carbon-react 142.9.1 → 142.10.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.
Files changed (23) hide show
  1. package/esm/components/link-preview/link-preview.style.js +1 -2
  2. package/esm/components/pages/pages.component.js +1 -0
  3. package/esm/components/preview/preview.component.d.ts +14 -4
  4. package/esm/components/preview/preview.component.js +19 -7
  5. package/esm/components/preview/preview.style.d.ts +10 -1
  6. package/esm/components/preview/preview.style.js +78 -4
  7. package/esm/components/search/search.component.js +3 -2
  8. package/lib/components/link-preview/link-preview.style.js +2 -3
  9. package/lib/components/pages/pages.component.js +1 -0
  10. package/lib/components/preview/preview.component.d.ts +14 -4
  11. package/lib/components/preview/preview.component.js +18 -6
  12. package/lib/components/preview/preview.style.d.ts +10 -1
  13. package/lib/components/preview/preview.style.js +81 -5
  14. package/lib/components/search/search.component.js +3 -2
  15. package/package.json +4 -4
  16. package/esm/components/preview/__internal__/preview-placeholder.component.d.ts +0 -10
  17. package/esm/components/preview/__internal__/preview-placeholder.component.js +0 -19
  18. package/esm/components/preview/__internal__/preview-placeholder.style.d.ts +0 -7
  19. package/esm/components/preview/__internal__/preview-placeholder.style.js +0 -23
  20. package/lib/components/preview/__internal__/preview-placeholder.component.d.ts +0 -10
  21. package/lib/components/preview/__internal__/preview-placeholder.component.js +0 -26
  22. package/lib/components/preview/__internal__/preview-placeholder.style.d.ts +0 -7
  23. package/lib/components/preview/__internal__/preview-placeholder.style.js +0 -31
@@ -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 = `
@@ -31,6 +31,7 @@ const Pages = ({
31
31
  transitionName,
32
32
  timeout: TRANSITION_TIME,
33
33
  "data-element": "visible-page",
34
+ "data-role": "visible-page",
34
35
  className: visiblePage.props.className
35
36
  };
36
37
  return /*#__PURE__*/React.cloneElement(visiblePage, additionalProps);
@@ -1,11 +1,21 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
- import { PreviewPlaceholderProps } from "./__internal__/preview-placeholder.component";
4
- export interface PreviewProps extends Partial<Omit<PreviewPlaceholderProps, "index">>, MarginProps {
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
- /** Provides more control over when in a loading state. */
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 PreviewPlaceholder from "./__internal__/preview-placeholder.component";
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 === undefined ? !children : 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 = 1; i <= lines; i++) {
18
- placeholders.push( /*#__PURE__*/React.createElement(PreviewPlaceholder, _extends({
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
- index: i,
22
- lines: lines
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
- export { StyledPreview };
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), tagComponent("search", 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, {
@@ -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
- ${_previewPlaceholder.StyledPreviewPlaceholder}:first-of-type {
66
+ ${_preview.StyledPreviewPlaceholder}:first-of-type {
68
67
  margin-top: 8px;
69
68
  }
70
69
 
71
- ${_previewPlaceholder.StyledPreviewPlaceholder}:not(:first-of-type) {
70
+ ${_preview.StyledPreviewPlaceholder}:not(:first-of-type) {
72
71
  margin-top: 16px;
73
72
  }
74
73
  `;
@@ -46,6 +46,7 @@ const Pages = ({
46
46
  transitionName,
47
47
  timeout: TRANSITION_TIME,
48
48
  "data-element": "visible-page",
49
+ "data-role": "visible-page",
49
50
  className: visiblePage.props.className
50
51
  };
51
52
  return /*#__PURE__*/_react.default.cloneElement(visiblePage, additionalProps);
@@ -1,11 +1,21 @@
1
1
  import React from "react";
2
2
  import { MarginProps } from "styled-system";
3
- import { PreviewPlaceholderProps } from "./__internal__/preview-placeholder.component";
4
- export interface PreviewProps extends Partial<Omit<PreviewPlaceholderProps, "index">>, MarginProps {
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
- /** Provides more control over when in a loading state. */
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 === undefined ? !children : 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 = 1; i <= lines; i++) {
25
- placeholders.push( /*#__PURE__*/_react.default.createElement(_previewPlaceholder.default, _extends({
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
- index: i,
29
- lines: lines
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
- export { StyledPreview };
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 = _interopRequireDefault(require("styled-components"));
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), (0, _tags.default)("search", 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.9.1",
3
+ "version": "142.10.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.9.0",
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.43.0",
73
- "@playwright/test": "~1.43.0",
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
- `;