carbon-react 119.12.1 → 120.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__/input/input-presentation.style.d.ts +1 -1
- package/esm/__spec_helper__/test-utils.d.ts +3 -2
- package/esm/__spec_helper__/test-utils.js +15 -1
- package/esm/components/box/box.component.d.ts +23 -6
- package/esm/components/box/box.component.js +3570 -103
- package/esm/components/box/box.style.d.ts +3 -0
- package/esm/components/box/box.style.js +112 -0
- package/esm/components/dismissible-box/dismissible-box.style.d.ts +2 -1
- package/esm/components/drawer/drawer.style.d.ts +2 -1
- package/esm/components/duelling-picklist/picklist/picklist.style.js +4 -2
- package/esm/components/flat-table/flat-table.style.js +2 -2
- package/esm/components/heading/heading.style.d.ts +4 -9
- package/esm/components/menu/menu-full-screen/menu-full-screen.style.js +2 -2
- package/esm/components/menu/scrollable-block/scrollable-block.style.js +2 -2
- package/esm/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.js +1 -1
- package/esm/components/typography/typography.component.d.ts +25 -15
- package/esm/components/typography/typography.component.js +37 -184
- package/esm/components/typography/typography.style.d.ts +12 -0
- package/esm/components/typography/typography.style.js +190 -0
- package/esm/components/vertical-menu/vertical-menu.style.js +3 -3
- package/esm/style/utils/filter-styled-system-flexbox-props.d.ts +3 -0
- package/esm/style/utils/filter-styled-system-flexbox-props.js +5 -0
- package/esm/style/utils/filter-styled-system-grid-props.d.ts +3 -0
- package/esm/style/utils/filter-styled-system-grid-props.js +5 -0
- package/esm/style/utils/filter-styled-system-layout-props.d.ts +3 -0
- package/esm/style/utils/filter-styled-system-layout-props.js +5 -0
- package/esm/style/utils/index.d.ts +4 -1
- package/esm/style/utils/index.js +4 -1
- package/lib/__internal__/input/input-presentation.style.d.ts +1 -1
- package/lib/__spec_helper__/test-utils.d.ts +3 -2
- package/lib/__spec_helper__/test-utils.js +16 -1
- package/lib/components/box/box.component.d.ts +23 -6
- package/lib/components/box/box.component.js +3569 -105
- package/lib/components/box/box.style.d.ts +3 -0
- package/lib/components/box/box.style.js +122 -0
- package/lib/components/dismissible-box/dismissible-box.style.d.ts +2 -1
- package/lib/components/drawer/drawer.style.d.ts +2 -1
- package/lib/components/duelling-picklist/picklist/picklist.style.js +2 -1
- package/lib/components/flat-table/flat-table.style.js +1 -1
- package/lib/components/heading/heading.style.d.ts +4 -9
- package/lib/components/menu/menu-full-screen/menu-full-screen.style.js +1 -1
- package/lib/components/menu/scrollable-block/scrollable-block.style.js +1 -1
- package/lib/components/text-editor/__internal__/toolbar/toolbar-button/toolbar-button.style.js +1 -1
- package/lib/components/typography/typography.component.d.ts +25 -15
- package/lib/components/typography/typography.component.js +39 -187
- package/lib/components/typography/typography.style.d.ts +12 -0
- package/lib/components/typography/typography.style.js +200 -0
- package/lib/components/vertical-menu/vertical-menu.style.js +1 -1
- package/lib/style/utils/filter-styled-system-flexbox-props.d.ts +3 -0
- package/lib/style/utils/filter-styled-system-flexbox-props.js +14 -0
- package/lib/style/utils/filter-styled-system-grid-props.d.ts +3 -0
- package/lib/style/utils/filter-styled-system-grid-props.js +14 -0
- package/lib/style/utils/filter-styled-system-layout-props.d.ts +3 -0
- package/lib/style/utils/filter-styled-system-layout-props.js +14 -0
- package/lib/style/utils/index.d.ts +4 -1
- package/lib/style/utils/index.js +21 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommonInputPresentationProps } from "./input-presentation.component";
|
|
2
2
|
import { InputContextProps } from "../input-behaviour";
|
|
3
3
|
import { CarbonProviderProps } from "../../components/carbon-provider";
|
|
4
|
-
export declare const StyledInputPresentationContainer: import("styled-components").StyledComponent<"div", any, Pick<CommonInputPresentationProps, "
|
|
4
|
+
export declare const StyledInputPresentationContainer: import("styled-components").StyledComponent<"div", any, Pick<CommonInputPresentationProps, "maxWidth" | "inputWidth">, never>;
|
|
5
5
|
declare const InputPresentationStyle: import("styled-components").StyledComponent<"div", any, Pick<InputContextProps, "hasFocus"> & Pick<CommonInputPresentationProps, "disabled" | "error" | "info" | "warning" | "prefix" | "align" | "readOnly" | "size" | "hasIcon"> & Pick<CarbonProviderProps, "validationRedesignOptIn">, never>;
|
|
6
6
|
export default InputPresentationStyle;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ReactWrapper, ShallowWrapper } from "enzyme";
|
|
3
|
-
import { LayoutProps, FlexboxProps, BackgroundProps, PositionProps } from "styled-system";
|
|
3
|
+
import { LayoutProps, FlexboxProps, BackgroundProps, PositionProps, GridProps } from "styled-system";
|
|
4
4
|
import { ReactTestRendererJSON } from "react-test-renderer";
|
|
5
5
|
import { mockMatchMedia } from "./mock-match-media";
|
|
6
6
|
declare const toCSSCase: (str: string) => string;
|
|
@@ -46,7 +46,8 @@ declare const testStyledSystemWidth: (component: (widthProperties?: {
|
|
|
46
46
|
}) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
47
47
|
declare const testStyledSystemLayout: (component: (layoutProperties?: LayoutProps) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
48
48
|
declare const testStyledSystemFlexBox: (component: (flexboxProperties?: FlexboxProps) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
49
|
+
declare const testStyledSystemGrid: (component: (gridProperties?: GridProps) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
49
50
|
declare const testStyledSystemBackground: (component: (backgroundProperties?: BackgroundProps) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
50
51
|
declare const testStyledSystemPosition: (component: (positionProperties?: PositionProps) => JSX.Element, styleContainer?: ((wrapper: ReactWrapper) => ReactWrapper) | undefined) => void;
|
|
51
52
|
declare const expectConsoleOutput: (message: string, type?: "warn" | "error") => () => void;
|
|
52
|
-
export { assertStyleMatch, toCSSCase, hoverList, selectedItemOf, childrenFrom, makeArrayKeys, keyboard, assertKeyboardTraversal, assertHoverTraversal, listFrom, click, simulate, carbonThemesJestTable, mockMatchMedia, testStyledSystemSpacing, testStyledSystemMargin, testStyledSystemPadding, testStyledSystemColor, testStyledSystemWidth, testStyledSystemLayout, testStyledSystemFlexBox, testStyledSystemBackground, testStyledSystemPosition, expectConsoleOutput, };
|
|
53
|
+
export { assertStyleMatch, toCSSCase, hoverList, selectedItemOf, childrenFrom, makeArrayKeys, keyboard, assertKeyboardTraversal, assertHoverTraversal, listFrom, click, simulate, carbonThemesJestTable, mockMatchMedia, testStyledSystemSpacing, testStyledSystemMargin, testStyledSystemPadding, testStyledSystemColor, testStyledSystemWidth, testStyledSystemLayout, testStyledSystemFlexBox, testStyledSystemGrid, testStyledSystemBackground, testStyledSystemPosition, expectConsoleOutput, };
|
|
@@ -85,6 +85,7 @@ const colorProps = [["color", "color", "#CCCCCC"], ["bg", "background-color", "#
|
|
|
85
85
|
const widthProps = ["width", "width", "200px"];
|
|
86
86
|
const layoutProps = [widthProps, ["height", "height", "200px"], ["minWidth", "min-width", "120px"], ["maxWidth", "max-width", "120px"], ["minHeight", "min-height", "120px"], ["maxHeight", "max-height", "120px"], ["size", "width", "120px"], ["size", "height", "120px"], ["display", "display", "inline-block"], ["verticalAlign", "vertical-align", "baseline"], ["overflow", "overflow", "hidden"], ["overflowX", "overflow-x", "hidden"], ["overflowY", "overflow-y", "hidden"]];
|
|
87
87
|
const flexBoxProps = [["alignItems", "alignItems", "center"], ["alignContent", "alignContent", "center"], ["justifyItems", "justifyItems", "center"], ["justifyContent", "justifyContent", "center"], ["flexWrap", "flexWrap", "wrap"], ["flexDirection", "flexDirection", "row-reverse"], ["flex", "flex", "1"], ["flexGrow", "flexGrow", "1"], ["flexShrink", "flexShrink", "1"], ["flexBasis", "flexBasis", "100px"], ["justifySelf", "justifySelf", "center"], ["alignSelf", "alignSelf", "center"], ["order", "order", "1"]];
|
|
88
|
+
const gridProps = [["gridColumn", "gridColumn", "1 / span 2"], ["gridRow", "gridRow", "1 / span 2"], ["gridArea", "gridArea", "myArea"], ["gridAutoFlow", "gridAutoFlow", "column"], ["gridAutoRows", "gridAutoRows", "150px"], ["gridAutoColumns", "gridAutoColumns", "50px"], ["gridTemplateRows", "gridTemplateRows", "100px 300px"], ["gridTemplateColumns", "gridTemplateColumns", "auto auto auto auto"], ["gridTemplateAreas", "gridTemplateAreas", "myArea myArea . . ."]];
|
|
88
89
|
const backgroundProps = [["background", "background", "lightblue url('foo.jpg') no-repeat fixed center"], ["backgroundImage", "background-image", "url(foo.jpg)"], ["backgroundSize", "background-size", "center"], ["backgroundRepeat", "background-repeat", "no-repeat"]];
|
|
89
90
|
const positionProps = [["top", "0px"], ["bottom", "0px"], ["right", "0px"], ["left", "0px"], ["position", "fixed"], ["position", "sticky"], ["position", "absolute"], ["position", "static"], ["position", "relative"]];
|
|
90
91
|
export const getDefaultValue = value => {
|
|
@@ -260,6 +261,19 @@ const testStyledSystemFlexBox = (component, styleContainer) => {
|
|
|
260
261
|
});
|
|
261
262
|
});
|
|
262
263
|
};
|
|
264
|
+
const testStyledSystemGrid = (component, styleContainer) => {
|
|
265
|
+
describe.each(gridProps)('when a prop is specified using the "%s" styled system props', (styledSystemProp, propName, value) => {
|
|
266
|
+
it(`then ${propName} should have been set correctly`, () => {
|
|
267
|
+
const props = {
|
|
268
|
+
[styledSystemProp]: value
|
|
269
|
+
};
|
|
270
|
+
const wrapper = mount(component(props));
|
|
271
|
+
assertStyleMatch({
|
|
272
|
+
[propName]: value
|
|
273
|
+
}, styleContainer ? styleContainer(wrapper) : wrapper);
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
};
|
|
263
277
|
const testStyledSystemBackground = (component, styleContainer) => {
|
|
264
278
|
describe.each(backgroundProps)('when a prop is specified using the "%s" styled system props', (styledSystemProp, propName, value) => {
|
|
265
279
|
it(`then ${propName} should have been set correctly`, () => {
|
|
@@ -317,4 +331,4 @@ const expectConsoleOutput = (message, type = "error") => {
|
|
|
317
331
|
global.console[type] = consoleType;
|
|
318
332
|
};
|
|
319
333
|
};
|
|
320
|
-
export { assertStyleMatch, toCSSCase, hoverList, selectedItemOf, childrenFrom, makeArrayKeys, keyboard, assertKeyboardTraversal, assertHoverTraversal, listFrom, click, simulate, carbonThemesJestTable, mockMatchMedia, testStyledSystemSpacing, testStyledSystemMargin, testStyledSystemPadding, testStyledSystemColor, testStyledSystemWidth, testStyledSystemLayout, testStyledSystemFlexBox, testStyledSystemBackground, testStyledSystemPosition, expectConsoleOutput };
|
|
334
|
+
export { assertStyleMatch, toCSSCase, hoverList, selectedItemOf, childrenFrom, makeArrayKeys, keyboard, assertKeyboardTraversal, assertHoverTraversal, listFrom, click, simulate, carbonThemesJestTable, mockMatchMedia, testStyledSystemSpacing, testStyledSystemMargin, testStyledSystemPadding, testStyledSystemColor, testStyledSystemWidth, testStyledSystemLayout, testStyledSystemFlexBox, testStyledSystemGrid, testStyledSystemBackground, testStyledSystemPosition, expectConsoleOutput };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { SpaceProps, LayoutProps, FlexboxProps,
|
|
2
|
+
import { SpaceProps, LayoutProps, FlexboxProps, PositionProps, GridProps } from "styled-system";
|
|
3
3
|
import * as DesignTokens from "@sage/design-tokens/js/base/common";
|
|
4
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags";
|
|
4
5
|
declare const GAP_VALUES: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
|
5
6
|
export declare type OverflowWrap = "break-word" | "anywhere";
|
|
6
7
|
export declare type ScrollVariant = "light" | "dark";
|
|
@@ -10,16 +11,22 @@ export declare type Gap = AllowedNumericalValues | string;
|
|
|
10
11
|
declare type DesignTokensType = keyof typeof DesignTokens;
|
|
11
12
|
declare type BoxShadowsType = Extract<DesignTokensType, `boxShadow${string}`>;
|
|
12
13
|
declare type BorderRadiusType = Extract<DesignTokensType, `borderRadius${string}`>;
|
|
13
|
-
export interface BoxProps extends SpaceProps, LayoutProps, FlexboxProps,
|
|
14
|
+
export interface BoxProps extends SpaceProps, LayoutProps, FlexboxProps, Omit<GridProps, "gridGap" | "gridRowGap" | "gridColumnGap">, TagProps, Omit<PositionProps, "zIndex"> {
|
|
14
15
|
as?: keyof JSX.IntrinsicElements | React.ComponentType<any>;
|
|
16
|
+
/** Set the ID attribute of the Box component */
|
|
17
|
+
id?: string;
|
|
18
|
+
/** Content to be rendered inside the Box component */
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
/** Set the Role attribute of the Box component */
|
|
21
|
+
role?: string;
|
|
15
22
|
/** String to set Box content break strategy. Note "anywhere" is not supported in Safari */
|
|
16
23
|
overflowWrap?: OverflowWrap;
|
|
17
|
-
/**
|
|
24
|
+
/** Scroll styling attribute */
|
|
18
25
|
scrollVariant?: ScrollVariant;
|
|
19
|
-
/**
|
|
26
|
+
/** Set the box-sizing attribute of the Box component */
|
|
20
27
|
boxSizing?: BoxSizing;
|
|
21
28
|
/** Allows a tabindex to be specified */
|
|
22
|
-
tabIndex?: number
|
|
29
|
+
tabIndex?: number;
|
|
23
30
|
/** Gap, an integer multiplier of the base spacing constant (8px) or any valid CSS string." */
|
|
24
31
|
gap?: Gap;
|
|
25
32
|
/** Column gap, an integer multiplier of the base spacing constant (8px) or any valid CSS string." */
|
|
@@ -30,6 +37,16 @@ export interface BoxProps extends SpaceProps, LayoutProps, FlexboxProps, ColorPr
|
|
|
30
37
|
boxShadow?: BoxShadowsType;
|
|
31
38
|
/** Design Token for Border Radius. Note: please check that the border radius design token you are using is compatible with the Box component. **This prop will not do anything if you have the roundedCornerOptOut flag set in the CarbonProvider** */
|
|
32
39
|
borderRadius?: BorderRadiusType;
|
|
40
|
+
/** @private @ignore */
|
|
41
|
+
className?: string;
|
|
42
|
+
/** Set the color attribute of the Box component */
|
|
43
|
+
color?: string;
|
|
44
|
+
/** Set the bg attribute of the Box component */
|
|
45
|
+
bg?: string;
|
|
46
|
+
/** Set the backgroundColor attribute of the Box component */
|
|
47
|
+
backgroundColor?: string;
|
|
48
|
+
/** Set the opacity attribute of the Box component */
|
|
49
|
+
opacity?: string | number;
|
|
33
50
|
}
|
|
34
|
-
export declare const Box:
|
|
51
|
+
export declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
35
52
|
export default Box;
|