@workday/canvas-kit-react 8.0.0-alpha.227-next.10 → 8.0.0-alpha.229-next.11

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.
@@ -12,10 +12,10 @@ import {BreadcrumbsMenu} from './BreadcrumbsMenu';
12
12
  export interface BreadcrumbsProps {
13
13
  /**
14
14
  * The accessibility label for the nav element.
15
+ * It's required to be provided by a11y guidance.
15
16
  *
16
- * @default "breadcrumbs"
17
17
  */
18
- 'aria-label'?: string;
18
+ 'aria-label': string;
19
19
  /**
20
20
  * The contents of the Breadcrumbs. Can be `Breadcrumbs` children or any valid elements.
21
21
  */
@@ -32,7 +32,7 @@ export interface BreadcrumbsProps {
32
32
  *
33
33
  * @example
34
34
  * ```tsx
35
- * <Breadcrumbs aria-label="breadcrumbs">
35
+ * <Breadcrumbs aria-label="Breadcrumbs">
36
36
  * <Breadcrumbs.List>
37
37
  * <Breadcrumbs.Item>
38
38
  * <Breadcrumbs.Link href="/docs">Docs</Breadcrumbs.Link>
@@ -56,7 +56,7 @@ export const Breadcrumbs = createContainer('nav')({
56
56
  * ---
57
57
  * [View Developer Docs](https://canvas.workdaydesign.com/components/navigation/breadcrumbs/#breadcrumbslist)
58
58
  *
59
- * The nav list containing `BreadcrumbItems`
59
+ * The nav list containing `Breadcrumbs.Item` components and overflow button.
60
60
  */
61
61
  List: BreadcrumbsList,
62
62
  /**
@@ -64,7 +64,7 @@ export const Breadcrumbs = createContainer('nav')({
64
64
  * ---
65
65
  * [View Developer Docs](https://canvas.workdaydesign.com/components/navigation/breadcrumbs/#breadcrumbsitem)
66
66
  *
67
- * List items in `Breadcrumb.List`.
67
+ * List items in `Breadcrumbs.List`.
68
68
  * By default, this item is truncated with a tooltip at `350px`,
69
69
  * but that can be customized with the `maxWidth` prop.
70
70
  *
@@ -82,14 +82,15 @@ export const Breadcrumbs = createContainer('nav')({
82
82
  * [View Developer Docs](https://canvas.workdaydesign.com/components/navigation/breadcrumbs/#breadcrumbsoverflowbutton)
83
83
  *
84
84
  * The toggle button for the Breadcrumbs Menu.
85
- * This button is rendered implicitly in the `Breadcrumbs.List` when the list overflows.
86
- * However, if you need to pass props to it, you can do so by passing `overflowButtonProps` to the List.
85
+ * This button is rendered in the `Breadcrumbs.List` when `overflowButtonProps` passed
86
+ * and becomes visible when the list overflows. `overflowButtonProps must contain at least `aria-label`.
87
+ * If you need to pass other props to it, you can do so by adding it to `overflowButtonProps` passed to the List.
87
88
  *
88
89
  * @example
89
90
  * ```tsx
90
91
  * <Breadcrumbs.List
91
92
  * overflowButtonProps={{
92
- * 'aria-label': 'More breadcrumb links',
93
+ * 'aria-label': 'More links',
93
94
  * onClick={handleOverflowButtonClick}
94
95
  * }}
95
96
  * >
@@ -101,7 +102,7 @@ export const Breadcrumbs = createContainer('nav')({
101
102
  * ---
102
103
  * [View Developer Docs](https://canvas.workdaydesign.com/components/navigation/breadcrumbs/#breadcrumbscurrentitem)
103
104
  *
104
- * The last element in the list of `Breadcrumb.Item`s.
105
+ * The last element in the list of `Breadcrumbs.Item`s.
105
106
  * By default, this item is truncated with a tooltip at `350px`,
106
107
  * But that can be customized with the `maxWidth` prop.
107
108
  *
@@ -139,14 +140,12 @@ export const Breadcrumbs = createContainer('nav')({
139
140
  */
140
141
  Menu: BreadcrumbsMenu,
141
142
  },
142
- })<BreadcrumbsProps>(
143
- ({children, 'aria-label': ariaLabel = 'breadcrumbs', ...elemProps}, _, model) => {
144
- return (
145
- <Menu model={model.menu}>
146
- <nav role="navigation" aria-label={ariaLabel} {...elemProps}>
147
- {children}
148
- </nav>
149
- </Menu>
150
- );
151
- }
152
- );
143
+ })<BreadcrumbsProps>(({children, ...elemProps}, _, model) => {
144
+ return (
145
+ <Menu model={model.menu}>
146
+ <nav role="navigation" {...elemProps}>
147
+ {children}
148
+ </nav>
149
+ </Menu>
150
+ );
151
+ });
@@ -5,16 +5,11 @@ import {Flex} from '@workday/canvas-kit-react/layout';
5
5
  import {useOverflowListMeasure, useListRenderItems} from '@workday/canvas-kit-react/collection';
6
6
  import {space} from '@workday/canvas-kit-react/tokens';
7
7
  import {useBreadcrumbsModel} from './hooks/useBreadcrumbsModel';
8
- import {Breadcrumbs} from './Breadcrumbs';
9
- import {BreadcrumbsOverflowButton} from './BreadcrumbsOverflowButton';
10
8
 
11
9
  // Use `Partial` here to make `spacing` optional
12
10
  export interface BreadcrumbsListProps<T = any>
13
11
  extends Omit<Partial<ExtractProps<typeof Flex, never>>, 'children'> {
14
- /**
15
- * Props passed into overflow button, style prop will be ignored
16
- */
17
- overflowButtonProps?: ExtractProps<typeof BreadcrumbsOverflowButton>;
12
+ overflowButton?: React.ReactNode;
18
13
  /**
19
14
  * If items are passed to a `BreadcrumbsModel`, the child of `Breadcrumbs.List` should be a render prop. The
20
15
  * List will determine how and when the item will be rendered.
@@ -31,7 +26,7 @@ export const BreadcrumbsList = createSubcomponent('ul')({
31
26
  displayName: 'Breadcrumbs.List',
32
27
  modelHook: useBreadcrumbsModel,
33
28
  elemPropsHook: useOverflowListMeasure,
34
- })<BreadcrumbsListProps>(({overflowButtonProps = {}, children, ...elemProps}, Element, model) => {
29
+ })<BreadcrumbsListProps>(({overflowButton, children, ...elemProps}, Element, model) => {
35
30
  const items = useListRenderItems(model, children) as [];
36
31
  const splitIndex = items.length - 2;
37
32
 
@@ -49,7 +44,7 @@ export const BreadcrumbsList = createSubcomponent('ul')({
49
44
  {...elemProps}
50
45
  >
51
46
  {items.length ? items.slice(0, splitIndex) : items}
52
- <Breadcrumbs.OverflowButton {...overflowButtonProps} />
47
+ {overflowButton}
53
48
  {items.length ? items.slice(splitIndex, items.length) : null}
54
49
  </Flex>
55
50
  );
@@ -16,6 +16,7 @@ import {useBreadcrumbsModel} from './hooks/useBreadcrumbsModel';
16
16
  import {TertiaryButton, TertiaryButtonProps} from '@workday/canvas-kit-react/button';
17
17
 
18
18
  export interface BreadcrumbsOverflowButtonProps extends TertiaryButtonProps {
19
+ 'aria-label': string;
19
20
  /**
20
21
  * style prop applies styles to the whole Flex component,
21
22
  * `useOverflowListTarget` automatically adds hidden styles if list doesn't have items to hide
@@ -40,12 +41,7 @@ export const BreadcrumbsOverflowButton = createSubcomponent('button')({
40
41
  })<BreadcrumbsOverflowButtonProps>(({style, ...elemProps}, Element) => {
41
42
  return (
42
43
  <Flex alignItems="center" {...style}>
43
- <TertiaryButton
44
- as={Element}
45
- icon={relatedActionsIcon}
46
- aria-label="More links"
47
- {...elemProps}
48
- />
44
+ <TertiaryButton as={Element} icon={relatedActionsIcon} {...elemProps} />
49
45
  <SystemIcon
50
46
  icon={chevronRightSmallIcon}
51
47
  color={colors.licorice200}