diff --git a/dist/Button/Button.d.ts b/dist/Button/Button.d.ts index 7ef0fe38..13e3b503 100644 --- a/dist/Button/Button.d.ts +++ b/dist/Button/Button.d.ts @@ -1,66 +1,93 @@ +import React from 'react'; +declare type Variant = 'primary' | 'secondary' | 'warning'; +declare const ButtonLabel: { + (props: { + /** + * Child nodes to be rendered as the label for the button. Maps to + * the button element’s innerHTML. + */ + children: React.ReactNode; + /** + * Whether the label should be purely textual, e.g. for use in a + * paragraph of text. + */ + inline?: boolean | undefined; + /** + * Visual variations of the button. + */ + variant?: "primary" | "secondary" | "warning" | undefined; + }): JSX.Element; + defaultProps: { + inline: boolean; + variant: string; + }; +}; +declare type AriaRole = ('checkbox' | 'link' | 'menuitem' | 'menuitemcheckbox' | 'menuitemradio' | 'option' | 'radio' | 'switch' | 'tab'); +declare 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?: boolean | undefined; + /** + * Forwarded to the button element as `aria-described-by`. + */ + ariaDescribedBy?: string | undefined; + /** + * Child nodes to be rendered as the label for the button. Maps to + * the button element’s innerHTML. + */ + children: React.ReactNode; + /** + * Whether the button is interactive. Forwarded to the button + * element. + */ + disabled?: boolean | undefined; + /** + * 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?: boolean | undefined; + /** + * Whether the button should be purely textual, e.g. for use in a + * paragraph of text. + */ + inline?: boolean | undefined; + /** + * 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?: boolean | undefined; + /** + * For binding Google AMP interactivity. See + * https://amp.dev/documentation/examples/components/amp-bind/ + */ + on?: string | undefined; + /** + * Function to run when the button is engaged. Forwarded to the button + * element. + */ + onClick?: ((event: React.UIEvent) => void) | undefined; + /** + * The WAI-ARIA element role. It is always preferable to use the + * approporiate HTML element over the role attribute, e.g. + * `` is preferred to ` -); +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?: 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, // empty when type="submit" /** * 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