@react-spectrum/card 3.0.0-alpha.4 → 3.0.0-alpha.40

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/BaseLayout.main.js +213 -0
  2. package/dist/BaseLayout.main.js.map +1 -0
  3. package/dist/BaseLayout.mjs +208 -0
  4. package/dist/BaseLayout.module.js +208 -0
  5. package/dist/BaseLayout.module.js.map +1 -0
  6. package/dist/Card.main.js +52 -0
  7. package/dist/Card.main.js.map +1 -0
  8. package/dist/Card.mjs +43 -0
  9. package/dist/Card.module.js +43 -0
  10. package/dist/Card.module.js.map +1 -0
  11. package/dist/CardBase.main.js +203 -0
  12. package/dist/CardBase.main.js.map +1 -0
  13. package/dist/CardBase.mjs +198 -0
  14. package/dist/CardBase.module.js +198 -0
  15. package/dist/CardBase.module.js.map +1 -0
  16. package/dist/CardView.main.js +238 -0
  17. package/dist/CardView.main.js.map +1 -0
  18. package/dist/CardView.mjs +233 -0
  19. package/dist/CardView.module.js +233 -0
  20. package/dist/CardView.module.js.map +1 -0
  21. package/dist/CardViewContext.main.js +32 -0
  22. package/dist/CardViewContext.main.js.map +1 -0
  23. package/dist/CardViewContext.mjs +22 -0
  24. package/dist/CardViewContext.module.js +22 -0
  25. package/dist/CardViewContext.module.js.map +1 -0
  26. package/dist/GalleryLayout.main.js +230 -0
  27. package/dist/GalleryLayout.main.js.map +1 -0
  28. package/dist/GalleryLayout.mjs +225 -0
  29. package/dist/GalleryLayout.module.js +225 -0
  30. package/dist/GalleryLayout.module.js.map +1 -0
  31. package/dist/GridLayout.main.js +175 -0
  32. package/dist/GridLayout.main.js.map +1 -0
  33. package/dist/GridLayout.mjs +170 -0
  34. package/dist/GridLayout.module.js +170 -0
  35. package/dist/GridLayout.module.js.map +1 -0
  36. package/dist/WaterfallLayout.main.js +182 -0
  37. package/dist/WaterfallLayout.main.js.map +1 -0
  38. package/dist/WaterfallLayout.mjs +177 -0
  39. package/dist/WaterfallLayout.module.js +177 -0
  40. package/dist/WaterfallLayout.module.js.map +1 -0
  41. package/dist/ar-AE.main.js +7 -0
  42. package/dist/ar-AE.main.js.map +1 -0
  43. package/dist/ar-AE.mjs +9 -0
  44. package/dist/ar-AE.module.js +9 -0
  45. package/dist/ar-AE.module.js.map +1 -0
  46. package/dist/bg-BG.main.js +7 -0
  47. package/dist/bg-BG.main.js.map +1 -0
  48. package/dist/bg-BG.mjs +9 -0
  49. package/dist/bg-BG.module.js +9 -0
  50. package/dist/bg-BG.module.js.map +1 -0
  51. package/dist/card_vars_css.main.js +116 -0
  52. package/dist/card_vars_css.main.js.map +1 -0
  53. package/dist/card_vars_css.mjs +118 -0
  54. package/dist/card_vars_css.module.js +118 -0
  55. package/dist/card_vars_css.module.js.map +1 -0
  56. package/dist/cs-CZ.main.js +7 -0
  57. package/dist/cs-CZ.main.js.map +1 -0
  58. package/dist/cs-CZ.mjs +9 -0
  59. package/dist/cs-CZ.module.js +9 -0
  60. package/dist/cs-CZ.module.js.map +1 -0
  61. package/dist/da-DK.main.js +7 -0
  62. package/dist/da-DK.main.js.map +1 -0
  63. package/dist/da-DK.mjs +9 -0
  64. package/dist/da-DK.module.js +9 -0
  65. package/dist/da-DK.module.js.map +1 -0
  66. package/dist/de-DE.main.js +7 -0
  67. package/dist/de-DE.main.js.map +1 -0
  68. package/dist/de-DE.mjs +9 -0
  69. package/dist/de-DE.module.js +9 -0
  70. package/dist/de-DE.module.js.map +1 -0
  71. package/dist/el-GR.main.js +7 -0
  72. package/dist/el-GR.main.js.map +1 -0
  73. package/dist/el-GR.mjs +9 -0
  74. package/dist/el-GR.module.js +9 -0
  75. package/dist/el-GR.module.js.map +1 -0
  76. package/dist/en-US.main.js +7 -0
  77. package/dist/en-US.main.js.map +1 -0
  78. package/dist/en-US.mjs +9 -0
  79. package/dist/en-US.module.js +9 -0
  80. package/dist/en-US.module.js.map +1 -0
  81. package/dist/es-ES.main.js +7 -0
  82. package/dist/es-ES.main.js.map +1 -0
  83. package/dist/es-ES.mjs +9 -0
  84. package/dist/es-ES.module.js +9 -0
  85. package/dist/es-ES.module.js.map +1 -0
  86. package/dist/et-EE.main.js +7 -0
  87. package/dist/et-EE.main.js.map +1 -0
  88. package/dist/et-EE.mjs +9 -0
  89. package/dist/et-EE.module.js +9 -0
  90. package/dist/et-EE.module.js.map +1 -0
  91. package/dist/fi-FI.main.js +7 -0
  92. package/dist/fi-FI.main.js.map +1 -0
  93. package/dist/fi-FI.mjs +9 -0
  94. package/dist/fi-FI.module.js +9 -0
  95. package/dist/fi-FI.module.js.map +1 -0
  96. package/dist/fr-FR.main.js +7 -0
  97. package/dist/fr-FR.main.js.map +1 -0
  98. package/dist/fr-FR.mjs +9 -0
  99. package/dist/fr-FR.module.js +9 -0
  100. package/dist/fr-FR.module.js.map +1 -0
  101. package/dist/he-IL.main.js +7 -0
  102. package/dist/he-IL.main.js.map +1 -0
  103. package/dist/he-IL.mjs +9 -0
  104. package/dist/he-IL.module.js +9 -0
  105. package/dist/he-IL.module.js.map +1 -0
  106. package/dist/hr-HR.main.js +7 -0
  107. package/dist/hr-HR.main.js.map +1 -0
  108. package/dist/hr-HR.mjs +9 -0
  109. package/dist/hr-HR.module.js +9 -0
  110. package/dist/hr-HR.module.js.map +1 -0
  111. package/dist/hu-HU.main.js +7 -0
  112. package/dist/hu-HU.main.js.map +1 -0
  113. package/dist/hu-HU.mjs +9 -0
  114. package/dist/hu-HU.module.js +9 -0
  115. package/dist/hu-HU.module.js.map +1 -0
  116. package/dist/import.mjs +26 -0
  117. package/dist/intlStrings.main.js +108 -0
  118. package/dist/intlStrings.main.js.map +1 -0
  119. package/dist/intlStrings.mjs +110 -0
  120. package/dist/intlStrings.module.js +110 -0
  121. package/dist/intlStrings.module.js.map +1 -0
  122. package/dist/it-IT.main.js +7 -0
  123. package/dist/it-IT.main.js.map +1 -0
  124. package/dist/it-IT.mjs +9 -0
  125. package/dist/it-IT.module.js +9 -0
  126. package/dist/it-IT.module.js.map +1 -0
  127. package/dist/ja-JP.main.js +7 -0
  128. package/dist/ja-JP.main.js.map +1 -0
  129. package/dist/ja-JP.mjs +9 -0
  130. package/dist/ja-JP.module.js +9 -0
  131. package/dist/ja-JP.module.js.map +1 -0
  132. package/dist/ko-KR.main.js +7 -0
  133. package/dist/ko-KR.main.js.map +1 -0
  134. package/dist/ko-KR.mjs +9 -0
  135. package/dist/ko-KR.module.js +9 -0
  136. package/dist/ko-KR.module.js.map +1 -0
  137. package/dist/lt-LT.main.js +7 -0
  138. package/dist/lt-LT.main.js.map +1 -0
  139. package/dist/lt-LT.mjs +9 -0
  140. package/dist/lt-LT.module.js +9 -0
  141. package/dist/lt-LT.module.js.map +1 -0
  142. package/dist/lv-LV.main.js +7 -0
  143. package/dist/lv-LV.main.js.map +1 -0
  144. package/dist/lv-LV.mjs +9 -0
  145. package/dist/lv-LV.module.js +9 -0
  146. package/dist/lv-LV.module.js.map +1 -0
  147. package/dist/main.js +21 -1447
  148. package/dist/main.js.map +1 -1
  149. package/dist/module.js +17 -1432
  150. package/dist/module.js.map +1 -1
  151. package/dist/nb-NO.main.js +7 -0
  152. package/dist/nb-NO.main.js.map +1 -0
  153. package/dist/nb-NO.mjs +9 -0
  154. package/dist/nb-NO.module.js +9 -0
  155. package/dist/nb-NO.module.js.map +1 -0
  156. package/dist/nl-NL.main.js +7 -0
  157. package/dist/nl-NL.main.js.map +1 -0
  158. package/dist/nl-NL.mjs +9 -0
  159. package/dist/nl-NL.module.js +9 -0
  160. package/dist/nl-NL.module.js.map +1 -0
  161. package/dist/pl-PL.main.js +7 -0
  162. package/dist/pl-PL.main.js.map +1 -0
  163. package/dist/pl-PL.mjs +9 -0
  164. package/dist/pl-PL.module.js +9 -0
  165. package/dist/pl-PL.module.js.map +1 -0
  166. package/dist/pt-BR.main.js +7 -0
  167. package/dist/pt-BR.main.js.map +1 -0
  168. package/dist/pt-BR.mjs +9 -0
  169. package/dist/pt-BR.module.js +9 -0
  170. package/dist/pt-BR.module.js.map +1 -0
  171. package/dist/pt-PT.main.js +7 -0
  172. package/dist/pt-PT.main.js.map +1 -0
  173. package/dist/pt-PT.mjs +9 -0
  174. package/dist/pt-PT.module.js +9 -0
  175. package/dist/pt-PT.module.js.map +1 -0
  176. package/dist/ro-RO.main.js +7 -0
  177. package/dist/ro-RO.main.js.map +1 -0
  178. package/dist/ro-RO.mjs +9 -0
  179. package/dist/ro-RO.module.js +9 -0
  180. package/dist/ro-RO.module.js.map +1 -0
  181. package/dist/ru-RU.main.js +7 -0
  182. package/dist/ru-RU.main.js.map +1 -0
  183. package/dist/ru-RU.mjs +9 -0
  184. package/dist/ru-RU.module.js +9 -0
  185. package/dist/ru-RU.module.js.map +1 -0
  186. package/dist/sk-SK.main.js +7 -0
  187. package/dist/sk-SK.main.js.map +1 -0
  188. package/dist/sk-SK.mjs +9 -0
  189. package/dist/sk-SK.module.js +9 -0
  190. package/dist/sk-SK.module.js.map +1 -0
  191. package/dist/sl-SI.main.js +7 -0
  192. package/dist/sl-SI.main.js.map +1 -0
  193. package/dist/sl-SI.mjs +9 -0
  194. package/dist/sl-SI.module.js +9 -0
  195. package/dist/sl-SI.module.js.map +1 -0
  196. package/dist/sr-SP.main.js +7 -0
  197. package/dist/sr-SP.main.js.map +1 -0
  198. package/dist/sr-SP.mjs +9 -0
  199. package/dist/sr-SP.module.js +9 -0
  200. package/dist/sr-SP.module.js.map +1 -0
  201. package/dist/sv-SE.main.js +7 -0
  202. package/dist/sv-SE.main.js.map +1 -0
  203. package/dist/sv-SE.mjs +9 -0
  204. package/dist/sv-SE.module.js +9 -0
  205. package/dist/sv-SE.module.js.map +1 -0
  206. package/dist/tr-TR.main.js +7 -0
  207. package/dist/tr-TR.main.js.map +1 -0
  208. package/dist/tr-TR.mjs +9 -0
  209. package/dist/tr-TR.module.js +9 -0
  210. package/dist/tr-TR.module.js.map +1 -0
  211. package/dist/types.d.ts +38 -36
  212. package/dist/types.d.ts.map +1 -1
  213. package/dist/uk-UA.main.js +7 -0
  214. package/dist/uk-UA.main.js.map +1 -0
  215. package/dist/uk-UA.mjs +9 -0
  216. package/dist/uk-UA.module.js +9 -0
  217. package/dist/uk-UA.module.js.map +1 -0
  218. package/dist/vars.02438011.css +1671 -0
  219. package/dist/vars.02438011.css.map +1 -0
  220. package/dist/zh-CN.main.js +7 -0
  221. package/dist/zh-CN.main.js.map +1 -0
  222. package/dist/zh-CN.mjs +9 -0
  223. package/dist/zh-CN.module.js +9 -0
  224. package/dist/zh-CN.module.js.map +1 -0
  225. package/dist/zh-TW.main.js +7 -0
  226. package/dist/zh-TW.main.js.map +1 -0
  227. package/dist/zh-TW.mjs +9 -0
  228. package/dist/zh-TW.module.js +9 -0
  229. package/dist/zh-TW.module.js.map +1 -0
  230. package/package.json +26 -23
  231. package/src/BaseLayout.tsx +36 -32
  232. package/src/Card.tsx +1 -0
  233. package/src/CardBase.tsx +9 -11
  234. package/src/CardView.tsx +71 -51
  235. package/src/CardViewContext.tsx +1 -0
  236. package/src/GalleryLayout.tsx +4 -2
  237. package/src/GridLayout.tsx +7 -39
  238. package/src/WaterfallLayout.tsx +8 -5
  239. package/src/index.ts +10 -5
  240. package/dist/main.css +0 -1
@@ -0,0 +1 @@
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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,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","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"}
@@ -0,0 +1,233 @@
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 "./vars.02438011.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
@@ -0,0 +1,233 @@
1
+ import {CardBase as $643dd8fa80926f94$export$7a6ccaf429ad93a8} from "./CardBase.module.js";
2
+ import {CardViewContext as $8d180a244893de14$export$64992ac69f286e5c, useCardViewContext as $8d180a244893de14$export$fea0b38586ec8f13} from "./CardViewContext.module.js";
3
+ import $iOsT7$intlStringsmodulejs from "./intlStrings.module.js";
4
+ import "./vars.02438011.css";
5
+ import $iOsT7$card_vars_cssmodulejs from "./card_vars_css.module.js";
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
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,cAAc;AACd;;;;;;;;;;CAUC;;;;;;;;;;;;;;AAwBM,MAAM,0DAAW,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC,SAAS,SAA2B,KAA+B,EAAE,GAA2B;IACvI,IAAI,SAAC,KAAK,EAAC,GAAG,CAAA,GAAA,kBAAU;IACxB,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IACvB,IAAI,WACF,OAAO,oBACP,gBAAgB,UAChB,MAAM,gBACN,YAAY,cACZ,UAAU,mBACV,kBAAkB,YACnB,GAAG;IAEJ,IAAI,WAAW,CAAA,GAAA,kBAAU,EAAE;QAAC,OAAO;QAAU,aAAa;IAAM;IAChE,IAAI,YAAY,iBAAiB,aAAa,iBAAiB;IAC/D,IAAI,iBAAiB,CAAA,GAAA,cAAM,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,G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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,gCAAC;QAAK,GAAG,QAAQ;QAAE,KAAK;QAAQ,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;qBAC5D,gCAAC,CAAA,GAAA,yCAAO;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.module.js.map"}
@@ -0,0 +1,32 @@
1
+ var $g0nMI$react = require("react");
2
+
3
+
4
+ function $parcel$interopDefault(a) {
5
+ return a && a.__esModule ? a.default : a;
6
+ }
7
+
8
+ function $parcel$export(e, n, v, s) {
9
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
10
+ }
11
+
12
+ $parcel$export(module.exports, "CardViewContext", () => $e57ab98cef2f01a5$export$64992ac69f286e5c);
13
+ $parcel$export(module.exports, "useCardViewContext", () => $e57ab98cef2f01a5$export$fea0b38586ec8f13);
14
+ // @ts-nocheck
15
+ /*
16
+ * Copyright 2020 Adobe. All rights reserved.
17
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License. You may obtain a copy
19
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software distributed under
22
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
23
+ * OF ANY KIND, either express or implied. See the License for the specific language
24
+ * governing permissions and limitations under the License.
25
+ */
26
+ const $e57ab98cef2f01a5$export$64992ac69f286e5c = /*#__PURE__*/ (0, ($parcel$interopDefault($g0nMI$react))).createContext(null);
27
+ function $e57ab98cef2f01a5$export$fea0b38586ec8f13() {
28
+ return (0, $g0nMI$react.useContext)($e57ab98cef2f01a5$export$64992ac69f286e5c);
29
+ }
30
+
31
+
32
+ //# sourceMappingURL=CardViewContext.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;AAAA,cAAc;AACd;;;;;;;;;;CAUC;AAIM,MAAM,0DAAkB,CAAA,GAAA,sCAAI,EAAE,aAAa,CAAC;AAE5C,SAAS;IACd,OAAO,CAAA,GAAA,uBAAS,EAAE;AACpB","sources":["packages/@react-spectrum/card/src/CardViewContext.tsx"],"sourcesContent":["// @ts-nocheck\n/*\n * Copyright 2020 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 React, {useContext} from 'react';\n\nexport const CardViewContext = React.createContext(null);\n\nexport function useCardViewContext() {\n return useContext(CardViewContext);\n}\n"],"names":[],"version":3,"file":"CardViewContext.main.js.map"}
@@ -0,0 +1,22 @@
1
+ import $ip66o$react, {useContext as $ip66o$useContext} from "react";
2
+
3
+ // @ts-nocheck
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+ const $8d180a244893de14$export$64992ac69f286e5c = /*#__PURE__*/ (0, $ip66o$react).createContext(null);
16
+ function $8d180a244893de14$export$fea0b38586ec8f13() {
17
+ return (0, $ip66o$useContext)($8d180a244893de14$export$64992ac69f286e5c);
18
+ }
19
+
20
+
21
+ export {$8d180a244893de14$export$64992ac69f286e5c as CardViewContext, $8d180a244893de14$export$fea0b38586ec8f13 as useCardViewContext};
22
+ //# sourceMappingURL=CardViewContext.module.js.map
@@ -0,0 +1,22 @@
1
+ import $ip66o$react, {useContext as $ip66o$useContext} from "react";
2
+
3
+ // @ts-nocheck
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */
15
+ const $8d180a244893de14$export$64992ac69f286e5c = /*#__PURE__*/ (0, $ip66o$react).createContext(null);
16
+ function $8d180a244893de14$export$fea0b38586ec8f13() {
17
+ return (0, $ip66o$useContext)($8d180a244893de14$export$64992ac69f286e5c);
18
+ }
19
+
20
+
21
+ export {$8d180a244893de14$export$64992ac69f286e5c as CardViewContext, $8d180a244893de14$export$fea0b38586ec8f13 as useCardViewContext};
22
+ //# sourceMappingURL=CardViewContext.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAAA,cAAc;AACd;;;;;;;;;;CAUC;AAIM,MAAM,0DAAkB,CAAA,GAAA,YAAI,EAAE,aAAa,CAAC;AAE5C,SAAS;IACd,OAAO,CAAA,GAAA,iBAAS,EAAE;AACpB","sources":["packages/@react-spectrum/card/src/CardViewContext.tsx"],"sourcesContent":["// @ts-nocheck\n/*\n * Copyright 2020 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 React, {useContext} from 'react';\n\nexport const CardViewContext = React.createContext(null);\n\nexport function useCardViewContext() {\n return useContext(CardViewContext);\n}\n"],"names":[],"version":3,"file":"CardViewContext.module.js.map"}