react-aria-components 3.0.0-nightly-db60babaf-241014 → 3.0.0-nightly-e1b72a79f-241016

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.
@@ -86,24 +86,27 @@ function $2979ab89b336194b$var$Dialog(props, ref) {
86
86
  'aria-labelledby': originalAriaLabelledby
87
87
  }, ref);
88
88
  let state = (0, $03da9$react.useContext)($2979ab89b336194b$export$d2f961adcb0afbe);
89
- let children = props.children;
90
- if (typeof children === 'function') children = children({
91
- close: (state === null || state === void 0 ? void 0 : state.close) || (()=>{})
92
- });
93
89
  if (!dialogProps['aria-label'] && !dialogProps['aria-labelledby']) {
94
90
  // If aria-labelledby exists on props, we know it came from context.
95
91
  // Use that as a fallback in case there is no title slot.
96
92
  if (props['aria-labelledby']) dialogProps['aria-labelledby'] = props['aria-labelledby'];
97
93
  else console.warn('If a Dialog does not contain a <Heading slot="title">, it must have an aria-label or aria-labelledby attribute for accessibility.');
98
94
  }
99
- var _props_className;
95
+ let renderProps = (0, $c5ccf687772c0422$exports.useRenderProps)({
96
+ defaultClassName: 'react-aria-Dialog',
97
+ className: props.className,
98
+ style: props.style,
99
+ children: props.children,
100
+ values: {
101
+ close: (state === null || state === void 0 ? void 0 : state.close) || (()=>{})
102
+ }
103
+ });
100
104
  return /*#__PURE__*/ (0, ($parcel$interopDefault($03da9$react))).createElement("section", {
101
105
  ...(0, $03da9$reactariautils.filterDOMProps)(props),
102
106
  ...dialogProps,
107
+ ...renderProps,
103
108
  ref: ref,
104
- slot: props.slot || undefined,
105
- style: props.style,
106
- className: (_props_className = props.className) !== null && _props_className !== void 0 ? _props_className : 'react-aria-Dialog'
109
+ slot: props.slot || undefined
107
110
  }, /*#__PURE__*/ (0, ($parcel$interopDefault($03da9$react))).createElement((0, $c5ccf687772c0422$exports.Provider), {
108
111
  values: [
109
112
  [
@@ -119,7 +122,7 @@ function $2979ab89b336194b$var$Dialog(props, ref) {
119
122
  }
120
123
  ]
121
124
  ]
122
- }, children));
125
+ }, renderProps.children));
123
126
  }
124
127
  /**
125
128
  * A dialog is an overlay shown above other content in an application.
@@ -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;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,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,eAAC,WAAW,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,0BAAQ,EAAE;QACxC,GAAG,KAAK;QACR,qDAAqD;QACrD,uCAAuC;QACvC,mBAAmB;IACrB,GAAG;IACH,IAAI,QAAQ,CAAA,GAAA,uBAAS,EAAE;IAEvB,IAAI,WAAW,MAAM,QAAQ;IAC7B,IAAI,OAAO,aAAa,YACtB,WAAW,SAAS;QAClB,OAAO,CAAA,kBAAA,4BAAA,MAAO,KAAK,KAAK,CAAA,KAAO,CAAA;IACjC;IAGF,IAAI,CAAC,WAAW,CAAC,aAAa,IAAI,CAAC,WAAW,CAAC,kBAAkB;QAC/D,oEAAoE;QACpE,yDAAyD;QACzD,IAAI,KAAK,CAAC,kBAAkB,EAC1B,WAAW,CAAC,kBAAkB,GAAG,KAAK,CAAC,kBAAkB;aAEzD,QAAQ,IAAI,CAAC;;QAWF;IAPf,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,oCAAa,EAAE,MAAM;QACxB,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,OAAO,MAAM,KAAK;QAClB,WAAW,CAAA,mBAAA,MAAM,SAAS,cAAf,8BAAA,mBAAmB;qBAC9B,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,wCAAa;gBAAG;oBACf,OAAO;wBACL,CAAC,CAAA,GAAA,sCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;4BAAC,GAAG,UAAU;4BAAE,OAAO;wBAAC;oBACjC;gBACF;aAAE;SACH;OACA;AAIT;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} 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 let children = props.children;\n if (typeof children === 'function') {\n children = children({\n close: state?.close || (() => {})\n });\n }\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 return (\n <section\n {...filterDOMProps(props)}\n {...dialogProps}\n ref={ref}\n slot={props.slot || undefined}\n style={props.style}\n className={props.className ?? 'react-aria-Dialog'}>\n <Provider\n values={[\n [HeadingContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n title: {...titleProps, level: 2}\n }\n }]\n ]}>\n {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;;;;;;;;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,GA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AAA,MAAO,KAAK,KAAK,CAAA,KAAO,CAAA;QACjC;IACF;IAEA,qBACE,0DAAC;QACE,GAAG,CAAA,GAAA,oCAAa,EAAE,MAAM;QACxB,GAAG,WAAW;QACd,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;qBACpB,0DAAC,CAAA,GAAA,kCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,wCAAa;gBAAG;oBACf,OAAO;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"}
package/dist/Dialog.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import {DEFAULT_SLOT as $64fa3d84918910a7$export$c62b8e45d58ddad9, Provider as $64fa3d84918910a7$export$2881499e37b75b9a, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415} from "./utils.mjs";
1
+ import {DEFAULT_SLOT as $64fa3d84918910a7$export$c62b8e45d58ddad9, Provider as $64fa3d84918910a7$export$2881499e37b75b9a, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.mjs";
2
2
  import {HeadingContext as $4e85f108e88277b8$export$d688439359537581} from "./RSPContexts.mjs";
3
3
  import {PopoverContext as $07b14b47974efb58$export$9b9a0cd73afb7ca4} from "./Popover.mjs";
4
4
  import {useOverlayTrigger as $6IYYA$useOverlayTrigger, useId as $6IYYA$useId, useDialog as $6IYYA$useDialog} from "react-aria";
@@ -73,24 +73,27 @@ function $de32f1b87079253c$var$Dialog(props, ref) {
73
73
  'aria-labelledby': originalAriaLabelledby
74
74
  }, ref);
75
75
  let state = (0, $6IYYA$useContext)($de32f1b87079253c$export$d2f961adcb0afbe);
76
- let children = props.children;
77
- if (typeof children === 'function') children = children({
78
- close: (state === null || state === void 0 ? void 0 : state.close) || (()=>{})
79
- });
80
76
  if (!dialogProps['aria-label'] && !dialogProps['aria-labelledby']) {
81
77
  // If aria-labelledby exists on props, we know it came from context.
82
78
  // Use that as a fallback in case there is no title slot.
83
79
  if (props['aria-labelledby']) dialogProps['aria-labelledby'] = props['aria-labelledby'];
84
80
  else console.warn('If a Dialog does not contain a <Heading slot="title">, it must have an aria-label or aria-labelledby attribute for accessibility.');
85
81
  }
86
- var _props_className;
82
+ let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
83
+ defaultClassName: 'react-aria-Dialog',
84
+ className: props.className,
85
+ style: props.style,
86
+ children: props.children,
87
+ values: {
88
+ close: (state === null || state === void 0 ? void 0 : state.close) || (()=>{})
89
+ }
90
+ });
87
91
  return /*#__PURE__*/ (0, $6IYYA$react).createElement("section", {
88
92
  ...(0, $6IYYA$filterDOMProps)(props),
89
93
  ...dialogProps,
94
+ ...renderProps,
90
95
  ref: ref,
91
- slot: props.slot || undefined,
92
- style: props.style,
93
- className: (_props_className = props.className) !== null && _props_className !== void 0 ? _props_className : 'react-aria-Dialog'
96
+ slot: props.slot || undefined
94
97
  }, /*#__PURE__*/ (0, $6IYYA$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
95
98
  values: [
96
99
  [
@@ -106,7 +109,7 @@ function $de32f1b87079253c$var$Dialog(props, ref) {
106
109
  }
107
110
  ]
108
111
  ]
109
- }, children));
112
+ }, renderProps.children));
110
113
  }
111
114
  /**
112
115
  * A dialog is an overlay shown above other content in an application.
@@ -1,4 +1,4 @@
1
- import {DEFAULT_SLOT as $64fa3d84918910a7$export$c62b8e45d58ddad9, Provider as $64fa3d84918910a7$export$2881499e37b75b9a, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415} from "./utils.module.js";
1
+ import {DEFAULT_SLOT as $64fa3d84918910a7$export$c62b8e45d58ddad9, Provider as $64fa3d84918910a7$export$2881499e37b75b9a, useContextProps as $64fa3d84918910a7$export$29f1550f4b0d4415, useRenderProps as $64fa3d84918910a7$export$4d86445c2cf5e3} from "./utils.module.js";
2
2
  import {HeadingContext as $4e85f108e88277b8$export$d688439359537581} from "./RSPContexts.module.js";
3
3
  import {PopoverContext as $07b14b47974efb58$export$9b9a0cd73afb7ca4} from "./Popover.module.js";
4
4
  import {useOverlayTrigger as $6IYYA$useOverlayTrigger, useId as $6IYYA$useId, useDialog as $6IYYA$useDialog} from "react-aria";
@@ -73,24 +73,27 @@ function $de32f1b87079253c$var$Dialog(props, ref) {
73
73
  'aria-labelledby': originalAriaLabelledby
74
74
  }, ref);
75
75
  let state = (0, $6IYYA$useContext)($de32f1b87079253c$export$d2f961adcb0afbe);
76
- let children = props.children;
77
- if (typeof children === 'function') children = children({
78
- close: (state === null || state === void 0 ? void 0 : state.close) || (()=>{})
79
- });
80
76
  if (!dialogProps['aria-label'] && !dialogProps['aria-labelledby']) {
81
77
  // If aria-labelledby exists on props, we know it came from context.
82
78
  // Use that as a fallback in case there is no title slot.
83
79
  if (props['aria-labelledby']) dialogProps['aria-labelledby'] = props['aria-labelledby'];
84
80
  else console.warn('If a Dialog does not contain a <Heading slot="title">, it must have an aria-label or aria-labelledby attribute for accessibility.');
85
81
  }
86
- var _props_className;
82
+ let renderProps = (0, $64fa3d84918910a7$export$4d86445c2cf5e3)({
83
+ defaultClassName: 'react-aria-Dialog',
84
+ className: props.className,
85
+ style: props.style,
86
+ children: props.children,
87
+ values: {
88
+ close: (state === null || state === void 0 ? void 0 : state.close) || (()=>{})
89
+ }
90
+ });
87
91
  return /*#__PURE__*/ (0, $6IYYA$react).createElement("section", {
88
92
  ...(0, $6IYYA$filterDOMProps)(props),
89
93
  ...dialogProps,
94
+ ...renderProps,
90
95
  ref: ref,
91
- slot: props.slot || undefined,
92
- style: props.style,
93
- className: (_props_className = props.className) !== null && _props_className !== void 0 ? _props_className : 'react-aria-Dialog'
96
+ slot: props.slot || undefined
94
97
  }, /*#__PURE__*/ (0, $6IYYA$react).createElement((0, $64fa3d84918910a7$export$2881499e37b75b9a), {
95
98
  values: [
96
99
  [
@@ -106,7 +109,7 @@ function $de32f1b87079253c$var$Dialog(props, ref) {
106
109
  }
107
110
  ]
108
111
  ]
109
- }, children));
112
+ }, renderProps.children));
110
113
  }
111
114
  /**
112
115
  * A dialog is an overlay shown above other content in an application.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAwBM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAA0C;AAC5E,MAAM,yDAA6B,CAAA,GAAA,oBAAY,EAA8B;AAK7E,SAAS,0CAAc,KAAyB;IACrD,IAAI,QAAQ,CAAA,GAAA,6BAAqB,EAAE;IAEnC,IAAI,YAAY,CAAA,GAAA,aAAK,EAAqB;IAC1C,IAAI,gBAAC,YAAY,gBAAE,YAAY,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;QAAC,MAAM;IAAQ,GAAG,OAAO;IAE9E,uEAAuE;IACvE,+EAA+E;IAC/E,0EAA0E;IAC1E,qDAAqD;IACrD,aAAa,EAAE,GAAG,CAAA,GAAA,YAAI;IACtB,YAAY,CAAC,kBAAkB,GAAG,aAAa,EAAE;IAEjD,qBACE,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC;gBAA4B;aAAM;YACnC;gBAAC;gBAAe;aAAa;YAC7B;gBAAC,CAAA,GAAA,yCAAa;gBAAG;oBAAC,SAAS;oBAAiB,YAAY;gBAAS;aAAE;SACpE;qBACD,gCAAC,CAAA,GAAA,qBAAa;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,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAC3C,IAAI,eAAC,WAAW,cAAE,UAAU,EAAC,GAAG,CAAA,GAAA,gBAAQ,EAAE;QACxC,GAAG,KAAK;QACR,qDAAqD;QACrD,uCAAuC;QACvC,mBAAmB;IACrB,GAAG;IACH,IAAI,QAAQ,CAAA,GAAA,iBAAS,EAAE;IAEvB,IAAI,WAAW,MAAM,QAAQ;IAC7B,IAAI,OAAO,aAAa,YACtB,WAAW,SAAS;QAClB,OAAO,CAAA,kBAAA,4BAAA,MAAO,KAAK,KAAK,CAAA,KAAO,CAAA;IACjC;IAGF,IAAI,CAAC,WAAW,CAAC,aAAa,IAAI,CAAC,WAAW,CAAC,kBAAkB;QAC/D,oEAAoE;QACpE,yDAAyD;QACzD,IAAI,KAAK,CAAC,kBAAkB,EAC1B,WAAW,CAAC,kBAAkB,GAAG,KAAK,CAAC,kBAAkB;aAEzD,QAAQ,IAAI,CAAC;;QAWF;IAPf,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,qBAAa,EAAE,MAAM;QACxB,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,OAAO,MAAM,KAAK;QAClB,WAAW,CAAA,mBAAA,MAAM,SAAS,cAAf,8BAAA,mBAAmB;qBAC9B,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,yCAAa;gBAAG;oBACf,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,EAAE,EAAE,CAAC;wBACjB,OAAO;4BAAC,GAAG,UAAU;4BAAE,OAAO;wBAAC;oBACjC;gBACF;aAAE;SACH;OACA;AAIT;AAEA;;CAEC,GACD,MAAM,4CAAwB,AAAd,WAAW,GAAI,CAAA,GAAA,iBAAS,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} 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 let children = props.children;\n if (typeof children === 'function') {\n children = children({\n close: state?.close || (() => {})\n });\n }\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 return (\n <section\n {...filterDOMProps(props)}\n {...dialogProps}\n ref={ref}\n slot={props.slot || undefined}\n style={props.style}\n className={props.className ?? 'react-aria-Dialog'}>\n <Provider\n values={[\n [HeadingContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n title: {...titleProps, level: 2}\n }\n }]\n ]}>\n {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.module.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAwBM,MAAM,0DAAgB,CAAA,GAAA,oBAAY,EAA0C;AAC5E,MAAM,yDAA6B,CAAA,GAAA,oBAAY,EAA8B;AAK7E,SAAS,0CAAc,KAAyB;IACrD,IAAI,QAAQ,CAAA,GAAA,6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B;QAClB,WAAW,MAAM,SAAS;QAC1B,OAAO,MAAM,KAAK;QAClB,UAAU,MAAM,QAAQ;QACxB,QAAQ;YACN,OAAO,CAAA,kBAAA,4BAAA,MAAO,KAAK,KAAK,CAAA,KAAO,CAAA;QACjC;IACF;IAEA,qBACE,gCAAC;QACE,GAAG,CAAA,GAAA,qBAAa,EAAE,MAAM;QACxB,GAAG,WAAW;QACd,GAAG,WAAW;QACf,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;qBACpB,gCAAC,CAAA,GAAA,yCAAO;QACN,QAAQ;YACN;gBAAC,CAAA,GAAA,yCAAa;gBAAG;oBACf,OAAO;wBACL,CAAC,CAAA,GAAA,yCAAW,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,iBAAS,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.module.js.map"}
@@ -328,6 +328,7 @@ const $132cbde493282f82$export$e96fc9a8407faa6b = /*#__PURE__*/ (0, $UaDUV$react
328
328
  (0, $525402dfec7da5bc$exports.CheckboxContext),
329
329
  {
330
330
  slots: {
331
+ [(0, $c5ccf687772c0422$exports.DEFAULT_SLOT)]: {},
331
332
  selection: checkboxProps
332
333
  }
333
334
  }
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AA+DM,MAAM,0DAAkB,CAAA,GAAA,0BAAY,EAAoD;AAE/F,SAAS,+BAA2B,KAAuB,EAAE,GAAiC;IAC5F,+FAA+F;IAC/F,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAE3C,qBACE,0DAAC,CAAA,GAAA,6CAAgB;QAAE,uBAAS,0DAAC,CAAA,GAAA,sCAAS,GAAM;OACzC,CAAA,2BAAc,0DAAC;YAAc,OAAO;YAAO,YAAY;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AAI,eAAe,UAAW,YAAY,CAAC;QAAC,MAAM;IAAM;IACxD,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,kCAAgB;IAE5C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,0DAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;QAAE,OAAO;YAAC,UAAU;QAAU;qBAC1F,0DAAC;QAAI,MAAK;qBACR,0DAAC;QAAI,MAAK;QAAU,GAAG,mBAAmB;QAAG,GAAG,kBAAkB;QAAE,KAAK;;AAIjF","sources":["packages/react-aria-components/src/GridList.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 {AriaGridListProps, DraggableItemResult, DragPreviewRenderer, DropIndicatorAria, DroppableCollectionResult, FocusScope, ListKeyboardDelegate, mergeProps, useCollator, useFocusRing, useGridList, useGridListItem, useGridListSelectionCheckbox, useHover, useLocale, useVisuallyHidden} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CheckboxContext} from './RSPContexts';\nimport {Collection, CollectionBuilder, createLeafComponent} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, DefaultCollectionRenderer, ItemRenderProps} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';\nimport {DragAndDropContext, DropIndicatorContext, DropIndicatorProps, useDndPersistedKeys, useRenderDropIndicator} from './DragAndDrop';\nimport {DragAndDropHooks} from './useDragAndDrop';\nimport {DraggableCollectionState, DroppableCollectionState, Collection as ICollection, ListState, Node, SelectionBehavior, useListState} from 'react-stately';\nimport {filterDOMProps, useObjectRef} from '@react-aria/utils';\nimport {forwardRefType, HoverEvents, Key, LinkDOMProps, RefObject} from '@react-types/shared';\nimport {ListStateContext} from './ListBox';\nimport React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, JSX, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface GridListRenderProps {\n /**\n * Whether the list has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the grid list is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the grid list is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the grid list is currently the active drop target.\n * @selector [data-drop-target]\n */\n isDropTarget: boolean,\n /**\n * Whether the items are arranged in a stack or grid.\n * @selector [data-layout=\"stack | grid\"]\n */\n layout: 'stack' | 'grid',\n /**\n * State of the grid list.\n */\n state: ListState<unknown>\n}\n\nexport interface GridListProps<T> extends Omit<AriaGridListProps<T>, 'children'>, CollectionProps<T>, StyleRenderProps<GridListRenderProps>, SlotProps, ScrollableProps<HTMLDivElement> {\n /** How multiple selection should behave in the collection. */\n selectionBehavior?: SelectionBehavior,\n /** The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the GridList. */\n dragAndDropHooks?: DragAndDropHooks,\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: GridListRenderProps) => ReactNode,\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid'\n}\n\n\nexport const GridListContext = createContext<ContextValue<GridListProps<any>, HTMLDivElement>>(null);\n\nfunction GridList<T extends object>(props: GridListProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n // Render the portal first so that we have the collection by the time we render the DOM in SSR.\n [props, ref] = useContextProps(props, ref, GridListContext);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <GridListInner props={props} collection={collection} gridListRef={ref} />}\n </CollectionBuilder>\n );\n}\n\ninterface GridListInnerProps<T extends object> {\n props: GridListProps<T>,\n collection: ICollection<Node<object>>,\n gridListRef: RefObject<HTMLDivElement | null>\n}\n\nfunction GridListInner<T extends object>({props, collection, gridListRef: ref}: GridListInnerProps<T>) {\n let {dragAndDropHooks, keyboardNavigationBehavior = 'arrow', layout = 'stack'} = props;\n let {CollectionRoot, isVirtualized, layoutDelegate, dropTargetDelegate: ctxDropTargetDelegate} = useContext(CollectionRendererContext);\n let state = useListState({\n ...props,\n collection,\n children: undefined,\n layoutDelegate\n });\n\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let {disabledBehavior, disabledKeys} = state.selectionManager;\n let {direction} = useLocale();\n let keyboardDelegate = useMemo(() => (\n new ListKeyboardDelegate({\n collection,\n collator,\n ref,\n disabledKeys,\n disabledBehavior,\n layoutDelegate,\n layout,\n direction\n })\n ), [collection, ref, layout, disabledKeys, disabledBehavior, layoutDelegate, collator, direction]);\n\n let {gridProps} = useGridList({\n ...props,\n keyboardDelegate,\n // Only tab navigation is supported in grid layout.\n keyboardNavigationBehavior: layout === 'grid' ? 'tab' : keyboardNavigationBehavior,\n isVirtualized\n }, state, ref);\n\n let selectionManager = state.selectionManager;\n let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;\n let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(isListDraggable);\n let dropHooksProvided = useRef(isListDroppable);\n useEffect(() => {\n if (dragHooksProvided.current !== isListDraggable) {\n console.warn('Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n if (dropHooksProvided.current !== isListDroppable) {\n console.warn('Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n }, [isListDraggable, isListDroppable]);\n\n let dragState: DraggableCollectionState | undefined = undefined;\n let dropState: DroppableCollectionState | undefined = undefined;\n let droppableCollection: DroppableCollectionResult | undefined = undefined;\n let isRootDropTarget = false;\n let dragPreview: JSX.Element | null = null;\n let preview = useRef<DragPreviewRenderer>(null);\n\n if (isListDraggable && dragAndDropHooks) {\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection,\n selectionManager,\n preview: dragAndDropHooks.renderDragPreview ? preview : undefined\n });\n dragAndDropHooks.useDraggableCollection!({}, dragState, ref);\n\n let DragPreview = dragAndDropHooks.DragPreview!;\n dragPreview = dragAndDropHooks.renderDragPreview\n ? <DragPreview ref={preview}>{dragAndDropHooks.renderDragPreview}</DragPreview>\n : null;\n }\n\n if (isListDroppable && dragAndDropHooks) {\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection,\n selectionManager\n });\n\n let keyboardDelegate = new ListKeyboardDelegate({\n collection,\n disabledKeys: selectionManager.disabledKeys,\n disabledBehavior: selectionManager.disabledBehavior,\n ref\n });\n let dropTargetDelegate = dragAndDropHooks.dropTargetDelegate || ctxDropTargetDelegate || new dragAndDropHooks.ListDropTargetDelegate(collection, ref, {layout, direction});\n droppableCollection = dragAndDropHooks.useDroppableCollection!({\n keyboardDelegate,\n dropTargetDelegate\n }, dropState, ref);\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderValues = {\n isDropTarget: isRootDropTarget,\n isEmpty: state.collection.size === 0,\n isFocused,\n isFocusVisible,\n layout,\n state\n };\n let renderProps = useRenderProps({\n className: props.className,\n style: props.style,\n defaultClassName: 'react-aria-GridList',\n values: renderValues\n });\n\n let emptyState: ReactNode = null;\n let emptyStatePropOverrides: HTMLAttributes<HTMLElement> | null = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n let content = props.renderEmptyState(renderValues);\n emptyState = (\n <div role=\"row\" style={{display: 'contents'}}>\n <div role=\"gridcell\" style={{display: 'contents'}}>\n {content}\n </div>\n </div>\n );\n }\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...renderProps}\n {...mergeProps(gridProps, focusProps, droppableCollection?.collectionProps, emptyStatePropOverrides)}\n ref={ref}\n slot={props.slot || undefined}\n onScroll={props.onScroll}\n data-drop-target={isRootDropTarget || undefined}\n data-empty={state.collection.size === 0 || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-layout={layout}>\n <Provider\n values={[\n [ListStateContext, state],\n [DragAndDropContext, {dragAndDropHooks, dragState, dropState}],\n [DropIndicatorContext, {render: GridListDropIndicatorWrapper}]\n ]}>\n {isListDroppable && <RootDropIndicator />}\n <CollectionRoot\n collection={collection}\n scrollRef={ref}\n persistedKeys={useDndPersistedKeys(selectionManager, dragAndDropHooks, dropState)}\n renderDropIndicator={useRenderDropIndicator(dragAndDropHooks, dropState)} />\n </Provider>\n {emptyState}\n {dragPreview}\n </div>\n </FocusScope>\n );\n}\n\n/**\n * A grid list displays a list of interactive items, with support for keyboard navigation,\n * single or multiple selection, and row actions.\n */\nconst _GridList = /*#__PURE__*/ (forwardRef as forwardRefType)(GridList);\nexport {_GridList as GridList};\n\nexport interface GridListItemRenderProps extends ItemRenderProps {}\n\nexport interface GridListItemProps<T = object> extends RenderProps<GridListItemRenderProps>, LinkDOMProps, HoverEvents {\n /** The unique id of the item. */\n id?: Key,\n /** The object value that this item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the item's contents, used for features like typeahead. */\n textValue?: string,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on the item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\n/**\n * A GridListItem represents an individual item in a GridList.\n */\nexport const GridListItem = /*#__PURE__*/ createLeafComponent('item', function GridListItem<T extends object>(props: GridListItemProps<T>, forwardedRef: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n let state = useContext(ListStateContext)!;\n let {dragAndDropHooks, dragState, dropState} = useContext(DragAndDropContext);\n let ref = useObjectRef<HTMLDivElement>(forwardedRef);\n let {isVirtualized} = useContext(CollectionRendererContext);\n let {rowProps, gridCellProps, descriptionProps, ...states} = useGridListItem(\n {\n node: item,\n shouldSelectOnPressUp: !!dragState,\n isVirtualized\n },\n state,\n ref\n );\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: !states.allowsSelection && !states.hasAction,\n onHoverStart: item.props.onHoverStart,\n onHoverChange: item.props.onHoverChange,\n onHoverEnd: item.props.onHoverEnd\n });\n\n let {isFocusVisible, focusProps} = useFocusRing();\n let {checkboxProps} = useGridListSelectionCheckbox(\n {key: item.key},\n state\n );\n\n let buttonProps = state.selectionManager.disabledBehavior === 'all' && states.isDisabled ? {isDisabled: true} : {};\n\n let draggableItem: DraggableItemResult | null = null;\n if (dragState && dragAndDropHooks) {\n draggableItem = dragAndDropHooks.useDraggableItem!({key: item.key, hasDragButton: true}, dragState);\n }\n\n let dropIndicator: DropIndicatorAria | null = null;\n let dropIndicatorRef = useRef<HTMLDivElement>(null);\n let {visuallyHiddenProps} = useVisuallyHidden();\n if (dropState && dragAndDropHooks) {\n dropIndicator = dragAndDropHooks.useDropIndicator!({\n target: {type: 'item', key: item.key, dropPosition: 'on'}\n }, dropState, dropIndicatorRef);\n }\n\n let isDragging = dragState && dragState.isDragging(item.key);\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-GridListItem',\n values: {\n ...states,\n isHovered,\n isFocusVisible,\n selectionMode: state.selectionManager.selectionMode,\n selectionBehavior: state.selectionManager.selectionBehavior,\n allowsDragging: !!dragState,\n isDragging,\n isDropTarget: dropIndicator?.isDropTarget\n }\n });\n\n let dragButtonRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (dragState && !dragButtonRef.current) {\n console.warn('Draggable items in a GridList must contain a <Button slot=\"drag\"> element so that keyboard and screen reader users can drag them.');\n }\n // eslint-disable-next-line\n }, []);\n\n useEffect(() => {\n if (!item.textValue) {\n console.warn('A `textValue` prop is required for <GridListItem> elements with non-plain text children in order to support accessibility features such as type to select.');\n }\n }, [item.textValue]);\n\n return (\n <>\n {dropIndicator && !dropIndicator.isHidden &&\n <div role=\"row\" style={{position: 'absolute'}}>\n <div role=\"gridcell\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator?.dropIndicatorProps} ref={dropIndicatorRef} />\n </div>\n </div>\n }\n <div\n {...mergeProps(filterDOMProps(props as any), rowProps, focusProps, hoverProps, draggableItem?.dragProps)}\n {...renderProps}\n ref={ref}\n data-selected={states.isSelected || undefined}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-allows-dragging={!!dragState || undefined}\n data-dragging={isDragging || undefined}\n data-drop-target={dropIndicator?.isDropTarget || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}>\n <div {...gridCellProps} style={{display: 'contents'}}>\n <Provider\n values={[\n [CheckboxContext, {\n slots: {\n selection: checkboxProps\n }\n }],\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: buttonProps,\n drag: {\n ...draggableItem?.dragButtonProps,\n ref: dragButtonRef,\n style: {\n pointerEvents: 'none'\n }\n }\n }\n }],\n [TextContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n description: descriptionProps\n }\n }],\n [CollectionRendererContext, DefaultCollectionRenderer],\n [ListStateContext, null]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n </div>\n </>\n );\n});\n\nfunction GridListDropIndicatorWrapper(props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n ref = useObjectRef(ref);\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);\n let buttonRef = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps, isHidden, isDropTarget} = dragAndDropHooks!.useDropIndicator!(\n props,\n dropState!,\n buttonRef\n );\n\n if (isHidden) {\n return null;\n }\n\n return (\n <GridListDropIndicatorForwardRef {...props} dropIndicatorProps={dropIndicatorProps} isDropTarget={isDropTarget} buttonRef={buttonRef} ref={ref} />\n );\n}\n\ninterface GridListDropIndicatorProps extends DropIndicatorProps {\n dropIndicatorProps: React.HTMLAttributes<HTMLElement>,\n isDropTarget: boolean,\n buttonRef: RefObject<HTMLDivElement | null>\n}\n\nfunction GridListDropIndicator(props: GridListDropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n let {\n dropIndicatorProps,\n isDropTarget,\n buttonRef,\n ...otherProps\n } = props;\n\n let {visuallyHiddenProps} = useVisuallyHidden();\n let renderProps = useRenderProps({\n ...otherProps,\n defaultClassName: 'react-aria-DropIndicator',\n values: {\n isDropTarget\n }\n });\n\n return (\n <div\n {...renderProps}\n role=\"row\"\n ref={ref as RefObject<HTMLDivElement | null>}\n data-drop-target={isDropTarget || undefined}>\n <div role=\"gridcell\">\n <div {...visuallyHiddenProps} role=\"button\" {...dropIndicatorProps} ref={buttonRef} />\n {renderProps.children}\n </div>\n </div>\n );\n}\n\nconst GridListDropIndicatorForwardRef = forwardRef(GridListDropIndicator);\n\nfunction RootDropIndicator() {\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);\n let ref = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!({\n target: {type: 'root'}\n }, dropState!, ref);\n let isDropTarget = dropState!.isDropTarget({type: 'root'});\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']} style={{position: 'absolute'}}>\n <div role=\"gridcell\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"GridList.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;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,GAAG,kBAAkB;QAAE,KAAK;QACxE,YAAY,QAAQ;AAI7B;AAEA,MAAM,sEAAkC,CAAA,GAAA,uBAAS,EAAE;AAEnD,SAAS;IACP,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,uBAAS,EAAE,CAAA,GAAA,4CAAiB;IAChE,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAkB;IACjC,IAAI,sBAAC,kBAAkB,EAAC,GAAG,iBAAkB,gBAAgB,CAAE;QAC7D,QAAQ;YAAC,MAAM;QAAM;IACvB,GAAG,WAAY;IACf,IAAI,eAAe,UAAW,YAAY,CAAC;QAAC,MAAM;IAAM;IACxD,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,kCAAgB;IAE5C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,0DAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;QAAE,OAAO;YAAC,UAAU;QAAU;qBAC1F,0DAAC;QAAI,MAAK;qBACR,0DAAC;QAAI,MAAK;QAAU,GAAG,mBAAmB;QAAG,GAAG,kBAAkB;QAAE,KAAK;;AAIjF","sources":["packages/react-aria-components/src/GridList.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 {AriaGridListProps, DraggableItemResult, DragPreviewRenderer, DropIndicatorAria, DroppableCollectionResult, FocusScope, ListKeyboardDelegate, mergeProps, useCollator, useFocusRing, useGridList, useGridListItem, useGridListSelectionCheckbox, useHover, useLocale, useVisuallyHidden} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CheckboxContext} from './RSPContexts';\nimport {Collection, CollectionBuilder, createLeafComponent} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, DefaultCollectionRenderer, ItemRenderProps} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';\nimport {DragAndDropContext, DropIndicatorContext, DropIndicatorProps, useDndPersistedKeys, useRenderDropIndicator} from './DragAndDrop';\nimport {DragAndDropHooks} from './useDragAndDrop';\nimport {DraggableCollectionState, DroppableCollectionState, Collection as ICollection, ListState, Node, SelectionBehavior, useListState} from 'react-stately';\nimport {filterDOMProps, useObjectRef} from '@react-aria/utils';\nimport {forwardRefType, HoverEvents, Key, LinkDOMProps, RefObject} from '@react-types/shared';\nimport {ListStateContext} from './ListBox';\nimport React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, JSX, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface GridListRenderProps {\n /**\n * Whether the list has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the grid list is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the grid list is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the grid list is currently the active drop target.\n * @selector [data-drop-target]\n */\n isDropTarget: boolean,\n /**\n * Whether the items are arranged in a stack or grid.\n * @selector [data-layout=\"stack | grid\"]\n */\n layout: 'stack' | 'grid',\n /**\n * State of the grid list.\n */\n state: ListState<unknown>\n}\n\nexport interface GridListProps<T> extends Omit<AriaGridListProps<T>, 'children'>, CollectionProps<T>, StyleRenderProps<GridListRenderProps>, SlotProps, ScrollableProps<HTMLDivElement> {\n /** How multiple selection should behave in the collection. */\n selectionBehavior?: SelectionBehavior,\n /** The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the GridList. */\n dragAndDropHooks?: DragAndDropHooks,\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: GridListRenderProps) => ReactNode,\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid'\n}\n\n\nexport const GridListContext = createContext<ContextValue<GridListProps<any>, HTMLDivElement>>(null);\n\nfunction GridList<T extends object>(props: GridListProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n // Render the portal first so that we have the collection by the time we render the DOM in SSR.\n [props, ref] = useContextProps(props, ref, GridListContext);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <GridListInner props={props} collection={collection} gridListRef={ref} />}\n </CollectionBuilder>\n );\n}\n\ninterface GridListInnerProps<T extends object> {\n props: GridListProps<T>,\n collection: ICollection<Node<object>>,\n gridListRef: RefObject<HTMLDivElement | null>\n}\n\nfunction GridListInner<T extends object>({props, collection, gridListRef: ref}: GridListInnerProps<T>) {\n let {dragAndDropHooks, keyboardNavigationBehavior = 'arrow', layout = 'stack'} = props;\n let {CollectionRoot, isVirtualized, layoutDelegate, dropTargetDelegate: ctxDropTargetDelegate} = useContext(CollectionRendererContext);\n let state = useListState({\n ...props,\n collection,\n children: undefined,\n layoutDelegate\n });\n\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let {disabledBehavior, disabledKeys} = state.selectionManager;\n let {direction} = useLocale();\n let keyboardDelegate = useMemo(() => (\n new ListKeyboardDelegate({\n collection,\n collator,\n ref,\n disabledKeys,\n disabledBehavior,\n layoutDelegate,\n layout,\n direction\n })\n ), [collection, ref, layout, disabledKeys, disabledBehavior, layoutDelegate, collator, direction]);\n\n let {gridProps} = useGridList({\n ...props,\n keyboardDelegate,\n // Only tab navigation is supported in grid layout.\n keyboardNavigationBehavior: layout === 'grid' ? 'tab' : keyboardNavigationBehavior,\n isVirtualized\n }, state, ref);\n\n let selectionManager = state.selectionManager;\n let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;\n let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(isListDraggable);\n let dropHooksProvided = useRef(isListDroppable);\n useEffect(() => {\n if (dragHooksProvided.current !== isListDraggable) {\n console.warn('Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n if (dropHooksProvided.current !== isListDroppable) {\n console.warn('Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n }, [isListDraggable, isListDroppable]);\n\n let dragState: DraggableCollectionState | undefined = undefined;\n let dropState: DroppableCollectionState | undefined = undefined;\n let droppableCollection: DroppableCollectionResult | undefined = undefined;\n let isRootDropTarget = false;\n let dragPreview: JSX.Element | null = null;\n let preview = useRef<DragPreviewRenderer>(null);\n\n if (isListDraggable && dragAndDropHooks) {\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection,\n selectionManager,\n preview: dragAndDropHooks.renderDragPreview ? preview : undefined\n });\n dragAndDropHooks.useDraggableCollection!({}, dragState, ref);\n\n let DragPreview = dragAndDropHooks.DragPreview!;\n dragPreview = dragAndDropHooks.renderDragPreview\n ? <DragPreview ref={preview}>{dragAndDropHooks.renderDragPreview}</DragPreview>\n : null;\n }\n\n if (isListDroppable && dragAndDropHooks) {\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection,\n selectionManager\n });\n\n let keyboardDelegate = new ListKeyboardDelegate({\n collection,\n disabledKeys: selectionManager.disabledKeys,\n disabledBehavior: selectionManager.disabledBehavior,\n ref\n });\n let dropTargetDelegate = dragAndDropHooks.dropTargetDelegate || ctxDropTargetDelegate || new dragAndDropHooks.ListDropTargetDelegate(collection, ref, {layout, direction});\n droppableCollection = dragAndDropHooks.useDroppableCollection!({\n keyboardDelegate,\n dropTargetDelegate\n }, dropState, ref);\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderValues = {\n isDropTarget: isRootDropTarget,\n isEmpty: state.collection.size === 0,\n isFocused,\n isFocusVisible,\n layout,\n state\n };\n let renderProps = useRenderProps({\n className: props.className,\n style: props.style,\n defaultClassName: 'react-aria-GridList',\n values: renderValues\n });\n\n let emptyState: ReactNode = null;\n let emptyStatePropOverrides: HTMLAttributes<HTMLElement> | null = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n let content = props.renderEmptyState(renderValues);\n emptyState = (\n <div role=\"row\" style={{display: 'contents'}}>\n <div role=\"gridcell\" style={{display: 'contents'}}>\n {content}\n </div>\n </div>\n );\n }\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...renderProps}\n {...mergeProps(gridProps, focusProps, droppableCollection?.collectionProps, emptyStatePropOverrides)}\n ref={ref}\n slot={props.slot || undefined}\n onScroll={props.onScroll}\n data-drop-target={isRootDropTarget || undefined}\n data-empty={state.collection.size === 0 || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-layout={layout}>\n <Provider\n values={[\n [ListStateContext, state],\n [DragAndDropContext, {dragAndDropHooks, dragState, dropState}],\n [DropIndicatorContext, {render: GridListDropIndicatorWrapper}]\n ]}>\n {isListDroppable && <RootDropIndicator />}\n <CollectionRoot\n collection={collection}\n scrollRef={ref}\n persistedKeys={useDndPersistedKeys(selectionManager, dragAndDropHooks, dropState)}\n renderDropIndicator={useRenderDropIndicator(dragAndDropHooks, dropState)} />\n </Provider>\n {emptyState}\n {dragPreview}\n </div>\n </FocusScope>\n );\n}\n\n/**\n * A grid list displays a list of interactive items, with support for keyboard navigation,\n * single or multiple selection, and row actions.\n */\nconst _GridList = /*#__PURE__*/ (forwardRef as forwardRefType)(GridList);\nexport {_GridList as GridList};\n\nexport interface GridListItemRenderProps extends ItemRenderProps {}\n\nexport interface GridListItemProps<T = object> extends RenderProps<GridListItemRenderProps>, LinkDOMProps, HoverEvents {\n /** The unique id of the item. */\n id?: Key,\n /** The object value that this item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the item's contents, used for features like typeahead. */\n textValue?: string,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on the item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\n/**\n * A GridListItem represents an individual item in a GridList.\n */\nexport const GridListItem = /*#__PURE__*/ createLeafComponent('item', function GridListItem<T extends object>(props: GridListItemProps<T>, forwardedRef: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n let state = useContext(ListStateContext)!;\n let {dragAndDropHooks, dragState, dropState} = useContext(DragAndDropContext);\n let ref = useObjectRef<HTMLDivElement>(forwardedRef);\n let {isVirtualized} = useContext(CollectionRendererContext);\n let {rowProps, gridCellProps, descriptionProps, ...states} = useGridListItem(\n {\n node: item,\n shouldSelectOnPressUp: !!dragState,\n isVirtualized\n },\n state,\n ref\n );\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: !states.allowsSelection && !states.hasAction,\n onHoverStart: item.props.onHoverStart,\n onHoverChange: item.props.onHoverChange,\n onHoverEnd: item.props.onHoverEnd\n });\n\n let {isFocusVisible, focusProps} = useFocusRing();\n let {checkboxProps} = useGridListSelectionCheckbox(\n {key: item.key},\n state\n );\n\n let buttonProps = state.selectionManager.disabledBehavior === 'all' && states.isDisabled ? {isDisabled: true} : {};\n\n let draggableItem: DraggableItemResult | null = null;\n if (dragState && dragAndDropHooks) {\n draggableItem = dragAndDropHooks.useDraggableItem!({key: item.key, hasDragButton: true}, dragState);\n }\n\n let dropIndicator: DropIndicatorAria | null = null;\n let dropIndicatorRef = useRef<HTMLDivElement>(null);\n let {visuallyHiddenProps} = useVisuallyHidden();\n if (dropState && dragAndDropHooks) {\n dropIndicator = dragAndDropHooks.useDropIndicator!({\n target: {type: 'item', key: item.key, dropPosition: 'on'}\n }, dropState, dropIndicatorRef);\n }\n\n let isDragging = dragState && dragState.isDragging(item.key);\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-GridListItem',\n values: {\n ...states,\n isHovered,\n isFocusVisible,\n selectionMode: state.selectionManager.selectionMode,\n selectionBehavior: state.selectionManager.selectionBehavior,\n allowsDragging: !!dragState,\n isDragging,\n isDropTarget: dropIndicator?.isDropTarget\n }\n });\n\n let dragButtonRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (dragState && !dragButtonRef.current) {\n console.warn('Draggable items in a GridList must contain a <Button slot=\"drag\"> element so that keyboard and screen reader users can drag them.');\n }\n // eslint-disable-next-line\n }, []);\n\n useEffect(() => {\n if (!item.textValue) {\n console.warn('A `textValue` prop is required for <GridListItem> elements with non-plain text children in order to support accessibility features such as type to select.');\n }\n }, [item.textValue]);\n\n return (\n <>\n {dropIndicator && !dropIndicator.isHidden &&\n <div role=\"row\" style={{position: 'absolute'}}>\n <div role=\"gridcell\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator?.dropIndicatorProps} ref={dropIndicatorRef} />\n </div>\n </div>\n }\n <div\n {...mergeProps(filterDOMProps(props as any), rowProps, focusProps, hoverProps, draggableItem?.dragProps)}\n {...renderProps}\n ref={ref}\n data-selected={states.isSelected || undefined}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-allows-dragging={!!dragState || undefined}\n data-dragging={isDragging || undefined}\n data-drop-target={dropIndicator?.isDropTarget || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}>\n <div {...gridCellProps} style={{display: 'contents'}}>\n <Provider\n values={[\n [CheckboxContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n selection: checkboxProps\n }\n }],\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: buttonProps,\n drag: {\n ...draggableItem?.dragButtonProps,\n ref: dragButtonRef,\n style: {\n pointerEvents: 'none'\n }\n }\n }\n }],\n [TextContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n description: descriptionProps\n }\n }],\n [CollectionRendererContext, DefaultCollectionRenderer],\n [ListStateContext, null]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n </div>\n </>\n );\n});\n\nfunction GridListDropIndicatorWrapper(props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n ref = useObjectRef(ref);\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);\n let buttonRef = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps, isHidden, isDropTarget} = dragAndDropHooks!.useDropIndicator!(\n props,\n dropState!,\n buttonRef\n );\n\n if (isHidden) {\n return null;\n }\n\n return (\n <GridListDropIndicatorForwardRef {...props} dropIndicatorProps={dropIndicatorProps} isDropTarget={isDropTarget} buttonRef={buttonRef} ref={ref} />\n );\n}\n\ninterface GridListDropIndicatorProps extends DropIndicatorProps {\n dropIndicatorProps: React.HTMLAttributes<HTMLElement>,\n isDropTarget: boolean,\n buttonRef: RefObject<HTMLDivElement | null>\n}\n\nfunction GridListDropIndicator(props: GridListDropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n let {\n dropIndicatorProps,\n isDropTarget,\n buttonRef,\n ...otherProps\n } = props;\n\n let {visuallyHiddenProps} = useVisuallyHidden();\n let renderProps = useRenderProps({\n ...otherProps,\n defaultClassName: 'react-aria-DropIndicator',\n values: {\n isDropTarget\n }\n });\n\n return (\n <div\n {...renderProps}\n role=\"row\"\n ref={ref as RefObject<HTMLDivElement | null>}\n data-drop-target={isDropTarget || undefined}>\n <div role=\"gridcell\">\n <div {...visuallyHiddenProps} role=\"button\" {...dropIndicatorProps} ref={buttonRef} />\n {renderProps.children}\n </div>\n </div>\n );\n}\n\nconst GridListDropIndicatorForwardRef = forwardRef(GridListDropIndicator);\n\nfunction RootDropIndicator() {\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);\n let ref = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!({\n target: {type: 'root'}\n }, dropState!, ref);\n let isDropTarget = dropState!.isDropTarget({type: 'root'});\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']} style={{position: 'absolute'}}>\n <div role=\"gridcell\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"GridList.main.js.map"}
package/dist/GridList.mjs CHANGED
@@ -316,6 +316,7 @@ const $72e60046c03fbe42$export$e96fc9a8407faa6b = /*#__PURE__*/ (0, $jTmF7$creat
316
316
  (0, $4e85f108e88277b8$export$b085522c77523c51),
317
317
  {
318
318
  slots: {
319
+ [(0, $64fa3d84918910a7$export$c62b8e45d58ddad9)]: {},
319
320
  selection: checkboxProps
320
321
  }
321
322
  }
@@ -316,6 +316,7 @@ const $72e60046c03fbe42$export$e96fc9a8407faa6b = /*#__PURE__*/ (0, $jTmF7$creat
316
316
  (0, $4e85f108e88277b8$export$b085522c77523c51),
317
317
  {
318
318
  slots: {
319
+ [(0, $64fa3d84918910a7$export$c62b8e45d58ddad9)]: {},
319
320
  selection: checkboxProps
320
321
  }
321
322
  }
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AA+DM,MAAM,0DAAkB,CAAA,GAAA,oBAAY,EAAoD;AAE/F,SAAS,+BAA2B,KAAuB,EAAE,GAAiC;IAC5F,+FAA+F;IAC/F,CAAC,OAAO,IAAI,GAAG,CAAA,GAAA,yCAAc,EAAE,OAAO,KAAK;IAE3C,qBACE,gCAAC,CAAA,GAAA,wBAAgB;QAAE,uBAAS,gCAAC,CAAA,GAAA,iBAAS,GAAM;OACzC,CAAA,2BAAc,gCAAC;YAAc,OAAO;YAAO,YAAY;YAAY,aAAa;;AAGvF;AAQA,SAAS,oCAAgC,SAAC,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,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,wBAAgB;IAE5C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,gCAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;QAAE,OAAO;YAAC,UAAU;QAAU;qBAC1F,gCAAC;QAAI,MAAK;qBACR,gCAAC;QAAI,MAAK;QAAU,GAAG,mBAAmB;QAAG,GAAG,kBAAkB;QAAE,KAAK;;AAIjF","sources":["packages/react-aria-components/src/GridList.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 {AriaGridListProps, DraggableItemResult, DragPreviewRenderer, DropIndicatorAria, DroppableCollectionResult, FocusScope, ListKeyboardDelegate, mergeProps, useCollator, useFocusRing, useGridList, useGridListItem, useGridListSelectionCheckbox, useHover, useLocale, useVisuallyHidden} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CheckboxContext} from './RSPContexts';\nimport {Collection, CollectionBuilder, createLeafComponent} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, DefaultCollectionRenderer, ItemRenderProps} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';\nimport {DragAndDropContext, DropIndicatorContext, DropIndicatorProps, useDndPersistedKeys, useRenderDropIndicator} from './DragAndDrop';\nimport {DragAndDropHooks} from './useDragAndDrop';\nimport {DraggableCollectionState, DroppableCollectionState, Collection as ICollection, ListState, Node, SelectionBehavior, useListState} from 'react-stately';\nimport {filterDOMProps, useObjectRef} from '@react-aria/utils';\nimport {forwardRefType, HoverEvents, Key, LinkDOMProps, RefObject} from '@react-types/shared';\nimport {ListStateContext} from './ListBox';\nimport React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, JSX, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface GridListRenderProps {\n /**\n * Whether the list has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the grid list is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the grid list is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the grid list is currently the active drop target.\n * @selector [data-drop-target]\n */\n isDropTarget: boolean,\n /**\n * Whether the items are arranged in a stack or grid.\n * @selector [data-layout=\"stack | grid\"]\n */\n layout: 'stack' | 'grid',\n /**\n * State of the grid list.\n */\n state: ListState<unknown>\n}\n\nexport interface GridListProps<T> extends Omit<AriaGridListProps<T>, 'children'>, CollectionProps<T>, StyleRenderProps<GridListRenderProps>, SlotProps, ScrollableProps<HTMLDivElement> {\n /** How multiple selection should behave in the collection. */\n selectionBehavior?: SelectionBehavior,\n /** The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the GridList. */\n dragAndDropHooks?: DragAndDropHooks,\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: GridListRenderProps) => ReactNode,\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid'\n}\n\n\nexport const GridListContext = createContext<ContextValue<GridListProps<any>, HTMLDivElement>>(null);\n\nfunction GridList<T extends object>(props: GridListProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n // Render the portal first so that we have the collection by the time we render the DOM in SSR.\n [props, ref] = useContextProps(props, ref, GridListContext);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <GridListInner props={props} collection={collection} gridListRef={ref} />}\n </CollectionBuilder>\n );\n}\n\ninterface GridListInnerProps<T extends object> {\n props: GridListProps<T>,\n collection: ICollection<Node<object>>,\n gridListRef: RefObject<HTMLDivElement | null>\n}\n\nfunction GridListInner<T extends object>({props, collection, gridListRef: ref}: GridListInnerProps<T>) {\n let {dragAndDropHooks, keyboardNavigationBehavior = 'arrow', layout = 'stack'} = props;\n let {CollectionRoot, isVirtualized, layoutDelegate, dropTargetDelegate: ctxDropTargetDelegate} = useContext(CollectionRendererContext);\n let state = useListState({\n ...props,\n collection,\n children: undefined,\n layoutDelegate\n });\n\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let {disabledBehavior, disabledKeys} = state.selectionManager;\n let {direction} = useLocale();\n let keyboardDelegate = useMemo(() => (\n new ListKeyboardDelegate({\n collection,\n collator,\n ref,\n disabledKeys,\n disabledBehavior,\n layoutDelegate,\n layout,\n direction\n })\n ), [collection, ref, layout, disabledKeys, disabledBehavior, layoutDelegate, collator, direction]);\n\n let {gridProps} = useGridList({\n ...props,\n keyboardDelegate,\n // Only tab navigation is supported in grid layout.\n keyboardNavigationBehavior: layout === 'grid' ? 'tab' : keyboardNavigationBehavior,\n isVirtualized\n }, state, ref);\n\n let selectionManager = state.selectionManager;\n let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;\n let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(isListDraggable);\n let dropHooksProvided = useRef(isListDroppable);\n useEffect(() => {\n if (dragHooksProvided.current !== isListDraggable) {\n console.warn('Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n if (dropHooksProvided.current !== isListDroppable) {\n console.warn('Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n }, [isListDraggable, isListDroppable]);\n\n let dragState: DraggableCollectionState | undefined = undefined;\n let dropState: DroppableCollectionState | undefined = undefined;\n let droppableCollection: DroppableCollectionResult | undefined = undefined;\n let isRootDropTarget = false;\n let dragPreview: JSX.Element | null = null;\n let preview = useRef<DragPreviewRenderer>(null);\n\n if (isListDraggable && dragAndDropHooks) {\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection,\n selectionManager,\n preview: dragAndDropHooks.renderDragPreview ? preview : undefined\n });\n dragAndDropHooks.useDraggableCollection!({}, dragState, ref);\n\n let DragPreview = dragAndDropHooks.DragPreview!;\n dragPreview = dragAndDropHooks.renderDragPreview\n ? <DragPreview ref={preview}>{dragAndDropHooks.renderDragPreview}</DragPreview>\n : null;\n }\n\n if (isListDroppable && dragAndDropHooks) {\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection,\n selectionManager\n });\n\n let keyboardDelegate = new ListKeyboardDelegate({\n collection,\n disabledKeys: selectionManager.disabledKeys,\n disabledBehavior: selectionManager.disabledBehavior,\n ref\n });\n let dropTargetDelegate = dragAndDropHooks.dropTargetDelegate || ctxDropTargetDelegate || new dragAndDropHooks.ListDropTargetDelegate(collection, ref, {layout, direction});\n droppableCollection = dragAndDropHooks.useDroppableCollection!({\n keyboardDelegate,\n dropTargetDelegate\n }, dropState, ref);\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderValues = {\n isDropTarget: isRootDropTarget,\n isEmpty: state.collection.size === 0,\n isFocused,\n isFocusVisible,\n layout,\n state\n };\n let renderProps = useRenderProps({\n className: props.className,\n style: props.style,\n defaultClassName: 'react-aria-GridList',\n values: renderValues\n });\n\n let emptyState: ReactNode = null;\n let emptyStatePropOverrides: HTMLAttributes<HTMLElement> | null = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n let content = props.renderEmptyState(renderValues);\n emptyState = (\n <div role=\"row\" style={{display: 'contents'}}>\n <div role=\"gridcell\" style={{display: 'contents'}}>\n {content}\n </div>\n </div>\n );\n }\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...renderProps}\n {...mergeProps(gridProps, focusProps, droppableCollection?.collectionProps, emptyStatePropOverrides)}\n ref={ref}\n slot={props.slot || undefined}\n onScroll={props.onScroll}\n data-drop-target={isRootDropTarget || undefined}\n data-empty={state.collection.size === 0 || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-layout={layout}>\n <Provider\n values={[\n [ListStateContext, state],\n [DragAndDropContext, {dragAndDropHooks, dragState, dropState}],\n [DropIndicatorContext, {render: GridListDropIndicatorWrapper}]\n ]}>\n {isListDroppable && <RootDropIndicator />}\n <CollectionRoot\n collection={collection}\n scrollRef={ref}\n persistedKeys={useDndPersistedKeys(selectionManager, dragAndDropHooks, dropState)}\n renderDropIndicator={useRenderDropIndicator(dragAndDropHooks, dropState)} />\n </Provider>\n {emptyState}\n {dragPreview}\n </div>\n </FocusScope>\n );\n}\n\n/**\n * A grid list displays a list of interactive items, with support for keyboard navigation,\n * single or multiple selection, and row actions.\n */\nconst _GridList = /*#__PURE__*/ (forwardRef as forwardRefType)(GridList);\nexport {_GridList as GridList};\n\nexport interface GridListItemRenderProps extends ItemRenderProps {}\n\nexport interface GridListItemProps<T = object> extends RenderProps<GridListItemRenderProps>, LinkDOMProps, HoverEvents {\n /** The unique id of the item. */\n id?: Key,\n /** The object value that this item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the item's contents, used for features like typeahead. */\n textValue?: string,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on the item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\n/**\n * A GridListItem represents an individual item in a GridList.\n */\nexport const GridListItem = /*#__PURE__*/ createLeafComponent('item', function GridListItem<T extends object>(props: GridListItemProps<T>, forwardedRef: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n let state = useContext(ListStateContext)!;\n let {dragAndDropHooks, dragState, dropState} = useContext(DragAndDropContext);\n let ref = useObjectRef<HTMLDivElement>(forwardedRef);\n let {isVirtualized} = useContext(CollectionRendererContext);\n let {rowProps, gridCellProps, descriptionProps, ...states} = useGridListItem(\n {\n node: item,\n shouldSelectOnPressUp: !!dragState,\n isVirtualized\n },\n state,\n ref\n );\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: !states.allowsSelection && !states.hasAction,\n onHoverStart: item.props.onHoverStart,\n onHoverChange: item.props.onHoverChange,\n onHoverEnd: item.props.onHoverEnd\n });\n\n let {isFocusVisible, focusProps} = useFocusRing();\n let {checkboxProps} = useGridListSelectionCheckbox(\n {key: item.key},\n state\n );\n\n let buttonProps = state.selectionManager.disabledBehavior === 'all' && states.isDisabled ? {isDisabled: true} : {};\n\n let draggableItem: DraggableItemResult | null = null;\n if (dragState && dragAndDropHooks) {\n draggableItem = dragAndDropHooks.useDraggableItem!({key: item.key, hasDragButton: true}, dragState);\n }\n\n let dropIndicator: DropIndicatorAria | null = null;\n let dropIndicatorRef = useRef<HTMLDivElement>(null);\n let {visuallyHiddenProps} = useVisuallyHidden();\n if (dropState && dragAndDropHooks) {\n dropIndicator = dragAndDropHooks.useDropIndicator!({\n target: {type: 'item', key: item.key, dropPosition: 'on'}\n }, dropState, dropIndicatorRef);\n }\n\n let isDragging = dragState && dragState.isDragging(item.key);\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-GridListItem',\n values: {\n ...states,\n isHovered,\n isFocusVisible,\n selectionMode: state.selectionManager.selectionMode,\n selectionBehavior: state.selectionManager.selectionBehavior,\n allowsDragging: !!dragState,\n isDragging,\n isDropTarget: dropIndicator?.isDropTarget\n }\n });\n\n let dragButtonRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (dragState && !dragButtonRef.current) {\n console.warn('Draggable items in a GridList must contain a <Button slot=\"drag\"> element so that keyboard and screen reader users can drag them.');\n }\n // eslint-disable-next-line\n }, []);\n\n useEffect(() => {\n if (!item.textValue) {\n console.warn('A `textValue` prop is required for <GridListItem> elements with non-plain text children in order to support accessibility features such as type to select.');\n }\n }, [item.textValue]);\n\n return (\n <>\n {dropIndicator && !dropIndicator.isHidden &&\n <div role=\"row\" style={{position: 'absolute'}}>\n <div role=\"gridcell\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator?.dropIndicatorProps} ref={dropIndicatorRef} />\n </div>\n </div>\n }\n <div\n {...mergeProps(filterDOMProps(props as any), rowProps, focusProps, hoverProps, draggableItem?.dragProps)}\n {...renderProps}\n ref={ref}\n data-selected={states.isSelected || undefined}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-allows-dragging={!!dragState || undefined}\n data-dragging={isDragging || undefined}\n data-drop-target={dropIndicator?.isDropTarget || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}>\n <div {...gridCellProps} style={{display: 'contents'}}>\n <Provider\n values={[\n [CheckboxContext, {\n slots: {\n selection: checkboxProps\n }\n }],\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: buttonProps,\n drag: {\n ...draggableItem?.dragButtonProps,\n ref: dragButtonRef,\n style: {\n pointerEvents: 'none'\n }\n }\n }\n }],\n [TextContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n description: descriptionProps\n }\n }],\n [CollectionRendererContext, DefaultCollectionRenderer],\n [ListStateContext, null]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n </div>\n </>\n );\n});\n\nfunction GridListDropIndicatorWrapper(props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n ref = useObjectRef(ref);\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);\n let buttonRef = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps, isHidden, isDropTarget} = dragAndDropHooks!.useDropIndicator!(\n props,\n dropState!,\n buttonRef\n );\n\n if (isHidden) {\n return null;\n }\n\n return (\n <GridListDropIndicatorForwardRef {...props} dropIndicatorProps={dropIndicatorProps} isDropTarget={isDropTarget} buttonRef={buttonRef} ref={ref} />\n );\n}\n\ninterface GridListDropIndicatorProps extends DropIndicatorProps {\n dropIndicatorProps: React.HTMLAttributes<HTMLElement>,\n isDropTarget: boolean,\n buttonRef: RefObject<HTMLDivElement | null>\n}\n\nfunction GridListDropIndicator(props: GridListDropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n let {\n dropIndicatorProps,\n isDropTarget,\n buttonRef,\n ...otherProps\n } = props;\n\n let {visuallyHiddenProps} = useVisuallyHidden();\n let renderProps = useRenderProps({\n ...otherProps,\n defaultClassName: 'react-aria-DropIndicator',\n values: {\n isDropTarget\n }\n });\n\n return (\n <div\n {...renderProps}\n role=\"row\"\n ref={ref as RefObject<HTMLDivElement | null>}\n data-drop-target={isDropTarget || undefined}>\n <div role=\"gridcell\">\n <div {...visuallyHiddenProps} role=\"button\" {...dropIndicatorProps} ref={buttonRef} />\n {renderProps.children}\n </div>\n </div>\n );\n}\n\nconst GridListDropIndicatorForwardRef = forwardRef(GridListDropIndicator);\n\nfunction RootDropIndicator() {\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);\n let ref = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!({\n target: {type: 'root'}\n }, dropState!, ref);\n let isDropTarget = dropState!.isDropTarget({type: 'root'});\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']} style={{position: 'absolute'}}>\n <div role=\"gridcell\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"GridList.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;AA+DM,MAAM,0DAAkB,CAAA,GAAA,oBAAY,EAAoD;AAE/F,SAAS,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AAA,iBAAS,EAAE;AAEnD,SAAS;IACP,IAAI,oBAAC,gBAAgB,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,yCAAiB;IAChE,IAAI,MAAM,CAAA,GAAA,aAAK,EAAkB;IACjC,IAAI,sBAAC,kBAAkB,EAAC,GAAG,iBAAkB,gBAAgB,CAAE;QAC7D,QAAQ;YAAC,MAAM;QAAM;IACvB,GAAG,WAAY;IACf,IAAI,eAAe,UAAW,YAAY,CAAC;QAAC,MAAM;IAAM;IACxD,IAAI,uBAAC,mBAAmB,EAAC,GAAG,CAAA,GAAA,wBAAgB;IAE5C,IAAI,CAAC,gBAAgB,kBAAkB,CAAC,cAAc,EACpD,OAAO;IAGT,qBACE,gCAAC;QAAI,MAAK;QAAM,eAAa,kBAAkB,CAAC,cAAc;QAAE,OAAO;YAAC,UAAU;QAAU;qBAC1F,gCAAC;QAAI,MAAK;qBACR,gCAAC;QAAI,MAAK;QAAU,GAAG,mBAAmB;QAAG,GAAG,kBAAkB;QAAE,KAAK;;AAIjF","sources":["packages/react-aria-components/src/GridList.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 {AriaGridListProps, DraggableItemResult, DragPreviewRenderer, DropIndicatorAria, DroppableCollectionResult, FocusScope, ListKeyboardDelegate, mergeProps, useCollator, useFocusRing, useGridList, useGridListItem, useGridListSelectionCheckbox, useHover, useLocale, useVisuallyHidden} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {CheckboxContext} from './RSPContexts';\nimport {Collection, CollectionBuilder, createLeafComponent} from '@react-aria/collections';\nimport {CollectionProps, CollectionRendererContext, DefaultCollectionRenderer, ItemRenderProps} from './Collection';\nimport {ContextValue, DEFAULT_SLOT, Provider, RenderProps, ScrollableProps, SlotProps, StyleRenderProps, useContextProps, useRenderProps} from './utils';\nimport {DragAndDropContext, DropIndicatorContext, DropIndicatorProps, useDndPersistedKeys, useRenderDropIndicator} from './DragAndDrop';\nimport {DragAndDropHooks} from './useDragAndDrop';\nimport {DraggableCollectionState, DroppableCollectionState, Collection as ICollection, ListState, Node, SelectionBehavior, useListState} from 'react-stately';\nimport {filterDOMProps, useObjectRef} from '@react-aria/utils';\nimport {forwardRefType, HoverEvents, Key, LinkDOMProps, RefObject} from '@react-types/shared';\nimport {ListStateContext} from './ListBox';\nimport React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, JSX, ReactNode, useContext, useEffect, useMemo, useRef} from 'react';\nimport {TextContext} from './Text';\n\nexport interface GridListRenderProps {\n /**\n * Whether the list has no items and should display its empty state.\n * @selector [data-empty]\n */\n isEmpty: boolean,\n /**\n * Whether the grid list is currently focused.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the grid list is currently keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the grid list is currently the active drop target.\n * @selector [data-drop-target]\n */\n isDropTarget: boolean,\n /**\n * Whether the items are arranged in a stack or grid.\n * @selector [data-layout=\"stack | grid\"]\n */\n layout: 'stack' | 'grid',\n /**\n * State of the grid list.\n */\n state: ListState<unknown>\n}\n\nexport interface GridListProps<T> extends Omit<AriaGridListProps<T>, 'children'>, CollectionProps<T>, StyleRenderProps<GridListRenderProps>, SlotProps, ScrollableProps<HTMLDivElement> {\n /** How multiple selection should behave in the collection. */\n selectionBehavior?: SelectionBehavior,\n /** The drag and drop hooks returned by `useDragAndDrop` used to enable drag and drop behavior for the GridList. */\n dragAndDropHooks?: DragAndDropHooks,\n /** Provides content to display when there are no items in the list. */\n renderEmptyState?: (props: GridListRenderProps) => ReactNode,\n /**\n * Whether the items are arranged in a stack or grid.\n * @default 'stack'\n */\n layout?: 'stack' | 'grid'\n}\n\n\nexport const GridListContext = createContext<ContextValue<GridListProps<any>, HTMLDivElement>>(null);\n\nfunction GridList<T extends object>(props: GridListProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n // Render the portal first so that we have the collection by the time we render the DOM in SSR.\n [props, ref] = useContextProps(props, ref, GridListContext);\n\n return (\n <CollectionBuilder content={<Collection {...props} />}>\n {collection => <GridListInner props={props} collection={collection} gridListRef={ref} />}\n </CollectionBuilder>\n );\n}\n\ninterface GridListInnerProps<T extends object> {\n props: GridListProps<T>,\n collection: ICollection<Node<object>>,\n gridListRef: RefObject<HTMLDivElement | null>\n}\n\nfunction GridListInner<T extends object>({props, collection, gridListRef: ref}: GridListInnerProps<T>) {\n let {dragAndDropHooks, keyboardNavigationBehavior = 'arrow', layout = 'stack'} = props;\n let {CollectionRoot, isVirtualized, layoutDelegate, dropTargetDelegate: ctxDropTargetDelegate} = useContext(CollectionRendererContext);\n let state = useListState({\n ...props,\n collection,\n children: undefined,\n layoutDelegate\n });\n\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let {disabledBehavior, disabledKeys} = state.selectionManager;\n let {direction} = useLocale();\n let keyboardDelegate = useMemo(() => (\n new ListKeyboardDelegate({\n collection,\n collator,\n ref,\n disabledKeys,\n disabledBehavior,\n layoutDelegate,\n layout,\n direction\n })\n ), [collection, ref, layout, disabledKeys, disabledBehavior, layoutDelegate, collator, direction]);\n\n let {gridProps} = useGridList({\n ...props,\n keyboardDelegate,\n // Only tab navigation is supported in grid layout.\n keyboardNavigationBehavior: layout === 'grid' ? 'tab' : keyboardNavigationBehavior,\n isVirtualized\n }, state, ref);\n\n let selectionManager = state.selectionManager;\n let isListDraggable = !!dragAndDropHooks?.useDraggableCollectionState;\n let isListDroppable = !!dragAndDropHooks?.useDroppableCollectionState;\n let dragHooksProvided = useRef(isListDraggable);\n let dropHooksProvided = useRef(isListDroppable);\n useEffect(() => {\n if (dragHooksProvided.current !== isListDraggable) {\n console.warn('Drag hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n if (dropHooksProvided.current !== isListDroppable) {\n console.warn('Drop hooks were provided during one render, but not another. This should be avoided as it may produce unexpected behavior.');\n }\n }, [isListDraggable, isListDroppable]);\n\n let dragState: DraggableCollectionState | undefined = undefined;\n let dropState: DroppableCollectionState | undefined = undefined;\n let droppableCollection: DroppableCollectionResult | undefined = undefined;\n let isRootDropTarget = false;\n let dragPreview: JSX.Element | null = null;\n let preview = useRef<DragPreviewRenderer>(null);\n\n if (isListDraggable && dragAndDropHooks) {\n dragState = dragAndDropHooks.useDraggableCollectionState!({\n collection,\n selectionManager,\n preview: dragAndDropHooks.renderDragPreview ? preview : undefined\n });\n dragAndDropHooks.useDraggableCollection!({}, dragState, ref);\n\n let DragPreview = dragAndDropHooks.DragPreview!;\n dragPreview = dragAndDropHooks.renderDragPreview\n ? <DragPreview ref={preview}>{dragAndDropHooks.renderDragPreview}</DragPreview>\n : null;\n }\n\n if (isListDroppable && dragAndDropHooks) {\n dropState = dragAndDropHooks.useDroppableCollectionState!({\n collection,\n selectionManager\n });\n\n let keyboardDelegate = new ListKeyboardDelegate({\n collection,\n disabledKeys: selectionManager.disabledKeys,\n disabledBehavior: selectionManager.disabledBehavior,\n ref\n });\n let dropTargetDelegate = dragAndDropHooks.dropTargetDelegate || ctxDropTargetDelegate || new dragAndDropHooks.ListDropTargetDelegate(collection, ref, {layout, direction});\n droppableCollection = dragAndDropHooks.useDroppableCollection!({\n keyboardDelegate,\n dropTargetDelegate\n }, dropState, ref);\n\n isRootDropTarget = dropState.isDropTarget({type: 'root'});\n }\n\n let {focusProps, isFocused, isFocusVisible} = useFocusRing();\n let renderValues = {\n isDropTarget: isRootDropTarget,\n isEmpty: state.collection.size === 0,\n isFocused,\n isFocusVisible,\n layout,\n state\n };\n let renderProps = useRenderProps({\n className: props.className,\n style: props.style,\n defaultClassName: 'react-aria-GridList',\n values: renderValues\n });\n\n let emptyState: ReactNode = null;\n let emptyStatePropOverrides: HTMLAttributes<HTMLElement> | null = null;\n if (state.collection.size === 0 && props.renderEmptyState) {\n let content = props.renderEmptyState(renderValues);\n emptyState = (\n <div role=\"row\" style={{display: 'contents'}}>\n <div role=\"gridcell\" style={{display: 'contents'}}>\n {content}\n </div>\n </div>\n );\n }\n\n return (\n <FocusScope>\n <div\n {...filterDOMProps(props)}\n {...renderProps}\n {...mergeProps(gridProps, focusProps, droppableCollection?.collectionProps, emptyStatePropOverrides)}\n ref={ref}\n slot={props.slot || undefined}\n onScroll={props.onScroll}\n data-drop-target={isRootDropTarget || undefined}\n data-empty={state.collection.size === 0 || undefined}\n data-focused={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-layout={layout}>\n <Provider\n values={[\n [ListStateContext, state],\n [DragAndDropContext, {dragAndDropHooks, dragState, dropState}],\n [DropIndicatorContext, {render: GridListDropIndicatorWrapper}]\n ]}>\n {isListDroppable && <RootDropIndicator />}\n <CollectionRoot\n collection={collection}\n scrollRef={ref}\n persistedKeys={useDndPersistedKeys(selectionManager, dragAndDropHooks, dropState)}\n renderDropIndicator={useRenderDropIndicator(dragAndDropHooks, dropState)} />\n </Provider>\n {emptyState}\n {dragPreview}\n </div>\n </FocusScope>\n );\n}\n\n/**\n * A grid list displays a list of interactive items, with support for keyboard navigation,\n * single or multiple selection, and row actions.\n */\nconst _GridList = /*#__PURE__*/ (forwardRef as forwardRefType)(GridList);\nexport {_GridList as GridList};\n\nexport interface GridListItemRenderProps extends ItemRenderProps {}\n\nexport interface GridListItemProps<T = object> extends RenderProps<GridListItemRenderProps>, LinkDOMProps, HoverEvents {\n /** The unique id of the item. */\n id?: Key,\n /** The object value that this item represents. When using dynamic collections, this is set automatically. */\n value?: T,\n /** A string representation of the item's contents, used for features like typeahead. */\n textValue?: string,\n /** Whether the item is disabled. */\n isDisabled?: boolean,\n /**\n * Handler that is called when a user performs an action on the item. The exact user event depends on\n * the collection's `selectionBehavior` prop and the interaction modality.\n */\n onAction?: () => void\n}\n\n/**\n * A GridListItem represents an individual item in a GridList.\n */\nexport const GridListItem = /*#__PURE__*/ createLeafComponent('item', function GridListItem<T extends object>(props: GridListItemProps<T>, forwardedRef: ForwardedRef<HTMLDivElement>, item: Node<T>) {\n let state = useContext(ListStateContext)!;\n let {dragAndDropHooks, dragState, dropState} = useContext(DragAndDropContext);\n let ref = useObjectRef<HTMLDivElement>(forwardedRef);\n let {isVirtualized} = useContext(CollectionRendererContext);\n let {rowProps, gridCellProps, descriptionProps, ...states} = useGridListItem(\n {\n node: item,\n shouldSelectOnPressUp: !!dragState,\n isVirtualized\n },\n state,\n ref\n );\n\n let {hoverProps, isHovered} = useHover({\n isDisabled: !states.allowsSelection && !states.hasAction,\n onHoverStart: item.props.onHoverStart,\n onHoverChange: item.props.onHoverChange,\n onHoverEnd: item.props.onHoverEnd\n });\n\n let {isFocusVisible, focusProps} = useFocusRing();\n let {checkboxProps} = useGridListSelectionCheckbox(\n {key: item.key},\n state\n );\n\n let buttonProps = state.selectionManager.disabledBehavior === 'all' && states.isDisabled ? {isDisabled: true} : {};\n\n let draggableItem: DraggableItemResult | null = null;\n if (dragState && dragAndDropHooks) {\n draggableItem = dragAndDropHooks.useDraggableItem!({key: item.key, hasDragButton: true}, dragState);\n }\n\n let dropIndicator: DropIndicatorAria | null = null;\n let dropIndicatorRef = useRef<HTMLDivElement>(null);\n let {visuallyHiddenProps} = useVisuallyHidden();\n if (dropState && dragAndDropHooks) {\n dropIndicator = dragAndDropHooks.useDropIndicator!({\n target: {type: 'item', key: item.key, dropPosition: 'on'}\n }, dropState, dropIndicatorRef);\n }\n\n let isDragging = dragState && dragState.isDragging(item.key);\n let renderProps = useRenderProps({\n ...props,\n id: undefined,\n children: item.rendered,\n defaultClassName: 'react-aria-GridListItem',\n values: {\n ...states,\n isHovered,\n isFocusVisible,\n selectionMode: state.selectionManager.selectionMode,\n selectionBehavior: state.selectionManager.selectionBehavior,\n allowsDragging: !!dragState,\n isDragging,\n isDropTarget: dropIndicator?.isDropTarget\n }\n });\n\n let dragButtonRef = useRef<HTMLButtonElement>(null);\n useEffect(() => {\n if (dragState && !dragButtonRef.current) {\n console.warn('Draggable items in a GridList must contain a <Button slot=\"drag\"> element so that keyboard and screen reader users can drag them.');\n }\n // eslint-disable-next-line\n }, []);\n\n useEffect(() => {\n if (!item.textValue) {\n console.warn('A `textValue` prop is required for <GridListItem> elements with non-plain text children in order to support accessibility features such as type to select.');\n }\n }, [item.textValue]);\n\n return (\n <>\n {dropIndicator && !dropIndicator.isHidden &&\n <div role=\"row\" style={{position: 'absolute'}}>\n <div role=\"gridcell\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicator?.dropIndicatorProps} ref={dropIndicatorRef} />\n </div>\n </div>\n }\n <div\n {...mergeProps(filterDOMProps(props as any), rowProps, focusProps, hoverProps, draggableItem?.dragProps)}\n {...renderProps}\n ref={ref}\n data-selected={states.isSelected || undefined}\n data-disabled={states.isDisabled || undefined}\n data-hovered={isHovered || undefined}\n data-focused={states.isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-pressed={states.isPressed || undefined}\n data-allows-dragging={!!dragState || undefined}\n data-dragging={isDragging || undefined}\n data-drop-target={dropIndicator?.isDropTarget || undefined}\n data-selection-mode={state.selectionManager.selectionMode === 'none' ? undefined : state.selectionManager.selectionMode}>\n <div {...gridCellProps} style={{display: 'contents'}}>\n <Provider\n values={[\n [CheckboxContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n selection: checkboxProps\n }\n }],\n [ButtonContext, {\n slots: {\n [DEFAULT_SLOT]: buttonProps,\n drag: {\n ...draggableItem?.dragButtonProps,\n ref: dragButtonRef,\n style: {\n pointerEvents: 'none'\n }\n }\n }\n }],\n [TextContext, {\n slots: {\n [DEFAULT_SLOT]: {},\n description: descriptionProps\n }\n }],\n [CollectionRendererContext, DefaultCollectionRenderer],\n [ListStateContext, null]\n ]}>\n {renderProps.children}\n </Provider>\n </div>\n </div>\n </>\n );\n});\n\nfunction GridListDropIndicatorWrapper(props: DropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n ref = useObjectRef(ref);\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);\n let buttonRef = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps, isHidden, isDropTarget} = dragAndDropHooks!.useDropIndicator!(\n props,\n dropState!,\n buttonRef\n );\n\n if (isHidden) {\n return null;\n }\n\n return (\n <GridListDropIndicatorForwardRef {...props} dropIndicatorProps={dropIndicatorProps} isDropTarget={isDropTarget} buttonRef={buttonRef} ref={ref} />\n );\n}\n\ninterface GridListDropIndicatorProps extends DropIndicatorProps {\n dropIndicatorProps: React.HTMLAttributes<HTMLElement>,\n isDropTarget: boolean,\n buttonRef: RefObject<HTMLDivElement | null>\n}\n\nfunction GridListDropIndicator(props: GridListDropIndicatorProps, ref: ForwardedRef<HTMLElement>) {\n let {\n dropIndicatorProps,\n isDropTarget,\n buttonRef,\n ...otherProps\n } = props;\n\n let {visuallyHiddenProps} = useVisuallyHidden();\n let renderProps = useRenderProps({\n ...otherProps,\n defaultClassName: 'react-aria-DropIndicator',\n values: {\n isDropTarget\n }\n });\n\n return (\n <div\n {...renderProps}\n role=\"row\"\n ref={ref as RefObject<HTMLDivElement | null>}\n data-drop-target={isDropTarget || undefined}>\n <div role=\"gridcell\">\n <div {...visuallyHiddenProps} role=\"button\" {...dropIndicatorProps} ref={buttonRef} />\n {renderProps.children}\n </div>\n </div>\n );\n}\n\nconst GridListDropIndicatorForwardRef = forwardRef(GridListDropIndicator);\n\nfunction RootDropIndicator() {\n let {dragAndDropHooks, dropState} = useContext(DragAndDropContext);\n let ref = useRef<HTMLDivElement>(null);\n let {dropIndicatorProps} = dragAndDropHooks!.useDropIndicator!({\n target: {type: 'root'}\n }, dropState!, ref);\n let isDropTarget = dropState!.isDropTarget({type: 'root'});\n let {visuallyHiddenProps} = useVisuallyHidden();\n\n if (!isDropTarget && dropIndicatorProps['aria-hidden']) {\n return null;\n }\n\n return (\n <div role=\"row\" aria-hidden={dropIndicatorProps['aria-hidden']} style={{position: 'absolute'}}>\n <div role=\"gridcell\">\n <div role=\"button\" {...visuallyHiddenProps} {...dropIndicatorProps} ref={ref} />\n </div>\n </div>\n );\n}\n"],"names":[],"version":3,"file":"GridList.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAwDM,MAAM,0DAAgB,CAAA,GAAA,0BAAY,EAAkD;AACpF,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAA+B;AAE7E,SAAS,6BAAyB,KAAqB,EAAE,GAAiC;IACxF,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,IACpB,OAAO,aAAa,aAChB,SAAS;YACT,QAAQ;wBACR;uBACA;wBACA;YACA,WAAW;YACX,gBAAgB;YAChB,iBAAiB;QACnB,KACE,UACH;QAAC;QAAU;QAAY;QAAW;KAAW;IAEhD,qBACE,0DAAC,CAAA,GAAA,6CAAgB;QAAE,SAAS;OACzB,CAAA,2BAAc,0DAAC;YAAY,OAAO;YAAO,YAAY;YAAY,WAAW;;AAGnF;AAQA,SAAS,kCAA8B,SAAC,KAAK,EAAE,WAAW,GAAG,cAAE,UAAU,EAAsB;IAC7F,IAAI,EAAC,oBAAoB,sBAAsB,EAAC,GAAG,CAAA,GAAA,2CAAgB,EAAE,CAAA,GAAA,qCAAU,MAAM,CAAC;QAC7D,2BAAA;IAAzB,IAAI,qBAAqB,CAAA,OAAA,CAAA,4BAAA,MAAM,kBAAkB,cAAxB,uCAAA,4BAA4B,oCAA5B,kBAAA,OA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2CAAA,gCAAiC;YAC/C,eAAe,CAAC;QAClB;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE;IAE9B,qBACE,0DAAC;QAAK,KAAK;QAAM,GAAG,QAAQ;QAAG,GAAG,WAAW;QAAE,oBAAkB,CAAC,gBAAgB;qBAEhF,0DAAC,CAAA,GAAA,qCAAU,EAAE,QAAQ;QAAC,OAAO;OAC1B,YAAY,QAAQ;AAI7B;AAEA;;;CAGC,GACD,MAAM,4CAA6B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB","sources":["packages/react-aria-components/src/Select.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 {AriaSelectProps, HiddenSelect, useFocusRing, useLocalizedStringFormatter, useSelect} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {Collection, Node, SelectState, useSelectState} 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} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ItemRenderProps} from './Collection';\nimport {LabelContext} from './Label';\nimport {ListBoxContext, ListStateContext} from './ListBox';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, ReactNode, useCallback, useContext, useMemo, useRef, useState} from 'react';\nimport {TextContext} from './Text';\n\nexport interface SelectRenderProps {\n /**\n * Whether the select is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the select is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the select is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the select is currently open.\n * @selector [data-open]\n */\n isOpen: boolean,\n /**\n * Whether the select is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the select is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport interface SelectProps<T extends object> extends Omit<AriaSelectProps<T>, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior' | 'items'>, RACValidation, RenderProps<SelectRenderProps>, SlotProps {}\n\nexport const SelectContext = createContext<ContextValue<SelectProps<any>, HTMLDivElement>>(null);\nexport const SelectStateContext = createContext<SelectState<unknown> | null>(null);\n\nfunction Select<T extends object>(props: SelectProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, SelectContext);\n let {children, isDisabled = false, isInvalid = false, isRequired = false} = props;\n let content = useMemo(() => (\n typeof children === 'function'\n ? children({\n isOpen: false,\n isDisabled,\n isInvalid,\n isRequired,\n isFocused: false,\n isFocusVisible: false,\n defaultChildren: null\n })\n : children\n ), [children, isDisabled, isInvalid, isRequired]);\n\n return (\n <CollectionBuilder content={content}>\n {collection => <SelectInner props={props} collection={collection} selectRef={ref} />}\n </CollectionBuilder>\n );\n}\n\ninterface SelectInnerProps<T extends object> {\n props: SelectProps<T>,\n selectRef: ForwardedRef<HTMLDivElement>,\n collection: Collection<Node<T>>\n}\n\nfunction SelectInner<T extends object>({props, selectRef: ref, collection}: SelectInnerProps<T>) {\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useSelectState({\n ...props,\n collection,\n children: undefined,\n validationBehavior\n });\n\n let {isFocusVisible, focusProps} = useFocusRing({within: true});\n\n // Get props for child elements from useSelect\n let buttonRef = useRef<HTMLButtonElement>(null);\n let [labelRef, label] = useSlot();\n let {\n labelProps,\n triggerProps,\n valueProps,\n menuProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useSelect({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, buttonRef);\n\n // Make menu width match input + button\n let [buttonWidth, setButtonWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (buttonRef.current) {\n setButtonWidth(buttonRef.current.offsetWidth + 'px');\n }\n }, [buttonRef]);\n\n useResizeObserver({\n ref: buttonRef,\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 isFocused: state.isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false,\n isRequired: props.isRequired || false\n }), [state.isOpen, state.isFocused, isFocusVisible, props.isDisabled, validation.isInvalid, props.isRequired]);\n\n let renderProps = useRenderProps({\n ...props,\n values: renderPropsState,\n defaultClassName: 'react-aria-Select'\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n let scrollRef = useRef(null);\n\n return (\n <Provider\n values={[\n [SelectContext, props],\n [SelectStateContext, state],\n [SelectValueContext, valueProps],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [ButtonContext, {...triggerProps, ref: buttonRef, isPressed: state.isOpen}],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'Select',\n triggerRef: buttonRef,\n scrollRef,\n placement: 'bottom start',\n style: {'--trigger-width': buttonWidth} as React.CSSProperties\n }],\n [ListBoxContext, {...menuProps, ref: scrollRef}],\n [ListStateContext, state],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n {...focusProps}\n ref={ref}\n slot={props.slot || undefined}\n data-focused={state.isFocused || undefined}\n data-focus-visible={isFocusVisible || 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 <HiddenSelect\n state={state}\n triggerRef={buttonRef}\n label={label}\n name={props.name}\n isDisabled={props.isDisabled} />\n </Provider>\n );\n}\n\n/**\n * A select displays a collapsible list of options and allows a user to select one of them.\n */\nconst _Select = /*#__PURE__*/ (forwardRef as forwardRefType)(Select);\nexport {_Select as Select};\n\nexport interface SelectValueRenderProps<T> {\n /**\n * Whether the value is a placeholder.\n * @selector [data-placeholder]\n */\n isPlaceholder: boolean,\n /** The object value of the currently selected item. */\n selectedItem: T | null,\n /** The textValue of the currently selected item. */\n selectedText: string | null\n}\n\nexport interface SelectValueProps<T extends object> extends Omit<HTMLAttributes<HTMLElement>, keyof RenderProps<unknown>>, RenderProps<SelectValueRenderProps<T>> {}\n\nexport const SelectValueContext = createContext<ContextValue<SelectValueProps<any>, HTMLSpanElement>>(null);\n\nfunction SelectValue<T extends object>(props: SelectValueProps<T>, ref: ForwardedRef<HTMLSpanElement>) {\n [props, ref] = useContextProps(props, ref, SelectValueContext);\n let state = useContext(SelectStateContext)!;\n let {placeholder} = useSlottedContext(SelectContext)!;\n let selectedItem = state.selectedKey != null\n ? state.collection.getItem(state.selectedKey)\n : null;\n let rendered = selectedItem?.props.children;\n if (typeof rendered === 'function') {\n // If the selected item has a function as a child, we need to call it to render to React.JSX.\n let fn = rendered as (s: ItemRenderProps) => ReactNode;\n rendered = fn({\n isHovered: false,\n isPressed: false,\n isSelected: false,\n isFocused: false,\n isFocusVisible: false,\n isDisabled: false,\n selectionMode: 'single',\n selectionBehavior: 'toggle'\n });\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, 'react-aria-components');\n\n let renderProps = useRenderProps({\n ...props,\n defaultChildren: rendered ?? placeholder ?? stringFormatter.format('selectPlaceholder'),\n defaultClassName: 'react-aria-SelectValue',\n values: {\n selectedItem: state.selectedItem?.value as T ?? null,\n selectedText: state.selectedItem?.textValue ?? null,\n isPlaceholder: !selectedItem\n }\n });\n\n let DOMProps = filterDOMProps(props);\n\n return (\n <span ref={ref} {...DOMProps} {...renderProps} data-placeholder={!selectedItem || undefined}>\n {/* clear description and error message slots */}\n <TextContext.Provider value={undefined}>\n {renderProps.children}\n </TextContext.Provider>\n </span>\n );\n}\n\n/**\n * SelectValue renders the current value of a Select, or a placeholder if no value is selected.\n * It is usually placed within the button element.\n */\nconst _SelectValue = /*#__PURE__*/ (forwardRef as forwardRefType)(SelectValue);\nexport {_SelectValue as SelectValue};\n"],"names":[],"version":3,"file":"Select.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAwDM,MAAM,0DAAgB,CAAA,GAAA,0BAAY,EAAkD;AACpF,MAAM,0DAAqB,CAAA,GAAA,0BAAY,EAA+B;AAE7E,SAAS,6BAA8B,KAAqB,EAAE,GAAiC;IAC7F,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,IACpB,OAAO,aAAa,aAChB,SAAS;YACT,QAAQ;wBACR;uBACA;wBACA;YACA,WAAW;YACX,gBAAgB;YAChB,iBAAiB;QACnB,KACE,UACH;QAAC;QAAU;QAAY;QAAW;KAAW;IAEhD,qBACE,0DAAC,CAAA,GAAA,6CAAgB;QAAE,SAAS;OACzB,CAAA,2BAAc,0DAAC;YAAY,OAAO;YAAO,YAAY;YAAY,WAAW;;AAGnF;AAQA,SAAS,kCAA8B,SAAC,K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AAA,sBAAA,WAAY,yBAAZ,kBAAA,OAA2B,gBAAgB,MAAM,CAAC;QACnE,kBAAkB;QAClB,QAAQ;YACN,cAAc,CAAA,6BAAA,sBAAA,MAAM,YAAY,cAAlB,0CAAA,oBAAoB,KAAK,cAAzB,uCAAA,4BAAkC;YAChD,cAAc,CAAA,iCAAA,uBAAA,MAAM,YAAY,cAAlB,2CAAA,qBAAoB,SAAS,cAA7B,2CAAA,gCAAiC;YAC/C,eAAe,CAAC;QAClB;IACF;IAEA,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE;IAE9B,qBACE,0DAAC;QAAK,KAAK;QAAM,GAAG,QAAQ;QAAG,GAAG,WAAW;QAAE,oBAAkB,CAAC,gBAAgB;qBAEhF,0DAAC,CAAA,GAAA,qCAAU,EAAE,QAAQ;QAAC,OAAO;OAC1B,YAAY,QAAQ;AAI7B;AAEA;;;CAGC,GACD,MAAM,4CAA6B,AAAd,WAAW,GAAI,CAAA,GAAA,uBAAS,EAAqB","sources":["packages/react-aria-components/src/Select.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 {AriaSelectProps, HiddenSelect, useFocusRing, useLocalizedStringFormatter, useSelect} from 'react-aria';\nimport {ButtonContext} from './Button';\nimport {Collection, Node, SelectState, useSelectState} 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} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {ItemRenderProps} from './Collection';\nimport {LabelContext} from './Label';\nimport {ListBoxContext, ListStateContext} from './ListBox';\nimport {OverlayTriggerStateContext} from './Dialog';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, HTMLAttributes, ReactNode, useCallback, useContext, useMemo, useRef, useState} from 'react';\nimport {TextContext} from './Text';\n\nexport interface SelectRenderProps {\n /**\n * Whether the select is focused, either via a mouse or keyboard.\n * @selector [data-focused]\n */\n isFocused: boolean,\n /**\n * Whether the select is keyboard focused.\n * @selector [data-focus-visible]\n */\n isFocusVisible: boolean,\n /**\n * Whether the select is disabled.\n * @selector [data-disabled]\n */\n isDisabled: boolean,\n /**\n * Whether the select is currently open.\n * @selector [data-open]\n */\n isOpen: boolean,\n /**\n * Whether the select is invalid.\n * @selector [data-invalid]\n */\n isInvalid: boolean,\n /**\n * Whether the select is required.\n * @selector [data-required]\n */\n isRequired: boolean\n}\n\nexport interface SelectProps<T extends object = {}> extends Omit<AriaSelectProps<T>, 'children' | 'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior' | 'items'>, RACValidation, RenderProps<SelectRenderProps>, SlotProps {}\n\nexport const SelectContext = createContext<ContextValue<SelectProps<any>, HTMLDivElement>>(null);\nexport const SelectStateContext = createContext<SelectState<unknown> | null>(null);\n\nfunction Select<T extends object = {}>(props: SelectProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n [props, ref] = useContextProps(props, ref, SelectContext);\n let {children, isDisabled = false, isInvalid = false, isRequired = false} = props;\n let content = useMemo(() => (\n typeof children === 'function'\n ? children({\n isOpen: false,\n isDisabled,\n isInvalid,\n isRequired,\n isFocused: false,\n isFocusVisible: false,\n defaultChildren: null\n })\n : children\n ), [children, isDisabled, isInvalid, isRequired]);\n\n return (\n <CollectionBuilder content={content}>\n {collection => <SelectInner props={props} collection={collection} selectRef={ref} />}\n </CollectionBuilder>\n );\n}\n\ninterface SelectInnerProps<T extends object> {\n props: SelectProps<T>,\n selectRef: ForwardedRef<HTMLDivElement>,\n collection: Collection<Node<T>>\n}\n\nfunction SelectInner<T extends object>({props, selectRef: ref, collection}: SelectInnerProps<T>) {\n let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n let state = useSelectState({\n ...props,\n collection,\n children: undefined,\n validationBehavior\n });\n\n let {isFocusVisible, focusProps} = useFocusRing({within: true});\n\n // Get props for child elements from useSelect\n let buttonRef = useRef<HTMLButtonElement>(null);\n let [labelRef, label] = useSlot();\n let {\n labelProps,\n triggerProps,\n valueProps,\n menuProps,\n descriptionProps,\n errorMessageProps,\n ...validation\n } = useSelect({\n ...removeDataAttributes(props),\n label,\n validationBehavior\n }, state, buttonRef);\n\n // Make menu width match input + button\n let [buttonWidth, setButtonWidth] = useState<string | null>(null);\n let onResize = useCallback(() => {\n if (buttonRef.current) {\n setButtonWidth(buttonRef.current.offsetWidth + 'px');\n }\n }, [buttonRef]);\n\n useResizeObserver({\n ref: buttonRef,\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 isFocused: state.isFocused,\n isFocusVisible,\n isDisabled: props.isDisabled || false,\n isInvalid: validation.isInvalid || false,\n isRequired: props.isRequired || false\n }), [state.isOpen, state.isFocused, isFocusVisible, props.isDisabled, validation.isInvalid, props.isRequired]);\n\n let renderProps = useRenderProps({\n ...props,\n values: renderPropsState,\n defaultClassName: 'react-aria-Select'\n });\n\n let DOMProps = filterDOMProps(props);\n delete DOMProps.id;\n\n let scrollRef = useRef(null);\n\n return (\n <Provider\n values={[\n [SelectContext, props],\n [SelectStateContext, state],\n [SelectValueContext, valueProps],\n [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n [ButtonContext, {...triggerProps, ref: buttonRef, isPressed: state.isOpen}],\n [OverlayTriggerStateContext, state],\n [PopoverContext, {\n trigger: 'Select',\n triggerRef: buttonRef,\n scrollRef,\n placement: 'bottom start',\n style: {'--trigger-width': buttonWidth} as React.CSSProperties\n }],\n [ListBoxContext, {...menuProps, ref: scrollRef}],\n [ListStateContext, state],\n [TextContext, {\n slots: {\n description: descriptionProps,\n errorMessage: errorMessageProps\n }\n }],\n [FieldErrorContext, validation]\n ]}>\n <div\n {...DOMProps}\n {...renderProps}\n {...focusProps}\n ref={ref}\n slot={props.slot || undefined}\n data-focused={state.isFocused || undefined}\n data-focus-visible={isFocusVisible || 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 <HiddenSelect\n state={state}\n triggerRef={buttonRef}\n label={label}\n name={props.name}\n isDisabled={props.isDisabled} />\n </Provider>\n );\n}\n\n/**\n * A select displays a collapsible list of options and allows a user to select one of them.\n */\nconst _Select = /*#__PURE__*/ (forwardRef as forwardRefType)(Select);\nexport {_Select as Select};\n\nexport interface SelectValueRenderProps<T> {\n /**\n * Whether the value is a placeholder.\n * @selector [data-placeholder]\n */\n isPlaceholder: boolean,\n /** The object value of the currently selected item. */\n selectedItem: T | null,\n /** The textValue of the currently selected item. */\n selectedText: string | null\n}\n\nexport interface SelectValueProps<T extends object> extends Omit<HTMLAttributes<HTMLElement>, keyof RenderProps<unknown>>, RenderProps<SelectValueRenderProps<T>> {}\n\nexport const SelectValueContext = createContext<ContextValue<SelectValueProps<any>, HTMLSpanElement>>(null);\n\nfunction SelectValue<T extends object>(props: SelectValueProps<T>, ref: ForwardedRef<HTMLSpanElement>) {\n [props, ref] = useContextProps(props, ref, SelectValueContext);\n let state = useContext(SelectStateContext)!;\n let {placeholder} = useSlottedContext(SelectContext)!;\n let selectedItem = state.selectedKey != null\n ? state.collection.getItem(state.selectedKey)\n : null;\n let rendered = selectedItem?.props.children;\n if (typeof rendered === 'function') {\n // If the selected item has a function as a child, we need to call it to render to React.JSX.\n let fn = rendered as (s: ItemRenderProps) => ReactNode;\n rendered = fn({\n isHovered: false,\n isPressed: false,\n isSelected: false,\n isFocused: false,\n isFocusVisible: false,\n isDisabled: false,\n selectionMode: 'single',\n selectionBehavior: 'toggle'\n });\n }\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, 'react-aria-components');\n\n let renderProps = useRenderProps({\n ...props,\n defaultChildren: rendered ?? placeholder ?? stringFormatter.format('selectPlaceholder'),\n defaultClassName: 'react-aria-SelectValue',\n values: {\n selectedItem: state.selectedItem?.value as T ?? null,\n selectedText: state.selectedItem?.textValue ?? null,\n isPlaceholder: !selectedItem\n }\n });\n\n let DOMProps = filterDOMProps(props);\n\n return (\n <span ref={ref} {...DOMProps} {...renderProps} data-placeholder={!selectedItem || undefined}>\n {/* clear description and error message slots */}\n <TextContext.Provider value={undefined}>\n {renderProps.children}\n </TextContext.Provider>\n </span>\n );\n}\n\n/**\n * SelectValue renders the current value of a Select, or a placeholder if no value is selected.\n * It is usually placed within the button element.\n */\nconst _SelectValue = /*#__PURE__*/ (forwardRef as forwardRefType)(SelectValue);\nexport {_SelectValue as SelectValue};\n"],"names":[],"version":3,"file":"Select.main.js.map"}