{"version":3,"file":"useSectioningWrapper.cjs","sources":["../../../src/components/SectioningContent/useSectioningWrapper.ts"],"sourcesContent":["import { type ComponentType, useMemo } from 'react'\nimport { isStyledComponent } from 'styled-components'\n\nimport { SectioningFragment } from './SectioningContent'\n\ntype AsType = string | ComponentType<any>\n\nconst SECTIONING_CONTENTS_REGEX = /^(article|aside|nav|section)$/\n\nconst isSectioningContent = (as: AsType) => {\n  const type_ = isStyledComponent(as) ? as.target : as\n\n  return typeof type_ === 'string' && SECTIONING_CONTENTS_REGEX.test(type_)\n}\n\n/** NOTE: Layout コンポーネントに変更がある場合、必ず [smarthr/a11y-heading-in-sectioning-content](https://github.com/kufu/eslint-plugin-smarthr/tree/main/rules/a11y-heading-in-sectioning-content) を見直すこと\n */\nexport const useSectionWrapper = (as: AsType) =>\n  useMemo(() => (isSectioningContent(as) ? SectioningFragment : null), [as])\n"],"names":["isStyledComponent","useMemo","SectioningFragment"],"mappings":";;;;;;AAOA,MAAM,yBAAyB,GAAG,+BAA+B;AAEjE,MAAM,mBAAmB,GAAG,CAAC,EAAU,KAAI;AACzC,IAAA,MAAM,KAAK,GAAGA,kCAAiB,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,GAAG,EAAE;IAEpD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC;AAC3E,CAAC;AAED;AACG;AACI,MAAM,iBAAiB,GAAG,CAAC,EAAU,KAC1CC,aAAO,CAAC,OAAO,mBAAmB,CAAC,EAAE,CAAC,GAAGC,iEAAkB,GAAG,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;;;;"}