@vesture/react 0.2.2 → 0.2.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/index.d.ts +5 -2
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ButtonHTMLAttributes, LabelHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, ReactNode, HTMLAttributes, ReactElement, MutableRefObject, AnchorHTMLAttributes } from 'react';
|
|
2
|
+
import { ButtonHTMLAttributes, LabelHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes, SelectHTMLAttributes, ReactNode, HTMLAttributes, ReactElement, MutableRefObject, AnchorHTMLAttributes, CSSProperties } from 'react';
|
|
3
3
|
import { Placement } from '@floating-ui/react';
|
|
4
4
|
export { defaultThemeClass, defaultThemeVars, vars } from '@vesture/tokens';
|
|
5
5
|
|
|
@@ -424,6 +424,7 @@ interface NumberInputProps {
|
|
|
424
424
|
id?: string;
|
|
425
425
|
name?: string;
|
|
426
426
|
className?: string;
|
|
427
|
+
style?: CSSProperties;
|
|
427
428
|
"aria-label"?: string;
|
|
428
429
|
"aria-labelledby"?: string;
|
|
429
430
|
}
|
|
@@ -438,14 +439,16 @@ interface SliderProps {
|
|
|
438
439
|
max?: number;
|
|
439
440
|
step?: number;
|
|
440
441
|
disabled?: boolean;
|
|
442
|
+
id?: string;
|
|
441
443
|
className?: string;
|
|
444
|
+
style?: CSSProperties;
|
|
442
445
|
/** Label for the single thumb, or the [start, end] thumbs in range mode. */
|
|
443
446
|
"aria-label"?: string | [string, string];
|
|
444
447
|
/** Formats the value shown to assistive tech and in the value label, e.g. `(v) => \`$\${v}\`` */
|
|
445
448
|
formatValue?: (value: number) => string;
|
|
446
449
|
}
|
|
447
450
|
|
|
448
|
-
declare function Slider({ value: controlledValue, defaultValue, onChange, min, max, step, disabled, className, formatValue, ...rest }: SliderProps): ReactElement;
|
|
451
|
+
declare function Slider({ value: controlledValue, defaultValue, onChange, min, max, step, disabled, id, className, style, formatValue, ...rest }: SliderProps): ReactElement;
|
|
449
452
|
|
|
450
453
|
interface ComboboxOption {
|
|
451
454
|
value: string;
|
package/dist/index.js
CHANGED
|
@@ -2654,6 +2654,7 @@ var NumberInput = forwardRef14(function NumberInput2({
|
|
|
2654
2654
|
id,
|
|
2655
2655
|
name,
|
|
2656
2656
|
className,
|
|
2657
|
+
style,
|
|
2657
2658
|
...rest
|
|
2658
2659
|
}, ref) {
|
|
2659
2660
|
const [uncontrolledValue, setUncontrolledValue] = useState12(defaultValue);
|
|
@@ -2725,7 +2726,7 @@ var NumberInput = forwardRef14(function NumberInput2({
|
|
|
2725
2726
|
commitTypedValue();
|
|
2726
2727
|
};
|
|
2727
2728
|
const classes = [wrapper8, className].filter(Boolean).join(" ");
|
|
2728
|
-
return /* @__PURE__ */ jsxs21("span", { className: classes, "data-disabled": disabled || void 0, children: [
|
|
2729
|
+
return /* @__PURE__ */ jsxs21("span", { className: classes, style, "data-disabled": disabled || void 0, children: [
|
|
2729
2730
|
/* @__PURE__ */ jsx38(
|
|
2730
2731
|
"input",
|
|
2731
2732
|
{
|
|
@@ -2808,7 +2809,9 @@ function Slider({
|
|
|
2808
2809
|
max = 100,
|
|
2809
2810
|
step = 1,
|
|
2810
2811
|
disabled = false,
|
|
2812
|
+
id,
|
|
2811
2813
|
className,
|
|
2814
|
+
style,
|
|
2812
2815
|
formatValue: formatValue2 = (v) => String(v),
|
|
2813
2816
|
...rest
|
|
2814
2817
|
}) {
|
|
@@ -2822,6 +2825,7 @@ function Slider({
|
|
|
2822
2825
|
onChange?.(next);
|
|
2823
2826
|
};
|
|
2824
2827
|
const trackRef = useRef7(null);
|
|
2828
|
+
const thumbRefs = useRef7({ single: null, 0: null, 1: null });
|
|
2825
2829
|
const dragThumbIndex = useRef7(null);
|
|
2826
2830
|
const isDragging = useRef7(false);
|
|
2827
2831
|
const valueFromClientX = (clientX) => {
|
|
@@ -2857,6 +2861,7 @@ function Slider({
|
|
|
2857
2861
|
const startDrag = (index) => (event) => {
|
|
2858
2862
|
if (disabled) return;
|
|
2859
2863
|
event.preventDefault();
|
|
2864
|
+
thumbRefs.current[index ?? "single"]?.focus();
|
|
2860
2865
|
isDragging.current = true;
|
|
2861
2866
|
dragThumbIndex.current = index;
|
|
2862
2867
|
setThumbValue(index, valueFromClientX(event.clientX));
|
|
@@ -2908,6 +2913,9 @@ function Slider({
|
|
|
2908
2913
|
const renderThumb = (index, current2, label3) => /* @__PURE__ */ jsx39(
|
|
2909
2914
|
"span",
|
|
2910
2915
|
{
|
|
2916
|
+
ref: (node) => {
|
|
2917
|
+
thumbRefs.current[index ?? "single"] = node;
|
|
2918
|
+
},
|
|
2911
2919
|
role: "slider",
|
|
2912
2920
|
tabIndex: disabled ? -1 : 0,
|
|
2913
2921
|
"aria-label": label3,
|
|
@@ -2927,7 +2935,7 @@ function Slider({
|
|
|
2927
2935
|
index ?? "single"
|
|
2928
2936
|
);
|
|
2929
2937
|
const classes = [root3, className].filter(Boolean).join(" ");
|
|
2930
|
-
return /* @__PURE__ */ jsx39("span", { className: classes, "data-disabled": disabled || void 0, children: /* @__PURE__ */ jsxs22("span", { ref: trackRef, className: track3, onPointerDown: handleTrackPointerDown, children: [
|
|
2938
|
+
return /* @__PURE__ */ jsx39("span", { id, className: classes, style, "data-disabled": disabled || void 0, children: /* @__PURE__ */ jsxs22("span", { ref: trackRef, className: track3, onPointerDown: handleTrackPointerDown, children: [
|
|
2931
2939
|
isRange(value) ? /* @__PURE__ */ jsx39(
|
|
2932
2940
|
"span",
|
|
2933
2941
|
{
|