@workday/canvas-kit-react 13.0.0-alpha.1007-next.0 → 13.0.0-alpha.1011-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/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/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/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
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {
|
|
5
|
+
createStencil,
|
|
6
|
+
handleCsProp,
|
|
7
|
+
px2rem,
|
|
8
|
+
cssVar,
|
|
9
|
+
calc,
|
|
10
|
+
CSProps,
|
|
11
|
+
} from '@workday/canvas-kit-styling';
|
|
12
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
13
|
+
import {SkeletonShape} from './SkeletonShape';
|
|
14
|
+
|
|
15
|
+
export interface SkeletonHeaderProps extends CSProps {
|
|
16
|
+
/**
|
|
17
|
+
* The background color of the skeleton
|
|
18
|
+
* @default `system.color.bg.alt.strong`
|
|
19
|
+
*/
|
|
20
|
+
backgroundColor?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The height of the shape in `px` or `%`.
|
|
23
|
+
* @default 28px
|
|
24
|
+
*/
|
|
25
|
+
height?: number | string;
|
|
26
|
+
/**
|
|
27
|
+
* The width of the shape in `px` or `%`.
|
|
28
|
+
* @default 100%
|
|
29
|
+
*/
|
|
30
|
+
width?: number | string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const skeletonHeaderStencil = createStencil({
|
|
34
|
+
vars: {
|
|
35
|
+
width: '',
|
|
36
|
+
height: '',
|
|
37
|
+
backgroundColor: '',
|
|
38
|
+
},
|
|
39
|
+
base: ({width, backgroundColor, height}) => ({
|
|
40
|
+
backgroundColor: cssVar(backgroundColor, system.color.bg.alt.strong),
|
|
41
|
+
borderRadius: 0,
|
|
42
|
+
height: cssVar(height, calc.multiply(system.space.x1, 7)),
|
|
43
|
+
width: width,
|
|
44
|
+
marginBottom: system.space.x4,
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const SkeletonHeader = createComponent('div')<SkeletonHeaderProps>({
|
|
49
|
+
displayName: 'Skeleton.Header',
|
|
50
|
+
Component: (
|
|
51
|
+
{width = '100%', backgroundColor, height, ...elemProps}: SkeletonHeaderProps,
|
|
52
|
+
ref,
|
|
53
|
+
Element
|
|
54
|
+
) => (
|
|
55
|
+
<SkeletonShape
|
|
56
|
+
ref={ref}
|
|
57
|
+
as={Element}
|
|
58
|
+
{...handleCsProp(
|
|
59
|
+
elemProps,
|
|
60
|
+
skeletonHeaderStencil({
|
|
61
|
+
width: typeof width === 'number' ? px2rem(width) : width,
|
|
62
|
+
backgroundColor: backgroundColor,
|
|
63
|
+
height: typeof height === 'number' ? px2rem(height) : height,
|
|
64
|
+
})
|
|
65
|
+
)}
|
|
66
|
+
/>
|
|
67
|
+
),
|
|
68
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {createStencil, CSProps, cssVar, handleCsProp, px2rem} from '@workday/canvas-kit-styling';
|
|
5
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
6
|
+
|
|
7
|
+
export interface SkeletonShapeProps extends CSProps {
|
|
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 `system.color.bg.alt.strong`
|
|
26
|
+
*/
|
|
27
|
+
backgroundColor?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const skeletonShapeStencil = createStencil({
|
|
31
|
+
vars: {
|
|
32
|
+
width: '',
|
|
33
|
+
height: '',
|
|
34
|
+
borderRadius: '',
|
|
35
|
+
backgroundColor: '',
|
|
36
|
+
},
|
|
37
|
+
base: ({width, height, borderRadius, backgroundColor}) => ({
|
|
38
|
+
backgroundColor: cssVar(backgroundColor, system.color.bg.alt.strong),
|
|
39
|
+
borderRadius: cssVar(borderRadius, system.space.zero),
|
|
40
|
+
height: cssVar(height, '100%'),
|
|
41
|
+
width: width,
|
|
42
|
+
marginBottom: system.space.x4,
|
|
43
|
+
}),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const SkeletonShape = createComponent('div')({
|
|
47
|
+
displayName: 'Skeleton.Shape',
|
|
48
|
+
Component: (
|
|
49
|
+
{width = '100%', height, backgroundColor, borderRadius, ...elemProps}: SkeletonShapeProps,
|
|
50
|
+
ref,
|
|
51
|
+
Element
|
|
52
|
+
) => {
|
|
53
|
+
return (
|
|
54
|
+
<Element
|
|
55
|
+
ref={ref}
|
|
56
|
+
{...handleCsProp(
|
|
57
|
+
elemProps,
|
|
58
|
+
skeletonShapeStencil({
|
|
59
|
+
width: typeof width === 'number' ? px2rem(width) : width,
|
|
60
|
+
height: typeof height === 'number' ? px2rem(height) : height,
|
|
61
|
+
backgroundColor,
|
|
62
|
+
borderRadius: typeof borderRadius === 'number' ? px2rem(borderRadius) : borderRadius,
|
|
63
|
+
})
|
|
64
|
+
)}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {createStencil, cssVar, handleCsProp, px2rem} from '@workday/canvas-kit-styling';
|
|
5
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
6
|
+
|
|
7
|
+
export interface SkeletonTextProps {
|
|
8
|
+
/**
|
|
9
|
+
* The number of "lines" that SkeletonText will display. If there is more than one line, the last line will have a width of `60%`.
|
|
10
|
+
* @default 2
|
|
11
|
+
*/
|
|
12
|
+
lineCount?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The background color of the skeleton
|
|
15
|
+
* @default `system.color.bg.alt.strong`
|
|
16
|
+
*/
|
|
17
|
+
backgroundColor?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const skeletonTextStencil = createStencil({
|
|
21
|
+
vars: {
|
|
22
|
+
backgroundColor: '',
|
|
23
|
+
},
|
|
24
|
+
base: ({backgroundColor}) => ({
|
|
25
|
+
marginBottom: system.space.x6,
|
|
26
|
+
'& [data-part="skeleton-text-lines"]': {
|
|
27
|
+
backgroundColor: cssVar(backgroundColor, system.color.bg.alt.strong),
|
|
28
|
+
height: px2rem(21),
|
|
29
|
+
marginBlockEnd: system.space.x3,
|
|
30
|
+
borderRadius: system.shape.half,
|
|
31
|
+
width: '100%',
|
|
32
|
+
},
|
|
33
|
+
'& [data-part="skeleton-text-lines"]:last-child': {
|
|
34
|
+
width: '60%',
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const SkeletonText = createComponent('div')({
|
|
40
|
+
displayName: 'Skeleton.Text',
|
|
41
|
+
Component: ({backgroundColor, lineCount = 2, ...elemProps}: SkeletonTextProps, ref, Element) => {
|
|
42
|
+
const lines = new Array(lineCount).fill(null);
|
|
43
|
+
return lineCount <= 0 ? null : (
|
|
44
|
+
<Element
|
|
45
|
+
ref={ref}
|
|
46
|
+
{...handleCsProp(
|
|
47
|
+
elemProps,
|
|
48
|
+
skeletonTextStencil({
|
|
49
|
+
backgroundColor,
|
|
50
|
+
})
|
|
51
|
+
)}
|
|
52
|
+
>
|
|
53
|
+
{lines.map((_value, index) => (
|
|
54
|
+
<div data-part={'skeleton-text-lines'} key={index}></div>
|
|
55
|
+
))}
|
|
56
|
+
</Element>
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export interface SkeletonHeaderProps {
|
|
2
|
-
/**
|
|
3
|
-
* The background color of the skeleton
|
|
4
|
-
* @default soap200
|
|
5
|
-
*/
|
|
6
|
-
backgroundColor?: string;
|
|
7
|
-
/**
|
|
8
|
-
* The height of the shape in `px` or `%`.
|
|
9
|
-
* @default 28px
|
|
10
|
-
*/
|
|
11
|
-
height?: number | string;
|
|
12
|
-
/**
|
|
13
|
-
* The width of the shape in `px` or `%`.
|
|
14
|
-
* @default 100%
|
|
15
|
-
*/
|
|
16
|
-
width?: number | string;
|
|
17
|
-
}
|
|
18
|
-
export declare const SkeletonHeader: import("@workday/canvas-kit-react/common").ElementComponent<"div", SkeletonHeaderProps>;
|
|
19
|
-
//# sourceMappingURL=skeletonHeader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skeletonHeader.d.ts","sourceRoot":"","sources":["../../../../../skeleton/lib/parts/skeletonHeader.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,cAAc,yFAsBzB,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface SkeletonShapeProps {
|
|
2
|
-
/**
|
|
3
|
-
* The width of the shape in `px` or `%`.
|
|
4
|
-
* @default 100%
|
|
5
|
-
*/
|
|
6
|
-
width?: number | string;
|
|
7
|
-
/**
|
|
8
|
-
* The height of the shape in `px` or `%`.
|
|
9
|
-
* @default 100%
|
|
10
|
-
*/
|
|
11
|
-
height?: number | string;
|
|
12
|
-
/**
|
|
13
|
-
* The borderRadius of the shape in `px` or `%`.
|
|
14
|
-
* @default 0
|
|
15
|
-
*/
|
|
16
|
-
borderRadius?: number | string;
|
|
17
|
-
/**
|
|
18
|
-
* The background color of the skeleton
|
|
19
|
-
* @default soap200
|
|
20
|
-
*/
|
|
21
|
-
backgroundColor?: string;
|
|
22
|
-
}
|
|
23
|
-
export declare const SkeletonShape: import("@workday/canvas-kit-react/common").ElementComponent<"div", SkeletonShapeProps>;
|
|
24
|
-
//# sourceMappingURL=skeletonShape.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skeletonShape.d.ts","sourceRoot":"","sources":["../../../../../skeleton/lib/parts/skeletonShape.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAYD,eAAO,MAAM,aAAa,wFAuBxB,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.SkeletonShape = void 0;
|
|
30
|
-
const React = __importStar(require("react"));
|
|
31
|
-
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
32
|
-
const common_1 = require("@workday/canvas-kit-react/common");
|
|
33
|
-
const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
34
|
-
const Shape = (0, styled_1.default)('div')(({ backgroundColor, borderRadius, height, width }) => ({
|
|
35
|
-
backgroundColor,
|
|
36
|
-
borderRadius,
|
|
37
|
-
height,
|
|
38
|
-
width,
|
|
39
|
-
marginBottom: tokens_1.space.s,
|
|
40
|
-
}));
|
|
41
|
-
exports.SkeletonShape = (0, common_1.createComponent)('div')({
|
|
42
|
-
displayName: 'Skeleton.Shape',
|
|
43
|
-
Component: ({ backgroundColor = tokens_1.colors.soap200, borderRadius = 0, height = '100%', width = '100%', ...elemProps }, ref, Element) => (React.createElement(Shape, { ref: ref, as: Element, backgroundColor: backgroundColor, borderRadius: borderRadius, height: height, width: width, ...elemProps })),
|
|
44
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skeletonText.d.ts","sourceRoot":"","sources":["../../../../../skeleton/lib/parts/skeletonText.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AA+BD,eAAO,MAAM,YAAY,uFAYvB,CAAC"}
|
|
@@ -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,19 +0,0 @@
|
|
|
1
|
-
export interface SkeletonHeaderProps {
|
|
2
|
-
/**
|
|
3
|
-
* The background color of the skeleton
|
|
4
|
-
* @default soap200
|
|
5
|
-
*/
|
|
6
|
-
backgroundColor?: string;
|
|
7
|
-
/**
|
|
8
|
-
* The height of the shape in `px` or `%`.
|
|
9
|
-
* @default 28px
|
|
10
|
-
*/
|
|
11
|
-
height?: number | string;
|
|
12
|
-
/**
|
|
13
|
-
* The width of the shape in `px` or `%`.
|
|
14
|
-
* @default 100%
|
|
15
|
-
*/
|
|
16
|
-
width?: number | string;
|
|
17
|
-
}
|
|
18
|
-
export declare const SkeletonHeader: import("@workday/canvas-kit-react/common").ElementComponent<"div", SkeletonHeaderProps>;
|
|
19
|
-
//# sourceMappingURL=skeletonHeader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skeletonHeader.d.ts","sourceRoot":"","sources":["../../../../../skeleton/lib/parts/skeletonHeader.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,cAAc,yFAsBzB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { borderRadius, colors } from '@workday/canvas-kit-react/tokens';
|
|
4
|
-
import { SkeletonShape } from './skeletonShape';
|
|
5
|
-
export const SkeletonHeader = createComponent('div')({
|
|
6
|
-
displayName: 'Skeleton.Header',
|
|
7
|
-
Component: ({ backgroundColor = colors.soap200, height = '28px', width = '100%', ...elemProps }, ref, Element) => (React.createElement(SkeletonShape, { ref: ref, as: Element, backgroundColor: backgroundColor, borderRadius: borderRadius.s, height: height, width: width, ...elemProps })),
|
|
8
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export interface SkeletonShapeProps {
|
|
2
|
-
/**
|
|
3
|
-
* The width of the shape in `px` or `%`.
|
|
4
|
-
* @default 100%
|
|
5
|
-
*/
|
|
6
|
-
width?: number | string;
|
|
7
|
-
/**
|
|
8
|
-
* The height of the shape in `px` or `%`.
|
|
9
|
-
* @default 100%
|
|
10
|
-
*/
|
|
11
|
-
height?: number | string;
|
|
12
|
-
/**
|
|
13
|
-
* The borderRadius of the shape in `px` or `%`.
|
|
14
|
-
* @default 0
|
|
15
|
-
*/
|
|
16
|
-
borderRadius?: number | string;
|
|
17
|
-
/**
|
|
18
|
-
* The background color of the skeleton
|
|
19
|
-
* @default soap200
|
|
20
|
-
*/
|
|
21
|
-
backgroundColor?: string;
|
|
22
|
-
}
|
|
23
|
-
export declare const SkeletonShape: import("@workday/canvas-kit-react/common").ElementComponent<"div", SkeletonShapeProps>;
|
|
24
|
-
//# sourceMappingURL=skeletonShape.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skeletonShape.d.ts","sourceRoot":"","sources":["../../../../../skeleton/lib/parts/skeletonShape.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAYD,eAAO,MAAM,aAAa,wFAuBxB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
4
|
-
import { colors, space } from '@workday/canvas-kit-react/tokens';
|
|
5
|
-
const Shape = styled('div')(({ backgroundColor, borderRadius, height, width }) => ({
|
|
6
|
-
backgroundColor,
|
|
7
|
-
borderRadius,
|
|
8
|
-
height,
|
|
9
|
-
width,
|
|
10
|
-
marginBottom: space.s,
|
|
11
|
-
}));
|
|
12
|
-
export const SkeletonShape = createComponent('div')({
|
|
13
|
-
displayName: 'Skeleton.Shape',
|
|
14
|
-
Component: ({ backgroundColor = colors.soap200, borderRadius = 0, height = '100%', width = '100%', ...elemProps }, ref, Element) => (React.createElement(Shape, { ref: ref, as: Element, backgroundColor: backgroundColor, borderRadius: borderRadius, height: height, width: width, ...elemProps })),
|
|
15
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skeletonText.d.ts","sourceRoot":"","sources":["../../../../../skeleton/lib/parts/skeletonText.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AA+BD,eAAO,MAAM,YAAY,uFAYvB,CAAC"}
|
|
@@ -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
|
-
});
|