@particle-network/ui-react 0.5.1-beta.26 → 0.5.1-beta.28
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.
|
@@ -5,6 +5,7 @@ export interface UXRangeInputValue {
|
|
|
5
5
|
max?: number;
|
|
6
6
|
}
|
|
7
7
|
export type UXRangeInputProps = Omit<UXNumberInputProps, 'value' | 'defaultValue' | 'onValueChange' | 'minValue' | 'maxValue'> & {
|
|
8
|
+
asFragment?: boolean;
|
|
8
9
|
/**
|
|
9
10
|
* The current value of the range input (controlled)
|
|
10
11
|
*/
|
|
@@ -31,7 +32,6 @@ export type UXRangeInputProps = Omit<UXNumberInputProps, 'value' | 'defaultValue
|
|
|
31
32
|
maxInputProps?: Partial<UXNumberInputProps>;
|
|
32
33
|
/**
|
|
33
34
|
* Separator between the two inputs
|
|
34
|
-
* @default '-'
|
|
35
35
|
*/
|
|
36
36
|
separator?: React.ReactNode;
|
|
37
37
|
/**
|
|
@@ -39,4 +39,4 @@ export type UXRangeInputProps = Omit<UXNumberInputProps, 'value' | 'defaultValue
|
|
|
39
39
|
*/
|
|
40
40
|
onValueChange?: (value: UXRangeInputValue) => void;
|
|
41
41
|
};
|
|
42
|
-
export declare const UXRangeInput: React.
|
|
42
|
+
export declare const UXRangeInput: React.FC<UXRangeInputProps>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import react, {
|
|
2
|
+
import react, { Fragment, useCallback, useMemo } from "react";
|
|
3
3
|
import { useI18n } from "../../hooks/index.js";
|
|
4
4
|
import { HStack } from "../layout/index.js";
|
|
5
5
|
import { UXNumberInput } from "../UXNumberInput/index.js";
|
|
6
|
-
const UXRangeInput =
|
|
7
|
-
const { value, defaultValue, onValueChange, minValue, maxValue, minInputProps = {}, maxInputProps = {}, separator = '', className, ...restProps } = props;
|
|
6
|
+
const UXRangeInput = (props)=>{
|
|
7
|
+
const { asFragment, value, defaultValue, onValueChange, minValue, maxValue, minInputProps = {}, maxInputProps = {}, separator = '', className, ...restProps } = props;
|
|
8
8
|
const i18n = useI18n();
|
|
9
9
|
const [internalValue, setInternalValue] = react.useState(defaultValue || {
|
|
10
10
|
min: void 0,
|
|
@@ -53,8 +53,8 @@ const UXRangeInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
53
53
|
currentValue.min,
|
|
54
54
|
minValue
|
|
55
55
|
]);
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
const Wrapper = asFragment ? Fragment : HStack;
|
|
57
|
+
return /*#__PURE__*/ jsxs(Wrapper, {
|
|
58
58
|
gap: 2,
|
|
59
59
|
className: className,
|
|
60
60
|
children: [
|
|
@@ -64,6 +64,7 @@ const UXRangeInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
64
64
|
"aria-hidden": "true",
|
|
65
65
|
children: i18n.rangeInput.min
|
|
66
66
|
}),
|
|
67
|
+
textAlign: "right",
|
|
67
68
|
...restProps,
|
|
68
69
|
...minInputProps,
|
|
69
70
|
value: currentValue.min,
|
|
@@ -78,6 +79,7 @@ const UXRangeInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
78
79
|
"aria-hidden": "true",
|
|
79
80
|
children: i18n.rangeInput.max
|
|
80
81
|
}),
|
|
82
|
+
textAlign: "right",
|
|
81
83
|
...restProps,
|
|
82
84
|
...maxInputProps,
|
|
83
85
|
value: currentValue.max,
|
|
@@ -87,6 +89,6 @@ const UXRangeInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
87
89
|
})
|
|
88
90
|
]
|
|
89
91
|
});
|
|
90
|
-
}
|
|
92
|
+
};
|
|
91
93
|
UXRangeInput.displayName = 'UX.RangeInput';
|
|
92
94
|
export { UXRangeInput };
|
package/dist/hooks/useI18n.d.ts
CHANGED
package/dist/hooks/useI18n.js
CHANGED