plataforma-fundacao-componentes 2.26.11 → 2.26.12
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.
|
@@ -7,3 +7,7 @@ export declare const FirstExample: {
|
|
|
7
7
|
(args: ComponentProps<typeof VerticalSlider>): React.JSX.Element;
|
|
8
8
|
args: import("./verticalSlider").VerticalSliderProps & React.RefAttributes<HTMLDivElement>;
|
|
9
9
|
};
|
|
10
|
+
export declare const FilledExample: {
|
|
11
|
+
(args: ComponentProps<typeof VerticalSlider>): React.JSX.Element;
|
|
12
|
+
args: import("./verticalSlider").VerticalSliderProps & React.RefAttributes<HTMLDivElement>;
|
|
13
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -13110,6 +13110,7 @@ var VerticalSlider = React.forwardRef(function (_ref, ref) {
|
|
|
13110
13110
|
var index = options.findIndex(function (o) {
|
|
13111
13111
|
return o.value === value;
|
|
13112
13112
|
});
|
|
13113
|
+
movingRef.current.elementIndex = index;
|
|
13113
13114
|
if (fillRef.current) {
|
|
13114
13115
|
var height = (index + 1) * optionHeight;
|
|
13115
13116
|
var gaps = index * optionGap;
|
|
@@ -13143,7 +13144,7 @@ var VerticalSlider = React.forwardRef(function (_ref, ref) {
|
|
|
13143
13144
|
return optionHeight + optionGap;
|
|
13144
13145
|
});
|
|
13145
13146
|
}, [options]);
|
|
13146
|
-
var
|
|
13147
|
+
var accumulatedHeights = React.useMemo(function () {
|
|
13147
13148
|
return heights.reduce(function (ac, at, i) {
|
|
13148
13149
|
if (i === 0) return [at];
|
|
13149
13150
|
return [].concat(ac, [ac[i - 1] + at]);
|
|
@@ -13157,7 +13158,7 @@ var VerticalSlider = React.forwardRef(function (_ref, ref) {
|
|
|
13157
13158
|
var el = (_evt$currentTarget = evt.currentTarget) === null || _evt$currentTarget === void 0 ? void 0 : _evt$currentTarget.getBoundingClientRect();
|
|
13158
13159
|
var clientY = 'clientY' in evt ? evt.clientY : evt.touches[0].clientY;
|
|
13159
13160
|
var clickHeight = el.y + el.height - clientY;
|
|
13160
|
-
var i =
|
|
13161
|
+
var i = accumulatedHeights.findIndex(function (a) {
|
|
13161
13162
|
return a > clickHeight;
|
|
13162
13163
|
});
|
|
13163
13164
|
var height = (i + 1) * optionHeight;
|
|
@@ -13165,7 +13166,7 @@ var VerticalSlider = React.forwardRef(function (_ref, ref) {
|
|
|
13165
13166
|
var h = Math.max(height + gaps, 24);
|
|
13166
13167
|
fillRef.current.style.height = h + "px";
|
|
13167
13168
|
movingRef.current.elementIndex = i;
|
|
13168
|
-
}, [
|
|
13169
|
+
}, [accumulatedHeights, disabled, fillRef]);
|
|
13169
13170
|
var handleStart = React.useCallback(function (evt) {
|
|
13170
13171
|
var _fillRef$current2;
|
|
13171
13172
|
if (disabled) return;
|
|
@@ -13178,11 +13179,11 @@ var VerticalSlider = React.forwardRef(function (_ref, ref) {
|
|
|
13178
13179
|
if (disabled) return;
|
|
13179
13180
|
var el = evt.currentTarget.getBoundingClientRect();
|
|
13180
13181
|
var clickHeight = el.y + el.height - evt.clientY;
|
|
13181
|
-
var h =
|
|
13182
|
+
var h = accumulatedHeights.findIndex(function (a) {
|
|
13182
13183
|
return a > clickHeight;
|
|
13183
13184
|
});
|
|
13184
13185
|
onChange(options[h].value, h);
|
|
13185
|
-
}, [
|
|
13186
|
+
}, [accumulatedHeights, disabled, onChange, options]);
|
|
13186
13187
|
return React__default.createElement("div", Object.assign({}, props, {
|
|
13187
13188
|
className: classNames,
|
|
13188
13189
|
ref: ref,
|