carbon-react 126.2.1 → 126.3.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/loader/loader-square.style.d.ts +2 -0
- package/esm/components/loader/loader-square.style.js +3 -2
- package/esm/components/loader/loader.component.d.ts +4 -2
- package/esm/components/loader/loader.component.js +13 -13
- package/lib/components/loader/loader-square.style.d.ts +2 -0
- package/lib/components/loader/loader-square.style.js +3 -2
- package/lib/components/loader/loader.component.d.ts +4 -2
- package/lib/components/loader/loader.component.js +13 -13
- package/package.json +1 -1
|
@@ -5,6 +5,8 @@ export interface StyledLoaderSquareProps {
|
|
|
5
5
|
isInsideButton?: boolean;
|
|
6
6
|
/** Applies slate color. Available only when isInsideButton is true. */
|
|
7
7
|
isActive?: boolean;
|
|
8
|
+
/** The background color of each loader square */
|
|
9
|
+
backgroundColor?: string;
|
|
8
10
|
}
|
|
9
11
|
declare const StyledLoaderSquare: import("styled-components").StyledComponent<"div", any, StyledLoaderSquareProps, never>;
|
|
10
12
|
export default StyledLoaderSquare;
|
|
@@ -38,10 +38,11 @@ const StyledLoaderSquare = styled.div`
|
|
|
38
38
|
size,
|
|
39
39
|
isInsideButton,
|
|
40
40
|
isActive,
|
|
41
|
-
theme
|
|
41
|
+
theme,
|
|
42
|
+
backgroundColor
|
|
42
43
|
}) => css`
|
|
43
44
|
animation: ${loaderAnimation} 1s infinite ease-in-out both;
|
|
44
|
-
background-color:
|
|
45
|
+
background-color: ${backgroundColor};
|
|
45
46
|
display: inline-block;
|
|
46
47
|
${getDimentions(size, theme.roundedCornersOptOut)}
|
|
47
48
|
|
|
@@ -2,9 +2,11 @@ import React from "react";
|
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
3
|
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
4
4
|
import { StyledLoaderSquareProps } from "./loader-square.style";
|
|
5
|
-
export interface LoaderProps extends StyledLoaderSquareProps, MarginProps, TagProps {
|
|
5
|
+
export interface LoaderProps extends Omit<StyledLoaderSquareProps, "backgroundColor">, MarginProps, TagProps {
|
|
6
|
+
/** Toggle between the default variant and gradient variant */
|
|
7
|
+
variant?: string;
|
|
6
8
|
/** Specify a custom accessible name for the Loader component */
|
|
7
9
|
"aria-label"?: string;
|
|
8
10
|
}
|
|
9
|
-
export declare const Loader: ({ "aria-label": ariaLabel, size, isInsideButton, isActive, ...rest }: LoaderProps) => React.JSX.Element;
|
|
11
|
+
export declare const Loader: ({ variant, "aria-label": ariaLabel, size, isInsideButton, isActive, ...rest }: LoaderProps) => React.JSX.Element;
|
|
10
12
|
export default Loader;
|
|
@@ -8,6 +8,7 @@ import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
|
8
8
|
import StyledLoader from "./loader.style";
|
|
9
9
|
import StyledLoaderSquare from "./loader-square.style";
|
|
10
10
|
export const Loader = ({
|
|
11
|
+
variant = "default",
|
|
11
12
|
"aria-label": ariaLabel,
|
|
12
13
|
size = "medium",
|
|
13
14
|
isInsideButton,
|
|
@@ -16,21 +17,20 @@ export const Loader = ({
|
|
|
16
17
|
}) => {
|
|
17
18
|
const l = useLocale();
|
|
18
19
|
const reduceMotion = !useMediaQuery("screen and (prefers-reduced-motion: no-preference)");
|
|
20
|
+
const loaderSquareProps = {
|
|
21
|
+
isInsideButton,
|
|
22
|
+
isActive,
|
|
23
|
+
size,
|
|
24
|
+
variant
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// FE-6368 has been raised for the below, changed hex values for design tokens (when added)
|
|
19
28
|
return /*#__PURE__*/React.createElement(StyledLoader, _extends({
|
|
20
29
|
"aria-label": ariaLabel || l.loader.loading(),
|
|
21
30
|
role: "progressbar"
|
|
22
|
-
}, tagComponent("loader", rest), filterStyledSystemMarginProps(rest)), reduceMotion ? l.loader.loading() : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledLoaderSquare, {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}), /*#__PURE__*/React.createElement(StyledLoaderSquare, {
|
|
27
|
-
isInsideButton: isInsideButton,
|
|
28
|
-
isActive: isActive,
|
|
29
|
-
size: size
|
|
30
|
-
}), /*#__PURE__*/React.createElement(StyledLoaderSquare, {
|
|
31
|
-
isInsideButton: isInsideButton,
|
|
32
|
-
isActive: isActive,
|
|
33
|
-
size: size
|
|
34
|
-
})));
|
|
31
|
+
}, tagComponent("loader", rest), filterStyledSystemMarginProps(rest)), reduceMotion ? l.loader.loading() : /*#__PURE__*/React.createElement(React.Fragment, null, ["#13A038", "#0092DB", "#8F49FE"].map(color => /*#__PURE__*/React.createElement(StyledLoaderSquare, _extends({
|
|
32
|
+
key: color,
|
|
33
|
+
backgroundColor: variant === "gradient" ? color : "var(--colorsActionMajor500)"
|
|
34
|
+
}, loaderSquareProps)))));
|
|
35
35
|
};
|
|
36
36
|
export default Loader;
|
|
@@ -5,6 +5,8 @@ export interface StyledLoaderSquareProps {
|
|
|
5
5
|
isInsideButton?: boolean;
|
|
6
6
|
/** Applies slate color. Available only when isInsideButton is true. */
|
|
7
7
|
isActive?: boolean;
|
|
8
|
+
/** The background color of each loader square */
|
|
9
|
+
backgroundColor?: string;
|
|
8
10
|
}
|
|
9
11
|
declare const StyledLoaderSquare: import("styled-components").StyledComponent<"div", any, StyledLoaderSquareProps, never>;
|
|
10
12
|
export default StyledLoaderSquare;
|
|
@@ -47,10 +47,11 @@ const StyledLoaderSquare = _styledComponents.default.div`
|
|
|
47
47
|
size,
|
|
48
48
|
isInsideButton,
|
|
49
49
|
isActive,
|
|
50
|
-
theme
|
|
50
|
+
theme,
|
|
51
|
+
backgroundColor
|
|
51
52
|
}) => (0, _styledComponents.css)`
|
|
52
53
|
animation: ${loaderAnimation} 1s infinite ease-in-out both;
|
|
53
|
-
background-color:
|
|
54
|
+
background-color: ${backgroundColor};
|
|
54
55
|
display: inline-block;
|
|
55
56
|
${getDimentions(size, theme.roundedCornersOptOut)}
|
|
56
57
|
|
|
@@ -2,9 +2,11 @@ import React from "react";
|
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
3
|
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
4
4
|
import { StyledLoaderSquareProps } from "./loader-square.style";
|
|
5
|
-
export interface LoaderProps extends StyledLoaderSquareProps, MarginProps, TagProps {
|
|
5
|
+
export interface LoaderProps extends Omit<StyledLoaderSquareProps, "backgroundColor">, MarginProps, TagProps {
|
|
6
|
+
/** Toggle between the default variant and gradient variant */
|
|
7
|
+
variant?: string;
|
|
6
8
|
/** Specify a custom accessible name for the Loader component */
|
|
7
9
|
"aria-label"?: string;
|
|
8
10
|
}
|
|
9
|
-
export declare const Loader: ({ "aria-label": ariaLabel, size, isInsideButton, isActive, ...rest }: LoaderProps) => React.JSX.Element;
|
|
11
|
+
export declare const Loader: ({ variant, "aria-label": ariaLabel, size, isInsideButton, isActive, ...rest }: LoaderProps) => React.JSX.Element;
|
|
10
12
|
export default Loader;
|
|
@@ -15,6 +15,7 @@ var _loaderSquare = _interopRequireDefault(require("./loader-square.style"));
|
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
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); }
|
|
17
17
|
const Loader = ({
|
|
18
|
+
variant = "default",
|
|
18
19
|
"aria-label": ariaLabel,
|
|
19
20
|
size = "medium",
|
|
20
21
|
isInsideButton,
|
|
@@ -23,22 +24,21 @@ const Loader = ({
|
|
|
23
24
|
}) => {
|
|
24
25
|
const l = (0, _useLocale.default)();
|
|
25
26
|
const reduceMotion = !(0, _useMediaQuery.default)("screen and (prefers-reduced-motion: no-preference)");
|
|
27
|
+
const loaderSquareProps = {
|
|
28
|
+
isInsideButton,
|
|
29
|
+
isActive,
|
|
30
|
+
size,
|
|
31
|
+
variant
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// FE-6368 has been raised for the below, changed hex values for design tokens (when added)
|
|
26
35
|
return /*#__PURE__*/_react.default.createElement(_loader.default, _extends({
|
|
27
36
|
"aria-label": ariaLabel || l.loader.loading(),
|
|
28
37
|
role: "progressbar"
|
|
29
|
-
}, (0, _tags.default)("loader", rest), (0, _utils.filterStyledSystemMarginProps)(rest)), reduceMotion ? l.loader.loading() : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_loaderSquare.default, {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}), /*#__PURE__*/_react.default.createElement(_loaderSquare.default, {
|
|
34
|
-
isInsideButton: isInsideButton,
|
|
35
|
-
isActive: isActive,
|
|
36
|
-
size: size
|
|
37
|
-
}), /*#__PURE__*/_react.default.createElement(_loaderSquare.default, {
|
|
38
|
-
isInsideButton: isInsideButton,
|
|
39
|
-
isActive: isActive,
|
|
40
|
-
size: size
|
|
41
|
-
})));
|
|
38
|
+
}, (0, _tags.default)("loader", rest), (0, _utils.filterStyledSystemMarginProps)(rest)), reduceMotion ? l.loader.loading() : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, ["#13A038", "#0092DB", "#8F49FE"].map(color => /*#__PURE__*/_react.default.createElement(_loaderSquare.default, _extends({
|
|
39
|
+
key: color,
|
|
40
|
+
backgroundColor: variant === "gradient" ? color : "var(--colorsActionMajor500)"
|
|
41
|
+
}, loaderSquareProps)))));
|
|
42
42
|
};
|
|
43
43
|
exports.Loader = Loader;
|
|
44
44
|
var _default = exports.default = Loader;
|