reshaped 3.2.0-canary.4 → 3.2.0-canary.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.
- package/CHANGELOG.md +8 -0
- package/dist/bundle.css +1 -1
- package/dist/bundle.js +11 -11
- package/dist/components/Actionable/Actionable.js +2 -2
- package/dist/components/Actionable/Actionable.module.css +1 -1
- package/dist/components/Actionable/Actionable.types.d.ts +1 -0
- package/dist/components/Autocomplete/Autocomplete.js +10 -4
- package/dist/components/Dismissible/Dismissible.module.css +1 -1
- package/dist/components/Overlay/tests/Overlay.stories.js +1 -1
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Table/Table.js +6 -4
- package/dist/components/Table/Table.types.d.ts +6 -1
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/_private/Expandable/Expandable.js +9 -5
- package/dist/components/_private/Flyout/Flyout.types.d.ts +1 -0
- package/dist/components/_private/Flyout/FlyoutControlled.js +10 -6
- package/dist/components/_private/Flyout/useFlyout.js +2 -3
- package/dist/components/_private/Flyout/utilities/cooldown.d.ts +1 -1
- package/dist/components/_private/Flyout/utilities/cooldown.js +17 -5
- package/dist/hooks/_private/useOnClickOutside.js +3 -2
- package/dist/hooks/_private/useSingletonHotkeys.js +16 -13
- package/dist/hooks/tests/useHotkeys.stories.js +6 -0
- package/dist/tests/ShadowDOM.stories.d.ts +6 -0
- package/dist/tests/ShadowDOM.stories.js +110 -0
- package/dist/themes/_generator/tests/themes.stories.js +1 -1
- package/dist/utilities/a11y/TrapFocus.js +14 -5
- package/dist/utilities/a11y/focus.d.ts +1 -1
- package/dist/utilities/a11y/focus.js +10 -5
- package/dist/utilities/dom.d.ts +2 -1
- package/dist/utilities/dom.js +12 -2
- package/package.json +2 -1
package/dist/utilities/dom.js
CHANGED
@@ -1,14 +1,20 @@
|
|
1
|
-
export const getClosestFlyoutTarget = (el) => {
|
1
|
+
export const getClosestFlyoutTarget = (el, iteration = 0) => {
|
2
2
|
const style = el && window.getComputedStyle(el);
|
3
3
|
const overflowY = style?.overflowY;
|
4
4
|
const position = style?.position;
|
5
5
|
const isScrollable = overflowY?.includes("scroll");
|
6
6
|
const isFixed = position === "fixed" || position === "sticky";
|
7
|
+
// Only check shadow root on the first run
|
8
|
+
if (iteration === 0) {
|
9
|
+
const shadowRoot = getShadowRoot(el);
|
10
|
+
if (shadowRoot?.firstElementChild)
|
11
|
+
return shadowRoot.firstElementChild;
|
12
|
+
}
|
7
13
|
if (el === document.body || !el)
|
8
14
|
return document.body;
|
9
15
|
if ((isScrollable && el.scrollHeight > el.clientHeight) || isFixed)
|
10
16
|
return el;
|
11
|
-
return getClosestFlyoutTarget(el.parentElement);
|
17
|
+
return getClosestFlyoutTarget(el.parentElement, iteration + 1);
|
12
18
|
};
|
13
19
|
export const disableUserSelect = () => {
|
14
20
|
document.body.style.userSelect = "none";
|
@@ -25,3 +31,7 @@ export const enableScroll = () => {
|
|
25
31
|
window.removeEventListener("wheel", preventDefault);
|
26
32
|
window.removeEventListener("touchmove", preventDefault);
|
27
33
|
};
|
34
|
+
export const getShadowRoot = (el) => {
|
35
|
+
const rootNode = el?.getRootNode();
|
36
|
+
return rootNode instanceof ShadowRoot ? rootNode : null;
|
37
|
+
};
|
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.2.0-canary.
|
4
|
+
"version": "3.2.0-canary.6",
|
5
5
|
"license": "MIT",
|
6
6
|
"email": "hello@reshaped.so",
|
7
7
|
"homepage": "https://reshaped.so",
|
@@ -140,6 +140,7 @@
|
|
140
140
|
"prettier": "3.3.3",
|
141
141
|
"react": "18.3.1",
|
142
142
|
"react-dom": "18.3.1",
|
143
|
+
"react-shadow": "^20.5.0",
|
143
144
|
"resolve-tspaths": "0.8.19",
|
144
145
|
"size-limit": "11.1.4",
|
145
146
|
"storybook": "8.2.8",
|