forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
67 changed files
with
1,258 additions
and
669 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ const TEMPLATE = [ | |
{ | ||
text: __( 'Submit' ), | ||
tagName: 'button', | ||
type: 'submit', | ||
}, | ||
], | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
// eslint-disable-next-line no-restricted-imports | ||
import * as Ariakit from '@ariakit/react'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { forwardRef } from '@wordpress/element'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { DisclosureContentProps } from './types'; | ||
import type { WordPressComponentProps } from '../context'; | ||
|
||
/** | ||
* Accessible Disclosure component that controls visibility of a section of | ||
* content. It follows the WAI-ARIA Disclosure Pattern. | ||
*/ | ||
const UnforwardedDisclosureContent = ( | ||
{ | ||
visible, | ||
children, | ||
...props | ||
}: WordPressComponentProps< DisclosureContentProps, 'div', false >, | ||
ref: React.ForwardedRef< any > | ||
) => { | ||
const disclosure = Ariakit.useDisclosureStore( { open: visible } ); | ||
|
||
return ( | ||
<Ariakit.DisclosureContent | ||
store={ disclosure } | ||
ref={ ref } | ||
{ ...props } | ||
> | ||
{ children } | ||
</Ariakit.DisclosureContent> | ||
); | ||
}; | ||
|
||
export const DisclosureContent = forwardRef( UnforwardedDisclosureContent ); | ||
export default DisclosureContent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export type DisclosureContentProps = { | ||
/** | ||
* If set to `true` the content will be shown, otherwise it's hidden. | ||
*/ | ||
visible?: boolean; | ||
/** | ||
* The content to display within the component. | ||
*/ | ||
children: React.ReactNode; | ||
}; |
Oops, something went wrong.