@workday/canvas-kit-docs 10.0.7 → 10.0.9
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/preview-react/_examples/examples/SelectWithFormik.tsx +57 -21
- package/dist/mdx/preview-react/_examples/examples/TextInputWithReactHookForm.tsx +27 -7
- 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,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {useFormik} from 'formik';
|
|
3
|
-
import {Select} from '@workday/canvas-kit-
|
|
3
|
+
import {Select, useSelectModel} from '@workday/canvas-kit-react/select';
|
|
4
4
|
import {
|
|
5
5
|
FormField,
|
|
6
6
|
useFormFieldInput,
|
|
@@ -8,6 +8,31 @@ import {
|
|
|
8
8
|
} from '@workday/canvas-kit-preview-react/form-field';
|
|
9
9
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
10
10
|
import {PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
11
|
+
import {
|
|
12
|
+
activityStreamIcon,
|
|
13
|
+
avatarIcon,
|
|
14
|
+
uploadCloudIcon,
|
|
15
|
+
userIcon,
|
|
16
|
+
} from '@workday/canvas-system-icons-web';
|
|
17
|
+
|
|
18
|
+
export default [
|
|
19
|
+
{
|
|
20
|
+
label: 'Dessert Person by Claire Saffitz',
|
|
21
|
+
serverId: 1,
|
|
22
|
+
icon: activityStreamIcon,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: 'Elements of Pizza by Ken Forkish',
|
|
26
|
+
serverId: 2,
|
|
27
|
+
icon: avatarIcon,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: 'Flour Water Salt Yeast by Ken Forkish',
|
|
31
|
+
serverId: 3,
|
|
32
|
+
icon: uploadCloudIcon,
|
|
33
|
+
},
|
|
34
|
+
{label: 'Mastering Pasta by Marc Verti', serverId: 4, icon: userIcon},
|
|
35
|
+
];
|
|
11
36
|
|
|
12
37
|
export default () => {
|
|
13
38
|
const formik = useFormik({
|
|
@@ -22,34 +47,45 @@ export default () => {
|
|
|
22
47
|
},
|
|
23
48
|
});
|
|
24
49
|
|
|
25
|
-
const
|
|
26
|
-
|
|
50
|
+
const selectModel = useSelectModel({
|
|
51
|
+
items: customOptionsMain,
|
|
52
|
+
getId: item => {
|
|
53
|
+
return item.serverId;
|
|
54
|
+
},
|
|
55
|
+
getTextValue: item => item.label,
|
|
56
|
+
});
|
|
27
57
|
|
|
28
58
|
return (
|
|
29
59
|
<form onSubmit={formik.handleSubmit} action=".">
|
|
30
60
|
<Flex gap="xs" flexDirection="column" alignItems="flex-start">
|
|
31
61
|
<FormField orientation="vertical" alignSelf="stretch" alignItems="normal">
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
62
|
+
<Select model={selectModel}>
|
|
63
|
+
<FormField.Label>Choose a book</FormField.Label>
|
|
64
|
+
<FormField.Input
|
|
65
|
+
as={Select.Input}
|
|
66
|
+
name="selectedBook"
|
|
67
|
+
onChange={event => formik.setFieldValue('selectedBook', event.currentTarget.value)}
|
|
68
|
+
value={formik.values.selectedBook}
|
|
69
|
+
grow
|
|
70
|
+
/>
|
|
71
|
+
<Select.Popper>
|
|
72
|
+
<Select.Card>
|
|
73
|
+
<Select.List maxHeight={200}>
|
|
74
|
+
{item => {
|
|
75
|
+
return (
|
|
76
|
+
<Select.Item data-id={item.serverId} data-text={item.label}>
|
|
77
|
+
<Select.Item.Icon icon={item.icon} />
|
|
78
|
+
{item.label}
|
|
79
|
+
</Select.Item>
|
|
80
|
+
);
|
|
81
|
+
}}
|
|
82
|
+
</Select.List>
|
|
83
|
+
</Select.Card>
|
|
84
|
+
</Select.Popper>
|
|
85
|
+
</Select>
|
|
41
86
|
</FormField>
|
|
42
87
|
<PrimaryButton type="submit">Submit</PrimaryButton>
|
|
43
88
|
</Flex>
|
|
44
89
|
</form>
|
|
45
90
|
);
|
|
46
91
|
};
|
|
47
|
-
|
|
48
|
-
const bookList = [
|
|
49
|
-
{label: 'Dessert Person by Claire Saffitz', value: 'dessert person'},
|
|
50
|
-
{label: 'Elements of Pizza by Ken Forkish', value: 'the elements of pizza'},
|
|
51
|
-
{label: 'Flour Water Salt Yeast by Ken Forkish', value: 'flour water salt yeast'},
|
|
52
|
-
{label: 'Mastering Pasta by Marc Verti', value: 'mastering pasta'},
|
|
53
|
-
{label: 'Patisserie by Christophe Felder', value: 'patisserie'},
|
|
54
|
-
{label: 'Tartine by Elisabeth Prueitt & Chad Robertson', value: 'tartine'},
|
|
55
|
-
];
|
|
@@ -6,6 +6,8 @@ import {object, SchemaOf, string} from 'yup';
|
|
|
6
6
|
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
7
7
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
8
8
|
import {TertiaryButton, PrimaryButton} from '@workday/canvas-kit-react/button';
|
|
9
|
+
import {Select} from '@workday/canvas-kit-react/select';
|
|
10
|
+
import {FormField} from '@workday/canvas-kit-preview-react/form-field';
|
|
9
11
|
import {visibleIcon, invisibleIcon} from '@workday/canvas-system-icons-web';
|
|
10
12
|
import {useUniqueId} from '@workday/canvas-kit-react/common';
|
|
11
13
|
|
|
@@ -13,7 +15,7 @@ type YupValidationResolver = <T extends {}>(
|
|
|
13
15
|
validationSchema: SchemaOf<T>
|
|
14
16
|
) => (data: T) => Promise<{values: T; errors: {}} | {values: {}; errors: FieldErrorsImpl<T>}>;
|
|
15
17
|
|
|
16
|
-
const useYupValidationResolver:
|
|
18
|
+
const useYupValidationResolver: YupValidationResolver = validationSchema => {
|
|
17
19
|
return React.useCallback(
|
|
18
20
|
async data => {
|
|
19
21
|
try {
|
|
@@ -42,22 +44,23 @@ const useYupValidationResolver: any = validationSchema => {
|
|
|
42
44
|
interface LoginSchema {
|
|
43
45
|
email: string;
|
|
44
46
|
password: string;
|
|
47
|
+
role: string;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
const passwordMinimum = 8;
|
|
48
51
|
const passwordHint = `Password should be of minimum ${passwordMinimum} characters length`;
|
|
49
52
|
const emailRequired = 'Email is required';
|
|
50
53
|
const passwordRequired = 'Password is required';
|
|
54
|
+
const roleRequired = 'Role is required';
|
|
51
55
|
|
|
52
56
|
const validationSchema: SchemaOf<LoginSchema> = object({
|
|
53
|
-
email: string()
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
password: string()
|
|
57
|
-
.min(passwordMinimum, passwordHint)
|
|
58
|
-
.required(passwordRequired),
|
|
57
|
+
email: string().email('Enter a valid email').required(emailRequired),
|
|
58
|
+
password: string().min(passwordMinimum, passwordHint).required(passwordRequired),
|
|
59
|
+
role: string().required(roleRequired),
|
|
59
60
|
});
|
|
60
61
|
|
|
62
|
+
const options = ['Developer', 'Designer', 'Product Manager'];
|
|
63
|
+
|
|
61
64
|
export default () => {
|
|
62
65
|
const {
|
|
63
66
|
handleSubmit,
|
|
@@ -67,6 +70,7 @@ export default () => {
|
|
|
67
70
|
defaultValues: {
|
|
68
71
|
email: 'example@baz.com',
|
|
69
72
|
password: 'foobarbaz',
|
|
73
|
+
role: 'Designer',
|
|
70
74
|
},
|
|
71
75
|
resolver: useYupValidationResolver(validationSchema),
|
|
72
76
|
mode: 'onTouched',
|
|
@@ -92,6 +96,22 @@ export default () => {
|
|
|
92
96
|
return (
|
|
93
97
|
<form onSubmit={onSubmit} action=".">
|
|
94
98
|
<Flex gap="xs" flexDirection="column" alignItems="flex-start">
|
|
99
|
+
<FormField orientation="vertical" isRequired={true} hasError={!!errors.role}>
|
|
100
|
+
<Select items={options}>
|
|
101
|
+
<FormField.Label>What is your role?</FormField.Label>
|
|
102
|
+
<FormField.Input as={Select.Input} {...register('role')} width="280px" />
|
|
103
|
+
<Select.Popper>
|
|
104
|
+
<Select.Card>
|
|
105
|
+
<Select.List maxHeight={200}>
|
|
106
|
+
{item => {
|
|
107
|
+
return <Select.Item>{item}</Select.Item>;
|
|
108
|
+
}}
|
|
109
|
+
</Select.List>
|
|
110
|
+
</Select.Card>
|
|
111
|
+
</Select.Popper>
|
|
112
|
+
<FormField.Hint>{errors.role?.message}</FormField.Hint>
|
|
113
|
+
</Select>
|
|
114
|
+
</FormField>
|
|
95
115
|
<TextInput orientation="vertical" isRequired={true} hasError={!!errors.email}>
|
|
96
116
|
<TextInput.Label>Email</TextInput.Label>
|
|
97
117
|
<TextInput.Field
|
|
@@ -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.9",
|
|
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.9",
|
|
48
|
+
"@workday/canvas-kit-preview-react": "^10.0.9",
|
|
49
|
+
"@workday/canvas-kit-react": "^10.0.9",
|
|
50
|
+
"@workday/canvas-kit-styling": "^10.0.9",
|
|
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": "b4494312c0fca962af3bb92e5c84edf6c5486a39"
|
|
61
63
|
}
|