@snack-uikit/breadcrumbs 0.8.55 → 0.8.56
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 +11 -0
- package/dist/components/Collapse/styles.module.css +1 -1
- package/dist/components/Crumb/styles.module.css +1 -1
- package/dist/hooks.js +1 -1
- package/dist/utils/getMaxPossibleWidth.js +10 -6
- package/package.json +5 -5
- package/src/hooks.tsx +2 -1
- package/src/utils/getMaxPossibleWidth.ts +13 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 0.8.56 (2024-09-23)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **PDS-480:** remove direct usage of browser api elements ([1231ff7](https://github.com/cloud-ru-tech/snack-uikit/commit/1231ff7ab7a1b210b579a7b694633ef23bffcf44))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 0.8.55 (2024-09-06)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
outline-width:var(--border-state-focus-s-border-width, 2px);
|
|
11
11
|
outline-style:var(--border-state-focus-s-border-style, solid);
|
|
12
12
|
outline-color:var(--border-state-focus-s-border-color, );
|
|
13
|
-
outline-color:var(--sys-available-complementary, #
|
|
13
|
+
outline-color:var(--sys-available-complementary, #1c1c24);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.collapsedRow{
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
outline-width:var(--border-state-focus-s-border-width, 2px);
|
|
31
31
|
outline-style:var(--border-state-focus-s-border-style, solid);
|
|
32
32
|
outline-color:var(--border-state-focus-s-border-color, );
|
|
33
|
-
outline-color:var(--sys-available-complementary, #
|
|
33
|
+
outline-color:var(--sys-available-complementary, #1c1c24);
|
|
34
34
|
}
|
|
35
35
|
.crumb[data-size=xs], a.crumb[data-size=xs]{
|
|
36
36
|
height:var(--size-breadcrumbs-xs, 16px);
|
package/dist/hooks.js
CHANGED
|
@@ -72,7 +72,7 @@ export function useBreadcrumbsLayout(containerRef) {
|
|
|
72
72
|
}, 100);
|
|
73
73
|
const visibleContainerObserver = new ResizeObserver(reselectConfig);
|
|
74
74
|
visibleContainerObserver.observe(visibleContainer);
|
|
75
|
-
visibleContainerObserver.observe(
|
|
75
|
+
visibleContainerObserver.observe(document.body);
|
|
76
76
|
return () => visibleContainerObserver.disconnect();
|
|
77
77
|
}, [containerRef, selectConfigForWidth]);
|
|
78
78
|
return { setConfigs, currentConfig };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isBrowser } from '@snack-uikit/utils';
|
|
1
2
|
/**
|
|
2
3
|
* Функция предназначена для измерения максимально возможной ширины контейнера
|
|
3
4
|
* она вставляет широкую распорку, замеряет ширину и удаляет ее
|
|
@@ -7,10 +8,13 @@ export const getMaxPossibleWidth = (element) => {
|
|
|
7
8
|
if (!element) {
|
|
8
9
|
return 0;
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
if (isBrowser()) {
|
|
12
|
+
const spreader = document.createElement('div');
|
|
13
|
+
spreader.style.width = '10000px';
|
|
14
|
+
element.append(spreader);
|
|
15
|
+
const width = element.getBoundingClientRect().width;
|
|
16
|
+
element.removeChild(spreader);
|
|
17
|
+
return width;
|
|
18
|
+
}
|
|
19
|
+
return 0;
|
|
16
20
|
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Breadcrumbs",
|
|
7
|
-
"version": "0.8.
|
|
7
|
+
"version": "0.8.56",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"scripts": {},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@snack-uikit/list": "0.16.
|
|
36
|
-
"@snack-uikit/typography": "0.6.
|
|
37
|
-
"@snack-uikit/utils": "3.
|
|
35
|
+
"@snack-uikit/list": "0.16.2",
|
|
36
|
+
"@snack-uikit/typography": "0.6.3",
|
|
37
|
+
"@snack-uikit/utils": "3.4.0",
|
|
38
38
|
"classnames": "2.3.2",
|
|
39
39
|
"lodash.debounce": "4.0.8"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "f9212fe04b0dbba9bedea1bb3a034ab612287841"
|
|
42
42
|
}
|
package/src/hooks.tsx
CHANGED
|
@@ -77,6 +77,7 @@ export function useBreadcrumbsLayout(containerRef: RefObject<HTMLElement>): Brea
|
|
|
77
77
|
|
|
78
78
|
const reselectConfig = debounce(() => {
|
|
79
79
|
const width = getMaxPossibleWidth(visibleContainer);
|
|
80
|
+
|
|
80
81
|
setCurrentConfig(prevConfig => {
|
|
81
82
|
if (prevConfig?.containerWidth === width) {
|
|
82
83
|
return prevConfig;
|
|
@@ -90,7 +91,7 @@ export function useBreadcrumbsLayout(containerRef: RefObject<HTMLElement>): Brea
|
|
|
90
91
|
const visibleContainerObserver = new ResizeObserver(reselectConfig);
|
|
91
92
|
|
|
92
93
|
visibleContainerObserver.observe(visibleContainer);
|
|
93
|
-
visibleContainerObserver.observe(
|
|
94
|
+
visibleContainerObserver.observe(document.body);
|
|
94
95
|
|
|
95
96
|
return () => visibleContainerObserver.disconnect();
|
|
96
97
|
}, [containerRef, selectConfigForWidth]);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isBrowser } from '@snack-uikit/utils';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Функция предназначена для измерения максимально возможной ширины контейнера
|
|
3
5
|
* она вставляет широкую распорку, замеряет ширину и удаляет ее
|
|
@@ -7,11 +9,16 @@ export const getMaxPossibleWidth = (element: HTMLElement): number => {
|
|
|
7
9
|
if (!element) {
|
|
8
10
|
return 0;
|
|
9
11
|
}
|
|
10
|
-
const spreader = document.createElement('DIV');
|
|
11
|
-
spreader.style.width = '10000px';
|
|
12
|
-
element.append(spreader);
|
|
13
|
-
const width = element.getBoundingClientRect().width;
|
|
14
|
-
element.removeChild(spreader);
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
if (isBrowser()) {
|
|
14
|
+
const spreader = document.createElement('div');
|
|
15
|
+
spreader.style.width = '10000px';
|
|
16
|
+
element.append(spreader);
|
|
17
|
+
const width = element.getBoundingClientRect().width;
|
|
18
|
+
element.removeChild(spreader);
|
|
19
|
+
|
|
20
|
+
return width;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return 0;
|
|
17
24
|
};
|