carbon-react 122.0.1 → 123.0.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/esm/__internal__/utils/helpers/tags/tags-specs/index.d.ts +1 -1
- package/esm/__internal__/utils/helpers/tags/tags-specs/index.js +1 -1
- package/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +2 -1
- package/esm/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +6 -3
- package/esm/components/tile/__internal__/compute-content-padding.d.ts +13 -0
- package/esm/components/tile/__internal__/compute-content-padding.js +23 -0
- package/esm/components/tile/__internal__/tile-context.d.ts +8 -0
- package/esm/components/tile/__internal__/tile-context.js +4 -0
- package/esm/components/tile/index.d.ts +5 -1
- package/esm/components/tile/index.js +3 -1
- package/esm/components/tile/tile-content/index.d.ts +2 -0
- package/esm/components/tile/tile-content/index.js +1 -0
- package/esm/components/tile/tile-content/tile-content.component.d.ts +10 -0
- package/esm/components/tile/tile-content/tile-content.component.js +33 -0
- package/esm/components/tile/tile-content/tile-content.style.d.ts +9 -0
- package/esm/components/tile/tile-content/tile-content.style.js +64 -0
- package/esm/components/tile/tile-footer/tile-footer.component.d.ts +3 -2
- package/esm/components/tile/tile-footer/tile-footer.component.js +6 -7
- package/esm/components/tile/tile.component.d.ts +3 -2
- package/esm/components/tile/tile.component.js +23 -34
- package/esm/components/tile/tile.style.d.ts +1 -8
- package/esm/components/tile/tile.style.js +1 -60
- package/esm/style/utils/filter-styled-system-padding-props.d.ts +8 -1
- package/esm/style/utils/filter-styled-system-padding-props.js +10 -1
- package/lib/__internal__/utils/helpers/tags/tags-specs/index.d.ts +1 -1
- package/lib/__internal__/utils/helpers/tags/tags-specs/index.js +6 -0
- package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.d.ts +2 -1
- package/lib/__internal__/utils/helpers/tags/tags-specs/tags-specs.js +8 -4
- package/lib/components/tile/__internal__/compute-content-padding.d.ts +13 -0
- package/lib/components/tile/__internal__/compute-content-padding.js +30 -0
- package/lib/components/tile/__internal__/tile-context.d.ts +8 -0
- package/lib/components/tile/__internal__/tile-context.js +11 -0
- package/lib/components/tile/index.d.ts +5 -1
- package/lib/components/tile/index.js +15 -1
- package/lib/components/tile/tile-content/index.d.ts +2 -0
- package/lib/components/tile/tile-content/index.js +13 -0
- package/lib/components/tile/tile-content/package.json +6 -0
- package/lib/components/tile/tile-content/tile-content.component.d.ts +10 -0
- package/lib/components/tile/tile-content/tile-content.component.js +43 -0
- package/lib/components/tile/tile-content/tile-content.style.d.ts +9 -0
- package/lib/components/tile/tile-content/tile-content.style.js +74 -0
- package/lib/components/tile/tile-footer/tile-footer.component.d.ts +3 -2
- package/lib/components/tile/tile-footer/tile-footer.component.js +6 -7
- package/lib/components/tile/tile.component.d.ts +3 -2
- package/lib/components/tile/tile.component.js +24 -35
- package/lib/components/tile/tile.style.d.ts +1 -8
- package/lib/components/tile/tile.style.js +4 -63
- package/lib/style/utils/filter-styled-system-padding-props.d.ts +8 -1
- package/lib/style/utils/filter-styled-system-padding-props.js +18 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export { elementsTagTest, rootTagTest } from "./tags-specs";
|
|
1
|
+
export { elementsTagTest, rootTagTest, rootTagTestRtl } from "./tags-specs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { elementsTagTest, rootTagTest } from "./tags-specs";
|
|
1
|
+
export { elementsTagTest, rootTagTest, rootTagTestRtl } from "./tags-specs";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactWrapper, ShallowWrapper } from "enzyme";
|
|
2
2
|
declare const elementsTagTest: (wrapper: ReactWrapper | ShallowWrapper, elements: string[]) => void;
|
|
3
3
|
declare const rootTagTest: (rootNode: ReactWrapper | ShallowWrapper, comp: string, elem?: string, role?: string) => void;
|
|
4
|
-
|
|
4
|
+
declare const rootTagTestRtl: (element: HTMLElement, comp: string, elem?: string, role?: string) => void;
|
|
5
|
+
export { elementsTagTest, rootTagTest, rootTagTestRtl };
|
|
@@ -12,6 +12,9 @@ const rootTagTest = (rootNode, comp, elem, role) => {
|
|
|
12
12
|
expect(rootNode.prop("data-element")).toEqual(elem);
|
|
13
13
|
expect(rootNode.prop("data-role")).toEqual(role);
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const rootTagTestRtl = (element, comp, elem, role) => {
|
|
16
|
+
expect(element.getAttribute("data-component")).toBe(comp);
|
|
17
|
+
expect(element.getAttribute("data-element")).toBe(elem);
|
|
18
|
+
expect(element.getAttribute("data-role")).toBe(role);
|
|
19
|
+
};
|
|
20
|
+
export { elementsTagTest, rootTagTest, rootTagTestRtl };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PaddingProps } from "styled-system";
|
|
2
|
+
declare const _default: (paddingProps: PaddingProps, isHorizontal: boolean) => {
|
|
3
|
+
pr: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
|
4
|
+
pl: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
|
5
|
+
pt?: undefined;
|
|
6
|
+
pb?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
pt: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
|
9
|
+
pb: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
|
10
|
+
pr?: undefined;
|
|
11
|
+
pl?: undefined;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { paddingNames, paddingLeftPropertyNames, paddingRightPropertyNames, paddingBottomPropertyNames, paddingTopPropertyNames, paddingXPropertyNames, paddingYPropertyNames } from "../../../style/utils/filter-styled-system-padding-props";
|
|
2
|
+
const CONTENT_PADDING_LEFT_KEYS = [...paddingLeftPropertyNames, ...paddingXPropertyNames, ...paddingNames];
|
|
3
|
+
const CONTENT_PADDING_RIGHT_KEYS = [...paddingRightPropertyNames, ...paddingXPropertyNames, ...paddingNames];
|
|
4
|
+
const CONTENT_PADDING_TOP_KEYS = [...paddingTopPropertyNames, ...paddingYPropertyNames, ...paddingNames];
|
|
5
|
+
const CONTENT_PADDING_BOTTOM_KEYS = [...paddingBottomPropertyNames, ...paddingYPropertyNames, ...paddingNames];
|
|
6
|
+
export default ((paddingProps, isHorizontal) => {
|
|
7
|
+
const getPaddingProps = paddingKeys => {
|
|
8
|
+
const key = paddingKeys.find(propName => paddingProps[propName]);
|
|
9
|
+
|
|
10
|
+
/* istanbul ignore if */
|
|
11
|
+
if (!key) {
|
|
12
|
+
return key;
|
|
13
|
+
}
|
|
14
|
+
return paddingProps[key];
|
|
15
|
+
};
|
|
16
|
+
return isHorizontal ? {
|
|
17
|
+
pr: getPaddingProps(CONTENT_PADDING_LEFT_KEYS),
|
|
18
|
+
pl: getPaddingProps(CONTENT_PADDING_RIGHT_KEYS)
|
|
19
|
+
} : {
|
|
20
|
+
pt: getPaddingProps(CONTENT_PADDING_TOP_KEYS),
|
|
21
|
+
pb: getPaddingProps(CONTENT_PADDING_BOTTOM_KEYS)
|
|
22
|
+
};
|
|
23
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PaddingProps } from "styled-system";
|
|
3
|
+
interface TileContextProps {
|
|
4
|
+
isHorizontal?: boolean;
|
|
5
|
+
paddingPropsFromTile: PaddingProps;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import("react").Context<TileContextProps>;
|
|
8
|
+
export default _default;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export { default } from "./tile.component";
|
|
1
|
+
export { default as Tile } from "./tile.component";
|
|
2
2
|
export type { TileProps } from "./tile.component";
|
|
3
|
+
export { default as TileContent } from "./tile-content";
|
|
4
|
+
export type { TileContentProps } from "./tile-content";
|
|
5
|
+
export { default as TileFooter } from "./tile-footer";
|
|
6
|
+
export type { TileFooterProps } from "./tile-footer";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./tile-content.component";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SpaceProps } from "styled-system";
|
|
3
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
4
|
+
export interface TileContentProps extends SpaceProps, TagProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
width?: string | number;
|
|
7
|
+
height?: string | number;
|
|
8
|
+
}
|
|
9
|
+
declare const TileContent: ({ children, width, height, ...rest }: TileContentProps) => React.JSX.Element | null;
|
|
10
|
+
export default TileContent;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import React, { useContext } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import StyledTileContent from "./tile-content.style";
|
|
5
|
+
import TileContext from "../__internal__/tile-context";
|
|
6
|
+
import tagComponent from "../../../__internal__/utils/helpers/tags";
|
|
7
|
+
import filterStyledSystemPaddingProps from "../../../style/utils/filter-styled-system-padding-props";
|
|
8
|
+
import filterStyledSystemMarginProps from "../../../style/utils/filter-styled-system-margin-props";
|
|
9
|
+
const TileContent = ({
|
|
10
|
+
children,
|
|
11
|
+
width,
|
|
12
|
+
height,
|
|
13
|
+
...rest
|
|
14
|
+
}) => {
|
|
15
|
+
const {
|
|
16
|
+
isHorizontal,
|
|
17
|
+
paddingPropsFromTile
|
|
18
|
+
} = useContext(TileContext);
|
|
19
|
+
if (!children) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const spacingProps = {
|
|
23
|
+
...filterStyledSystemPaddingProps(rest),
|
|
24
|
+
...filterStyledSystemMarginProps(rest)
|
|
25
|
+
};
|
|
26
|
+
return /*#__PURE__*/React.createElement(StyledTileContent, _extends({
|
|
27
|
+
width: width,
|
|
28
|
+
height: height,
|
|
29
|
+
isHorizontal: isHorizontal,
|
|
30
|
+
isVertical: !isHorizontal
|
|
31
|
+
}, paddingPropsFromTile, spacingProps, tagComponent("tile-content", rest)), children);
|
|
32
|
+
};
|
|
33
|
+
export default TileContent;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TileContentProps } from "./tile-content.component";
|
|
2
|
+
interface StyledTileContentProps extends TileContentProps {
|
|
3
|
+
isHorizontal?: boolean;
|
|
4
|
+
isVertical?: boolean;
|
|
5
|
+
width?: string | number;
|
|
6
|
+
height?: string | number;
|
|
7
|
+
}
|
|
8
|
+
declare const StyledTileContent: import("styled-components").StyledComponent<"div", any, StyledTileContentProps, never>;
|
|
9
|
+
export default StyledTileContent;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { space } from "styled-system";
|
|
3
|
+
import baseTheme from "../../../style/themes/base";
|
|
4
|
+
import computeSizing from "../../../style/utils/element-sizing";
|
|
5
|
+
const StyledTileContent = styled.div`
|
|
6
|
+
${({
|
|
7
|
+
isHorizontal,
|
|
8
|
+
isVertical,
|
|
9
|
+
width,
|
|
10
|
+
height
|
|
11
|
+
}) => css`
|
|
12
|
+
${space}
|
|
13
|
+
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
position: relative;
|
|
16
|
+
flex-grow: 1;
|
|
17
|
+
|
|
18
|
+
${isHorizontal && css`
|
|
19
|
+
display: inline;
|
|
20
|
+
|
|
21
|
+
:last-of-type {
|
|
22
|
+
padding-right: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:first-of-type {
|
|
26
|
+
padding-left: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
& + & {
|
|
30
|
+
margin-top: 0;
|
|
31
|
+
border-left: solid 1px var(--colorsUtilityMajor050);
|
|
32
|
+
}
|
|
33
|
+
`}
|
|
34
|
+
|
|
35
|
+
${isVertical && css`
|
|
36
|
+
width: auto;
|
|
37
|
+
|
|
38
|
+
:last-of-type {
|
|
39
|
+
padding-bottom: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:first-of-type {
|
|
43
|
+
padding-top: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
& + & {
|
|
47
|
+
margin-top: 0;
|
|
48
|
+
border-top: solid 1px var(--colorsUtilityMajor050);
|
|
49
|
+
}
|
|
50
|
+
`}
|
|
51
|
+
|
|
52
|
+
${(width || height) && css`
|
|
53
|
+
flex-grow: 0;
|
|
54
|
+
${computeSizing({
|
|
55
|
+
width: width || /* istanbul ignore next */undefined,
|
|
56
|
+
height: height || undefined
|
|
57
|
+
})}
|
|
58
|
+
`}
|
|
59
|
+
`}
|
|
60
|
+
`;
|
|
61
|
+
StyledTileContent.defaultProps = {
|
|
62
|
+
theme: baseTheme
|
|
63
|
+
};
|
|
64
|
+
export default StyledTileContent;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
|
-
|
|
3
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
4
|
+
export interface TileFooterProps extends PaddingProps, TagProps {
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
/** set which background color variant should be used */
|
|
6
7
|
variant?: "default" | "black" | "transparent";
|
|
7
8
|
}
|
|
8
|
-
export declare const TileFooter: ({ variant, children, ...
|
|
9
|
+
export declare const TileFooter: ({ variant, children, ...rest }: TileFooterProps) => React.JSX.Element;
|
|
9
10
|
export default TileFooter;
|
|
@@ -2,14 +2,13 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import StyledTileFooter from "./tile-footer.style";
|
|
5
|
+
import tagComponent from "../../../__internal__/utils/helpers/tags";
|
|
6
|
+
import filterStyledSystemPaddingProps from "../../../style/utils/filter-styled-system-padding-props";
|
|
5
7
|
export const TileFooter = ({
|
|
6
8
|
variant,
|
|
7
9
|
children,
|
|
8
|
-
...
|
|
9
|
-
}) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
variant: variant
|
|
13
|
-
}, props), children);
|
|
14
|
-
};
|
|
10
|
+
...rest
|
|
11
|
+
}) => /*#__PURE__*/React.createElement(StyledTileFooter, _extends({
|
|
12
|
+
variant: variant
|
|
13
|
+
}, filterStyledSystemPaddingProps(rest), tagComponent("tile-footer", rest)), children);
|
|
15
14
|
export default TileFooter;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import * as DesignTokens from "@sage/design-tokens/js/base/common";
|
|
3
3
|
import { SpaceProps, WidthProps } from "styled-system";
|
|
4
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
4
5
|
declare type DesignTokensType = keyof typeof DesignTokens;
|
|
5
|
-
export interface TileProps extends SpaceProps, WidthProps {
|
|
6
|
+
export interface TileProps extends SpaceProps, WidthProps, TagProps {
|
|
6
7
|
/** Sets the theme of the tile - either 'tile', 'transparent' or 'active' */
|
|
7
8
|
variant?: "tile" | "transparent" | "active";
|
|
8
9
|
/**
|
|
@@ -31,5 +32,5 @@ export interface TileProps extends SpaceProps, WidthProps {
|
|
|
31
32
|
*/
|
|
32
33
|
height?: string | number;
|
|
33
34
|
}
|
|
34
|
-
export declare const Tile: ({ variant, p, children, orientation, width, roundness, height, ...
|
|
35
|
+
export declare const Tile: ({ variant, p, children, orientation, width, roundness, height, borderWidth, borderVariant, ...rest }: TileProps) => React.JSX.Element;
|
|
35
36
|
export default Tile;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import
|
|
4
|
+
import StyledTile from "./tile.style";
|
|
5
|
+
import TileContext from "./__internal__/tile-context";
|
|
6
|
+
import filterStyledSystemPaddingProps from "../../style/utils/filter-styled-system-padding-props";
|
|
7
|
+
import filterStyledSystemMarginProps from "../../style/utils/filter-styled-system-margin-props";
|
|
8
|
+
import computeContentPadding from "./__internal__/compute-content-padding";
|
|
9
|
+
import tagComponent from "../../__internal__/utils/helpers/tags";
|
|
5
10
|
export const Tile = ({
|
|
6
11
|
variant = "tile",
|
|
7
12
|
p = 3,
|
|
@@ -10,47 +15,31 @@ export const Tile = ({
|
|
|
10
15
|
width = "100%",
|
|
11
16
|
roundness = "default",
|
|
12
17
|
height,
|
|
13
|
-
|
|
18
|
+
borderWidth,
|
|
19
|
+
borderVariant,
|
|
20
|
+
...rest
|
|
14
21
|
}) => {
|
|
15
22
|
const isHorizontal = orientation === "horizontal";
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// istanbul ignore if
|
|
23
|
-
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
24
|
-
return child;
|
|
25
|
-
}
|
|
26
|
-
const {
|
|
27
|
-
width: contentWidth,
|
|
28
|
-
height: contentHeight,
|
|
29
|
-
...childProps
|
|
30
|
-
} = child.props;
|
|
31
|
-
const key = child.key || `tile-content-${index + 1}`;
|
|
32
|
-
return /*#__PURE__*/React.createElement(TileContent, _extends({
|
|
33
|
-
key: key,
|
|
34
|
-
width: contentWidth,
|
|
35
|
-
height: contentHeight,
|
|
36
|
-
isHorizontal: isHorizontal,
|
|
37
|
-
isVertical: isVertical
|
|
38
|
-
}, isVertical && {
|
|
39
|
-
pt: props.pt || props.py || p,
|
|
40
|
-
pb: props.pb || props.py || p
|
|
41
|
-
}, isHorizontal && {
|
|
42
|
-
pr: props.pr || props.px || p,
|
|
43
|
-
pl: props.pl || props.px || p
|
|
44
|
-
}), /*#__PURE__*/React.cloneElement(child, childProps));
|
|
23
|
+
const paddingProps = filterStyledSystemPaddingProps({
|
|
24
|
+
p,
|
|
25
|
+
...rest
|
|
45
26
|
});
|
|
27
|
+
const marginProps = filterStyledSystemMarginProps(rest);
|
|
28
|
+
const contentPaddingProps = computeContentPadding(paddingProps, isHorizontal);
|
|
46
29
|
return /*#__PURE__*/React.createElement(StyledTile, _extends({
|
|
47
30
|
variant: variant,
|
|
48
31
|
width: width,
|
|
49
32
|
height: height,
|
|
50
|
-
"data-component": "tile",
|
|
51
33
|
isHorizontal: isHorizontal,
|
|
52
34
|
p: p,
|
|
53
|
-
roundness: roundness
|
|
54
|
-
|
|
35
|
+
roundness: roundness,
|
|
36
|
+
borderWidth: borderWidth,
|
|
37
|
+
borderVariant: borderVariant
|
|
38
|
+
}, paddingProps, marginProps, tagComponent("tile", rest)), /*#__PURE__*/React.createElement(TileContext.Provider, {
|
|
39
|
+
value: {
|
|
40
|
+
isHorizontal,
|
|
41
|
+
paddingPropsFromTile: contentPaddingProps
|
|
42
|
+
}
|
|
43
|
+
}, children));
|
|
55
44
|
};
|
|
56
45
|
export default Tile;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { SpaceProps } from "styled-system";
|
|
2
2
|
import { TileProps } from "./tile.component";
|
|
3
|
-
interface TileContentProps {
|
|
4
|
-
isHorizontal?: boolean;
|
|
5
|
-
isVertical?: boolean;
|
|
6
|
-
width?: TileProps["width"];
|
|
7
|
-
height?: TileProps["height"];
|
|
8
|
-
}
|
|
9
|
-
declare const TileContent: import("styled-components").StyledComponent<"div", any, TileContentProps, never>;
|
|
10
3
|
declare const StyledTile: import("styled-components").StyledComponent<"div", any, Pick<TileProps, "width" | "height" | "variant" | "roundness" | "borderWidth" | "borderVariant"> & {
|
|
11
4
|
isHorizontal?: boolean | undefined;
|
|
12
5
|
} & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
|
|
13
|
-
export
|
|
6
|
+
export default StyledTile;
|
|
@@ -18,62 +18,6 @@ const getBorderColor = borderVariant => {
|
|
|
18
18
|
return "var(--colorsUtilityMajor100)";
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
const TileContent = styled.div`
|
|
22
|
-
${({
|
|
23
|
-
isHorizontal,
|
|
24
|
-
isVertical,
|
|
25
|
-
width,
|
|
26
|
-
height
|
|
27
|
-
}) => css`
|
|
28
|
-
${space}
|
|
29
|
-
|
|
30
|
-
box-sizing: border-box;
|
|
31
|
-
position: relative;
|
|
32
|
-
flex-grow: 1;
|
|
33
|
-
|
|
34
|
-
${isHorizontal && css`
|
|
35
|
-
display: inline;
|
|
36
|
-
|
|
37
|
-
:last-of-type {
|
|
38
|
-
padding-right: 0;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
:first-of-type {
|
|
42
|
-
padding-left: 0;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
& + & {
|
|
46
|
-
margin-top: 0;
|
|
47
|
-
border-left: solid 1px var(--colorsUtilityMajor050);
|
|
48
|
-
}
|
|
49
|
-
`}
|
|
50
|
-
|
|
51
|
-
${isVertical && css`
|
|
52
|
-
width: auto;
|
|
53
|
-
|
|
54
|
-
:last-of-type {
|
|
55
|
-
padding-bottom: 0;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
:first-of-type {
|
|
59
|
-
padding-top: 0;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
& + & {
|
|
63
|
-
margin-top: 0;
|
|
64
|
-
border-top: solid 1px var(--colorsUtilityMajor050);
|
|
65
|
-
}
|
|
66
|
-
`}
|
|
67
|
-
|
|
68
|
-
${(width || height) && css`
|
|
69
|
-
flex-grow: 0;
|
|
70
|
-
${computeSizing({
|
|
71
|
-
width: width || /* istanbul ignore next */undefined,
|
|
72
|
-
height: height || undefined
|
|
73
|
-
})}
|
|
74
|
-
`}
|
|
75
|
-
`}
|
|
76
|
-
`;
|
|
77
21
|
const StyledTile = styled.div`
|
|
78
22
|
${({
|
|
79
23
|
borderVariant,
|
|
@@ -113,10 +57,7 @@ const StyledTile = styled.div`
|
|
|
113
57
|
})}
|
|
114
58
|
`}
|
|
115
59
|
`;
|
|
116
|
-
TileContent.defaultProps = {
|
|
117
|
-
theme: baseTheme
|
|
118
|
-
};
|
|
119
60
|
StyledTile.defaultProps = {
|
|
120
61
|
theme: baseTheme
|
|
121
62
|
};
|
|
122
|
-
export
|
|
63
|
+
export default StyledTile;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { PaddingProps } from "styled-system";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const paddingNames: (keyof PaddingProps)[];
|
|
3
|
+
export declare const paddingLeftPropertyNames: (keyof PaddingProps)[];
|
|
4
|
+
export declare const paddingRightPropertyNames: (keyof PaddingProps)[];
|
|
5
|
+
export declare const paddingXPropertyNames: (keyof PaddingProps)[];
|
|
6
|
+
export declare const paddingTopPropertyNames: (keyof PaddingProps)[];
|
|
7
|
+
export declare const paddingBottomPropertyNames: (keyof PaddingProps)[];
|
|
8
|
+
export declare const paddingYPropertyNames: (keyof PaddingProps)[];
|
|
9
|
+
export declare const paddingPropertyNames: (keyof PaddingProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>)[];
|
|
3
10
|
export default function filterStyledSystemPaddingProps(props: Record<string, unknown> | PaddingProps): PaddingProps;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import filterObjectProperties from "../../__internal__/filter-object-properties";
|
|
2
|
-
export const
|
|
2
|
+
export const paddingNames = ["p", "padding"];
|
|
3
|
+
export const paddingLeftPropertyNames = ["pl", "paddingLeft"];
|
|
4
|
+
export const paddingRightPropertyNames = ["pr", "paddingRight"];
|
|
5
|
+
export const paddingXPropertyNames = ["px", "paddingX"];
|
|
6
|
+
const paddingHorizontalPropertyNames = [...paddingLeftPropertyNames, ...paddingRightPropertyNames, ...paddingXPropertyNames];
|
|
7
|
+
export const paddingTopPropertyNames = ["pt", "paddingTop"];
|
|
8
|
+
export const paddingBottomPropertyNames = ["pb", "paddingBottom"];
|
|
9
|
+
export const paddingYPropertyNames = ["py", "paddingY"];
|
|
10
|
+
const paddingVerticalPropertyNames = [...paddingTopPropertyNames, ...paddingBottomPropertyNames, ...paddingYPropertyNames];
|
|
11
|
+
export const paddingPropertyNames = [...paddingNames, ...paddingHorizontalPropertyNames, ...paddingVerticalPropertyNames];
|
|
3
12
|
export default function filterStyledSystemPaddingProps(props) {
|
|
4
13
|
return filterObjectProperties(props, paddingPropertyNames);
|
|
5
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { elementsTagTest, rootTagTest } from "./tags-specs";
|
|
1
|
+
export { elementsTagTest, rootTagTest, rootTagTestRtl } from "./tags-specs";
|
|
@@ -15,4 +15,10 @@ Object.defineProperty(exports, "rootTagTest", {
|
|
|
15
15
|
return _tagsSpecs.rootTagTest;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "rootTagTestRtl", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _tagsSpecs.rootTagTestRtl;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
var _tagsSpecs = require("./tags-specs");
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactWrapper, ShallowWrapper } from "enzyme";
|
|
2
2
|
declare const elementsTagTest: (wrapper: ReactWrapper | ShallowWrapper, elements: string[]) => void;
|
|
3
3
|
declare const rootTagTest: (rootNode: ReactWrapper | ShallowWrapper, comp: string, elem?: string, role?: string) => void;
|
|
4
|
-
|
|
4
|
+
declare const rootTagTestRtl: (element: HTMLElement, comp: string, elem?: string, role?: string) => void;
|
|
5
|
+
export { elementsTagTest, rootTagTest, rootTagTestRtl };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.rootTagTest = exports.elementsTagTest = void 0;
|
|
6
|
+
exports.rootTagTestRtl = exports.rootTagTest = exports.elementsTagTest = void 0;
|
|
7
7
|
const elementsTagTest = (wrapper, elements) => {
|
|
8
8
|
elements.forEach(element => {
|
|
9
9
|
it(`include 'data-element="${element}"'`, () => {
|
|
@@ -19,6 +19,10 @@ const rootTagTest = (rootNode, comp, elem, role) => {
|
|
|
19
19
|
expect(rootNode.prop("data-element")).toEqual(elem);
|
|
20
20
|
expect(rootNode.prop("data-role")).toEqual(role);
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
exports.rootTagTest = rootTagTest;
|
|
23
|
+
const rootTagTestRtl = (element, comp, elem, role) => {
|
|
24
|
+
expect(element.getAttribute("data-component")).toBe(comp);
|
|
25
|
+
expect(element.getAttribute("data-element")).toBe(elem);
|
|
26
|
+
expect(element.getAttribute("data-role")).toBe(role);
|
|
27
|
+
};
|
|
28
|
+
exports.rootTagTestRtl = rootTagTestRtl;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PaddingProps } from "styled-system";
|
|
2
|
+
declare const _default: (paddingProps: PaddingProps, isHorizontal: boolean) => {
|
|
3
|
+
pr: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
|
4
|
+
pl: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
|
5
|
+
pt?: undefined;
|
|
6
|
+
pb?: undefined;
|
|
7
|
+
} | {
|
|
8
|
+
pt: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
|
9
|
+
pb: import("styled-system").ResponsiveValue<string | number | symbol, Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> | undefined;
|
|
10
|
+
pr?: undefined;
|
|
11
|
+
pl?: undefined;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _filterStyledSystemPaddingProps = require("../../../style/utils/filter-styled-system-padding-props");
|
|
8
|
+
const CONTENT_PADDING_LEFT_KEYS = [..._filterStyledSystemPaddingProps.paddingLeftPropertyNames, ..._filterStyledSystemPaddingProps.paddingXPropertyNames, ..._filterStyledSystemPaddingProps.paddingNames];
|
|
9
|
+
const CONTENT_PADDING_RIGHT_KEYS = [..._filterStyledSystemPaddingProps.paddingRightPropertyNames, ..._filterStyledSystemPaddingProps.paddingXPropertyNames, ..._filterStyledSystemPaddingProps.paddingNames];
|
|
10
|
+
const CONTENT_PADDING_TOP_KEYS = [..._filterStyledSystemPaddingProps.paddingTopPropertyNames, ..._filterStyledSystemPaddingProps.paddingYPropertyNames, ..._filterStyledSystemPaddingProps.paddingNames];
|
|
11
|
+
const CONTENT_PADDING_BOTTOM_KEYS = [..._filterStyledSystemPaddingProps.paddingBottomPropertyNames, ..._filterStyledSystemPaddingProps.paddingYPropertyNames, ..._filterStyledSystemPaddingProps.paddingNames];
|
|
12
|
+
var _default = (paddingProps, isHorizontal) => {
|
|
13
|
+
const getPaddingProps = paddingKeys => {
|
|
14
|
+
const key = paddingKeys.find(propName => paddingProps[propName]);
|
|
15
|
+
|
|
16
|
+
/* istanbul ignore if */
|
|
17
|
+
if (!key) {
|
|
18
|
+
return key;
|
|
19
|
+
}
|
|
20
|
+
return paddingProps[key];
|
|
21
|
+
};
|
|
22
|
+
return isHorizontal ? {
|
|
23
|
+
pr: getPaddingProps(CONTENT_PADDING_LEFT_KEYS),
|
|
24
|
+
pl: getPaddingProps(CONTENT_PADDING_RIGHT_KEYS)
|
|
25
|
+
} : {
|
|
26
|
+
pt: getPaddingProps(CONTENT_PADDING_TOP_KEYS),
|
|
27
|
+
pb: getPaddingProps(CONTENT_PADDING_BOTTOM_KEYS)
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.default = _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { PaddingProps } from "styled-system";
|
|
3
|
+
interface TileContextProps {
|
|
4
|
+
isHorizontal?: boolean;
|
|
5
|
+
paddingPropsFromTile: PaddingProps;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: import("react").Context<TileContextProps>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _default = /*#__PURE__*/(0, _react.createContext)({
|
|
9
|
+
paddingPropsFromTile: {}
|
|
10
|
+
});
|
|
11
|
+
exports.default = _default;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
export { default } from "./tile.component";
|
|
1
|
+
export { default as Tile } from "./tile.component";
|
|
2
2
|
export type { TileProps } from "./tile.component";
|
|
3
|
+
export { default as TileContent } from "./tile-content";
|
|
4
|
+
export type { TileContentProps } from "./tile-content";
|
|
5
|
+
export { default as TileFooter } from "./tile-footer";
|
|
6
|
+
export type { TileFooterProps } from "./tile-footer";
|
|
@@ -3,11 +3,25 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "Tile", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
9
|
return _tile.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "TileContent", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _tileContent.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "TileFooter", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _tileFooter.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
12
24
|
var _tile = _interopRequireDefault(require("./tile.component"));
|
|
25
|
+
var _tileContent = _interopRequireDefault(require("./tile-content"));
|
|
26
|
+
var _tileFooter = _interopRequireDefault(require("./tile-footer"));
|
|
13
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _tileContent.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _tileContent = _interopRequireDefault(require("./tile-content.component"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SpaceProps } from "styled-system";
|
|
3
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
4
|
+
export interface TileContentProps extends SpaceProps, TagProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
width?: string | number;
|
|
7
|
+
height?: string | number;
|
|
8
|
+
}
|
|
9
|
+
declare const TileContent: ({ children, width, height, ...rest }: TileContentProps) => React.JSX.Element | null;
|
|
10
|
+
export default TileContent;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _tileContent = _interopRequireDefault(require("./tile-content.style"));
|
|
10
|
+
var _tileContext = _interopRequireDefault(require("../__internal__/tile-context"));
|
|
11
|
+
var _tags = _interopRequireDefault(require("../../../__internal__/utils/helpers/tags"));
|
|
12
|
+
var _filterStyledSystemPaddingProps = _interopRequireDefault(require("../../../style/utils/filter-styled-system-padding-props"));
|
|
13
|
+
var _filterStyledSystemMarginProps = _interopRequireDefault(require("../../../style/utils/filter-styled-system-margin-props"));
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
18
|
+
const TileContent = ({
|
|
19
|
+
children,
|
|
20
|
+
width,
|
|
21
|
+
height,
|
|
22
|
+
...rest
|
|
23
|
+
}) => {
|
|
24
|
+
const {
|
|
25
|
+
isHorizontal,
|
|
26
|
+
paddingPropsFromTile
|
|
27
|
+
} = (0, _react.useContext)(_tileContext.default);
|
|
28
|
+
if (!children) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const spacingProps = {
|
|
32
|
+
...(0, _filterStyledSystemPaddingProps.default)(rest),
|
|
33
|
+
...(0, _filterStyledSystemMarginProps.default)(rest)
|
|
34
|
+
};
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_tileContent.default, _extends({
|
|
36
|
+
width: width,
|
|
37
|
+
height: height,
|
|
38
|
+
isHorizontal: isHorizontal,
|
|
39
|
+
isVertical: !isHorizontal
|
|
40
|
+
}, paddingPropsFromTile, spacingProps, (0, _tags.default)("tile-content", rest)), children);
|
|
41
|
+
};
|
|
42
|
+
var _default = TileContent;
|
|
43
|
+
exports.default = _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TileContentProps } from "./tile-content.component";
|
|
2
|
+
interface StyledTileContentProps extends TileContentProps {
|
|
3
|
+
isHorizontal?: boolean;
|
|
4
|
+
isVertical?: boolean;
|
|
5
|
+
width?: string | number;
|
|
6
|
+
height?: string | number;
|
|
7
|
+
}
|
|
8
|
+
declare const StyledTileContent: import("styled-components").StyledComponent<"div", any, StyledTileContentProps, never>;
|
|
9
|
+
export default StyledTileContent;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
var _styledSystem = require("styled-system");
|
|
9
|
+
var _base = _interopRequireDefault(require("../../../style/themes/base"));
|
|
10
|
+
var _elementSizing = _interopRequireDefault(require("../../../style/utils/element-sizing"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
+
const StyledTileContent = _styledComponents.default.div`
|
|
15
|
+
${({
|
|
16
|
+
isHorizontal,
|
|
17
|
+
isVertical,
|
|
18
|
+
width,
|
|
19
|
+
height
|
|
20
|
+
}) => (0, _styledComponents.css)`
|
|
21
|
+
${_styledSystem.space}
|
|
22
|
+
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
position: relative;
|
|
25
|
+
flex-grow: 1;
|
|
26
|
+
|
|
27
|
+
${isHorizontal && (0, _styledComponents.css)`
|
|
28
|
+
display: inline;
|
|
29
|
+
|
|
30
|
+
:last-of-type {
|
|
31
|
+
padding-right: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:first-of-type {
|
|
35
|
+
padding-left: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
& + & {
|
|
39
|
+
margin-top: 0;
|
|
40
|
+
border-left: solid 1px var(--colorsUtilityMajor050);
|
|
41
|
+
}
|
|
42
|
+
`}
|
|
43
|
+
|
|
44
|
+
${isVertical && (0, _styledComponents.css)`
|
|
45
|
+
width: auto;
|
|
46
|
+
|
|
47
|
+
:last-of-type {
|
|
48
|
+
padding-bottom: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
:first-of-type {
|
|
52
|
+
padding-top: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
& + & {
|
|
56
|
+
margin-top: 0;
|
|
57
|
+
border-top: solid 1px var(--colorsUtilityMajor050);
|
|
58
|
+
}
|
|
59
|
+
`}
|
|
60
|
+
|
|
61
|
+
${(width || height) && (0, _styledComponents.css)`
|
|
62
|
+
flex-grow: 0;
|
|
63
|
+
${(0, _elementSizing.default)({
|
|
64
|
+
width: width || /* istanbul ignore next */undefined,
|
|
65
|
+
height: height || undefined
|
|
66
|
+
})}
|
|
67
|
+
`}
|
|
68
|
+
`}
|
|
69
|
+
`;
|
|
70
|
+
StyledTileContent.defaultProps = {
|
|
71
|
+
theme: _base.default
|
|
72
|
+
};
|
|
73
|
+
var _default = StyledTileContent;
|
|
74
|
+
exports.default = _default;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
|
-
|
|
3
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
4
|
+
export interface TileFooterProps extends PaddingProps, TagProps {
|
|
4
5
|
children?: React.ReactNode;
|
|
5
6
|
/** set which background color variant should be used */
|
|
6
7
|
variant?: "default" | "black" | "transparent";
|
|
7
8
|
}
|
|
8
|
-
export declare const TileFooter: ({ variant, children, ...
|
|
9
|
+
export declare const TileFooter: ({ variant, children, ...rest }: TileFooterProps) => React.JSX.Element;
|
|
9
10
|
export default TileFooter;
|
|
@@ -7,18 +7,17 @@ exports.default = exports.TileFooter = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _tileFooter = _interopRequireDefault(require("./tile-footer.style"));
|
|
10
|
+
var _tags = _interopRequireDefault(require("../../../__internal__/utils/helpers/tags"));
|
|
11
|
+
var _filterStyledSystemPaddingProps = _interopRequireDefault(require("../../../style/utils/filter-styled-system-padding-props"));
|
|
10
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
13
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
12
14
|
const TileFooter = ({
|
|
13
15
|
variant,
|
|
14
16
|
children,
|
|
15
|
-
...
|
|
16
|
-
}) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
variant: variant
|
|
20
|
-
}, props), children);
|
|
21
|
-
};
|
|
17
|
+
...rest
|
|
18
|
+
}) => /*#__PURE__*/_react.default.createElement(_tileFooter.default, _extends({
|
|
19
|
+
variant: variant
|
|
20
|
+
}, (0, _filterStyledSystemPaddingProps.default)(rest), (0, _tags.default)("tile-footer", rest)), children);
|
|
22
21
|
exports.TileFooter = TileFooter;
|
|
23
22
|
var _default = TileFooter;
|
|
24
23
|
exports.default = _default;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import * as DesignTokens from "@sage/design-tokens/js/base/common";
|
|
3
3
|
import { SpaceProps, WidthProps } from "styled-system";
|
|
4
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
4
5
|
declare type DesignTokensType = keyof typeof DesignTokens;
|
|
5
|
-
export interface TileProps extends SpaceProps, WidthProps {
|
|
6
|
+
export interface TileProps extends SpaceProps, WidthProps, TagProps {
|
|
6
7
|
/** Sets the theme of the tile - either 'tile', 'transparent' or 'active' */
|
|
7
8
|
variant?: "tile" | "transparent" | "active";
|
|
8
9
|
/**
|
|
@@ -31,5 +32,5 @@ export interface TileProps extends SpaceProps, WidthProps {
|
|
|
31
32
|
*/
|
|
32
33
|
height?: string | number;
|
|
33
34
|
}
|
|
34
|
-
export declare const Tile: ({ variant, p, children, orientation, width, roundness, height, ...
|
|
35
|
+
export declare const Tile: ({ variant, p, children, orientation, width, roundness, height, borderWidth, borderVariant, ...rest }: TileProps) => React.JSX.Element;
|
|
35
36
|
export default Tile;
|
|
@@ -6,7 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.Tile = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _tile = require("./tile.style");
|
|
9
|
+
var _tile = _interopRequireDefault(require("./tile.style"));
|
|
10
|
+
var _tileContext = _interopRequireDefault(require("./__internal__/tile-context"));
|
|
11
|
+
var _filterStyledSystemPaddingProps = _interopRequireDefault(require("../../style/utils/filter-styled-system-padding-props"));
|
|
12
|
+
var _filterStyledSystemMarginProps = _interopRequireDefault(require("../../style/utils/filter-styled-system-margin-props"));
|
|
13
|
+
var _computeContentPadding = _interopRequireDefault(require("./__internal__/compute-content-padding"));
|
|
14
|
+
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags"));
|
|
10
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
16
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
12
17
|
const Tile = ({
|
|
@@ -17,48 +22,32 @@ const Tile = ({
|
|
|
17
22
|
width = "100%",
|
|
18
23
|
roundness = "default",
|
|
19
24
|
height,
|
|
20
|
-
|
|
25
|
+
borderWidth,
|
|
26
|
+
borderVariant,
|
|
27
|
+
...rest
|
|
21
28
|
}) => {
|
|
22
29
|
const isHorizontal = orientation === "horizontal";
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// istanbul ignore if
|
|
30
|
-
if (! /*#__PURE__*/_react.default.isValidElement(child)) {
|
|
31
|
-
return child;
|
|
32
|
-
}
|
|
33
|
-
const {
|
|
34
|
-
width: contentWidth,
|
|
35
|
-
height: contentHeight,
|
|
36
|
-
...childProps
|
|
37
|
-
} = child.props;
|
|
38
|
-
const key = child.key || `tile-content-${index + 1}`;
|
|
39
|
-
return /*#__PURE__*/_react.default.createElement(_tile.TileContent, _extends({
|
|
40
|
-
key: key,
|
|
41
|
-
width: contentWidth,
|
|
42
|
-
height: contentHeight,
|
|
43
|
-
isHorizontal: isHorizontal,
|
|
44
|
-
isVertical: isVertical
|
|
45
|
-
}, isVertical && {
|
|
46
|
-
pt: props.pt || props.py || p,
|
|
47
|
-
pb: props.pb || props.py || p
|
|
48
|
-
}, isHorizontal && {
|
|
49
|
-
pr: props.pr || props.px || p,
|
|
50
|
-
pl: props.pl || props.px || p
|
|
51
|
-
}), /*#__PURE__*/_react.default.cloneElement(child, childProps));
|
|
30
|
+
const paddingProps = (0, _filterStyledSystemPaddingProps.default)({
|
|
31
|
+
p,
|
|
32
|
+
...rest
|
|
52
33
|
});
|
|
53
|
-
|
|
34
|
+
const marginProps = (0, _filterStyledSystemMarginProps.default)(rest);
|
|
35
|
+
const contentPaddingProps = (0, _computeContentPadding.default)(paddingProps, isHorizontal);
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_tile.default, _extends({
|
|
54
37
|
variant: variant,
|
|
55
38
|
width: width,
|
|
56
39
|
height: height,
|
|
57
|
-
"data-component": "tile",
|
|
58
40
|
isHorizontal: isHorizontal,
|
|
59
41
|
p: p,
|
|
60
|
-
roundness: roundness
|
|
61
|
-
|
|
42
|
+
roundness: roundness,
|
|
43
|
+
borderWidth: borderWidth,
|
|
44
|
+
borderVariant: borderVariant
|
|
45
|
+
}, paddingProps, marginProps, (0, _tags.default)("tile", rest)), /*#__PURE__*/_react.default.createElement(_tileContext.default.Provider, {
|
|
46
|
+
value: {
|
|
47
|
+
isHorizontal,
|
|
48
|
+
paddingPropsFromTile: contentPaddingProps
|
|
49
|
+
}
|
|
50
|
+
}, children));
|
|
62
51
|
};
|
|
63
52
|
exports.Tile = Tile;
|
|
64
53
|
var _default = Tile;
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { SpaceProps } from "styled-system";
|
|
2
2
|
import { TileProps } from "./tile.component";
|
|
3
|
-
interface TileContentProps {
|
|
4
|
-
isHorizontal?: boolean;
|
|
5
|
-
isVertical?: boolean;
|
|
6
|
-
width?: TileProps["width"];
|
|
7
|
-
height?: TileProps["height"];
|
|
8
|
-
}
|
|
9
|
-
declare const TileContent: import("styled-components").StyledComponent<"div", any, TileContentProps, never>;
|
|
10
3
|
declare const StyledTile: import("styled-components").StyledComponent<"div", any, Pick<TileProps, "width" | "height" | "variant" | "roundness" | "borderWidth" | "borderVariant"> & {
|
|
11
4
|
isHorizontal?: boolean | undefined;
|
|
12
5
|
} & SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol>, never>;
|
|
13
|
-
export
|
|
6
|
+
export default StyledTile;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _styledSystem = require("styled-system");
|
|
9
9
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
@@ -27,63 +27,6 @@ const getBorderColor = borderVariant => {
|
|
|
27
27
|
return "var(--colorsUtilityMajor100)";
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
const TileContent = _styledComponents.default.div`
|
|
31
|
-
${({
|
|
32
|
-
isHorizontal,
|
|
33
|
-
isVertical,
|
|
34
|
-
width,
|
|
35
|
-
height
|
|
36
|
-
}) => (0, _styledComponents.css)`
|
|
37
|
-
${_styledSystem.space}
|
|
38
|
-
|
|
39
|
-
box-sizing: border-box;
|
|
40
|
-
position: relative;
|
|
41
|
-
flex-grow: 1;
|
|
42
|
-
|
|
43
|
-
${isHorizontal && (0, _styledComponents.css)`
|
|
44
|
-
display: inline;
|
|
45
|
-
|
|
46
|
-
:last-of-type {
|
|
47
|
-
padding-right: 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
:first-of-type {
|
|
51
|
-
padding-left: 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
& + & {
|
|
55
|
-
margin-top: 0;
|
|
56
|
-
border-left: solid 1px var(--colorsUtilityMajor050);
|
|
57
|
-
}
|
|
58
|
-
`}
|
|
59
|
-
|
|
60
|
-
${isVertical && (0, _styledComponents.css)`
|
|
61
|
-
width: auto;
|
|
62
|
-
|
|
63
|
-
:last-of-type {
|
|
64
|
-
padding-bottom: 0;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
:first-of-type {
|
|
68
|
-
padding-top: 0;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
& + & {
|
|
72
|
-
margin-top: 0;
|
|
73
|
-
border-top: solid 1px var(--colorsUtilityMajor050);
|
|
74
|
-
}
|
|
75
|
-
`}
|
|
76
|
-
|
|
77
|
-
${(width || height) && (0, _styledComponents.css)`
|
|
78
|
-
flex-grow: 0;
|
|
79
|
-
${(0, _elementSizing.default)({
|
|
80
|
-
width: width || /* istanbul ignore next */undefined,
|
|
81
|
-
height: height || undefined
|
|
82
|
-
})}
|
|
83
|
-
`}
|
|
84
|
-
`}
|
|
85
|
-
`;
|
|
86
|
-
exports.TileContent = TileContent;
|
|
87
30
|
const StyledTile = _styledComponents.default.div`
|
|
88
31
|
${({
|
|
89
32
|
borderVariant,
|
|
@@ -123,10 +66,8 @@ const StyledTile = _styledComponents.default.div`
|
|
|
123
66
|
})}
|
|
124
67
|
`}
|
|
125
68
|
`;
|
|
126
|
-
exports.StyledTile = StyledTile;
|
|
127
|
-
TileContent.defaultProps = {
|
|
128
|
-
theme: _base.default
|
|
129
|
-
};
|
|
130
69
|
StyledTile.defaultProps = {
|
|
131
70
|
theme: _base.default
|
|
132
|
-
};
|
|
71
|
+
};
|
|
72
|
+
var _default = StyledTile;
|
|
73
|
+
exports.default = _default;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { PaddingProps } from "styled-system";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const paddingNames: (keyof PaddingProps)[];
|
|
3
|
+
export declare const paddingLeftPropertyNames: (keyof PaddingProps)[];
|
|
4
|
+
export declare const paddingRightPropertyNames: (keyof PaddingProps)[];
|
|
5
|
+
export declare const paddingXPropertyNames: (keyof PaddingProps)[];
|
|
6
|
+
export declare const paddingTopPropertyNames: (keyof PaddingProps)[];
|
|
7
|
+
export declare const paddingBottomPropertyNames: (keyof PaddingProps)[];
|
|
8
|
+
export declare const paddingYPropertyNames: (keyof PaddingProps)[];
|
|
9
|
+
export declare const paddingPropertyNames: (keyof PaddingProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>>)[];
|
|
3
10
|
export default function filterStyledSystemPaddingProps(props: Record<string, unknown> | PaddingProps): PaddingProps;
|
|
@@ -4,10 +4,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = filterStyledSystemPaddingProps;
|
|
7
|
-
exports.paddingPropertyNames = void 0;
|
|
7
|
+
exports.paddingYPropertyNames = exports.paddingXPropertyNames = exports.paddingTopPropertyNames = exports.paddingRightPropertyNames = exports.paddingPropertyNames = exports.paddingNames = exports.paddingLeftPropertyNames = exports.paddingBottomPropertyNames = void 0;
|
|
8
8
|
var _filterObjectProperties = _interopRequireDefault(require("../../__internal__/filter-object-properties"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
const
|
|
10
|
+
const paddingNames = ["p", "padding"];
|
|
11
|
+
exports.paddingNames = paddingNames;
|
|
12
|
+
const paddingLeftPropertyNames = ["pl", "paddingLeft"];
|
|
13
|
+
exports.paddingLeftPropertyNames = paddingLeftPropertyNames;
|
|
14
|
+
const paddingRightPropertyNames = ["pr", "paddingRight"];
|
|
15
|
+
exports.paddingRightPropertyNames = paddingRightPropertyNames;
|
|
16
|
+
const paddingXPropertyNames = ["px", "paddingX"];
|
|
17
|
+
exports.paddingXPropertyNames = paddingXPropertyNames;
|
|
18
|
+
const paddingHorizontalPropertyNames = [...paddingLeftPropertyNames, ...paddingRightPropertyNames, ...paddingXPropertyNames];
|
|
19
|
+
const paddingTopPropertyNames = ["pt", "paddingTop"];
|
|
20
|
+
exports.paddingTopPropertyNames = paddingTopPropertyNames;
|
|
21
|
+
const paddingBottomPropertyNames = ["pb", "paddingBottom"];
|
|
22
|
+
exports.paddingBottomPropertyNames = paddingBottomPropertyNames;
|
|
23
|
+
const paddingYPropertyNames = ["py", "paddingY"];
|
|
24
|
+
exports.paddingYPropertyNames = paddingYPropertyNames;
|
|
25
|
+
const paddingVerticalPropertyNames = [...paddingTopPropertyNames, ...paddingBottomPropertyNames, ...paddingYPropertyNames];
|
|
26
|
+
const paddingPropertyNames = [...paddingNames, ...paddingHorizontalPropertyNames, ...paddingVerticalPropertyNames];
|
|
11
27
|
exports.paddingPropertyNames = paddingPropertyNames;
|
|
12
28
|
function filterStyledSystemPaddingProps(props) {
|
|
13
29
|
return (0, _filterObjectProperties.default)(props, paddingPropertyNames);
|