carbon-react 142.3.2 → 142.4.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/flat-table/flat-table-cell/flat-table-cell.component.d.ts +3 -2
- package/esm/components/flat-table/flat-table-cell/flat-table-cell.component.js +7 -2
- package/esm/components/flat-table/flat-table-header/flat-table-header.component.d.ts +3 -2
- package/esm/components/flat-table/flat-table-header/flat-table-header.component.js +9 -3
- package/esm/components/flat-table/flat-table-row/flat-table-row.component.js +2 -0
- package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.d.ts +1 -1
- package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +10 -9
- package/esm/components/grouped-character/grouped-character.component.js +1 -1
- package/esm/components/loader-star/index.d.ts +2 -0
- package/esm/components/loader-star/index.js +1 -0
- package/esm/components/loader-star/internal/star.component.d.ts +9 -0
- package/esm/components/loader-star/internal/star.component.js +40 -0
- package/esm/components/loader-star/internal/star.style.d.ts +4 -0
- package/esm/components/loader-star/internal/star.style.js +126 -0
- package/esm/components/loader-star/loader-star.component.d.ts +14 -0
- package/esm/components/loader-star/loader-star.component.js +46 -0
- package/esm/components/loader-star/loader-star.style.d.ts +8 -0
- package/esm/components/loader-star/loader-star.style.js +15 -0
- package/esm/locales/de-de.js +3 -0
- package/esm/locales/en-gb.js +3 -0
- package/esm/locales/es-es.js +3 -0
- package/esm/locales/fr-ca.js +3 -0
- package/esm/locales/fr-fr.js +3 -0
- package/esm/locales/locale.d.ts +3 -0
- package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.d.ts +3 -2
- package/lib/components/flat-table/flat-table-cell/flat-table-cell.component.js +7 -2
- package/lib/components/flat-table/flat-table-header/flat-table-header.component.d.ts +3 -2
- package/lib/components/flat-table/flat-table-header/flat-table-header.component.js +9 -3
- package/lib/components/flat-table/flat-table-row/flat-table-row.component.js +2 -0
- package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.d.ts +1 -1
- package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.js +10 -9
- package/lib/components/grouped-character/grouped-character.component.js +1 -1
- package/lib/components/loader-star/index.d.ts +2 -0
- package/lib/components/loader-star/index.js +13 -0
- package/lib/components/loader-star/internal/star.component.d.ts +9 -0
- package/lib/components/loader-star/internal/star.component.js +47 -0
- package/lib/components/loader-star/internal/star.style.d.ts +4 -0
- package/lib/components/loader-star/internal/star.style.js +134 -0
- package/lib/components/loader-star/loader-star.component.d.ts +14 -0
- package/lib/components/loader-star/loader-star.component.js +53 -0
- package/lib/components/loader-star/loader-star.style.d.ts +8 -0
- package/lib/components/loader-star/loader-star.style.js +22 -0
- package/lib/components/loader-star/package.json +6 -0
- package/lib/locales/de-de.js +3 -0
- package/lib/locales/en-gb.js +3 -0
- package/lib/locales/es-es.js +3 -0
- package/lib/locales/fr-ca.js +3 -0
- package/lib/locales/fr-fr.js +3 -0
- package/lib/locales/locale.d.ts +3 -0
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
3
|
import { TableBorderSize, TableCellAlign } from "..";
|
|
4
|
-
|
|
4
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
5
|
+
export interface FlatTableCellProps extends PaddingProps, Omit<TagProps, "data-component"> {
|
|
5
6
|
/** Content alignment */
|
|
6
7
|
align?: TableCellAlign;
|
|
7
8
|
/** Cell content */
|
|
@@ -24,7 +25,7 @@ export interface FlatTableCellProps extends PaddingProps {
|
|
|
24
25
|
id?: string;
|
|
25
26
|
}
|
|
26
27
|
export declare const FlatTableCell: {
|
|
27
|
-
({ align, children, pl, width, truncate, title, colspan, rowspan, id, ...rest }: FlatTableCellProps): React.JSX.Element;
|
|
28
|
+
({ align, children, pl, width, truncate, title, colspan, rowspan, id, "data-element": dataElement, "data-role": dataRole, ...rest }: FlatTableCellProps): React.JSX.Element;
|
|
28
29
|
displayName: string;
|
|
29
30
|
};
|
|
30
31
|
export default FlatTableCell;
|
|
@@ -15,6 +15,8 @@ export const FlatTableCell = ({
|
|
|
15
15
|
colspan,
|
|
16
16
|
rowspan,
|
|
17
17
|
id,
|
|
18
|
+
"data-element": dataElement,
|
|
19
|
+
"data-role": dataRole,
|
|
18
20
|
...rest
|
|
19
21
|
}) => {
|
|
20
22
|
const internalId = useRef(id || guid());
|
|
@@ -41,7 +43,9 @@ export const FlatTableCell = ({
|
|
|
41
43
|
makeCellSticky: makeCellSticky,
|
|
42
44
|
className: makeCellSticky ? "isSticky" : undefined,
|
|
43
45
|
align: align,
|
|
44
|
-
"data-
|
|
46
|
+
"data-component": "flat-table-cell",
|
|
47
|
+
"data-element": dataElement || "flat-table-cell",
|
|
48
|
+
"data-role": dataRole,
|
|
45
49
|
pl: pl,
|
|
46
50
|
onClick: isExpandableCell ? onClick : undefined,
|
|
47
51
|
tabIndex: isExpandableCell ? tabIndex : undefined,
|
|
@@ -61,7 +65,8 @@ export const FlatTableCell = ({
|
|
|
61
65
|
onFocus: handleOnFocus
|
|
62
66
|
}), /*#__PURE__*/React.createElement(StyledCellContent, {
|
|
63
67
|
title: truncate && !title && typeof children === "string" ? children : title,
|
|
64
|
-
expandable: expandable
|
|
68
|
+
expandable: expandable,
|
|
69
|
+
"data-role": "flat-table-cell-content"
|
|
65
70
|
}, expandable && isFirstCell && /*#__PURE__*/React.createElement(Icon, {
|
|
66
71
|
type: "chevron_down_thick",
|
|
67
72
|
mr: "8px"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
3
4
|
import { TableBorderSize, TableCellAlign } from "..";
|
|
4
|
-
export interface FlatTableHeaderProps extends PaddingProps {
|
|
5
|
+
export interface FlatTableHeaderProps extends PaddingProps, Omit<TagProps, "data-component"> {
|
|
5
6
|
/** Content alignment */
|
|
6
7
|
align?: TableCellAlign;
|
|
7
8
|
/** If true sets alternative background color */
|
|
@@ -22,7 +23,7 @@ export interface FlatTableHeaderProps extends PaddingProps {
|
|
|
22
23
|
id?: string;
|
|
23
24
|
}
|
|
24
25
|
export declare const FlatTableHeader: {
|
|
25
|
-
({ align, children, colspan, rowspan, width, py, px, id, ...rest }: FlatTableHeaderProps): React.JSX.Element;
|
|
26
|
+
({ align, children, colspan, rowspan, width, py, px, id, "data-element": dataElement, "data-role": dataRole, ...rest }: FlatTableHeaderProps): React.JSX.Element;
|
|
26
27
|
displayName: string;
|
|
27
28
|
};
|
|
28
29
|
export default FlatTableHeader;
|
|
@@ -14,6 +14,8 @@ export const FlatTableHeader = ({
|
|
|
14
14
|
py,
|
|
15
15
|
px,
|
|
16
16
|
id,
|
|
17
|
+
"data-element": dataElement,
|
|
18
|
+
"data-role": dataRole,
|
|
17
19
|
...rest
|
|
18
20
|
}) => {
|
|
19
21
|
const ref = useRef(null);
|
|
@@ -33,8 +35,7 @@ export const FlatTableHeader = ({
|
|
|
33
35
|
makeCellSticky: makeCellSticky,
|
|
34
36
|
className: makeCellSticky ? "isSticky" : undefined,
|
|
35
37
|
align: align,
|
|
36
|
-
colorTheme: colorTheme
|
|
37
|
-
"data-element": "flat-table-header"
|
|
38
|
+
colorTheme: colorTheme
|
|
38
39
|
}, colspan !== undefined && {
|
|
39
40
|
colSpan: Number(colspan)
|
|
40
41
|
}, rowspan !== undefined && {
|
|
@@ -44,8 +45,13 @@ export const FlatTableHeader = ({
|
|
|
44
45
|
py: py,
|
|
45
46
|
px: px
|
|
46
47
|
}, rest, {
|
|
48
|
+
"data-component": "flat-table-header",
|
|
49
|
+
"data-element": dataElement || "flat-table-header",
|
|
50
|
+
"data-role": dataRole,
|
|
47
51
|
id: internalId.current
|
|
48
|
-
}), /*#__PURE__*/React.createElement("div",
|
|
52
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
"data-role": "flat-table-header-content"
|
|
54
|
+
}, children));
|
|
49
55
|
};
|
|
50
56
|
FlatTableHeader.displayName = "FlatTableHeader";
|
|
51
57
|
export default FlatTableHeader;
|
|
@@ -131,6 +131,8 @@ const FlatTableRow = /*#__PURE__*/React.forwardRef(({
|
|
|
131
131
|
}
|
|
132
132
|
function handleCellKeyDown(ev) {
|
|
133
133
|
const isEnterOrSpaceKey = Event.isEnterKey(ev) || Event.isSpaceKey(ev);
|
|
134
|
+
|
|
135
|
+
/* istanbul ignore else */
|
|
134
136
|
if (isEnterOrSpaceKey) {
|
|
135
137
|
ev.preventDefault();
|
|
136
138
|
toggleExpanded();
|
package/esm/components/flat-table/flat-table-row-header/flat-table-row-header.component.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
3
|
import { TableBorderSize, TableCellAlign } from "..";
|
|
4
4
|
import { TagProps } from "../../../__internal__/utils/helpers/tags/tags";
|
|
5
|
-
export interface FlatTableRowHeaderProps extends PaddingProps, TagProps {
|
|
5
|
+
export interface FlatTableRowHeaderProps extends PaddingProps, Omit<TagProps, "data-component"> {
|
|
6
6
|
/** Content alignment */
|
|
7
7
|
align?: TableCellAlign;
|
|
8
8
|
/** RowHeader content */
|
|
@@ -41,6 +41,7 @@ export const FlatTableRowHeader = ({
|
|
|
41
41
|
bringToFront(ev, "TH");
|
|
42
42
|
};
|
|
43
43
|
const handleOnKeyDown = useCallback(ev => {
|
|
44
|
+
/* istanbul ignore else */
|
|
44
45
|
if (isExpandableCell && onKeyDown) {
|
|
45
46
|
onKeyDown(ev);
|
|
46
47
|
}
|
|
@@ -48,11 +49,7 @@ export const FlatTableRowHeader = ({
|
|
|
48
49
|
return /*#__PURE__*/React.createElement(StyledFlatTableRowHeader, _extends({
|
|
49
50
|
leftPosition: stickyAlignment === "left" ? leftPosition || 0 : undefined,
|
|
50
51
|
rightPosition: stickyAlignment === "right" ? rightPosition || 0 : undefined,
|
|
51
|
-
align: align
|
|
52
|
-
}, tagComponent("flat-table-row-header", {
|
|
53
|
-
"data-element": "flat-table-row-header",
|
|
54
|
-
...rest
|
|
55
|
-
}), {
|
|
52
|
+
align: align,
|
|
56
53
|
width: width,
|
|
57
54
|
py: py || "10px",
|
|
58
55
|
px: px || 3,
|
|
@@ -68,13 +65,17 @@ export const FlatTableRowHeader = ({
|
|
|
68
65
|
rowSpan: Number(rowspan)
|
|
69
66
|
}, {
|
|
70
67
|
"data-selected": isInSelectedRow && isExpandableCell,
|
|
71
|
-
"data-highlighted": isInHighlightedRow && isExpandableCell
|
|
72
|
-
}, rest, {
|
|
73
|
-
id: internalId.current,
|
|
68
|
+
"data-highlighted": isInHighlightedRow && isExpandableCell,
|
|
74
69
|
onFocus: handleOnFocus
|
|
70
|
+
}, rest, tagComponent("flat-table-row-header", {
|
|
71
|
+
"data-element": "flat-table-row-header",
|
|
72
|
+
...rest
|
|
73
|
+
}), {
|
|
74
|
+
id: internalId.current
|
|
75
75
|
}), /*#__PURE__*/React.createElement(StyledFlatTableRowHeaderContent, {
|
|
76
76
|
title: truncate && !title && typeof children === "string" ? children : title,
|
|
77
|
-
expandable: expandable
|
|
77
|
+
expandable: expandable,
|
|
78
|
+
"data-role": "flat-table-row-header-content"
|
|
78
79
|
}, expandable && isFirstCell && /*#__PURE__*/React.createElement(Icon, {
|
|
79
80
|
type: "chevron_down_thick",
|
|
80
81
|
mr: "8px"
|
|
@@ -50,7 +50,7 @@ const GroupedCharacter = /*#__PURE__*/React.forwardRef(({
|
|
|
50
50
|
const {
|
|
51
51
|
selectionEnd
|
|
52
52
|
} = target;
|
|
53
|
-
let newCursorPos = selectionEnd ?? 0;
|
|
53
|
+
let newCursorPos = selectionEnd ?? /* istanbul ignore next */0;
|
|
54
54
|
const rawValue = sanitizeValue(target.value);
|
|
55
55
|
const formattedValue = formatValue(rawValue);
|
|
56
56
|
const isLastPosition = target.value.length === newCursorPos;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./loader-star.component";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface StarProps {
|
|
2
|
+
starContainerClassName: "star-1" | "star-2" | "star-3";
|
|
3
|
+
gradientId: "gradient1" | "gradient2" | "gradient3";
|
|
4
|
+
}
|
|
5
|
+
declare const Star: {
|
|
6
|
+
({ starContainerClassName, gradientId, }: StarProps): JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
export default Star;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import { GradientStopBottom, GradientStopTop, StyledLoaderStarContainer, StyledStarSVG } from "./star.style";
|
|
4
|
+
const Star = ({
|
|
5
|
+
starContainerClassName,
|
|
6
|
+
gradientId
|
|
7
|
+
}) => {
|
|
8
|
+
return /*#__PURE__*/React.createElement(StyledLoaderStarContainer, {
|
|
9
|
+
"data-component": "star",
|
|
10
|
+
role: "presentation",
|
|
11
|
+
className: starContainerClassName
|
|
12
|
+
}, /*#__PURE__*/React.createElement(StyledStarSVG, {
|
|
13
|
+
className: "ai-star-svg",
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
viewBox: "0 0 217 216"
|
|
16
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
17
|
+
className: "ai-star-path",
|
|
18
|
+
fill: "#000",
|
|
19
|
+
fillRule: "evenodd",
|
|
20
|
+
d: "M108.502 215.994c-.166.006-.334.006-.502.006-7.218 0-11.975-3.217-15.497-8.335-4.396-5.656-7.56-13.591-10.338-21.896l-.597-1.807-.667-2.063-.91-2.87-1.225-3.904c-1.831-5.82-3.65-11.42-5.751-16.135-1.456-2.661-3.075-5.078-4.921-7.146-.356-.391-.72-.777-1.094-1.156-4.054-4.038-9.808-7.093-16.262-9.726-14.49-4.937-33.33-8.698-43.486-17.634C2.766 119.712 0 114.918 0 108l.003-.413c.108-6.697 2.852-11.372 7.25-14.916 10.155-8.935 28.995-12.696 43.485-17.633C57.192 72.405 62.946 69.35 67 65.312c.373-.38.738-.765 1.094-1.156 1.846-2.068 3.465-4.485 4.922-7.145 2.567-5.764 4.713-12.849 6.976-20.04l.91-2.87.666-2.063.338-1.028c2.84-8.586 6.063-16.843 10.598-22.675C95.954 3.32 100.592.13 107.57.004L108 0c.168 0 .336 0 .502.006L109 0l.405.003c6.999.119 11.645 3.316 15.102 8.347 5.071 6.529 8.5 16.09 11.592 25.75l.335 1.054 2.362 7.501c1.645 5.178 3.304 10.125 5.19 14.358 1.456 2.66 3.074 5.075 4.92 7.142.356.392.72.778 1.094 1.157 4.054 4.038 9.808 7.093 16.262 9.726 14.49 4.937 33.33 8.698 43.486 17.634C214.234 96.288 217 101.082 217 108c0 6.918-2.766 11.712-7.252 15.328-10.156 8.936-28.996 12.697-43.486 17.634-6.454 2.633-12.208 5.688-16.262 9.726-.373.38-.738.765-1.094 1.157-1.846 2.067-3.464 4.482-4.92 7.142-1.886 4.233-3.545 9.18-5.19 14.358l-2.362 7.5-.335 1.054c-3.091 9.66-6.521 19.222-11.592 25.751-3.524 5.127-8.282 8.35-15.507 8.35l-.498-.006Z"
|
|
21
|
+
}), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
22
|
+
id: gradientId,
|
|
23
|
+
x1: "0%",
|
|
24
|
+
y1: "0%",
|
|
25
|
+
x2: "100%",
|
|
26
|
+
y2: "100%"
|
|
27
|
+
}, /*#__PURE__*/React.createElement(GradientStopTop, {
|
|
28
|
+
offset: "0%"
|
|
29
|
+
}), /*#__PURE__*/React.createElement(GradientStopBottom, {
|
|
30
|
+
offset: "100%"
|
|
31
|
+
})))));
|
|
32
|
+
};
|
|
33
|
+
if (process.env.NODE_ENV !== "production") {
|
|
34
|
+
Star.propTypes = {
|
|
35
|
+
"gradientId": PropTypes.oneOf(["gradient1", "gradient2", "gradient3"]).isRequired,
|
|
36
|
+
"starContainerClassName": PropTypes.oneOf(["star-1", "star-2", "star-3"]).isRequired
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
Star.displayName = "Star";
|
|
40
|
+
export default Star;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const StyledStarSVG: import("styled-components").StyledComponent<"svg", any, {}, never>;
|
|
2
|
+
export declare const GradientStopTop: import("styled-components").StyledComponent<"stop", any, {}, never>;
|
|
3
|
+
export declare const GradientStopBottom: import("styled-components").StyledComponent<"stop", any, {}, never>;
|
|
4
|
+
export declare const StyledLoaderStarContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import styled, { keyframes } from "styled-components";
|
|
2
|
+
const animateStar = keyframes`
|
|
3
|
+
0% {
|
|
4
|
+
transform: translate3d(0px, 0px, 0px) scale(0.3);
|
|
5
|
+
opacity: 0;
|
|
6
|
+
}
|
|
7
|
+
10% {
|
|
8
|
+
transform: translate3d(0px, 0px, 0px) scale(0.3);
|
|
9
|
+
opacity: 0;
|
|
10
|
+
}
|
|
11
|
+
20% {
|
|
12
|
+
transform: translate3d(0px, 0px, 0px) scale(0.6);
|
|
13
|
+
opacity: 1;
|
|
14
|
+
}
|
|
15
|
+
35% {
|
|
16
|
+
transform: translate3d(0px, 0px, 0px) scale(0.6);
|
|
17
|
+
opacity: 1;
|
|
18
|
+
}
|
|
19
|
+
55% {
|
|
20
|
+
transform: translate3d(16px, -12px, 0px) scale(1.4);
|
|
21
|
+
opacity: 1;
|
|
22
|
+
}
|
|
23
|
+
60% {
|
|
24
|
+
transform: translate3d(16px, -12px, 0px) scale(1.4);
|
|
25
|
+
opacity: 1;
|
|
26
|
+
}
|
|
27
|
+
90% {
|
|
28
|
+
transform: translate3d(0px, -24px, 0px) scale(0.8);
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
100% {
|
|
32
|
+
transform: translate3d(0px, -24px, 0px) scale(0.6);
|
|
33
|
+
opacity: 0;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
const animateStopTop = keyframes`
|
|
37
|
+
0% { stop-color: #13a038; }
|
|
38
|
+
10% { stop-color: #13a038; }
|
|
39
|
+
50% { stop-color: #0092db; }
|
|
40
|
+
90% { stop-color: #8f49fe; }
|
|
41
|
+
100% { stop-color: #8f49fe; }
|
|
42
|
+
`;
|
|
43
|
+
const animateStopBottom = keyframes`
|
|
44
|
+
0% { stop-color: #13a038; }
|
|
45
|
+
10% { stop-color: #13a038; }
|
|
46
|
+
50% { stop-color: #13a038; }
|
|
47
|
+
90% { stop-color: #0092db; }
|
|
48
|
+
100% { stop-color: #0092db; }
|
|
49
|
+
`;
|
|
50
|
+
const time = "3s";
|
|
51
|
+
export const StyledStarSVG = styled.svg`
|
|
52
|
+
animation: ${animateStar} ${time} ease-in-out forwards infinite;
|
|
53
|
+
height: var(--sizing200);
|
|
54
|
+
opacity: 0;
|
|
55
|
+
width: var(--sizing200);
|
|
56
|
+
`;
|
|
57
|
+
export const GradientStopTop = styled.stop`
|
|
58
|
+
animation: ${animateStopTop} ${time} ease-in-out forwards infinite;
|
|
59
|
+
`;
|
|
60
|
+
export const GradientStopBottom = styled.stop`
|
|
61
|
+
animation: ${animateStopBottom} ${time} ease-in-out forwards infinite;
|
|
62
|
+
`;
|
|
63
|
+
export const StyledLoaderStarContainer = styled.div`
|
|
64
|
+
bottom: 0;
|
|
65
|
+
height: var(--sizing200);
|
|
66
|
+
left: 0;
|
|
67
|
+
position: absolute;
|
|
68
|
+
width: var(--sizing200);
|
|
69
|
+
|
|
70
|
+
&.star-1 {
|
|
71
|
+
.ai-star-path {
|
|
72
|
+
fill: url(#gradient1);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
${StyledStarSVG} {
|
|
76
|
+
animation-delay: -2s;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
#gradient1 {
|
|
80
|
+
${GradientStopTop} {
|
|
81
|
+
animation-delay: -2s;
|
|
82
|
+
}
|
|
83
|
+
${GradientStopBottom} {
|
|
84
|
+
animation-delay: -2s;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&.star-2 {
|
|
90
|
+
.ai-star-path {
|
|
91
|
+
fill: url(#gradient2);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
${StyledStarSVG} {
|
|
95
|
+
animation-delay: -1s;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#gradient2 {
|
|
99
|
+
${GradientStopTop} {
|
|
100
|
+
animation-delay: -1s;
|
|
101
|
+
}
|
|
102
|
+
${GradientStopBottom} {
|
|
103
|
+
animation-delay: -1s;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&.star-3 {
|
|
109
|
+
.ai-star-path {
|
|
110
|
+
fill: url(#gradient3);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
${StyledStarSVG} {
|
|
114
|
+
animation-delay: 0s;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#gradient3 {
|
|
118
|
+
${GradientStopTop} {
|
|
119
|
+
animation-delay: 0s;
|
|
120
|
+
}
|
|
121
|
+
${GradientStopBottom} {
|
|
122
|
+
animation-delay: 0s;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
2
|
+
export interface LoaderStarProps extends Omit<TagProps, "data-component"> {
|
|
3
|
+
/**
|
|
4
|
+
* The loaderStarLabel prop allows a specific label to be set.
|
|
5
|
+
* This label will be present if the user has `reduce-motion` enabled and will also be available to assistive technologies.
|
|
6
|
+
* By default the label will be `Loading...`.
|
|
7
|
+
*/
|
|
8
|
+
loaderStarLabel?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const LoaderStar: {
|
|
11
|
+
({ loaderStarLabel, ...rest }: LoaderStarProps): JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
export default LoaderStar;
|
|
@@ -0,0 +1,46 @@
|
|
|
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";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
5
|
+
import { StyledLoaderStarWrapper, StyledLabel, StyledStars } from "./loader-star.style";
|
|
6
|
+
import useLocale from "../../hooks/__internal__/useLocale";
|
|
7
|
+
import useMediaQuery from "../../hooks/useMediaQuery";
|
|
8
|
+
import Star from "./internal/star.component";
|
|
9
|
+
import Typography from "../typography";
|
|
10
|
+
const LoaderStar = ({
|
|
11
|
+
loaderStarLabel,
|
|
12
|
+
...rest
|
|
13
|
+
}) => {
|
|
14
|
+
const locale = useLocale();
|
|
15
|
+
const reduceMotion = !useMediaQuery("screen and (prefers-reduced-motion: no-preference)");
|
|
16
|
+
const label = /*#__PURE__*/React.createElement(StyledLabel, {
|
|
17
|
+
"data-role": "visible-label",
|
|
18
|
+
variant: "span",
|
|
19
|
+
fontWeight: "500"
|
|
20
|
+
}, loaderStarLabel || locale.loaderStar.loading());
|
|
21
|
+
return /*#__PURE__*/React.createElement(StyledLoaderStarWrapper, _extends({
|
|
22
|
+
role: "status"
|
|
23
|
+
}, tagComponent("loader-star", rest)), reduceMotion ? label : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledStars, null, /*#__PURE__*/React.createElement(Star, {
|
|
24
|
+
starContainerClassName: "star-1",
|
|
25
|
+
gradientId: "gradient1"
|
|
26
|
+
}), /*#__PURE__*/React.createElement(Star, {
|
|
27
|
+
starContainerClassName: "star-2",
|
|
28
|
+
gradientId: "gradient2"
|
|
29
|
+
}), /*#__PURE__*/React.createElement(Star, {
|
|
30
|
+
starContainerClassName: "star-3",
|
|
31
|
+
gradientId: "gradient3"
|
|
32
|
+
})), /*#__PURE__*/React.createElement(Typography, {
|
|
33
|
+
"data-role": "hidden-label",
|
|
34
|
+
variant: "span",
|
|
35
|
+
screenReaderOnly: true
|
|
36
|
+
}, loaderStarLabel || locale.loaderStar.loading())));
|
|
37
|
+
};
|
|
38
|
+
if (process.env.NODE_ENV !== "production") {
|
|
39
|
+
LoaderStar.propTypes = {
|
|
40
|
+
"data-element": PropTypes.string,
|
|
41
|
+
"data-role": PropTypes.string,
|
|
42
|
+
"loaderStarLabel": PropTypes.string
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
LoaderStar.displayName = "LoaderStar";
|
|
46
|
+
export default LoaderStar;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LoaderStarProps } from "./loader-star.component";
|
|
3
|
+
export declare const StyledLoaderStarWrapper: import("styled-components").StyledComponent<"div", any, LoaderStarProps, 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, wordBreak, 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, {}, never>;
|
|
8
|
+
export declare const StyledStars: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import Typography from "../typography";
|
|
3
|
+
export const StyledLoaderStarWrapper = styled.div`
|
|
4
|
+
position: relative;
|
|
5
|
+
width: max-content;
|
|
6
|
+
`;
|
|
7
|
+
export const StyledLabel = styled(Typography)`
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
text-align: center;
|
|
11
|
+
`;
|
|
12
|
+
export const StyledStars = styled.div`
|
|
13
|
+
width: 40px;
|
|
14
|
+
height: 40px;
|
|
15
|
+
`;
|
package/esm/locales/de-de.js
CHANGED
package/esm/locales/en-gb.js
CHANGED
package/esm/locales/es-es.js
CHANGED
package/esm/locales/fr-ca.js
CHANGED
package/esm/locales/fr-fr.js
CHANGED
package/esm/locales/locale.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
3
|
import { TableBorderSize, TableCellAlign } from "..";
|
|
4
|
-
|
|
4
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
5
|
+
export interface FlatTableCellProps extends PaddingProps, Omit<TagProps, "data-component"> {
|
|
5
6
|
/** Content alignment */
|
|
6
7
|
align?: TableCellAlign;
|
|
7
8
|
/** Cell content */
|
|
@@ -24,7 +25,7 @@ export interface FlatTableCellProps extends PaddingProps {
|
|
|
24
25
|
id?: string;
|
|
25
26
|
}
|
|
26
27
|
export declare const FlatTableCell: {
|
|
27
|
-
({ align, children, pl, width, truncate, title, colspan, rowspan, id, ...rest }: FlatTableCellProps): React.JSX.Element;
|
|
28
|
+
({ align, children, pl, width, truncate, title, colspan, rowspan, id, "data-element": dataElement, "data-role": dataRole, ...rest }: FlatTableCellProps): React.JSX.Element;
|
|
28
29
|
displayName: string;
|
|
29
30
|
};
|
|
30
31
|
export default FlatTableCell;
|
|
@@ -24,6 +24,8 @@ const FlatTableCell = ({
|
|
|
24
24
|
colspan,
|
|
25
25
|
rowspan,
|
|
26
26
|
id,
|
|
27
|
+
"data-element": dataElement,
|
|
28
|
+
"data-role": dataRole,
|
|
27
29
|
...rest
|
|
28
30
|
}) => {
|
|
29
31
|
const internalId = (0, _react.useRef)(id || (0, _guid.default)());
|
|
@@ -50,7 +52,9 @@ const FlatTableCell = ({
|
|
|
50
52
|
makeCellSticky: makeCellSticky,
|
|
51
53
|
className: makeCellSticky ? "isSticky" : undefined,
|
|
52
54
|
align: align,
|
|
53
|
-
"data-
|
|
55
|
+
"data-component": "flat-table-cell",
|
|
56
|
+
"data-element": dataElement || "flat-table-cell",
|
|
57
|
+
"data-role": dataRole,
|
|
54
58
|
pl: pl,
|
|
55
59
|
onClick: isExpandableCell ? onClick : undefined,
|
|
56
60
|
tabIndex: isExpandableCell ? tabIndex : undefined,
|
|
@@ -70,7 +74,8 @@ const FlatTableCell = ({
|
|
|
70
74
|
onFocus: handleOnFocus
|
|
71
75
|
}), /*#__PURE__*/_react.default.createElement(_flatTableCell.StyledCellContent, {
|
|
72
76
|
title: truncate && !title && typeof children === "string" ? children : title,
|
|
73
|
-
expandable: expandable
|
|
77
|
+
expandable: expandable,
|
|
78
|
+
"data-role": "flat-table-cell-content"
|
|
74
79
|
}, expandable && isFirstCell && /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
75
80
|
type: "chevron_down_thick",
|
|
76
81
|
mr: "8px"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
|
+
import { TagProps } from "../../../__internal__/utils/helpers/tags";
|
|
3
4
|
import { TableBorderSize, TableCellAlign } from "..";
|
|
4
|
-
export interface FlatTableHeaderProps extends PaddingProps {
|
|
5
|
+
export interface FlatTableHeaderProps extends PaddingProps, Omit<TagProps, "data-component"> {
|
|
5
6
|
/** Content alignment */
|
|
6
7
|
align?: TableCellAlign;
|
|
7
8
|
/** If true sets alternative background color */
|
|
@@ -22,7 +23,7 @@ export interface FlatTableHeaderProps extends PaddingProps {
|
|
|
22
23
|
id?: string;
|
|
23
24
|
}
|
|
24
25
|
export declare const FlatTableHeader: {
|
|
25
|
-
({ align, children, colspan, rowspan, width, py, px, id, ...rest }: FlatTableHeaderProps): React.JSX.Element;
|
|
26
|
+
({ align, children, colspan, rowspan, width, py, px, id, "data-element": dataElement, "data-role": dataRole, ...rest }: FlatTableHeaderProps): React.JSX.Element;
|
|
26
27
|
displayName: string;
|
|
27
28
|
};
|
|
28
29
|
export default FlatTableHeader;
|
|
@@ -23,6 +23,8 @@ const FlatTableHeader = ({
|
|
|
23
23
|
py,
|
|
24
24
|
px,
|
|
25
25
|
id,
|
|
26
|
+
"data-element": dataElement,
|
|
27
|
+
"data-role": dataRole,
|
|
26
28
|
...rest
|
|
27
29
|
}) => {
|
|
28
30
|
const ref = (0, _react.useRef)(null);
|
|
@@ -42,8 +44,7 @@ const FlatTableHeader = ({
|
|
|
42
44
|
makeCellSticky: makeCellSticky,
|
|
43
45
|
className: makeCellSticky ? "isSticky" : undefined,
|
|
44
46
|
align: align,
|
|
45
|
-
colorTheme: colorTheme
|
|
46
|
-
"data-element": "flat-table-header"
|
|
47
|
+
colorTheme: colorTheme
|
|
47
48
|
}, colspan !== undefined && {
|
|
48
49
|
colSpan: Number(colspan)
|
|
49
50
|
}, rowspan !== undefined && {
|
|
@@ -53,8 +54,13 @@ const FlatTableHeader = ({
|
|
|
53
54
|
py: py,
|
|
54
55
|
px: px
|
|
55
56
|
}, rest, {
|
|
57
|
+
"data-component": "flat-table-header",
|
|
58
|
+
"data-element": dataElement || "flat-table-header",
|
|
59
|
+
"data-role": dataRole,
|
|
56
60
|
id: internalId.current
|
|
57
|
-
}), /*#__PURE__*/_react.default.createElement("div",
|
|
61
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
62
|
+
"data-role": "flat-table-header-content"
|
|
63
|
+
}, children));
|
|
58
64
|
};
|
|
59
65
|
exports.FlatTableHeader = FlatTableHeader;
|
|
60
66
|
FlatTableHeader.displayName = "FlatTableHeader";
|
|
@@ -140,6 +140,8 @@ const FlatTableRow = exports.FlatTableRow = /*#__PURE__*/_react.default.forwardR
|
|
|
140
140
|
}
|
|
141
141
|
function handleCellKeyDown(ev) {
|
|
142
142
|
const isEnterOrSpaceKey = _events.default.isEnterKey(ev) || _events.default.isSpaceKey(ev);
|
|
143
|
+
|
|
144
|
+
/* istanbul ignore else */
|
|
143
145
|
if (isEnterOrSpaceKey) {
|
|
144
146
|
ev.preventDefault();
|
|
145
147
|
toggleExpanded();
|
package/lib/components/flat-table/flat-table-row-header/flat-table-row-header.component.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { PaddingProps } from "styled-system";
|
|
3
3
|
import { TableBorderSize, TableCellAlign } from "..";
|
|
4
4
|
import { TagProps } from "../../../__internal__/utils/helpers/tags/tags";
|
|
5
|
-
export interface FlatTableRowHeaderProps extends PaddingProps, TagProps {
|
|
5
|
+
export interface FlatTableRowHeaderProps extends PaddingProps, Omit<TagProps, "data-component"> {
|
|
6
6
|
/** Content alignment */
|
|
7
7
|
align?: TableCellAlign;
|
|
8
8
|
/** RowHeader content */
|
|
@@ -50,6 +50,7 @@ const FlatTableRowHeader = ({
|
|
|
50
50
|
bringToFront(ev, "TH");
|
|
51
51
|
};
|
|
52
52
|
const handleOnKeyDown = (0, _react.useCallback)(ev => {
|
|
53
|
+
/* istanbul ignore else */
|
|
53
54
|
if (isExpandableCell && onKeyDown) {
|
|
54
55
|
onKeyDown(ev);
|
|
55
56
|
}
|
|
@@ -57,11 +58,7 @@ const FlatTableRowHeader = ({
|
|
|
57
58
|
return /*#__PURE__*/_react.default.createElement(_flatTableRowHeader.StyledFlatTableRowHeader, _extends({
|
|
58
59
|
leftPosition: stickyAlignment === "left" ? leftPosition || 0 : undefined,
|
|
59
60
|
rightPosition: stickyAlignment === "right" ? rightPosition || 0 : undefined,
|
|
60
|
-
align: align
|
|
61
|
-
}, (0, _tags.default)("flat-table-row-header", {
|
|
62
|
-
"data-element": "flat-table-row-header",
|
|
63
|
-
...rest
|
|
64
|
-
}), {
|
|
61
|
+
align: align,
|
|
65
62
|
width: width,
|
|
66
63
|
py: py || "10px",
|
|
67
64
|
px: px || 3,
|
|
@@ -77,13 +74,17 @@ const FlatTableRowHeader = ({
|
|
|
77
74
|
rowSpan: Number(rowspan)
|
|
78
75
|
}, {
|
|
79
76
|
"data-selected": isInSelectedRow && isExpandableCell,
|
|
80
|
-
"data-highlighted": isInHighlightedRow && isExpandableCell
|
|
81
|
-
}, rest, {
|
|
82
|
-
id: internalId.current,
|
|
77
|
+
"data-highlighted": isInHighlightedRow && isExpandableCell,
|
|
83
78
|
onFocus: handleOnFocus
|
|
79
|
+
}, rest, (0, _tags.default)("flat-table-row-header", {
|
|
80
|
+
"data-element": "flat-table-row-header",
|
|
81
|
+
...rest
|
|
82
|
+
}), {
|
|
83
|
+
id: internalId.current
|
|
84
84
|
}), /*#__PURE__*/_react.default.createElement(_flatTableRowHeader.StyledFlatTableRowHeaderContent, {
|
|
85
85
|
title: truncate && !title && typeof children === "string" ? children : title,
|
|
86
|
-
expandable: expandable
|
|
86
|
+
expandable: expandable,
|
|
87
|
+
"data-role": "flat-table-row-header-content"
|
|
87
88
|
}, expandable && isFirstCell && /*#__PURE__*/_react.default.createElement(_icon.default, {
|
|
88
89
|
type: "chevron_down_thick",
|
|
89
90
|
mr: "8px"
|
|
@@ -59,7 +59,7 @@ const GroupedCharacter = exports.GroupedCharacter = /*#__PURE__*/_react.default.
|
|
|
59
59
|
const {
|
|
60
60
|
selectionEnd
|
|
61
61
|
} = target;
|
|
62
|
-
let newCursorPos = selectionEnd ?? 0;
|
|
62
|
+
let newCursorPos = selectionEnd ?? /* istanbul ignore next */0;
|
|
63
63
|
const rawValue = sanitizeValue(target.value);
|
|
64
64
|
const formattedValue = formatValue(rawValue);
|
|
65
65
|
const isLastPosition = target.value.length === newCursorPos;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _loaderStar.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _loaderStar = _interopRequireDefault(require("./loader-star.component"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface StarProps {
|
|
2
|
+
starContainerClassName: "star-1" | "star-2" | "star-3";
|
|
3
|
+
gradientId: "gradient1" | "gradient2" | "gradient3";
|
|
4
|
+
}
|
|
5
|
+
declare const Star: {
|
|
6
|
+
({ starContainerClassName, gradientId, }: StarProps): JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
export default Star;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _star = require("./star.style");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const Star = ({
|
|
12
|
+
starContainerClassName,
|
|
13
|
+
gradientId
|
|
14
|
+
}) => {
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_star.StyledLoaderStarContainer, {
|
|
16
|
+
"data-component": "star",
|
|
17
|
+
role: "presentation",
|
|
18
|
+
className: starContainerClassName
|
|
19
|
+
}, /*#__PURE__*/_react.default.createElement(_star.StyledStarSVG, {
|
|
20
|
+
className: "ai-star-svg",
|
|
21
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
22
|
+
viewBox: "0 0 217 216"
|
|
23
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
24
|
+
className: "ai-star-path",
|
|
25
|
+
fill: "#000",
|
|
26
|
+
fillRule: "evenodd",
|
|
27
|
+
d: "M108.502 215.994c-.166.006-.334.006-.502.006-7.218 0-11.975-3.217-15.497-8.335-4.396-5.656-7.56-13.591-10.338-21.896l-.597-1.807-.667-2.063-.91-2.87-1.225-3.904c-1.831-5.82-3.65-11.42-5.751-16.135-1.456-2.661-3.075-5.078-4.921-7.146-.356-.391-.72-.777-1.094-1.156-4.054-4.038-9.808-7.093-16.262-9.726-14.49-4.937-33.33-8.698-43.486-17.634C2.766 119.712 0 114.918 0 108l.003-.413c.108-6.697 2.852-11.372 7.25-14.916 10.155-8.935 28.995-12.696 43.485-17.633C57.192 72.405 62.946 69.35 67 65.312c.373-.38.738-.765 1.094-1.156 1.846-2.068 3.465-4.485 4.922-7.145 2.567-5.764 4.713-12.849 6.976-20.04l.91-2.87.666-2.063.338-1.028c2.84-8.586 6.063-16.843 10.598-22.675C95.954 3.32 100.592.13 107.57.004L108 0c.168 0 .336 0 .502.006L109 0l.405.003c6.999.119 11.645 3.316 15.102 8.347 5.071 6.529 8.5 16.09 11.592 25.75l.335 1.054 2.362 7.501c1.645 5.178 3.304 10.125 5.19 14.358 1.456 2.66 3.074 5.075 4.92 7.142.356.392.72.778 1.094 1.157 4.054 4.038 9.808 7.093 16.262 9.726 14.49 4.937 33.33 8.698 43.486 17.634C214.234 96.288 217 101.082 217 108c0 6.918-2.766 11.712-7.252 15.328-10.156 8.936-28.996 12.697-43.486 17.634-6.454 2.633-12.208 5.688-16.262 9.726-.373.38-.738.765-1.094 1.157-1.846 2.067-3.464 4.482-4.92 7.142-1.886 4.233-3.545 9.18-5.19 14.358l-2.362 7.5-.335 1.054c-3.091 9.66-6.521 19.222-11.592 25.751-3.524 5.127-8.282 8.35-15.507 8.35l-.498-.006Z"
|
|
28
|
+
}), /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("linearGradient", {
|
|
29
|
+
id: gradientId,
|
|
30
|
+
x1: "0%",
|
|
31
|
+
y1: "0%",
|
|
32
|
+
x2: "100%",
|
|
33
|
+
y2: "100%"
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement(_star.GradientStopTop, {
|
|
35
|
+
offset: "0%"
|
|
36
|
+
}), /*#__PURE__*/_react.default.createElement(_star.GradientStopBottom, {
|
|
37
|
+
offset: "100%"
|
|
38
|
+
})))));
|
|
39
|
+
};
|
|
40
|
+
if (process.env.NODE_ENV !== "production") {
|
|
41
|
+
Star.propTypes = {
|
|
42
|
+
"gradientId": _propTypes.default.oneOf(["gradient1", "gradient2", "gradient3"]).isRequired,
|
|
43
|
+
"starContainerClassName": _propTypes.default.oneOf(["star-1", "star-2", "star-3"]).isRequired
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
Star.displayName = "Star";
|
|
47
|
+
var _default = exports.default = Star;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const StyledStarSVG: import("styled-components").StyledComponent<"svg", any, {}, never>;
|
|
2
|
+
export declare const GradientStopTop: import("styled-components").StyledComponent<"stop", any, {}, never>;
|
|
3
|
+
export declare const GradientStopBottom: import("styled-components").StyledComponent<"stop", any, {}, never>;
|
|
4
|
+
export declare const StyledLoaderStarContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledStarSVG = exports.StyledLoaderStarContainer = exports.GradientStopTop = exports.GradientStopBottom = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
const animateStar = (0, _styledComponents.keyframes)`
|
|
11
|
+
0% {
|
|
12
|
+
transform: translate3d(0px, 0px, 0px) scale(0.3);
|
|
13
|
+
opacity: 0;
|
|
14
|
+
}
|
|
15
|
+
10% {
|
|
16
|
+
transform: translate3d(0px, 0px, 0px) scale(0.3);
|
|
17
|
+
opacity: 0;
|
|
18
|
+
}
|
|
19
|
+
20% {
|
|
20
|
+
transform: translate3d(0px, 0px, 0px) scale(0.6);
|
|
21
|
+
opacity: 1;
|
|
22
|
+
}
|
|
23
|
+
35% {
|
|
24
|
+
transform: translate3d(0px, 0px, 0px) scale(0.6);
|
|
25
|
+
opacity: 1;
|
|
26
|
+
}
|
|
27
|
+
55% {
|
|
28
|
+
transform: translate3d(16px, -12px, 0px) scale(1.4);
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
60% {
|
|
32
|
+
transform: translate3d(16px, -12px, 0px) scale(1.4);
|
|
33
|
+
opacity: 1;
|
|
34
|
+
}
|
|
35
|
+
90% {
|
|
36
|
+
transform: translate3d(0px, -24px, 0px) scale(0.8);
|
|
37
|
+
opacity: 1;
|
|
38
|
+
}
|
|
39
|
+
100% {
|
|
40
|
+
transform: translate3d(0px, -24px, 0px) scale(0.6);
|
|
41
|
+
opacity: 0;
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
const animateStopTop = (0, _styledComponents.keyframes)`
|
|
45
|
+
0% { stop-color: #13a038; }
|
|
46
|
+
10% { stop-color: #13a038; }
|
|
47
|
+
50% { stop-color: #0092db; }
|
|
48
|
+
90% { stop-color: #8f49fe; }
|
|
49
|
+
100% { stop-color: #8f49fe; }
|
|
50
|
+
`;
|
|
51
|
+
const animateStopBottom = (0, _styledComponents.keyframes)`
|
|
52
|
+
0% { stop-color: #13a038; }
|
|
53
|
+
10% { stop-color: #13a038; }
|
|
54
|
+
50% { stop-color: #13a038; }
|
|
55
|
+
90% { stop-color: #0092db; }
|
|
56
|
+
100% { stop-color: #0092db; }
|
|
57
|
+
`;
|
|
58
|
+
const time = "3s";
|
|
59
|
+
const StyledStarSVG = exports.StyledStarSVG = _styledComponents.default.svg`
|
|
60
|
+
animation: ${animateStar} ${time} ease-in-out forwards infinite;
|
|
61
|
+
height: var(--sizing200);
|
|
62
|
+
opacity: 0;
|
|
63
|
+
width: var(--sizing200);
|
|
64
|
+
`;
|
|
65
|
+
const GradientStopTop = exports.GradientStopTop = _styledComponents.default.stop`
|
|
66
|
+
animation: ${animateStopTop} ${time} ease-in-out forwards infinite;
|
|
67
|
+
`;
|
|
68
|
+
const GradientStopBottom = exports.GradientStopBottom = _styledComponents.default.stop`
|
|
69
|
+
animation: ${animateStopBottom} ${time} ease-in-out forwards infinite;
|
|
70
|
+
`;
|
|
71
|
+
const StyledLoaderStarContainer = exports.StyledLoaderStarContainer = _styledComponents.default.div`
|
|
72
|
+
bottom: 0;
|
|
73
|
+
height: var(--sizing200);
|
|
74
|
+
left: 0;
|
|
75
|
+
position: absolute;
|
|
76
|
+
width: var(--sizing200);
|
|
77
|
+
|
|
78
|
+
&.star-1 {
|
|
79
|
+
.ai-star-path {
|
|
80
|
+
fill: url(#gradient1);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
${StyledStarSVG} {
|
|
84
|
+
animation-delay: -2s;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
#gradient1 {
|
|
88
|
+
${GradientStopTop} {
|
|
89
|
+
animation-delay: -2s;
|
|
90
|
+
}
|
|
91
|
+
${GradientStopBottom} {
|
|
92
|
+
animation-delay: -2s;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&.star-2 {
|
|
98
|
+
.ai-star-path {
|
|
99
|
+
fill: url(#gradient2);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
${StyledStarSVG} {
|
|
103
|
+
animation-delay: -1s;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
#gradient2 {
|
|
107
|
+
${GradientStopTop} {
|
|
108
|
+
animation-delay: -1s;
|
|
109
|
+
}
|
|
110
|
+
${GradientStopBottom} {
|
|
111
|
+
animation-delay: -1s;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&.star-3 {
|
|
117
|
+
.ai-star-path {
|
|
118
|
+
fill: url(#gradient3);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
${StyledStarSVG} {
|
|
122
|
+
animation-delay: 0s;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
#gradient3 {
|
|
126
|
+
${GradientStopTop} {
|
|
127
|
+
animation-delay: 0s;
|
|
128
|
+
}
|
|
129
|
+
${GradientStopBottom} {
|
|
130
|
+
animation-delay: 0s;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
|
|
2
|
+
export interface LoaderStarProps extends Omit<TagProps, "data-component"> {
|
|
3
|
+
/**
|
|
4
|
+
* The loaderStarLabel prop allows a specific label to be set.
|
|
5
|
+
* This label will be present if the user has `reduce-motion` enabled and will also be available to assistive technologies.
|
|
6
|
+
* By default the label will be `Loading...`.
|
|
7
|
+
*/
|
|
8
|
+
loaderStarLabel?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const LoaderStar: {
|
|
11
|
+
({ loaderStarLabel, ...rest }: LoaderStarProps): JSX.Element;
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
14
|
+
export default LoaderStar;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = 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 _loaderStar = require("./loader-star.style");
|
|
11
|
+
var _useLocale = _interopRequireDefault(require("../../hooks/__internal__/useLocale"));
|
|
12
|
+
var _useMediaQuery = _interopRequireDefault(require("../../hooks/useMediaQuery"));
|
|
13
|
+
var _star = _interopRequireDefault(require("./internal/star.component"));
|
|
14
|
+
var _typography = _interopRequireDefault(require("../typography"));
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
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); }
|
|
17
|
+
const LoaderStar = ({
|
|
18
|
+
loaderStarLabel,
|
|
19
|
+
...rest
|
|
20
|
+
}) => {
|
|
21
|
+
const locale = (0, _useLocale.default)();
|
|
22
|
+
const reduceMotion = !(0, _useMediaQuery.default)("screen and (prefers-reduced-motion: no-preference)");
|
|
23
|
+
const label = /*#__PURE__*/_react.default.createElement(_loaderStar.StyledLabel, {
|
|
24
|
+
"data-role": "visible-label",
|
|
25
|
+
variant: "span",
|
|
26
|
+
fontWeight: "500"
|
|
27
|
+
}, loaderStarLabel || locale.loaderStar.loading());
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_loaderStar.StyledLoaderStarWrapper, _extends({
|
|
29
|
+
role: "status"
|
|
30
|
+
}, (0, _tags.default)("loader-star", rest)), reduceMotion ? label : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_loaderStar.StyledStars, null, /*#__PURE__*/_react.default.createElement(_star.default, {
|
|
31
|
+
starContainerClassName: "star-1",
|
|
32
|
+
gradientId: "gradient1"
|
|
33
|
+
}), /*#__PURE__*/_react.default.createElement(_star.default, {
|
|
34
|
+
starContainerClassName: "star-2",
|
|
35
|
+
gradientId: "gradient2"
|
|
36
|
+
}), /*#__PURE__*/_react.default.createElement(_star.default, {
|
|
37
|
+
starContainerClassName: "star-3",
|
|
38
|
+
gradientId: "gradient3"
|
|
39
|
+
})), /*#__PURE__*/_react.default.createElement(_typography.default, {
|
|
40
|
+
"data-role": "hidden-label",
|
|
41
|
+
variant: "span",
|
|
42
|
+
screenReaderOnly: true
|
|
43
|
+
}, loaderStarLabel || locale.loaderStar.loading())));
|
|
44
|
+
};
|
|
45
|
+
if (process.env.NODE_ENV !== "production") {
|
|
46
|
+
LoaderStar.propTypes = {
|
|
47
|
+
"data-element": _propTypes.default.string,
|
|
48
|
+
"data-role": _propTypes.default.string,
|
|
49
|
+
"loaderStarLabel": _propTypes.default.string
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
LoaderStar.displayName = "LoaderStar";
|
|
53
|
+
var _default = exports.default = LoaderStar;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LoaderStarProps } from "./loader-star.component";
|
|
3
|
+
export declare const StyledLoaderStarWrapper: import("styled-components").StyledComponent<"div", any, LoaderStarProps, 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, wordBreak, 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, {}, never>;
|
|
8
|
+
export declare const StyledStars: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StyledStars = exports.StyledLoaderStarWrapper = exports.StyledLabel = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
8
|
+
var _typography = _interopRequireDefault(require("../typography"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const StyledLoaderStarWrapper = exports.StyledLoaderStarWrapper = _styledComponents.default.div`
|
|
11
|
+
position: relative;
|
|
12
|
+
width: max-content;
|
|
13
|
+
`;
|
|
14
|
+
const StyledLabel = exports.StyledLabel = (0, _styledComponents.default)(_typography.default)`
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
text-align: center;
|
|
18
|
+
`;
|
|
19
|
+
const StyledStars = exports.StyledStars = _styledComponents.default.div`
|
|
20
|
+
width: 40px;
|
|
21
|
+
height: 40px;
|
|
22
|
+
`;
|
package/lib/locales/de-de.js
CHANGED
package/lib/locales/en-gb.js
CHANGED
package/lib/locales/es-es.js
CHANGED
package/lib/locales/fr-ca.js
CHANGED
package/lib/locales/fr-fr.js
CHANGED
package/lib/locales/locale.d.ts
CHANGED