carbon-react 125.8.0 → 125.9.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.
@@ -9,7 +9,7 @@ export declare type BoxSizing = "content-box" | "border-box";
9
9
  declare type DesignTokensType = keyof typeof DesignTokens;
10
10
  declare type BoxShadowsType = Extract<DesignTokensType, `boxShadow${string}`>;
11
11
  declare type BorderRadiusType = Extract<DesignTokensType, `borderRadius${string}`>;
12
- export interface BoxProps extends SpaceProps, LayoutProps, FlexboxProps, Omit<GridProps, "gridGap" | "gridRowGap" | "gridColumnGap">, TagProps, Omit<PositionProps, "zIndex"> {
12
+ export interface BoxProps extends FlexboxProps, Omit<GridProps, "gridGap" | "gridRowGap" | "gridColumnGap">, LayoutProps, Omit<PositionProps, "zIndex">, SpaceProps, TagProps {
13
13
  as?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
14
14
  /** Set the ID attribute of the Box component */
15
15
  id?: string;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { StyledImageProps } from "./image.style";
3
3
  export declare const Image: {
4
- ({ alt, decorative, src, children, ...rest }: StyledImageProps): React.JSX.Element;
4
+ ({ alt, decorative, src, children, position, top, right, bottom, left, ...rest }: StyledImageProps): React.JSX.Element;
5
5
  displayName: string;
6
6
  };
7
7
  export default Image;
@@ -8,6 +8,11 @@ export const Image = ({
8
8
  decorative = false,
9
9
  src,
10
10
  children,
11
+ position,
12
+ top,
13
+ right,
14
+ bottom,
15
+ left,
11
16
  ...rest
12
17
  }) => {
13
18
  !(!src || !children) ? process.env.NODE_ENV !== "production" ? invariant(false, "The 'Image' component renders as an 'img' element when the 'src' prop is used and therefore does not accept children.") : invariant(false) : void 0;
@@ -15,7 +20,12 @@ export const Image = ({
15
20
  return /*#__PURE__*/React.createElement(StyledImage, _extends({
16
21
  alt: alt,
17
22
  decorative: decorative,
18
- src: src
23
+ src: src,
24
+ position: position,
25
+ top: top,
26
+ right: right,
27
+ bottom: bottom,
28
+ left: left
19
29
  }, rest), children);
20
30
  };
21
31
  Image.displayName = "Image";
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { MarginProps, BackgroundProps, LayoutProps } from "styled-system";
3
- export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutProps {
3
+ export declare type PositionProps = "absolute" | "fixed" | "relative" | "static" | "sticky";
4
+ export interface StyledImageProps extends BackgroundProps, LayoutProps, MarginProps {
4
5
  /** HTML alt property to display when an img fails to load */
5
6
  alt?: string;
6
7
  /** Prop to specify if the image is decorative */
@@ -11,11 +12,26 @@ export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutPr
11
12
  hidden?: boolean;
12
13
  /** Children elements, will only render if component is a div element */
13
14
  children?: React.ReactNode;
15
+ /** Any valid CSS string for position */
16
+ position?: PositionProps;
17
+ /** Any valid CSS string for top */
18
+ top?: string;
19
+ /** Any valid CSS string for right */
20
+ right?: string;
21
+ /** Any valid CSS string for bottom */
22
+ bottom?: string;
23
+ /** Any valid CSS string for left */
24
+ left?: string;
14
25
  }
15
26
  declare const StyledImage: import("styled-components").StyledComponent<"div", any, {
16
27
  children: import("react").ReactNode;
17
28
  src: string | undefined;
18
29
  hidden: boolean;
30
+ position: PositionProps | undefined;
31
+ top: string | undefined;
32
+ right: string | undefined;
33
+ bottom: string | undefined;
34
+ left: string | undefined;
19
35
  as?: string | undefined;
20
- } & StyledImageProps, "hidden" | "children" | "as" | "src">;
36
+ } & StyledImageProps, "hidden" | "children" | "as" | "left" | "right" | "bottom" | "top" | "src" | "position">;
21
37
  export { StyledImage };
@@ -4,18 +4,42 @@ import { baseTheme } from "../../style/themes";
4
4
  const StyledImage = styled.div.attrs(({
5
5
  src,
6
6
  children,
7
- hidden = false
7
+ hidden = false,
8
+ position,
9
+ top,
10
+ right,
11
+ bottom,
12
+ left
8
13
  }) => ({
9
14
  ...(src && {
10
15
  as: "img"
11
16
  }),
12
17
  children: src ? undefined : children,
13
18
  src,
14
- hidden
19
+ hidden,
20
+ position,
21
+ top,
22
+ right,
23
+ bottom,
24
+ left
15
25
  }))`
16
26
  ${margin}
17
27
  ${layout}
18
28
 
29
+ ${({
30
+ position,
31
+ top,
32
+ right,
33
+ bottom,
34
+ left
35
+ }) => css`
36
+ position: ${position};
37
+ top: ${top};
38
+ right: ${right};
39
+ bottom: ${bottom};
40
+ left: ${left};
41
+ `}
42
+
19
43
  ${({
20
44
  as
21
45
  }) => as !== "img" && css`
@@ -9,7 +9,7 @@ export declare type BoxSizing = "content-box" | "border-box";
9
9
  declare type DesignTokensType = keyof typeof DesignTokens;
10
10
  declare type BoxShadowsType = Extract<DesignTokensType, `boxShadow${string}`>;
11
11
  declare type BorderRadiusType = Extract<DesignTokensType, `borderRadius${string}`>;
12
- export interface BoxProps extends SpaceProps, LayoutProps, FlexboxProps, Omit<GridProps, "gridGap" | "gridRowGap" | "gridColumnGap">, TagProps, Omit<PositionProps, "zIndex"> {
12
+ export interface BoxProps extends FlexboxProps, Omit<GridProps, "gridGap" | "gridRowGap" | "gridColumnGap">, LayoutProps, Omit<PositionProps, "zIndex">, SpaceProps, TagProps {
13
13
  as?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
14
14
  /** Set the ID attribute of the Box component */
15
15
  id?: string;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { StyledImageProps } from "./image.style";
3
3
  export declare const Image: {
4
- ({ alt, decorative, src, children, ...rest }: StyledImageProps): React.JSX.Element;
4
+ ({ alt, decorative, src, children, position, top, right, bottom, left, ...rest }: StyledImageProps): React.JSX.Element;
5
5
  displayName: string;
6
6
  };
7
7
  export default Image;
@@ -15,6 +15,11 @@ const Image = ({
15
15
  decorative = false,
16
16
  src,
17
17
  children,
18
+ position,
19
+ top,
20
+ right,
21
+ bottom,
22
+ left,
18
23
  ...rest
19
24
  }) => {
20
25
  !(!src || !children) ? process.env.NODE_ENV !== "production" ? (0, _invariant.default)(false, "The 'Image' component renders as an 'img' element when the 'src' prop is used and therefore does not accept children.") : (0, _invariant.default)(false) : void 0;
@@ -22,7 +27,12 @@ const Image = ({
22
27
  return /*#__PURE__*/_react.default.createElement(_image.StyledImage, _extends({
23
28
  alt: alt,
24
29
  decorative: decorative,
25
- src: src
30
+ src: src,
31
+ position: position,
32
+ top: top,
33
+ right: right,
34
+ bottom: bottom,
35
+ left: left
26
36
  }, rest), children);
27
37
  };
28
38
  exports.Image = Image;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { MarginProps, BackgroundProps, LayoutProps } from "styled-system";
3
- export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutProps {
3
+ export declare type PositionProps = "absolute" | "fixed" | "relative" | "static" | "sticky";
4
+ export interface StyledImageProps extends BackgroundProps, LayoutProps, MarginProps {
4
5
  /** HTML alt property to display when an img fails to load */
5
6
  alt?: string;
6
7
  /** Prop to specify if the image is decorative */
@@ -11,11 +12,26 @@ export interface StyledImageProps extends MarginProps, BackgroundProps, LayoutPr
11
12
  hidden?: boolean;
12
13
  /** Children elements, will only render if component is a div element */
13
14
  children?: React.ReactNode;
15
+ /** Any valid CSS string for position */
16
+ position?: PositionProps;
17
+ /** Any valid CSS string for top */
18
+ top?: string;
19
+ /** Any valid CSS string for right */
20
+ right?: string;
21
+ /** Any valid CSS string for bottom */
22
+ bottom?: string;
23
+ /** Any valid CSS string for left */
24
+ left?: string;
14
25
  }
15
26
  declare const StyledImage: import("styled-components").StyledComponent<"div", any, {
16
27
  children: import("react").ReactNode;
17
28
  src: string | undefined;
18
29
  hidden: boolean;
30
+ position: PositionProps | undefined;
31
+ top: string | undefined;
32
+ right: string | undefined;
33
+ bottom: string | undefined;
34
+ left: string | undefined;
19
35
  as?: string | undefined;
20
- } & StyledImageProps, "hidden" | "children" | "as" | "src">;
36
+ } & StyledImageProps, "hidden" | "children" | "as" | "left" | "right" | "bottom" | "top" | "src" | "position">;
21
37
  export { StyledImage };
@@ -12,18 +12,42 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
12
12
  const StyledImage = exports.StyledImage = _styledComponents.default.div.attrs(({
13
13
  src,
14
14
  children,
15
- hidden = false
15
+ hidden = false,
16
+ position,
17
+ top,
18
+ right,
19
+ bottom,
20
+ left
16
21
  }) => ({
17
22
  ...(src && {
18
23
  as: "img"
19
24
  }),
20
25
  children: src ? undefined : children,
21
26
  src,
22
- hidden
27
+ hidden,
28
+ position,
29
+ top,
30
+ right,
31
+ bottom,
32
+ left
23
33
  }))`
24
34
  ${_styledSystem.margin}
25
35
  ${_styledSystem.layout}
26
36
 
37
+ ${({
38
+ position,
39
+ top,
40
+ right,
41
+ bottom,
42
+ left
43
+ }) => (0, _styledComponents.css)`
44
+ position: ${position};
45
+ top: ${top};
46
+ right: ${right};
47
+ bottom: ${bottom};
48
+ left: ${left};
49
+ `}
50
+
27
51
  ${({
28
52
  as
29
53
  }) => as !== "img" && (0, _styledComponents.css)`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "125.8.0",
3
+ "version": "125.9.0",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",