@atlaskit/navigation-system 4.1.0 → 4.2.0
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 +12 -0
- package/dist/cjs/ui/page-layout/panel-splitter/get-width.js +2 -8
- package/dist/cjs/ui/page-layout/use-safe-default-width.js +9 -16
- package/dist/es2019/ui/page-layout/panel-splitter/get-width.js +2 -9
- package/dist/es2019/ui/page-layout/use-safe-default-width.js +9 -17
- package/dist/esm/ui/page-layout/panel-splitter/get-width.js +2 -8
- package/dist/esm/ui/page-layout/use-safe-default-width.js +9 -17
- package/dist/types/ui/page-layout/use-safe-default-width.d.ts +1 -5
- package/dist/types-ts4.5/ui/page-layout/use-safe-default-width.d.ts +1 -5
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 4.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`5ab567cfb4d29`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5ab567cfb4d29) -
|
|
8
|
+
Cleans up the `platform_dst_nav4_panel_splitter_guards` feature gate. Panel splitters will now use
|
|
9
|
+
a safe fallback default width if the provided default width is not an integer.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 4.1.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getWidthFromDragLocation = exports.getPixelWidth = void 0;
|
|
7
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
7
|
var getWidthFromDragLocation = exports.getWidthFromDragLocation = function getWidthFromDragLocation(_ref) {
|
|
9
8
|
var initialWidth = _ref.initialWidth,
|
|
10
9
|
location = _ref.location,
|
|
@@ -26,11 +25,6 @@ var getWidthFromDragLocation = exports.getWidthFromDragLocation = function getWi
|
|
|
26
25
|
* Returns the computed width of an element in pixels.
|
|
27
26
|
*/
|
|
28
27
|
var getPixelWidth = exports.getPixelWidth = function getPixelWidth(element) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return element.offsetWidth;
|
|
32
|
-
}
|
|
33
|
-
var _window$getComputedSt = window.getComputedStyle(element),
|
|
34
|
-
width = _window$getComputedSt.width;
|
|
35
|
-
return parseInt(width);
|
|
28
|
+
// Always returns an integer. Returns 0 if element is hidden / removed.
|
|
29
|
+
return element.offsetWidth;
|
|
36
30
|
};
|
|
@@ -4,29 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useSafeDefaultWidth = useSafeDefaultWidth;
|
|
7
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
10
|
-
* `useSafeDefaultWidth` returns the provided `defaultWidthProp`.
|
|
11
|
-
*
|
|
12
|
-
* When `platform_dst_nav4_panel_splitter_guards` is enabled,
|
|
13
|
-
* `useSafeDefaultWidth` returns the `fallbackWidth` if the provided `defaultWidthProp` is not an integer value.
|
|
8
|
+
* Returns the `fallbackWidth` if the provided `defaultWidthProp` is not an integer value.
|
|
14
9
|
*/
|
|
15
10
|
function useSafeDefaultWidth(_ref) {
|
|
16
11
|
var defaultWidthProp = _ref.defaultWidthProp,
|
|
17
12
|
fallbackDefaultWidth = _ref.fallbackDefaultWidth,
|
|
18
13
|
slotName = _ref.slotName;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
console.error("The defaultWidth value must be an integer, but '".concat(defaultWidthProp, "' was provided to ").concat(slotName, ". Falling back to ").concat(fallbackDefaultWidth, "px instead."));
|
|
27
|
-
}
|
|
28
|
-
return fallbackDefaultWidth;
|
|
14
|
+
// If the provided `defaultWidth` is invalid then we use our fallback.
|
|
15
|
+
// We are using a runtime check because some invalid numbers like `NaN` are not caught by types,
|
|
16
|
+
// and we saw some issues in products where our experience broke due to this.
|
|
17
|
+
if (!Number.isInteger(defaultWidthProp)) {
|
|
18
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
19
|
+
// eslint-disable-next-line no-console
|
|
20
|
+
console.error("The defaultWidth value must be an integer, but '".concat(defaultWidthProp, "' was provided to ").concat(slotName, ". Falling back to ").concat(fallbackDefaultWidth, "px instead."));
|
|
29
21
|
}
|
|
22
|
+
return fallbackDefaultWidth;
|
|
30
23
|
}
|
|
31
24
|
return defaultWidthProp;
|
|
32
25
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
export const getWidthFromDragLocation = ({
|
|
3
2
|
initialWidth,
|
|
4
3
|
location,
|
|
@@ -21,12 +20,6 @@ export const getWidthFromDragLocation = ({
|
|
|
21
20
|
* Returns the computed width of an element in pixels.
|
|
22
21
|
*/
|
|
23
22
|
export const getPixelWidth = element => {
|
|
24
|
-
if
|
|
25
|
-
|
|
26
|
-
return element.offsetWidth;
|
|
27
|
-
}
|
|
28
|
-
const {
|
|
29
|
-
width
|
|
30
|
-
} = window.getComputedStyle(element);
|
|
31
|
-
return parseInt(width);
|
|
23
|
+
// Always returns an integer. Returns 0 if element is hidden / removed.
|
|
24
|
+
return element.offsetWidth;
|
|
32
25
|
};
|
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
* `useSafeDefaultWidth` returns the provided `defaultWidthProp`.
|
|
6
|
-
*
|
|
7
|
-
* When `platform_dst_nav4_panel_splitter_guards` is enabled,
|
|
8
|
-
* `useSafeDefaultWidth` returns the `fallbackWidth` if the provided `defaultWidthProp` is not an integer value.
|
|
2
|
+
* Returns the `fallbackWidth` if the provided `defaultWidthProp` is not an integer value.
|
|
9
3
|
*/
|
|
10
4
|
export function useSafeDefaultWidth({
|
|
11
5
|
defaultWidthProp,
|
|
12
6
|
fallbackDefaultWidth,
|
|
13
7
|
slotName
|
|
14
8
|
}) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
console.error(`The defaultWidth value must be an integer, but '${defaultWidthProp}' was provided to ${slotName}. Falling back to ${fallbackDefaultWidth}px instead.`);
|
|
23
|
-
}
|
|
24
|
-
return fallbackDefaultWidth;
|
|
9
|
+
// If the provided `defaultWidth` is invalid then we use our fallback.
|
|
10
|
+
// We are using a runtime check because some invalid numbers like `NaN` are not caught by types,
|
|
11
|
+
// and we saw some issues in products where our experience broke due to this.
|
|
12
|
+
if (!Number.isInteger(defaultWidthProp)) {
|
|
13
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
console.error(`The defaultWidth value must be an integer, but '${defaultWidthProp}' was provided to ${slotName}. Falling back to ${fallbackDefaultWidth}px instead.`);
|
|
25
16
|
}
|
|
17
|
+
return fallbackDefaultWidth;
|
|
26
18
|
}
|
|
27
19
|
return defaultWidthProp;
|
|
28
20
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
export var getWidthFromDragLocation = function getWidthFromDragLocation(_ref) {
|
|
3
2
|
var initialWidth = _ref.initialWidth,
|
|
4
3
|
location = _ref.location,
|
|
@@ -20,11 +19,6 @@ export var getWidthFromDragLocation = function getWidthFromDragLocation(_ref) {
|
|
|
20
19
|
* Returns the computed width of an element in pixels.
|
|
21
20
|
*/
|
|
22
21
|
export var getPixelWidth = function getPixelWidth(element) {
|
|
23
|
-
if
|
|
24
|
-
|
|
25
|
-
return element.offsetWidth;
|
|
26
|
-
}
|
|
27
|
-
var _window$getComputedSt = window.getComputedStyle(element),
|
|
28
|
-
width = _window$getComputedSt.width;
|
|
29
|
-
return parseInt(width);
|
|
22
|
+
// Always returns an integer. Returns 0 if element is hidden / removed.
|
|
23
|
+
return element.offsetWidth;
|
|
30
24
|
};
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
* `useSafeDefaultWidth` returns the provided `defaultWidthProp`.
|
|
6
|
-
*
|
|
7
|
-
* When `platform_dst_nav4_panel_splitter_guards` is enabled,
|
|
8
|
-
* `useSafeDefaultWidth` returns the `fallbackWidth` if the provided `defaultWidthProp` is not an integer value.
|
|
2
|
+
* Returns the `fallbackWidth` if the provided `defaultWidthProp` is not an integer value.
|
|
9
3
|
*/
|
|
10
4
|
export function useSafeDefaultWidth(_ref) {
|
|
11
5
|
var defaultWidthProp = _ref.defaultWidthProp,
|
|
12
6
|
fallbackDefaultWidth = _ref.fallbackDefaultWidth,
|
|
13
7
|
slotName = _ref.slotName;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
console.error("The defaultWidth value must be an integer, but '".concat(defaultWidthProp, "' was provided to ").concat(slotName, ". Falling back to ").concat(fallbackDefaultWidth, "px instead."));
|
|
22
|
-
}
|
|
23
|
-
return fallbackDefaultWidth;
|
|
8
|
+
// If the provided `defaultWidth` is invalid then we use our fallback.
|
|
9
|
+
// We are using a runtime check because some invalid numbers like `NaN` are not caught by types,
|
|
10
|
+
// and we saw some issues in products where our experience broke due to this.
|
|
11
|
+
if (!Number.isInteger(defaultWidthProp)) {
|
|
12
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
13
|
+
// eslint-disable-next-line no-console
|
|
14
|
+
console.error("The defaultWidth value must be an integer, but '".concat(defaultWidthProp, "' was provided to ").concat(slotName, ". Falling back to ").concat(fallbackDefaultWidth, "px instead."));
|
|
24
15
|
}
|
|
16
|
+
return fallbackDefaultWidth;
|
|
25
17
|
}
|
|
26
18
|
return defaultWidthProp;
|
|
27
19
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `useSafeDefaultWidth` returns the provided `defaultWidthProp`.
|
|
4
|
-
*
|
|
5
|
-
* When `platform_dst_nav4_panel_splitter_guards` is enabled,
|
|
6
|
-
* `useSafeDefaultWidth` returns the `fallbackWidth` if the provided `defaultWidthProp` is not an integer value.
|
|
2
|
+
* Returns the `fallbackWidth` if the provided `defaultWidthProp` is not an integer value.
|
|
7
3
|
*/
|
|
8
4
|
export declare function useSafeDefaultWidth({ defaultWidthProp, fallbackDefaultWidth, slotName, }: {
|
|
9
5
|
/**
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* `useSafeDefaultWidth` returns the provided `defaultWidthProp`.
|
|
4
|
-
*
|
|
5
|
-
* When `platform_dst_nav4_panel_splitter_guards` is enabled,
|
|
6
|
-
* `useSafeDefaultWidth` returns the `fallbackWidth` if the provided `defaultWidthProp` is not an integer value.
|
|
2
|
+
* Returns the `fallbackWidth` if the provided `defaultWidthProp` is not an integer value.
|
|
7
3
|
*/
|
|
8
4
|
export declare function useSafeDefaultWidth({ defaultWidthProp, fallbackDefaultWidth, slotName, }: {
|
|
9
5
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/navigation-system",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "The latest navigation system for Atlassian apps.",
|
|
5
5
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
6
6
|
"author": "Atlassian Pty Ltd",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@atlaskit/analytics-next": "^11.1.0",
|
|
70
|
-
"@atlaskit/avatar": "^25.
|
|
70
|
+
"@atlaskit/avatar": "^25.5.0",
|
|
71
71
|
"@atlaskit/button": "^23.5.0",
|
|
72
72
|
"@atlaskit/css": "^0.15.0",
|
|
73
73
|
"@atlaskit/ds-lib": "^5.1.0",
|
|
@@ -164,9 +164,6 @@
|
|
|
164
164
|
"platform_dst_nav4_flyoutmenuitem_render_to_parent": {
|
|
165
165
|
"type": "boolean"
|
|
166
166
|
},
|
|
167
|
-
"platform_dst_nav4_panel_splitter_guards": {
|
|
168
|
-
"type": "boolean"
|
|
169
|
-
},
|
|
170
167
|
"navx-full-height-sidebar": {
|
|
171
168
|
"type": "boolean"
|
|
172
169
|
},
|