@funstack/ui 0.1.0-alpha.1 → 0.1.0-alpha.3
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-context.mjs.map +1 -1
- package/dist/accordion/accordion-item.mjs +18 -4
- package/dist/accordion/accordion-item.mjs.map +1 -1
- package/dist/accordion/accordion-panel.mjs +2 -3
- package/dist/accordion/accordion-panel.mjs.map +1 -1
- package/dist/accordion/accordion-root.d.mts.map +1 -1
- package/dist/accordion/accordion-root.mjs +32 -14
- package/dist/accordion/accordion-root.mjs.map +1 -1
- package/dist/accordion/accordion-trigger.mjs +4 -5
- package/dist/accordion/accordion-trigger.mjs.map +1 -1
- package/dist/checkbox/checkbox.d.mts +5 -3
- package/dist/checkbox/checkbox.d.mts.map +1 -1
- package/dist/checkbox/checkbox.mjs +25 -9
- package/dist/checkbox/checkbox.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-context.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.d.mts +2 -1
- package/dist/checkbox-group/checkbox-group-item.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-item.mjs +3 -1
- package/dist/checkbox-group/checkbox-group-item.mjs.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.d.mts +5 -2
- package/dist/checkbox-group/checkbox-group-root.d.mts.map +1 -1
- package/dist/checkbox-group/checkbox-group-root.mjs +24 -5
- package/dist/checkbox-group/checkbox-group-root.mjs.map +1 -1
- package/dist/combobox/combobox-clear.d.mts +34 -0
- package/dist/combobox/combobox-clear.d.mts.map +1 -0
- package/dist/combobox/combobox-clear.mjs +58 -0
- package/dist/combobox/combobox-clear.mjs.map +1 -0
- package/dist/combobox/combobox-context.mjs +23 -0
- package/dist/combobox/combobox-context.mjs.map +1 -0
- package/dist/combobox/combobox-group.d.mts +72 -0
- package/dist/combobox/combobox-group.d.mts.map +1 -0
- package/dist/combobox/combobox-group.mjs +104 -0
- package/dist/combobox/combobox-group.mjs.map +1 -0
- package/dist/combobox/combobox-input.d.mts +42 -0
- package/dist/combobox/combobox-input.d.mts.map +1 -0
- package/dist/combobox/combobox-input.mjs +102 -0
- package/dist/combobox/combobox-input.mjs.map +1 -0
- package/dist/combobox/combobox-label.d.mts +22 -0
- package/dist/combobox/combobox-label.d.mts.map +1 -0
- package/dist/combobox/combobox-label.mjs +32 -0
- package/dist/combobox/combobox-label.mjs.map +1 -0
- package/dist/combobox/combobox-list.d.mts +37 -0
- package/dist/combobox/combobox-list.d.mts.map +1 -0
- package/dist/combobox/combobox-list.mjs +70 -0
- package/dist/combobox/combobox-list.mjs.map +1 -0
- package/dist/combobox/combobox-option.d.mts +45 -0
- package/dist/combobox/combobox-option.d.mts.map +1 -0
- package/dist/combobox/combobox-option.mjs +88 -0
- package/dist/combobox/combobox-option.mjs.map +1 -0
- package/dist/combobox/combobox-popup.d.mts +49 -0
- package/dist/combobox/combobox-popup.d.mts.map +1 -0
- package/dist/combobox/combobox-popup.mjs +86 -0
- package/dist/combobox/combobox-popup.mjs.map +1 -0
- package/dist/combobox/combobox-root.d.mts +135 -0
- package/dist/combobox/combobox-root.d.mts.map +1 -0
- package/dist/combobox/combobox-root.mjs +523 -0
- package/dist/combobox/combobox-root.mjs.map +1 -0
- package/dist/combobox/combobox-trigger.d.mts +36 -0
- package/dist/combobox/combobox-trigger.d.mts.map +1 -0
- package/dist/combobox/combobox-trigger.mjs +92 -0
- package/dist/combobox/combobox-trigger.mjs.map +1 -0
- package/dist/combobox/index.d.mts +36 -0
- package/dist/combobox/index.d.mts.map +1 -0
- package/dist/combobox/index.mjs +36 -0
- package/dist/combobox/index.mjs.map +1 -0
- package/dist/dialog/dialog-close.d.mts +17 -10
- package/dist/dialog/dialog-close.d.mts.map +1 -1
- package/dist/dialog/dialog-close.mjs +31 -20
- package/dist/dialog/dialog-close.mjs.map +1 -1
- package/dist/dialog/dialog-context.mjs.map +1 -1
- package/dist/dialog/dialog-form.d.mts +12 -5
- package/dist/dialog/dialog-form.d.mts.map +1 -1
- package/dist/dialog/dialog-form.mjs +16 -28
- package/dist/dialog/dialog-form.mjs.map +1 -1
- package/dist/dialog/dialog-popup.d.mts +10 -4
- package/dist/dialog/dialog-popup.d.mts.map +1 -1
- package/dist/dialog/dialog-popup.mjs +106 -41
- package/dist/dialog/dialog-popup.mjs.map +1 -1
- package/dist/dialog/dialog-root.d.mts +14 -8
- package/dist/dialog/dialog-root.d.mts.map +1 -1
- package/dist/dialog/dialog-root.mjs +66 -11
- package/dist/dialog/dialog-root.mjs.map +1 -1
- package/dist/dialog/dialog-trigger.d.mts +3 -2
- package/dist/dialog/dialog-trigger.d.mts.map +1 -1
- package/dist/dialog/dialog-trigger.mjs.map +1 -1
- package/dist/dialog/index.d.mts +4 -2
- package/dist/dialog/index.d.mts.map +1 -1
- package/dist/dialog/index.mjs +4 -2
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/field/field-control.d.mts +33 -0
- package/dist/field/field-control.d.mts.map +1 -0
- package/dist/field/field-control.mjs +68 -0
- package/dist/field/field-control.mjs.map +1 -0
- package/dist/field/field-description.d.mts +24 -0
- package/dist/field/field-description.d.mts.map +1 -0
- package/dist/field/field-description.mjs +34 -0
- package/dist/field/field-description.mjs.map +1 -0
- package/dist/field/field-error.d.mts +30 -0
- package/dist/field/field-error.d.mts.map +1 -0
- package/dist/field/field-error.mjs +42 -0
- package/dist/field/field-error.mjs.map +1 -0
- package/dist/field/field-label.d.mts +25 -0
- package/dist/field/field-label.d.mts.map +1 -0
- package/dist/field/field-label.mjs +46 -0
- package/dist/field/field-label.mjs.map +1 -0
- package/dist/field/field-root.d.mts +53 -0
- package/dist/field/field-root.d.mts.map +1 -0
- package/dist/field/field-root.mjs +317 -0
- package/dist/field/field-root.mjs.map +1 -0
- package/dist/field/index.d.mts +18 -0
- package/dist/field/index.d.mts.map +1 -0
- package/dist/field/index.mjs +17 -0
- package/dist/field/index.mjs.map +1 -0
- package/dist/form/form-root.d.mts +58 -0
- package/dist/form/form-root.d.mts.map +1 -0
- package/dist/form/form-root.mjs +146 -0
- package/dist/form/form-root.mjs.map +1 -0
- package/dist/form/form-submit.d.mts +31 -0
- package/dist/form/form-submit.d.mts.map +1 -0
- package/dist/form/form-submit.mjs +52 -0
- package/dist/form/form-submit.mjs.map +1 -0
- package/dist/form/index.d.mts +11 -0
- package/dist/form/index.d.mts.map +1 -0
- package/dist/form/index.mjs +11 -0
- package/dist/form/index.mjs.map +1 -0
- package/dist/index.d.mts +46 -2
- package/dist/index.mjs +8 -1
- package/dist/internal/content-focus-probe.mjs +42 -0
- package/dist/internal/content-focus-probe.mjs.map +1 -0
- package/dist/internal/field-context.d.mts +19 -0
- package/dist/internal/field-context.d.mts.map +1 -0
- package/dist/internal/field-context.mjs +14 -0
- package/dist/internal/field-context.mjs.map +1 -0
- package/dist/internal/focus-first-invalid.mjs +67 -0
- package/dist/internal/focus-first-invalid.mjs.map +1 -0
- package/dist/internal/form-status-watcher.mjs +31 -0
- package/dist/internal/form-status-watcher.mjs.map +1 -0
- package/dist/internal/modal-registry.mjs +39 -0
- package/dist/internal/modal-registry.mjs.map +1 -0
- package/dist/internal/platform-attributes.d.mts +12 -1
- package/dist/internal/platform-attributes.d.mts.map +1 -1
- package/dist/internal/types.d.mts +11 -1
- package/dist/internal/types.d.mts.map +1 -1
- package/dist/internal/use-controllable-action.mjs +35 -13
- package/dist/internal/use-controllable-action.mjs.map +1 -1
- package/dist/internal/use-field-control.mjs +107 -0
- package/dist/internal/use-field-control.mjs.map +1 -0
- package/dist/internal/use-form-owner-event.mjs +44 -0
- package/dist/internal/use-form-owner-event.mjs.map +1 -0
- package/dist/internal/use-form-reset.mjs +12 -31
- package/dist/internal/use-form-reset.mjs.map +1 -1
- package/dist/internal/use-hydrated-mount.mjs +21 -0
- package/dist/internal/use-hydrated-mount.mjs.map +1 -0
- package/dist/internal/use-latest.mjs +32 -0
- package/dist/internal/use-latest.mjs.map +1 -0
- package/dist/internal/use-modal-registration.mjs +47 -0
- package/dist/internal/use-modal-registration.mjs.map +1 -0
- package/dist/internal/use-native-group-reconciliation.mjs +6 -5
- package/dist/internal/use-native-group-reconciliation.mjs.map +1 -1
- package/dist/internal/use-native-select-value.mjs +184 -0
- package/dist/internal/use-native-select-value.mjs.map +1 -0
- package/dist/internal/use-popover-popup.mjs +8 -22
- package/dist/internal/use-popover-popup.mjs.map +1 -1
- package/dist/internal/use-popover-root.mjs +58 -23
- package/dist/internal/use-popover-root.mjs.map +1 -1
- package/dist/internal/validity.d.mts +24 -0
- package/dist/internal/validity.d.mts.map +1 -0
- package/dist/internal/validity.mjs +108 -0
- package/dist/internal/validity.mjs.map +1 -0
- package/dist/menu/menu-group.d.mts.map +1 -1
- package/dist/menu/menu-group.mjs +3 -2
- package/dist/menu/menu-group.mjs.map +1 -1
- package/dist/menu/menu-radio-group.mjs +9 -4
- package/dist/menu/menu-radio-group.mjs.map +1 -1
- package/dist/menu/menu-root.mjs.map +1 -1
- package/dist/radio-group/radio-group-root.d.mts +4 -2
- package/dist/radio-group/radio-group-root.d.mts.map +1 -1
- package/dist/radio-group/radio-group-root.mjs +34 -8
- package/dist/radio-group/radio-group-root.mjs.map +1 -1
- package/dist/select/index.d.mts +30 -0
- package/dist/select/index.d.mts.map +1 -0
- package/dist/select/index.mjs +30 -0
- package/dist/select/index.mjs.map +1 -0
- package/dist/select/select-context.mjs +13 -0
- package/dist/select/select-context.mjs.map +1 -0
- package/dist/select/select-dom.mjs +44 -0
- package/dist/select/select-dom.mjs.map +1 -0
- package/dist/select/select-group-label.d.mts +22 -0
- package/dist/select/select-group-label.d.mts.map +1 -0
- package/dist/select/select-group-label.mjs +39 -0
- package/dist/select/select-group-label.mjs.map +1 -0
- package/dist/select/select-group.d.mts +28 -0
- package/dist/select/select-group.d.mts.map +1 -0
- package/dist/select/select-group.mjs +47 -0
- package/dist/select/select-group.mjs.map +1 -0
- package/dist/select/select-option.d.mts +42 -0
- package/dist/select/select-option.d.mts.map +1 -0
- package/dist/select/select-option.mjs +65 -0
- package/dist/select/select-option.mjs.map +1 -0
- package/dist/select/select-root.d.mts +68 -0
- package/dist/select/select-root.d.mts.map +1 -0
- package/dist/select/select-root.mjs +114 -0
- package/dist/select/select-root.mjs.map +1 -0
- package/dist/select/select-separator.d.mts +20 -0
- package/dist/select/select-separator.d.mts.map +1 -0
- package/dist/select/select-separator.mjs +30 -0
- package/dist/select/select-separator.mjs.map +1 -0
- package/dist/select/select-trigger.d.mts +29 -0
- package/dist/select/select-trigger.d.mts.map +1 -0
- package/dist/select/select-trigger.mjs +48 -0
- package/dist/select/select-trigger.mjs.map +1 -0
- package/dist/select/select-value.d.mts +31 -0
- package/dist/select/select-value.d.mts.map +1 -0
- package/dist/select/select-value.mjs +101 -0
- package/dist/select/select-value.mjs.map +1 -0
- package/dist/slider/index.d.mts +32 -0
- package/dist/slider/index.d.mts.map +1 -0
- package/dist/slider/index.mjs +27 -0
- package/dist/slider/index.mjs.map +1 -0
- package/dist/slider/slider-arithmetic.mjs +120 -0
- package/dist/slider/slider-arithmetic.mjs.map +1 -0
- package/dist/slider/slider-context.mjs +13 -0
- package/dist/slider/slider-context.mjs.map +1 -0
- package/dist/slider/slider-indicator.d.mts +22 -0
- package/dist/slider/slider-indicator.d.mts.map +1 -0
- package/dist/slider/slider-indicator.mjs +36 -0
- package/dist/slider/slider-indicator.mjs.map +1 -0
- package/dist/slider/slider-label.d.mts +23 -0
- package/dist/slider/slider-label.d.mts.map +1 -0
- package/dist/slider/slider-label.mjs +44 -0
- package/dist/slider/slider-label.mjs.map +1 -0
- package/dist/slider/slider-root.d.mts +111 -0
- package/dist/slider/slider-root.d.mts.map +1 -0
- package/dist/slider/slider-root.mjs +582 -0
- package/dist/slider/slider-root.mjs.map +1 -0
- package/dist/slider/slider-thumb.d.mts +58 -0
- package/dist/slider/slider-thumb.d.mts.map +1 -0
- package/dist/slider/slider-thumb.mjs +145 -0
- package/dist/slider/slider-thumb.mjs.map +1 -0
- package/dist/slider/slider-track.d.mts +29 -0
- package/dist/slider/slider-track.d.mts.map +1 -0
- package/dist/slider/slider-track.mjs +54 -0
- package/dist/slider/slider-track.mjs.map +1 -0
- package/dist/slider/slider-value.d.mts +34 -0
- package/dist/slider/slider-value.d.mts.map +1 -0
- package/dist/slider/slider-value.mjs +38 -0
- package/dist/slider/slider-value.mjs.map +1 -0
- package/dist/switch/switch.d.mts +5 -3
- package/dist/switch/switch.d.mts.map +1 -1
- package/dist/switch/switch.mjs +24 -8
- package/dist/switch/switch.mjs.map +1 -1
- package/dist/tabs/tabs-root.mjs +13 -3
- package/dist/tabs/tabs-root.mjs.map +1 -1
- package/dist/toast/index.d.mts +25 -0
- package/dist/toast/index.d.mts.map +1 -0
- package/dist/toast/index.mjs +26 -0
- package/dist/toast/index.mjs.map +1 -0
- package/dist/toast/toast-action.d.mts +39 -0
- package/dist/toast/toast-action.d.mts.map +1 -0
- package/dist/toast/toast-action.mjs +64 -0
- package/dist/toast/toast-action.mjs.map +1 -0
- package/dist/toast/toast-close.d.mts +25 -0
- package/dist/toast/toast-close.d.mts.map +1 -0
- package/dist/toast/toast-close.mjs +46 -0
- package/dist/toast/toast-close.mjs.map +1 -0
- package/dist/toast/toast-context.mjs +19 -0
- package/dist/toast/toast-context.mjs.map +1 -0
- package/dist/toast/toast-description.d.mts +24 -0
- package/dist/toast/toast-description.d.mts.map +1 -0
- package/dist/toast/toast-description.mjs +35 -0
- package/dist/toast/toast-description.mjs.map +1 -0
- package/dist/toast/toast-root.d.mts +43 -0
- package/dist/toast/toast-root.d.mts.map +1 -0
- package/dist/toast/toast-root.mjs +204 -0
- package/dist/toast/toast-root.mjs.map +1 -0
- package/dist/toast/toast-title.d.mts +24 -0
- package/dist/toast/toast-title.d.mts.map +1 -0
- package/dist/toast/toast-title.mjs +33 -0
- package/dist/toast/toast-title.mjs.map +1 -0
- package/dist/toast/toast-viewport.d.mts +52 -0
- package/dist/toast/toast-viewport.d.mts.map +1 -0
- package/dist/toast/toast-viewport.mjs +621 -0
- package/dist/toast/toast-viewport.mjs.map +1 -0
- package/dist/toast/toast.d.mts +119 -0
- package/dist/toast/toast.d.mts.map +1 -0
- package/dist/toast/toast.mjs +153 -0
- package/dist/toast/toast.mjs.map +1 -0
- package/package.json +7 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider-label.mjs","names":[],"sources":["../../src/slider/slider-label.tsx"],"sourcesContent":["\"use client\";\nimport { useCallback, useLayoutEffect, useRef } from \"react\";\nimport type { ComponentPropsWithRef, CSSProperties, ReactNode } from \"react\";\nimport type { RenderProp, StateValue } from \"../internal/types.js\";\nimport { useRender } from \"../internal/use-render.js\";\nimport { useSliderContext } from \"./slider-context.js\";\nimport type { SliderRootState, SliderValue } from \"./slider-root.js\";\n\nconst isDev = process.env.NODE_ENV !== \"production\";\n\n/** `T` defaults to `SliderValue`; pass it to narrow the state (`<Slider.Label<number>>`). */\nexport interface SliderLabelProps<T extends SliderValue = SliderValue> extends Omit<\n ComponentPropsWithRef<\"label\">,\n \"htmlFor\" | \"id\" | \"className\" | \"style\" | \"children\"\n> {\n className?: StateValue<string | undefined, SliderRootState<T>>;\n style?: StateValue<CSSProperties | undefined, SliderRootState<T>>;\n children?: StateValue<ReactNode, SliderRootState<T>>;\n /** Must stay a `<label>` when the slider has one thumb (the `for` association). */\n render?: RenderProp<ComponentPropsWithRef<\"label\">, SliderRootState<T>>;\n}\n\n/**\n * The visible name of the slider: `<label for>` naming the only thumb's input, or, with several\n * thumbs, the element whose `id` the Root's `aria-labelledby` (`role=\"group\"`) points at, emitted\n * only while a Label is mounted. Owned keys: `id`, `htmlFor`.\n */\nexport function SliderLabel<T extends SliderValue = SliderValue>({\n className,\n style,\n children,\n render,\n ...rest\n}: SliderLabelProps<T>) {\n const ctx = useSliderContext(\"Slider.Label\");\n const { registerLabel } = ctx;\n useLayoutEffect(registerLabel, [registerLabel]);\n\n const single = ctx.shown.length === 1;\n const warnedElement = useRef(false);\n const libraryRef = useCallback(\n (element: HTMLElement) => {\n if (isDev && single && !warnedElement.current && element.tagName !== \"LABEL\") {\n warnedElement.current = true;\n console.error(\n `Slider.Label: expected a <label> element but got <${element.tagName.toLowerCase()}>. ` +\n `With one thumb the Label names the input through \\`for\\`, which only a <label> has.`,\n );\n }\n // A cleanup, so the ref is never called with `null`.\n return () => {};\n },\n [single],\n );\n\n return useRender<ComponentPropsWithRef<\"label\">, SliderRootState<T>>({\n defaultElement: \"label\",\n render,\n state: ctx.state as SliderRootState<T>,\n className,\n style,\n children,\n props: rest,\n ref: libraryRef,\n libraryProps: {\n id: ctx.labelId,\n htmlFor: single ? ctx.thumbId(0) : undefined,\n },\n });\n}\n\nSliderLabel.displayName = \"SliderLabel\";\n"],"mappings":";;;;;AAQA,MAAM,QAAQ,QAAQ,IAAI,aAAa;;;;;;AAmBvC,SAAgB,YAAiD,EAC/D,WACA,OACA,UACA,QACA,GAAG,QACmB;CACtB,MAAM,MAAM,iBAAiB,cAAc;CAC3C,MAAM,EAAE,kBAAkB;CAC1B,gBAAgB,eAAe,CAAC,aAAa,CAAC;CAE9C,MAAM,SAAS,IAAI,MAAM,WAAW;CACpC,MAAM,gBAAgB,OAAO,KAAK;CAClC,MAAM,aAAa,aAChB,YAAyB;EACxB,IAAI,SAAS,UAAU,CAAC,cAAc,WAAW,QAAQ,YAAY,SAAS;GAC5E,cAAc,UAAU;GACxB,QAAQ,MACN,qDAAqD,QAAQ,QAAQ,YAAY,EAAE,uFAErF;EACF;EAEA,aAAa,CAAC;CAChB,GACA,CAAC,MAAM,CACT;CAEA,OAAO,UAA8D;EACnE,gBAAgB;EAChB;EACA,OAAO,IAAI;EACX;EACA;EACA;EACA,OAAO;EACP,KAAK;EACL,cAAc;GACZ,IAAI,IAAI;GACR,SAAS,SAAS,IAAI,QAAQ,CAAC,IAAI,KAAA;EACrC;CACF,CAAC;AACH;AAEA,YAAY,cAAc"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { ActionDetails, ChangeAction, ChangeReason, RenderProp, StateValue } from "../internal/types.mjs";
|
|
2
|
+
import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
//#region src/slider/slider-root.d.ts
|
|
4
|
+
/** One number (one thumb) or one number per thumb, in ascending order. */
|
|
5
|
+
export type SliderValue = number | readonly number[];
|
|
6
|
+
export type SliderOrientation = "horizontal" | "vertical";
|
|
7
|
+
/** Details passed as the second argument of `Slider.Root`'s `valueChangeAction` (each step). */
|
|
8
|
+
export interface SliderValueChangeDetails extends ActionDetails {
|
|
9
|
+
/**
|
|
10
|
+
* `"activate"`: the user moved a thumb (`details.event` is the native `input` event for a key
|
|
11
|
+
* press, the `pointerdown` / `pointermove` / `pointerup` for a drag, the `keydown` for a
|
|
12
|
+
* JS-normalised key).
|
|
13
|
+
* `"platform"`: a form reset (the `reset` event) or a value found in the inputs at mount
|
|
14
|
+
* (`undefined`).
|
|
15
|
+
* `"dismiss"`: the commit action rejected and the slider reverted to the committed value
|
|
16
|
+
* (uncontrolled mode; `undefined`).
|
|
17
|
+
*/
|
|
18
|
+
readonly reason: ChangeReason;
|
|
19
|
+
/** Index of the thumb that moved; `null` on a platform path or a revert, where several may change. */
|
|
20
|
+
readonly thumb: number | null;
|
|
21
|
+
}
|
|
22
|
+
/** Details passed as the second argument of `Slider.Root`'s `valueCommitAction` (each gesture). */
|
|
23
|
+
export interface SliderValueCommitDetails extends ActionDetails {
|
|
24
|
+
/**
|
|
25
|
+
* `"activate"`: a gesture ended (`details.event` is the native `change` event for a key press,
|
|
26
|
+
* the `pointerup` / `pointercancel` / `lostpointercapture` for a drag, the `keydown` for a
|
|
27
|
+
* JS-normalised key). `"platform"`: a form reset (the `reset` event) or mount reconciliation
|
|
28
|
+
* (`undefined`). Never `"dismiss"`.
|
|
29
|
+
*/
|
|
30
|
+
readonly reason: ChangeReason;
|
|
31
|
+
/** Index of the thumb the gesture moved; `null` on a platform path. */
|
|
32
|
+
readonly thumb: number | null;
|
|
33
|
+
}
|
|
34
|
+
export interface SliderRootState<T extends SliderValue = number> {
|
|
35
|
+
/**
|
|
36
|
+
* The value the thumbs show: the value a gesture has reached while a pointer is captured or a
|
|
37
|
+
* step or commit is in flight, else the optimistic value. Content rendered from it must not
|
|
38
|
+
* suspend.
|
|
39
|
+
*/
|
|
40
|
+
readonly value: T;
|
|
41
|
+
/** `value` as an array, one entry per thumb, in thumb order. */
|
|
42
|
+
readonly values: readonly number[];
|
|
43
|
+
/** A step or commit dispatched through this Slider is in flight. */
|
|
44
|
+
readonly pending: boolean;
|
|
45
|
+
/** A pointer is captured on a thumb. */
|
|
46
|
+
readonly dragging: boolean;
|
|
47
|
+
readonly orientation: SliderOrientation;
|
|
48
|
+
readonly disabled: boolean;
|
|
49
|
+
readonly min: number;
|
|
50
|
+
readonly max: number;
|
|
51
|
+
readonly step: number;
|
|
52
|
+
}
|
|
53
|
+
export interface SliderRootProps<T extends SliderValue = number> extends Omit<ComponentPropsWithRef<"div">, "defaultValue" | "role" | "className" | "style" | "children" | "aria-valuemin" | "aria-valuemax" | "aria-valuenow" | "aria-valuetext" | "aria-orientation"> {
|
|
54
|
+
/** Controlled value: one number, or one per thumb in ascending order. `undefined`: uncontrolled. */
|
|
55
|
+
value?: T;
|
|
56
|
+
/**
|
|
57
|
+
* Initial value in uncontrolled mode; also the form-reset target (latest value). Default: the
|
|
58
|
+
* platform's midpoint, `min + (max - min) / 2`, snapped to `step`.
|
|
59
|
+
*/
|
|
60
|
+
defaultValue?: T;
|
|
61
|
+
/**
|
|
62
|
+
* Runs inside the Root's step transition on every step: each pointer move, each key press,
|
|
63
|
+
* each platform change, and the revert after a rejected commit (`reason: "dismiss"`,
|
|
64
|
+
* uncontrolled). Awaited; `data-pending` meanwhile (without this action a step starts no
|
|
65
|
+
* transition and is never pending). Adopt the value here in a controlled
|
|
66
|
+
* parent (`setValue(next)` in the sync prefix is a transition update). Not the place for a
|
|
67
|
+
* save: a pending async action entangles every transition in the app, and a drag is many
|
|
68
|
+
* steps. A `setState` after your own `await` needs `startTransition`.
|
|
69
|
+
*/
|
|
70
|
+
valueChangeAction?: ChangeAction<T, SliderValueChangeDetails>;
|
|
71
|
+
/**
|
|
72
|
+
* Runs inside the Root's commit transition once per gesture: pointer release, each key press,
|
|
73
|
+
* a form reset, a value found at mount. Awaited; the thumb keeps the gesture's value and shows
|
|
74
|
+
* `data-pending` until it settles; in uncontrolled mode the value is committed when it
|
|
75
|
+
* resolves and reverts to the previous value if it rejects. May be a Server Function.
|
|
76
|
+
*/
|
|
77
|
+
valueCommitAction?: ChangeAction<T, SliderValueCommitDetails>;
|
|
78
|
+
/** Default `0`. */
|
|
79
|
+
min?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Default `100`. A `max` that is not on the step grid from `min` is unreachable, as on a
|
|
82
|
+
* native range (dev warning).
|
|
83
|
+
*/
|
|
84
|
+
max?: number;
|
|
85
|
+
/** Default `1`. Must be positive. Values snap to `min + n × step`. */
|
|
86
|
+
step?: number;
|
|
87
|
+
/** Minimum number of steps between two adjacent thumbs. Default `0` (thumbs may share a value). */
|
|
88
|
+
minStepsBetweenThumbs?: number;
|
|
89
|
+
/** Default `"horizontal"`. Vertical sliders have `min` at the bottom. */
|
|
90
|
+
orientation?: SliderOrientation;
|
|
91
|
+
/**
|
|
92
|
+
* `aria-valuetext` for a thumb, from the value it shows. Set it when the number alone is not
|
|
93
|
+
* meaningful ("3 of 5 stars", "Tuesday"). Default: none (the number is announced).
|
|
94
|
+
*/
|
|
95
|
+
getAriaValueText?: (value: number, index: number) => string;
|
|
96
|
+
/**
|
|
97
|
+
* Form field name for every thumb's input (a Thumb's own `name` wins). With several thumbs,
|
|
98
|
+
* read with `FormData.getAll()`.
|
|
99
|
+
*/
|
|
100
|
+
name?: string;
|
|
101
|
+
/** The `form` attribute for every thumb's input (a Thumb's own `form` wins). */
|
|
102
|
+
form?: string;
|
|
103
|
+
/** Disables every input (native `disabled`; not submitted) and the pointer. Never set while pending. */
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
className?: StateValue<string | undefined, SliderRootState<T>>;
|
|
106
|
+
style?: StateValue<CSSProperties | undefined, SliderRootState<T>>;
|
|
107
|
+
children?: StateValue<ReactNode, SliderRootState<T>>;
|
|
108
|
+
render?: RenderProp<ComponentPropsWithRef<"div">, SliderRootState<T>>;
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
//# sourceMappingURL=slider-root.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slider-root.d.mts","names":[],"sources":["../../src/slider/slider-root.tsx"],"mappings":";;;;YAmDY;YAEA;;iBAGK,iCAAiC;;;;;;;;;;WAUvC,QAAQ;;WAER;;;iBAIM,iCAAiC;;;;;;;WAOvC,QAAQ;;WAER;;iBAGM,gBAAgB,UAAU;;;;;;WAMhC,OAAO;;WAEP;;WAEA;;WAEA;WACA,aAAa;WACb;WACA;WACA;WACA;;iBAGM,gBAAgB,UAAU,8BAA8B,KACvE;;EAcA,QAAQ;;;;;EAKR,eAAe;;;;;;;;;;EAUf,oBAAoB,aAAa,GAAG;;;;;;;EAOpC,oBAAoB,aAAa,GAAG;;EAEpC;;;;;EAKA;;EAEA;;EAEA;;EAEA,cAAc;;;;;EAKd,oBAAoB,eAAe;;;;;EAKnC;;EAEA;;EAEA;EACA,YAAY,+BAA+B,gBAAgB;EAC3D,QAAQ,WAAW,2BAA2B,gBAAgB;EAC9D,WAAW,WAAW,WAAW,gBAAgB;EACjD,SAAS,WAAW,8BAA8B,gBAAgB"}
|