@react-spectrum/card 3.0.0-alpha.53 → 3.0.0-alpha.55

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 (240) hide show
  1. package/dist/import.mjs +6 -6
  2. package/dist/main.js +10 -10
  3. package/dist/main.js.map +1 -1
  4. package/dist/module.js +6 -6
  5. package/dist/module.js.map +1 -1
  6. package/dist/types/src/index.d.ts +9 -0
  7. package/package.json +22 -46
  8. package/src/index.ts +13 -9
  9. package/dist/BaseLayout.main.js +0 -213
  10. package/dist/BaseLayout.main.js.map +0 -1
  11. package/dist/BaseLayout.mjs +0 -208
  12. package/dist/BaseLayout.module.js +0 -208
  13. package/dist/BaseLayout.module.js.map +0 -1
  14. package/dist/Card.main.js +0 -52
  15. package/dist/Card.main.js.map +0 -1
  16. package/dist/Card.mjs +0 -43
  17. package/dist/Card.module.js +0 -43
  18. package/dist/Card.module.js.map +0 -1
  19. package/dist/CardBase.main.js +0 -205
  20. package/dist/CardBase.main.js.map +0 -1
  21. package/dist/CardBase.mjs +0 -200
  22. package/dist/CardBase.module.js +0 -200
  23. package/dist/CardBase.module.js.map +0 -1
  24. package/dist/CardView.main.js +0 -238
  25. package/dist/CardView.main.js.map +0 -1
  26. package/dist/CardView.mjs +0 -233
  27. package/dist/CardView.module.js +0 -233
  28. package/dist/CardView.module.js.map +0 -1
  29. package/dist/CardViewContext.main.js +0 -32
  30. package/dist/CardViewContext.main.js.map +0 -1
  31. package/dist/CardViewContext.mjs +0 -22
  32. package/dist/CardViewContext.module.js +0 -22
  33. package/dist/CardViewContext.module.js.map +0 -1
  34. package/dist/GalleryLayout.main.js +0 -230
  35. package/dist/GalleryLayout.main.js.map +0 -1
  36. package/dist/GalleryLayout.mjs +0 -225
  37. package/dist/GalleryLayout.module.js +0 -225
  38. package/dist/GalleryLayout.module.js.map +0 -1
  39. package/dist/GridLayout.main.js +0 -175
  40. package/dist/GridLayout.main.js.map +0 -1
  41. package/dist/GridLayout.mjs +0 -170
  42. package/dist/GridLayout.module.js +0 -170
  43. package/dist/GridLayout.module.js.map +0 -1
  44. package/dist/WaterfallLayout.main.js +0 -182
  45. package/dist/WaterfallLayout.main.js.map +0 -1
  46. package/dist/WaterfallLayout.mjs +0 -177
  47. package/dist/WaterfallLayout.module.js +0 -177
  48. package/dist/WaterfallLayout.module.js.map +0 -1
  49. package/dist/ar-AE.main.js +0 -7
  50. package/dist/ar-AE.main.js.map +0 -1
  51. package/dist/ar-AE.mjs +0 -9
  52. package/dist/ar-AE.module.js +0 -9
  53. package/dist/ar-AE.module.js.map +0 -1
  54. package/dist/bg-BG.main.js +0 -7
  55. package/dist/bg-BG.main.js.map +0 -1
  56. package/dist/bg-BG.mjs +0 -9
  57. package/dist/bg-BG.module.js +0 -9
  58. package/dist/bg-BG.module.js.map +0 -1
  59. package/dist/card.4d5d6544.css +0 -1671
  60. package/dist/card.4d5d6544.css.map +0 -1
  61. package/dist/card_vars_css.main.js +0 -116
  62. package/dist/card_vars_css.main.js.map +0 -1
  63. package/dist/card_vars_css.mjs +0 -118
  64. package/dist/card_vars_css.module.js +0 -118
  65. package/dist/card_vars_css.module.js.map +0 -1
  66. package/dist/cs-CZ.main.js +0 -7
  67. package/dist/cs-CZ.main.js.map +0 -1
  68. package/dist/cs-CZ.mjs +0 -9
  69. package/dist/cs-CZ.module.js +0 -9
  70. package/dist/cs-CZ.module.js.map +0 -1
  71. package/dist/da-DK.main.js +0 -7
  72. package/dist/da-DK.main.js.map +0 -1
  73. package/dist/da-DK.mjs +0 -9
  74. package/dist/da-DK.module.js +0 -9
  75. package/dist/da-DK.module.js.map +0 -1
  76. package/dist/de-DE.main.js +0 -7
  77. package/dist/de-DE.main.js.map +0 -1
  78. package/dist/de-DE.mjs +0 -9
  79. package/dist/de-DE.module.js +0 -9
  80. package/dist/de-DE.module.js.map +0 -1
  81. package/dist/el-GR.main.js +0 -7
  82. package/dist/el-GR.main.js.map +0 -1
  83. package/dist/el-GR.mjs +0 -9
  84. package/dist/el-GR.module.js +0 -9
  85. package/dist/el-GR.module.js.map +0 -1
  86. package/dist/en-US.main.js +0 -7
  87. package/dist/en-US.main.js.map +0 -1
  88. package/dist/en-US.mjs +0 -9
  89. package/dist/en-US.module.js +0 -9
  90. package/dist/en-US.module.js.map +0 -1
  91. package/dist/es-ES.main.js +0 -7
  92. package/dist/es-ES.main.js.map +0 -1
  93. package/dist/es-ES.mjs +0 -9
  94. package/dist/es-ES.module.js +0 -9
  95. package/dist/es-ES.module.js.map +0 -1
  96. package/dist/et-EE.main.js +0 -7
  97. package/dist/et-EE.main.js.map +0 -1
  98. package/dist/et-EE.mjs +0 -9
  99. package/dist/et-EE.module.js +0 -9
  100. package/dist/et-EE.module.js.map +0 -1
  101. package/dist/fi-FI.main.js +0 -7
  102. package/dist/fi-FI.main.js.map +0 -1
  103. package/dist/fi-FI.mjs +0 -9
  104. package/dist/fi-FI.module.js +0 -9
  105. package/dist/fi-FI.module.js.map +0 -1
  106. package/dist/fr-FR.main.js +0 -7
  107. package/dist/fr-FR.main.js.map +0 -1
  108. package/dist/fr-FR.mjs +0 -9
  109. package/dist/fr-FR.module.js +0 -9
  110. package/dist/fr-FR.module.js.map +0 -1
  111. package/dist/he-IL.main.js +0 -7
  112. package/dist/he-IL.main.js.map +0 -1
  113. package/dist/he-IL.mjs +0 -9
  114. package/dist/he-IL.module.js +0 -9
  115. package/dist/he-IL.module.js.map +0 -1
  116. package/dist/hr-HR.main.js +0 -7
  117. package/dist/hr-HR.main.js.map +0 -1
  118. package/dist/hr-HR.mjs +0 -9
  119. package/dist/hr-HR.module.js +0 -9
  120. package/dist/hr-HR.module.js.map +0 -1
  121. package/dist/hu-HU.main.js +0 -7
  122. package/dist/hu-HU.main.js.map +0 -1
  123. package/dist/hu-HU.mjs +0 -9
  124. package/dist/hu-HU.module.js +0 -9
  125. package/dist/hu-HU.module.js.map +0 -1
  126. package/dist/intlStrings.main.js +0 -108
  127. package/dist/intlStrings.main.js.map +0 -1
  128. package/dist/intlStrings.mjs +0 -110
  129. package/dist/intlStrings.module.js +0 -110
  130. package/dist/intlStrings.module.js.map +0 -1
  131. package/dist/it-IT.main.js +0 -7
  132. package/dist/it-IT.main.js.map +0 -1
  133. package/dist/it-IT.mjs +0 -9
  134. package/dist/it-IT.module.js +0 -9
  135. package/dist/it-IT.module.js.map +0 -1
  136. package/dist/ja-JP.main.js +0 -7
  137. package/dist/ja-JP.main.js.map +0 -1
  138. package/dist/ja-JP.mjs +0 -9
  139. package/dist/ja-JP.module.js +0 -9
  140. package/dist/ja-JP.module.js.map +0 -1
  141. package/dist/ko-KR.main.js +0 -7
  142. package/dist/ko-KR.main.js.map +0 -1
  143. package/dist/ko-KR.mjs +0 -9
  144. package/dist/ko-KR.module.js +0 -9
  145. package/dist/ko-KR.module.js.map +0 -1
  146. package/dist/lt-LT.main.js +0 -7
  147. package/dist/lt-LT.main.js.map +0 -1
  148. package/dist/lt-LT.mjs +0 -9
  149. package/dist/lt-LT.module.js +0 -9
  150. package/dist/lt-LT.module.js.map +0 -1
  151. package/dist/lv-LV.main.js +0 -7
  152. package/dist/lv-LV.main.js.map +0 -1
  153. package/dist/lv-LV.mjs +0 -9
  154. package/dist/lv-LV.module.js +0 -9
  155. package/dist/lv-LV.module.js.map +0 -1
  156. package/dist/nb-NO.main.js +0 -7
  157. package/dist/nb-NO.main.js.map +0 -1
  158. package/dist/nb-NO.mjs +0 -9
  159. package/dist/nb-NO.module.js +0 -9
  160. package/dist/nb-NO.module.js.map +0 -1
  161. package/dist/nl-NL.main.js +0 -7
  162. package/dist/nl-NL.main.js.map +0 -1
  163. package/dist/nl-NL.mjs +0 -9
  164. package/dist/nl-NL.module.js +0 -9
  165. package/dist/nl-NL.module.js.map +0 -1
  166. package/dist/pl-PL.main.js +0 -7
  167. package/dist/pl-PL.main.js.map +0 -1
  168. package/dist/pl-PL.mjs +0 -9
  169. package/dist/pl-PL.module.js +0 -9
  170. package/dist/pl-PL.module.js.map +0 -1
  171. package/dist/pt-BR.main.js +0 -7
  172. package/dist/pt-BR.main.js.map +0 -1
  173. package/dist/pt-BR.mjs +0 -9
  174. package/dist/pt-BR.module.js +0 -9
  175. package/dist/pt-BR.module.js.map +0 -1
  176. package/dist/pt-PT.main.js +0 -7
  177. package/dist/pt-PT.main.js.map +0 -1
  178. package/dist/pt-PT.mjs +0 -9
  179. package/dist/pt-PT.module.js +0 -9
  180. package/dist/pt-PT.module.js.map +0 -1
  181. package/dist/ro-RO.main.js +0 -7
  182. package/dist/ro-RO.main.js.map +0 -1
  183. package/dist/ro-RO.mjs +0 -9
  184. package/dist/ro-RO.module.js +0 -9
  185. package/dist/ro-RO.module.js.map +0 -1
  186. package/dist/ru-RU.main.js +0 -7
  187. package/dist/ru-RU.main.js.map +0 -1
  188. package/dist/ru-RU.mjs +0 -9
  189. package/dist/ru-RU.module.js +0 -9
  190. package/dist/ru-RU.module.js.map +0 -1
  191. package/dist/sk-SK.main.js +0 -7
  192. package/dist/sk-SK.main.js.map +0 -1
  193. package/dist/sk-SK.mjs +0 -9
  194. package/dist/sk-SK.module.js +0 -9
  195. package/dist/sk-SK.module.js.map +0 -1
  196. package/dist/sl-SI.main.js +0 -7
  197. package/dist/sl-SI.main.js.map +0 -1
  198. package/dist/sl-SI.mjs +0 -9
  199. package/dist/sl-SI.module.js +0 -9
  200. package/dist/sl-SI.module.js.map +0 -1
  201. package/dist/sr-SP.main.js +0 -7
  202. package/dist/sr-SP.main.js.map +0 -1
  203. package/dist/sr-SP.mjs +0 -9
  204. package/dist/sr-SP.module.js +0 -9
  205. package/dist/sr-SP.module.js.map +0 -1
  206. package/dist/sv-SE.main.js +0 -7
  207. package/dist/sv-SE.main.js.map +0 -1
  208. package/dist/sv-SE.mjs +0 -9
  209. package/dist/sv-SE.module.js +0 -9
  210. package/dist/sv-SE.module.js.map +0 -1
  211. package/dist/tr-TR.main.js +0 -7
  212. package/dist/tr-TR.main.js.map +0 -1
  213. package/dist/tr-TR.mjs +0 -9
  214. package/dist/tr-TR.module.js +0 -9
  215. package/dist/tr-TR.module.js.map +0 -1
  216. package/dist/types.d.ts +0 -194
  217. package/dist/types.d.ts.map +0 -1
  218. package/dist/uk-UA.main.js +0 -7
  219. package/dist/uk-UA.main.js.map +0 -1
  220. package/dist/uk-UA.mjs +0 -9
  221. package/dist/uk-UA.module.js +0 -9
  222. package/dist/uk-UA.module.js.map +0 -1
  223. package/dist/zh-CN.main.js +0 -7
  224. package/dist/zh-CN.main.js.map +0 -1
  225. package/dist/zh-CN.mjs +0 -9
  226. package/dist/zh-CN.module.js +0 -9
  227. package/dist/zh-CN.module.js.map +0 -1
  228. package/dist/zh-TW.main.js +0 -7
  229. package/dist/zh-TW.main.js.map +0 -1
  230. package/dist/zh-TW.mjs +0 -9
  231. package/dist/zh-TW.module.js +0 -9
  232. package/dist/zh-TW.module.js.map +0 -1
  233. package/src/BaseLayout.tsx +0 -290
  234. package/src/Card.tsx +0 -48
  235. package/src/CardBase.tsx +0 -188
  236. package/src/CardView.tsx +0 -250
  237. package/src/CardViewContext.tsx +0 -27
  238. package/src/GalleryLayout.tsx +0 -321
  239. package/src/GridLayout.tsx +0 -242
  240. package/src/WaterfallLayout.tsx +0 -241
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;AAAA,cAAc;AACd;;;;;;;;;;CAUC;;;;;;;;;AAsBM,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAA2B,KAAuB,EAAE,GAA2B;IAC/H,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;QAAC,MAAM;IAAS,SAC/B,IAAI,UACJ,MAAM,YACN,QAAQ,EACT,GAAG;IAEJ,IA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,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","sources":["packages/@react-spectrum/card/src/CardBase.tsx"],"sourcesContent":["// @ts-nocheck\n/*\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, nodeContains, 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\n/**\n * TODO: Add description of component here.\n */\nexport const CardBase = React.forwardRef(function 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 = {role: 'article'},\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 && !nodeContains(checkboxRef.current.UNSAFE_getDOMNode(), 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 <div\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 </div>\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"],"names":[],"version":3,"file":"CardBase.module.js.map"}
@@ -1,238 +0,0 @@
1
- var $7888205ff7de382f$exports = require("./CardBase.main.js");
2
- var $e57ab98cef2f01a5$exports = require("./CardViewContext.main.js");
3
- var $85c597beff94758b$exports = require("./intlStrings.main.js");
4
- require("./card.4d5d6544.css");
5
- var $71570f0038472fa2$exports = require("./card_vars_css.main.js");
6
- var $kFdxB$reactspectrumutils = require("@react-spectrum/utils");
7
- var $kFdxB$reactstatelygrid = require("@react-stately/grid");
8
- var $kFdxB$reactariautils = require("@react-aria/utils");
9
- var $kFdxB$reactspectrumprogress = require("@react-spectrum/progress");
10
- var $kFdxB$react = require("react");
11
- var $kFdxB$reactariai18n = require("@react-aria/i18n");
12
- var $kFdxB$reactariagrid = require("@react-aria/grid");
13
- var $kFdxB$reactstatelylist = require("@react-stately/list");
14
- var $kFdxB$reactspectrumprovider = require("@react-spectrum/provider");
15
- var $kFdxB$reactariavirtualizer = require("@react-aria/virtualizer");
16
-
17
-
18
- function $parcel$interopDefault(a) {
19
- return a && a.__esModule ? a.default : a;
20
- }
21
-
22
- function $parcel$export(e, n, v, s) {
23
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
24
- }
25
-
26
- $parcel$export(module.exports, "CardView", () => $514a55f6d91f25ef$export$7e52c821f7b6f422);
27
- // @ts-nocheck
28
- /*
29
- * Copyright 2021 Adobe. All rights reserved.
30
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
31
- * you may not use this file except in compliance with the License. You may obtain a copy
32
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
33
- *
34
- * Unless required by applicable law or agreed to in writing, software distributed under
35
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
36
- * OF ANY KIND, either express or implied. See the License for the specific language
37
- * governing permissions and limitations under the License.
38
- */
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
- const $514a55f6d91f25ef$export$7e52c821f7b6f422 = /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).forwardRef(function CardView(props, ref) {
53
- let { scale: scale } = (0, $kFdxB$reactspectrumprovider.useProvider)();
54
- let { styleProps: styleProps } = (0, $kFdxB$reactspectrumutils.useStyleProps)(props);
55
- let domRef = (0, $kFdxB$reactspectrumutils.useDOMRef)(ref);
56
- let { isQuiet: isQuiet, renderEmptyState: renderEmptyState, layout: layout, loadingState: loadingState, onLoadMore: onLoadMore, cardOrientation: cardOrientation = 'vertical' } = props;
57
- let collator = (0, $kFdxB$reactariai18n.useCollator)({
58
- usage: 'search',
59
- sensitivity: 'base'
60
- });
61
- let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
62
- let cardViewLayout = (0, $kFdxB$react.useMemo)(()=>typeof layout === 'function' ? new layout({
63
- collator: collator,
64
- cardOrientation: cardOrientation,
65
- scale: scale
66
- }) : layout, [
67
- layout,
68
- collator,
69
- cardOrientation,
70
- scale
71
- ]);
72
- let layoutType = cardViewLayout.layoutType;
73
- let { direction: direction } = (0, $kFdxB$reactariai18n.useLocale)();
74
- let { collection: collection } = (0, $kFdxB$reactstatelylist.useListState)(props);
75
- let gridCollection = (0, $kFdxB$react.useMemo)(()=>new (0, $kFdxB$reactstatelygrid.GridCollection)({
76
- columnCount: 1,
77
- items: [
78
- ...collection
79
- ].map((item)=>({
80
- // Makes the Grid row use the keys the user provides to the cards so that selection change via interactions returns the card keys
81
- ...item,
82
- hasChildNodes: true,
83
- childNodes: [
84
- {
85
- key: `cell-${item.key}`,
86
- type: 'cell',
87
- value: null,
88
- level: 0,
89
- rendered: null,
90
- textValue: item.textValue,
91
- hasChildNodes: false,
92
- childNodes: []
93
- }
94
- ]
95
- }))
96
- }), [
97
- collection
98
- ]);
99
- let state = (0, $kFdxB$reactstatelygrid.useGridState)({
100
- ...props,
101
- selectionMode: cardOrientation === 'horizontal' && layoutType === 'grid' ? 'none' : props.selectionMode,
102
- collection: gridCollection,
103
- focusMode: 'cell'
104
- });
105
- cardViewLayout.collection = gridCollection;
106
- cardViewLayout.disabledKeys = state.disabledKeys;
107
- let { gridProps: gridProps } = (0, $kFdxB$reactariagrid.useGrid)({
108
- ...props,
109
- isVirtualized: true,
110
- keyboardDelegate: cardViewLayout
111
- }, state, domRef);
112
- let renderWrapper = (0, $kFdxB$react.useCallback)((parent, reusableView)=>/*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement((0, $kFdxB$reactariavirtualizer.VirtualizerItem), {
113
- key: reusableView.key,
114
- layoutInfo: reusableView.layoutInfo,
115
- virtualizer: reusableView.virtualizer,
116
- parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
117
- }, reusableView.rendered), []);
118
- let focusedKey = state.selectionManager.focusedKey;
119
- let focusedItem = gridCollection.getItem(state.selectionManager.focusedKey);
120
- if ((focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.parentKey) != null) focusedKey = focusedItem.parentKey;
121
- let persistedKeys = (0, $kFdxB$react.useMemo)(()=>focusedKey != null ? new Set([
122
- focusedKey
123
- ]) : null, [
124
- focusedKey
125
- ]);
126
- // TODO: does aria-row count and aria-col count need to be modified? Perhaps aria-col count needs to be omitted
127
- return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement((0, $e57ab98cef2f01a5$exports.CardViewContext).Provider, {
128
- value: {
129
- state: state,
130
- isQuiet: isQuiet,
131
- layout: cardViewLayout,
132
- cardOrientation: cardOrientation,
133
- renderEmptyState: renderEmptyState
134
- }
135
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement((0, $kFdxB$reactariavirtualizer.Virtualizer), {
136
- ...gridProps,
137
- ...styleProps,
138
- className: (0, $kFdxB$reactspectrumutils.classNames)((0, ($parcel$interopDefault($71570f0038472fa2$exports))), 'spectrum-CardView'),
139
- ref: domRef,
140
- persistedKeys: persistedKeys,
141
- scrollDirection: "vertical",
142
- layout: cardViewLayout,
143
- collection: gridCollection,
144
- isLoading: isLoading,
145
- onLoadMore: onLoadMore,
146
- layoutOptions: (0, $kFdxB$react.useMemo)(()=>({
147
- isLoading: isLoading,
148
- direction: direction
149
- }), [
150
- isLoading,
151
- direction
152
- ]),
153
- renderWrapper: renderWrapper,
154
- style: {
155
- ...styleProps.style,
156
- scrollPaddingTop: cardViewLayout.margin || 0
157
- }
158
- }, (0, $kFdxB$react.useCallback)((type, item)=>{
159
- if (type === 'item') return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$InternalCard, {
160
- item: item
161
- });
162
- else if (type === 'loader') return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$LoadingState, null);
163
- else if (type === 'placeholder') return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$EmptyState, null);
164
- }, [])));
165
- });
166
- function $514a55f6d91f25ef$var$LoadingState() {
167
- let { state: state } = (0, $e57ab98cef2f01a5$exports.useCardViewContext)();
168
- let stringFormatter = (0, $kFdxB$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($85c597beff94758b$exports))), '@react-spectrum/card');
169
- return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$CenteredWrapper, null, /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement((0, $kFdxB$reactspectrumprogress.ProgressCircle), {
170
- isIndeterminate: true,
171
- "aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')
172
- }));
173
- }
174
- function $514a55f6d91f25ef$var$EmptyState() {
175
- let { renderEmptyState: renderEmptyState } = (0, $e57ab98cef2f01a5$exports.useCardViewContext)();
176
- let emptyState = renderEmptyState ? renderEmptyState() : null;
177
- if (emptyState == null) return null;
178
- return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement($514a55f6d91f25ef$var$CenteredWrapper, null, emptyState);
179
- }
180
- function $514a55f6d91f25ef$var$CenteredWrapper({ children: children }) {
181
- let { state: state } = (0, $e57ab98cef2f01a5$exports.useCardViewContext)();
182
- return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement("div", {
183
- role: "row",
184
- "aria-rowindex": state.collection.size + 1,
185
- className: (0, $kFdxB$reactspectrumutils.classNames)((0, ($parcel$interopDefault($71570f0038472fa2$exports))), 'spectrum-CardView-centeredWrapper')
186
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement("div", {
187
- role: "gridcell"
188
- }, children));
189
- }
190
- function $514a55f6d91f25ef$var$InternalCard(props) {
191
- let { item: item } = props;
192
- let cellNode = [
193
- ...item.childNodes
194
- ][0];
195
- let { state: state, cardOrientation: cardOrientation, isQuiet: isQuiet, layout: layout } = (0, $e57ab98cef2f01a5$exports.useCardViewContext)();
196
- let layoutType = layout.layoutType;
197
- let rowRef = (0, $kFdxB$react.useRef)(undefined);
198
- let cellRef = (0, $kFdxB$react.useRef)(undefined);
199
- let unwrappedRef = (0, $kFdxB$reactspectrumutils.useUnwrapDOMRef)(cellRef);
200
- let { rowProps: gridRowProps } = (0, $kFdxB$reactariagrid.useGridRow)({
201
- node: item,
202
- isVirtualized: true
203
- }, state, rowRef);
204
- let { gridCellProps: gridCellProps } = (0, $kFdxB$reactariagrid.useGridCell)({
205
- node: cellNode,
206
- focusMode: 'cell'
207
- }, state, unwrappedRef);
208
- // Prevent space key from scrolling the CardView if triggered on a disabled item or on a Card in a selectionMode="none" CardView.
209
- let allowsInteraction = state.selectionManager.selectionMode !== 'none';
210
- let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
211
- let onKeyDown = (e)=>{
212
- if (e.key === ' ' && isDisabled) e.preventDefault();
213
- };
214
- let rowProps = (0, $kFdxB$reactariautils.mergeProps)(gridRowProps, {
215
- onKeyDown: onKeyDown
216
- });
217
- if (layoutType === 'grid' || layoutType === 'gallery') isQuiet = true;
218
- if (layoutType !== 'grid') cardOrientation = 'vertical';
219
- // We don't want to focus the checkbox (or any other focusable elements) within the Card
220
- // when pressing the arrow keys so we delete the key down handler here. Arrow key navigation between
221
- // the cards in the CardView is handled by useGrid => useSelectableCollection instead.
222
- delete gridCellProps.onKeyDownCapture;
223
- return /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement("div", {
224
- ...rowProps,
225
- ref: rowRef,
226
- className: (0, $kFdxB$reactspectrumutils.classNames)((0, ($parcel$interopDefault($71570f0038472fa2$exports))), 'spectrum-CardView-row')
227
- }, /*#__PURE__*/ (0, ($parcel$interopDefault($kFdxB$react))).createElement((0, $7888205ff7de382f$exports.CardBase), {
228
- ref: cellRef,
229
- articleProps: gridCellProps,
230
- isQuiet: isQuiet,
231
- orientation: cardOrientation,
232
- item: item,
233
- layout: layoutType
234
- }, item.rendered));
235
- }
236
-
237
-
238
- //# sourceMappingURL=CardView.main.js.map
@@ -1 +0,0 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAwBM,MAAM,0DAAW,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,SAA2B,KAA+B,EAAE,GAA2B;IACvI,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,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oCAAW,EAAE;IAEhC,IAAI,iBAAiB,CAAA,GAAA,oBAAM,EAAE,IAAM,IAAI,CAAA,GAAA,sCAAa,EAAK;YACvD,aAAa;YACb,OAAO;mBAAI;aAAW,CAAC,GAAG,CAAC,CAAA,OAAS,CAAA;oBAClC,i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AA,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","sources":["packages/@react-spectrum/card/src/CardView.tsx"],"sourcesContent":["// @ts-nocheck\n/*\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\n/**\n * TODO: Add description of component here.\n */\nexport const CardView = React.forwardRef(function 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}) as <T>(props: SpectrumCardViewProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\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"],"names":[],"version":3,"file":"CardView.main.js.map"}
package/dist/CardView.mjs DELETED
@@ -1,233 +0,0 @@
1
- import {CardBase as $643dd8fa80926f94$export$7a6ccaf429ad93a8} from "./CardBase.mjs";
2
- import {CardViewContext as $8d180a244893de14$export$64992ac69f286e5c, useCardViewContext as $8d180a244893de14$export$fea0b38586ec8f13} from "./CardViewContext.mjs";
3
- import $iOsT7$intlStringsmodulejs from "./intlStrings.mjs";
4
- import "./card.4d5d6544.css";
5
- import $iOsT7$card_vars_cssmodulejs from "./card_vars_css.mjs";
6
- import {useStyleProps as $iOsT7$useStyleProps, useDOMRef as $iOsT7$useDOMRef, classNames as $iOsT7$classNames, useUnwrapDOMRef as $iOsT7$useUnwrapDOMRef} from "@react-spectrum/utils";
7
- import {GridCollection as $iOsT7$GridCollection, useGridState as $iOsT7$useGridState} from "@react-stately/grid";
8
- import {mergeProps as $iOsT7$mergeProps} from "@react-aria/utils";
9
- import {ProgressCircle as $iOsT7$ProgressCircle} from "@react-spectrum/progress";
10
- import $iOsT7$react, {useMemo as $iOsT7$useMemo, useCallback as $iOsT7$useCallback, useRef as $iOsT7$useRef} from "react";
11
- import {useCollator as $iOsT7$useCollator, useLocale as $iOsT7$useLocale, useLocalizedStringFormatter as $iOsT7$useLocalizedStringFormatter} from "@react-aria/i18n";
12
- import {useGrid as $iOsT7$useGrid, useGridRow as $iOsT7$useGridRow, useGridCell as $iOsT7$useGridCell} from "@react-aria/grid";
13
- import {useListState as $iOsT7$useListState} from "@react-stately/list";
14
- import {useProvider as $iOsT7$useProvider} from "@react-spectrum/provider";
15
- import {VirtualizerItem as $iOsT7$VirtualizerItem, Virtualizer as $iOsT7$Virtualizer} from "@react-aria/virtualizer";
16
-
17
-
18
- function $parcel$interopDefault(a) {
19
- return a && a.__esModule ? a.default : a;
20
- }
21
- // @ts-nocheck
22
- /*
23
- * Copyright 2021 Adobe. All rights reserved.
24
- * This file is licensed to you under the Apache License, Version 2.0 (the "License");
25
- * you may not use this file except in compliance with the License. You may obtain a copy
26
- * of the License at http://www.apache.org/licenses/LICENSE-2.0
27
- *
28
- * Unless required by applicable law or agreed to in writing, software distributed under
29
- * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
30
- * OF ANY KIND, either express or implied. See the License for the specific language
31
- * governing permissions and limitations under the License.
32
- */
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
- const $81a52da995c19652$export$7e52c821f7b6f422 = /*#__PURE__*/ (0, $iOsT7$react).forwardRef(function CardView(props, ref) {
47
- let { scale: scale } = (0, $iOsT7$useProvider)();
48
- let { styleProps: styleProps } = (0, $iOsT7$useStyleProps)(props);
49
- let domRef = (0, $iOsT7$useDOMRef)(ref);
50
- let { isQuiet: isQuiet, renderEmptyState: renderEmptyState, layout: layout, loadingState: loadingState, onLoadMore: onLoadMore, cardOrientation: cardOrientation = 'vertical' } = props;
51
- let collator = (0, $iOsT7$useCollator)({
52
- usage: 'search',
53
- sensitivity: 'base'
54
- });
55
- let isLoading = loadingState === 'loading' || loadingState === 'loadingMore';
56
- let cardViewLayout = (0, $iOsT7$useMemo)(()=>typeof layout === 'function' ? new layout({
57
- collator: collator,
58
- cardOrientation: cardOrientation,
59
- scale: scale
60
- }) : layout, [
61
- layout,
62
- collator,
63
- cardOrientation,
64
- scale
65
- ]);
66
- let layoutType = cardViewLayout.layoutType;
67
- let { direction: direction } = (0, $iOsT7$useLocale)();
68
- let { collection: collection } = (0, $iOsT7$useListState)(props);
69
- let gridCollection = (0, $iOsT7$useMemo)(()=>new (0, $iOsT7$GridCollection)({
70
- columnCount: 1,
71
- items: [
72
- ...collection
73
- ].map((item)=>({
74
- // Makes the Grid row use the keys the user provides to the cards so that selection change via interactions returns the card keys
75
- ...item,
76
- hasChildNodes: true,
77
- childNodes: [
78
- {
79
- key: `cell-${item.key}`,
80
- type: 'cell',
81
- value: null,
82
- level: 0,
83
- rendered: null,
84
- textValue: item.textValue,
85
- hasChildNodes: false,
86
- childNodes: []
87
- }
88
- ]
89
- }))
90
- }), [
91
- collection
92
- ]);
93
- let state = (0, $iOsT7$useGridState)({
94
- ...props,
95
- selectionMode: cardOrientation === 'horizontal' && layoutType === 'grid' ? 'none' : props.selectionMode,
96
- collection: gridCollection,
97
- focusMode: 'cell'
98
- });
99
- cardViewLayout.collection = gridCollection;
100
- cardViewLayout.disabledKeys = state.disabledKeys;
101
- let { gridProps: gridProps } = (0, $iOsT7$useGrid)({
102
- ...props,
103
- isVirtualized: true,
104
- keyboardDelegate: cardViewLayout
105
- }, state, domRef);
106
- let renderWrapper = (0, $iOsT7$useCallback)((parent, reusableView)=>/*#__PURE__*/ (0, $iOsT7$react).createElement((0, $iOsT7$VirtualizerItem), {
107
- key: reusableView.key,
108
- layoutInfo: reusableView.layoutInfo,
109
- virtualizer: reusableView.virtualizer,
110
- parent: parent === null || parent === void 0 ? void 0 : parent.layoutInfo
111
- }, reusableView.rendered), []);
112
- let focusedKey = state.selectionManager.focusedKey;
113
- let focusedItem = gridCollection.getItem(state.selectionManager.focusedKey);
114
- if ((focusedItem === null || focusedItem === void 0 ? void 0 : focusedItem.parentKey) != null) focusedKey = focusedItem.parentKey;
115
- let persistedKeys = (0, $iOsT7$useMemo)(()=>focusedKey != null ? new Set([
116
- focusedKey
117
- ]) : null, [
118
- focusedKey
119
- ]);
120
- // TODO: does aria-row count and aria-col count need to be modified? Perhaps aria-col count needs to be omitted
121
- return /*#__PURE__*/ (0, $iOsT7$react).createElement((0, $8d180a244893de14$export$64992ac69f286e5c).Provider, {
122
- value: {
123
- state: state,
124
- isQuiet: isQuiet,
125
- layout: cardViewLayout,
126
- cardOrientation: cardOrientation,
127
- renderEmptyState: renderEmptyState
128
- }
129
- }, /*#__PURE__*/ (0, $iOsT7$react).createElement((0, $iOsT7$Virtualizer), {
130
- ...gridProps,
131
- ...styleProps,
132
- className: (0, $iOsT7$classNames)((0, ($parcel$interopDefault($iOsT7$card_vars_cssmodulejs))), 'spectrum-CardView'),
133
- ref: domRef,
134
- persistedKeys: persistedKeys,
135
- scrollDirection: "vertical",
136
- layout: cardViewLayout,
137
- collection: gridCollection,
138
- isLoading: isLoading,
139
- onLoadMore: onLoadMore,
140
- layoutOptions: (0, $iOsT7$useMemo)(()=>({
141
- isLoading: isLoading,
142
- direction: direction
143
- }), [
144
- isLoading,
145
- direction
146
- ]),
147
- renderWrapper: renderWrapper,
148
- style: {
149
- ...styleProps.style,
150
- scrollPaddingTop: cardViewLayout.margin || 0
151
- }
152
- }, (0, $iOsT7$useCallback)((type, item)=>{
153
- if (type === 'item') return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$InternalCard, {
154
- item: item
155
- });
156
- else if (type === 'loader') return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$LoadingState, null);
157
- else if (type === 'placeholder') return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$EmptyState, null);
158
- }, [])));
159
- });
160
- function $81a52da995c19652$var$LoadingState() {
161
- let { state: state } = (0, $8d180a244893de14$export$fea0b38586ec8f13)();
162
- let stringFormatter = (0, $iOsT7$useLocalizedStringFormatter)((0, ($parcel$interopDefault($iOsT7$intlStringsmodulejs))), '@react-spectrum/card');
163
- return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$CenteredWrapper, null, /*#__PURE__*/ (0, $iOsT7$react).createElement((0, $iOsT7$ProgressCircle), {
164
- isIndeterminate: true,
165
- "aria-label": state.collection.size > 0 ? stringFormatter.format('loadingMore') : stringFormatter.format('loading')
166
- }));
167
- }
168
- function $81a52da995c19652$var$EmptyState() {
169
- let { renderEmptyState: renderEmptyState } = (0, $8d180a244893de14$export$fea0b38586ec8f13)();
170
- let emptyState = renderEmptyState ? renderEmptyState() : null;
171
- if (emptyState == null) return null;
172
- return /*#__PURE__*/ (0, $iOsT7$react).createElement($81a52da995c19652$var$CenteredWrapper, null, emptyState);
173
- }
174
- function $81a52da995c19652$var$CenteredWrapper({ children: children }) {
175
- let { state: state } = (0, $8d180a244893de14$export$fea0b38586ec8f13)();
176
- return /*#__PURE__*/ (0, $iOsT7$react).createElement("div", {
177
- role: "row",
178
- "aria-rowindex": state.collection.size + 1,
179
- className: (0, $iOsT7$classNames)((0, ($parcel$interopDefault($iOsT7$card_vars_cssmodulejs))), 'spectrum-CardView-centeredWrapper')
180
- }, /*#__PURE__*/ (0, $iOsT7$react).createElement("div", {
181
- role: "gridcell"
182
- }, children));
183
- }
184
- function $81a52da995c19652$var$InternalCard(props) {
185
- let { item: item } = props;
186
- let cellNode = [
187
- ...item.childNodes
188
- ][0];
189
- let { state: state, cardOrientation: cardOrientation, isQuiet: isQuiet, layout: layout } = (0, $8d180a244893de14$export$fea0b38586ec8f13)();
190
- let layoutType = layout.layoutType;
191
- let rowRef = (0, $iOsT7$useRef)(undefined);
192
- let cellRef = (0, $iOsT7$useRef)(undefined);
193
- let unwrappedRef = (0, $iOsT7$useUnwrapDOMRef)(cellRef);
194
- let { rowProps: gridRowProps } = (0, $iOsT7$useGridRow)({
195
- node: item,
196
- isVirtualized: true
197
- }, state, rowRef);
198
- let { gridCellProps: gridCellProps } = (0, $iOsT7$useGridCell)({
199
- node: cellNode,
200
- focusMode: 'cell'
201
- }, state, unwrappedRef);
202
- // Prevent space key from scrolling the CardView if triggered on a disabled item or on a Card in a selectionMode="none" CardView.
203
- let allowsInteraction = state.selectionManager.selectionMode !== 'none';
204
- let isDisabled = !allowsInteraction || state.disabledKeys.has(item.key);
205
- let onKeyDown = (e)=>{
206
- if (e.key === ' ' && isDisabled) e.preventDefault();
207
- };
208
- let rowProps = (0, $iOsT7$mergeProps)(gridRowProps, {
209
- onKeyDown: onKeyDown
210
- });
211
- if (layoutType === 'grid' || layoutType === 'gallery') isQuiet = true;
212
- if (layoutType !== 'grid') cardOrientation = 'vertical';
213
- // We don't want to focus the checkbox (or any other focusable elements) within the Card
214
- // when pressing the arrow keys so we delete the key down handler here. Arrow key navigation between
215
- // the cards in the CardView is handled by useGrid => useSelectableCollection instead.
216
- delete gridCellProps.onKeyDownCapture;
217
- return /*#__PURE__*/ (0, $iOsT7$react).createElement("div", {
218
- ...rowProps,
219
- ref: rowRef,
220
- className: (0, $iOsT7$classNames)((0, ($parcel$interopDefault($iOsT7$card_vars_cssmodulejs))), 'spectrum-CardView-row')
221
- }, /*#__PURE__*/ (0, $iOsT7$react).createElement((0, $643dd8fa80926f94$export$7a6ccaf429ad93a8), {
222
- ref: cellRef,
223
- articleProps: gridCellProps,
224
- isQuiet: isQuiet,
225
- orientation: cardOrientation,
226
- item: item,
227
- layout: layoutType
228
- }, item.rendered));
229
- }
230
-
231
-
232
- export {$81a52da995c19652$export$7e52c821f7b6f422 as CardView};
233
- //# sourceMappingURL=CardView.module.js.map