@react-spectrum/card 3.0.0-alpha.32 → 3.0.0-alpha.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/BaseLayout.main.js +21 -26
  2. package/dist/BaseLayout.main.js.map +1 -1
  3. package/dist/BaseLayout.mjs +22 -27
  4. package/dist/BaseLayout.module.js +21 -26
  5. package/dist/BaseLayout.module.js.map +1 -1
  6. package/dist/Card.main.js +2 -2
  7. package/dist/Card.mjs +3 -3
  8. package/dist/Card.module.js +2 -2
  9. package/dist/CardBase.main.js +37 -37
  10. package/dist/CardBase.main.js.map +1 -1
  11. package/dist/CardBase.mjs +38 -38
  12. package/dist/CardBase.module.js +37 -37
  13. package/dist/CardBase.module.js.map +1 -1
  14. package/dist/CardView.main.js +56 -48
  15. package/dist/CardView.main.js.map +1 -1
  16. package/dist/CardView.mjs +58 -50
  17. package/dist/CardView.module.js +57 -49
  18. package/dist/CardView.module.js.map +1 -1
  19. package/dist/CardViewContext.mjs +1 -1
  20. package/dist/GalleryLayout.main.js +10 -10
  21. package/dist/GalleryLayout.main.js.map +1 -1
  22. package/dist/GalleryLayout.mjs +11 -11
  23. package/dist/GalleryLayout.module.js +10 -10
  24. package/dist/GalleryLayout.module.js.map +1 -1
  25. package/dist/GridLayout.main.js +18 -42
  26. package/dist/GridLayout.main.js.map +1 -1
  27. package/dist/GridLayout.mjs +19 -43
  28. package/dist/GridLayout.module.js +18 -42
  29. package/dist/GridLayout.module.js.map +1 -1
  30. package/dist/WaterfallLayout.main.js +7 -7
  31. package/dist/WaterfallLayout.main.js.map +1 -1
  32. package/dist/WaterfallLayout.mjs +8 -8
  33. package/dist/WaterfallLayout.module.js +7 -7
  34. package/dist/WaterfallLayout.module.js.map +1 -1
  35. package/dist/ar-AE.mjs +1 -1
  36. package/dist/bg-BG.mjs +1 -1
  37. package/dist/card_vars_css.mjs +1 -1
  38. package/dist/cs-CZ.mjs +1 -1
  39. package/dist/da-DK.mjs +1 -1
  40. package/dist/de-DE.mjs +1 -1
  41. package/dist/el-GR.mjs +1 -1
  42. package/dist/en-US.mjs +1 -1
  43. package/dist/es-ES.mjs +1 -1
  44. package/dist/et-EE.mjs +1 -1
  45. package/dist/fi-FI.mjs +1 -1
  46. package/dist/fr-FR.mjs +1 -1
  47. package/dist/he-IL.mjs +1 -1
  48. package/dist/hr-HR.mjs +1 -1
  49. package/dist/hu-HU.mjs +1 -1
  50. package/dist/intlStrings.mjs +1 -1
  51. package/dist/it-IT.mjs +1 -1
  52. package/dist/ja-JP.mjs +1 -1
  53. package/dist/ko-KR.mjs +1 -1
  54. package/dist/lt-LT.mjs +1 -1
  55. package/dist/lv-LV.mjs +1 -1
  56. package/dist/nb-NO.mjs +1 -1
  57. package/dist/nl-NL.mjs +1 -1
  58. package/dist/pl-PL.mjs +1 -1
  59. package/dist/pt-BR.mjs +1 -1
  60. package/dist/pt-PT.mjs +1 -1
  61. package/dist/ro-RO.mjs +1 -1
  62. package/dist/ru-RU.mjs +1 -1
  63. package/dist/sk-SK.mjs +1 -1
  64. package/dist/sl-SI.mjs +1 -1
  65. package/dist/sr-SP.mjs +1 -1
  66. package/dist/sv-SE.mjs +1 -1
  67. package/dist/tr-TR.mjs +1 -1
  68. package/dist/types.d.ts +12 -11
  69. package/dist/types.d.ts.map +1 -1
  70. package/dist/uk-UA.mjs +1 -1
  71. package/dist/zh-CN.mjs +1 -1
  72. package/dist/zh-TW.main.js +1 -1
  73. package/dist/zh-TW.main.js.map +1 -1
  74. package/dist/zh-TW.mjs +2 -2
  75. package/dist/zh-TW.module.js +1 -1
  76. package/dist/zh-TW.module.js.map +1 -1
  77. package/package.json +20 -20
  78. package/src/BaseLayout.tsx +22 -19
  79. package/src/CardBase.tsx +1 -1
  80. package/src/CardView.tsx +42 -38
  81. package/src/GalleryLayout.tsx +2 -2
  82. package/src/GridLayout.tsx +0 -35
  83. package/src/WaterfallLayout.tsx +2 -2
@@ -1 +1 @@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C;QAAI,KAAK;QAAS,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;OAC9C,WAAW,QAAQ,aAAa,KAAK,wBACpC,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;qBACjC,gCAAC,CAAA,GAAA,eAAO;QACN,KAAK;QACL,YAAY;QACZ,qBAAA;QACA,YAAY;QACZ,UAAU;QACV,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;QACrC,cAAA;QACA,cAAW;uBAGjB,gCAAC,CAAA,GAAA,mBAAW;QAAE,OAAO;OAClB,yBAEH,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;;AAK7C;AAWA,SAAS,8BAAQ,KAAsB;IACrC,IAAI,UAAU,CAAA,GAAA,gBAAQ;IACtB,IAAI,gBAAgB,CAAA,GAAA,gBAAQ;IAC5B,IAAI,aAAa,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;YAC9B,IAAI;QACN,CAAA,GAAI;QAAC;KAAQ;IACb,IAAI,eAAe,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;YAChC,IAAI;QACN,CAAA,GAAI;QAAC;KAAc;IAEnB,OAAO;QACL,WAAW;YACT,GAAG,CAAA,GAAA,qBAAa,EAAE,MAAM;YACxB,mBAAmB;YACnB,oBAAoB;YACpB,UAAU;QACZ;oBACA;sBACA;IACF;AACF;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/card/src/CardBase.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {AriaCardProps, SpectrumCardProps} from '@react-types/card';\nimport {Checkbox} from '@react-spectrum/checkbox';\nimport {classNames, SlotProvider, useDOMRef, useHasChild, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, Node} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useLayoutEffect, useResizeObserver, useSlotId} from '@react-aria/utils';\nimport {FocusRing, getFocusableTreeWalker} from '@react-aria/focus';\nimport React, {HTMLAttributes, useCallback, useMemo, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/card/vars.css';\nimport {useCardViewContext} from './CardViewContext';\nimport {useFocusWithin, useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\n\ninterface CardBaseProps<T> extends SpectrumCardProps {\n articleProps?: HTMLAttributes<HTMLElement>,\n item?: Node<T>\n}\n\nfunction CardBase<T extends object>(props: CardBaseProps<T>, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n let context = useCardViewContext() || {}; // we can call again here, won't change from Card.tsx\n let {state} = context;\n let manager = state?.selectionManager;\n let {\n isQuiet,\n orientation = 'vertical',\n articleProps = {},\n item,\n layout,\n children\n } = props;\n\n let key = item?.key;\n let isSelected = manager?.isSelected(key);\n let isDisabled = state?.disabledKeys.has(key);\n let onChange = () => manager?.select(key);\n\n let {styleProps} = useStyleProps(props);\n let {cardProps, titleProps, contentProps} = useCard(props);\n let domRef = useDOMRef(ref);\n let gridRef = useRef<HTMLDivElement>();\n let checkboxRef = useRef(null);\n\n // cards are only interactive if there is a selection manager and it allows selection\n let {hoverProps, isHovered} = useHover({isDisabled: manager === undefined || manager?.selectionMode === 'none' || isDisabled});\n let [isFocused, setIsFocused] = useState(false);\n let {focusWithinProps} = useFocusWithin({\n onFocusWithinChange: setIsFocused,\n isDisabled\n });\n\n // ToDo: see css for comment about avatar under selector .spectrum-Card--noLayout.spectrum-Card--default\n let hasPreviewImage = useHasChild(`.${styles['spectrum-Card-image']}`, gridRef);\n let hasPreviewIllustration = useHasChild(`.${styles['spectrum-Card-illustration']}`, gridRef);\n let hasPreview = hasPreviewImage || hasPreviewIllustration;\n\n // this is for horizontal cards\n let [height, setHeight] = useState(NaN);\n let updateHeight = useCallback(() => {\n if (orientation !== 'horizontal') {\n return;\n }\n\n let cardHeight = gridRef.current.getBoundingClientRect().height;\n setHeight(cardHeight);\n }, [orientation, gridRef, setHeight]);\n useResizeObserver({ref: gridRef, onResize: updateHeight});\n\n let aspectRatioEnforce = undefined;\n if (orientation === 'horizontal' && !isNaN(height)) {\n aspectRatioEnforce = {\n height: `${height}px`,\n width: `${height}px`\n };\n }\n\n let slots = useMemo(() => ({\n image: {UNSAFE_className: classNames(styles, 'spectrum-Card-image'), objectFit: orientation === 'horizontal' ? 'cover' : 'contain', alt: '', ...aspectRatioEnforce},\n illustration: {UNSAFE_className: classNames(styles, 'spectrum-Card-illustration'), ...aspectRatioEnforce},\n avatar: {UNSAFE_className: classNames(styles, 'spectrum-Card-avatar'), size: 'avatar-size-400'},\n heading: {UNSAFE_className: classNames(styles, 'spectrum-Card-heading'), ...titleProps},\n content: {UNSAFE_className: classNames(styles, 'spectrum-Card-content'), ...contentProps},\n detail: {UNSAFE_className: classNames(styles, 'spectrum-Card-detail')}\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }), [titleProps, contentProps, height, isQuiet, orientation]);\n\n useLayoutEffect(() => {\n if (gridRef?.current) {\n let walker = getFocusableTreeWalker(gridRef.current);\n let nextNode = walker.nextNode();\n while (nextNode != null) {\n if (checkboxRef.current && !checkboxRef.current.UNSAFE_getDOMNode().contains(nextNode)) {\n console.warn('Card does not support focusable elements, please contact the team regarding your use case.');\n break;\n }\n nextNode = walker.nextNode();\n }\n }\n }, [children]);\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <article\n {...styleProps}\n {...mergeProps(cardProps, focusWithinProps, hoverProps, filterDOMProps(props), articleProps)}\n ref={domRef}\n className={classNames(styles, 'spectrum-Card', {\n 'spectrum-Card--default': !isQuiet && orientation !== 'horizontal',\n 'spectrum-Card--isQuiet': isQuiet && orientation !== 'horizontal',\n 'spectrum-Card--horizontal': orientation === 'horizontal',\n 'spectrum-Card--noPreview': !hasPreview,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'is-selected': isSelected,\n 'spectrum-Card--waterfall': layout === 'waterfall',\n 'spectrum-Card--gallery': layout === 'gallery',\n 'spectrum-Card--grid': layout === 'grid',\n 'spectrum-Card--noLayout': layout !== 'waterfall' && layout !== 'gallery' && layout !== 'grid'\n }, styleProps.className)}>\n <div ref={gridRef} className={classNames(styles, 'spectrum-Card-grid')}>\n {manager && manager.selectionMode !== 'none' && (\n <div className={classNames(styles, 'spectrum-Card-checkboxWrapper')}>\n <Checkbox\n ref={checkboxRef}\n isDisabled={isDisabled}\n excludeFromTabOrder\n isSelected={isSelected}\n onChange={onChange}\n UNSAFE_className={classNames(styles, 'spectrum-Card-checkbox')}\n isEmphasized\n aria-label=\"select\" />\n </div>\n )}\n <SlotProvider slots={slots}>\n {children}\n </SlotProvider>\n <div className={classNames(styles, 'spectrum-Card-decoration')} />\n </div>\n </article>\n </FocusRing>\n );\n}\n\ninterface AriaCardOptions extends AriaCardProps {\n}\n\ninterface CardAria {\n cardProps: HTMLAttributes<HTMLDivElement>,\n titleProps: HTMLAttributes<HTMLDivElement>,\n contentProps: HTMLAttributes<HTMLDivElement>\n}\n\nfunction useCard(props: AriaCardOptions): CardAria {\n let titleId = useSlotId();\n let descriptionId = useSlotId();\n let titleProps = useMemo(() => ({\n id: titleId\n }), [titleId]);\n let contentProps = useMemo(() => ({\n id: descriptionId\n }), [descriptionId]);\n\n return {\n cardProps: {\n ...filterDOMProps(props),\n 'aria-labelledby': titleId,\n 'aria-describedby': descriptionId,\n tabIndex: 0\n },\n titleProps,\n contentProps\n };\n}\n\n/**\n * TODO: Add description of component here.\n */\nconst _CardBase = React.forwardRef(CardBase);\nexport {_CardBase as CardBase};\n"],"names":[],"version":3,"file":"CardBase.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAmBD,SAAS,+BAA2B,KAAuB,EAAE,GAA2B;IACtF,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,IAAI,UAAU,CAAA,GAAA,yCAAiB,OAAO,CAAC,GAAG,qDAAqD;IAC/F,IAAI,SAAC,KAAK,EAAC,GAAG;IACd,IAAI,UAAU,kBAAA,4BAAA,MAAO,gBAAgB;IACrC,IAAI,WACF,OAAO,eACP,cAAc,0BACd,eAAe,CAAC,SAChB,IAAI,UACJ,MAAM,YACN,QAAQ,EACT,GAAG;IAEJ,IAAI,MAAM,iBAAA,2BAAA,KAAM,GAAG;IACnB,IAAI,aAAa,oBAAA,8BAAA,QAAS,UAAU,CAAC;IACrC,IAAI,aAAa,kBAAA,4BAAA,MAAO,YAAY,CAAC,GAAG,CAAC;IACzC,IAAI,WAAW,IAAM,oBAAA,8BAAA,QAAS,MAAM,CAAC;IAErC,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,aAAC,SAAS,cAAE,UAAU,gBAAE,YAAY,EAAC,GAAG,8BAAQ;IACpD,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,UAAU,CAAA,GAAA,aAAK,EAAkB;IACrC,IAAI,cAAc,CAAA,GAAA,aAAK,EAAE;IAEzB,qFAAqF;IACrF,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAAC,YAAY,YAAY,aAAa,CAAA,oBAAA,8BAAA,QAAS,aAAa,MAAK,UAAU;IAAU;IAC5H,IAAI,CAAC,WAAW,aAAa,GAAG,CAAA,GAAA,eAAO,EAAE;IACzC,IAAI,oBAAC,gBAAg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;YACvC,0BAA0B,WAAW;YACrC,uBAAuB,WAAW;YAClC,2BAA2B,WAAW,eAAe,WAAW,aAAa,WAAW;QAC1F,GAAG,WAAW,SAAS;qBACvB,gCAAC;QAAI,KAAK;QAAS,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;OAC9C,WAAW,QAAQ,aAAa,KAAK,wBACpC,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;qBACjC,gCAAC,CAAA,GAAA,eAAO;QACN,KAAK;QACL,YAAY;QACZ,qBAAA;QACA,YAAY;QACZ,UAAU;QACV,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;QACrC,cAAA;QACA,cAAW;uBAGjB,gCAAC,CAAA,GAAA,mBAAW;QAAE,OAAO;OAClB,yBAEH,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;;AAK7C;AAWA,SAAS,8BAAQ,KAAsB;IACrC,IAAI,UAAU,CAAA,GAAA,gBAAQ;IACtB,IAAI,gBAAgB,CAAA,GAAA,gBAAQ;IAC5B,IAAI,aAAa,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;YAC9B,IAAI;QACN,CAAA,GAAI;QAAC;KAAQ;IACb,IAAI,eAAe,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;YAChC,IAAI;QACN,CAAA,GAAI;QAAC;KAAc;IAEnB,OAAO;QACL,WAAW;YACT,GAAG,CAAA,GAAA,qBAAa,EAAE,MAAM;YACxB,mBAAmB;YACnB,oBAAoB;YACpB,UAAU;QACZ;oBACA;sBACA;IACF;AACF;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/card/src/CardBase.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {AriaCardProps, SpectrumCardProps} from '@react-types/card';\nimport {Checkbox} from '@react-spectrum/checkbox';\nimport {classNames, SlotProvider, useDOMRef, useHasChild, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, Node} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useLayoutEffect, useResizeObserver, useSlotId} from '@react-aria/utils';\nimport {FocusRing, getFocusableTreeWalker} from '@react-aria/focus';\nimport React, {HTMLAttributes, useCallback, useMemo, useRef, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/card/vars.css';\nimport {useCardViewContext} from './CardViewContext';\nimport {useFocusWithin, useHover} from '@react-aria/interactions';\nimport {useProviderProps} from '@react-spectrum/provider';\n\ninterface CardBaseProps<T> extends SpectrumCardProps {\n articleProps?: HTMLAttributes<HTMLElement>,\n item?: Node<T>\n}\n\nfunction CardBase<T extends object>(props: CardBaseProps<T>, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n let context = useCardViewContext() || {}; // we can call again here, won't change from Card.tsx\n let {state} = context;\n let manager = state?.selectionManager;\n let {\n isQuiet,\n orientation = 'vertical',\n articleProps = {},\n item,\n layout,\n children\n } = props;\n\n let key = item?.key;\n let isSelected = manager?.isSelected(key);\n let isDisabled = state?.disabledKeys.has(key);\n let onChange = () => manager?.select(key);\n\n let {styleProps} = useStyleProps(props);\n let {cardProps, titleProps, contentProps} = useCard(props);\n let domRef = useDOMRef(ref);\n let gridRef = useRef<HTMLDivElement>(undefined);\n let checkboxRef = useRef(null);\n\n // cards are only interactive if there is a selection manager and it allows selection\n let {hoverProps, isHovered} = useHover({isDisabled: manager === undefined || manager?.selectionMode === 'none' || isDisabled});\n let [isFocused, setIsFocused] = useState(false);\n let {focusWithinProps} = useFocusWithin({\n onFocusWithinChange: setIsFocused,\n isDisabled\n });\n\n // ToDo: see css for comment about avatar under selector .spectrum-Card--noLayout.spectrum-Card--default\n let hasPreviewImage = useHasChild(`.${styles['spectrum-Card-image']}`, gridRef);\n let hasPreviewIllustration = useHasChild(`.${styles['spectrum-Card-illustration']}`, gridRef);\n let hasPreview = hasPreviewImage || hasPreviewIllustration;\n\n // this is for horizontal cards\n let [height, setHeight] = useState(NaN);\n let updateHeight = useCallback(() => {\n if (orientation !== 'horizontal') {\n return;\n }\n\n let cardHeight = gridRef.current.getBoundingClientRect().height;\n setHeight(cardHeight);\n }, [orientation, gridRef, setHeight]);\n useResizeObserver({ref: gridRef, onResize: updateHeight});\n\n let aspectRatioEnforce = undefined;\n if (orientation === 'horizontal' && !isNaN(height)) {\n aspectRatioEnforce = {\n height: `${height}px`,\n width: `${height}px`\n };\n }\n\n let slots = useMemo(() => ({\n image: {UNSAFE_className: classNames(styles, 'spectrum-Card-image'), objectFit: orientation === 'horizontal' ? 'cover' : 'contain', alt: '', ...aspectRatioEnforce},\n illustration: {UNSAFE_className: classNames(styles, 'spectrum-Card-illustration'), ...aspectRatioEnforce},\n avatar: {UNSAFE_className: classNames(styles, 'spectrum-Card-avatar'), size: 'avatar-size-400'},\n heading: {UNSAFE_className: classNames(styles, 'spectrum-Card-heading'), ...titleProps},\n content: {UNSAFE_className: classNames(styles, 'spectrum-Card-content'), ...contentProps},\n detail: {UNSAFE_className: classNames(styles, 'spectrum-Card-detail')}\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }), [titleProps, contentProps, height, isQuiet, orientation]);\n\n useLayoutEffect(() => {\n if (gridRef?.current) {\n let walker = getFocusableTreeWalker(gridRef.current);\n let nextNode = walker.nextNode();\n while (nextNode != null) {\n if (checkboxRef.current && !checkboxRef.current.UNSAFE_getDOMNode().contains(nextNode)) {\n console.warn('Card does not support focusable elements, please contact the team regarding your use case.');\n break;\n }\n nextNode = walker.nextNode();\n }\n }\n }, [children]);\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <article\n {...styleProps}\n {...mergeProps(cardProps, focusWithinProps, hoverProps, filterDOMProps(props), articleProps)}\n ref={domRef}\n className={classNames(styles, 'spectrum-Card', {\n 'spectrum-Card--default': !isQuiet && orientation !== 'horizontal',\n 'spectrum-Card--isQuiet': isQuiet && orientation !== 'horizontal',\n 'spectrum-Card--horizontal': orientation === 'horizontal',\n 'spectrum-Card--noPreview': !hasPreview,\n 'is-hovered': isHovered,\n 'is-focused': isFocused,\n 'is-selected': isSelected,\n 'spectrum-Card--waterfall': layout === 'waterfall',\n 'spectrum-Card--gallery': layout === 'gallery',\n 'spectrum-Card--grid': layout === 'grid',\n 'spectrum-Card--noLayout': layout !== 'waterfall' && layout !== 'gallery' && layout !== 'grid'\n }, styleProps.className)}>\n <div ref={gridRef} className={classNames(styles, 'spectrum-Card-grid')}>\n {manager && manager.selectionMode !== 'none' && (\n <div className={classNames(styles, 'spectrum-Card-checkboxWrapper')}>\n <Checkbox\n ref={checkboxRef}\n isDisabled={isDisabled}\n excludeFromTabOrder\n isSelected={isSelected}\n onChange={onChange}\n UNSAFE_className={classNames(styles, 'spectrum-Card-checkbox')}\n isEmphasized\n aria-label=\"select\" />\n </div>\n )}\n <SlotProvider slots={slots}>\n {children}\n </SlotProvider>\n <div className={classNames(styles, 'spectrum-Card-decoration')} />\n </div>\n </article>\n </FocusRing>\n );\n}\n\ninterface AriaCardOptions extends AriaCardProps {\n}\n\ninterface CardAria {\n cardProps: HTMLAttributes<HTMLDivElement>,\n titleProps: HTMLAttributes<HTMLDivElement>,\n contentProps: HTMLAttributes<HTMLDivElement>\n}\n\nfunction useCard(props: AriaCardOptions): CardAria {\n let titleId = useSlotId();\n let descriptionId = useSlotId();\n let titleProps = useMemo(() => ({\n id: titleId\n }), [titleId]);\n let contentProps = useMemo(() => ({\n id: descriptionId\n }), [descriptionId]);\n\n return {\n cardProps: {\n ...filterDOMProps(props),\n 'aria-labelledby': titleId,\n 'aria-describedby': descriptionId,\n tabIndex: 0\n },\n titleProps,\n contentProps\n };\n}\n\n/**\n * TODO: Add description of component here.\n */\nconst _CardBase = React.forwardRef(CardBase);\nexport {_CardBase as CardBase};\n"],"names":[],"version":3,"file":"CardBase.module.js.map"}
@@ -52,13 +52,13 @@ function $514a55f6d91f25ef$var$CardView(props, ref) {
52
52
  let { scale: scale } = (0, $kFdxB$reactspectrumprovider.useProvider)();
53
53
  let { styleProps: styleProps } = (0, $kFdxB$reactspectrumutils.useStyleProps)(props);
54
54
  let domRef = (0, $kFdxB$reactspectrumutils.useDOMRef)(ref);
55
- let { isQuiet: isQuiet, renderEmptyState: renderEmptyState, layout: layout, loadingState: loadingState, onLoadMore: onLoadMore, cardOrientation: cardOrientation = "vertical" } = props;
55
+ let { isQuiet: isQuiet, renderEmptyState: renderEmptyState, layout: layout, loadingState: loadingState, onLoadMore: onLoadMore, cardOrientation: cardOrientation = 'vertical' } = props;
56
56
  let collator = (0, $kFdxB$reactariai18n.useCollator)({
57
- usage: "search",
58
- sensitivity: "base"
57
+ usage: 'search',
58
+ sensitivity: 'base'
59
59
  });
60
- let isLoading = loadingState === "loading" || loadingState === "loadingMore";
61
- let cardViewLayout = (0, $kFdxB$react.useMemo)(()=>typeof layout === "function" ? new layout({
60
+ let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
61
+ let cardViewLayout = (0, $kFdxB$react.useMemo)(()=>typeof layout === 'function' ? new layout({
62
62
  collator: collator,
63
63
  cardOrientation: cardOrientation,
64
64
  scale: scale
@@ -69,7 +69,6 @@ function $514a55f6d91f25ef$var$CardView(props, ref) {
69
69
  scale
70
70
  ]);
71
71
  let layoutType = cardViewLayout.layoutType;
72
- let stringFormatter = (0, $kFdxB$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($85c597beff94758b$exports))), "@react-spectrum/card");
73
72
  let { direction: direction } = (0, $kFdxB$reactariai18n.useLocale)();
74
73
  let { collection: collection } = (0, $kFdxB$reactstatelylist.useListState)(props);
75
74
  let gridCollection = (0, $kFdxB$react.useMemo)(()=>new (0, $kFdxB$reactstatelygrid.GridCollection)({
@@ -83,7 +82,7 @@ function $514a55f6d91f25ef$var$CardView(props, ref) {
83
82
  childNodes: [
84
83
  {
85
84
  key: `cell-${item.key}`,
86
- type: "cell",
85
+ type: 'cell',
87
86
  value: null,
88
87
  level: 0,
89
88
  rendered: null,
@@ -98,38 +97,30 @@ function $514a55f6d91f25ef$var$CardView(props, ref) {
98
97
  ]);
99
98
  let state = (0, $kFdxB$reactstatelygrid.useGridState)({
100
99
  ...props,
101
- selectionMode: cardOrientation === "horizontal" && layoutType === "grid" ? "none" : props.selectionMode,
100
+ selectionMode: cardOrientation === 'horizontal' && layoutType === 'grid' ? 'none' : props.selectionMode,
102
101
  collection: gridCollection,
103
- focusMode: "cell"
102
+ focusMode: 'cell'
104
103
  });
105
104
  cardViewLayout.collection = gridCollection;
106
105
  cardViewLayout.disabledKeys = state.disabledKeys;
107
- cardViewLayout.isLoading = isLoading;
108
- cardViewLayout.direction = direction;
109
106
  let { gridProps: gridProps } = (0, $kFdxB$reactariagrid.useGrid)({
110
107
  ...props,
111
108
  isVirtualized: true,
112
109
  keyboardDelegate: cardViewLayout
113
110
  }, state, domRef);
114
- let renderWrapper = (parent, reusableView)=>/*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement((0, $kFdxB$reactariavirtualizer.VirtualizerItem), {
111
+ let renderWrapper = (0, $kFdxB$react.useCallback)((parent, reusableView)=>/*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement((0, $kFdxB$reactariavirtualizer.VirtualizerItem), {
115
112
  key: reusableView.key,
116
113
  layoutInfo: reusableView.layoutInfo,
117
114
  virtualizer: reusableView.virtualizer,
118
115
  parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
119
- }, reusableView.rendered);
116
+ }, reusableView.rendered), []);
120
117
  let focusedKey = state.selectionManager.focusedKey;
121
118
  let focusedItem = gridCollection.getItem(state.selectionManager.focusedKey);
122
119
  if ((focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.parentKey) != null) focusedKey = focusedItem.parentKey;
123
- let margin = cardViewLayout.margin || 0;
124
- let virtualizer = cardViewLayout.virtualizer;
125
- let scrollToItem = (0, $kFdxB$react.useCallback)((key)=>{
126
- virtualizer && virtualizer.scrollToItem(key, {
127
- duration: 0,
128
- offsetY: margin
129
- });
130
- }, [
131
- margin,
132
- virtualizer
120
+ let persistedKeys = (0, $kFdxB$react.useMemo)(()=>focusedKey != null ? new Set([
121
+ focusedKey
122
+ ]) : null, [
123
+ focusedKey
133
124
  ]);
134
125
  // TODO: does aria-row count and aria-col count need to be modified? Perhaps aria-col count needs to be omitted
135
126
  return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement((0, $e57ab98cef2f01a5$exports.CardViewContext).Provider, {
@@ -137,43 +128,60 @@ function $514a55f6d91f25ef$var$CardView(props, ref) {
137
128
  state: state,
138
129
  isQuiet: isQuiet,
139
130
  layout: cardViewLayout,
140
- cardOrientation: cardOrientation
131
+ cardOrientation: cardOrientation,
132
+ renderEmptyState: renderEmptyState
141
133
  }
142
134
  }, /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement((0, $kFdxB$reactariavirtualizer.Virtualizer), {
143
135
  ...gridProps,
144
136
  ...styleProps,
145
- className: (0, $kFdxB$reactspectrumutils.classNames)((0, ($parcel$interopDefault($71570f0038472fa2$exports))), "spectrum-CardView"),
137
+ className: (0, $kFdxB$reactspectrumutils.classNames)((0, ($parcel$interopDefault($71570f0038472fa2$exports))), 'spectrum-CardView'),
146
138
  ref: domRef,
147
- focusedKey: focusedKey,
139
+ persistedKeys: persistedKeys,
148
140
  scrollDirection: "vertical",
149
141
  layout: cardViewLayout,
150
142
  collection: gridCollection,
151
143
  isLoading: isLoading,
152
144
  onLoadMore: onLoadMore,
145
+ layoutOptions: (0, $kFdxB$react.useMemo)(()=>({
146
+ isLoading: isLoading,
147
+ direction: direction
148
+ }), [
149
+ isLoading,
150
+ direction
151
+ ]),
153
152
  renderWrapper: renderWrapper,
154
- transitionDuration: isLoading ? 160 : 220,
155
- scrollToItem: scrollToItem
156
- }, (type, item)=>{
157
- if (type === "item") return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$InternalCard, {
153
+ style: {
154
+ ...styleProps.style,
155
+ scrollPaddingTop: cardViewLayout.margin || 0
156
+ }
157
+ }, (0, $kFdxB$react.useCallback)((type, item)=>{
158
+ if (type === 'item') return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$InternalCard, {
158
159
  item: item
159
160
  });
160
- else if (type === "loader") return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$CenteredWrapper, null, /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement((0, $kFdxB$reactspectrumprogress.ProgressCircle), {
161
- isIndeterminate: true,
162
- "aria-label": state.collection.size > 0 ? stringFormatter.format("loadingMore") : stringFormatter.format("loading")
163
- }));
164
- else if (type === "placeholder") {
165
- let emptyState = renderEmptyState ? renderEmptyState() : null;
166
- if (emptyState == null) return null;
167
- return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$CenteredWrapper, null, emptyState);
168
- }
161
+ else if (type === 'loader') return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$LoadingState, null);
162
+ else if (type === 'placeholder') return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$EmptyState, null);
163
+ }, [])));
164
+ }
165
+ function $514a55f6d91f25ef$var$LoadingState() {
166
+ let { state: state } = (0, $e57ab98cef2f01a5$exports.useCardViewContext)();
167
+ let stringFormatter = (0, $kFdxB$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($85c597beff94758b$exports))), '@react-spectrum/card');
168
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$CenteredWrapper, null, /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement((0, $kFdxB$reactspectrumprogress.ProgressCircle), {
169
+ isIndeterminate: true,
170
+ "aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')
169
171
  }));
170
172
  }
173
+ function $514a55f6d91f25ef$var$EmptyState() {
174
+ let { renderEmptyState: renderEmptyState } = (0, $e57ab98cef2f01a5$exports.useCardViewContext)();
175
+ let emptyState = renderEmptyState ? renderEmptyState() : null;
176
+ if (emptyState == null) return null;
177
+ return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$CenteredWrapper, null, emptyState);
178
+ }
171
179
  function $514a55f6d91f25ef$var$CenteredWrapper({ children: children }) {
172
180
  let { state: state } = (0, $e57ab98cef2f01a5$exports.useCardViewContext)();
173
181
  return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement("div", {
174
182
  role: "row",
175
183
  "aria-rowindex": state.collection.size + 1,
176
- className: (0, $kFdxB$reactspectrumutils.classNames)((0, ($parcel$interopDefault($71570f0038472fa2$exports))), "spectrum-CardView-centeredWrapper")
184
+ className: (0, $kFdxB$reactspectrumutils.classNames)((0, ($parcel$interopDefault($71570f0038472fa2$exports))), 'spectrum-CardView-centeredWrapper')
177
185
  }, /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement("div", {
178
186
  role: "gridcell"
179
187
  }, children));
@@ -185,8 +193,8 @@ function $514a55f6d91f25ef$var$InternalCard(props) {
185
193
  ][0];
186
194
  let { state: state, cardOrientation: cardOrientation, isQuiet: isQuiet, layout: layout } = (0, $e57ab98cef2f01a5$exports.useCardViewContext)();
187
195
  let layoutType = layout.layoutType;
188
- let rowRef = (0, $kFdxB$react.useRef)();
189
- let cellRef = (0, $kFdxB$react.useRef)();
196
+ let rowRef = (0, $kFdxB$react.useRef)(undefined);
197
+ let cellRef = (0, $kFdxB$react.useRef)(undefined);
190
198
  let unwrappedRef = (0, $kFdxB$reactspectrumutils.useUnwrapDOMRef)(cellRef);
191
199
  let { rowProps: gridRowProps } = (0, $kFdxB$reactariagrid.useGridRow)({
192
200
  node: item,
@@ -194,19 +202,19 @@ function $514a55f6d91f25ef$var$InternalCard(props) {
194
202
  }, state, rowRef);
195
203
  let { gridCellProps: gridCellProps } = (0, $kFdxB$reactariagrid.useGridCell)({
196
204
  node: cellNode,
197
- focusMode: "cell"
205
+ focusMode: 'cell'
198
206
  }, state, unwrappedRef);
199
207
  // Prevent space key from scrolling the CardView if triggered on a disabled item or on a Card in a selectionMode="none" CardView.
200
- let allowsInteraction = state.selectionManager.selectionMode !== "none";
208
+ let allowsInteraction = state.selectionManager.selectionMode !== 'none';
201
209
  let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
202
210
  let onKeyDown = (e)=>{
203
- if (e.key === " " && isDisabled) e.preventDefault();
211
+ if (e.key === ' ' && isDisabled) e.preventDefault();
204
212
  };
205
213
  let rowProps = (0, $kFdxB$reactariautils.mergeProps)(gridRowProps, {
206
214
  onKeyDown: onKeyDown
207
215
  });
208
- if (layoutType === "grid" || layoutType === "gallery") isQuiet = true;
209
- if (layoutType !== "grid") cardOrientation = "vertical";
216
+ if (layoutType === 'grid' || layoutType === 'gallery') isQuiet = true;
217
+ if (layoutType !== 'grid') cardOrientation = 'vertical';
210
218
  // We don't want to focus the checkbox (or any other focusable elements) within the Card
211
219
  // when pressing the arrow keys so we delete the key down handler here. Arrow key navigation between
212
220
  // the cards in the CardView is handled by useGrid => useSelectableCollection instead.
@@ -214,7 +222,7 @@ function $514a55f6d91f25ef$var$InternalCard(props) {
214
222
  return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement("div", {
215
223
  ...rowProps,
216
224
  ref: rowRef,
217
- className: (0, $kFdxB$reactspectrumutils.classNames)((0, ($parcel$interopDefault($71570f0038472fa2$exports))), "spectrum-CardView-row")
225
+ className: (0, $kFdxB$reactspectrumutils.classNames)((0, ($parcel$interopDefault($71570f0038472fa2$exports))), 'spectrum-CardView-row')
218
226
  }, /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement((0, $7888205ff7de382f$exports.CardBase), {
219
227
  ref: cellRef,
220
228
  articleProps: gridCellProps,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAqBD,SAAS,+BAA2B,KAA+B,EAAE,GAA2B;IAC9F,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,wCAAU;IACxB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,WACF,OAAO,oBACP,gBAAgB,UAChB,MAAM,gBACN,YAAY,cACZ,UAAU,mBACV,kBAAkB,YACnB,GAAG;IAEJ,IAAI,WAAW,CAAA,GAAA,gCAAU,EAAE;QAAC,OAAO;QAAU,aAAa;IAAM;IAChE,IAAI,YAAY,iBAAiB,aAAa,iBAAiB;IAC/D,IAAI,iBAAiB,CAAA,GAAA,oBAAM,EAAE,IAAM,OAAO,WAAW,aAAa,IAAI,OAAO;sBAAC;6BAAU;mBAAiB;QAAK,KAAK,QAAQ;QAAC;QAAQ;QAAU;QAAiB;KAAM;IACrK,IAAI,aAAa,eAAe,UAAU;IAE1C,IAAI,kBAAkB,CAAA,GAAA,gDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA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ACP,KAAK,QAAQ;AAItB;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/card/src/CardView.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {CardBase} from './CardBase';\nimport {CardViewContext, useCardViewContext} from './CardViewContext';\nimport {classNames, useDOMRef, useStyleProps, useUnwrapDOMRef} from '@react-spectrum/utils';\nimport {DOMRef, DOMRefValue, Node} from '@react-types/shared';\nimport {GridCollection, useGridState} from '@react-stately/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {ReactElement, ReactNode, useCallback, useMemo, useRef} from 'react';\nimport {ReusableView} from '@react-stately/virtualizer';\nimport {SpectrumCardViewProps} from '@react-types/card';\nimport styles from '@adobe/spectrum-css-temp/components/card/vars.css';\nimport {useCollator, useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useGrid, useGridCell, useGridRow} from '@react-aria/grid';\nimport {useListState} from '@react-stately/list';\nimport {useProvider} from '@react-spectrum/provider';\nimport {Virtualizer, VirtualizerItem} from '@react-aria/virtualizer';\n\nfunction CardView<T extends object>(props: SpectrumCardViewProps<T>, ref: DOMRef<HTMLDivElement>) {\n let {scale} = useProvider();\n let {styleProps} = useStyleProps(props);\n let domRef = useDOMRef(ref);\n let {\n isQuiet,\n renderEmptyState,\n layout,\n loadingState,\n onLoadMore,\n cardOrientation = 'vertical'\n } = props;\n\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n let cardViewLayout = useMemo(() => typeof layout === 'function' ? new layout({collator, cardOrientation, scale}) : layout, [layout, collator, cardOrientation, scale]);\n let layoutType = cardViewLayout.layoutType;\n\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/card');\n let {direction} = useLocale();\n let {collection} = useListState(props);\n\n let gridCollection = useMemo(() => new GridCollection<T>({\n columnCount: 1,\n items: [...collection].map(item => ({\n // Makes the Grid row use the keys the user provides to the cards so that selection change via interactions returns the card keys\n ...item,\n hasChildNodes: true,\n childNodes: [{\n key: `cell-${item.key}`,\n type: 'cell',\n value: null,\n level: 0,\n rendered: null,\n textValue: item.textValue,\n hasChildNodes: false,\n childNodes: []\n }]\n }))\n }), [collection]);\n\n let state = useGridState({\n ...props,\n selectionMode: cardOrientation === 'horizontal' && layoutType === 'grid' ? 'none' : props.selectionMode,\n collection: gridCollection,\n focusMode: 'cell'\n });\n\n cardViewLayout.collection = gridCollection;\n cardViewLayout.disabledKeys = state.disabledKeys;\n cardViewLayout.isLoading = isLoading;\n cardViewLayout.direction = direction;\n\n let {gridProps} = useGrid({\n ...props,\n isVirtualized: true,\n keyboardDelegate: cardViewLayout\n }, state, domRef);\n\n type View = ReusableView<Node<T>, ReactNode>;\n let renderWrapper = (parent: View, reusableView: View) => (\n <VirtualizerItem\n key={reusableView.key}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n parent={parent?.layoutInfo}>\n {reusableView.rendered}\n </VirtualizerItem>\n );\n\n let focusedKey = state.selectionManager.focusedKey;\n let focusedItem = gridCollection.getItem(state.selectionManager.focusedKey);\n if (focusedItem?.parentKey != null) {\n focusedKey = focusedItem.parentKey;\n }\n\n let margin = cardViewLayout.margin || 0;\n let virtualizer = cardViewLayout.virtualizer;\n let scrollToItem = useCallback((key) => {\n virtualizer && virtualizer.scrollToItem(key, {\n duration: 0,\n offsetY: margin\n });\n }, [margin, virtualizer]);\n\n // TODO: does aria-row count and aria-col count need to be modified? Perhaps aria-col count needs to be omitted\n return (\n <CardViewContext.Provider value={{state, isQuiet, layout: cardViewLayout, cardOrientation}}>\n <Virtualizer\n {...gridProps}\n {...styleProps}\n className={classNames(styles, 'spectrum-CardView')}\n ref={domRef}\n focusedKey={focusedKey}\n scrollDirection=\"vertical\"\n layout={cardViewLayout}\n collection={gridCollection}\n isLoading={isLoading}\n onLoadMore={onLoadMore}\n renderWrapper={renderWrapper}\n transitionDuration={isLoading ? 160 : 220}\n scrollToItem={scrollToItem}>\n {(type, item) => {\n if (type === 'item') {\n return (\n <InternalCard item={item} />\n );\n } else if (type === 'loader') {\n return (\n <CenteredWrapper>\n <ProgressCircle\n isIndeterminate\n aria-label={state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')} />\n </CenteredWrapper>\n );\n } else if (type === 'placeholder') {\n let emptyState = renderEmptyState ? renderEmptyState() : null;\n if (emptyState == null) {\n return null;\n }\n\n return (\n <CenteredWrapper>\n {emptyState}\n </CenteredWrapper>\n );\n }\n }}\n </Virtualizer>\n </CardViewContext.Provider>\n\n );\n}\n\nfunction CenteredWrapper({children}) {\n let {state} = useCardViewContext();\n return (\n <div\n role=\"row\"\n aria-rowindex={state.collection.size + 1}\n className={classNames(styles, 'spectrum-CardView-centeredWrapper')}>\n <div role=\"gridcell\">\n {children}\n </div>\n </div>\n );\n}\n\nfunction InternalCard(props) {\n let {\n item\n } = props;\n let cellNode = [...item.childNodes][0];\n let {state, cardOrientation, isQuiet, layout} = useCardViewContext();\n\n let layoutType = layout.layoutType;\n let rowRef = useRef();\n let cellRef = useRef<DOMRefValue<HTMLDivElement>>();\n let unwrappedRef = useUnwrapDOMRef(cellRef);\n\n let {rowProps: gridRowProps} = useGridRow({\n node: item,\n isVirtualized: true\n }, state, rowRef);\n\n let {gridCellProps} = useGridCell({\n node: cellNode,\n focusMode: 'cell'\n }, state, unwrappedRef);\n\n // Prevent space key from scrolling the CardView if triggered on a disabled item or on a Card in a selectionMode=\"none\" CardView.\n let allowsInteraction = state.selectionManager.selectionMode !== 'none';\n let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);\n\n let onKeyDown = (e) => {\n if (e.key === ' ' && isDisabled) {\n e.preventDefault();\n }\n };\n\n let rowProps = mergeProps(\n gridRowProps,\n {onKeyDown}\n );\n\n if (layoutType === 'grid' || layoutType === 'gallery') {\n isQuiet = true;\n }\n\n if (layoutType !== 'grid') {\n cardOrientation = 'vertical';\n }\n\n // We don't want to focus the checkbox (or any other focusable elements) within the Card\n // when pressing the arrow keys so we delete the key down handler here. Arrow key navigation between\n // the cards in the CardView is handled by useGrid => useSelectableCollection instead.\n delete gridCellProps.onKeyDownCapture;\n return (\n <div {...rowProps} ref={rowRef} className={classNames(styles, 'spectrum-CardView-row')}>\n <CardBase\n ref={cellRef}\n articleProps={gridCellProps}\n isQuiet={isQuiet}\n orientation={cardOrientation}\n item={item}\n layout={layoutType}>\n {item.rendered}\n </CardBase>\n </div>\n );\n}\n\n/**\n * TODO: Add description of component here.\n */\nconst _CardView = React.forwardRef(CardView) as <T>(props: SpectrumCardViewProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\nexport {_CardView as CardView};\n"],"names":[],"version":3,"file":"CardView.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAqBD,SAAS,+BAA2B,KAA+B,EAAE,GAA2B;IAC9F,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,wCAAU;IACxB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,SAAS,CAAA,GAAA,mCAAQ,EAAE;IACvB,IAAI,WACF,OAAO,oBACP,gBAAgB,UAChB,MAAM,gBACN,YAAY,cACZ,UAAU,mBACV,kBAAkB,YACnB,GAAG;IAEJ,IAAI,WAAW,C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AAG,CAAA,GAAA,gCAAU,EAAE;QAChC,MAAM;QACN,WAAW;IACb,GAAG,OAAO;IAEV,iIAAiI;IACjI,IAAI,oBAAoB,MAAM,gBAAgB,CAAC,aAAa,KAAK;IACjE,IAAI,aAAa,CAAC,qBAAqB,MAAM,YAAY,CAAC,GAAG,CAAC,KAAK,GAAG;IAEtE,IAAI,YAAY,CAAC;QACf,IAAI,EAAE,GAAG,KAAK,OAAO,YACnB,EAAE,cAAc;IAEpB;IAEA,IAAI,WAAW,CAAA,GAAA,gCAAS,EACtB,cACA;mBAAC;IAAS;IAGZ,IAAI,eAAe,UAAU,eAAe,WAC1C,UAAU;IAGZ,IAAI,eAAe,QACjB,kBAAkB;IAGpB,wFAAwF;IACxF,oGAAoG;IACpG,sFAAsF;IACtF,OAAO,cAAc,gBAAgB;IACrC,qBACE,0DAAC;QAAK,GAAG,QAAQ;QAAE,KAAK;QAAQ,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;qBAC5D,0DAAC,CAAA,GAAA,kCAAO;QACN,KAAK;QACL,cAAc;QACd,SAAS;QACT,aAAa;QACb,MAAM;QACN,QAAQ;OACP,KAAK,QAAQ;AAItB;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/card/src/CardView.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 {CardBase} from './CardBase';\nimport {CardViewContext, useCardViewContext} from './CardViewContext';\nimport {classNames, useDOMRef, useStyleProps, useUnwrapDOMRef} from '@react-spectrum/utils';\nimport {DOMRef, DOMRefValue, Node} from '@react-types/shared';\nimport {GridCollection, useGridState} from '@react-stately/grid';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {mergeProps} from '@react-aria/utils';\nimport {ProgressCircle} from '@react-spectrum/progress';\nimport React, {ReactElement, ReactNode, useCallback, useMemo, useRef} from 'react';\nimport {ReusableView} from '@react-stately/virtualizer';\nimport {SpectrumCardViewProps} from '@react-types/card';\nimport styles from '@adobe/spectrum-css-temp/components/card/vars.css';\nimport {useCollator, useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useGrid, useGridCell, useGridRow} from '@react-aria/grid';\nimport {useListState} from '@react-stately/list';\nimport {useProvider} from '@react-spectrum/provider';\nimport {Virtualizer, VirtualizerItem} from '@react-aria/virtualizer';\n\nfunction CardView<T extends object>(props: SpectrumCardViewProps<T>, ref: DOMRef<HTMLDivElement>) {\n let {scale} = useProvider();\n let {styleProps} = useStyleProps(props);\n let domRef = useDOMRef(ref);\n let {\n isQuiet,\n renderEmptyState,\n layout,\n loadingState,\n onLoadMore,\n cardOrientation = 'vertical'\n } = props;\n\n let collator = useCollator({usage: 'search', sensitivity: 'base'});\n let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';\n let cardViewLayout = useMemo(() => typeof layout === 'function' ? new layout({collator, cardOrientation, scale}) : layout, [layout, collator, cardOrientation, scale]);\n let layoutType = cardViewLayout.layoutType;\n\n let {direction} = useLocale();\n let {collection} = useListState(props);\n\n let gridCollection = useMemo(() => new GridCollection<T>({\n columnCount: 1,\n items: [...collection].map(item => ({\n // Makes the Grid row use the keys the user provides to the cards so that selection change via interactions returns the card keys\n ...item,\n hasChildNodes: true,\n childNodes: [{\n key: `cell-${item.key}`,\n type: 'cell',\n value: null,\n level: 0,\n rendered: null,\n textValue: item.textValue,\n hasChildNodes: false,\n childNodes: []\n }]\n }))\n }), [collection]);\n\n let state = useGridState({\n ...props,\n selectionMode: cardOrientation === 'horizontal' && layoutType === 'grid' ? 'none' : props.selectionMode,\n collection: gridCollection,\n focusMode: 'cell'\n });\n\n cardViewLayout.collection = gridCollection;\n cardViewLayout.disabledKeys = state.disabledKeys;\n\n let {gridProps} = useGrid({\n ...props,\n isVirtualized: true,\n keyboardDelegate: cardViewLayout\n }, state, domRef);\n\n type View = ReusableView<Node<T>, ReactNode>;\n let renderWrapper = useCallback((parent: View, reusableView: View) => (\n <VirtualizerItem\n key={reusableView.key}\n layoutInfo={reusableView.layoutInfo}\n virtualizer={reusableView.virtualizer}\n parent={parent?.layoutInfo}>\n {reusableView.rendered}\n </VirtualizerItem>\n ), []);\n\n let focusedKey = state.selectionManager.focusedKey;\n let focusedItem = gridCollection.getItem(state.selectionManager.focusedKey);\n if (focusedItem?.parentKey != null) {\n focusedKey = focusedItem.parentKey;\n }\n\n let persistedKeys = useMemo(() => focusedKey != null ? new Set([focusedKey]) : null, [focusedKey]);\n\n // TODO: does aria-row count and aria-col count need to be modified? Perhaps aria-col count needs to be omitted\n return (\n <CardViewContext.Provider value={{state, isQuiet, layout: cardViewLayout, cardOrientation, renderEmptyState}}>\n <Virtualizer\n {...gridProps}\n {...styleProps}\n className={classNames(styles, 'spectrum-CardView')}\n ref={domRef}\n persistedKeys={persistedKeys}\n scrollDirection=\"vertical\"\n layout={cardViewLayout}\n collection={gridCollection}\n isLoading={isLoading}\n onLoadMore={onLoadMore}\n layoutOptions={useMemo(() => ({isLoading, direction}), [isLoading, direction])}\n renderWrapper={renderWrapper}\n style={{\n ...styleProps.style,\n scrollPaddingTop: cardViewLayout.margin || 0\n }}>\n {useCallback((type, item) => {\n if (type === 'item') {\n return (\n <InternalCard item={item} />\n );\n } else if (type === 'loader') {\n return <LoadingState />;\n } else if (type === 'placeholder') {\n return <EmptyState />;\n }\n }, [])}\n </Virtualizer>\n </CardViewContext.Provider>\n\n );\n}\n\nfunction LoadingState() {\n let {state} = useCardViewContext();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/card');\n return (\n <CenteredWrapper>\n <ProgressCircle\n isIndeterminate\n aria-label={state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')} />\n </CenteredWrapper>\n );\n}\n\nfunction EmptyState() {\n let {renderEmptyState} = useCardViewContext();\n let emptyState = renderEmptyState ? renderEmptyState() : null;\n if (emptyState == null) {\n return null;\n }\n\n return (\n <CenteredWrapper>\n {emptyState}\n </CenteredWrapper>\n );\n}\n\nfunction CenteredWrapper({children}) {\n let {state} = useCardViewContext();\n return (\n <div\n role=\"row\"\n aria-rowindex={state.collection.size + 1}\n className={classNames(styles, 'spectrum-CardView-centeredWrapper')}>\n <div role=\"gridcell\">\n {children}\n </div>\n </div>\n );\n}\n\nfunction InternalCard(props) {\n let {\n item\n } = props;\n let cellNode = [...item.childNodes][0];\n let {state, cardOrientation, isQuiet, layout} = useCardViewContext();\n\n let layoutType = layout.layoutType;\n let rowRef = useRef(undefined);\n let cellRef = useRef<DOMRefValue<HTMLDivElement>>(undefined);\n let unwrappedRef = useUnwrapDOMRef(cellRef);\n\n let {rowProps: gridRowProps} = useGridRow({\n node: item,\n isVirtualized: true\n }, state, rowRef);\n\n let {gridCellProps} = useGridCell({\n node: cellNode,\n focusMode: 'cell'\n }, state, unwrappedRef);\n\n // Prevent space key from scrolling the CardView if triggered on a disabled item or on a Card in a selectionMode=\"none\" CardView.\n let allowsInteraction = state.selectionManager.selectionMode !== 'none';\n let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);\n\n let onKeyDown = (e) => {\n if (e.key === ' ' && isDisabled) {\n e.preventDefault();\n }\n };\n\n let rowProps = mergeProps(\n gridRowProps,\n {onKeyDown}\n );\n\n if (layoutType === 'grid' || layoutType === 'gallery') {\n isQuiet = true;\n }\n\n if (layoutType !== 'grid') {\n cardOrientation = 'vertical';\n }\n\n // We don't want to focus the checkbox (or any other focusable elements) within the Card\n // when pressing the arrow keys so we delete the key down handler here. Arrow key navigation between\n // the cards in the CardView is handled by useGrid => useSelectableCollection instead.\n delete gridCellProps.onKeyDownCapture;\n return (\n <div {...rowProps} ref={rowRef} className={classNames(styles, 'spectrum-CardView-row')}>\n <CardBase\n ref={cellRef}\n articleProps={gridCellProps}\n isQuiet={isQuiet}\n orientation={cardOrientation}\n item={item}\n layout={layoutType}>\n {item.rendered}\n </CardBase>\n </div>\n );\n}\n\n/**\n * TODO: Add description of component here.\n */\nconst _CardView = React.forwardRef(CardView) as <T>(props: SpectrumCardViewProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\nexport {_CardView as CardView};\n"],"names":[],"version":3,"file":"CardView.main.js.map"}
package/dist/CardView.mjs CHANGED
@@ -8,7 +8,7 @@ import {GridCollection as $iOsT7$GridCollection, useGridState as $iOsT7$useGridS
8
8
  import {mergeProps as $iOsT7$mergeProps} from "@react-aria/utils";
9
9
  import {ProgressCircle as $iOsT7$ProgressCircle} from "@react-spectrum/progress";
10
10
  import $iOsT7$react, {useMemo as $iOsT7$useMemo, useCallback as $iOsT7$useCallback, useRef as $iOsT7$useRef} from "react";
11
- import {useCollator as $iOsT7$useCollator, useLocalizedStringFormatter as $iOsT7$useLocalizedStringFormatter, useLocale as $iOsT7$useLocale} from "@react-aria/i18n";
11
+ import {useCollator as $iOsT7$useCollator, useLocale as $iOsT7$useLocale, useLocalizedStringFormatter as $iOsT7$useLocalizedStringFormatter} from "@react-aria/i18n";
12
12
  import {useGrid as $iOsT7$useGrid, useGridRow as $iOsT7$useGridRow, useGridCell as $iOsT7$useGridCell} from "@react-aria/grid";
13
13
  import {useListState as $iOsT7$useListState} from "@react-stately/list";
14
14
  import {useProvider as $iOsT7$useProvider} from "@react-spectrum/provider";
@@ -46,13 +46,13 @@ function $81a52da995c19652$var$CardView(props, ref) {
46
46
  let { scale: scale } = (0, $iOsT7$useProvider)();
47
47
  let { styleProps: styleProps } = (0, $iOsT7$useStyleProps)(props);
48
48
  let domRef = (0, $iOsT7$useDOMRef)(ref);
49
- let { isQuiet: isQuiet, renderEmptyState: renderEmptyState, layout: layout, loadingState: loadingState, onLoadMore: onLoadMore, cardOrientation: cardOrientation = "vertical" } = props;
49
+ let { isQuiet: isQuiet, renderEmptyState: renderEmptyState, layout: layout, loadingState: loadingState, onLoadMore: onLoadMore, cardOrientation: cardOrientation = 'vertical' } = props;
50
50
  let collator = (0, $iOsT7$useCollator)({
51
- usage: "search",
52
- sensitivity: "base"
51
+ usage: 'search',
52
+ sensitivity: 'base'
53
53
  });
54
- let isLoading = loadingState === "loading" || loadingState === "loadingMore";
55
- let cardViewLayout = (0, $iOsT7$useMemo)(()=>typeof layout === "function" ? new layout({
54
+ let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
55
+ let cardViewLayout = (0, $iOsT7$useMemo)(()=>typeof layout === 'function' ? new layout({
56
56
  collator: collator,
57
57
  cardOrientation: cardOrientation,
58
58
  scale: scale
@@ -63,7 +63,6 @@ function $81a52da995c19652$var$CardView(props, ref) {
63
63
  scale
64
64
  ]);
65
65
  let layoutType = cardViewLayout.layoutType;
66
- let stringFormatter = (0, $iOsT7$useLocalizedStringFormatter)((0, ($parcel$interopDefault($iOsT7$intlStringsmodulejs))), "@react-spectrum/card");
67
66
  let { direction: direction } = (0, $iOsT7$useLocale)();
68
67
  let { collection: collection } = (0, $iOsT7$useListState)(props);
69
68
  let gridCollection = (0, $iOsT7$useMemo)(()=>new (0, $iOsT7$GridCollection)({
@@ -77,7 +76,7 @@ function $81a52da995c19652$var$CardView(props, ref) {
77
76
  childNodes: [
78
77
  {
79
78
  key: `cell-${item.key}`,
80
- type: "cell",
79
+ type: 'cell',
81
80
  value: null,
82
81
  level: 0,
83
82
  rendered: null,
@@ -92,38 +91,30 @@ function $81a52da995c19652$var$CardView(props, ref) {
92
91
  ]);
93
92
  let state = (0, $iOsT7$useGridState)({
94
93
  ...props,
95
- selectionMode: cardOrientation === "horizontal" && layoutType === "grid" ? "none" : props.selectionMode,
94
+ selectionMode: cardOrientation === 'horizontal' && layoutType === 'grid' ? 'none' : props.selectionMode,
96
95
  collection: gridCollection,
97
- focusMode: "cell"
96
+ focusMode: 'cell'
98
97
  });
99
98
  cardViewLayout.collection = gridCollection;
100
99
  cardViewLayout.disabledKeys = state.disabledKeys;
101
- cardViewLayout.isLoading = isLoading;
102
- cardViewLayout.direction = direction;
103
100
  let { gridProps: gridProps } = (0, $iOsT7$useGrid)({
104
101
  ...props,
105
102
  isVirtualized: true,
106
103
  keyboardDelegate: cardViewLayout
107
104
  }, state, domRef);
108
- let renderWrapper = (parent, reusableView)=>/*#__PURE__*/ (0, $iOsT7$react).createElement((0, $iOsT7$VirtualizerItem), {
105
+ let renderWrapper = (0, $iOsT7$useCallback)((parent, reusableView)=>/*#__PURE__*/ (0, $iOsT7$react).createElement((0, $iOsT7$VirtualizerItem), {
109
106
  key: reusableView.key,
110
107
  layoutInfo: reusableView.layoutInfo,
111
108
  virtualizer: reusableView.virtualizer,
112
109
  parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
113
- }, reusableView.rendered);
110
+ }, reusableView.rendered), []);
114
111
  let focusedKey = state.selectionManager.focusedKey;
115
112
  let focusedItem = gridCollection.getItem(state.selectionManager.focusedKey);
116
113
  if ((focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.parentKey) != null) focusedKey = focusedItem.parentKey;
117
- let margin = cardViewLayout.margin || 0;
118
- let virtualizer = cardViewLayout.virtualizer;
119
- let scrollToItem = (0, $iOsT7$useCallback)((key)=>{
120
- virtualizer && virtualizer.scrollToItem(key, {
121
- duration: 0,
122
- offsetY: margin
123
- });
124
- }, [
125
- margin,
126
- virtualizer
114
+ let persistedKeys = (0, $iOsT7$useMemo)(()=>focusedKey != null ? new Set([
115
+ focusedKey
116
+ ]) : null, [
117
+ focusedKey
127
118
  ]);
128
119
  // TODO: does aria-row count and aria-col count need to be modified? Perhaps aria-col count needs to be omitted
129
120
  return /*#__PURE__*/ (0, $iOsT7$react).createElement((0, $8d180a244893de14$export$64992ac69f286e5c).Provider, {
@@ -131,43 +122,60 @@ function $81a52da995c19652$var$CardView(props, ref) {
131
122
  state: state,
132
123
  isQuiet: isQuiet,
133
124
  layout: cardViewLayout,
134
- cardOrientation: cardOrientation
125
+ cardOrientation: cardOrientation,
126
+ renderEmptyState: renderEmptyState
135
127
  }
136
128
  }, /*#__PURE__*/ (0, $iOsT7$react).createElement((0, $iOsT7$Virtualizer), {
137
129
  ...gridProps,
138
130
  ...styleProps,
139
- className: (0, $iOsT7$classNames)((0, ($parcel$interopDefault($iOsT7$card_vars_cssmodulejs))), "spectrum-CardView"),
131
+ className: (0, $iOsT7$classNames)((0, ($parcel$interopDefault($iOsT7$card_vars_cssmodulejs))), 'spectrum-CardView'),
140
132
  ref: domRef,
141
- focusedKey: focusedKey,
133
+ persistedKeys: persistedKeys,
142
134
  scrollDirection: "vertical",
143
135
  layout: cardViewLayout,
144
136
  collection: gridCollection,
145
137
  isLoading: isLoading,
146
138
  onLoadMore: onLoadMore,
139
+ layoutOptions: (0, $iOsT7$useMemo)(()=>({
140
+ isLoading: isLoading,
141
+ direction: direction
142
+ }), [
143
+ isLoading,
144
+ direction
145
+ ]),
147
146
  renderWrapper: renderWrapper,
148
- transitionDuration: isLoading ? 160 : 220,
149
- scrollToItem: scrollToItem
150
- }, (type, item)=>{
151
- if (type === "item") return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$InternalCard, {
147
+ style: {
148
+ ...styleProps.style,
149
+ scrollPaddingTop: cardViewLayout.margin || 0
150
+ }
151
+ }, (0, $iOsT7$useCallback)((type, item)=>{
152
+ if (type === 'item') return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$InternalCard, {
152
153
  item: item
153
154
  });
154
- else if (type === "loader") return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$CenteredWrapper, null, /*#__PURE__*/ (0, $iOsT7$react).createElement((0, $iOsT7$ProgressCircle), {
155
- isIndeterminate: true,
156
- "aria-label": state.collection.size > 0 ? stringFormatter.format("loadingMore") : stringFormatter.format("loading")
157
- }));
158
- else if (type === "placeholder") {
159
- let emptyState = renderEmptyState ? renderEmptyState() : null;
160
- if (emptyState == null) return null;
161
- return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$CenteredWrapper, null, emptyState);
162
- }
155
+ else if (type === 'loader') return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$LoadingState, null);
156
+ else if (type === 'placeholder') return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$EmptyState, null);
157
+ }, [])));
158
+ }
159
+ function $81a52da995c19652$var$LoadingState() {
160
+ let { state: state } = (0, $8d180a244893de14$export$fea0b38586ec8f13)();
161
+ let stringFormatter = (0, $iOsT7$useLocalizedStringFormatter)((0, ($parcel$interopDefault($iOsT7$intlStringsmodulejs))), '@react-spectrum/card');
162
+ return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$CenteredWrapper, null, /*#__PURE__*/ (0, $iOsT7$react).createElement((0, $iOsT7$ProgressCircle), {
163
+ isIndeterminate: true,
164
+ "aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')
163
165
  }));
164
166
  }
167
+ function $81a52da995c19652$var$EmptyState() {
168
+ let { renderEmptyState: renderEmptyState } = (0, $8d180a244893de14$export$fea0b38586ec8f13)();
169
+ let emptyState = renderEmptyState ? renderEmptyState() : null;
170
+ if (emptyState == null) return null;
171
+ return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$CenteredWrapper, null, emptyState);
172
+ }
165
173
  function $81a52da995c19652$var$CenteredWrapper({ children: children }) {
166
174
  let { state: state } = (0, $8d180a244893de14$export$fea0b38586ec8f13)();
167
175
  return /*#__PURE__*/ (0, $iOsT7$react).createElement("div", {
168
176
  role: "row",
169
177
  "aria-rowindex": state.collection.size + 1,
170
- className: (0, $iOsT7$classNames)((0, ($parcel$interopDefault($iOsT7$card_vars_cssmodulejs))), "spectrum-CardView-centeredWrapper")
178
+ className: (0, $iOsT7$classNames)((0, ($parcel$interopDefault($iOsT7$card_vars_cssmodulejs))), 'spectrum-CardView-centeredWrapper')
171
179
  }, /*#__PURE__*/ (0, $iOsT7$react).createElement("div", {
172
180
  role: "gridcell"
173
181
  }, children));
@@ -179,8 +187,8 @@ function $81a52da995c19652$var$InternalCard(props) {
179
187
  ][0];
180
188
  let { state: state, cardOrientation: cardOrientation, isQuiet: isQuiet, layout: layout } = (0, $8d180a244893de14$export$fea0b38586ec8f13)();
181
189
  let layoutType = layout.layoutType;
182
- let rowRef = (0, $iOsT7$useRef)();
183
- let cellRef = (0, $iOsT7$useRef)();
190
+ let rowRef = (0, $iOsT7$useRef)(undefined);
191
+ let cellRef = (0, $iOsT7$useRef)(undefined);
184
192
  let unwrappedRef = (0, $iOsT7$useUnwrapDOMRef)(cellRef);
185
193
  let { rowProps: gridRowProps } = (0, $iOsT7$useGridRow)({
186
194
  node: item,
@@ -188,19 +196,19 @@ function $81a52da995c19652$var$InternalCard(props) {
188
196
  }, state, rowRef);
189
197
  let { gridCellProps: gridCellProps } = (0, $iOsT7$useGridCell)({
190
198
  node: cellNode,
191
- focusMode: "cell"
199
+ focusMode: 'cell'
192
200
  }, state, unwrappedRef);
193
201
  // Prevent space key from scrolling the CardView if triggered on a disabled item or on a Card in a selectionMode="none" CardView.
194
- let allowsInteraction = state.selectionManager.selectionMode !== "none";
202
+ let allowsInteraction = state.selectionManager.selectionMode !== 'none';
195
203
  let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
196
204
  let onKeyDown = (e)=>{
197
- if (e.key === " " && isDisabled) e.preventDefault();
205
+ if (e.key === ' ' && isDisabled) e.preventDefault();
198
206
  };
199
207
  let rowProps = (0, $iOsT7$mergeProps)(gridRowProps, {
200
208
  onKeyDown: onKeyDown
201
209
  });
202
- if (layoutType === "grid" || layoutType === "gallery") isQuiet = true;
203
- if (layoutType !== "grid") cardOrientation = "vertical";
210
+ if (layoutType === 'grid' || layoutType === 'gallery') isQuiet = true;
211
+ if (layoutType !== 'grid') cardOrientation = 'vertical';
204
212
  // We don't want to focus the checkbox (or any other focusable elements) within the Card
205
213
  // when pressing the arrow keys so we delete the key down handler here. Arrow key navigation between
206
214
  // the cards in the CardView is handled by useGrid => useSelectableCollection instead.
@@ -208,7 +216,7 @@ function $81a52da995c19652$var$InternalCard(props) {
208
216
  return /*#__PURE__*/ (0, $iOsT7$react).createElement("div", {
209
217
  ...rowProps,
210
218
  ref: rowRef,
211
- className: (0, $iOsT7$classNames)((0, ($parcel$interopDefault($iOsT7$card_vars_cssmodulejs))), "spectrum-CardView-row")
219
+ className: (0, $iOsT7$classNames)((0, ($parcel$interopDefault($iOsT7$card_vars_cssmodulejs))), 'spectrum-CardView-row')
212
220
  }, /*#__PURE__*/ (0, $iOsT7$react).createElement((0, $643dd8fa80926f94$export$7a6ccaf429ad93a8), {
213
221
  ref: cellRef,
214
222
  articleProps: gridCellProps,
@@ -224,4 +232,4 @@ function $81a52da995c19652$var$InternalCard(props) {
224
232
 
225
233
 
226
234
  export {$81a52da995c19652$export$7e52c821f7b6f422 as CardView};
227
- //# sourceMappingURL=CardView.mjs.map
235
+ //# sourceMappingURL=CardView.module.js.map