react-aria-components 3.0.0-nightly-3f44370de-241118 → 3.0.0-nightly-b3a4d6c11-241119

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.
Files changed (133) hide show
  1. package/dist/Breadcrumbs.main.js +2 -2
  2. package/dist/Breadcrumbs.main.js.map +1 -1
  3. package/dist/Breadcrumbs.mjs +2 -2
  4. package/dist/Breadcrumbs.module.js +2 -2
  5. package/dist/Breadcrumbs.module.js.map +1 -1
  6. package/dist/Button.main.js.map +1 -1
  7. package/dist/Button.module.js.map +1 -1
  8. package/dist/Collection.main.js.map +1 -1
  9. package/dist/Collection.module.js.map +1 -1
  10. package/dist/ComboBox.main.js +2 -2
  11. package/dist/ComboBox.main.js.map +1 -1
  12. package/dist/ComboBox.mjs +2 -2
  13. package/dist/ComboBox.module.js +2 -2
  14. package/dist/ComboBox.module.js.map +1 -1
  15. package/dist/Dialog.main.js +22 -1
  16. package/dist/Dialog.main.js.map +1 -1
  17. package/dist/Dialog.mjs +23 -2
  18. package/dist/Dialog.module.js +23 -2
  19. package/dist/Dialog.module.js.map +1 -1
  20. package/dist/Disclosure.main.js +1 -1
  21. package/dist/Disclosure.main.js.map +1 -1
  22. package/dist/Disclosure.mjs +1 -1
  23. package/dist/Disclosure.module.js +1 -1
  24. package/dist/Disclosure.module.js.map +1 -1
  25. package/dist/Heading.main.js.map +1 -1
  26. package/dist/Heading.module.js.map +1 -1
  27. package/dist/Menu.main.js +7 -45
  28. package/dist/Menu.main.js.map +1 -1
  29. package/dist/Menu.mjs +9 -47
  30. package/dist/Menu.module.js +9 -47
  31. package/dist/Menu.module.js.map +1 -1
  32. package/dist/OverlayArrow.main.js +1 -1
  33. package/dist/OverlayArrow.main.js.map +1 -1
  34. package/dist/OverlayArrow.mjs +1 -1
  35. package/dist/OverlayArrow.module.js +1 -1
  36. package/dist/OverlayArrow.module.js.map +1 -1
  37. package/dist/Popover.main.js +1 -0
  38. package/dist/Popover.main.js.map +1 -1
  39. package/dist/Popover.mjs +1 -0
  40. package/dist/Popover.module.js +1 -0
  41. package/dist/Popover.module.js.map +1 -1
  42. package/dist/Table.main.js +2 -10
  43. package/dist/Table.main.js.map +1 -1
  44. package/dist/Table.mjs +2 -10
  45. package/dist/Table.module.js +2 -10
  46. package/dist/Table.module.js.map +1 -1
  47. package/dist/Tooltip.main.js +1 -1
  48. package/dist/Tooltip.main.js.map +1 -1
  49. package/dist/Tooltip.mjs +1 -1
  50. package/dist/Tooltip.module.js +1 -1
  51. package/dist/Tooltip.module.js.map +1 -1
  52. package/dist/Virtualizer.main.js.map +1 -1
  53. package/dist/Virtualizer.module.js.map +1 -1
  54. package/dist/types.d.ts +107 -107
  55. package/dist/types.d.ts.map +1 -1
  56. package/i18n/ar-AE.js +1 -1
  57. package/i18n/ar-AE.mjs +1 -1
  58. package/i18n/bg-BG.js +1 -1
  59. package/i18n/bg-BG.mjs +1 -1
  60. package/i18n/cs-CZ.js +1 -1
  61. package/i18n/cs-CZ.mjs +1 -1
  62. package/i18n/da-DK.js +1 -1
  63. package/i18n/da-DK.mjs +1 -1
  64. package/i18n/de-DE.js +1 -1
  65. package/i18n/de-DE.mjs +1 -1
  66. package/i18n/el-GR.js +1 -1
  67. package/i18n/el-GR.mjs +1 -1
  68. package/i18n/en-US.js +1 -1
  69. package/i18n/en-US.mjs +1 -1
  70. package/i18n/es-ES.js +1 -1
  71. package/i18n/es-ES.mjs +1 -1
  72. package/i18n/et-EE.js +1 -1
  73. package/i18n/et-EE.mjs +1 -1
  74. package/i18n/fi-FI.js +1 -1
  75. package/i18n/fi-FI.mjs +1 -1
  76. package/i18n/fr-FR.js +1 -1
  77. package/i18n/fr-FR.mjs +1 -1
  78. package/i18n/he-IL.js +1 -1
  79. package/i18n/he-IL.mjs +1 -1
  80. package/i18n/hr-HR.js +1 -1
  81. package/i18n/hr-HR.mjs +1 -1
  82. package/i18n/hu-HU.js +1 -1
  83. package/i18n/hu-HU.mjs +1 -1
  84. package/i18n/it-IT.js +1 -1
  85. package/i18n/it-IT.mjs +1 -1
  86. package/i18n/ja-JP.js +1 -1
  87. package/i18n/ja-JP.mjs +1 -1
  88. package/i18n/ko-KR.js +1 -1
  89. package/i18n/ko-KR.mjs +1 -1
  90. package/i18n/lt-LT.js +1 -1
  91. package/i18n/lt-LT.mjs +1 -1
  92. package/i18n/lv-LV.js +1 -1
  93. package/i18n/lv-LV.mjs +1 -1
  94. package/i18n/nb-NO.js +1 -1
  95. package/i18n/nb-NO.mjs +1 -1
  96. package/i18n/nl-NL.js +1 -1
  97. package/i18n/nl-NL.mjs +1 -1
  98. package/i18n/pl-PL.js +1 -1
  99. package/i18n/pl-PL.mjs +1 -1
  100. package/i18n/pt-BR.js +1 -1
  101. package/i18n/pt-BR.mjs +1 -1
  102. package/i18n/pt-PT.js +1 -1
  103. package/i18n/pt-PT.mjs +1 -1
  104. package/i18n/ro-RO.js +1 -1
  105. package/i18n/ro-RO.mjs +1 -1
  106. package/i18n/ru-RU.js +1 -1
  107. package/i18n/ru-RU.mjs +1 -1
  108. package/i18n/sk-SK.js +1 -1
  109. package/i18n/sk-SK.mjs +1 -1
  110. package/i18n/sl-SI.js +1 -1
  111. package/i18n/sl-SI.mjs +1 -1
  112. package/i18n/sr-SP.js +1 -1
  113. package/i18n/sr-SP.mjs +1 -1
  114. package/i18n/sv-SE.js +1 -1
  115. package/i18n/sv-SE.mjs +1 -1
  116. package/i18n/tr-TR.js +1 -1
  117. package/i18n/tr-TR.mjs +1 -1
  118. package/i18n/uk-UA.js +1 -1
  119. package/i18n/uk-UA.mjs +1 -1
  120. package/i18n/zh-CN.js +1 -1
  121. package/i18n/zh-CN.mjs +1 -1
  122. package/i18n/zh-TW.js +1 -1
  123. package/i18n/zh-TW.mjs +1 -1
  124. package/package.json +32 -33
  125. package/src/Collection.tsx +1 -1
  126. package/src/Dialog.tsx +15 -2
  127. package/src/Disclosure.tsx +1 -1
  128. package/src/Menu.tsx +7 -33
  129. package/src/OverlayArrow.tsx +5 -3
  130. package/src/Popover.tsx +2 -2
  131. package/src/Table.tsx +1 -2
  132. package/src/Tooltip.tsx +2 -2
  133. package/src/Virtualizer.tsx +2 -2
@@ -42,9 +42,9 @@ function $afa44b644f65ed30$var$Breadcrumbs(props, ref) {
42
42
  let { navProps: navProps } = (0, $l7mU3$reactaria.useBreadcrumbs)(props);
43
43
  return /*#__PURE__*/ (0, ($parcel$interopDefault($l7mU3$react))).createElement((0, $l7mU3$reactariacollections.CollectionBuilder), {
44
44
  content: /*#__PURE__*/ (0, ($parcel$interopDefault($l7mU3$react))).createElement((0, $l7mU3$reactariacollections.Collection), props)
45
- }, (collection)=>/*#__PURE__*/ {
45
+ }, (collection)=>{
46
46
  var _props_className;
47
- return (0, ($parcel$interopDefault($l7mU3$react))).createElement("ol", {
47
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($l7mU3$react))).createElement("ol", {
48
48
  ref: ref,
49
49
  ...navProps,
50
50
  slot: props.slot || undefined,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAkBM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAyD;AAEvG,SAAS,kCAA8B,KAA0B,EAAE,GAAmC;IACpG,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,mDAAwB;IAC1D,IAAI,YAAC,QAAQ,EAAC,GAAG,CAAA,GAAA,+BAAa,EAAE;IAEhC,qBACE,0DAAC,CAAA,GAAA,6CAAgB;QAAE,uBAAS,0DAAC,CAAA,GAAA,sCAAS,GAAM;OACzC,CAAA;YAMc;eALb,0DAAC;YACC,KAAK;YACJ,GAAG,QAAQ;YACZ,MAAM,MAAM,IAAI,IAAI;YACpB,OAAO,MAAM,KAAK;YAClB,WAAW,CAAA,mBAAA,MAAM,SAAS,cAAf,8BAAA,mBAAmB;yBAC9B,0DAAC,0CAAmB,QAAQ;YAAC,OAAO;yBAClC,0DAAC;YAAe,YAAY;;IAE5B;AAIZ;AAEA;;CAEC,GACD,MAAM,2CAA6B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB;AAwB3D,MAAM,4CAAa,WAAW,GAAG,CAAA,GAAA,+CAAkB,EAAE,QAAQ,SAAS,WAAW,KAAsB,EAAE,GAAgC,EAAE,IAAmB;IACnK,sGAAsG;IACtG,IAAI,YAAY,KAAK,OAAO,IAAI;IAChC,IAAI,cAAC,UAAU,YAAE,QAAQ,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE;IAC/C,IAAI,YAAY;QACd,gBAAgB,YAAY,SAAS;QACrC,YAAY,cAAc;QAC1B,SAAS,IAAM,qBAAA,+BAAA,SAAW,KAAK,GAAG;IACpC;IAEA,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK,KAAK;QACb,UAAU,KAAK,QAAQ;QACvB,QAAQ;YAAC,YAAY,cAAc;uBAAW;QAAS;QACvD,kBAAkB;IACpB;IAEA,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,oCAAa,EAAE,MAAa;QAC/B,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,cAAc,aAAa;QAC1C,gBAAc,aAAa;qBAC3B,0DAAC,CAAA,GAAA,qCAAU,EAAE,QAAQ;QAAC,OAAO;OAC1B,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Breadcrumbs.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 */\nimport {AriaBreadcrumbsProps, useBreadcrumbs} from 'react-aria';\nimport {Collection, CollectionBuilder, createLeafComponent} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext} from './Collection';\nimport {ContextValue, RenderProps, SlotProps, StyleProps, useContextProps, useRenderProps, useSlottedContext} from './utils';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {forwardRefType, Key} from '@react-types/shared';\nimport {LinkContext} from './Link';\nimport {Node} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, useContext} from 'react';\n\nexport interface BreadcrumbsProps<T> extends Omit<CollectionProps<T>, 'disabledKeys'>, AriaBreadcrumbsProps, StyleProps, SlotProps {\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean,\n /** Handler that is called when a breadcrumb is clicked. */\n onAction?: (key: Key) => void\n}\n\nexport const BreadcrumbsContext = createContext<ContextValue<BreadcrumbsProps<any>, HTMLOListElement>>(null);\n\nfunction Breadcrumbs<T extends object>(props: BreadcrumbsProps<T>, ref: ForwardedRef<HTMLOListElement>) {\n [props, ref] = useContextProps(props, ref, BreadcrumbsContext);\n let {CollectionRoot} = useContext(CollectionRendererContext);\n let {navProps} = useBreadcrumbs(props);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => (\n <ol\n ref={ref}\n {...navProps}\n slot={props.slot || undefined}\n style={props.style}\n className={props.className ?? 'react-aria-Breadcrumbs'}>\n <BreadcrumbsContext.Provider value={props}>\n <CollectionRoot collection={collection} />\n </BreadcrumbsContext.Provider>\n </ol>\n )}\n </CollectionBuilder>\n );\n}\n\n/**\n * Breadcrumbs display a hierarchy of links to the current page or resource in an application.\n */\nconst _Breadcrumbs = /*#__PURE__*/ (forwardRef as forwardRefType)(Breadcrumbs);\nexport {_Breadcrumbs as Breadcrumbs};\n\nexport interface BreadcrumbRenderProps {\n /**\n * Whether the breadcrumb is for the current page.\n * @selector [data-current]\n */\n isCurrent: boolean,\n /**\n * Whether the breadcrumb is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean\n}\n\nexport interface BreadcrumbProps extends RenderProps<BreadcrumbRenderProps> {\n /** A unique id for the breadcrumb, which will be passed to `onAction` when the breadcrumb is pressed. */\n id?: Key\n}\n\n/**\n * A Breadcrumb represents an individual item in a `<Breadcrumbs>` list.\n */\nexport const Breadcrumb = /*#__PURE__*/ createLeafComponent('item', function Breadcrumb(props: BreadcrumbProps, ref: ForwardedRef<HTMLLIElement>, node: Node<unknown>) {\n // Recreating useBreadcrumbItem because we want to use composition instead of having the link builtin.\n let isCurrent = node.nextKey == null;\n let {isDisabled, onAction} = useSlottedContext(BreadcrumbsContext)!;\n let linkProps = {\n 'aria-current': isCurrent ? 'page' : null,\n isDisabled: isDisabled || isCurrent,\n onPress: () => onAction?.(node.key)\n };\n\n let renderProps = useRenderProps({\n ...node.props,\n children: node.rendered,\n values: {isDisabled: isDisabled || isCurrent, isCurrent},\n defaultClassName: 'react-aria-Breadcrumb'\n });\n\n return (\n <li\n {...filterDOMProps(props as any)}\n {...renderProps}\n ref={ref}\n data-disabled={isDisabled || isCurrent || undefined}\n data-current={isCurrent || undefined}>\n <LinkContext.Provider value={linkProps}>\n {renderProps.children}\n </LinkContext.Provider>\n </li>\n );\n});\n"],"names":[],"version":3,"file":"Breadcrumbs.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAkBM,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAAyD;AAEvG,SAAS,kCAA8B,KAA0B,EAAE,GAAmC;IACpG,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,mDAAwB;IAC1D,IAAI,YAAC,QAAQ,EAAC,GAAG,CAAA,GAAA,+BAAa,EAAE;IAEhC,qBACE,0DAAC,CAAA,GAAA,6CAAgB;QAAE,uBAAS,0DAAC,CAAA,GAAA,sCAAS,GAAM;OACzC,CAAA;YAMc;6BALb,0DAAC;YACC,KAAK;YACJ,GAAG,QAAQ;YACZ,MAAM,MAAM,IAAI,IAAI;YACpB,OAAO,MAAM,KAAK;YAClB,WAAW,CAAA,mBAAA,MAAM,SAAS,cAAf,8BAAA,mBAAmB;yBAC9B,0DAAC,0CAAmB,QAAQ;YAAC,OAAO;yBAClC,0DAAC;YAAe,YAAY;;;AAMxC;AAEA;;CAEC,GACD,MAAM,2CAA6B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB;AAwB3D,MAAM,4CAAa,WAAW,GAAG,CAAA,GAAA,+CAAkB,EAAE,QAAQ,SAAS,WAAW,KAAsB,EAAE,GAAgC,EAAE,IAAmB;IACnK,sGAAsG;IACtG,IAAI,YAAY,KAAK,OAAO,IAAI;IAChC,IAAI,cAAC,UAAU,YAAE,QAAQ,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE;IAC/C,IAAI,YAAY;QACd,gBAAgB,YAAY,SAAS;QACrC,YAAY,cAAc;QAC1B,SAAS,IAAM,qBAAA,+BAAA,SAAW,KAAK,GAAG;IACpC;IAEA,IAAI,cAAc,CAAA,GAAA,wCAAa,EAAE;QAC/B,GAAG,KAAK,KAAK;QACb,UAAU,KAAK,QAAQ;QACvB,QAAQ;YAAC,YAAY,cAAc;uBAAW;QAAS;QACvD,kBAAkB;IACpB;IAEA,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,oCAAa,EAAE,MAAa;QAC/B,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,cAAc,aAAa;QAC1C,gBAAc,aAAa;qBAC3B,0DAAC,CAAA,GAAA,qCAAU,EAAE,QAAQ;QAAC,OAAO;OAC1B,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Breadcrumbs.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 */\nimport {AriaBreadcrumbsProps, useBreadcrumbs} from 'react-aria';\nimport {Collection, CollectionBuilder, createLeafComponent} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext} from './Collection';\nimport {ContextValue, RenderProps, SlotProps, StyleProps, useContextProps, useRenderProps, useSlottedContext} from './utils';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {forwardRefType, Key} from '@react-types/shared';\nimport {LinkContext} from './Link';\nimport {Node} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, useContext} from 'react';\n\nexport interface BreadcrumbsProps<T> extends Omit<CollectionProps<T>, 'disabledKeys'>, AriaBreadcrumbsProps, StyleProps, SlotProps {\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean,\n /** Handler that is called when a breadcrumb is clicked. */\n onAction?: (key: Key) => void\n}\n\nexport const BreadcrumbsContext = createContext<ContextValue<BreadcrumbsProps<any>, HTMLOListElement>>(null);\n\nfunction Breadcrumbs<T extends object>(props: BreadcrumbsProps<T>, ref: ForwardedRef<HTMLOListElement>) {\n [props, ref] = useContextProps(props, ref, BreadcrumbsContext);\n let {CollectionRoot} = useContext(CollectionRendererContext);\n let {navProps} = useBreadcrumbs(props);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => (\n <ol\n ref={ref}\n {...navProps}\n slot={props.slot || undefined}\n style={props.style}\n className={props.className ?? 'react-aria-Breadcrumbs'}>\n <BreadcrumbsContext.Provider value={props}>\n <CollectionRoot collection={collection} />\n </BreadcrumbsContext.Provider>\n </ol>\n )}\n </CollectionBuilder>\n );\n}\n\n/**\n * Breadcrumbs display a hierarchy of links to the current page or resource in an application.\n */\nconst _Breadcrumbs = /*#__PURE__*/ (forwardRef as forwardRefType)(Breadcrumbs);\nexport {_Breadcrumbs as Breadcrumbs};\n\nexport interface BreadcrumbRenderProps {\n /**\n * Whether the breadcrumb is for the current page.\n * @selector [data-current]\n */\n isCurrent: boolean,\n /**\n * Whether the breadcrumb is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean\n}\n\nexport interface BreadcrumbProps extends RenderProps<BreadcrumbRenderProps> {\n /** A unique id for the breadcrumb, which will be passed to `onAction` when the breadcrumb is pressed. */\n id?: Key\n}\n\n/**\n * A Breadcrumb represents an individual item in a `<Breadcrumbs>` list.\n */\nexport const Breadcrumb = /*#__PURE__*/ createLeafComponent('item', function Breadcrumb(props: BreadcrumbProps, ref: ForwardedRef<HTMLLIElement>, node: Node<unknown>) {\n // Recreating useBreadcrumbItem because we want to use composition instead of having the link builtin.\n let isCurrent = node.nextKey == null;\n let {isDisabled, onAction} = useSlottedContext(BreadcrumbsContext)!;\n let linkProps = {\n 'aria-current': isCurrent ? 'page' : null,\n isDisabled: isDisabled || isCurrent,\n onPress: () => onAction?.(node.key)\n };\n\n let renderProps = useRenderProps({\n ...node.props,\n children: node.rendered,\n values: {isDisabled: isDisabled || isCurrent, isCurrent},\n defaultClassName: 'react-aria-Breadcrumb'\n });\n\n return (\n <li\n {...filterDOMProps(props as any)}\n {...renderProps}\n ref={ref}\n data-disabled={isDisabled || isCurrent || undefined}\n data-current={isCurrent || undefined}>\n <LinkContext.Provider value={linkProps}>\n {renderProps.children}\n </LinkContext.Provider>\n </li>\n );\n});\n"],"names":[],"version":3,"file":"Breadcrumbs.main.js.map"}
@@ -30,9 +30,9 @@ function $778035c5624f61e7$var$Breadcrumbs(props, ref) {
30
30
  let { navProps: navProps } = (0, $c5cc5$useBreadcrumbs)(props);
31
31
  return /*#__PURE__*/ (0, $c5cc5$react).createElement((0, $c5cc5$CollectionBuilder), {
32
32
  content: /*#__PURE__*/ (0, $c5cc5$react).createElement((0, $c5cc5$Collection), props)
33
- }, (collection)=>/*#__PURE__*/ {
33
+ }, (collection)=>{
34
34
  var _props_className;
35
- return (0, $c5cc5$react).createElement("ol", {
35
+ return /*#__PURE__*/ (0, $c5cc5$react).createElement("ol", {
36
36
  ref: ref,
37
37
  ...navProps,
38
38
  slot: props.slot || undefined,
@@ -30,9 +30,9 @@ function $778035c5624f61e7$var$Breadcrumbs(props, ref) {
30
30
  let { navProps: navProps } = (0, $c5cc5$useBreadcrumbs)(props);
31
31
  return /*#__PURE__*/ (0, $c5cc5$react).createElement((0, $c5cc5$CollectionBuilder), {
32
32
  content: /*#__PURE__*/ (0, $c5cc5$react).createElement((0, $c5cc5$Collection), props)
33
- }, (collection)=>/*#__PURE__*/ {
33
+ }, (collection)=>{
34
34
  var _props_className;
35
- return (0, $c5cc5$react).createElement("ol", {
35
+ return /*#__PURE__*/ (0, $c5cc5$react).createElement("ol", {
36
36
  ref: ref,
37
37
  ...navProps,
38
38
  slot: props.slot || undefined,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAkBM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAAyD;AAEvG,SAAS,kCAA8B,KAA0B,EAAE,GAAmC;IACpG,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAwB;IAC1D,IAAI,YAAC,QAAQ,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;IAEhC,qBACE,gCAAC,CAAA,GAAA,wBAAgB;QAAE,uBAAS,gCAAC,CAAA,GAAA,iBAAS,GAAM;OACzC,CAAA;YAMc;eALb,gCAAC;YACC,KAAK;YACJ,GAAG,QAAQ;YACZ,MAAM,MAAM,IAAI,IAAI;YACpB,OAAO,MAAM,KAAK;YAClB,WAAW,CAAA,mBAAA,MAAM,SAAS,cAAf,8BAAA,mBAAmB;yBAC9B,gCAAC,0CAAmB,QAAQ;YAAC,OAAO;yBAClC,gCAAC;YAAe,YAAY;;IAE5B;AAIZ;AAEA;;CAEC,GACD,MAAM,2CAA6B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB;AAwB3D,MAAM,4CAAa,WAAW,GAAG,CAAA,GAAA,0BAAkB,EAAE,QAAQ,SAAS,WAAW,KAAsB,EAAE,GAAgC,EAAE,IAAmB;IACnK,sGAAsG;IACtG,IAAI,YAAY,KAAK,OAAO,IAAI;IAChC,IAAI,cAAC,UAAU,YAAE,QAAQ,EAAC,GAAG,CAAA,GAAA,yCAAgB,EAAE;IAC/C,IAAI,YAAY;QACd,gBAAgB,YAAY,SAAS;QACrC,YAAY,cAAc;QAC1B,SAAS,IAAM,qBAAA,+BAAA,SAAW,KAAK,GAAG;IACpC;IAEA,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK,KAAK;QACb,UAAU,KAAK,QAAQ;QACvB,QAAQ;YAAC,YAAY,cAAc;uBAAW;QAAS;QACvD,kBAAkB;IACpB;IAEA,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,qBAAa,EAAE,MAAa;QAC/B,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,cAAc,aAAa;QAC1C,gBAAc,aAAa;qBAC3B,gCAAC,CAAA,GAAA,yCAAU,EAAE,QAAQ;QAAC,OAAO;OAC1B,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Breadcrumbs.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 */\nimport {AriaBreadcrumbsProps, useBreadcrumbs} from 'react-aria';\nimport {Collection, CollectionBuilder, createLeafComponent} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext} from './Collection';\nimport {ContextValue, RenderProps, SlotProps, StyleProps, useContextProps, useRenderProps, useSlottedContext} from './utils';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {forwardRefType, Key} from '@react-types/shared';\nimport {LinkContext} from './Link';\nimport {Node} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, useContext} from 'react';\n\nexport interface BreadcrumbsProps<T> extends Omit<CollectionProps<T>, 'disabledKeys'>, AriaBreadcrumbsProps, StyleProps, SlotProps {\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean,\n /** Handler that is called when a breadcrumb is clicked. */\n onAction?: (key: Key) => void\n}\n\nexport const BreadcrumbsContext = createContext<ContextValue<BreadcrumbsProps<any>, HTMLOListElement>>(null);\n\nfunction Breadcrumbs<T extends object>(props: BreadcrumbsProps<T>, ref: ForwardedRef<HTMLOListElement>) {\n [props, ref] = useContextProps(props, ref, BreadcrumbsContext);\n let {CollectionRoot} = useContext(CollectionRendererContext);\n let {navProps} = useBreadcrumbs(props);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => (\n <ol\n ref={ref}\n {...navProps}\n slot={props.slot || undefined}\n style={props.style}\n className={props.className ?? 'react-aria-Breadcrumbs'}>\n <BreadcrumbsContext.Provider value={props}>\n <CollectionRoot collection={collection} />\n </BreadcrumbsContext.Provider>\n </ol>\n )}\n </CollectionBuilder>\n );\n}\n\n/**\n * Breadcrumbs display a hierarchy of links to the current page or resource in an application.\n */\nconst _Breadcrumbs = /*#__PURE__*/ (forwardRef as forwardRefType)(Breadcrumbs);\nexport {_Breadcrumbs as Breadcrumbs};\n\nexport interface BreadcrumbRenderProps {\n /**\n * Whether the breadcrumb is for the current page.\n * @selector [data-current]\n */\n isCurrent: boolean,\n /**\n * Whether the breadcrumb is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean\n}\n\nexport interface BreadcrumbProps extends RenderProps<BreadcrumbRenderProps> {\n /** A unique id for the breadcrumb, which will be passed to `onAction` when the breadcrumb is pressed. */\n id?: Key\n}\n\n/**\n * A Breadcrumb represents an individual item in a `<Breadcrumbs>` list.\n */\nexport const Breadcrumb = /*#__PURE__*/ createLeafComponent('item', function Breadcrumb(props: BreadcrumbProps, ref: ForwardedRef<HTMLLIElement>, node: Node<unknown>) {\n // Recreating useBreadcrumbItem because we want to use composition instead of having the link builtin.\n let isCurrent = node.nextKey == null;\n let {isDisabled, onAction} = useSlottedContext(BreadcrumbsContext)!;\n let linkProps = {\n 'aria-current': isCurrent ? 'page' : null,\n isDisabled: isDisabled || isCurrent,\n onPress: () => onAction?.(node.key)\n };\n\n let renderProps = useRenderProps({\n ...node.props,\n children: node.rendered,\n values: {isDisabled: isDisabled || isCurrent, isCurrent},\n defaultClassName: 'react-aria-Breadcrumb'\n });\n\n return (\n <li\n {...filterDOMProps(props as any)}\n {...renderProps}\n ref={ref}\n data-disabled={isDisabled || isCurrent || undefined}\n data-current={isCurrent || undefined}>\n <LinkContext.Provider value={linkProps}>\n {renderProps.children}\n </LinkContext.Provider>\n </li>\n );\n});\n"],"names":[],"version":3,"file":"Breadcrumbs.module.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AAkBM,MAAM,0DAAqB,CAAA,GAAA,oBAAY,EAAyD;AAEvG,SAAS,kCAA8B,KAA0B,EAAE,GAAmC;IACpG,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAwB;IAC1D,IAAI,YAAC,QAAQ,EAAC,GAAG,CAAA,GAAA,qBAAa,EAAE;IAEhC,qBACE,gCAAC,CAAA,GAAA,wBAAgB;QAAE,uBAAS,gCAAC,CAAA,GAAA,iBAAS,GAAM;OACzC,CAAA;YAMc;6BALb,gCAAC;YACC,KAAK;YACJ,GAAG,QAAQ;YACZ,MAAM,MAAM,IAAI,IAAI;YACpB,OAAO,MAAM,KAAK;YAClB,WAAW,CAAA,mBAAA,MAAM,SAAS,cAAf,8BAAA,mBAAmB;yBAC9B,gCAAC,0CAAmB,QAAQ;YAAC,OAAO;yBAClC,gCAAC;YAAe,YAAY;;;AAMxC;AAEA;;CAEC,GACD,MAAM,2CAA6B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB;AAwB3D,MAAM,4CAAa,WAAW,GAAG,CAAA,GAAA,0BAAkB,EAAE,QAAQ,SAAS,WAAW,KAAsB,EAAE,GAAgC,EAAE,IAAmB;IACnK,sGAAsG;IACtG,IAAI,YAAY,KAAK,OAAO,IAAI;IAChC,IAAI,cAAC,UAAU,YAAE,QAAQ,EAAC,GAAG,CAAA,GAAA,yCAAgB,EAAE;IAC/C,IAAI,YAAY;QACd,gBAAgB,YAAY,SAAS;QACrC,YAAY,cAAc;QAC1B,SAAS,IAAM,qBAAA,+BAAA,SAAW,KAAK,GAAG;IACpC;IAEA,IAAI,cAAc,CAAA,GAAA,uCAAa,EAAE;QAC/B,GAAG,KAAK,KAAK;QACb,UAAU,KAAK,QAAQ;QACvB,QAAQ;YAAC,YAAY,cAAc;uBAAW;QAAS;QACvD,kBAAkB;IACpB;IAEA,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,qBAAa,EAAE,MAAa;QAC/B,GAAG,WAAW;QACf,KAAK;QACL,iBAAe,cAAc,aAAa;QAC1C,gBAAc,aAAa;qBAC3B,gCAAC,CAAA,GAAA,yCAAU,EAAE,QAAQ;QAAC,OAAO;OAC1B,YAAY,QAAQ;AAI7B","sources":["packages/react-aria-components/src/Breadcrumbs.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 */\nimport {AriaBreadcrumbsProps, useBreadcrumbs} from 'react-aria';\nimport {Collection, CollectionBuilder, createLeafComponent} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext} from './Collection';\nimport {ContextValue, RenderProps, SlotProps, StyleProps, useContextProps, useRenderProps, useSlottedContext} from './utils';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {forwardRefType, Key} from '@react-types/shared';\nimport {LinkContext} from './Link';\nimport {Node} from 'react-stately';\nimport React, {createContext, ForwardedRef, forwardRef, useContext} from 'react';\n\nexport interface BreadcrumbsProps<T> extends Omit<CollectionProps<T>, 'disabledKeys'>, AriaBreadcrumbsProps, StyleProps, SlotProps {\n /** Whether the breadcrumbs are disabled. */\n isDisabled?: boolean,\n /** Handler that is called when a breadcrumb is clicked. */\n onAction?: (key: Key) => void\n}\n\nexport const BreadcrumbsContext = createContext<ContextValue<BreadcrumbsProps<any>, HTMLOListElement>>(null);\n\nfunction Breadcrumbs<T extends object>(props: BreadcrumbsProps<T>, ref: ForwardedRef<HTMLOListElement>) {\n [props, ref] = useContextProps(props, ref, BreadcrumbsContext);\n let {CollectionRoot} = useContext(CollectionRendererContext);\n let {navProps} = useBreadcrumbs(props);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => (\n <ol\n ref={ref}\n {...navProps}\n slot={props.slot || undefined}\n style={props.style}\n className={props.className ?? 'react-aria-Breadcrumbs'}>\n <BreadcrumbsContext.Provider value={props}>\n <CollectionRoot collection={collection} />\n </BreadcrumbsContext.Provider>\n </ol>\n )}\n </CollectionBuilder>\n );\n}\n\n/**\n * Breadcrumbs display a hierarchy of links to the current page or resource in an application.\n */\nconst _Breadcrumbs = /*#__PURE__*/ (forwardRef as forwardRefType)(Breadcrumbs);\nexport {_Breadcrumbs as Breadcrumbs};\n\nexport interface BreadcrumbRenderProps {\n /**\n * Whether the breadcrumb is for the current page.\n * @selector [data-current]\n */\n isCurrent: boolean,\n /**\n * Whether the breadcrumb is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean\n}\n\nexport interface BreadcrumbProps extends RenderProps<BreadcrumbRenderProps> {\n /** A unique id for the breadcrumb, which will be passed to `onAction` when the breadcrumb is pressed. */\n id?: Key\n}\n\n/**\n * A Breadcrumb represents an individual item in a `<Breadcrumbs>` list.\n */\nexport const Breadcrumb = /*#__PURE__*/ createLeafComponent('item', function Breadcrumb(props: BreadcrumbProps, ref: ForwardedRef<HTMLLIElement>, node: Node<unknown>) {\n // Recreating useBreadcrumbItem because we want to use composition instead of having the link builtin.\n let isCurrent = node.nextKey == null;\n let {isDisabled, onAction} = useSlottedContext(BreadcrumbsContext)!;\n let linkProps = {\n 'aria-current': isCurrent ? 'page' : null,\n isDisabled: isDisabled || isCurrent,\n onPress: () => onAction?.(node.key)\n };\n\n let renderProps = useRenderProps({\n ...node.props,\n children: node.rendered,\n values: {isDisabled: isDisabled || isCurrent, isCurrent},\n defaultClassName: 'react-aria-Breadcrumb'\n });\n\n return (\n <li\n {...filterDOMProps(props as any)}\n {...renderProps}\n ref={ref}\n data-disabled={isDisabled || isCurrent || undefined}\n data-current={isCurrent || undefined}>\n <LinkContext.Provider value={linkProps}>\n {renderProps.children}\n </LinkContext.Provider>\n </li>\n );\n});\n"],"names":[],"version":3,"file":"Breadcrumbs.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA2FD,MAAM,uDAAiC,IAAI,IAAI;IAAC;IAAQ;IAAc;IAAe;IAAc;IAAkB;IAAc;IAAQ;CAAQ;AAE5I,MAAM,0DAAgB,CAAA,GAAA,0BAAY,EAAuD,CAAC;AAEjG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IAAI,aAAa,WACtC,CAAA,GAAA,sCAAO,EAAE,SAAS;aACb,IAAI,WAAW,OAAO,IAAI,aAAa,CAAC,WAC7C,CAAA,GAAA,sCAAO,EAAE,SAAS;QAEpB,WAAW,OAAO,GAAG;IACvB,GAAG;QAAC;QAAW;QAAW;QAAgB;KAAS;IAEnD,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,oCAAa,EAAE,OAAO;YAAC,WAAW;QAA8B,EAAE;QACrE,GAAG,CAAA,GAAA,2BAAS,EAAE,aAAa,YAAY,WAAW;QAClD,GAAG,WAAW;QACf,IAAI;QACJ,KAAK;QACL,mBAAiB;QACjB,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,YAAY,SAAS,WAAW,CAAC,gBAAgB;QAChE,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,aAAa,SAAS,IAAI;QACxC,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;qBACtC,0DAAC,CAAA,GAAA,4CAAiB,EAAE,QAAQ;QAAC,OAAO;YAAC,IAAI;QAAU;OAChD,YAAY,QAAQ;AAI7B;AAEA,SAAS,0CAAoB,KAAK;IAChC,kDAAkD;IAClD,IAAI,MAAM,SAAS,EAAE;QACnB,MAAM,OAAO,GAAG;QAChB,MAAM,YAAY,GAAG;QACrB,MAAM,UAAU,GAAG;QACnB,MAAM,aAAa,GAAG;QACtB,MAAM,SAAS,GAAG;QAClB,MAAM,SAAS,GAAG;QAClB,MAAM,OAAO,GAAG;QAChB,MAAM,OAAO,GAAG;QAChB,MAAM,IAAI,GAAG;IACf;IACA,OAAO;AACT;AAEA;;CAEC,GACD,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,mDAAsB,EAAE","sources":["packages/react-aria-components/src/Button.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 {announce} from '@react-aria/live-announcer';\nimport {\n AriaButtonProps,\n HoverEvents,\n mergeProps,\n useButton,\n useFocusRing,\n useHover,\n useId\n} from 'react-aria';\nimport {\n ContextValue,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {createHideableComponent} from '@react-aria/collections';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {ProgressBarContext} from './ProgressBar';\nimport React, {createContext, ForwardedRef, useEffect, useRef} from 'react';\n\nexport interface ButtonRenderProps {\n /**\n * Whether the button is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the button is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the button is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the button is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the button is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the button is currently in a pending state.\n * @selector [data-pending]\n */\n isPending: boolean\n}\n\nexport interface ButtonProps extends Omit<AriaButtonProps, 'children' | 'href' | 'target' | 'rel' | 'elementType'>, HoverEvents, SlotProps, RenderProps<ButtonRenderProps> {\n /**\n * The `<form>` element to associate the button with.\n * The value of this attribute must be the id of a `<form>` in the same document.\n */\n form?: string,\n /**\n * The URL that processes the information submitted by the button.\n * Overrides the action attribute of the button's form owner.\n */\n formAction?: string,\n /** Indicates how to encode the form data that is submitted. */\n formEncType?: string,\n /** Indicates the HTTP method used to submit the form. */\n formMethod?: string,\n /** Indicates that the form is not to be validated when it is submitted. */\n formNoValidate?: boolean,\n /** Overrides the target attribute of the button's form owner. */\n formTarget?: string,\n /** Submitted as a pair with the button's value as part of the form data. */\n name?: string,\n /** The value associated with the button's name when it's submitted with the form data. */\n value?: string,\n /**\n * Whether the button is in a pending state. This disables press and hover events\n * while retaining focusability, and announces the pending state to screen readers.\n */\n isPending?: boolean\n}\n\ninterface ButtonContextValue extends ButtonProps {\n isPressed?: boolean\n}\n\nconst additionalButtonHTMLAttributes = new Set(['form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'name', 'value']);\n\nexport const ButtonContext = createContext<ContextValue<ButtonContextValue, HTMLButtonElement>>({});\n\nfunction Button(props: ButtonProps, ref: ForwardedRef<HTMLButtonElement>) {\n [props, ref] = useContextProps(props, ref, ButtonContext);\n props = disablePendingProps(props);\n let ctx = props as ButtonContextValue;\n let {isPending} = ctx;\n let {buttonProps, isPressed} = useButton(props, ref);\n let {focusProps, isFocused, isFocusVisible} = useFocusRing(props);\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: props.isDisabled || isPending\n });\n let renderValues = {\n isHovered,\n isPressed: (ctx.isPressed || isPressed) && !isPending,\n isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isPending: isPending ?? false\n };\n\n let renderProps = useRenderProps({\n ...props,\n values: renderValues,\n defaultClassName: 'react-aria-Button'\n });\n\n let buttonId = useId(buttonProps.id);\n let progressId = useId();\n\n let ariaLabelledby = buttonProps['aria-labelledby'];\n if (isPending) {\n // aria-labelledby wins over aria-label\n // https://www.w3.org/TR/accname-1.2/#computation-steps\n if (ariaLabelledby) {\n ariaLabelledby = `${ariaLabelledby} ${progressId}`;\n } else if (buttonProps['aria-label']) {\n ariaLabelledby = `${buttonId} ${progressId}`;\n }\n }\n\n let wasPending = useRef(isPending);\n useEffect(() => {\n let message = {'aria-labelledby': ariaLabelledby || buttonId};\n if (!wasPending.current && isFocused && isPending) {\n announce(message, 'assertive');\n } else if (wasPending.current && isFocused && !isPending) {\n announce(message, 'assertive');\n }\n wasPending.current = isPending;\n }, [isPending, isFocused, ariaLabelledby, buttonId]);\n\n return (\n <button\n {...filterDOMProps(props, {propNames: additionalButtonHTMLAttributes})}\n {...mergeProps(buttonProps, focusProps, hoverProps)}\n {...renderProps}\n id={buttonId}\n ref={ref}\n aria-labelledby={ariaLabelledby}\n slot={props.slot || undefined}\n aria-disabled={isPending ? 'true' : buttonProps['aria-disabled']}\n data-disabled={props.isDisabled || undefined}\n data-pressed={renderValues.isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-pending={isPending || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n <ProgressBarContext.Provider value={{id: progressId}}>\n {renderProps.children}\n </ProgressBarContext.Provider>\n </button>\n );\n}\n\nfunction disablePendingProps(props) {\n // Don't allow interaction while isPending is true\n if (props.isPending) {\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n props.onClick = undefined;\n props.href = undefined;\n }\n return props;\n}\n\n/**\n * A button allows a user to perform an action, with mouse, touch, and keyboard interactions.\n */\nconst _Button = /*#__PURE__*/ createHideableComponent(Button);\nexport {_Button as Button};\n"],"names":[],"version":3,"file":"Button.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA2FD,MAAM,uDAAiC,IAAI,IAAI;IAAC;IAAQ;IAAc;IAAe;IAAc;IAAkB;IAAc;IAAQ;CAAQ;AAE5I,MAAM,0DAAgB,CAAA,GAAA,0BAAY,EAAuD,CAAC;AAEjG,SAAS,6BAAO,KAAkB,EAAE,GAAoC;IACtE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,QAAQ,0CAAoB;IAC5B,IAAI,MAAM;IACV,IAAI,aAAC,SAAS,EAAC,GAAG;IAClB,IAAI,eAA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ACE,GAAG,CAAA,GAAA,oCAAa,EAAE,OAAO;YAAC,WAAW;QAA8B,EAAE;QACrE,GAAG,CAAA,GAAA,2BAAS,EAAE,aAAa,YAAY,WAAW;QAClD,GAAG,WAAW;QACf,IAAI;QACJ,KAAK;QACL,mBAAiB;QACjB,MAAM,MAAM,IAAI,IAAI;QACpB,iBAAe,YAAY,SAAS,WAAW,CAAC,gBAAgB;QAChE,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,aAAa,SAAS,IAAI;QACxC,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;qBACtC,0DAAC,CAAA,GAAA,4CAAiB,EAAE,QAAQ;QAAC,OAAO;YAAC,IAAI;QAAU;OAChD,YAAY,QAAQ;AAI7B;AAEA,SAAS,0CAAoB,KAAK;IAChC,kDAAkD;IAClD,IAAI,MAAM,SAAS,EAAE;QACnB,MAAM,OAAO,GAAG;QAChB,MAAM,YAAY,GAAG;QACrB,MAAM,UAAU,GAAG;QACnB,MAAM,aAAa,GAAG;QACtB,MAAM,SAAS,GAAG;QAClB,MAAM,SAAS,GAAG;QAClB,MAAM,OAAO,GAAG;QAChB,MAAM,OAAO,GAAG;QAChB,MAAM,IAAI,GAAG;IACf;IACA,OAAO;AACT;AAEA;;CAEC,GACD,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,mDAAsB,EAAE","sources":["packages/react-aria-components/src/Button.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 {announce} from '@react-aria/live-announcer';\nimport {\n AriaButtonProps,\n HoverEvents,\n mergeProps,\n useButton,\n useFocusRing,\n useHover,\n useId\n} from 'react-aria';\nimport {\n ContextValue,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {createHideableComponent} from '@react-aria/collections';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {ProgressBarContext} from './ProgressBar';\nimport React, {createContext, ForwardedRef, useEffect, useRef} from 'react';\n\nexport interface ButtonRenderProps {\n /**\n * Whether the button is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the button is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the button is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the button is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the button is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the button is currently in a pending state.\n * @selector [data-pending]\n */\n isPending: boolean\n}\n\nexport interface ButtonProps extends Omit<AriaButtonProps, 'children' | 'href' | 'target' | 'rel' | 'elementType'>, HoverEvents, SlotProps, RenderProps<ButtonRenderProps> {\n /**\n * The `<form>` element to associate the button with.\n * The value of this attribute must be the id of a `<form>` in the same document.\n */\n form?: string,\n /**\n * The URL that processes the information submitted by the button.\n * Overrides the action attribute of the button's form owner.\n */\n formAction?: string,\n /** Indicates how to encode the form data that is submitted. */\n formEncType?: string,\n /** Indicates the HTTP method used to submit the form. */\n formMethod?: string,\n /** Indicates that the form is not to be validated when it is submitted. */\n formNoValidate?: boolean,\n /** Overrides the target attribute of the button's form owner. */\n formTarget?: string,\n /** Submitted as a pair with the button's value as part of the form data. */\n name?: string,\n /** The value associated with the button's name when it's submitted with the form data. */\n value?: string,\n /**\n * Whether the button is in a pending state. This disables press and hover events\n * while retaining focusability, and announces the pending state to screen readers.\n */\n isPending?: boolean\n}\n\ninterface ButtonContextValue extends ButtonProps {\n isPressed?: boolean\n}\n\nconst additionalButtonHTMLAttributes = new Set(['form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'name', 'value']);\n\nexport const ButtonContext = createContext<ContextValue<ButtonContextValue, HTMLButtonElement>>({});\n\nfunction Button(props: ButtonProps, ref: ForwardedRef<HTMLButtonElement>) {\n [props, ref] = useContextProps(props, ref, ButtonContext);\n props = disablePendingProps(props);\n let ctx = props as ButtonContextValue;\n let {isPending} = ctx;\n let {buttonProps, isPressed} = useButton(props, ref);\n let {focusProps, isFocused, isFocusVisible} = useFocusRing(props);\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: props.isDisabled || isPending\n });\n let renderValues = {\n isHovered,\n isPressed: (ctx.isPressed || isPressed) && !isPending,\n isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isPending: isPending ?? false\n };\n\n let renderProps = useRenderProps({\n ...props,\n values: renderValues,\n defaultClassName: 'react-aria-Button'\n });\n\n let buttonId = useId(buttonProps.id);\n let progressId = useId();\n\n let ariaLabelledby = buttonProps['aria-labelledby'];\n if (isPending) {\n // aria-labelledby wins over aria-label\n // https://www.w3.org/TR/accname-1.2/#computation-steps\n if (ariaLabelledby) {\n ariaLabelledby = `${ariaLabelledby} ${progressId}`;\n } else if (buttonProps['aria-label']) {\n ariaLabelledby = `${buttonId} ${progressId}`;\n }\n }\n\n let wasPending = useRef(isPending);\n useEffect(() => {\n let message = {'aria-labelledby': ariaLabelledby || buttonId};\n if (!wasPending.current && isFocused && isPending) {\n announce(message, 'assertive');\n } else if (wasPending.current && isFocused && !isPending) {\n announce(message, 'assertive');\n }\n wasPending.current = isPending;\n }, [isPending, isFocused, ariaLabelledby, buttonId]);\n\n return (\n <button\n {...filterDOMProps(props, {propNames: additionalButtonHTMLAttributes})}\n {...mergeProps(buttonProps, focusProps, hoverProps)}\n {...renderProps}\n id={buttonId}\n ref={ref}\n aria-labelledby={ariaLabelledby}\n slot={props.slot || undefined}\n aria-disabled={isPending ? 'true' : buttonProps['aria-disabled']}\n data-disabled={props.isDisabled || undefined}\n data-pressed={renderValues.isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-pending={isPending || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n <ProgressBarContext.Provider value={{id: progressId}}>\n {renderProps.children}\n </ProgressBarContext.Provider>\n </button>\n );\n}\n\nfunction disablePendingProps(props) {\n // Don't allow interaction while isPending is true\n if (props.isPending) {\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n props.onClick = undefined;\n props.href = undefined;\n }\n return props;\n}\n\n/**\n * A button allows a user to perform an action, with mouse, touch, and keyboard interactions.\n */\nconst _Button = /*#__PURE__*/ createHideableComponent(Button);\nexport {_Button as Button};\n"],"names":[],"version":3,"file":"Button.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA2FD,MAAM,uDAAiC,IAAI,IAAI;IAAC;IAAQ;IAAc;IAAe;IAAc;IAAkB;IAAc;IAAQ;CAAQ;AAE5I,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAAuD,CAAC;AAEjG,SAAS,6BAAO,KAAkB,EAAE,GAAoC;IACtE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,QAAQ,0CAAoB;IAC5B,IAAI,MAAM;IACV,IAAI,aAAC,SAAS,EAAC,GAAG;IAClB,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE,OAAO;IAChD,IAAI,cAAC,UAAU,aAAE,SAAS,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE;IAC3D,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,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AI;QACpB,iBAAe,YAAY,SAAS,WAAW,CAAC,gBAAgB;QAChE,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,aAAa,SAAS,IAAI;QACxC,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,gBAAc,aAAa;QAC3B,sBAAoB,kBAAkB;qBACtC,gCAAC,CAAA,GAAA,yCAAiB,EAAE,QAAQ;QAAC,OAAO;YAAC,IAAI;QAAU;OAChD,YAAY,QAAQ;AAI7B;AAEA,SAAS,0CAAoB,KAAK;IAChC,kDAAkD;IAClD,IAAI,MAAM,SAAS,EAAE;QACnB,MAAM,OAAO,GAAG;QAChB,MAAM,YAAY,GAAG;QACrB,MAAM,UAAU,GAAG;QACnB,MAAM,aAAa,GAAG;QACtB,MAAM,SAAS,GAAG;QAClB,MAAM,SAAS,GAAG;QAClB,MAAM,OAAO,GAAG;QAChB,MAAM,OAAO,GAAG;QAChB,MAAM,IAAI,GAAG;IACf;IACA,OAAO;AACT;AAEA;;CAEC,GACD,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,8BAAsB,EAAE","sources":["packages/react-aria-components/src/Button.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 {announce} from '@react-aria/live-announcer';\nimport {\n AriaButtonProps,\n HoverEvents,\n mergeProps,\n useButton,\n useFocusRing,\n useHover,\n useId\n} from 'react-aria';\nimport {\n ContextValue,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {createHideableComponent} from '@react-aria/collections';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {ProgressBarContext} from './ProgressBar';\nimport React, {createContext, ForwardedRef, useEffect, useRef} from 'react';\n\nexport interface ButtonRenderProps {\n /**\n * Whether the button is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the button is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the button is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the button is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the button is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the button is currently in a pending state.\n * @selector [data-pending]\n */\n isPending: boolean\n}\n\nexport interface ButtonProps extends Omit<AriaButtonProps, 'children' | 'href' | 'target' | 'rel' | 'elementType'>, HoverEvents, SlotProps, RenderProps<ButtonRenderProps> {\n /**\n * The `<form>` element to associate the button with.\n * The value of this attribute must be the id of a `<form>` in the same document.\n */\n form?: string,\n /**\n * The URL that processes the information submitted by the button.\n * Overrides the action attribute of the button's form owner.\n */\n formAction?: string,\n /** Indicates how to encode the form data that is submitted. */\n formEncType?: string,\n /** Indicates the HTTP method used to submit the form. */\n formMethod?: string,\n /** Indicates that the form is not to be validated when it is submitted. */\n formNoValidate?: boolean,\n /** Overrides the target attribute of the button's form owner. */\n formTarget?: string,\n /** Submitted as a pair with the button's value as part of the form data. */\n name?: string,\n /** The value associated with the button's name when it's submitted with the form data. */\n value?: string,\n /**\n * Whether the button is in a pending state. This disables press and hover events\n * while retaining focusability, and announces the pending state to screen readers.\n */\n isPending?: boolean\n}\n\ninterface ButtonContextValue extends ButtonProps {\n isPressed?: boolean\n}\n\nconst additionalButtonHTMLAttributes = new Set(['form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'name', 'value']);\n\nexport const ButtonContext = createContext<ContextValue<ButtonContextValue, HTMLButtonElement>>({});\n\nfunction Button(props: ButtonProps, ref: ForwardedRef<HTMLButtonElement>) {\n [props, ref] = useContextProps(props, ref, ButtonContext);\n props = disablePendingProps(props);\n let ctx = props as ButtonContextValue;\n let {isPending} = ctx;\n let {buttonProps, isPressed} = useButton(props, ref);\n let {focusProps, isFocused, isFocusVisible} = useFocusRing(props);\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: props.isDisabled || isPending\n });\n let renderValues = {\n isHovered,\n isPressed: (ctx.isPressed || isPressed) && !isPending,\n isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isPending: isPending ?? false\n };\n\n let renderProps = useRenderProps({\n ...props,\n values: renderValues,\n defaultClassName: 'react-aria-Button'\n });\n\n let buttonId = useId(buttonProps.id);\n let progressId = useId();\n\n let ariaLabelledby = buttonProps['aria-labelledby'];\n if (isPending) {\n // aria-labelledby wins over aria-label\n // https://www.w3.org/TR/accname-1.2/#computation-steps\n if (ariaLabelledby) {\n ariaLabelledby = `${ariaLabelledby} ${progressId}`;\n } else if (buttonProps['aria-label']) {\n ariaLabelledby = `${buttonId} ${progressId}`;\n }\n }\n\n let wasPending = useRef(isPending);\n useEffect(() => {\n let message = {'aria-labelledby': ariaLabelledby || buttonId};\n if (!wasPending.current && isFocused && isPending) {\n announce(message, 'assertive');\n } else if (wasPending.current && isFocused && !isPending) {\n announce(message, 'assertive');\n }\n wasPending.current = isPending;\n }, [isPending, isFocused, ariaLabelledby, buttonId]);\n\n return (\n <button\n {...filterDOMProps(props, {propNames: additionalButtonHTMLAttributes})}\n {...mergeProps(buttonProps, focusProps, hoverProps)}\n {...renderProps}\n id={buttonId}\n ref={ref}\n aria-labelledby={ariaLabelledby}\n slot={props.slot || undefined}\n aria-disabled={isPending ? 'true' : buttonProps['aria-disabled']}\n data-disabled={props.isDisabled || undefined}\n data-pressed={renderValues.isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-pending={isPending || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n <ProgressBarContext.Provider value={{id: progressId}}>\n {renderProps.children}\n </ProgressBarContext.Provider>\n </button>\n );\n}\n\nfunction disablePendingProps(props) {\n // Don't allow interaction while isPending is true\n if (props.isPending) {\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n props.onClick = undefined;\n props.href = undefined;\n }\n return props;\n}\n\n/**\n * A button allows a user to perform an action, with mouse, touch, and keyboard interactions.\n */\nconst _Button = /*#__PURE__*/ createHideableComponent(Button);\nexport {_Button as Button};\n"],"names":[],"version":3,"file":"Button.module.js.map"}
1
+ {"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;AA2FD,MAAM,uDAAiC,IAAI,IAAI;IAAC;IAAQ;IAAc;IAAe;IAAc;IAAkB;IAAc;IAAQ;CAAQ;AAE5I,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAAuD,CAAC;AAEjG,SAAS,6BAAO,KAAkB,EAAE,GAAoC;IACtE,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,QAAQ,0CAAoB;IAC5B,IAAI,MAAM;IACV,IAAI,aAAC,SAAS,EAAC,GAAG;IAClB,IAAI,eAAC,WAAW,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE,OAAO;IAChD,IAAI,cAAC,UAAU,aAAE,SAAS,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE;IAC3D,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QACrC,GAAG,KAAK;QACR,YAAY,MAAM,UAAU,IAAI;IAClC;IACA,IAAI,eAAe;mBACjB;QACA,WAAW,AAAC,CAAA,IAAI,SAAS,IAAI,SAAQ,KAAM,CAAC;mBAC5C;wBACA;QACA,YAAY,MAAM,UAAU,IAAI;QAChC,WAAW,sBAAA,uBAAA,YA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AQ;QAAC,OAAO;YAAC,IAAI;QAAU;OAChD,YAAY,QAAQ;AAI7B;AAEA,SAAS,0CAAoB,KAAK;IAChC,kDAAkD;IAClD,IAAI,MAAM,SAAS,EAAE;QACnB,MAAM,OAAO,GAAG;QAChB,MAAM,YAAY,GAAG;QACrB,MAAM,UAAU,GAAG;QACnB,MAAM,aAAa,GAAG;QACtB,MAAM,SAAS,GAAG;QAClB,MAAM,SAAS,GAAG;QAClB,MAAM,OAAO,GAAG;QAChB,MAAM,OAAO,GAAG;QAChB,MAAM,IAAI,GAAG;IACf;IACA,OAAO;AACT;AAEA;;CAEC,GACD,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,8BAAsB,EAAE","sources":["packages/react-aria-components/src/Button.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 {announce} from '@react-aria/live-announcer';\nimport {\n AriaButtonProps,\n HoverEvents,\n mergeProps,\n useButton,\n useFocusRing,\n useHover,\n useId\n} from 'react-aria';\nimport {\n ContextValue,\n RenderProps,\n SlotProps,\n useContextProps,\n useRenderProps\n} from './utils';\nimport {createHideableComponent} from '@react-aria/collections';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {ProgressBarContext} from './ProgressBar';\nimport React, {createContext, ForwardedRef, useEffect, useRef} from 'react';\n\nexport interface ButtonRenderProps {\n /**\n * Whether the button is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the button is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the button is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the button is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the button is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the button is currently in a pending state.\n * @selector [data-pending]\n */\n isPending: boolean\n}\n\nexport interface ButtonProps extends Omit<AriaButtonProps, 'children' | 'href' | 'target' | 'rel' | 'elementType'>, HoverEvents, SlotProps, RenderProps<ButtonRenderProps> {\n /**\n * The `<form>` element to associate the button with.\n * The value of this attribute must be the id of a `<form>` in the same document.\n */\n form?: string,\n /**\n * The URL that processes the information submitted by the button.\n * Overrides the action attribute of the button's form owner.\n */\n formAction?: string,\n /** Indicates how to encode the form data that is submitted. */\n formEncType?: string,\n /** Indicates the HTTP method used to submit the form. */\n formMethod?: string,\n /** Indicates that the form is not to be validated when it is submitted. */\n formNoValidate?: boolean,\n /** Overrides the target attribute of the button's form owner. */\n formTarget?: string,\n /** Submitted as a pair with the button's value as part of the form data. */\n name?: string,\n /** The value associated with the button's name when it's submitted with the form data. */\n value?: string,\n /**\n * Whether the button is in a pending state. This disables press and hover events\n * while retaining focusability, and announces the pending state to screen readers.\n */\n isPending?: boolean\n}\n\ninterface ButtonContextValue extends ButtonProps {\n isPressed?: boolean\n}\n\nconst additionalButtonHTMLAttributes = new Set(['form', 'formAction', 'formEncType', 'formMethod', 'formNoValidate', 'formTarget', 'name', 'value']);\n\nexport const ButtonContext = createContext<ContextValue<ButtonContextValue, HTMLButtonElement>>({});\n\nfunction Button(props: ButtonProps, ref: ForwardedRef<HTMLButtonElement>) {\n [props, ref] = useContextProps(props, ref, ButtonContext);\n props = disablePendingProps(props);\n let ctx = props as ButtonContextValue;\n let {isPending} = ctx;\n let {buttonProps, isPressed} = useButton(props, ref);\n let {focusProps, isFocused, isFocusVisible} = useFocusRing(props);\n let {hoverProps, isHovered} = useHover({\n ...props,\n isDisabled: props.isDisabled || isPending\n });\n let renderValues = {\n isHovered,\n isPressed: (ctx.isPressed || isPressed) && !isPending,\n isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isPending: isPending ?? false\n };\n\n let renderProps = useRenderProps({\n ...props,\n values: renderValues,\n defaultClassName: 'react-aria-Button'\n });\n\n let buttonId = useId(buttonProps.id);\n let progressId = useId();\n\n let ariaLabelledby = buttonProps['aria-labelledby'];\n if (isPending) {\n // aria-labelledby wins over aria-label\n // https://www.w3.org/TR/accname-1.2/#computation-steps\n if (ariaLabelledby) {\n ariaLabelledby = `${ariaLabelledby} ${progressId}`;\n } else if (buttonProps['aria-label']) {\n ariaLabelledby = `${buttonId} ${progressId}`;\n }\n }\n\n let wasPending = useRef(isPending);\n useEffect(() => {\n let message = {'aria-labelledby': ariaLabelledby || buttonId};\n if (!wasPending.current && isFocused && isPending) {\n announce(message, 'assertive');\n } else if (wasPending.current && isFocused && !isPending) {\n announce(message, 'assertive');\n }\n wasPending.current = isPending;\n }, [isPending, isFocused, ariaLabelledby, buttonId]);\n\n return (\n <button\n {...filterDOMProps(props, {propNames: additionalButtonHTMLAttributes})}\n {...mergeProps(buttonProps, focusProps, hoverProps)}\n {...renderProps}\n id={buttonId}\n ref={ref}\n aria-labelledby={ariaLabelledby}\n slot={props.slot || undefined}\n aria-disabled={isPending ? 'true' : buttonProps['aria-disabled']}\n data-disabled={props.isDisabled || undefined}\n data-pressed={renderValues.isPressed || undefined}\n data-hovered={isHovered || undefined}\n data-focused={isFocused || undefined}\n data-pending={isPending || undefined}\n data-focus-visible={isFocusVisible || undefined}>\n <ProgressBarContext.Provider value={{id: progressId}}>\n {renderProps.children}\n </ProgressBarContext.Provider>\n </button>\n );\n}\n\nfunction disablePendingProps(props) {\n // Don't allow interaction while isPending is true\n if (props.isPending) {\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n props.onClick = undefined;\n props.href = undefined;\n }\n return props;\n}\n\n/**\n * A button allows a user to perform an action, with mouse, touch, and keyboard interactions.\n */\nconst _Button = /*#__PURE__*/ createHideableComponent(Button);\nexport {_Button as Button};\n"],"names":[],"version":3,"file":"Button.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAyFM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA8B;AAGjE,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,iDAAoB,EAAE,WAAW,CAAmB,OAAwB,KAAgC;IAC/I,IAAI,QAAC,IAAI,UAAE,MAAM,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IAChC,QAAQ,IAAI,CAAC,CAAC,qCAAqC,EAAE,KAAK,UAAU,CAAC;IACrE,OAAO,OAAO,OAAO,KAAK,SAAS;AACrC;AAmCO,MAAM,4CAAgD;IAC3D,gBAAe,cAAC,UAAU,uBAAE,mBAAmB,EAAC;QAC9C,OAAO,0CAAoB,YAAY,MAAM;IAC/C;IACA,kBAAiB,cAAC,UAAU,UAAE,MAAM,uBAAE,mBAAmB,EAAC;QACxD,OAAO,0CAAoB,YAAY,QAAQ;IACjD;AACF;AAEA,SAAS,0CACP,UAAsC,EACtC,MAA4B,EAC5B,mBAA2D;IAE3D,OAAO,CAAA,GAAA,6CAAgB,EAAE;QACvB,OAAO,SAAS,WAAW,WAAW,CAAE,OAAO,GAAG,IAAI;QACtD,cAAc;YAAC;SAAoB;QACnC,UAAS,IAAI;gBAYgB;YAX3B,IAAI,WAAW,KAAK,MAAM,CAAE;YAC5B,IAAI,CAAC,uBAAuB,KAAK,IAAI,KAAK,QACxC,OAAO;YAGT,IAAI,MAAM,KAAK,GAAG;YAClB,IAAI,WAAW,WAAW,WAAW,CAAC;YACtC,qBACE,sHACG,oBAAoB;gBAAC,MAAM;qBAAQ;gBAAK,cAAc;YAAQ,IAC9D,UACA,AAAE,CAAA,YAAY,QAAQ,EAAA,sBAAA,WAAW,OAAO,CAAC,uBAAnB,0CAAA,oBAA8B,IAAI,MAAK,MAAK,KAAO,oBAAoB;gBAAC,MAAM;qBAAQ;gBAAK,cAAc;YAAO;QAG7I;IACF;AACF;AAEO,MAAM,0DAA4B,CAAA,GAAA,0BAAY,EAAsB;AAEpE,SAAS,0CAAiB,UAAe;IAC9C,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAM,cAAc,OAAO,IAAI,IAAI;YAAC;SAAW,IAAI,MAAM;QAAC;KAAW;AACtF","sources":["packages/react-aria-components/src/Collection.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 */\nimport {CollectionBase, DropTargetDelegate, ItemDropTarget, Key, LayoutDelegate, RefObject} from '@react-types/shared';\nimport {createBranchComponent, useCachedChildren} from '@react-aria/collections';\nimport {Collection as ICollection, Node, SelectionBehavior, SelectionMode, SectionProps as SharedSectionProps} from 'react-stately';\nimport React, {createContext, ForwardedRef, HTMLAttributes, JSX, ReactElement, ReactNode, useContext, useMemo} from 'react';\nimport {StyleProps} from './utils';\n\nexport interface CollectionProps<T> extends Omit<CollectionBase<T>, 'children'> {\n /** The contents of the collection. */\n children?: ReactNode | ((item: T) => ReactNode),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: any[]\n}\n\nexport interface ItemRenderProps {\n /**\n * Whether the item is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the item is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the item is currently selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the item is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the item is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * The type of selection that is allowed in the collection.\n * @selector [data-selection-mode=\"single | multiple\"]\n */\n selectionMode: SelectionMode,\n /** The selection behavior for the collection. */\n selectionBehavior: SelectionBehavior,\n /**\n * Whether the item allows dragging.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-allows-dragging]\n */\n allowsDragging?: boolean,\n /**\n * Whether the item is currently being dragged.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-dragging]\n */\n isDragging?: boolean,\n /**\n * Whether the item is currently an active drop target.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-drop-target]\n */\n isDropTarget?: boolean\n}\n\nexport interface SectionProps<T> extends Omit<SharedSectionProps<T>, 'children' | 'title'>, StyleProps {\n /** The unique id of the section. */\n id?: Key,\n /** The object value that this section represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** Static child items or a function to render children. */\n children?: ReactNode | ((item: T) => ReactElement),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: any[]\n}\n\ninterface SectionContextValue {\n name: string,\n render: (props: SectionProps<any>, ref: ForwardedRef<HTMLElement>, section: Node<any>, className?: string) => ReactElement\n}\n\nexport const SectionContext = createContext<SectionContextValue | null>(null);\n\n/** @deprecated */\nexport const Section = /*#__PURE__*/ createBranchComponent('section', <T extends object>(props: SectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>): JSX.Element => {\n let {name, render} = useContext(SectionContext)!;\n console.warn(`<Section> is deprecated. Please use <${name}> instead.`);\n return render(props, ref, section, 'react-aria-Section');\n});\n\nexport interface CollectionBranchProps {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** The parent node of the items to render. */\n parent: Node<unknown>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRootProps extends HTMLAttributes<HTMLElement> {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** A set of keys for items that should always be persisted in the DOM. */\n persistedKeys?: Set<Key> | null,\n /** A ref to the scroll container for the collection. */\n scrollRef?: RefObject<HTMLElement | null>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRenderer {\n /** Whether this is a virtualized collection. */\n isVirtualized?: boolean,\n /** A delegate object that provides layout information for items in the collection. */\n layoutDelegate?: LayoutDelegate,\n /** A delegate object that provides drop targets for pointer coordinates within the collection. */\n dropTargetDelegate?: DropTargetDelegate,\n /** A component that renders the root collection items. */\n CollectionRoot: React.ComponentType<CollectionRootProps>,\n /** A component that renders the child collection items. */\n CollectionBranch: React.ComponentType<CollectionBranchProps>\n}\n\nexport const DefaultCollectionRenderer: CollectionRenderer = {\n CollectionRoot({collection, renderDropIndicator}) {\n return useCollectionRender(collection, null, renderDropIndicator);\n },\n CollectionBranch({collection, parent, renderDropIndicator}) {\n return useCollectionRender(collection, parent, renderDropIndicator);\n }\n};\n\nfunction useCollectionRender(\n collection: ICollection<Node<unknown>>,\n parent: Node<unknown> | null,\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n) {\n return useCachedChildren({\n items: parent ? collection.getChildren!(parent.key) : collection,\n dependencies: [renderDropIndicator],\n children(node) {\n let rendered = node.render!(node);\n if (!renderDropIndicator || node.type !== 'item') {\n return rendered;\n }\n\n let key = node.key;\n let keyAfter = collection.getKeyAfter(key);\n return (\n <>\n {renderDropIndicator({type: 'item', key, dropPosition: 'before'})}\n {rendered}\n {((keyAfter == null || collection.getItem(keyAfter)?.type !== 'item')) && renderDropIndicator({type: 'item', key, dropPosition: 'after'})}\n </>\n );\n }\n });\n}\n\nexport const CollectionRendererContext = createContext<CollectionRenderer>(DefaultCollectionRenderer);\n\nexport function usePersistedKeys(focusedKey: Key) {\n return useMemo(() => focusedKey != null ? new Set([focusedKey]) : null, [focusedKey]);\n}\n"],"names":[],"version":3,"file":"Collection.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAyFM,MAAM,0DAAiB,CAAA,GAAA,0BAAY,EAA8B;AAGjE,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,iDAAoB,EAAE,WAAW,CAAmB,OAAwB,KAAgC;IAC/I,IAAI,QAAC,IAAI,UAAE,MAAM,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE;IAChC,QAAQ,IAAI,CAAC,CAAC,qCAAqC,EAAE,KAAK,UAAU,CAAC;IACrE,OAAO,OAAO,OAAO,KAAK,SAAS;AACrC;AAmCO,MAAM,4CAAgD;IAC3D,gBAAe,cAAC,UAAU,uBAAE,mBAAmB,EAAC;QAC9C,OAAO,0CAAoB,YAAY,MAAM;IAC/C;IACA,kBAAiB,cAAC,UAAU,UAAE,MAAM,uBAAE,mBAAmB,EAAC;QACxD,OAAO,0CAAoB,YAAY,QAAQ;IACjD;AACF;AAEA,SAAS,0CACP,UAAsC,EACtC,MAA4B,EAC5B,mBAA2D;IAE3D,OAAO,CAAA,GAAA,6CAAgB,EAAE;QACvB,OAAO,SAAS,WAAW,WAAW,CAAE,OAAO,GAAG,IAAI;QACtD,cAAc;YAAC;SAAoB;QACnC,UAAS,IAAI;gBAYgB;YAX3B,IAAI,WAAW,KAAK,MAAM,CAAE;YAC5B,IAAI,CAAC,uBAAuB,KAAK,IAAI,KAAK,QACxC,OAAO;YAGT,IAAI,MAAM,KAAK,GAAG;YAClB,IAAI,WAAW,WAAW,WAAW,CAAC;YACtC,qBACE,sHACG,oBAAoB;gBAAC,MAAM;qBAAQ;gBAAK,cAAc;YAAQ,IAC9D,UACA,AAAE,CAAA,YAAY,QAAQ,EAAA,sBAAA,WAAW,OAAO,CAAC,uBAAnB,0CAAA,oBAA8B,IAAI,MAAK,MAAK,KAAO,oBAAoB;gBAAC,MAAM;qBAAQ;gBAAK,cAAc;YAAO;QAG7I;IACF;AACF;AAEO,MAAM,0DAA4B,CAAA,GAAA,0BAAY,EAAsB;AAEpE,SAAS,0CAAiB,UAAsB;IACrD,OAAO,CAAA,GAAA,oBAAM,EAAE,IAAM,cAAc,OAAO,IAAI,IAAI;YAAC;SAAW,IAAI,MAAM;QAAC;KAAW;AACtF","sources":["packages/react-aria-components/src/Collection.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 */\nimport {CollectionBase, DropTargetDelegate, ItemDropTarget, Key, LayoutDelegate, RefObject} from '@react-types/shared';\nimport {createBranchComponent, useCachedChildren} from '@react-aria/collections';\nimport {Collection as ICollection, Node, SelectionBehavior, SelectionMode, SectionProps as SharedSectionProps} from 'react-stately';\nimport React, {createContext, ForwardedRef, HTMLAttributes, JSX, ReactElement, ReactNode, useContext, useMemo} from 'react';\nimport {StyleProps} from './utils';\n\nexport interface CollectionProps<T> extends Omit<CollectionBase<T>, 'children'> {\n /** The contents of the collection. */\n children?: ReactNode | ((item: T) => ReactNode),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: any[]\n}\n\nexport interface ItemRenderProps {\n /**\n * Whether the item is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the item is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the item is currently selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the item is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the item is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * The type of selection that is allowed in the collection.\n * @selector [data-selection-mode=\"single | multiple\"]\n */\n selectionMode: SelectionMode,\n /** The selection behavior for the collection. */\n selectionBehavior: SelectionBehavior,\n /**\n * Whether the item allows dragging.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-allows-dragging]\n */\n allowsDragging?: boolean,\n /**\n * Whether the item is currently being dragged.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-dragging]\n */\n isDragging?: boolean,\n /**\n * Whether the item is currently an active drop target.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-drop-target]\n */\n isDropTarget?: boolean\n}\n\nexport interface SectionProps<T> extends Omit<SharedSectionProps<T>, 'children' | 'title'>, StyleProps {\n /** The unique id of the section. */\n id?: Key,\n /** The object value that this section represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** Static child items or a function to render children. */\n children?: ReactNode | ((item: T) => ReactElement),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: any[]\n}\n\ninterface SectionContextValue {\n name: string,\n render: (props: SectionProps<any>, ref: ForwardedRef<HTMLElement>, section: Node<any>, className?: string) => ReactElement\n}\n\nexport const SectionContext = createContext<SectionContextValue | null>(null);\n\n/** @deprecated */\nexport const Section = /*#__PURE__*/ createBranchComponent('section', <T extends object>(props: SectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>): JSX.Element => {\n let {name, render} = useContext(SectionContext)!;\n console.warn(`<Section> is deprecated. Please use <${name}> instead.`);\n return render(props, ref, section, 'react-aria-Section');\n});\n\nexport interface CollectionBranchProps {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** The parent node of the items to render. */\n parent: Node<unknown>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRootProps extends HTMLAttributes<HTMLElement> {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** A set of keys for items that should always be persisted in the DOM. */\n persistedKeys?: Set<Key> | null,\n /** A ref to the scroll container for the collection. */\n scrollRef?: RefObject<HTMLElement | null>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRenderer {\n /** Whether this is a virtualized collection. */\n isVirtualized?: boolean,\n /** A delegate object that provides layout information for items in the collection. */\n layoutDelegate?: LayoutDelegate,\n /** A delegate object that provides drop targets for pointer coordinates within the collection. */\n dropTargetDelegate?: DropTargetDelegate,\n /** A component that renders the root collection items. */\n CollectionRoot: React.ComponentType<CollectionRootProps>,\n /** A component that renders the child collection items. */\n CollectionBranch: React.ComponentType<CollectionBranchProps>\n}\n\nexport const DefaultCollectionRenderer: CollectionRenderer = {\n CollectionRoot({collection, renderDropIndicator}) {\n return useCollectionRender(collection, null, renderDropIndicator);\n },\n CollectionBranch({collection, parent, renderDropIndicator}) {\n return useCollectionRender(collection, parent, renderDropIndicator);\n }\n};\n\nfunction useCollectionRender(\n collection: ICollection<Node<unknown>>,\n parent: Node<unknown> | null,\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n) {\n return useCachedChildren({\n items: parent ? collection.getChildren!(parent.key) : collection,\n dependencies: [renderDropIndicator],\n children(node) {\n let rendered = node.render!(node);\n if (!renderDropIndicator || node.type !== 'item') {\n return rendered;\n }\n\n let key = node.key;\n let keyAfter = collection.getKeyAfter(key);\n return (\n <>\n {renderDropIndicator({type: 'item', key, dropPosition: 'before'})}\n {rendered}\n {((keyAfter == null || collection.getItem(keyAfter)?.type !== 'item')) && renderDropIndicator({type: 'item', key, dropPosition: 'after'})}\n </>\n );\n }\n });\n}\n\nexport const CollectionRendererContext = createContext<CollectionRenderer>(DefaultCollectionRenderer);\n\nexport function usePersistedKeys(focusedKey: Key | null) {\n return useMemo(() => focusedKey != null ? new Set([focusedKey]) : null, [focusedKey]);\n}\n"],"names":[],"version":3,"file":"Collection.main.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAyFM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA8B;AAGjE,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,4BAAoB,EAAE,WAAW,CAAmB,OAAwB,KAAgC;IAC/I,IAAI,QAAC,IAAI,UAAE,MAAM,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IAChC,QAAQ,IAAI,CAAC,CAAC,qCAAqC,EAAE,KAAK,UAAU,CAAC;IACrE,OAAO,OAAO,OAAO,KAAK,SAAS;AACrC;AAmCO,MAAM,4CAAgD;IAC3D,gBAAe,cAAC,UAAU,uBAAE,mBAAmB,EAAC;QAC9C,OAAO,0CAAoB,YAAY,MAAM;IAC/C;IACA,kBAAiB,cAAC,UAAU,UAAE,MAAM,uBAAE,mBAAmB,EAAC;QACxD,OAAO,0CAAoB,YAAY,QAAQ;IACjD;AACF;AAEA,SAAS,0CACP,UAAsC,EACtC,MAA4B,EAC5B,mBAA2D;IAE3D,OAAO,CAAA,GAAA,wBAAgB,EAAE;QACvB,OAAO,SAAS,WAAW,WAAW,CAAE,OAAO,GAAG,IAAI;QACtD,cAAc;YAAC;SAAoB;QACnC,UAAS,IAAI;gBAYgB;YAX3B,IAAI,WAAW,KAAK,MAAM,CAAE;YAC5B,IAAI,CAAC,uBAAuB,KAAK,IAAI,KAAK,QACxC,OAAO;YAGT,IAAI,MAAM,KAAK,GAAG;YAClB,IAAI,WAAW,WAAW,WAAW,CAAC;YACtC,qBACE,kEACG,oBAAoB;gBAAC,MAAM;qBAAQ;gBAAK,cAAc;YAAQ,IAC9D,UACA,AAAE,CAAA,YAAY,QAAQ,EAAA,sBAAA,WAAW,OAAO,CAAC,uBAAnB,0CAAA,oBAA8B,IAAI,MAAK,MAAK,KAAO,oBAAoB;gBAAC,MAAM;qBAAQ;gBAAK,cAAc;YAAO;QAG7I;IACF;AACF;AAEO,MAAM,0DAA4B,CAAA,GAAA,oBAAY,EAAsB;AAEpE,SAAS,0CAAiB,UAAe;IAC9C,OAAO,CAAA,GAAA,cAAM,EAAE,IAAM,cAAc,OAAO,IAAI,IAAI;YAAC;SAAW,IAAI,MAAM;QAAC;KAAW;AACtF","sources":["packages/react-aria-components/src/Collection.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 */\nimport {CollectionBase, DropTargetDelegate, ItemDropTarget, Key, LayoutDelegate, RefObject} from '@react-types/shared';\nimport {createBranchComponent, useCachedChildren} from '@react-aria/collections';\nimport {Collection as ICollection, Node, SelectionBehavior, SelectionMode, SectionProps as SharedSectionProps} from 'react-stately';\nimport React, {createContext, ForwardedRef, HTMLAttributes, JSX, ReactElement, ReactNode, useContext, useMemo} from 'react';\nimport {StyleProps} from './utils';\n\nexport interface CollectionProps<T> extends Omit<CollectionBase<T>, 'children'> {\n /** The contents of the collection. */\n children?: ReactNode | ((item: T) => ReactNode),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: any[]\n}\n\nexport interface ItemRenderProps {\n /**\n * Whether the item is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the item is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the item is currently selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the item is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the item is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * The type of selection that is allowed in the collection.\n * @selector [data-selection-mode=\"single | multiple\"]\n */\n selectionMode: SelectionMode,\n /** The selection behavior for the collection. */\n selectionBehavior: SelectionBehavior,\n /**\n * Whether the item allows dragging.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-allows-dragging]\n */\n allowsDragging?: boolean,\n /**\n * Whether the item is currently being dragged.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-dragging]\n */\n isDragging?: boolean,\n /**\n * Whether the item is currently an active drop target.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-drop-target]\n */\n isDropTarget?: boolean\n}\n\nexport interface SectionProps<T> extends Omit<SharedSectionProps<T>, 'children' | 'title'>, StyleProps {\n /** The unique id of the section. */\n id?: Key,\n /** The object value that this section represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** Static child items or a function to render children. */\n children?: ReactNode | ((item: T) => ReactElement),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: any[]\n}\n\ninterface SectionContextValue {\n name: string,\n render: (props: SectionProps<any>, ref: ForwardedRef<HTMLElement>, section: Node<any>, className?: string) => ReactElement\n}\n\nexport const SectionContext = createContext<SectionContextValue | null>(null);\n\n/** @deprecated */\nexport const Section = /*#__PURE__*/ createBranchComponent('section', <T extends object>(props: SectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>): JSX.Element => {\n let {name, render} = useContext(SectionContext)!;\n console.warn(`<Section> is deprecated. Please use <${name}> instead.`);\n return render(props, ref, section, 'react-aria-Section');\n});\n\nexport interface CollectionBranchProps {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** The parent node of the items to render. */\n parent: Node<unknown>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRootProps extends HTMLAttributes<HTMLElement> {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** A set of keys for items that should always be persisted in the DOM. */\n persistedKeys?: Set<Key> | null,\n /** A ref to the scroll container for the collection. */\n scrollRef?: RefObject<HTMLElement | null>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRenderer {\n /** Whether this is a virtualized collection. */\n isVirtualized?: boolean,\n /** A delegate object that provides layout information for items in the collection. */\n layoutDelegate?: LayoutDelegate,\n /** A delegate object that provides drop targets for pointer coordinates within the collection. */\n dropTargetDelegate?: DropTargetDelegate,\n /** A component that renders the root collection items. */\n CollectionRoot: React.ComponentType<CollectionRootProps>,\n /** A component that renders the child collection items. */\n CollectionBranch: React.ComponentType<CollectionBranchProps>\n}\n\nexport const DefaultCollectionRenderer: CollectionRenderer = {\n CollectionRoot({collection, renderDropIndicator}) {\n return useCollectionRender(collection, null, renderDropIndicator);\n },\n CollectionBranch({collection, parent, renderDropIndicator}) {\n return useCollectionRender(collection, parent, renderDropIndicator);\n }\n};\n\nfunction useCollectionRender(\n collection: ICollection<Node<unknown>>,\n parent: Node<unknown> | null,\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n) {\n return useCachedChildren({\n items: parent ? collection.getChildren!(parent.key) : collection,\n dependencies: [renderDropIndicator],\n children(node) {\n let rendered = node.render!(node);\n if (!renderDropIndicator || node.type !== 'item') {\n return rendered;\n }\n\n let key = node.key;\n let keyAfter = collection.getKeyAfter(key);\n return (\n <>\n {renderDropIndicator({type: 'item', key, dropPosition: 'before'})}\n {rendered}\n {((keyAfter == null || collection.getItem(keyAfter)?.type !== 'item')) && renderDropIndicator({type: 'item', key, dropPosition: 'after'})}\n </>\n );\n }\n });\n}\n\nexport const CollectionRendererContext = createContext<CollectionRenderer>(DefaultCollectionRenderer);\n\nexport function usePersistedKeys(focusedKey: Key) {\n return useMemo(() => focusedKey != null ? new Set([focusedKey]) : null, [focusedKey]);\n}\n"],"names":[],"version":3,"file":"Collection.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAyFM,MAAM,0DAAiB,CAAA,GAAA,oBAAY,EAA8B;AAGjE,MAAM,4CAAU,WAAW,GAAG,CAAA,GAAA,4BAAoB,EAAE,WAAW,CAAmB,OAAwB,KAAgC;IAC/I,IAAI,QAAC,IAAI,UAAE,MAAM,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE;IAChC,QAAQ,IAAI,CAAC,CAAC,qCAAqC,EAAE,KAAK,UAAU,CAAC;IACrE,OAAO,OAAO,OAAO,KAAK,SAAS;AACrC;AAmCO,MAAM,4CAAgD;IAC3D,gBAAe,cAAC,UAAU,uBAAE,mBAAmB,EAAC;QAC9C,OAAO,0CAAoB,YAAY,MAAM;IAC/C;IACA,kBAAiB,cAAC,UAAU,UAAE,MAAM,uBAAE,mBAAmB,EAAC;QACxD,OAAO,0CAAoB,YAAY,QAAQ;IACjD;AACF;AAEA,SAAS,0CACP,UAAsC,EACtC,MAA4B,EAC5B,mBAA2D;IAE3D,OAAO,CAAA,GAAA,wBAAgB,EAAE;QACvB,OAAO,SAAS,WAAW,WAAW,CAAE,OAAO,GAAG,IAAI;QACtD,cAAc;YAAC;SAAoB;QACnC,UAAS,IAAI;gBAYgB;YAX3B,IAAI,WAAW,KAAK,MAAM,CAAE;YAC5B,IAAI,CAAC,uBAAuB,KAAK,IAAI,KAAK,QACxC,OAAO;YAGT,IAAI,MAAM,KAAK,GAAG;YAClB,IAAI,WAAW,WAAW,WAAW,CAAC;YACtC,qBACE,kEACG,oBAAoB;gBAAC,MAAM;qBAAQ;gBAAK,cAAc;YAAQ,IAC9D,UACA,AAAE,CAAA,YAAY,QAAQ,EAAA,sBAAA,WAAW,OAAO,CAAC,uBAAnB,0CAAA,oBAA8B,IAAI,MAAK,MAAK,KAAO,oBAAoB;gBAAC,MAAM;qBAAQ;gBAAK,cAAc;YAAO;QAG7I;IACF;AACF;AAEO,MAAM,0DAA4B,CAAA,GAAA,oBAAY,EAAsB;AAEpE,SAAS,0CAAiB,UAAsB;IACrD,OAAO,CAAA,GAAA,cAAM,EAAE,IAAM,cAAc,OAAO,IAAI,IAAI;YAAC;SAAW,IAAI,MAAM;QAAC;KAAW;AACtF","sources":["packages/react-aria-components/src/Collection.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 */\nimport {CollectionBase, DropTargetDelegate, ItemDropTarget, Key, LayoutDelegate, RefObject} from '@react-types/shared';\nimport {createBranchComponent, useCachedChildren} from '@react-aria/collections';\nimport {Collection as ICollection, Node, SelectionBehavior, SelectionMode, SectionProps as SharedSectionProps} from 'react-stately';\nimport React, {createContext, ForwardedRef, HTMLAttributes, JSX, ReactElement, ReactNode, useContext, useMemo} from 'react';\nimport {StyleProps} from './utils';\n\nexport interface CollectionProps<T> extends Omit<CollectionBase<T>, 'children'> {\n /** The contents of the collection. */\n children?: ReactNode | ((item: T) => ReactNode),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: any[]\n}\n\nexport interface ItemRenderProps {\n /**\n * Whether the item is currently hovered with a mouse.\n * @selector [data-hovered]\n */\n isHovered: boolean,\n /**\n * Whether the item is currently in a pressed state.\n * @selector [data-pressed]\n */\n isPressed: boolean,\n /**\n * Whether the item is currently selected.\n * @selector [data-selected]\n */\n isSelected: boolean,\n /**\n * Whether the item is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the item is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the item is non-interactive, i.e. both selection and actions are disabled and the item may\n * not be focused. Dependent on `disabledKeys` and `disabledBehavior`.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * The type of selection that is allowed in the collection.\n * @selector [data-selection-mode=\"single | multiple\"]\n */\n selectionMode: SelectionMode,\n /** The selection behavior for the collection. */\n selectionBehavior: SelectionBehavior,\n /**\n * Whether the item allows dragging.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-allows-dragging]\n */\n allowsDragging?: boolean,\n /**\n * Whether the item is currently being dragged.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-dragging]\n */\n isDragging?: boolean,\n /**\n * Whether the item is currently an active drop target.\n * @note This property is only available in collection components that support drag and drop.\n * @selector [data-drop-target]\n */\n isDropTarget?: boolean\n}\n\nexport interface SectionProps<T> extends Omit<SharedSectionProps<T>, 'children' | 'title'>, StyleProps {\n /** The unique id of the section. */\n id?: Key,\n /** The object value that this section represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** Static child items or a function to render children. */\n children?: ReactNode | ((item: T) => ReactElement),\n /** Values that should invalidate the item cache when using dynamic collections. */\n dependencies?: any[]\n}\n\ninterface SectionContextValue {\n name: string,\n render: (props: SectionProps<any>, ref: ForwardedRef<HTMLElement>, section: Node<any>, className?: string) => ReactElement\n}\n\nexport const SectionContext = createContext<SectionContextValue | null>(null);\n\n/** @deprecated */\nexport const Section = /*#__PURE__*/ createBranchComponent('section', <T extends object>(props: SectionProps<T>, ref: ForwardedRef<HTMLElement>, section: Node<T>): JSX.Element => {\n let {name, render} = useContext(SectionContext)!;\n console.warn(`<Section> is deprecated. Please use <${name}> instead.`);\n return render(props, ref, section, 'react-aria-Section');\n});\n\nexport interface CollectionBranchProps {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** The parent node of the items to render. */\n parent: Node<unknown>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRootProps extends HTMLAttributes<HTMLElement> {\n /** The collection of items to render. */\n collection: ICollection<Node<unknown>>,\n /** A set of keys for items that should always be persisted in the DOM. */\n persistedKeys?: Set<Key> | null,\n /** A ref to the scroll container for the collection. */\n scrollRef?: RefObject<HTMLElement | null>,\n /** A function that renders a drop indicator between items. */\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n}\n\nexport interface CollectionRenderer {\n /** Whether this is a virtualized collection. */\n isVirtualized?: boolean,\n /** A delegate object that provides layout information for items in the collection. */\n layoutDelegate?: LayoutDelegate,\n /** A delegate object that provides drop targets for pointer coordinates within the collection. */\n dropTargetDelegate?: DropTargetDelegate,\n /** A component that renders the root collection items. */\n CollectionRoot: React.ComponentType<CollectionRootProps>,\n /** A component that renders the child collection items. */\n CollectionBranch: React.ComponentType<CollectionBranchProps>\n}\n\nexport const DefaultCollectionRenderer: CollectionRenderer = {\n CollectionRoot({collection, renderDropIndicator}) {\n return useCollectionRender(collection, null, renderDropIndicator);\n },\n CollectionBranch({collection, parent, renderDropIndicator}) {\n return useCollectionRender(collection, parent, renderDropIndicator);\n }\n};\n\nfunction useCollectionRender(\n collection: ICollection<Node<unknown>>,\n parent: Node<unknown> | null,\n renderDropIndicator?: (target: ItemDropTarget) => ReactNode\n) {\n return useCachedChildren({\n items: parent ? collection.getChildren!(parent.key) : collection,\n dependencies: [renderDropIndicator],\n children(node) {\n let rendered = node.render!(node);\n if (!renderDropIndicator || node.type !== 'item') {\n return rendered;\n }\n\n let key = node.key;\n let keyAfter = collection.getKeyAfter(key);\n return (\n <>\n {renderDropIndicator({type: 'item', key, dropPosition: 'before'})}\n {rendered}\n {((keyAfter == null || collection.getItem(keyAfter)?.type !== 'item')) && renderDropIndicator({type: 'item', key, dropPosition: 'after'})}\n </>\n );\n }\n });\n}\n\nexport const CollectionRendererContext = createContext<CollectionRenderer>(DefaultCollectionRenderer);\n\nexport function usePersistedKeys(focusedKey: Key | null) {\n return useMemo(() => focusedKey != null ? new Set([focusedKey]) : null, [focusedKey]);\n}\n"],"names":[],"version":3,"file":"Collection.module.js.map"}
@@ -58,9 +58,9 @@ const $1d716ce69f118fad$export$c02625b26074192c = /*#__PURE__*/ (0, $9obPC$react
58
58
  function $1d716ce69f118fad$var$ComboBox(props, ref) {
59
59
  [props, ref] = (0, $c5ccf687772c0422$exports.useContextProps)(props, ref, $1d716ce69f118fad$export$d414ccceff7063c3);
60
60
  let { children: children, isDisabled: isDisabled = false, isInvalid: isInvalid = false, isRequired: isRequired = false } = props;
61
- let content = (0, $9obPC$react.useMemo)(()=>/*#__PURE__*/ {
61
+ let content = (0, $9obPC$react.useMemo)(()=>{
62
62
  var _props_items;
63
- return (0, ($parcel$interopDefault($9obPC$react))).createElement((0, $a03b42240404b420$exports.ListBoxContext).Provider, {
63
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($9obPC$react))).createElement((0, $a03b42240404b420$exports.ListBoxContext).Provider, {
64
64
  value: {
65
65
  items: (_props_items = props.items) !== null && _props_items !== void 0 ? _props_items : props.defaultItems
66
66
  }
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;AAuDM,MAAM,0DAAkB,CAAA,GAAA,0BAAY,EAAoD;AACxF,MAAM,0DAAuB,CAAA,GAAA,0BAAY,EAA6B;AAE7E,SAAS,+BAA2B,KAAuB,EAAE,GAAiC;IAC5F,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,YAAC,QAAQ,cAAE,aAAa,kBAAO,YAAY,mBAAO,aAAa,OAAM,GAAG;IAC5E,IAAI,UAAU,CAAA,GAAA,oBAAM,EAAE;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M,IAAI;QAC3B,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,WAAW,SAAS,IAAI;QACtC,iBAAe,MAAM,UAAU,IAAI;QACpC,QAAQ,cAAc,uBAAS,0DAAC;QAAM,MAAK;QAAS,MAAM;QAAM,OAAO,CAAA,qBAAA,MAAM,WAAW,cAAjB,gCAAA,qBAAqB;;AAGnG;AAEA;;CAEC,GACD,MAAM,4CAA0B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB","sources":["packages/react-aria-components/src/ComboBox.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 */\nimport {AriaComboBoxProps, useComboBox, useFilter} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {Collection, ComboBoxState, Node, useComboBoxState} from 'react-stately';\nimport {CollectionBuilder} from '@react-aria/collections';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, useResizeObserver} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport {ListBoxContext, ListStateContext} from './ListBox';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useCallback, useMemo, useRef, useState} from 'react';\nimport {TextContext} from './Text';\n\nexport interface ComboBoxRenderProps {\n /**\n * Whether the combobox is currently open.\n * @selector [data-open]\n */\n isOpen: boolean,\n /**\n * Whether the combobox is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the combobox is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the combobox is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport interface ComboBoxProps<T extends object> extends Omit<AriaComboBoxProps<T>, 'children' | 'placeholder' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<ComboBoxRenderProps>, SlotProps {\n /** The filter function used to determine if a option should be included in the combo box list. */\n defaultFilter?: (textValue: string, inputValue: string) => boolean,\n /**\n * Whether the text or key of the selected item is submitted as part of an HTML form.\n * When `allowsCustomValue` is `true`, this option does not apply and the text is always submitted.\n * @default 'key'\n */\n formValue?: 'text' | 'key',\n /** Whether the combo box allows the menu to be open when the collection is empty. */\n allowsEmptyCollection?: boolean\n}\n\nexport const ComboBoxContext = createContext<ContextValue<ComboBoxProps<any>, HTMLDivElement>>(null);\nexport const ComboBoxStateContext = createContext<ComboBoxState<any> | null>(null);\n\nfunction ComboBox<T extends object>(props: ComboBoxProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ComboBoxContext);\n let {children, isDisabled = false, isInvalid = false, isRequired = false} = props;\n let content = useMemo(() => (\n <ListBoxContext.Provider value={{items: props.items ?? props.defaultItems}}>\n {typeof children === 'function'\n ? children({\n isOpen: false,\n isDisabled,\n isInvalid,\n isRequired,\n defaultChildren: null\n })\n : children}\n </ListBoxContext.Provider>\n ), [children, isDisabled, isInvalid, isRequired, props.items, props.defaultItems]);\n\n return (\n <CollectionBuilder content={content}>\n {collection => <ComboBoxInner props={props} collection={collection} comboBoxRef={ref} />}\n </CollectionBuilder>\n );\n}\n\ninterface ComboBoxInnerProps<T extends object> {\n props: ComboBoxProps<T>,\n collection: Collection<Node<T>>,\n comboBoxRef: RefObject<HTMLDivElement | null>\n}\n\nfunction ComboBoxInner<T extends object>({props, collection, comboBoxRef: ref}: ComboBoxInnerProps<T>) {\n let {\n name,\n formValue = 'key',\n allowsCustomValue\n } = props;\n if (allowsCustomValue) {\n formValue = 'text';\n }\n\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let {contains} = useFilter({sensitivity: 'base'});\n let state = useComboBoxState({\n defaultFilter: props.defaultFilter || contains,\n ...props,\n // If props.items isn't provided, rely on collection filtering (aka listbox.items is provided or defaultItems provided to Combobox)\n items: props.items,\n children: undefined,\n collection,\n validationBehavior\n });\n\n let buttonRef = useRef<HTMLButtonElement>(null);\n let inputRef = useRef<HTMLInputElement>(null);\n let listBoxRef = useRef<HTMLDivElement>(null);\n let popoverRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot();\n let {\n buttonProps,\n inputProps,\n listBoxProps,\n labelProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useComboBox({\n ...removeDataAttributes(props),\n label,\n inputRef,\n buttonRef,\n listBoxRef,\n popoverRef,\n name: formValue === 'text' ? name : undefined,\n validationBehavior\n }, state);\n\n // Make menu width match input + button\n let [menuWidth, setMenuWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (inputRef.current) {\n let buttonRect = buttonRef.current?.getBoundingClientRect();\n let inputRect = inputRef.current.getBoundingClientRect();\n let minX = buttonRect ? Math.min(buttonRect.left, inputRect.left) : inputRect.left;\n let maxX = buttonRect ? Math.max(buttonRect.right, inputRect.right) : inputRect.right;\n setMenuWidth((maxX - minX) + 'px');\n }\n }, [buttonRef, inputRef, setMenuWidth]);\n\n useResizeObserver({\n ref: inputRef,\n onResize: onResize\n });\n\n // Only expose a subset of state to renderProps function to avoid infinite render loop\n let renderPropsState = useMemo(() => ({\n isOpen: state.isOpen,\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false,\n isRequired: props.isRequired || false\n }), [state.isOpen, props.isDisabled, validation.isInvalid, props.isRequired]);\n\n let renderProps = useRenderProps({\n ...props,\n values: renderPropsState,\n defaultClassName: 'react-aria-ComboBox'\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [ComboBoxStateContext, state],\n [LabelContext, {...labelProps, ref: labelRef}],\n [ButtonContext, {...buttonProps, ref: buttonRef, isPressed: state.isOpen}],\n [InputContext, {...inputProps, ref: inputRef}],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n ref: popoverRef,\n triggerRef: inputRef,\n scrollRef: listBoxRef,\n placement: 'bottom start',\n isNonModal: true,\n trigger: 'ComboBox',\n style: {'--trigger-width': menuWidth} as React.CSSProperties\n }],\n [ListBoxContext, {...listBoxProps, ref: listBoxRef}],\n [ListStateContext, state],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [GroupContext, {isInvalid: validation.isInvalid, isDisabled: props.isDisabled || false}],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-focused={state.isFocused || undefined}\n data-open={state.isOpen || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined}\n data-required={props.isRequired || undefined} />\n {name && formValue === 'key' && <input type=\"hidden\" name={name} value={state.selectedKey ?? ''} />}\n </Provider>\n );\n}\n\n/**\n * A combo box combines a text input with a listbox, allowing users to filter a list of options to items matching a query.\n */\nconst _ComboBox = /*#__PURE__*/ (forwardRef as forwardRefType)(ComboBox);\nexport {_ComboBox as ComboBox};\n"],"names":[],"version":3,"file":"ComboBox.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;AAuDM,MAAM,0DAAkB,CAAA,GAAA,0BAAY,EAAoD;AACxF,MAAM,0DAAuB,CAAA,GAAA,0BAAY,EAA6B;AAE7E,SAAS,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,IAAI;gBAAK;aAAE;YACxF;gBAAC,CAAA,GAAA,2CAAgB;gBAAG;aAAW;SAChC;qBACD,0DAAC;QACE,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,gBAAc,MAAM,SAAS,IAAI;QACjC,aAAW,MAAM,MAAM,IAAI;QAC3B,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,WAAW,SAAS,IAAI;QACtC,iBAAe,MAAM,UAAU,IAAI;QACpC,QAAQ,cAAc,uBAAS,0DAAC;QAAM,MAAK;QAAS,MAAM;QAAM,OAAO,CAAA,qBAAA,MAAM,WAAW,cAAjB,gCAAA,qBAAqB;;AAGnG;AAEA;;CAEC,GACD,MAAM,4CAA0B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB","sources":["packages/react-aria-components/src/ComboBox.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 */\nimport {AriaComboBoxProps, useComboBox, useFilter} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {Collection, ComboBoxState, Node, useComboBoxState} from 'react-stately';\nimport {CollectionBuilder} from '@react-aria/collections';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, useResizeObserver} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport {ListBoxContext, ListStateContext} from './ListBox';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useCallback, useMemo, useRef, useState} from 'react';\nimport {TextContext} from './Text';\n\nexport interface ComboBoxRenderProps {\n /**\n * Whether the combobox is currently open.\n * @selector [data-open]\n */\n isOpen: boolean,\n /**\n * Whether the combobox is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the combobox is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the combobox is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport interface ComboBoxProps<T extends object> extends Omit<AriaComboBoxProps<T>, 'children' | 'placeholder' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<ComboBoxRenderProps>, SlotProps {\n /** The filter function used to determine if a option should be included in the combo box list. */\n defaultFilter?: (textValue: string, inputValue: string) => boolean,\n /**\n * Whether the text or key of the selected item is submitted as part of an HTML form.\n * When `allowsCustomValue` is `true`, this option does not apply and the text is always submitted.\n * @default 'key'\n */\n formValue?: 'text' | 'key',\n /** Whether the combo box allows the menu to be open when the collection is empty. */\n allowsEmptyCollection?: boolean\n}\n\nexport const ComboBoxContext = createContext<ContextValue<ComboBoxProps<any>, HTMLDivElement>>(null);\nexport const ComboBoxStateContext = createContext<ComboBoxState<any> | null>(null);\n\nfunction ComboBox<T extends object>(props: ComboBoxProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ComboBoxContext);\n let {children, isDisabled = false, isInvalid = false, isRequired = false} = props;\n let content = useMemo(() => (\n <ListBoxContext.Provider value={{items: props.items ?? props.defaultItems}}>\n {typeof children === 'function'\n ? children({\n isOpen: false,\n isDisabled,\n isInvalid,\n isRequired,\n defaultChildren: null\n })\n : children}\n </ListBoxContext.Provider>\n ), [children, isDisabled, isInvalid, isRequired, props.items, props.defaultItems]);\n\n return (\n <CollectionBuilder content={content}>\n {collection => <ComboBoxInner props={props} collection={collection} comboBoxRef={ref} />}\n </CollectionBuilder>\n );\n}\n\ninterface ComboBoxInnerProps<T extends object> {\n props: ComboBoxProps<T>,\n collection: Collection<Node<T>>,\n comboBoxRef: RefObject<HTMLDivElement | null>\n}\n\nfunction ComboBoxInner<T extends object>({props, collection, comboBoxRef: ref}: ComboBoxInnerProps<T>) {\n let {\n name,\n formValue = 'key',\n allowsCustomValue\n } = props;\n if (allowsCustomValue) {\n formValue = 'text';\n }\n\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let {contains} = useFilter({sensitivity: 'base'});\n let state = useComboBoxState({\n defaultFilter: props.defaultFilter || contains,\n ...props,\n // If props.items isn't provided, rely on collection filtering (aka listbox.items is provided or defaultItems provided to Combobox)\n items: props.items,\n children: undefined,\n collection,\n validationBehavior\n });\n\n let buttonRef = useRef<HTMLButtonElement>(null);\n let inputRef = useRef<HTMLInputElement>(null);\n let listBoxRef = useRef<HTMLDivElement>(null);\n let popoverRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot();\n let {\n buttonProps,\n inputProps,\n listBoxProps,\n labelProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useComboBox({\n ...removeDataAttributes(props),\n label,\n inputRef,\n buttonRef,\n listBoxRef,\n popoverRef,\n name: formValue === 'text' ? name : undefined,\n validationBehavior\n }, state);\n\n // Make menu width match input + button\n let [menuWidth, setMenuWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (inputRef.current) {\n let buttonRect = buttonRef.current?.getBoundingClientRect();\n let inputRect = inputRef.current.getBoundingClientRect();\n let minX = buttonRect ? Math.min(buttonRect.left, inputRect.left) : inputRect.left;\n let maxX = buttonRect ? Math.max(buttonRect.right, inputRect.right) : inputRect.right;\n setMenuWidth((maxX - minX) + 'px');\n }\n }, [buttonRef, inputRef, setMenuWidth]);\n\n useResizeObserver({\n ref: inputRef,\n onResize: onResize\n });\n\n // Only expose a subset of state to renderProps function to avoid infinite render loop\n let renderPropsState = useMemo(() => ({\n isOpen: state.isOpen,\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false,\n isRequired: props.isRequired || false\n }), [state.isOpen, props.isDisabled, validation.isInvalid, props.isRequired]);\n\n let renderProps = useRenderProps({\n ...props,\n values: renderPropsState,\n defaultClassName: 'react-aria-ComboBox'\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [ComboBoxStateContext, state],\n [LabelContext, {...labelProps, ref: labelRef}],\n [ButtonContext, {...buttonProps, ref: buttonRef, isPressed: state.isOpen}],\n [InputContext, {...inputProps, ref: inputRef}],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n ref: popoverRef,\n triggerRef: inputRef,\n scrollRef: listBoxRef,\n placement: 'bottom start',\n isNonModal: true,\n trigger: 'ComboBox',\n style: {'--trigger-width': menuWidth} as React.CSSProperties\n }],\n [ListBoxContext, {...listBoxProps, ref: listBoxRef}],\n [ListStateContext, state],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [GroupContext, {isInvalid: validation.isInvalid, isDisabled: props.isDisabled || false}],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-focused={state.isFocused || undefined}\n data-open={state.isOpen || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined}\n data-required={props.isRequired || undefined} />\n {name && formValue === 'key' && <input type=\"hidden\" name={name} value={state.selectedKey ?? ''} />}\n </Provider>\n );\n}\n\n/**\n * A combo box combines a text input with a listbox, allowing users to filter a list of options to items matching a query.\n */\nconst _ComboBox = /*#__PURE__*/ (forwardRef as forwardRefType)(ComboBox);\nexport {_ComboBox as ComboBox};\n"],"names":[],"version":3,"file":"ComboBox.main.js.map"}
package/dist/ComboBox.mjs CHANGED
@@ -46,9 +46,9 @@ const $d01f2c01039c0eec$export$c02625b26074192c = /*#__PURE__*/ (0, $cP7hC$creat
46
46
  function $d01f2c01039c0eec$var$ComboBox(props, ref) {
47
47
  [props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $d01f2c01039c0eec$export$d414ccceff7063c3);
48
48
  let { children: children, isDisabled: isDisabled = false, isInvalid: isInvalid = false, isRequired: isRequired = false } = props;
49
- let content = (0, $cP7hC$useMemo)(()=>/*#__PURE__*/ {
49
+ let content = (0, $cP7hC$useMemo)(()=>{
50
50
  var _props_items;
51
- return (0, $cP7hC$react).createElement((0, $eed445e0843c11d0$export$7ff8f37d2d81a48d).Provider, {
51
+ return /*#__PURE__*/ (0, $cP7hC$react).createElement((0, $eed445e0843c11d0$export$7ff8f37d2d81a48d).Provider, {
52
52
  value: {
53
53
  items: (_props_items = props.items) !== null && _props_items !== void 0 ? _props_items : props.defaultItems
54
54
  }
@@ -46,9 +46,9 @@ const $d01f2c01039c0eec$export$c02625b26074192c = /*#__PURE__*/ (0, $cP7hC$creat
46
46
  function $d01f2c01039c0eec$var$ComboBox(props, ref) {
47
47
  [props, ref] = (0, $64fa3d84918910a7$export$29f1550f4b0d4415)(props, ref, $d01f2c01039c0eec$export$d414ccceff7063c3);
48
48
  let { children: children, isDisabled: isDisabled = false, isInvalid: isInvalid = false, isRequired: isRequired = false } = props;
49
- let content = (0, $cP7hC$useMemo)(()=>/*#__PURE__*/ {
49
+ let content = (0, $cP7hC$useMemo)(()=>{
50
50
  var _props_items;
51
- return (0, $cP7hC$react).createElement((0, $eed445e0843c11d0$export$7ff8f37d2d81a48d).Provider, {
51
+ return /*#__PURE__*/ (0, $cP7hC$react).createElement((0, $eed445e0843c11d0$export$7ff8f37d2d81a48d).Provider, {
52
52
  value: {
53
53
  items: (_props_items = props.items) !== null && _props_items !== void 0 ? _props_items : props.defaultItems
54
54
  }
@@ -1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;YACzB;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAW;gBAAG;oBAAC,WAAW,WAAW,SAAS;oBAAE,YAAY,MAAM,UAAU,IAAI;gBAAK;aAAE;YACxF;gBAAC,CAAA,GAAA,yCAAgB;gBAAG;aAAW;SAChC;qBACD,gCAAC;QACE,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,gBAAc,MAAM,SAAS,IAAI;QACjC,aAAW,MAAM,MAAM,IAAI;QAC3B,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,WAAW,SAAS,IAAI;QACtC,iBAAe,MAAM,UAAU,IAAI;QACpC,QAAQ,cAAc,uBAAS,gCAAC;QAAM,MAAK;QAAS,MAAM;QAAM,OAAO,CAAA,qBAAA,MAAM,WAAW,cAAjB,gCAAA,qBAAqB;;AAGnG;AAEA;;CAEC,GACD,MAAM,4CAA0B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB","sources":["packages/react-aria-components/src/ComboBox.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 */\nimport {AriaComboBoxProps, useComboBox, useFilter} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {Collection, ComboBoxState, Node, useComboBoxState} from 'react-stately';\nimport {CollectionBuilder} from '@react-aria/collections';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, useResizeObserver} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport {ListBoxContext, ListStateContext} from './ListBox';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useCallback, useMemo, useRef, useState} from 'react';\nimport {TextContext} from './Text';\n\nexport interface ComboBoxRenderProps {\n /**\n * Whether the combobox is currently open.\n * @selector [data-open]\n */\n isOpen: boolean,\n /**\n * Whether the combobox is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the combobox is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the combobox is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport interface ComboBoxProps<T extends object> extends Omit<AriaComboBoxProps<T>, 'children' | 'placeholder' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<ComboBoxRenderProps>, SlotProps {\n /** The filter function used to determine if a option should be included in the combo box list. */\n defaultFilter?: (textValue: string, inputValue: string) => boolean,\n /**\n * Whether the text or key of the selected item is submitted as part of an HTML form.\n * When `allowsCustomValue` is `true`, this option does not apply and the text is always submitted.\n * @default 'key'\n */\n formValue?: 'text' | 'key',\n /** Whether the combo box allows the menu to be open when the collection is empty. */\n allowsEmptyCollection?: boolean\n}\n\nexport const ComboBoxContext = createContext<ContextValue<ComboBoxProps<any>, HTMLDivElement>>(null);\nexport const ComboBoxStateContext = createContext<ComboBoxState<any> | null>(null);\n\nfunction ComboBox<T extends object>(props: ComboBoxProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ComboBoxContext);\n let {children, isDisabled = false, isInvalid = false, isRequired = false} = props;\n let content = useMemo(() => (\n <ListBoxContext.Provider value={{items: props.items ?? props.defaultItems}}>\n {typeof children === 'function'\n ? children({\n isOpen: false,\n isDisabled,\n isInvalid,\n isRequired,\n defaultChildren: null\n })\n : children}\n </ListBoxContext.Provider>\n ), [children, isDisabled, isInvalid, isRequired, props.items, props.defaultItems]);\n\n return (\n <CollectionBuilder content={content}>\n {collection => <ComboBoxInner props={props} collection={collection} comboBoxRef={ref} />}\n </CollectionBuilder>\n );\n}\n\ninterface ComboBoxInnerProps<T extends object> {\n props: ComboBoxProps<T>,\n collection: Collection<Node<T>>,\n comboBoxRef: RefObject<HTMLDivElement | null>\n}\n\nfunction ComboBoxInner<T extends object>({props, collection, comboBoxRef: ref}: ComboBoxInnerProps<T>) {\n let {\n name,\n formValue = 'key',\n allowsCustomValue\n } = props;\n if (allowsCustomValue) {\n formValue = 'text';\n }\n\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let {contains} = useFilter({sensitivity: 'base'});\n let state = useComboBoxState({\n defaultFilter: props.defaultFilter || contains,\n ...props,\n // If props.items isn't provided, rely on collection filtering (aka listbox.items is provided or defaultItems provided to Combobox)\n items: props.items,\n children: undefined,\n collection,\n validationBehavior\n });\n\n let buttonRef = useRef<HTMLButtonElement>(null);\n let inputRef = useRef<HTMLInputElement>(null);\n let listBoxRef = useRef<HTMLDivElement>(null);\n let popoverRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot();\n let {\n buttonProps,\n inputProps,\n listBoxProps,\n labelProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useComboBox({\n ...removeDataAttributes(props),\n label,\n inputRef,\n buttonRef,\n listBoxRef,\n popoverRef,\n name: formValue === 'text' ? name : undefined,\n validationBehavior\n }, state);\n\n // Make menu width match input + button\n let [menuWidth, setMenuWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (inputRef.current) {\n let buttonRect = buttonRef.current?.getBoundingClientRect();\n let inputRect = inputRef.current.getBoundingClientRect();\n let minX = buttonRect ? Math.min(buttonRect.left, inputRect.left) : inputRect.left;\n let maxX = buttonRect ? Math.max(buttonRect.right, inputRect.right) : inputRect.right;\n setMenuWidth((maxX - minX) + 'px');\n }\n }, [buttonRef, inputRef, setMenuWidth]);\n\n useResizeObserver({\n ref: inputRef,\n onResize: onResize\n });\n\n // Only expose a subset of state to renderProps function to avoid infinite render loop\n let renderPropsState = useMemo(() => ({\n isOpen: state.isOpen,\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false,\n isRequired: props.isRequired || false\n }), [state.isOpen, props.isDisabled, validation.isInvalid, props.isRequired]);\n\n let renderProps = useRenderProps({\n ...props,\n values: renderPropsState,\n defaultClassName: 'react-aria-ComboBox'\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [ComboBoxStateContext, state],\n [LabelContext, {...labelProps, ref: labelRef}],\n [ButtonContext, {...buttonProps, ref: buttonRef, isPressed: state.isOpen}],\n [InputContext, {...inputProps, ref: inputRef}],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n ref: popoverRef,\n triggerRef: inputRef,\n scrollRef: listBoxRef,\n placement: 'bottom start',\n isNonModal: true,\n trigger: 'ComboBox',\n style: {'--trigger-width': menuWidth} as React.CSSProperties\n }],\n [ListBoxContext, {...listBoxProps, ref: listBoxRef}],\n [ListStateContext, state],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [GroupContext, {isInvalid: validation.isInvalid, isDisabled: props.isDisabled || false}],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-focused={state.isFocused || undefined}\n data-open={state.isOpen || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined}\n data-required={props.isRequired || undefined} />\n {name && formValue === 'key' && <input type=\"hidden\" name={name} value={state.selectedKey ?? ''} />}\n </Provider>\n );\n}\n\n/**\n * A combo box combines a text input with a listbox, allowing users to filter a list of options to items matching a query.\n */\nconst _ComboBox = /*#__PURE__*/ (forwardRef as forwardRefType)(ComboBox);\nexport {_ComboBox as ComboBox};\n"],"names":[],"version":3,"file":"ComboBox.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;;AAuDM,MAAM,0DAAkB,CAAA,GAAA,oBAAY,EAAoD;AACxF,MAAM,0DAAuB,CAAA,GAAA,oBAAY,EAA6B;AAE7E,SAAS,+BAA2B,KAAuB,EAAE,GAAiC;IAC5F,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,YAAC,QAAQ,cAAE,aAAa,kBAAO,YAAY,mBAAO,aAAa,OAAM,GAAG;IAC5E,IAAI,UAAU,CAAA,GAAA,cAAM,EAAE;YACoB;6BAAxC,gCAAC,CAAA,GAAA,yCAAa,EAAE,QAAQ;YAAC,OAAO;gBAAC,OAAO,CAAA,eAAA,MAAM,KAAK,cAAX,0BAAA,eAAe,MAAM,YAAY;YAAA;WACtE,OAAO,aAAa,aACjB,SAAS;YACT,QAAQ;wBACR;uBACA;wBACA;YACA,iBAAiB;QACnB,KACE;OAEL;QAAC;QAAU;QAAY;QAAW;QAAY,MAAM,KAAK;QAAE,MAAM,YAAY;KAAC;IAEjF,qBACE,gCAAC,CAAA,GAAA,wBAAgB;QAAE,SAAS;OACzB,CAAA,2BAAc,gCAAC;YAAc,OAAO;YAAO,YAAY;YAAY,aAAa;;AAGvF;AAQA,SAAS,oCAAgC,SAAC,KAAK,cAAE,UAAU,EAAE,aAAa,GAAG,EAAwB;IACnG,IAAI,QACF,IAAI,aACJ,YAAY,0BACZ,iBAAiB,EAClB,GAAG;IACJ,IAAI,mBACF,YAAY;IAGd,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA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;oBACZ,SAAS;oBACT,OAAO;wBAAC,mBAAmB;oBAAS;gBACtC;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAa;gBAAG;oBAAC,GAAG,YAAY;oBAAE,KAAK;gBAAU;aAAE;YACpD;gBAAC,CAAA,GAAA,yCAAe;gBAAG;aAAM;YACzB;gBAAC,CAAA,GAAA,yCAAU;gBAAG;oBACZ,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aAAE;YACF;gBAAC,CAAA,GAAA,yCAAW;gBAAG;oBAAC,WAAW,WAAW,SAAS;oBAAE,YAAY,MAAM,UAAU,IAAI;gBAAK;aAAE;YACxF;gBAAC,CAAA,GAAA,yCAAgB;gBAAG;aAAW;SAChC;qBACD,gCAAC;QACE,GAAG,QAAQ;QACX,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,gBAAc,MAAM,SAAS,IAAI;QACjC,aAAW,MAAM,MAAM,IAAI;QAC3B,iBAAe,MAAM,UAAU,IAAI;QACnC,gBAAc,WAAW,SAAS,IAAI;QACtC,iBAAe,MAAM,UAAU,IAAI;QACpC,QAAQ,cAAc,uBAAS,gCAAC;QAAM,MAAK;QAAS,MAAM;QAAM,OAAO,CAAA,qBAAA,MAAM,WAAW,cAAjB,gCAAA,qBAAqB;;AAGnG;AAEA;;CAEC,GACD,MAAM,4CAA0B,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,EAAqB","sources":["packages/react-aria-components/src/ComboBox.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 */\nimport {AriaComboBoxProps, useComboBox, useFilter} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {Collection, ComboBoxState, Node, useComboBoxState} from 'react-stately';\nimport {CollectionBuilder} from '@react-aria/collections';\nimport {ContextValue, Provider, RACValidation, removeDataAttributes, RenderProps, SlotProps, useContextProps, useRenderProps, useSlot, useSlottedContext} from './utils';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps, useResizeObserver} from '@react-aria/utils';\nimport {FormContext} from './Form';\nimport {forwardRefType, RefObject} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {InputContext} from './Input';\nimport {LabelContext} from './Label';\nimport {ListBoxContext, ListStateContext} from './ListBox';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useCallback, useMemo, useRef, useState} from 'react';\nimport {TextContext} from './Text';\n\nexport interface ComboBoxRenderProps {\n /**\n * Whether the combobox is currently open.\n * @selector [data-open]\n */\n isOpen: boolean,\n /**\n * Whether the combobox is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the combobox is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the combobox is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport interface ComboBoxProps<T extends object> extends Omit<AriaComboBoxProps<T>, 'children' | 'placeholder' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'>, RACValidation, RenderProps<ComboBoxRenderProps>, SlotProps {\n /** The filter function used to determine if a option should be included in the combo box list. */\n defaultFilter?: (textValue: string, inputValue: string) => boolean,\n /**\n * Whether the text or key of the selected item is submitted as part of an HTML form.\n * When `allowsCustomValue` is `true`, this option does not apply and the text is always submitted.\n * @default 'key'\n */\n formValue?: 'text' | 'key',\n /** Whether the combo box allows the menu to be open when the collection is empty. */\n allowsEmptyCollection?: boolean\n}\n\nexport const ComboBoxContext = createContext<ContextValue<ComboBoxProps<any>, HTMLDivElement>>(null);\nexport const ComboBoxStateContext = createContext<ComboBoxState<any> | null>(null);\n\nfunction ComboBox<T extends object>(props: ComboBoxProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, ComboBoxContext);\n let {children, isDisabled = false, isInvalid = false, isRequired = false} = props;\n let content = useMemo(() => (\n <ListBoxContext.Provider value={{items: props.items ?? props.defaultItems}}>\n {typeof children === 'function'\n ? children({\n isOpen: false,\n isDisabled,\n isInvalid,\n isRequired,\n defaultChildren: null\n })\n : children}\n </ListBoxContext.Provider>\n ), [children, isDisabled, isInvalid, isRequired, props.items, props.defaultItems]);\n\n return (\n <CollectionBuilder content={content}>\n {collection => <ComboBoxInner props={props} collection={collection} comboBoxRef={ref} />}\n </CollectionBuilder>\n );\n}\n\ninterface ComboBoxInnerProps<T extends object> {\n props: ComboBoxProps<T>,\n collection: Collection<Node<T>>,\n comboBoxRef: RefObject<HTMLDivElement | null>\n}\n\nfunction ComboBoxInner<T extends object>({props, collection, comboBoxRef: ref}: ComboBoxInnerProps<T>) {\n let {\n name,\n formValue = 'key',\n allowsCustomValue\n } = props;\n if (allowsCustomValue) {\n formValue = 'text';\n }\n\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let {contains} = useFilter({sensitivity: 'base'});\n let state = useComboBoxState({\n defaultFilter: props.defaultFilter || contains,\n ...props,\n // If props.items isn't provided, rely on collection filtering (aka listbox.items is provided or defaultItems provided to Combobox)\n items: props.items,\n children: undefined,\n collection,\n validationBehavior\n });\n\n let buttonRef = useRef<HTMLButtonElement>(null);\n let inputRef = useRef<HTMLInputElement>(null);\n let listBoxRef = useRef<HTMLDivElement>(null);\n let popoverRef = useRef<HTMLDivElement>(null);\n let [labelRef, label] = useSlot();\n let {\n buttonProps,\n inputProps,\n listBoxProps,\n labelProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useComboBox({\n ...removeDataAttributes(props),\n label,\n inputRef,\n buttonRef,\n listBoxRef,\n popoverRef,\n name: formValue === 'text' ? name : undefined,\n validationBehavior\n }, state);\n\n // Make menu width match input + button\n let [menuWidth, setMenuWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (inputRef.current) {\n let buttonRect = buttonRef.current?.getBoundingClientRect();\n let inputRect = inputRef.current.getBoundingClientRect();\n let minX = buttonRect ? Math.min(buttonRect.left, inputRect.left) : inputRect.left;\n let maxX = buttonRect ? Math.max(buttonRect.right, inputRect.right) : inputRect.right;\n setMenuWidth((maxX - minX) + 'px');\n }\n }, [buttonRef, inputRef, setMenuWidth]);\n\n useResizeObserver({\n ref: inputRef,\n onResize: onResize\n });\n\n // Only expose a subset of state to renderProps function to avoid infinite render loop\n let renderPropsState = useMemo(() => ({\n isOpen: state.isOpen,\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false,\n isRequired: props.isRequired || false\n }), [state.isOpen, props.isDisabled, validation.isInvalid, props.isRequired]);\n\n let renderProps = useRenderProps({\n ...props,\n values: renderPropsState,\n defaultClassName: 'react-aria-ComboBox'\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n return (\n <Provider\n values={[\n [ComboBoxStateContext, state],\n [LabelContext, {...labelProps, ref: labelRef}],\n [ButtonContext, {...buttonProps, ref: buttonRef, isPressed: state.isOpen}],\n [InputContext, {...inputProps, ref: inputRef}],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n ref: popoverRef,\n triggerRef: inputRef,\n scrollRef: listBoxRef,\n placement: 'bottom start',\n isNonModal: true,\n trigger: 'ComboBox',\n style: {'--trigger-width': menuWidth} as React.CSSProperties\n }],\n [ListBoxContext, {...listBoxProps, ref: listBoxRef}],\n [ListStateContext, state],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [GroupContext, {isInvalid: validation.isInvalid, isDisabled: props.isDisabled || false}],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}\n data-focused={state.isFocused || undefined}\n data-open={state.isOpen || undefined}\n data-disabled={props.isDisabled || undefined}\n data-invalid={validation.isInvalid || undefined}\n data-required={props.isRequired || undefined} />\n {name && formValue === 'key' && <input type=\"hidden\" name={name} value={state.selectedKey ?? ''} />}\n </Provider>\n );\n}\n\n/**\n * A combo box combines a text input with a listbox, allowing users to filter a list of options to items matching a query.\n */\nconst _ComboBox = /*#__PURE__*/ (forwardRef as forwardRefType)(ComboBox);\nexport {_ComboBox as ComboBox};\n"],"names":[],"version":3,"file":"ComboBox.module.js.map"}
@@ -1,6 +1,8 @@
1
+ var $b856e6788a7ea5bf$exports = require("./Button.main.js");
1
2
  var $c5ccf687772c0422$exports = require("./utils.main.js");
2
3
  var $525402dfec7da5bc$exports = require("./RSPContexts.main.js");
3
4
  var $61e2b7078adb18bc$exports = require("./Popover.main.js");
5
+ var $a8f6e7d095d1cc86$exports = require("./Menu.main.js");
4
6
  var $03da9$reactaria = require("react-aria");
5
7
  var $03da9$reactariautils = require("@react-aria/utils");
6
8
  var $03da9$reactstately = require("react-stately");
@@ -38,10 +40,14 @@ $parcel$export(module.exports, "Dialog", () => $2979ab89b336194b$export$3ddf2d17
38
40
 
39
41
 
40
42
 
43
+
44
+
41
45
  const $2979ab89b336194b$export$8b93a07348a7730c = /*#__PURE__*/ (0, $03da9$react.createContext)(null);
42
46
  const $2979ab89b336194b$export$d2f961adcb0afbe = /*#__PURE__*/ (0, $03da9$react.createContext)(null);
43
47
  function $2979ab89b336194b$export$2e1e1122cf0cba88(props) {
44
- let state = (0, $03da9$reactstately.useOverlayTriggerState)(props);
48
+ // Use useMenuTriggerState instead of useOverlayTriggerState in case a menu is embedded in the dialog.
49
+ // This is needed to handle submenus.
50
+ let state = (0, $03da9$reactstately.useMenuTriggerState)(props);
45
51
  let buttonRef = (0, $03da9$react.useRef)(null);
46
52
  let { triggerProps: triggerProps, overlayProps: overlayProps } = (0, $03da9$reactaria.useOverlayTrigger)({
47
53
  type: 'dialog'
@@ -58,6 +64,10 @@ function $2979ab89b336194b$export$2e1e1122cf0cba88(props) {
58
64
  $2979ab89b336194b$export$d2f961adcb0afbe,
59
65
  state
60
66
  ],
67
+ [
68
+ (0, $a8f6e7d095d1cc86$exports.RootMenuTriggerStateContext),
69
+ state
70
+ ],
61
71
  [
62
72
  $2979ab89b336194b$export$8b93a07348a7730c,
63
73
  overlayProps
@@ -120,6 +130,17 @@ function $2979ab89b336194b$var$Dialog(props, ref) {
120
130
  }
121
131
  }
122
132
  }
133
+ ],
134
+ [
135
+ (0, $b856e6788a7ea5bf$exports.ButtonContext),
136
+ {
137
+ slots: {
138
+ [(0, $c5ccf687772c0422$exports.DEFAULT_SLOT)]: {},
139
+ close: {
140
+ onPress: ()=>state === null || state === void 0 ? void 0 : state.close()
141
+ }
142
+ }
143
+ }
123
144
  ]
124
145
  ]
125
146
  }, renderProps.children));
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAwBM,MAAM,0DAAgB,CAAA,GAAA,0BAAY,EAA0C;AAC5E,MAAM,yDAA6B,CAAA,GAAA,0BAAY,EAA8B;AAK7E,SAAS,0CAAc,KAAyB;IACrD,IAAI,QAAQ,CAAA,GAAA,0CAAqB,EAAE;IAEnC,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAqB;IAC1C,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,kCAAgB,EAAE;QAAC,MAAM;IAAQ,GAAG,OAAO;IAE9E,uEAAuE;IACvE,+EAA+E;IAC/E,0EAA0E;IAC1E,qDAAqD;IACrD,aAAa,EAAE,GAAG,CAAA,GAAA,sBAAI;IACtB,YAAY,CAAC,kBAAkB,GAAG,aAAa,EAAE;IAEjD,qBACE,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC;gBAA4B;aAAM;YACnC;g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wBACL,CAAC,CAAA,GAAA,sCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;4BAAC,GAAG,UAAU;4BAAE,OAAO;wBAAC;oBACjC;gBACF;aAAE;SACH;OACA,YAAY,QAAQ;AAI7B;AAEA;;CAEC,GACD,MAAM,4CAAwB,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB","sources":["packages/react-aria-components/src/Dialog.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 */\nimport {AriaDialogProps, useDialog, useId, useOverlayTrigger} from 'react-aria';\nimport {ContextValue, DEFAULT_SLOT, Provider, SlotProps, StyleProps, useContextProps, useRenderProps} from './utils';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {forwardRefType} from '@react-types/shared';\nimport {HeadingContext} from './RSPContexts';\nimport {OverlayTriggerProps, OverlayTriggerState, useOverlayTriggerState} from 'react-stately';\nimport {PopoverContext} from './Popover';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {createContext, ForwardedRef, forwardRef, ReactNode, useContext, useRef} from 'react';\n\nexport interface DialogTriggerProps extends OverlayTriggerProps {\n children: ReactNode\n}\n\ninterface DialogRenderProps {\n close: () => void\n}\n\nexport interface DialogProps extends AriaDialogProps, StyleProps, SlotProps {\n /** Children of the dialog. A function may be provided to access a function to close the dialog. */\n children?: ReactNode | ((opts: DialogRenderProps) => ReactNode)\n}\n\nexport const DialogContext = createContext<ContextValue<DialogProps, HTMLElement>>(null);\nexport const OverlayTriggerStateContext = createContext<OverlayTriggerState | null>(null);\n\n/**\n * A DialogTrigger opens a dialog when a trigger element is pressed.\n */\nexport function DialogTrigger(props: DialogTriggerProps) {\n let state = useOverlayTriggerState(props);\n\n let buttonRef = useRef<HTMLButtonElement>(null);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'dialog'}, state, buttonRef);\n\n // Label dialog by the trigger as a fallback if there is no title slot.\n // This is done in RAC instead of hooks because otherwise we cannot distinguish\n // between context and props. Normally aria-labelledby overrides the title\n // but when sent by context we want the title to win.\n triggerProps.id = useId();\n overlayProps['aria-labelledby'] = triggerProps.id;\n\n return (\n <Provider\n values={[\n [OverlayTriggerStateContext, state],\n [DialogContext, overlayProps],\n [PopoverContext, {trigger: 'DialogTrigger', triggerRef: buttonRef}]\n ]}>\n <PressResponder {...triggerProps} ref={buttonRef} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\nfunction Dialog(props: DialogProps, ref: ForwardedRef<HTMLElement>) {\n let originalAriaLabelledby = props['aria-labelledby'];\n [props, ref] = useContextProps(props, ref, DialogContext);\n let {dialogProps, titleProps} = useDialog({\n ...props,\n // Only pass aria-labelledby from props, not context.\n // Context is used as a fallback below.\n 'aria-labelledby': originalAriaLabelledby\n }, ref);\n let state = useContext(OverlayTriggerStateContext);\n\n if (!dialogProps['aria-label'] && !dialogProps['aria-labelledby']) {\n // If aria-labelledby exists on props, we know it came from context.\n // Use that as a fallback in case there is no title slot.\n if (props['aria-labelledby']) {\n dialogProps['aria-labelledby'] = props['aria-labelledby'];\n } else {\n console.warn('If a Dialog does not contain a <Heading slot=\"title\">, it must have an aria-label or aria-labelledby attribute for accessibility.');\n }\n }\n\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Dialog',\n className: props.className,\n style: props.style,\n children: props.children,\n values: {\n close: state?.close || (() => {})\n }\n });\n\n return (\n <section\n {...filterDOMProps(props)}\n {...dialogProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}>\n <Provider\n values={[\n [HeadingContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n title: {...titleProps, level: 2}\n }\n }]\n ]}>\n {renderProps.children}\n </Provider>\n </section>\n );\n}\n\n/**\n * A dialog is an overlay shown above other content in an application.\n */\nconst _Dialog = /*#__PURE__*/ (forwardRef as forwardRefType)(Dialog);\nexport {_Dialog as Dialog};\n"],"names":[],"version":3,"file":"Dialog.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AA0BM,MAAM,0DAAgB,CAAA,GAAA,0BAAY,EAA0C;AAC5E,MAAM,yDAA6B,CAAA,GAAA,0BAAY,EAA8B;AAK7E,SAAS,0CAAc,KAAyB;IACrD,sGAAsG;IACtG,qCAAqC;IACrC,IAAI,QAAQ,CAAA,GAAA,uCAAkB,EAAE;IAEhC,IAAI,YAAY,CAAA,GAAA,mBAAK,EAAqB;IAC1C,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,kCAAgB,EAAE;QAAC,MAAM;IAAQ,GAAG,OAAO;IAE9E,uEAAuE;IACvE,+EAA+E;IAC/E,0EAA0E;IAC1E,qDAAqD;IACrD,aAAa,EAAE,GAAG,CAAA,GAAA,sBAAI;IACtB,YAAY,CAAC,kBAAkB,GAAG,aAAa,EAAE;IAEjD,qBACE,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC;gBAA4B;aAAM;YACnC;gBAAC,CAAA,GAAA,qDAA0B;gBAAG;aAAM;YACpC;gBAAC;gBAAe;aAAa;YAC7B;gBAAC,CAAA,GAAA,wCAAa;gBAAG;oBAAC,SAAS;oBAAiB,YAAY;gBAAS;aAAE;SACpE;qBACD,0DAAC,CAAA,GAAA,2CAAa;QAAG,GAAG,YAAY;QAAE,KAAK;QAAW,WAAW,MAAM,MAAM;OACtE,MAAM,QAAQ;AAIvB;AAEA,SAAS,6BAAO,KAAkB,EAAE,GAA8B;IAChE,IAAI,yBAAyB,KAAK,CAAC,kBAAkB;IACrD,CAAC,O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,YAAY,QAAQ;AAI7B;AAEA;;CAEC,GACD,MAAM,4CAAwB,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB","sources":["packages/react-aria-components/src/Dialog.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 */\nimport {AriaDialogProps, useDialog, useId, useOverlayTrigger} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {ContextValue, DEFAULT_SLOT, Provider, SlotProps, StyleProps, useContextProps, useRenderProps} from './utils';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {forwardRefType} from '@react-types/shared';\nimport {HeadingContext} from './RSPContexts';\nimport {OverlayTriggerProps, OverlayTriggerState, useMenuTriggerState} from 'react-stately';\nimport {PopoverContext} from './Popover';\nimport {PressResponder} from '@react-aria/interactions';\nimport React, {createContext, ForwardedRef, forwardRef, ReactNode, useContext, useRef} from 'react';\nimport {RootMenuTriggerStateContext} from './Menu';\n\nexport interface DialogTriggerProps extends OverlayTriggerProps {\n children: ReactNode\n}\n\ninterface DialogRenderProps {\n close: () => void\n}\n\nexport interface DialogProps extends AriaDialogProps, StyleProps, SlotProps {\n /** Children of the dialog. A function may be provided to access a function to close the dialog. */\n children?: ReactNode | ((opts: DialogRenderProps) => ReactNode)\n}\n\nexport const DialogContext = createContext<ContextValue<DialogProps, HTMLElement>>(null);\nexport const OverlayTriggerStateContext = createContext<OverlayTriggerState | null>(null);\n\n/**\n * A DialogTrigger opens a dialog when a trigger element is pressed.\n */\nexport function DialogTrigger(props: DialogTriggerProps) {\n // Use useMenuTriggerState instead of useOverlayTriggerState in case a menu is embedded in the dialog.\n // This is needed to handle submenus.\n let state = useMenuTriggerState(props);\n\n let buttonRef = useRef<HTMLButtonElement>(null);\n let {triggerProps, overlayProps} = useOverlayTrigger({type: 'dialog'}, state, buttonRef);\n\n // Label dialog by the trigger as a fallback if there is no title slot.\n // This is done in RAC instead of hooks because otherwise we cannot distinguish\n // between context and props. Normally aria-labelledby overrides the title\n // but when sent by context we want the title to win.\n triggerProps.id = useId();\n overlayProps['aria-labelledby'] = triggerProps.id;\n\n return (\n <Provider\n values={[\n [OverlayTriggerStateContext, state],\n [RootMenuTriggerStateContext, state],\n [DialogContext, overlayProps],\n [PopoverContext, {trigger: 'DialogTrigger', triggerRef: buttonRef}]\n ]}>\n <PressResponder {...triggerProps} ref={buttonRef} isPressed={state.isOpen}>\n {props.children}\n </PressResponder>\n </Provider>\n );\n}\n\nfunction Dialog(props: DialogProps, ref: ForwardedRef<HTMLElement>) {\n let originalAriaLabelledby = props['aria-labelledby'];\n [props, ref] = useContextProps(props, ref, DialogContext);\n let {dialogProps, titleProps} = useDialog({\n ...props,\n // Only pass aria-labelledby from props, not context.\n // Context is used as a fallback below.\n 'aria-labelledby': originalAriaLabelledby\n }, ref);\n let state = useContext(OverlayTriggerStateContext);\n\n if (!dialogProps['aria-label'] && !dialogProps['aria-labelledby']) {\n // If aria-labelledby exists on props, we know it came from context.\n // Use that as a fallback in case there is no title slot.\n if (props['aria-labelledby']) {\n dialogProps['aria-labelledby'] = props['aria-labelledby'];\n } else {\n console.warn('If a Dialog does not contain a <Heading slot=\"title\">, it must have an aria-label or aria-labelledby attribute for accessibility.');\n }\n }\n\n let renderProps = useRenderProps({\n defaultClassName: 'react-aria-Dialog',\n className: props.className,\n style: props.style,\n children: props.children,\n values: {\n close: state?.close || (() => {})\n }\n });\n\n return (\n <section\n {...filterDOMProps(props)}\n {...dialogProps}\n {...renderProps}\n ref={ref}\n slot={props.slot || undefined}>\n <Provider\n values={[\n [HeadingContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n title: {...titleProps, level: 2}\n }\n }],\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n close: {\n onPress: () => state?.close()\n }\n }\n }]\n ]}>\n {renderProps.children}\n </Provider>\n </section>\n );\n}\n\n/**\n * A dialog is an overlay shown above other content in an application.\n */\nconst _Dialog = /*#__PURE__*/ (forwardRef as forwardRefType)(Dialog);\nexport {_Dialog as Dialog};\n"],"names":[],"version":3,"file":"Dialog.main.js.map"}