@workday/canvas-kit-preview-react 13.0.4 → 13.0.5

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 (48) hide show
  1. package/dist/commonjs/divider/lib/Divider.js +1 -1
  2. package/dist/commonjs/information-highlight/lib/InformationHighlight.js +7 -7
  3. package/dist/commonjs/information-highlight/lib/parts/Body.js +1 -1
  4. package/dist/commonjs/information-highlight/lib/parts/Heading.js +1 -1
  5. package/dist/commonjs/information-highlight/lib/parts/Link.js +1 -1
  6. package/dist/commonjs/loading-sparkles/lib/LoadingSparkles.js +2 -2
  7. package/dist/commonjs/multi-select/lib/MultiSelectInput.d.ts +57 -3
  8. package/dist/commonjs/multi-select/lib/MultiSelectInput.d.ts.map +1 -1
  9. package/dist/commonjs/multi-select/lib/MultiSelectInput.js +17 -8
  10. package/dist/commonjs/pill/lib/Pill.js +3 -3
  11. package/dist/commonjs/pill/lib/PillAvatar.js +1 -1
  12. package/dist/commonjs/pill/lib/PillCount.js +1 -1
  13. package/dist/commonjs/pill/lib/PillIcon.js +1 -1
  14. package/dist/commonjs/pill/lib/PillIconButton.js +1 -1
  15. package/dist/commonjs/pill/lib/PillLabel.js +1 -1
  16. package/dist/commonjs/radio/lib/RadioGroup.js +3 -3
  17. package/dist/commonjs/radio/lib/RadioLabel.js +1 -1
  18. package/dist/commonjs/radio/lib/RadioText.js +4 -4
  19. package/dist/commonjs/radio/lib/StyledRadioButton.js +5 -5
  20. package/dist/commonjs/side-panel/lib/SidePanel.js +7 -7
  21. package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +11 -11
  22. package/dist/commonjs/status-indicator/lib/StatusIndicator.js +13 -13
  23. package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.js +1 -1
  24. package/dist/es6/divider/lib/Divider.js +1 -1
  25. package/dist/es6/information-highlight/lib/InformationHighlight.js +7 -7
  26. package/dist/es6/information-highlight/lib/parts/Body.js +1 -1
  27. package/dist/es6/information-highlight/lib/parts/Heading.js +1 -1
  28. package/dist/es6/information-highlight/lib/parts/Link.js +1 -1
  29. package/dist/es6/loading-sparkles/lib/LoadingSparkles.js +2 -2
  30. package/dist/es6/multi-select/lib/MultiSelectInput.d.ts +57 -3
  31. package/dist/es6/multi-select/lib/MultiSelectInput.d.ts.map +1 -1
  32. package/dist/es6/multi-select/lib/MultiSelectInput.js +19 -10
  33. package/dist/es6/pill/lib/Pill.js +3 -3
  34. package/dist/es6/pill/lib/PillAvatar.js +1 -1
  35. package/dist/es6/pill/lib/PillCount.js +1 -1
  36. package/dist/es6/pill/lib/PillIcon.js +1 -1
  37. package/dist/es6/pill/lib/PillIconButton.js +1 -1
  38. package/dist/es6/pill/lib/PillLabel.js +1 -1
  39. package/dist/es6/radio/lib/RadioGroup.js +3 -3
  40. package/dist/es6/radio/lib/RadioLabel.js +1 -1
  41. package/dist/es6/radio/lib/RadioText.js +4 -4
  42. package/dist/es6/radio/lib/StyledRadioButton.js +5 -5
  43. package/dist/es6/side-panel/lib/SidePanel.js +7 -7
  44. package/dist/es6/side-panel/lib/SidePanelToggleButton.js +11 -11
  45. package/dist/es6/status-indicator/lib/StatusIndicator.js +13 -13
  46. package/dist/es6/status-indicator/lib/StatusIndicatorLabel.js +1 -1
  47. package/multi-select/lib/MultiSelectInput.tsx +60 -12
  48. package/package.json +4 -4
@@ -6,7 +6,7 @@ import { mergeStyles } from '@workday/canvas-kit-react/layout';
6
6
  import { system } from '@workday/canvas-tokens-web';
7
7
  const statusIndicatorLabelStencil = createStencil({
8
8
  extends: textStencil,
9
- base: { name: "swv63y", styles: "box-sizing:border-box;font-weight:var(--cnvs-sys-font-weight-bold);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-transform:capitalize;color:inherit;" },
9
+ base: { name: "x4983y", styles: "box-sizing:border-box;font-weight:var(--cnvs-sys-font-weight-bold);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-transform:capitalize;color:inherit;" },
10
10
  defaultModifiers: { typeLevel: 'subtext.large' }
11
11
  }, "status-indicator-label-63258e");
12
12
  export const StatusIndicatorLabel = createComponent('span')({
@@ -1,15 +1,16 @@
1
1
  import React from 'react';
2
2
 
3
- import {system} from '@workday/canvas-tokens-web';
3
+ import {brand, system} from '@workday/canvas-tokens-web';
4
4
  import {caretDownSmallIcon, searchIcon} from '@workday/canvas-system-icons-web';
5
5
 
6
6
  import {
7
+ ErrorType,
7
8
  composeHooks,
8
9
  createElemPropsHook,
9
10
  createSubcomponent,
10
11
  } from '@workday/canvas-kit-react/common';
11
- import {createStencil, CSProps, handleCsProp} from '@workday/canvas-kit-styling';
12
- import {InputGroup, TextInput} from '@workday/canvas-kit-react/text-input';
12
+ import {createStencil, CSProps, handleCsProp, px2rem, calc} from '@workday/canvas-kit-styling';
13
+ import {InputGroup, TextInput, textInputStencil} from '@workday/canvas-kit-react/text-input';
13
14
  import {SystemIcon} from '@workday/canvas-kit-react/icon';
14
15
  import {getCursor} from '@workday/canvas-kit-react/collection';
15
16
  import {useComboboxInput, useComboboxInputConstrained} from '@workday/canvas-kit-react/combobox';
@@ -18,7 +19,8 @@ import {useMultiSelectModel} from './useMultiSelectModel';
18
19
  import {MultiSelectedItemProps} from './MultiSelectedItem';
19
20
  import {MultiSelectedList} from './MultiSelectedList';
20
21
 
21
- export const multiSelectStencil = createStencil({
22
+ export const multiSelectInputStencil = createStencil({
23
+ //@ts-ignore Types don't like defining a variable in `base` and using a variable in a nested selector. One or the other is fine, but not both.
22
24
  base: {
23
25
  border: `1px solid ${system.color.border.input.default}`,
24
26
  display: 'flex',
@@ -29,12 +31,13 @@ export const multiSelectStencil = createStencil({
29
31
  minHeight: system.space.x10,
30
32
  transition: '0.2s box-shadow, 0.2s border-color',
31
33
  margin: 0, // Fix Safari
34
+ [textInputStencil.vars.width]: '100%',
32
35
 
33
36
  '&:hover, &.hover': {
34
37
  borderColor: system.color.border.input.strong,
35
38
  },
36
39
 
37
- '&:focus-within': {
40
+ '&:has(:focus-visible:not([disabled])), &.focus': {
38
41
  borderColor: system.color.border.primary.default,
39
42
  boxShadow: `inset 0 0 0 1px ${system.color.border.primary.default}`,
40
43
  },
@@ -45,6 +48,12 @@ export const multiSelectStencil = createStencil({
45
48
  backgroundColor: system.color.bg.transparent,
46
49
  borderRadius: system.shape.x1,
47
50
 
51
+ // collapse the height of the input by the border width so that an empty multi-select
52
+ // is the same height as a `TextInput`
53
+ '&:where([data-part="user-input"], [data-part="form-input"])': {
54
+ height: calc.subtract(system.space.x10, px2rem(2)),
55
+ },
56
+
48
57
  // Remove the focus ring - it is handled at the container level
49
58
  border: 'none !important',
50
59
  boxShadow: 'none !important',
@@ -88,8 +97,43 @@ export const multiSelectStencil = createStencil({
88
97
  flexWrap: 'wrap',
89
98
  },
90
99
  },
100
+ modifiers: {
101
+ error: {
102
+ error: {
103
+ borderColor: brand.error.base,
104
+ boxShadow: `inset 0 0 0 ${px2rem(1)} ${brand.error.base}`,
105
+ '&:has(:hover, :disabled, :focus-visible), &:is(.hover, .disabled, .focus)': {
106
+ borderColor: brand.error.base,
107
+ },
108
+ '&:has(:focus-visible:not([disabled])), &.focus': {
109
+ boxShadow: `inset 0 0 0 ${px2rem(1)} ${brand.error.base}, 0 0 0 2px ${
110
+ system.color.border.inverse
111
+ }, 0 0 0 4px ${brand.common.focusOutline}`,
112
+ outlineOffset: px2rem(2),
113
+ },
114
+ },
115
+ alert: {
116
+ borderColor: brand.alert.darkest,
117
+ boxShadow: `inset 0 0 0 ${px2rem(2)} ${brand.alert.base}`,
118
+ '&:has(:hover, .hover, :disabled, .disabled, :focus-visible:not([disabled])), .focus:not(:has([disabled]))':
119
+ {
120
+ borderColor: brand.alert.darkest,
121
+ },
122
+
123
+ '&:has(:focus-visible, .focus):not(:has([disabled]))': {
124
+ boxShadow: `inset 0 0 0 ${px2rem(2)} ${brand.alert.base},
125
+ 0 0 0 2px ${system.color.border.inverse},
126
+ 0 0 0 4px ${brand.common.focusOutline}`,
127
+ },
128
+ outlineOffset: px2rem(2),
129
+ },
130
+ },
131
+ },
91
132
  });
92
133
 
134
+ /** @deprecated use `multiSelectInputStencil` instead. This will be removed in a future version. */
135
+ export const multiSelectStencil = multiSelectInputStencil;
136
+
93
137
  export const useMultiSelectInput = composeHooks(
94
138
  createElemPropsHook(useMultiSelectModel)((model, ref) => {
95
139
  return {
@@ -128,7 +172,9 @@ export interface MultiSelectInputProps
128
172
  React.InputHTMLAttributes<HTMLInputElement>,
129
173
  'disabled' | 'className' | 'style' | 'aria-labelledby'
130
174
  >,
131
- Pick<MultiSelectedItemProps, 'removeLabel'> {}
175
+ Pick<MultiSelectedItemProps, 'removeLabel'> {
176
+ error?: ErrorType;
177
+ }
132
178
 
133
179
  export const MultiSelectInput = createSubcomponent(TextInput)({
134
180
  modelHook: useMultiSelectModel,
@@ -139,17 +185,17 @@ export const MultiSelectInput = createSubcomponent(TextInput)({
139
185
  className,
140
186
  cs,
141
187
  style,
188
+ error,
142
189
  'aria-labelledby': ariaLabelledBy,
143
190
  removeLabel,
144
191
  disabled,
145
192
  formInputProps,
146
193
  ...elemProps
147
194
  },
148
- Element,
149
- model
195
+ Element
150
196
  ) => {
151
197
  return (
152
- <div {...handleCsProp({className, cs, style}, multiSelectStencil({}))}>
198
+ <div {...handleCsProp({className, cs, style}, multiSelectInputStencil({error}))}>
153
199
  <InputGroup>
154
200
  <InputGroup.Input data-part="form-input" {...formInputProps} />
155
201
  <InputGroup.Input
@@ -158,6 +204,7 @@ export const MultiSelectInput = createSubcomponent(TextInput)({
158
204
  aria-labelledby={ariaLabelledBy}
159
205
  readOnly
160
206
  disabled={disabled}
207
+ error={error}
161
208
  {...elemProps}
162
209
  />
163
210
  <InputGroup.InnerEnd pointerEvents="none">
@@ -184,13 +231,13 @@ export const MultiSelectSearchInput = createSubcomponent(TextInput)({
184
231
  formInputProps,
185
232
  ref,
186
233
  disabled,
234
+ error,
187
235
  ...elemProps
188
236
  },
189
- Element,
190
- model
237
+ Element
191
238
  ) => {
192
239
  return (
193
- <div {...handleCsProp({className, cs, style}, multiSelectStencil({}))}>
240
+ <div {...handleCsProp({className, cs, style}, multiSelectInputStencil({}))}>
194
241
  <InputGroup>
195
242
  <InputGroup.InnerStart pointerEvents="none" width={system.space.x8}>
196
243
  <SystemIcon icon={searchIcon} size={system.space.x4} />
@@ -205,6 +252,7 @@ export const MultiSelectSearchInput = createSubcomponent(TextInput)({
205
252
  as={Element}
206
253
  aria-labelledby={ariaLabelledBy}
207
254
  disabled={disabled}
255
+ error={error}
208
256
  {...elemProps}
209
257
  />
210
258
  <InputGroup.InnerEnd width={system.space.x4}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-preview-react",
3
- "version": "13.0.4",
3
+ "version": "13.0.5",
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,8 +46,8 @@
46
46
  "dependencies": {
47
47
  "@emotion/react": "^11.7.1",
48
48
  "@emotion/styled": "^11.6.0",
49
- "@workday/canvas-kit-react": "^13.0.4",
50
- "@workday/canvas-kit-styling": "^13.0.4",
49
+ "@workday/canvas-kit-react": "^13.0.5",
50
+ "@workday/canvas-kit-styling": "^13.0.5",
51
51
  "@workday/canvas-system-icons-web": "^3.0.0",
52
52
  "@workday/canvas-tokens-web": "^2.1.1",
53
53
  "@workday/design-assets-types": "^0.2.8"
@@ -58,5 +58,5 @@
58
58
  "react-hook-form": "7.36.1",
59
59
  "yup": "^0.32.11"
60
60
  },
61
- "gitHead": "885784bd65fe9a445b16d7b7ac21b0af9151dadd"
61
+ "gitHead": "ab6af4b56e5da8a029108d119d86aab19645e6c8"
62
62
  }