@workday/canvas-kit-docs 16.0.15 → 16.0.17

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.
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
18
18
  "@emotion/react": "11.11.4",
19
19
  "@types/react": "18.2.60",
20
20
  "@types/react-dom": "18.2.19",
21
- "@workday/canvas-kit-labs-react": "16.0.15",
22
- "@workday/canvas-kit-preview-react": "16.0.15",
23
- "@workday/canvas-kit-react": "16.0.15",
24
- "@workday/canvas-kit-react-fonts": "^16.0.15",
25
- "@workday/canvas-kit-styling": "16.0.15",
21
+ "@workday/canvas-kit-labs-react": "16.0.17",
22
+ "@workday/canvas-kit-preview-react": "16.0.17",
23
+ "@workday/canvas-kit-react": "16.0.17",
24
+ "@workday/canvas-kit-react-fonts": "^16.0.17",
25
+ "@workday/canvas-kit-styling": "16.0.17",
26
26
  "@workday/canvas-system-icons-web": "^5.0.3",
27
27
  "@workday/canvas-expressive-icons-web": "1.0.1",
28
28
  "@workday/canvas-tokens-web": "4.4.0-beta.11"
@@ -19,11 +19,11 @@ export const packageJSONFile = `{
19
19
  "@emotion/react": "11.11.4",
20
20
  "@types/react": "18.2.60",
21
21
  "@types/react-dom": "18.2.19",
22
- "@workday/canvas-kit-labs-react": "16.0.15",
23
- "@workday/canvas-kit-preview-react": "16.0.15",
24
- "@workday/canvas-kit-react": "16.0.15",
25
- "@workday/canvas-kit-react-fonts": "^16.0.15",
26
- "@workday/canvas-kit-styling": "16.0.15",
22
+ "@workday/canvas-kit-labs-react": "16.0.17",
23
+ "@workday/canvas-kit-preview-react": "16.0.17",
24
+ "@workday/canvas-kit-react": "16.0.17",
25
+ "@workday/canvas-kit-react-fonts": "^16.0.17",
26
+ "@workday/canvas-kit-styling": "16.0.17",
27
27
  "@workday/canvas-system-icons-web": "^5.0.3",
28
28
  "@workday/canvas-expressive-icons-web": "1.0.1",
29
29
  "@workday/canvas-tokens-web": "4.4.0-beta.11"
@@ -0,0 +1,57 @@
1
+ # Agent Skills
2
+
3
+ Canvas Kit ships a **consumer-facing** skill set for AI coding agents (Cursor, Claude, Copilot, and
4
+ similar tools). Each skill is a `SKILL.md` file under [`skills/`](../../../../skills/README.md) in
5
+ this repository. Agents load them to write, style, migrate, and review UI that follows Canvas Kit
6
+ correctly.
7
+
8
+ These skills target the **current generation**: Canvas Kit **v16** +
9
+ `@workday/canvas-tokens-web` **4.4** (Sana Canvas theme). They do **not** cover maintainer-only
10
+ concerns (`system.legacy.*` in `modules/**/lib/**`, Chromatic class twins, publishing) — see
11
+ [`AGENTS.md`](../../../../AGENTS.md) and [`STYLE.md`](../../../../STYLE.md) for that workflow.
12
+
13
+ ## Installing skills
14
+
15
+ Copy or symlink the [`skills/`](../../../../skills/) directory into your editor's skills location
16
+ (for example `.cursor/skills/` or `.claude/skills/`), or point your agent configuration at the
17
+ folder in a checkout of this repo.
18
+
19
+ Start every version-sensitive task with the **Version Detection** skill so tables from other skills
20
+ match what's installed in `node_modules`.
21
+
22
+ ## Skill catalog
23
+
24
+ | Skill | Use when | Source on GitHub |
25
+ | ----- | -------- | ---------------- |
26
+ | [Version Detection](../../../../skills/sana-canvas-kit-version/SKILL.md) | Detect installed Canvas Kit / tokens-web versions; lookup upgrade guides | [references.md](../../../../skills/sana-canvas-kit-version/references.md) |
27
+ | [Tokens](../../../../skills/sana-canvas-kit-tokens/SKILL.md) | Pick tokens by role; accessible color pairings; CSS-variable troubleshooting | [references.md](../../../../skills/sana-canvas-kit-tokens/references.md) |
28
+ | [Styling](../../../../skills/sana-canvas-kit-styling/SKILL.md) | `createStyles`, `createStencil`, `cs`, layout without `Box`/`Flex` | — |
29
+ | [Design Principles](../../../../skills/sana-canvas-kit-design-principles/SKILL.md) | Which component fits a use case; dos/don'ts snapshot | [references/components.md](../../../../skills/sana-canvas-kit-design-principles/references/components.md) |
30
+ | [Accessibility](../../../../skills/sana-canvas-kit-accessibility/SKILL.md) | Labels, keyboard, focus, popups, forms, live regions | [references.md](../../../../skills/sana-canvas-kit-accessibility/references.md) |
31
+ | [Component Selection](../../../../skills/sana-canvas-kit-component-selection/SKILL.md) | Avoid `@deprecated` exports; Main vs Preview vs Labs | [references.md](../../../../skills/sana-canvas-kit-component-selection/references.md) |
32
+ | [Icons](../../../../skills/sana-canvas-kit-icons/SKILL.md) | System/expressive icons; `icon-migration` codemod | — |
33
+ | [Migration](../../../../skills/sana-canvas-kit-migration/SKILL.md) | Run `@workday/canvas-kit-codemod` across majors | [references.md](../../../../skills/sana-canvas-kit-migration/references.md) |
34
+ | [Builder](../../../../skills/sana-canvas-kit-builder/SKILL.md) | Custom components with Canvas Kit factories | — |
35
+ | [Review](../../../../skills/sana-canvas-kit-review/SKILL.md) | Report-only design-system compliance check on a diff | — |
36
+
37
+ Full index and dependency notes: [`skills/README.md`](../../../../skills/README.md).
38
+
39
+ ## How skills depend on each other
40
+
41
+ Run **Version Detection** first whenever another skill's guidance might be release-specific.
42
+
43
+ ```
44
+ version → tokens, styling, component-selection, icons, migration, review
45
+ tokens → styling, design-principles, accessibility, builder, review
46
+ component-selection → accessibility, icons, review
47
+ accessibility → design-principles, builder, review
48
+ styling → builder, review
49
+ design-principles → builder, review
50
+ migration → review
51
+ ```
52
+
53
+ ## Related tooling
54
+
55
+ - **Canvas Kit MCP** — runtime docs, upgrade guides, and accessibility scenarios for agents.
56
+ See [MCP Docs](../../../mcp/stories/mdx/MCPDocs.mdx) (under **AI For LLMs** in the sidebar).
57
+ - **Maintainer agent guide** — [`AGENTS.md`](../../../../AGENTS.md) for contributing to this repo.
@@ -1,8 +1,4 @@
1
- import {
2
- ExampleCodeBlock,
3
- Specifications,
4
- SymbolDoc,
5
- } from '@workday/canvas-kit-docs';
1
+ import {ExampleCodeBlock, Specifications, SymbolDoc} from '@workday/canvas-kit-docs';
6
2
 
7
3
  import Basic from './examples/Basic';
8
4
  import Caution from './examples/Caution';
@@ -34,7 +30,9 @@ yarn add @workday/canvas-kit-react
34
30
 
35
31
  Checkbox may be used on its own without [Form Field](/components/inputs/form-field/) since it
36
32
  includes a `<label>` with a `for` attribute referencing the underlying `<input type="checkbox">`
37
- element.
33
+ element. For checkboxes grouped with **`FormFieldGroup`**, see
34
+ [FormField accessibility](/components/inputs/form-field/#accessibility) for hint, error, caution,
35
+ and required state wiring.
38
36
 
39
37
  <ExampleCodeBlock code={Basic} />
40
38
 
@@ -61,6 +59,9 @@ not all) of its children are checked.
61
59
 
62
60
  <ExampleCodeBlock code={Indeterminate} />
63
61
 
62
+ > **Accessibility Note**: Use semantic unordered list markup so that screen readers can communicate
63
+ > the nested hierarchy of the components to users.
64
+
64
65
  ### Ref Forwarding
65
66
 
66
67
  Checkbox supports [ref forwarding](https://reactjs.org/docs/forwarding-refs.html). It will forward
@@ -70,27 +71,32 @@ Checkbox supports [ref forwarding](https://reactjs.org/docs/forwarding-refs.html
70
71
 
71
72
  ### Label Position Horizontal
72
73
 
73
- Set the `orientation` prop of the Form Field to designate the position of the label relative to the
74
- input component. By default, the orientation will be set to `vertical`.
74
+ Set the `orientation` prop of the wrapping FormFieldGroup to designate the position of the group
75
+ label relative to the checkboxes. By default, the orientation will be set to `vertical`.
75
76
 
76
77
  <ExampleCodeBlock code={LabelPosition} />
77
78
 
78
79
  ### Required
79
80
 
80
- Set the `required` prop of a wrapping Form Field to `true` to indicate that the field is required.
81
- Labels for required fields are suffixed by a red asterisk.
81
+ Set the `isRequired` prop of a wrapping FormFieldGroup to `true` to indicate that the field is
82
+ required. Labels for required fields are suffixed by a red asterisk.
83
+
84
+ A standalone checkbox does not need **`FormFieldGroup`**. This example wraps a single checkbox so
85
+ `isRequired` can show the required asterisk on **`FormFieldGroup.Label`**. Use that wrapper only
86
+ when the spec includes a required state (or a group name, hint, error, or caution). See
87
+ [Accessibility](#accessibility).
82
88
 
83
89
  <ExampleCodeBlock code={Required} />
84
90
 
85
91
  ### Error States
86
92
 
87
- Set the `error` prop of the wrapping Form Field to `"caution"` or `"error"` to set the Checkbox to
88
- the Alert or Error state, respectively. You will also need to set the `hintId` and `hintText` props
89
- on the Form Field to meet accessibility standards. You may wish to omit the `label` prop on the Form
90
- Field given that Checkbox already includes a label.
93
+ Set the `error` prop of the wrapping FormFieldGroup to `"caution"` or `"error"` to set the Checkbox
94
+ to the Alert or Error state, respectively. Render `FormFieldGroup.Hint` with the message text so
95
+ assistive technology can associate the hint with the group. Keep the Checkbox `label` so each
96
+ control retains its own accessible name; `FormFieldGroup.Label` only provides the group name.
91
97
 
92
98
  The `error` prop may be applied directly to the Checkbox with a value of `"caution"` or `"error"` if
93
- Form Field is not being used.
99
+ FormFieldGroup is not being used.
94
100
 
95
101
  #### Caution
96
102
 
@@ -105,6 +111,127 @@ Form Field is not being used.
105
111
  Checkbox supports custom styling via the `cs` prop. For more information, check our
106
112
  ["How To Customize Styles"](https://workday.github.io/canvas-kit/?path=/docs/styling-guides-customizing-styles--docs).
107
113
 
114
+ ## Accessibility
115
+
116
+ The primary accessibility goal is a visible, programmatically determinable name and a checked,
117
+ unchecked, or mixed state that assistive technology can expose. Use **Checkbox** when the user can
118
+ select zero, one, or many independent options. For mutually exclusive choices, use
119
+ [**Radio**](https://workday.github.io/canvas-kit/?path=/docs/preview-inputs-radio--docs) instead.
120
+ When checkboxes answer the same question, or need hint, error, caution, or required association, see
121
+ [FormField's accessibility documentation](/components/inputs/form-field/#accessibility).
122
+
123
+ ### Minimum Accessible Structure
124
+
125
+ The following matches the [Basic Example](#basic-example): a **`Checkbox`** with a non-empty
126
+ **`label`**. **`FormFieldGroup`** is not required for a single standalone checkbox with no hint,
127
+ error, caution, or required state.
128
+
129
+ ```tsx
130
+ import {Checkbox} from '@workday/canvas-kit-react/checkbox';
131
+
132
+ <Checkbox label="I agree to the terms" />;
133
+ ```
134
+
135
+ ### Built-in Behaviors
136
+
137
+ Canvas Kit applies these automatically on **`Checkbox`**. When checkboxes that answer the same
138
+ question are composed with **`FormFieldGroup`** subcomponents, that grouping wiring is also applied
139
+ automatically. **Do not duplicate them** in consuming code.
140
+
141
+ **ARIA and DOM** (_applied by Checkbox_):
142
+
143
+ - **`Checkbox`**: Renders a native `<input type="checkbox">`. Canvas Kit assigns an `id` with
144
+ `useUniqueId` unless you pass **`id`**.
145
+ - **`label`**: Renders a visible `<label htmlFor={id}>` so the control has an accessible name and
146
+ clicking the text activates the input.
147
+ - **`indeterminate`**: Sets `aria-checked="mixed"` and the input's native `indeterminate` property.
148
+ Otherwise `aria-checked` follows the **`checked`** prop.
149
+ - **`disabled`**: Maps to the native `disabled` attribute.
150
+ - **`ref`**: Forwards to the underlying `<input type="checkbox">`.
151
+
152
+ **Keyboard** (_native checkbox behavior_):
153
+
154
+ **`Checkbox`** uses native `<input type="checkbox">` keyboard behavior (tab order, Space to toggle,
155
+ and label activation). Do not intercept <kbd>Space</kbd> or otherwise prevent the native toggle.
156
+
157
+ **Screen reader expectations** (_when built-in behaviors are used as intended_):
158
+
159
+ - On focus, assistive technology announces the Checkbox **`label`** and checked, unchecked, or mixed
160
+ state
161
+ - Disabled checkboxes are announced as unavailable
162
+
163
+ For group, hint, error, and required association, see
164
+ [FormField's Built-in Behaviors](/components/inputs/form-field/#built-in-behaviors).
165
+
166
+ ### Accessibility Requirements
167
+
168
+ Required in application code for an accessible Checkbox. Rows marked _(conditional)_ apply only when
169
+ the situation matches—otherwise omit.
170
+
171
+ **If no design spec is provided:** use a visible, non-empty Checkbox **`label`**. Omit
172
+ **`FormFieldGroup`** unless the spec includes a group name, more than one independent option for the
173
+ same question, or hint, error, caution, or required state. Omit **`FormFieldGroup.Hint`**,
174
+ **`isRequired`**, **`error`**, **`indeterminate`**, **`disabled`**, a custom **`id`**, and a
175
+ **`ref`** unless the spec requires them.
176
+
177
+ **Choose a composition:**
178
+
179
+ - Standalone **`Checkbox`** with **`label`** — one control with no hint, error, caution, or required
180
+ state
181
+ - **`FormFieldGroup`** — one question with two or more independent options, or any checkbox that
182
+ needs a group name, hint, error, caution, or required state
183
+ - Nested `<ul>` / `<li>` — parent checkbox with nested children and **`indeterminate`**. Do not use
184
+ **`FormFieldGroup`** for that hierarchy. Checkboxes that answer different questions stay in
185
+ separate compositions.
186
+
187
+ **Programmatic focus** _(conditional — omit by default)_:
188
+
189
+ Attach a `ref` only when the product must move focus to the checkbox after an action (for example,
190
+ **Submit** in [Ref Forwarding](#ref-forwarding)). Do not attach a `ref` or call `focus()` unless the
191
+ design or developer asks for it.
192
+
193
+ | Requirement | How to satisfy |
194
+ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
195
+ | Accessible name | Non-empty **`label`** on every **`Checkbox`**. **`FormFieldGroup.Label`** names the group only (`div` with an `id`); it is not a `<label>` and does not replace **`label`**. |
196
+ | Group wiring _(conditional)_ | When the spec is one question with two or more independent options, or includes a group name, hint, error, caution, or required state: **`FormFieldGroup`** + **`FormFieldGroup.Label`** + **`FormFieldGroup.Input as={Checkbox}`**. Put hint, error, caution, and required on the group — see [FormField accessibility](/components/inputs/form-field/#accessibility). See [Required](#required) and [Error States](#error-states). |
197
+ | Visual error or caution _(conditional)_ | When **`FormFieldGroup`** has `error="error"` or `error="caution"`, also set **`error`** on **`Checkbox`** to the same state so the visual ring appears. See [Caution](#caution) and [Error](#error). |
198
+ | Indeterminate parent _(conditional)_ | When a parent checkbox's value depends on nested children and some (but not all) children are checked: set **`indeterminate`** on the parent **`Checkbox`**; keep a non-empty **`label`** on the parent and on each child; nest the children in a `<ul>` inside the parent's `<li>`. See [Indeterminate](#indeterminate). |
199
+ | Disabled _(conditional)_ | `disabled` on **`Checkbox`** when the spec marks the option unavailable. See [Disabled](#disabled). |
200
+ | Programmatic focus _(conditional)_ | `ref` on **`Checkbox`** (or **`FormFieldGroup.Input`**) and move focus when the product requires it — omit by default (see **Programmatic focus** above and [Ref Forwarding](#ref-forwarding)). |
201
+
202
+ **Summary for code generation:**
203
+
204
+ - **REQUIRED:** non-empty **`label`**
205
+ - **CONDITIONAL:** **`FormFieldGroup`** for one question with two or more independent options, or
206
+ for hint, error, caution, or required; **`error`** on **`Checkbox`** when the group is in caution
207
+ or error; nested list + **`indeterminate`** for a parent/child tree; disabled; programmatic focus
208
+ via `ref`. See [FormField accessibility](/components/inputs/form-field/#accessibility) for group
209
+ hint, error, caution, and required.
210
+
211
+ ### Anti-Patterns
212
+
213
+ Do **not** generate code that does the following (see **Accessibility Requirements** above for what
214
+ to supply instead):
215
+
216
+ - Manually set `aria-checked` or `htmlFor` on **`Checkbox`**, or pass an **`id`** when the spec does
217
+ not require a known id — Canvas Kit wires `aria-checked` and `htmlFor`, and assigns an `id` with
218
+ `useUniqueId` unless you pass one (see **If no design spec is provided**)
219
+ - Ignore **Choose a composition** — do not wrap a standalone checkbox with no group name, hint,
220
+ error, caution, or required state in **`FormFieldGroup`**; do not put different questions in one
221
+ group; do not use **`FormFieldGroup`** for a parent/child indeterminate tree
222
+ - Wrap **`Checkbox`** with **`FormField.Input`** — **`Checkbox`** already renders its own `<label>`.
223
+ When a group is required, use **`FormFieldGroup.Input as={Checkbox}`** (see **Group wiring**)
224
+ - Omit **`label`** because **`FormFieldGroup.Label`** is present — the group label does not name the
225
+ individual control
226
+ - Set `aria-checked="mixed"` without **`indeterminate`**
227
+ - Use **`aria-disabled`** instead of **`disabled`** — **`Checkbox`** maps unavailability to the
228
+ native **`disabled`** prop
229
+ - Use **`disabled`** when the spec says users must still focus the control to hear why it is
230
+ unavailable. Only in that case keep the checkbox enabled and put the explanation in
231
+ **`FormFieldGroup.Hint`** or on an adjacent focusable control
232
+ - Use **Checkbox** for mutually exclusive choices — use
233
+ [**Radio**](https://workday.github.io/canvas-kit/?path=/docs/preview-inputs-radio--docs) instead
234
+
108
235
  ## Component API
109
236
 
110
237
  <SymbolDoc name="Checkbox" fileName="/react/" />
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
4
- import {FormField} from '@workday/canvas-kit-react/form-field';
5
4
 
6
5
  export default () => {
7
6
  const [checked, setChecked] = React.useState(false);
@@ -10,17 +9,5 @@ export default () => {
10
9
  setChecked(event.target.checked);
11
10
  };
12
11
 
13
- return (
14
- <FormField>
15
- <FormField.Label>Confirm</FormField.Label>
16
- <FormField.Field>
17
- <FormField.Input
18
- as={Checkbox}
19
- checked={checked}
20
- label="I agree to the terms"
21
- onChange={handleChange}
22
- />
23
- </FormField.Field>
24
- </FormField>
25
- );
12
+ return <Checkbox checked={checked} label="I agree to the terms" onChange={handleChange} />;
26
13
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
4
- import {FormField} from '@workday/canvas-kit-react/form-field';
4
+ import {FormFieldGroup} from '@workday/canvas-kit-react/form-field';
5
5
 
6
6
  export default () => {
7
7
  const [checked, setChecked] = React.useState(false);
@@ -11,17 +11,18 @@ export default () => {
11
11
  };
12
12
 
13
13
  return (
14
- <FormField error="caution">
15
- <FormField.Label>Confirm</FormField.Label>
16
- <FormField.Field>
17
- <FormField.Input
14
+ <FormFieldGroup error="caution">
15
+ <FormFieldGroup.Label>Confirm</FormFieldGroup.Label>
16
+ <FormFieldGroup.Field>
17
+ <FormFieldGroup.Input
18
18
  as={Checkbox}
19
19
  checked={checked}
20
+ error={Checkbox.ErrorType.Caution}
20
21
  label="I agree to the terms"
21
22
  onChange={handleChange}
22
23
  />
23
- <FormField.Hint>You must agree to the terms before proceeding</FormField.Hint>
24
- </FormField.Field>
25
- </FormField>
24
+ <FormFieldGroup.Hint>You must agree to the terms before proceeding</FormFieldGroup.Hint>
25
+ </FormFieldGroup.Field>
26
+ </FormFieldGroup>
26
27
  );
27
28
  };
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
4
- import {FormField} from '@workday/canvas-kit-react/form-field';
5
4
 
6
5
  export default () => {
7
6
  const [checked, setChecked] = React.useState(false);
@@ -11,17 +10,6 @@ export default () => {
11
10
  };
12
11
 
13
12
  return (
14
- <FormField>
15
- <FormField.Label>Confirm</FormField.Label>
16
- <FormField.Field>
17
- <FormField.Input
18
- as={Checkbox}
19
- checked={checked}
20
- disabled={true}
21
- label="I agree to the terms"
22
- onChange={handleChange}
23
- />
24
- </FormField.Field>
25
- </FormField>
13
+ <Checkbox checked={checked} disabled label="I agree to the terms" onChange={handleChange} />
26
14
  );
27
15
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
4
- import {FormField} from '@workday/canvas-kit-react/form-field';
4
+ import {FormFieldGroup} from '@workday/canvas-kit-react/form-field';
5
5
 
6
6
  export default () => {
7
7
  const [checked, setChecked] = React.useState(false);
@@ -11,17 +11,18 @@ export default () => {
11
11
  };
12
12
 
13
13
  return (
14
- <FormField error="error">
15
- <FormField.Label>Confirm</FormField.Label>
16
- <FormField.Field>
17
- <FormField.Input
14
+ <FormFieldGroup error="error">
15
+ <FormFieldGroup.Label>Confirm</FormFieldGroup.Label>
16
+ <FormFieldGroup.Field>
17
+ <FormFieldGroup.Input
18
18
  as={Checkbox}
19
19
  checked={checked}
20
+ error={Checkbox.ErrorType.Error}
20
21
  label="I agree to the terms"
21
22
  onChange={handleChange}
22
23
  />
23
- <FormField.Hint>You must agree to the terms before proceeding</FormField.Hint>
24
- </FormField.Field>
25
- </FormField>
24
+ <FormFieldGroup.Hint>You must agree to the terms before proceeding</FormFieldGroup.Hint>
25
+ </FormFieldGroup.Field>
26
+ </FormFieldGroup>
26
27
  );
27
28
  };
@@ -1,13 +1,24 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
4
- import {Box} from '@workday/canvas-kit-react/layout';
5
4
  import {createStyles} from '@workday/canvas-kit-styling';
6
5
  import {system} from '@workday/canvas-tokens-web';
7
6
 
8
- const styleOverrides = createStyles({
7
+ const listStyles = createStyles({
8
+ listStyle: 'none',
9
+ margin: 0,
10
+ padding: 0,
11
+ });
12
+
13
+ const nestedListStyles = createStyles({
14
+ listStyle: 'none',
15
+ margin: 0,
9
16
  marginInlineStart: system.gap.xl,
10
17
  marginBlockStart: system.gap.sm,
18
+ padding: 0,
19
+ display: 'flex',
20
+ flexDirection: 'column',
21
+ gap: system.gap.sm,
11
22
  });
12
23
 
13
24
  export default () => {
@@ -59,23 +70,26 @@ export default () => {
59
70
  };
60
71
 
61
72
  return (
62
- <>
63
- <Checkbox
64
- checked={pizzaChecked}
65
- indeterminate={pizzaIndeterminate}
66
- label="Supreme Pizza Toppings"
67
- onChange={handlePizzaChange}
68
- />
69
- <Box cs={styleOverrides}>
70
- {toppings.map((topping, index) => (
71
- <Checkbox
72
- checked={topping.checked}
73
- key={topping.name}
74
- label={topping.name}
75
- onChange={event => handleToppingChange(event, index)}
76
- />
77
- ))}
78
- </Box>
79
- </>
73
+ <ul className={listStyles}>
74
+ <li>
75
+ <Checkbox
76
+ checked={pizzaChecked}
77
+ indeterminate={pizzaIndeterminate}
78
+ label="Supreme Pizza Toppings"
79
+ onChange={handlePizzaChange}
80
+ />
81
+ <ul className={nestedListStyles}>
82
+ {toppings.map((topping, index) => (
83
+ <li key={topping.name}>
84
+ <Checkbox
85
+ checked={topping.checked}
86
+ label={topping.name}
87
+ onChange={event => handleToppingChange(event, index)}
88
+ />
89
+ </li>
90
+ ))}
91
+ </ul>
92
+ </li>
93
+ </ul>
80
94
  );
81
95
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
4
- import {FormField} from '@workday/canvas-kit-react/form-field';
4
+ import {FormFieldGroup} from '@workday/canvas-kit-react/form-field';
5
5
 
6
6
  export default () => {
7
7
  const [checked, setChecked] = React.useState(false);
@@ -11,16 +11,16 @@ export default () => {
11
11
  };
12
12
 
13
13
  return (
14
- <FormField orientation="horizontalStart">
15
- <FormField.Label>Confirm</FormField.Label>
16
- <FormField.Field>
17
- <FormField.Input
14
+ <FormFieldGroup orientation="horizontalStart">
15
+ <FormFieldGroup.Label>Confirm</FormFieldGroup.Label>
16
+ <FormFieldGroup.Field>
17
+ <FormFieldGroup.Input
18
18
  as={Checkbox}
19
19
  checked={checked}
20
20
  label="I agree to the terms"
21
21
  onChange={handleChange}
22
22
  />
23
- </FormField.Field>
24
- </FormField>
23
+ </FormFieldGroup.Field>
24
+ </FormFieldGroup>
25
25
  );
26
26
  };
@@ -2,45 +2,33 @@ import React from 'react';
2
2
 
3
3
  import {PrimaryButton} from '@workday/canvas-kit-react/button';
4
4
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
5
- import {FormField} from '@workday/canvas-kit-react/form-field';
6
- import {Box} from '@workday/canvas-kit-react/layout';
7
- import {createStyles, px2rem} from '@workday/canvas-kit-styling';
5
+ import {changeFocus} from '@workday/canvas-kit-react/common';
6
+ import {Flex} from '@workday/canvas-kit-react/layout';
7
+ import {createStyles} from '@workday/canvas-kit-styling';
8
8
  import {system} from '@workday/canvas-tokens-web';
9
9
 
10
- const boxStyles = createStyles({
11
- display: 'flex',
10
+ const containerStyles = createStyles({
11
+ gap: system.gap.md,
12
+ alignItems: 'flex-start',
12
13
  flexDirection: 'column',
13
14
  });
14
15
 
15
16
  export default () => {
16
17
  const [checked, setChecked] = React.useState(false);
17
- const ref = React.useRef(null);
18
+ const ref = React.useRef<HTMLInputElement>(null);
18
19
 
19
20
  const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
20
21
  setChecked(event.target.checked);
21
22
  };
22
23
 
23
24
  const handleClick = () => {
24
- ref.current.click();
25
+ changeFocus(ref.current);
25
26
  };
26
27
 
27
28
  return (
28
- <>
29
- <Box cs={boxStyles}>
30
- <FormField>
31
- <FormField.Label>Confirm</FormField.Label>
32
- <FormField.Field>
33
- <FormField.Input
34
- as={Checkbox}
35
- checked={checked}
36
- label="I agree to the terms"
37
- onChange={handleChange}
38
- ref={ref}
39
- />
40
- </FormField.Field>
41
- </FormField>
42
- </Box>
43
- <PrimaryButton onClick={handleClick}>Check Agreement to Terms</PrimaryButton>
44
- </>
29
+ <Flex cs={containerStyles}>
30
+ <Checkbox checked={checked} label="I agree to the terms" onChange={handleChange} ref={ref} />
31
+ <PrimaryButton onClick={handleClick}>Focus Checkbox</PrimaryButton>
32
+ </Flex>
45
33
  );
46
34
  };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
4
- import {FormField} from '@workday/canvas-kit-react/form-field';
4
+ import {FormFieldGroup} from '@workday/canvas-kit-react/form-field';
5
5
 
6
6
  export default () => {
7
7
  const [checked, setChecked] = React.useState(false);
@@ -11,16 +11,16 @@ export default () => {
11
11
  };
12
12
 
13
13
  return (
14
- <FormField isRequired={true}>
15
- <FormField.Label>Confirm</FormField.Label>
16
- <FormField.Field>
17
- <FormField.Input
14
+ <FormFieldGroup isRequired={true}>
15
+ <FormFieldGroup.Label>Confirm</FormFieldGroup.Label>
16
+ <FormFieldGroup.Field>
17
+ <FormFieldGroup.Input
18
18
  as={Checkbox}
19
19
  checked={checked}
20
20
  label="I agree to the terms"
21
21
  onChange={handleChange}
22
22
  />
23
- </FormField.Field>
24
- </FormField>
23
+ </FormFieldGroup.Field>
24
+ </FormFieldGroup>
25
25
  );
26
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "16.0.15",
3
+ "version": "16.0.17",
4
4
  "description": "Documentation components of Canvas Kit components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -47,10 +47,10 @@
47
47
  "@stackblitz/sdk": "^1.11.0",
48
48
  "@storybook/csf": "0.0.1",
49
49
  "@workday/canvas-expressive-icons-web": "1.0.2",
50
- "@workday/canvas-kit-labs-react": "^16.0.15",
51
- "@workday/canvas-kit-preview-react": "^16.0.15",
52
- "@workday/canvas-kit-react": "^16.0.15",
53
- "@workday/canvas-kit-styling": "^16.0.15",
50
+ "@workday/canvas-kit-labs-react": "^16.0.17",
51
+ "@workday/canvas-kit-preview-react": "^16.0.17",
52
+ "@workday/canvas-kit-react": "^16.0.17",
53
+ "@workday/canvas-kit-styling": "^16.0.17",
54
54
  "@workday/canvas-system-icons-web": "^5.0.3",
55
55
  "@workday/canvas-tokens-web": "^4.4.0",
56
56
  "markdown-to-jsx": "^7.2.0",
@@ -63,5 +63,5 @@
63
63
  "mkdirp": "^1.0.3",
64
64
  "typescript": "5.0"
65
65
  },
66
- "gitHead": "f4ae86b34eec3edc8e580c9384d4919da5ae2a76"
66
+ "gitHead": "945e2de7e77180c089e101727dcfa3c04019759e"
67
67
  }