From 8d2b60766b357e7df7c18d4f334b1fd4ea299faa Mon Sep 17 00:00:00 2001 From: Adam Hooper Date: Mon, 23 Aug 2021 14:21:24 -0400 Subject: [PATCH 1/9] Restore -); +type AriaRole = ( + 'checkbox' | 'link' | 'menuitem' | 'menuitemcheckbox' | 'menuitemradio' | 'option' | 'radio' | 'switch' | 'tab' +) -Button.propTypes = { +const Button = ( props: { /** * Forwarded to the button element as `aria-checked`. Only use when * `props.role` is one of `checkbox`, `menuitemcheckbox`, * `menuitemradiobutton`, `radiobutton`, or `switch`. */ - ariaChecked: PropTypes.bool, + ariaChecked?: boolean, /** * Forwarded to the button element as `aria-described-by`. */ - ariaDescribedBy: PropTypes.string, + ariaDescribedBy?: string, /** * Child nodes to be rendered as the label for the button. Maps to * the button element’s innerHTML. */ - children: PropTypes.node.isRequired, + children: React.ReactNode, /** * Whether the button is interactive. Forwarded to the button * element. */ - disabled: PropTypes.bool.isRequired, + disabled?: boolean, /** * Same visual state as `props.disabled`, but without affecting * interactivity. Use this when you want to indicate that a form's * contents are invalid, but still submissible. */ - inactive: PropTypes.bool.isRequired, + inactive?: boolean, /** * Whether the button should be purely textual, e.g. for use in a * paragraph of text. */ - inline: PropTypes.bool.isRequired, + inline?: boolean, /** * Visually replaces `props.children` with the Spinner component. Use * when waiting for an action to complete in response to a user * engaging the button. */ - loading: PropTypes.bool.isRequired, + loading?: boolean, /** * For binding Google AMP interactivity. See * https://amp.dev/documentation/examples/components/amp-bind/ */ - on: PropTypes.string, + on?: string, /** * Function to run when the button is engaged. Forwarded to the button * element. */ - onClick: PropTypes.func.isRequired, + onClick: React.UIEventHandler, /** * The WAI-ARIA element role. It is always preferable to use the * approporiate HTML element over the role attribute, e.g. * `` is preferred to ` + ); }; export { ButtonLabel }; diff --git a/src/components/Button/buttonElementWithAmp.d.ts b/src/components/Button/buttonElementWithAmp.d.ts new file mode 100644 index 00000000..4084a5bf --- /dev/null +++ b/src/components/Button/buttonElementWithAmp.d.ts @@ -0,0 +1,9 @@ +import 'react'; + +// Allow