reshaped 3.5.4-canary.0 → 3.6.0-canary.1
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/CHANGELOG.md +29 -46
- package/dist/bundle.css +1 -1
- package/dist/bundle.d.ts +37 -32
- package/dist/bundle.js +11 -11
- package/dist/components/Accordion/AccordionControlled.js +1 -1
- package/dist/components/Accordion/AccordionTrigger.js +1 -1
- package/dist/components/ActionBar/ActionBar.js +1 -1
- package/dist/components/Actionable/Actionable.js +1 -1
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Badge/Badge.js +1 -1
- package/dist/components/Badge/BadgeContainer.js +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.types.d.ts +1 -1
- package/dist/components/Button/ButtonGroup.js +1 -1
- package/dist/components/Calendar/CalendarDate.js +1 -1
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Card/tests/Card.stories.d.ts +1 -1
- package/dist/components/Card/tests/Card.test.stories.d.ts +1 -1
- package/dist/components/Carousel/Carousel.js +4 -3
- package/dist/components/Carousel/CarouselControl.js +1 -1
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/Container/Container.js +1 -1
- package/dist/components/Dismissible/Dismissible.js +1 -1
- package/dist/components/Divider/Divider.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +2 -2
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +1 -1
- package/dist/components/DropdownMenu/tests/DropdownMenu.stories.d.ts +1 -1
- package/dist/components/DropdownMenu/tests/DropdownMenu.test.stories.d.ts +1 -1
- package/dist/components/FileUpload/FileUpload.js +1 -1
- package/dist/components/Flyout/Flyout.constants.d.ts +6 -0
- package/dist/components/Flyout/Flyout.constants.js +19 -0
- package/dist/components/{_private/Flyout → Flyout}/Flyout.types.d.ts +3 -3
- package/dist/components/{_private/Flyout → Flyout}/FlyoutContent.js +28 -22
- package/dist/components/{_private/Flyout → Flyout}/FlyoutControlled.js +9 -9
- package/dist/components/{_private/Flyout → Flyout}/tests/Flyout.stories.d.ts +6 -4
- package/dist/components/{_private/Flyout → Flyout}/tests/Flyout.stories.js +128 -118
- package/dist/components/{_private/Flyout → Flyout}/useFlyout.d.ts +1 -1
- package/dist/components/Flyout/useFlyout.js +116 -0
- package/dist/components/Flyout/utilities/calculatePosition.d.ts +30 -0
- package/dist/components/Flyout/utilities/calculatePosition.js +129 -0
- package/dist/components/Flyout/utilities/flyout.d.ts +11 -0
- package/dist/components/Flyout/utilities/flyout.js +79 -0
- package/dist/components/Flyout/utilities/isFullyVisible.d.ts +10 -0
- package/dist/components/Flyout/utilities/isFullyVisible.js +24 -0
- package/dist/components/FormControl/FormControl.context.d.ts +0 -2
- package/dist/components/Grid/Grid.js +1 -1
- package/dist/components/Hidden/Hidden.js +1 -1
- package/dist/components/Hotkey/Hotkey.js +1 -1
- package/dist/components/Icon/Icon.js +1 -1
- package/dist/components/Image/Image.js +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/Link/Link.js +1 -1
- package/dist/components/Loader/Loader.js +1 -1
- package/dist/components/MenuItem/MenuItem.js +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/NumberField/NumberFieldControlled.js +1 -1
- package/dist/components/Overlay/Overlay.js +1 -1
- package/dist/components/PinField/PinFieldControlled.js +1 -1
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/components/Popover/Popover.js +4 -4
- package/dist/components/Popover/Popover.module.css +1 -1
- package/dist/components/Popover/Popover.types.d.ts +3 -1
- package/dist/components/Popover/tests/Popover.stories.d.ts +48 -9
- package/dist/components/Popover/tests/Popover.stories.js +209 -85
- package/dist/components/Progress/Progress.js +1 -1
- package/dist/components/ProgressIndicator/ProgressIndicator.js +1 -1
- package/dist/components/Radio/Radio.js +1 -1
- package/dist/components/Reshaped/Reshaped.js +1 -1
- package/dist/components/Resizable/Resizable.js +1 -1
- package/dist/components/Scrim/Scrim.js +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +6 -6
- package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Skeleton/Skeleton.js +1 -1
- package/dist/components/Slider/Slider.types.d.ts +34 -7
- package/dist/components/Slider/SliderControlled.js +32 -20
- package/dist/components/Slider/SliderThumb.js +4 -4
- package/dist/components/Slider/SliderUncontrolled.js +3 -2
- package/dist/components/Slider/tests/Slider.stories.d.ts +38 -8
- package/dist/components/Slider/tests/Slider.stories.js +268 -54
- package/dist/components/Stepper/Stepper.js +1 -1
- package/dist/components/Switch/Switch.js +1 -1
- package/dist/components/Table/Table.js +6 -3
- package/dist/components/Table/Table.module.css +1 -1
- package/dist/components/Tabs/TabsContext.d.ts +2 -2
- package/dist/components/Tabs/TabsItem.js +1 -1
- package/dist/components/Tabs/TabsList.js +3 -34
- package/dist/components/Tabs/TabsPanel.js +1 -1
- package/dist/components/Text/Text.js +1 -1
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/Theme/Theme.js +1 -1
- package/dist/components/Timeline/Timeline.js +1 -1
- package/dist/components/Toast/ToastContainer.js +1 -1
- package/dist/components/Toast/ToastRegion.js +1 -1
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +1 -1
- package/dist/components/View/View.js +1 -1
- package/dist/components/_private/Aligner/Aligner.js +1 -1
- package/dist/components/_private/Expandable/Expandable.js +1 -1
- package/dist/components/_private/HiddenInput/HiddenInput.js +1 -1
- package/dist/config/tailwind.d.ts +1 -1
- package/dist/hooks/_private/useFadeSide.d.ts +5 -0
- package/dist/hooks/_private/useFadeSide.js +47 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +1 -1
- package/dist/index.d.ts +37 -32
- package/dist/index.js +21 -17
- package/dist/styles/align/index.js +1 -1
- package/dist/styles/aspectRatio/index.js +1 -1
- package/dist/styles/bleed/index.js +1 -1
- package/dist/styles/border/index.js +1 -1
- package/dist/styles/height/index.js +1 -1
- package/dist/styles/inset/index.js +1 -1
- package/dist/styles/justify/index.js +1 -1
- package/dist/styles/maxHeight/index.js +1 -1
- package/dist/styles/maxWidth/index.js +1 -1
- package/dist/styles/minHeight/index.js +1 -1
- package/dist/styles/minWidth/index.js +1 -1
- package/dist/styles/padding/index.js +1 -1
- package/dist/styles/position/index.js +1 -1
- package/dist/styles/radius/index.js +1 -1
- package/dist/styles/textAlign/index.js +1 -1
- package/dist/styles/width/index.js +1 -1
- package/dist/utilities/dom/event.d.ts +7 -0
- package/dist/utilities/dom/event.js +11 -0
- package/dist/utilities/dom/find.d.ts +6 -9
- package/dist/utilities/dom/find.js +17 -15
- package/dist/utilities/dom/index.d.ts +2 -1
- package/dist/utilities/dom/index.js +2 -1
- package/dist/utilities/helpers.d.ts +1 -15
- package/dist/utilities/helpers.js +11 -133
- package/dist/utilities/props.d.ts +13 -0
- package/dist/utilities/props.js +83 -0
- package/dist/utilities/scroll/lock.js +4 -3
- package/package.json +24 -24
- package/CHANGELOG-old.md +0 -14
- package/dist/components/Popover/tests/Popover.test.stories.d.ts +0 -39
- package/dist/components/Popover/tests/Popover.test.stories.js +0 -167
- package/dist/components/Slider/tests/Slider.test.stories.d.ts +0 -38
- package/dist/components/Slider/tests/Slider.test.stories.js +0 -150
- package/dist/components/_private/Flyout/Flyout.constants.d.ts +0 -3
- package/dist/components/_private/Flyout/Flyout.constants.js +0 -3
- package/dist/components/_private/Flyout/useFlyout.js +0 -211
- package/dist/components/_private/Flyout/utilities/calculatePosition.d.ts +0 -19
- package/dist/components/_private/Flyout/utilities/calculatePosition.js +0 -102
- package/dist/components/_private/Flyout/utilities/isFullyVisible.d.ts +0 -8
- package/dist/components/_private/Flyout/utilities/isFullyVisible.js +0 -16
- /package/dist/components/{_private/Flyout → Flyout}/Flyout.context.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/Flyout.context.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/Flyout.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/Flyout.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/Flyout.module.css +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/Flyout.types.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/FlyoutContent.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/FlyoutControlled.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/FlyoutTrigger.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/FlyoutTrigger.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/FlyoutUncontrolled.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/FlyoutUncontrolled.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/index.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/index.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/utilities/cooldown.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/utilities/cooldown.js +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/utilities/getPositionFallbacks.d.ts +0 -0
- /package/dist/components/{_private/Flyout → Flyout}/utilities/getPositionFallbacks.js +0 -0
@@ -6,139 +6,17 @@ export const range = (start, end) => {
|
|
6
6
|
return [];
|
7
7
|
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
8
8
|
};
|
9
|
-
//
|
10
|
-
|
11
|
-
|
12
|
-
let
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
};
|
20
|
-
export function debounceHandler(handler, timeout) {
|
21
|
-
const debounced = debounce(handler, timeout);
|
22
|
-
return (event) => {
|
23
|
-
if ("persist" in event)
|
24
|
-
event.persist();
|
25
|
-
return debounced(event);
|
26
|
-
};
|
27
|
-
}
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
29
|
-
export const throttle = (cb, wait) => {
|
30
|
-
let waiting = false;
|
31
|
-
return (...args) => {
|
32
|
-
if (!waiting) {
|
33
|
-
cb(...args);
|
34
|
-
waiting = true;
|
35
|
-
setTimeout(() => {
|
36
|
-
waiting = false;
|
37
|
-
setTimeout(() => {
|
38
|
-
if (waiting)
|
39
|
-
return;
|
40
|
-
cb(...args);
|
41
|
-
}, wait);
|
42
|
-
}, wait);
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
10
|
+
export const rafThrottle = (fn) => {
|
11
|
+
let rafId = null;
|
12
|
+
let args = null;
|
13
|
+
return function (...newArgs) {
|
14
|
+
args = newArgs;
|
15
|
+
if (rafId === null) {
|
16
|
+
rafId = requestAnimationFrame(() => {
|
17
|
+
rafId = null;
|
18
|
+
fn(...args);
|
19
|
+
});
|
43
20
|
}
|
44
21
|
};
|
45
22
|
};
|
46
|
-
export function throttleHandler(handler, timeout) {
|
47
|
-
const throttled = throttle(handler, timeout);
|
48
|
-
return (event) => {
|
49
|
-
if ("persist" in event)
|
50
|
-
event.persist();
|
51
|
-
return throttled(event);
|
52
|
-
};
|
53
|
-
}
|
54
|
-
export const classNames = (...args) => {
|
55
|
-
return args.reduce((acc, cur) => {
|
56
|
-
if (Array.isArray(cur)) {
|
57
|
-
const className = classNames(...cur);
|
58
|
-
if (!className)
|
59
|
-
return acc;
|
60
|
-
return `${acc} ${className}`;
|
61
|
-
}
|
62
|
-
if (cur)
|
63
|
-
return `${acc} ${cur}`;
|
64
|
-
return acc;
|
65
|
-
}, "");
|
66
|
-
};
|
67
|
-
const applyClassName = (passedClassName, value, options) => {
|
68
|
-
const { base, excludeValueFromClassName } = options || {};
|
69
|
-
const className = typeof passedClassName === "string" ? passedClassName : passedClassName(value);
|
70
|
-
if ((value === true && base) || excludeValueFromClassName)
|
71
|
-
return className;
|
72
|
-
// CSS should be turned on/off for non base viewport with mobile first approach
|
73
|
-
if (value === true && !base)
|
74
|
-
return `${className}-true`;
|
75
|
-
if (value === false && !base)
|
76
|
-
return `${className}-false`;
|
77
|
-
if (value !== undefined)
|
78
|
-
return `${className}-${value}`;
|
79
|
-
return null;
|
80
|
-
};
|
81
|
-
export const responsiveClassNames = (s, className, value, options) => {
|
82
|
-
if (typeof value !== "object") {
|
83
|
-
const staticClassName = applyClassName(className, value, {
|
84
|
-
base: true,
|
85
|
-
excludeValueFromClassName: options?.excludeValueFromClassName,
|
86
|
-
});
|
87
|
-
return staticClassName ? [s[staticClassName]] : [];
|
88
|
-
}
|
89
|
-
return Object.keys(value).reduce((acc, viewport) => {
|
90
|
-
const base = viewport === "s";
|
91
|
-
const viewportClassName = applyClassName(className, value[viewport], {
|
92
|
-
base,
|
93
|
-
excludeValueFromClassName: options?.excludeValueFromClassName,
|
94
|
-
});
|
95
|
-
const suffix = base ? "" : `--${viewport}`;
|
96
|
-
return [...acc, s[`${viewportClassName}${suffix}`]];
|
97
|
-
}, []);
|
98
|
-
};
|
99
|
-
export const responsiveVariables = (variableName, value) => {
|
100
|
-
if (value === undefined)
|
101
|
-
return {};
|
102
|
-
if (typeof value !== "object")
|
103
|
-
return { [`${variableName}-s`]: value };
|
104
|
-
return Object.keys(value).reduce((acc, key) => {
|
105
|
-
const viewportValue = value[key];
|
106
|
-
if (viewportValue === undefined)
|
107
|
-
return acc;
|
108
|
-
if (viewportValue === false)
|
109
|
-
return acc;
|
110
|
-
return {
|
111
|
-
...acc,
|
112
|
-
[`${variableName}-${key}`]: viewportValue,
|
113
|
-
};
|
114
|
-
}, {});
|
115
|
-
};
|
116
|
-
const isResponsive = (prop) => {
|
117
|
-
if (prop === null)
|
118
|
-
return false;
|
119
|
-
return typeof prop === "object" && prop !== null && "s" in prop;
|
120
|
-
};
|
121
|
-
export const responsivePropDependency = (prop, resolver) => {
|
122
|
-
if (!isResponsive(prop))
|
123
|
-
return resolver(prop, "s");
|
124
|
-
const keys = Object.keys(prop);
|
125
|
-
return keys.reduce((acc, viewport) => {
|
126
|
-
const viewportValue = prop[viewport];
|
127
|
-
if (viewportValue === undefined || viewportValue === null)
|
128
|
-
return acc;
|
129
|
-
return { ...acc, [viewport]: resolver(viewportValue, viewport) };
|
130
|
-
}, {});
|
131
|
-
};
|
132
|
-
const viewports = ["s", "m", "l", "xl"];
|
133
|
-
export const resolveViewportValue = (viewport, value) => {
|
134
|
-
let result;
|
135
|
-
if (!isResponsive(value))
|
136
|
-
return value;
|
137
|
-
for (const currentViewport of viewports) {
|
138
|
-
const viewportValue = value[currentViewport];
|
139
|
-
if (viewportValue !== undefined)
|
140
|
-
result = viewportValue;
|
141
|
-
if (currentViewport === viewport)
|
142
|
-
return result;
|
143
|
-
}
|
144
|
-
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import type * as G from "../types/global";
|
2
|
+
type Value = string | boolean | number | undefined;
|
3
|
+
type ClassNameResolver = string | ((value: Value) => string);
|
4
|
+
/**
|
5
|
+
* Resolve an array of values into a classname string
|
6
|
+
*/
|
7
|
+
export declare const classNames: (...args: G.ClassName[]) => string;
|
8
|
+
export declare const responsiveClassNames: <V extends G.Responsive<Value>>(s: Record<string, string>, className: ClassNameResolver, value: V, options?: {
|
9
|
+
excludeValueFromClassName?: boolean;
|
10
|
+
}) => string[];
|
11
|
+
export declare const responsiveVariables: <V extends Value = Value>(variableName: G.CSSVariable, value?: G.Responsive<V>) => Record<G.CSSVariable, V>;
|
12
|
+
export declare const responsivePropDependency: <Result, T>(prop: G.Responsive<T>, resolver: (value: T, key: G.Viewport) => Result) => Result;
|
13
|
+
export {};
|
@@ -0,0 +1,83 @@
|
|
1
|
+
/**
|
2
|
+
* Resolve an array of values into a classname string
|
3
|
+
*/
|
4
|
+
export const classNames = (...args) => {
|
5
|
+
return args
|
6
|
+
.reduce((acc, cur) => {
|
7
|
+
if (Array.isArray(cur)) {
|
8
|
+
const className = classNames(...cur);
|
9
|
+
if (!className)
|
10
|
+
return acc;
|
11
|
+
return `${acc} ${className}`;
|
12
|
+
}
|
13
|
+
if (cur)
|
14
|
+
return `${acc} ${cur}`;
|
15
|
+
return acc;
|
16
|
+
}, "")
|
17
|
+
.trim();
|
18
|
+
};
|
19
|
+
const applyClassName = (passedClassName, value, options) => {
|
20
|
+
const { base, excludeValueFromClassName } = options || {};
|
21
|
+
const className = typeof passedClassName === "string" ? passedClassName : passedClassName(value);
|
22
|
+
if ((value === true && base) || excludeValueFromClassName)
|
23
|
+
return className;
|
24
|
+
// CSS should be turned on/off for non base viewport with mobile first approach
|
25
|
+
if (value === true && !base)
|
26
|
+
return `${className}-true`;
|
27
|
+
if (value === false && !base)
|
28
|
+
return `${className}-false`;
|
29
|
+
if (value !== undefined)
|
30
|
+
return `${className}-${value}`;
|
31
|
+
return null;
|
32
|
+
};
|
33
|
+
export const responsiveClassNames = (s, className, value, options) => {
|
34
|
+
if (typeof value !== "object") {
|
35
|
+
const staticClassName = applyClassName(className, value, {
|
36
|
+
base: true,
|
37
|
+
excludeValueFromClassName: options?.excludeValueFromClassName,
|
38
|
+
});
|
39
|
+
return staticClassName ? [s[staticClassName]] : [];
|
40
|
+
}
|
41
|
+
return Object.keys(value).reduce((acc, viewport) => {
|
42
|
+
const base = viewport === "s";
|
43
|
+
const viewportClassName = applyClassName(className, value[viewport], {
|
44
|
+
base,
|
45
|
+
excludeValueFromClassName: options?.excludeValueFromClassName,
|
46
|
+
});
|
47
|
+
const suffix = base ? "" : `--${viewport}`;
|
48
|
+
return [...acc, s[`${viewportClassName}${suffix}`]];
|
49
|
+
}, []);
|
50
|
+
};
|
51
|
+
export const responsiveVariables = (variableName, value) => {
|
52
|
+
if (value === undefined)
|
53
|
+
return {};
|
54
|
+
if (typeof value !== "object")
|
55
|
+
return { [`${variableName}-s`]: value };
|
56
|
+
return Object.keys(value).reduce((acc, key) => {
|
57
|
+
const viewportValue = value[key];
|
58
|
+
if (viewportValue === undefined)
|
59
|
+
return acc;
|
60
|
+
if (viewportValue === false)
|
61
|
+
return acc;
|
62
|
+
return {
|
63
|
+
...acc,
|
64
|
+
[`${variableName}-${key}`]: viewportValue,
|
65
|
+
};
|
66
|
+
}, {});
|
67
|
+
};
|
68
|
+
const isResponsive = (prop) => {
|
69
|
+
if (prop === null)
|
70
|
+
return false;
|
71
|
+
return typeof prop === "object" && prop !== null && "s" in prop;
|
72
|
+
};
|
73
|
+
export const responsivePropDependency = (prop, resolver) => {
|
74
|
+
if (!isResponsive(prop))
|
75
|
+
return resolver(prop, "s");
|
76
|
+
const keys = Object.keys(prop);
|
77
|
+
return keys.reduce((acc, viewport) => {
|
78
|
+
const viewportValue = prop[viewport];
|
79
|
+
if (viewportValue === undefined || viewportValue === null)
|
80
|
+
return acc;
|
81
|
+
return { ...acc, [viewport]: resolver(viewportValue, viewport) };
|
82
|
+
}, {});
|
83
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { isIOS } from "../platform.js";
|
2
|
-
import {
|
2
|
+
import { findClosestScrollableContainer } from "../dom/index.js";
|
3
3
|
import lockSafariScroll from "./lockSafari.js";
|
4
4
|
import lockStandardScroll from "./lockStandard.js";
|
5
5
|
let bodyLockedCount = 0;
|
@@ -7,8 +7,9 @@ let reset = () => { };
|
|
7
7
|
export const lockScroll = (args) => {
|
8
8
|
const isIOSLock = isIOS() && !args.containerEl && !args.originEl;
|
9
9
|
let container = document.body;
|
10
|
-
if (args.originEl && !isIOSLock)
|
11
|
-
container =
|
10
|
+
if (args.originEl && !isIOSLock) {
|
11
|
+
container = findClosestScrollableContainer({ el: args.originEl });
|
12
|
+
}
|
12
13
|
if (args.containerEl && !isIOSLock)
|
13
14
|
container = args.containerEl;
|
14
15
|
if (container === document.body)
|
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": "3.
|
4
|
+
"version": "3.6.0-canary.1",
|
5
5
|
"license": "MIT",
|
6
6
|
"email": "hello@reshaped.so",
|
7
7
|
"homepage": "https://reshaped.so",
|
@@ -74,8 +74,8 @@
|
|
74
74
|
"build:storybook": "storybook build -o dist/app --disable-telemetry",
|
75
75
|
"build:chromatic": "STORYBOOK_ENV=chromatic storybook build",
|
76
76
|
"release": "read -p 'Have you updated chromatic tests?' && yarn release:lib && yarn release:source && yarn build:storybook && yarn release:copy",
|
77
|
-
"release:lib": "yarn build && yarn publish
|
78
|
-
"release:canary": "yarn build && yarn
|
77
|
+
"release:lib": "yarn build && yarn publish",
|
78
|
+
"release:canary": "yarn build && yarn publish --tag canary",
|
79
79
|
"release:test": "yarn build && yarn pack --filename reshaped-test.tgz",
|
80
80
|
"release:source": "sh ./bin/release-source.sh",
|
81
81
|
"release:copy": "sh ./bin/release-copy.sh",
|
@@ -87,16 +87,16 @@
|
|
87
87
|
"lint": "yarn lint:js && yarn lint:css",
|
88
88
|
"lint:js": "eslint './src/**/*.{ts,tsx}' --fix",
|
89
89
|
"lint:css": "stylelint 'src/**/*.css'",
|
90
|
-
"commit": "
|
90
|
+
"commit": "git-cz"
|
91
91
|
},
|
92
92
|
"browserslist": [
|
93
93
|
"defaults and not IE 11"
|
94
94
|
],
|
95
95
|
"devDependencies": {
|
96
|
-
"@commitlint/cli": "19.8.
|
97
|
-
"@commitlint/config-conventional": "19.8.
|
98
|
-
"@commitlint/types": "19.8.
|
99
|
-
"@eslint/js": "9.
|
96
|
+
"@commitlint/cli": "19.8.1",
|
97
|
+
"@commitlint/config-conventional": "19.8.1",
|
98
|
+
"@commitlint/types": "19.8.1",
|
99
|
+
"@eslint/js": "9.26.0",
|
100
100
|
"@size-limit/preset-big-lib": "11.2.0",
|
101
101
|
"@storybook/addon-a11y": "8.6.12",
|
102
102
|
"@storybook/addon-actions": "8.6.12",
|
@@ -106,25 +106,25 @@
|
|
106
106
|
"@storybook/experimental-addon-test": "8.6.12",
|
107
107
|
"@storybook/react": "8.6.12",
|
108
108
|
"@storybook/react-vite": "8.6.12",
|
109
|
-
"@types/culori": "
|
109
|
+
"@types/culori": "4.0.0",
|
110
110
|
"@types/events": "3.0.3",
|
111
|
-
"@types/node": "22.
|
112
|
-
"@types/react": "19.1.
|
113
|
-
"@types/react-dom": "19.1.
|
111
|
+
"@types/node": "22.15.17",
|
112
|
+
"@types/react": "19.1.3",
|
113
|
+
"@types/react-dom": "19.1.3",
|
114
114
|
"@vitejs/plugin-react": "4.4.1",
|
115
|
-
"@vitest/browser": "3.1.
|
116
|
-
"@vitest/coverage-istanbul": "3.1.
|
117
|
-
"@vitest/coverage-v8": "3.1.
|
115
|
+
"@vitest/browser": "3.1.3",
|
116
|
+
"@vitest/coverage-istanbul": "3.1.3",
|
117
|
+
"@vitest/coverage-v8": "3.1.3",
|
118
118
|
"chromatic": "11.28.2",
|
119
119
|
"conventional-changelog-cli": "^5.0.0",
|
120
120
|
"cz-conventional-changelog": "3.3.0",
|
121
|
-
"eslint": "9.
|
122
|
-
"eslint-config-prettier": "10.1.
|
121
|
+
"eslint": "9.26.0",
|
122
|
+
"eslint-config-prettier": "10.1.5",
|
123
123
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
124
|
-
"eslint-plugin-prettier": "5.
|
124
|
+
"eslint-plugin-prettier": "5.4.0",
|
125
125
|
"eslint-plugin-react": "7.37.5",
|
126
126
|
"eslint-plugin-react-hooks": "5.2.0",
|
127
|
-
"lefthook": "1.11.
|
127
|
+
"lefthook": "1.11.12",
|
128
128
|
"playwright": "1.52.0",
|
129
129
|
"postcss": "8.5.3",
|
130
130
|
"postcss-cli": "11.0.1",
|
@@ -137,15 +137,15 @@
|
|
137
137
|
"resolve-tspaths": "0.8.23",
|
138
138
|
"size-limit": "11.2.0",
|
139
139
|
"storybook": "8.6.12",
|
140
|
-
"stylelint": "16.
|
140
|
+
"stylelint": "16.19.1",
|
141
141
|
"stylelint-config-prettier": "9.0.5",
|
142
142
|
"stylelint-config-standard": "38.0.0",
|
143
143
|
"ts-node": "10.9.2",
|
144
144
|
"typescript": "5.8.3",
|
145
|
-
"typescript-eslint": "8.
|
146
|
-
"vite": "6.3.
|
145
|
+
"typescript-eslint": "8.32.0",
|
146
|
+
"vite": "6.3.5",
|
147
147
|
"vite-tsconfig-paths": "5.1.4",
|
148
|
-
"vitest": "3.1.
|
148
|
+
"vitest": "3.1.3",
|
149
149
|
"vitest-browser-react": "0.1.1"
|
150
150
|
},
|
151
151
|
"peerDependencies": {
|
@@ -157,7 +157,7 @@
|
|
157
157
|
"@csstools/postcss-global-data": "3.0.0",
|
158
158
|
"chalk": "4.1.2",
|
159
159
|
"commander": "13.1.0",
|
160
|
-
"cssnano": "7.0.
|
160
|
+
"cssnano": "7.0.7",
|
161
161
|
"csstype": "3.1.3",
|
162
162
|
"culori": "4.0.1",
|
163
163
|
"postcss-custom-media": "11.0.5"
|
package/CHANGELOG-old.md
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
## WIP 3.5.2
|
2
|
-
|
3
|
-
- Tailwind 3: Preflight compatibility
|
4
|
-
- ScrollArea: fixed maxHeight
|
5
|
-
- Updated sideEffects to \*.css
|
6
|
-
|
7
|
-
## 3.5.1
|
8
|
-
|
9
|
-
- NumberField: user-select none for touch devices
|
10
|
-
- Tabs: Fixed arrow navigation
|
11
|
-
- Slider: Fixed drag propagation when used in swipeable modals
|
12
|
-
- Card: Removed internal content wrapper to fix Safari absolute positioning of contents inside the card
|
13
|
-
- [Pro] Storybook: Preserve theme and mode values while navigating stories
|
14
|
-
- [Pro] Storybook config: switched to js to resolve TS resolving issues
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react";
|
2
|
-
import { fn } from "@storybook/test";
|
3
|
-
declare const _default: {
|
4
|
-
title: string;
|
5
|
-
component: import("react").FC<import("./..").PopoverProps> & {
|
6
|
-
Dismissible: import("react").FC<import("../../Dismissible").DismissibleProps>;
|
7
|
-
Trigger: import("react").FC<import("../../_private/Flyout").FlyoutTriggerProps>;
|
8
|
-
Content: import("react").FC<import("../../_private/Flyout").FlyoutContentProps>;
|
9
|
-
};
|
10
|
-
parameters: {
|
11
|
-
iframe: {
|
12
|
-
url: string;
|
13
|
-
};
|
14
|
-
chromatic: {
|
15
|
-
disableSnapshot: boolean;
|
16
|
-
};
|
17
|
-
};
|
18
|
-
};
|
19
|
-
export default _default;
|
20
|
-
export declare const defaultActive: StoryObj<{
|
21
|
-
handleOpen: ReturnType<typeof fn>;
|
22
|
-
handleClose: ReturnType<typeof fn>;
|
23
|
-
}>;
|
24
|
-
export declare const active: StoryObj<{
|
25
|
-
handleOpen: ReturnType<typeof fn>;
|
26
|
-
handleClose: ReturnType<typeof fn>;
|
27
|
-
}>;
|
28
|
-
export declare const activeFalse: StoryObj<{
|
29
|
-
handleOpen: ReturnType<typeof fn>;
|
30
|
-
handleClose: ReturnType<typeof fn>;
|
31
|
-
}>;
|
32
|
-
export declare const dismissible: StoryObj<{
|
33
|
-
handleClose: ReturnType<typeof fn>;
|
34
|
-
}>;
|
35
|
-
export declare const triggerType: StoryObj<{
|
36
|
-
handleOpen: ReturnType<typeof fn>;
|
37
|
-
handleClose: ReturnType<typeof fn>;
|
38
|
-
}>;
|
39
|
-
export declare const className: StoryObj;
|
@@ -1,167 +0,0 @@
|
|
1
|
-
import { expect, fn, userEvent, within, waitFor } from "@storybook/test";
|
2
|
-
import Popover from "../index.js";
|
3
|
-
import Button from "../../Button/index.js";
|
4
|
-
import { sleep } from "../../../utilities/helpers.js";
|
5
|
-
export default {
|
6
|
-
title: "Components/Popover/tests",
|
7
|
-
component: Popover,
|
8
|
-
parameters: {
|
9
|
-
iframe: {
|
10
|
-
url: "https://reshaped.so/docs/components/popover",
|
11
|
-
},
|
12
|
-
chromatic: { disableSnapshot: true },
|
13
|
-
},
|
14
|
-
};
|
15
|
-
export const defaultActive = {
|
16
|
-
name: "defaultActive, uncontrolled",
|
17
|
-
args: {
|
18
|
-
handleOpen: fn(),
|
19
|
-
handleClose: fn(),
|
20
|
-
},
|
21
|
-
render: (args) => (<Popover onOpen={args.handleOpen} onClose={args.handleClose} defaultActive>
|
22
|
-
<Popover.Trigger>
|
23
|
-
{(attributes) => <Button attributes={attributes}>Open</Button>}
|
24
|
-
</Popover.Trigger>
|
25
|
-
<Popover.Content>Content</Popover.Content>
|
26
|
-
</Popover>),
|
27
|
-
play: async ({ canvasElement, args }) => {
|
28
|
-
const canvas = within(canvasElement.ownerDocument.body);
|
29
|
-
const trigger = canvas.getAllByRole("button")[0];
|
30
|
-
let item = canvas.getByText("Content");
|
31
|
-
// Wait for the open animation
|
32
|
-
await sleep(500);
|
33
|
-
await userEvent.click(document.body);
|
34
|
-
await waitFor(() => {
|
35
|
-
expect(args.handleClose).toHaveBeenCalledTimes(1);
|
36
|
-
expect(args.handleClose).toHaveBeenCalledWith({ reason: "outside-click" });
|
37
|
-
expect(item).not.toBeInTheDocument();
|
38
|
-
});
|
39
|
-
await userEvent.click(trigger);
|
40
|
-
await waitFor(() => {
|
41
|
-
expect(args.handleOpen).toHaveBeenCalledTimes(1);
|
42
|
-
expect(args.handleOpen).toHaveBeenCalledWith();
|
43
|
-
});
|
44
|
-
item = canvas.getByText("Content");
|
45
|
-
expect(item).toBeInTheDocument();
|
46
|
-
},
|
47
|
-
};
|
48
|
-
export const active = {
|
49
|
-
name: "active, controlled",
|
50
|
-
args: {
|
51
|
-
handleOpen: fn(),
|
52
|
-
handleClose: fn(),
|
53
|
-
},
|
54
|
-
render: (args) => (<Popover onOpen={args.handleOpen} onClose={args.handleClose} active>
|
55
|
-
<Popover.Trigger>
|
56
|
-
{(attributes) => <Button attributes={attributes}>Open</Button>}
|
57
|
-
</Popover.Trigger>
|
58
|
-
<Popover.Content>Content</Popover.Content>
|
59
|
-
</Popover>),
|
60
|
-
play: async ({ canvasElement, args }) => {
|
61
|
-
const canvas = within(canvasElement.ownerDocument.body);
|
62
|
-
const item = canvas.getByText("Content");
|
63
|
-
await userEvent.click(document.body);
|
64
|
-
await waitFor(() => {
|
65
|
-
expect(args.handleClose).toHaveBeenCalledTimes(1);
|
66
|
-
expect(args.handleClose).toHaveBeenCalledWith({ reason: "outside-click" });
|
67
|
-
});
|
68
|
-
expect(item).toBeInTheDocument();
|
69
|
-
},
|
70
|
-
};
|
71
|
-
export const activeFalse = {
|
72
|
-
name: "active false, controlled",
|
73
|
-
args: {
|
74
|
-
handleOpen: fn(),
|
75
|
-
handleClose: fn(),
|
76
|
-
},
|
77
|
-
render: (args) => (<Popover onOpen={args.handleOpen} onClose={args.handleClose} active={false}>
|
78
|
-
<Popover.Trigger>
|
79
|
-
{(attributes) => <Button attributes={attributes}>Open</Button>}
|
80
|
-
</Popover.Trigger>
|
81
|
-
<Popover.Content>Content</Popover.Content>
|
82
|
-
</Popover>),
|
83
|
-
play: async ({ canvasElement, args }) => {
|
84
|
-
const canvas = within(canvasElement.ownerDocument.body);
|
85
|
-
const trigger = canvas.getAllByRole("button")[0];
|
86
|
-
await userEvent.click(trigger);
|
87
|
-
await waitFor(() => {
|
88
|
-
expect(args.handleOpen).toHaveBeenCalledTimes(1);
|
89
|
-
expect(args.handleOpen).toHaveBeenCalledWith();
|
90
|
-
});
|
91
|
-
const item = canvas.queryByText("Content");
|
92
|
-
expect(item).not.toBeInTheDocument();
|
93
|
-
},
|
94
|
-
};
|
95
|
-
export const dismissible = {
|
96
|
-
name: "dismissible, onClose, className, attributes, closeAriaLabel",
|
97
|
-
args: {
|
98
|
-
handleClose: fn(),
|
99
|
-
},
|
100
|
-
render: (args) => (<Popover onClose={args.handleClose} defaultActive>
|
101
|
-
<Popover.Trigger>
|
102
|
-
{(attributes) => <Button attributes={attributes}>Open</Button>}
|
103
|
-
</Popover.Trigger>
|
104
|
-
<Popover.Content>
|
105
|
-
<Popover.Dismissible closeAriaLabel="Close" attributes={{ "data-testid": "test-id" }} className="test-classname">
|
106
|
-
Content
|
107
|
-
</Popover.Dismissible>
|
108
|
-
</Popover.Content>
|
109
|
-
</Popover>),
|
110
|
-
play: async ({ canvasElement, args }) => {
|
111
|
-
const canvas = within(canvasElement.ownerDocument.body);
|
112
|
-
const dismissible = canvas.getByTestId("test-id");
|
113
|
-
const closeButton = within(dismissible).getByRole("button");
|
114
|
-
expect(dismissible).toHaveClass("test-classname");
|
115
|
-
expect(closeButton).toHaveAccessibleName("Close");
|
116
|
-
await userEvent.click(closeButton);
|
117
|
-
await waitFor(() => {
|
118
|
-
expect(args.handleClose).toHaveBeenCalledTimes(1);
|
119
|
-
expect(args.handleClose).toHaveBeenCalledWith({});
|
120
|
-
});
|
121
|
-
},
|
122
|
-
};
|
123
|
-
export const triggerType = {
|
124
|
-
name: "triggerType hover",
|
125
|
-
args: {
|
126
|
-
handleOpen: fn(),
|
127
|
-
handleClose: fn(),
|
128
|
-
},
|
129
|
-
render: (args) => (<Popover onOpen={args.handleOpen} onClose={args.handleClose} triggerType="hover">
|
130
|
-
<Popover.Trigger>
|
131
|
-
{(attributes) => <Button attributes={attributes}>Open</Button>}
|
132
|
-
</Popover.Trigger>
|
133
|
-
<Popover.Content>Content</Popover.Content>
|
134
|
-
</Popover>),
|
135
|
-
play: async ({ canvasElement, args }) => {
|
136
|
-
const canvas = within(canvasElement.ownerDocument.body);
|
137
|
-
const trigger = canvas.getAllByRole("button")[0];
|
138
|
-
await userEvent.hover(trigger);
|
139
|
-
await waitFor(() => {
|
140
|
-
expect(args.handleOpen).toHaveBeenCalledTimes(1);
|
141
|
-
expect(args.handleOpen).toHaveBeenCalledWith();
|
142
|
-
});
|
143
|
-
await userEvent.unhover(trigger);
|
144
|
-
await waitFor(() => {
|
145
|
-
expect(args.handleClose).toHaveBeenCalledTimes(1);
|
146
|
-
expect(args.handleClose).toHaveBeenCalledWith({});
|
147
|
-
});
|
148
|
-
},
|
149
|
-
};
|
150
|
-
export const className = {
|
151
|
-
name: "className, attributes",
|
152
|
-
render: () => (<div data-testid="root">
|
153
|
-
<Popover active>
|
154
|
-
<Popover.Trigger>
|
155
|
-
{(attributes) => <Button attributes={attributes}>Open</Button>}
|
156
|
-
</Popover.Trigger>
|
157
|
-
<Popover.Content className="test-classname" attributes={{ "data-testid": "test-id" }}>
|
158
|
-
Content
|
159
|
-
</Popover.Content>
|
160
|
-
</Popover>
|
161
|
-
</div>),
|
162
|
-
play: async ({ canvasElement }) => {
|
163
|
-
const canvas = within(canvasElement.ownerDocument.body);
|
164
|
-
const menu = await canvas.findByTestId("test-id");
|
165
|
-
expect(menu).toHaveClass("test-classname");
|
166
|
-
},
|
167
|
-
};
|
@@ -1,38 +0,0 @@
|
|
1
|
-
import { StoryObj } from "@storybook/react";
|
2
|
-
import { fn } from "@storybook/test";
|
3
|
-
declare const _default: {
|
4
|
-
title: string;
|
5
|
-
component: import("react").FC<import("./..").SliderProps>;
|
6
|
-
parameters: {
|
7
|
-
iframe: {
|
8
|
-
url: string;
|
9
|
-
};
|
10
|
-
chromatic: {
|
11
|
-
disableSnapshot: boolean;
|
12
|
-
};
|
13
|
-
};
|
14
|
-
};
|
15
|
-
export default _default;
|
16
|
-
export declare const defaultValue: StoryObj<{
|
17
|
-
handleChange: ReturnType<typeof fn>;
|
18
|
-
handleChangeCommit: ReturnType<typeof fn>;
|
19
|
-
}>;
|
20
|
-
export declare const value: StoryObj<{
|
21
|
-
handleChange: ReturnType<typeof fn>;
|
22
|
-
handleChangeCommit: ReturnType<typeof fn>;
|
23
|
-
}>;
|
24
|
-
export declare const rangeDefaultValue: StoryObj<{
|
25
|
-
handleChange: ReturnType<typeof fn>;
|
26
|
-
handleChangeCommit: ReturnType<typeof fn>;
|
27
|
-
}>;
|
28
|
-
export declare const rangeValue: StoryObj<{
|
29
|
-
handleChange: ReturnType<typeof fn>;
|
30
|
-
handleChangeCommit: ReturnType<typeof fn>;
|
31
|
-
}>;
|
32
|
-
export declare const minMax: StoryObj;
|
33
|
-
export declare const step: StoryObj;
|
34
|
-
export declare const stepFloat: StoryObj;
|
35
|
-
export declare const renderValue: StoryObj;
|
36
|
-
export declare const withoutTooltipValue: StoryObj;
|
37
|
-
export declare const disabled: StoryObj;
|
38
|
-
export declare const className: StoryObj;
|