@semcore/base-components 17.0.0-prerelease.36 → 17.0.0-prerelease.39
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 +6 -2
- package/lib/cjs/components/popper/Popper.js +3 -2
- package/lib/cjs/components/popper/Popper.js.map +1 -1
- package/lib/cjs/components/scroll-area/ScrollBar.js +8 -0
- package/lib/cjs/components/scroll-area/ScrollBar.js.map +1 -1
- package/lib/es6/components/popper/Popper.js +2 -1
- package/lib/es6/components/popper/Popper.js.map +1 -1
- package/lib/es6/components/scroll-area/ScrollBar.js +8 -0
- package/lib/es6/components/scroll-area/ScrollBar.js.map +1 -1
- package/lib/esm/components/animation/Animation.mjs +2 -2
- package/lib/esm/components/animation/Collapse.mjs +1 -2
- package/lib/esm/components/animation/FadeInOut.mjs +1 -2
- package/lib/esm/components/animation/Scale.mjs +1 -2
- package/lib/esm/components/animation/Slide.mjs +1 -2
- package/lib/esm/components/animation/Transform.mjs +1 -2
- package/lib/esm/components/animation/index.mjs +15 -0
- package/lib/esm/components/ellipsis/Ellipsis.mjs +6 -6
- package/lib/esm/components/ellipsis/EllipsisManager.mjs +20 -24
- package/lib/esm/components/ellipsis/Queue.mjs +2 -3
- package/lib/esm/components/ellipsis/index.mjs +4 -0
- package/lib/esm/components/flex-box/Box/useBox.mjs +0 -1
- package/lib/esm/components/flex-box/Flex/useFlex.mjs +0 -1
- package/lib/esm/components/flex-box/index.mjs +14 -0
- package/lib/esm/components/flex-box/invalid-state-box/InvalidStateBox.mjs +4 -3
- package/lib/esm/components/flex-box/screen-reader-only-box/ScreenReaderOnlyBox.mjs +4 -3
- package/lib/esm/components/grid/Grid.mjs +2 -2
- package/lib/esm/components/hint/Hint.mjs +6 -7
- package/lib/esm/components/hint/index.mjs +4 -0
- package/lib/esm/components/neighbor-location/NeighborLocation.mjs +2 -2
- package/lib/esm/components/neighbor-location/index.mjs +6 -0
- package/lib/esm/components/outside-click/OutsideClick.mjs +9 -9
- package/lib/esm/components/outside-click/index.mjs +4 -0
- package/lib/esm/components/popper/Popper.mjs +28 -31
- package/lib/esm/components/popper/arrowOffset.mjs +1 -2
- package/lib/esm/components/popper/createPopper.mjs +1 -1
- package/lib/esm/components/popper/index.mjs +5 -0
- package/lib/esm/components/popper/modifiers/applyMaxSize.mjs +1 -1
- package/lib/esm/components/popper/modifiers/cursorAnchoring.mjs +2 -3
- package/lib/esm/components/portal/Portal.mjs +2 -2
- package/lib/esm/components/portal/index.mjs +6 -0
- package/lib/esm/components/scroll-area/ScrollArea.mjs +13 -16
- package/lib/esm/components/scroll-area/ScrollBar.mjs +8 -5
- package/lib/esm/components/scroll-area/index.mjs +7 -0
- package/lib/esm/index.mjs +33 -24
- package/package.json +4 -4
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
import {
|
|
3
|
+
import { sstyled, Component, lastInteraction, assignProps, createComponent } from "@semcore/core";
|
|
4
4
|
import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
|
|
5
5
|
import canUseDOM from "@semcore/core/lib/utils/canUseDOM";
|
|
6
6
|
import { isAdvanceMode } from "@semcore/core/lib/utils/findComponent";
|
|
7
7
|
import trottle from "@semcore/core/lib/utils/rafTrottle";
|
|
8
8
|
import uniqueIDEnhancement from "@semcore/core/lib/utils/uniqueID";
|
|
9
9
|
import React from "react";
|
|
10
|
-
import
|
|
10
|
+
import "../flex-box/index.mjs";
|
|
11
|
+
import { setAreaValue as setAriaValues, ScrollBar } from "./ScrollBar.mjs";
|
|
11
12
|
import Box from "../flex-box/Box/index.mjs";
|
|
12
|
-
/*!__reshadow-styles__:"./style/scroll-area.shadow.css"*/
|
|
13
13
|
const style = (
|
|
14
14
|
/*__reshadow_css_start__*/
|
|
15
15
|
(sstyled.insert(
|
|
@@ -151,8 +151,8 @@ class ScrollAreaRoot extends Component {
|
|
|
151
151
|
const roundedScroll = Math.round(scroll);
|
|
152
152
|
const roundedMaxScroll = Math.round(maxScroll);
|
|
153
153
|
let shadow = "";
|
|
154
|
-
if (roundedMaxScroll <= 0)
|
|
155
|
-
else if (roundedScroll <= 0) {
|
|
154
|
+
if (roundedMaxScroll <= 0) {
|
|
155
|
+
} else if (roundedScroll <= 0) {
|
|
156
156
|
shadow = "end";
|
|
157
157
|
} else if (roundedScroll >= roundedMaxScroll) {
|
|
158
158
|
shadow = "start";
|
|
@@ -280,25 +280,23 @@ class ScrollAreaRoot extends Component {
|
|
|
280
280
|
};
|
|
281
281
|
}
|
|
282
282
|
componentDidMount() {
|
|
283
|
-
var _a, _b, _c, _d;
|
|
284
283
|
this.calculate();
|
|
285
284
|
this.updateBarsAria();
|
|
286
285
|
if (this.$inner) {
|
|
287
|
-
|
|
286
|
+
this.observer?.observe(this.$inner);
|
|
288
287
|
}
|
|
289
288
|
if (this.$container) {
|
|
290
|
-
|
|
289
|
+
this.observer?.observe(this.$container);
|
|
291
290
|
}
|
|
292
291
|
if (this.$wrapper) {
|
|
293
|
-
|
|
292
|
+
this.observer?.observe(this.$wrapper);
|
|
294
293
|
}
|
|
295
294
|
if (!this.asProps.disableAutofocusToContent) {
|
|
296
295
|
this.hasAutoFocusToContent = true;
|
|
297
|
-
|
|
296
|
+
this.$inner?.addEventListener("focusin", this.handleFocusIn);
|
|
298
297
|
}
|
|
299
298
|
}
|
|
300
299
|
componentDidUpdate(prevProps) {
|
|
301
|
-
var _a, _b;
|
|
302
300
|
this.calculate();
|
|
303
301
|
const {
|
|
304
302
|
disableAutofocusToContent
|
|
@@ -306,19 +304,18 @@ class ScrollAreaRoot extends Component {
|
|
|
306
304
|
if (prevProps.disableAutofocusToContent !== disableAutofocusToContent) {
|
|
307
305
|
if (disableAutofocusToContent && this.hasAutoFocusToContent) {
|
|
308
306
|
this.hasAutoFocusToContent = false;
|
|
309
|
-
|
|
307
|
+
this.$inner?.removeEventListener("focusin", this.handleFocusIn);
|
|
310
308
|
} else if (!this.hasAutoFocusToContent) {
|
|
311
309
|
this.hasAutoFocusToContent = true;
|
|
312
|
-
|
|
310
|
+
this.$inner?.addEventListener("focusin", this.handleFocusIn);
|
|
313
311
|
}
|
|
314
312
|
}
|
|
315
313
|
}
|
|
316
314
|
componentWillUnmount() {
|
|
317
|
-
|
|
318
|
-
(_a = this.observer) == null ? void 0 : _a.disconnect();
|
|
315
|
+
this.observer?.disconnect();
|
|
319
316
|
if (!this.asProps.disableAutofocusToContent) {
|
|
320
317
|
this.hasAutoFocusToContent = false;
|
|
321
|
-
|
|
318
|
+
this.$inner?.removeEventListener("focusin", this.handleFocusIn);
|
|
322
319
|
}
|
|
323
320
|
}
|
|
324
321
|
render() {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import {
|
|
2
|
+
import { sstyled, Component, assignProps, createComponent } from "@semcore/core";
|
|
3
3
|
import contextEnhance from "@semcore/core/lib/utils/enhances/contextEnhance";
|
|
4
4
|
import React from "react";
|
|
5
|
+
import "../flex-box/index.mjs";
|
|
5
6
|
import Box from "../flex-box/Box/index.mjs";
|
|
6
|
-
/*!__reshadow-styles__:"./style/scroll-bar.shadow.css"*/
|
|
7
7
|
const style = (
|
|
8
8
|
/*__reshadow_css_start__*/
|
|
9
9
|
(sstyled.insert(
|
|
@@ -81,7 +81,7 @@ class ScrollBarRoot extends Component {
|
|
|
81
81
|
} = this.asProps;
|
|
82
82
|
if (orientation === "horizontal" && horizontalBarRef) horizontalBarRef.current = domNode;
|
|
83
83
|
if (orientation === "vertical" && verticalBarRef) verticalBarRef.current = domNode;
|
|
84
|
-
setAriaValues(this.$container, horizontalBarRef
|
|
84
|
+
setAriaValues(this.$container, horizontalBarRef?.current, verticalBarRef?.current);
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
_defineProperty(this, "refSlider", (node) => {
|
|
@@ -92,6 +92,9 @@ class ScrollBarRoot extends Component {
|
|
|
92
92
|
_defineProperty(this, "calculate", () => {
|
|
93
93
|
if (!this.$container) return;
|
|
94
94
|
const visibleScroll = this.calculateVisibleScroll();
|
|
95
|
+
if (!visibleScroll && this.$slider) {
|
|
96
|
+
this.$slider.style.transform = "none";
|
|
97
|
+
}
|
|
95
98
|
this.setState({
|
|
96
99
|
visibleScroll
|
|
97
100
|
}, () => {
|
|
@@ -333,7 +336,7 @@ class ScrollBarRoot extends Component {
|
|
|
333
336
|
if (orientation === "horizontal") {
|
|
334
337
|
if (leftOffset) offsetSum += leftOffset;
|
|
335
338
|
if (rightOffset) offsetSum += rightOffset;
|
|
336
|
-
if (position === "sticky" &&
|
|
339
|
+
if (position === "sticky" && container?.current) {
|
|
337
340
|
const {
|
|
338
341
|
left,
|
|
339
342
|
right
|
|
@@ -349,7 +352,7 @@ class ScrollBarRoot extends Component {
|
|
|
349
352
|
if (orientation === "vertical") {
|
|
350
353
|
if (topOffset) offsetSum += topOffset;
|
|
351
354
|
if (bottomOffset) offsetSum += bottomOffset;
|
|
352
|
-
if (position === "sticky" &&
|
|
355
|
+
if (position === "sticky" && container?.current) {
|
|
353
356
|
const {
|
|
354
357
|
top,
|
|
355
358
|
bottom
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1,36 +1,45 @@
|
|
|
1
|
+
import "./components/animation/index.mjs";
|
|
1
2
|
import { defaultBreakpoints } from "./components/breakpoints/index.mjs";
|
|
3
|
+
import "./components/ellipsis/index.mjs";
|
|
4
|
+
import "./components/flex-box/index.mjs";
|
|
2
5
|
import { Col } from "./components/grid/index.mjs";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
6
|
+
import "./components/hint/index.mjs";
|
|
7
|
+
import "./components/neighbor-location/index.mjs";
|
|
8
|
+
import "./components/outside-click/index.mjs";
|
|
9
|
+
import "./components/popper/index.mjs";
|
|
10
|
+
import "./components/portal/index.mjs";
|
|
11
|
+
import "./components/scroll-area/index.mjs";
|
|
12
|
+
import { default as default2, animationContext } from "./components/animation/Animation.mjs";
|
|
13
|
+
import { default as default3 } from "./components/flex-box/Box/index.mjs";
|
|
14
|
+
import { default as default4 } from "./components/animation/Collapse.mjs";
|
|
9
15
|
import { DEFAULT_MEDIA, MediaList, createBreakpoints } from "./components/breakpoints/Breakpoints.mjs";
|
|
10
16
|
import { Ellipsis } from "./components/ellipsis/Ellipsis.mjs";
|
|
11
|
-
import { default as
|
|
12
|
-
import { default as
|
|
17
|
+
import { default as default5 } from "./components/animation/FadeInOut.mjs";
|
|
18
|
+
import { default as default6 } from "./components/flex-box/Flex/index.mjs";
|
|
13
19
|
import { Hint } from "./components/hint/Hint.mjs";
|
|
14
20
|
import { InvalidStateBox } from "./components/flex-box/invalid-state-box/InvalidStateBox.mjs";
|
|
15
21
|
import { NeighborLocation, NeighborLocationRoot, useNeighborLocationDetect } from "./components/neighbor-location/NeighborLocation.mjs";
|
|
16
22
|
import { OutsideClick } from "./components/outside-click/OutsideClick.mjs";
|
|
17
23
|
import { Popper, isInputTriggerTag } from "./components/popper/Popper.mjs";
|
|
18
|
-
import { default as
|
|
19
|
-
import { default as
|
|
24
|
+
import { default as default7, PortalContext, PortalProvider } from "./components/portal/Portal.mjs";
|
|
25
|
+
import { default as default8 } from "./components/grid/Grid.mjs";
|
|
26
|
+
import { default as default9 } from "./components/animation/Scale.mjs";
|
|
20
27
|
import { ScreenReaderOnly } from "./components/flex-box/screen-reader-only-box/ScreenReaderOnlyBox.mjs";
|
|
21
28
|
import { ScrollArea, eventCalculate } from "./components/scroll-area/ScrollArea.mjs";
|
|
22
|
-
import { default as
|
|
23
|
-
import { default as
|
|
29
|
+
import { default as default10 } from "./components/animation/Slide.mjs";
|
|
30
|
+
import { default as default11 } from "./components/animation/Transform.mjs";
|
|
24
31
|
import { hideScrollBarsFromScreenReadersContext } from "./components/scroll-area/ScrollBar.mjs";
|
|
32
|
+
import { default as default12 } from "./components/flex-box/Box/useBox.mjs";
|
|
33
|
+
import { default as default13 } from "./components/flex-box/Flex/useFlex.mjs";
|
|
25
34
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
35
|
+
default2 as Animation,
|
|
36
|
+
default3 as Box,
|
|
28
37
|
Col,
|
|
29
|
-
|
|
38
|
+
default4 as Collapse,
|
|
30
39
|
DEFAULT_MEDIA,
|
|
31
40
|
Ellipsis,
|
|
32
|
-
|
|
33
|
-
|
|
41
|
+
default5 as FadeInOut,
|
|
42
|
+
default6 as Flex,
|
|
34
43
|
Hint,
|
|
35
44
|
InvalidStateBox,
|
|
36
45
|
MediaList,
|
|
@@ -38,22 +47,22 @@ export {
|
|
|
38
47
|
NeighborLocationRoot,
|
|
39
48
|
OutsideClick,
|
|
40
49
|
Popper,
|
|
41
|
-
|
|
50
|
+
default7 as Portal,
|
|
42
51
|
PortalContext,
|
|
43
52
|
PortalProvider,
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
default8 as Row,
|
|
54
|
+
default9 as Scale,
|
|
46
55
|
ScreenReaderOnly,
|
|
47
56
|
ScrollArea,
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
default10 as Slide,
|
|
58
|
+
default11 as Transform,
|
|
50
59
|
animationContext,
|
|
51
60
|
createBreakpoints,
|
|
52
61
|
defaultBreakpoints,
|
|
53
62
|
eventCalculate,
|
|
54
63
|
hideScrollBarsFromScreenReadersContext,
|
|
55
64
|
isInputTriggerTag,
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
default12 as useBox,
|
|
66
|
+
default13 as useFlex,
|
|
58
67
|
useNeighborLocationDetect
|
|
59
68
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/base-components",
|
|
3
3
|
"description": "Semrush Base Components",
|
|
4
|
-
"version": "17.0.0-prerelease.
|
|
4
|
+
"version": "17.0.0-prerelease.39",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/esm/index.mjs",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
"
|
|
13
|
+
"types": "./lib/types/index.d.ts",
|
|
14
14
|
"import": "./lib/esm/index.mjs",
|
|
15
|
-
"
|
|
15
|
+
"require": "./lib/cjs/index.js"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@types/classnames": "2.2.6",
|
|
35
|
-
"@semcore/core": "17.0.0-prerelease.
|
|
35
|
+
"@semcore/core": "17.0.0-prerelease.39",
|
|
36
36
|
"@semcore/testing-utils": "1.0.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|