@workday/canvas-kit-docs 11.0.0-alpha.726-next.0 → 11.0.0-alpha.760-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/dist/es6/docgen/docParser.js +1 -1
- package/dist/es6/lib/docs.js +7079 -2908
- package/dist/es6/lib/specs.js +26 -0
- package/dist/mdx/11.0-UPGRADE-GUIDE.mdx +233 -37
- package/dist/mdx/preview-react/status-indicator/examples/Overflow.tsx +1 -1
- package/dist/mdx/react/card/card.mdx +10 -18
- package/dist/mdx/react/card/examples/CustomStyles.tsx +21 -0
- package/dist/mdx/react/card/examples/Stencils.tsx +108 -0
- package/dist/mdx/react/icon/examples/Overview.tsx +2 -3
- package/package.json +7 -7
- package/dist/mdx/react/card/examples/Depth.tsx +0 -20
- package/dist/mdx/react/card/examples/Padding.tsx +0 -21
package/dist/es6/lib/specs.js
CHANGED
|
@@ -3687,6 +3687,32 @@ module.exports = {specifications: [
|
|
|
3687
3687
|
}
|
|
3688
3688
|
]
|
|
3689
3689
|
},
|
|
3690
|
+
{
|
|
3691
|
+
"type": "describe",
|
|
3692
|
+
"name": "given the [Testing/Popups/Popup, ComboboxWithinPopup] example is rendered",
|
|
3693
|
+
"children": [
|
|
3694
|
+
{
|
|
3695
|
+
"type": "describe",
|
|
3696
|
+
"name": "when the button is clicked",
|
|
3697
|
+
"children": [
|
|
3698
|
+
{
|
|
3699
|
+
"type": "it",
|
|
3700
|
+
"name": "should show the popup"
|
|
3701
|
+
},
|
|
3702
|
+
{
|
|
3703
|
+
"type": "describe",
|
|
3704
|
+
"name": "when is open and the first item is clicked",
|
|
3705
|
+
"children": [
|
|
3706
|
+
{
|
|
3707
|
+
"type": "it",
|
|
3708
|
+
"name": "should not close the popup on select"
|
|
3709
|
+
}
|
|
3710
|
+
]
|
|
3711
|
+
}
|
|
3712
|
+
]
|
|
3713
|
+
}
|
|
3714
|
+
]
|
|
3715
|
+
},
|
|
3690
3716
|
{
|
|
3691
3717
|
"type": "describe",
|
|
3692
3718
|
"name": "given the [Testing/Popups/Popup, PopupWithFallbackPlacements] example is rendered",
|
|
@@ -17,13 +17,15 @@ any questions.
|
|
|
17
17
|
- [Label Text](#label-text)
|
|
18
18
|
- [Text Area (Preview)](#text-area-preview)
|
|
19
19
|
- [Text Input (Preview)](#text-input-preview)
|
|
20
|
+
- [Component Style Updates](#component-style-updates)
|
|
21
|
+
- [Component Token Updates](#component-token-updates)
|
|
20
22
|
- [Component Updates](#component-updates)
|
|
21
|
-
- [Component Style Updates](#component-style-updates)
|
|
22
23
|
- [Card](#card)
|
|
23
24
|
- [Checkbox](#checkbox)
|
|
24
25
|
- [Combobox](#combobox)
|
|
25
26
|
- [Count Badge](#count-badge)
|
|
26
27
|
- [Form Field Preview](#form-field-preview)
|
|
28
|
+
- [Icons](#icons)
|
|
27
29
|
- [Radio (Preview)](#radio-preview)
|
|
28
30
|
- [Select](#select)
|
|
29
31
|
- [Switch](#switch)
|
|
@@ -34,7 +36,6 @@ any questions.
|
|
|
34
36
|
- [Preview](#preview)
|
|
35
37
|
- [Labs](#labs)
|
|
36
38
|
|
|
37
|
-
|
|
38
39
|
## Codemod
|
|
39
40
|
|
|
40
41
|
We've provided a [codemod](https://github.com/Workday/canvas-kit/tree/master/modules/codemod) to
|
|
@@ -102,33 +103,36 @@ finished.
|
|
|
102
103
|
|
|
103
104
|
**PR:** [#2600](https://github.com/Workday/canvas-kit/pull/2600)
|
|
104
105
|
|
|
105
|
-
We've promoted the `Table` compound component in [Preview](#preview) to [Main](#main). This replaces
|
|
106
|
-
and will consist of a new compound
|
|
106
|
+
We've promoted the `Table` compound component in [Preview](#preview) to [Main](#main). This replaces
|
|
107
|
+
the existing `Table` component with a compound component and will consist of a new compound
|
|
108
|
+
component API.
|
|
107
109
|
|
|
108
110
|
> `rowState` prop is no longer a part of the `Table` component.
|
|
109
111
|
|
|
110
|
-
In v10, the `Table` component in [Main](#main) only exposed a `Table`
|
|
112
|
+
In v10, the `Table` component in [Main](#main) only exposed a `Table` and `TableRow` component to
|
|
113
|
+
build tables.
|
|
111
114
|
|
|
112
115
|
In v11, `Table` now exposes every subcomponent of a semantic HTML
|
|
113
|
-
[Table](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table). While more verbose, it
|
|
114
|
-
|
|
115
|
-
See below for examples of the differences between the v10 `Table` and the v11 `Table` compound component.
|
|
116
|
+
[Table](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table). While more verbose, it
|
|
117
|
+
provides more flexibility for customization.
|
|
116
118
|
|
|
119
|
+
See below for examples of the differences between the v10 `Table` and the v11 `Table` compound
|
|
120
|
+
component.
|
|
117
121
|
|
|
118
122
|
v10:
|
|
119
123
|
|
|
120
124
|
```tsx
|
|
121
125
|
<Table>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
126
|
+
<thead>
|
|
127
|
+
<TableRow header={true}>
|
|
128
|
+
<th>Header Text</th>
|
|
129
|
+
</TableRow>
|
|
130
|
+
</thead>
|
|
131
|
+
<tbody>
|
|
132
|
+
<TableRow>
|
|
133
|
+
<td>Cell Text</td>
|
|
134
|
+
</TableRow>
|
|
135
|
+
</tbody>
|
|
132
136
|
</Table>
|
|
133
137
|
```
|
|
134
138
|
|
|
@@ -136,24 +140,26 @@ v11:
|
|
|
136
140
|
|
|
137
141
|
```tsx
|
|
138
142
|
<Table>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
143
|
+
<Table.Head>
|
|
144
|
+
<Table.Row>
|
|
145
|
+
<Table.Header>Header Text</Table.Header>
|
|
146
|
+
</Table.Row>
|
|
147
|
+
</Table.Head>
|
|
148
|
+
<Table.Body>
|
|
149
|
+
<Table.Row>
|
|
150
|
+
<Table.Cell>Cell Text</Table.Cell>
|
|
151
|
+
</Table.Row>
|
|
152
|
+
</Table.Body>
|
|
149
153
|
</Table>
|
|
150
154
|
```
|
|
151
155
|
|
|
156
|
+
Please refer to the
|
|
157
|
+
[Table examples](https://workday.github.io/canvas-kit/?path=/story/components-containers-table--basic)
|
|
158
|
+
for how to implement new tables.
|
|
152
159
|
|
|
153
|
-
|
|
154
|
-
to
|
|
155
|
-
|
|
156
|
-
> **NOTE:** If you were using the [Preview](#preview) `Table` compound component, then you will need to update your import from `"@workday/canvas-kit-preview-react/table"` to `"@workday/canvas-kit-react/table"`.
|
|
160
|
+
> **NOTE:** If you were using the [Preview](#preview) `Table` compound component, then you will need
|
|
161
|
+
> to update your import from `"@workday/canvas-kit-preview-react/table"` to
|
|
162
|
+
> `"@workday/canvas-kit-react/table"`.
|
|
157
163
|
|
|
158
164
|
## Deprecations
|
|
159
165
|
|
|
@@ -208,9 +214,7 @@ instead.
|
|
|
208
214
|
|
|
209
215
|
---
|
|
210
216
|
|
|
211
|
-
## Component Updates
|
|
212
|
-
|
|
213
|
-
### Component Style Updates
|
|
217
|
+
## Component Style Updates
|
|
214
218
|
|
|
215
219
|
These changes are to address discrepancies that were found between Canvas Kit Design Specs and
|
|
216
220
|
Canvas Kit.
|
|
@@ -407,6 +411,14 @@ See below:
|
|
|
407
411
|
</Table.Body>
|
|
408
412
|
</Table>
|
|
409
413
|
|
|
414
|
+
### Component Token Updates
|
|
415
|
+
|
|
416
|
+
The following components have been updated to use our [new system tokens](insert link).
|
|
417
|
+
|
|
418
|
+
- Text
|
|
419
|
+
|
|
420
|
+
## Component Updates
|
|
421
|
+
|
|
410
422
|
### Card
|
|
411
423
|
|
|
412
424
|
**PR:** [#2471](https://github.com/Workday/canvas-kit/pull/2471)
|
|
@@ -434,8 +446,7 @@ identically as it did in previous versions.
|
|
|
434
446
|
`Combobox` has been refactored to use our
|
|
435
447
|
[new styling utilities](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--create-modifiers#createstyles-api)
|
|
436
448
|
and [tokens](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs). The
|
|
437
|
-
component now supports the `cs` prop, but otherwise the API has not changed.
|
|
438
|
-
identically as it did in previous versions.
|
|
449
|
+
component now supports the `cs` prop, but otherwise the API has not changed.
|
|
439
450
|
|
|
440
451
|
### Count Badge
|
|
441
452
|
|
|
@@ -495,6 +506,178 @@ import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
|
495
506
|
|
|
496
507
|
🤖 The codemod will handle the change of `hasError` to `error` for you automatically.
|
|
497
508
|
|
|
509
|
+
### Icons
|
|
510
|
+
|
|
511
|
+
All icons components including `Svg`, `SystemIcon`, `SystemIconCircle`, `AccentIcon`, `AppletIcon`
|
|
512
|
+
and `Graphic` now use our new
|
|
513
|
+
[Canvas Tokens](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs) and
|
|
514
|
+
[new styling utilities](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--create-modifiers#createstyles-api).
|
|
515
|
+
|
|
516
|
+
- Components now support the `cs` prop. -`styles` prop has been removed.
|
|
517
|
+
|
|
518
|
+
**Note: Passing a token name to a style prop will be not supported in a future major version.**
|
|
519
|
+
|
|
520
|
+
```tsx
|
|
521
|
+
// This will no longer be supported in a future major version
|
|
522
|
+
<SystemIcon color="blueberry400" .../>
|
|
523
|
+
|
|
524
|
+
// Use new tokens instead.
|
|
525
|
+
<SystemIcon color={base.blueberry400} .../>
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
🤖 The codemod will handle the change of `styles` to `cs` for you automatically.
|
|
529
|
+
|
|
530
|
+
#### AccentIcon
|
|
531
|
+
|
|
532
|
+
- `AccentIconStyles` prop has been deprecated and will be merged with `AccentIconProps` in a future
|
|
533
|
+
version.
|
|
534
|
+
- `accentIconStyles` has been deprecated and will be removed in a future version as a part of
|
|
535
|
+
implementation of stencils and new tokens. Consider to use `accentIconStencil` to get styles or
|
|
536
|
+
class name.
|
|
537
|
+
- `AccentIcon` supports `size` and `color` css variables, along with `size` and `color` props. Both
|
|
538
|
+
ways are supported:
|
|
539
|
+
|
|
540
|
+
```tsx
|
|
541
|
+
// set size or color by props
|
|
542
|
+
<AccentIcon color={base.blueberry100} size={24} />;
|
|
543
|
+
|
|
544
|
+
// set size or color by css vars
|
|
545
|
+
import {accentIconStencil} from '@workday/canvas-kit-react/icon';
|
|
546
|
+
|
|
547
|
+
const MyComponent = StyledRadioButton('div')({
|
|
548
|
+
[accentIconStencil.vars.color]: base.berrySmoothie100,
|
|
549
|
+
[accentIconStencil.vars.size]: '2rem',
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
<MyComponent>
|
|
553
|
+
<AccentIcon icon={myIcon} />
|
|
554
|
+
</MyComponent>;
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
#### AppletIcon
|
|
558
|
+
|
|
559
|
+
- `AppletIconStyles` prop has been deprecated and will be merged with `AppletIconProps` in a future
|
|
560
|
+
version.
|
|
561
|
+
- `appletIconStyles` has been deprecated and will be removed in a future version as a part of
|
|
562
|
+
implementation of stencils and new tokens. Consider using `appletIconStencil` to get styles or
|
|
563
|
+
class name.
|
|
564
|
+
- `AppletIcon` supports `size`, `color200`, `color300`, `color400` and `color500` css variables,
|
|
565
|
+
along with `size` and `color` props. Both ways are supported:
|
|
566
|
+
|
|
567
|
+
```tsx
|
|
568
|
+
// set size or color by props
|
|
569
|
+
<AppletIcon color="blueberry" size={240} />;
|
|
570
|
+
|
|
571
|
+
// set size or color by css vars
|
|
572
|
+
import {appletIconStencil} from '@workday/canvas-kit-react/icon';
|
|
573
|
+
|
|
574
|
+
const MyComponent = StyledRadioButton('div')({
|
|
575
|
+
[appletIconStencil.vars.size]: '2rem',
|
|
576
|
+
[appletIconStencil.vars.color200]: base.berrySmoothie200,
|
|
577
|
+
[appletIconStencil.vars.color300]: base.berrySmoothie300,
|
|
578
|
+
[appletIconStencil.vars.color400]: base.berrySmoothie400,
|
|
579
|
+
[appletIconStencil.vars.color500]: base.berrySmoothie500,
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
<MyComponent>
|
|
583
|
+
<AppletIcon icon={myIcon} />
|
|
584
|
+
</MyComponent>;
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
#### Graphic
|
|
588
|
+
|
|
589
|
+
- `GraphicStyles` prop has been deprecated and will be merged with `GraphicProps` in a future
|
|
590
|
+
version.
|
|
591
|
+
- `graphicStyles` has been deprecated and will be removed in a future version as a part of
|
|
592
|
+
implementation of stencils and new tokens. Consider to use `graphicStencil` to get styles or class
|
|
593
|
+
name.
|
|
594
|
+
- `width` and `height` props has been deprecated and will be removed in a future version. Consider
|
|
595
|
+
using `cs` props instead to set svg sizes.
|
|
596
|
+
|
|
597
|
+
```tsx
|
|
598
|
+
// before
|
|
599
|
+
<Graphic icon={myGraphic} width={160} />
|
|
600
|
+
|
|
601
|
+
// after
|
|
602
|
+
<Graphic icon={myGraphic} cs={{"& svg": {width: '10rem'}}} />
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
#### Icon
|
|
606
|
+
|
|
607
|
+
This change only impacts internal Canvas Kit code. `Icon` component has been removed and no longer
|
|
608
|
+
used in icons. It was replaced by `Svg` and icon stencils extend `svgStencil`.
|
|
609
|
+
|
|
610
|
+
#### SystemIcon
|
|
611
|
+
|
|
612
|
+
- `SystemIconStyles` prop has been deprecated and will be merged with `SystemIconProps` in a future
|
|
613
|
+
version.
|
|
614
|
+
|
|
615
|
+
- `accentHover` is deprecated and will be removed in a future version. Please use the following when
|
|
616
|
+
overriding styles:
|
|
617
|
+
|
|
618
|
+
```tsx
|
|
619
|
+
'&:hover': {
|
|
620
|
+
[systemIconStencil.vars.accent]: desiredAccentHoverColor
|
|
621
|
+
}
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
- `backgroundHover` is deprecated and will be removed in a future version. Please use the following
|
|
625
|
+
when overriding styles:
|
|
626
|
+
|
|
627
|
+
```tsx
|
|
628
|
+
'&:hover': {
|
|
629
|
+
[systemIconStencil.vars.background]: desiredBackgroundHoverColor
|
|
630
|
+
}
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
- `fillHover` is deprecated and will be removed in a future version. Please use the following when
|
|
634
|
+
overriding styles:
|
|
635
|
+
|
|
636
|
+
```tsx
|
|
637
|
+
'&:hover': {
|
|
638
|
+
[systemIconStencil.vars.fill]: desiredFillHoverColor
|
|
639
|
+
}
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
- `fill` is deprecated and will be removed in a future version. Please use `color` and specify
|
|
643
|
+
`accent` color if you want `accent` to be different from `color`.
|
|
644
|
+
|
|
645
|
+
```tsx
|
|
646
|
+
'&:hover': {
|
|
647
|
+
[systemIconStencil.vars.fill]: desiredFillHoverColor
|
|
648
|
+
}
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
- `systemIconStyles` has been deprecated and will be removed in a future version as a part of
|
|
652
|
+
implementation of stencils and new tokens. Consider to use `systemIconStencil` to get styles or
|
|
653
|
+
class name.
|
|
654
|
+
|
|
655
|
+
- `SystemIcon` supports `size`, `color`, `accentColor` and `background` css variables, along with
|
|
656
|
+
props. Both ways are supported:
|
|
657
|
+
|
|
658
|
+
```tsx
|
|
659
|
+
// set size or color by props
|
|
660
|
+
<SystemIcon color={base.blueberry100} size={24} />;
|
|
661
|
+
|
|
662
|
+
// set size or color by css vars
|
|
663
|
+
import {systemIconStencil} from '@workday/canvas-kit-react/icon';
|
|
664
|
+
|
|
665
|
+
const MyComponent = StyledRadioButton('div')({
|
|
666
|
+
[accentIconStencil.vars.size]: '2rem',
|
|
667
|
+
[systemIconStencil.vars.color]: base.berrySmoothie400,
|
|
668
|
+
[systemIconStencil.vars.background]: base.frenchVanilla100,
|
|
669
|
+
// on hover:
|
|
670
|
+
'&:hover': {
|
|
671
|
+
[systemIconStencil.vars.color]: base.berrySmoothie500,
|
|
672
|
+
[systemIconStencil.vars.background]: 'transparent',
|
|
673
|
+
},
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
<MyComponent>
|
|
677
|
+
<SystemIcon icon={myIcon} />
|
|
678
|
+
</MyComponent>;
|
|
679
|
+
```
|
|
680
|
+
|
|
498
681
|
### Radio (Preview)
|
|
499
682
|
|
|
500
683
|
**PR:** [#2546](https://github.com/Workday/canvas-kit/pull/2546)
|
|
@@ -548,6 +731,19 @@ longer extends the `Box` component, however, it still supports Emotion `styled`
|
|
|
548
731
|
Type level components: `Title`, `Heading`, `BodyText` and `Subtext`, have not been changed since
|
|
549
732
|
they extend the `Text` component. These changes do not affect the components API.
|
|
550
733
|
|
|
734
|
+
### StatusIndicator (Preview)
|
|
735
|
+
|
|
736
|
+
**PR:** [#2620] https://github.com/Workday/canvas-kit/pull/2620
|
|
737
|
+
|
|
738
|
+
`StatusIndicator` now uses
|
|
739
|
+
[Canvas Tokens](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs) and
|
|
740
|
+
our
|
|
741
|
+
[new styling utilities](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--create-modifiers#createstyles-api).
|
|
742
|
+
The component now supports the `cs` prop, but otherwise the API has not changed. It should behave
|
|
743
|
+
identically as it did in previous versions.
|
|
744
|
+
- statusIndicatorColors has been deprecated and will be removed in a future version as a part of implementation of stencils and new tokens
|
|
745
|
+
- useStatusIndicatorIcon has been deprecated and will be removed in a future version as a part of implementation of stencils and new tokens
|
|
746
|
+
|
|
551
747
|
## Glossary
|
|
552
748
|
|
|
553
749
|
### Main
|
|
@@ -7,7 +7,7 @@ import {OverflowTooltip} from '@workday/canvas-kit-react/tooltip';
|
|
|
7
7
|
export default () => {
|
|
8
8
|
return (
|
|
9
9
|
<OverflowTooltip>
|
|
10
|
-
<StatusIndicator tabIndex={0}
|
|
10
|
+
<StatusIndicator tabIndex={0} style={{maxWidth: '6rem'}}>
|
|
11
11
|
<StatusIndicator.Icon icon={uploadCloudIcon} />
|
|
12
12
|
<StatusIndicator.Label>
|
|
13
13
|
Your workbook is currently in process of saving
|
|
@@ -3,8 +3,8 @@ import {SymbolDoc} from '@workday/canvas-kit-docs';
|
|
|
3
3
|
import {Card} from '@workday/canvas-kit-react/card';
|
|
4
4
|
|
|
5
5
|
import Basic from './examples/Basic';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import WithCustomStyles from './examples/CustomStyles';
|
|
7
|
+
import WithStencils from './examples/Stencils';
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
# Canvas Kit Card
|
|
@@ -26,30 +26,22 @@ yarn add @workday/canvas-kit-react
|
|
|
26
26
|
|
|
27
27
|
### Basic Example
|
|
28
28
|
|
|
29
|
-
Card includes a container `Card`
|
|
30
|
-
`Card.Heading`.
|
|
29
|
+
`Card` includes a container component and `Card.Body` and `Card.Heading` subcomponents.
|
|
31
30
|
|
|
32
31
|
<ExampleCodeBlock code={Basic} />
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
## Custom Styles
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
[Box's style props](/components/layout/box/#style-props). This includes `depth`, which changes the
|
|
38
|
-
Card's perceived "height" above the page surface by adjusting its box shadow. `Card` has a default
|
|
39
|
-
depth of `1`.
|
|
35
|
+
You can customize `Card` styles by using the `cs` prop.
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
<ExampleCodeBlock code={WithCustomStyles} />
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
## Stencils
|
|
44
40
|
|
|
45
|
-
|
|
41
|
+
You can also use `Card` stencils to extend styles for your own custom components. This allows you to
|
|
42
|
+
compose styles without using components directly. In the example below, we're extending `Card` stencils to create a custom `MenuCard` component.
|
|
46
43
|
|
|
47
|
-
|
|
48
|
-
default padding of `x8` (`4rem` or `32px`).
|
|
49
|
-
|
|
50
|
-
Here's an example of a `Card` with a reduced padding of `x3` (`0.75rem` or `12px`).
|
|
51
|
-
|
|
52
|
-
<ExampleCodeBlock code={Padding} />
|
|
44
|
+
<ExampleCodeBlock code={WithStencils} />
|
|
53
45
|
|
|
54
46
|
## Component API
|
|
55
47
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import {Card} from '@workday/canvas-kit-react/card';
|
|
4
|
+
import {createStyles, px2rem} from '@workday/canvas-kit-styling';
|
|
5
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
6
|
+
|
|
7
|
+
const customCardStyles = createStyles({
|
|
8
|
+
boxShadow: system.depth[2],
|
|
9
|
+
maxWidth: px2rem(320),
|
|
10
|
+
padding: system.space.x3,
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export default () => (
|
|
14
|
+
<Card cs={customCardStyles}>
|
|
15
|
+
<Card.Heading>Canvas Supreme</Card.Heading>
|
|
16
|
+
<Card.Body>
|
|
17
|
+
Our house special supreme pizza includes pepperoni, sausage, bell peppers, mushrooms, onions,
|
|
18
|
+
and oregano.
|
|
19
|
+
</Card.Body>
|
|
20
|
+
</Card>
|
|
21
|
+
);
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {cardStencil, cardBodyStencil, cardHeadingStencil} from '@workday/canvas-kit-react/card';
|
|
3
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {createStencil, px2rem, CSProps, handleCsProp} from '@workday/canvas-kit-styling';
|
|
5
|
+
import {system, brand} from '@workday/canvas-tokens-web';
|
|
6
|
+
|
|
7
|
+
const menuCardStencil = createStencil({
|
|
8
|
+
extends: cardStencil,
|
|
9
|
+
base: {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
padding: system.space.zero,
|
|
13
|
+
maxWidth: px2rem(320),
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const menuCardHeroStencil = createStencil({
|
|
18
|
+
base: {
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'flex-end',
|
|
21
|
+
boxSizing: 'border-box',
|
|
22
|
+
background: brand.gradient.primary,
|
|
23
|
+
aspectRatio: '1',
|
|
24
|
+
maxHeight: px2rem(80),
|
|
25
|
+
padding: system.space.x2,
|
|
26
|
+
borderRadius: `${system.shape.x2} ${system.shape.x2} 0 0`,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const MenuCardHero = createComponent('div')({
|
|
31
|
+
displayName: 'MenuCard.Hero',
|
|
32
|
+
Component: (elemProps: CSProps, ref, Element) => {
|
|
33
|
+
return <Element ref={ref} {...handleCsProp(elemProps, menuCardHeroStencil())} />;
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const menuCardContentStencil = createStencil({
|
|
38
|
+
base: {
|
|
39
|
+
boxSizing: 'border-box',
|
|
40
|
+
display: 'flex',
|
|
41
|
+
flexDirection: 'column',
|
|
42
|
+
gap: system.space.x2,
|
|
43
|
+
padding: system.space.x2,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const MenuCardContent = createComponent('div')({
|
|
48
|
+
displayName: 'MenuCard.Content',
|
|
49
|
+
Component: (elemProps: CSProps, ref, Element) => {
|
|
50
|
+
return <Element ref={ref} {...handleCsProp(elemProps, menuCardContentStencil())} />;
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const menuCardHeadingStencil = createStencil({
|
|
55
|
+
extends: cardHeadingStencil,
|
|
56
|
+
base: {
|
|
57
|
+
color: brand.primary.accent,
|
|
58
|
+
margin: system.space.zero,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const MenuCardHeading = createComponent('h3')({
|
|
63
|
+
displayName: 'MenuCard.Heading',
|
|
64
|
+
Component: (elemProps: CSProps, ref, Element) => {
|
|
65
|
+
return <Element ref={ref} {...handleCsProp(elemProps, menuCardHeadingStencil())} />;
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const menuCardTextStencil = createStencil({
|
|
70
|
+
extends: cardBodyStencil,
|
|
71
|
+
base: {
|
|
72
|
+
margin: 0,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const MenuCardText = createComponent('p')({
|
|
77
|
+
displayName: 'MenuCard.Text',
|
|
78
|
+
Component: (elemProps: CSProps, ref, Element) => {
|
|
79
|
+
return <Element ref={ref} {...handleCsProp(elemProps, menuCardTextStencil())} />;
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const MenuCard = createComponent('div')({
|
|
84
|
+
displayName: 'MenuCard',
|
|
85
|
+
Component: (elemProps: CSProps, ref, Element) => {
|
|
86
|
+
return <Element ref={ref} {...handleCsProp(elemProps, menuCardStencil())} />;
|
|
87
|
+
},
|
|
88
|
+
subComponents: {
|
|
89
|
+
Content: MenuCardContent,
|
|
90
|
+
Heading: MenuCardHeading,
|
|
91
|
+
Hero: MenuCardHero,
|
|
92
|
+
Text: MenuCardText,
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export default () => (
|
|
97
|
+
<MenuCard>
|
|
98
|
+
<MenuCard.Hero>
|
|
99
|
+
<MenuCard.Heading>Sausage Pizza</MenuCard.Heading>
|
|
100
|
+
</MenuCard.Hero>
|
|
101
|
+
<MenuCard.Content>
|
|
102
|
+
<MenuCard.Text>
|
|
103
|
+
Red sauce, homemade seasoned sausage, mushrooms, red bell peppers, rosemary, cheese.
|
|
104
|
+
</MenuCard.Text>
|
|
105
|
+
<MenuCard.Text></MenuCard.Text>
|
|
106
|
+
</MenuCard.Content>
|
|
107
|
+
</MenuCard>
|
|
108
|
+
);
|
|
@@ -12,8 +12,7 @@ import {activityStreamIcon} from '@workday/canvas-system-icons-web';
|
|
|
12
12
|
const graphicExample: CanvasGraphic = {
|
|
13
13
|
name: 'badgeAchievement',
|
|
14
14
|
type: CanvasIconTypes.Graphic,
|
|
15
|
-
svg:
|
|
16
|
-
'<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" class="wd-graphic wd-graphic-badge-achievement" focusable="false" role="presentation" viewBox="0 0 50 50"><g fill="none" fill-rule="nonzero" class="wd-icon-container"><circle cx="25" cy="25" r="25" fill="#FFC943"/><path fill="#FF7A45" d="M17 12h23l-4.373 7.5L40 27H17z"/><path fill="#656464" d="M15 12h2v31h-2z"/><circle cx="16" cy="11.5" r="1.5" fill="#656464"/></g></svg>',
|
|
15
|
+
svg: '<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" class="wd-graphic wd-graphic-badge-achievement" focusable="false" role="presentation" viewBox="0 0 50 50"><g fill="none" fill-rule="nonzero" class="wd-icon-container"><circle cx="25" cy="25" r="25" fill="#FFC943"/><path fill="#FF7A45" d="M17 12h23l-4.373 7.5L40 27H17z"/><path fill="#656464" d="M15 12h2v31h-2z"/><circle cx="16" cy="11.5" r="1.5" fill="#656464"/></g></svg>',
|
|
17
16
|
filename: 'wd-graphic-badge-achievement.svg',
|
|
18
17
|
category: '',
|
|
19
18
|
tags: [],
|
|
@@ -23,7 +22,7 @@ export default () => (
|
|
|
23
22
|
<Flex flexDirection="row" alignItems="center" gap="s">
|
|
24
23
|
<AccentIcon icon={shieldIcon} />
|
|
25
24
|
<AppletIcon icon={benefitsIcon} />
|
|
26
|
-
<SystemIcon icon={activityStreamIcon} />
|
|
25
|
+
<SystemIcon icon={activityStreamIcon} background="berrySmoothie100" />
|
|
27
26
|
<SystemIconCircle icon={activityStreamIcon} />
|
|
28
27
|
<Graphic src={graphicExample} />
|
|
29
28
|
</Flex>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.760-next.0",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@storybook/csf": "0.0.1",
|
|
47
|
-
"@workday/canvas-kit-labs-react": "^11.0.0-alpha.
|
|
48
|
-
"@workday/canvas-kit-preview-react": "^11.0.0-alpha.
|
|
49
|
-
"@workday/canvas-kit-react": "^11.0.0-alpha.
|
|
50
|
-
"@workday/canvas-kit-styling": "^11.0.0-alpha.
|
|
47
|
+
"@workday/canvas-kit-labs-react": "^11.0.0-alpha.760-next.0",
|
|
48
|
+
"@workday/canvas-kit-preview-react": "^11.0.0-alpha.760-next.0",
|
|
49
|
+
"@workday/canvas-kit-react": "^11.0.0-alpha.760-next.0",
|
|
50
|
+
"@workday/canvas-kit-styling": "^11.0.0-alpha.760-next.0",
|
|
51
51
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
52
|
-
"@workday/canvas-tokens-web": "^1.0
|
|
52
|
+
"@workday/canvas-tokens-web": "^1.3.0",
|
|
53
53
|
"markdown-to-jsx": "^6.10.3",
|
|
54
54
|
"ts-node": "^10.9.1"
|
|
55
55
|
},
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"mkdirp": "^1.0.3",
|
|
60
60
|
"typescript": "4.2"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "567f7f389a35212b6f58050c9e0bf5f9834589c8"
|
|
63
63
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {Card} from '@workday/canvas-kit-react/card';
|
|
3
|
-
import {createStyles} from '@workday/canvas-kit-styling';
|
|
4
|
-
import {system} from '@workday/canvas-tokens-web';
|
|
5
|
-
|
|
6
|
-
const cardCustomDepth = createStyles({
|
|
7
|
-
boxShadow: system.depth[2],
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export default () => {
|
|
11
|
-
return (
|
|
12
|
-
<Card cs={cardCustomDepth}>
|
|
13
|
-
<Card.Heading>Canvas Supreme</Card.Heading>
|
|
14
|
-
<Card.Body>
|
|
15
|
-
Our house special supreme pizza includes pepperoni, sausage, bell peppers, mushrooms,
|
|
16
|
-
onions, and oregano.
|
|
17
|
-
</Card.Body>
|
|
18
|
-
</Card>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {Card} from '@workday/canvas-kit-react/card';
|
|
3
|
-
import {createStyles} from '@workday/canvas-kit-styling';
|
|
4
|
-
import {system} from '@workday/canvas-tokens-web';
|
|
5
|
-
import {space} from '../../../tokens';
|
|
6
|
-
|
|
7
|
-
const cardCustomPadding = createStyles({
|
|
8
|
-
padding: system.space.x3,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export default () => {
|
|
12
|
-
return (
|
|
13
|
-
<Card cs={cardCustomPadding}>
|
|
14
|
-
<Card.Heading>Canvas Supreme</Card.Heading>
|
|
15
|
-
<Card.Body>
|
|
16
|
-
Our house special supreme pizza includes pepperoni, sausage, bell peppers, mushrooms,
|
|
17
|
-
onions, and oregano.
|
|
18
|
-
</Card.Body>
|
|
19
|
-
</Card>
|
|
20
|
-
);
|
|
21
|
-
};
|