@designbasekorea/ui 0.2.13 → 0.2.16
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.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.css.map +1 -1
- package/dist/index.esm.js +5 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.umd.css +1 -1
- package/dist/index.umd.css.map +1 -1
- package/dist/index.umd.js +5 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -9363,7 +9363,7 @@
|
|
|
9363
9363
|
}) }));
|
|
9364
9364
|
};
|
|
9365
9365
|
|
|
9366
|
-
const RangeSlider = ({ value, range, min = 0, max = 100, step = 1, size = 'm', variant = 'default', showValue = false, showMarks = false, marks = [], markLabels = {}, disabled = false, readOnly = false, fullWidth = false, vertical = false, onChange, onRangeChange, className, ...props }) => {
|
|
9366
|
+
const RangeSlider = ({ value, range, min = 0, max = 100, step = 1, size = 'm', variant = 'default', showValue = false, valuePosition = 'top', showMarks = false, marks = [], markLabels = {}, disabled = false, readOnly = false, fullWidth = false, vertical = false, onChange, onRangeChange, className, ...props }) => {
|
|
9367
9367
|
const [internalValue, setInternalValue] = React.useState(value ?? min);
|
|
9368
9368
|
const [internalRange, setInternalRange] = React.useState(range ?? [min, max]);
|
|
9369
9369
|
const [isDragging, setIsDragging] = React.useState(false);
|
|
@@ -9374,6 +9374,8 @@
|
|
|
9374
9374
|
const isControlled = value !== undefined || range !== undefined;
|
|
9375
9375
|
const currentValue = isControlled ? (value ?? internalValue) : internalValue;
|
|
9376
9376
|
const currentRange = isControlled ? (range ?? internalRange) : internalRange;
|
|
9377
|
+
// 범위 슬라이더는 기본적으로 양끝에 값 표시, 단일 슬라이더는 우측에 표시
|
|
9378
|
+
const effectiveValuePosition = range !== undefined ? 'top' : (valuePosition === 'top' ? 'right' : valuePosition);
|
|
9377
9379
|
// 값 정규화
|
|
9378
9380
|
const normalizeValue = React.useCallback((val) => {
|
|
9379
9381
|
return Math.max(min, Math.min(max, val));
|
|
@@ -9543,7 +9545,7 @@
|
|
|
9543
9545
|
}, "aria-hidden": "true", children: markLabels[mark] && (jsxRuntime.jsx("span", { className: "designbase-range-slider__mark-label", children: markLabels[mark] })) }, mark));
|
|
9544
9546
|
});
|
|
9545
9547
|
};
|
|
9546
|
-
const classes = clsx('designbase-range-slider', `designbase-range-slider--${size}`, `designbase-range-slider--${variant}`, {
|
|
9548
|
+
const classes = clsx('designbase-range-slider', `designbase-range-slider--${size}`, `designbase-range-slider--${variant}`, `designbase-range-slider--value-${effectiveValuePosition}`, {
|
|
9547
9549
|
'designbase-range-slider--disabled': disabled,
|
|
9548
9550
|
'designbase-range-slider--readonly': readOnly,
|
|
9549
9551
|
'designbase-range-slider--full-width': fullWidth,
|
|
@@ -9562,7 +9564,7 @@
|
|
|
9562
9564
|
: {
|
|
9563
9565
|
[vertical ? 'height' : 'width']: `${getPercentage(currentValue)}%`,
|
|
9564
9566
|
};
|
|
9565
|
-
return (jsxRuntime.jsxs("div", { className: classes, ...props, children: [showValue && (jsxRuntime.jsx("div", { className: "designbase-range-slider__values", children: range !== undefined ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "designbase-range-slider__value", children: currentRange[0] }), jsxRuntime.jsx("span", { className: "designbase-range-slider__value", children: currentRange[1] })] })) : (jsxRuntime.jsx("span", { className: "designbase-range-slider__value", children: currentValue })) })), jsxRuntime.jsx("div", { ref: containerRef, className: "designbase-range-slider__container", role: "slider", "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": range !== undefined ? currentRange[0] : currentValue, "aria-valuetext": range !== undefined ? `${currentRange[0]} to ${currentRange[1]}` : currentValue.toString(), "aria-disabled": disabled, "aria-readonly": readOnly, tabIndex: disabled || readOnly ? -1 : 0, onKeyDown: (e) => handleKeyDown(e), children: jsxRuntime.jsxs("div", { ref: trackRef, className: trackClasses, onClick: handleTrackClick, children: [jsxRuntime.jsx("div", { className: "designbase-range-slider__fill", style: fillStyle }), renderMarks(), range !== undefined ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: clsx('designbase-range-slider__thumb', {
|
|
9567
|
+
return (jsxRuntime.jsxs("div", { className: classes, ...props, children: [showValue && (jsxRuntime.jsx("div", { className: "designbase-range-slider__values", children: range !== undefined ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "designbase-range-slider__value designbase-range-slider__value--min", children: currentRange[0] }), jsxRuntime.jsx("span", { className: "designbase-range-slider__value designbase-range-slider__value--max", children: currentRange[1] })] })) : (jsxRuntime.jsx("span", { className: "designbase-range-slider__value designbase-range-slider__value--single", children: currentValue })) })), jsxRuntime.jsx("div", { ref: containerRef, className: "designbase-range-slider__container", role: "slider", "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": range !== undefined ? currentRange[0] : currentValue, "aria-valuetext": range !== undefined ? `${currentRange[0]} to ${currentRange[1]}` : currentValue.toString(), "aria-disabled": disabled, "aria-readonly": readOnly, tabIndex: disabled || readOnly ? -1 : 0, onKeyDown: (e) => handleKeyDown(e), children: jsxRuntime.jsxs("div", { ref: trackRef, className: trackClasses, onClick: handleTrackClick, children: [jsxRuntime.jsx("div", { className: "designbase-range-slider__fill", style: fillStyle }), renderMarks(), range !== undefined ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: clsx('designbase-range-slider__thumb', {
|
|
9566
9568
|
'designbase-range-slider__thumb--active': activeThumb === 'min',
|
|
9567
9569
|
}), style: {
|
|
9568
9570
|
[vertical ? 'bottom' : 'left']: `${getPercentage(currentRange[0])}%`,
|