@splunk/react-ui 5.7.1 → 5.8.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 (138) hide show
  1. package/Accordion.js +6 -6
  2. package/Box.js +83 -34
  3. package/CHANGELOG.md +29 -0
  4. package/CollapsiblePanel.js +11 -11
  5. package/ComboBox.js +31 -27
  6. package/ControlGroup.js +92 -91
  7. package/DefinitionList.js +9 -9
  8. package/Drawer.d.ts +2 -0
  9. package/Drawer.js +679 -0
  10. package/DualListbox.js +1 -1
  11. package/JSONTree.js +73 -72
  12. package/Link.js +2 -2
  13. package/MIGRATION.md +10 -0
  14. package/Menu.js +338 -240
  15. package/Modal.js +127 -109
  16. package/Multiselect.js +437 -351
  17. package/Paginator.js +14 -12
  18. package/Popover.js +4 -1
  19. package/README.md +11 -0
  20. package/RadioBar.js +1 -1
  21. package/Search.js +103 -88
  22. package/Select.js +42 -40
  23. package/SelectBase.js +374 -328
  24. package/SidePanel.js +346 -167
  25. package/SlidingPanels.js +11 -11
  26. package/StepBar.js +7 -7
  27. package/Switch.js +5 -5
  28. package/Text.js +24 -24
  29. package/TextArea.js +7 -7
  30. package/TransitionOpen.js +188 -169
  31. package/docs-llm/Accordion.md +267 -0
  32. package/docs-llm/Anchor Menu.md +115 -0
  33. package/docs-llm/Anchor.md +54 -0
  34. package/docs-llm/AnimationToggle.md +254 -0
  35. package/docs-llm/Avatar.md +298 -0
  36. package/docs-llm/Badge.md +212 -0
  37. package/docs-llm/Breadcrumbs.md +306 -0
  38. package/docs-llm/Button Group.md +53 -0
  39. package/docs-llm/Button.md +361 -0
  40. package/docs-llm/Card Layout.md +286 -0
  41. package/docs-llm/Card.md +619 -0
  42. package/docs-llm/Checkbox.md +218 -0
  43. package/docs-llm/Chip.md +291 -0
  44. package/docs-llm/Clickable.md +160 -0
  45. package/docs-llm/Code.md +292 -0
  46. package/docs-llm/Collapsible Panel.md +744 -0
  47. package/docs-llm/Color.md +253 -0
  48. package/docs-llm/Column Layout.md +391 -0
  49. package/docs-llm/Combo Box.md +540 -0
  50. package/docs-llm/Control Group.md +594 -0
  51. package/docs-llm/Date.md +270 -0
  52. package/docs-llm/Definition List.md +278 -0
  53. package/docs-llm/Divider.md +216 -0
  54. package/docs-llm/Drawer.md +414 -0
  55. package/docs-llm/Dropdown.md +472 -0
  56. package/docs-llm/Dual Listbox.md +325 -0
  57. package/docs-llm/File.md +653 -0
  58. package/docs-llm/Form Rows.md +374 -0
  59. package/docs-llm/Heading.md +179 -0
  60. package/docs-llm/Image.md +109 -0
  61. package/docs-llm/JSON Tree.md +260 -0
  62. package/docs-llm/Layer.md +74 -0
  63. package/docs-llm/Layout.md +50 -0
  64. package/docs-llm/Link.md +318 -0
  65. package/docs-llm/List.md +189 -0
  66. package/docs-llm/Markdown.md +179 -0
  67. package/docs-llm/Menu.md +735 -0
  68. package/docs-llm/Message Bar.md +236 -0
  69. package/docs-llm/Message.md +248 -0
  70. package/docs-llm/Modal.md +443 -0
  71. package/docs-llm/Monogram.md +159 -0
  72. package/docs-llm/Multiselect.md +937 -0
  73. package/docs-llm/Number.md +298 -0
  74. package/docs-llm/Paginator.md +395 -0
  75. package/docs-llm/Paragraph.md +148 -0
  76. package/docs-llm/Phone Number.md +254 -0
  77. package/docs-llm/Popover.md +166 -0
  78. package/docs-llm/Progress.md +141 -0
  79. package/docs-llm/Radio Bar.md +303 -0
  80. package/docs-llm/Radio List.md +350 -0
  81. package/docs-llm/Resize.md +362 -0
  82. package/docs-llm/Screen Reader Content.md +73 -0
  83. package/docs-llm/Scroll Container Context.md +155 -0
  84. package/docs-llm/Scroll.md +152 -0
  85. package/docs-llm/Search.md +381 -0
  86. package/docs-llm/Select.md +985 -0
  87. package/docs-llm/Side Panel.md +777 -0
  88. package/docs-llm/Slider.md +339 -0
  89. package/docs-llm/Sliding Panels.md +340 -0
  90. package/docs-llm/Split Button.md +295 -0
  91. package/docs-llm/Static Content.md +90 -0
  92. package/docs-llm/Step Bar.md +292 -0
  93. package/docs-llm/Switch.md +268 -0
  94. package/docs-llm/Tab Bar.md +439 -0
  95. package/docs-llm/Tab Layout.md +398 -0
  96. package/docs-llm/Table.md +2642 -0
  97. package/docs-llm/Text Area.md +253 -0
  98. package/docs-llm/Text.md +339 -0
  99. package/docs-llm/Tooltip.md +325 -0
  100. package/docs-llm/Transition Open.md +406 -0
  101. package/docs-llm/Tree.md +586 -0
  102. package/docs-llm/Typography.md +125 -0
  103. package/docs-llm/Wait Spinner.md +121 -0
  104. package/docs-llm/llms.txt +97 -0
  105. package/package.json +6 -5
  106. package/types/src/Box/Box.d.ts +2 -10
  107. package/types/src/Drawer/Body.d.ts +17 -0
  108. package/types/src/Drawer/Drawer.d.ts +114 -0
  109. package/types/src/Drawer/DrawerContext.d.ts +11 -0
  110. package/types/src/Drawer/Footer.d.ts +25 -0
  111. package/types/src/Drawer/Header.d.ts +41 -0
  112. package/types/src/Drawer/docs/examples/Basic.d.ts +6 -0
  113. package/types/src/Drawer/docs/examples/ContainerPosition.d.ts +7 -0
  114. package/types/src/Drawer/docs/examples/InitialFocus.d.ts +9 -0
  115. package/types/src/Drawer/docs/examples/InlinePosition.d.ts +7 -0
  116. package/types/src/Drawer/docs/examples/PagePosition.d.ts +7 -0
  117. package/types/src/Drawer/index.d.ts +2 -0
  118. package/types/src/JSONTree/JSONTree.d.ts +12 -5
  119. package/types/src/JSONTree/renderTreeItems.d.ts +2 -1
  120. package/types/src/Menu/Item.d.ts +2 -1
  121. package/types/src/Menu/docs/examples/SelectableCheckbox.d.ts +7 -0
  122. package/types/src/Modal/Modal.d.ts +1 -2
  123. package/types/src/Select/Option.d.ts +6 -3
  124. package/types/src/Select/Select.d.ts +8 -5
  125. package/types/src/Select/docs/examples/Dimmed.d.ts +7 -0
  126. package/types/src/SelectBase/OptionBase.d.ts +6 -3
  127. package/types/src/SelectBase/SelectBase.d.ts +8 -3
  128. package/types/src/SidePanel/SidePanel.d.ts +43 -2
  129. package/types/src/SidePanel/docs/examples/DockLayout.d.ts +17 -0
  130. package/types/src/SidePanel/docs/examples/InitialFocus.d.ts +9 -0
  131. package/types/src/TransitionOpen/TransitionOpen.d.ts +29 -4
  132. package/types/src/useKeyPress/index.d.ts +9 -2
  133. package/types/src/useOnClickOutside/index.d.ts +2 -0
  134. package/types/src/useOnClickOutside/useOnClickOutside.d.ts +4 -0
  135. package/useKeyPress.js +23 -18
  136. package/useOnClickOutside.d.ts +2 -0
  137. package/useOnClickOutside.js +79 -0
  138. package/types/src/RadioList/docs/examples/Row.d.ts +0 -6
@@ -0,0 +1,735 @@
1
+ # Menu
2
+
3
+ ## Examples
4
+
5
+
6
+ ### Basic
7
+
8
+ ```typescript
9
+ import React from 'react';
10
+
11
+ import Menu from '@splunk/react-ui/Menu';
12
+
13
+
14
+ function Basic() {
15
+ return (
16
+ <Menu style={{ width: 300 }}>
17
+ <Menu.Item>Line Chart</Menu.Item>
18
+ <Menu.Item>Area Chart</Menu.Item>
19
+ <Menu.Item>Column Chart</Menu.Item>
20
+ <Menu.Item>Bar Chart</Menu.Item>
21
+ <Menu.Item>Pie Chart</Menu.Item>
22
+ <Menu.Item>Scatter Chart</Menu.Item>
23
+ <Menu.Item>Bubble Chart</Menu.Item>
24
+ </Menu>
25
+ );
26
+ }
27
+
28
+ export default Basic;
29
+ ```
30
+
31
+
32
+
33
+ ### Adornments
34
+
35
+ A startAdornment and/or endAdornment can be added to a Menu.Item. Adornments should be decorative.
36
+
37
+ ```typescript
38
+ import React from 'react';
39
+
40
+ import ChartArea from '@splunk/react-icons/ChartArea';
41
+ import ChartBar from '@splunk/react-icons/ChartBar';
42
+ import ChartBubble from '@splunk/react-icons/ChartBubble';
43
+ import ChartColumn from '@splunk/react-icons/ChartColumn';
44
+ import ChartLine from '@splunk/react-icons/ChartLine';
45
+ import ChartPie from '@splunk/react-icons/ChartPie';
46
+ import ChartScatter from '@splunk/react-icons/ChartScatter';
47
+ import Menu from '@splunk/react-ui/Menu';
48
+
49
+
50
+ function Adornments() {
51
+ return (
52
+ <Menu focusMode="roving" style={{ width: 300 }}>
53
+ <Menu.Item startAdornment={<ChartLine />}>Line Chart</Menu.Item>
54
+ <Menu.Item startAdornment={<ChartArea />}>Area Chart</Menu.Item>
55
+ <Menu.Item startAdornment={<ChartColumn />}>Column Chart</Menu.Item>
56
+ <Menu.Item startAdornment={<ChartBar />}>Bar Chart</Menu.Item>
57
+ <Menu.Item startAdornment={<ChartPie />}>Pie Chart</Menu.Item>
58
+ <Menu.Item startAdornment={<ChartScatter />}>Scatter Chart</Menu.Item>
59
+ <Menu.Item endAdornment={<ChartBubble />}>Bubble Chart</Menu.Item>
60
+ </Menu>
61
+ );
62
+ }
63
+
64
+ export default Adornments;
65
+ ```
66
+
67
+
68
+
69
+ ### Links
70
+
71
+ Menu.Items can contain links by including a to attribute.
72
+
73
+ ```typescript
74
+ import React from 'react';
75
+
76
+ import Menu from '@splunk/react-ui/Menu';
77
+
78
+
79
+ function Links() {
80
+ return (
81
+ <Menu style={{ width: 300 }}>
82
+ <Menu.Item to="Overview">Overview</Menu.Item>
83
+ <Menu.Item to="https://duckduckgo.com" openInNewContext>
84
+ Duck Duck Go
85
+ </Menu.Item>
86
+ </Menu>
87
+ );
88
+ }
89
+
90
+ export default Links;
91
+ ```
92
+
93
+
94
+
95
+ ### Descriptions
96
+
97
+ Descriptions can be placed below or to the right of the label. Defaults to descriptionPosition="bottom".
98
+
99
+ ```typescript
100
+ import React from 'react';
101
+
102
+ import Menu from '@splunk/react-ui/Menu';
103
+
104
+
105
+ function Descriptions() {
106
+ return (
107
+ <Menu style={{ width: 300 }}>
108
+ <Menu.Item description="Recommended" descriptionPosition="right">
109
+ Statistics
110
+ </Menu.Item>
111
+ <Menu.Divider />
112
+ <Menu.Item description="A map with overlaid circles">Cluster Map</Menu.Item>
113
+ <Menu.Item description="A map with colored regions">Choropleth Map</Menu.Item>
114
+ </Menu>
115
+ );
116
+ }
117
+
118
+ export default Descriptions;
119
+ ```
120
+
121
+
122
+
123
+ ### Headings
124
+
125
+ Menus can have headings to summarize the following items.
126
+
127
+ ```typescript
128
+ import React from 'react';
129
+
130
+ import Menu from '@splunk/react-ui/Menu';
131
+
132
+
133
+ function Headings() {
134
+ return (
135
+ <Menu style={{ width: 300 }}>
136
+ <Menu.Heading title>Reports</Menu.Heading>
137
+ <Menu.Divider />
138
+ <Menu.Item>Events</Menu.Item>
139
+ <Menu.Item>Statistics Table</Menu.Item>
140
+ <Menu.Heading>Chart</Menu.Heading>
141
+ <Menu.Item>Line Chart</Menu.Item>
142
+ <Menu.Item>Area Chart</Menu.Item>
143
+ <Menu.Item>Column Chart</Menu.Item>
144
+ <Menu.Item>Bar Chart</Menu.Item>
145
+ <Menu.Item>Pie Chart</Menu.Item>
146
+ <Menu.Item>Scatter Chart</Menu.Item>
147
+ <Menu.Item>Bubble Chart</Menu.Item>
148
+ <Menu.Heading>Value</Menu.Heading>
149
+ <Menu.Item>Single Value</Menu.Item>
150
+ <Menu.Item>Radial Gauge</Menu.Item>
151
+ <Menu.Item>Filler Gauge</Menu.Item>
152
+ <Menu.Item>Marker Gauge</Menu.Item>
153
+ <Menu.Heading>Map</Menu.Heading>
154
+ <Menu.Item>Cluster Map</Menu.Item>
155
+ <Menu.Item>Choropleth Map</Menu.Item>
156
+ </Menu>
157
+ );
158
+ }
159
+
160
+ export default Headings;
161
+ ```
162
+
163
+
164
+
165
+ ### Dividers
166
+
167
+ ```typescript
168
+ import React from 'react';
169
+
170
+ import Menu from '@splunk/react-ui/Menu';
171
+
172
+
173
+ function Dividers() {
174
+ return (
175
+ <Menu style={{ width: 300 }}>
176
+ <Menu.Item>Events</Menu.Item>
177
+ <Menu.Item>Statistics Table</Menu.Item>
178
+ <Menu.Divider />
179
+ <Menu.Item>Line Chart</Menu.Item>
180
+ <Menu.Item>Area Chart</Menu.Item>
181
+ <Menu.Item>Column Chart</Menu.Item>
182
+ <Menu.Item>Bar Chart</Menu.Item>
183
+ <Menu.Item>Pie Chart</Menu.Item>
184
+ <Menu.Item>Scatter Chart</Menu.Item>
185
+ <Menu.Item>Bubble Chart</Menu.Item>
186
+ <Menu.Divider />
187
+ <Menu.Item>Single Value</Menu.Item>
188
+ <Menu.Item>Radial Gauge</Menu.Item>
189
+ <Menu.Item>Filler Gauge</Menu.Item>
190
+ <Menu.Item>Marker Gauge</Menu.Item>
191
+ <Menu.Divider />
192
+ <Menu.Item>Cluster Map</Menu.Item>
193
+ <Menu.Item>Choropleth Map</Menu.Item>
194
+ </Menu>
195
+ );
196
+ }
197
+
198
+ export default Dividers;
199
+ ```
200
+
201
+
202
+
203
+ ### Selectable and Selected
204
+
205
+ Items can be selected or selectable, which ensures space is reserved for the checkmark.
206
+
207
+ ```typescript
208
+ import React from 'react';
209
+
210
+ import Menu from '@splunk/react-ui/Menu';
211
+
212
+
213
+ function Selectable() {
214
+ return (
215
+ <Menu style={{ width: 300 }}>
216
+ <Menu.Item selectable>Line Chart</Menu.Item>
217
+ <Menu.Item selectable selected>
218
+ Area Chart
219
+ </Menu.Item>
220
+ <Menu.Item selectable>Column Chart</Menu.Item>
221
+ <Menu.Item selectable>Bar Chart</Menu.Item>
222
+ <Menu.Item selectable>Pie Chart</Menu.Item>
223
+ <Menu.Item selectable>Scatter Chart</Menu.Item>
224
+ <Menu.Item selectable>Bubble Chart</Menu.Item>
225
+ </Menu>
226
+ );
227
+ }
228
+
229
+ export default Selectable;
230
+ ```
231
+
232
+
233
+
234
+ ### Selectable and Selected Checkboxes
235
+
236
+ A Menu.Item's selected indicator can appear as a checkmark (default) or a checkbox with the `selectableAppearance` prop. Use a checkmark when only one Item can be selected, and a checkbox when multiple can be selected.
237
+
238
+ ```typescript
239
+ import React from 'react';
240
+
241
+ import Menu from '@splunk/react-ui/Menu';
242
+
243
+
244
+
245
+ function SelectableCheckbox() {
246
+ return (
247
+ <Menu style={{ width: 300 }}>
248
+ <Menu.Item selectableAppearance="checkbox" selectable selected>
249
+ Line Chart
250
+ </Menu.Item>
251
+ <Menu.Item selectableAppearance="checkbox" selectable selected>
252
+ Area Chart
253
+ </Menu.Item>
254
+ <Menu.Item selectableAppearance="checkbox" selectable selected>
255
+ Column Chart
256
+ </Menu.Item>
257
+ <Menu.Item selectableAppearance="checkbox" selectable>
258
+ Bar Chart
259
+ </Menu.Item>
260
+ <Menu.Item selectableAppearance="checkbox" selectable>
261
+ Pie Chart
262
+ </Menu.Item>
263
+ <Menu.Item selectableAppearance="checkbox" selectable>
264
+ Scatter Chart
265
+ </Menu.Item>
266
+ <Menu.Item selectableAppearance="checkbox" selectable>
267
+ Bubble Chart
268
+ </Menu.Item>
269
+ </Menu>
270
+ );
271
+ }
272
+
273
+ export default SelectableCheckbox;
274
+ ```
275
+
276
+
277
+
278
+ ### Selectable and Selected with Adornments
279
+
280
+ Items with adornments can be selected or selectable.
281
+
282
+ ```typescript
283
+ import React from 'react';
284
+
285
+ import ChartArea from '@splunk/react-icons/ChartArea';
286
+ import ChartBar from '@splunk/react-icons/ChartBar';
287
+ import ChartBubble from '@splunk/react-icons/ChartBubble';
288
+ import ChartColumn from '@splunk/react-icons/ChartColumn';
289
+ import ChartLine from '@splunk/react-icons/ChartLine';
290
+ import ChartPie from '@splunk/react-icons/ChartPie';
291
+ import ChartScatter from '@splunk/react-icons/ChartScatter';
292
+ import Menu from '@splunk/react-ui/Menu';
293
+
294
+
295
+ function SelectableWithAdornments() {
296
+ return (
297
+ <Menu style={{ width: 300 }}>
298
+ <Menu.Item selectable startAdornment={<ChartLine />}>
299
+ Line Chart
300
+ </Menu.Item>
301
+ <Menu.Item selectable selected startAdornment={<ChartArea />}>
302
+ Area Chart
303
+ </Menu.Item>
304
+ <Menu.Item selectable startAdornment={<ChartColumn />}>
305
+ Column Chart
306
+ </Menu.Item>
307
+ <Menu.Item selectable startAdornment={<ChartBar />}>
308
+ Bar Chart
309
+ </Menu.Item>
310
+ <Menu.Item selectable startAdornment={<ChartPie />}>
311
+ Pie Chart
312
+ </Menu.Item>
313
+ <Menu.Item selectable startAdornment={<ChartScatter />}>
314
+ Scatter Chart
315
+ </Menu.Item>
316
+ <Menu.Item selectable startAdornment={<ChartBubble />}>
317
+ Bubble Chart
318
+ </Menu.Item>
319
+ </Menu>
320
+ );
321
+ }
322
+
323
+ export default SelectableWithAdornments;
324
+ ```
325
+
326
+
327
+
328
+ ### Truncation
329
+
330
+ Labels that are too long can be optionally constrained to one line and truncated.
331
+
332
+ ```typescript
333
+ import React from 'react';
334
+
335
+ import Menu from '@splunk/react-ui/Menu';
336
+
337
+
338
+ function Truncate() {
339
+ const longLabel = 'A very long label truncation truncation truncation truncation truncation';
340
+
341
+ return (
342
+ <Menu style={{ maxWidth: 200 }}>
343
+ <Menu.Item truncate>{longLabel}</Menu.Item>
344
+ <Menu.Item truncate>{longLabel}</Menu.Item>
345
+ <Menu.Item>{longLabel}</Menu.Item>
346
+ <Menu.Item>{longLabel}</Menu.Item>
347
+ <Menu.Item>
348
+ aVeryLongLabelWordWordWordWordWordWordWordWordWordWordWordWordWord
349
+ </Menu.Item>
350
+ </Menu>
351
+ );
352
+ }
353
+
354
+ export default Truncate;
355
+ ```
356
+
357
+
358
+
359
+ ### Dimmed
360
+
361
+ Rendering a 'dimmed' Menu Item ensures the Menu Item is still discoverable and can receive focus, but the Menu Item cannot not be activated by the user.
362
+
363
+ ```typescript
364
+ import React from 'react';
365
+
366
+ import ChartArea from '@splunk/react-icons/ChartArea';
367
+ import ChartColumn from '@splunk/react-icons/ChartColumn';
368
+ import ChartLine from '@splunk/react-icons/ChartLine';
369
+ import Table from '@splunk/react-icons/Table';
370
+ import Menu from '@splunk/react-ui/Menu';
371
+
372
+
373
+ function Dimmed() {
374
+ return (
375
+ <Menu style={{ width: 300 }}>
376
+ <Menu.Item
377
+ startAdornment={<Table />}
378
+ selectable
379
+ description="Recommended"
380
+ descriptionPosition="right"
381
+ disabled
382
+ >
383
+ Statistics Table
384
+ </Menu.Item>
385
+ <Menu.Divider />
386
+ <Menu.Item startAdornment={<ChartLine />} selectable disabled>
387
+ Line Chart
388
+ </Menu.Item>
389
+ <Menu.Item startAdornment={<ChartArea />} selectable>
390
+ Area Chart
391
+ </Menu.Item>
392
+ <Menu.Item startAdornment={<ChartColumn />} selectable disabled>
393
+ Column Chart
394
+ </Menu.Item>
395
+ </Menu>
396
+ );
397
+ }
398
+
399
+ export default Dimmed;
400
+ ```
401
+
402
+
403
+
404
+ ### Disabled
405
+
406
+ Consider using a 'dimmed' Menu Item. Disabling Menu Items creates barriers for all users and can exclude people with disabilities. If necessary, a Menu Item can be completely disabled by setting disabled='disabled'. In these cases, consider contacting us to collaborate on alternatives for a more inclusive experience.
407
+
408
+ ```typescript
409
+ import React from 'react';
410
+
411
+ import ChartArea from '@splunk/react-icons/ChartArea';
412
+ import ChartBar from '@splunk/react-icons/ChartBar';
413
+ import ChartBubble from '@splunk/react-icons/ChartBubble';
414
+ import ChartColumn from '@splunk/react-icons/ChartColumn';
415
+ import ChartLine from '@splunk/react-icons/ChartLine';
416
+ import ChartPie from '@splunk/react-icons/ChartPie';
417
+ import ChartScatter from '@splunk/react-icons/ChartScatter';
418
+ import Table from '@splunk/react-icons/Table';
419
+ import Menu from '@splunk/react-ui/Menu';
420
+
421
+
422
+ function Disabled() {
423
+ return (
424
+ <Menu style={{ width: 300 }}>
425
+ <Menu.Item
426
+ startAdornment={<Table />}
427
+ selectable
428
+ description="Recommended"
429
+ descriptionPosition="right"
430
+ disabled="disabled"
431
+ >
432
+ Statistics Table
433
+ </Menu.Item>
434
+ <Menu.Divider />
435
+ <Menu.Item startAdornment={<ChartLine />} selectable>
436
+ Line Chart
437
+ </Menu.Item>
438
+ <Menu.Item startAdornment={<ChartArea />} selectable disabled="disabled">
439
+ Area Chart
440
+ </Menu.Item>
441
+ <Menu.Item startAdornment={<ChartColumn />} selectable>
442
+ Column Chart
443
+ </Menu.Item>
444
+ <Menu.Item startAdornment={<ChartBar />} selectable>
445
+ Bar Chart
446
+ </Menu.Item>
447
+ <Menu.Item startAdornment={<ChartPie />} selectable disabled="disabled">
448
+ Pie Chart
449
+ </Menu.Item>
450
+ <Menu.Item startAdornment={<ChartScatter />} selectable disabled="disabled">
451
+ Scatter Chart
452
+ </Menu.Item>
453
+ <Menu.Item startAdornment={<ChartBubble />} selectable disabled="disabled">
454
+ Bubble Chart
455
+ </Menu.Item>
456
+ </Menu>
457
+ );
458
+ }
459
+
460
+ export default Disabled;
461
+ ```
462
+
463
+
464
+
465
+ ### Complex
466
+
467
+ All the options can be used together. Additional props, such as hasSubmenu, are detailed in the following example.
468
+
469
+ ```typescript
470
+ import React from 'react';
471
+
472
+ import ChartArea from '@splunk/react-icons/ChartArea';
473
+ import ChartBar from '@splunk/react-icons/ChartBar';
474
+ import ChartBubble from '@splunk/react-icons/ChartBubble';
475
+ import ChartChoroplethMap from '@splunk/react-icons/ChartChoroplethMap';
476
+ import ChartColumn from '@splunk/react-icons/ChartColumn';
477
+ import ChartGantt from '@splunk/react-icons/ChartGantt';
478
+ import ChartGaugeRadial from '@splunk/react-icons/ChartGauge';
479
+ import ChartGaugeFiller from '@splunk/react-icons/ChartGaugeFiller';
480
+ import ChartGaugeMarker from '@splunk/react-icons/ChartGaugeMarker';
481
+ import ChartLine from '@splunk/react-icons/ChartLine';
482
+ import ChartPie from '@splunk/react-icons/ChartPie';
483
+ import ChartSankey from '@splunk/react-icons/ChartSankey';
484
+ import ChartScatter from '@splunk/react-icons/ChartScatter';
485
+ import ChartSingleValue from '@splunk/react-icons/ChartSingleValue';
486
+ import ChevronLeft from '@splunk/react-icons/ChevronLeft';
487
+ import Menu from '@splunk/react-ui/Menu';
488
+ import SlidingPanels from '@splunk/react-ui/SlidingPanels';
489
+
490
+
491
+ function Complex() {
492
+ const [transition, setTransition] = React.useState<'forward' | 'backward' | undefined>(
493
+ 'forward'
494
+ );
495
+ const [activePanelId, setActivePanelId] = React.useState('one');
496
+
497
+ const goBackward = () => {
498
+ setActivePanelId(activePanelId === 'one' ? 'two' : 'one');
499
+ setTransition('backward');
500
+ };
501
+
502
+ const goForward = () => {
503
+ setActivePanelId(activePanelId === 'one' ? 'two' : 'one');
504
+ setTransition('forward');
505
+ };
506
+
507
+ return (
508
+ <SlidingPanels activePanelId={activePanelId} transition={transition} style={{ width: 300 }}>
509
+ <SlidingPanels.Panel key="one" panelId="one">
510
+ <Menu>
511
+ <Menu.Item selectable description="Recommended" descriptionPosition="right">
512
+ Chart Types
513
+ </Menu.Item>
514
+ <Menu.Divider />
515
+ <Menu.Item startAdornment={<ChartLine />} selectable>
516
+ Line Chart
517
+ </Menu.Item>
518
+ <Menu.Item startAdornment={<ChartArea />} selectable>
519
+ Area Chart
520
+ </Menu.Item>
521
+ <Menu.Item startAdornment={<ChartColumn />} selectable>
522
+ Column Chart
523
+ </Menu.Item>
524
+ <Menu.Item startAdornment={<ChartBar />} selectable>
525
+ Bar Chart
526
+ </Menu.Item>
527
+ <Menu.Item startAdornment={<ChartPie />} selectable>
528
+ Pie Chart
529
+ </Menu.Item>
530
+ <Menu.Item startAdornment={<ChartScatter />} selectable>
531
+ Scatter Chart
532
+ </Menu.Item>
533
+ <Menu.Item startAdornment={<ChartBubble />} selectable>
534
+ Bubble Chart
535
+ </Menu.Item>
536
+ <Menu.Divider />
537
+ <Menu.Item hasSubmenu onClick={goForward}>
538
+ More
539
+ </Menu.Item>
540
+ </Menu>
541
+ </SlidingPanels.Panel>
542
+ <SlidingPanels.Panel key="two" panelId="two">
543
+ <Menu>
544
+ <Menu.Item startAdornment={<ChevronLeft />} onClick={goBackward}>
545
+ Back
546
+ </Menu.Item>
547
+ <Menu.Divider />
548
+ <Menu.Item startAdornment={<ChartGantt />}>Gantt Chart</Menu.Item>
549
+ <Menu.Item startAdornment={<ChartSankey />}>Sankey Chart</Menu.Item>
550
+ <Menu.Item startAdornment={<ChartChoroplethMap />}>Choropleth Map</Menu.Item>
551
+ <Menu.Item startAdornment={<ChartGaugeRadial />}>Radial Gauge</Menu.Item>
552
+ <Menu.Item startAdornment={<ChartGaugeFiller />}>Filler Gauge</Menu.Item>
553
+ <Menu.Item startAdornment={<ChartGaugeMarker />}>Marker Gauge</Menu.Item>
554
+ <Menu.Item startAdornment={<ChartSingleValue />}>Single Value</Menu.Item>
555
+ </Menu>
556
+ </SlidingPanels.Panel>
557
+ </SlidingPanels>
558
+ );
559
+ }
560
+
561
+ export default Complex;
562
+ ```
563
+
564
+
565
+
566
+ ### Match Ranges
567
+
568
+ Menu.Item can highlight portions of the label as matching a filter or search.
569
+
570
+ ```typescript
571
+ import React from 'react';
572
+
573
+ import Menu from '@splunk/react-ui/Menu';
574
+
575
+
576
+ function MatchRanges() {
577
+ return (
578
+ <Menu style={{ width: 300 }}>
579
+ <Menu.Item matchRanges={[{ start: 5, end: 10 }]}>Line Chart</Menu.Item>
580
+ <Menu.Item matchRanges={[{ start: 5, end: 10 }]}>Area Chart</Menu.Item>
581
+ <Menu.Item
582
+ matchRanges={[
583
+ { start: 2, end: 5 },
584
+ { start: 7, end: 12 },
585
+ ]}
586
+ >
587
+ Column Chart
588
+ </Menu.Item>
589
+ <Menu.Item matchRanges={[{ start: 4, end: 9 }]}>Bar Chart</Menu.Item>
590
+ <Menu.Item matchRanges={[{ start: 4, end: 9 }]}>Pie Chart</Menu.Item>
591
+ <Menu.Item matchRanges={[{ start: 8, end: 13 }]}>Scatter Chart</Menu.Item>
592
+ <Menu.Item matchRanges={[{ start: 7, end: 12 }]}>Bubble Chart</Menu.Item>
593
+ </Menu>
594
+ );
595
+ }
596
+
597
+ export default MatchRanges;
598
+ ```
599
+
600
+
601
+
602
+
603
+ ## API
604
+
605
+
606
+ ### Menu API
607
+
608
+ #### Props
609
+
610
+ | Name | Type | Required | Default | Description |
611
+ |------|------|------|------|------|
612
+ | children | React.ReactNode | no | | Must be `Menu.Item`, `Menu.Heading`, or `Menu.Divider`. Interactive elements are not supported as children. |
613
+ | elementRef | React.Ref<HTMLDivElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. |
614
+ | focusMode | 'never' \| 'normal' \| 'roving' | no | 'roving' | Specifies whether the menu accept/retain focus and how the focus behaves. - `never`: `Menu` will never take focus, and the Menu.Item will not have a focus-like appearance. - `normal`: `Menu` and its children follow the normal focus order of DOM without any interference. - `roving`: Single tab stop. Use up/down arrow keys to navigate and loop through Menu.Items. |
615
+ | stopScrollPropagation | boolean | no | | Prevents scrolling from propagating to the parent containers when the top or bottom of the `Menu` is reached. |
616
+
617
+
618
+
619
+ ### Menu.Item API
620
+
621
+ #### Props
622
+
623
+ | Name | Type | Required | Default | Description |
624
+ |------|------|------|------|------|
625
+ | active | boolean | no | | Active shows a temporarily selected state, similar to that of focus. This is used when filtering the `Menu` items in Multiselect, Select, and ComboBox and when navigating with arrows. |
626
+ | children | React.ReactNode | no | | Becomes the label. Must be a string if using `matchRanges`. |
627
+ | description | string | no | | Additional information to explain the option. |
628
+ | descriptionPosition | 'right' \| 'bottom' | no | 'bottom' | The description text might appear to the right of the label or under the label. |
629
+ | disabled | boolean \| 'dimmed' \| 'disabled' | no | | Prevents user interaction and adds disabled styling. If set to `dimmed`, the component is able to be focused, and is more easily located. If set to `disabled`, the disabled attribute is set which makes the component unable to be focused and more difficult to locate. The default behavior when `disabled={true}` is `dimmed`. |
630
+ | elementRef | React.Ref<HTMLAnchorElement \| HTMLButtonElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. |
631
+ | endAdornment | React.ReactNode | no | | Adornment after the label. |
632
+ | hasSubmenu | boolean | no | | Adds an icon to the right to show that there is a submenu. To implement submenus, use the `SlidingPanels` component. |
633
+ | matchRanges | { start: number; end: number }[] | no | | Sections of the label string to highlight as a match. |
634
+ | onClick | React.MouseEventHandler<HTMLAnchorElement \| HTMLButtonElement> | no | | Callback for click events. |
635
+ | openInNewContext | boolean \| string | no | | Open the "to" link in a new context, which is usually a new tab or window based on browser settings. An icon and a screen reader message is added to indicate this behavior to users. The default message is "(Opens new window)"; this can be customized by passing a string instead of boolean to `openInNewContext`. |
636
+ | role | 'menuitem' \| 'menuitemradio' \| 'menuitemcheckbox' \| 'listboxitem' \| 'link' \| 'option' | no | | The default role is inferred from the other props. `selectable` with a `selectableAppearance` of 'checkmark' defaults to `menuitemradio`. `selectable` with a `selectableAppearance` of 'checkbox' defaults to `menuitemcheckbox`. Otherwise, the role defaults to `menuitem`. |
637
+ | selectable | boolean | no | | Enables selection for this item and reserves space for the control. Required when using `selected` or `selectableAppearance`. |
638
+ | selectableAppearance | 'checkmark' \| 'checkbox' | no | 'checkmark' | Specifies the type of selection control to display when `selectable` is enabled. Use `'checkmark'` for single-select menus and `'checkbox'` for multi-select menus. |
639
+ | selected | boolean \| 'some' | no | | Controls the selection state of the item. The selection control (checkmark or checkbox) is only rendered when `selectable` is enabled. When `selectableAppearance = 'checkmark'`: - `true` shows a checkmark. When `selectableAppearance = 'checkbox'`: - `true` renders a checked box. - `'some'` renders an indeterminate box (`aria-checked="mixed"`). - `false` renders an unchecked box. |
640
+ | startAdornment | React.ReactNode | no | | Adornment in front of the label. |
641
+ | to | string | no | | The URL or path to link to. |
642
+ | truncate | boolean | no | | When `true`, wrapping is disabled and any additional text is truncated using an ellipsis. A `Tooltip` will render so users can see the full text on hover. |
643
+
644
+
645
+
646
+ ### Menu.Heading API
647
+
648
+ A non-interactive `Menu` item used to separate and label groups of `Menu` items.
649
+
650
+ #### Props
651
+
652
+ | Name | Type | Required | Default | Description |
653
+ |------|------|------|------|------|
654
+ | children | React.ReactNode | no | | |
655
+ | outerStyle | React.CSSProperties | no | | |
656
+ | title | boolean | no | | Renders this heading as a title to describe the whole `Menu`, which should only be enabled for the first heading in a `Menu`. |
657
+
658
+
659
+
660
+ ### Menu.Divider API
661
+
662
+ A non-interactive menu item used to visually separate groups of items in the menu.
663
+
664
+
665
+
666
+ ## Accessibility
667
+
668
+ > Flyouts and multi-stage menus are NOT supported by the design system.
669
+
670
+ ## Menu
671
+ ### Visual Design
672
+ - Color contrast ratio **MUST** be:
673
+ - &gt= 4.5:1 for text to background-color [SC 1.4.3][1]
674
+ - &gt= 3:1 checkmark in selected [SC 1.4.11][2]
675
+ - Empty `alt-text("")` **MUST** be present for adornments and avatars in a menu, as these are decorative [SC 1.1.1][3]
676
+
677
+ ### Content
678
+ - Content **MAY** be ~60-85 characters per line for alphabetic scripts
679
+
680
+ ### States
681
+ - Color contrast guidelines do NOT apply to disabled list items
682
+
683
+ ### Interaction Design
684
+ - **MUST** have a visible focus border [SC 2.4.7][4]
685
+ - **MUST** have keyboard navigation based on what's in menu [SC 2.1][5]
686
+ - Links (navigation):
687
+ - <kbd>Enter</kbd> **and** <kbd>Space</kbd>: direct user to new page
688
+ - <kbd>Up</kbd>/<kbd>Down</kbd>: cycle through menu items
689
+ - Selection:
690
+ - <kbd>Enter</kbd> **and** <kbd>Space</kbd>: select menu items
691
+ - <kbd>Tab</kbd> and <kbd>Shift</kbd> + <kbd>Tab</kbd>: cycle through menu items
692
+ - <kbd>Esc</kbd>: close menu and return to parent element
693
+
694
+ ### Implementation
695
+ - If menu uses separators and/or headings, developer **MUST** build a common component that flexes between separator and heading
696
+ - No headings allow separator to act on its own
697
+ - Headings allow screen reader to skip separator and announce heading
698
+ - Screen Reader **SHOULD** announce:
699
+ - Upon entering menu how many items are in the menu(1 of n)
700
+ - When menu is loading
701
+ - Screen Reader **SHOULD NOT** register these elements in list item count:
702
+ - Dividers
703
+ - Headers
704
+ - Any non-interactive element
705
+ - To prevent confustion between ellipses and "more" button, menu component **SHOULD** use wrap instead of truncating text
706
+ - If a menu is part of a dialog or pop-up, trapping and inerting behavior **MUST** be observed to prevent keyboard traps [SC 2.1.2][6]
707
+
708
+ [1]: https://www.w3.org/TR/WCAG21/#contrast-minimum
709
+ [2]: https://www.w3.org/TR/WCAG21/#non-text-contrast
710
+ [3]: https://www.w3.org/TR/WCAG21/#non-text-content
711
+ [4]: https://www.w3.org/TR/WCAG21/#focus-visible
712
+ [5]: https://www.w3.org/TR/WCAG21/#keyboard-accessible
713
+ [6]: https://www.w3.org/TR/WCAG21/#no-keyboard-trap
714
+
715
+
716
+ ## Menu Divider
717
+
718
+ ### Visual Design
719
+
720
+ - Dividers do not need to follow any color contrast guidelines
721
+
722
+ ### Interaction Model
723
+
724
+ - **Designers should determine functionality for engineering to implement.**
725
+ - Horizontal Rule: An HTML semantic `<hr>` used for long prose or documentation.
726
+ - Visual Separator: use `aria-hidden`
727
+ - Functional Separator: should be in the a11y tree and skipped when keyboard-only
728
+
729
+ ### Implementation
730
+
731
+ - All dividers **SHOULD NOT** be counted towards the number of items in lists or menus and should not be announced by screen readers.
732
+ This is to prevent misinformation for screen reader users of what is interactive and what isn't.
733
+ - Must have `role="separator"`
734
+
735
+