carbon-react 144.0.0 → 144.1.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/advanced-color-picker/advanced-color-picker.style.js +1 -5
- package/esm/components/dialog/dialog.component.js +29 -103
- package/esm/components/dialog/dialog.config.d.ts +0 -4
- package/esm/components/dialog/dialog.config.js +1 -5
- package/esm/components/dialog/dialog.style.d.ts +6 -14
- package/esm/components/dialog/dialog.style.js +54 -83
- package/esm/components/dialog-full-screen/content.style.js +32 -74
- package/esm/components/dialog-full-screen/dialog-full-screen.style.js +0 -5
- package/esm/components/form/form.component.js +8 -17
- package/esm/components/form/form.style.d.ts +10 -6
- package/esm/components/form/form.style.js +12 -25
- package/esm/components/sidebar/sidebar.component.js +8 -18
- package/esm/components/sidebar/sidebar.config.d.ts +0 -4
- package/esm/components/sidebar/sidebar.config.js +1 -5
- package/esm/components/sidebar/sidebar.style.d.ts +4 -2
- package/esm/components/sidebar/sidebar.style.js +26 -12
- package/esm/components/typography/typography.style.js +12 -8
- package/lib/components/advanced-color-picker/advanced-color-picker.style.js +0 -4
- package/lib/components/dialog/dialog.component.js +27 -101
- package/lib/components/dialog/dialog.config.d.ts +0 -4
- package/lib/components/dialog/dialog.config.js +2 -6
- package/lib/components/dialog/dialog.style.d.ts +6 -14
- package/lib/components/dialog/dialog.style.js +54 -83
- package/lib/components/dialog-full-screen/content.style.js +31 -73
- package/lib/components/dialog-full-screen/dialog-full-screen.style.js +0 -5
- package/lib/components/form/form.component.js +7 -16
- package/lib/components/form/form.style.d.ts +10 -6
- package/lib/components/form/form.style.js +12 -25
- package/lib/components/sidebar/sidebar.component.js +7 -17
- package/lib/components/sidebar/sidebar.config.d.ts +0 -4
- package/lib/components/sidebar/sidebar.config.js +2 -6
- package/lib/components/sidebar/sidebar.style.d.ts +4 -2
- package/lib/components/sidebar/sidebar.style.js +28 -15
- package/lib/components/typography/typography.style.js +12 -8
- package/package.json +1 -1
- package/esm/style/utils/form-style-utils.d.ts +0 -21
- package/esm/style/utils/form-style-utils.js +0 -92
- package/lib/style/utils/form-style-utils.d.ts +0 -21
- package/lib/style/utils/form-style-utils.js +0 -100
|
@@ -3,32 +3,23 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.StyledSidebarContent = exports.StyledSidebar = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
var _styledSystem = require("styled-system");
|
|
8
9
|
var _elementSizing = _interopRequireDefault(require("../../style/utils/element-sizing"));
|
|
9
10
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
10
11
|
var _iconButton = _interopRequireDefault(require("../icon-button/icon-button.style"));
|
|
11
|
-
var _formStyleUtils = require("../../style/utils/form-style-utils");
|
|
12
|
-
var _form = require("../form/form.style");
|
|
13
12
|
var _sidebar = require("./sidebar.config");
|
|
13
|
+
var _form = require("../form/form.style");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
15
|
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); }
|
|
16
16
|
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; }
|
|
17
|
-
const StyledSidebar = _styledComponents.default.div`
|
|
17
|
+
const StyledSidebar = exports.StyledSidebar = _styledComponents.default.div`
|
|
18
18
|
// prevents outline being added in safari
|
|
19
19
|
:focus {
|
|
20
20
|
outline: none;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
${_form.StyledFormContent} {
|
|
24
|
-
${props => (0, _formStyleUtils.calculateFormSpacingValues)(props, true, "sidebar")}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
${_form.StyledFormFooter}.sticky {
|
|
28
|
-
${_formStyleUtils.calculateWidthValue}
|
|
29
|
-
${props => (0, _formStyleUtils.calculateFormSpacingValues)(props, false, "sidebar")}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
23
|
${({
|
|
33
24
|
onCancel,
|
|
34
25
|
position,
|
|
@@ -67,7 +58,29 @@ const StyledSidebar = _styledComponents.default.div`
|
|
|
67
58
|
`}
|
|
68
59
|
`}
|
|
69
60
|
`;
|
|
61
|
+
const StyledSidebarContent = exports.StyledSidebarContent = _styledComponents.default.div`
|
|
62
|
+
box-sizing: border-box;
|
|
63
|
+
display: block;
|
|
64
|
+
overflow-y: auto;
|
|
65
|
+
flex-grow: 1;
|
|
66
|
+
|
|
67
|
+
padding: var(--spacing300) var(--spacing400) var(--spacing400);
|
|
68
|
+
${_styledSystem.padding}
|
|
69
|
+
|
|
70
|
+
&:has(${_form.StyledForm}.sticky) {
|
|
71
|
+
display: flex;
|
|
72
|
+
flex-direction: column;
|
|
73
|
+
overflow-y: hidden;
|
|
74
|
+
padding: 0;
|
|
75
|
+
|
|
76
|
+
${_form.StyledForm}.sticky {
|
|
77
|
+
${_form.StyledFormContent} {
|
|
78
|
+
padding: var(--spacing300) var(--spacing400) var(--spacing400);
|
|
79
|
+
${_styledSystem.padding}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
70
84
|
StyledSidebar.defaultProps = {
|
|
71
85
|
theme: _base.default
|
|
72
|
-
};
|
|
73
|
-
var _default = exports.default = StyledSidebar;
|
|
86
|
+
};
|
|
@@ -64,23 +64,27 @@ const getLineHeight = variant => {
|
|
|
64
64
|
case "h1-large":
|
|
65
65
|
return "40px";
|
|
66
66
|
case "h1":
|
|
67
|
-
|
|
68
|
-
return "31px";
|
|
67
|
+
return "30px";
|
|
69
68
|
case "h2":
|
|
70
|
-
return "
|
|
69
|
+
return "27.5px";
|
|
71
70
|
case "h3":
|
|
71
|
+
return "25px";
|
|
72
|
+
case "h4":
|
|
73
|
+
return "22.5px";
|
|
74
|
+
case "h5":
|
|
75
|
+
return "20px";
|
|
72
76
|
case "segment-header":
|
|
73
|
-
return "
|
|
77
|
+
return "25px";
|
|
78
|
+
case "segment-header-small":
|
|
79
|
+
return "22.5px";
|
|
80
|
+
case "segment-subheader":
|
|
81
|
+
return "24px";
|
|
74
82
|
case "big":
|
|
75
83
|
return "24px";
|
|
76
|
-
case "h4":
|
|
77
|
-
case "segment-header-small":
|
|
78
|
-
return "23px";
|
|
79
84
|
case "small":
|
|
80
85
|
case "sub":
|
|
81
86
|
case "sup":
|
|
82
87
|
return "20px";
|
|
83
|
-
case "h5":
|
|
84
88
|
case "segment-subheader-alt":
|
|
85
89
|
case "p":
|
|
86
90
|
case "span":
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { PaddingProps } from "styled-system";
|
|
2
|
-
declare type ContainerComponent = "dialog" | "sidebar";
|
|
3
|
-
export declare const calculateWidthValue: (props: PaddingProps) => string;
|
|
4
|
-
export declare const calculateFormSpacingValues: (props: PaddingProps, isFormContent: boolean, containerComponent?: ContainerComponent) => {
|
|
5
|
-
"margin-top": string;
|
|
6
|
-
"padding-top": string;
|
|
7
|
-
"padding-bottom": string | undefined;
|
|
8
|
-
"padding-left": string;
|
|
9
|
-
"padding-right": string;
|
|
10
|
-
"margin-left": string;
|
|
11
|
-
"margin-right": string;
|
|
12
|
-
} | {
|
|
13
|
-
":not(.padded)"?: {
|
|
14
|
-
"padding-left": string;
|
|
15
|
-
"padding-right": string;
|
|
16
|
-
} | undefined;
|
|
17
|
-
"margin-bottom": string;
|
|
18
|
-
"margin-left": string;
|
|
19
|
-
"margin-right": string;
|
|
20
|
-
};
|
|
21
|
-
export {};
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { padding as paddingFn } from "styled-system";
|
|
2
|
-
import { HORIZONTAL_PADDING, CONTENT_TOP_PADDING, CONTENT_BOTTOM_PADDING } from "../../components/dialog/dialog.config";
|
|
3
|
-
import { SIDEBAR_TOP_SPACING, SIDEBAR_BOTTOM_SPACING, SIDEBAR_LEFT_PADDING, SIDEBAR_RIGHT_PADDING } from "../../components/sidebar/sidebar.config";
|
|
4
|
-
const parsePadding = paddingString => {
|
|
5
|
-
const paddingValues = paddingString.split(/\s+/);
|
|
6
|
-
let paddingTop, paddingBottom, paddingLeft, paddingRight;
|
|
7
|
-
switch (paddingValues.length) {
|
|
8
|
-
case 1:
|
|
9
|
-
{
|
|
10
|
-
const [value] = paddingValues;
|
|
11
|
-
[paddingTop, paddingRight, paddingBottom, paddingLeft] = [value, value, value, value];
|
|
12
|
-
break;
|
|
13
|
-
}
|
|
14
|
-
case 2:
|
|
15
|
-
{
|
|
16
|
-
const [vertical, horizontal] = paddingValues;
|
|
17
|
-
[paddingTop, paddingRight, paddingBottom, paddingLeft] = [vertical, horizontal, vertical, horizontal];
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
case 3:
|
|
21
|
-
{
|
|
22
|
-
const [top, horizontal, bottom] = paddingValues;
|
|
23
|
-
[paddingTop, paddingRight, paddingBottom, paddingLeft] = [top, horizontal, bottom, horizontal];
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
case 4:
|
|
27
|
-
{
|
|
28
|
-
[paddingTop, paddingRight, paddingBottom, paddingLeft] = paddingValues;
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
/* istanbul ignore next */
|
|
32
|
-
default:
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
paddingTop,
|
|
37
|
-
paddingBottom,
|
|
38
|
-
paddingLeft,
|
|
39
|
-
paddingRight
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
const calculatePadding = props => {
|
|
43
|
-
const {
|
|
44
|
-
padding,
|
|
45
|
-
...individualPaddingProperties
|
|
46
|
-
} = paddingFn(props);
|
|
47
|
-
const result = padding ? parsePadding(padding) : {};
|
|
48
|
-
Object.assign(result, individualPaddingProperties);
|
|
49
|
-
return result;
|
|
50
|
-
};
|
|
51
|
-
export const calculateWidthValue = props => {
|
|
52
|
-
const {
|
|
53
|
-
paddingLeft,
|
|
54
|
-
paddingRight
|
|
55
|
-
} = calculatePadding(props);
|
|
56
|
-
const paddingValue = `(${paddingLeft ?? `${HORIZONTAL_PADDING}px`} + ${paddingRight ?? `${HORIZONTAL_PADDING}px`})`;
|
|
57
|
-
return `width: calc(100% + ${paddingValue});`;
|
|
58
|
-
};
|
|
59
|
-
export const calculateFormSpacingValues = (props, isFormContent, containerComponent = "dialog") => {
|
|
60
|
-
const {
|
|
61
|
-
paddingTop,
|
|
62
|
-
paddingBottom,
|
|
63
|
-
paddingLeft,
|
|
64
|
-
paddingRight
|
|
65
|
-
} = calculatePadding(props);
|
|
66
|
-
const isSidebar = containerComponent === "sidebar";
|
|
67
|
-
const spacingTopValue = paddingTop ?? (isSidebar ? SIDEBAR_TOP_SPACING : `${CONTENT_TOP_PADDING}px`);
|
|
68
|
-
const spacingRightValue = paddingRight ?? `${HORIZONTAL_PADDING}px`;
|
|
69
|
-
const spacingBottomValue = paddingBottom ?? (isSidebar ? SIDEBAR_BOTTOM_SPACING : `${CONTENT_BOTTOM_PADDING}px`);
|
|
70
|
-
const spacingLeftValue = paddingLeft ?? `${HORIZONTAL_PADDING}px`;
|
|
71
|
-
const setNegativeValue = value => `calc(-1 * ${value})`;
|
|
72
|
-
return {
|
|
73
|
-
"margin-left": setNegativeValue(spacingLeftValue),
|
|
74
|
-
"margin-right": setNegativeValue(spacingRightValue),
|
|
75
|
-
...(isFormContent ? {
|
|
76
|
-
"margin-top": setNegativeValue(spacingTopValue),
|
|
77
|
-
"padding-top": spacingTopValue,
|
|
78
|
-
"padding-bottom": isSidebar ? undefined : spacingBottomValue,
|
|
79
|
-
"padding-left": spacingLeftValue,
|
|
80
|
-
"padding-right": spacingRightValue
|
|
81
|
-
} : {
|
|
82
|
-
"margin-bottom": setNegativeValue(spacingBottomValue),
|
|
83
|
-
...(isSidebar && {
|
|
84
|
-
// if footer already has custom padding do not set
|
|
85
|
-
":not(.padded)": {
|
|
86
|
-
"padding-left": SIDEBAR_LEFT_PADDING,
|
|
87
|
-
"padding-right": SIDEBAR_RIGHT_PADDING
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
})
|
|
91
|
-
};
|
|
92
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { PaddingProps } from "styled-system";
|
|
2
|
-
declare type ContainerComponent = "dialog" | "sidebar";
|
|
3
|
-
export declare const calculateWidthValue: (props: PaddingProps) => string;
|
|
4
|
-
export declare const calculateFormSpacingValues: (props: PaddingProps, isFormContent: boolean, containerComponent?: ContainerComponent) => {
|
|
5
|
-
"margin-top": string;
|
|
6
|
-
"padding-top": string;
|
|
7
|
-
"padding-bottom": string | undefined;
|
|
8
|
-
"padding-left": string;
|
|
9
|
-
"padding-right": string;
|
|
10
|
-
"margin-left": string;
|
|
11
|
-
"margin-right": string;
|
|
12
|
-
} | {
|
|
13
|
-
":not(.padded)"?: {
|
|
14
|
-
"padding-left": string;
|
|
15
|
-
"padding-right": string;
|
|
16
|
-
} | undefined;
|
|
17
|
-
"margin-bottom": string;
|
|
18
|
-
"margin-left": string;
|
|
19
|
-
"margin-right": string;
|
|
20
|
-
};
|
|
21
|
-
export {};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.calculateWidthValue = exports.calculateFormSpacingValues = void 0;
|
|
7
|
-
var _styledSystem = require("styled-system");
|
|
8
|
-
var _dialog = require("../../components/dialog/dialog.config");
|
|
9
|
-
var _sidebar = require("../../components/sidebar/sidebar.config");
|
|
10
|
-
const parsePadding = paddingString => {
|
|
11
|
-
const paddingValues = paddingString.split(/\s+/);
|
|
12
|
-
let paddingTop, paddingBottom, paddingLeft, paddingRight;
|
|
13
|
-
switch (paddingValues.length) {
|
|
14
|
-
case 1:
|
|
15
|
-
{
|
|
16
|
-
const [value] = paddingValues;
|
|
17
|
-
[paddingTop, paddingRight, paddingBottom, paddingLeft] = [value, value, value, value];
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
case 2:
|
|
21
|
-
{
|
|
22
|
-
const [vertical, horizontal] = paddingValues;
|
|
23
|
-
[paddingTop, paddingRight, paddingBottom, paddingLeft] = [vertical, horizontal, vertical, horizontal];
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
case 3:
|
|
27
|
-
{
|
|
28
|
-
const [top, horizontal, bottom] = paddingValues;
|
|
29
|
-
[paddingTop, paddingRight, paddingBottom, paddingLeft] = [top, horizontal, bottom, horizontal];
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
case 4:
|
|
33
|
-
{
|
|
34
|
-
[paddingTop, paddingRight, paddingBottom, paddingLeft] = paddingValues;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
/* istanbul ignore next */
|
|
38
|
-
default:
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
paddingTop,
|
|
43
|
-
paddingBottom,
|
|
44
|
-
paddingLeft,
|
|
45
|
-
paddingRight
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
const calculatePadding = props => {
|
|
49
|
-
const {
|
|
50
|
-
padding,
|
|
51
|
-
...individualPaddingProperties
|
|
52
|
-
} = (0, _styledSystem.padding)(props);
|
|
53
|
-
const result = padding ? parsePadding(padding) : {};
|
|
54
|
-
Object.assign(result, individualPaddingProperties);
|
|
55
|
-
return result;
|
|
56
|
-
};
|
|
57
|
-
const calculateWidthValue = props => {
|
|
58
|
-
const {
|
|
59
|
-
paddingLeft,
|
|
60
|
-
paddingRight
|
|
61
|
-
} = calculatePadding(props);
|
|
62
|
-
const paddingValue = `(${paddingLeft ?? `${_dialog.HORIZONTAL_PADDING}px`} + ${paddingRight ?? `${_dialog.HORIZONTAL_PADDING}px`})`;
|
|
63
|
-
return `width: calc(100% + ${paddingValue});`;
|
|
64
|
-
};
|
|
65
|
-
exports.calculateWidthValue = calculateWidthValue;
|
|
66
|
-
const calculateFormSpacingValues = (props, isFormContent, containerComponent = "dialog") => {
|
|
67
|
-
const {
|
|
68
|
-
paddingTop,
|
|
69
|
-
paddingBottom,
|
|
70
|
-
paddingLeft,
|
|
71
|
-
paddingRight
|
|
72
|
-
} = calculatePadding(props);
|
|
73
|
-
const isSidebar = containerComponent === "sidebar";
|
|
74
|
-
const spacingTopValue = paddingTop ?? (isSidebar ? _sidebar.SIDEBAR_TOP_SPACING : `${_dialog.CONTENT_TOP_PADDING}px`);
|
|
75
|
-
const spacingRightValue = paddingRight ?? `${_dialog.HORIZONTAL_PADDING}px`;
|
|
76
|
-
const spacingBottomValue = paddingBottom ?? (isSidebar ? _sidebar.SIDEBAR_BOTTOM_SPACING : `${_dialog.CONTENT_BOTTOM_PADDING}px`);
|
|
77
|
-
const spacingLeftValue = paddingLeft ?? `${_dialog.HORIZONTAL_PADDING}px`;
|
|
78
|
-
const setNegativeValue = value => `calc(-1 * ${value})`;
|
|
79
|
-
return {
|
|
80
|
-
"margin-left": setNegativeValue(spacingLeftValue),
|
|
81
|
-
"margin-right": setNegativeValue(spacingRightValue),
|
|
82
|
-
...(isFormContent ? {
|
|
83
|
-
"margin-top": setNegativeValue(spacingTopValue),
|
|
84
|
-
"padding-top": spacingTopValue,
|
|
85
|
-
"padding-bottom": isSidebar ? undefined : spacingBottomValue,
|
|
86
|
-
"padding-left": spacingLeftValue,
|
|
87
|
-
"padding-right": spacingRightValue
|
|
88
|
-
} : {
|
|
89
|
-
"margin-bottom": setNegativeValue(spacingBottomValue),
|
|
90
|
-
...(isSidebar && {
|
|
91
|
-
// if footer already has custom padding do not set
|
|
92
|
-
":not(.padded)": {
|
|
93
|
-
"padding-left": _sidebar.SIDEBAR_LEFT_PADDING,
|
|
94
|
-
"padding-right": _sidebar.SIDEBAR_RIGHT_PADDING
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
})
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
exports.calculateFormSpacingValues = calculateFormSpacingValues;
|