@workday/canvas-kit-docs 14.2.0-0052-next.0 → 14.2.0-0058-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/lib/StorybookStatusIndicator.d.ts +1 -1
- package/dist/es6/lib/StorybookStatusIndicator.d.ts.map +1 -1
- package/dist/es6/lib/StorybookStatusIndicator.js +12 -14
- package/dist/es6/lib/docs.js +3457 -147
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +5 -5
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +5 -5
- package/dist/mdx/labs-react/side-panel/SidePanel.mdx +256 -0
- package/dist/mdx/labs-react/side-panel/examples/AlwaysOpen.tsx +52 -0
- package/dist/mdx/labs-react/side-panel/examples/Basic.tsx +55 -0
- package/dist/mdx/labs-react/side-panel/examples/ExternalControl.tsx +75 -0
- package/dist/mdx/labs-react/side-panel/examples/HiddenName.tsx +41 -0
- package/dist/mdx/labs-react/side-panel/examples/OnStateTransition.tsx +49 -0
- package/dist/mdx/labs-react/side-panel/examples/RightOrigin.tsx +73 -0
- package/dist/mdx/labs-react/side-panel/examples/Variant.tsx +60 -0
- package/dist/mdx/labs-react/side-panel/examples/useDirection.ts +23 -0
- package/dist/mdx/preview-react/side-panel/SidePanel.mdx +15 -3
- package/dist/mdx/react/button/button/examples/Primary.tsx +4 -1
- package/lib/StorybookStatusIndicator.tsx +17 -14
- package/package.json +6 -6
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
2
|
+
import {SidePanel, useSidePanelModel} from '@workday/canvas-kit-labs-react/side-panel';
|
|
3
|
+
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
4
|
+
import {Heading, Text} from '@workday/canvas-kit-react/text';
|
|
5
|
+
import {CanvasProvider} from '@workday/canvas-kit-react/common';
|
|
6
|
+
import {createStyles, px2rem} from '@workday/canvas-kit-styling';
|
|
7
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
8
|
+
|
|
9
|
+
// local helper hook for setting content direction;
|
|
10
|
+
import {useDirection} from './useDirection';
|
|
11
|
+
|
|
12
|
+
const stylesOverride = {
|
|
13
|
+
viewport: createStyles({
|
|
14
|
+
height: px2rem(320),
|
|
15
|
+
backgroundColor: system.color.bg.alt.default,
|
|
16
|
+
}),
|
|
17
|
+
panel: createStyles({
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
padding: system.space.x4,
|
|
20
|
+
}),
|
|
21
|
+
main: createStyles({
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
justifyContent: 'center',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
flex: 1,
|
|
26
|
+
flexBasis: 'auto',
|
|
27
|
+
}),
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default () => {
|
|
31
|
+
const {direction, toggleDirection} = useDirection();
|
|
32
|
+
const model = useSidePanelModel({});
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<CanvasProvider dir={direction}>
|
|
36
|
+
<Flex cs={stylesOverride.viewport}>
|
|
37
|
+
<SidePanel model={model} variant="alternate">
|
|
38
|
+
<SidePanel.ToggleButton />
|
|
39
|
+
<Flex cs={stylesOverride.panel}>
|
|
40
|
+
<Heading
|
|
41
|
+
size="small"
|
|
42
|
+
hidden={model.state.transitionState === 'collapsed' ? true : undefined}
|
|
43
|
+
id={model.state.labelId}
|
|
44
|
+
>
|
|
45
|
+
Alternate Panel
|
|
46
|
+
</Heading>
|
|
47
|
+
</Flex>
|
|
48
|
+
</SidePanel>
|
|
49
|
+
<Flex as="main" cs={stylesOverride.main}>
|
|
50
|
+
<Text as="p" typeLevel="body.large">
|
|
51
|
+
Toggle the content direction
|
|
52
|
+
</Text>
|
|
53
|
+
<SecondaryButton onClick={toggleDirection}>
|
|
54
|
+
Set to {direction === 'ltr' ? 'Right-to-Left' : 'Left-to-Right'}
|
|
55
|
+
</SecondaryButton>
|
|
56
|
+
</Flex>
|
|
57
|
+
</Flex>
|
|
58
|
+
</CanvasProvider>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {ContentDirection} from '@workday/canvas-kit-react/common';
|
|
3
|
+
|
|
4
|
+
export function useDirection(initialDirection = ContentDirection.LTR) {
|
|
5
|
+
const [direction, setDirection] = React.useState(initialDirection);
|
|
6
|
+
|
|
7
|
+
return {
|
|
8
|
+
direction,
|
|
9
|
+
toggleDirection() {
|
|
10
|
+
if (direction === ContentDirection.LTR) {
|
|
11
|
+
setDirection(ContentDirection.RTL);
|
|
12
|
+
} else {
|
|
13
|
+
setDirection(ContentDirection.LTR);
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
setLTR() {
|
|
17
|
+
setDirection(ContentDirection.LTR);
|
|
18
|
+
},
|
|
19
|
+
setRTL() {
|
|
20
|
+
setDirection(ContentDirection.RTL);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {ExampleCodeBlock, SymbolDoc, Specifications} from '@workday/canvas-kit-docs';
|
|
1
|
+
import {ExampleCodeBlock, SymbolDoc, Specifications, StorybookStatusIndicator} from '@workday/canvas-kit-docs';import {InformationHighlight} from '@workday/canvas-kit-preview-react/information-highlight'
|
|
2
|
+
|
|
2
3
|
import Basic from './examples/Basic';
|
|
3
4
|
import HiddenName from './examples/HiddenName';
|
|
4
5
|
import AlternatePanel from './examples/Variant';
|
|
@@ -9,9 +10,20 @@ import OnExpandedChange from './examples/OnExpandedChange';
|
|
|
9
10
|
import OnStateTransition from './examples/OnStateTransition';
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
# Canvas Kit Side Panel
|
|
13
|
+
# Canvas Kit Side Panel <StorybookStatusIndicator type="deprecated" />
|
|
14
|
+
|
|
15
|
+
<InformationHighlight className="sb-unstyled" variant="caution" cs={{p: {marginBlock: 0}}}>
|
|
16
|
+
<InformationHighlight.Icon />
|
|
17
|
+
<InformationHighlight.Body>
|
|
18
|
+
`SidePanel` in Preview has been deprecated and will be removed in a future major version. Please
|
|
19
|
+
use `SidePanel` in Labs instead.
|
|
20
|
+
</InformationHighlight.Body>
|
|
21
|
+
<InformationHighlight.Link href="https://workday.github.io/canvas-kit/?path=/docs/labs-side-panel--docs">
|
|
22
|
+
View SidePanel Docs
|
|
23
|
+
</InformationHighlight.Link>
|
|
24
|
+
</InformationHighlight>
|
|
13
25
|
|
|
14
|
-
`SidePanel` is a
|
|
26
|
+
`SidePanel` is a collapsible container that anchors to the left or right side of the screen.
|
|
15
27
|
|
|
16
28
|
[> Workday Design Reference](https://design.workday.com/components/containers/side-panel)
|
|
17
29
|
|
|
@@ -17,7 +17,10 @@ const parentContainerStyles = createStyles({
|
|
|
17
17
|
export default () => (
|
|
18
18
|
<Flex cs={parentContainerStyles}>
|
|
19
19
|
<PrimaryButton>Primary</PrimaryButton>
|
|
20
|
-
<PrimaryButton
|
|
20
|
+
<PrimaryButton
|
|
21
|
+
icon={plusIcon}
|
|
22
|
+
iconPosition="start"
|
|
23
|
+
>
|
|
21
24
|
Primary
|
|
22
25
|
</PrimaryButton>
|
|
23
26
|
<PrimaryButton icon={caretDownIcon} iconPosition="end">
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
StatusIndicator,
|
|
3
|
+
type StatusIndicatorVariant,
|
|
4
|
+
} from '@workday/canvas-kit-preview-react/status-indicator';
|
|
2
5
|
import {system} from '@workday/canvas-tokens-web';
|
|
3
6
|
import {sparkleSingleSmallIcon} from '@workday/canvas-system-icons-web';
|
|
4
7
|
import {createStencil} from '@workday/canvas-kit-styling';
|
|
@@ -10,18 +13,6 @@ const storybookStatusIndicatorStencil = createStencil({
|
|
|
10
13
|
padding: `${system.space.zero} ${system.space.x2}`,
|
|
11
14
|
[systemIconStencil.vars.color]: 'currentColor',
|
|
12
15
|
},
|
|
13
|
-
modifiers: {
|
|
14
|
-
type: {
|
|
15
|
-
ai: {
|
|
16
|
-
background: system.color.bg.ai.default,
|
|
17
|
-
color: system.color.fg.ai,
|
|
18
|
-
},
|
|
19
|
-
deprecated: {
|
|
20
|
-
background: system.color.static.amber.soft,
|
|
21
|
-
color: system.color.static.amber.stronger,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
16
|
});
|
|
26
17
|
|
|
27
18
|
const content = {
|
|
@@ -33,14 +24,26 @@ const content = {
|
|
|
33
24
|
icon: undefined,
|
|
34
25
|
label: 'Deprecated',
|
|
35
26
|
},
|
|
27
|
+
new: {
|
|
28
|
+
icon: undefined,
|
|
29
|
+
label: 'New',
|
|
30
|
+
},
|
|
36
31
|
};
|
|
37
32
|
|
|
38
|
-
export const StorybookStatusIndicator = ({type}: {type: 'ai' | 'deprecated'}) => {
|
|
33
|
+
export const StorybookStatusIndicator = ({type}: {type: 'ai' | 'deprecated' | 'new'}) => {
|
|
39
34
|
const {icon, label} = content[type];
|
|
35
|
+
const variantMapping = {
|
|
36
|
+
ai: 'ai',
|
|
37
|
+
deprecated: 'caution',
|
|
38
|
+
new: 'positive',
|
|
39
|
+
};
|
|
40
|
+
console.log(variantMapping[type]);
|
|
40
41
|
return (
|
|
41
42
|
<StatusIndicator
|
|
42
43
|
className="sb-unstyled cnvs-title-status-indicator"
|
|
43
44
|
cs={storybookStatusIndicatorStencil({type})}
|
|
45
|
+
variant={variantMapping[type] as StatusIndicatorVariant}
|
|
46
|
+
emphasis="low"
|
|
44
47
|
>
|
|
45
48
|
{icon && <StatusIndicator.Icon icon={icon} />}
|
|
46
49
|
<StatusIndicator.Label>{label}</StatusIndicator.Label>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "14.2.0-
|
|
3
|
+
"version": "14.2.0-0058-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",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@stackblitz/sdk": "^1.11.0",
|
|
47
47
|
"@storybook/csf": "0.0.1",
|
|
48
|
-
"@workday/canvas-kit-labs-react": "^14.2.0-
|
|
49
|
-
"@workday/canvas-kit-preview-react": "^14.2.0-
|
|
50
|
-
"@workday/canvas-kit-react": "^14.2.0-
|
|
51
|
-
"@workday/canvas-kit-styling": "^14.2.0-
|
|
48
|
+
"@workday/canvas-kit-labs-react": "^14.2.0-0058-next.0",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^14.2.0-0058-next.0",
|
|
50
|
+
"@workday/canvas-kit-react": "^14.2.0-0058-next.0",
|
|
51
|
+
"@workday/canvas-kit-styling": "^14.2.0-0058-next.0",
|
|
52
52
|
"@workday/canvas-system-icons-web": "^3.0.36",
|
|
53
53
|
"@workday/canvas-tokens-web": "^3.1.1",
|
|
54
54
|
"markdown-to-jsx": "^7.2.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"mkdirp": "^1.0.3",
|
|
62
62
|
"typescript": "5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "464d89a31875769371724f0db9031cef57340f80"
|
|
65
65
|
}
|