@workday/canvas-kit-docs 8.0.0-alpha.144-next.0 → 8.0.0-alpha.151-next.3
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/dist/mdx/8.0-UPGRADE-GUIDE.mdx +28 -2
- package/dist/mdx/preview-react/_examples/examples/SidePanelWithOverlay.tsx +5 -8
- package/dist/mdx/preview-react/side-panel/examples/AlwaysOpen.tsx +12 -9
- package/dist/mdx/preview-react/side-panel/examples/Basic.tsx +11 -9
- package/dist/mdx/preview-react/side-panel/examples/ExternalControl.tsx +10 -9
- package/dist/mdx/preview-react/side-panel/examples/RightOrigin.tsx +10 -8
- package/dist/mdx/preview-react/side-panel/examples/Variant.tsx +11 -9
- package/dist/mdx/preview-react/text-area/examples/Alert.tsx +3 -2
- package/dist/mdx/react/_examples/examples/PageHeader.tsx +13 -11
- package/dist/mdx/react/layout/Box.mdx +30 -3
- package/dist/mdx/react/layout/Grid.mdx +130 -0
- package/dist/mdx/react/layout/examples/Flex/FlexCard.tsx +7 -19
- package/dist/mdx/react/layout/examples/Flex/Usage.tsx +31 -48
- package/dist/mdx/react/layout/examples/Font.tsx +21 -0
- package/dist/mdx/react/layout/examples/Grid/GridCard.tsx +44 -0
- package/dist/mdx/react/layout/examples/Grid/GridLayout.tsx +65 -0
- package/dist/mdx/react/layout/examples/Grid/GridLayoutInteractive.tsx +114 -0
- package/dist/mdx/react/layout/examples/Grid/UIExample.tsx +71 -0
- package/dist/mdx/react/layout/examples/PropTables.splitprops.tsx +3 -1
- package/dist/mdx/react/layout/examples/Stack/HStackCards.tsx +7 -3
- package/dist/mdx/react/layout/examples/Stack/StackCard.tsx +6 -4
- package/dist/mdx/react/layout/examples/Stack/VStackCards.tsx +7 -3
- package/dist/mdx/react/layout/examples/Text.tsx +32 -0
- package/dist/mdx/react/radio/examples/NoValue.tsx +2 -2
- package/dist/mdx/react/skeleton/examples/Simulation.tsx +4 -8
- package/dist/mdx/react/text/PropTables.splitprops.tsx +15 -0
- package/dist/mdx/react/text/Text.mdx +129 -0
- package/dist/mdx/react/text/examples/BodyText.tsx +10 -0
- package/dist/mdx/react/text/examples/Heading.tsx +16 -0
- package/dist/mdx/react/text/examples/Label.tsx +14 -0
- package/dist/mdx/react/text/examples/Subtext.tsx +10 -0
- package/dist/mdx/react/text/examples/Text.tsx +23 -0
- package/dist/mdx/react/text/examples/Title.tsx +16 -0
- package/package.json +3 -3
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {Basic as BasicText} from './examples/Text';
|
|
2
|
+
import Label from './examples/Label';
|
|
3
|
+
import BodyText from './examples/BodyText';
|
|
4
|
+
import Heading from './examples/Heading';
|
|
5
|
+
import Subtext from './examples/Subtext';
|
|
6
|
+
import Title from './examples/Title';
|
|
7
|
+
|
|
8
|
+
import {TextComponent, LabelComponent, TypeLevelComponent} from './PropTables.splitprops.tsx';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# Canvas Kit React Text
|
|
12
|
+
|
|
13
|
+
`Text` is a group of text components that provide a common, ergonomic API to render text with
|
|
14
|
+
simplified usage of Canvas Kit type token.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
yarn add @workday/canvas-kit-react
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Text
|
|
23
|
+
|
|
24
|
+
### Usage
|
|
25
|
+
|
|
26
|
+
`Text` is the base component that is used to render text in the UI. It is built off of our `Box`
|
|
27
|
+
component which allows the use of styles props such as `display`, `margin`, `padding` as well as the
|
|
28
|
+
most common type styles such as `fontWeight`, `fontSize` amongst others. This component is an
|
|
29
|
+
extension of our [type tokens](https://canvas.workdaydesign.com/tokens/type/#type-styles),
|
|
30
|
+
therefore, props like `typeLevel` and `variant` all exists.
|
|
31
|
+
|
|
32
|
+
By default `Text` component is a `span` element, but it's possible to override the element by
|
|
33
|
+
passing `as` prop.
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<Text as="p" fontSize={14} fontWeight="medium">
|
|
37
|
+
Text here...
|
|
38
|
+
</Text>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
<ExampleCodeBlock code={BasicText} />
|
|
42
|
+
|
|
43
|
+
### Text Props
|
|
44
|
+
|
|
45
|
+
As previously mentioned, `Text` is built on top of `Box` and has access to all its props. In
|
|
46
|
+
addition `Text` has its own props:
|
|
47
|
+
|
|
48
|
+
<ArgsTable of={TextComponent} />
|
|
49
|
+
|
|
50
|
+
## LabelText
|
|
51
|
+
|
|
52
|
+
`LabelText` is a `label` element build based on the top of `Text` component with added ability to
|
|
53
|
+
add a cursor or disabled style.
|
|
54
|
+
|
|
55
|
+
### Usage
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
<LabelText cursor="pointer" disabled={true}>
|
|
59
|
+
Text here...
|
|
60
|
+
</LabelText>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
<ExampleCodeBlock code={Label} />
|
|
64
|
+
|
|
65
|
+
### LabelText Props
|
|
66
|
+
|
|
67
|
+
In addition to `Text` component props, `LabelText` has the following props:
|
|
68
|
+
|
|
69
|
+
<ArgsTable of={LabelComponent} />
|
|
70
|
+
|
|
71
|
+
## Type Level Components
|
|
72
|
+
|
|
73
|
+
Type Level Components, `Subtext`, `BodyText`, `Heading` and `Title`, apply type token styles to text
|
|
74
|
+
element. Instead of passing type level token you can use one of Type Level Components, like in
|
|
75
|
+
example below:
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
// v7
|
|
79
|
+
<p css={{...type.levels.subtext.small}}>Small Subtext Text</p>
|
|
80
|
+
|
|
81
|
+
// v8
|
|
82
|
+
<Subtext size="small">Small Subtext Text</Subtext>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Props
|
|
86
|
+
|
|
87
|
+
In addition to `Text` component props, each type level components has the following props:
|
|
88
|
+
|
|
89
|
+
<ArgsTable of={TypeLevelComponent} />
|
|
90
|
+
|
|
91
|
+
### BodyText
|
|
92
|
+
|
|
93
|
+
`BodyText` component renders text with `type.levels.body[size]` styles.
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
<BodyText size="small">Small Body Text</BodyText>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
<ExampleCodeBlock code={BodyText} />
|
|
100
|
+
|
|
101
|
+
### Heading
|
|
102
|
+
|
|
103
|
+
`Heading` component renders text with `type.levels.heading[size]` styles.
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
<Heading size="small">Small Heading Text</Heading>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
<ExampleCodeBlock code={Heading} />
|
|
110
|
+
|
|
111
|
+
### Subtext
|
|
112
|
+
|
|
113
|
+
`Subtext` component renders text with `type.levels.subtext[size]` styles.
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
<Subtext size="small">Small Subtext Text</Subtext>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
<ExampleCodeBlock code={Subtext} />
|
|
120
|
+
|
|
121
|
+
### Title
|
|
122
|
+
|
|
123
|
+
`Title` component renders text with `type.levels.title[size]` styles.
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
<Title size="small">Small Title Text</Title>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
<ExampleCodeBlock code={Title} />
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {BodyText as BodyTextComponent} from '@workday/canvas-kit-react/text';
|
|
3
|
+
|
|
4
|
+
export default () => (
|
|
5
|
+
<>
|
|
6
|
+
<BodyTextComponent size="large">Large Body Text</BodyTextComponent>
|
|
7
|
+
<BodyTextComponent size="medium">Medium Body Text</BodyTextComponent>
|
|
8
|
+
<BodyTextComponent size="small">Small Body Text</BodyTextComponent>
|
|
9
|
+
</>
|
|
10
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Heading as HeadingComponent} from '@workday/canvas-kit-react/text';
|
|
3
|
+
|
|
4
|
+
export default () => (
|
|
5
|
+
<>
|
|
6
|
+
<HeadingComponent as="h4" size="large">
|
|
7
|
+
Large Heading Text
|
|
8
|
+
</HeadingComponent>
|
|
9
|
+
<HeadingComponent as="h5" size="medium">
|
|
10
|
+
Medium Heading Text
|
|
11
|
+
</HeadingComponent>
|
|
12
|
+
<HeadingComponent as="h6" size="small">
|
|
13
|
+
Small Heading Text
|
|
14
|
+
</HeadingComponent>
|
|
15
|
+
</>
|
|
16
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {LabelText} from '@workday/canvas-kit-react/text';
|
|
3
|
+
|
|
4
|
+
export default () => (
|
|
5
|
+
<>
|
|
6
|
+
<LabelText marginBottom="s">Label</LabelText>
|
|
7
|
+
<LabelText cursor="pointer" marginBottom="s">
|
|
8
|
+
Label with pointer
|
|
9
|
+
</LabelText>
|
|
10
|
+
<LabelText disabled marginBottom="s">
|
|
11
|
+
Disabled Label
|
|
12
|
+
</LabelText>
|
|
13
|
+
</>
|
|
14
|
+
);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Subtext as SubtextComponent} from '@workday/canvas-kit-react/text';
|
|
3
|
+
|
|
4
|
+
export default () => (
|
|
5
|
+
<>
|
|
6
|
+
<SubtextComponent size="large">Large Subtext</SubtextComponent>
|
|
7
|
+
<SubtextComponent size="medium">Medium Subtext</SubtextComponent>
|
|
8
|
+
<SubtextComponent size="small">Small Subtext</SubtextComponent>
|
|
9
|
+
</>
|
|
10
|
+
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {type, typeColors} from '@workday/canvas-kit-react/tokens';
|
|
4
|
+
import {Box} from '@workday/canvas-kit-react';
|
|
5
|
+
import {Text} from '@workday/canvas-kit-react/text';
|
|
6
|
+
|
|
7
|
+
export default () => (
|
|
8
|
+
<Box>
|
|
9
|
+
<Text as="h4">Text as h4</Text>
|
|
10
|
+
<Text as="p" fontSize={14} fontWeight="regular" fontFamily="monospace">
|
|
11
|
+
Text with props passed
|
|
12
|
+
</Text>
|
|
13
|
+
<Text as="p" {...type.levels.subtext.large}>
|
|
14
|
+
Text with type token passed
|
|
15
|
+
</Text>
|
|
16
|
+
<Box {...type.levels.subtext.large} color={typeColors.hint} marginBottom="s">
|
|
17
|
+
<Text>Text with inherenced styles</Text>
|
|
18
|
+
</Box>
|
|
19
|
+
<Text as="p" typeLevel="body.small">
|
|
20
|
+
Small Body level text
|
|
21
|
+
</Text>
|
|
22
|
+
</Box>
|
|
23
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Title as TitleComponent} from '@workday/canvas-kit-react/text';
|
|
3
|
+
|
|
4
|
+
export default () => (
|
|
5
|
+
<>
|
|
6
|
+
<TitleComponent as="h1" size="large">
|
|
7
|
+
Large Title Text
|
|
8
|
+
</TitleComponent>
|
|
9
|
+
<TitleComponent as="h2" size="medium">
|
|
10
|
+
Medium Title Text
|
|
11
|
+
</TitleComponent>
|
|
12
|
+
<TitleComponent as="h3" size="small">
|
|
13
|
+
Small Title Text
|
|
14
|
+
</TitleComponent>
|
|
15
|
+
</>
|
|
16
|
+
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.151-next.3+548c0a40",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@storybook/csf": "0.0.1",
|
|
45
|
-
"@workday/canvas-kit-react": "^8.0.0-alpha.
|
|
45
|
+
"@workday/canvas-kit-react": "^8.0.0-alpha.151-next.3+548c0a40"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"fs-extra": "^10.0.0",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"mkdirp": "^1.0.3",
|
|
51
51
|
"typescript": "4.1"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "548c0a4090f25b1feeabaf1c1288fec4539e7d0a"
|
|
54
54
|
}
|