@workday/canvas-kit-docs 10.0.7 → 10.0.8
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/index.d.ts +1 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +1 -0
- package/dist/es6/lib/InformationHighlight/Base.d.ts +5 -0
- package/dist/es6/lib/InformationHighlight/Base.d.ts.map +1 -0
- package/dist/es6/lib/InformationHighlight/Base.js +9 -0
- package/dist/es6/lib/InformationHighlight/Body.d.ts +2 -0
- package/dist/es6/lib/InformationHighlight/Body.d.ts.map +1 -0
- package/dist/es6/lib/InformationHighlight/Body.js +18 -0
- package/dist/es6/lib/InformationHighlight/Heading.d.ts +2 -0
- package/dist/es6/lib/InformationHighlight/Heading.d.ts.map +1 -0
- package/dist/es6/lib/InformationHighlight/Heading.js +17 -0
- package/dist/es6/lib/InformationHighlight/Icon.d.ts +13 -0
- package/dist/es6/lib/InformationHighlight/Icon.d.ts.map +1 -0
- package/dist/es6/lib/InformationHighlight/Icon.js +44 -0
- package/dist/es6/lib/InformationHighlight/Link.d.ts +2 -0
- package/dist/es6/lib/InformationHighlight/Link.d.ts.map +1 -0
- package/dist/es6/lib/InformationHighlight/Link.js +18 -0
- package/dist/es6/lib/InformationHighlight/index.d.ts +25 -0
- package/dist/es6/lib/InformationHighlight/index.d.ts.map +1 -0
- package/dist/es6/lib/InformationHighlight/index.js +44 -0
- package/dist/es6/lib/InformationHighlight/modelHook.d.ts +19 -0
- package/dist/es6/lib/InformationHighlight/modelHook.d.ts.map +1 -0
- package/dist/es6/lib/InformationHighlight/modelHook.js +13 -0
- package/dist/es6/lib/widgetUtils.d.ts +1 -1
- package/dist/mdx/react/tokens/Tokens.mdx +13 -0
- package/index.ts +1 -0
- package/lib/InformationHighlight/Base.tsx +12 -0
- package/lib/InformationHighlight/Body.tsx +21 -0
- package/lib/InformationHighlight/Heading.tsx +20 -0
- package/lib/InformationHighlight/Icon.tsx +65 -0
- package/lib/InformationHighlight/Link.tsx +20 -0
- package/lib/InformationHighlight/index.tsx +62 -0
- package/lib/InformationHighlight/modelHook.ts +16 -0
- package/package.json +7 -5
package/dist/es6/index.d.ts
CHANGED
package/dist/es6/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
|
package/dist/es6/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../../../lib/InformationHighlight/Base.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAe,MAAM,6BAA6B,CAAC;AAElE,MAAM,WAAW,SAAU,SAAQ,OAAO;CAAG;AAE7C,eAAO,MAAM,IAAI,+EAKf,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { handleCsProp } from '@workday/canvas-kit-styling';
|
|
4
|
+
export const Base = createComponent('div')({
|
|
5
|
+
displayName: 'Base',
|
|
6
|
+
Component: (props, ref, Element) => {
|
|
7
|
+
return React.createElement(Element, Object.assign({ ref: ref }, handleCsProp(props)));
|
|
8
|
+
},
|
|
9
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Body.d.ts","sourceRoot":"","sources":["../../../../lib/InformationHighlight/Body.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,IAAI,2EAKf,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { createStyles } from '@workday/canvas-kit-styling';
|
|
4
|
+
import { base, system } from '@workday/canvas-tokens-web';
|
|
5
|
+
import { Base } from './Base';
|
|
6
|
+
const bodyStyles = createStyles({
|
|
7
|
+
...system.type.subtext.large,
|
|
8
|
+
color: base.blackPepper300,
|
|
9
|
+
gridColumn: '2',
|
|
10
|
+
fontWeight: 400,
|
|
11
|
+
margin: 0,
|
|
12
|
+
});
|
|
13
|
+
export const Body = createComponent('p')({
|
|
14
|
+
displayName: 'Body',
|
|
15
|
+
Component: (props, ref, Element) => {
|
|
16
|
+
return React.createElement(Base, Object.assign({ as: Element, ref: ref, cs: bodyStyles }, props));
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../../../lib/InformationHighlight/Heading.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,OAAO,6EAKlB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { createStyles } from '@workday/canvas-kit-styling';
|
|
4
|
+
import { base, system } from '@workday/canvas-tokens-web';
|
|
5
|
+
import { Base } from './Base';
|
|
6
|
+
const headingStyles = createStyles({
|
|
7
|
+
...system.type.body.small,
|
|
8
|
+
color: base.blackPepper400,
|
|
9
|
+
gridColumn: '2',
|
|
10
|
+
fontWeight: 700, // should use system.fontWeight.bold
|
|
11
|
+
});
|
|
12
|
+
export const Heading = createComponent('div')({
|
|
13
|
+
displayName: 'Heading',
|
|
14
|
+
Component: (props, ref, Element) => {
|
|
15
|
+
return React.createElement(Base, Object.assign({ as: Element, ref: ref, cs: headingStyles }, props));
|
|
16
|
+
},
|
|
17
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SystemIconProps } from '@workday/canvas-kit-react/icon';
|
|
2
|
+
declare type Variant = 'emphasis' | 'caution' | 'attention';
|
|
3
|
+
export interface IconProps extends SystemIconProps {
|
|
4
|
+
variant: Variant;
|
|
5
|
+
}
|
|
6
|
+
export declare const Icon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", IconProps, {
|
|
7
|
+
state: {
|
|
8
|
+
variant: import("./modelHook").Variant;
|
|
9
|
+
};
|
|
10
|
+
events: {};
|
|
11
|
+
}>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../../lib/InformationHighlight/Icon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAY3E,aAAK,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;AA6BpD,MAAM,WAAW,SAAU,SAAQ,eAAe;IAChD,OAAO,EAAE,OAAO,CAAC;CAClB;AAQD,eAAO,MAAM,IAAI;;;;;EAYf,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
3
|
+
import { createSubcomponent } from '@workday/canvas-kit-react/common';
|
|
4
|
+
import { cssVar } from '@workday/canvas-kit-styling';
|
|
5
|
+
import { infoIcon, exclamationCircleIcon, exclamationTriangleIcon, } from '@workday/canvas-system-icons-web';
|
|
6
|
+
import { base } from '@workday/canvas-tokens-web';
|
|
7
|
+
import { useInformationHighlightModel } from './modelHook';
|
|
8
|
+
const iconStyles = {
|
|
9
|
+
emphasis: {
|
|
10
|
+
accent: cssVar(base.blueberry400),
|
|
11
|
+
fill: cssVar(base.blueberry400),
|
|
12
|
+
background: 'none',
|
|
13
|
+
accentHover: cssVar(base.blueberry400),
|
|
14
|
+
fillHover: cssVar(base.blueberry400),
|
|
15
|
+
backgroundHover: 'none',
|
|
16
|
+
},
|
|
17
|
+
caution: {
|
|
18
|
+
accent: cssVar(base.blackPepper400),
|
|
19
|
+
fill: cssVar(base.blackPepper400),
|
|
20
|
+
background: 'none',
|
|
21
|
+
accentHover: cssVar(base.blackPepper400),
|
|
22
|
+
fillHover: cssVar(base.blackPepper400),
|
|
23
|
+
backgroundHover: 'none',
|
|
24
|
+
},
|
|
25
|
+
attention: {
|
|
26
|
+
accent: cssVar(base.cinnamon500),
|
|
27
|
+
fill: cssVar(base.cinnamon500),
|
|
28
|
+
background: 'none',
|
|
29
|
+
accentHover: cssVar(base.cinnamon500),
|
|
30
|
+
fillHover: cssVar(base.cinnamon500),
|
|
31
|
+
backgroundHover: 'none',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const defaultIcons = {
|
|
35
|
+
emphasis: infoIcon,
|
|
36
|
+
caution: exclamationTriangleIcon,
|
|
37
|
+
attention: exclamationCircleIcon,
|
|
38
|
+
};
|
|
39
|
+
export const Icon = createSubcomponent('span')({
|
|
40
|
+
displayName: 'Icon',
|
|
41
|
+
modelHook: useInformationHighlightModel,
|
|
42
|
+
})(({ icon, ...props }, Element, model) => {
|
|
43
|
+
return (React.createElement(SystemIcon, Object.assign({ as: Element, icon: icon ? icon : defaultIcons[model.state.variant] }, iconStyles[model.state.variant], props)));
|
|
44
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../../lib/InformationHighlight/Link.tsx"],"names":[],"mappings":"AAcA,eAAO,MAAM,IAAI,6EAKf,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ExternalHyperlink } from '@workday/canvas-kit-react/button';
|
|
3
|
+
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
4
|
+
import { createStyles, cssVar } from '@workday/canvas-kit-styling';
|
|
5
|
+
import { base, system } from '@workday/canvas-tokens-web';
|
|
6
|
+
const linkStyles = createStyles({
|
|
7
|
+
...system.type.subtext.large,
|
|
8
|
+
gridColumn: '2',
|
|
9
|
+
justifySelf: 'start',
|
|
10
|
+
color: `${cssVar(base.blueberry500)} !important`,
|
|
11
|
+
fontWeight: 500, // should use system.fontWeight.bold
|
|
12
|
+
});
|
|
13
|
+
export const Link = createComponent('div')({
|
|
14
|
+
displayName: 'Link',
|
|
15
|
+
Component: (props, ref, Element) => {
|
|
16
|
+
return React.createElement(ExternalHyperlink, Object.assign({ as: Element, ref: ref, className: linkStyles }, props));
|
|
17
|
+
},
|
|
18
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { BaseProps } from './Base';
|
|
2
|
+
declare type Variant = 'emphasis' | 'caution' | 'attention';
|
|
3
|
+
interface InformationHighlightProps extends BaseProps {
|
|
4
|
+
variant?: Variant;
|
|
5
|
+
}
|
|
6
|
+
export declare const InformationHighlight: import("@workday/canvas-kit-react/common").ElementComponentM<"section", InformationHighlightProps & Partial<{
|
|
7
|
+
variant: import("./modelHook").Variant;
|
|
8
|
+
}> & {} & {}, {
|
|
9
|
+
state: {
|
|
10
|
+
variant: import("./modelHook").Variant;
|
|
11
|
+
};
|
|
12
|
+
events: {};
|
|
13
|
+
}> & {
|
|
14
|
+
Icon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", import("./Icon").IconProps, {
|
|
15
|
+
state: {
|
|
16
|
+
variant: import("./modelHook").Variant;
|
|
17
|
+
};
|
|
18
|
+
events: {};
|
|
19
|
+
}>;
|
|
20
|
+
Heading: import("@workday/canvas-kit-react/common").ElementComponent<"div", unknown>;
|
|
21
|
+
Body: import("@workday/canvas-kit-react/common").ElementComponent<"p", unknown>;
|
|
22
|
+
Link: import("@workday/canvas-kit-react/common").ElementComponent<"div", unknown>;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/InformationHighlight/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAO,SAAS,EAAC,MAAM,QAAQ,CAAC;AAOvC,aAAK,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;AAEpD,UAAU,yBAA0B,SAAQ,SAAS;IACnD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AA4BD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;CAiB/B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createContainer } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { createModifiers, createStyles, cssVar } from '@workday/canvas-kit-styling';
|
|
4
|
+
import { base, system } from '@workday/canvas-tokens-web';
|
|
5
|
+
import { Base } from './Base';
|
|
6
|
+
import { Heading } from './Heading';
|
|
7
|
+
import { Body } from './Body';
|
|
8
|
+
import { Icon } from './Icon';
|
|
9
|
+
import { Link } from './Link';
|
|
10
|
+
import { useInformationHighlightModel } from './modelHook';
|
|
11
|
+
const containerStyles = createStyles({
|
|
12
|
+
backgroundColor: base.soap100,
|
|
13
|
+
display: 'grid',
|
|
14
|
+
gridTemplateColumns: 'min-content',
|
|
15
|
+
columnGap: system.space.x4,
|
|
16
|
+
rowGap: system.space.x2,
|
|
17
|
+
padding: system.space.x4,
|
|
18
|
+
borderRadius: system.shape.x1,
|
|
19
|
+
});
|
|
20
|
+
const containerModifiers = createModifiers({
|
|
21
|
+
variant: {
|
|
22
|
+
emphasis: createStyles({
|
|
23
|
+
borderInlineStart: `solid ${cssVar(system.space.x1)} ${cssVar(base.blueberry400)}`,
|
|
24
|
+
}),
|
|
25
|
+
caution: createStyles({
|
|
26
|
+
borderInlineStart: `solid ${cssVar(system.space.x1)} ${cssVar(base.cantaloupe400)}`,
|
|
27
|
+
}),
|
|
28
|
+
attention: createStyles({
|
|
29
|
+
borderInlineStart: `solid ${cssVar(system.space.x1)} ${cssVar(base.cinnamon500)}`,
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
export const InformationHighlight = createContainer('section')({
|
|
34
|
+
displayName: 'InformationHighlight',
|
|
35
|
+
modelHook: useInformationHighlightModel,
|
|
36
|
+
subComponents: {
|
|
37
|
+
Icon: Icon,
|
|
38
|
+
Heading: Heading,
|
|
39
|
+
Body: Body,
|
|
40
|
+
Link: Link,
|
|
41
|
+
},
|
|
42
|
+
})((props, Element, model) => {
|
|
43
|
+
return (React.createElement(Base, Object.assign({ as: Element, cs: [containerStyles, containerModifiers({ variant: model.state.variant })] }, props)));
|
|
44
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare type Variant = 'emphasis' | 'caution' | 'attention';
|
|
2
|
+
export declare const useInformationHighlightModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
3
|
+
variant: Variant;
|
|
4
|
+
}> & {} & {}) | undefined) => {
|
|
5
|
+
state: {
|
|
6
|
+
variant: Variant;
|
|
7
|
+
};
|
|
8
|
+
events: {};
|
|
9
|
+
}) & import("@workday/canvas-kit-react/common").ModelExtras<{
|
|
10
|
+
variant: Variant;
|
|
11
|
+
}, {}, {
|
|
12
|
+
variant: Variant;
|
|
13
|
+
}, {}, {
|
|
14
|
+
state: {
|
|
15
|
+
variant: Variant;
|
|
16
|
+
};
|
|
17
|
+
events: {};
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=modelHook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelHook.d.ts","sourceRoot":"","sources":["../../../../lib/InformationHighlight/modelHook.ts"],"names":[],"mappings":"AAEA,oBAAY,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;AAE3D,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;EAWvC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createModelHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
export const useInformationHighlightModel = createModelHook({
|
|
3
|
+
defaultConfig: {
|
|
4
|
+
variant: 'emphasis',
|
|
5
|
+
},
|
|
6
|
+
})(config => {
|
|
7
|
+
return {
|
|
8
|
+
state: {
|
|
9
|
+
variant: config.variant,
|
|
10
|
+
},
|
|
11
|
+
events: {},
|
|
12
|
+
};
|
|
13
|
+
});
|
|
@@ -27,7 +27,7 @@ interface HeadingProps {
|
|
|
27
27
|
* relative heading levels.
|
|
28
28
|
*/
|
|
29
29
|
export declare const Heading: import("@workday/canvas-kit-react/common").ElementComponent<"h4", HeadingProps>;
|
|
30
|
-
export declare function renderTypeParameters(typeParameters?: types.TypeParameter[]): JSX.Element
|
|
30
|
+
export declare function renderTypeParameters(typeParameters?: types.TypeParameter[]): "" | JSX.Element;
|
|
31
31
|
export interface SymbolDialogProps {
|
|
32
32
|
value: types.SymbolValue;
|
|
33
33
|
}
|
|
@@ -1,9 +1,22 @@
|
|
|
1
|
+
import {InformationHighlight} from '@workday/canvas-kit-docs';
|
|
1
2
|
import {BorderRadius, Space, Depth, Colors, Type} from './examples/Tokens';
|
|
2
3
|
import Overview from './examples/Overview';
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
# Tokens
|
|
6
7
|
|
|
8
|
+
<InformationHighlight>
|
|
9
|
+
<InformationHighlight.Icon />
|
|
10
|
+
<InformationHighlight.Heading>New Tokens Package Available!</InformationHighlight.Heading>
|
|
11
|
+
<InformationHighlight.Body>
|
|
12
|
+
The tokens documented below are still available in Canvas Kit but are being replaced by our new
|
|
13
|
+
Canvas Tokens Web package. We encourage you to begin moving to our new tokens.
|
|
14
|
+
</InformationHighlight.Body>
|
|
15
|
+
<InformationHighlight.Link href="https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs">
|
|
16
|
+
View the Docs
|
|
17
|
+
</InformationHighlight.Link>
|
|
18
|
+
</InformationHighlight>
|
|
19
|
+
|
|
7
20
|
Tokens are the smallest pieces of our Design System with the primary function of storing UI
|
|
8
21
|
information. They enable building components and patterns with consistency across our platforms.
|
|
9
22
|
|
package/index.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {CSProps, handleCsProp} from '@workday/canvas-kit-styling';
|
|
4
|
+
|
|
5
|
+
export interface BaseProps extends CSProps {}
|
|
6
|
+
|
|
7
|
+
export const Base = createComponent('div')({
|
|
8
|
+
displayName: 'Base',
|
|
9
|
+
Component: (props: BaseProps, ref, Element) => {
|
|
10
|
+
return <Element ref={ref} {...handleCsProp(props)} />;
|
|
11
|
+
},
|
|
12
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {createStyles} from '@workday/canvas-kit-styling';
|
|
4
|
+
import {base, system} from '@workday/canvas-tokens-web';
|
|
5
|
+
|
|
6
|
+
import {Base} from './Base';
|
|
7
|
+
|
|
8
|
+
const bodyStyles = createStyles({
|
|
9
|
+
...system.type.subtext.large,
|
|
10
|
+
color: base.blackPepper300,
|
|
11
|
+
gridColumn: '2',
|
|
12
|
+
fontWeight: 400, // This is here to keep createStyle types from being angry
|
|
13
|
+
margin: 0,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const Body = createComponent('p')({
|
|
17
|
+
displayName: 'Body',
|
|
18
|
+
Component: (props, ref, Element) => {
|
|
19
|
+
return <Base as={Element} ref={ref} cs={bodyStyles} {...props} />;
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {createStyles} from '@workday/canvas-kit-styling';
|
|
4
|
+
import {base, system} from '@workday/canvas-tokens-web';
|
|
5
|
+
|
|
6
|
+
import {Base} from './Base';
|
|
7
|
+
|
|
8
|
+
const headingStyles = createStyles({
|
|
9
|
+
...system.type.body.small,
|
|
10
|
+
color: base.blackPepper400,
|
|
11
|
+
gridColumn: '2',
|
|
12
|
+
fontWeight: 700, // should use system.fontWeight.bold
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const Heading = createComponent('div')({
|
|
16
|
+
displayName: 'Heading',
|
|
17
|
+
Component: (props, ref, Element) => {
|
|
18
|
+
return <Base as={Element} ref={ref} cs={headingStyles} {...props} />;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {SystemIcon, SystemIconProps} from '@workday/canvas-kit-react/icon';
|
|
3
|
+
import {createSubcomponent} from '@workday/canvas-kit-react/common';
|
|
4
|
+
|
|
5
|
+
import {cssVar} from '@workday/canvas-kit-styling';
|
|
6
|
+
import {
|
|
7
|
+
infoIcon,
|
|
8
|
+
exclamationCircleIcon,
|
|
9
|
+
exclamationTriangleIcon,
|
|
10
|
+
} from '@workday/canvas-system-icons-web';
|
|
11
|
+
import {base} from '@workday/canvas-tokens-web';
|
|
12
|
+
import {useInformationHighlightModel} from './modelHook';
|
|
13
|
+
|
|
14
|
+
type Variant = 'emphasis' | 'caution' | 'attention';
|
|
15
|
+
|
|
16
|
+
const iconStyles = {
|
|
17
|
+
emphasis: {
|
|
18
|
+
accent: cssVar(base.blueberry400),
|
|
19
|
+
fill: cssVar(base.blueberry400),
|
|
20
|
+
background: 'none',
|
|
21
|
+
accentHover: cssVar(base.blueberry400),
|
|
22
|
+
fillHover: cssVar(base.blueberry400),
|
|
23
|
+
backgroundHover: 'none',
|
|
24
|
+
},
|
|
25
|
+
caution: {
|
|
26
|
+
accent: cssVar(base.blackPepper400),
|
|
27
|
+
fill: cssVar(base.blackPepper400),
|
|
28
|
+
background: 'none',
|
|
29
|
+
accentHover: cssVar(base.blackPepper400),
|
|
30
|
+
fillHover: cssVar(base.blackPepper400),
|
|
31
|
+
backgroundHover: 'none',
|
|
32
|
+
},
|
|
33
|
+
attention: {
|
|
34
|
+
accent: cssVar(base.cinnamon500),
|
|
35
|
+
fill: cssVar(base.cinnamon500),
|
|
36
|
+
background: 'none',
|
|
37
|
+
accentHover: cssVar(base.cinnamon500),
|
|
38
|
+
fillHover: cssVar(base.cinnamon500),
|
|
39
|
+
backgroundHover: 'none',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export interface IconProps extends SystemIconProps {
|
|
44
|
+
variant: Variant;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const defaultIcons = {
|
|
48
|
+
emphasis: infoIcon,
|
|
49
|
+
caution: exclamationTriangleIcon,
|
|
50
|
+
attention: exclamationCircleIcon,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const Icon = createSubcomponent('span')({
|
|
54
|
+
displayName: 'Icon',
|
|
55
|
+
modelHook: useInformationHighlightModel,
|
|
56
|
+
})(({icon, ...props}: IconProps, Element, model) => {
|
|
57
|
+
return (
|
|
58
|
+
<SystemIcon
|
|
59
|
+
as={Element}
|
|
60
|
+
icon={icon ? icon : defaultIcons[model.state.variant]}
|
|
61
|
+
{...iconStyles[model.state.variant]}
|
|
62
|
+
{...props}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
|
|
3
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {createStyles, cssVar} from '@workday/canvas-kit-styling';
|
|
5
|
+
import {base, system} from '@workday/canvas-tokens-web';
|
|
6
|
+
|
|
7
|
+
const linkStyles = createStyles({
|
|
8
|
+
...system.type.subtext.large,
|
|
9
|
+
gridColumn: '2',
|
|
10
|
+
justifySelf: 'start',
|
|
11
|
+
color: `${cssVar(base.blueberry500)} !important`,
|
|
12
|
+
fontWeight: 500, // should use system.fontWeight.bold
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const Link = createComponent('div')({
|
|
16
|
+
displayName: 'Link',
|
|
17
|
+
Component: (props, ref, Element) => {
|
|
18
|
+
return <ExternalHyperlink as={Element} ref={ref} className={linkStyles} {...props} />;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {createContainer} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {createModifiers, createStyles, cssVar} from '@workday/canvas-kit-styling';
|
|
4
|
+
import {base, system} from '@workday/canvas-tokens-web';
|
|
5
|
+
|
|
6
|
+
import {Base, BaseProps} from './Base';
|
|
7
|
+
import {Heading} from './Heading';
|
|
8
|
+
import {Body} from './Body';
|
|
9
|
+
import {Icon} from './Icon';
|
|
10
|
+
import {Link} from './Link';
|
|
11
|
+
import {useInformationHighlightModel} from './modelHook';
|
|
12
|
+
|
|
13
|
+
type Variant = 'emphasis' | 'caution' | 'attention';
|
|
14
|
+
|
|
15
|
+
interface InformationHighlightProps extends BaseProps {
|
|
16
|
+
variant?: Variant;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const containerStyles = createStyles({
|
|
20
|
+
backgroundColor: base.soap100,
|
|
21
|
+
display: 'grid',
|
|
22
|
+
gridTemplateColumns: 'min-content',
|
|
23
|
+
columnGap: system.space.x4,
|
|
24
|
+
rowGap: system.space.x2,
|
|
25
|
+
padding: system.space.x4,
|
|
26
|
+
borderRadius: system.shape.x1,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const containerModifiers = createModifiers({
|
|
30
|
+
variant: {
|
|
31
|
+
emphasis: createStyles({
|
|
32
|
+
borderInlineStart: `solid ${cssVar(system.space.x1)} ${cssVar(base.blueberry400)}`,
|
|
33
|
+
}),
|
|
34
|
+
caution: createStyles({
|
|
35
|
+
borderInlineStart: `solid ${cssVar(system.space.x1)} ${cssVar(
|
|
36
|
+
base.cantaloupe400
|
|
37
|
+
)}`,
|
|
38
|
+
}),
|
|
39
|
+
attention: createStyles({
|
|
40
|
+
borderInlineStart: `solid ${cssVar(system.space.x1)} ${cssVar(base.cinnamon500)}`,
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export const InformationHighlight = createContainer('section')({
|
|
46
|
+
displayName: 'InformationHighlight',
|
|
47
|
+
modelHook: useInformationHighlightModel,
|
|
48
|
+
subComponents: {
|
|
49
|
+
Icon: Icon,
|
|
50
|
+
Heading: Heading,
|
|
51
|
+
Body: Body,
|
|
52
|
+
Link: Link,
|
|
53
|
+
},
|
|
54
|
+
})((props: InformationHighlightProps, Element, model) => {
|
|
55
|
+
return (
|
|
56
|
+
<Base
|
|
57
|
+
as={Element}
|
|
58
|
+
cs={[containerStyles, containerModifiers({variant: model.state.variant})]}
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
62
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {createModelHook} from '@workday/canvas-kit-react/common';
|
|
2
|
+
|
|
3
|
+
export type Variant = 'emphasis' | 'caution' | 'attention';
|
|
4
|
+
|
|
5
|
+
export const useInformationHighlightModel = createModelHook({
|
|
6
|
+
defaultConfig: {
|
|
7
|
+
variant: 'emphasis' as Variant,
|
|
8
|
+
},
|
|
9
|
+
})(config => {
|
|
10
|
+
return {
|
|
11
|
+
state: {
|
|
12
|
+
variant: config.variant,
|
|
13
|
+
},
|
|
14
|
+
events: {},
|
|
15
|
+
};
|
|
16
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.8",
|
|
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,10 +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": "^10.0.
|
|
48
|
-
"@workday/canvas-kit-preview-react": "^10.0.
|
|
49
|
-
"@workday/canvas-kit-react": "^10.0.
|
|
47
|
+
"@workday/canvas-kit-labs-react": "^10.0.8",
|
|
48
|
+
"@workday/canvas-kit-preview-react": "^10.0.8",
|
|
49
|
+
"@workday/canvas-kit-react": "^10.0.8",
|
|
50
|
+
"@workday/canvas-kit-styling": "^10.0.8",
|
|
50
51
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
52
|
+
"@workday/canvas-tokens-web": "^1.0.0",
|
|
51
53
|
"markdown-to-jsx": "^6.10.3",
|
|
52
54
|
"ts-node": "^10.9.1"
|
|
53
55
|
},
|
|
@@ -57,5 +59,5 @@
|
|
|
57
59
|
"mkdirp": "^1.0.3",
|
|
58
60
|
"typescript": "4.2"
|
|
59
61
|
},
|
|
60
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "b68a344126cb563661e92ca9d63776050c89e23e"
|
|
61
63
|
}
|