@carbon/react 1.43.0-rc.0 → 1.44.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 (82) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1024 -905
  2. package/es/components/Accordion/AccordionItem.d.ts +1 -1
  3. package/es/components/Accordion/AccordionItem.js +19 -15
  4. package/es/components/Checkbox/Checkbox.d.ts +4 -0
  5. package/es/components/Checkbox/Checkbox.js +15 -2
  6. package/es/components/CheckboxGroup/CheckboxGroup.js +17 -2
  7. package/es/components/ComboBox/ComboBox.js +12 -0
  8. package/es/components/ComboButton/index.js +2 -1
  9. package/es/components/ComposedModal/ComposedModal.d.ts +3 -3
  10. package/es/components/ComposedModal/ComposedModal.js +3 -3
  11. package/es/components/ContextMenu/useContextMenu.js +2 -1
  12. package/es/components/DataTable/tools/sorting.js +1 -1
  13. package/es/components/DataTableSkeleton/DataTableSkeleton.js +1 -1
  14. package/es/components/Dropdown/Dropdown.js +4 -1
  15. package/es/components/FileUploader/FileUploader.js +5 -3
  16. package/es/components/Grid/Column.js +11 -1
  17. package/es/components/Link/Link.d.ts +5 -0
  18. package/es/components/Link/Link.js +9 -2
  19. package/es/components/Menu/Menu.js +14 -0
  20. package/es/components/Menu/MenuContext.js +1 -0
  21. package/es/components/Menu/MenuItem.js +19 -4
  22. package/es/components/MenuButton/index.js +10 -2
  23. package/es/components/RadioButton/RadioButton.d.ts +4 -0
  24. package/es/components/RadioButton/RadioButton.js +15 -2
  25. package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
  26. package/es/components/RadioButtonGroup/RadioButtonGroup.js +17 -2
  27. package/es/components/Select/Select.d.ts +1 -1
  28. package/es/components/Slug/index.js +2 -2
  29. package/es/components/Tile/Tile.d.ts +37 -0
  30. package/es/components/Tile/Tile.js +110 -13
  31. package/es/components/UIShell/Content.d.ts +296 -0
  32. package/es/components/UIShell/Content.js +1 -2
  33. package/es/components/UIShell/SideNav.d.ts +1 -1
  34. package/es/components/UIShell/SideNav.js +1 -1
  35. package/es/components/UIShell/Switcher.d.ts +38 -0
  36. package/es/components/UIShell/Switcher.js +14 -13
  37. package/es/components/UIShell/SwitcherDivider.d.ts +9 -0
  38. package/es/components/UIShell/SwitcherDivider.js +4 -5
  39. package/es/components/UIShell/SwitcherItem.d.ts +49 -0
  40. package/es/components/UIShell/SwitcherItem.js +13 -17
  41. package/es/prop-types/tools/getDisplayName.js +34 -0
  42. package/lib/components/Accordion/AccordionItem.d.ts +1 -1
  43. package/lib/components/Accordion/AccordionItem.js +18 -14
  44. package/lib/components/Checkbox/Checkbox.d.ts +4 -0
  45. package/lib/components/Checkbox/Checkbox.js +15 -2
  46. package/lib/components/CheckboxGroup/CheckboxGroup.js +17 -2
  47. package/lib/components/ComboBox/ComboBox.js +12 -0
  48. package/lib/components/ComboButton/index.js +2 -1
  49. package/lib/components/ComposedModal/ComposedModal.d.ts +3 -3
  50. package/lib/components/ComposedModal/ComposedModal.js +3 -3
  51. package/lib/components/ContextMenu/useContextMenu.js +2 -1
  52. package/lib/components/DataTable/tools/sorting.js +1 -1
  53. package/lib/components/DataTableSkeleton/DataTableSkeleton.js +1 -1
  54. package/lib/components/Dropdown/Dropdown.js +4 -1
  55. package/lib/components/FileUploader/FileUploader.js +5 -3
  56. package/lib/components/Grid/Column.js +11 -1
  57. package/lib/components/Link/Link.d.ts +5 -0
  58. package/lib/components/Link/Link.js +9 -2
  59. package/lib/components/Menu/Menu.js +14 -0
  60. package/lib/components/Menu/MenuContext.js +1 -0
  61. package/lib/components/Menu/MenuItem.js +19 -4
  62. package/lib/components/MenuButton/index.js +10 -2
  63. package/lib/components/RadioButton/RadioButton.d.ts +4 -0
  64. package/lib/components/RadioButton/RadioButton.js +15 -2
  65. package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
  66. package/lib/components/RadioButtonGroup/RadioButtonGroup.js +17 -2
  67. package/lib/components/Select/Select.d.ts +1 -1
  68. package/lib/components/Slug/index.js +2 -2
  69. package/lib/components/Tile/Tile.d.ts +37 -0
  70. package/lib/components/Tile/Tile.js +110 -13
  71. package/lib/components/UIShell/Content.d.ts +296 -0
  72. package/lib/components/UIShell/Content.js +1 -2
  73. package/lib/components/UIShell/SideNav.d.ts +1 -1
  74. package/lib/components/UIShell/SideNav.js +1 -1
  75. package/lib/components/UIShell/Switcher.d.ts +38 -0
  76. package/lib/components/UIShell/Switcher.js +13 -12
  77. package/lib/components/UIShell/SwitcherDivider.d.ts +9 -0
  78. package/lib/components/UIShell/SwitcherDivider.js +4 -5
  79. package/lib/components/UIShell/SwitcherItem.d.ts +49 -0
  80. package/lib/components/UIShell/SwitcherItem.js +12 -16
  81. package/lib/prop-types/tools/getDisplayName.js +38 -0
  82. package/package.json +5 -5
@@ -0,0 +1,296 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import PropTypes from 'prop-types';
8
+ import React, { HTMLAttributes, ReactNode } from 'react';
9
+ export type ContentProps = HTMLAttributes<HTMLElement> & {
10
+ /**
11
+ * Provide children nodes to be rendered in the content container
12
+ */
13
+ children?: ReactNode;
14
+ /**
15
+ * Optionally provide a custom class name that is applied to the container
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Optionally specify the tag of the content node. Defaults to `main`
20
+ */
21
+ tagName?: string;
22
+ };
23
+ declare const Content: {
24
+ ({ className: customClassName, children, tagName, ...rest }: ContentProps): React.DOMElement<{
25
+ className: string;
26
+ defaultChecked?: boolean | undefined;
27
+ defaultValue?: string | number | readonly string[] | undefined;
28
+ suppressContentEditableWarning?: boolean | undefined;
29
+ suppressHydrationWarning?: boolean | undefined;
30
+ accessKey?: string | undefined;
31
+ contentEditable?: "inherit" | (boolean | "true" | "false") | undefined;
32
+ contextMenu?: string | undefined;
33
+ dir?: string | undefined;
34
+ draggable?: (boolean | "true" | "false") | undefined;
35
+ hidden?: boolean | undefined;
36
+ id?: string | undefined;
37
+ lang?: string | undefined;
38
+ placeholder?: string | undefined;
39
+ slot?: string | undefined;
40
+ spellCheck?: (boolean | "true" | "false") | undefined;
41
+ style?: React.CSSProperties | undefined;
42
+ tabIndex?: number | undefined;
43
+ title?: string | undefined;
44
+ translate?: "no" | "yes" | undefined;
45
+ radioGroup?: string | undefined;
46
+ role?: React.AriaRole | undefined;
47
+ about?: string | undefined;
48
+ datatype?: string | undefined;
49
+ inlist?: any;
50
+ prefix?: string | undefined;
51
+ property?: string | undefined;
52
+ resource?: string | undefined;
53
+ typeof?: string | undefined;
54
+ vocab?: string | undefined;
55
+ autoCapitalize?: string | undefined;
56
+ autoCorrect?: string | undefined;
57
+ autoSave?: string | undefined;
58
+ color?: string | undefined;
59
+ itemProp?: string | undefined;
60
+ itemScope?: boolean | undefined;
61
+ itemType?: string | undefined;
62
+ itemID?: string | undefined;
63
+ itemRef?: string | undefined;
64
+ results?: number | undefined;
65
+ security?: string | undefined;
66
+ unselectable?: "on" | "off" | undefined;
67
+ inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
68
+ is?: string | undefined;
69
+ 'aria-activedescendant'?: string | undefined;
70
+ 'aria-atomic'?: (boolean | "true" | "false") | undefined;
71
+ 'aria-autocomplete'?: "list" | "none" | "inline" | "both" | undefined;
72
+ 'aria-busy'?: (boolean | "true" | "false") | undefined;
73
+ 'aria-checked'?: boolean | "true" | "false" | "mixed" | undefined;
74
+ 'aria-colcount'?: number | undefined;
75
+ 'aria-colindex'?: number | undefined;
76
+ 'aria-colspan'?: number | undefined;
77
+ 'aria-controls'?: string | undefined;
78
+ 'aria-current'?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
79
+ 'aria-describedby'?: string | undefined;
80
+ 'aria-details'?: string | undefined;
81
+ 'aria-disabled'?: (boolean | "true" | "false") | undefined;
82
+ 'aria-dropeffect'?: "link" | "none" | "copy" | "execute" | "move" | "popup" | undefined;
83
+ 'aria-errormessage'?: string | undefined;
84
+ 'aria-expanded'?: (boolean | "true" | "false") | undefined;
85
+ 'aria-flowto'?: string | undefined;
86
+ 'aria-grabbed'?: (boolean | "true" | "false") | undefined;
87
+ 'aria-haspopup'?: boolean | "dialog" | "menu" | "grid" | "listbox" | "tree" | "true" | "false" | undefined;
88
+ 'aria-hidden'?: (boolean | "true" | "false") | undefined;
89
+ 'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
90
+ 'aria-keyshortcuts'?: string | undefined;
91
+ 'aria-label'?: string | undefined;
92
+ 'aria-labelledby'?: string | undefined;
93
+ 'aria-level'?: number | undefined;
94
+ 'aria-live'?: "off" | "assertive" | "polite" | undefined;
95
+ 'aria-modal'?: (boolean | "true" | "false") | undefined;
96
+ 'aria-multiline'?: (boolean | "true" | "false") | undefined;
97
+ 'aria-multiselectable'?: (boolean | "true" | "false") | undefined;
98
+ 'aria-orientation'?: "horizontal" | "vertical" | undefined;
99
+ 'aria-owns'?: string | undefined;
100
+ 'aria-placeholder'?: string | undefined;
101
+ 'aria-posinset'?: number | undefined;
102
+ 'aria-pressed'?: boolean | "true" | "false" | "mixed" | undefined;
103
+ 'aria-readonly'?: (boolean | "true" | "false") | undefined;
104
+ 'aria-relevant'?: "text" | "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
105
+ 'aria-required'?: (boolean | "true" | "false") | undefined;
106
+ 'aria-roledescription'?: string | undefined;
107
+ 'aria-rowcount'?: number | undefined;
108
+ 'aria-rowindex'?: number | undefined;
109
+ 'aria-rowspan'?: number | undefined;
110
+ 'aria-selected'?: (boolean | "true" | "false") | undefined;
111
+ 'aria-setsize'?: number | undefined;
112
+ 'aria-sort'?: "none" | "ascending" | "descending" | "other" | undefined;
113
+ 'aria-valuemax'?: number | undefined;
114
+ 'aria-valuemin'?: number | undefined;
115
+ 'aria-valuenow'?: number | undefined;
116
+ 'aria-valuetext'?: string | undefined;
117
+ dangerouslySetInnerHTML?: {
118
+ __html: string;
119
+ } | undefined;
120
+ onCopy?: React.ClipboardEventHandler<HTMLElement> | undefined;
121
+ onCopyCapture?: React.ClipboardEventHandler<HTMLElement> | undefined;
122
+ onCut?: React.ClipboardEventHandler<HTMLElement> | undefined;
123
+ onCutCapture?: React.ClipboardEventHandler<HTMLElement> | undefined;
124
+ onPaste?: React.ClipboardEventHandler<HTMLElement> | undefined;
125
+ onPasteCapture?: React.ClipboardEventHandler<HTMLElement> | undefined;
126
+ onCompositionEnd?: React.CompositionEventHandler<HTMLElement> | undefined;
127
+ onCompositionEndCapture?: React.CompositionEventHandler<HTMLElement> | undefined;
128
+ onCompositionStart?: React.CompositionEventHandler<HTMLElement> | undefined;
129
+ onCompositionStartCapture?: React.CompositionEventHandler<HTMLElement> | undefined;
130
+ onCompositionUpdate?: React.CompositionEventHandler<HTMLElement> | undefined;
131
+ onCompositionUpdateCapture?: React.CompositionEventHandler<HTMLElement> | undefined;
132
+ onFocus?: React.FocusEventHandler<HTMLElement> | undefined;
133
+ onFocusCapture?: React.FocusEventHandler<HTMLElement> | undefined;
134
+ onBlur?: React.FocusEventHandler<HTMLElement> | undefined;
135
+ onBlurCapture?: React.FocusEventHandler<HTMLElement> | undefined;
136
+ onChange?: React.FormEventHandler<HTMLElement> | undefined;
137
+ onChangeCapture?: React.FormEventHandler<HTMLElement> | undefined;
138
+ onBeforeInput?: React.FormEventHandler<HTMLElement> | undefined;
139
+ onBeforeInputCapture?: React.FormEventHandler<HTMLElement> | undefined;
140
+ onInput?: React.FormEventHandler<HTMLElement> | undefined;
141
+ onInputCapture?: React.FormEventHandler<HTMLElement> | undefined;
142
+ onReset?: React.FormEventHandler<HTMLElement> | undefined;
143
+ onResetCapture?: React.FormEventHandler<HTMLElement> | undefined;
144
+ onSubmit?: React.FormEventHandler<HTMLElement> | undefined;
145
+ onSubmitCapture?: React.FormEventHandler<HTMLElement> | undefined;
146
+ onInvalid?: React.FormEventHandler<HTMLElement> | undefined;
147
+ onInvalidCapture?: React.FormEventHandler<HTMLElement> | undefined;
148
+ onLoad?: React.ReactEventHandler<HTMLElement> | undefined;
149
+ onLoadCapture?: React.ReactEventHandler<HTMLElement> | undefined;
150
+ onError?: React.ReactEventHandler<HTMLElement> | undefined;
151
+ onErrorCapture?: React.ReactEventHandler<HTMLElement> | undefined;
152
+ onKeyDown?: React.KeyboardEventHandler<HTMLElement> | undefined;
153
+ onKeyDownCapture?: React.KeyboardEventHandler<HTMLElement> | undefined;
154
+ onKeyPress?: React.KeyboardEventHandler<HTMLElement> | undefined;
155
+ onKeyPressCapture?: React.KeyboardEventHandler<HTMLElement> | undefined;
156
+ onKeyUp?: React.KeyboardEventHandler<HTMLElement> | undefined;
157
+ onKeyUpCapture?: React.KeyboardEventHandler<HTMLElement> | undefined;
158
+ onAbort?: React.ReactEventHandler<HTMLElement> | undefined;
159
+ onAbortCapture?: React.ReactEventHandler<HTMLElement> | undefined;
160
+ onCanPlay?: React.ReactEventHandler<HTMLElement> | undefined;
161
+ onCanPlayCapture?: React.ReactEventHandler<HTMLElement> | undefined;
162
+ onCanPlayThrough?: React.ReactEventHandler<HTMLElement> | undefined;
163
+ onCanPlayThroughCapture?: React.ReactEventHandler<HTMLElement> | undefined;
164
+ onDurationChange?: React.ReactEventHandler<HTMLElement> | undefined;
165
+ onDurationChangeCapture?: React.ReactEventHandler<HTMLElement> | undefined;
166
+ onEmptied?: React.ReactEventHandler<HTMLElement> | undefined;
167
+ onEmptiedCapture?: React.ReactEventHandler<HTMLElement> | undefined;
168
+ onEncrypted?: React.ReactEventHandler<HTMLElement> | undefined;
169
+ onEncryptedCapture?: React.ReactEventHandler<HTMLElement> | undefined;
170
+ onEnded?: React.ReactEventHandler<HTMLElement> | undefined;
171
+ onEndedCapture?: React.ReactEventHandler<HTMLElement> | undefined;
172
+ onLoadedData?: React.ReactEventHandler<HTMLElement> | undefined;
173
+ onLoadedDataCapture?: React.ReactEventHandler<HTMLElement> | undefined;
174
+ onLoadedMetadata?: React.ReactEventHandler<HTMLElement> | undefined;
175
+ onLoadedMetadataCapture?: React.ReactEventHandler<HTMLElement> | undefined;
176
+ onLoadStart?: React.ReactEventHandler<HTMLElement> | undefined;
177
+ onLoadStartCapture?: React.ReactEventHandler<HTMLElement> | undefined;
178
+ onPause?: React.ReactEventHandler<HTMLElement> | undefined;
179
+ onPauseCapture?: React.ReactEventHandler<HTMLElement> | undefined;
180
+ onPlay?: React.ReactEventHandler<HTMLElement> | undefined;
181
+ onPlayCapture?: React.ReactEventHandler<HTMLElement> | undefined;
182
+ onPlaying?: React.ReactEventHandler<HTMLElement> | undefined;
183
+ onPlayingCapture?: React.ReactEventHandler<HTMLElement> | undefined;
184
+ onProgress?: React.ReactEventHandler<HTMLElement> | undefined;
185
+ onProgressCapture?: React.ReactEventHandler<HTMLElement> | undefined;
186
+ onRateChange?: React.ReactEventHandler<HTMLElement> | undefined;
187
+ onRateChangeCapture?: React.ReactEventHandler<HTMLElement> | undefined;
188
+ onSeeked?: React.ReactEventHandler<HTMLElement> | undefined;
189
+ onSeekedCapture?: React.ReactEventHandler<HTMLElement> | undefined;
190
+ onSeeking?: React.ReactEventHandler<HTMLElement> | undefined;
191
+ onSeekingCapture?: React.ReactEventHandler<HTMLElement> | undefined;
192
+ onStalled?: React.ReactEventHandler<HTMLElement> | undefined;
193
+ onStalledCapture?: React.ReactEventHandler<HTMLElement> | undefined;
194
+ onSuspend?: React.ReactEventHandler<HTMLElement> | undefined;
195
+ onSuspendCapture?: React.ReactEventHandler<HTMLElement> | undefined;
196
+ onTimeUpdate?: React.ReactEventHandler<HTMLElement> | undefined;
197
+ onTimeUpdateCapture?: React.ReactEventHandler<HTMLElement> | undefined;
198
+ onVolumeChange?: React.ReactEventHandler<HTMLElement> | undefined;
199
+ onVolumeChangeCapture?: React.ReactEventHandler<HTMLElement> | undefined;
200
+ onWaiting?: React.ReactEventHandler<HTMLElement> | undefined;
201
+ onWaitingCapture?: React.ReactEventHandler<HTMLElement> | undefined;
202
+ onAuxClick?: React.MouseEventHandler<HTMLElement> | undefined;
203
+ onAuxClickCapture?: React.MouseEventHandler<HTMLElement> | undefined;
204
+ onClick?: React.MouseEventHandler<HTMLElement> | undefined;
205
+ onClickCapture?: React.MouseEventHandler<HTMLElement> | undefined;
206
+ onContextMenu?: React.MouseEventHandler<HTMLElement> | undefined;
207
+ onContextMenuCapture?: React.MouseEventHandler<HTMLElement> | undefined;
208
+ onDoubleClick?: React.MouseEventHandler<HTMLElement> | undefined;
209
+ onDoubleClickCapture?: React.MouseEventHandler<HTMLElement> | undefined;
210
+ onDrag?: React.DragEventHandler<HTMLElement> | undefined;
211
+ onDragCapture?: React.DragEventHandler<HTMLElement> | undefined;
212
+ onDragEnd?: React.DragEventHandler<HTMLElement> | undefined;
213
+ onDragEndCapture?: React.DragEventHandler<HTMLElement> | undefined;
214
+ onDragEnter?: React.DragEventHandler<HTMLElement> | undefined;
215
+ onDragEnterCapture?: React.DragEventHandler<HTMLElement> | undefined;
216
+ onDragExit?: React.DragEventHandler<HTMLElement> | undefined;
217
+ onDragExitCapture?: React.DragEventHandler<HTMLElement> | undefined;
218
+ onDragLeave?: React.DragEventHandler<HTMLElement> | undefined;
219
+ onDragLeaveCapture?: React.DragEventHandler<HTMLElement> | undefined;
220
+ onDragOver?: React.DragEventHandler<HTMLElement> | undefined;
221
+ onDragOverCapture?: React.DragEventHandler<HTMLElement> | undefined;
222
+ onDragStart?: React.DragEventHandler<HTMLElement> | undefined;
223
+ onDragStartCapture?: React.DragEventHandler<HTMLElement> | undefined;
224
+ onDrop?: React.DragEventHandler<HTMLElement> | undefined;
225
+ onDropCapture?: React.DragEventHandler<HTMLElement> | undefined;
226
+ onMouseDown?: React.MouseEventHandler<HTMLElement> | undefined;
227
+ onMouseDownCapture?: React.MouseEventHandler<HTMLElement> | undefined;
228
+ onMouseEnter?: React.MouseEventHandler<HTMLElement> | undefined;
229
+ onMouseLeave?: React.MouseEventHandler<HTMLElement> | undefined;
230
+ onMouseMove?: React.MouseEventHandler<HTMLElement> | undefined;
231
+ onMouseMoveCapture?: React.MouseEventHandler<HTMLElement> | undefined;
232
+ onMouseOut?: React.MouseEventHandler<HTMLElement> | undefined;
233
+ onMouseOutCapture?: React.MouseEventHandler<HTMLElement> | undefined;
234
+ onMouseOver?: React.MouseEventHandler<HTMLElement> | undefined;
235
+ onMouseOverCapture?: React.MouseEventHandler<HTMLElement> | undefined;
236
+ onMouseUp?: React.MouseEventHandler<HTMLElement> | undefined;
237
+ onMouseUpCapture?: React.MouseEventHandler<HTMLElement> | undefined;
238
+ onSelect?: React.ReactEventHandler<HTMLElement> | undefined;
239
+ onSelectCapture?: React.ReactEventHandler<HTMLElement> | undefined;
240
+ onTouchCancel?: React.TouchEventHandler<HTMLElement> | undefined;
241
+ onTouchCancelCapture?: React.TouchEventHandler<HTMLElement> | undefined;
242
+ onTouchEnd?: React.TouchEventHandler<HTMLElement> | undefined;
243
+ onTouchEndCapture?: React.TouchEventHandler<HTMLElement> | undefined;
244
+ onTouchMove?: React.TouchEventHandler<HTMLElement> | undefined;
245
+ onTouchMoveCapture?: React.TouchEventHandler<HTMLElement> | undefined;
246
+ onTouchStart?: React.TouchEventHandler<HTMLElement> | undefined;
247
+ onTouchStartCapture?: React.TouchEventHandler<HTMLElement> | undefined;
248
+ onPointerDown?: React.PointerEventHandler<HTMLElement> | undefined;
249
+ onPointerDownCapture?: React.PointerEventHandler<HTMLElement> | undefined;
250
+ onPointerMove?: React.PointerEventHandler<HTMLElement> | undefined;
251
+ onPointerMoveCapture?: React.PointerEventHandler<HTMLElement> | undefined;
252
+ onPointerUp?: React.PointerEventHandler<HTMLElement> | undefined;
253
+ onPointerUpCapture?: React.PointerEventHandler<HTMLElement> | undefined;
254
+ onPointerCancel?: React.PointerEventHandler<HTMLElement> | undefined;
255
+ onPointerCancelCapture?: React.PointerEventHandler<HTMLElement> | undefined;
256
+ onPointerEnter?: React.PointerEventHandler<HTMLElement> | undefined;
257
+ onPointerEnterCapture?: React.PointerEventHandler<HTMLElement> | undefined;
258
+ onPointerLeave?: React.PointerEventHandler<HTMLElement> | undefined;
259
+ onPointerLeaveCapture?: React.PointerEventHandler<HTMLElement> | undefined;
260
+ onPointerOver?: React.PointerEventHandler<HTMLElement> | undefined;
261
+ onPointerOverCapture?: React.PointerEventHandler<HTMLElement> | undefined;
262
+ onPointerOut?: React.PointerEventHandler<HTMLElement> | undefined;
263
+ onPointerOutCapture?: React.PointerEventHandler<HTMLElement> | undefined;
264
+ onGotPointerCapture?: React.PointerEventHandler<HTMLElement> | undefined;
265
+ onGotPointerCaptureCapture?: React.PointerEventHandler<HTMLElement> | undefined;
266
+ onLostPointerCapture?: React.PointerEventHandler<HTMLElement> | undefined;
267
+ onLostPointerCaptureCapture?: React.PointerEventHandler<HTMLElement> | undefined;
268
+ onScroll?: React.UIEventHandler<HTMLElement> | undefined;
269
+ onScrollCapture?: React.UIEventHandler<HTMLElement> | undefined;
270
+ onWheel?: React.WheelEventHandler<HTMLElement> | undefined;
271
+ onWheelCapture?: React.WheelEventHandler<HTMLElement> | undefined;
272
+ onAnimationStart?: React.AnimationEventHandler<HTMLElement> | undefined;
273
+ onAnimationStartCapture?: React.AnimationEventHandler<HTMLElement> | undefined;
274
+ onAnimationEnd?: React.AnimationEventHandler<HTMLElement> | undefined;
275
+ onAnimationEndCapture?: React.AnimationEventHandler<HTMLElement> | undefined;
276
+ onAnimationIteration?: React.AnimationEventHandler<HTMLElement> | undefined;
277
+ onAnimationIterationCapture?: React.AnimationEventHandler<HTMLElement> | undefined;
278
+ onTransitionEnd?: React.TransitionEventHandler<HTMLElement> | undefined;
279
+ onTransitionEndCapture?: React.TransitionEventHandler<HTMLElement> | undefined;
280
+ }, Element>;
281
+ propTypes: {
282
+ /**
283
+ * Provide children nodes to be rendered in the content container
284
+ */
285
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
286
+ /**
287
+ * Optionally provide a custom class name that is applied to the container
288
+ */
289
+ className: PropTypes.Requireable<string>;
290
+ /**
291
+ * Optionally specify the tag of the content node. Defaults to `main`
292
+ */
293
+ tagName: PropTypes.Requireable<string>;
294
+ };
295
+ };
296
+ export default Content;
@@ -48,6 +48,5 @@ Content.propTypes = {
48
48
  */
49
49
  tagName: PropTypes__default["default"].string
50
50
  };
51
- var Content$1 = Content;
52
51
 
53
- exports["default"] = Content$1;
52
+ exports["default"] = Content;
@@ -25,5 +25,5 @@ interface SideNavContextData {
25
25
  isRail?: boolean | undefined;
26
26
  }
27
27
  export declare const SideNavContext: React.Context<SideNavContextData>;
28
- declare const SideNav: React.ForwardRefExoticComponent<Pick<SideNavProps, "children" | "slot" | "style" | "title" | "className" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "onToggle" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "onAnimationEnd" | "onKeyDown" | "tabIndex" | "color" | "lang" | "role" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "expanded" | "enterDelayMs" | "defaultExpanded" | "inert" | "addFocusListeners" | "isChildOfHeader" | "isFixedNav" | "isRail" | "isPersistent" | "addMouseListeners" | "onOverlayClick" | "onSideNavBlur"> & React.RefAttributes<HTMLElement>>;
28
+ declare const SideNav: React.ForwardRefExoticComponent<Pick<SideNavProps, "children" | "slot" | "style" | "title" | "className" | "dir" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "onToggle" | "key" | "id" | "aria-controls" | "aria-expanded" | "onClick" | "onKeyDown" | "onTransitionEnd" | "tabIndex" | "color" | "lang" | "role" | "href" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEndCapture" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "expanded" | "enterDelayMs" | "defaultExpanded" | "inert" | "addFocusListeners" | "isChildOfHeader" | "isFixedNav" | "isRail" | "isPersistent" | "addMouseListeners" | "onOverlayClick" | "onSideNavBlur"> & React.RefAttributes<HTMLElement>>;
29
29
  export default SideNav;
@@ -180,7 +180,7 @@ function SideNavRenderFunction(_ref, ref) {
180
180
  tabIndex: -1,
181
181
  ref: navRef,
182
182
  className: `${prefix}--side-nav__navigation ${className}`,
183
- inert: !isRail && (expanded || isLg ? undefined : -1)
183
+ inert: !isRail ? expanded || isLg ? undefined : -1 : undefined
184
184
  }, accessibilityLabel, eventHandlers, other), childrenToRender));
185
185
  }
186
186
  const SideNav = /*#__PURE__*/React__default["default"].forwardRef(SideNavRenderFunction);
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /**
8
+ * Copyright IBM Corp. 2016, 2023
9
+ *
10
+ * This source code is licensed under the Apache-2.0 license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ */
13
+ import React, { ReactNode } from 'react';
14
+ interface BaseSwitcherProps {
15
+ /**
16
+ * expects to receive <SwitcherItem />
17
+ */
18
+ children: ReactNode;
19
+ /**
20
+ * Optionally provide a custom class to apply to the underlying `<ul>` node
21
+ */
22
+ className?: string;
23
+ /**
24
+ * Specify whether the panel is expanded
25
+ */
26
+ expanded?: boolean;
27
+ }
28
+ interface SwitcherWithAriaLabel extends BaseSwitcherProps {
29
+ 'aria-label': string;
30
+ 'aria-labelledby'?: never;
31
+ }
32
+ interface SwitcherWithAriaLabelledBy extends BaseSwitcherProps {
33
+ 'aria-label'?: never;
34
+ 'aria-labelledby': string;
35
+ }
36
+ type SwitcherProps = SwitcherWithAriaLabel | SwitcherWithAriaLabelledBy;
37
+ declare const Switcher: React.ForwardRefExoticComponent<SwitcherProps & React.RefAttributes<HTMLUListElement>>;
38
+ export default Switcher;
@@ -12,10 +12,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
12
12
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
13
  var React = require('react');
14
14
  var cx = require('classnames');
15
- var PropTypes = require('prop-types');
16
- var AriaPropTypes = require('../../prop-types/AriaPropTypes.js');
17
15
  var usePrefix = require('../../internal/usePrefix.js');
18
16
  var useMergedRefs = require('../../internal/useMergedRefs.js');
17
+ var PropTypes = require('prop-types');
18
+ var AriaPropTypes = require('../../prop-types/AriaPropTypes.js');
19
+ var getDisplayName = require('../../prop-types/tools/getDisplayName.js');
19
20
 
20
21
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
22
 
@@ -23,7 +24,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
24
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
25
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
25
26
 
26
- const Switcher = /*#__PURE__*/React__default["default"].forwardRef(function Switcher(props, forwardRef) {
27
+ const Switcher = /*#__PURE__*/React.forwardRef(function Switcher(props, forwardRef) {
27
28
  const switcherRef = React.useRef(null);
28
29
  const ref = useMergedRefs.useMergedRefs([switcherRef, forwardRef]);
29
30
  const prefix = usePrefix.usePrefix();
@@ -39,7 +40,7 @@ const Switcher = /*#__PURE__*/React__default["default"].forwardRef(function Swit
39
40
  'aria-labelledby': ariaLabelledBy
40
41
  };
41
42
  const className = cx__default["default"](`${prefix}--switcher`, {
42
- [customClassName]: !!customClassName
43
+ [customClassName || '']: !!customClassName
43
44
  });
44
45
  const handleSwitcherItemFocus = _ref => {
45
46
  let {
@@ -64,13 +65,14 @@ const Switcher = /*#__PURE__*/React__default["default"].forwardRef(function Swit
64
65
  return enabledIndices[nextIndex];
65
66
  }
66
67
  })();
67
- const switcherItem = switcherRef.current.children[nextValidIndex].children[0];
68
- switcherItem?.focus();
68
+ const switcherItem = switcherRef.current?.children[nextValidIndex]?.children[0];
69
+ if (switcherItem) {
70
+ switcherItem.focus();
71
+ }
69
72
  };
70
- const childrenWithProps = React__default["default"].Children.toArray(children).map((child, index) => {
71
- // handleSwitcherItemFocus should only be passed down if the child is a SwitcherItem
72
- // SwitcherDivider, for example, does not accept a handleSwitcherItemFocus prop
73
- if (child.type?.displayName === 'SwitcherItem') {
73
+ const childrenWithProps = React__default["default"].Children.map(children, (child, index) => {
74
+ // only setup click handlers if onChange event is passed
75
+ if ( /*#__PURE__*/React__default["default"].isValidElement(child) && child.type && getDisplayName["default"](child.type) === 'Switcher') {
74
76
  return /*#__PURE__*/React__default["default"].cloneElement(child, {
75
77
  handleSwitcherItemFocus,
76
78
  index,
@@ -108,6 +110,5 @@ Switcher.propTypes = {
108
110
  */
109
111
  expanded: PropTypes__default["default"].bool
110
112
  };
111
- var Switcher$1 = Switcher;
112
113
 
113
- exports["default"] = Switcher$1;
114
+ exports["default"] = Switcher;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface SwitcherDividerProps {
3
+ /**
4
+ * Optionally provide a custom class to apply to the underlying `<li>` node
5
+ */
6
+ className?: string;
7
+ }
8
+ declare const SwitcherDivider: React.FC<SwitcherDividerProps>;
9
+ export default SwitcherDivider;
@@ -27,11 +27,11 @@ const SwitcherDivider = _ref => {
27
27
  ...other
28
28
  } = _ref;
29
29
  const prefix = usePrefix.usePrefix();
30
- const className = cx__default["default"](`${prefix}--switcher__item--divider`, {
31
- [customClassName]: !!customClassName
30
+ const classNames = cx__default["default"](`${prefix}--switcher__item--divider`, {
31
+ [customClassName || '']: !!customClassName
32
32
  });
33
33
  return /*#__PURE__*/React__default["default"].createElement("hr", _rollupPluginBabelHelpers["extends"]({}, other, {
34
- className: className
34
+ className: classNames
35
35
  }));
36
36
  };
37
37
  SwitcherDivider.propTypes = {
@@ -40,6 +40,5 @@ SwitcherDivider.propTypes = {
40
40
  */
41
41
  className: PropTypes__default["default"].string
42
42
  };
43
- var SwitcherDivider$1 = SwitcherDivider;
44
43
 
45
- exports["default"] = SwitcherDivider$1;
44
+ exports["default"] = SwitcherDivider;
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ interface BaseSwitcherItemProps {
3
+ /**
4
+ * Specify the text content for the link
5
+ */
6
+ children: React.ReactNode;
7
+ /**
8
+ * Optionally provide a custom class to apply to the underlying `<li>` node
9
+ */
10
+ className?: string;
11
+ /**
12
+ * event handlers
13
+ */
14
+ handleSwitcherItemFocus?: (event: {
15
+ currentIndex: number;
16
+ direction: number;
17
+ }) => void;
18
+ /**
19
+ * Specify the index of the SwitcherItem
20
+ */
21
+ index?: number;
22
+ /**
23
+ * event handlers
24
+ */
25
+ onKeyDown?: (event: KeyboardEvent) => void;
26
+ /**
27
+ * Specify the tab index of the Link
28
+ */
29
+ tabIndex?: number;
30
+ /**
31
+ * Specify whether the panel is expanded
32
+ */
33
+ expanded?: boolean;
34
+ /**
35
+ * Specify whether the panel is selected
36
+ */
37
+ isSelected?: boolean;
38
+ }
39
+ interface SwitcherItemWithAriaLabel extends BaseSwitcherItemProps {
40
+ 'aria-label': string;
41
+ 'aria-labelledby'?: never;
42
+ }
43
+ interface SwitcherItemWithAriaLabelledBy extends BaseSwitcherItemProps {
44
+ 'aria-label'?: never;
45
+ 'aria-labelledby': string;
46
+ }
47
+ type SwitcherItemProps = SwitcherItemWithAriaLabel | SwitcherItemWithAriaLabelledBy;
48
+ declare const SwitcherItem: React.ForwardRefExoticComponent<SwitcherItemProps & React.RefAttributes<React.ElementType<any>>>;
49
+ export default SwitcherItem;
@@ -13,9 +13,9 @@ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelper
13
13
  var React = require('react');
14
14
  var cx = require('classnames');
15
15
  var PropTypes = require('prop-types');
16
- var AriaPropTypes = require('../../prop-types/AriaPropTypes.js');
17
16
  var Link = require('./Link.js');
18
17
  var usePrefix = require('../../internal/usePrefix.js');
18
+ var AriaPropTypes = require('../../prop-types/AriaPropTypes.js');
19
19
  var match = require('../../internal/keyboard/match.js');
20
20
  var keys = require('../../internal/keyboard/keys.js');
21
21
 
@@ -25,8 +25,8 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
25
25
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
26
26
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
27
27
 
28
- const SwitcherItem = /*#__PURE__*/React__default["default"].forwardRef(function SwitcherItem(_ref, ref) {
29
- let {
28
+ const SwitcherItem = /*#__PURE__*/React.forwardRef(function SwitcherItem(props, forwardRef) {
29
+ const {
30
30
  'aria-label': ariaLabel,
31
31
  'aria-labelledby': ariaLabelledBy,
32
32
  className: customClassName,
@@ -38,10 +38,10 @@ const SwitcherItem = /*#__PURE__*/React__default["default"].forwardRef(function
38
38
  handleSwitcherItemFocus,
39
39
  onKeyDown = () => {},
40
40
  ...rest
41
- } = _ref;
41
+ } = props;
42
42
  const prefix = usePrefix.usePrefix();
43
- const className = cx__default["default"](`${prefix}--switcher__item`, {
44
- [customClassName]: !!customClassName
43
+ const classNames = cx__default["default"](`${prefix}--switcher__item`, {
44
+ [customClassName || '']: !!customClassName
45
45
  });
46
46
  const accessibilityLabel = {
47
47
  'aria-label': ariaLabel,
@@ -54,36 +54,33 @@ const SwitcherItem = /*#__PURE__*/React__default["default"].forwardRef(function
54
54
  if (match.match(evt, keys.ArrowDown)) {
55
55
  evt.preventDefault();
56
56
  handleSwitcherItemFocus?.({
57
- currentIndex: index,
57
+ currentIndex: index || -1,
58
58
  direction: 1
59
59
  });
60
60
  }
61
61
  if (match.match(evt, keys.ArrowUp)) {
62
62
  evt.preventDefault();
63
63
  handleSwitcherItemFocus?.({
64
- currentIndex: index,
64
+ currentIndex: index || -1,
65
65
  direction: -1
66
66
  });
67
67
  }
68
68
  }
69
69
  return /*#__PURE__*/React__default["default"].createElement("li", {
70
- className: className
70
+ className: classNames
71
71
  }, /*#__PURE__*/React__default["default"].createElement(Link["default"], _rollupPluginBabelHelpers["extends"]({
72
72
  onKeyDown: evt => {
73
73
  setTabFocus(evt);
74
74
  onKeyDown(evt);
75
- }
75
+ },
76
+ ref: forwardRef
76
77
  }, rest, {
77
- ref: ref,
78
78
  className: linkClassName,
79
79
  tabIndex: tabIndex
80
80
  }, accessibilityLabel), children));
81
81
  });
82
82
  SwitcherItem.displayName = 'SwitcherItem';
83
83
  SwitcherItem.propTypes = {
84
- /**
85
- * Required props for accessibility label on the underlying menuitem
86
- */
87
84
  ...AriaPropTypes.AriaLabelPropType,
88
85
  /**
89
86
  * Specify the text content for the link
@@ -110,6 +107,5 @@ SwitcherItem.propTypes = {
110
107
  */
111
108
  tabIndex: PropTypes__default["default"].number
112
109
  };
113
- var SwitcherItem$1 = SwitcherItem;
114
110
 
115
- exports["default"] = SwitcherItem$1;
111
+ exports["default"] = SwitcherItem;