@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,406 @@
1
+ # Transition Open
2
+
3
+ ## Examples
4
+
5
+
6
+ ### Slide from Top
7
+
8
+ Transition Open content sliding in from the top.
9
+
10
+ ```typescript
11
+ import React, { useCallback, useState } from 'react';
12
+
13
+ import Button from '@splunk/react-ui/Button';
14
+ import TransitionOpen from '@splunk/react-ui/TransitionOpen';
15
+
16
+
17
+ function SlideFromTop() {
18
+ const [open, setOpen] = useState(false);
19
+ const handleClick = useCallback(() => {
20
+ setOpen((isOpen) => !isOpen);
21
+ }, []);
22
+
23
+ const style: React.CSSProperties = {
24
+ border: '1px solid black',
25
+ textAlign: 'center',
26
+ width: 150,
27
+ };
28
+
29
+ // Container and outer styles allow for inset animations
30
+ const containerStyle: React.CSSProperties = {
31
+ border: '1px solid black',
32
+ height: 228,
33
+ marginTop: 10,
34
+ position: 'relative',
35
+ };
36
+ const outerStyle: React.CSSProperties = {
37
+ position: 'absolute',
38
+ top: 0,
39
+ };
40
+
41
+ return (
42
+ <>
43
+ <Button onClick={handleClick}>Click me!</Button>
44
+ <div style={containerStyle}>
45
+ <TransitionOpen animation="slideFromTop" open={open} outerStyle={outerStyle}>
46
+ <div style={style}>
47
+ <p>Hello world</p>
48
+ <p>Hello world</p>
49
+ <p>Hello world</p>
50
+ <p>Hello world</p>
51
+ <p>Hello world</p>
52
+ </div>
53
+ </TransitionOpen>
54
+ </div>
55
+ </>
56
+ );
57
+ }
58
+
59
+ export default SlideFromTop;
60
+ ```
61
+
62
+
63
+
64
+ ### Slide from Bottom
65
+
66
+ Transition Open content sliding in from the bottom.
67
+
68
+ ```typescript
69
+ import React, { useCallback, useState } from 'react';
70
+
71
+ import Button from '@splunk/react-ui/Button';
72
+ import TransitionOpen from '@splunk/react-ui/TransitionOpen';
73
+
74
+
75
+ function SlideFromBottom() {
76
+ const [open, setOpen] = useState(false);
77
+ const handleClick = useCallback(() => {
78
+ setOpen((isOpen) => !isOpen);
79
+ }, []);
80
+
81
+ const style: React.CSSProperties = {
82
+ border: '1px solid black',
83
+ textAlign: 'center',
84
+ width: 150,
85
+ };
86
+
87
+ // Container and outer styles allow for inset animations
88
+ const containerStyle: React.CSSProperties = {
89
+ border: '1px solid black',
90
+ height: 228,
91
+ marginTop: 10,
92
+ position: 'relative',
93
+ };
94
+ const outerStyle: React.CSSProperties = {
95
+ bottom: 0,
96
+ position: 'absolute',
97
+ };
98
+
99
+ return (
100
+ <>
101
+ <Button onClick={handleClick}>Click me!</Button>
102
+ <div style={containerStyle}>
103
+ <TransitionOpen animation="slideFromBottom" open={open} outerStyle={outerStyle}>
104
+ <div style={style}>
105
+ <p>Hello world</p>
106
+ <p>Hello world</p>
107
+ <p>Hello world</p>
108
+ <p>Hello world</p>
109
+ <p>Hello world</p>
110
+ </div>
111
+ </TransitionOpen>
112
+ </div>
113
+ </>
114
+ );
115
+ }
116
+
117
+ export default SlideFromBottom;
118
+ ```
119
+
120
+
121
+
122
+ ### Slide from Left
123
+
124
+ Transition Open content sliding in from the left.
125
+
126
+ ```typescript
127
+ import React, { useCallback, useState } from 'react';
128
+
129
+ import Button from '@splunk/react-ui/Button';
130
+ import TransitionOpen from '@splunk/react-ui/TransitionOpen';
131
+
132
+
133
+ function SlideFromLeft() {
134
+ const [open, setOpen] = useState(false);
135
+ const handleClick = useCallback(() => {
136
+ setOpen((isOpen) => !isOpen);
137
+ }, []);
138
+
139
+ const style: React.CSSProperties = {
140
+ border: '1px solid black',
141
+ textAlign: 'center',
142
+ width: 150,
143
+ };
144
+
145
+ // Container and outer styles allow for inset animations
146
+ const containerStyle: React.CSSProperties = {
147
+ border: '1px solid black',
148
+ height: 228,
149
+ marginTop: 10,
150
+ position: 'relative',
151
+ };
152
+ const outerStyle: React.CSSProperties = {
153
+ left: 0,
154
+ position: 'absolute',
155
+ };
156
+
157
+ return (
158
+ <>
159
+ <Button onClick={handleClick}>Click me!</Button>
160
+ <div style={containerStyle}>
161
+ <TransitionOpen animation="slideFromLeft" open={open} outerStyle={outerStyle}>
162
+ <div style={style}>
163
+ <p>Hello world</p>
164
+ <p>Hello world</p>
165
+ <p>Hello world</p>
166
+ <p>Hello world</p>
167
+ <p>Hello world</p>
168
+ </div>
169
+ </TransitionOpen>
170
+ </div>
171
+ </>
172
+ );
173
+ }
174
+
175
+ export default SlideFromLeft;
176
+ ```
177
+
178
+
179
+
180
+ ### Slide from Right
181
+
182
+ Transition Open content sliding in from the right.
183
+
184
+ ```typescript
185
+ import React, { useCallback, useState } from 'react';
186
+
187
+ import Button from '@splunk/react-ui/Button';
188
+ import TransitionOpen from '@splunk/react-ui/TransitionOpen';
189
+
190
+
191
+ function SlideFromRight() {
192
+ const [open, setOpen] = useState(false);
193
+ const handleClick = useCallback(() => {
194
+ setOpen((isOpen) => !isOpen);
195
+ }, []);
196
+
197
+ const style: React.CSSProperties = {
198
+ border: '1px solid black',
199
+ textAlign: 'center',
200
+ width: 150,
201
+ };
202
+
203
+ // Container and outer styles allow for inset animations
204
+ const containerStyle: React.CSSProperties = {
205
+ border: '1px solid black',
206
+ height: 228,
207
+ marginTop: 10,
208
+ position: 'relative',
209
+ };
210
+ const outerStyle: React.CSSProperties = {
211
+ position: 'absolute',
212
+ right: 0,
213
+ };
214
+
215
+ return (
216
+ <>
217
+ <Button onClick={handleClick}>Click me!</Button>
218
+ <div style={containerStyle}>
219
+ <TransitionOpen animation="slideFromRight" open={open} outerStyle={outerStyle}>
220
+ <div style={style}>
221
+ <p>Hello world</p>
222
+ <p>Hello world</p>
223
+ <p>Hello world</p>
224
+ <p>Hello world</p>
225
+ <p>Hello world</p>
226
+ </div>
227
+ </TransitionOpen>
228
+ </div>
229
+ </>
230
+ );
231
+ }
232
+
233
+ export default SlideFromRight;
234
+ ```
235
+
236
+
237
+
238
+ ### Expand Height
239
+
240
+ ```typescript
241
+ import React, { useCallback, useState } from 'react';
242
+
243
+ import Button from '@splunk/react-ui/Button';
244
+ import TransitionOpen from '@splunk/react-ui/TransitionOpen';
245
+
246
+
247
+ function ExpandHeight() {
248
+ const [open, setOpen] = useState(false);
249
+ const handleClick = useCallback(() => {
250
+ setOpen((isOpen) => !isOpen);
251
+ }, []);
252
+
253
+ const style: React.CSSProperties = {
254
+ border: '1px solid black',
255
+ marginTop: 10,
256
+ textAlign: 'center',
257
+ width: 150,
258
+ };
259
+ return (
260
+ <div>
261
+ <Button onClick={handleClick}>Click me!</Button>
262
+ <TransitionOpen animation="expandHeight" open={open}>
263
+ <div style={style}>
264
+ <p>Hello world</p>
265
+ <p>Hello world</p>
266
+ <p>Hello world</p>
267
+ <p>Hello world</p>
268
+ <p>Hello world</p>
269
+ </div>
270
+ </TransitionOpen>
271
+ </div>
272
+ );
273
+ }
274
+
275
+ export default ExpandHeight;
276
+ ```
277
+
278
+
279
+
280
+ ### Expand Width
281
+
282
+ ```typescript
283
+ import React, { useCallback, useState } from 'react';
284
+
285
+ import Button from '@splunk/react-ui/Button';
286
+ import TransitionOpen from '@splunk/react-ui/TransitionOpen';
287
+
288
+
289
+ function ExpandWidth() {
290
+ const [open, setOpen] = useState(false);
291
+ const handleClick = useCallback(() => {
292
+ setOpen((isOpen) => !isOpen);
293
+ }, []);
294
+
295
+ const style: React.CSSProperties = {
296
+ border: '1px solid black',
297
+ marginTop: 10,
298
+ textAlign: 'center',
299
+ width: 150,
300
+ };
301
+
302
+ return (
303
+ <div style={{ height: 228 }}>
304
+ <Button onClick={handleClick}>Click me!</Button>
305
+ <TransitionOpen animation="expandWidth" open={open}>
306
+ <div style={style}>
307
+ <p>Hello world</p>
308
+ <p>Hello world</p>
309
+ <p>Hello world</p>
310
+ <p>Hello world</p>
311
+ <p>Hello world</p>
312
+ </div>
313
+ </TransitionOpen>
314
+ </div>
315
+ );
316
+ }
317
+
318
+ export default ExpandWidth;
319
+ ```
320
+
321
+
322
+
323
+ ### None
324
+
325
+ Transition Open content appears with no animation.
326
+
327
+ ```typescript
328
+ import React, { useCallback, useState } from 'react';
329
+
330
+ import Button from '@splunk/react-ui/Button';
331
+ import TransitionOpen from '@splunk/react-ui/TransitionOpen';
332
+
333
+
334
+ function None() {
335
+ const [open, setOpen] = useState(false);
336
+ const handleClick = useCallback(() => {
337
+ setOpen((isOpen) => !isOpen);
338
+ }, []);
339
+
340
+ const style: React.CSSProperties = {
341
+ border: '1px solid black',
342
+ marginTop: 10,
343
+ textAlign: 'center',
344
+ width: 150,
345
+ };
346
+
347
+ return (
348
+ <div>
349
+ <Button onClick={handleClick}>Click me!</Button>
350
+ <TransitionOpen animation="none" open={open}>
351
+ <div style={style}>
352
+ <p>Hello world</p>
353
+ <p>Hello world</p>
354
+ <p>Hello world</p>
355
+ <p>Hello world</p>
356
+ <p>Hello world</p>
357
+ </div>
358
+ </TransitionOpen>
359
+ </div>
360
+ );
361
+ }
362
+
363
+ export default None;
364
+ ```
365
+
366
+
367
+
368
+
369
+ ## API
370
+
371
+
372
+ ### TransitionOpen API
373
+
374
+ #### Props
375
+
376
+ | Name | Type | Required | Default | Description |
377
+ |------|------|------|------|------|
378
+ | animateOnMount | boolean | no | | |
379
+ | animation | AnimationType \| AnimationOnOpen \| AnimationOnClose | no | 'expandHeight' | The animation to use when opening and closing. Can be: - A string (e.g., 'expandHeight') to animate both open and close - An object with `{ open: AnimationType, close: 'none' }` to animate only when opening - An object with `{ open: 'none', close: AnimationType }` to animate only when closing |
380
+ | children | React.ReactNode | no | | |
381
+ | elementRef | React.Ref<HTMLDivElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. |
382
+ | id | string | no | | The `id` of the inner container. |
383
+ | innerClassName | string | no | | An additional className to inner container. |
384
+ | innerStyle | React.CSSProperties | no | {} | |
385
+ | onAnimationEnd | () => void | no | | |
386
+ | onAnimationStart | () => void | no | | |
387
+ | open | boolean | no | | Whether the component is currently open or not. |
388
+ | outerClassName | string | no | | An additional className to outer container. |
389
+ | outerId | string | no | | The `id` of the outer container. |
390
+ | outerStyle | React.CSSProperties | no | {} | |
391
+ | renderChildrenWhenCollapsed | boolean | no | | When true, children are always rendered whether open or closed. |
392
+ | retainFocus | boolean | no | | Keep focus within `TransitionOpen` while open. |
393
+ | takeFocus | boolean | no | | When true, the `TransitionOpen` automatically takes focus when 'open' changes to true. |
394
+
395
+ #### Types
396
+
397
+ | Name | Type | Description |
398
+ |------|------|------|
399
+ | AnimationOnClose | { open: 'none'; close: AnimationType } | |
400
+ | AnimationOnOpen | { open: AnimationType; close: 'none' } | |
401
+ | AnimationType | \| 'slideFromTop' \| 'slideFromRight' \| 'slideFromBottom' \| 'slideFromLeft' \| 'expandHeight' \| 'expandWidth' \| 'none' | |
402
+
403
+
404
+
405
+
406
+