import { Component, Prop, Element, h, Watch, State, AttachInternals } from '@stencil/core'; import { Button } from './button.interface'; import { ButtonType, ButtonTypes, HtmlType, HtmlTypes } from './ontario-button.types'; import { validatePropExists, validateValueAgainstArray } from '../../utils/validation/validation-functions'; import { ConsoleMessageClass } from '../../utils/console-message/console-message'; import { isServerSideRendering } from '../../utils/common/environment'; /** * Ontario Button triggers actions and supports button or link behavior. * * This component intentionally does not expose a `disabled` prop. * * To support accessible and understandable form completion: * - keep actions available * - use validation and error messaging to guide corrections instead of disabling * * For component guidance, see: * - https://designsystem.ontario.ca/components/detail/buttons.html * - https://designsystem.ontario.ca/developer-docs/components/ontario-button/ * * Disabled/read-only policy source: * - https://designsystem.ontario.ca/components/detail/buttons.html#disabled-buttons */ @Component({ tag: 'ontario-button', styleUrl: 'ontario-button.scss', shadow: true, formAssociated: true, }) export class OntarioButton implements Button { @Element() host: HTMLElement; @AttachInternals() internals: ElementInternals; /** * The type of button to render. * * If no type is passed, it will default to 'secondary'. */ @Prop() type: ButtonType = 'secondary'; /** * The native HTML button type the button should use. * * If no `htmlType` is passed, it will default to `'button'`. * This prop only affects the component when it renders as a native ` ); } }