react-aria
Version:
Spectrum UI components in React
1 lines • 2.72 kB
Source Map (JSON)
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AA6BM,SAAS,0CACd,KAA+B,EAC/B,6DAA6D;AAC7D,KAAmB,EACnB,6DAA6D;AAC7D,GAAkC;IAElC,IAAI,EAAC,cAAc,SAAS,EAAC,GAAG;IAChC,IAAI,YAAY,CAAA,GAAA,mCAAQ;IACxB,IAAI,aAAa,CAAA,GAAA,mCAAQ,EAAE;QACzB,cAAc;QACd,mBAAmB;IACrB;IAEA,OAAO;QACL,UAAU;YACR,MAAM;QACR;QACA,gBAAgB;YACd,IAAI;YACJ,MAAM;QACR;QACA,eAAe;YACb,MAAM;YACN,GAAG,UAAU;QACf;IACF;AACF","sources":["packages/react-aria/src/gridlist/useGridListSection.ts"],"sourcesContent":["/*\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 {DOMAttributes, RefObject} from '@react-types/shared';\nimport type {ListState} from 'react-stately/useListState';\nimport {useLabels} from '../utils/useLabels';\nimport {useSlotId} from '../utils/useId';\n\nexport interface AriaGridListSectionProps {\n /** An accessibility label for the section. Required if `heading` is not present. */\n 'aria-label'?: string;\n}\n\nexport interface GridListSectionAria {\n /** Props for the wrapper list item. */\n rowProps: DOMAttributes;\n\n /** Props for the heading element, if any. */\n rowHeaderProps: DOMAttributes;\n\n /** Props for the grid's row group element. */\n rowGroupProps: DOMAttributes;\n}\n\n/**\n * Provides the behavior and accessibility implementation for a section in a grid list.\n * See `useGridList` for more details about grid list.\n *\n * @param props - Props for the section.\n */\nexport function useGridListSection<T>(\n props: AriaGridListSectionProps,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n state: ListState<T>,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n ref: RefObject<HTMLElement | null>\n): GridListSectionAria {\n let {'aria-label': ariaLabel} = props;\n let headingId = useSlotId();\n let labelProps = useLabels({\n 'aria-label': ariaLabel,\n 'aria-labelledby': headingId\n });\n\n return {\n rowProps: {\n role: 'row'\n },\n rowHeaderProps: {\n id: headingId,\n role: 'rowheader'\n },\n rowGroupProps: {\n role: 'rowgroup',\n ...labelProps\n }\n };\n}\n"],"names":[],"version":3,"file":"useGridListSection.cjs.map"}