carbon-react 144.21.0 → 144.22.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/components/box/box.component.js +23 -3
- package/esm/components/box/box.style.d.ts +8 -1
- package/esm/components/box/box.style.js +17 -9
- package/esm/components/duelling-picklist/picklist/picklist.style.d.ts +7 -0
- package/esm/components/flat-table/flat-table.style.d.ts +8 -1
- package/esm/components/typography/list.component.d.ts +4 -2
- package/esm/components/typography/list.component.js +25 -8
- package/esm/components/typography/list.context.d.ts +7 -0
- package/esm/components/typography/list.context.js +3 -0
- package/esm/components/vertical-menu/vertical-menu.style.d.ts +16 -2
- package/lib/components/box/box.component.js +23 -3
- package/lib/components/box/box.style.d.ts +8 -1
- package/lib/components/box/box.style.js +17 -9
- package/lib/components/duelling-picklist/picklist/picklist.style.d.ts +7 -0
- package/lib/components/flat-table/flat-table.style.d.ts +8 -1
- package/lib/components/typography/list.component.d.ts +4 -2
- package/lib/components/typography/list.component.js +27 -8
- package/lib/components/typography/list.context.d.ts +7 -0
- package/lib/components/typography/list.context.js +10 -0
- package/lib/components/vertical-menu/vertical-menu.style.d.ts +16 -2
- package/package.json +6 -7
- package/scripts/check_rfcs/check_rfcs.js +3 -5
- package/esm/style/design-tokens/debug-theme.util.d.ts +0 -514
- package/esm/style/design-tokens/debug-theme.util.js +0 -37
- package/lib/style/design-tokens/debug-theme.util.d.ts +0 -514
- package/lib/style/design-tokens/debug-theme.util.js +0 -44
|
@@ -26,6 +26,8 @@ const Box = /*#__PURE__*/React.forwardRef(({
|
|
|
26
26
|
borderRadius,
|
|
27
27
|
color,
|
|
28
28
|
opacity,
|
|
29
|
+
height,
|
|
30
|
+
width,
|
|
29
31
|
"aria-hidden": ariaHidden,
|
|
30
32
|
...rest
|
|
31
33
|
}, ref) => {
|
|
@@ -33,6 +35,24 @@ const Box = /*#__PURE__*/React.forwardRef(({
|
|
|
33
35
|
deprecatedTabIndex = true;
|
|
34
36
|
Logger.deprecate("The `tabIndex` prop for `Box` component has been deprecated and will soon be removed.");
|
|
35
37
|
}
|
|
38
|
+
let actualWidth = "";
|
|
39
|
+
if (typeof width === "number") {
|
|
40
|
+
actualWidth = width <= 1 ? `${(width * 100).toFixed(0)}%` : `${width}px`;
|
|
41
|
+
} else if (typeof width === "string") {
|
|
42
|
+
actualWidth = width;
|
|
43
|
+
}
|
|
44
|
+
let actualHeight = "";
|
|
45
|
+
if (typeof height === "number") {
|
|
46
|
+
actualHeight = height <= 1 ? `${(height * 100).toFixed(0)}%` : `${height}px`;
|
|
47
|
+
} else if (typeof height === "string") {
|
|
48
|
+
actualHeight = height;
|
|
49
|
+
}
|
|
50
|
+
const cssProps = {
|
|
51
|
+
color,
|
|
52
|
+
opacity,
|
|
53
|
+
width: actualWidth,
|
|
54
|
+
height: actualHeight
|
|
55
|
+
};
|
|
36
56
|
return /*#__PURE__*/React.createElement(StyledBox, _extends({
|
|
37
57
|
as: as,
|
|
38
58
|
id: id,
|
|
@@ -50,10 +70,10 @@ const Box = /*#__PURE__*/React.forwardRef(({
|
|
|
50
70
|
backgroundColor: backgroundColor,
|
|
51
71
|
boxShadow: boxShadow,
|
|
52
72
|
borderRadius: borderRadius,
|
|
53
|
-
color: color,
|
|
54
|
-
opacity: opacity,
|
|
55
73
|
"aria-hidden": ariaHidden
|
|
56
|
-
}, tagComponent(dataComponent, rest), filterStyledSystemMarginProps(rest), filterStyledSystemPaddingProps(rest), filterStyledSystemFlexboxProps(rest), filterStyledSystemGridProps(rest), filterStyledSystemLayoutProps(rest)
|
|
74
|
+
}, tagComponent(dataComponent, rest), filterStyledSystemMarginProps(rest), filterStyledSystemPaddingProps(rest), filterStyledSystemFlexboxProps(rest), filterStyledSystemGridProps(rest), filterStyledSystemLayoutProps(rest), {
|
|
75
|
+
cssProps: cssProps
|
|
76
|
+
}), children);
|
|
57
77
|
});
|
|
58
78
|
if (process.env.NODE_ENV !== "production") {
|
|
59
79
|
Box.propTypes = {
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { BoxProps } from "./box.component";
|
|
2
|
-
declare const StyledBox: import("styled-components").StyledComponent<"div", any, BoxProps
|
|
2
|
+
declare const StyledBox: import("styled-components").StyledComponent<"div", any, BoxProps & {
|
|
3
|
+
cssProps?: {
|
|
4
|
+
color?: string | undefined;
|
|
5
|
+
opacity?: string | undefined;
|
|
6
|
+
height?: string | undefined;
|
|
7
|
+
width?: string | undefined;
|
|
8
|
+
} | undefined;
|
|
9
|
+
}, never>;
|
|
3
10
|
export default StyledBox;
|
|
@@ -28,19 +28,25 @@ const StyledBox = styled.div`
|
|
|
28
28
|
}) => !theme.roundedCornersOptOut && css`
|
|
29
29
|
border-radius: var(--${borderRadius});
|
|
30
30
|
`}
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
${({
|
|
33
|
-
|
|
33
|
+
cssProps,
|
|
34
34
|
bg,
|
|
35
35
|
backgroundColor,
|
|
36
36
|
...rest
|
|
37
37
|
}) => styledColor({
|
|
38
|
-
color,
|
|
38
|
+
color: cssProps?.color,
|
|
39
39
|
bg,
|
|
40
40
|
backgroundColor,
|
|
41
41
|
...rest
|
|
42
42
|
})}
|
|
43
43
|
|
|
44
|
+
${({
|
|
45
|
+
cssProps
|
|
46
|
+
}) => css`
|
|
47
|
+
opacity: ${cssProps?.opacity};
|
|
48
|
+
`}
|
|
49
|
+
|
|
44
50
|
${({
|
|
45
51
|
overflowWrap
|
|
46
52
|
}) => overflowWrap && css`
|
|
@@ -48,15 +54,17 @@ const StyledBox = styled.div`
|
|
|
48
54
|
`}
|
|
49
55
|
|
|
50
56
|
${({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
cssProps,
|
|
58
|
+
size
|
|
59
|
+
}) => cssProps?.height && !size && css`
|
|
60
|
+
height: ${cssProps?.height};
|
|
54
61
|
`}
|
|
55
62
|
|
|
56
63
|
${({
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
cssProps,
|
|
65
|
+
size
|
|
66
|
+
}) => cssProps?.width && !size && css`
|
|
67
|
+
width: ${cssProps?.width};
|
|
60
68
|
`}
|
|
61
69
|
|
|
62
70
|
${({
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
declare const StyledPicklist: import("styled-components").StyledComponent<"div", any, import("../../box").BoxProps & {
|
|
2
|
+
cssProps?: {
|
|
3
|
+
color?: string | undefined;
|
|
4
|
+
opacity?: string | undefined;
|
|
5
|
+
height?: string | undefined;
|
|
6
|
+
width?: string | undefined;
|
|
7
|
+
} | undefined;
|
|
8
|
+
} & {
|
|
2
9
|
as: string;
|
|
3
10
|
}, "as">;
|
|
4
11
|
declare const StyledEmptyContainer: import("styled-components").StyledComponent<"li", any, {}, never>;
|
|
@@ -12,6 +12,13 @@ interface StyledFlatTableWrapperProps extends Pick<FlatTableProps, "hasStickyFoo
|
|
|
12
12
|
isFocused: boolean;
|
|
13
13
|
bottomBorderRadius: NonNullable<FlatTableProps["bottomBorderRadius"]>;
|
|
14
14
|
}
|
|
15
|
-
declare const StyledFlatTableWrapper: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps &
|
|
15
|
+
declare const StyledFlatTableWrapper: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & {
|
|
16
|
+
cssProps?: {
|
|
17
|
+
color?: string | undefined;
|
|
18
|
+
opacity?: string | undefined;
|
|
19
|
+
height?: string | undefined;
|
|
20
|
+
width?: string | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
} & StyledFlatTableWrapperProps, never>;
|
|
16
23
|
declare const StyledFlatTableFooter: import("styled-components").StyledComponent<"div", any, Pick<FlatTableProps, "hasStickyFooter">, never>;
|
|
17
24
|
export { StyledFlatTableWrapper, StyledFlatTable, StyledFlatTableFooter, StyledTableContainer, };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { TypographyProps } from "./typography.component";
|
|
2
|
+
import { TypographyProps, VariantTypes } from "./typography.component";
|
|
3
3
|
export interface ListProps extends TypographyProps {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
}
|
|
6
6
|
export interface ListItemProps extends TypographyProps {
|
|
7
|
+
/** (Deprecated) The visual style to apply to the component */
|
|
8
|
+
variant?: VariantTypes;
|
|
7
9
|
children?: React.ReactNode;
|
|
8
10
|
}
|
|
9
|
-
declare const List: ({ children, as, ...props }: ListProps) => React.JSX.Element;
|
|
11
|
+
declare const List: ({ children, as, variant, ...props }: ListProps) => React.JSX.Element;
|
|
10
12
|
declare const ListItem: ({ children, ...props }: ListItemProps) => React.JSX.Element;
|
|
11
13
|
export { List, ListItem };
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { useContext } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import Typography from "./typography.component";
|
|
5
|
+
import ListContext from "./list.context";
|
|
6
|
+
import Logger from "../../__internal__/utils/logger";
|
|
7
|
+
let childVariantDeprecationWarning = false;
|
|
5
8
|
const getListStyleType = as => {
|
|
6
9
|
if (as === "ul") {
|
|
7
10
|
return "square";
|
|
@@ -11,18 +14,32 @@ const getListStyleType = as => {
|
|
|
11
14
|
const List = ({
|
|
12
15
|
children,
|
|
13
16
|
as = "ul",
|
|
17
|
+
variant = "p",
|
|
14
18
|
...props
|
|
15
19
|
}) => /*#__PURE__*/React.createElement(Typography, _extends({
|
|
16
|
-
variant:
|
|
20
|
+
variant: variant,
|
|
17
21
|
as: as,
|
|
18
22
|
listStyleType: getListStyleType(as)
|
|
19
|
-
}, props),
|
|
23
|
+
}, props), /*#__PURE__*/React.createElement(ListContext.Provider, {
|
|
24
|
+
value: {
|
|
25
|
+
variant
|
|
26
|
+
}
|
|
27
|
+
}, children));
|
|
20
28
|
const ListItem = ({
|
|
21
29
|
children,
|
|
22
30
|
...props
|
|
23
|
-
}) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
31
|
+
}) => {
|
|
32
|
+
if (props.variant && !childVariantDeprecationWarning) {
|
|
33
|
+
Logger.deprecate("The use of `variant` on `ListItem` is deprecated. Please set it via `List` instead.");
|
|
34
|
+
childVariantDeprecationWarning = true;
|
|
35
|
+
}
|
|
36
|
+
const {
|
|
37
|
+
variant: parentListVariant
|
|
38
|
+
} = useContext(ListContext);
|
|
39
|
+
return /*#__PURE__*/React.createElement(Typography, _extends({
|
|
40
|
+
as: "li",
|
|
41
|
+
variant: parentListVariant,
|
|
42
|
+
m: "0 0 8px 16px"
|
|
43
|
+
}, props), children);
|
|
44
|
+
};
|
|
28
45
|
export { List, ListItem };
|
|
@@ -10,6 +10,20 @@ export declare const StyledTitle: import("styled-components").StyledComponent<"h
|
|
|
10
10
|
export declare const StyledAdornment: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
11
|
export declare const StyledTitleIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
|
|
12
12
|
export declare const StyledChevronIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
|
|
13
|
-
export declare const StyledVerticalMenu: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps
|
|
14
|
-
|
|
13
|
+
export declare const StyledVerticalMenu: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & {
|
|
14
|
+
cssProps?: {
|
|
15
|
+
color?: string | undefined;
|
|
16
|
+
opacity?: string | undefined;
|
|
17
|
+
height?: string | undefined;
|
|
18
|
+
width?: string | undefined;
|
|
19
|
+
} | undefined;
|
|
20
|
+
}, never>;
|
|
21
|
+
export declare const StyledVerticalMenuFullScreen: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & {
|
|
22
|
+
cssProps?: {
|
|
23
|
+
color?: string | undefined;
|
|
24
|
+
opacity?: string | undefined;
|
|
25
|
+
height?: string | undefined;
|
|
26
|
+
width?: string | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
}, never>;
|
|
15
29
|
export {};
|
|
@@ -33,6 +33,8 @@ const Box = exports.Box = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
33
33
|
borderRadius,
|
|
34
34
|
color,
|
|
35
35
|
opacity,
|
|
36
|
+
height,
|
|
37
|
+
width,
|
|
36
38
|
"aria-hidden": ariaHidden,
|
|
37
39
|
...rest
|
|
38
40
|
}, ref) => {
|
|
@@ -40,6 +42,24 @@ const Box = exports.Box = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
40
42
|
deprecatedTabIndex = true;
|
|
41
43
|
_logger.default.deprecate("The `tabIndex` prop for `Box` component has been deprecated and will soon be removed.");
|
|
42
44
|
}
|
|
45
|
+
let actualWidth = "";
|
|
46
|
+
if (typeof width === "number") {
|
|
47
|
+
actualWidth = width <= 1 ? `${(width * 100).toFixed(0)}%` : `${width}px`;
|
|
48
|
+
} else if (typeof width === "string") {
|
|
49
|
+
actualWidth = width;
|
|
50
|
+
}
|
|
51
|
+
let actualHeight = "";
|
|
52
|
+
if (typeof height === "number") {
|
|
53
|
+
actualHeight = height <= 1 ? `${(height * 100).toFixed(0)}%` : `${height}px`;
|
|
54
|
+
} else if (typeof height === "string") {
|
|
55
|
+
actualHeight = height;
|
|
56
|
+
}
|
|
57
|
+
const cssProps = {
|
|
58
|
+
color,
|
|
59
|
+
opacity,
|
|
60
|
+
width: actualWidth,
|
|
61
|
+
height: actualHeight
|
|
62
|
+
};
|
|
43
63
|
return /*#__PURE__*/_react.default.createElement(_box.default, _extends({
|
|
44
64
|
as: as,
|
|
45
65
|
id: id,
|
|
@@ -57,10 +77,10 @@ const Box = exports.Box = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
57
77
|
backgroundColor: backgroundColor,
|
|
58
78
|
boxShadow: boxShadow,
|
|
59
79
|
borderRadius: borderRadius,
|
|
60
|
-
color: color,
|
|
61
|
-
opacity: opacity,
|
|
62
80
|
"aria-hidden": ariaHidden
|
|
63
|
-
}, (0, _tags.default)(dataComponent, rest), (0, _utils.filterStyledSystemMarginProps)(rest), (0, _utils.filterStyledSystemPaddingProps)(rest), (0, _utils.filterStyledSystemFlexboxProps)(rest), (0, _utils.filterStyledSystemGridProps)(rest), (0, _utils.filterStyledSystemLayoutProps)(rest)
|
|
81
|
+
}, (0, _tags.default)(dataComponent, rest), (0, _utils.filterStyledSystemMarginProps)(rest), (0, _utils.filterStyledSystemPaddingProps)(rest), (0, _utils.filterStyledSystemFlexboxProps)(rest), (0, _utils.filterStyledSystemGridProps)(rest), (0, _utils.filterStyledSystemLayoutProps)(rest), {
|
|
82
|
+
cssProps: cssProps
|
|
83
|
+
}), children);
|
|
64
84
|
});
|
|
65
85
|
if (process.env.NODE_ENV !== "production") {
|
|
66
86
|
Box.propTypes = {
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { BoxProps } from "./box.component";
|
|
2
|
-
declare const StyledBox: import("styled-components").StyledComponent<"div", any, BoxProps
|
|
2
|
+
declare const StyledBox: import("styled-components").StyledComponent<"div", any, BoxProps & {
|
|
3
|
+
cssProps?: {
|
|
4
|
+
color?: string | undefined;
|
|
5
|
+
opacity?: string | undefined;
|
|
6
|
+
height?: string | undefined;
|
|
7
|
+
width?: string | undefined;
|
|
8
|
+
} | undefined;
|
|
9
|
+
}, never>;
|
|
3
10
|
export default StyledBox;
|
|
@@ -37,19 +37,25 @@ const StyledBox = _styledComponents.default.div`
|
|
|
37
37
|
}) => !theme.roundedCornersOptOut && (0, _styledComponents.css)`
|
|
38
38
|
border-radius: var(--${borderRadius});
|
|
39
39
|
`}
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
${({
|
|
42
|
-
|
|
42
|
+
cssProps,
|
|
43
43
|
bg,
|
|
44
44
|
backgroundColor,
|
|
45
45
|
...rest
|
|
46
46
|
}) => (0, _color.default)({
|
|
47
|
-
color,
|
|
47
|
+
color: cssProps?.color,
|
|
48
48
|
bg,
|
|
49
49
|
backgroundColor,
|
|
50
50
|
...rest
|
|
51
51
|
})}
|
|
52
52
|
|
|
53
|
+
${({
|
|
54
|
+
cssProps
|
|
55
|
+
}) => (0, _styledComponents.css)`
|
|
56
|
+
opacity: ${cssProps?.opacity};
|
|
57
|
+
`}
|
|
58
|
+
|
|
53
59
|
${({
|
|
54
60
|
overflowWrap
|
|
55
61
|
}) => overflowWrap && (0, _styledComponents.css)`
|
|
@@ -57,15 +63,17 @@ const StyledBox = _styledComponents.default.div`
|
|
|
57
63
|
`}
|
|
58
64
|
|
|
59
65
|
${({
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
cssProps,
|
|
67
|
+
size
|
|
68
|
+
}) => cssProps?.height && !size && (0, _styledComponents.css)`
|
|
69
|
+
height: ${cssProps?.height};
|
|
63
70
|
`}
|
|
64
71
|
|
|
65
72
|
${({
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
cssProps,
|
|
74
|
+
size
|
|
75
|
+
}) => cssProps?.width && !size && (0, _styledComponents.css)`
|
|
76
|
+
width: ${cssProps?.width};
|
|
69
77
|
`}
|
|
70
78
|
|
|
71
79
|
${({
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
declare const StyledPicklist: import("styled-components").StyledComponent<"div", any, import("../../box").BoxProps & {
|
|
2
|
+
cssProps?: {
|
|
3
|
+
color?: string | undefined;
|
|
4
|
+
opacity?: string | undefined;
|
|
5
|
+
height?: string | undefined;
|
|
6
|
+
width?: string | undefined;
|
|
7
|
+
} | undefined;
|
|
8
|
+
} & {
|
|
2
9
|
as: string;
|
|
3
10
|
}, "as">;
|
|
4
11
|
declare const StyledEmptyContainer: import("styled-components").StyledComponent<"li", any, {}, never>;
|
|
@@ -12,6 +12,13 @@ interface StyledFlatTableWrapperProps extends Pick<FlatTableProps, "hasStickyFoo
|
|
|
12
12
|
isFocused: boolean;
|
|
13
13
|
bottomBorderRadius: NonNullable<FlatTableProps["bottomBorderRadius"]>;
|
|
14
14
|
}
|
|
15
|
-
declare const StyledFlatTableWrapper: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps &
|
|
15
|
+
declare const StyledFlatTableWrapper: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & {
|
|
16
|
+
cssProps?: {
|
|
17
|
+
color?: string | undefined;
|
|
18
|
+
opacity?: string | undefined;
|
|
19
|
+
height?: string | undefined;
|
|
20
|
+
width?: string | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
} & StyledFlatTableWrapperProps, never>;
|
|
16
23
|
declare const StyledFlatTableFooter: import("styled-components").StyledComponent<"div", any, Pick<FlatTableProps, "hasStickyFooter">, never>;
|
|
17
24
|
export { StyledFlatTableWrapper, StyledFlatTable, StyledFlatTableFooter, StyledTableContainer, };
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { TypographyProps } from "./typography.component";
|
|
2
|
+
import { TypographyProps, VariantTypes } from "./typography.component";
|
|
3
3
|
export interface ListProps extends TypographyProps {
|
|
4
4
|
children?: React.ReactNode;
|
|
5
5
|
}
|
|
6
6
|
export interface ListItemProps extends TypographyProps {
|
|
7
|
+
/** (Deprecated) The visual style to apply to the component */
|
|
8
|
+
variant?: VariantTypes;
|
|
7
9
|
children?: React.ReactNode;
|
|
8
10
|
}
|
|
9
|
-
declare const List: ({ children, as, ...props }: ListProps) => React.JSX.Element;
|
|
11
|
+
declare const List: ({ children, as, variant, ...props }: ListProps) => React.JSX.Element;
|
|
10
12
|
declare const ListItem: ({ children, ...props }: ListItemProps) => React.JSX.Element;
|
|
11
13
|
export { List, ListItem };
|
|
@@ -4,11 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ListItem = exports.List = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _typography = _interopRequireDefault(require("./typography.component"));
|
|
10
|
+
var _list = _interopRequireDefault(require("./list.context"));
|
|
11
|
+
var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
|
|
10
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
14
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
15
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
16
|
+
let childVariantDeprecationWarning = false;
|
|
12
17
|
const getListStyleType = as => {
|
|
13
18
|
if (as === "ul") {
|
|
14
19
|
return "square";
|
|
@@ -18,19 +23,33 @@ const getListStyleType = as => {
|
|
|
18
23
|
const List = ({
|
|
19
24
|
children,
|
|
20
25
|
as = "ul",
|
|
26
|
+
variant = "p",
|
|
21
27
|
...props
|
|
22
28
|
}) => /*#__PURE__*/_react.default.createElement(_typography.default, _extends({
|
|
23
|
-
variant:
|
|
29
|
+
variant: variant,
|
|
24
30
|
as: as,
|
|
25
31
|
listStyleType: getListStyleType(as)
|
|
26
|
-
}, props),
|
|
32
|
+
}, props), /*#__PURE__*/_react.default.createElement(_list.default.Provider, {
|
|
33
|
+
value: {
|
|
34
|
+
variant
|
|
35
|
+
}
|
|
36
|
+
}, children));
|
|
27
37
|
exports.List = List;
|
|
28
38
|
const ListItem = ({
|
|
29
39
|
children,
|
|
30
40
|
...props
|
|
31
|
-
}) =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
41
|
+
}) => {
|
|
42
|
+
if (props.variant && !childVariantDeprecationWarning) {
|
|
43
|
+
_logger.default.deprecate("The use of `variant` on `ListItem` is deprecated. Please set it via `List` instead.");
|
|
44
|
+
childVariantDeprecationWarning = true;
|
|
45
|
+
}
|
|
46
|
+
const {
|
|
47
|
+
variant: parentListVariant
|
|
48
|
+
} = (0, _react.useContext)(_list.default);
|
|
49
|
+
return /*#__PURE__*/_react.default.createElement(_typography.default, _extends({
|
|
50
|
+
as: "li",
|
|
51
|
+
variant: parentListVariant,
|
|
52
|
+
m: "0 0 8px 16px"
|
|
53
|
+
}, props), children);
|
|
54
|
+
};
|
|
36
55
|
exports.ListItem = ListItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.ListContext = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
const ListContext = exports.ListContext = /*#__PURE__*/_react.default.createContext({});
|
|
10
|
+
var _default = exports.default = ListContext;
|
|
@@ -10,6 +10,20 @@ export declare const StyledTitle: import("styled-components").StyledComponent<"h
|
|
|
10
10
|
export declare const StyledAdornment: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
11
|
export declare const StyledTitleIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
|
|
12
12
|
export declare const StyledChevronIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../icon").IconProps & import("react").RefAttributes<HTMLSpanElement>>, any, {}, never>;
|
|
13
|
-
export declare const StyledVerticalMenu: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps
|
|
14
|
-
|
|
13
|
+
export declare const StyledVerticalMenu: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & {
|
|
14
|
+
cssProps?: {
|
|
15
|
+
color?: string | undefined;
|
|
16
|
+
opacity?: string | undefined;
|
|
17
|
+
height?: string | undefined;
|
|
18
|
+
width?: string | undefined;
|
|
19
|
+
} | undefined;
|
|
20
|
+
}, never>;
|
|
21
|
+
export declare const StyledVerticalMenuFullScreen: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & {
|
|
22
|
+
cssProps?: {
|
|
23
|
+
color?: string | undefined;
|
|
24
|
+
opacity?: string | undefined;
|
|
25
|
+
height?: string | undefined;
|
|
26
|
+
width?: string | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
}, never>;
|
|
15
29
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "144.
|
|
3
|
+
"version": "144.22.0",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
"scripts/check_rfcs/index.js"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"start": "node ./scripts/check_node_version.mjs && storybook dev -p 9001 -c .storybook",
|
|
13
|
-
"start:debug-theme": "node ./scripts/debug-storybook.js",
|
|
12
|
+
"start": "node ./scripts/check_node_version.mjs && dotenvx run -- storybook dev -p 9001 -c .storybook",
|
|
14
13
|
"test": "jest --config=./jest.config.ts",
|
|
15
14
|
"test-update": "jest --config=./jest.config.ts --updateSnapshot",
|
|
16
15
|
"format": "prettier --write './{src,playwright}/**/*.{js,jsx,ts,tsx}'",
|
|
@@ -21,8 +20,8 @@
|
|
|
21
20
|
"prepublishOnly": "npm run precompile",
|
|
22
21
|
"postinstall": "node ./scripts/check_rfcs/index.js",
|
|
23
22
|
"watch": "npm run clean-lib && npm run copy-files -- --watch & npm run babel -- --watch",
|
|
24
|
-
"build-storybook": "
|
|
25
|
-
"
|
|
23
|
+
"build-storybook": "dotenvx run -- storybook build -c .storybook",
|
|
24
|
+
"build-storybook:prod": "dotenvx run -f .env.production -- storybook build -c .storybook",
|
|
26
25
|
"start:static": "npx http-server -p 9001 ./storybook-static",
|
|
27
26
|
"clean-lib": "rimraf ./lib && rimraf ./esm",
|
|
28
27
|
"commit": "git-cz",
|
|
@@ -70,6 +69,7 @@
|
|
|
70
69
|
"@chromatic-com/storybook": "^2.0.2",
|
|
71
70
|
"@commitlint/cli": "^17.6.3",
|
|
72
71
|
"@commitlint/config-conventional": "^17.6.3",
|
|
72
|
+
"@dotenvx/dotenvx": "^1.25.1",
|
|
73
73
|
"@playwright/experimental-ct-react17": "~1.47.0",
|
|
74
74
|
"@playwright/test": "~1.47.0",
|
|
75
75
|
"@sage/design-tokens": "~4.29.0",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@storybook/addon-docs": "^8.3.3",
|
|
83
83
|
"@storybook/addon-toolbars": "^8.3.3",
|
|
84
84
|
"@storybook/addon-viewport": "^8.3.3",
|
|
85
|
-
"@storybook/addon-webpack5-compiler-
|
|
85
|
+
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
|
|
86
86
|
"@storybook/components": "^8.3.3",
|
|
87
87
|
"@storybook/manager-api": "^8.3.3",
|
|
88
88
|
"@storybook/preview-api": "^8.3.3",
|
|
@@ -126,7 +126,6 @@
|
|
|
126
126
|
"cz-conventional-changelog": "^3.3.0",
|
|
127
127
|
"date-fns-tz": "^1.3.8",
|
|
128
128
|
"dayjs": "^1.11.10",
|
|
129
|
-
"dotenv": "^16.4.5",
|
|
130
129
|
"draft-js": "^0.11.7",
|
|
131
130
|
"eslint": "^8.55.0",
|
|
132
131
|
"eslint-config-airbnb": "^19.0.0",
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
const { Octokit } = require("@octokit/rest");
|
|
3
|
-
const dotenv = require("dotenv");
|
|
4
3
|
const chalk = require("chalk");
|
|
5
4
|
const ci = require("ci-info");
|
|
6
5
|
|
|
7
|
-
dotenv.config();
|
|
8
6
|
const octokit = new Octokit({
|
|
9
7
|
baseUrl: "https://api.github.com",
|
|
10
8
|
});
|
|
@@ -46,7 +44,7 @@ const checkRfcs = async () => {
|
|
|
46
44
|
const header = chalk.bold.inverse.white(
|
|
47
45
|
" ".repeat(20),
|
|
48
46
|
"Open RFCs for carbon-react",
|
|
49
|
-
" ".repeat(20)
|
|
47
|
+
" ".repeat(20),
|
|
50
48
|
);
|
|
51
49
|
|
|
52
50
|
const rfcText = openRfcs
|
|
@@ -61,10 +59,10 @@ const checkRfcs = async () => {
|
|
|
61
59
|
const rfcLink =
|
|
62
60
|
"https://github.com/Sage/carbon/pulls?q=is%3Aopen+is%3Apr+label%3ARFC";
|
|
63
61
|
const message = `Failed to retrieve open RFCs for carbon-react. Go to ${chalk.cyan.italic(
|
|
64
|
-
rfcLink
|
|
62
|
+
rfcLink,
|
|
65
63
|
)} to view current RFCs.`;
|
|
66
64
|
console.log(
|
|
67
|
-
`${chalk.yellow.inverse(" WARN ")}\n${chalk.yellow(message)}\n
|
|
65
|
+
`${chalk.yellow.inverse(" WARN ")}\n${chalk.yellow(message)}\n`,
|
|
68
66
|
);
|
|
69
67
|
}
|
|
70
68
|
};
|