@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.
- package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +1024 -905
- package/es/components/Accordion/AccordionItem.d.ts +1 -1
- package/es/components/Accordion/AccordionItem.js +19 -15
- package/es/components/Checkbox/Checkbox.d.ts +4 -0
- package/es/components/Checkbox/Checkbox.js +15 -2
- package/es/components/CheckboxGroup/CheckboxGroup.js +17 -2
- package/es/components/ComboBox/ComboBox.js +12 -0
- package/es/components/ComboButton/index.js +2 -1
- package/es/components/ComposedModal/ComposedModal.d.ts +3 -3
- package/es/components/ComposedModal/ComposedModal.js +3 -3
- package/es/components/ContextMenu/useContextMenu.js +2 -1
- package/es/components/DataTable/tools/sorting.js +1 -1
- package/es/components/DataTableSkeleton/DataTableSkeleton.js +1 -1
- package/es/components/Dropdown/Dropdown.js +4 -1
- package/es/components/FileUploader/FileUploader.js +5 -3
- package/es/components/Grid/Column.js +11 -1
- package/es/components/Link/Link.d.ts +5 -0
- package/es/components/Link/Link.js +9 -2
- package/es/components/Menu/Menu.js +14 -0
- package/es/components/Menu/MenuContext.js +1 -0
- package/es/components/Menu/MenuItem.js +19 -4
- package/es/components/MenuButton/index.js +10 -2
- package/es/components/RadioButton/RadioButton.d.ts +4 -0
- package/es/components/RadioButton/RadioButton.js +15 -2
- package/es/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
- package/es/components/RadioButtonGroup/RadioButtonGroup.js +17 -2
- package/es/components/Select/Select.d.ts +1 -1
- package/es/components/Slug/index.js +2 -2
- package/es/components/Tile/Tile.d.ts +37 -0
- package/es/components/Tile/Tile.js +110 -13
- package/es/components/UIShell/Content.d.ts +296 -0
- package/es/components/UIShell/Content.js +1 -2
- package/es/components/UIShell/SideNav.d.ts +1 -1
- package/es/components/UIShell/SideNav.js +1 -1
- package/es/components/UIShell/Switcher.d.ts +38 -0
- package/es/components/UIShell/Switcher.js +14 -13
- package/es/components/UIShell/SwitcherDivider.d.ts +9 -0
- package/es/components/UIShell/SwitcherDivider.js +4 -5
- package/es/components/UIShell/SwitcherItem.d.ts +49 -0
- package/es/components/UIShell/SwitcherItem.js +13 -17
- package/es/prop-types/tools/getDisplayName.js +34 -0
- package/lib/components/Accordion/AccordionItem.d.ts +1 -1
- package/lib/components/Accordion/AccordionItem.js +18 -14
- package/lib/components/Checkbox/Checkbox.d.ts +4 -0
- package/lib/components/Checkbox/Checkbox.js +15 -2
- package/lib/components/CheckboxGroup/CheckboxGroup.js +17 -2
- package/lib/components/ComboBox/ComboBox.js +12 -0
- package/lib/components/ComboButton/index.js +2 -1
- package/lib/components/ComposedModal/ComposedModal.d.ts +3 -3
- package/lib/components/ComposedModal/ComposedModal.js +3 -3
- package/lib/components/ContextMenu/useContextMenu.js +2 -1
- package/lib/components/DataTable/tools/sorting.js +1 -1
- package/lib/components/DataTableSkeleton/DataTableSkeleton.js +1 -1
- package/lib/components/Dropdown/Dropdown.js +4 -1
- package/lib/components/FileUploader/FileUploader.js +5 -3
- package/lib/components/Grid/Column.js +11 -1
- package/lib/components/Link/Link.d.ts +5 -0
- package/lib/components/Link/Link.js +9 -2
- package/lib/components/Menu/Menu.js +14 -0
- package/lib/components/Menu/MenuContext.js +1 -0
- package/lib/components/Menu/MenuItem.js +19 -4
- package/lib/components/MenuButton/index.js +10 -2
- package/lib/components/RadioButton/RadioButton.d.ts +4 -0
- package/lib/components/RadioButton/RadioButton.js +15 -2
- package/lib/components/RadioButtonGroup/RadioButtonGroup.d.ts +4 -0
- package/lib/components/RadioButtonGroup/RadioButtonGroup.js +17 -2
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Slug/index.js +2 -2
- package/lib/components/Tile/Tile.d.ts +37 -0
- package/lib/components/Tile/Tile.js +110 -13
- package/lib/components/UIShell/Content.d.ts +296 -0
- package/lib/components/UIShell/Content.js +1 -2
- package/lib/components/UIShell/SideNav.d.ts +1 -1
- package/lib/components/UIShell/SideNav.js +1 -1
- package/lib/components/UIShell/Switcher.d.ts +38 -0
- package/lib/components/UIShell/Switcher.js +13 -12
- package/lib/components/UIShell/SwitcherDivider.d.ts +9 -0
- package/lib/components/UIShell/SwitcherDivider.js +4 -5
- package/lib/components/UIShell/SwitcherItem.d.ts +49 -0
- package/lib/components/UIShell/SwitcherItem.js +12 -16
- package/lib/prop-types/tools/getDisplayName.js +38 -0
- 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;
|
|
@@ -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" | "
|
|
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;
|
|
@@ -170,7 +170,7 @@ function SideNavRenderFunction(_ref, ref) {
|
|
|
170
170
|
tabIndex: -1,
|
|
171
171
|
ref: navRef,
|
|
172
172
|
className: `${prefix}--side-nav__navigation ${className}`,
|
|
173
|
-
inert: !isRail
|
|
173
|
+
inert: !isRail ? expanded || isLg ? undefined : -1 : undefined
|
|
174
174
|
}, accessibilityLabel, eventHandlers, other), childrenToRender));
|
|
175
175
|
}
|
|
176
176
|
const SideNav = /*#__PURE__*/React__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;
|
|
@@ -6,14 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React__default, { useRef } from 'react';
|
|
9
|
+
import React__default, { forwardRef, useRef } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
|
-
import PropTypes from 'prop-types';
|
|
12
|
-
import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
|
|
13
11
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
12
|
import { useMergedRefs } from '../../internal/useMergedRefs.js';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
|
|
15
|
+
import getDisplayName from '../../prop-types/tools/getDisplayName.js';
|
|
15
16
|
|
|
16
|
-
const Switcher = /*#__PURE__*/
|
|
17
|
+
const Switcher = /*#__PURE__*/forwardRef(function Switcher(props, forwardRef) {
|
|
17
18
|
const switcherRef = useRef(null);
|
|
18
19
|
const ref = useMergedRefs([switcherRef, forwardRef]);
|
|
19
20
|
const prefix = usePrefix();
|
|
@@ -29,7 +30,7 @@ const Switcher = /*#__PURE__*/React__default.forwardRef(function Switcher(props,
|
|
|
29
30
|
'aria-labelledby': ariaLabelledBy
|
|
30
31
|
};
|
|
31
32
|
const className = cx(`${prefix}--switcher`, {
|
|
32
|
-
[customClassName]: !!customClassName
|
|
33
|
+
[customClassName || '']: !!customClassName
|
|
33
34
|
});
|
|
34
35
|
const handleSwitcherItemFocus = _ref => {
|
|
35
36
|
let {
|
|
@@ -54,13 +55,14 @@ const Switcher = /*#__PURE__*/React__default.forwardRef(function Switcher(props,
|
|
|
54
55
|
return enabledIndices[nextIndex];
|
|
55
56
|
}
|
|
56
57
|
})();
|
|
57
|
-
const switcherItem = switcherRef.current
|
|
58
|
-
switcherItem
|
|
58
|
+
const switcherItem = switcherRef.current?.children[nextValidIndex]?.children[0];
|
|
59
|
+
if (switcherItem) {
|
|
60
|
+
switcherItem.focus();
|
|
61
|
+
}
|
|
59
62
|
};
|
|
60
|
-
const childrenWithProps = React__default.Children.
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
if (child.type?.displayName === 'SwitcherItem') {
|
|
63
|
+
const childrenWithProps = React__default.Children.map(children, (child, index) => {
|
|
64
|
+
// only setup click handlers if onChange event is passed
|
|
65
|
+
if ( /*#__PURE__*/React__default.isValidElement(child) && child.type && getDisplayName(child.type) === 'Switcher') {
|
|
64
66
|
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
65
67
|
handleSwitcherItemFocus,
|
|
66
68
|
index,
|
|
@@ -98,6 +100,5 @@ Switcher.propTypes = {
|
|
|
98
100
|
*/
|
|
99
101
|
expanded: PropTypes.bool
|
|
100
102
|
};
|
|
101
|
-
var Switcher$1 = Switcher;
|
|
102
103
|
|
|
103
|
-
export { Switcher
|
|
104
|
+
export { Switcher as default };
|
|
@@ -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;
|
|
@@ -17,11 +17,11 @@ const SwitcherDivider = _ref => {
|
|
|
17
17
|
...other
|
|
18
18
|
} = _ref;
|
|
19
19
|
const prefix = usePrefix();
|
|
20
|
-
const
|
|
21
|
-
[customClassName]: !!customClassName
|
|
20
|
+
const classNames = cx(`${prefix}--switcher__item--divider`, {
|
|
21
|
+
[customClassName || '']: !!customClassName
|
|
22
22
|
});
|
|
23
23
|
return /*#__PURE__*/React__default.createElement("hr", _extends({}, other, {
|
|
24
|
-
className:
|
|
24
|
+
className: classNames
|
|
25
25
|
}));
|
|
26
26
|
};
|
|
27
27
|
SwitcherDivider.propTypes = {
|
|
@@ -30,6 +30,5 @@ SwitcherDivider.propTypes = {
|
|
|
30
30
|
*/
|
|
31
31
|
className: PropTypes.string
|
|
32
32
|
};
|
|
33
|
-
var SwitcherDivider$1 = SwitcherDivider;
|
|
34
33
|
|
|
35
|
-
export { SwitcherDivider
|
|
34
|
+
export { SwitcherDivider as default };
|
|
@@ -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;
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
9
|
-
import React__default from 'react';
|
|
9
|
+
import React__default, { forwardRef } from 'react';
|
|
10
10
|
import cx from 'classnames';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
|
|
13
12
|
import Link from './Link.js';
|
|
14
13
|
import { usePrefix } from '../../internal/usePrefix.js';
|
|
14
|
+
import { AriaLabelPropType } from '../../prop-types/AriaPropTypes.js';
|
|
15
15
|
import { match } from '../../internal/keyboard/match.js';
|
|
16
16
|
import { ArrowDown, ArrowUp } from '../../internal/keyboard/keys.js';
|
|
17
17
|
|
|
18
|
-
const SwitcherItem = /*#__PURE__*/
|
|
19
|
-
|
|
18
|
+
const SwitcherItem = /*#__PURE__*/forwardRef(function SwitcherItem(props, forwardRef) {
|
|
19
|
+
const {
|
|
20
20
|
'aria-label': ariaLabel,
|
|
21
21
|
'aria-labelledby': ariaLabelledBy,
|
|
22
22
|
className: customClassName,
|
|
@@ -28,10 +28,10 @@ const SwitcherItem = /*#__PURE__*/React__default.forwardRef(function SwitcherIte
|
|
|
28
28
|
handleSwitcherItemFocus,
|
|
29
29
|
onKeyDown = () => {},
|
|
30
30
|
...rest
|
|
31
|
-
} =
|
|
31
|
+
} = props;
|
|
32
32
|
const prefix = usePrefix();
|
|
33
|
-
const
|
|
34
|
-
[customClassName]: !!customClassName
|
|
33
|
+
const classNames = cx(`${prefix}--switcher__item`, {
|
|
34
|
+
[customClassName || '']: !!customClassName
|
|
35
35
|
});
|
|
36
36
|
const accessibilityLabel = {
|
|
37
37
|
'aria-label': ariaLabel,
|
|
@@ -44,36 +44,33 @@ const SwitcherItem = /*#__PURE__*/React__default.forwardRef(function SwitcherIte
|
|
|
44
44
|
if (match(evt, ArrowDown)) {
|
|
45
45
|
evt.preventDefault();
|
|
46
46
|
handleSwitcherItemFocus?.({
|
|
47
|
-
currentIndex: index,
|
|
47
|
+
currentIndex: index || -1,
|
|
48
48
|
direction: 1
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
if (match(evt, ArrowUp)) {
|
|
52
52
|
evt.preventDefault();
|
|
53
53
|
handleSwitcherItemFocus?.({
|
|
54
|
-
currentIndex: index,
|
|
54
|
+
currentIndex: index || -1,
|
|
55
55
|
direction: -1
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
return /*#__PURE__*/React__default.createElement("li", {
|
|
60
|
-
className:
|
|
60
|
+
className: classNames
|
|
61
61
|
}, /*#__PURE__*/React__default.createElement(Link, _extends({
|
|
62
62
|
onKeyDown: evt => {
|
|
63
63
|
setTabFocus(evt);
|
|
64
64
|
onKeyDown(evt);
|
|
65
|
-
}
|
|
65
|
+
},
|
|
66
|
+
ref: forwardRef
|
|
66
67
|
}, rest, {
|
|
67
|
-
ref: ref,
|
|
68
68
|
className: linkClassName,
|
|
69
69
|
tabIndex: tabIndex
|
|
70
70
|
}, accessibilityLabel), children));
|
|
71
71
|
});
|
|
72
72
|
SwitcherItem.displayName = 'SwitcherItem';
|
|
73
73
|
SwitcherItem.propTypes = {
|
|
74
|
-
/**
|
|
75
|
-
* Required props for accessibility label on the underlying menuitem
|
|
76
|
-
*/
|
|
77
74
|
...AriaLabelPropType,
|
|
78
75
|
/**
|
|
79
76
|
* Specify the text content for the link
|
|
@@ -100,6 +97,5 @@ SwitcherItem.propTypes = {
|
|
|
100
97
|
*/
|
|
101
98
|
tabIndex: PropTypes.number
|
|
102
99
|
};
|
|
103
|
-
var SwitcherItem$1 = SwitcherItem;
|
|
104
100
|
|
|
105
|
-
export { SwitcherItem
|
|
101
|
+
export { SwitcherItem as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
const cachedDisplayNames = new WeakMap();
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* `getDisplayName` is a utility function for getting a name from a given
|
|
12
|
+
* component type. It supports names from React elements, Stateless Functional
|
|
13
|
+
* Components, and Class-based Components
|
|
14
|
+
*/
|
|
15
|
+
const getDisplayName = type => {
|
|
16
|
+
if (typeof type === 'string') {
|
|
17
|
+
return type;
|
|
18
|
+
}
|
|
19
|
+
if (cachedDisplayNames.has(type)) {
|
|
20
|
+
return cachedDisplayNames.get(type);
|
|
21
|
+
}
|
|
22
|
+
let displayName;
|
|
23
|
+
if (typeof type.displayName === 'string') {
|
|
24
|
+
displayName = type.displayName;
|
|
25
|
+
}
|
|
26
|
+
if (!displayName) {
|
|
27
|
+
displayName = type.name || 'Unknown';
|
|
28
|
+
}
|
|
29
|
+
cachedDisplayNames.set(type, displayName);
|
|
30
|
+
return displayName;
|
|
31
|
+
};
|
|
32
|
+
var getDisplayName$1 = getDisplayName;
|
|
33
|
+
|
|
34
|
+
export { getDisplayName$1 as default };
|