{"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;AAqBM,SAAS,0CACd,KAAyC;IAEzC,IAAI,kBAAkB,CAAA,GAAA,qDAA0B,EAAE,CAAA,GAAA,mDAAW,GAAG;IAChE,IAAI,WAAW,CAAA,GAAA,gDAAqB;IACpC,sGAAsG;IACtG,IAAI,kBACF,AAAC,CAAA,aAAa,aAAa,aAAa,aAAa,YAAY,IAAG,KACpE,OAAO,WAAW,eAClB,kBAAkB;IAEpB,IAAI,yBAAyB,CAAA,GAAA,oBAAM,EAAE;QACnC,IAAI,gBAAgB,MAAM,gBAAgB,CAAC,aAAa;QACxD,IAAI,oBAAoB,MAAM,gBAAgB,CAAC,iBAAiB;QAEhE,IAAI;QACJ,IAAI,iBACF,UAAU,gBAAgB,MAAM,CAAC;QAGnC,OAAO,sBAAsB,aAAa,kBAAkB,UAAU,MAAM,cAAc,GACtF,UACA;IACN,GAAG;QACD,MAAM,gBAAgB,CAAC,aAAa;QACpC,MAAM,gBAAgB,CAAC,iBAAiB;QACxC,MAAM,cAAc;QACpB;QACA;KACD;IAED,IAAI,mBAAmB,CAAA,GAAA,wCAAa,EAAE;IACtC,OAAO;AACT","sources":["packages/react-aria/src/grid/useHighlightSelectionDescription.ts"],"sourcesContent":["/*\n * Copyright 2021 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLabelingProps} from '@react-types/shared';\n// @ts-ignore\nimport intlMessages from '../../intl/grid/*.json';\nimport {MultipleSelectionManager} from 'react-stately/useMultipleSelectionState';\nimport {useDescription} from '../utils/useDescription';\nimport {useInteractionModality} from '../interactions/useFocusVisible';\nimport {useLocalizedStringFormatter} from '../i18n/useLocalizedStringFormatter';\nimport {useMemo} from 'react';\n\nexport interface HighlightSelectionDescriptionProps {\n  selectionManager: MultipleSelectionManager;\n  hasItemActions?: boolean;\n}\n\n/**\n * Computes the description for a grid selectable collection.\n *\n * @param props\n */\nexport function useHighlightSelectionDescription(\n  props: HighlightSelectionDescriptionProps\n): AriaLabelingProps {\n  let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/grid');\n  let modality = useInteractionModality();\n  // null is the default if the user hasn't interacted with the table at all yet or the rest of the page\n  let shouldLongPress =\n    (modality === 'pointer' || modality === 'virtual' || modality == null) &&\n    typeof window !== 'undefined' &&\n    'ontouchstart' in window;\n\n  let interactionDescription = useMemo(() => {\n    let selectionMode = props.selectionManager.selectionMode;\n    let selectionBehavior = props.selectionManager.selectionBehavior;\n\n    let message: string | undefined;\n    if (shouldLongPress) {\n      message = stringFormatter.format('longPressToSelect');\n    }\n\n    return selectionBehavior === 'replace' && selectionMode !== 'none' && props.hasItemActions\n      ? message\n      : undefined;\n  }, [\n    props.selectionManager.selectionMode,\n    props.selectionManager.selectionBehavior,\n    props.hasItemActions,\n    stringFormatter,\n    shouldLongPress\n  ]);\n\n  let descriptionProps = useDescription(interactionDescription);\n  return descriptionProps;\n}\n"],"names":[],"version":3,"file":"useHighlightSelectionDescription.cjs.map"}