UNPKG

react-aria

Version:
1 lines 2.67 kB
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAiBM,SAAS,0CACd,KAA2B,EAC3B,KAAuB,EACvB,GAAuC;IAEvC,IAAI,EAAC,cAAc,SAAS,EAAC,GAAG;IAChC,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,yCAAgB,EAAE;QAClC,GAAG,KAAK;QACR,GAAG,KAAK;QACR,qBAAqB;aACrB;IACF;IAEA,MAAM,UAAU,CAAA,GAAA,yCAA0B,EAAE,CAAA,GAAA,+CAAW,GAAG;IAC1D,MAAM,gBAA6C;QACjD,GAAG,CAAA,GAAA,yCAAS,EAAE,WAAW,CAAA,GAAA,yCAAa,EAAE,OAAO;YAAC,WAAW;QAAI,GAAG;QAClE,cAAc,aAAa,QAAQ,MAAM,CAAC;IAC5C;IAEA,OAAO;QACL,WAAW;YACT,GAAG,aAAa;YAChB,UAAU;QACZ;IACF;AACF","sources":["packages/react-aria/src/steplist/useStepList.ts"],"sourcesContent":["/*\n * Copyright 2023 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 {AriaLabelingProps, DOMProps, RefObject} from '@react-types/shared';\nimport {filterDOMProps} from '../utils/filterDOMProps';\nimport {HTMLAttributes} from 'react';\nimport intlMessages from '../../intl/steplist/*.json';\nimport {mergeProps} from '../utils/mergeProps';\nimport {StepListProps, StepListState} from 'react-stately/private/steplist/useStepListState';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useSelectableList} from '../selection/useSelectableList';\n\nexport interface AriaStepListProps<T> extends StepListProps<T>, AriaLabelingProps, DOMProps {}\n\nexport interface StepListAria {\n listProps: HTMLAttributes<HTMLElement>;\n}\n\nexport function useStepList<T>(\n props: AriaStepListProps<T>,\n state: StepListState<T>,\n ref: RefObject<HTMLOListElement | null>\n): StepListAria {\n let {'aria-label': ariaLabel} = props;\n let {listProps} = useSelectableList({\n ...props,\n ...state,\n allowsTabNavigation: true,\n ref\n });\n\n const strings = useLocalizedStringFormatter(intlMessages, '@react-aria/steplist');\n const stepListProps: HTMLAttributes<HTMLElement> = {\n ...mergeProps(listProps, filterDOMProps(props, {labelable: true})),\n 'aria-label': ariaLabel || strings.format('steplist')\n };\n\n return {\n listProps: {\n ...stepListProps,\n tabIndex: undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"useStepList.mjs.map"}