@workday/canvas-kit-preview-react 12.2.2 → 12.3.1

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.
Files changed (74) hide show
  1. package/dist/commonjs/divider/lib/Divider.js +1 -1
  2. package/dist/commonjs/index.d.ts +1 -0
  3. package/dist/commonjs/index.d.ts.map +1 -1
  4. package/dist/commonjs/index.js +1 -0
  5. package/dist/commonjs/information-highlight/index.d.ts +6 -0
  6. package/dist/commonjs/information-highlight/index.d.ts.map +1 -0
  7. package/dist/commonjs/information-highlight/index.js +21 -0
  8. package/dist/commonjs/information-highlight/lib/InformationHighlight.d.ts +76 -0
  9. package/dist/commonjs/information-highlight/lib/InformationHighlight.d.ts.map +1 -0
  10. package/dist/commonjs/information-highlight/lib/InformationHighlight.js +65 -0
  11. package/dist/commonjs/information-highlight/lib/hooks/useInformationHighlightModel.d.ts +23 -0
  12. package/dist/commonjs/information-highlight/lib/hooks/useInformationHighlightModel.d.ts.map +1 -0
  13. package/dist/commonjs/information-highlight/lib/hooks/useInformationHighlightModel.js +18 -0
  14. package/dist/commonjs/information-highlight/lib/parts/Body.d.ts +2 -0
  15. package/dist/commonjs/information-highlight/lib/parts/Body.d.ts.map +1 -0
  16. package/dist/commonjs/information-highlight/lib/parts/Body.js +40 -0
  17. package/dist/commonjs/information-highlight/lib/parts/Heading.d.ts +6 -0
  18. package/dist/commonjs/information-highlight/lib/parts/Heading.d.ts.map +1 -0
  19. package/dist/commonjs/information-highlight/lib/parts/Heading.js +40 -0
  20. package/dist/commonjs/information-highlight/lib/parts/Icon.d.ts +12 -0
  21. package/dist/commonjs/information-highlight/lib/parts/Icon.d.ts.map +1 -0
  22. package/dist/commonjs/information-highlight/lib/parts/Icon.js +42 -0
  23. package/dist/commonjs/information-highlight/lib/parts/Link.d.ts +2 -0
  24. package/dist/commonjs/information-highlight/lib/parts/Link.d.ts.map +1 -0
  25. package/dist/commonjs/information-highlight/lib/parts/Link.js +40 -0
  26. package/dist/commonjs/loading-sparkles/lib/LoadingSparkles.js +3 -3
  27. package/dist/commonjs/multi-select/lib/MultiSelectInput.js +1 -1
  28. package/dist/commonjs/radio/lib/RadioGroup.js +3 -3
  29. package/dist/commonjs/radio/lib/RadioLabel.js +1 -1
  30. package/dist/commonjs/radio/lib/RadioText.js +4 -4
  31. package/dist/commonjs/radio/lib/StyledRadioButton.js +5 -5
  32. package/dist/commonjs/status-indicator/lib/StatusIndicator.js +13 -13
  33. package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.js +1 -1
  34. package/dist/es6/divider/lib/Divider.js +1 -1
  35. package/dist/es6/index.d.ts +1 -0
  36. package/dist/es6/index.d.ts.map +1 -1
  37. package/dist/es6/index.js +1 -0
  38. package/dist/es6/information-highlight/index.d.ts +6 -0
  39. package/dist/es6/information-highlight/index.d.ts.map +1 -0
  40. package/dist/es6/information-highlight/index.js +5 -0
  41. package/dist/es6/information-highlight/lib/InformationHighlight.d.ts +76 -0
  42. package/dist/es6/information-highlight/lib/InformationHighlight.d.ts.map +1 -0
  43. package/dist/es6/information-highlight/lib/InformationHighlight.js +39 -0
  44. package/dist/es6/information-highlight/lib/hooks/useInformationHighlightModel.d.ts +23 -0
  45. package/dist/es6/information-highlight/lib/hooks/useInformationHighlightModel.d.ts.map +1 -0
  46. package/dist/es6/information-highlight/lib/hooks/useInformationHighlightModel.js +15 -0
  47. package/dist/es6/information-highlight/lib/parts/Body.d.ts +2 -0
  48. package/dist/es6/information-highlight/lib/parts/Body.d.ts.map +1 -0
  49. package/dist/es6/information-highlight/lib/parts/Body.js +14 -0
  50. package/dist/es6/information-highlight/lib/parts/Heading.d.ts +6 -0
  51. package/dist/es6/information-highlight/lib/parts/Heading.d.ts.map +1 -0
  52. package/dist/es6/information-highlight/lib/parts/Heading.js +14 -0
  53. package/dist/es6/information-highlight/lib/parts/Icon.d.ts +12 -0
  54. package/dist/es6/information-highlight/lib/parts/Icon.d.ts.map +1 -0
  55. package/dist/es6/information-highlight/lib/parts/Icon.js +16 -0
  56. package/dist/es6/information-highlight/lib/parts/Link.d.ts +2 -0
  57. package/dist/es6/information-highlight/lib/parts/Link.d.ts.map +1 -0
  58. package/dist/es6/information-highlight/lib/parts/Link.js +14 -0
  59. package/dist/es6/loading-sparkles/lib/LoadingSparkles.js +3 -3
  60. package/dist/es6/multi-select/lib/MultiSelectInput.js +1 -1
  61. package/dist/es6/radio/lib/RadioGroup.js +3 -3
  62. package/dist/es6/radio/lib/RadioLabel.js +1 -1
  63. package/dist/es6/radio/lib/RadioText.js +4 -4
  64. package/dist/es6/radio/lib/StyledRadioButton.js +5 -5
  65. package/dist/es6/status-indicator/lib/StatusIndicator.js +13 -13
  66. package/dist/es6/status-indicator/lib/StatusIndicatorLabel.js +1 -1
  67. package/index.ts +1 -0
  68. package/information-highlight/lib/InformationHighlight.tsx +118 -0
  69. package/information-highlight/lib/hooks/useInformationHighlightModel.ts +16 -0
  70. package/information-highlight/lib/parts/Body.tsx +29 -0
  71. package/information-highlight/lib/parts/Heading.tsx +35 -0
  72. package/information-highlight/lib/parts/Icon.tsx +30 -0
  73. package/information-highlight/lib/parts/Link.tsx +30 -0
  74. package/package.json +5 -5
@@ -0,0 +1,118 @@
1
+ import * as React from 'react';
2
+ import {createContainer} from '@workday/canvas-kit-react/common';
3
+ import {cssVar, createStencil, handleCsProp, CSProps} from '@workday/canvas-kit-styling';
4
+ import {base, system} from '@workday/canvas-tokens-web';
5
+
6
+ import {InformationHighlightHeading} from './parts/Heading';
7
+ import {Body} from './parts/Body';
8
+ import {Icon} from './parts/Icon';
9
+ import {Link} from './parts/Link';
10
+ import {useInformationHighlightModel} from './hooks/useInformationHighlightModel';
11
+ import {systemIconStencil} from '@workday/canvas-kit-react/icon';
12
+
13
+ interface InformationHighlightProps extends CSProps {}
14
+
15
+ export const informationHighlightStencil = createStencil({
16
+ base: {
17
+ display: 'grid',
18
+ gridTemplateColumns: 'min-content',
19
+ columnGap: system.space.x4,
20
+ rowGap: system.space.x2,
21
+ padding: system.space.x4,
22
+ borderRadius: system.shape.x1,
23
+ },
24
+ modifiers: {
25
+ informational: {
26
+ low: {
27
+ borderInlineStart: `solid ${cssVar(system.space.x1)} ${cssVar(
28
+ system.color.bg.primary.default
29
+ )}`,
30
+ backgroundColor: system.color.bg.alt.soft,
31
+ '& [data-part="information-highlight-icon"]': {
32
+ [systemIconStencil.vars.accentColor]: system.color.bg.primary.default,
33
+ [systemIconStencil.vars.color]: system.color.bg.primary.default,
34
+ [systemIconStencil.vars.backgroundColor]: 'none',
35
+ },
36
+ },
37
+ high: {
38
+ borderInlineStart: `solid ${cssVar(system.space.x1)} ${cssVar(
39
+ system.color.bg.primary.default
40
+ )}`,
41
+ backgroundColor: base.blueberry100,
42
+ '& [data-part="information-highlight-icon"]': {
43
+ [systemIconStencil.vars.accentColor]: system.color.icon.inverse,
44
+ [systemIconStencil.vars.color]: system.color.bg.primary.default,
45
+ [systemIconStencil.vars.backgroundColor]: system.color.bg.primary.default,
46
+ },
47
+ },
48
+ },
49
+ caution: {
50
+ low: {
51
+ borderInlineStart: `solid ${cssVar(system.space.x1)} ${cssVar(
52
+ system.color.border.caution.default
53
+ )}`,
54
+ backgroundColor: system.color.bg.alt.soft,
55
+ '& [data-part="information-highlight-icon"]': {
56
+ [systemIconStencil.vars.accentColor]: system.color.fg.contrast.default,
57
+ [systemIconStencil.vars.color]: system.color.fg.contrast.default,
58
+ [systemIconStencil.vars.backgroundColor]: 'none',
59
+ },
60
+ },
61
+ high: {
62
+ borderInlineStart: `solid ${cssVar(system.space.x1)} ${cssVar(
63
+ system.color.border.caution.default
64
+ )}`,
65
+ backgroundColor: base.sourLemon100,
66
+ '& [data-part="information-highlight-icon"]': {
67
+ [systemIconStencil.vars.accentColor]: system.color.icon.inverse,
68
+ [systemIconStencil.vars.color]: system.color.fg.contrast.default,
69
+ [systemIconStencil.vars.backgroundColor]: system.color.fg.contrast.default,
70
+ },
71
+ },
72
+ },
73
+ critical: {
74
+ low: {
75
+ borderInlineStart: `solid ${cssVar(system.space.x1)} ${cssVar(
76
+ system.color.border.critical.default
77
+ )}`,
78
+ backgroundColor: system.color.bg.alt.soft,
79
+ '& [data-part="information-highlight-icon"]': {
80
+ [systemIconStencil.vars.accentColor]: system.color.bg.critical.default,
81
+ [systemIconStencil.vars.color]: system.color.bg.critical.default,
82
+ [systemIconStencil.vars.backgroundColor]: 'none',
83
+ },
84
+ },
85
+ high: {
86
+ borderInlineStart: `solid ${cssVar(system.space.x1)} ${cssVar(
87
+ system.color.border.critical.default
88
+ )}`,
89
+ backgroundColor: base.peach100,
90
+ '& [data-part="information-highlight-icon"]': {
91
+ [systemIconStencil.vars.accentColor]: system.color.icon.inverse,
92
+ [systemIconStencil.vars.color]: system.color.bg.critical.default,
93
+ [systemIconStencil.vars.backgroundColor]: system.color.bg.critical.default,
94
+ },
95
+ },
96
+ },
97
+ },
98
+ });
99
+
100
+ export const InformationHighlight = createContainer('section')({
101
+ displayName: 'InformationHighlight',
102
+ modelHook: useInformationHighlightModel,
103
+ subComponents: {
104
+ Icon: Icon,
105
+ Heading: InformationHighlightHeading,
106
+ Body: Body,
107
+ Link: Link,
108
+ },
109
+ })(({...elemProps}: InformationHighlightProps, Element, model) => {
110
+ return (
111
+ <Element
112
+ {...handleCsProp(
113
+ elemProps,
114
+ informationHighlightStencil({[model.state.variant]: model.state.emphasis})
115
+ )}
116
+ />
117
+ );
118
+ });
@@ -0,0 +1,16 @@
1
+ import {createModelHook} from '@workday/canvas-kit-react/common';
2
+
3
+ export const useInformationHighlightModel = createModelHook({
4
+ defaultConfig: {
5
+ variant: 'informational' as 'informational' | 'caution' | 'critical',
6
+ emphasis: 'low' as 'low' | 'high',
7
+ },
8
+ })(config => {
9
+ return {
10
+ state: {
11
+ variant: config.variant,
12
+ emphasis: config.emphasis,
13
+ },
14
+ events: {},
15
+ };
16
+ });
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import {createComponent, ExtractProps} from '@workday/canvas-kit-react/common';
3
+ import {createStencil, cssVar, handleCsProp} from '@workday/canvas-kit-styling';
4
+ import {system} from '@workday/canvas-tokens-web';
5
+ import {Text} from '@workday/canvas-kit-react/text';
6
+
7
+ const informationHighlightBodyStencil = createStencil({
8
+ base: () => {
9
+ return {
10
+ ...system.type.subtext.large,
11
+ color: system.color.text.strong,
12
+ gridColumn: '2',
13
+ margin: `0 0 ${cssVar(system.space.x2)} 0`,
14
+ };
15
+ },
16
+ });
17
+
18
+ export const Body = createComponent('p')({
19
+ displayName: 'Body',
20
+ Component: ({...elemProps}: ExtractProps<typeof Text, never>, ref, Element) => {
21
+ return (
22
+ <Text
23
+ as={Element}
24
+ ref={ref}
25
+ {...handleCsProp(elemProps, informationHighlightBodyStencil())}
26
+ />
27
+ );
28
+ },
29
+ });
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ import {createComponent, ExtractProps} from '@workday/canvas-kit-react/common';
3
+ import {createStencil, handleCsProp} from '@workday/canvas-kit-styling';
4
+ import {system} from '@workday/canvas-tokens-web';
5
+ import {Heading} from '@workday/canvas-kit-react/text';
6
+
7
+ const informationHighlightHeadingStencil = createStencil({
8
+ base: () => {
9
+ return {
10
+ ...system.type.body.small,
11
+ color: system.color.text.strong,
12
+ gridColumn: '2',
13
+ fontWeight: system.fontWeight.bold,
14
+ marginTop: system.space.zero,
15
+ marginBottom: system.space.zero,
16
+ };
17
+ },
18
+ });
19
+
20
+ export interface InformationHighlightHeadingProps
21
+ extends Partial<ExtractProps<typeof Heading, never>> {}
22
+
23
+ export const InformationHighlightHeading = createComponent('h3')({
24
+ displayName: 'Heading',
25
+ Component: ({size = 'small', ...elemProps}: InformationHighlightHeadingProps, ref, Element) => {
26
+ return (
27
+ <Heading
28
+ as={Element}
29
+ ref={ref}
30
+ size={size}
31
+ {...handleCsProp(elemProps, informationHighlightHeadingStencil())}
32
+ />
33
+ );
34
+ },
35
+ });
@@ -0,0 +1,30 @@
1
+ import * as React from 'react';
2
+ import {SystemIcon} from '@workday/canvas-kit-react/icon';
3
+ import {createSubcomponent, ExtractProps} from '@workday/canvas-kit-react/common';
4
+ import {
5
+ infoIcon,
6
+ exclamationCircleIcon,
7
+ exclamationTriangleIcon,
8
+ } from '@workday/canvas-system-icons-web';
9
+ import {useInformationHighlightModel} from '../hooks/useInformationHighlightModel';
10
+
11
+ export interface IconProps extends Partial<ExtractProps<typeof SystemIcon, never>> {}
12
+ const defaultIcons = {
13
+ informational: infoIcon,
14
+ caution: exclamationTriangleIcon,
15
+ critical: exclamationCircleIcon,
16
+ };
17
+
18
+ export const Icon = createSubcomponent('span')({
19
+ displayName: 'Icon',
20
+ modelHook: useInformationHighlightModel,
21
+ })(({icon, ...props}: IconProps, Element, model) => {
22
+ return (
23
+ <SystemIcon
24
+ as={Element}
25
+ icon={icon ? icon : defaultIcons[model.state.variant]}
26
+ data-part="information-highlight-icon"
27
+ {...props}
28
+ />
29
+ );
30
+ });
@@ -0,0 +1,30 @@
1
+ import * as React from 'react';
2
+ import {Hyperlink} from '@workday/canvas-kit-react/button';
3
+ import {createComponent, ExtractProps} from '@workday/canvas-kit-react/common';
4
+ import {createStencil, handleCsProp} from '@workday/canvas-kit-styling';
5
+ import {system} from '@workday/canvas-tokens-web';
6
+
7
+ const informationHighlightLinkStencil = createStencil({
8
+ base: () => {
9
+ return {
10
+ ...system.type.subtext.large,
11
+ gridColumn: '2',
12
+ justifySelf: 'start',
13
+ color: system.color.text.strong,
14
+ fontWeight: system.fontWeight.bold,
15
+ };
16
+ },
17
+ });
18
+
19
+ export const Link = createComponent('a')({
20
+ displayName: 'Link',
21
+ Component: ({...elemProps}: ExtractProps<typeof Hyperlink, never>, ref, Element) => {
22
+ return (
23
+ <Hyperlink
24
+ as={Element}
25
+ ref={ref}
26
+ {...handleCsProp(elemProps, informationHighlightLinkStencil())}
27
+ />
28
+ );
29
+ },
30
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-preview-react",
3
- "version": "12.2.2",
3
+ "version": "12.3.1",
4
4
  "description": "Canvas Kit Preview is made up of components that have the full design and a11y review, are part of the DS ecosystem and are approved for use in product. The API's could be subject to change, but not without strong communication and migration strategies.",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -46,10 +46,10 @@
46
46
  "dependencies": {
47
47
  "@emotion/react": "^11.7.1",
48
48
  "@emotion/styled": "^11.6.0",
49
- "@workday/canvas-kit-react": "^12.2.2",
50
- "@workday/canvas-kit-styling": "^12.2.2",
49
+ "@workday/canvas-kit-react": "^12.3.1",
50
+ "@workday/canvas-kit-styling": "^12.3.1",
51
51
  "@workday/canvas-system-icons-web": "^3.0.0",
52
- "@workday/canvas-tokens-web": "^2.0.1",
52
+ "@workday/canvas-tokens-web": "^2.1.0",
53
53
  "@workday/design-assets-types": "^0.2.8"
54
54
  },
55
55
  "devDependencies": {
@@ -58,5 +58,5 @@
58
58
  "react-hook-form": "7.36.1",
59
59
  "yup": "^0.32.11"
60
60
  },
61
- "gitHead": "43600098f5347d9100d07a8663721bbaede5a4f1"
61
+ "gitHead": "8f197dfdb262f224d73c602d6811d24302e6154c"
62
62
  }