reshaped 2.11.5 → 2.11.7
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/bundle.css +1 -1
- package/bundle.js +8 -8
- package/components/Popover/tests/Popover.stories.d.ts +1 -0
- package/components/Popover/tests/Popover.stories.js +20 -0
- package/components/Slider/Slider.module.css +1 -1
- package/components/Slider/SliderControlled.js +4 -8
- package/components/Slider/tests/Slider.stories.js +1 -3
- package/components/_private/Expandable/Expandable.js +4 -4
- package/components/_private/Flyout/FlyoutControlled.js +3 -2
- package/package.json +1 -1
@@ -17,3 +17,4 @@ export declare const width: () => import("react").JSX.Element;
|
|
17
17
|
export declare const variant: () => import("react").JSX.Element;
|
18
18
|
export declare const padding: () => import("react").JSX.Element;
|
19
19
|
export declare const triggerType: () => import("react").JSX.Element;
|
20
|
+
export declare const edgeCases: () => import("react").JSX.Element;
|
@@ -12,6 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
12
12
|
import { Example } from "../../../utilities/storybook/index.js";
|
13
13
|
import View from "../../View/index.js";
|
14
14
|
import Popover from "../index.js";
|
15
|
+
import Tooltip from "../../Tooltip/index.js";
|
15
16
|
import Button from "../../Button/index.js";
|
16
17
|
export default {
|
17
18
|
title: "Components/Popover",
|
@@ -104,3 +105,22 @@ export const triggerType = () => (<Example>
|
|
104
105
|
<Demo triggerType="hover"/>
|
105
106
|
</Example.Item>
|
106
107
|
</Example>);
|
108
|
+
export const edgeCases = () => (<Example>
|
109
|
+
<Example.Item title="Popover with tooltip">
|
110
|
+
<Tooltip position="top" text="Hello">
|
111
|
+
{(tooltipAttributes) => (<Popover position="bottom">
|
112
|
+
<Popover.Trigger>
|
113
|
+
{(attributes) => (<Button attributes={Object.assign(Object.assign({}, attributes), tooltipAttributes)}>
|
114
|
+
Open
|
115
|
+
</Button>)}
|
116
|
+
</Popover.Trigger>
|
117
|
+
<Popover.Content>
|
118
|
+
<View gap={2} align="start">
|
119
|
+
Popover content
|
120
|
+
<Button onClick={() => { }}>Button</Button>
|
121
|
+
</View>
|
122
|
+
</Popover.Content>
|
123
|
+
</Popover>)}
|
124
|
+
</Tooltip>
|
125
|
+
</Example.Item>
|
126
|
+
</Example>);
|
@@ -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
|
};
|
@@ -15,8 +15,10 @@ import { checkTransitions } from "../../../utilities/animation.js";
|
|
15
15
|
import { Provider, useFlyoutContext } from "./Flyout.context.js";
|
16
16
|
const FlyoutRoot = (props) => {
|
17
17
|
const { triggerType = "click", onOpen, onClose, children, forcePosition, trapFocusMode, width, disableHideAnimation, contentGap, contentClassName, contentAttributes, position: passedPosition, active: passedActive, id: passedId, instanceRef, } = props;
|
18
|
+
const parentFlyoutContext = useFlyoutContext();
|
18
19
|
const [isRTL] = useRTL();
|
19
|
-
const
|
20
|
+
const internalTriggerElRef = React.useRef(null);
|
21
|
+
const triggerElRef = (parentFlyoutContext === null || parentFlyoutContext === void 0 ? void 0 : parentFlyoutContext.triggerElRef) || internalTriggerElRef;
|
20
22
|
const flyoutElRef = React.useRef(null);
|
21
23
|
const id = useElementId(passedId);
|
22
24
|
const timerRef = React.useRef();
|
@@ -31,7 +33,6 @@ const FlyoutRoot = (props) => {
|
|
31
33
|
defaultActive: passedActive,
|
32
34
|
forcePosition,
|
33
35
|
});
|
34
|
-
const parentFlyoutContext = useFlyoutContext();
|
35
36
|
const { status, updatePosition, render, hide, remove } = flyout;
|
36
37
|
// Don't create dismissible queue for hover flyout because they close all together on mouseout
|
37
38
|
const isDismissible = useIsDismissible(triggerType !== "hover" && status !== "idle", flyoutElRef, triggerElRef);
|
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.7",
|
5
5
|
"license": "MIT",
|
6
6
|
"email": "hello@reshaped.so",
|
7
7
|
"homepage": "https://reshaped.so",
|