@workday/canvas-kit-docs 15.0.0-alpha.0010-next.0 → 15.0.0-alpha.0023-next.0

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 (22) hide show
  1. package/dist/es6/lib/docs.js +180337 -181060
  2. package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +5 -5
  3. package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +5 -5
  4. package/dist/mdx/15.0-UPGRADE-GUIDE.mdx +197 -1
  5. package/dist/mdx/react/_examples/mdx/examples/Density.tsx +1 -1
  6. package/dist/mdx/react/_examples/mdx/examples/layout/ResponsiveColumns.tsx +1 -1
  7. package/dist/mdx/react/action-bar/examples/OverflowActionBar.tsx +1 -1
  8. package/dist/mdx/react/breadcrumbs/examples/Overflow.tsx +1 -1
  9. package/dist/mdx/react/segmented-control/SegmentedControl.mdx +119 -26
  10. package/dist/mdx/react/segmented-control/examples/Basic.tsx +32 -28
  11. package/dist/mdx/{preview-react → react}/segmented-control/examples/Disabled.tsx +1 -1
  12. package/dist/mdx/{preview-react → react}/segmented-control/examples/Dynamic.tsx +1 -1
  13. package/dist/mdx/{preview-react → react}/segmented-control/examples/RTL.tsx +1 -1
  14. package/dist/mdx/{preview-react → react}/segmented-control/examples/Sizes.tsx +1 -1
  15. package/dist/mdx/{preview-react → react}/segmented-control/examples/TextAndIcon.tsx +1 -1
  16. package/dist/mdx/{preview-react → react}/segmented-control/examples/TextOnly.tsx +1 -1
  17. package/dist/mdx/{preview-react → react}/segmented-control/examples/Vertical.tsx +1 -1
  18. package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +1 -1
  19. package/package.json +6 -6
  20. package/dist/mdx/preview-react/segmented-control/SegmentedControl.mdx +0 -139
  21. package/dist/mdx/preview-react/segmented-control/examples/Basic.tsx +0 -42
  22. package/dist/mdx/react/_examples/mdx/examples/SegmentControlWithText.tsx +0 -119
@@ -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": "14.1.19",
22
- "@workday/canvas-kit-preview-react": "14.1.19",
23
- "@workday/canvas-kit-react": "14.1.19",
24
- "@workday/canvas-kit-react-fonts": "^14.1.19",
25
- "@workday/canvas-kit-styling": "14.1.19",
21
+ "@workday/canvas-kit-labs-react": "14.1.21",
22
+ "@workday/canvas-kit-preview-react": "14.1.21",
23
+ "@workday/canvas-kit-react": "14.1.21",
24
+ "@workday/canvas-kit-react-fonts": "^14.1.21",
25
+ "@workday/canvas-kit-styling": "14.1.21",
26
26
  "@workday/canvas-system-icons-web": "3.0.36",
27
27
  "@workday/canvas-tokens-web": "3.1.2"
28
28
  },
@@ -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": "14.1.19",
22
- "@workday/canvas-kit-preview-react": "14.1.19",
23
- "@workday/canvas-kit-react": "14.1.19",
24
- "@workday/canvas-kit-react-fonts": "^14.1.19",
25
- "@workday/canvas-kit-styling": "14.1.19",
21
+ "@workday/canvas-kit-labs-react": "14.1.21",
22
+ "@workday/canvas-kit-preview-react": "14.1.21",
23
+ "@workday/canvas-kit-react": "14.1.21",
24
+ "@workday/canvas-kit-react-fonts": "^14.1.21",
25
+ "@workday/canvas-kit-styling": "14.1.21",
26
26
  "@workday/canvas-system-icons-web": "3.0.36",
27
27
  "@workday/canvas-tokens-web": "3.1.2"
28
28
  },
@@ -15,8 +15,179 @@ space tokens, the new tokens aim to add more semantic meaning to allow for bette
15
15
 
16
16
  ## Table of Contents
17
17
 
18
+ - [Codemod](#codemod)
19
+ - [Instructions](#instructions)
20
+ - [Component Promotions](#component-promotions)
21
+ - [Segmented Control](#segmented-control-)
18
22
  - [Component Updates](#component-updates)
19
23
  - [Buttons](#buttons)
24
+ - [Removals](#removals)
25
+ - [Segmented Control (Deprecated)](#segmented-control-deprecated)
26
+ - [Glossary](#glossary)
27
+ - [Main](#main)
28
+ - [Preview](#preview)
29
+
30
+ ## Codemod
31
+
32
+ We've provided a [codemod](https://github.com/Workday/canvas-kit/tree/master/modules/codemod) to
33
+ automatically update your code to work with most of the breaking changes in v15. **Breaking changes
34
+ handled by the codemod are marked with 🤖 in the Upgrade Guide.**
35
+
36
+ A codemod is a script that makes programmatic transformations on your codebase by traversing the
37
+ AST, identifying patterns, and making prescribed changes. This greatly decreases opportunities for
38
+ error and reduces the number of manual updates, which allows you to focus on changes that need your
39
+ attention. **We highly recommend you use the codemod for these reasons.**
40
+
41
+ If you're new to running codemods or if it's been a minute since you've used one, there are a few
42
+ things you'll want to keep in mind.
43
+
44
+ - Our codemods are meant to be run sequentially. For example, if you're using v13 of Canvas Kit,
45
+ you'll need to run the v14 codemod before you run v15.
46
+ - The codemod will update your code to be compatible with the specified version, but it will **not**
47
+ remove outdated dependencies or upgrade dependencies to the latest version. You'll need to upgrade
48
+ dependencies on your own.
49
+ - We recommend upgrading dependencies before running the codemod.
50
+ - Always review your `package.json` files to make sure your dependency versions look correct.
51
+ - The codemod will not handle every breaking change in v15. You will likely need to make some manual
52
+ changes to be compatible. Use our Upgrade Guide as a checklist.
53
+ - Codemods are not bulletproof.
54
+ - Conduct a thorough PR and QA review of all changes to ensure no regressions were introduced.
55
+ - As a safety precaution, we recommend committing the changes from the codemod as a single
56
+ isolated commit (separate from other changes) so you can roll back more easily if necessary.
57
+
58
+ We're here to help! Automatic changes to your codebase can feel scary. You can always reach out to
59
+ our team. We'd be very happy to walk you through the process to set you up for success.
60
+
61
+ ### Instructions
62
+
63
+ The easiest way to run our codemod is to use `npx` in your terminal.
64
+
65
+ ```sh
66
+ npx @workday/canvas-kit-codemod v15 [path]
67
+ ```
68
+
69
+ Be sure to provide specific directories that need to be updated via the `[path]` argument. This
70
+ decreases the amount of AST the codemod needs to traverse and reduces the chances of the script
71
+ having an error. For example, if your source code lives in `src/`, use `src/` as your `[path]`. Or,
72
+ if you have a monorepo with three packages using Canvas Kit, provide those specific packages as your
73
+ `[path]`.
74
+
75
+ Alternatively, if you're unable to run the codemod successfully using `npx`, you can install the
76
+ codemod package as a dev dependency, run it with `yarn`, and then remove the package after you're
77
+ finished.
78
+
79
+ ```sh
80
+ yarn add @workday/canvas-kit-codemod --dev
81
+ yarn canvas-kit-codemod v15 [path]
82
+ yarn remove @workday/canvas-kit-codemod
83
+ ```
84
+
85
+ > **Note:** The codemod only works on `.js`, `.jsx`, `.ts`, and `.tsx` files. You'll need to
86
+ > manually edit other file types (`.json`, `.mdx`, `.md`, etc.). You may need to run your linter
87
+ > after executing the codemod, as its resulting formatting (spacing, quotes, etc.) may not match
88
+ > your project conventions.
89
+
90
+ ## Component Promotions
91
+
92
+ ### Segmented Control ⚡️
93
+
94
+ We've promoted `SegmentedControl` from [Preview](/components/buttons/segmented-control/) to [Main](#main). This replaces the deprecated `SegmentedControl` that was previously in Main.
95
+
96
+ **Before in v14**
97
+
98
+ ```tsx
99
+ import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
100
+ ```
101
+
102
+ **After in v15**
103
+
104
+ ```tsx
105
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
106
+ ```
107
+
108
+ > 🤖 The codemod will handle the change of imports as shown above.
109
+
110
+ #### API Differences
111
+
112
+ The new `SegmentedControl` is a [compound component](/getting-started/for-developers/resources/compound-components/)
113
+ with a different API than the deprecated version.
114
+
115
+ ##### Structure Changes
116
+
117
+ | Deprecated (Old Main) | New (Promoted from Preview) |
118
+ | --------------------- | ----------------------------------- |
119
+ | `SegmentedControl` | `SegmentedControl` |
120
+ | `SegmentedControl.Button` | `SegmentedControl.List` + `SegmentedControl.Item` |
121
+
122
+ ##### Prop Changes
123
+
124
+ | Feature | Deprecated (Old Main) | New (Promoted from Preview) |
125
+ | ---------------- | ------------------------------------------ | ------------------------------------------------ |
126
+ | Selection | `value` prop on container | `initialValue` prop on container |
127
+ | Change handler | `onChange={(value) => {}}` | `onSelect={(data) => setSelected(data.id)}` |
128
+ | Item identifier | `value` prop on Button | `data-id` prop on Item |
129
+ | Disabled (all) | Not supported | `disabled` prop on container model |
130
+ | Size | Not supported | `size` prop (`small`, `medium`, `large`) |
131
+ | Orientation | Not supported | `orientation` prop (`horizontal`, `vertical`) |
132
+ | Text labels | Not supported | `children` on Item |
133
+ | Tooltips | Not supported | `tooltipProps` on Item |
134
+ | Accessibility | Manual | Built-in `aria-label` on List |
135
+
136
+ ##### Code Migration
137
+
138
+ **Deprecated API (Old Main)**
139
+
140
+ ```tsx
141
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
142
+
143
+ const [value, setValue] = React.useState<string | number>('list-view');
144
+
145
+ <SegmentedControl value={value} onChange={setValue}>
146
+ <SegmentedControl.Button icon={listViewIcon} value="list-view" />
147
+ <SegmentedControl.Button icon={worksheetsIcon} value="table-view" />
148
+ <SegmentedControl.Button icon={deviceTabletIcon} value="device-view" />
149
+ </SegmentedControl>
150
+ ```
151
+
152
+ **New API (v15)**
153
+
154
+ ```tsx
155
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
156
+
157
+ const [value, setValue] = React.useState('list-view');
158
+
159
+ <SegmentedControl initialValue={value} onSelect={data => setValue(data.id)}>
160
+ <SegmentedControl.List aria-label="View type">
161
+ <SegmentedControl.Item data-id="list-view" icon={listViewIcon} tooltipProps={{title: 'List'}} />
162
+ <SegmentedControl.Item data-id="table-view" icon={worksheetsIcon} tooltipProps={{title: 'Table'}} />
163
+ <SegmentedControl.Item data-id="device-view" icon={deviceTabletIcon} tooltipProps={{title: 'Device'}} />
164
+ </SegmentedControl.List>
165
+ </SegmentedControl>
166
+ ```
167
+
168
+ ##### New Features
169
+
170
+ The promoted `SegmentedControl` includes several new features:
171
+
172
+ - **Text and icon support**: Items can display text, icons, or both
173
+ - **Size variants**: `small`, `medium`, and `large` sizes
174
+ - **Vertical orientation**: Use `orientation="vertical"` for vertical layouts
175
+ - **Built-in tooltips**: Add tooltips via `tooltipProps` on items
176
+ - **Disabled state**: Disable all items via the model or individual items
177
+ - **Dynamic items**: Render items dynamically using the collection API
178
+
179
+ ```tsx
180
+ // Text only
181
+ <SegmentedControl.Item data-id="yearly">Yearly</SegmentedControl.Item>
182
+
183
+ // Icon with text
184
+ <SegmentedControl.Item data-id="list" icon={listViewIcon}>List View</SegmentedControl.Item>
185
+
186
+ // With size and orientation
187
+ <SegmentedControl size="large" orientation="vertical">
188
+ ...
189
+ </SegmentedControl>
190
+ ```
20
191
 
21
192
  ## Component Updates
22
193
 
@@ -28,4 +199,29 @@ The Following components have been updated to use our new `size`, `padding`, `ga
28
199
  tokens. These changes are **only visual**.
29
200
 
30
201
  `PrimaryButton`, `SecondaryButton`, `DeleteButton`, `TertiaryButton`, `ToolbarButton`,
31
- `ToolbarDropdownButton`, `Hyperlink`, `ExternalHyperlink`, and `ActionBar`.
202
+ `ToolbarDropdownButton`, `Hyperlink`, `ExternalHyperlink`, and `ActionBar`.
203
+
204
+ ## Removals
205
+
206
+ ### Segmented Control (Deprecated)
207
+
208
+ The deprecated `SegmentedControl` that was previously in `@workday/canvas-kit-react/segmented-control`
209
+ has been removed. This was the older implementation that used `SegmentedControl.Button` subcomponents.
210
+
211
+ Please migrate to the new `SegmentedControl` component (promoted from Preview) which uses a compound
212
+ component pattern with `SegmentedControl.List` and `SegmentedControl.Item`. See the
213
+ [API Differences](#api-differences) section above for migration guidance.
214
+
215
+ ## Glossary
216
+
217
+ For an overview of the different packages we provide, please view our docs
218
+ [here](https://workday.github.io/canvas-kit/?path=/docs/guides-packages--docs).
219
+
220
+ ### Main
221
+
222
+ Components in the Main package are stable and ready for production use.
223
+
224
+ ### Preview
225
+
226
+ Components in the Preview package are mostly stable but may still receive breaking changes before
227
+ being promoted to Main.
@@ -4,7 +4,7 @@ import {TextInput} from '@workday/canvas-kit-react/text-input';
4
4
  import {Select} from '@workday/canvas-kit-react/select';
5
5
  import {Switch} from '@workday/canvas-kit-react/switch';
6
6
  import {Heading, Text} from '@workday/canvas-kit-react/text';
7
- import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
7
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
8
8
  import {calc, createStencil, createStyles, px2rem} from '@workday/canvas-kit-styling';
9
9
  import {system} from '@workday/canvas-tokens-web';
10
10
 
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
 
3
3
  import {Grid, Box} from '@workday/canvas-kit-react/layout';
4
4
  import {BodyText, Heading} from '@workday/canvas-kit-react/text';
5
- import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
5
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
6
6
 
7
7
  export default () => {
8
8
  const [screen, setScreen] = React.useState('100%');
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import {breakpoints} from '@workday/canvas-kit-react/common';
3
3
  import {ActionBar, useActionBarModel} from '@workday/canvas-kit-react/action-bar';
4
4
  import {PrimaryButton} from '@workday/canvas-kit-react/button';
5
- import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
5
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
6
6
  import {Box} from '@workday/canvas-kit-react/layout';
7
7
 
8
8
  type MyActionItem = {
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import {Breadcrumbs, useBreadcrumbsModel} from '@workday/canvas-kit-react/breadcrumbs';
3
3
  import {Box} from '@workday/canvas-kit-react/layout';
4
- import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
4
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
5
5
 
6
6
  export interface Breadcrumb {
7
7
  id: string;
@@ -1,29 +1,21 @@
1
- import {
2
- ExampleCodeBlock,
3
- StorybookStatusIndicator,
4
- SymbolDoc,
5
- Specifications,
6
- } from '@workday/canvas-kit-docs';
7
-
8
- import {InformationHighlight} from '@workday/canvas-kit-preview-react/information-highlight';
9
-
1
+ import {ExampleCodeBlock, SymbolDoc, Specifications} from '@workday/canvas-kit-docs';
10
2
  import Basic from './examples/Basic';
3
+ import Disabled from './examples/Disabled';
4
+ import TextAndIcon from './examples/TextAndIcon';
5
+ import TextOnly from './examples/TextOnly';
6
+ import Sizes from './examples/Sizes';
7
+ import Vertical from './examples/Vertical';
8
+ import RTL from './examples/RTL';
9
+ import Dynamic from './examples/Dynamic';
10
+
11
11
 
12
- # Canvas Kit Segmented Control <StorybookStatusIndicator type="deprecated" />
12
+ # Canvas Kit Segmented Control
13
13
 
14
- <InformationHighlight className="sb-unstyled" variant="caution" cs={{p: {marginBlock: 0}}}>
15
- <InformationHighlight.Icon />
16
- <InformationHighlight.Body>
17
- `SegmentedControl` in Main has been deprecated and will be removed in a future major version.
18
- Please use `Segmented Control` in Preview instead.
19
- </InformationHighlight.Body>
20
- <InformationHighlight.Link href="https://workday.github.io/canvas-kit/?path=/docs/preview-segmented-control--docs">
21
- Segmented Control Docs
22
- </InformationHighlight.Link>
23
- </InformationHighlight>
14
+ Segmented Control is a
15
+ [compound component](/getting-started/for-developers/resources/compound-components/) that represents
16
+ a linear group of multiple buttons allowing the selection of a specific value.
24
17
 
25
- A linear set of two or more segments, each of which functions as a mutually exclusive button. This
26
- is a [_controlled_](https://reactjs.org/docs/forms.html#controlled-components) component.
18
+ [> Workday Design Reference](https://design.workday.com/components/buttons/segmented-control)
27
19
 
28
20
  ## Installation
29
21
 
@@ -35,12 +27,113 @@ yarn add @workday/canvas-kit-react
35
27
 
36
28
  ### Basic Example
37
29
 
38
- Here is a basic example of a Segmented Control with multiple nested `Button`s. **Note:** while
39
- managing state using a unique `value` for each `Button` child is encouraged, you can also use
40
- indexes and omit the `value` field. It is strongly recommended to not mix these two methods.
30
+ `SegmentedControl` includes a container `SegmentedControl` component and the following
31
+ subcomponents: `SegmentedControl.List` and `SegmentedControl.Item`.
32
+
33
+ The example below contains a `SegmentedControl` with four icon-only buttons. Each button is rendered
34
+ using a `SegmentedControl.Item` and is paired with a tooltip describing the button's function. Only
35
+ one button can be active at a time.
41
36
 
42
37
  <ExampleCodeBlock code={Basic} />
43
38
 
39
+ We **strongly** discourage including more than four buttons in a single `SegmentedControl`.
40
+
41
+ ### Accessibility
42
+
43
+ Our `SegmentedControl` component renders semantic HTML `<button>` elements to the browser DOM,
44
+ wrapped inside of a `<div>` with an explicit ARIA `role="group"`. This is equivalent to an HTML
45
+ `<fieldset>` element, and useful for screen readers to describe the relationship between the
46
+ buttons.
47
+
48
+ - Each button is a 2-state toggle button with `aria-pressed={true | false}` to indicate the current
49
+ state to screen readers.
50
+ - Providing your own `aria-label` string to `SegmentedControl.List` is recommended for describing the
51
+ purpose of the component.
52
+
53
+ #### Screen Reader Experience
54
+
55
+ When users interact with a `SegmentedControl` using screen readers:
56
+
57
+ - The group context is announced (e.g., "View options, group" when using
58
+ `aria-label="View options"`)
59
+ - Each button announces its text/label, "toggle button" role, and pressed/unpressed state (e.g.,
60
+ "List view, toggle button, pressed" or "Grid view, toggle button, not pressed")
61
+ - For icon-only buttons with tooltips, the tooltip text is announced along with the button role and
62
+ state
63
+ - When a button is activated, screen readers should announce the new state
64
+
65
+ Refer to [Button](?path=/docs/components-buttons--docs#accessibility) for more information about
66
+ accessibility of these components.
67
+
68
+ ### Variations
69
+
70
+ `SegmentedControl` supports three variations based on whether or not its `SegmentedControl.Item`
71
+ components have an `icon` prop and/or text content: icon-only, text-only, and text-and-icon.
72
+
73
+ All `SegmentedControl.Item` components within a given `SegmentedControl` must be of the same
74
+ variation.
75
+
76
+ #### Icon-Only
77
+
78
+ To render an icon-only `SegmentedControl`, apply the `icon` prop to `SegmentedControl.Item` and do
79
+ not provide it with text content. Refer to the [basic example](#basic-example) above for an instance
80
+ of an icon-only `SegmentedControl`.
81
+
82
+ The icon-only variation is the only variation which supports a vertical orientation in addition to
83
+ the default horizontal orientation. Set the `orientation` prop of `SegmentedControl` to `vertical`
84
+ to configure the component to render vertically.
85
+
86
+ <ExampleCodeBlock code={Vertical} />
87
+
88
+ #### Text-Only
89
+
90
+ To render a text-only `SegmentedControl`, omit the `icon` prop from `SegmentedControl.Item` and
91
+ provide it with text content.
92
+
93
+ <ExampleCodeBlock code={TextOnly} />
94
+
95
+ #### Text-and-Icon
96
+
97
+ To render a text-and-icon `SegmentedControl`, apply the `icon` prop to `SegmentedControl.Item` and
98
+ provide it with text content.
99
+
100
+ <ExampleCodeBlock code={TextAndIcon} />
101
+
102
+ ### Sizes
103
+
104
+ `SegmentedControl` accepts a `size` prop which supports the following values:
105
+
106
+ - `small`
107
+ - `medium` (Default)
108
+ - `large`
109
+
110
+ <ExampleCodeBlock code={Sizes} />
111
+
112
+ ### Disabled
113
+
114
+ Set the `disabled` prop of `SegmentedControl` to disable the entire component including its buttons.
115
+
116
+ <ExampleCodeBlock code={Disabled} />
117
+
118
+ ### Right-to-Left (RTL)
119
+
120
+ `SegmentedControl` supports right-to-left languages when specified in the `CanvasProvider` `theme`.
121
+
122
+ <ExampleCodeBlock code={RTL} />
123
+
124
+ ### Dynamic Items
125
+
126
+ `SegmentedControl` supports a
127
+ [dynamic API](/getting-started/for-developers/resources/collection-api/#dynamic-items) where instead
128
+ of statically providing the JSX for each `SegmentedControl.Item`, you pass an array of `items` in
129
+ the `model` state and provide a render function to display the items.
130
+
131
+ <ExampleCodeBlock code={Dynamic} />
132
+
44
133
  ## Component API
45
134
 
46
- <SymbolDoc name="SegmentedControl" fileName="/react/" />
135
+ <SymbolDoc name="SegmentedControl" fileName="/react/" />
136
+
137
+ ## Specifications
138
+
139
+ <Specifications file="SegmentedControl.spec.ts" name="SegmentedControl" />
@@ -1,38 +1,42 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
 
3
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
4
+ import {BodyText} from '@workday/canvas-kit-react/text';
3
5
  import {
6
+ gridIcon,
4
7
  listViewIcon,
5
- worksheetsIcon,
6
- deviceTabletIcon,
7
- percentageIcon,
8
+ listDetailIcon,
9
+ pieChartIcon,
8
10
  } from '@workday/canvas-system-icons-web';
9
- import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
10
11
 
11
12
  export default () => {
12
- const [value, setValue] = React.useState<string | number>();
13
- const handleToggle = (selectedValue: string | number) => {
14
- setValue(selectedValue);
15
- };
13
+ const [viewType, setViewType] = React.useState('table');
16
14
 
17
15
  return (
18
- <SegmentedControl value={value} onChange={handleToggle}>
19
- <SegmentedControl.Button
20
- icon={listViewIcon}
21
- value="list-view"
22
- onClick={e => console.log('Existing TertiaryButton onClick callback')}
23
- id="test"
24
- />
25
- <SegmentedControl.Button icon={worksheetsIcon} value="table-view" disabled={true} />
26
- <SegmentedControl.Button
27
- icon={deviceTabletIcon}
28
- value="device-view"
29
- aria-label="Device View"
30
- />
31
- <SegmentedControl.Button
32
- icon={percentageIcon}
33
- value="percent-view"
34
- aria-label="Percent View"
35
- />
36
- </SegmentedControl>
16
+ <>
17
+ <SegmentedControl initialValue={viewType} onSelect={data => setViewType(data.id)}>
18
+ <SegmentedControl.List aria-label="View type">
19
+ <SegmentedControl.Item data-id="table" icon={gridIcon} tooltipProps={{title: 'Table'}} />
20
+ <SegmentedControl.Item
21
+ data-id="list-view"
22
+ icon={listViewIcon}
23
+ tooltipProps={{title: 'List'}}
24
+ />
25
+ <SegmentedControl.Item
26
+ data-id="list-detail"
27
+ icon={listDetailIcon}
28
+ tooltipProps={{title: 'Detail'}}
29
+ />
30
+ <SegmentedControl.Item
31
+ data-id="diagrams"
32
+ icon={pieChartIcon}
33
+ tooltipProps={{title: 'Diagram'}}
34
+ />
35
+ </SegmentedControl.List>
36
+ </SegmentedControl>
37
+ <BodyText size="small" marginTop="s">
38
+ Selected: {viewType}
39
+ </BodyText>
40
+ </>
37
41
  );
38
42
  };
@@ -1,4 +1,4 @@
1
- import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
1
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
2
2
  import {
3
3
  gridIcon,
4
4
  listViewIcon,
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import {
3
3
  SegmentedControl,
4
4
  useSegmentedControlModel,
5
- } from '@workday/canvas-kit-preview-react/segmented-control';
5
+ } from '@workday/canvas-kit-react/segmented-control';
6
6
  import {
7
7
  gridIcon,
8
8
  listViewIcon,
@@ -5,7 +5,7 @@ import {
5
5
  listDetailIcon,
6
6
  pieChartIcon,
7
7
  } from '@workday/canvas-system-icons-web';
8
- import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
8
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
9
9
 
10
10
  export default () => (
11
11
  <CanvasProvider dir="rtl">
@@ -6,7 +6,7 @@ import {
6
6
  listDetailIcon,
7
7
  pieChartIcon,
8
8
  } from '@workday/canvas-system-icons-web';
9
- import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
9
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
10
10
  import {BodyText} from '@workday/canvas-kit-react/text';
11
11
 
12
12
  export default () => (
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import {gridIcon, listViewIcon, pieChartIcon} from '@workday/canvas-system-icons-web';
3
- import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
3
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
4
4
 
5
5
  export default () => (
6
6
  <SegmentedControl>
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
2
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
3
3
 
4
4
  export default () => (
5
5
  <SegmentedControl>
@@ -1,4 +1,4 @@
1
- import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
1
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
2
2
  import {
3
3
  gridIcon,
4
4
  listViewIcon,
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  import {Tabs, useTabsModel} from '@workday/canvas-kit-react/tabs';
4
- import {SegmentedControl} from '@workday/canvas-kit-preview-react/segmented-control';
4
+ import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
5
5
  import {Box} from '@workday/canvas-kit-react/layout';
6
6
 
7
7
  type MyTabItem = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "15.0.0-alpha.0010-next.0",
3
+ "version": "15.0.0-alpha.0023-next.0",
4
4
  "description": "Documentation components of Canvas Kit components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -45,10 +45,10 @@
45
45
  "@emotion/styled": "^11.6.0",
46
46
  "@stackblitz/sdk": "^1.11.0",
47
47
  "@storybook/csf": "0.0.1",
48
- "@workday/canvas-kit-labs-react": "^15.0.0-alpha.0010-next.0",
49
- "@workday/canvas-kit-preview-react": "^15.0.0-alpha.0010-next.0",
50
- "@workday/canvas-kit-react": "^15.0.0-alpha.0010-next.0",
51
- "@workday/canvas-kit-styling": "^15.0.0-alpha.0010-next.0",
48
+ "@workday/canvas-kit-labs-react": "^15.0.0-alpha.0023-next.0",
49
+ "@workday/canvas-kit-preview-react": "^15.0.0-alpha.0023-next.0",
50
+ "@workday/canvas-kit-react": "^15.0.0-alpha.0023-next.0",
51
+ "@workday/canvas-kit-styling": "^15.0.0-alpha.0023-next.0",
52
52
  "@workday/canvas-system-icons-web": "^3.0.36",
53
53
  "@workday/canvas-tokens-web": "4.0.0-alpha.3",
54
54
  "markdown-to-jsx": "^7.2.0",
@@ -61,5 +61,5 @@
61
61
  "mkdirp": "^1.0.3",
62
62
  "typescript": "5.0"
63
63
  },
64
- "gitHead": "596c44d0fd4c67d54185ce1a91b1ab3517981dd2"
64
+ "gitHead": "13b3abf5b4752be5738a78f3c37e31b6252077dc"
65
65
  }