/** * The `auro-counter` element provides a flexible counter interface with increment and decrement buttons, supporting optional sub-labels and disabled states. * @customElement auro-counter * * @slot default - Main label content for the counter. * @slot ariaLabel.minus - Accessible label for the decrement button. * @slot ariaLabel.plus - Accessible label for the increment button. * @slot helpText - Help text content for the counter. * @slot description - Descriptive content for the counter. * * @csspart counterControl - The container for the counter's spinbutton controls and value. * @csspart controlMinus - The decrement button. * @csspart controlPlus - The increment button. * @csspart helpText - The help text and error message container. * * @event input - Notifies that the counter's value has changed. */ export class AuroCounter extends LitElement { static get shadowRootOptions(): { delegatesFocus: boolean; clonable?: boolean; customElementRegistry?: CustomElementRegistry | null; mode: ShadowRootMode; serializable?: boolean; slotAssignment?: SlotAssignmentMode; }; /** * Defines reactive properties for the component. * @returns {Object} Property configuration. */ static get properties(): Object; /** * Registers the custom element with the browser. * @param {string} [name="auro-counter"] - The name of the element that you want to register. * @example * AuroCounter.register("custom-counter") // registers */ static register(name?: string): void; static get styles(): import("lit").CSSResult[]; _initializeDefaults(): void; appearance: string | undefined; defaultSlot: any; disabled: boolean | undefined; disableMax: boolean | undefined; disableMin: boolean | undefined; max: number | undefined; min: number | undefined; onDark: boolean | undefined; validity: any; /** * Sets the value of the counter. If the provided value is undefined, null, or cannot be converted to a number, the internal value will be set to undefined. * @param {number|string|undefined|null} val - The value to set for the counter. Can be a number, a string that can be converted to a number, undefined, or null. */ set value(val: number | string | undefined | null); /** * Gets the current value of the counter. * @returns {number|undefined} The current value of the counter, or undefined if the value is not set or invalid. */ get value(): number | undefined; /** * @private */ private validation; /** * Dynamically generated icon tag for counter buttons. * @private * @type {string} */ private iconTag; /** * @private */ private helpTextTag; /** * @private */ private runtimeUtils; _value: number | undefined; /** * Increments the counter value by 1. If a value is provided, it increments by that amount. * @method increment * @param {number} [value] - The amount to increment by. * @returns {void} */ increment(value?: number): void; /** * Decrements the value of the counter by 1. If a value is provided, it decrements by that amount. * @method decrement * @param {number} [value] - The amount to decrement by. * @returns {void} */ decrement(value?: number): void; /** * Moves focus to the spinbutton control container. * The +/- buttons are internal `tabindex="-1"` controls; the container is the * widget's single focusable element. `focusVisible: true` forces the container's * `:focus-visible` ring to render even though the interaction was a pointer * click, so focus stays visible on the counter after using its buttons. * @private */ private focusControl; /** * Handles a pointer click on a control button. * A pointer click focuses the clicked button, so if the value change disables * that button at an extreme the browser would drop focus to the document body. * Move focus to the spinbutton container first, then change the value: focus is * no longer on the button when it becomes disabled, so it is never lost and the * counter (and any enclosing dropdown) stays operable (AB#1634231). * @param {'increment' | 'decrement'} action - The control action to perform. * @private */ private handleControlClick; /** * Initializes the value of the counter. * If the current value is undefined, it sets the value to the minimum value. * @private */ private initValue; /** * Determines if the increment button should be disabled based on the current value and extrema. * * @param {number} extrema - The extreme value (either min or max) to compare against the current value. * @returns {boolean} - Returns true if the increment button should be disabled, otherwise false. * @private */ private isIncrementDisabled; /** * Validates value. * @param {boolean} [force=false] - Whether to force validation. */ validate(force?: boolean): void; /** * Resets the counter to its default state, clearing validity/touched state and returning * the value to `min` — matching the clear-on-reset behavior of the other Auro form elements. * @returns {void} */ reset(): void; firstUpdated(): void; /** * Sets an attribute that matches the default tag name if the tag name is not the default. * @param {string} tagName - The tag name to set as an attribute. * @private */ private setTagAttribute; /** * Handles the change event for the default slot. * Updates the defaultSlot property with the trimmed text content of the first assigned node. * * @param {Event} event - The event object representing the slot change event. * @private */ private onDefaultSlotChange; updated(changedProperties: any): void; /** * Returns HTML for the help text and error message. * @private * @returns {html} - Returns HTML for the help text and error message. */ private renderHelpText; render(): import("lit-html").TemplateResult; } import { LitElement } from "lit";