carbon-react 132.0.0 → 132.2.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/file-input/__internal__/file-upload-status/file-upload-status.component.js +1 -4
- package/esm/components/file-input/__internal__/file-upload-status/file-upload-status.style.js +1 -1
- package/esm/components/file-input/file-input.component.d.ts +3 -3
- package/esm/components/file-input/file-input.component.js +5 -4
- package/esm/components/file-input/file-input.style.d.ts +1 -0
- package/esm/components/file-input/file-input.style.js +6 -4
- package/esm/components/loader-spinner/index.d.ts +2 -0
- package/esm/components/loader-spinner/index.js +1 -0
- package/esm/components/loader-spinner/loader-spinner.component.d.ts +36 -0
- package/esm/components/loader-spinner/loader-spinner.component.js +60 -0
- package/esm/components/loader-spinner/loader-spinner.config.d.ts +11 -0
- package/esm/components/loader-spinner/loader-spinner.config.js +25 -0
- package/esm/components/loader-spinner/loader-spinner.style.d.ts +13 -0
- package/esm/components/loader-spinner/loader-spinner.style.js +127 -0
- package/esm/locales/__internal__/es-es.js +3 -0
- package/esm/locales/en-gb.js +3 -0
- package/esm/locales/locale.d.ts +3 -0
- package/lib/components/file-input/__internal__/file-upload-status/file-upload-status.component.js +1 -4
- package/lib/components/file-input/__internal__/file-upload-status/file-upload-status.style.js +1 -1
- package/lib/components/file-input/file-input.component.d.ts +3 -3
- package/lib/components/file-input/file-input.component.js +5 -4
- package/lib/components/file-input/file-input.style.d.ts +1 -0
- package/lib/components/file-input/file-input.style.js +6 -4
- package/lib/components/loader-spinner/index.d.ts +2 -0
- package/lib/components/loader-spinner/index.js +13 -0
- package/lib/components/loader-spinner/loader-spinner.component.d.ts +36 -0
- package/lib/components/loader-spinner/loader-spinner.component.js +68 -0
- package/lib/components/loader-spinner/loader-spinner.config.d.ts +11 -0
- package/lib/components/loader-spinner/loader-spinner.config.js +30 -0
- package/lib/components/loader-spinner/loader-spinner.style.d.ts +13 -0
- package/lib/components/loader-spinner/loader-spinner.style.js +136 -0
- package/lib/components/loader-spinner/package.json +6 -0
- package/lib/locales/__internal__/es-es.js +3 -0
- package/lib/locales/en-gb.js +3 -0
- package/lib/locales/locale.d.ts +3 -0
- package/package.json +1 -1
package/esm/components/file-input/__internal__/file-upload-status/file-upload-status.component.js
CHANGED
|
@@ -24,10 +24,7 @@ export const FileUploadStatus = ({
|
|
|
24
24
|
switch (status) {
|
|
25
25
|
case "uploading":
|
|
26
26
|
buttonText = locale.fileInput.actions.cancel();
|
|
27
|
-
progressBar = statusProps.progress === undefined ? /*#__PURE__*/React.createElement(LoaderBar, {
|
|
28
|
-
size: "small"
|
|
29
|
-
}) : /*#__PURE__*/React.createElement(ProgressTracker, {
|
|
30
|
-
size: "small",
|
|
27
|
+
progressBar = statusProps.progress === undefined ? /*#__PURE__*/React.createElement(LoaderBar, null) : /*#__PURE__*/React.createElement(ProgressTracker, {
|
|
31
28
|
progress: statusProps.progress,
|
|
32
29
|
length: "100%"
|
|
33
30
|
});
|
package/esm/components/file-input/__internal__/file-upload-status/file-upload-status.style.js
CHANGED
|
@@ -76,7 +76,6 @@ export const StyledFileUploadStatus = styled.div`
|
|
|
76
76
|
`;
|
|
77
77
|
}}
|
|
78
78
|
border-radius: var(--borderRadius050);
|
|
79
|
-
width: 100%;
|
|
80
79
|
|
|
81
80
|
${StyledProgressBar}, ${ProgressTrackerInnerBar} {
|
|
82
81
|
border-radius: var(--borderRadius050);
|
|
@@ -93,5 +92,6 @@ export const StyledFileUploadStatus = styled.div`
|
|
|
93
92
|
|
|
94
93
|
${LoaderBarInnerBar} {
|
|
95
94
|
background-color: var(--colorsSemanticNeutral500);
|
|
95
|
+
border-radius: var(--borderRadius050);
|
|
96
96
|
}
|
|
97
97
|
`;
|
|
@@ -19,13 +19,13 @@ export interface FileInputProps extends Pick<ValidationProps, "error">, Pick<Inp
|
|
|
19
19
|
isVertical?: boolean;
|
|
20
20
|
/** Label content */
|
|
21
21
|
label?: string;
|
|
22
|
-
/** A valid CSS string for the max-height CSS property.
|
|
22
|
+
/** A valid CSS string for the max-height CSS property. */
|
|
23
23
|
maxHeight?: string;
|
|
24
24
|
/** A valid CSS string for the max-width CSS property. Defaults to the same as the minWidth. */
|
|
25
25
|
maxWidth?: string;
|
|
26
|
-
/** A valid CSS string for the min-height CSS property.
|
|
26
|
+
/** A valid CSS string for the min-height CSS property. */
|
|
27
27
|
minHeight?: string;
|
|
28
|
-
/** A valid CSS string for the min-width CSS property.
|
|
28
|
+
/** A valid CSS string for the min-width CSS property. */
|
|
29
29
|
minWidth?: string;
|
|
30
30
|
/** onChange event handler. Accepts a list of all files currently entered to the input. */
|
|
31
31
|
onChange: (files: FileList) => void;
|
|
@@ -27,8 +27,8 @@ const FileInput = /*#__PURE__*/React.forwardRef(({
|
|
|
27
27
|
isVertical,
|
|
28
28
|
maxHeight,
|
|
29
29
|
maxWidth,
|
|
30
|
-
minHeight
|
|
31
|
-
minWidth = "
|
|
30
|
+
minHeight,
|
|
31
|
+
minWidth = "280px",
|
|
32
32
|
name,
|
|
33
33
|
onChange,
|
|
34
34
|
required,
|
|
@@ -40,7 +40,7 @@ const FileInput = /*#__PURE__*/React.forwardRef(({
|
|
|
40
40
|
const textOnButton = buttonText || locale.fileInput.selectFile();
|
|
41
41
|
const mainText = dragAndDropText || locale.fileInput.dragAndDrop();
|
|
42
42
|
const sizeProps = {
|
|
43
|
-
maxHeight: maxHeight ||
|
|
43
|
+
maxHeight: maxHeight || undefined,
|
|
44
44
|
maxWidth: maxWidth || minWidth,
|
|
45
45
|
minHeight,
|
|
46
46
|
minWidth
|
|
@@ -137,7 +137,8 @@ const FileInput = /*#__PURE__*/React.forwardRef(({
|
|
|
137
137
|
error: error,
|
|
138
138
|
onDragLeave: onDragLeave,
|
|
139
139
|
onDragOver: onDragOver,
|
|
140
|
-
onDrop: onDrop
|
|
140
|
+
onDrop: onDrop,
|
|
141
|
+
isVertical: isVertical
|
|
141
142
|
}, sizeProps), /*#__PURE__*/React.createElement(ButtonMinor, {
|
|
142
143
|
buttonType: "primary",
|
|
143
144
|
onClick: onSelectFileClick
|
|
@@ -9,6 +9,7 @@ interface StyledFileInputPresentationProps extends Pick<ValidationProps, "error"
|
|
|
9
9
|
maxWidth?: string;
|
|
10
10
|
minHeight?: string;
|
|
11
11
|
minWidth?: string;
|
|
12
|
+
isVertical?: boolean;
|
|
12
13
|
}
|
|
13
14
|
export declare const StyledFileInputPresentation: import("styled-components").StyledComponent<"div", any, StyledFileInputPresentationProps, never>;
|
|
14
15
|
export {};
|
|
@@ -15,8 +15,9 @@ export const StyledFileInputPresentation = styled.div`
|
|
|
15
15
|
min-height: ${minHeight};
|
|
16
16
|
max-width: ${maxWidth};
|
|
17
17
|
${!hasUploadStatus && css`
|
|
18
|
-
padding:
|
|
18
|
+
padding: 11px; /* not 12px to account for 1px border */
|
|
19
19
|
max-height: ${maxHeight};
|
|
20
|
+
box-sizing: border-box;
|
|
20
21
|
`}
|
|
21
22
|
`}
|
|
22
23
|
|
|
@@ -24,7 +25,8 @@ export const StyledFileInputPresentation = styled.div`
|
|
|
24
25
|
hasUploadStatus,
|
|
25
26
|
isDraggedOver,
|
|
26
27
|
isDraggingFile,
|
|
27
|
-
error
|
|
28
|
+
error,
|
|
29
|
+
isVertical
|
|
28
30
|
}) => {
|
|
29
31
|
const borderWidthToken = error || isDraggingFile ? "borderWidth200" : "borderWidth100";
|
|
30
32
|
let borderColorToken = "colorsUtilityMajor300";
|
|
@@ -40,13 +42,13 @@ export const StyledFileInputPresentation = styled.div`
|
|
|
40
42
|
}
|
|
41
43
|
return !hasUploadStatus && css`
|
|
42
44
|
display: flex;
|
|
43
|
-
flex-direction: column;
|
|
45
|
+
${isVertical && "flex-direction: column;"}
|
|
44
46
|
flex-wrap: wrap;
|
|
45
47
|
justify-content: center;
|
|
46
48
|
align-content: center;
|
|
47
49
|
align-items: center;
|
|
48
50
|
text-align: center;
|
|
49
|
-
gap: var(--
|
|
51
|
+
gap: var(--spacing100);
|
|
50
52
|
border-radius: var(--borderRadius050);
|
|
51
53
|
border: var(--${borderWidthToken}) dashed var(--${borderColorToken});
|
|
52
54
|
background: var(--${backgroundColorToken});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LoaderSpinner } from "./loader-spinner.component";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
4
|
+
import { LoaderSpinnerSizes, LoaderSpinnerVariants } from "./loader-spinner.config";
|
|
5
|
+
export interface LoaderSpinnerProps extends MarginProps, TagProps {
|
|
6
|
+
/**
|
|
7
|
+
* The size prop allows a specific size to be set, ranging from
|
|
8
|
+
* `extra-small` to `extra-large`
|
|
9
|
+
*/
|
|
10
|
+
size?: LoaderSpinnerSizes;
|
|
11
|
+
/**
|
|
12
|
+
* If set to `false` no visual label will be displayed, however
|
|
13
|
+
* a visually hidden label will still be available for assistive technologies
|
|
14
|
+
*/
|
|
15
|
+
showSpinnerLabel?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The variant prop can be used to change the appearance of the component.
|
|
18
|
+
* Typically both the outer and inner spinner will change color,
|
|
19
|
+
* however there will still be sufficient contrast between them
|
|
20
|
+
*/
|
|
21
|
+
variant?: LoaderSpinnerVariants;
|
|
22
|
+
/** If set to `false` all motion will be suspended */
|
|
23
|
+
hasMotion?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* If set to `true` the animation type will become tracked, this is
|
|
26
|
+
* used specifically for when wait times are predictable
|
|
27
|
+
*/
|
|
28
|
+
isTracked?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The total animation time (in seconds). Default animation is time `1` second.
|
|
31
|
+
* For any gradient variants the default animation time is `2` seconds
|
|
32
|
+
*/
|
|
33
|
+
animationTime?: number;
|
|
34
|
+
}
|
|
35
|
+
export declare const LoaderSpinner: ({ size, showSpinnerLabel, variant, isTracked, hasMotion, animationTime, ...rest }: LoaderSpinnerProps) => React.JSX.Element;
|
|
36
|
+
export default LoaderSpinner;
|
|
@@ -0,0 +1,60 @@
|
|
|
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 from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
5
|
+
import { StyledSpinnerWrapper, StyledLabel, StyledSpinnerCircleSvg } from "./loader-spinner.style";
|
|
6
|
+
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
7
|
+
import useLocale from "../../hooks/__internal__/useLocale";
|
|
8
|
+
import useMediaQuery from "../../hooks/useMediaQuery";
|
|
9
|
+
import Typography from "../typography";
|
|
10
|
+
export const LoaderSpinner = ({
|
|
11
|
+
size = "medium",
|
|
12
|
+
showSpinnerLabel = true,
|
|
13
|
+
variant = "action",
|
|
14
|
+
isTracked = false,
|
|
15
|
+
hasMotion = true,
|
|
16
|
+
animationTime,
|
|
17
|
+
...rest
|
|
18
|
+
}) => {
|
|
19
|
+
const locale = useLocale();
|
|
20
|
+
const reduceMotion = !useMediaQuery("screen and (prefers-reduced-motion: no-preference)");
|
|
21
|
+
const isLabelDark = variant !== "inverse" && variant !== "gradient-white";
|
|
22
|
+
const spinnerLabel = /*#__PURE__*/React.createElement(StyledLabel, {
|
|
23
|
+
"data-role": "visible-label",
|
|
24
|
+
variant: "span",
|
|
25
|
+
fontWeight: "500",
|
|
26
|
+
size: size,
|
|
27
|
+
color: isLabelDark ? "var(--colorsUtilityYin090);" : "var(--colorsActionMajorYang100);",
|
|
28
|
+
fontSize: size === "extra-large" ? "var(--sizing200)" : "var(--sizing175)",
|
|
29
|
+
lineHeight: size === "extra-large" ? "var(--sizing300)" : "var(--sizing250)"
|
|
30
|
+
}, locale.loaderSpinner.loading());
|
|
31
|
+
const isGradientVariant = variant === "gradient-white" || variant === "gradient-grey";
|
|
32
|
+
const calculateDefaultAnimationTime = () => {
|
|
33
|
+
if (animationTime) {
|
|
34
|
+
return animationTime;
|
|
35
|
+
}
|
|
36
|
+
return isGradientVariant ? 2 : 1;
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/React.createElement(StyledSpinnerWrapper, _extends({
|
|
39
|
+
size: size,
|
|
40
|
+
role: "status"
|
|
41
|
+
}, tagComponent("loader-spinner", rest), filterStyledSystemMarginProps(rest)), reduceMotion ? spinnerLabel : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledSpinnerCircleSvg, {
|
|
42
|
+
role: "presentation",
|
|
43
|
+
size: size,
|
|
44
|
+
variant: variant,
|
|
45
|
+
hasMotion: hasMotion,
|
|
46
|
+
isTracked: isTracked,
|
|
47
|
+
isGradientVariant: isGradientVariant,
|
|
48
|
+
animationTime: calculateDefaultAnimationTime(),
|
|
49
|
+
viewBox: "0 0 24 24"
|
|
50
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
51
|
+
"data-role": "outer-arc"
|
|
52
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
53
|
+
"data-role": "inner-arc"
|
|
54
|
+
})), showSpinnerLabel ? spinnerLabel : /*#__PURE__*/React.createElement(Typography, {
|
|
55
|
+
"data-role": "hidden-label",
|
|
56
|
+
variant: "span",
|
|
57
|
+
screenReaderOnly: true
|
|
58
|
+
}, locale.loaderSpinner.loading())));
|
|
59
|
+
};
|
|
60
|
+
export default LoaderSpinner;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const LOADER_SPINNER_VARIANTS: readonly ["action", "neutral", "inverse", "gradient-grey", "gradient-white"];
|
|
2
|
+
declare type LoaderSpinnerVariants = typeof LOADER_SPINNER_VARIANTS[number];
|
|
3
|
+
declare const LOADER_SPINNER_SIZES: readonly ["extra-small", "small", "medium", "large", "extra-large"];
|
|
4
|
+
declare type LoaderSpinnerSizes = typeof LOADER_SPINNER_SIZES[number];
|
|
5
|
+
declare type LoaderSpinnerSizeParams = Record<LoaderSpinnerSizes, {
|
|
6
|
+
wrapperDimensions: number;
|
|
7
|
+
strokeWidth: number;
|
|
8
|
+
}>;
|
|
9
|
+
declare const LOADER_SPINNER_SIZE_PARAMS: LoaderSpinnerSizeParams;
|
|
10
|
+
export type { LoaderSpinnerSizes, LoaderSpinnerVariants };
|
|
11
|
+
export { LOADER_SPINNER_SIZES, LOADER_SPINNER_VARIANTS, LOADER_SPINNER_SIZE_PARAMS, };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const LOADER_SPINNER_VARIANTS = ["action", "neutral", "inverse", "gradient-grey", "gradient-white"];
|
|
2
|
+
const LOADER_SPINNER_SIZES = ["extra-small", "small", "medium", "large", "extra-large"];
|
|
3
|
+
const LOADER_SPINNER_SIZE_PARAMS = {
|
|
4
|
+
"extra-small": {
|
|
5
|
+
wrapperDimensions: 20,
|
|
6
|
+
strokeWidth: 4
|
|
7
|
+
},
|
|
8
|
+
small: {
|
|
9
|
+
wrapperDimensions: 32,
|
|
10
|
+
strokeWidth: 4
|
|
11
|
+
},
|
|
12
|
+
medium: {
|
|
13
|
+
wrapperDimensions: 56,
|
|
14
|
+
strokeWidth: 3.3
|
|
15
|
+
},
|
|
16
|
+
large: {
|
|
17
|
+
wrapperDimensions: 80,
|
|
18
|
+
strokeWidth: 3.7
|
|
19
|
+
},
|
|
20
|
+
"extra-large": {
|
|
21
|
+
wrapperDimensions: 104,
|
|
22
|
+
strokeWidth: 3.7
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export { LOADER_SPINNER_SIZES, LOADER_SPINNER_VARIANTS, LOADER_SPINNER_SIZE_PARAMS };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LoaderSpinnerProps } from "./loader-spinner.component";
|
|
3
|
+
export declare const StyledSpinnerWrapper: import("styled-components").StyledComponent<"div", any, Pick<LoaderSpinnerProps, "size">, never>;
|
|
4
|
+
export declare const StyledLabel: import("styled-components").StyledComponent<{
|
|
5
|
+
({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, isDisabled, "aria-hidden": ariaHidden, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
|
|
6
|
+
displayName: string;
|
|
7
|
+
}, any, Required<Pick<LoaderSpinnerProps, "size">>, never>;
|
|
8
|
+
interface StyledSpinnerCircleSvgProps extends Omit<LoaderSpinnerProps, "showSpinnerLabel"> {
|
|
9
|
+
isGradientVariant?: boolean;
|
|
10
|
+
size: Required<LoaderSpinnerProps>["size"];
|
|
11
|
+
}
|
|
12
|
+
export declare const StyledSpinnerCircleSvg: import("styled-components").StyledComponent<"svg", any, StyledSpinnerCircleSvgProps, never>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { margin } from "styled-system";
|
|
3
|
+
import { LOADER_SPINNER_SIZE_PARAMS } from "./loader-spinner.config";
|
|
4
|
+
import Typography from "../typography";
|
|
5
|
+
const calculateColors = (isWheel, variant) => {
|
|
6
|
+
switch (variant) {
|
|
7
|
+
case "neutral":
|
|
8
|
+
return isWheel ? "var(--colorsSemanticNeutral500)" : "var(--colorsSemanticNeutral200)";
|
|
9
|
+
case "gradient-grey":
|
|
10
|
+
return isWheel ? "#00D639" : "#0000001A";
|
|
11
|
+
case "gradient-white":
|
|
12
|
+
return isWheel ? "#00D639" : "var(--colorsActionMajorYang100)";
|
|
13
|
+
case "inverse":
|
|
14
|
+
return "var(--colorsActionMajorYang100)";
|
|
15
|
+
default:
|
|
16
|
+
return isWheel ? "var(--colorsActionMajor500)" : "var(--colorsActionMajor150)";
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export const StyledSpinnerWrapper = styled.div`
|
|
20
|
+
${margin}
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: ${({
|
|
23
|
+
size
|
|
24
|
+
}) => size === "extra-small" ? "row" : "column"};
|
|
25
|
+
`;
|
|
26
|
+
export const StyledLabel = styled(Typography)`
|
|
27
|
+
${({
|
|
28
|
+
size
|
|
29
|
+
}) => css`
|
|
30
|
+
display: flex;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
${size !== "extra-small" && `width: ${LOADER_SPINNER_SIZE_PARAMS[size].wrapperDimensions}px`};
|
|
33
|
+
${size === "extra-small" && `margin-left: var(--spacing100)`};
|
|
34
|
+
`}
|
|
35
|
+
`;
|
|
36
|
+
export const StyledSpinnerCircleSvg = styled.svg`
|
|
37
|
+
${({
|
|
38
|
+
size,
|
|
39
|
+
isTracked,
|
|
40
|
+
hasMotion,
|
|
41
|
+
isGradientVariant,
|
|
42
|
+
animationTime,
|
|
43
|
+
variant
|
|
44
|
+
}) => {
|
|
45
|
+
const dimensions = `${LOADER_SPINNER_SIZE_PARAMS[size].wrapperDimensions}px`;
|
|
46
|
+
return size && css`
|
|
47
|
+
width: ${dimensions};
|
|
48
|
+
height: ${dimensions};
|
|
49
|
+
min-width: ${dimensions};
|
|
50
|
+
min-height: ${dimensions};
|
|
51
|
+
|
|
52
|
+
circle[data-role="outer-arc"] {
|
|
53
|
+
fill: transparent;
|
|
54
|
+
stroke-width: ${LOADER_SPINNER_SIZE_PARAMS[size].strokeWidth}px;
|
|
55
|
+
stroke: ${calculateColors(false, variant)};
|
|
56
|
+
${variant === "inverse" && `stroke-opacity: 0.3`}
|
|
57
|
+
cx: 12px;
|
|
58
|
+
cy: 12px;
|
|
59
|
+
r: 10px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
circle[data-role="inner-arc"] {
|
|
63
|
+
fill: transparent;
|
|
64
|
+
stroke-width: ${LOADER_SPINNER_SIZE_PARAMS[size].strokeWidth}px;
|
|
65
|
+
stroke: ${calculateColors(true, variant)};
|
|
66
|
+
stroke-linecap: round;
|
|
67
|
+
stroke-dasharray: 100px;
|
|
68
|
+
stroke-dashoffset: 80px;
|
|
69
|
+
transform-origin: 12px 12px 0px;
|
|
70
|
+
cx: 12px;
|
|
71
|
+
cy: 12px;
|
|
72
|
+
r: 10px;
|
|
73
|
+
transform: rotate(270deg);
|
|
74
|
+
|
|
75
|
+
@keyframes gradientAnimation {
|
|
76
|
+
0% {
|
|
77
|
+
stroke: #00d639;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
33% {
|
|
81
|
+
stroke: #11afff;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
66% {
|
|
85
|
+
stroke: #8f49fe;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@keyframes trackedAnimation {
|
|
90
|
+
from {
|
|
91
|
+
stroke-dasharray: 100;
|
|
92
|
+
stroke-dashoffset: 100;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
to {
|
|
96
|
+
stroke-dasharray: 100;
|
|
97
|
+
stroke-dashoffset: 20;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@keyframes untrackedAnimation {
|
|
102
|
+
0% {
|
|
103
|
+
transform: rotate(0deg);
|
|
104
|
+
stroke-dasharray: 100;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
40% {
|
|
108
|
+
stroke-dasharray: 80;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
80% {
|
|
112
|
+
stroke-dasharray: 100;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
100% {
|
|
116
|
+
transform: rotate(360deg);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
animation-name: ${isTracked && !isGradientVariant ? "trackedAnimation" : "untrackedAnimation"},
|
|
121
|
+
${variant === "gradient-grey" || variant === "gradient-white" && "gradientAnimation" ? "gradientAnimation" : "none"};
|
|
122
|
+
${hasMotion && `animation-duration: ${animationTime}s`};
|
|
123
|
+
animation-timing-function: cubic-bezier(0.2, 0.1, 0.8, 1);
|
|
124
|
+
animation-iteration-count: ${hasMotion ? "infinite" : "none"};
|
|
125
|
+
`;
|
|
126
|
+
}};
|
|
127
|
+
`;
|
package/esm/locales/en-gb.js
CHANGED
package/esm/locales/locale.d.ts
CHANGED
package/lib/components/file-input/__internal__/file-upload-status/file-upload-status.component.js
CHANGED
|
@@ -31,10 +31,7 @@ const FileUploadStatus = ({
|
|
|
31
31
|
switch (status) {
|
|
32
32
|
case "uploading":
|
|
33
33
|
buttonText = locale.fileInput.actions.cancel();
|
|
34
|
-
progressBar = statusProps.progress === undefined ? /*#__PURE__*/_react.default.createElement(_loaderBar.default, {
|
|
35
|
-
size: "small"
|
|
36
|
-
}) : /*#__PURE__*/_react.default.createElement(_progressTracker.default, {
|
|
37
|
-
size: "small",
|
|
34
|
+
progressBar = statusProps.progress === undefined ? /*#__PURE__*/_react.default.createElement(_loaderBar.default, null) : /*#__PURE__*/_react.default.createElement(_progressTracker.default, {
|
|
38
35
|
progress: statusProps.progress,
|
|
39
36
|
length: "100%"
|
|
40
37
|
});
|
package/lib/components/file-input/__internal__/file-upload-status/file-upload-status.style.js
CHANGED
|
@@ -85,7 +85,6 @@ const StyledFileUploadStatus = exports.StyledFileUploadStatus = _styledComponent
|
|
|
85
85
|
`;
|
|
86
86
|
}}
|
|
87
87
|
border-radius: var(--borderRadius050);
|
|
88
|
-
width: 100%;
|
|
89
88
|
|
|
90
89
|
${_progressTracker.StyledProgressBar}, ${_progressTracker.InnerBar} {
|
|
91
90
|
border-radius: var(--borderRadius050);
|
|
@@ -102,5 +101,6 @@ const StyledFileUploadStatus = exports.StyledFileUploadStatus = _styledComponent
|
|
|
102
101
|
|
|
103
102
|
${_loaderBar.InnerBar} {
|
|
104
103
|
background-color: var(--colorsSemanticNeutral500);
|
|
104
|
+
border-radius: var(--borderRadius050);
|
|
105
105
|
}
|
|
106
106
|
`;
|
|
@@ -19,13 +19,13 @@ export interface FileInputProps extends Pick<ValidationProps, "error">, Pick<Inp
|
|
|
19
19
|
isVertical?: boolean;
|
|
20
20
|
/** Label content */
|
|
21
21
|
label?: string;
|
|
22
|
-
/** A valid CSS string for the max-height CSS property.
|
|
22
|
+
/** A valid CSS string for the max-height CSS property. */
|
|
23
23
|
maxHeight?: string;
|
|
24
24
|
/** A valid CSS string for the max-width CSS property. Defaults to the same as the minWidth. */
|
|
25
25
|
maxWidth?: string;
|
|
26
|
-
/** A valid CSS string for the min-height CSS property.
|
|
26
|
+
/** A valid CSS string for the min-height CSS property. */
|
|
27
27
|
minHeight?: string;
|
|
28
|
-
/** A valid CSS string for the min-width CSS property.
|
|
28
|
+
/** A valid CSS string for the min-width CSS property. */
|
|
29
29
|
minWidth?: string;
|
|
30
30
|
/** onChange event handler. Accepts a list of all files currently entered to the input. */
|
|
31
31
|
onChange: (files: FileList) => void;
|
|
@@ -36,8 +36,8 @@ const FileInput = exports.FileInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
36
36
|
isVertical,
|
|
37
37
|
maxHeight,
|
|
38
38
|
maxWidth,
|
|
39
|
-
minHeight
|
|
40
|
-
minWidth = "
|
|
39
|
+
minHeight,
|
|
40
|
+
minWidth = "280px",
|
|
41
41
|
name,
|
|
42
42
|
onChange,
|
|
43
43
|
required,
|
|
@@ -49,7 +49,7 @@ const FileInput = exports.FileInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
49
49
|
const textOnButton = buttonText || locale.fileInput.selectFile();
|
|
50
50
|
const mainText = dragAndDropText || locale.fileInput.dragAndDrop();
|
|
51
51
|
const sizeProps = {
|
|
52
|
-
maxHeight: maxHeight ||
|
|
52
|
+
maxHeight: maxHeight || undefined,
|
|
53
53
|
maxWidth: maxWidth || minWidth,
|
|
54
54
|
minHeight,
|
|
55
55
|
minWidth
|
|
@@ -146,7 +146,8 @@ const FileInput = exports.FileInput = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
146
146
|
error: error,
|
|
147
147
|
onDragLeave: onDragLeave,
|
|
148
148
|
onDragOver: onDragOver,
|
|
149
|
-
onDrop: onDrop
|
|
149
|
+
onDrop: onDrop,
|
|
150
|
+
isVertical: isVertical
|
|
150
151
|
}, sizeProps), /*#__PURE__*/_react.default.createElement(_buttonMinor.default, {
|
|
151
152
|
buttonType: "primary",
|
|
152
153
|
onClick: onSelectFileClick
|
|
@@ -9,6 +9,7 @@ interface StyledFileInputPresentationProps extends Pick<ValidationProps, "error"
|
|
|
9
9
|
maxWidth?: string;
|
|
10
10
|
minHeight?: string;
|
|
11
11
|
minWidth?: string;
|
|
12
|
+
isVertical?: boolean;
|
|
12
13
|
}
|
|
13
14
|
export declare const StyledFileInputPresentation: import("styled-components").StyledComponent<"div", any, StyledFileInputPresentationProps, never>;
|
|
14
15
|
export {};
|
|
@@ -24,8 +24,9 @@ const StyledFileInputPresentation = exports.StyledFileInputPresentation = _style
|
|
|
24
24
|
min-height: ${minHeight};
|
|
25
25
|
max-width: ${maxWidth};
|
|
26
26
|
${!hasUploadStatus && (0, _styledComponents.css)`
|
|
27
|
-
padding:
|
|
27
|
+
padding: 11px; /* not 12px to account for 1px border */
|
|
28
28
|
max-height: ${maxHeight};
|
|
29
|
+
box-sizing: border-box;
|
|
29
30
|
`}
|
|
30
31
|
`}
|
|
31
32
|
|
|
@@ -33,7 +34,8 @@ const StyledFileInputPresentation = exports.StyledFileInputPresentation = _style
|
|
|
33
34
|
hasUploadStatus,
|
|
34
35
|
isDraggedOver,
|
|
35
36
|
isDraggingFile,
|
|
36
|
-
error
|
|
37
|
+
error,
|
|
38
|
+
isVertical
|
|
37
39
|
}) => {
|
|
38
40
|
const borderWidthToken = error || isDraggingFile ? "borderWidth200" : "borderWidth100";
|
|
39
41
|
let borderColorToken = "colorsUtilityMajor300";
|
|
@@ -49,13 +51,13 @@ const StyledFileInputPresentation = exports.StyledFileInputPresentation = _style
|
|
|
49
51
|
}
|
|
50
52
|
return !hasUploadStatus && (0, _styledComponents.css)`
|
|
51
53
|
display: flex;
|
|
52
|
-
flex-direction: column;
|
|
54
|
+
${isVertical && "flex-direction: column;"}
|
|
53
55
|
flex-wrap: wrap;
|
|
54
56
|
justify-content: center;
|
|
55
57
|
align-content: center;
|
|
56
58
|
align-items: center;
|
|
57
59
|
text-align: center;
|
|
58
|
-
gap: var(--
|
|
60
|
+
gap: var(--spacing100);
|
|
59
61
|
border-radius: var(--borderRadius050);
|
|
60
62
|
border: var(--${borderWidthToken}) dashed var(--${borderColorToken});
|
|
61
63
|
background: var(--${backgroundColorToken});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "LoaderSpinner", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _loaderSpinner.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _loaderSpinner = _interopRequireDefault(require("./loader-spinner.component"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MarginProps } from "styled-system";
|
|
3
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
4
|
+
import { LoaderSpinnerSizes, LoaderSpinnerVariants } from "./loader-spinner.config";
|
|
5
|
+
export interface LoaderSpinnerProps extends MarginProps, TagProps {
|
|
6
|
+
/**
|
|
7
|
+
* The size prop allows a specific size to be set, ranging from
|
|
8
|
+
* `extra-small` to `extra-large`
|
|
9
|
+
*/
|
|
10
|
+
size?: LoaderSpinnerSizes;
|
|
11
|
+
/**
|
|
12
|
+
* If set to `false` no visual label will be displayed, however
|
|
13
|
+
* a visually hidden label will still be available for assistive technologies
|
|
14
|
+
*/
|
|
15
|
+
showSpinnerLabel?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The variant prop can be used to change the appearance of the component.
|
|
18
|
+
* Typically both the outer and inner spinner will change color,
|
|
19
|
+
* however there will still be sufficient contrast between them
|
|
20
|
+
*/
|
|
21
|
+
variant?: LoaderSpinnerVariants;
|
|
22
|
+
/** If set to `false` all motion will be suspended */
|
|
23
|
+
hasMotion?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* If set to `true` the animation type will become tracked, this is
|
|
26
|
+
* used specifically for when wait times are predictable
|
|
27
|
+
*/
|
|
28
|
+
isTracked?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The total animation time (in seconds). Default animation is time `1` second.
|
|
31
|
+
* For any gradient variants the default animation time is `2` seconds
|
|
32
|
+
*/
|
|
33
|
+
animationTime?: number;
|
|
34
|
+
}
|
|
35
|
+
export declare const LoaderSpinner: ({ size, showSpinnerLabel, variant, isTracked, hasMotion, animationTime, ...rest }: LoaderSpinnerProps) => React.JSX.Element;
|
|
36
|
+
export default LoaderSpinner;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.LoaderSpinner = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
10
|
+
var _loaderSpinner = require("./loader-spinner.style");
|
|
11
|
+
var _utils = require("../../style/utils");
|
|
12
|
+
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
13
|
+
var _useMediaQuery = _interopRequireDefault(require("../../hooks/useMediaQuery"));
|
|
14
|
+
var _typography = _interopRequireDefault(require("../typography"));
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
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
|
+
const LoaderSpinner = ({
|
|
18
|
+
size = "medium",
|
|
19
|
+
showSpinnerLabel = true,
|
|
20
|
+
variant = "action",
|
|
21
|
+
isTracked = false,
|
|
22
|
+
hasMotion = true,
|
|
23
|
+
animationTime,
|
|
24
|
+
...rest
|
|
25
|
+
}) => {
|
|
26
|
+
const locale = (0, _useLocale.default)();
|
|
27
|
+
const reduceMotion = !(0, _useMediaQuery.default)("screen and (prefers-reduced-motion: no-preference)");
|
|
28
|
+
const isLabelDark = variant !== "inverse" && variant !== "gradient-white";
|
|
29
|
+
const spinnerLabel = /*#__PURE__*/_react.default.createElement(_loaderSpinner.StyledLabel, {
|
|
30
|
+
"data-role": "visible-label",
|
|
31
|
+
variant: "span",
|
|
32
|
+
fontWeight: "500",
|
|
33
|
+
size: size,
|
|
34
|
+
color: isLabelDark ? "var(--colorsUtilityYin090);" : "var(--colorsActionMajorYang100);",
|
|
35
|
+
fontSize: size === "extra-large" ? "var(--sizing200)" : "var(--sizing175)",
|
|
36
|
+
lineHeight: size === "extra-large" ? "var(--sizing300)" : "var(--sizing250)"
|
|
37
|
+
}, locale.loaderSpinner.loading());
|
|
38
|
+
const isGradientVariant = variant === "gradient-white" || variant === "gradient-grey";
|
|
39
|
+
const calculateDefaultAnimationTime = () => {
|
|
40
|
+
if (animationTime) {
|
|
41
|
+
return animationTime;
|
|
42
|
+
}
|
|
43
|
+
return isGradientVariant ? 2 : 1;
|
|
44
|
+
};
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement(_loaderSpinner.StyledSpinnerWrapper, _extends({
|
|
46
|
+
size: size,
|
|
47
|
+
role: "status"
|
|
48
|
+
}, (0, _tags.default)("loader-spinner", rest), (0, _utils.filterStyledSystemMarginProps)(rest)), reduceMotion ? spinnerLabel : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_loaderSpinner.StyledSpinnerCircleSvg, {
|
|
49
|
+
role: "presentation",
|
|
50
|
+
size: size,
|
|
51
|
+
variant: variant,
|
|
52
|
+
hasMotion: hasMotion,
|
|
53
|
+
isTracked: isTracked,
|
|
54
|
+
isGradientVariant: isGradientVariant,
|
|
55
|
+
animationTime: calculateDefaultAnimationTime(),
|
|
56
|
+
viewBox: "0 0 24 24"
|
|
57
|
+
}, /*#__PURE__*/_react.default.createElement("circle", {
|
|
58
|
+
"data-role": "outer-arc"
|
|
59
|
+
}), /*#__PURE__*/_react.default.createElement("circle", {
|
|
60
|
+
"data-role": "inner-arc"
|
|
61
|
+
})), showSpinnerLabel ? spinnerLabel : /*#__PURE__*/_react.default.createElement(_typography.default, {
|
|
62
|
+
"data-role": "hidden-label",
|
|
63
|
+
variant: "span",
|
|
64
|
+
screenReaderOnly: true
|
|
65
|
+
}, locale.loaderSpinner.loading())));
|
|
66
|
+
};
|
|
67
|
+
exports.LoaderSpinner = LoaderSpinner;
|
|
68
|
+
var _default = exports.default = LoaderSpinner;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const LOADER_SPINNER_VARIANTS: readonly ["action", "neutral", "inverse", "gradient-grey", "gradient-white"];
|
|
2
|
+
declare type LoaderSpinnerVariants = typeof LOADER_SPINNER_VARIANTS[number];
|
|
3
|
+
declare const LOADER_SPINNER_SIZES: readonly ["extra-small", "small", "medium", "large", "extra-large"];
|
|
4
|
+
declare type LoaderSpinnerSizes = typeof LOADER_SPINNER_SIZES[number];
|
|
5
|
+
declare type LoaderSpinnerSizeParams = Record<LoaderSpinnerSizes, {
|
|
6
|
+
wrapperDimensions: number;
|
|
7
|
+
strokeWidth: number;
|
|
8
|
+
}>;
|
|
9
|
+
declare const LOADER_SPINNER_SIZE_PARAMS: LoaderSpinnerSizeParams;
|
|
10
|
+
export type { LoaderSpinnerSizes, LoaderSpinnerVariants };
|
|
11
|
+
export { LOADER_SPINNER_SIZES, LOADER_SPINNER_VARIANTS, LOADER_SPINNER_SIZE_PARAMS, };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.LOADER_SPINNER_VARIANTS = exports.LOADER_SPINNER_SIZE_PARAMS = exports.LOADER_SPINNER_SIZES = void 0;
|
|
7
|
+
const LOADER_SPINNER_VARIANTS = exports.LOADER_SPINNER_VARIANTS = ["action", "neutral", "inverse", "gradient-grey", "gradient-white"];
|
|
8
|
+
const LOADER_SPINNER_SIZES = exports.LOADER_SPINNER_SIZES = ["extra-small", "small", "medium", "large", "extra-large"];
|
|
9
|
+
const LOADER_SPINNER_SIZE_PARAMS = exports.LOADER_SPINNER_SIZE_PARAMS = {
|
|
10
|
+
"extra-small": {
|
|
11
|
+
wrapperDimensions: 20,
|
|
12
|
+
strokeWidth: 4
|
|
13
|
+
},
|
|
14
|
+
small: {
|
|
15
|
+
wrapperDimensions: 32,
|
|
16
|
+
strokeWidth: 4
|
|
17
|
+
},
|
|
18
|
+
medium: {
|
|
19
|
+
wrapperDimensions: 56,
|
|
20
|
+
strokeWidth: 3.3
|
|
21
|
+
},
|
|
22
|
+
large: {
|
|
23
|
+
wrapperDimensions: 80,
|
|
24
|
+
strokeWidth: 3.7
|
|
25
|
+
},
|
|
26
|
+
"extra-large": {
|
|
27
|
+
wrapperDimensions: 104,
|
|
28
|
+
strokeWidth: 3.7
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LoaderSpinnerProps } from "./loader-spinner.component";
|
|
3
|
+
export declare const StyledSpinnerWrapper: import("styled-components").StyledComponent<"div", any, Pick<LoaderSpinnerProps, "size">, never>;
|
|
4
|
+
export declare const StyledLabel: import("styled-components").StyledComponent<{
|
|
5
|
+
({ "data-component": dataComponent, variant, as, id, fontSize, fontWeight, textTransform, lineHeight, textDecoration, display, listStyleType, whiteSpace, wordWrap, textAlign, textOverflow, truncate, color, backgroundColor, bg, opacity, children, className, screenReaderOnly, isDisabled, "aria-hidden": ariaHidden, ...rest }: import("../typography").TypographyProps): import("react").JSX.Element;
|
|
6
|
+
displayName: string;
|
|
7
|
+
}, any, Required<Pick<LoaderSpinnerProps, "size">>, never>;
|
|
8
|
+
interface StyledSpinnerCircleSvgProps extends Omit<LoaderSpinnerProps, "showSpinnerLabel"> {
|
|
9
|
+
isGradientVariant?: boolean;
|
|
10
|
+
size: Required<LoaderSpinnerProps>["size"];
|
|
11
|
+
}
|
|
12
|
+
export declare const StyledSpinnerCircleSvg: import("styled-components").StyledComponent<"svg", any, StyledSpinnerCircleSvgProps, never>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledSpinnerWrapper = exports.StyledSpinnerCircleSvg = exports.StyledLabel = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
var _styledSystem = require("styled-system");
|
|
9
|
+
var _loaderSpinner = require("./loader-spinner.config");
|
|
10
|
+
var _typography = _interopRequireDefault(require("../typography"));
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
+
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); }
|
|
13
|
+
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 && Object.prototype.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; }
|
|
14
|
+
const calculateColors = (isWheel, variant) => {
|
|
15
|
+
switch (variant) {
|
|
16
|
+
case "neutral":
|
|
17
|
+
return isWheel ? "var(--colorsSemanticNeutral500)" : "var(--colorsSemanticNeutral200)";
|
|
18
|
+
case "gradient-grey":
|
|
19
|
+
return isWheel ? "#00D639" : "#0000001A";
|
|
20
|
+
case "gradient-white":
|
|
21
|
+
return isWheel ? "#00D639" : "var(--colorsActionMajorYang100)";
|
|
22
|
+
case "inverse":
|
|
23
|
+
return "var(--colorsActionMajorYang100)";
|
|
24
|
+
default:
|
|
25
|
+
return isWheel ? "var(--colorsActionMajor500)" : "var(--colorsActionMajor150)";
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const StyledSpinnerWrapper = exports.StyledSpinnerWrapper = _styledComponents.default.div`
|
|
29
|
+
${_styledSystem.margin}
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: ${({
|
|
32
|
+
size
|
|
33
|
+
}) => size === "extra-small" ? "row" : "column"};
|
|
34
|
+
`;
|
|
35
|
+
const StyledLabel = exports.StyledLabel = (0, _styledComponents.default)(_typography.default)`
|
|
36
|
+
${({
|
|
37
|
+
size
|
|
38
|
+
}) => (0, _styledComponents.css)`
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
${size !== "extra-small" && `width: ${_loaderSpinner.LOADER_SPINNER_SIZE_PARAMS[size].wrapperDimensions}px`};
|
|
42
|
+
${size === "extra-small" && `margin-left: var(--spacing100)`};
|
|
43
|
+
`}
|
|
44
|
+
`;
|
|
45
|
+
const StyledSpinnerCircleSvg = exports.StyledSpinnerCircleSvg = _styledComponents.default.svg`
|
|
46
|
+
${({
|
|
47
|
+
size,
|
|
48
|
+
isTracked,
|
|
49
|
+
hasMotion,
|
|
50
|
+
isGradientVariant,
|
|
51
|
+
animationTime,
|
|
52
|
+
variant
|
|
53
|
+
}) => {
|
|
54
|
+
const dimensions = `${_loaderSpinner.LOADER_SPINNER_SIZE_PARAMS[size].wrapperDimensions}px`;
|
|
55
|
+
return size && (0, _styledComponents.css)`
|
|
56
|
+
width: ${dimensions};
|
|
57
|
+
height: ${dimensions};
|
|
58
|
+
min-width: ${dimensions};
|
|
59
|
+
min-height: ${dimensions};
|
|
60
|
+
|
|
61
|
+
circle[data-role="outer-arc"] {
|
|
62
|
+
fill: transparent;
|
|
63
|
+
stroke-width: ${_loaderSpinner.LOADER_SPINNER_SIZE_PARAMS[size].strokeWidth}px;
|
|
64
|
+
stroke: ${calculateColors(false, variant)};
|
|
65
|
+
${variant === "inverse" && `stroke-opacity: 0.3`}
|
|
66
|
+
cx: 12px;
|
|
67
|
+
cy: 12px;
|
|
68
|
+
r: 10px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
circle[data-role="inner-arc"] {
|
|
72
|
+
fill: transparent;
|
|
73
|
+
stroke-width: ${_loaderSpinner.LOADER_SPINNER_SIZE_PARAMS[size].strokeWidth}px;
|
|
74
|
+
stroke: ${calculateColors(true, variant)};
|
|
75
|
+
stroke-linecap: round;
|
|
76
|
+
stroke-dasharray: 100px;
|
|
77
|
+
stroke-dashoffset: 80px;
|
|
78
|
+
transform-origin: 12px 12px 0px;
|
|
79
|
+
cx: 12px;
|
|
80
|
+
cy: 12px;
|
|
81
|
+
r: 10px;
|
|
82
|
+
transform: rotate(270deg);
|
|
83
|
+
|
|
84
|
+
@keyframes gradientAnimation {
|
|
85
|
+
0% {
|
|
86
|
+
stroke: #00d639;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
33% {
|
|
90
|
+
stroke: #11afff;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
66% {
|
|
94
|
+
stroke: #8f49fe;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@keyframes trackedAnimation {
|
|
99
|
+
from {
|
|
100
|
+
stroke-dasharray: 100;
|
|
101
|
+
stroke-dashoffset: 100;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
to {
|
|
105
|
+
stroke-dasharray: 100;
|
|
106
|
+
stroke-dashoffset: 20;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@keyframes untrackedAnimation {
|
|
111
|
+
0% {
|
|
112
|
+
transform: rotate(0deg);
|
|
113
|
+
stroke-dasharray: 100;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
40% {
|
|
117
|
+
stroke-dasharray: 80;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
80% {
|
|
121
|
+
stroke-dasharray: 100;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
100% {
|
|
125
|
+
transform: rotate(360deg);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
animation-name: ${isTracked && !isGradientVariant ? "trackedAnimation" : "untrackedAnimation"},
|
|
130
|
+
${variant === "gradient-grey" || variant === "gradient-white" && "gradientAnimation" ? "gradientAnimation" : "none"};
|
|
131
|
+
${hasMotion && `animation-duration: ${animationTime}s`};
|
|
132
|
+
animation-timing-function: cubic-bezier(0.2, 0.1, 0.8, 1);
|
|
133
|
+
animation-iteration-count: ${hasMotion ? "infinite" : "none"};
|
|
134
|
+
`;
|
|
135
|
+
}};
|
|
136
|
+
`;
|
package/lib/locales/en-gb.js
CHANGED
package/lib/locales/locale.d.ts
CHANGED