@funstack/ui 0.1.0-alpha.5 → 0.1.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion/accordion-item.mjs +2 -2
- package/dist/accordion/accordion-panel.mjs +2 -2
- package/dist/accordion/accordion-root.mjs +3 -3
- package/dist/accordion/accordion-trigger.mjs +2 -2
- package/dist/button/button.d.mts +78 -0
- package/dist/button/button.d.mts.map +1 -0
- package/dist/button/button.mjs +77 -0
- package/dist/button/button.mjs.map +1 -0
- package/dist/button/index.d.mts +3 -0
- package/dist/button/index.mjs +1 -0
- package/dist/checkbox/checkbox.mjs +2 -2
- package/dist/checkbox-group/checkbox-group-item.mjs +1 -1
- package/dist/checkbox-group/checkbox-group-parent.mjs +1 -1
- package/dist/checkbox-group/checkbox-group-root.mjs +1 -1
- package/dist/combobox/combobox-clear.d.mts +6 -3
- package/dist/combobox/combobox-clear.d.mts.map +1 -1
- package/dist/combobox/combobox-clear.mjs +10 -5
- package/dist/combobox/combobox-clear.mjs.map +1 -1
- package/dist/combobox/combobox-group.mjs +1 -1
- package/dist/combobox/combobox-list.mjs +1 -1
- package/dist/combobox/combobox-option.mjs +1 -1
- package/dist/combobox/combobox-popup.mjs +2 -2
- package/dist/combobox/combobox-root.mjs +3 -3
- package/dist/combobox/combobox-trigger.d.mts +6 -2
- package/dist/combobox/combobox-trigger.d.mts.map +1 -1
- package/dist/combobox/combobox-trigger.mjs +10 -4
- package/dist/combobox/combobox-trigger.mjs.map +1 -1
- package/dist/dialog/dialog-close.d.mts +8 -3
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +12 -8
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-form.mjs +1 -1
- package/dist/dialog/dialog-popup.mjs +3 -3
- package/dist/dialog/dialog-root.mjs +2 -2
- package/dist/dialog/dialog-trigger.d.mts +8 -3
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs +15 -8
- package/dist/dialog/dialog-trigger.mjs.map +1 -1
- package/dist/field/field-root.mjs +3 -3
- package/dist/form/form-root.mjs +1 -1
- package/dist/form/form-submit.d.mts +4 -1
- package/dist/form/form-submit.d.mts.map +1 -1
- package/dist/form/form-submit.mjs.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +2 -1
- package/dist/internal/render-element.mjs +18 -5
- package/dist/internal/render-element.mjs.map +1 -1
- package/dist/internal/use-action-trigger.mjs +17 -6
- package/dist/internal/use-action-trigger.mjs.map +1 -1
- package/dist/internal/use-field-control.mjs +1 -1
- package/dist/internal/use-popover-root.mjs +1 -1
- package/dist/internal/use-popover-trigger.mjs +6 -5
- package/dist/internal/use-popover-trigger.mjs.map +1 -1
- package/dist/internal/use-render.mjs +2 -2
- package/dist/internal/use-render.mjs.map +1 -1
- package/dist/menu/menu-checkbox-item.mjs +2 -2
- package/dist/menu/menu-dom.mjs +7 -1
- package/dist/menu/menu-dom.mjs.map +1 -1
- package/dist/menu/menu-group.mjs +1 -1
- package/dist/menu/menu-item.d.mts +6 -2
- package/dist/menu/menu-item.d.mts.map +1 -1
- package/dist/menu/menu-item.mjs +6 -4
- package/dist/menu/menu-item.mjs.map +1 -1
- package/dist/menu/menu-popup.mjs +1 -1
- package/dist/menu/menu-radio-group.mjs +1 -1
- package/dist/menu/menu-root.mjs +1 -1
- package/dist/menu/menu-submenu-trigger.mjs +1 -1
- package/dist/menu/menu-trigger.d.mts +6 -3
- package/dist/menu/menu-trigger.d.mts.map +1 -1
- package/dist/menu/menu-trigger.mjs +3 -3
- package/dist/menu/menu-trigger.mjs.map +1 -1
- package/dist/number-field/number-field-decrement.d.mts +4 -3
- package/dist/number-field/number-field-decrement.d.mts.map +1 -1
- package/dist/number-field/number-field-decrement.mjs +4 -3
- package/dist/number-field/number-field-decrement.mjs.map +1 -1
- package/dist/number-field/number-field-increment.d.mts +8 -3
- package/dist/number-field/number-field-increment.d.mts.map +1 -1
- package/dist/number-field/number-field-increment.mjs +9 -6
- package/dist/number-field/number-field-increment.mjs.map +1 -1
- package/dist/number-field/number-field-input.mjs +1 -1
- package/dist/number-field/number-field-root.mjs +5 -5
- package/dist/number-field/number-field-root.mjs.map +1 -1
- package/dist/number-field/use-step-button.mjs +6 -1
- package/dist/number-field/use-step-button.mjs.map +1 -1
- package/dist/popover/popover-close.d.mts +9 -3
- package/dist/popover/popover-close.d.mts.map +1 -1
- package/dist/popover/popover-close.mjs +13 -8
- package/dist/popover/popover-close.mjs.map +1 -1
- package/dist/popover/popover-popup.mjs +2 -2
- package/dist/popover/popover-trigger.d.mts +8 -4
- package/dist/popover/popover-trigger.d.mts.map +1 -1
- package/dist/popover/popover-trigger.mjs +3 -3
- package/dist/popover/popover-trigger.mjs.map +1 -1
- package/dist/radio-group/radio-group-item.mjs +1 -1
- package/dist/radio-group/radio-group-root.mjs +1 -1
- package/dist/select/select-root.mjs +1 -1
- package/dist/slider/slider-root.mjs +6 -6
- package/dist/slider/slider-root.mjs.map +1 -1
- package/dist/slider/slider-thumb.mjs +1 -1
- package/dist/slider/slider-value.mjs +1 -1
- package/dist/switch/switch.mjs +2 -2
- package/dist/tabs/tabs-list.mjs +1 -1
- package/dist/tabs/tabs-panel.mjs +1 -1
- package/dist/tabs/tabs-root.mjs +2 -2
- package/dist/tabs/tabs-tab.mjs +1 -1
- package/dist/toast/toast-action.d.mts +4 -3
- package/dist/toast/toast-action.d.mts.map +1 -1
- package/dist/toast/toast-action.mjs +8 -6
- package/dist/toast/toast-action.mjs.map +1 -1
- package/dist/toast/toast-root.mjs +1 -1
- package/dist/toast/toast-viewport.mjs +3 -3
- package/dist/toggle/toggle.d.mts +4 -1
- package/dist/toggle/toggle.d.mts.map +1 -1
- package/dist/toggle/toggle.mjs +16 -10
- package/dist/toggle/toggle.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-item.d.mts +6 -2
- package/dist/toggle-group/toggle-group-item.d.mts.map +1 -1
- package/dist/toggle-group/toggle-group-item.mjs +10 -5
- package/dist/toggle-group/toggle-group-item.mjs.map +1 -1
- package/dist/toggle-group/toggle-group-root.mjs +3 -3
- package/dist/toolbar/index.d.mts +4 -5
- package/dist/toolbar/index.d.mts.map +1 -1
- package/dist/toolbar/index.mjs +3 -4
- package/dist/toolbar/index.mjs.map +1 -1
- package/dist/toolbar/toolbar-root.mjs +1 -1
- package/dist/toolbar/toolbar-separator.mjs +1 -1
- package/package.json +2 -1
- package/dist/toolbar/toolbar-button.d.mts +0 -42
- package/dist/toolbar/toolbar-button.d.mts.map +0 -1
- package/dist/toolbar/toolbar-button.mjs +0 -50
- package/dist/toolbar/toolbar-button.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider-root.mjs","names":[],"sources":["../../src/slider/slider-root.tsx"],"sourcesContent":["\"use client\";\nimport {\n addTransitionType,\n use,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode, RefObject } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { FieldContext } from \"../internal/field-context.js\";\nimport { mergeTokenLists } from \"../internal/merge-props.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type {\n ActionDetails,\n ChangeAction,\n ChangeReason,\n RenderProp,\n StateValue,\n} from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport {\n useFieldControl,\n useFieldValueChange,\n useMergedRef,\n} from \"../internal/use-field-control.js\";\nimport type { FormAssociatedElement } from \"../internal/use-form-reset.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { useNativeGroupReconciliation } from \"../internal/use-native-group-reconciliation.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport {\n clampToNeighbours,\n equalValues,\n isMaxReachable,\n isOnGrid,\n nearestThumb,\n percent,\n platformDefault,\n sanitize,\n} from \"./slider-arithmetic.js\";\nimport { SliderContext } from \"./slider-context.js\";\nimport type { SliderContextValue, SliderFieldWiring } from \"./slider-context.js\";\n\n/** One number (one thumb) or one number per thumb, in ascending order. */\nexport type SliderValue = number | readonly number[];\n\nexport type SliderOrientation = \"horizontal\" | \"vertical\";\n\n/** Details passed as the second argument of `Slider.Root`'s `valueChangeAction` (each step). */\nexport interface SliderValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user moved a thumb (`details.event` is the native `input` event for a key\n * press, the `pointerdown` / `pointermove` / `pointerup` for a drag, the `keydown` for a\n * JS-normalised key).\n * `\"platform\"`: a form reset (the `reset` event) or a value found in the inputs at mount\n * (`undefined`).\n * `\"dismiss\"`: the commit action rejected and the slider reverted to the committed value\n * (uncontrolled mode; `undefined`).\n */\n readonly reason: ChangeReason;\n /** Index of the thumb that moved; `null` on a platform path or a revert, where several may change. */\n readonly thumb: number | null;\n}\n\n/** Details passed as the second argument of `Slider.Root`'s `valueCommitAction` (each gesture). */\nexport interface SliderValueCommitDetails extends ActionDetails {\n /**\n * `\"activate\"`: a gesture ended (`details.event` is the native `change` event for a key press,\n * the `pointerup` / `pointercancel` / `lostpointercapture` for a drag, the `keydown` for a\n * JS-normalised key). `\"platform\"`: a form reset (the `reset` event) or mount reconciliation\n * (`undefined`). Never `\"dismiss\"`.\n */\n readonly reason: ChangeReason;\n /** Index of the thumb the gesture moved; `null` on a platform path. */\n readonly thumb: number | null;\n}\n\nexport interface SliderRootState<T extends SliderValue = number> {\n /**\n * The value the thumbs show: the value a gesture has reached while a pointer is captured or a\n * step or commit is in flight, else the optimistic value. Content rendered from it must not\n * suspend.\n */\n readonly value: T;\n /** `value` as an array, one entry per thumb, in thumb order. */\n readonly values: readonly number[];\n /** A step or commit dispatched through this Slider is in flight. */\n readonly pending: boolean;\n /** A pointer is captured on a thumb. */\n readonly dragging: boolean;\n readonly orientation: SliderOrientation;\n readonly disabled: boolean;\n readonly min: number;\n readonly max: number;\n readonly step: number;\n}\n\nexport interface SliderRootProps<T extends SliderValue = number> extends Omit<\n ComponentPropsWithRef<\"div\">,\n | \"defaultValue\"\n | \"role\"\n | \"className\"\n | \"style\"\n | \"children\"\n // The value attributes are the native inputs' (design 8): never authored.\n | \"aria-valuemin\"\n | \"aria-valuemax\"\n | \"aria-valuenow\"\n | \"aria-valuetext\"\n | \"aria-orientation\"\n> {\n /** Controlled value: one number, or one per thumb in ascending order. `undefined`: uncontrolled. */\n value?: T;\n /**\n * Initial value in uncontrolled mode; also the form-reset target (latest value). Default: the\n * platform's midpoint, `min + (max - min) / 2`, snapped to `step`.\n */\n defaultValue?: T;\n /**\n * Runs inside the Root's step transition on every step: each pointer move, each key press,\n * each platform change, and the revert after a rejected commit (`reason: \"dismiss\"`,\n * uncontrolled). Awaited; `data-pending` meanwhile (without this action a step starts no\n * transition and is never pending). Adopt the value here in a controlled\n * parent (`setValue(next)` in the sync prefix is a transition update). Not the place for a\n * save: a pending async action entangles every transition in the app, and a drag is many\n * steps. A `setState` after your own `await` needs `startTransition`.\n */\n valueChangeAction?: ChangeAction<T, SliderValueChangeDetails>;\n /**\n * Runs inside the Root's commit transition once per gesture: pointer release, each key press,\n * a form reset, a value found at mount. Awaited; the thumb keeps the gesture's value and shows\n * `data-pending` until it settles; in uncontrolled mode the value is committed when it\n * resolves and reverts to the previous value if it rejects. May be a Server Function.\n */\n valueCommitAction?: ChangeAction<T, SliderValueCommitDetails>;\n /** Default `0`. */\n min?: number;\n /**\n * Default `100`. A `max` that is not on the step grid from `min` is unreachable, as on a\n * native range (dev warning).\n */\n max?: number;\n /** Default `1`. Must be positive. Values snap to `min + n × step`. */\n step?: number;\n /** Minimum number of steps between two adjacent thumbs. Default `0` (thumbs may share a value). */\n minStepsBetweenThumbs?: number;\n /** Default `\"horizontal\"`. Vertical sliders have `min` at the bottom. */\n orientation?: SliderOrientation;\n /**\n * `aria-valuetext` for a thumb, from the value it shows. Set it when the number alone is not\n * meaningful (\"3 of 5 stars\", \"Tuesday\"). Default: none (the number is announced).\n */\n getAriaValueText?: (value: number, index: number) => string;\n /**\n * Form field name for every thumb's input (a Thumb's own `name` wins). With several thumbs,\n * read with `FormData.getAll()`.\n */\n name?: string;\n /** The `form` attribute for every thumb's input (a Thumb's own `form` wins). */\n form?: string;\n /** Disables every input (native `disabled`; not submitted) and the pointer. Never set while pending. */\n disabled?: boolean;\n className?: StateValue<string | undefined, SliderRootState<T>>;\n style?: StateValue<CSSProperties | undefined, SliderRootState<T>>;\n children?: StateValue<ReactNode, SliderRootState<T>>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, SliderRootState<T>>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nconst STEP_TYPES = transitionTypes(\"slider\", \"change\");\nconst COMMIT_TYPES = transitionTypes(\"slider\", \"commit\");\n\nfunction toArray(value: SliderValue): readonly number[] {\n return typeof value === \"number\" ? [value] : value;\n}\n\nfunction shapeOf(value: SliderValue | undefined): \"number\" | \"array\" | undefined {\n if (value === undefined) return undefined;\n return typeof value === \"number\" ? \"number\" : \"array\";\n}\n\nfunction replaceAt(values: readonly number[], index: number, value: number): readonly number[] {\n return values.map((v, i) => (i === index ? value : v));\n}\n\n/** Writes each registered input's `defaultValue` (the attribute a form reset restores). */\nfunction writeDefaults(\n registry: ReadonlyMap<number, HTMLInputElement>,\n target: readonly number[],\n): void {\n for (const [index, input] of registry) {\n const entry = target[index];\n if (entry !== undefined) input.defaultValue = String(entry);\n }\n}\n\n/** A pointer captured on a Thumb or the Track (design 4.1). */\ninterface ActiveGesture {\n readonly pointerId: number;\n /** Detaches the gesture's listeners. */\n readonly detach: () => void;\n}\n\n/**\n * Owns the slider's state (design/components/slider.md 2): the committed value through\n * `useControllableAction` with `valueCommitAction` (once per gesture), each step through its own\n * transition (`valueChangeAction`), and the value a gesture has reached in the urgent lane\n * (`live`), which the thumbs show while a pointer is captured or anything is in flight. Also the\n * pointer gesture, the Thumb registry, mount reconciliation and form reset, and the geometry\n * custom properties `--slider-start`, `--slider-end` and `--slider-value-<i>`.\n *\n * Owned keys (conventions 1.2): `role` (`\"group\"` with several thumbs), `aria-labelledby` (the\n * Label's id while a Label is mounted and there are several thumbs; token-merged with the\n * consumer's), `data-pending`, `data-dragging`, `data-orientation`, `data-disabled`. The custom\n * properties are merged into `style`, where the consumer's entries win.\n *\n * Inside a `Field.Root` (design 9.4) the Root calls `useFieldControl`: with one thumb, Thumb 0's\n * input is the Field's labelable control; with several, the Root registers itself as the group\n * and also owns the Field label in `aria-labelledby`, the Field's `aria-describedby` and\n * `data-invalid`. `name` / `disabled` default from the Field.\n */\nfunction SliderRootImpl<T extends SliderValue = number>(props: SliderRootProps<T>) {\n const {\n value,\n defaultValue,\n valueChangeAction,\n valueCommitAction,\n min = 0,\n max = 100,\n step: stepProp = 1,\n minStepsBetweenThumbs = 0,\n orientation = \"horizontal\",\n getAriaValueText,\n name: nameProp,\n form,\n disabled: disabledProp = false,\n className,\n style,\n children,\n render,\n ...rest\n } = props;\n\n const stepValid = Number.isFinite(stepProp) && stepProp > 0;\n const step = stepValid ? stepProp : 1;\n const gap = Math.max(0, minStepsBetweenThumbs) * step;\n\n const id = useId();\n const labelId = `${id}-label`;\n\n // The shape (one number or an array) is fixed at mount (design 3.1).\n const [shape] = useState<\"number\" | \"array\">(() => shapeOf(value ?? defaultValue) ?? \"number\");\n const fromArray = useCallback(\n (values: readonly number[]): T => (shape === \"number\" ? values[0] : values) as T,\n [shape],\n );\n\n // --- State (design 2) ----------------------------------------------------------------------\n\n const [live, setLive] = useState<readonly number[] | null>(null);\n const [gestureThumb, setGestureThumb] = useState<number | null>(null);\n /**\n * A step was taken and its gesture's commit has not been dispatched yet. Holds `live` on\n * screen between a key's native `input` and `change` when no step transition runs (no\n * `valueChangeAction`): otherwise react-dom restores the controlled input to the old value\n * after `input`, and Firefox then fires no `change`.\n */\n const [stepHeld, setStepHeld] = useState(false);\n const [pendingThumb, setPendingThumb] = useState<number | null>(null);\n\n /** The value of the latest step, read by the commit in the same or a later event. */\n const liveRef = useRef<readonly number[] | null>(null);\n /** The shown value when the open gesture began; `null` when no gesture is open. */\n const gestureStart = useRef<readonly number[] | null>(null);\n const activeGesture = useRef<ActiveGesture | null>(null);\n const commitSeq = useRef(0);\n const trackRef = useRef<HTMLElement | null>(null);\n\n const runCommit = async (next: T, details: SliderValueCommitDetails): Promise<void> => {\n const seq = ++commitSeq.current;\n try {\n await valueCommitAction?.(next, details);\n } catch (error) {\n // Design 2.4: in uncontrolled mode, tell the preview channel about the rollback, for the\n // latest commit only. Yield once to leave the commit's transition (conventions 2.6).\n if (value === undefined && seq === commitSeq.current) {\n await undefined;\n // `stepTo` and `committedRef` are declared below; this runs long after the render.\n stepTo(toArray(committedRef.current), null, \"dismiss\", undefined);\n }\n throw error;\n }\n };\n\n const commitState = useControllableAction<T, SliderValueCommitDetails>({\n controlled: value,\n defaultValue,\n initialValue: platformDefault(min, max, step) as T,\n action: runCommit,\n transitionTypes: () => COMMIT_TYPES,\n warn: { component: \"Slider.Root\", prop: \"value\" },\n });\n const { optimistic, committed, dispatch } = commitState;\n const committedRef = useLatest(committed);\n\n const { pending: stepPending, run: runStep } = useActionTrigger();\n\n const optimisticValues = useMemo(() => toArray(optimistic), [optimistic]);\n const held = gestureThumb !== null || stepHeld || stepPending || commitState.pending;\n const shown = held && live !== null ? live : optimisticValues;\n const pending = stepPending || commitState.pending;\n\n // --- Inside a Field.Root (design 9.4) ------------------------------------------------------\n\n // One thumb: its input is the Field's labelable control. Several: the Root (`role=\"group\"`)\n // registers, `Field.Label` drops `for` and names the group through `aria-labelledby`.\n const thumbCount = shown.length;\n const field = useFieldControl({\n labelable: thumbCount === 1,\n name: nameProp,\n disabled: disabledProp,\n component: \"Slider.Root\",\n });\n const fieldName = use(FieldContext)?.name;\n const name = field.name;\n const disabled = field.disabled;\n const fieldId = field.id;\n const thumbId = useCallback(\n (index: number) => (index === 0 && fieldId !== undefined ? fieldId : `${id}-thumb-${index}`),\n [id, fieldId],\n );\n const rootRef = useMergedRef<HTMLElement>(undefined, thumbCount > 1 ? field.ref : undefined);\n useDevWarning(\n field.inField && field.required,\n \"Slider.Root: a range is never empty, so `required` on the enclosing Field.Root has no \" +\n \"effect on the slider.\",\n );\n /**\n * The reason of the latest change the user or the platform made, consumed by the Field\n * notification below: `\"activate\"` dismisses a shown server error, a rollback does not.\n */\n const lastReason = useRef<ChangeReason | null>(null);\n // A pointer gesture and the JS-normalised keys fire no `input` / `change` the Field hears:\n // tell it at the commit, when the optimistic value changes (design 9.4.4).\n useFieldValueChange(optimisticValues.join(\"\\u0000\"), () => {\n const edit = lastReason.current === \"activate\";\n lastReason.current = null;\n return edit;\n });\n const {\n \"aria-labelledby\": fieldLabelledBy,\n \"aria-describedby\": fieldDescribedBy,\n \"aria-invalid\": fieldInvalid,\n \"data-invalid\": fieldDataInvalid,\n } = field.attributes;\n const inField = field.inField;\n const fieldRef = field.ref;\n const fieldWiring = useMemo<SliderFieldWiring | null>(() => {\n if (!inField) return null;\n const single = thumbCount === 1;\n return {\n inputRef: single ? fieldRef : undefined,\n describedBy: single ? fieldDescribedBy : undefined,\n invalid: fieldInvalid,\n dataInvalid: fieldDataInvalid,\n name: fieldName,\n };\n }, [inField, fieldRef, thumbCount, fieldDescribedBy, fieldInvalid, fieldDataInvalid, fieldName]);\n\n /** What the thumbs show, for handlers; also written by `stepTo` ahead of the render. */\n const shownRef = useLatest(shown);\n\n const latest = useLatest({\n valueChangeAction,\n fromArray,\n runStep,\n min,\n max,\n step,\n gap,\n orientation,\n disabled,\n });\n\n // --- Step and commit (design 2.4) ---------------------------------------------------------\n\n const stepTo = useCallback(\n (\n next: readonly number[],\n thumb: number | null,\n reason: ChangeReason,\n event: Event | undefined,\n ): boolean => {\n // No-op against what the user sees (conventions 2.3 item 8).\n if (equalValues(next, shownRef.current)) return false;\n liveRef.current = next;\n shownRef.current = next;\n // A controlled parent that adopts steps changes the optimistic value per step.\n lastReason.current = reason;\n setLive(next);\n setPendingThumb(thumb);\n // A revert has no commit after it: the optimistic value already shows the committed one.\n if (reason !== \"dismiss\") setStepHeld(true);\n const { valueChangeAction: action, fromArray: toValue, runStep: run } = latest.current;\n // Without a step action there is nothing to run and no consumer update to keep\n // interruptible: no transition, so `data-pending` does not blink on every pointer move.\n if (action === undefined) return true;\n run(() => {\n for (const type of STEP_TYPES) addTransitionType(type);\n return action?.(toValue(next), createActionDetails(event, { reason, thumb }));\n });\n return true;\n },\n [latest, shownRef],\n );\n\n const commitGesture = useCallback(\n (thumb: number | null, reason: ChangeReason, event: Event | undefined): void => {\n const start = gestureStart.current;\n gestureStart.current = null;\n // The commit's own pending state holds `live` from here (set in this same batch).\n setStepHeld(false);\n const next = liveRef.current;\n // Nothing changed since the gesture began (a drag out and back, a trailing `change`).\n if (start === null || next === null || equalValues(next, start)) return;\n lastReason.current = reason;\n setPendingThumb(thumb);\n dispatch(latest.current.fromArray(next), createActionDetails(event, { reason, thumb }));\n },\n [dispatch, latest],\n );\n\n // --- Thumb registry ------------------------------------------------------------------------\n\n const [registry] = useState(() => new Map<number, HTMLInputElement>());\n const warnedDuplicate = useRef(false);\n const warnedForm = useRef(false);\n const registerThumb = useCallback(\n (index: number, input: HTMLInputElement) => {\n const existing = registry.get(index);\n if (isDev && existing !== undefined && existing !== input && !warnedDuplicate.current) {\n warnedDuplicate.current = true;\n console.error(\n `Slider.Thumb: two Thumbs have \\`index={${index}}\\`. Each value needs exactly one ` +\n `Thumb; give every Thumb a distinct index.`,\n );\n }\n if (isDev && !warnedForm.current) {\n for (const other of registry.values()) {\n if (other !== input && other.form !== input.form) {\n warnedForm.current = true;\n console.error(\n \"Slider.Thumb: the thumbs of one Slider belong to different forms (a Thumb's \" +\n \"`form` prop). A form reset is followed through the first thumb's form only; \" +\n \"keep every thumb in one form.\",\n );\n break;\n }\n }\n }\n registry.set(index, input);\n return () => {\n if (registry.get(index) === input) registry.delete(index);\n };\n },\n [registry],\n );\n\n /** The first registered input: the form-associated element the reset subscription follows. */\n const formElement = useMemo<RefObject<FormAssociatedElement | null>>(\n () => ({\n get current() {\n let first: HTMLInputElement | null = null;\n let firstIndex = Number.POSITIVE_INFINITY;\n for (const [index, input] of registry) {\n if (index < firstIndex) {\n firstIndex = index;\n first = input;\n }\n }\n return first;\n },\n set current(_ignored) {},\n }),\n [registry],\n );\n\n // --- Labels --------------------------------------------------------------------------------\n\n const [labelCount, setLabelCount] = useState(0);\n // The same count for the dev warning, which can run before the re-render the registration\n // scheduled.\n const labelCountRef = useRef(0);\n const registerLabel = useCallback(() => {\n labelCountRef.current += 1;\n setLabelCount((count) => count + 1);\n return () => {\n labelCountRef.current -= 1;\n setLabelCount((count) => count - 1);\n };\n }, []);\n\n // --- Residual browser paths: mount reconciliation and form reset (design 9.2, 9.3) --------\n\n const [mountValue] = useState(value);\n const resetTarget = (): readonly number[] =>\n value !== undefined\n ? toArray(mountValue ?? value)\n : toArray(defaultValue ?? platformDefault(min, max, step));\n\n const readCurrent = (): readonly number[] =>\n shownRef.current.map((v, index) => {\n const input = registry.get(index);\n if (input === undefined) return v;\n const read = Number(input.value);\n return Number.isFinite(read) ? read : v;\n });\n\n const { onItemMounted } = useNativeGroupReconciliation<readonly number[]>({\n element: formElement,\n readCurrent,\n readDefault: resetTarget,\n base: () => shownRef.current,\n // Compare as the DOM would hold the values: a consumer's off-grid value is sanitised by the\n // browser (not by jsdom), and that is not a platform change.\n equals: (a, b) => {\n const reference = shownRef.current;\n return equalValues(\n sanitize(a, reference, min, max, step, gap),\n sanitize(b, reference, min, max, step, gap),\n );\n },\n onPlatformChange: (next, event) => {\n if (next.length !== shownRef.current.length) return;\n const before = shownRef.current;\n gestureStart.current = before;\n liveRef.current = before;\n stepTo(next, null, \"platform\", event);\n commitGesture(null, \"platform\", event);\n },\n onResetEvent: () => {\n // react-dom writes `defaultValue = value` after every update of a controlled input, so the\n // reset target is written here, right before the browser's reset algorithm reads it.\n writeDefaults(registry, resetTarget());\n },\n });\n\n // --- Keyboard (design 4.2) -----------------------------------------------------------------\n\n const inputStep = useCallback(\n (index: number, raw: number, event: Event) => {\n if (!Number.isFinite(raw)) return;\n const before = shownRef.current;\n if (index >= before.length) return;\n // A key press is a one-step gesture: it starts at the value shown before it.\n if (stepTo(replaceAt(before, index, raw), index, \"activate\", event)) {\n if (gestureStart.current === null) gestureStart.current = before;\n }\n },\n [shownRef, stepTo],\n );\n\n const inputCommit = useCallback(\n (index: number, event: Event) => {\n // A pointer gesture commits at its release.\n if (activeGesture.current !== null) return;\n commitGesture(index, \"activate\", event);\n },\n [commitGesture],\n );\n\n const inputKeyDown = useCallback(\n (index: number, event: KeyboardEvent) => {\n const {\n orientation: axis,\n disabled: off,\n min: lo,\n max: hi,\n step: inc,\n gap: g,\n } = latest.current;\n if (off) return;\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return;\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n // Vertical: Firefox decreases a vertical range on ArrowRight; the APG says increase.\n // Horizontal RTL: the track is mirrored (min on the right), so ArrowLeft increases;\n // Chromium and Firefox mirror a native range, WebKit does not (design 7). LTR stays native.\n let increaseKey: \"ArrowLeft\" | \"ArrowRight\";\n if (axis === \"vertical\") {\n increaseKey = \"ArrowRight\";\n } else {\n // Read at the keydown: the direction may come from any ancestor and change at any time.\n const input = event.currentTarget as Element | null;\n if (input === null || getComputedStyle(input).direction !== \"rtl\") return;\n increaseKey = \"ArrowLeft\";\n }\n event.preventDefault();\n const before = shownRef.current;\n const current = before[index];\n if (current === undefined) return;\n const delta = event.key === increaseKey ? inc : -inc;\n const next = replaceAt(\n before,\n index,\n clampToNeighbours(before, index, current + delta, lo, hi, inc, g),\n );\n if (activeGesture.current !== null) {\n stepTo(next, index, \"activate\", event);\n return;\n }\n gestureStart.current = before;\n liveRef.current = before;\n stepTo(next, index, \"activate\", event);\n commitGesture(index, \"activate\", event);\n },\n [commitGesture, latest, shownRef, stepTo],\n );\n\n // --- Pointer (design 4.1) ------------------------------------------------------------------\n\n const warnedNoTrack = useRef(false);\n const beginGesture = useCallback(\n (index: number | null, event: PointerEvent, element: HTMLElement) => {\n const { disabled: off } = latest.current;\n if (off || event.button !== 0 || activeGesture.current !== null) return;\n const track = trackRef.current;\n if (track === null) {\n if (isDev && !warnedNoTrack.current) {\n warnedNoTrack.current = true;\n console.error(\n \"Slider.Thumb: a pointer press needs a Slider.Track to map the pointer to a value. \" +\n \"Without a Track the slider is keyboard-only.\",\n );\n }\n return;\n }\n // No text selection, no focus change through the compatibility `mousedown`.\n event.preventDefault();\n const rtl = getComputedStyle(track).direction === \"rtl\";\n\n const valueAt = (clientX: number, clientY: number): number => {\n const { min: lo, max: hi, orientation: axis } = latest.current;\n const rect = (trackRef.current ?? track).getBoundingClientRect();\n let fraction: number;\n if (axis === \"vertical\") {\n fraction = rect.height > 0 ? (rect.bottom - clientY) / rect.height : 0;\n } else {\n fraction = rect.width > 0 ? (clientX - rect.left) / rect.width : 0;\n if (rtl) fraction = 1 - fraction;\n }\n fraction = Math.min(1, Math.max(0, fraction));\n return lo + fraction * (hi - lo);\n };\n const moveTo = (thumb: number, raw: number, cause: Event): void => {\n const { min: lo, max: hi, step: inc, gap: g } = latest.current;\n const before = shownRef.current;\n if (thumb >= before.length) return;\n stepTo(\n replaceAt(before, thumb, clampToNeighbours(before, thumb, raw, lo, hi, inc, g)),\n thumb,\n \"activate\",\n cause,\n );\n };\n\n const start = valueAt(event.clientX, event.clientY);\n const startValues = shownRef.current;\n // A press on a Thumb that shares its value with a neighbour (stacked thumbs) moves the one\n // that can go toward the pointer, the Track's tie rule; when the press is exactly on the\n // value, the first move decides. Otherwise a Thumb press moves that Thumb.\n let tied: { readonly first: number; readonly last: number; readonly at: number } | null =\n null;\n if (index !== null) {\n const at = startValues[index];\n if (at !== undefined) {\n let first = index;\n let last = index;\n while (first > 0 && equalValues([startValues[first - 1] as number], [at])) first -= 1;\n while (\n last < startValues.length - 1 &&\n equalValues([startValues[last + 1] as number], [at])\n ) {\n last += 1;\n }\n if (first !== last) tied = { first, last, at };\n }\n }\n const resolveTie = (raw: number): number | null => {\n if (tied === null) return null;\n if (raw > tied.at) return tied.last;\n if (raw < tied.at) return tied.first;\n return null;\n };\n /** The thumb the gesture moves; `null` while a press on stacked thumbs is undecided. */\n let decided: number | null =\n index === null ? nearestThumb(startValues, start) : tied ? resolveTie(start) : index;\n /** The thumb shown as dragging and focused meanwhile. */\n let thumb = decided ?? index ?? 0;\n const pointerId = event.pointerId;\n try {\n element.setPointerCapture(pointerId);\n } catch {\n // An inactive pointer id (a synthetic event): the gesture still follows the element.\n }\n\n const decide = (raw: number): boolean => {\n if (decided !== null) return true;\n decided = resolveTie(raw);\n if (decided === null) return false;\n if (decided !== thumb) {\n thumb = decided;\n setGestureThumb(thumb);\n registry.get(thumb)?.focus({ focusVisible: false } as FocusOptions);\n }\n return true;\n };\n const follow = (pointerEvent: PointerEvent): void => {\n const raw = valueAt(pointerEvent.clientX, pointerEvent.clientY);\n if (decide(raw)) moveTo(thumb, raw, pointerEvent);\n };\n\n const onMove = (moveEvent: PointerEvent): void => {\n if (moveEvent.pointerId !== pointerId) return;\n follow(moveEvent);\n };\n const onEnd = (endEvent: PointerEvent): void => {\n if (endEvent.pointerId !== pointerId) return;\n detach();\n // The release position is the gesture's last (an engine may coalesce the final move\n // into the `pointerup`); a cancel or a lost capture keeps the last move's value.\n if (endEvent.type === \"pointerup\") follow(endEvent);\n activeGesture.current = null;\n setGestureThumb(null);\n commitGesture(thumb, \"activate\", endEvent);\n };\n const detach = (): void => {\n element.removeEventListener(\"pointermove\", onMove);\n element.removeEventListener(\"pointerup\", onEnd);\n element.removeEventListener(\"pointercancel\", onEnd);\n element.removeEventListener(\"lostpointercapture\", onEnd);\n };\n element.addEventListener(\"pointermove\", onMove);\n element.addEventListener(\"pointerup\", onEnd);\n element.addEventListener(\"pointercancel\", onEnd);\n element.addEventListener(\"lostpointercapture\", onEnd);\n\n activeGesture.current = { pointerId, detach };\n setGestureThumb(thumb);\n gestureStart.current = shownRef.current;\n liveRef.current = shownRef.current;\n // A capture alone holds `live` on screen: start it from what is shown, not from the value\n // an earlier gesture left behind (a press exactly on the current value steps nothing).\n setLive(shownRef.current);\n // `:focus-visible` does not match after a pointer press, as on a native range.\n registry.get(thumb)?.focus({ focusVisible: false } as FocusOptions);\n if (decided !== null) moveTo(thumb, start, event);\n },\n [commitGesture, latest, registry, shownRef, stepTo],\n );\n\n // An unmount mid-gesture leaves no listener behind.\n useEffect(\n () => () => {\n activeGesture.current?.detach();\n activeGesture.current = null;\n },\n [],\n );\n\n // --- Development warnings ------------------------------------------------------------------\n\n useDevWarning(\n !stepValid,\n `Slider.Root: \\`step\\` must be a positive number (got ${String(stepProp)}); using 1.`,\n );\n useDevWarning(\n stepValid && !isMaxReachable(min, max, step),\n `Slider.Root: \\`max\\` (${max}) is not on the step grid from \\`min\\` (${min}) with \\`step\\` ` +\n `${step}: it is unreachable, as on a native range. The last reachable value is the last ` +\n `step below \\`max\\`.`,\n );\n const given = value ?? defaultValue;\n const givenValues = given === undefined ? [] : toArray(given);\n useDevWarning(\n givenValues.some((v) => !isOnGrid(v, min, max, step)),\n `Slider.Root: the ${value !== undefined ? \"`value`\" : \"`defaultValue`\"} ` +\n `(${givenValues.join(\", \")}) is off the step grid or outside \\`min\\` / \\`max\\`. It is ` +\n `rendered as given and the browser sanitises it; the first user step snaps it.`,\n );\n useDevWarning(\n givenValues.some((v, i) => i > 0 && v < (givenValues[i - 1] as number)),\n `Slider.Root: the values (${givenValues.join(\", \")}) must be in ascending order; the thumbs ` +\n `would be rendered crossed.`,\n );\n const currentShape = shapeOf(given);\n useDevWarning(\n currentShape !== undefined && currentShape !== shape,\n `Slider.Root: the value changed shape between a number and an array after mount. The shape ` +\n `is fixed at mount; remount the Slider (a \\`key\\`) to change the number of thumbs.`,\n );\n // Inside a Field, `Field.Label` names the group (design 9.4.2).\n const unnamedGroup =\n shown.length > 1 &&\n !inField &&\n rest[\"aria-label\"] === undefined &&\n rest[\"aria-labelledby\"] === undefined;\n const warnedGroupName = useRef(false);\n useEffect(() => {\n if (!isDev || warnedGroupName.current || !unnamedGroup || labelCountRef.current > 0) return;\n warnedGroupName.current = true;\n console.error(\n \"Slider.Root: a slider with several thumbs is a `group` and needs a name: render a \" +\n \"Slider.Label, or pass `aria-label` / `aria-labelledby` to the Root.\",\n );\n }, [unnamedGroup]);\n\n // --- Render --------------------------------------------------------------------------------\n\n const count = shown.length;\n const percents = shown.map((v) => percent(v, min, max));\n const geometry: Record<string, string> = {\n \"--slider-start\": count > 1 ? `${percents[0] ?? 0}%` : \"0%\",\n \"--slider-end\": `${percents[count - 1] ?? 0}%`,\n };\n percents.forEach((p, index) => {\n geometry[`--slider-value-${index}`] = `${p}%`;\n });\n\n const shownValue = fromArray(shown);\n const dragging = gestureThumb !== null;\n const state = useMemo<SliderRootState<T>>(\n () => ({\n value: shownValue,\n values: shown,\n pending,\n dragging,\n orientation,\n disabled,\n min,\n max,\n step,\n }),\n [shownValue, shown, pending, dragging, orientation, disabled, min, max, step],\n );\n\n // Memoised (#48): the functions are stable, so this changes only with the state below.\n const context = useMemo<SliderContextValue>(\n () => ({\n state: state as SliderRootState<SliderValue>,\n shown,\n shownValue: shownValue as SliderValue,\n min,\n max,\n step,\n gap,\n orientation,\n disabled,\n pending,\n draggingThumb: gestureThumb,\n pendingThumb,\n name,\n form,\n getAriaValueText,\n labelId,\n thumbId,\n trackRef,\n inputStep,\n inputCommit,\n inputKeyDown,\n beginGesture,\n registerThumb,\n registerLabel,\n onItemMounted,\n field: fieldWiring,\n }),\n [\n state,\n shown,\n shownValue,\n min,\n max,\n step,\n gap,\n orientation,\n disabled,\n pending,\n gestureThumb,\n pendingThumb,\n name,\n form,\n getAriaValueText,\n labelId,\n thumbId,\n inputStep,\n inputCommit,\n inputKeyDown,\n beginGesture,\n registerThumb,\n registerLabel,\n onItemMounted,\n fieldWiring,\n ],\n );\n\n // Several thumbs: the Field's label, then `Slider.Label` while one is mounted (the consumer's\n // tokens come first through the merge). Only when there is one: an owned `undefined` would\n // remove the consumer's own tokens.\n const labelledBy =\n count > 1 ? mergeTokenLists(fieldLabelledBy, labelCount > 0 ? labelId : undefined) : \"\";\n const libraryProps: Partial<ComponentPropsWithRef<\"div\">> & DataAttributes = {\n role: count > 1 ? \"group\" : undefined,\n ...(labelledBy !== \"\" ? { \"aria-labelledby\": labelledBy } : {}),\n // The group element is described (read when focus enters it); one thumb: its input is.\n ...(count > 1 && fieldDescribedBy !== undefined\n ? { \"aria-describedby\": fieldDescribedBy }\n : {}),\n // Inside a Field only (`aria-invalid` goes on the inputs, never on the group).\n ...(inField ? { \"data-invalid\": fieldDataInvalid } : {}),\n \"data-pending\": dataAttr(pending),\n \"data-dragging\": dataAttr(dragging),\n \"data-orientation\": orientation,\n \"data-disabled\": dataAttr(disabled),\n };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, SliderRootState<T>>({\n defaultElement: \"div\",\n render,\n state,\n className,\n // The geometry properties lose to the consumer's own entries (design 3.1).\n style: (s) => ({ ...(geometry as CSSProperties), ...resolveStateValue(style, s) }),\n children,\n props: rest,\n libraryProps,\n ref: rootRef,\n });\n\n return <SliderContext value={context}>{element}</SliderContext>;\n}\n\nSliderRootImpl.displayName = \"SliderRoot\";\n\n/**\n * `Slider.Root`. Overloaded so that the value's shape is inferred from `value` / `defaultValue`\n * as `number` or `readonly number[]` (an array literal would otherwise infer a mutable\n * `number[]`), and every action and state function receives that shape (design 3.1).\n */\nexport const SliderRoot = SliderRootImpl as {\n (props: SliderRootProps<number>): ReactNode;\n (props: SliderRootProps<readonly number[]>): ReactNode;\n (props: SliderRootProps<SliderValue>): ReactNode;\n displayName?: string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+KA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,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;CACT,IACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAKA,MAAM,aACJ,QAAQ,IAAI,gBAAgB,iBAAiB,aAAa,IAAI,UAAU,KAAA,CAAS,IAAI;CACvF,MAAM,eAAuE;EAC3E,MAAM,QAAQ,IAAI,UAAU,KAAA;EAC5B,GAAI,eAAe,KAAK,EAAE,mBAAmB,WAAW,IAAI,CAAC;EAE7D,GAAI,QAAQ,KAAK,qBAAqB,KAAA,IAClC,EAAE,oBAAoB,iBAAiB,IACvC,CAAC;EAEL,GAAI,UAAU,EAAE,gBAAgB,iBAAiB,IAAI,CAAC;EACtD,gBAAgB,SAAS,OAAO;EAChC,iBAAiB,SAAS,QAAQ;EAClC,oBAAoB;EACpB,iBAAiB,SAAS,QAAQ;CACpC;CAEA,MAAM,UAAU,UAA4D;EAC1E,gBAAgB;EAChB;EACA;EACA;EAEA,QAAQ,OAAO;GAAE,GAAI;GAA4B,GAAG,kBAAkB,OAAO,CAAC;EAAE;EAChF;EACA,OAAO;EACP;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,eAAD;EAAe,OAAO;EAAU,UAAA;CAAuB,CAAA;AAChE;AAEA,eAAe,cAAc;;;;;;AAO7B,MAAa,aAAa"}
|
|
1
|
+
{"version":3,"file":"slider-root.mjs","names":[],"sources":["../../src/slider/slider-root.tsx"],"sourcesContent":["\"use client\";\nimport {\n addTransitionType,\n use,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode, RefObject } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { FieldContext } from \"../internal/field-context.js\";\nimport { mergeTokenLists } from \"../internal/merge-props.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type {\n ActionDetails,\n ChangeAction,\n ChangeReason,\n RenderProp,\n StateValue,\n} from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { useDevWarning } from \"../internal/use-dev-warning.js\";\nimport {\n useFieldControl,\n useFieldValueChange,\n useMergedRef,\n} from \"../internal/use-field-control.js\";\nimport type { FormAssociatedElement } from \"../internal/use-form-reset.js\";\nimport { useLatest } from \"../internal/use-latest.js\";\nimport { useNativeGroupReconciliation } from \"../internal/use-native-group-reconciliation.js\";\nimport { resolveStateValue, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport {\n clampToNeighbours,\n equalValues,\n isMaxReachable,\n isOnGrid,\n nearestThumb,\n percent,\n platformDefault,\n sanitize,\n} from \"./slider-arithmetic.js\";\nimport { SliderContext } from \"./slider-context.js\";\nimport type { SliderContextValue, SliderFieldWiring } from \"./slider-context.js\";\n\n/** One number (one thumb) or one number per thumb, in ascending order. */\nexport type SliderValue = number | readonly number[];\n\nexport type SliderOrientation = \"horizontal\" | \"vertical\";\n\n/** Details passed as the second argument of `Slider.Root`'s `valueChangeAction` (each step). */\nexport interface SliderValueChangeDetails extends ActionDetails {\n /**\n * `\"activate\"`: the user moved a thumb (`details.event` is the native `input` event for a key\n * press, the `pointerdown` / `pointermove` / `pointerup` for a drag, the `keydown` for a\n * JS-normalised key).\n * `\"platform\"`: a form reset (the `reset` event) or a value found in the inputs at mount\n * (`undefined`).\n * `\"dismiss\"`: the commit action rejected and the slider reverted to the committed value\n * (uncontrolled mode; `undefined`).\n */\n readonly reason: ChangeReason;\n /** Index of the thumb that moved; `null` on a platform path or a revert, where several may change. */\n readonly thumb: number | null;\n}\n\n/** Details passed as the second argument of `Slider.Root`'s `valueCommitAction` (each gesture). */\nexport interface SliderValueCommitDetails extends ActionDetails {\n /**\n * `\"activate\"`: a gesture ended (`details.event` is the native `change` event for a key press,\n * the `pointerup` / `pointercancel` / `lostpointercapture` for a drag, the `keydown` for a\n * JS-normalised key). `\"platform\"`: a form reset (the `reset` event) or mount reconciliation\n * (`undefined`). Never `\"dismiss\"`.\n */\n readonly reason: ChangeReason;\n /** Index of the thumb the gesture moved; `null` on a platform path. */\n readonly thumb: number | null;\n}\n\nexport interface SliderRootState<T extends SliderValue = number> {\n /**\n * The value the thumbs show: the value a gesture has reached while a pointer is captured or a\n * step or commit is in flight, else the optimistic value. Content rendered from it must not\n * suspend.\n */\n readonly value: T;\n /** `value` as an array, one entry per thumb, in thumb order. */\n readonly values: readonly number[];\n /** A step or commit dispatched through this Slider is in flight. */\n readonly pending: boolean;\n /** A pointer is captured on a thumb. */\n readonly dragging: boolean;\n readonly orientation: SliderOrientation;\n readonly disabled: boolean;\n readonly min: number;\n readonly max: number;\n readonly step: number;\n}\n\nexport interface SliderRootProps<T extends SliderValue = number> extends Omit<\n ComponentPropsWithRef<\"div\">,\n | \"defaultValue\"\n | \"role\"\n | \"className\"\n | \"style\"\n | \"children\"\n // The value attributes are the native inputs' (design 8): never authored.\n | \"aria-valuemin\"\n | \"aria-valuemax\"\n | \"aria-valuenow\"\n | \"aria-valuetext\"\n | \"aria-orientation\"\n> {\n /** Controlled value: one number, or one per thumb in ascending order. `undefined`: uncontrolled. */\n value?: T;\n /**\n * Initial value in uncontrolled mode; also the form-reset target (latest value). Default: the\n * platform's midpoint, `min + (max - min) / 2`, snapped to `step`.\n */\n defaultValue?: T;\n /**\n * Runs inside the Root's step transition on every step: each pointer move, each key press,\n * each platform change, and the revert after a rejected commit (`reason: \"dismiss\"`,\n * uncontrolled). Awaited; `data-pending` meanwhile (without this action a step starts no\n * transition and is never pending). Adopt the value here in a controlled\n * parent (`setValue(next)` in the sync prefix is a transition update). Not the place for a\n * save: a pending async action entangles every transition in the app, and a drag is many\n * steps. A `setState` after your own `await` needs `startTransition`.\n */\n valueChangeAction?: ChangeAction<T, SliderValueChangeDetails>;\n /**\n * Runs inside the Root's commit transition once per gesture: pointer release, each key press,\n * a form reset, a value found at mount. Awaited; the thumb keeps the gesture's value and shows\n * `data-pending` until it settles; in uncontrolled mode the value is committed when it\n * resolves and reverts to the previous value if it rejects. May be a Server Function.\n */\n valueCommitAction?: ChangeAction<T, SliderValueCommitDetails>;\n /** Default `0`. */\n min?: number;\n /**\n * Default `100`. A `max` that is not on the step grid from `min` is unreachable, as on a\n * native range (dev warning).\n */\n max?: number;\n /** Default `1`. Must be positive. Values snap to `min + n × step`. */\n step?: number;\n /** Minimum number of steps between two adjacent thumbs. Default `0` (thumbs may share a value). */\n minStepsBetweenThumbs?: number;\n /** Default `\"horizontal\"`. Vertical sliders have `min` at the bottom. */\n orientation?: SliderOrientation;\n /**\n * `aria-valuetext` for a thumb, from the value it shows. Set it when the number alone is not\n * meaningful (\"3 of 5 stars\", \"Tuesday\"). Default: none (the number is announced).\n */\n getAriaValueText?: (value: number, index: number) => string;\n /**\n * Form field name for every thumb's input (a Thumb's own `name` wins). With several thumbs,\n * read with `FormData.getAll()`.\n */\n name?: string;\n /** The `form` attribute for every thumb's input (a Thumb's own `form` wins). */\n form?: string;\n /** Disables every input (native `disabled`; not submitted) and the pointer. Never set while pending. */\n disabled?: boolean;\n className?: StateValue<string | undefined, SliderRootState<T>>;\n style?: StateValue<CSSProperties | undefined, SliderRootState<T>>;\n children?: StateValue<ReactNode, SliderRootState<T>>;\n render?: RenderProp<ComponentPropsWithRef<\"div\">, SliderRootState<T>>;\n}\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\nconst STEP_TYPES = transitionTypes(\"slider\", \"change\");\nconst COMMIT_TYPES = transitionTypes(\"slider\", \"commit\");\n\nfunction toArray(value: SliderValue): readonly number[] {\n return typeof value === \"number\" ? [value] : value;\n}\n\nfunction shapeOf(value: SliderValue | undefined): \"number\" | \"array\" | undefined {\n if (value === undefined) return undefined;\n return typeof value === \"number\" ? \"number\" : \"array\";\n}\n\nfunction replaceAt(values: readonly number[], index: number, value: number): readonly number[] {\n return values.map((v, i) => (i === index ? value : v));\n}\n\n/** Writes each registered input's `defaultValue` (the attribute a form reset restores). */\nfunction writeDefaults(\n registry: ReadonlyMap<number, HTMLInputElement>,\n target: readonly number[],\n): void {\n for (const [index, input] of registry) {\n const entry = target[index];\n if (entry !== undefined) input.defaultValue = String(entry);\n }\n}\n\n/** A pointer captured on a Thumb or the Track (design 4.1). */\ninterface ActiveGesture {\n readonly pointerId: number;\n /** Detaches the gesture's listeners. */\n readonly detach: () => void;\n}\n\n/**\n * Owns the slider's state (design/components/slider.md 2): the committed value through\n * `useControllableAction` with `valueCommitAction` (once per gesture), each step through its own\n * transition (`valueChangeAction`), and the value a gesture has reached in the urgent lane\n * (`live`), which the thumbs show while a pointer is captured or anything is in flight. Also the\n * pointer gesture, the Thumb registry, mount reconciliation and form reset, and the geometry\n * custom properties `--slider-start`, `--slider-end` and `--slider-value-<i>`.\n *\n * Owned keys (conventions 1.2): `role` (`\"group\"` with several thumbs), `aria-labelledby` (the\n * Label's id while a Label is mounted and there are several thumbs; token-merged with the\n * consumer's), `data-pending`, `data-dragging`, `data-orientation`, `data-disabled`. The custom\n * properties are merged into `style`, where the consumer's entries win.\n *\n * Inside a `Field.Root` (design 9.4) the Root calls `useFieldControl`: with one thumb, Thumb 0's\n * input is the Field's labelable control; with several, the Root registers itself as the group\n * and also owns the Field label in `aria-labelledby`, the Field's `aria-describedby` and\n * `data-invalid`. `name` / `disabled` default from the Field.\n */\nfunction SliderRootImpl<T extends SliderValue = number>(props: SliderRootProps<T>) {\n const {\n value,\n defaultValue,\n valueChangeAction,\n valueCommitAction,\n min = 0,\n max = 100,\n step: stepProp = 1,\n minStepsBetweenThumbs = 0,\n orientation = \"horizontal\",\n getAriaValueText,\n name: nameProp,\n form,\n disabled: disabledProp = false,\n className,\n style,\n children,\n render,\n ...rest\n } = props;\n\n const stepValid = Number.isFinite(stepProp) && stepProp > 0;\n const step = stepValid ? stepProp : 1;\n const gap = Math.max(0, minStepsBetweenThumbs) * step;\n\n const id = useId();\n const labelId = `${id}-label`;\n\n // The shape (one number or an array) is fixed at mount (design 3.1).\n const [shape] = useState<\"number\" | \"array\">(() => shapeOf(value ?? defaultValue) ?? \"number\");\n const fromArray = useCallback(\n (values: readonly number[]): T => (shape === \"number\" ? values[0] : values) as T,\n [shape],\n );\n\n // --- State (design 2) ----------------------------------------------------------------------\n\n const [live, setLive] = useState<readonly number[] | null>(null);\n const [gestureThumb, setGestureThumb] = useState<number | null>(null);\n /**\n * A step was taken and its gesture's commit has not been dispatched yet. Holds `live` on\n * screen between a key's native `input` and `change` when no step transition runs (no\n * `valueChangeAction`): otherwise react-dom restores the controlled input to the old value\n * after `input`, and Firefox then fires no `change`.\n */\n const [stepHeld, setStepHeld] = useState(false);\n const [pendingThumb, setPendingThumb] = useState<number | null>(null);\n\n /** The value of the latest step, read by the commit in the same or a later event. */\n const liveRef = useRef<readonly number[] | null>(null);\n /** The shown value when the open gesture began; `null` when no gesture is open. */\n const gestureStart = useRef<readonly number[] | null>(null);\n const activeGesture = useRef<ActiveGesture | null>(null);\n const commitSeq = useRef(0);\n const trackRef = useRef<HTMLElement | null>(null);\n\n const runCommit = async (next: T, details: SliderValueCommitDetails): Promise<void> => {\n const seq = ++commitSeq.current;\n try {\n await valueCommitAction?.(next, details);\n } catch (error) {\n // Design 2.4: in uncontrolled mode, tell the preview channel about the rollback, for the\n // latest commit only. Yield once to leave the commit's transition (conventions 2.6).\n if (value === undefined && seq === commitSeq.current) {\n await undefined;\n // `stepTo` and `committedRef` are declared below; this runs long after the render.\n stepTo(toArray(committedRef.current), null, \"dismiss\", undefined);\n }\n throw error;\n }\n };\n\n const commitState = useControllableAction<T, SliderValueCommitDetails>({\n controlled: value,\n defaultValue,\n initialValue: platformDefault(min, max, step) as T,\n action: runCommit,\n transitionTypes: () => COMMIT_TYPES,\n warn: { component: \"Slider.Root\", prop: \"value\" },\n });\n const { optimistic, committed, dispatch } = commitState;\n const committedRef = useLatest(committed);\n\n // A step is not a re-entry: a continuous control dispatches one step per key press or pointer\n // move and every step must run (design/components/button.md 16.1), so no in-flight guard.\n const { pending: stepPending, run: runStep } = useActionTrigger({ ignoreWhilePending: false });\n\n const optimisticValues = useMemo(() => toArray(optimistic), [optimistic]);\n const held = gestureThumb !== null || stepHeld || stepPending || commitState.pending;\n const shown = held && live !== null ? live : optimisticValues;\n const pending = stepPending || commitState.pending;\n\n // --- Inside a Field.Root (design 9.4) ------------------------------------------------------\n\n // One thumb: its input is the Field's labelable control. Several: the Root (`role=\"group\"`)\n // registers, `Field.Label` drops `for` and names the group through `aria-labelledby`.\n const thumbCount = shown.length;\n const field = useFieldControl({\n labelable: thumbCount === 1,\n name: nameProp,\n disabled: disabledProp,\n component: \"Slider.Root\",\n });\n const fieldName = use(FieldContext)?.name;\n const name = field.name;\n const disabled = field.disabled;\n const fieldId = field.id;\n const thumbId = useCallback(\n (index: number) => (index === 0 && fieldId !== undefined ? fieldId : `${id}-thumb-${index}`),\n [id, fieldId],\n );\n const rootRef = useMergedRef<HTMLElement>(undefined, thumbCount > 1 ? field.ref : undefined);\n useDevWarning(\n field.inField && field.required,\n \"Slider.Root: a range is never empty, so `required` on the enclosing Field.Root has no \" +\n \"effect on the slider.\",\n );\n /**\n * The reason of the latest change the user or the platform made, consumed by the Field\n * notification below: `\"activate\"` dismisses a shown server error, a rollback does not.\n */\n const lastReason = useRef<ChangeReason | null>(null);\n // A pointer gesture and the JS-normalised keys fire no `input` / `change` the Field hears:\n // tell it at the commit, when the optimistic value changes (design 9.4.4).\n useFieldValueChange(optimisticValues.join(\"\\u0000\"), () => {\n const edit = lastReason.current === \"activate\";\n lastReason.current = null;\n return edit;\n });\n const {\n \"aria-labelledby\": fieldLabelledBy,\n \"aria-describedby\": fieldDescribedBy,\n \"aria-invalid\": fieldInvalid,\n \"data-invalid\": fieldDataInvalid,\n } = field.attributes;\n const inField = field.inField;\n const fieldRef = field.ref;\n const fieldWiring = useMemo<SliderFieldWiring | null>(() => {\n if (!inField) return null;\n const single = thumbCount === 1;\n return {\n inputRef: single ? fieldRef : undefined,\n describedBy: single ? fieldDescribedBy : undefined,\n invalid: fieldInvalid,\n dataInvalid: fieldDataInvalid,\n name: fieldName,\n };\n }, [inField, fieldRef, thumbCount, fieldDescribedBy, fieldInvalid, fieldDataInvalid, fieldName]);\n\n /** What the thumbs show, for handlers; also written by `stepTo` ahead of the render. */\n const shownRef = useLatest(shown);\n\n const latest = useLatest({\n valueChangeAction,\n fromArray,\n runStep,\n min,\n max,\n step,\n gap,\n orientation,\n disabled,\n });\n\n // --- Step and commit (design 2.4) ---------------------------------------------------------\n\n const stepTo = useCallback(\n (\n next: readonly number[],\n thumb: number | null,\n reason: ChangeReason,\n event: Event | undefined,\n ): boolean => {\n // No-op against what the user sees (conventions 2.3 item 8).\n if (equalValues(next, shownRef.current)) return false;\n liveRef.current = next;\n shownRef.current = next;\n // A controlled parent that adopts steps changes the optimistic value per step.\n lastReason.current = reason;\n setLive(next);\n setPendingThumb(thumb);\n // A revert has no commit after it: the optimistic value already shows the committed one.\n if (reason !== \"dismiss\") setStepHeld(true);\n const { valueChangeAction: action, fromArray: toValue, runStep: run } = latest.current;\n // Without a step action there is nothing to run and no consumer update to keep\n // interruptible: no transition, so `data-pending` does not blink on every pointer move.\n if (action === undefined) return true;\n run(() => {\n for (const type of STEP_TYPES) addTransitionType(type);\n return action?.(toValue(next), createActionDetails(event, { reason, thumb }));\n });\n return true;\n },\n [latest, shownRef],\n );\n\n const commitGesture = useCallback(\n (thumb: number | null, reason: ChangeReason, event: Event | undefined): void => {\n const start = gestureStart.current;\n gestureStart.current = null;\n // The commit's own pending state holds `live` from here (set in this same batch).\n setStepHeld(false);\n const next = liveRef.current;\n // Nothing changed since the gesture began (a drag out and back, a trailing `change`).\n if (start === null || next === null || equalValues(next, start)) return;\n lastReason.current = reason;\n setPendingThumb(thumb);\n dispatch(latest.current.fromArray(next), createActionDetails(event, { reason, thumb }));\n },\n [dispatch, latest],\n );\n\n // --- Thumb registry ------------------------------------------------------------------------\n\n const [registry] = useState(() => new Map<number, HTMLInputElement>());\n const warnedDuplicate = useRef(false);\n const warnedForm = useRef(false);\n const registerThumb = useCallback(\n (index: number, input: HTMLInputElement) => {\n const existing = registry.get(index);\n if (isDev && existing !== undefined && existing !== input && !warnedDuplicate.current) {\n warnedDuplicate.current = true;\n console.error(\n `Slider.Thumb: two Thumbs have \\`index={${index}}\\`. Each value needs exactly one ` +\n `Thumb; give every Thumb a distinct index.`,\n );\n }\n if (isDev && !warnedForm.current) {\n for (const other of registry.values()) {\n if (other !== input && other.form !== input.form) {\n warnedForm.current = true;\n console.error(\n \"Slider.Thumb: the thumbs of one Slider belong to different forms (a Thumb's \" +\n \"`form` prop). A form reset is followed through the first thumb's form only; \" +\n \"keep every thumb in one form.\",\n );\n break;\n }\n }\n }\n registry.set(index, input);\n return () => {\n if (registry.get(index) === input) registry.delete(index);\n };\n },\n [registry],\n );\n\n /** The first registered input: the form-associated element the reset subscription follows. */\n const formElement = useMemo<RefObject<FormAssociatedElement | null>>(\n () => ({\n get current() {\n let first: HTMLInputElement | null = null;\n let firstIndex = Number.POSITIVE_INFINITY;\n for (const [index, input] of registry) {\n if (index < firstIndex) {\n firstIndex = index;\n first = input;\n }\n }\n return first;\n },\n set current(_ignored) {},\n }),\n [registry],\n );\n\n // --- Labels --------------------------------------------------------------------------------\n\n const [labelCount, setLabelCount] = useState(0);\n // The same count for the dev warning, which can run before the re-render the registration\n // scheduled.\n const labelCountRef = useRef(0);\n const registerLabel = useCallback(() => {\n labelCountRef.current += 1;\n setLabelCount((count) => count + 1);\n return () => {\n labelCountRef.current -= 1;\n setLabelCount((count) => count - 1);\n };\n }, []);\n\n // --- Residual browser paths: mount reconciliation and form reset (design 9.2, 9.3) --------\n\n const [mountValue] = useState(value);\n const resetTarget = (): readonly number[] =>\n value !== undefined\n ? toArray(mountValue ?? value)\n : toArray(defaultValue ?? platformDefault(min, max, step));\n\n const readCurrent = (): readonly number[] =>\n shownRef.current.map((v, index) => {\n const input = registry.get(index);\n if (input === undefined) return v;\n const read = Number(input.value);\n return Number.isFinite(read) ? read : v;\n });\n\n const { onItemMounted } = useNativeGroupReconciliation<readonly number[]>({\n element: formElement,\n readCurrent,\n readDefault: resetTarget,\n base: () => shownRef.current,\n // Compare as the DOM would hold the values: a consumer's off-grid value is sanitised by the\n // browser (not by jsdom), and that is not a platform change.\n equals: (a, b) => {\n const reference = shownRef.current;\n return equalValues(\n sanitize(a, reference, min, max, step, gap),\n sanitize(b, reference, min, max, step, gap),\n );\n },\n onPlatformChange: (next, event) => {\n if (next.length !== shownRef.current.length) return;\n const before = shownRef.current;\n gestureStart.current = before;\n liveRef.current = before;\n stepTo(next, null, \"platform\", event);\n commitGesture(null, \"platform\", event);\n },\n onResetEvent: () => {\n // react-dom writes `defaultValue = value` after every update of a controlled input, so the\n // reset target is written here, right before the browser's reset algorithm reads it.\n writeDefaults(registry, resetTarget());\n },\n });\n\n // --- Keyboard (design 4.2) -----------------------------------------------------------------\n\n const inputStep = useCallback(\n (index: number, raw: number, event: Event) => {\n if (!Number.isFinite(raw)) return;\n const before = shownRef.current;\n if (index >= before.length) return;\n // A key press is a one-step gesture: it starts at the value shown before it.\n if (stepTo(replaceAt(before, index, raw), index, \"activate\", event)) {\n if (gestureStart.current === null) gestureStart.current = before;\n }\n },\n [shownRef, stepTo],\n );\n\n const inputCommit = useCallback(\n (index: number, event: Event) => {\n // A pointer gesture commits at its release.\n if (activeGesture.current !== null) return;\n commitGesture(index, \"activate\", event);\n },\n [commitGesture],\n );\n\n const inputKeyDown = useCallback(\n (index: number, event: KeyboardEvent) => {\n const {\n orientation: axis,\n disabled: off,\n min: lo,\n max: hi,\n step: inc,\n gap: g,\n } = latest.current;\n if (off) return;\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return;\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n // Vertical: Firefox decreases a vertical range on ArrowRight; the APG says increase.\n // Horizontal RTL: the track is mirrored (min on the right), so ArrowLeft increases;\n // Chromium and Firefox mirror a native range, WebKit does not (design 7). LTR stays native.\n let increaseKey: \"ArrowLeft\" | \"ArrowRight\";\n if (axis === \"vertical\") {\n increaseKey = \"ArrowRight\";\n } else {\n // Read at the keydown: the direction may come from any ancestor and change at any time.\n const input = event.currentTarget as Element | null;\n if (input === null || getComputedStyle(input).direction !== \"rtl\") return;\n increaseKey = \"ArrowLeft\";\n }\n event.preventDefault();\n const before = shownRef.current;\n const current = before[index];\n if (current === undefined) return;\n const delta = event.key === increaseKey ? inc : -inc;\n const next = replaceAt(\n before,\n index,\n clampToNeighbours(before, index, current + delta, lo, hi, inc, g),\n );\n if (activeGesture.current !== null) {\n stepTo(next, index, \"activate\", event);\n return;\n }\n gestureStart.current = before;\n liveRef.current = before;\n stepTo(next, index, \"activate\", event);\n commitGesture(index, \"activate\", event);\n },\n [commitGesture, latest, shownRef, stepTo],\n );\n\n // --- Pointer (design 4.1) ------------------------------------------------------------------\n\n const warnedNoTrack = useRef(false);\n const beginGesture = useCallback(\n (index: number | null, event: PointerEvent, element: HTMLElement) => {\n const { disabled: off } = latest.current;\n if (off || event.button !== 0 || activeGesture.current !== null) return;\n const track = trackRef.current;\n if (track === null) {\n if (isDev && !warnedNoTrack.current) {\n warnedNoTrack.current = true;\n console.error(\n \"Slider.Thumb: a pointer press needs a Slider.Track to map the pointer to a value. \" +\n \"Without a Track the slider is keyboard-only.\",\n );\n }\n return;\n }\n // No text selection, no focus change through the compatibility `mousedown`.\n event.preventDefault();\n const rtl = getComputedStyle(track).direction === \"rtl\";\n\n const valueAt = (clientX: number, clientY: number): number => {\n const { min: lo, max: hi, orientation: axis } = latest.current;\n const rect = (trackRef.current ?? track).getBoundingClientRect();\n let fraction: number;\n if (axis === \"vertical\") {\n fraction = rect.height > 0 ? (rect.bottom - clientY) / rect.height : 0;\n } else {\n fraction = rect.width > 0 ? (clientX - rect.left) / rect.width : 0;\n if (rtl) fraction = 1 - fraction;\n }\n fraction = Math.min(1, Math.max(0, fraction));\n return lo + fraction * (hi - lo);\n };\n const moveTo = (thumb: number, raw: number, cause: Event): void => {\n const { min: lo, max: hi, step: inc, gap: g } = latest.current;\n const before = shownRef.current;\n if (thumb >= before.length) return;\n stepTo(\n replaceAt(before, thumb, clampToNeighbours(before, thumb, raw, lo, hi, inc, g)),\n thumb,\n \"activate\",\n cause,\n );\n };\n\n const start = valueAt(event.clientX, event.clientY);\n const startValues = shownRef.current;\n // A press on a Thumb that shares its value with a neighbour (stacked thumbs) moves the one\n // that can go toward the pointer, the Track's tie rule; when the press is exactly on the\n // value, the first move decides. Otherwise a Thumb press moves that Thumb.\n let tied: { readonly first: number; readonly last: number; readonly at: number } | null =\n null;\n if (index !== null) {\n const at = startValues[index];\n if (at !== undefined) {\n let first = index;\n let last = index;\n while (first > 0 && equalValues([startValues[first - 1] as number], [at])) first -= 1;\n while (\n last < startValues.length - 1 &&\n equalValues([startValues[last + 1] as number], [at])\n ) {\n last += 1;\n }\n if (first !== last) tied = { first, last, at };\n }\n }\n const resolveTie = (raw: number): number | null => {\n if (tied === null) return null;\n if (raw > tied.at) return tied.last;\n if (raw < tied.at) return tied.first;\n return null;\n };\n /** The thumb the gesture moves; `null` while a press on stacked thumbs is undecided. */\n let decided: number | null =\n index === null ? nearestThumb(startValues, start) : tied ? resolveTie(start) : index;\n /** The thumb shown as dragging and focused meanwhile. */\n let thumb = decided ?? index ?? 0;\n const pointerId = event.pointerId;\n try {\n element.setPointerCapture(pointerId);\n } catch {\n // An inactive pointer id (a synthetic event): the gesture still follows the element.\n }\n\n const decide = (raw: number): boolean => {\n if (decided !== null) return true;\n decided = resolveTie(raw);\n if (decided === null) return false;\n if (decided !== thumb) {\n thumb = decided;\n setGestureThumb(thumb);\n registry.get(thumb)?.focus({ focusVisible: false } as FocusOptions);\n }\n return true;\n };\n const follow = (pointerEvent: PointerEvent): void => {\n const raw = valueAt(pointerEvent.clientX, pointerEvent.clientY);\n if (decide(raw)) moveTo(thumb, raw, pointerEvent);\n };\n\n const onMove = (moveEvent: PointerEvent): void => {\n if (moveEvent.pointerId !== pointerId) return;\n follow(moveEvent);\n };\n const onEnd = (endEvent: PointerEvent): void => {\n if (endEvent.pointerId !== pointerId) return;\n detach();\n // The release position is the gesture's last (an engine may coalesce the final move\n // into the `pointerup`); a cancel or a lost capture keeps the last move's value.\n if (endEvent.type === \"pointerup\") follow(endEvent);\n activeGesture.current = null;\n setGestureThumb(null);\n commitGesture(thumb, \"activate\", endEvent);\n };\n const detach = (): void => {\n element.removeEventListener(\"pointermove\", onMove);\n element.removeEventListener(\"pointerup\", onEnd);\n element.removeEventListener(\"pointercancel\", onEnd);\n element.removeEventListener(\"lostpointercapture\", onEnd);\n };\n element.addEventListener(\"pointermove\", onMove);\n element.addEventListener(\"pointerup\", onEnd);\n element.addEventListener(\"pointercancel\", onEnd);\n element.addEventListener(\"lostpointercapture\", onEnd);\n\n activeGesture.current = { pointerId, detach };\n setGestureThumb(thumb);\n gestureStart.current = shownRef.current;\n liveRef.current = shownRef.current;\n // A capture alone holds `live` on screen: start it from what is shown, not from the value\n // an earlier gesture left behind (a press exactly on the current value steps nothing).\n setLive(shownRef.current);\n // `:focus-visible` does not match after a pointer press, as on a native range.\n registry.get(thumb)?.focus({ focusVisible: false } as FocusOptions);\n if (decided !== null) moveTo(thumb, start, event);\n },\n [commitGesture, latest, registry, shownRef, stepTo],\n );\n\n // An unmount mid-gesture leaves no listener behind.\n useEffect(\n () => () => {\n activeGesture.current?.detach();\n activeGesture.current = null;\n },\n [],\n );\n\n // --- Development warnings ------------------------------------------------------------------\n\n useDevWarning(\n !stepValid,\n `Slider.Root: \\`step\\` must be a positive number (got ${String(stepProp)}); using 1.`,\n );\n useDevWarning(\n stepValid && !isMaxReachable(min, max, step),\n `Slider.Root: \\`max\\` (${max}) is not on the step grid from \\`min\\` (${min}) with \\`step\\` ` +\n `${step}: it is unreachable, as on a native range. The last reachable value is the last ` +\n `step below \\`max\\`.`,\n );\n const given = value ?? defaultValue;\n const givenValues = given === undefined ? [] : toArray(given);\n useDevWarning(\n givenValues.some((v) => !isOnGrid(v, min, max, step)),\n `Slider.Root: the ${value !== undefined ? \"`value`\" : \"`defaultValue`\"} ` +\n `(${givenValues.join(\", \")}) is off the step grid or outside \\`min\\` / \\`max\\`. It is ` +\n `rendered as given and the browser sanitises it; the first user step snaps it.`,\n );\n useDevWarning(\n givenValues.some((v, i) => i > 0 && v < (givenValues[i - 1] as number)),\n `Slider.Root: the values (${givenValues.join(\", \")}) must be in ascending order; the thumbs ` +\n `would be rendered crossed.`,\n );\n const currentShape = shapeOf(given);\n useDevWarning(\n currentShape !== undefined && currentShape !== shape,\n `Slider.Root: the value changed shape between a number and an array after mount. The shape ` +\n `is fixed at mount; remount the Slider (a \\`key\\`) to change the number of thumbs.`,\n );\n // Inside a Field, `Field.Label` names the group (design 9.4.2).\n const unnamedGroup =\n shown.length > 1 &&\n !inField &&\n rest[\"aria-label\"] === undefined &&\n rest[\"aria-labelledby\"] === undefined;\n const warnedGroupName = useRef(false);\n useEffect(() => {\n if (!isDev || warnedGroupName.current || !unnamedGroup || labelCountRef.current > 0) return;\n warnedGroupName.current = true;\n console.error(\n \"Slider.Root: a slider with several thumbs is a `group` and needs a name: render a \" +\n \"Slider.Label, or pass `aria-label` / `aria-labelledby` to the Root.\",\n );\n }, [unnamedGroup]);\n\n // --- Render --------------------------------------------------------------------------------\n\n const count = shown.length;\n const percents = shown.map((v) => percent(v, min, max));\n const geometry: Record<string, string> = {\n \"--slider-start\": count > 1 ? `${percents[0] ?? 0}%` : \"0%\",\n \"--slider-end\": `${percents[count - 1] ?? 0}%`,\n };\n percents.forEach((p, index) => {\n geometry[`--slider-value-${index}`] = `${p}%`;\n });\n\n const shownValue = fromArray(shown);\n const dragging = gestureThumb !== null;\n const state = useMemo<SliderRootState<T>>(\n () => ({\n value: shownValue,\n values: shown,\n pending,\n dragging,\n orientation,\n disabled,\n min,\n max,\n step,\n }),\n [shownValue, shown, pending, dragging, orientation, disabled, min, max, step],\n );\n\n // Memoised (#48): the functions are stable, so this changes only with the state below.\n const context = useMemo<SliderContextValue>(\n () => ({\n state: state as SliderRootState<SliderValue>,\n shown,\n shownValue: shownValue as SliderValue,\n min,\n max,\n step,\n gap,\n orientation,\n disabled,\n pending,\n draggingThumb: gestureThumb,\n pendingThumb,\n name,\n form,\n getAriaValueText,\n labelId,\n thumbId,\n trackRef,\n inputStep,\n inputCommit,\n inputKeyDown,\n beginGesture,\n registerThumb,\n registerLabel,\n onItemMounted,\n field: fieldWiring,\n }),\n [\n state,\n shown,\n shownValue,\n min,\n max,\n step,\n gap,\n orientation,\n disabled,\n pending,\n gestureThumb,\n pendingThumb,\n name,\n form,\n getAriaValueText,\n labelId,\n thumbId,\n inputStep,\n inputCommit,\n inputKeyDown,\n beginGesture,\n registerThumb,\n registerLabel,\n onItemMounted,\n fieldWiring,\n ],\n );\n\n // Several thumbs: the Field's label, then `Slider.Label` while one is mounted (the consumer's\n // tokens come first through the merge). Only when there is one: an owned `undefined` would\n // remove the consumer's own tokens.\n const labelledBy =\n count > 1 ? mergeTokenLists(fieldLabelledBy, labelCount > 0 ? labelId : undefined) : \"\";\n const libraryProps: Partial<ComponentPropsWithRef<\"div\">> & DataAttributes = {\n role: count > 1 ? \"group\" : undefined,\n ...(labelledBy !== \"\" ? { \"aria-labelledby\": labelledBy } : {}),\n // The group element is described (read when focus enters it); one thumb: its input is.\n ...(count > 1 && fieldDescribedBy !== undefined\n ? { \"aria-describedby\": fieldDescribedBy }\n : {}),\n // Inside a Field only (`aria-invalid` goes on the inputs, never on the group).\n ...(inField ? { \"data-invalid\": fieldDataInvalid } : {}),\n \"data-pending\": dataAttr(pending),\n \"data-dragging\": dataAttr(dragging),\n \"data-orientation\": orientation,\n \"data-disabled\": dataAttr(disabled),\n };\n\n const element = useRender<ComponentPropsWithRef<\"div\">, SliderRootState<T>>({\n defaultElement: \"div\",\n render,\n state,\n className,\n // The geometry properties lose to the consumer's own entries (design 3.1).\n style: (s) => ({ ...(geometry as CSSProperties), ...resolveStateValue(style, s) }),\n children,\n props: rest,\n libraryProps,\n ref: rootRef,\n });\n\n return <SliderContext value={context}>{element}</SliderContext>;\n}\n\nSliderRootImpl.displayName = \"SliderRoot\";\n\n/**\n * `Slider.Root`. Overloaded so that the value's shape is inferred from `value` / `defaultValue`\n * as `number` or `readonly number[]` (an array literal would otherwise infer a mutable\n * `number[]`), and every action and state function receives that shape (design 3.1).\n */\nexport const SliderRoot = SliderRootImpl as {\n (props: SliderRootProps<number>): ReactNode;\n (props: SliderRootProps<readonly number[]>): ReactNode;\n (props: SliderRootProps<SliderValue>): ReactNode;\n displayName?: string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA+KA,MAAM,QAAQ,QAAQ,IAAI,aAAa;AAEvC,MAAM,aAAa,gBAAgB,UAAU,QAAQ;AACrD,MAAM,eAAe,gBAAgB,UAAU,QAAQ;AAEvD,SAAS,QAAQ,OAAuC;CACtD,OAAO,OAAO,UAAU,WAAW,CAAC,KAAK,IAAI;AAC/C;AAEA,SAAS,QAAQ,OAAgE;CAC/E,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;CAChC,OAAO,OAAO,UAAU,WAAW,WAAW;AAChD;AAEA,SAAS,UAAU,QAA2B,OAAe,OAAkC;CAC7F,OAAO,OAAO,KAAK,GAAG,MAAO,MAAM,QAAQ,QAAQ,CAAE;AACvD;;AAGA,SAAS,cACP,UACA,QACM;CACN,KAAK,MAAM,CAAC,OAAO,UAAU,UAAU;EACrC,MAAM,QAAQ,OAAO;EACrB,IAAI,UAAU,KAAA,GAAW,MAAM,eAAe,OAAO,KAAK;CAC5D;AACF;;;;;;;;;;;;;;;;;;;AA2BA,SAAS,eAA+C,OAA2B;CACjF,MAAM,EACJ,OACA,cACA,mBACA,mBACA,MAAM,GACN,MAAM,KACN,MAAM,WAAW,GACjB,wBAAwB,GACxB,cAAc,cACd,kBACA,MAAM,UACN,MACA,UAAU,eAAe,OACzB,WACA,OACA,UACA,QAC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O;EACP;EACA,KAAK;CACP,CAAC;CAED,OAAO,oBAAC,eAAD;EAAe,OAAO;EAAU,UAAA;CAAuB,CAAA;AAChE;AAEA,eAAe,cAAc;;;;;;AAO7B,MAAa,aAAa"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
|
+
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
3
4
|
import { mergeRefs, mergeTokenLists } from "../internal/merge-props.mjs";
|
|
4
5
|
import { resolveStateValue } from "../internal/render-element.mjs";
|
|
5
6
|
import { useRender } from "../internal/use-render.mjs";
|
|
6
|
-
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
7
7
|
import { useSliderContext } from "./slider-context.mjs";
|
|
8
8
|
import { percent, thumbBounds } from "./slider-arithmetic.mjs";
|
|
9
9
|
import { useEffectEvent, useLayoutEffect, useMemo, useRef } from "react";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useRender } from "../internal/use-render.mjs";
|
|
3
2
|
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
3
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
4
4
|
import { useSliderContext } from "./slider-context.mjs";
|
|
5
5
|
//#region src/slider/slider-value.tsx
|
|
6
6
|
/**
|
package/dist/switch/switch.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
3
2
|
import { createActionDetails } from "../internal/action-details.mjs";
|
|
4
3
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
4
|
+
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
5
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
5
6
|
import { transitionTypes } from "../internal/transition-types.mjs";
|
|
6
7
|
import { useControllableAction } from "../internal/use-controllable-action.mjs";
|
|
7
|
-
import { useRender } from "../internal/use-render.mjs";
|
|
8
8
|
import { fieldInputProps, useFieldControl, useFieldValueChange, useMergedRef } from "../internal/use-field-control.mjs";
|
|
9
9
|
import { guardCheckableChange, useNativeChecked } from "../internal/use-native-checked.mjs";
|
|
10
10
|
//#region src/switch/switch.tsx
|
package/dist/tabs/tabs-list.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
|
-
import { useRender } from "../internal/use-render.mjs";
|
|
4
3
|
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
4
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
5
5
|
import { TabsListContext, useTabsContext } from "./tabs-context.mjs";
|
|
6
6
|
import { useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
package/dist/tabs/tabs-panel.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
3
2
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
|
+
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
4
4
|
import { useRender } from "../internal/use-render.mjs";
|
|
5
5
|
import { useTabsContext } from "./tabs-context.mjs";
|
|
6
6
|
import { panelId, tabId } from "./tabs-ids.mjs";
|
package/dist/tabs/tabs-root.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createActionDetails } from "../internal/action-details.mjs";
|
|
3
3
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
4
|
+
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
5
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
4
6
|
import { transitionTypes } from "../internal/transition-types.mjs";
|
|
5
7
|
import { useControllableAction } from "../internal/use-controllable-action.mjs";
|
|
6
|
-
import { useRender } from "../internal/use-render.mjs";
|
|
7
|
-
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
8
8
|
import { TabsContext } from "./tabs-context.mjs";
|
|
9
9
|
import { tabId } from "./tabs-ids.mjs";
|
|
10
10
|
import { useId, useMemo, useRef } from "react";
|
package/dist/tabs/tabs-tab.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
3
2
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
|
+
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
4
4
|
import { rendersButton, resolveStateValue } from "../internal/render-element.mjs";
|
|
5
5
|
import { useRender } from "../internal/use-render.mjs";
|
|
6
6
|
import { TabsListContext, useTabsContext } from "./tabs-context.mjs";
|
|
@@ -26,10 +26,11 @@ export interface ToastActionProps extends Omit<ComponentPropsWithRef<"button">,
|
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* The toast's action button (Undo, Retry, View): a `button type="button"` whose `action` runs as
|
|
29
|
-
* a transition. Renders nothing when neither the part nor the toast has an action. Never
|
|
30
|
-
* while pending
|
|
29
|
+
* a transition. Renders nothing when neither the part nor the toast has an action. Never natively
|
|
30
|
+
* disabled while pending: a second click meanwhile is ignored and the Action is `aria-disabled`.
|
|
31
31
|
*
|
|
32
|
-
* Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`, `
|
|
32
|
+
* Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`, `aria-disabled`,
|
|
33
|
+
* `data-pending`.
|
|
33
34
|
*/
|
|
34
35
|
export declare function ToastAction({ action, closeOnSettle, children, className, style, render, ...rest }: ToastActionProps): ReactNode;
|
|
35
36
|
export declare namespace ToastAction {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast-action.d.mts","names":[],"sources":["../../src/toast/toast-action.tsx"],"mappings":";;;;iBAYiB;;WAEN;WACA,OAAO;;iBAGD,yBAAyB,KACxC;;;;;;;;EAUA,SAAS,QAAQ,SAAS;;EAE1B;;EAEA,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,iCAAiC
|
|
1
|
+
{"version":3,"file":"toast-action.d.mts","names":[],"sources":["../../src/toast/toast-action.tsx"],"mappings":";;;;iBAYiB;;WAEN;WACA,OAAO;;iBAGD,yBAAyB,KACxC;;;;;;;;EAUA,SAAS,QAAQ,SAAS;;EAE1B;;EAEA,WAAW,WAAW,WAAW;EACjC,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;EAC9C,SAAS,WAAW,iCAAiC;;;;;;;;;;wBAWvC,cACd,QACA,eACA,UACA,WACA,OACA,WACG,QACF,mBAAgB;yBARH"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createActionDetails } from "../internal/action-details.mjs";
|
|
3
3
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
4
|
+
import { useActionTrigger } from "../internal/use-action-trigger.mjs";
|
|
4
5
|
import { rendersButton } from "../internal/render-element.mjs";
|
|
5
6
|
import { useRender } from "../internal/use-render.mjs";
|
|
6
|
-
import { useActionTrigger } from "../internal/use-action-trigger.mjs";
|
|
7
7
|
import { useToastRootContext } from "./toast-context.mjs";
|
|
8
8
|
import { useLayoutEffect, useState } from "react";
|
|
9
9
|
//#region src/toast/toast-action.tsx
|
|
10
10
|
/**
|
|
11
11
|
* The toast's action button (Undo, Retry, View): a `button type="button"` whose `action` runs as
|
|
12
|
-
* a transition. Renders nothing when neither the part nor the toast has an action. Never
|
|
13
|
-
* while pending
|
|
12
|
+
* a transition. Renders nothing when neither the part nor the toast has an action. Never natively
|
|
13
|
+
* disabled while pending: a second click meanwhile is ignored and the Action is `aria-disabled`.
|
|
14
14
|
*
|
|
15
|
-
* Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`, `
|
|
15
|
+
* Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`, `aria-disabled`,
|
|
16
|
+
* `data-pending`.
|
|
16
17
|
*/
|
|
17
18
|
function ToastAction({ action, closeOnSettle = true, children, className, style, render, ...rest }) {
|
|
18
19
|
const root = useToastRootContext("Toast.Action");
|
|
@@ -37,13 +38,14 @@ function ToastAction({ action, closeOnSettle = true, children, className, style,
|
|
|
37
38
|
if (effective === void 0 || rest.disabled === true) return;
|
|
38
39
|
const native = event.nativeEvent;
|
|
39
40
|
const details = createActionDetails(native, { id: root.toast.id });
|
|
40
|
-
run(() => effective(details), () => {
|
|
41
|
+
if (!run(() => effective(details), () => {
|
|
41
42
|
if (closeOnSettle) root.close("activate", native);
|
|
42
|
-
});
|
|
43
|
+
})) event.preventDefault();
|
|
43
44
|
};
|
|
44
45
|
const libraryProps = {
|
|
45
46
|
...rendersButton(render) && { type: "button" },
|
|
46
47
|
onClick,
|
|
48
|
+
"aria-disabled": pending ? true : void 0,
|
|
47
49
|
"data-pending": dataAttr(pending)
|
|
48
50
|
};
|
|
49
51
|
const element = useRender({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toast-action.mjs","names":[],"sources":["../../src/toast/toast-action.tsx"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { Action, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport type { ToastActionDetails, ToastItem } from \"./toast.js\";\nimport { useToastRootContext } from \"./toast-context.js\";\n\nexport interface ToastActionState {\n /** This part's action is in flight. */\n readonly pending: boolean;\n readonly toast: ToastItem;\n}\n\nexport interface ToastActionProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Runs in this part's own transition: `data-pending` on the Action and the Root, the toast's\n * timer paused. When it resolves the toast closes with `reason: \"activate\"` (unless\n * `closeOnSettle` is `false`); a rejection keeps the toast and reaches the nearest Error\n * Boundary above the Viewport. A caught error counts as success and closes the toast: rethrow\n * after `toast.update`, or use `closeOnSettle={false}`. Default: the toast's `action.action`.\n */\n action?: Action<[details: ToastActionDetails]>;\n /** Close the toast when the action resolves. Default `true`. */\n closeOnSettle?: boolean;\n /** Default: the toast's `action.label`. */\n children?: StateValue<ReactNode, ToastActionState>;\n className?: StateValue<string | undefined, ToastActionState>;\n style?: StateValue<CSSProperties | undefined, ToastActionState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, ToastActionState>;\n}\n\n/**\n * The toast's action button (Undo, Retry, View): a `button type=\"button\"` whose `action` runs as\n * a transition. Renders nothing when neither the part nor the toast has an action. Never
|
|
1
|
+
{"version":3,"file":"toast-action.mjs","names":[],"sources":["../../src/toast/toast-action.tsx"],"sourcesContent":["\"use client\";\nimport { useLayoutEffect, useState } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, MouseEvent, ReactNode } from \"react\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport type { Action, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useActionTrigger } from \"../internal/use-action-trigger.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\nimport type { DataAttributes } from \"../internal/use-render.js\";\nimport type { ToastActionDetails, ToastItem } from \"./toast.js\";\nimport { useToastRootContext } from \"./toast-context.js\";\n\nexport interface ToastActionState {\n /** This part's action is in flight. */\n readonly pending: boolean;\n readonly toast: ToastItem;\n}\n\nexport interface ToastActionProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"className\" | \"style\" | \"children\"\n> {\n /**\n * Runs in this part's own transition: `data-pending` on the Action and the Root, the toast's\n * timer paused. When it resolves the toast closes with `reason: \"activate\"` (unless\n * `closeOnSettle` is `false`); a rejection keeps the toast and reaches the nearest Error\n * Boundary above the Viewport. A caught error counts as success and closes the toast: rethrow\n * after `toast.update`, or use `closeOnSettle={false}`. Default: the toast's `action.action`.\n */\n action?: Action<[details: ToastActionDetails]>;\n /** Close the toast when the action resolves. Default `true`. */\n closeOnSettle?: boolean;\n /** Default: the toast's `action.label`. */\n children?: StateValue<ReactNode, ToastActionState>;\n className?: StateValue<string | undefined, ToastActionState>;\n style?: StateValue<CSSProperties | undefined, ToastActionState>;\n render?: RenderProp<ComponentPropsWithRef<\"button\">, ToastActionState>;\n}\n\n/**\n * The toast's action button (Undo, Retry, View): a `button type=\"button\"` whose `action` runs as\n * a transition. Renders nothing when neither the part nor the toast has an action. Never natively\n * disabled while pending: a second click meanwhile is ignored and the Action is `aria-disabled`.\n *\n * Owned keys (conventions 1.2): `type` (on a `<button>` only), `onClick`, `aria-disabled`,\n * `data-pending`.\n */\nexport function ToastAction({\n action,\n closeOnSettle = true,\n children,\n className,\n style,\n render,\n ...rest\n}: ToastActionProps) {\n const root = useToastRootContext(\"Toast.Action\");\n const { pending, run } = useActionTrigger();\n const [token] = useState(() => ({}));\n const effective = action ?? root.toast.action?.action;\n const { setActionPending } = root;\n\n // The Root (and through it the Viewport's timer) sees this part's pending state.\n useLayoutEffect(() => {\n if (!pending) return;\n setActionPending(token, true);\n return () => setActionPending(token, false);\n }, [pending, setActionPending, token]);\n\n const state: ToastActionState = { pending, toast: root.toast };\n\n const onClick = (event: MouseEvent<HTMLElement>): void => {\n if (effective === undefined || rest.disabled === true) return;\n const native = event.nativeEvent;\n const details = createActionDetails(native, { id: root.toast.id });\n // A second click while this Action's own run is in flight starts nothing and is cancelled\n // (the hook's guard, #81): one Undo, one Retry.\n const started = run(\n () => effective(details),\n () => {\n // Closing is idempotent: a dismissal meanwhile already closed it.\n if (closeOnSettle) root.close(\"activate\", native);\n },\n );\n if (!started) event.preventDefault();\n };\n\n const libraryProps: ComponentPropsWithRef<\"button\"> & DataAttributes = {\n ...(rendersButton(render) && { type: \"button\" as const }),\n onClick,\n // Exactly while `data-pending` (#81). Owned, so an idle Action removes a render element's own.\n \"aria-disabled\": pending ? true : undefined,\n \"data-pending\": dataAttr(pending),\n };\n\n const element = useRender<ComponentPropsWithRef<\"button\">, ToastActionState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children: children ?? root.toast.action?.label,\n props: rest,\n libraryProps,\n });\n return effective === undefined ? null : element;\n}\n\nToastAction.displayName = \"ToastAction\";\n"],"mappings":";;;;;;;;;;;;;;;;;AA+CA,SAAgB,YAAY,EAC1B,QACA,gBAAgB,MAChB,UACA,WACA,OACA,QACA,GAAG,QACgB;CACnB,MAAM,OAAO,oBAAoB,cAAc;CAC/C,MAAM,EAAE,SAAS,QAAQ,iBAAiB;CAC1C,MAAM,CAAC,SAAS,gBAAgB,CAAC,EAAE;CACnC,MAAM,YAAY,UAAU,KAAK,MAAM,QAAQ;CAC/C,MAAM,EAAE,qBAAqB;CAG7B,sBAAsB;EACpB,IAAI,CAAC,SAAS;EACd,iBAAiB,OAAO,IAAI;EAC5B,aAAa,iBAAiB,OAAO,KAAK;CAC5C,GAAG;EAAC;EAAS;EAAkB;CAAK,CAAC;CAErC,MAAM,QAA0B;EAAE;EAAS,OAAO,KAAK;CAAM;CAE7D,MAAM,WAAW,UAAyC;EACxD,IAAI,cAAc,KAAA,KAAa,KAAK,aAAa,MAAM;EACvD,MAAM,SAAS,MAAM;EACrB,MAAM,UAAU,oBAAoB,QAAQ,EAAE,IAAI,KAAK,MAAM,GAAG,CAAC;EAUjE,IAAI,CAPY,UACR,UAAU,OAAO,SACjB;GAEJ,IAAI,eAAe,KAAK,MAAM,YAAY,MAAM;EAClD,CAES,GAAG,MAAM,eAAe;CACrC;CAEA,MAAM,eAAiE;EACrE,GAAI,cAAc,MAAM,KAAK,EAAE,MAAM,SAAkB;EACvD;EAEA,iBAAiB,UAAU,OAAO,KAAA;EAClC,gBAAgB,SAAS,OAAO;CAClC;CAEA,MAAM,UAAU,UAA6D;EAC3E,gBAAgB;EAChB;EACA;EACA;EACA;EACA,UAAU,YAAY,KAAK,MAAM,QAAQ;EACzC,OAAO;EACP;CACF,CAAC;CACD,OAAO,cAAc,KAAA,IAAY,OAAO;AAC1C;AAEA,YAAY,cAAc"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
3
|
-
import { useLatest } from "../internal/use-latest.mjs";
|
|
4
3
|
import { resolveStateValue } from "../internal/render-element.mjs";
|
|
5
4
|
import { useRender } from "../internal/use-render.mjs";
|
|
5
|
+
import { useLatest } from "../internal/use-latest.mjs";
|
|
6
6
|
import { exitAnimations } from "../internal/use-exit-animation.mjs";
|
|
7
7
|
import { ToastRootContext, useToastRootContext, useToastViewportContext } from "./toast-context.mjs";
|
|
8
8
|
import { Suspense, useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createActionDetails } from "../internal/action-details.mjs";
|
|
3
3
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
4
|
-
import { useLatest } from "../internal/use-latest.mjs";
|
|
5
|
-
import { useRender } from "../internal/use-render.mjs";
|
|
6
4
|
import { useDevWarning } from "../internal/use-dev-warning.mjs";
|
|
5
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
6
|
+
import { useLatest } from "../internal/use-latest.mjs";
|
|
7
7
|
import { DialogContext } from "../dialog/dialog-context.mjs";
|
|
8
8
|
import { animationBaseline } from "../internal/use-exit-animation.mjs";
|
|
9
9
|
import { getServerTopmostModal, getTopmostModal, subscribeModals } from "../internal/modal-registry.mjs";
|
|
10
10
|
import { ToastViewportContext } from "./toast-context.mjs";
|
|
11
11
|
import { toast, toastManagerInternals } from "./toast.mjs";
|
|
12
12
|
import { use, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
|
|
13
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
13
|
import { createPortal } from "react-dom";
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
//#region src/toast/toast-viewport.tsx
|
|
16
16
|
const isDev = process.env.NODE_ENV !== "production";
|
|
17
17
|
const DEFAULT_HOTKEY = ["F8"];
|
package/dist/toggle/toggle.d.mts
CHANGED
|
@@ -24,7 +24,10 @@ export interface ToggleProps extends Omit<ComponentPropsWithRef<"button">, "onCl
|
|
|
24
24
|
* `startTransition` (React limitation).
|
|
25
25
|
*/
|
|
26
26
|
pressedChangeAction?: ChangeAction<boolean, TogglePressedChangeDetails>;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Never dispatches. Native `disabled` on a `<button>`; with a link or component `render`,
|
|
29
|
+
* `aria-disabled="true"` instead (the element stays focusable). Default `false`.
|
|
30
|
+
*/
|
|
28
31
|
disabled?: boolean;
|
|
29
32
|
/**
|
|
30
33
|
* Forwarded as `default` to the Toggle's `<ViewTransition>`. Default: no boundary. Animates the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.d.mts","names":[],"sources":["../../src/toggle/toggle.tsx"],"mappings":";;;iBAgBiB;;WAEN;;WAEA;;WAEA;;;iBAIM,mCAAmC;iBAKnC,oBAAoB,KACnC;;EAIA;;EAEA;;;;;;;;EAQA,sBAAsB,sBAAsB
|
|
1
|
+
{"version":3,"file":"toggle.d.mts","names":[],"sources":["../../src/toggle/toggle.tsx"],"mappings":";;;iBAgBiB;;WAEN;;WAEA;;WAEA;;;iBAIM,mCAAmC;iBAKnC,oBAAoB,KACnC;;EAIA;;EAEA;;;;;;;;EAQA,sBAAsB,sBAAsB;;;;;EAK5C;;;;;;;;;;;EAWA,aAAa;EACb,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;wBAQvC,SACd,SACA,gBACA,qBACA,UACA,YACA,WACA,OACA,UACA,WACG,QACF,cAAW;yBAXE"}
|
package/dist/toggle/toggle.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
3
2
|
import { createActionDetails } from "../internal/action-details.mjs";
|
|
4
3
|
import { dataAttr } from "../internal/data-attr.mjs";
|
|
4
|
+
import { useTransitionBoundary } from "../internal/transition-boundary.mjs";
|
|
5
|
+
import { isHostButton, rendersButton } from "../internal/render-element.mjs";
|
|
6
|
+
import { useRender } from "../internal/use-render.mjs";
|
|
5
7
|
import { transitionTypes } from "../internal/transition-types.mjs";
|
|
6
8
|
import { useControllableAction } from "../internal/use-controllable-action.mjs";
|
|
7
|
-
import { rendersButton } from "../internal/render-element.mjs";
|
|
8
|
-
import { useRender } from "../internal/use-render.mjs";
|
|
9
9
|
//#region src/toggle/toggle.tsx
|
|
10
10
|
/**
|
|
11
11
|
* A two-state button (WAI-ARIA "Button" pattern, toggle variant). Renders
|
|
@@ -24,14 +24,16 @@ function Toggle({ pressed, defaultPressed, pressedChangeAction, disabled = false
|
|
|
24
24
|
prop: "pressed"
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
const state = {
|
|
28
|
+
pressed: optimistic,
|
|
29
|
+
pending,
|
|
30
|
+
disabled
|
|
31
|
+
};
|
|
32
|
+
const focusable = !isHostButton(render);
|
|
27
33
|
const element = useRender({
|
|
28
34
|
defaultElement: "button",
|
|
29
35
|
render,
|
|
30
|
-
state
|
|
31
|
-
pressed: optimistic,
|
|
32
|
-
pending,
|
|
33
|
-
disabled
|
|
34
|
-
},
|
|
36
|
+
state,
|
|
35
37
|
className,
|
|
36
38
|
style,
|
|
37
39
|
children,
|
|
@@ -40,13 +42,17 @@ function Toggle({ pressed, defaultPressed, pressedChangeAction, disabled = false
|
|
|
40
42
|
type: "button"
|
|
41
43
|
} : rest,
|
|
42
44
|
libraryProps: {
|
|
43
|
-
disabled,
|
|
45
|
+
disabled: focusable ? void 0 : disabled,
|
|
46
|
+
...focusable && { "aria-disabled": disabled ? true : void 0 },
|
|
44
47
|
"aria-pressed": optimistic,
|
|
45
48
|
"data-pressed": dataAttr(optimistic),
|
|
46
49
|
"data-pending": dataAttr(pending),
|
|
47
50
|
"data-disabled": dataAttr(disabled),
|
|
48
51
|
onClick: (event) => {
|
|
49
|
-
if (disabled)
|
|
52
|
+
if (disabled) {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
50
56
|
dispatch(!optimistic, createActionDetails(event.nativeEvent, {}));
|
|
51
57
|
}
|
|
52
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.mjs","names":[],"sources":["../../src/toggle/toggle.tsx"],"sourcesContent":["\"use client\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n MouseEvent,\n ReactNode,\n ViewTransitionClass,\n} from \"react\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type { ActionDetails, ChangeAction, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { rendersButton, useRender } from \"../internal/use-render.js\";\n\nexport interface ToggleState {\n /** Optimistic pressed state: what the user sees, including an in-flight change. */\n readonly pressed: boolean;\n /** An action dispatched by this Toggle is in flight (including the resulting render). */\n readonly pending: boolean;\n /** The `disabled` prop. */\n readonly disabled: boolean;\n}\n\n/** Details passed as the second argument of `pressedChangeAction`. */\nexport interface TogglePressedChangeDetails extends ActionDetails {\n // v0 adds nothing beyond `event`; the interface exists so fields can be added without a\n // breaking change (e.g. a `reason` if a ToggleGroup ever dispatches on an item's behalf).\n}\n\nexport interface ToggleProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"type\" | \"aria-pressed\" | \"className\" | \"style\" | \"children\"\n> {\n /** Controlled pressed state. `undefined` means uncontrolled. */\n pressed?: boolean;\n /** Initial pressed state in uncontrolled mode. Default `false`. */\n defaultPressed?: boolean;\n /**\n * Called with the next pressed state on every user-initiated change. Runs inside the Toggle's\n * transition; may be sync or async. Rejections reach the nearest Error Boundary.\n *\n * A `setState` placed after your own `await` is not a Transition update; wrap it in\n * `startTransition` (React limitation).\n */\n pressedChangeAction?: ChangeAction<boolean, TogglePressedChangeDetails>;\n
|
|
1
|
+
{"version":3,"file":"toggle.mjs","names":[],"sources":["../../src/toggle/toggle.tsx"],"sourcesContent":["\"use client\";\nimport type {\n ComponentPropsWithRef,\n CSSProperties,\n MouseEvent,\n ReactNode,\n ViewTransitionClass,\n} from \"react\";\nimport { useTransitionBoundary } from \"../internal/transition-boundary.js\";\nimport { createActionDetails } from \"../internal/action-details.js\";\nimport { dataAttr } from \"../internal/data-attr.js\";\nimport { transitionTypes } from \"../internal/transition-types.js\";\nimport type { ActionDetails, ChangeAction, RenderProp, StateValue } from \"../internal/types.js\";\nimport { useControllableAction } from \"../internal/use-controllable-action.js\";\nimport { isHostButton, rendersButton, useRender } from \"../internal/use-render.js\";\n\nexport interface ToggleState {\n /** Optimistic pressed state: what the user sees, including an in-flight change. */\n readonly pressed: boolean;\n /** An action dispatched by this Toggle is in flight (including the resulting render). */\n readonly pending: boolean;\n /** The `disabled` prop. */\n readonly disabled: boolean;\n}\n\n/** Details passed as the second argument of `pressedChangeAction`. */\nexport interface TogglePressedChangeDetails extends ActionDetails {\n // v0 adds nothing beyond `event`; the interface exists so fields can be added without a\n // breaking change (e.g. a `reason` if a ToggleGroup ever dispatches on an item's behalf).\n}\n\nexport interface ToggleProps extends Omit<\n ComponentPropsWithRef<\"button\">,\n \"onClick\" | \"type\" | \"aria-pressed\" | \"className\" | \"style\" | \"children\"\n> {\n /** Controlled pressed state. `undefined` means uncontrolled. */\n pressed?: boolean;\n /** Initial pressed state in uncontrolled mode. Default `false`. */\n defaultPressed?: boolean;\n /**\n * Called with the next pressed state on every user-initiated change. Runs inside the Toggle's\n * transition; may be sync or async. Rejections reach the nearest Error Boundary.\n *\n * A `setState` placed after your own `await` is not a Transition update; wrap it in\n * `startTransition` (React limitation).\n */\n pressedChangeAction?: ChangeAction<boolean, TogglePressedChangeDetails>;\n /**\n * Never dispatches. Native `disabled` on a `<button>`; with a link or component `render`,\n * `aria-disabled=\"true\"` instead (the element stays focusable). Default `false`.\n */\n disabled?: boolean;\n /**\n * Forwarded as `default` to the Toggle's `<ViewTransition>`. Default: no boundary. Animates the\n * commit that ends an action (and rollbacks), not the optimistic flip itself; animate the flip\n * with a CSS `transition` on `[data-pressed]`.\n *\n * Static: without `transition` the part renders no `<ViewTransition>`; changing it between\n * `undefined` and a value remounts the element. Any value, `\"none\"` included, makes a mount or\n * `<Activity>` reveal of this part inside a transition start a document view transition: the\n * page cross-fades for about 250 ms and the next transition commit waits for it (issue #35).\n */\n transition?: ViewTransitionClass;\n className?: StateValue<string | undefined, ToggleState>;\n style?: StateValue<CSSProperties | undefined, ToggleState>;\n /** Rendered from optimistic state inside the button; must not suspend. */\n children?: StateValue<ReactNode, ToggleState>;\n /** Replace the rendered element (element form) or take over rendering (function form). */\n render?: RenderProp<ComponentPropsWithRef<\"button\">, ToggleState>;\n}\n\n/**\n * A two-state button (WAI-ARIA \"Button\" pattern, toggle variant). Renders\n * `<button type=\"button\" aria-pressed>`; the pressed state flips optimistically and the element\n * carries `data-pending` while `pressedChangeAction` is in flight.\n */\nexport function Toggle({\n pressed,\n defaultPressed,\n pressedChangeAction,\n disabled = false,\n transition,\n className,\n style,\n children,\n render,\n ...rest\n}: ToggleProps) {\n const { optimistic, pending, dispatch } = useControllableAction<\n boolean,\n TogglePressedChangeDetails\n >({\n controlled: pressed,\n defaultValue: defaultPressed,\n initialValue: false,\n action: pressedChangeAction,\n transitionTypes: (next) => transitionTypes(\"toggle\", next ? \"press\" : \"release\"),\n warn: { component: \"Toggle\", prop: \"pressed\" },\n });\n\n const state: ToggleState = { pressed: optimistic, pending, disabled };\n // Not a host <button> (a link, a component): native `disabled` would mean nothing to a link and\n // hide the state from AT, so `aria-disabled`; the click handler enforces it (#83).\n const focusable = !isHostButton(render);\n\n const element = useRender<ComponentPropsWithRef<\"button\">, ToggleState>({\n defaultElement: \"button\",\n render,\n state,\n className,\n style,\n children,\n // Pass-through layer: a `render` element's own props win over these (its `type` included).\n // `type=\"button\"` only on a real button; an `<a>` or a component element does not get it.\n props: rendersButton(render) ? { ...rest, type: \"button\" } : rest,\n // Library-controlled layer: wins over a `render` element's props.\n libraryProps: {\n // Owned so that native disabledness, `data-disabled` and the click guard always agree: a\n // `render` element cannot re-enable (`disabled={false}`) or disable the button on its own.\n // `undefined` (not `false`) in the focusable branch, so a render element's own is removed.\n disabled: focusable ? undefined : disabled,\n // Owned only in the focusable branch: a host button keeps a consumer's own.\n ...(focusable && { \"aria-disabled\": disabled ? true : undefined }),\n \"aria-pressed\": optimistic,\n \"data-pressed\": dataAttr(optimistic),\n \"data-pending\": dataAttr(pending),\n \"data-disabled\": dataAttr(disabled),\n onClick: (event: MouseEvent<HTMLButtonElement>) => {\n // Native buttons do not fire `click` when disabled; the guard covers `render` elements\n // that do not honour `disabled` (a link must not navigate either).\n if (disabled) {\n event.preventDefault();\n return;\n }\n dispatch(!optimistic, createActionDetails(event.nativeEvent, {}));\n },\n },\n });\n\n return useTransitionBoundary(\"Toggle\", transition, element);\n}\n\nToggle.displayName = \"Toggle\";\n"],"mappings":";;;;;;;;;;;;;;AA4EA,SAAgB,OAAO,EACrB,SACA,gBACA,qBACA,WAAW,OACX,YACA,WACA,OACA,UACA,QACA,GAAG,QACW;CACd,MAAM,EAAE,YAAY,SAAS,aAAa,sBAGxC;EACA,YAAY;EACZ,cAAc;EACd,cAAc;EACd,QAAQ;EACR,kBAAkB,SAAS,gBAAgB,UAAU,OAAO,UAAU,SAAS;EAC/E,MAAM;GAAE,WAAW;GAAU,MAAM;EAAU;CAC/C,CAAC;CAED,MAAM,QAAqB;EAAE,SAAS;EAAY;EAAS;CAAS;CAGpE,MAAM,YAAY,CAAC,aAAa,MAAM;CAEtC,MAAM,UAAU,UAAwD;EACtE,gBAAgB;EAChB;EACA;EACA;EACA;EACA;EAGA,OAAO,cAAc,MAAM,IAAI;GAAE,GAAG;GAAM,MAAM;EAAS,IAAI;EAE7D,cAAc;GAIZ,UAAU,YAAY,KAAA,IAAY;GAElC,GAAI,aAAa,EAAE,iBAAiB,WAAW,OAAO,KAAA,EAAU;GAChE,gBAAgB;GAChB,gBAAgB,SAAS,UAAU;GACnC,gBAAgB,SAAS,OAAO;GAChC,iBAAiB,SAAS,QAAQ;GAClC,UAAU,UAAyC;IAGjD,IAAI,UAAU;KACZ,MAAM,eAAe;KACrB;IACF;IACA,SAAS,CAAC,YAAY,oBAAoB,MAAM,aAAa,CAAC,CAAC,CAAC;GAClE;EACF;CACF,CAAC;CAED,OAAO,sBAAsB,UAAU,YAAY,OAAO;AAC5D;AAEA,OAAO,cAAc"}
|
|
@@ -14,7 +14,11 @@ export interface ToggleGroupItemState {
|
|
|
14
14
|
export interface ToggleGroupItemProps extends Omit<ComponentPropsWithRef<"button">, "onClick" | "type" | "value" | "tabIndex" | "aria-pressed" | "className" | "style" | "children"> {
|
|
15
15
|
/** The value this Item presses. Unique within the group. */
|
|
16
16
|
value: string;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Never dispatches. Native `disabled` on a `<button>` (skipped by the arrow keys); with a link
|
|
19
|
+
* or component `render`, `aria-disabled="true"` instead: the element stays focusable and the
|
|
20
|
+
* arrow keys reach it (the APG Toolbar behaviour).
|
|
21
|
+
*/
|
|
18
22
|
disabled?: boolean;
|
|
19
23
|
/**
|
|
20
24
|
* Forwarded as `default` to the Item's `<ViewTransition>`. As on Toggle: animates the commit
|
|
@@ -36,7 +40,7 @@ export interface ToggleGroupItemProps extends Omit<ComponentPropsWithRef<"button
|
|
|
36
40
|
* by the roving engine (the group's, or the enclosing Toolbar's).
|
|
37
41
|
*
|
|
38
42
|
* Owned keys (conventions 1.2): `type` (on a `<button>` only), `aria-pressed`, `disabled`,
|
|
39
|
-
* `data-pressed`, `data-pending`, `data-disabled`, `data-orientation`, `onClick`, and
|
|
43
|
+
* `aria-disabled` (link or component `render`), `data-pressed`, `data-pending`, `data-disabled`, `data-orientation`, `onClick`, and
|
|
40
44
|
* `focusgroupstart` while the Root renders `focusgroup`.
|
|
41
45
|
*/
|
|
42
46
|
export declare function ToggleGroupItem({ value, disabled: disabledProp, transition, className, style, children, render, ...rest }: ToggleGroupItemProps): ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-group-item.d.mts","names":[],"sources":["../../src/toggle-group/toggle-group-item.tsx"],"mappings":";;;;iBAgBiB;;WAEN;;WAEA;;WAEA;WACA,aAAa;;iBAGP,6BAA6B,KAC5C;;EAIA
|
|
1
|
+
{"version":3,"file":"toggle-group-item.d.mts","names":[],"sources":["../../src/toggle-group/toggle-group-item.tsx"],"mappings":";;;;iBAgBiB;;WAEN;;WAEA;;WAEA;WACA,aAAa;;iBAGP,6BAA6B,KAC5C;;EAIA;;;;;;EAMA;;;;;;;EAOA,aAAa;EACb,YAAY,+BAA+B;EAC3C,QAAQ,WAAW,2BAA2B;;EAE9C,WAAW,WAAW,WAAW;;EAEjC,SAAS,WAAW,iCAAiC;;;;;;;;;;;wBAYvC,kBACd,OACA,UAAU,cACV,YACA,WACA,OACA,UACA,WACG,QACF,uBAAoB;yBATP"}
|