reshaped 2.11.5 → 2.11.6
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.
@@ -1 +1 @@
|
|
1
|
-
.root{align-items:center;cursor:pointer;display:flex;height:var(--rs-
|
1
|
+
.root{--rs-slider-overflow-gap:var(--rs-unit-x1);--rs-slider-thumb-size:var(--rs-unit-x4);align-items:center;cursor:pointer;display:flex;height:var(--rs-slider-thumb-size);position:relative;user-select:none;-webkit-tap-highlight-color:transparent;margin-inline:calc(var(--rs-slider-overflow-gap) * -1);overflow-x:clip;padding-inline:var(--rs-slider-overflow-gap)}.root:has(.thumb:hover,.thumb--active,.input:focus){overflow:visible}.bar{background:var(--rs-color-background-neutral);border-radius:var(--rs-unit-radius-small);height:var(--rs-unit-x1);position:relative;width:100%}.bar,.input{overflow:hidden}.input{height:1px;opacity:0;pointer-events:none;position:absolute;width:1px}.selection{background:var(--rs-color-background-primary);height:100%;position:absolute}.tooltip{--rs-slider-tooltip-translate-x:calc(-50% + var(--rs-slider-tooltip-offset, 0px));background:var(--rs-color-background-elevation-overlay);border-radius:var(--rs-unit-radius-small);bottom:100%;box-shadow:var(--rs-shadow-overlay);box-sizing:initial;color:var(--rs-color-foreground-neutral);font-variant-numeric:tabular-nums;left:50%;min-width:var(--rs-line-height-caption-1);opacity:0;padding:calc(var(--rs-unit-x1) / 2) var(--rs-unit-x1);pointer-events:none;position:absolute;text-align:center;transform:translate(var(--rs-slider-tooltip-translate-x));transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:opacity,transform;user-select:none;white-space:nowrap;will-change:transform}.thumbs{inset-inline:calc(var(--rs-slider-thumb-size) / 2 + var(--rs-slider-overflow-gap))}.thumb,.thumbs{height:100%;position:absolute}.thumb{width:0}.thumb:before{background:var(--rs-color-background-primary);border-radius:999px;box-shadow:0 0 0 2px var(--rs-color-background-elevation-base);box-sizing:border-box;height:var(--rs-slider-thumb-size);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:box-shadow;width:var(--rs-slider-thumb-size)}.thumb:after,.thumb:before{content:"";left:0;position:absolute;top:50%;transform:translate(-50%,-50%)}.thumb:after{cursor:grab;height:var(--rs-unit-x7);width:var(--rs-unit-x7)}.thumb:hover .tooltip{opacity:1;transform:translate(var(--rs-slider-tooltip-translate-x),calc(var(--rs-unit-x1) * -1.5))}.input:focus+.thumb:after,.thumb--active:after{cursor:grabbing}.input:focus+.thumb:before,.thumb--active:before{box-shadow:0 0 0 1px var(--rs-color-background-elevation-base)}.input:focus+.thumb .tooltip,.thumb--active .tooltip{opacity:1;transform:translate(var(--rs-slider-tooltip-translate-x),calc(var(--rs-unit-x1) * -1.5))!important}.input:focus+.thumb:before{box-shadow:var(--rs-focus-shadow)}.--disabled{cursor:not-allowed}.--disabled .bar{background-color:var(--rs-color-background-disabled)}.--disabled .selection,.--disabled .thumb:before{background-color:var(--rs-color-foreground-disabled)}.--disabled .thumb:after{cursor:not-allowed}.--disabled .thumb:hover .tooltip{opacity:0}
|
@@ -26,7 +26,6 @@ const SliderControlled = (props) => {
|
|
26
26
|
const minTooltipRef = React.useRef(null);
|
27
27
|
const maxTooltipRef = React.useRef(null);
|
28
28
|
const [draggingId, setDraggingId] = React.useState(null);
|
29
|
-
const [mounted, setMounted] = React.useState(false);
|
30
29
|
const [rtl] = useRTL();
|
31
30
|
const formControl = useFormControl();
|
32
31
|
const id = useElementId();
|
@@ -34,7 +33,7 @@ const SliderControlled = (props) => {
|
|
34
33
|
const minId = `${inputId}-min`;
|
35
34
|
const maxId = `${inputId}-max`;
|
36
35
|
const disabled = (formControl === null || formControl === void 0 ? void 0 : formControl.disabled) || props.disabled;
|
37
|
-
const rootClassNames = classNames(s.root, disabled && s["--disabled"],
|
36
|
+
const rootClassNames = classNames(s.root, disabled && s["--disabled"], className);
|
38
37
|
const getPositionValue = React.useCallback((x) => {
|
39
38
|
if (!barRef.current)
|
40
39
|
return;
|
@@ -182,9 +181,9 @@ const SliderControlled = (props) => {
|
|
182
181
|
positionTooltip(maxId);
|
183
182
|
}, [positionTooltip, minId, maxId]);
|
184
183
|
React.useEffect(() => {
|
185
|
-
|
186
|
-
|
187
|
-
}, [
|
184
|
+
positionTooltip(minId);
|
185
|
+
positionTooltip(maxId);
|
186
|
+
}, [minId, maxId, minValue, maxValue, positionTooltip]);
|
188
187
|
React.useEffect(() => {
|
189
188
|
window.addEventListener("mouseup", handleDragStop);
|
190
189
|
window.addEventListener("touchend", handleDragStop);
|
@@ -197,9 +196,6 @@ const SliderControlled = (props) => {
|
|
197
196
|
window.removeEventListener("touchmove", handleDrag);
|
198
197
|
};
|
199
198
|
}, [handleDragStop, handleDrag]);
|
200
|
-
React.useEffect(() => {
|
201
|
-
setMounted(true);
|
202
|
-
}, []);
|
203
199
|
const minPercentPosition = minValue && getPercentPosition(minValue);
|
204
200
|
const maxPercentPosition = getPercentPosition(maxValue);
|
205
201
|
return (
|
@@ -11,9 +11,7 @@ export default {
|
|
11
11
|
},
|
12
12
|
};
|
13
13
|
export const base = () => (<Example>
|
14
|
-
<
|
15
|
-
<Slider name="slider" defaultValue={30}/>
|
16
|
-
</Example.Item>
|
14
|
+
<Slider name="slider" defaultValue={100} renderValue={() => "$12345"}/>
|
17
15
|
<Example.Item title="range">
|
18
16
|
<Slider range name="slider" defaultMinValue={30} defaultMaxValue={100} renderValue={() => "Hundred more times"}/>
|
19
17
|
</Example.Item>
|
@@ -6,21 +6,21 @@ import { classNames } from "../../../utilities/helpers.js";
|
|
6
6
|
import { onNextFrame } from "../../../utilities/animation.js";
|
7
7
|
const Expandable = (props) => {
|
8
8
|
const { children, active, attributes } = props;
|
9
|
-
const [
|
10
|
-
const rootClassNames = classNames(s.root, active &&
|
9
|
+
const [rendered, setRendered] = React.useState(active);
|
10
|
+
const rootClassNames = classNames(s.root, active && rendered && s["--active"], !active && !rendered && s["--hidden"]);
|
11
11
|
const handleTransitionEnd = (e) => {
|
12
12
|
if (e.propertyName !== "height")
|
13
13
|
return;
|
14
14
|
if (active)
|
15
15
|
return;
|
16
16
|
onNextFrame(() => {
|
17
|
-
|
17
|
+
setRendered(false);
|
18
18
|
});
|
19
19
|
};
|
20
20
|
React.useEffect(() => {
|
21
21
|
if (!active)
|
22
22
|
return;
|
23
|
-
|
23
|
+
setRendered(active);
|
24
24
|
}, [active]);
|
25
25
|
return (_jsx("div", Object.assign({}, attributes, { className: rootClassNames, onTransitionEnd: handleTransitionEnd, role: "region", hidden: !active, children: _jsx("div", { className: s.inner, children: children }) })));
|
26
26
|
};
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "reshaped",
|
3
3
|
"description": "Professionally crafted design system in React & Figma for building products of any scale and complexity",
|
4
|
-
"version": "2.11.
|
4
|
+
"version": "2.11.6",
|
5
5
|
"license": "MIT",
|
6
6
|
"email": "hello@reshaped.so",
|
7
7
|
"homepage": "https://reshaped.so",
|