carbon-react 142.9.1 → 142.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/__internal__/popover/popover.component.d.ts +32 -0
- package/esm/__internal__/popover/popover.component.js +3 -1
- package/esm/__internal__/radio-button-mapper/radio-button-mapper.component.js +0 -1
- package/esm/components/flat-table/flat-table-row/flat-table-row.style.js +6 -1
- package/esm/components/flat-table/flat-table.component.d.ts +6 -1
- package/esm/components/flat-table/flat-table.component.js +5 -0
- package/esm/components/flat-table/flat-table.style.d.ts +2 -1
- package/esm/components/flat-table/flat-table.style.js +22 -8
- package/esm/components/link-preview/link-preview.style.js +1 -2
- package/esm/components/pages/pages.component.js +1 -0
- package/esm/components/preview/preview.component.d.ts +14 -4
- package/esm/components/preview/preview.component.js +19 -7
- package/esm/components/preview/preview.style.d.ts +10 -1
- package/esm/components/preview/preview.style.js +78 -4
- package/esm/components/search/search.component.js +3 -2
- package/lib/__internal__/popover/popover.component.d.ts +32 -0
- package/lib/__internal__/popover/popover.component.js +3 -1
- package/lib/__internal__/radio-button-mapper/radio-button-mapper.component.js +0 -1
- package/lib/components/flat-table/flat-table-row/flat-table-row.style.js +6 -1
- package/lib/components/flat-table/flat-table.component.d.ts +6 -1
- package/lib/components/flat-table/flat-table.component.js +5 -0
- package/lib/components/flat-table/flat-table.style.d.ts +2 -1
- package/lib/components/flat-table/flat-table.style.js +22 -8
- package/lib/components/link-preview/link-preview.style.js +2 -3
- package/lib/components/pages/pages.component.js +1 -0
- package/lib/components/preview/preview.component.d.ts +14 -4
- package/lib/components/preview/preview.component.js +18 -6
- package/lib/components/preview/preview.style.d.ts +10 -1
- package/lib/components/preview/preview.style.js +81 -5
- package/lib/components/search/search.component.js +3 -2
- package/package.json +4 -4
- package/esm/components/preview/__internal__/preview-placeholder.component.d.ts +0 -10
- package/esm/components/preview/__internal__/preview-placeholder.component.js +0 -19
- package/esm/components/preview/__internal__/preview-placeholder.style.d.ts +0 -7
- package/esm/components/preview/__internal__/preview-placeholder.style.js +0 -23
- package/lib/components/preview/__internal__/preview-placeholder.component.d.ts +0 -10
- package/lib/components/preview/__internal__/preview-placeholder.component.js +0 -26
- package/lib/components/preview/__internal__/preview-placeholder.style.d.ts +0 -7
- package/lib/components/preview/__internal__/preview-placeholder.style.js +0 -31
|
@@ -4,15 +4,47 @@ declare type CustomRefObject<T> = {
|
|
|
4
4
|
current?: T | null;
|
|
5
5
|
};
|
|
6
6
|
export interface PopoverProps {
|
|
7
|
+
/**
|
|
8
|
+
* Element to be positioned, has to be a single node and has to accept `ref` and `style` props.
|
|
9
|
+
*/
|
|
7
10
|
children: React.ReactElement;
|
|
11
|
+
/**
|
|
12
|
+
* Placement of children in relation to the reference element.
|
|
13
|
+
*/
|
|
8
14
|
placement?: Placement;
|
|
15
|
+
/**
|
|
16
|
+
* Disables interaction with background UI.
|
|
17
|
+
*/
|
|
9
18
|
disableBackgroundUI?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Optional middleware array, for more information go to:
|
|
21
|
+
* [https://floating-ui.com/docs/middleware](https://floating-ui.com/docs/middleware)
|
|
22
|
+
*/
|
|
10
23
|
middleware?: Middleware[];
|
|
24
|
+
/**
|
|
25
|
+
* When true, children are not rendered in portal.
|
|
26
|
+
*/
|
|
11
27
|
disablePortal?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Reference element, children will be positioned in relation to this element - should be a ref shaped object.
|
|
30
|
+
*/
|
|
12
31
|
reference: CustomRefObject<HTMLElement>;
|
|
32
|
+
/**
|
|
33
|
+
* Determines if the popover is currently open/visible or not. Defaults to true.
|
|
34
|
+
*/
|
|
13
35
|
isOpen?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to update the position of the floating element on every animation frame if required. This is optimized for performance but can still be costly. Use with caution!
|
|
38
|
+
* [https://floating-ui.com/docs/autoUpdate#animationframe](https://floating-ui.com/docs/autoUpdate#animationframe)
|
|
39
|
+
*/
|
|
14
40
|
animationFrame?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Optional strategy to use for positioning the floating element. Defaults to "absolute".
|
|
43
|
+
*/
|
|
15
44
|
popoverStrategy?: "absolute" | "fixed";
|
|
45
|
+
/**
|
|
46
|
+
* Allows child ref to be set via a prop instead of dynamically finding it via children iteration.
|
|
47
|
+
*/
|
|
16
48
|
childRefOverride?: MutableRefObject<HTMLDivElement | null>;
|
|
17
49
|
}
|
|
18
50
|
declare const Popover: ({ children, placement, disablePortal, reference, middleware, disableBackgroundUI, isOpen, animationFrame, popoverStrategy, childRefOverride, }: PopoverProps) => React.JSX.Element;
|
|
@@ -67,7 +67,9 @@ const Popover = ({
|
|
|
67
67
|
if (disableBackgroundUI) {
|
|
68
68
|
content = /*#__PURE__*/React.createElement(StyledPopoverContent, {
|
|
69
69
|
isOpen: isOpen
|
|
70
|
-
}, /*#__PURE__*/React.createElement(StyledBackdrop,
|
|
70
|
+
}, /*#__PURE__*/React.createElement(StyledBackdrop, {
|
|
71
|
+
"data-role": "popup-backdrop"
|
|
72
|
+
}, content));
|
|
71
73
|
}
|
|
72
74
|
if (disablePortal) {
|
|
73
75
|
return content;
|
|
@@ -171,7 +171,12 @@ const StyledFlatTableRow = styled.tr`
|
|
|
171
171
|
${StyledFlatTableHeader} {
|
|
172
172
|
border-bottom: 1px solid ${borderColor(colorTheme)};
|
|
173
173
|
|
|
174
|
-
${
|
|
174
|
+
${horizontalBorderSize !== "small" && css`
|
|
175
|
+
border-bottom: ${horizontalBorderSizes[horizontalBorderSize]} solid
|
|
176
|
+
var(--colorsUtilityMajor100);
|
|
177
|
+
`}
|
|
178
|
+
|
|
179
|
+
${!isInSidebar && !colorTheme?.includes("transparent") && `
|
|
175
180
|
:first-child {
|
|
176
181
|
border-left: 1px solid ${borderColor(colorTheme)};
|
|
177
182
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
|
+
import * as DesignTokens from "@sage/design-tokens/js/base/common";
|
|
3
4
|
export interface FlatTableProps extends MarginProps {
|
|
4
5
|
/** The HTML id of the element that contains a description of this table. */
|
|
5
6
|
ariaDescribedby?: string;
|
|
@@ -25,13 +26,17 @@ export interface FlatTableProps extends MarginProps {
|
|
|
25
26
|
size?: "compact" | "small" | "medium" | "large" | "extraLarge";
|
|
26
27
|
/** Applies max-height of 100% to FlatTable if true */
|
|
27
28
|
hasMaxHeight?: boolean;
|
|
29
|
+
/** Toggles the visibility of the table's outer left and right borders. When false, the left border of the first column and the right border of the last column are hidden. */
|
|
30
|
+
hasOuterVerticalBorders?: boolean;
|
|
31
|
+
/** Sets the border radius of the first and last cells in the last row. */
|
|
32
|
+
bottomBorderRadius?: Extract<keyof typeof DesignTokens, `borderRadius${number}`>;
|
|
28
33
|
/** Set the overflow X of the table wrapper. Any valid CSS string */
|
|
29
34
|
overflowX?: string;
|
|
30
35
|
/** Width of the table. Any valid CSS string */
|
|
31
36
|
width?: string;
|
|
32
37
|
}
|
|
33
38
|
export declare const FlatTable: {
|
|
34
|
-
({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, ariaDescribedby, minHeight, overflowX, width, ...rest }: FlatTableProps): React.JSX.Element;
|
|
39
|
+
({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, hasOuterVerticalBorders, bottomBorderRadius, ariaDescribedby, minHeight, overflowX, width, ...rest }: FlatTableProps): React.JSX.Element;
|
|
35
40
|
displayName: string;
|
|
36
41
|
};
|
|
37
42
|
export default FlatTable;
|
|
@@ -17,6 +17,8 @@ export const FlatTable = ({
|
|
|
17
17
|
isZebra,
|
|
18
18
|
size = "medium",
|
|
19
19
|
hasMaxHeight = false,
|
|
20
|
+
hasOuterVerticalBorders = true,
|
|
21
|
+
bottomBorderRadius = "borderRadius100",
|
|
20
22
|
ariaDescribedby,
|
|
21
23
|
minHeight,
|
|
22
24
|
overflowX,
|
|
@@ -134,6 +136,7 @@ export const FlatTable = ({
|
|
|
134
136
|
return /*#__PURE__*/React.createElement(StyledFlatTableWrapper, _extends({
|
|
135
137
|
ref: wrapperRef,
|
|
136
138
|
"data-component": "flat-table-wrapper",
|
|
139
|
+
"data-role": "flat-table-wrapper",
|
|
137
140
|
isInSidebar: isInSidebar,
|
|
138
141
|
hasStickyHead: hasStickyHead,
|
|
139
142
|
colorTheme: colorTheme,
|
|
@@ -141,6 +144,8 @@ export const FlatTable = ({
|
|
|
141
144
|
overflowY: hasStickyHead || hasStickyFooter ? "auto" : undefined,
|
|
142
145
|
height: addDefaultHeight && !hasMaxHeight ? "99%" : height,
|
|
143
146
|
maxHeight: hasMaxHeight ? "100%" : undefined,
|
|
147
|
+
hasOuterVerticalBorders: hasOuterVerticalBorders,
|
|
148
|
+
bottomBorderRadius: bottomBorderRadius,
|
|
144
149
|
display: "flex",
|
|
145
150
|
flexDirection: "column",
|
|
146
151
|
justifyContent: hasStickyFooter || height ? "space-between" : undefined,
|
|
@@ -4,12 +4,13 @@ declare const StyledTableContainer: import("styled-components").StyledComponent<
|
|
|
4
4
|
declare const StyledFlatTable: import("styled-components").StyledComponent<"table", any, Pick<FlatTableProps, "caption" | "isZebra"> & {
|
|
5
5
|
size: NonNullable<FlatTableProps["size"]>;
|
|
6
6
|
}, never>;
|
|
7
|
-
interface StyledFlatTableWrapperProps extends Pick<FlatTableProps, "hasStickyFooter" | "colorTheme" | "hasStickyHead" | "footer">, Partial<DrawerSidebarContextProps> {
|
|
7
|
+
interface StyledFlatTableWrapperProps extends Pick<FlatTableProps, "hasStickyFooter" | "colorTheme" | "hasStickyHead" | "footer" | "hasOuterVerticalBorders">, Partial<DrawerSidebarContextProps> {
|
|
8
8
|
hasHorizontalScrollbar: boolean;
|
|
9
9
|
hasVerticalScrollbar: boolean;
|
|
10
10
|
lastColRowSpanIndex: number;
|
|
11
11
|
firstColRowSpanIndex: number;
|
|
12
12
|
isFocused: boolean;
|
|
13
|
+
bottomBorderRadius: NonNullable<FlatTableProps["bottomBorderRadius"]>;
|
|
13
14
|
}
|
|
14
15
|
declare const StyledFlatTableWrapper: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & StyledFlatTableWrapperProps, never>;
|
|
15
16
|
declare const StyledFlatTableFooter: import("styled-components").StyledComponent<"div", any, Pick<FlatTableProps, "hasStickyFooter">, never>;
|
|
@@ -100,12 +100,27 @@ const StyledFlatTable = styled.table`
|
|
|
100
100
|
const StyledFlatTableWrapper = styled(StyledBox)`
|
|
101
101
|
border-top-left-radius: var(--borderRadius100);
|
|
102
102
|
border-top-right-radius: var(--borderRadius100);
|
|
103
|
+
|
|
104
|
+
${({
|
|
105
|
+
hasOuterVerticalBorders
|
|
106
|
+
}) => !hasOuterVerticalBorders && css`
|
|
107
|
+
${StyledFlatTableRow} {
|
|
108
|
+
& > ${StyledFlatTableCell}:first-child {
|
|
109
|
+
border-left-color: var(--colorsUtilityMajorTransparent);
|
|
110
|
+
}
|
|
111
|
+
& > ${StyledFlatTableCell}:last-child {
|
|
112
|
+
border-right-color: var(--colorsUtilityMajorTransparent);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
`}
|
|
116
|
+
|
|
103
117
|
${({
|
|
104
118
|
hasStickyFooter,
|
|
105
|
-
hasHorizontalScrollbar
|
|
119
|
+
hasHorizontalScrollbar,
|
|
120
|
+
bottomBorderRadius
|
|
106
121
|
}) => !hasStickyFooter && !hasHorizontalScrollbar && css`
|
|
107
|
-
border-bottom-left-radius: var(
|
|
108
|
-
border-bottom-right-radius: var(
|
|
122
|
+
border-bottom-left-radius: var(--${bottomBorderRadius});
|
|
123
|
+
border-bottom-right-radius: var(--${bottomBorderRadius});
|
|
109
124
|
`}
|
|
110
125
|
|
|
111
126
|
${({
|
|
@@ -152,7 +167,6 @@ css`
|
|
|
152
167
|
${StyledFlatTableHeader},
|
|
153
168
|
${StyledFlatTableHead} ${StyledFlatTableCheckbox} {
|
|
154
169
|
background-color: var(--colorsUtilityMajor025);
|
|
155
|
-
border-right: 1px solid var(--colorsUtilityMajor025);
|
|
156
170
|
border-bottom-color: var(--colorsUtilityMajor100);
|
|
157
171
|
}
|
|
158
172
|
${StyledFlatTableHead} ${StyledFlatTableRowHeader} {
|
|
@@ -167,7 +181,6 @@ css`
|
|
|
167
181
|
${StyledFlatTableHeader},
|
|
168
182
|
${StyledFlatTableHead} ${StyledFlatTableCheckbox} {
|
|
169
183
|
background-color: var(--colorsUtilityYang100);
|
|
170
|
-
border-right: 1px solid var(--colorsUtilityYang100);
|
|
171
184
|
border-bottom-color: var(--colorsUtilityMajor100);
|
|
172
185
|
}
|
|
173
186
|
${StyledFlatTableHead} ${StyledFlatTableRowHeader} {
|
|
@@ -294,7 +307,8 @@ css`
|
|
|
294
307
|
firstColRowSpanIndex,
|
|
295
308
|
lastColRowSpanIndex,
|
|
296
309
|
hasHorizontalScrollbar,
|
|
297
|
-
hasVerticalScrollbar
|
|
310
|
+
hasVerticalScrollbar,
|
|
311
|
+
bottomBorderRadius
|
|
298
312
|
}) => !footer && css`
|
|
299
313
|
tbody {
|
|
300
314
|
${firstColRowSpanIndex >= 0 && css`
|
|
@@ -319,13 +333,13 @@ css`
|
|
|
319
333
|
${!hasHorizontalScrollbar && firstColRowSpanIndex === -1 && css`
|
|
320
334
|
th:first-child,
|
|
321
335
|
td:first-child {
|
|
322
|
-
border-bottom-left-radius: var(
|
|
336
|
+
border-bottom-left-radius: var(--${bottomBorderRadius});
|
|
323
337
|
}
|
|
324
338
|
`}
|
|
325
339
|
${!hasVerticalScrollbar && !hasHorizontalScrollbar && lastColRowSpanIndex === -1 && css`
|
|
326
340
|
th:last-child,
|
|
327
341
|
td:last-child {
|
|
328
|
-
border-bottom-right-radius: var(
|
|
342
|
+
border-bottom-right-radius: var(--${bottomBorderRadius});
|
|
329
343
|
}
|
|
330
344
|
`}
|
|
331
345
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import styled, { css } from "styled-components";
|
|
2
|
-
import { StyledPreview } from "../preview/preview.style";
|
|
3
|
-
import { StyledPreviewPlaceholder } from "../preview/__internal__/preview-placeholder.style";
|
|
2
|
+
import { StyledPreview, StyledPreviewPlaceholder } from "../preview/preview.style";
|
|
4
3
|
import addFocusStyling from "../../style/utils/add-focus-styling";
|
|
5
4
|
import baseTheme from "../../style/themes/base";
|
|
6
5
|
const oldFocusStyling = `
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
|
-
|
|
4
|
-
export interface PreviewProps extends
|
|
3
|
+
export declare type Shapes = "text" | "rectangle" | "rectangle-round" | "circle";
|
|
4
|
+
export interface PreviewProps extends MarginProps {
|
|
5
5
|
/** Children content to render in the component. */
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
-
/**
|
|
7
|
+
/** Sets loading state. */
|
|
8
8
|
loading?: boolean;
|
|
9
|
+
/** Sets the height of the Preview. */
|
|
10
|
+
height?: string;
|
|
11
|
+
/** Sets the width of the Preview. */
|
|
12
|
+
width?: string;
|
|
13
|
+
/** The number of placeholder shapes to render. */
|
|
14
|
+
lines?: number;
|
|
15
|
+
/** Sets the preview's shape. */
|
|
16
|
+
shape?: Shapes;
|
|
17
|
+
/** Removes Preview's animation, is true when prefer reduce-motion is on. */
|
|
18
|
+
disableAnimation?: boolean;
|
|
9
19
|
}
|
|
10
|
-
export declare const Preview: ({ children, loading, lines, ...props }: PreviewProps) => React.JSX.Element;
|
|
20
|
+
export declare const Preview: ({ children, loading, lines, height, width, shape, disableAnimation, ...props }: PreviewProps) => React.JSX.Element;
|
|
11
21
|
export default Preview;
|
|
@@ -1,25 +1,37 @@
|
|
|
1
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
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import
|
|
5
|
-
import { StyledPreview } from "./preview.style";
|
|
4
|
+
import { StyledPreview, StyledPreviewPlaceholder } from "./preview.style";
|
|
6
5
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
6
|
+
import useMediaQuery from "../../hooks/useMediaQuery";
|
|
7
7
|
export const Preview = ({
|
|
8
8
|
children,
|
|
9
9
|
loading,
|
|
10
10
|
lines = 1,
|
|
11
|
+
height,
|
|
12
|
+
width,
|
|
13
|
+
shape = "text",
|
|
14
|
+
disableAnimation,
|
|
11
15
|
...props
|
|
12
16
|
}) => {
|
|
13
17
|
const marginProps = filterStyledSystemMarginProps(props);
|
|
14
|
-
const hasPlaceholder = loading
|
|
18
|
+
const hasPlaceholder = loading ?? !children;
|
|
19
|
+
const isLastLine = index => {
|
|
20
|
+
return lines > 1 && lines === index + 1;
|
|
21
|
+
};
|
|
22
|
+
const reduceMotion = !useMediaQuery("screen and (prefers-reduced-motion: no-preference)");
|
|
15
23
|
if (hasPlaceholder) {
|
|
16
24
|
const placeholders = [];
|
|
17
|
-
for (let i =
|
|
18
|
-
placeholders.push( /*#__PURE__*/React.createElement(
|
|
25
|
+
for (let i = 0; i < lines; i++) {
|
|
26
|
+
placeholders.push( /*#__PURE__*/React.createElement(StyledPreviewPlaceholder, _extends({
|
|
27
|
+
"data-component": "preview",
|
|
19
28
|
"data-role": "preview-placeholder",
|
|
20
29
|
key: i,
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
height: height,
|
|
31
|
+
width: width,
|
|
32
|
+
isLastLine: isLastLine(i),
|
|
33
|
+
shape: shape,
|
|
34
|
+
disableAnimation: disableAnimation || reduceMotion
|
|
23
35
|
}, props)));
|
|
24
36
|
}
|
|
25
37
|
return /*#__PURE__*/React.createElement(StyledPreview, marginProps, placeholders);
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
import { Shapes } from "./preview.component";
|
|
1
2
|
declare const StyledPreview: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
|
|
3
|
+
interface StyledPreviewPlaceholderProps {
|
|
4
|
+
height?: string;
|
|
5
|
+
width?: string;
|
|
6
|
+
shape: Shapes;
|
|
7
|
+
disableAnimation?: boolean;
|
|
8
|
+
isLastLine: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const StyledPreviewPlaceholder: import("styled-components").StyledComponent<"span", any, StyledPreviewPlaceholderProps, never>;
|
|
11
|
+
export { StyledPreview, StyledPreviewPlaceholder };
|
|
@@ -1,12 +1,86 @@
|
|
|
1
|
-
import styled from "styled-components";
|
|
1
|
+
import styled, { css, keyframes } from "styled-components";
|
|
2
2
|
import { margin } from "styled-system";
|
|
3
3
|
import baseTheme from "../../style/themes/base";
|
|
4
4
|
const StyledPreview = styled.div`
|
|
5
5
|
${margin}
|
|
6
6
|
`;
|
|
7
|
+
const shimmer = keyframes`
|
|
8
|
+
0% {
|
|
9
|
+
opacity: 0.1
|
|
10
|
+
}
|
|
11
|
+
70% {
|
|
12
|
+
opacity: 1
|
|
13
|
+
}
|
|
14
|
+
100% {
|
|
15
|
+
opacity: 0.1
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
function getBorderRadius(shape) {
|
|
19
|
+
switch (shape) {
|
|
20
|
+
case "rectangle-round":
|
|
21
|
+
return "var(--borderRadius400)";
|
|
22
|
+
case "circle":
|
|
23
|
+
return "var(--borderRadiusCircle)";
|
|
24
|
+
default:
|
|
25
|
+
return "var(--borderRadius100)";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function getHeight(shape) {
|
|
29
|
+
if (shape.includes("rectangle")) {
|
|
30
|
+
return "var(--sizing400)";
|
|
31
|
+
}
|
|
32
|
+
switch (shape) {
|
|
33
|
+
case "circle":
|
|
34
|
+
return "var(--sizing700)";
|
|
35
|
+
default:
|
|
36
|
+
return "var(--sizing175)";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function getWidth(shape) {
|
|
40
|
+
if (shape.includes("rectangle")) {
|
|
41
|
+
return "var(--sizing1500)";
|
|
42
|
+
}
|
|
43
|
+
return "100%";
|
|
44
|
+
}
|
|
45
|
+
const StyledPreviewPlaceholder = styled.span`
|
|
46
|
+
${({
|
|
47
|
+
shape,
|
|
48
|
+
disableAnimation,
|
|
49
|
+
isLastLine,
|
|
50
|
+
height,
|
|
51
|
+
width
|
|
52
|
+
}) => {
|
|
53
|
+
return css`
|
|
54
|
+
display: block;
|
|
55
|
+
background: linear-gradient(
|
|
56
|
+
135deg,
|
|
57
|
+
var(--colorsUtilityMajor100),
|
|
58
|
+
var(--colorsUtilityMajor040)
|
|
59
|
+
);
|
|
60
|
+
border-radius: ${getBorderRadius(shape)};
|
|
61
|
+
height: ${height || getHeight(shape)};
|
|
62
|
+
width: ${width || getWidth(shape)};
|
|
63
|
+
animation: ${shimmer} 2s ease infinite;
|
|
64
|
+
|
|
65
|
+
${isLastLine && shape === "text" && css`
|
|
66
|
+
width: calc(${width || getWidth(shape)}*0.8);
|
|
67
|
+
`}
|
|
68
|
+
|
|
69
|
+
${shape === "circle" && css`
|
|
70
|
+
width: ${height || getHeight(shape)};
|
|
71
|
+
`}
|
|
72
|
+
|
|
73
|
+
${disableAnimation && css`
|
|
74
|
+
animation: none;
|
|
75
|
+
`}
|
|
76
|
+
|
|
77
|
+
& + & {
|
|
78
|
+
margin-top: 6px;
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
}}
|
|
82
|
+
`;
|
|
7
83
|
StyledPreview.defaultProps = {
|
|
8
84
|
theme: baseTheme
|
|
9
85
|
};
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
12
|
-
export { StyledPreview };
|
|
86
|
+
export { StyledPreview, StyledPreviewPlaceholder };
|
|
@@ -3,7 +3,6 @@ import React, { useState, useRef, useImperativeHandle } from "react";
|
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import invariant from "invariant";
|
|
5
5
|
import { filterStyledSystemMarginProps } from "../../style/utils";
|
|
6
|
-
import tagComponent from "../../__internal__/utils/helpers/tags/tags";
|
|
7
6
|
import StyledSearch from "./search.style";
|
|
8
7
|
import StyledSearchButton from "./search-button.style";
|
|
9
8
|
import Icon from "../icon";
|
|
@@ -141,7 +140,9 @@ const Search = /*#__PURE__*/React.forwardRef(({
|
|
|
141
140
|
showSearchButton: !!searchButton,
|
|
142
141
|
variant: variant,
|
|
143
142
|
mb: 0
|
|
144
|
-
}, filterStyledSystemMarginProps(rest),
|
|
143
|
+
}, filterStyledSystemMarginProps(rest), {
|
|
144
|
+
"data-component": "search",
|
|
145
|
+
"data-role": "search",
|
|
145
146
|
id: id,
|
|
146
147
|
name: name
|
|
147
148
|
}, rest), /*#__PURE__*/React.createElement(Textbox, {
|
|
@@ -4,15 +4,47 @@ declare type CustomRefObject<T> = {
|
|
|
4
4
|
current?: T | null;
|
|
5
5
|
};
|
|
6
6
|
export interface PopoverProps {
|
|
7
|
+
/**
|
|
8
|
+
* Element to be positioned, has to be a single node and has to accept `ref` and `style` props.
|
|
9
|
+
*/
|
|
7
10
|
children: React.ReactElement;
|
|
11
|
+
/**
|
|
12
|
+
* Placement of children in relation to the reference element.
|
|
13
|
+
*/
|
|
8
14
|
placement?: Placement;
|
|
15
|
+
/**
|
|
16
|
+
* Disables interaction with background UI.
|
|
17
|
+
*/
|
|
9
18
|
disableBackgroundUI?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Optional middleware array, for more information go to:
|
|
21
|
+
* [https://floating-ui.com/docs/middleware](https://floating-ui.com/docs/middleware)
|
|
22
|
+
*/
|
|
10
23
|
middleware?: Middleware[];
|
|
24
|
+
/**
|
|
25
|
+
* When true, children are not rendered in portal.
|
|
26
|
+
*/
|
|
11
27
|
disablePortal?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Reference element, children will be positioned in relation to this element - should be a ref shaped object.
|
|
30
|
+
*/
|
|
12
31
|
reference: CustomRefObject<HTMLElement>;
|
|
32
|
+
/**
|
|
33
|
+
* Determines if the popover is currently open/visible or not. Defaults to true.
|
|
34
|
+
*/
|
|
13
35
|
isOpen?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to update the position of the floating element on every animation frame if required. This is optimized for performance but can still be costly. Use with caution!
|
|
38
|
+
* [https://floating-ui.com/docs/autoUpdate#animationframe](https://floating-ui.com/docs/autoUpdate#animationframe)
|
|
39
|
+
*/
|
|
14
40
|
animationFrame?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Optional strategy to use for positioning the floating element. Defaults to "absolute".
|
|
43
|
+
*/
|
|
15
44
|
popoverStrategy?: "absolute" | "fixed";
|
|
45
|
+
/**
|
|
46
|
+
* Allows child ref to be set via a prop instead of dynamically finding it via children iteration.
|
|
47
|
+
*/
|
|
16
48
|
childRefOverride?: MutableRefObject<HTMLDivElement | null>;
|
|
17
49
|
}
|
|
18
50
|
declare const Popover: ({ children, placement, disablePortal, reference, middleware, disableBackgroundUI, isOpen, animationFrame, popoverStrategy, childRefOverride, }: PopoverProps) => React.JSX.Element;
|
|
@@ -76,7 +76,9 @@ const Popover = ({
|
|
|
76
76
|
if (disableBackgroundUI) {
|
|
77
77
|
content = /*#__PURE__*/_react.default.createElement(_popover.StyledPopoverContent, {
|
|
78
78
|
isOpen: isOpen
|
|
79
|
-
}, /*#__PURE__*/_react.default.createElement(_popover.StyledBackdrop,
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement(_popover.StyledBackdrop, {
|
|
80
|
+
"data-role": "popup-backdrop"
|
|
81
|
+
}, content));
|
|
80
82
|
}
|
|
81
83
|
if (disablePortal) {
|
|
82
84
|
return content;
|
|
@@ -32,7 +32,6 @@ const RadioButtonMapper = ({
|
|
|
32
32
|
const [checkedValue, setCheckedValue] = (0, _react.useState)(false);
|
|
33
33
|
const onChangeProp = (0, _react.useCallback)(event => {
|
|
34
34
|
onChange?.(event);
|
|
35
|
-
/* istanbul ignore else */
|
|
36
35
|
if (!isControlled) {
|
|
37
36
|
setCheckedValue(event.target.value);
|
|
38
37
|
}
|
|
@@ -180,7 +180,12 @@ const StyledFlatTableRow = _styledComponents.default.tr`
|
|
|
180
180
|
${_flatTableHeader.default} {
|
|
181
181
|
border-bottom: 1px solid ${borderColor(colorTheme)};
|
|
182
182
|
|
|
183
|
-
${
|
|
183
|
+
${horizontalBorderSize !== "small" && (0, _styledComponents.css)`
|
|
184
|
+
border-bottom: ${horizontalBorderSizes[horizontalBorderSize]} solid
|
|
185
|
+
var(--colorsUtilityMajor100);
|
|
186
|
+
`}
|
|
187
|
+
|
|
188
|
+
${!isInSidebar && !colorTheme?.includes("transparent") && `
|
|
184
189
|
:first-child {
|
|
185
190
|
border-left: 1px solid ${borderColor(colorTheme)};
|
|
186
191
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
|
+
import * as DesignTokens from "@sage/design-tokens/js/base/common";
|
|
3
4
|
export interface FlatTableProps extends MarginProps {
|
|
4
5
|
/** The HTML id of the element that contains a description of this table. */
|
|
5
6
|
ariaDescribedby?: string;
|
|
@@ -25,13 +26,17 @@ export interface FlatTableProps extends MarginProps {
|
|
|
25
26
|
size?: "compact" | "small" | "medium" | "large" | "extraLarge";
|
|
26
27
|
/** Applies max-height of 100% to FlatTable if true */
|
|
27
28
|
hasMaxHeight?: boolean;
|
|
29
|
+
/** Toggles the visibility of the table's outer left and right borders. When false, the left border of the first column and the right border of the last column are hidden. */
|
|
30
|
+
hasOuterVerticalBorders?: boolean;
|
|
31
|
+
/** Sets the border radius of the first and last cells in the last row. */
|
|
32
|
+
bottomBorderRadius?: Extract<keyof typeof DesignTokens, `borderRadius${number}`>;
|
|
28
33
|
/** Set the overflow X of the table wrapper. Any valid CSS string */
|
|
29
34
|
overflowX?: string;
|
|
30
35
|
/** Width of the table. Any valid CSS string */
|
|
31
36
|
width?: string;
|
|
32
37
|
}
|
|
33
38
|
export declare const FlatTable: {
|
|
34
|
-
({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, ariaDescribedby, minHeight, overflowX, width, ...rest }: FlatTableProps): React.JSX.Element;
|
|
39
|
+
({ caption, children, hasStickyHead, colorTheme, footer, hasStickyFooter, height, isZebra, size, hasMaxHeight, hasOuterVerticalBorders, bottomBorderRadius, ariaDescribedby, minHeight, overflowX, width, ...rest }: FlatTableProps): React.JSX.Element;
|
|
35
40
|
displayName: string;
|
|
36
41
|
};
|
|
37
42
|
export default FlatTable;
|
|
@@ -26,6 +26,8 @@ const FlatTable = ({
|
|
|
26
26
|
isZebra,
|
|
27
27
|
size = "medium",
|
|
28
28
|
hasMaxHeight = false,
|
|
29
|
+
hasOuterVerticalBorders = true,
|
|
30
|
+
bottomBorderRadius = "borderRadius100",
|
|
29
31
|
ariaDescribedby,
|
|
30
32
|
minHeight,
|
|
31
33
|
overflowX,
|
|
@@ -143,6 +145,7 @@ const FlatTable = ({
|
|
|
143
145
|
return /*#__PURE__*/_react.default.createElement(_flatTable.StyledFlatTableWrapper, _extends({
|
|
144
146
|
ref: wrapperRef,
|
|
145
147
|
"data-component": "flat-table-wrapper",
|
|
148
|
+
"data-role": "flat-table-wrapper",
|
|
146
149
|
isInSidebar: isInSidebar,
|
|
147
150
|
hasStickyHead: hasStickyHead,
|
|
148
151
|
colorTheme: colorTheme,
|
|
@@ -150,6 +153,8 @@ const FlatTable = ({
|
|
|
150
153
|
overflowY: hasStickyHead || hasStickyFooter ? "auto" : undefined,
|
|
151
154
|
height: addDefaultHeight && !hasMaxHeight ? "99%" : height,
|
|
152
155
|
maxHeight: hasMaxHeight ? "100%" : undefined,
|
|
156
|
+
hasOuterVerticalBorders: hasOuterVerticalBorders,
|
|
157
|
+
bottomBorderRadius: bottomBorderRadius,
|
|
153
158
|
display: "flex",
|
|
154
159
|
flexDirection: "column",
|
|
155
160
|
justifyContent: hasStickyFooter || height ? "space-between" : undefined,
|
|
@@ -4,12 +4,13 @@ declare const StyledTableContainer: import("styled-components").StyledComponent<
|
|
|
4
4
|
declare const StyledFlatTable: import("styled-components").StyledComponent<"table", any, Pick<FlatTableProps, "caption" | "isZebra"> & {
|
|
5
5
|
size: NonNullable<FlatTableProps["size"]>;
|
|
6
6
|
}, never>;
|
|
7
|
-
interface StyledFlatTableWrapperProps extends Pick<FlatTableProps, "hasStickyFooter" | "colorTheme" | "hasStickyHead" | "footer">, Partial<DrawerSidebarContextProps> {
|
|
7
|
+
interface StyledFlatTableWrapperProps extends Pick<FlatTableProps, "hasStickyFooter" | "colorTheme" | "hasStickyHead" | "footer" | "hasOuterVerticalBorders">, Partial<DrawerSidebarContextProps> {
|
|
8
8
|
hasHorizontalScrollbar: boolean;
|
|
9
9
|
hasVerticalScrollbar: boolean;
|
|
10
10
|
lastColRowSpanIndex: number;
|
|
11
11
|
firstColRowSpanIndex: number;
|
|
12
12
|
isFocused: boolean;
|
|
13
|
+
bottomBorderRadius: NonNullable<FlatTableProps["bottomBorderRadius"]>;
|
|
13
14
|
}
|
|
14
15
|
declare const StyledFlatTableWrapper: import("styled-components").StyledComponent<"div", any, import("../box").BoxProps & StyledFlatTableWrapperProps, never>;
|
|
15
16
|
declare const StyledFlatTableFooter: import("styled-components").StyledComponent<"div", any, Pick<FlatTableProps, "hasStickyFooter">, never>;
|
|
@@ -109,12 +109,27 @@ const StyledFlatTable = exports.StyledFlatTable = _styledComponents.default.tabl
|
|
|
109
109
|
const StyledFlatTableWrapper = exports.StyledFlatTableWrapper = (0, _styledComponents.default)(_box.default)`
|
|
110
110
|
border-top-left-radius: var(--borderRadius100);
|
|
111
111
|
border-top-right-radius: var(--borderRadius100);
|
|
112
|
+
|
|
113
|
+
${({
|
|
114
|
+
hasOuterVerticalBorders
|
|
115
|
+
}) => !hasOuterVerticalBorders && (0, _styledComponents.css)`
|
|
116
|
+
${_flatTableRow.default} {
|
|
117
|
+
& > ${_flatTableCell.StyledFlatTableCell}:first-child {
|
|
118
|
+
border-left-color: var(--colorsUtilityMajorTransparent);
|
|
119
|
+
}
|
|
120
|
+
& > ${_flatTableCell.StyledFlatTableCell}:last-child {
|
|
121
|
+
border-right-color: var(--colorsUtilityMajorTransparent);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
`}
|
|
125
|
+
|
|
112
126
|
${({
|
|
113
127
|
hasStickyFooter,
|
|
114
|
-
hasHorizontalScrollbar
|
|
128
|
+
hasHorizontalScrollbar,
|
|
129
|
+
bottomBorderRadius
|
|
115
130
|
}) => !hasStickyFooter && !hasHorizontalScrollbar && (0, _styledComponents.css)`
|
|
116
|
-
border-bottom-left-radius: var(
|
|
117
|
-
border-bottom-right-radius: var(
|
|
131
|
+
border-bottom-left-radius: var(--${bottomBorderRadius});
|
|
132
|
+
border-bottom-right-radius: var(--${bottomBorderRadius});
|
|
118
133
|
`}
|
|
119
134
|
|
|
120
135
|
${({
|
|
@@ -161,7 +176,6 @@ const StyledFlatTableWrapper = exports.StyledFlatTableWrapper = (0, _styledCompo
|
|
|
161
176
|
${_flatTableHeader.default},
|
|
162
177
|
${_flatTableHead.default} ${_flatTableCheckbox.default} {
|
|
163
178
|
background-color: var(--colorsUtilityMajor025);
|
|
164
|
-
border-right: 1px solid var(--colorsUtilityMajor025);
|
|
165
179
|
border-bottom-color: var(--colorsUtilityMajor100);
|
|
166
180
|
}
|
|
167
181
|
${_flatTableHead.default} ${_flatTableRowHeader.StyledFlatTableRowHeader} {
|
|
@@ -176,7 +190,6 @@ const StyledFlatTableWrapper = exports.StyledFlatTableWrapper = (0, _styledCompo
|
|
|
176
190
|
${_flatTableHeader.default},
|
|
177
191
|
${_flatTableHead.default} ${_flatTableCheckbox.default} {
|
|
178
192
|
background-color: var(--colorsUtilityYang100);
|
|
179
|
-
border-right: 1px solid var(--colorsUtilityYang100);
|
|
180
193
|
border-bottom-color: var(--colorsUtilityMajor100);
|
|
181
194
|
}
|
|
182
195
|
${_flatTableHead.default} ${_flatTableRowHeader.StyledFlatTableRowHeader} {
|
|
@@ -303,7 +316,8 @@ const StyledFlatTableWrapper = exports.StyledFlatTableWrapper = (0, _styledCompo
|
|
|
303
316
|
firstColRowSpanIndex,
|
|
304
317
|
lastColRowSpanIndex,
|
|
305
318
|
hasHorizontalScrollbar,
|
|
306
|
-
hasVerticalScrollbar
|
|
319
|
+
hasVerticalScrollbar,
|
|
320
|
+
bottomBorderRadius
|
|
307
321
|
}) => !footer && (0, _styledComponents.css)`
|
|
308
322
|
tbody {
|
|
309
323
|
${firstColRowSpanIndex >= 0 && (0, _styledComponents.css)`
|
|
@@ -328,13 +342,13 @@ const StyledFlatTableWrapper = exports.StyledFlatTableWrapper = (0, _styledCompo
|
|
|
328
342
|
${!hasHorizontalScrollbar && firstColRowSpanIndex === -1 && (0, _styledComponents.css)`
|
|
329
343
|
th:first-child,
|
|
330
344
|
td:first-child {
|
|
331
|
-
border-bottom-left-radius: var(
|
|
345
|
+
border-bottom-left-radius: var(--${bottomBorderRadius});
|
|
332
346
|
}
|
|
333
347
|
`}
|
|
334
348
|
${!hasVerticalScrollbar && !hasHorizontalScrollbar && lastColRowSpanIndex === -1 && (0, _styledComponents.css)`
|
|
335
349
|
th:last-child,
|
|
336
350
|
td:last-child {
|
|
337
|
-
border-bottom-right-radius: var(
|
|
351
|
+
border-bottom-right-radius: var(--${bottomBorderRadius});
|
|
338
352
|
}
|
|
339
353
|
`}
|
|
340
354
|
}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.StyledUrl = exports.StyledTitle = exports.StyledPreviewWrapper = exports.StyledLinkPreview = exports.StyledDescription = exports.StyledCloseIconWrapper = void 0;
|
|
7
7
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _preview = require("../preview/preview.style");
|
|
9
|
-
var _previewPlaceholder = require("../preview/__internal__/preview-placeholder.style");
|
|
10
9
|
var _addFocusStyling = _interopRequireDefault(require("../../style/utils/add-focus-styling"));
|
|
11
10
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
12
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -64,11 +63,11 @@ const StyledPreviewWrapper = exports.StyledPreviewWrapper = _styledComponents.de
|
|
|
64
63
|
}
|
|
65
64
|
`}
|
|
66
65
|
|
|
67
|
-
${
|
|
66
|
+
${_preview.StyledPreviewPlaceholder}:first-of-type {
|
|
68
67
|
margin-top: 8px;
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
${
|
|
70
|
+
${_preview.StyledPreviewPlaceholder}:not(:first-of-type) {
|
|
72
71
|
margin-top: 16px;
|
|
73
72
|
}
|
|
74
73
|
`;
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { MarginProps } from "styled-system";
|
|
3
|
-
|
|
4
|
-
export interface PreviewProps extends
|
|
3
|
+
export declare type Shapes = "text" | "rectangle" | "rectangle-round" | "circle";
|
|
4
|
+
export interface PreviewProps extends MarginProps {
|
|
5
5
|
/** Children content to render in the component. */
|
|
6
6
|
children?: React.ReactNode;
|
|
7
|
-
/**
|
|
7
|
+
/** Sets loading state. */
|
|
8
8
|
loading?: boolean;
|
|
9
|
+
/** Sets the height of the Preview. */
|
|
10
|
+
height?: string;
|
|
11
|
+
/** Sets the width of the Preview. */
|
|
12
|
+
width?: string;
|
|
13
|
+
/** The number of placeholder shapes to render. */
|
|
14
|
+
lines?: number;
|
|
15
|
+
/** Sets the preview's shape. */
|
|
16
|
+
shape?: Shapes;
|
|
17
|
+
/** Removes Preview's animation, is true when prefer reduce-motion is on. */
|
|
18
|
+
disableAnimation?: boolean;
|
|
9
19
|
}
|
|
10
|
-
export declare const Preview: ({ children, loading, lines, ...props }: PreviewProps) => React.JSX.Element;
|
|
20
|
+
export declare const Preview: ({ children, loading, lines, height, width, shape, disableAnimation, ...props }: PreviewProps) => React.JSX.Element;
|
|
11
21
|
export default Preview;
|
|
@@ -6,27 +6,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.Preview = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _previewPlaceholder = _interopRequireDefault(require("./__internal__/preview-placeholder.component"));
|
|
10
9
|
var _preview = require("./preview.style");
|
|
11
10
|
var _utils = require("../../style/utils");
|
|
11
|
+
var _useMediaQuery = _interopRequireDefault(require("../../hooks/useMediaQuery"));
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
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); }
|
|
14
14
|
const Preview = ({
|
|
15
15
|
children,
|
|
16
16
|
loading,
|
|
17
17
|
lines = 1,
|
|
18
|
+
height,
|
|
19
|
+
width,
|
|
20
|
+
shape = "text",
|
|
21
|
+
disableAnimation,
|
|
18
22
|
...props
|
|
19
23
|
}) => {
|
|
20
24
|
const marginProps = (0, _utils.filterStyledSystemMarginProps)(props);
|
|
21
|
-
const hasPlaceholder = loading
|
|
25
|
+
const hasPlaceholder = loading ?? !children;
|
|
26
|
+
const isLastLine = index => {
|
|
27
|
+
return lines > 1 && lines === index + 1;
|
|
28
|
+
};
|
|
29
|
+
const reduceMotion = !(0, _useMediaQuery.default)("screen and (prefers-reduced-motion: no-preference)");
|
|
22
30
|
if (hasPlaceholder) {
|
|
23
31
|
const placeholders = [];
|
|
24
|
-
for (let i =
|
|
25
|
-
placeholders.push( /*#__PURE__*/_react.default.createElement(
|
|
32
|
+
for (let i = 0; i < lines; i++) {
|
|
33
|
+
placeholders.push( /*#__PURE__*/_react.default.createElement(_preview.StyledPreviewPlaceholder, _extends({
|
|
34
|
+
"data-component": "preview",
|
|
26
35
|
"data-role": "preview-placeholder",
|
|
27
36
|
key: i,
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
height: height,
|
|
38
|
+
width: width,
|
|
39
|
+
isLastLine: isLastLine(i),
|
|
40
|
+
shape: shape,
|
|
41
|
+
disableAnimation: disableAnimation || reduceMotion
|
|
30
42
|
}, props)));
|
|
31
43
|
}
|
|
32
44
|
return /*#__PURE__*/_react.default.createElement(_preview.StyledPreview, marginProps, placeholders);
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
import { Shapes } from "./preview.component";
|
|
1
2
|
declare const StyledPreview: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
|
|
3
|
+
interface StyledPreviewPlaceholderProps {
|
|
4
|
+
height?: string;
|
|
5
|
+
width?: string;
|
|
6
|
+
shape: Shapes;
|
|
7
|
+
disableAnimation?: boolean;
|
|
8
|
+
isLastLine: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const StyledPreviewPlaceholder: import("styled-components").StyledComponent<"span", any, StyledPreviewPlaceholderProps, never>;
|
|
11
|
+
export { StyledPreview, StyledPreviewPlaceholder };
|
|
@@ -3,16 +3,92 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.StyledPreview = void 0;
|
|
7
|
-
var _styledComponents =
|
|
6
|
+
exports.StyledPreviewPlaceholder = exports.StyledPreview = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
8
|
var _styledSystem = require("styled-system");
|
|
9
9
|
var _base = _interopRequireDefault(require("../../style/themes/base"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
11
13
|
const StyledPreview = exports.StyledPreview = _styledComponents.default.div`
|
|
12
14
|
${_styledSystem.margin}
|
|
13
15
|
`;
|
|
16
|
+
const shimmer = (0, _styledComponents.keyframes)`
|
|
17
|
+
0% {
|
|
18
|
+
opacity: 0.1
|
|
19
|
+
}
|
|
20
|
+
70% {
|
|
21
|
+
opacity: 1
|
|
22
|
+
}
|
|
23
|
+
100% {
|
|
24
|
+
opacity: 0.1
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
function getBorderRadius(shape) {
|
|
28
|
+
switch (shape) {
|
|
29
|
+
case "rectangle-round":
|
|
30
|
+
return "var(--borderRadius400)";
|
|
31
|
+
case "circle":
|
|
32
|
+
return "var(--borderRadiusCircle)";
|
|
33
|
+
default:
|
|
34
|
+
return "var(--borderRadius100)";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function getHeight(shape) {
|
|
38
|
+
if (shape.includes("rectangle")) {
|
|
39
|
+
return "var(--sizing400)";
|
|
40
|
+
}
|
|
41
|
+
switch (shape) {
|
|
42
|
+
case "circle":
|
|
43
|
+
return "var(--sizing700)";
|
|
44
|
+
default:
|
|
45
|
+
return "var(--sizing175)";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function getWidth(shape) {
|
|
49
|
+
if (shape.includes("rectangle")) {
|
|
50
|
+
return "var(--sizing1500)";
|
|
51
|
+
}
|
|
52
|
+
return "100%";
|
|
53
|
+
}
|
|
54
|
+
const StyledPreviewPlaceholder = exports.StyledPreviewPlaceholder = _styledComponents.default.span`
|
|
55
|
+
${({
|
|
56
|
+
shape,
|
|
57
|
+
disableAnimation,
|
|
58
|
+
isLastLine,
|
|
59
|
+
height,
|
|
60
|
+
width
|
|
61
|
+
}) => {
|
|
62
|
+
return (0, _styledComponents.css)`
|
|
63
|
+
display: block;
|
|
64
|
+
background: linear-gradient(
|
|
65
|
+
135deg,
|
|
66
|
+
var(--colorsUtilityMajor100),
|
|
67
|
+
var(--colorsUtilityMajor040)
|
|
68
|
+
);
|
|
69
|
+
border-radius: ${getBorderRadius(shape)};
|
|
70
|
+
height: ${height || getHeight(shape)};
|
|
71
|
+
width: ${width || getWidth(shape)};
|
|
72
|
+
animation: ${shimmer} 2s ease infinite;
|
|
73
|
+
|
|
74
|
+
${isLastLine && shape === "text" && (0, _styledComponents.css)`
|
|
75
|
+
width: calc(${width || getWidth(shape)}*0.8);
|
|
76
|
+
`}
|
|
77
|
+
|
|
78
|
+
${shape === "circle" && (0, _styledComponents.css)`
|
|
79
|
+
width: ${height || getHeight(shape)};
|
|
80
|
+
`}
|
|
81
|
+
|
|
82
|
+
${disableAnimation && (0, _styledComponents.css)`
|
|
83
|
+
animation: none;
|
|
84
|
+
`}
|
|
85
|
+
|
|
86
|
+
& + & {
|
|
87
|
+
margin-top: 6px;
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
}}
|
|
91
|
+
`;
|
|
14
92
|
StyledPreview.defaultProps = {
|
|
15
93
|
theme: _base.default
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
94
|
+
};
|
|
@@ -8,7 +8,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _invariant = _interopRequireDefault(require("invariant"));
|
|
10
10
|
var _utils = require("../../style/utils");
|
|
11
|
-
var _tags = _interopRequireDefault(require("../../__internal__/utils/helpers/tags/tags"));
|
|
12
11
|
var _search = _interopRequireDefault(require("./search.style"));
|
|
13
12
|
var _searchButton = _interopRequireDefault(require("./search-button.style"));
|
|
14
13
|
var _icon = _interopRequireDefault(require("../icon"));
|
|
@@ -150,7 +149,9 @@ const Search = exports.Search = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
150
149
|
showSearchButton: !!searchButton,
|
|
151
150
|
variant: variant,
|
|
152
151
|
mb: 0
|
|
153
|
-
}, (0, _utils.filterStyledSystemMarginProps)(rest),
|
|
152
|
+
}, (0, _utils.filterStyledSystemMarginProps)(rest), {
|
|
153
|
+
"data-component": "search",
|
|
154
|
+
"data-role": "search",
|
|
154
155
|
id: id,
|
|
155
156
|
name: name
|
|
156
157
|
}, rest), /*#__PURE__*/_react.default.createElement(_textbox.default, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "carbon-react",
|
|
3
|
-
"version": "142.
|
|
3
|
+
"version": "142.11.0",
|
|
4
4
|
"description": "A library of reusable React components for easily building user interfaces.",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"styled-components": "^4.4.1"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@axe-core/playwright": "~4.
|
|
59
|
+
"@axe-core/playwright": "~4.10.0",
|
|
60
60
|
"@babel/cli": "^7.23.4",
|
|
61
61
|
"@babel/core": "^7.23.3",
|
|
62
62
|
"@babel/eslint-parser": "^7.23.3",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"@babel/types": "^7.23.4",
|
|
70
70
|
"@commitlint/cli": "^17.6.3",
|
|
71
71
|
"@commitlint/config-conventional": "^17.6.3",
|
|
72
|
-
"@playwright/experimental-ct-react17": "~1.
|
|
73
|
-
"@playwright/test": "~1.
|
|
72
|
+
"@playwright/experimental-ct-react17": "~1.47.0",
|
|
73
|
+
"@playwright/test": "~1.47.0",
|
|
74
74
|
"@sage/design-tokens": "~4.29.0",
|
|
75
75
|
"@semantic-release/changelog": "^6.0.3",
|
|
76
76
|
"@semantic-release/exec": "^6.0.3",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyledPreviewPlaceholderProps } from "./preview-placeholder.style";
|
|
3
|
-
export interface PreviewPlaceholderProps extends StyledPreviewPlaceholderProps {
|
|
4
|
-
index: number;
|
|
5
|
-
/** The number of lines to render. */
|
|
6
|
-
lines: number;
|
|
7
|
-
loading?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const PreviewPlaceholder: ({ height, index, lines, width, ...props }: PreviewPlaceholderProps) => React.JSX.Element;
|
|
10
|
-
export default PreviewPlaceholder;
|
|
@@ -1,19 +0,0 @@
|
|
|
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 { StyledPreviewPlaceholder } from "./preview-placeholder.style";
|
|
6
|
-
const PreviewPlaceholder = ({
|
|
7
|
-
height,
|
|
8
|
-
index,
|
|
9
|
-
lines,
|
|
10
|
-
width,
|
|
11
|
-
...props
|
|
12
|
-
}) => {
|
|
13
|
-
const isLastLine = lines > 1 && lines === index;
|
|
14
|
-
return /*#__PURE__*/React.createElement(StyledPreviewPlaceholder, _extends({
|
|
15
|
-
height: height,
|
|
16
|
-
width: !width && isLastLine ? "80%" : width
|
|
17
|
-
}, tagComponent("preview", props)));
|
|
18
|
-
};
|
|
19
|
-
export default PreviewPlaceholder;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export interface StyledPreviewPlaceholderProps {
|
|
2
|
-
/** A custom height to be applied to the component. */
|
|
3
|
-
height?: string;
|
|
4
|
-
/** A custom width */
|
|
5
|
-
width?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const StyledPreviewPlaceholder: import("styled-components").StyledComponent<"span", any, StyledPreviewPlaceholderProps, never>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import styled, { keyframes } from "styled-components";
|
|
2
|
-
const shimmer = keyframes`
|
|
3
|
-
0% { opacity:0.1 }
|
|
4
|
-
70% { opacity:0.6 }
|
|
5
|
-
100% { opacity:0.1 }
|
|
6
|
-
`;
|
|
7
|
-
export const StyledPreviewPlaceholder = styled.span`
|
|
8
|
-
animation: ${shimmer} 2s ease infinite;
|
|
9
|
-
background: var(--colorsUtilityMajor150);
|
|
10
|
-
display: block;
|
|
11
|
-
height: ${({
|
|
12
|
-
height
|
|
13
|
-
}) => height || "15px"};
|
|
14
|
-
opacity: 0.6;
|
|
15
|
-
width: ${({
|
|
16
|
-
width
|
|
17
|
-
}) => width || "100%"};
|
|
18
|
-
border-radius: var(--borderRadius050);
|
|
19
|
-
|
|
20
|
-
& + & {
|
|
21
|
-
margin-top: 3px;
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { StyledPreviewPlaceholderProps } from "./preview-placeholder.style";
|
|
3
|
-
export interface PreviewPlaceholderProps extends StyledPreviewPlaceholderProps {
|
|
4
|
-
index: number;
|
|
5
|
-
/** The number of lines to render. */
|
|
6
|
-
lines: number;
|
|
7
|
-
loading?: boolean;
|
|
8
|
-
}
|
|
9
|
-
declare const PreviewPlaceholder: ({ height, index, lines, width, ...props }: PreviewPlaceholderProps) => React.JSX.Element;
|
|
10
|
-
export default PreviewPlaceholder;
|
|
@@ -1,26 +0,0 @@
|
|
|
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 _previewPlaceholder = require("./preview-placeholder.style");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
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); }
|
|
13
|
-
const PreviewPlaceholder = ({
|
|
14
|
-
height,
|
|
15
|
-
index,
|
|
16
|
-
lines,
|
|
17
|
-
width,
|
|
18
|
-
...props
|
|
19
|
-
}) => {
|
|
20
|
-
const isLastLine = lines > 1 && lines === index;
|
|
21
|
-
return /*#__PURE__*/_react.default.createElement(_previewPlaceholder.StyledPreviewPlaceholder, _extends({
|
|
22
|
-
height: height,
|
|
23
|
-
width: !width && isLastLine ? "80%" : width
|
|
24
|
-
}, (0, _tags.default)("preview", props)));
|
|
25
|
-
};
|
|
26
|
-
var _default = exports.default = PreviewPlaceholder;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export interface StyledPreviewPlaceholderProps {
|
|
2
|
-
/** A custom height to be applied to the component. */
|
|
3
|
-
height?: string;
|
|
4
|
-
/** A custom width */
|
|
5
|
-
width?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const StyledPreviewPlaceholder: import("styled-components").StyledComponent<"span", any, StyledPreviewPlaceholderProps, never>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.StyledPreviewPlaceholder = 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 shimmer = (0, _styledComponents.keyframes)`
|
|
11
|
-
0% { opacity:0.1 }
|
|
12
|
-
70% { opacity:0.6 }
|
|
13
|
-
100% { opacity:0.1 }
|
|
14
|
-
`;
|
|
15
|
-
const StyledPreviewPlaceholder = exports.StyledPreviewPlaceholder = _styledComponents.default.span`
|
|
16
|
-
animation: ${shimmer} 2s ease infinite;
|
|
17
|
-
background: var(--colorsUtilityMajor150);
|
|
18
|
-
display: block;
|
|
19
|
-
height: ${({
|
|
20
|
-
height
|
|
21
|
-
}) => height || "15px"};
|
|
22
|
-
opacity: 0.6;
|
|
23
|
-
width: ${({
|
|
24
|
-
width
|
|
25
|
-
}) => width || "100%"};
|
|
26
|
-
border-radius: var(--borderRadius050);
|
|
27
|
-
|
|
28
|
-
& + & {
|
|
29
|
-
margin-top: 3px;
|
|
30
|
-
}
|
|
31
|
-
`;
|