@splunk/react-ui 5.7.1 → 5.9.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 (152) hide show
  1. package/Accordion.js +6 -6
  2. package/Anchor.js +2 -1
  3. package/Box.js +83 -34
  4. package/CHANGELOG.md +51 -0
  5. package/Calendar.js +134 -134
  6. package/Clickable.js +131 -94
  7. package/CollapsiblePanel.js +175 -137
  8. package/ComboBox.js +32 -27
  9. package/ControlGroup.js +92 -91
  10. package/DefinitionList.js +9 -9
  11. package/Drawer.d.ts +2 -0
  12. package/Drawer.js +679 -0
  13. package/Dropdown.js +27 -18
  14. package/DualListbox.js +1 -1
  15. package/File.js +35 -35
  16. package/JSONTree.js +73 -72
  17. package/Link.js +2 -2
  18. package/MIGRATION.md +10 -0
  19. package/Menu.js +403 -261
  20. package/Modal.js +263 -252
  21. package/Monogram.js +2 -2
  22. package/Multiselect.js +551 -385
  23. package/Number.js +2 -1
  24. package/Paginator.js +14 -12
  25. package/Popover.js +4 -1
  26. package/README.md +11 -0
  27. package/RadioBar.js +1 -1
  28. package/Search.js +111 -95
  29. package/Select.js +42 -40
  30. package/SelectBase.js +819 -715
  31. package/SidePanel.js +346 -167
  32. package/SlidingPanels.js +11 -11
  33. package/StepBar.js +7 -7
  34. package/Switch.js +5 -5
  35. package/Table.js +116 -119
  36. package/Text.js +48 -48
  37. package/TextArea.js +7 -7
  38. package/TransitionOpen.js +188 -169
  39. package/docs-llm/Accordion.md +267 -0
  40. package/docs-llm/Anchor Menu.md +115 -0
  41. package/docs-llm/Anchor.md +54 -0
  42. package/docs-llm/AnimationToggle.md +254 -0
  43. package/docs-llm/Avatar.md +292 -0
  44. package/docs-llm/Badge.md +212 -0
  45. package/docs-llm/Breadcrumbs.md +306 -0
  46. package/docs-llm/Button Group.md +53 -0
  47. package/docs-llm/Button.md +361 -0
  48. package/docs-llm/Card Layout.md +286 -0
  49. package/docs-llm/Card.md +619 -0
  50. package/docs-llm/Checkbox.md +218 -0
  51. package/docs-llm/Chip.md +291 -0
  52. package/docs-llm/Clickable.md +160 -0
  53. package/docs-llm/Code.md +292 -0
  54. package/docs-llm/Collapsible Panel.md +744 -0
  55. package/docs-llm/Color.md +253 -0
  56. package/docs-llm/Column Layout.md +391 -0
  57. package/docs-llm/Combo Box.md +540 -0
  58. package/docs-llm/Control Group.md +594 -0
  59. package/docs-llm/Date.md +270 -0
  60. package/docs-llm/Definition List.md +278 -0
  61. package/docs-llm/Divider.md +216 -0
  62. package/docs-llm/Drawer.md +414 -0
  63. package/docs-llm/Dropdown.md +472 -0
  64. package/docs-llm/Dual Listbox.md +325 -0
  65. package/docs-llm/File.md +653 -0
  66. package/docs-llm/Form Rows.md +374 -0
  67. package/docs-llm/Heading.md +179 -0
  68. package/docs-llm/Image.md +109 -0
  69. package/docs-llm/JSON Tree.md +260 -0
  70. package/docs-llm/Layer.md +74 -0
  71. package/docs-llm/Layout.md +50 -0
  72. package/docs-llm/Link.md +318 -0
  73. package/docs-llm/List.md +189 -0
  74. package/docs-llm/Markdown.md +179 -0
  75. package/docs-llm/Menu.md +735 -0
  76. package/docs-llm/Message Bar.md +236 -0
  77. package/docs-llm/Message.md +248 -0
  78. package/docs-llm/Modal.md +443 -0
  79. package/docs-llm/Monogram.md +159 -0
  80. package/docs-llm/Multiselect.md +939 -0
  81. package/docs-llm/Notifications.md +46 -0
  82. package/docs-llm/Number.md +298 -0
  83. package/docs-llm/Paginator.md +395 -0
  84. package/docs-llm/Paragraph.md +148 -0
  85. package/docs-llm/Phone Number.md +254 -0
  86. package/docs-llm/Popover.md +166 -0
  87. package/docs-llm/Progress.md +141 -0
  88. package/docs-llm/Radio Bar.md +303 -0
  89. package/docs-llm/Radio List.md +350 -0
  90. package/docs-llm/Resize.md +362 -0
  91. package/docs-llm/Screen Reader Content.md +73 -0
  92. package/docs-llm/Scroll Container Context.md +155 -0
  93. package/docs-llm/Scroll.md +152 -0
  94. package/docs-llm/Search.md +381 -0
  95. package/docs-llm/Select.md +985 -0
  96. package/docs-llm/Side Panel.md +777 -0
  97. package/docs-llm/Slider.md +339 -0
  98. package/docs-llm/Sliding Panels.md +340 -0
  99. package/docs-llm/Split Button.md +295 -0
  100. package/docs-llm/Static Content.md +90 -0
  101. package/docs-llm/Step Bar.md +292 -0
  102. package/docs-llm/Switch.md +268 -0
  103. package/docs-llm/Tab Bar.md +439 -0
  104. package/docs-llm/Tab Layout.md +398 -0
  105. package/docs-llm/Table.md +2642 -0
  106. package/docs-llm/Text Area.md +253 -0
  107. package/docs-llm/Text.md +339 -0
  108. package/docs-llm/Tooltip.md +325 -0
  109. package/docs-llm/Transition Open.md +406 -0
  110. package/docs-llm/Tree.md +591 -0
  111. package/docs-llm/Typography.md +125 -0
  112. package/docs-llm/Wait Spinner.md +121 -0
  113. package/docs-llm/llms.txt +101 -0
  114. package/package.json +6 -5
  115. package/types/src/Box/Box.d.ts +2 -10
  116. package/types/src/Drawer/Body.d.ts +17 -0
  117. package/types/src/Drawer/Drawer.d.ts +114 -0
  118. package/types/src/Drawer/DrawerContext.d.ts +11 -0
  119. package/types/src/Drawer/Footer.d.ts +25 -0
  120. package/types/src/Drawer/Header.d.ts +41 -0
  121. package/types/src/Drawer/docs/examples/Basic.d.ts +6 -0
  122. package/types/src/Drawer/docs/examples/ContainerPosition.d.ts +7 -0
  123. package/types/src/Drawer/docs/examples/InitialFocus.d.ts +9 -0
  124. package/types/src/Drawer/docs/examples/InlinePosition.d.ts +7 -0
  125. package/types/src/Drawer/docs/examples/PagePosition.d.ts +7 -0
  126. package/types/src/Drawer/index.d.ts +2 -0
  127. package/types/src/JSONTree/JSONTree.d.ts +12 -5
  128. package/types/src/JSONTree/renderTreeItems.d.ts +2 -1
  129. package/types/src/Menu/Item.d.ts +2 -1
  130. package/types/src/Menu/docs/examples/SelectableCheckbox.d.ts +7 -0
  131. package/types/src/Modal/Modal.d.ts +1 -2
  132. package/types/src/Multiselect/Compact.d.ts +8 -3
  133. package/types/src/Multiselect/Multiselect.d.ts +8 -3
  134. package/types/src/Multiselect/Normal.d.ts +8 -3
  135. package/types/src/Multiselect/Option.d.ts +6 -3
  136. package/types/src/Multiselect/docs/examples/Disabled.d.ts +1 -0
  137. package/types/src/Select/Option.d.ts +6 -3
  138. package/types/src/Select/Select.d.ts +8 -5
  139. package/types/src/Select/docs/examples/Dimmed.d.ts +7 -0
  140. package/types/src/SelectBase/OptionBase.d.ts +6 -3
  141. package/types/src/SelectBase/SelectBase.d.ts +8 -3
  142. package/types/src/SidePanel/SidePanel.d.ts +43 -2
  143. package/types/src/SidePanel/docs/examples/DockLayout.d.ts +17 -0
  144. package/types/src/SidePanel/docs/examples/InitialFocus.d.ts +9 -0
  145. package/types/src/TransitionOpen/TransitionOpen.d.ts +29 -4
  146. package/types/src/useKeyPress/index.d.ts +9 -2
  147. package/types/src/useOnClickOutside/index.d.ts +2 -0
  148. package/types/src/useOnClickOutside/useOnClickOutside.d.ts +4 -0
  149. package/useKeyPress.js +23 -18
  150. package/useOnClickOutside.d.ts +2 -0
  151. package/useOnClickOutside.js +79 -0
  152. package/types/src/RadioList/docs/examples/Row.d.ts +0 -6
@@ -0,0 +1,46 @@
1
+ # Notifications
2
+
3
+ ## Overview
4
+
5
+ # Notifications
6
+
7
+ Notifications help users understand what happened, what needs attention, and what to do next.
8
+
9
+ There are two notification components in Splunk UI:
10
+ - [Message](./Message) is used for inline, contextual feedback near the content it refers to.
11
+ - [Message Bar](./MessageBar) is used for page-level or system-level communication.
12
+
13
+ These components use standardized icons and [`notificationColors` design tokens](../themes/variables#notification-colors) to communicate consistent tone and urgency, so users can quickly understand what to expect.
14
+
15
+ ## Toast Notifications (Deprecated)
16
+
17
+ Toast notifications are **deprecated** and should not be used for new experiences.
18
+ Even with careful implementation, this pattern still creates significant accessibility and usability barriers.
19
+
20
+ Use persistent, user-dismissible notifications instead:
21
+ - Use [Message](./Message) for inline, contextual feedback.
22
+ - Use [Message Bar](./MessageBar) for page-level or system-level communication.
23
+
24
+ ### Migration Guide
25
+
26
+ Review the CRUD Blueprint sections for [Create confirmation](../../DesignSystem/Blueprints/CRUD/Create#3-confirmation), [Update confirmation](../../DesignSystem/Blueprints/CRUD/Update#3-confirmation) and [Delete feedback](../../DesignSystem/Blueprints/CRUD/Delete#3-feedback) for guidance on scenarios where the toast pattern may have previously been used.
27
+
28
+ Below are suggestions for how to migrate common scenarios:
29
+
30
+ | Current Toast Pattern | Recommended Alternative | Reason |
31
+ |---|---|---|
32
+ | Success message after form submission | Message Bar at top of page, or inline Message next to changed element | Persistent confirmation is visible to all users regardless of timing |
33
+ | Error feedback | Inline Message in form field, or Message Bar at top | Direct association with the error source helps users understand and fix the problem |
34
+ | Temporary status updates | Message Bar for page-level updates, or Message for task-level updates | Clear scope and persistent visibility ensure all users receive the information |
35
+ | Real-time alerts | Message Bar with optional dismiss action | Ensures users see critical information before it's dismissed |
36
+
37
+ ### Further Reading
38
+
39
+ Below are additional resources to understand the issues with toast patterns:
40
+
41
+ - [GitHub Primer: Accessible Notifications and Messages](https://primer.style/accessibility/patterns/accessible-notifications-and-messages/#toasts)
42
+ - [Defining Toast Messages (Adrian Roselli)](https://adrianroselli.com/2020/01/defining-toast-messages.html)
43
+ - [A Toast to an Accessible Toast... to Notifications (Scott O'Hara)](https://www.scottohara.me/blog/2019/07/08/a-toast-to-a11y-toasts.html)
44
+ - [The Problem with Toast Messages and What to Do Instead (Adam Silver)](https://adamsilver.io/blog/the-problem-with-toast-messages-and-what-to-do-instead/)
45
+
46
+
@@ -0,0 +1,298 @@
1
+ # Number
2
+
3
+ ## Overview
4
+
5
+
6
+
7
+ > Image: Illustration of a number component
8
+
9
+
10
+ <Message appearance="fill" type="info">
11
+ <div>All data entry components should be wrapped in a <Link to="ControlGroup">Control Group</Link> to provide a label, error states, and help or error text, ensuring an accessible experience for all users.</div>
12
+ </Message>
13
+
14
+
15
+
16
+ ## When to use this component
17
+ - The user only needs to input numeric values.
18
+ - Increasing or decreasing by small values only requires a few clicks.
19
+
20
+
21
+ ## When to use another component
22
+ - Large value changes are expected.
23
+ - Exact values need to be specified within a wide range.
24
+ - Consider the `Slider` component for inputs that aren’t precise.
25
+ - Consider `Text` or `Text Area` for inputs that are a mix of numbers and text
26
+ - For a predetermined list of values the user can select from, use `Select`.
27
+
28
+ ```mermaid
29
+ graph TD
30
+ accDescr: Decision tree that guides on when to use the Number component or something else
31
+ A(Is the input solely numerical?) -- Yes --- B(Is the number input from a predetermined range?)
32
+ B -- Yes --- C(Slider)
33
+ B -- No --- D(Is the number input from a predetermined list?)
34
+ D -- Yes --- E(Select)
35
+ D -- No --- F(Number)
36
+ A -- No --- G(Text/Text Area)
37
+ ```
38
+
39
+ ### Check out
40
+ - [Slider][1]
41
+ - [Text][2]
42
+ - [Text Area] [3]
43
+ - [Select][4]
44
+
45
+ ## Behaviors
46
+ ### Locale
47
+ Number inputs can automatically convert periods to commas for decimal places based on the user's regional settings.
48
+
49
+ ## Usage
50
+ ### Avoid placeholder text
51
+ Placeholder text presents a number of visual and cognitive issues; it is best to avoid using it. Placeholder does not replace a label. [Splunk Style Guide placeholder guidelines][5]
52
+
53
+ > Image: Image showing a comparison between two number input fields and ways to show placeholders. The correct version on the left shows a number input field with the placeholder text displayed underneath the input field, providing clear contextual information. The incorrect version shows a number input field with the placeholder text inside the input field, which could be mistaken for user input.
54
+
55
+
56
+ ### Adjust width to support longest values
57
+ Adjust the width to accommodate the anticipated input length, ensuring it is sufficiently wide to support the longest expected values. Avoid extending Number across the entire width of large viewports to maintain usability and readability.
58
+
59
+ > Image: Image showing a comparison between two number input fields and widths based on content. The correct version of the left shows a number input field with a reasonable width that accommodates the longest expected values, ensuring a clean and efficient design. The incorrect version shows a number input field that is excessively long, wasting space and making the design look unbalanced.
60
+
61
+
62
+
63
+ ## Content guidelines
64
+
65
+ ### Use descriptive labels
66
+ The required labels on top of the number input field should be descriptive to ensure users do not type in additional text along with the number. They should still champion brevity and use sentence-case capitalization.
67
+
68
+ > Image: Image showing a comparison between two number input fields for price. The correct example includes the currency denotated in the label, while the incorrect example requires the user to enter the currency symbol inside the number input field.
69
+
70
+
71
+ [1]: ./Slider
72
+ [2]: ./Text
73
+ [3]: ./TextArea
74
+ [4]: ./Select
75
+ [5]: https://docs.splunk.com/Documentation/StyleGuide/drafts/StyleGuide/UIGuidelines#Placeholder_text
76
+
77
+ ## Examples
78
+
79
+
80
+ ### Controlled
81
+
82
+ Number requires a value prop and an onChange callback to update the value prop for most use cases. Set value to null.
83
+
84
+ ```typescript
85
+ import React, { Component } from 'react';
86
+
87
+ import Number, { NumberChangeHandler } from '@splunk/react-ui/Number';
88
+
89
+
90
+ class Basic extends Component<object, { value?: number }> {
91
+ constructor(props: object) {
92
+ super(props);
93
+
94
+ this.state = {
95
+ value: undefined, // default empty
96
+ };
97
+ }
98
+
99
+ handleChange: NumberChangeHandler = (e, { value }) => {
100
+ this.setState({ value });
101
+ };
102
+
103
+ render() {
104
+ return <Number value={this.state.value} onChange={this.handleChange} inline />;
105
+ }
106
+ }
107
+
108
+ export default Basic;
109
+ ```
110
+
111
+
112
+
113
+ ### Uncontrolled
114
+
115
+ Alternately, Number can be uncontrolled and optionally provided a defaultValue. The onChange callback still fires. The value prop cannot be set or updated externally.
116
+
117
+ ```typescript
118
+ import React from 'react';
119
+
120
+ import Number from '@splunk/react-ui/Number';
121
+
122
+
123
+ function Uncontrolled() {
124
+ return <Number inline />;
125
+ }
126
+
127
+ export default Uncontrolled;
128
+ ```
129
+
130
+
131
+
132
+ ### Limits
133
+
134
+ Number accepts min, max, step, and roundTo props.
135
+
136
+ ```typescript
137
+ import React, { Component } from 'react';
138
+
139
+ import Number, { NumberChangeHandler } from '@splunk/react-ui/Number';
140
+
141
+
142
+ class Limits extends Component<object, { value?: number }> {
143
+ constructor(props: object) {
144
+ super(props);
145
+
146
+ this.state = {
147
+ value: undefined, // default empty
148
+ };
149
+ }
150
+
151
+ handleChange: NumberChangeHandler = (e, { value }) => {
152
+ this.setState({ value });
153
+ };
154
+
155
+ render() {
156
+ return (
157
+ <Number
158
+ value={this.state.value}
159
+ max={10}
160
+ min={-10}
161
+ roundTo={1}
162
+ step={0.1}
163
+ onChange={this.handleChange}
164
+ inline
165
+ />
166
+ );
167
+ }
168
+ }
169
+
170
+ export default Limits;
171
+ ```
172
+
173
+
174
+
175
+ ### Locale
176
+
177
+ A locale can be included which may change the decimal separator to a comma.
178
+
179
+ ```typescript
180
+ import React, { Component } from 'react';
181
+
182
+ import Number, { NumberChangeHandler } from '@splunk/react-ui/Number';
183
+
184
+
185
+ class Locale extends Component<object, { value?: number }> {
186
+ constructor(props: object) {
187
+ super(props);
188
+
189
+ this.state = {
190
+ value: 2.4,
191
+ };
192
+ }
193
+
194
+ handleChange: NumberChangeHandler = (e, { value }) => {
195
+ this.setState({ value });
196
+ };
197
+
198
+ render() {
199
+ return (
200
+ <Number
201
+ locale="fr-FR"
202
+ step={0.15}
203
+ value={this.state.value}
204
+ onChange={this.handleChange}
205
+ inline
206
+ />
207
+ );
208
+ }
209
+ }
210
+
211
+ export default Locale;
212
+ ```
213
+
214
+
215
+
216
+ ### Error
217
+
218
+ ```typescript
219
+ import React from 'react';
220
+
221
+ import Number from '@splunk/react-ui/Number';
222
+
223
+
224
+ function NumberError() {
225
+ return <Number error defaultValue={2020} inline />;
226
+ }
227
+ export default NumberError;
228
+ ```
229
+
230
+
231
+
232
+ ### Disabled
233
+
234
+ ```typescript
235
+ import React from 'react';
236
+
237
+ import Number from '@splunk/react-ui/Number';
238
+
239
+
240
+ function Disabled() {
241
+ return <Number disabled defaultValue={2020} inline />;
242
+ }
243
+
244
+ export default Disabled;
245
+ ```
246
+
247
+
248
+
249
+
250
+ ## API
251
+
252
+
253
+ ### Number API
254
+
255
+ #### Props
256
+
257
+ | Name | Type | Required | Default | Description |
258
+ |------|------|------|------|------|
259
+ | append | boolean | no | | Append removes the rounded borders and the border from the right side and moves the increment and decrement buttons to the left. |
260
+ | children | React.ReactNode | no | | |
261
+ | defaultValue | number | no | | Set this property instead of value to make the value uncontrolled. |
262
+ | describedBy | string | no | | The id of the description. When placed in a ControlGroup, this is automatically set to the ControlGroup's help component. |
263
+ | disabled | boolean | no | | Determines if the input is editable. |
264
+ | elementRef | React.Ref<HTMLDivElement> | no | | A React ref which is set to the DOM element when the component mounts, and null when it unmounts. |
265
+ | error | boolean | no | | Highlight the field as having an error. |
266
+ | hideStepButtons | boolean | no | | Hides the increment and decrement step buttons if true. |
267
+ | inline | boolean | no | | When false, displays as inline-block with the default width. |
268
+ | inputId | string | no | | An id for the input, which may be necessary for accessibility, such as for aria attributes. |
269
+ | inputRef | React.Ref<HTMLInputElement> | no | | A React ref which is set to the text input element when the component mounts, and null when it unmounts. |
270
+ | labelledBy | string | no | | The id of the label. When placed in a ControlGroup, this is automatically set to the ControlGroup's label. |
271
+ | locale | string | no | 'en-US' | The locale determines the decimal separator. Supported locale formats are: `xx`, `xx-XX`, and `xx_XX`. |
272
+ | max | number | no | | The largest allowable value. |
273
+ | min | number | no | | The smallest allowable value. |
274
+ | name | string | no | | The name is returned with onChange events, which can be used to identify the control when multiple controls share an onChange callback. |
275
+ | onBlur | NumberBlurHandler | no | | A callback for when the input loses focus. |
276
+ | onChange | NumberChangeHandler | no | | This is equivalent to onInput which is called on keydown, paste, and so on. If value is set, this callback is required. This must set the value prop to retain the change. |
277
+ | onClick | React.MouseEventHandler<HTMLInputElement> | no | | A callback for when the input is clicked. This will only trigger when the textbox itself is clicked and will not trigger for other parts of the component such as the step buttons. |
278
+ | onFocus | NumberFocusHandler | no | | A callback for when the input takes focus. |
279
+ | onKeyDown | React.KeyboardEventHandler<HTMLInputElement> | no | | A keydown callback can be used to prevent a certain input by utilizing the event argument. |
280
+ | onKeyUp | React.KeyboardEventHandler<HTMLDivElement> | no | | A keyup callback. |
281
+ | onSelect | React.ReactEventHandler<HTMLInputElement> | no | | A callback for when the user selects text. |
282
+ | prepend | boolean | no | | Prepend removes rounded borders from the left side. This cannot be used in combination with append. |
283
+ | roundTo | number | no | 5 | The number of decimal places for rounding. Set to zero to limit input to integers. Negative numbers are supported. For instance, -2 will round to the nearest hundred. |
284
+ | step | number | no | 1 | The amount of increment and decrement applied by the buttons and arrow keys. |
285
+ | value | number | no | | The contents of the input. Setting this value makes the property controlled. A callback is required. |
286
+
287
+ #### Types
288
+
289
+ | Name | Type | Description |
290
+ |------|------|------|
291
+ | NumberBlurHandler | ( event: React.FocusEvent<HTMLInputElement>, data: { name?: string; value: string; } ) => void | |
292
+ | NumberChangeHandler | ( event: \| React.ChangeEvent<HTMLInputElement> \| React.KeyboardEvent<HTMLInputElement> \| React.MouseEvent<HTMLAnchorElement \| HTMLButtonElement \| HTMLSpanElement>, data: { name?: string; value?: number; reason: 'input' \| 'stepButton'; } ) => void | |
293
+ | NumberFocusHandler | ( event: React.FocusEvent<HTMLInputElement>, data: { name?: string; value: string; } ) => void | |
294
+
295
+
296
+
297
+
298
+