UNPKG

react-aria

Version:
1 lines 1.93 kB
{"mappings":"AAAA;;;;;;;;;;CAUC,GAKM,MAAM,4CAAkD,IAAI;AAK5D,SAAS,0CACd,KAA6B,EAC7B,GAA2B,EAC3B,IAAY;IAEZ,IAAI,CAAC,OACH,kFAAkF;IAClF,OAAO;IAET,IAAI,OAAO,QAAQ,UACjB,MAAM,IAAI,OAAO,CAAC,QAAQ;IAG5B,IAAI,SAAS,0CAAQ,GAAG,CAAC;IACzB,IAAI,QAAQ,GAAG,CAAC,QAAQ,KAAK,gBAAgB,CAAC,QAC5C,QAAQ,KAAK,CACX;IAGJ,OAAO,GAAG,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,KAAK;AACnC","sources":["packages/react-aria/src/tabs/utils.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 {Key} from '@react-types/shared';\nimport {TabListState} from 'react-stately/useTabListState';\n\nexport const tabsIds: WeakMap<TabListState<unknown>, string> = new WeakMap<\n TabListState<unknown>,\n string\n>();\n\nexport function generateId<T>(\n state: TabListState<T> | null,\n key: Key | null | undefined,\n role: string\n): string {\n if (!state) {\n // this case should only happen in the first render before the tabs are registered\n return '';\n }\n if (typeof key === 'string') {\n key = key.replace(/\\s+/g, '');\n }\n\n let baseId = tabsIds.get(state);\n if (process.env.NODE_ENV !== 'production' && !baseId) {\n console.error(\n 'There is no tab id, please check if you have rendered the tab panel before the tab list.'\n );\n }\n return `${baseId}-${role}-${key}`;\n}\n"],"names":[],"version":3,"file":"utils.mjs.map"}