import React from "react"; import { XmSlider as XmSliderElement, CustomEvent, } from "../lit/components/slider/index.js"; /** * A generic type for strongly typing custom events with their targets * @template T - The type of the event target (extends EventTarget) * @template D - The type of the detail payload for the custom event */ type TypedEvent = E & { target: T; }; /** `XmSlider` component event */ export type XmSliderElementEvent = TypedEvent; export type { XmSliderElement, CustomEvent }; export interface XmSliderProps extends Pick< React.AllHTMLAttributes, | "children" | "dir" | "hidden" | "id" | "lang" | "slot" | "style" | "title" | "translate" | "onClick" | "onFocus" | "onBlur" > { /** Show the current numeric value as a label beside the track. */ showValue?: boolean; /** undefined */ required?: boolean; /** undefined */ disabled?: boolean; /** undefined */ readOnly?: boolean; /** undefined */ loading?: boolean; /** INITIAL checked for toggle subclasses; mapped from attribute `checked`. */ initialChecked?: boolean; /** undefined */ min?: XmSliderElement["min"]; /** undefined */ max?: XmSliderElement["max"]; /** undefined */ step?: XmSliderElement["step"]; /** Optional unit appended to the displayed value (e.g. "%", "px"). */ unit?: XmSliderElement["unit"]; /** undefined */ label?: XmSliderElement["label"]; /** undefined */ helper?: XmSliderElement["helper"]; /** Severity copy. Non-empty ⇒ the field is in error (icon + copy, never color). */ error?: XmSliderElement["error"]; /** undefined */ size?: XmSliderElement["size"]; /** Form-control name — mirrors native . */ name?: XmSliderElement["name"]; /** INITIAL value (uncontrolled-first, AD-6): the `value` attribute seeds the live state once, then never overrides user input. Mapped from attribute `value` so authors write ``. */ initialValue?: XmSliderElement["initialValue"]; /** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */ className?: string; /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */ exportparts?: string; /** Used for labels to link them with their inputs (using input id). */ htmlFor?: string; /** Used to help React identify which items have changed, are added, or are removed within a list. */ key?: number | string; /** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */ part?: string; /** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */ ref?: React.Ref; /** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */ tabIndex?: number; /** Typed live read; the inherited string `value` stays in sync. */ valueAsNumber?: XmSliderElement["valueAsNumber"]; /** Fired on each edit with the current value in `detail`. */ onInput?: (event: XmSliderElementEvent) => void; /** Fired on commit with the new value in `detail`. */ onChange?: (event: XmSliderElementEvent) => void; } /** * * * ## Attributes & Properties * * Component attributes and properties that can be applied to the element or by using JavaScript. * * - `min`: undefined * - `max`: undefined * - `step`: undefined * - `show-value`/`showValue`: Show the current numeric value as a label beside the track. * - `unit`: Optional unit appended to the displayed value (e.g. "%", "px"). * - `label`: undefined * - `helper`: undefined * - `error`: Severity copy. Non-empty ⇒ the field is in error (icon + copy, never color). * - `size`: undefined * - `required`: undefined * - `disabled`: undefined * - `readonly`/`readOnly`: undefined * - `loading`: undefined * - `name`: Form-control name — mirrors native . * - `value`/`initialValue`: INITIAL value (uncontrolled-first, AD-6): the `value` attribute seeds the * live state once, then never overrides user input. Mapped from attribute * `value` so authors write ``. * - `checked`/`initialChecked`: INITIAL checked for toggle subclasses; mapped from attribute `checked`. * - `valueAsNumber`: Typed live read; the inherited string `value` stays in sync. (property only) (readonly) * - `readonly`: undefined (property only) * - `value`: Programmatic reset support — setting `value` after first paint updates live state. (property only) * - `checked`: Public read contract for toggle subclasses (AD-6a). (property only) * * ## Events * * Events that will be emitted by the component. * * - `input`: Fired on each edit with the current value in `detail`. * - `change`: Fired on commit with the new value in `detail`. * * ## Methods * * Methods that can be called to access component functionality. * * - `setFormDisabled(disabled: boolean) => void`: Down-propagation hook: xm-form (Story 2.10) sets this; it OR's with the * field's own disabled and can never re-enable a self-disabled field. */ export const XmSlider: React.ForwardRefExoticComponent;