carbon-react 104.32.0 → 104.33.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.
@@ -1,7 +1,9 @@
1
1
  import React from "react";
2
2
  import { PaddingProps, FlexboxProps } from "styled-system";
3
- export declare type StickyPosition = "top" | "bottom";
3
+ export declare type Position = "sticky" | "fixed";
4
+ export declare type Orientation = "top" | "bottom";
4
5
  export declare type NavigationType = "light" | "dark" | "white" | "black";
6
+ export declare type StickyPosition = "top" | "bottom";
5
7
  export interface NavigationBarProps extends PaddingProps, FlexboxProps {
6
8
  children?: React.ReactNode;
7
9
  ariaLabel?: string;
@@ -13,6 +15,12 @@ export interface NavigationBarProps extends PaddingProps, FlexboxProps {
13
15
  stickyPosition?: StickyPosition;
14
16
  /** Defines the offset of sticky navigation bar */
15
17
  stickyOffset?: string;
18
+ /** Defines whether the navigation bar should be positioned fixed or sticky */
19
+ position?: Position;
20
+ /** Defines the offset of navigation bar */
21
+ offset?: string;
22
+ /** Defines whether the navigation bar should be positioned top or bottom */
23
+ orientation?: Orientation;
16
24
  }
17
- export declare const NavigationBar: ({ navigationType, isLoading, children, ariaLabel, stickyOffset, stickyPosition, ...props }: NavigationBarProps) => JSX.Element;
25
+ export declare const NavigationBar: ({ navigationType, isLoading, children, ariaLabel, stickyOffset, stickyPosition, position, offset, orientation, ...props }: NavigationBarProps) => JSX.Element;
18
26
  export default NavigationBar;
@@ -11,6 +11,10 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
11
11
 
12
12
  var _navigationBar = _interopRequireDefault(require("./navigation-bar.style"));
13
13
 
14
+ var _logger = _interopRequireDefault(
15
+ require("../../__internal__/utils/logger")
16
+ );
17
+
14
18
  function _interopRequireDefault(obj) {
15
19
  return obj && obj.__esModule ? obj : { default: obj };
16
20
  }
@@ -32,6 +36,8 @@ function _extends() {
32
36
  return _extends.apply(this, arguments);
33
37
  }
34
38
 
39
+ let deprecatedWarnTriggered = false;
40
+
35
41
  const NavigationBar = ({
36
42
  navigationType = "light",
37
43
  isLoading = false,
@@ -39,8 +45,20 @@ const NavigationBar = ({
39
45
  ariaLabel,
40
46
  stickyOffset = "0",
41
47
  stickyPosition,
48
+ position,
49
+ offset = "0",
50
+ orientation,
42
51
  ...props
43
52
  }) => {
53
+ if (!deprecatedWarnTriggered && stickyPosition) {
54
+ deprecatedWarnTriggered = true;
55
+
56
+ _logger.default.deprecate(
57
+ // eslint-disable-next-line max-len
58
+ "The `stickyPosition` and `stickyOffset` props are deprecated and will soon be removed. You should use the `position`, `offset` and `orientation` props to achieve the same layout. The following codemods are available to help with updating your code: https://github.com/Sage/carbon-codemod/tree/master/transforms/remove-prop and https://github.com/Sage/carbon-codemod/tree/master/transforms/add-prop"
59
+ );
60
+ }
61
+
44
62
  return /*#__PURE__*/ _react.default.createElement(
45
63
  _navigationBar.default,
46
64
  _extends(
@@ -51,6 +69,9 @@ const NavigationBar = ({
51
69
  "data-component": "navigation-bar",
52
70
  stickyOffset: stickyOffset,
53
71
  stickyPosition: stickyPosition,
72
+ position: position,
73
+ offset: offset,
74
+ orientation: orientation,
54
75
  },
55
76
  props
56
77
  ),
@@ -4694,6 +4715,10 @@ NavigationBar.propTypes = {
4694
4715
  * Color scheme of navigation component
4695
4716
  */
4696
4717
  navigationType: _propTypes.default.oneOf(["black", "dark", "light", "white"]),
4718
+ /**
4719
+ * Defines the offset of navigation bar
4720
+ */
4721
+ offset: _propTypes.default.string,
4697
4722
  /**
4698
4723
  * The order CSS property sets the order to lay out an item in a flex or grid container. Items in a container
4699
4724
  * are sorted by ascending order value and then by their source code order.
@@ -4786,6 +4811,10 @@ NavigationBar.propTypes = {
4786
4811
  valueOf: _propTypes.default.func.isRequired,
4787
4812
  }),
4788
4813
  ]),
4814
+ /**
4815
+ * Defines whether the navigation bar should be positioned top or bottom
4816
+ */
4817
+ orientation: _propTypes.default.oneOf(["bottom", "top"]),
4789
4818
  /**
4790
4819
  * Padding on top, left, bottom and right
4791
4820
  */
@@ -5236,6 +5265,10 @@ NavigationBar.propTypes = {
5236
5265
  }),
5237
5266
  _propTypes.default.string,
5238
5267
  ]),
5268
+ /**
5269
+ * Defines whether the navigation bar should be positioned fixed or sticky
5270
+ */
5271
+ position: _propTypes.default.oneOf(["fixed", "sticky"]),
5239
5272
  /**
5240
5273
  * Padding on right
5241
5274
  */
@@ -1,11 +1,17 @@
1
1
  import { PaddingProps, FlexboxProps } from "styled-system";
2
- import { StickyPosition, NavigationType } from "./navigation-bar.component";
2
+ import { Position, Orientation, NavigationType } from "./navigation-bar.component";
3
3
  declare const StyledNavigationBar: import("styled-components").StyledComponent<"nav", any, PaddingProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & FlexboxProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
4
4
  /** Color scheme of navigation component */
5
5
  navigationType?: NavigationType | undefined;
6
6
  /** Defines the position of sticky navigation bar */
7
- stickyPosition?: StickyPosition | undefined;
7
+ stickyPosition?: Orientation | undefined;
8
8
  /** Defines the offset of sticky navigation bar */
9
9
  stickyOffset?: string | undefined;
10
+ /** Defines whether the navigation bar should be positioned fixed or sticky */
11
+ position?: Position | undefined;
12
+ /** Defines the offset of navigation bar */
13
+ offset?: string | undefined;
14
+ /** Defines whether the navigation bar should be positioned top or bottom */
15
+ orientation?: Orientation | undefined;
10
16
  }, never>;
11
17
  export default StyledNavigationBar;
@@ -54,8 +54,22 @@ const StyledNavigationBar = _styledComponents.default.nav`
54
54
  stickyOffset
55
55
  }) => stickyPosition && (0, _styledComponents.css)`
56
56
  position: sticky;
57
- ${stickyPosition}: ${stickyOffset}
58
- `};
57
+ ${stickyPosition}: ${stickyOffset};
58
+ `}
59
+
60
+ ${({
61
+ position,
62
+ orientation,
63
+ offset
64
+ }) => position && orientation && (0, _styledComponents.css)`
65
+ position: ${position};
66
+ ${orientation}: ${offset};
67
+
68
+ ${position === "fixed" && (0, _styledComponents.css)`
69
+ box-sizing: border-box;
70
+ width: 100%;
71
+ `}
72
+ `}
59
73
 
60
74
  ${({
61
75
  navigationType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "104.32.0",
3
+ "version": "104.33.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {