@workday/canvas-kit-react 12.4.0-1015-next.0 → 13.0.0-alpha.1009-next.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/button/lib/ExternalHyperlink.tsx +37 -32
- package/button/lib/Hyperlink.tsx +1 -1
- package/combobox/lib/hooks/useComboboxInputConstrained.ts +1 -0
- package/dist/commonjs/avatar/lib/Avatar.js +21 -21
- package/dist/commonjs/badge/lib/CountBadge.js +3 -3
- package/dist/commonjs/button/lib/BaseButton.js +21 -21
- package/dist/commonjs/button/lib/DeleteButton.js +1 -1
- package/dist/commonjs/button/lib/ExternalHyperlink.d.ts +19 -2
- package/dist/commonjs/button/lib/ExternalHyperlink.d.ts.map +1 -1
- package/dist/commonjs/button/lib/ExternalHyperlink.js +10 -21
- package/dist/commonjs/button/lib/Hyperlink.d.ts +18 -0
- package/dist/commonjs/button/lib/Hyperlink.d.ts.map +1 -1
- package/dist/commonjs/button/lib/Hyperlink.js +6 -6
- package/dist/commonjs/button/lib/PrimaryButton.js +2 -2
- package/dist/commonjs/button/lib/SecondaryButton.js +2 -2
- package/dist/commonjs/button/lib/TertiaryButton.js +18 -18
- package/dist/commonjs/card/lib/Card.js +1 -1
- package/dist/commonjs/card/lib/CardBody.js +1 -1
- package/dist/commonjs/card/lib/CardHeading.js +1 -1
- package/dist/commonjs/checkbox/lib/CheckBackground.js +3 -3
- package/dist/commonjs/checkbox/lib/CheckboxCheck.js +5 -5
- package/dist/commonjs/checkbox/lib/CheckboxContainer.js +1 -1
- package/dist/commonjs/checkbox/lib/CheckboxInput.js +5 -5
- package/dist/commonjs/checkbox/lib/CheckboxRipple.js +1 -1
- package/dist/commonjs/collection/lib/ListBox.js +3 -3
- package/dist/commonjs/combobox/lib/ComboboxMenuList.js +1 -1
- package/dist/commonjs/combobox/lib/hooks/useComboboxInputConstrained.d.ts.map +1 -1
- package/dist/commonjs/common/lib/AccessibleHide.js +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.js +1 -1
- package/dist/commonjs/form-field/lib/FormFieldContainer.js +1 -1
- package/dist/commonjs/form-field/lib/FormFieldField.js +1 -1
- package/dist/commonjs/form-field/lib/FormFieldGroupLabel.js +5 -5
- package/dist/commonjs/form-field/lib/FormFieldGroupList.js +3 -3
- package/dist/commonjs/form-field/lib/FormFieldHint.js +3 -3
- package/dist/commonjs/form-field/lib/FormFieldLabel.js +6 -6
- package/dist/commonjs/form-field/lib/formFieldStencil.js +8 -8
- package/dist/commonjs/icon/lib/AccentIcon.js +2 -2
- package/dist/commonjs/icon/lib/AppletIcon.js +1 -1
- package/dist/commonjs/icon/lib/Graphic.js +2 -2
- package/dist/commonjs/icon/lib/Svg.js +2 -2
- package/dist/commonjs/icon/lib/SystemIcon.js +1 -1
- package/dist/commonjs/icon/lib/SystemIconCircle.js +1 -1
- package/dist/commonjs/loading-dots/lib/LoadingDots.js +2 -2
- package/dist/commonjs/menu/lib/MenuCard.js +1 -1
- package/dist/commonjs/menu/lib/MenuItem.js +1 -1
- package/dist/commonjs/menu/lib/MenuList.js +3 -3
- package/dist/commonjs/menu/lib/MenuOption.js +1 -1
- package/dist/commonjs/modal/lib/ModalBody.js +1 -1
- package/dist/commonjs/modal/lib/ModalCard.js +1 -1
- package/dist/commonjs/modal/lib/ModalHeading.js +1 -1
- package/dist/commonjs/modal/lib/ModalOverflowOverlay.js +1 -1
- package/dist/commonjs/modal/lib/ModalOverlay.js +2 -2
- package/dist/commonjs/popup/lib/PopupBody.js +1 -1
- package/dist/commonjs/popup/lib/PopupCard.js +2 -2
- package/dist/commonjs/popup/lib/PopupCloseIcon.js +1 -1
- package/dist/commonjs/popup/lib/PopupHeading.js +1 -1
- package/dist/commonjs/select/lib/SelectCard.js +1 -1
- package/dist/commonjs/select/lib/SelectInput.js +3 -3
- package/dist/commonjs/skeleton/index.d.ts +4 -1
- package/dist/commonjs/skeleton/index.d.ts.map +1 -1
- package/dist/commonjs/skeleton/index.js +22 -3
- package/dist/{es6/skeleton/lib/skeleton.d.ts → commonjs/skeleton/lib/Skeleton.d.ts} +5 -4
- package/dist/commonjs/skeleton/lib/Skeleton.d.ts.map +1 -0
- package/dist/commonjs/skeleton/lib/{skeleton.js → Skeleton.js} +14 -27
- package/dist/commonjs/skeleton/lib/parts/SkeletonHeader.d.ts +29 -0
- package/dist/commonjs/skeleton/lib/parts/SkeletonHeader.d.ts.map +1 -0
- package/dist/commonjs/skeleton/lib/parts/{skeletonHeader.js → SkeletonHeader.js} +17 -4
- package/dist/commonjs/skeleton/lib/parts/SkeletonShape.d.ts +36 -0
- package/dist/commonjs/skeleton/lib/parts/SkeletonShape.d.ts.map +1 -0
- package/dist/commonjs/skeleton/lib/parts/SkeletonShape.js +50 -0
- package/dist/{es6/skeleton/lib/parts/skeletonText.d.ts → commonjs/skeleton/lib/parts/SkeletonText.d.ts} +7 -2
- package/dist/commonjs/skeleton/lib/parts/SkeletonText.d.ts.map +1 -0
- package/dist/commonjs/skeleton/lib/parts/{skeletonText.js → SkeletonText.js} +15 -25
- package/dist/commonjs/switch/lib/Switch.js +7 -7
- package/dist/commonjs/table/lib/Table.js +1 -1
- package/dist/commonjs/table/lib/TableBody.js +1 -1
- package/dist/commonjs/table/lib/TableCaption.js +1 -1
- package/dist/commonjs/table/lib/TableCell.js +1 -1
- package/dist/commonjs/table/lib/TableFooter.js +1 -1
- package/dist/commonjs/table/lib/TableHead.js +1 -1
- package/dist/commonjs/table/lib/TableHeader.js +1 -1
- package/dist/commonjs/table/lib/TableRow.js +1 -1
- package/dist/commonjs/text/lib/LabelText.js +6 -6
- package/dist/commonjs/text/lib/Text.js +16 -16
- package/dist/commonjs/text/lib/TypeLevelComponents.js +4 -4
- package/dist/commonjs/text-area/lib/TextArea.js +5 -5
- package/dist/commonjs/text-input/lib/InputGroup.js +6 -6
- package/dist/commonjs/text-input/lib/TextInput.js +5 -5
- package/dist/commonjs/toast/lib/Toast.js +1 -1
- package/dist/commonjs/toast/lib/ToastBody.js +1 -1
- package/dist/commonjs/toast/lib/ToastCloseIcon.js +1 -1
- package/dist/commonjs/toast/lib/ToastIcon.js +1 -1
- package/dist/commonjs/toast/lib/ToastMessage.js +1 -1
- package/dist/commonjs/tooltip/lib/Tooltip.d.ts +2 -13
- package/dist/commonjs/tooltip/lib/Tooltip.d.ts.map +1 -1
- package/dist/commonjs/tooltip/lib/useTooltip.d.ts +3 -4
- package/dist/commonjs/tooltip/lib/useTooltip.d.ts.map +1 -1
- package/dist/commonjs/tooltip/lib/useTooltip.js +0 -1
- package/dist/es6/avatar/lib/Avatar.js +21 -21
- package/dist/es6/badge/lib/CountBadge.js +3 -3
- package/dist/es6/button/lib/BaseButton.js +21 -21
- package/dist/es6/button/lib/DeleteButton.js +1 -1
- package/dist/es6/button/lib/ExternalHyperlink.d.ts +19 -2
- package/dist/es6/button/lib/ExternalHyperlink.d.ts.map +1 -1
- package/dist/es6/button/lib/ExternalHyperlink.js +12 -23
- package/dist/es6/button/lib/Hyperlink.d.ts +18 -0
- package/dist/es6/button/lib/Hyperlink.d.ts.map +1 -1
- package/dist/es6/button/lib/Hyperlink.js +4 -4
- package/dist/es6/button/lib/PrimaryButton.js +2 -2
- package/dist/es6/button/lib/SecondaryButton.js +2 -2
- package/dist/es6/button/lib/TertiaryButton.js +18 -18
- package/dist/es6/card/lib/Card.js +1 -1
- package/dist/es6/card/lib/CardBody.js +1 -1
- package/dist/es6/card/lib/CardHeading.js +1 -1
- package/dist/es6/checkbox/lib/CheckBackground.js +3 -3
- package/dist/es6/checkbox/lib/CheckboxCheck.js +5 -5
- package/dist/es6/checkbox/lib/CheckboxContainer.js +1 -1
- package/dist/es6/checkbox/lib/CheckboxInput.js +5 -5
- package/dist/es6/checkbox/lib/CheckboxRipple.js +1 -1
- package/dist/es6/collection/lib/ListBox.js +3 -3
- package/dist/es6/combobox/lib/ComboboxMenuList.js +1 -1
- package/dist/es6/combobox/lib/hooks/useComboboxInputConstrained.d.ts.map +1 -1
- package/dist/es6/common/lib/AccessibleHide.js +1 -1
- package/dist/es6/common/lib/CanvasProvider.js +1 -1
- package/dist/es6/form-field/lib/FormFieldContainer.js +1 -1
- package/dist/es6/form-field/lib/FormFieldField.js +1 -1
- package/dist/es6/form-field/lib/FormFieldGroupLabel.js +5 -5
- package/dist/es6/form-field/lib/FormFieldGroupList.js +3 -3
- package/dist/es6/form-field/lib/FormFieldHint.js +3 -3
- package/dist/es6/form-field/lib/FormFieldLabel.js +6 -6
- package/dist/es6/form-field/lib/formFieldStencil.js +8 -8
- package/dist/es6/icon/lib/AccentIcon.js +2 -2
- package/dist/es6/icon/lib/AppletIcon.js +1 -1
- package/dist/es6/icon/lib/Graphic.js +2 -2
- package/dist/es6/icon/lib/Svg.js +2 -2
- package/dist/es6/icon/lib/SystemIcon.js +1 -1
- package/dist/es6/icon/lib/SystemIconCircle.js +1 -1
- package/dist/es6/loading-dots/lib/LoadingDots.js +2 -2
- package/dist/es6/menu/lib/MenuCard.js +1 -1
- package/dist/es6/menu/lib/MenuItem.js +1 -1
- package/dist/es6/menu/lib/MenuList.js +3 -3
- package/dist/es6/menu/lib/MenuOption.js +1 -1
- package/dist/es6/modal/lib/ModalBody.js +1 -1
- package/dist/es6/modal/lib/ModalCard.js +1 -1
- package/dist/es6/modal/lib/ModalHeading.js +1 -1
- package/dist/es6/modal/lib/ModalOverflowOverlay.js +1 -1
- package/dist/es6/modal/lib/ModalOverlay.js +2 -2
- package/dist/es6/popup/lib/PopupBody.js +1 -1
- package/dist/es6/popup/lib/PopupCard.js +2 -2
- package/dist/es6/popup/lib/PopupCloseIcon.js +1 -1
- package/dist/es6/popup/lib/PopupHeading.js +1 -1
- package/dist/es6/select/lib/SelectCard.js +1 -1
- package/dist/es6/select/lib/SelectInput.js +3 -3
- package/dist/es6/skeleton/index.d.ts +4 -1
- package/dist/es6/skeleton/index.d.ts.map +1 -1
- package/dist/es6/skeleton/index.js +4 -1
- package/dist/{commonjs/skeleton/lib/skeleton.d.ts → es6/skeleton/lib/Skeleton.d.ts} +5 -4
- package/dist/es6/skeleton/lib/Skeleton.d.ts.map +1 -0
- package/dist/es6/skeleton/lib/{skeleton.js → Skeleton.js} +10 -20
- package/dist/es6/skeleton/lib/parts/SkeletonHeader.d.ts +29 -0
- package/dist/es6/skeleton/lib/parts/SkeletonHeader.d.ts.map +1 -0
- package/dist/es6/skeleton/lib/parts/SkeletonHeader.js +21 -0
- package/dist/es6/skeleton/lib/parts/SkeletonShape.d.ts +36 -0
- package/dist/es6/skeleton/lib/parts/SkeletonShape.d.ts.map +1 -0
- package/dist/es6/skeleton/lib/parts/SkeletonShape.js +24 -0
- package/dist/{commonjs/skeleton/lib/parts/skeletonText.d.ts → es6/skeleton/lib/parts/SkeletonText.d.ts} +7 -2
- package/dist/es6/skeleton/lib/parts/SkeletonText.d.ts.map +1 -0
- package/dist/es6/skeleton/lib/parts/SkeletonText.js +19 -0
- package/dist/es6/switch/lib/Switch.js +7 -7
- package/dist/es6/table/lib/Table.js +1 -1
- package/dist/es6/table/lib/TableBody.js +1 -1
- package/dist/es6/table/lib/TableCaption.js +1 -1
- package/dist/es6/table/lib/TableCell.js +1 -1
- package/dist/es6/table/lib/TableFooter.js +1 -1
- package/dist/es6/table/lib/TableHead.js +1 -1
- package/dist/es6/table/lib/TableHeader.js +1 -1
- package/dist/es6/table/lib/TableRow.js +1 -1
- package/dist/es6/text/lib/LabelText.js +6 -6
- package/dist/es6/text/lib/Text.js +16 -16
- package/dist/es6/text/lib/TypeLevelComponents.js +4 -4
- package/dist/es6/text-area/lib/TextArea.js +5 -5
- package/dist/es6/text-input/lib/InputGroup.js +6 -6
- package/dist/es6/text-input/lib/TextInput.js +5 -5
- package/dist/es6/toast/lib/Toast.js +1 -1
- package/dist/es6/toast/lib/ToastBody.js +1 -1
- package/dist/es6/toast/lib/ToastCloseIcon.js +1 -1
- package/dist/es6/toast/lib/ToastIcon.js +1 -1
- package/dist/es6/toast/lib/ToastMessage.js +1 -1
- package/dist/es6/tooltip/lib/Tooltip.d.ts +2 -13
- package/dist/es6/tooltip/lib/Tooltip.d.ts.map +1 -1
- package/dist/es6/tooltip/lib/useTooltip.d.ts +3 -4
- package/dist/es6/tooltip/lib/useTooltip.d.ts.map +1 -1
- package/dist/es6/tooltip/lib/useTooltip.js +0 -1
- package/package.json +4 -4
- package/skeleton/index.ts +4 -1
- package/skeleton/lib/{skeleton.tsx → Skeleton.tsx} +19 -20
- package/skeleton/lib/parts/SkeletonHeader.tsx +68 -0
- package/skeleton/lib/parts/SkeletonShape.tsx +68 -0
- package/skeleton/lib/parts/SkeletonText.tsx +59 -0
- package/tooltip/lib/Tooltip.tsx +2 -13
- package/tooltip/lib/useTooltip.tsx +3 -4
- package/dist/commonjs/skeleton/lib/parts/skeletonHeader.d.ts +0 -19
- package/dist/commonjs/skeleton/lib/parts/skeletonHeader.d.ts.map +0 -1
- package/dist/commonjs/skeleton/lib/parts/skeletonShape.d.ts +0 -24
- package/dist/commonjs/skeleton/lib/parts/skeletonShape.d.ts.map +0 -1
- package/dist/commonjs/skeleton/lib/parts/skeletonShape.js +0 -44
- package/dist/commonjs/skeleton/lib/parts/skeletonText.d.ts.map +0 -1
- package/dist/commonjs/skeleton/lib/skeleton.d.ts.map +0 -1
- package/dist/es6/skeleton/lib/parts/skeletonHeader.d.ts +0 -19
- package/dist/es6/skeleton/lib/parts/skeletonHeader.d.ts.map +0 -1
- package/dist/es6/skeleton/lib/parts/skeletonHeader.js +0 -8
- package/dist/es6/skeleton/lib/parts/skeletonShape.d.ts +0 -24
- package/dist/es6/skeleton/lib/parts/skeletonShape.d.ts.map +0 -1
- package/dist/es6/skeleton/lib/parts/skeletonShape.js +0 -15
- package/dist/es6/skeleton/lib/parts/skeletonText.d.ts.map +0 -1
- package/dist/es6/skeleton/lib/parts/skeletonText.js +0 -26
- package/dist/es6/skeleton/lib/skeleton.d.ts.map +0 -1
- package/skeleton/lib/parts/skeletonHeader.tsx +0 -48
- package/skeleton/lib/parts/skeletonShape.tsx +0 -63
- package/skeleton/lib/parts/skeletonText.tsx +0 -65
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
import { createComponent, filterOutProps } from '@workday/canvas-kit-react/common';
|
|
4
|
-
import { borderRadius, colors, space } from '@workday/canvas-kit-react/tokens';
|
|
5
|
-
const TextContainer = styled('div')({
|
|
6
|
-
marginBottom: space.m,
|
|
7
|
-
});
|
|
8
|
-
const Line = styled('div', {
|
|
9
|
-
shouldForwardProp: filterOutProps(['backgroundColor', 'width']),
|
|
10
|
-
})(({ backgroundColor, width }) => {
|
|
11
|
-
return {
|
|
12
|
-
backgroundColor,
|
|
13
|
-
width,
|
|
14
|
-
borderRadius: borderRadius.s,
|
|
15
|
-
height: '21px',
|
|
16
|
-
marginBottom: space.xs,
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
const createTextLines = (lineCount, backgroundColor) => {
|
|
20
|
-
const lines = new Array(lineCount).fill(null);
|
|
21
|
-
return lines.map((_value, index) => (React.createElement(Line, { key: index, backgroundColor: backgroundColor, width: index < lineCount - 1 || lineCount === 1 ? '100%' : '60%' })));
|
|
22
|
-
};
|
|
23
|
-
export const SkeletonText = createComponent('div')({
|
|
24
|
-
displayName: 'Skeleton.Text',
|
|
25
|
-
Component: ({ backgroundColor = colors.soap200, lineCount = 2, ...elemProps }, ref, Element) => lineCount <= 0 ? null : (React.createElement(TextContainer, { ref: ref, as: Element, ...elemProps }, createTextLines(lineCount, backgroundColor))),
|
|
26
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.d.ts","sourceRoot":"","sources":["../../../../skeleton/lib/skeleton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,WAAW,aAAa;IAC5B;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAmBD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ;IAcjB;;OAEG;;IAEH;;;;OAIG;;IAEH;;;;OAIG;;CAGL,CAAC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
4
|
-
import {borderRadius, colors} from '@workday/canvas-kit-react/tokens';
|
|
5
|
-
|
|
6
|
-
import {SkeletonShape} from './skeletonShape';
|
|
7
|
-
|
|
8
|
-
export interface SkeletonHeaderProps {
|
|
9
|
-
/**
|
|
10
|
-
* The background color of the skeleton
|
|
11
|
-
* @default soap200
|
|
12
|
-
*/
|
|
13
|
-
backgroundColor?: string;
|
|
14
|
-
/**
|
|
15
|
-
* The height of the shape in `px` or `%`.
|
|
16
|
-
* @default 28px
|
|
17
|
-
*/
|
|
18
|
-
height?: number | string;
|
|
19
|
-
/**
|
|
20
|
-
* The width of the shape in `px` or `%`.
|
|
21
|
-
* @default 100%
|
|
22
|
-
*/
|
|
23
|
-
width?: number | string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const SkeletonHeader = createComponent('div')({
|
|
27
|
-
displayName: 'Skeleton.Header',
|
|
28
|
-
Component: (
|
|
29
|
-
{
|
|
30
|
-
backgroundColor = colors.soap200,
|
|
31
|
-
height = '28px',
|
|
32
|
-
width = '100%',
|
|
33
|
-
...elemProps
|
|
34
|
-
}: SkeletonHeaderProps,
|
|
35
|
-
ref,
|
|
36
|
-
Element
|
|
37
|
-
) => (
|
|
38
|
-
<SkeletonShape
|
|
39
|
-
ref={ref}
|
|
40
|
-
as={Element}
|
|
41
|
-
backgroundColor={backgroundColor}
|
|
42
|
-
borderRadius={borderRadius.s}
|
|
43
|
-
height={height}
|
|
44
|
-
width={width}
|
|
45
|
-
{...elemProps}
|
|
46
|
-
/>
|
|
47
|
-
),
|
|
48
|
-
});
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
|
|
4
|
-
import {createComponent, StyledType} from '@workday/canvas-kit-react/common';
|
|
5
|
-
import {colors, space} from '@workday/canvas-kit-react/tokens';
|
|
6
|
-
|
|
7
|
-
export interface SkeletonShapeProps {
|
|
8
|
-
/**
|
|
9
|
-
* The width of the shape in `px` or `%`.
|
|
10
|
-
* @default 100%
|
|
11
|
-
*/
|
|
12
|
-
width?: number | string;
|
|
13
|
-
/**
|
|
14
|
-
* The height of the shape in `px` or `%`.
|
|
15
|
-
* @default 100%
|
|
16
|
-
*/
|
|
17
|
-
height?: number | string;
|
|
18
|
-
/**
|
|
19
|
-
* The borderRadius of the shape in `px` or `%`.
|
|
20
|
-
* @default 0
|
|
21
|
-
*/
|
|
22
|
-
borderRadius?: number | string;
|
|
23
|
-
/**
|
|
24
|
-
* The background color of the skeleton
|
|
25
|
-
* @default soap200
|
|
26
|
-
*/
|
|
27
|
-
backgroundColor?: string;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const Shape = styled('div')<SkeletonShapeProps & StyledType>(
|
|
31
|
-
({backgroundColor, borderRadius, height, width}) => ({
|
|
32
|
-
backgroundColor,
|
|
33
|
-
borderRadius,
|
|
34
|
-
height,
|
|
35
|
-
width,
|
|
36
|
-
marginBottom: space.s,
|
|
37
|
-
})
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
export const SkeletonShape = createComponent('div')({
|
|
41
|
-
displayName: 'Skeleton.Shape',
|
|
42
|
-
Component: (
|
|
43
|
-
{
|
|
44
|
-
backgroundColor = colors.soap200,
|
|
45
|
-
borderRadius = 0,
|
|
46
|
-
height = '100%',
|
|
47
|
-
width = '100%',
|
|
48
|
-
...elemProps
|
|
49
|
-
}: SkeletonShapeProps,
|
|
50
|
-
ref,
|
|
51
|
-
Element
|
|
52
|
-
) => (
|
|
53
|
-
<Shape
|
|
54
|
-
ref={ref}
|
|
55
|
-
as={Element}
|
|
56
|
-
backgroundColor={backgroundColor}
|
|
57
|
-
borderRadius={borderRadius}
|
|
58
|
-
height={height}
|
|
59
|
-
width={width}
|
|
60
|
-
{...elemProps}
|
|
61
|
-
/>
|
|
62
|
-
),
|
|
63
|
-
});
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
|
|
4
|
-
import {createComponent, filterOutProps, StyledType} from '@workday/canvas-kit-react/common';
|
|
5
|
-
import {borderRadius, colors, space} from '@workday/canvas-kit-react/tokens';
|
|
6
|
-
|
|
7
|
-
const TextContainer = styled('div')<StyledType>({
|
|
8
|
-
marginBottom: space.m,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export interface SkeletonTextProps {
|
|
12
|
-
/**
|
|
13
|
-
* The number of "lines" that SkeletonText will display. If there is more than one line, the last line will have a width of `60%`.
|
|
14
|
-
* @default 2
|
|
15
|
-
*/
|
|
16
|
-
lineCount?: number;
|
|
17
|
-
/**
|
|
18
|
-
* The background color of the skeleton
|
|
19
|
-
* @default soap200
|
|
20
|
-
*/
|
|
21
|
-
backgroundColor?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const Line = styled('div', {
|
|
25
|
-
shouldForwardProp: filterOutProps(['backgroundColor', 'width']),
|
|
26
|
-
})<
|
|
27
|
-
{
|
|
28
|
-
backgroundColor: string;
|
|
29
|
-
width: number | string;
|
|
30
|
-
} & StyledType
|
|
31
|
-
>(({backgroundColor, width}) => {
|
|
32
|
-
return {
|
|
33
|
-
backgroundColor,
|
|
34
|
-
width,
|
|
35
|
-
borderRadius: borderRadius.s,
|
|
36
|
-
height: '21px',
|
|
37
|
-
marginBottom: space.xs,
|
|
38
|
-
};
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const createTextLines = (lineCount: number, backgroundColor: string) => {
|
|
42
|
-
const lines = new Array(lineCount).fill(null);
|
|
43
|
-
|
|
44
|
-
return lines.map((_value, index) => (
|
|
45
|
-
<Line
|
|
46
|
-
key={index}
|
|
47
|
-
backgroundColor={backgroundColor}
|
|
48
|
-
width={index < lineCount - 1 || lineCount === 1 ? '100%' : '60%'}
|
|
49
|
-
/>
|
|
50
|
-
));
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const SkeletonText = createComponent('div')({
|
|
54
|
-
displayName: 'Skeleton.Text',
|
|
55
|
-
Component: (
|
|
56
|
-
{backgroundColor = colors.soap200, lineCount = 2, ...elemProps}: SkeletonTextProps,
|
|
57
|
-
ref,
|
|
58
|
-
Element
|
|
59
|
-
) =>
|
|
60
|
-
lineCount <= 0 ? null : (
|
|
61
|
-
<TextContainer ref={ref} as={Element} {...elemProps}>
|
|
62
|
-
{createTextLines(lineCount, backgroundColor)}
|
|
63
|
-
</TextContainer>
|
|
64
|
-
),
|
|
65
|
-
});
|