UNPKG

@wordpress/components

Version:
1 lines • 1.42 kB
{"version":3,"file":"index.cjs","names":["Ariakit","forwardRef"],"sources":["../../src/disclosure/index.tsx"],"sourcesContent":["import * as Ariakit from '@ariakit/react';\nimport { forwardRef } from '@wordpress/element';\nimport type { DisclosureContentProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\n/**\n * Accessible Disclosure component that controls visibility of a section of\n * content. It follows the WAI-ARIA Disclosure Pattern.\n */\nconst UnforwardedDisclosureContent = (\n\t{\n\t\tvisible,\n\t\tchildren,\n\t\t...props\n\t}: WordPressComponentProps< DisclosureContentProps, 'div', false >,\n\tref: React.ForwardedRef< any >\n) => {\n\tconst disclosure = Ariakit.useDisclosureStore( { open: visible } );\n\n\treturn (\n\t\t<Ariakit.DisclosureContent\n\t\t\tstore={ disclosure }\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t</Ariakit.DisclosureContent>\n\t);\n};\n\nexport const DisclosureContent = forwardRef( UnforwardedDisclosureContent );\nDisclosureContent.displayName = 'DisclosureContent';\nexport default DisclosureContent;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,MAAM,gCACL,EACC,SACA,UACA,GAAG,SAEJ,QACI;CACJ,MAAM,aAAaA,eAAQ,mBAAoB,EAAE,MAAM,QAAQ,CAAE;CAEjE,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACA,eAAQ,mBAAT;EACC,OAAQ;EACF;EACN,GAAK;EAEH;CACwB,CAAA;AAE7B;AAEA,MAAa,qBAAA,GAAoBC,mBAAAA,WAAAA,CAAY,4BAA6B;AAC1E,kBAAkB,cAAc"}