@workday/canvas-kit-docs 6.9.0-next.0 → 6.9.0-next.2
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/commonjs/index.js +13 -6
- package/dist/commonjs/lib/Specifications.d.ts.map +1 -1
- package/dist/commonjs/lib/Specifications.js +3 -1
- package/dist/commonjs/lib/docs.js +1 -0
- package/dist/commonjs/lib/specs.js +259 -6
- package/dist/es6/lib/Specifications.d.ts.map +1 -1
- package/dist/es6/lib/specs.js +259 -6
- package/dist/mdx/{4.0-MIGRATION-GUIDE.mdx → 4.0-UPGRADE-GUIDE.mdx} +1 -1
- package/dist/mdx/{5.0-MIGRATION-GUIDE.mdx → 5.0-UPGRADE-GUIDE.mdx} +3 -3
- package/dist/mdx/{6.0-MIGRATION-GUIDE.mdx → 6.0-UPGRADE-GUIDE.mdx} +4 -4
- package/dist/mdx/7.0-UPGRADE-GUIDE.mdx +1006 -0
- package/dist/mdx/COMPOUND_COMPONENTS.mdx +2 -2
- package/dist/mdx/CONTRIBUTING.mdx +2 -2
- package/dist/mdx/TESTING.mdx +1 -1
- package/dist/mdx/changelog.stories.mdx +1 -0
- package/dist/mdx/labs-react/search-form/examples/Basic.tsx +4 -2
- package/dist/mdx/labs-react/search-form/examples/CustomTheme.tsx +4 -2
- package/dist/mdx/labs-react/search-form/examples/Grow.tsx +4 -2
- package/dist/mdx/labs-react/search-form/examples/RTL.tsx +4 -2
- package/dist/mdx/labs-react/search-form/examples/Theming.tsx +4 -2
- package/dist/mdx/preview-react/_examples/SidePanelWithOverlay.mdx +8 -0
- package/dist/mdx/preview-react/_examples/examples/SidePanelWithOverlay.tsx +31 -0
- package/dist/mdx/preview-react/_examples/examples/TextInputWithFormik.tsx +3 -3
- package/dist/mdx/preview-react/form-field/examples/Custom.tsx +4 -5
- package/dist/mdx/preview-react/menu/Menu.mdx +1 -1
- package/dist/mdx/preview-react/menu/examples/ContextMenu.tsx +2 -2
- package/dist/mdx/preview-react/menu/examples/Icons.tsx +0 -1
- package/dist/mdx/preview-react/pill/Pill.mdx +241 -0
- package/dist/mdx/preview-react/pill/examples/Basic.tsx +18 -0
- package/dist/mdx/preview-react/pill/examples/WithAvatar.tsx +21 -0
- package/dist/mdx/preview-react/pill/examples/WithCount.tsx +9 -0
- package/dist/mdx/preview-react/pill/examples/WithList.tsx +31 -0
- package/dist/mdx/preview-react/pill/examples/WithReadOnly.tsx +15 -0
- package/dist/mdx/preview-react/pill/examples/WithRemovable.tsx +25 -0
- package/dist/mdx/preview-react/pill/examples/test-avatar.png +0 -0
- package/dist/mdx/preview-react/side-panel/SidePanel.mdx +5 -3
- package/dist/mdx/preview-react/side-panel/examples/AlwaysOpen.tsx +16 -22
- package/dist/mdx/preview-react/side-panel/examples/Basic.tsx +9 -14
- package/dist/mdx/preview-react/side-panel/examples/ExternalControl.tsx +9 -13
- package/dist/mdx/preview-react/side-panel/examples/HiddenName.tsx +1 -1
- package/dist/mdx/preview-react/side-panel/examples/OnExpandedChange.tsx +1 -1
- package/dist/mdx/preview-react/side-panel/examples/OnStateTransition.tsx +1 -1
- package/dist/mdx/preview-react/side-panel/examples/RightOrigin.tsx +17 -24
- package/dist/mdx/preview-react/side-panel/examples/Variant.tsx +9 -14
- package/dist/mdx/preview-react/text-area/examples/Alert.tsx +2 -1
- package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +6 -4
- package/dist/mdx/preview-react/text-area/examples/RefForwarding.tsx +1 -1
- package/dist/mdx/preview-react/text-input/examples/Alert.tsx +2 -1
- package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +6 -4
- package/dist/mdx/preview-react/text-input/examples/RefForwarding.tsx +1 -1
- package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +2 -1
- package/dist/mdx/react/_examples/SegmentedControlWithText.mdx +12 -0
- package/dist/mdx/react/_examples/examples/GlobalHeader.tsx +7 -6
- package/dist/mdx/react/_examples/examples/PageHeader.tsx +5 -5
- package/dist/mdx/react/_examples/examples/SegmentControlWithText.tsx +119 -0
- package/dist/mdx/react/action-bar/ActionBar.mdx +126 -23
- package/dist/mdx/react/action-bar/examples/Basic.tsx +7 -4
- package/dist/mdx/react/action-bar/examples/DeleteAction.tsx +15 -0
- package/dist/mdx/react/action-bar/examples/Icons.tsx +18 -0
- package/dist/mdx/react/action-bar/examples/OverflowActionBar.tsx +59 -0
- package/dist/mdx/react/banner/Banner.mdx +203 -19
- package/dist/mdx/react/banner/PropTables.splitprops.tsx +39 -0
- package/dist/mdx/react/banner/examples/ActionText.tsx +8 -1
- package/dist/mdx/react/banner/examples/Basic.tsx +8 -1
- package/dist/mdx/react/banner/examples/Error.tsx +8 -1
- package/dist/mdx/react/banner/examples/RefForwarding.tsx +25 -0
- package/dist/mdx/react/banner/examples/Sticky.tsx +12 -7
- package/dist/mdx/react/banner/examples/StickyAnimation.tsx +64 -0
- package/dist/mdx/react/banner/examples/StickyRTL.tsx +35 -0
- package/dist/mdx/react/banner/examples/ThemedAlert.tsx +28 -0
- package/dist/mdx/react/banner/examples/ThemedError.tsx +29 -0
- package/dist/mdx/react/button/button/Button.mdx +3 -3
- package/dist/mdx/react/button/button/Hyperlink.mdx +72 -0
- package/dist/mdx/react/button/button/examples/ExternalHyperlink.tsx +7 -0
- package/dist/mdx/react/button/button/examples/ExternalHyperlinkInverse.tsx +12 -0
- package/dist/mdx/react/button/button/examples/Hyperlink.tsx +5 -0
- package/dist/mdx/react/button/button/examples/HyperlinkInverse.tsx +12 -0
- package/dist/mdx/react/button/button/examples/Primary.tsx +11 -3
- package/dist/mdx/react/button/button/examples/PrimaryInverse.tsx +11 -3
- package/dist/mdx/react/button/button/examples/Secondary.tsx +11 -3
- package/dist/mdx/react/button/button/examples/SecondaryInverse.tsx +11 -3
- package/dist/mdx/react/button/button/examples/Tertiary.tsx +9 -4
- package/dist/mdx/react/button/button/examples/TertiaryInverse.tsx +12 -3
- package/dist/mdx/react/card/card.mdx +2 -2
- package/dist/mdx/react/card/examples/Depth.tsx +1 -1
- package/dist/mdx/react/checkbox/Checkbox.mdx +7 -0
- package/dist/mdx/react/checkbox/examples/Indeterminate.tsx +1 -1
- package/dist/mdx/react/checkbox/examples/Inverse.tsx +22 -0
- package/dist/mdx/react/checkbox/examples/RefForwarding.tsx +1 -1
- package/dist/mdx/react/collection/Collection.mdx +358 -0
- package/dist/mdx/react/collection/Collection.splitprops.tsx +19 -0
- package/dist/mdx/react/collection/examples/Basic.tsx +12 -0
- package/dist/mdx/react/collection/examples/BasicGrid.tsx +46 -0
- package/dist/mdx/react/collection/examples/BasicVirtual.tsx +24 -0
- package/dist/mdx/react/collection/examples/DynamicItems.tsx +20 -0
- package/dist/mdx/react/collection/examples/IdentifiedItems.tsx +12 -0
- package/dist/mdx/react/collection/examples/MultiSelection.tsx +56 -0
- package/dist/mdx/react/collection/examples/RovingFocus.tsx +39 -0
- package/dist/mdx/react/collection/examples/Selection.tsx +58 -0
- package/dist/mdx/react/collection/examples/WrappingGrid.tsx +48 -0
- package/dist/mdx/react/color-picker/color-input/ColorInput.mdx +2 -2
- package/dist/mdx/react/color-picker/color-preview/ColorPreview.mdx +2 -2
- package/dist/mdx/{labs-react/common → react/layout}/Box.mdx +3 -6
- package/dist/mdx/{labs-react → react}/layout/Flex.mdx +24 -27
- package/dist/mdx/{labs-react → react}/layout/Stack.mdx +98 -146
- package/dist/mdx/{labs-react/common → react/layout}/examples/As.tsx +1 -1
- package/dist/mdx/{labs-react/common → react/layout}/examples/Border.tsx +1 -1
- package/dist/mdx/{labs-react/common → react/layout}/examples/Color.tsx +1 -1
- package/dist/mdx/{labs-react/common → react/layout}/examples/Depth.tsx +9 -3
- package/dist/mdx/{labs-react → react}/layout/examples/Flex/FlexCard.tsx +2 -3
- package/dist/mdx/{labs-react → react}/layout/examples/Flex/FlexLayout.tsx +1 -1
- package/dist/mdx/{labs-react → react}/layout/examples/Flex/Usage.tsx +2 -3
- package/dist/mdx/{labs-react/common → react/layout}/examples/FlexItem.tsx +1 -2
- package/dist/mdx/{labs-react/common → react/layout}/examples/Layout.tsx +1 -1
- package/dist/mdx/{labs-react/common → react/layout}/examples/Position.tsx +1 -1
- package/dist/mdx/{labs-react → react}/layout/examples/PropTables.splitprops.tsx +1 -1
- package/dist/mdx/{labs-react/common → react/layout}/examples/Ref.tsx +1 -1
- package/dist/mdx/{labs-react/common → react/layout}/examples/Space.tsx +1 -1
- package/dist/mdx/{labs-react → react}/layout/examples/Stack/BasicStack.tsx +1 -1
- package/dist/mdx/{labs-react → react}/layout/examples/Stack/HStackCards.tsx +2 -3
- package/dist/mdx/{labs-react → react}/layout/examples/Stack/NestedStacks.tsx +1 -1
- package/dist/mdx/react/layout/examples/Stack/ShouldWrapChildren.tsx +28 -0
- package/dist/mdx/{labs-react → react}/layout/examples/Stack/StackCard.tsx +2 -2
- package/dist/mdx/{labs-react → react}/layout/examples/Stack/StackItems.tsx +1 -2
- package/dist/mdx/{labs-react → react}/layout/examples/Stack/VStackCards.tsx +2 -2
- package/dist/mdx/react/menu/Menu.mdx +123 -0
- package/dist/mdx/react/menu/examples/Basic.tsx +26 -0
- package/dist/mdx/react/menu/examples/ContextMenu.tsx +25 -0
- package/dist/mdx/react/menu/examples/Icons.tsx +41 -0
- package/dist/mdx/react/modal/Modal.mdx +34 -11
- package/dist/mdx/react/modal/examples/Basic.tsx +4 -2
- package/dist/mdx/react/modal/examples/BodyOverflow.tsx +56 -0
- package/dist/mdx/react/modal/examples/CustomFocus.tsx +4 -2
- package/dist/mdx/react/modal/examples/FullOverflow.tsx +55 -0
- package/dist/mdx/react/modal/examples/ReturnFocus.tsx +5 -3
- package/dist/mdx/react/modal/examples/WithoutCloseIcon.tsx +4 -2
- package/dist/mdx/react/pagination/PropTables.splitprops.tsx +1 -1
- package/dist/mdx/react/pagination/pagination.mdx +14 -14
- package/dist/mdx/react/popup/Popup.mdx +2 -1
- package/dist/mdx/react/popup/examples/Basic.tsx +1 -1
- package/dist/mdx/react/popup/examples/FocusRedirect.tsx +3 -2
- package/dist/mdx/react/popup/examples/FocusTrap.tsx +1 -1
- package/dist/mdx/react/popup/examples/FullScreen.tsx +1 -1
- package/dist/mdx/react/popup/examples/InitialFocus.tsx +4 -2
- package/dist/mdx/react/popup/examples/MultiplePopups.tsx +1 -1
- package/dist/mdx/react/popup/examples/NestedPopups.tsx +18 -18
- package/dist/mdx/react/popup/examples/RTL.tsx +6 -3
- package/dist/mdx/react/radio/Radio.mdx +7 -0
- package/dist/mdx/react/radio/examples/Basic.tsx +11 -2
- package/dist/mdx/react/radio/examples/Inverse.tsx +23 -0
- package/dist/mdx/react/segmented-control/SegmentedControl.mdx +2 -2
- package/dist/mdx/react/segmented-control/examples/Basic.tsx +13 -11
- package/dist/mdx/react/skeleton/examples/Basic.tsx +1 -1
- package/dist/mdx/react/skeleton/examples/Color.tsx +1 -2
- package/dist/mdx/react/skeleton/examples/Simulation.tsx +31 -30
- package/dist/mdx/react/status-indicator/StatusIndicator.mdx +12 -0
- package/dist/mdx/react/status-indicator/examples/MaxWidth.tsx +30 -0
- package/dist/mdx/react/tabs/Tabs.mdx +14 -17
- package/dist/mdx/react/tabs/TabsModel.splitprops.tsx +7 -3
- package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +6 -13
- package/dist/mdx/react/tabs/examples/HoistedModel.tsx +8 -8
- package/dist/mdx/react/tabs/examples/Icons.tsx +4 -4
- package/dist/mdx/react/tabs/examples/NamedTabs.tsx +10 -10
- package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +4 -8
- package/dist/mdx/react/tabs/examples/SinglePanel.tsx +3 -3
- package/dist/mdx/react/text-input/examples/Basic.tsx +3 -0
- package/dist/mdx/react/tooltip/Tooltip.mdx +2 -2
- package/dist/mdx/react/tooltip/examples/Default.tsx +2 -2
- package/dist/mdx/react/tooltip/examples/UseTooltip.tsx +2 -2
- package/package.json +9 -17
- package/dist/mdx/labs-react/common/examples/PropTables.splitprops.tsx +0 -91
- package/dist/mdx/labs-react/layout/examples/Stack/ShouldWrapChildren.tsx +0 -33
- package/dist/mdx/react/button/icon-button/IconButton.mdx +0 -103
- package/dist/mdx/react/button/icon-button/examples/Circle.tsx +0 -6
- package/dist/mdx/react/button/icon-button/examples/CircleFilled.tsx +0 -8
- package/dist/mdx/react/button/icon-button/examples/Inverse.tsx +0 -20
- package/dist/mdx/react/button/icon-button/examples/InverseFilled.tsx +0 -20
- package/dist/mdx/react/button/icon-button/examples/MirroredIcon.tsx +0 -11
- package/dist/mdx/react/button/icon-button/examples/Plain.tsx +0 -8
- package/dist/mdx/react/button/icon-button/examples/Square.tsx +0 -8
- package/dist/mdx/react/button/icon-button/examples/SquareFilled.tsx +0 -8
- package/dist/mdx/react/button/icon-button/examples/Toggleable.tsx +0 -20
- package/ts3.5/dist/commonjs/index.d.ts +0 -4
- package/ts3.5/dist/commonjs/lib/Specifications.d.ts +0 -6
- package/ts3.5/dist/commonjs/lib/docs.d.ts +0 -5
- package/ts3.5/dist/commonjs/lib/specs.d.ts +0 -16
- package/ts3.5/dist/es6/index.d.ts +0 -4
- package/ts3.5/dist/es6/lib/Specifications.d.ts +0 -6
- package/ts3.5/dist/es6/lib/docs.d.ts +0 -5
- package/ts3.5/dist/es6/lib/specs.d.ts +0 -16
|
@@ -163,7 +163,7 @@ Undocumented props are spread to the underlying `<div>` element.
|
|
|
163
163
|
|
|
164
164
|
#### Usage
|
|
165
165
|
|
|
166
|
-
`Pagination.JumpToFirstButton` is an `
|
|
166
|
+
`Pagination.JumpToFirstButton` is an `Button` that subscribes to the `Pagination` context. This
|
|
167
167
|
allows it to know when to disable and set `currentPage` to the first page.
|
|
168
168
|
|
|
169
169
|
```tsx
|
|
@@ -176,14 +176,14 @@ Undocumented props are spread to the underlying `<button>` element. Note that yo
|
|
|
176
176
|
`aria-label` to meet accessibility standards. We recommend setting it to `First` or the translated
|
|
177
177
|
equivalent.
|
|
178
178
|
|
|
179
|
-
`Pagination.JumpToFirstButton` supports all `
|
|
179
|
+
`Pagination.JumpToFirstButton` supports all `TertiaryButton` props.
|
|
180
180
|
|
|
181
181
|
### Pagination.StepToPreviousButton
|
|
182
182
|
|
|
183
183
|
#### Usage
|
|
184
184
|
|
|
185
|
-
`Pagination.StepToPreviousButton` is an `
|
|
186
|
-
This allows it to know when to disable and decrement the `currentPage`.
|
|
185
|
+
`Pagination.StepToPreviousButton` is an `TertiaryButton` that renders an icon that subscribes to the
|
|
186
|
+
`Pagination` context. This allows it to know when to disable and decrement the `currentPage`.
|
|
187
187
|
|
|
188
188
|
```tsx
|
|
189
189
|
<Pagination.StepToPreviousButton aria-label="Previous" />
|
|
@@ -195,14 +195,14 @@ Undocumented props are spread to the underlying `<button>` element. Note that yo
|
|
|
195
195
|
`aria-label` to meet accessibility standards. We recommend setting it to `Previous` or the
|
|
196
196
|
translated equivalent.
|
|
197
197
|
|
|
198
|
-
`Pagination.StepToPreviousButton` supports all `
|
|
198
|
+
`Pagination.StepToPreviousButton` supports all `TertiaryButton` props.
|
|
199
199
|
|
|
200
200
|
### Pagination.StepToNextButton
|
|
201
201
|
|
|
202
202
|
#### Usage
|
|
203
203
|
|
|
204
|
-
`Pagination.StepToNextButton` is an `
|
|
205
|
-
allows it to know when to disable and increment the `currentPage`.
|
|
204
|
+
`Pagination.StepToNextButton` is an `TertiaryButton` that subscribes to the `Pagination` context.
|
|
205
|
+
This allows it to know when to disable and increment the `currentPage`.
|
|
206
206
|
|
|
207
207
|
```tsx
|
|
208
208
|
<Pagination.StepToNextButton aria-label="Next" />
|
|
@@ -214,14 +214,14 @@ Undocumented props are spread to the underlying `<button>` element. Note that yo
|
|
|
214
214
|
`aria-label` to meet accessibility standards. We recommend setting it to `Next` or the translated
|
|
215
215
|
equivalent.
|
|
216
216
|
|
|
217
|
-
`Pagination.StepToNextButton` supports all `
|
|
217
|
+
`Pagination.StepToNextButton` supports all `TertiaryButton` props.
|
|
218
218
|
|
|
219
219
|
### Pagination.JumpToLastButton
|
|
220
220
|
|
|
221
221
|
#### Usage
|
|
222
222
|
|
|
223
|
-
`Pagination.JumpToLastButton` is an `
|
|
224
|
-
allows it to know when to disable and set `currentPage` to the last page.
|
|
223
|
+
`Pagination.JumpToLastButton` is an `TertiaryButton` that renders an icon that subscribes to the
|
|
224
|
+
`Pagination` context. This allows it to know when to disable and set `currentPage` to the last page.
|
|
225
225
|
|
|
226
226
|
```tsx
|
|
227
227
|
<Pagination.JumpToLastButton aria-label="Last" />
|
|
@@ -233,7 +233,7 @@ Undocumented props are spread to the underlying `<button>` element. Note that yo
|
|
|
233
233
|
`aria-label` to meet accessibility standards. We recommend setting it to `Last` or the translated
|
|
234
234
|
equivalent.
|
|
235
235
|
|
|
236
|
-
`Pagination.JumpToLastButton` supports all `
|
|
236
|
+
`Pagination.JumpToLastButton` supports all `TertiaryButton` props.
|
|
237
237
|
|
|
238
238
|
### Pagination.PageList
|
|
239
239
|
|
|
@@ -285,8 +285,8 @@ Undocumented props are spread to the underlying `<li>` element.
|
|
|
285
285
|
|
|
286
286
|
#### Usage
|
|
287
287
|
|
|
288
|
-
`Pagination.PageButton` is
|
|
289
|
-
|
|
288
|
+
`Pagination.PageButton` is a `Button` that subscribes to the `Pagination` context. This allows it to
|
|
289
|
+
update the `currentPage` and set the `toggled` styling when it is the current item.
|
|
290
290
|
|
|
291
291
|
`Pagination.PageButton` will render `pageNumber` as its children.
|
|
292
292
|
|
|
@@ -302,7 +302,7 @@ translated equivalent.
|
|
|
302
302
|
|
|
303
303
|
<ArgsTable of={PageButtonComponent} />
|
|
304
304
|
|
|
305
|
-
`Pagination.PageButton` also supports all `
|
|
305
|
+
`Pagination.PageButton` also supports all `Button` props.
|
|
306
306
|
|
|
307
307
|
### Pagination.GoToForm
|
|
308
308
|
|
|
@@ -214,7 +214,8 @@ container component isn't needed.
|
|
|
214
214
|
A `Popup.Target` is any element that is meant to show the Popup. The default component rendered by
|
|
215
215
|
this component is a `SecondaryButton` element. You can override this by passing the desired
|
|
216
216
|
component via `as`. Many examples above use `as={DeleteButton}`. If you want to render an
|
|
217
|
-
`
|
|
217
|
+
`TertiaryButton` instead, use `as={TertiaryButton}`. The behavior hook used is called
|
|
218
|
+
`usePopupTarget`.
|
|
218
219
|
|
|
219
220
|
```tsx
|
|
220
221
|
const model = usePopupModel();
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useInitialFocus,
|
|
10
10
|
useReturnFocus,
|
|
11
11
|
} from '@workday/canvas-kit-react/popup';
|
|
12
|
-
import {HStack} from '@workday/canvas-kit-
|
|
12
|
+
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
13
13
|
|
|
14
14
|
export default () => {
|
|
15
15
|
const model = usePopupModel();
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useFocusRedirect,
|
|
11
11
|
usePopupModel,
|
|
12
12
|
} from '@workday/canvas-kit-react/popup';
|
|
13
|
-
import {HStack} from '@workday/canvas-kit-
|
|
13
|
+
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
14
14
|
|
|
15
15
|
export default () => {
|
|
16
16
|
const model = usePopupModel();
|
|
@@ -49,7 +49,8 @@ export default () => {
|
|
|
49
49
|
<Popup.CloseButton as={DeleteButton} onClick={handleDelete}>
|
|
50
50
|
Delete
|
|
51
51
|
</Popup.CloseButton>
|
|
52
|
-
|
|
52
|
+
{/* Disabled elements should not be focusable and focus should move to the next focusable element */}
|
|
53
|
+
<Popup.CloseButton disabled>Cancel</Popup.CloseButton>
|
|
53
54
|
</HStack>
|
|
54
55
|
</Popup.Card>
|
|
55
56
|
</Popup.Popper>
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useReturnFocus,
|
|
11
11
|
usePopupModel,
|
|
12
12
|
} from '@workday/canvas-kit-react/popup';
|
|
13
|
-
import {HStack} from '@workday/canvas-kit-
|
|
13
|
+
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
14
14
|
|
|
15
15
|
export default () => {
|
|
16
16
|
const model = usePopupModel();
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
useTransferOnFullscreenExit,
|
|
14
14
|
useTransferOnFullscreenEnter,
|
|
15
15
|
} from '@workday/canvas-kit-react/popup';
|
|
16
|
-
import {HStack, Flex} from '@workday/canvas-kit-
|
|
16
|
+
import {HStack, Flex} from '@workday/canvas-kit-react/layout';
|
|
17
17
|
import {useIsFullscreen} from '@workday/canvas-kit-react/common';
|
|
18
18
|
import screenfull from 'screenfull';
|
|
19
19
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
useInitialFocus,
|
|
9
9
|
useReturnFocus,
|
|
10
10
|
} from '@workday/canvas-kit-react/popup';
|
|
11
|
+
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
11
12
|
|
|
12
13
|
export default () => {
|
|
13
14
|
const initialFocusRef = React.useRef(null);
|
|
@@ -29,11 +30,12 @@ export default () => {
|
|
|
29
30
|
<Popup.Heading>Confirmation</Popup.Heading>
|
|
30
31
|
<Popup.Body>
|
|
31
32
|
<p id="popup-message">Your message has been sent!</p>
|
|
32
|
-
|
|
33
|
+
</Popup.Body>
|
|
34
|
+
<HStack spacing="s">
|
|
33
35
|
<Popup.CloseButton ref={initialFocusRef} aria-describedby="popup-message">
|
|
34
36
|
OK
|
|
35
37
|
</Popup.CloseButton>
|
|
36
|
-
</
|
|
38
|
+
</HStack>
|
|
37
39
|
</Popup.Card>
|
|
38
40
|
</Popup.Popper>
|
|
39
41
|
</Popup>
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
useCloseOnEscape,
|
|
7
7
|
usePopupModel,
|
|
8
8
|
} from '@workday/canvas-kit-react/popup';
|
|
9
|
-
import {HStack} from '@workday/canvas-kit-
|
|
9
|
+
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
10
10
|
|
|
11
11
|
export default () => {
|
|
12
12
|
const popup1 = usePopupModel();
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
useReturnFocus,
|
|
11
11
|
} from '@workday/canvas-kit-react/popup';
|
|
12
12
|
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
13
|
-
import {HStack} from '@workday/canvas-kit-
|
|
13
|
+
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
14
14
|
|
|
15
15
|
export default () => {
|
|
16
16
|
const popup1 = usePopupModel();
|
|
@@ -37,24 +37,24 @@ export default () => {
|
|
|
37
37
|
<Popup.CloseIcon aria-label="Close" size="small" />
|
|
38
38
|
<Popup.Body>
|
|
39
39
|
<p>Contents of Popup 1</p>
|
|
40
|
-
<Popup model={popup2}>
|
|
41
|
-
<Popup.Target>Open Popup 2</Popup.Target>
|
|
42
|
-
<Popup.Popper>
|
|
43
|
-
<Popup.Card aria-label="Popup 2">
|
|
44
|
-
<Popup.CloseIcon aria-label="Close" size="small" />
|
|
45
|
-
<Popup.Body>
|
|
46
|
-
<p>Contents of Popup 2</p>
|
|
47
|
-
<HStack spacing="s">
|
|
48
|
-
<Popup.CloseButton as={Popup.CloseButton} model={popup1}>
|
|
49
|
-
Close Both (as)
|
|
50
|
-
</Popup.CloseButton>
|
|
51
|
-
<SecondaryButton {...closeBothProps}>Close Both (props)</SecondaryButton>
|
|
52
|
-
</HStack>
|
|
53
|
-
</Popup.Body>
|
|
54
|
-
</Popup.Card>
|
|
55
|
-
</Popup.Popper>
|
|
56
|
-
</Popup>
|
|
57
40
|
</Popup.Body>
|
|
41
|
+
<Popup model={popup2}>
|
|
42
|
+
<Popup.Target>Open Popup 2</Popup.Target>
|
|
43
|
+
<Popup.Popper>
|
|
44
|
+
<Popup.Card aria-label="Popup 2">
|
|
45
|
+
<Popup.CloseIcon aria-label="Close" size="small" />
|
|
46
|
+
<Popup.Body>
|
|
47
|
+
<p>Contents of Popup 2</p>
|
|
48
|
+
</Popup.Body>
|
|
49
|
+
<HStack spacing="s">
|
|
50
|
+
<Popup.CloseButton as={Popup.CloseButton} model={popup1}>
|
|
51
|
+
Close Both (as)
|
|
52
|
+
</Popup.CloseButton>
|
|
53
|
+
<SecondaryButton {...closeBothProps}>Close Both (props)</SecondaryButton>
|
|
54
|
+
</HStack>
|
|
55
|
+
</Popup.Card>
|
|
56
|
+
</Popup.Popper>
|
|
57
|
+
</Popup>
|
|
58
58
|
</Popup.Card>
|
|
59
59
|
</Popup.Popper>
|
|
60
60
|
</Popup>
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import {SecondaryButton, DeleteButton} from '@workday/canvas-kit-react/button';
|
|
4
4
|
import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
|
|
5
5
|
import {Popup} from '@workday/canvas-kit-react/popup';
|
|
6
|
+
import {HStack} from '@workday/canvas-kit-react/layout';
|
|
6
7
|
|
|
7
8
|
export default () => {
|
|
8
9
|
return (
|
|
@@ -11,10 +12,12 @@ export default () => {
|
|
|
11
12
|
<Popup.CloseIcon aria-label="סגור" />
|
|
12
13
|
<Popup.Heading>למחוק פריט</Popup.Heading>
|
|
13
14
|
<Popup.Body>
|
|
14
|
-
<p
|
|
15
|
-
<DeleteButton style={{marginLeft: '16px'}}>לִמְחוֹק</DeleteButton>
|
|
16
|
-
<SecondaryButton>לְבַטֵל</SecondaryButton>
|
|
15
|
+
<p>האם ברצונך למחוק פריט זה</p>
|
|
17
16
|
</Popup.Body>
|
|
17
|
+
<HStack spacing="s">
|
|
18
|
+
<DeleteButton>לִמְחוֹק</DeleteButton>
|
|
19
|
+
<SecondaryButton>לְבַטֵל</SecondaryButton>
|
|
20
|
+
</HStack>
|
|
18
21
|
</Popup.Card>
|
|
19
22
|
</CanvasProvider>
|
|
20
23
|
);
|
|
@@ -5,6 +5,7 @@ import {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
|
|
|
5
5
|
import Alert from './examples/Alert';
|
|
6
6
|
import Basic from './examples/Basic';
|
|
7
7
|
import Disabled from './examples/Disabled';
|
|
8
|
+
import Inverse from './examples/Inverse';
|
|
8
9
|
import Error from './examples/Error';
|
|
9
10
|
import LabelPosition from './examples/LabelPosition';
|
|
10
11
|
import NoValue from './examples/NoValue';
|
|
@@ -41,6 +42,12 @@ Set the `disabled` prop of the Radio Button to prevent users from interacting wi
|
|
|
41
42
|
|
|
42
43
|
<ExampleCodeBlock code={Disabled} />
|
|
43
44
|
|
|
45
|
+
### Inverse
|
|
46
|
+
|
|
47
|
+
Radio with inverse variant
|
|
48
|
+
|
|
49
|
+
<ExampleCodeBlock code={Inverse} />
|
|
50
|
+
|
|
44
51
|
### Radio Buttons with No Values
|
|
45
52
|
|
|
46
53
|
The `value` prop may be omitted from Radio Buttons, in which case the `value` prop of the Radio
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
3
3
|
import {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
|
|
4
|
+
import styled from '@emotion/styled';
|
|
4
5
|
|
|
5
6
|
export default () => {
|
|
6
7
|
const [value, setValue] = React.useState<string | number>('deep-dish');
|
|
@@ -9,14 +10,22 @@ export default () => {
|
|
|
9
10
|
setValue(value);
|
|
10
11
|
};
|
|
11
12
|
|
|
13
|
+
const StyledFormField = styled(FormField)({
|
|
14
|
+
width: '161px',
|
|
15
|
+
});
|
|
16
|
+
|
|
12
17
|
return (
|
|
13
|
-
<
|
|
18
|
+
<StyledFormField label="Choose Your Pizza Crust" useFieldset={true}>
|
|
14
19
|
<RadioGroup name="crust" onChange={handleChange} value={value}>
|
|
15
20
|
<Radio label="Deep dish" value="deep-dish" />
|
|
16
21
|
<Radio label="Thin" value="thin" />
|
|
17
22
|
<Radio label="Gluten free" value="gluten-free" />
|
|
18
23
|
<Radio label="Cauliflower" value="cauliflower" />
|
|
24
|
+
<Radio
|
|
25
|
+
label="My favorite pizza crust flavor is butter because it's the best thing to put on bread"
|
|
26
|
+
value="cauliflower"
|
|
27
|
+
/>
|
|
19
28
|
</RadioGroup>
|
|
20
|
-
</
|
|
29
|
+
</StyledFormField>
|
|
21
30
|
);
|
|
22
31
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
3
|
+
import {Radio, RadioGroup} from '@workday/canvas-kit-react/radio';
|
|
4
|
+
import {Box} from '@workday/canvas-kit-react/layout';
|
|
5
|
+
|
|
6
|
+
export default () => {
|
|
7
|
+
const [value, setValue] = React.useState<string | number>('deep-dish');
|
|
8
|
+
|
|
9
|
+
const handleChange = (value: string | number) => {
|
|
10
|
+
setValue(value);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<Box backgroundColor="blueberry400" padding="s">
|
|
15
|
+
<RadioGroup name="crust" onChange={handleChange} value={value}>
|
|
16
|
+
<Radio variant="inverse" label="Deep dish" value="deep-dish" />
|
|
17
|
+
<Radio variant="inverse" label="Thin" value="thin" />
|
|
18
|
+
<Radio variant="inverse" label="Gluten free" value="gluten-free" />
|
|
19
|
+
<Radio variant="inverse" label="Cauliflower" value="cauliflower" />
|
|
20
|
+
</RadioGroup>
|
|
21
|
+
</Box>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
@@ -19,8 +19,8 @@ yarn add @workday/canvas-kit-react
|
|
|
19
19
|
|
|
20
20
|
### Basic Example
|
|
21
21
|
|
|
22
|
-
Here is a basic example of a Segmented Control with multiple nested `
|
|
23
|
-
managing state using a unique `value` for each `
|
|
22
|
+
Here is a basic example of a Segmented Control with multiple nested `Button`s. **Note:** while
|
|
23
|
+
managing state using a unique `value` for each `Button` child is encouraged, you can also use
|
|
24
24
|
indexes and omit the `value` field. It is strongly recommended to not mix these two methods.
|
|
25
25
|
|
|
26
26
|
<ExampleCodeBlock code={Basic} />
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
deviceTabletIcon,
|
|
7
7
|
percentageIcon,
|
|
8
8
|
} from '@workday/canvas-system-icons-web';
|
|
9
|
-
import {IconButton} from '@workday/canvas-kit-react/button';
|
|
10
9
|
import {SegmentedControl} from '@workday/canvas-kit-react/segmented-control';
|
|
11
10
|
|
|
12
11
|
export default () => {
|
|
@@ -17,20 +16,23 @@ export default () => {
|
|
|
17
16
|
|
|
18
17
|
return (
|
|
19
18
|
<SegmentedControl value={value} onChange={handleToggle}>
|
|
20
|
-
<
|
|
19
|
+
<SegmentedControl.Button
|
|
21
20
|
icon={listViewIcon}
|
|
22
21
|
value="list-view"
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
onClick={e => console.log('Existing TertiaryButton onClick callback')}
|
|
23
|
+
id="test"
|
|
25
24
|
/>
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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"
|
|
31
35
|
/>
|
|
32
|
-
<IconButton icon={deviceTabletIcon} value="device-view" aria-label="Device View" />
|
|
33
|
-
<IconButton icon={percentageIcon} value="percent-view" aria-label="Percent View" />
|
|
34
36
|
</SegmentedControl>
|
|
35
37
|
);
|
|
36
38
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {Skeleton} from '@workday/canvas-kit-react/skeleton';
|
|
3
|
-
import {Box, Flex} from '@workday/canvas-kit-
|
|
3
|
+
import {Box, Flex} from '@workday/canvas-kit-react/layout';
|
|
4
4
|
import {borderRadius, space} from '@workday/canvas-kit-react/tokens';
|
|
5
5
|
|
|
6
6
|
export default () => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {Skeleton} from '@workday/canvas-kit-react/skeleton';
|
|
3
|
-
import {Box} from '@workday/canvas-kit-
|
|
4
|
-
import {Flex} from '@workday/canvas-kit-labs-react/layout';
|
|
3
|
+
import {Box, Flex} from '@workday/canvas-kit-react/layout';
|
|
5
4
|
import {borderRadius, colors, space} from '@workday/canvas-kit-react/tokens';
|
|
6
5
|
|
|
7
6
|
export default () => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import {
|
|
2
|
+
import {keyframes} from '@emotion/react';
|
|
4
3
|
|
|
5
4
|
import {
|
|
6
5
|
Card,
|
|
@@ -9,13 +8,15 @@ import {
|
|
|
9
8
|
SecondaryButton,
|
|
10
9
|
SystemIconCircle,
|
|
11
10
|
TextInput,
|
|
11
|
+
styled,
|
|
12
12
|
} from '@workday/canvas-kit-react';
|
|
13
13
|
|
|
14
|
-
import {Box, Flex} from '@workday/canvas-kit-
|
|
14
|
+
import {Box, Flex} from '@workday/canvas-kit-react/layout';
|
|
15
15
|
|
|
16
16
|
import {Skeleton} from '@workday/canvas-kit-react/skeleton';
|
|
17
17
|
import {borderRadius, space, type} from '@workday/canvas-kit-react/tokens';
|
|
18
18
|
import {patternIcon} from '@workday/canvas-system-icons-web';
|
|
19
|
+
import {StyledType} from '@workday/canvas-kit-react/common';
|
|
19
20
|
|
|
20
21
|
const fadeOut = keyframes`
|
|
21
22
|
from {
|
|
@@ -27,6 +28,10 @@ const fadeOut = keyframes`
|
|
|
27
28
|
}
|
|
28
29
|
`;
|
|
29
30
|
|
|
31
|
+
const StyledSimulation = styled(Box)<StyledType>({
|
|
32
|
+
pointerEvents: 'none',
|
|
33
|
+
});
|
|
34
|
+
|
|
30
35
|
export default () => {
|
|
31
36
|
const [loading, setLoading] = React.useState(true);
|
|
32
37
|
const [loadTime, setLoadTime] = React.useState('3000');
|
|
@@ -74,7 +79,29 @@ export default () => {
|
|
|
74
79
|
<Card>
|
|
75
80
|
<Card.Body>
|
|
76
81
|
<Box minHeight={180} position="relative">
|
|
77
|
-
{
|
|
82
|
+
{loading ? (
|
|
83
|
+
<StyledSimulation
|
|
84
|
+
position="absolute"
|
|
85
|
+
top={0}
|
|
86
|
+
left={0}
|
|
87
|
+
width="100%"
|
|
88
|
+
animation={!loading ? `${fadeOut} 150ms ease-out forwards` : undefined}
|
|
89
|
+
>
|
|
90
|
+
<Skeleton>
|
|
91
|
+
<Flex alignItems="center">
|
|
92
|
+
<Skeleton.Shape
|
|
93
|
+
width={space.xl}
|
|
94
|
+
height={space.xl}
|
|
95
|
+
borderRadius={borderRadius.circle}
|
|
96
|
+
/>
|
|
97
|
+
<Box flex={1} marginLeft="xs">
|
|
98
|
+
<Skeleton.Header />
|
|
99
|
+
</Box>
|
|
100
|
+
</Flex>
|
|
101
|
+
<Skeleton.Text lineCount={3} />
|
|
102
|
+
</Skeleton>
|
|
103
|
+
</StyledSimulation>
|
|
104
|
+
) : (
|
|
78
105
|
<Box>
|
|
79
106
|
<Flex alignItems="center" display="inline-flex" marginBottom="s">
|
|
80
107
|
<SystemIconCircle icon={patternIcon} />
|
|
@@ -95,32 +122,6 @@ export default () => {
|
|
|
95
122
|
</p>
|
|
96
123
|
</Box>
|
|
97
124
|
)}
|
|
98
|
-
|
|
99
|
-
<Box
|
|
100
|
-
position="absolute"
|
|
101
|
-
top={0}
|
|
102
|
-
left={0}
|
|
103
|
-
width="100%"
|
|
104
|
-
css={{
|
|
105
|
-
pointerEvents: 'none',
|
|
106
|
-
animation: !loading ? `${fadeOut} 150ms ease-out` : undefined,
|
|
107
|
-
animationFillMode: !loading ? 'forwards' : undefined,
|
|
108
|
-
}}
|
|
109
|
-
>
|
|
110
|
-
<Skeleton>
|
|
111
|
-
<Flex alignItems="center">
|
|
112
|
-
<Skeleton.Shape
|
|
113
|
-
width={space.xl}
|
|
114
|
-
height={space.xl}
|
|
115
|
-
borderRadius={borderRadius.circle}
|
|
116
|
-
/>
|
|
117
|
-
<Box flex={1} marginLeft="xs">
|
|
118
|
-
<Skeleton.Header />
|
|
119
|
-
</Box>
|
|
120
|
-
</Flex>
|
|
121
|
-
<Skeleton.Text lineCount={3} />
|
|
122
|
-
</Skeleton>
|
|
123
|
-
</Box>
|
|
124
125
|
</Box>
|
|
125
126
|
</Card.Body>
|
|
126
127
|
</Card>
|
|
@@ -3,6 +3,7 @@ import {StatusIndicator} from '@workday/canvas-kit-react/status-indicator';
|
|
|
3
3
|
import Basic from './examples/Basic';
|
|
4
4
|
import Icon from './examples/Icon';
|
|
5
5
|
import Emphasis from './examples/Emphasis';
|
|
6
|
+
import MaxWidth from './examples/MaxWidth';
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
# Canvas Kit Status Indicator
|
|
@@ -54,6 +55,17 @@ label.
|
|
|
54
55
|
|
|
55
56
|
<ExampleCodeBlock code={Icon} />
|
|
56
57
|
|
|
58
|
+
### Max Width
|
|
59
|
+
|
|
60
|
+
By default, the maximum width of a Status Indicator is `200px`. When the text in the StatusIndicator
|
|
61
|
+
exceeds the max width, it will be truncated with an ellipsis. This maxWidth can be customized.
|
|
62
|
+
|
|
63
|
+
Avoid truncation wherever possible by using shorter text in Status Indicators. In the case where
|
|
64
|
+
truncation is necessary, you should use an `OverflowTooltip`. For the full text to be accessible
|
|
65
|
+
when you do this, you should make the tooltip focusable with `tabIndex`.
|
|
66
|
+
|
|
67
|
+
<ExampleCodeBlock code={MaxWidth} />
|
|
68
|
+
|
|
57
69
|
## Props
|
|
58
70
|
|
|
59
71
|
Undocumented props are spread to the outermost element rendered by Status Indicator.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from '@emotion/styled';
|
|
3
|
+
import {StatusIndicator} from '@workday/canvas-kit-react/status-indicator';
|
|
4
|
+
import {OverflowTooltip} from '@workday/canvas-kit-react/tooltip';
|
|
5
|
+
import {space} from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
|
|
7
|
+
const StatusIndicators = styled('div')({
|
|
8
|
+
'& > *': {
|
|
9
|
+
margin: space.xxs,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export default () => {
|
|
14
|
+
return (
|
|
15
|
+
<StatusIndicators>
|
|
16
|
+
<StatusIndicator
|
|
17
|
+
label="Longer Than Normal Ellipsized Status"
|
|
18
|
+
type={StatusIndicator.Type.Blue}
|
|
19
|
+
maxWidth={250}
|
|
20
|
+
/>
|
|
21
|
+
<OverflowTooltip>
|
|
22
|
+
<StatusIndicator
|
|
23
|
+
label="Overflow Tooltip On Hover/Focus Status"
|
|
24
|
+
type={StatusIndicator.Type.Green}
|
|
25
|
+
tabIndex={0}
|
|
26
|
+
/>
|
|
27
|
+
</OverflowTooltip>
|
|
28
|
+
</StatusIndicators>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -75,9 +75,9 @@ trigger an event to change the active tab.
|
|
|
75
75
|
|
|
76
76
|
### Named Tabs
|
|
77
77
|
|
|
78
|
-
`Tabs.Item` and `Tabs.Panel` both take an optional `
|
|
79
|
-
`onActivate` callback. This example is identical to the Basic Example, but with
|
|
80
|
-
`Tabs.Item` and `Tabs.Panel` subcomponents.
|
|
78
|
+
`Tabs.Item` and `Tabs.Panel` both take an optional `data-id` attribute that is used for the
|
|
79
|
+
`onActivate` callback. This example is identical to the Basic Example, but with tabs named using
|
|
80
|
+
`data-id` for the `Tabs.Item` and `Tabs.Panel` subcomponents.
|
|
81
81
|
|
|
82
82
|
<ExampleCodeBlock code={NamedTabs} />
|
|
83
83
|
|
|
@@ -95,9 +95,7 @@ Set the `disabled` prop of a `Tabs.Item` to `true` to disable it.
|
|
|
95
95
|
|
|
96
96
|
### Tab Icons
|
|
97
97
|
|
|
98
|
-
Tabs can have icons.
|
|
99
|
-
subcomponent. The `hasIcon` changes the `Tabs.Item` to change where overflow detection is from the
|
|
100
|
-
`Tabs.Item` element to the `Tabs.Item.Text` element.
|
|
98
|
+
Tabs can have icons. Use the `Icon` and `Text` subcomponents.
|
|
101
99
|
|
|
102
100
|
<ExampleCodeBlock code={Icons} />
|
|
103
101
|
|
|
@@ -139,17 +137,15 @@ array.
|
|
|
139
137
|
its subcomponents using React context. It does not represent a real element.
|
|
140
138
|
|
|
141
139
|
```tsx
|
|
142
|
-
<Tabs
|
|
143
|
-
{/* Child components */}
|
|
144
|
-
</Tabs>
|
|
140
|
+
<Tabs onSelect={data => console.log('Activated tab', data.id)}>{/* Child components */}</Tabs>
|
|
145
141
|
```
|
|
146
142
|
|
|
147
143
|
Alternatively, you may pass in a model using the hoisted model pattern.
|
|
148
144
|
|
|
149
145
|
```tsx
|
|
150
146
|
const model = useTabsModel({
|
|
151
|
-
|
|
152
|
-
console.log('Activated Tab', data.
|
|
147
|
+
onSelect(data) {
|
|
148
|
+
console.log('Activated Tab', data.id);
|
|
153
149
|
},
|
|
154
150
|
});
|
|
155
151
|
|
|
@@ -184,11 +180,11 @@ Undocumented props are spread to the underlying `<div>` element.
|
|
|
184
180
|
#### Usage
|
|
185
181
|
|
|
186
182
|
`Tabs.Item` is a `<button role="tab">` element. Each `Tabs.Item` is associated with a `Tabs.Panel`
|
|
187
|
-
either by a `
|
|
188
|
-
the
|
|
183
|
+
either by a `data-id` attribute or by the position in the list. If a `data-id` is provided, it must
|
|
184
|
+
match the `data-id` passed to the corresponding `Tabs.Panel` component.
|
|
189
185
|
|
|
190
186
|
```tsx
|
|
191
|
-
<Tabs.Item
|
|
187
|
+
<Tabs.Item data-id="first">First Tab</Tabs.Item>
|
|
192
188
|
```
|
|
193
189
|
|
|
194
190
|
#### Props
|
|
@@ -202,11 +198,12 @@ Undocumented props are spread to the underlying `button` element.
|
|
|
202
198
|
#### Usage
|
|
203
199
|
|
|
204
200
|
`Tabs.Panel` is a `<div role="tabpanel">` element. It is focusable by default. Each `Tabs.Panel` is
|
|
205
|
-
controlled by a `Tabs.Item` either by a `
|
|
206
|
-
is provided, it must match the
|
|
201
|
+
controlled by a `Tabs.Item` either by a `data-id` attribute or by the position in the list. If a
|
|
202
|
+
`data-id` is provided, it must match the `data-id` passed to the corresponding `Tabs.Item`
|
|
203
|
+
component.
|
|
207
204
|
|
|
208
205
|
```tsx
|
|
209
|
-
<Tabs.Panel
|
|
206
|
+
<Tabs.Panel data-id="first">{/* Contents of the tab panel */}</Tabs.Panel>
|
|
210
207
|
```
|
|
211
208
|
|
|
212
209
|
#### Props
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {useTabsModel} from '@workday/canvas-kit-react/tabs';
|
|
2
|
+
|
|
3
|
+
type TabsModelConfig = Partial<typeof useTabsModel.defaultConfig> &
|
|
4
|
+
typeof useTabsModel.requiredConfig;
|
|
5
|
+
type Model = ReturnType<typeof useTabsModel>;
|
|
2
6
|
|
|
3
7
|
export const TabsModelConfigComponent = (_: TabsModelConfig) => <div />;
|
|
4
|
-
export const TabsStateComponent = (_:
|
|
5
|
-
export const TabsEventsComponent = (_:
|
|
8
|
+
export const TabsStateComponent = (_: Model['state']) => <div />;
|
|
9
|
+
export const TabsEventsComponent = (_: Model['events']) => <div />;
|