@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,189 @@
1
+ # List
2
+
3
+ ## Overview
4
+
5
+
6
+ > Image: Illustration of a list component.
7
+
8
+
9
+ ## When to use this component
10
+ You need to group related content vertically.
11
+ - If your content has no specific order, use an unordered list.
12
+ - If your content has a priority, hierarchy, or sequence between list items, use an ordered list.
13
+
14
+
15
+ ## When to use another component
16
+ - If you need to display complex sets of data, use a data table.
17
+ - If users need to quickly understand a direct relationship between a key-value pairs, use a definition list.
18
+
19
+ ```mermaid
20
+ graph TD
21
+ accDescr: Decision tree that guides on when to use the List component or something else
22
+ A("Does your data have a clear relationship with a key (label) and value(s)?") -- Yes --- B(Definition List)
23
+ A -- No --- C(Is your data set complex and needs to be displayed for easy comparison or reference?)
24
+ C -- No --- D(Table)
25
+ C -- Yes --- E(List or Paragraph)
26
+ ```
27
+
28
+ ### Check out
29
+ - [Definition List][1]
30
+ - [Table][2]
31
+
32
+ ## Usage
33
+
34
+ ### Multiple items
35
+ Lists are best at displaying multiple items. If you are displaying fewer than two items, consider how to present the information as plain text on the page.
36
+
37
+ > Image: Examples of a List outlining the Benefits of Splunk ES. In the first example with heart eyes emojis, the following three benefits are outlined,
38
+
39
+
40
+ ### Logical order
41
+ Arrange list items in a logical way. For example, if the list is about resource use, the default order might be highest resource use to lowest. Grouping items in categories into smaller, more specific lists might be more meaningful.
42
+
43
+ > Image: Examples of a List outlining server usage stats for four servers, Server A with 85% CPU usage, Server B with 70% CPU usage, Server C with 50% CPU usage, and Server D with 30% CPU usage. In the first example with heart eyes emojis, the servers are split based on their data center location and then ordered alphabetically. In the second example with grimacing emoji, the order of the list is totally random, not following any sequence.
44
+
45
+
46
+ ### Links
47
+ Include links if they are relevant to better understanding the context of the list. If the whole list item is selectable, use a navigational or interactive component.
48
+
49
+ > Image: Examples of a List with the title,
50
+
51
+
52
+ ## Content
53
+ Follow writing best practices for Lists outlined in the [Splunk Style Guide][3]
54
+
55
+ ### Be concise
56
+ Try not to exceed 2 lines per list item and use list items that are grammatically parallel. For example, do not mix passive voice with active voice or declarative sentences (statements) with imperative sentences (direct command).
57
+
58
+ > Image: Examples of List with two items outlining server installation steps. In the first example with the heart eyes emoji has a concise label, the list items are
59
+
60
+
61
+ [1]: ./DefinitionList
62
+ [2]: ./Table
63
+ [3]: https://docs.splunk.com/Documentation/StyleGuide/current/StyleGuide/Listoverview
64
+
65
+ ## Examples
66
+
67
+
68
+ ### Unordered List
69
+
70
+ ```typescript
71
+ import React from 'react';
72
+
73
+ import List from '@splunk/react-ui/List';
74
+
75
+
76
+ function UnorderedList() {
77
+ return (
78
+ <List>
79
+ <List.Item>Bar Chart</List.Item>
80
+ <List.Item>Area Chart</List.Item>
81
+ <List.Item>Pie Chart</List.Item>
82
+ </List>
83
+ );
84
+ }
85
+
86
+ export default UnorderedList;
87
+ ```
88
+
89
+
90
+
91
+ ### Ordered List
92
+
93
+ Ordered Lists use numerals by default.
94
+
95
+ ```typescript
96
+ import React from 'react';
97
+
98
+ import List from '@splunk/react-ui/List';
99
+
100
+
101
+ function Ordered() {
102
+ return (
103
+ <List ordered>
104
+ <List.Item>First Item</List.Item>
105
+ <List.Item>Second Item</List.Item>
106
+ <List.Item>Third Item</List.Item>
107
+ </List>
108
+ );
109
+ }
110
+
111
+ export default Ordered;
112
+ ```
113
+
114
+
115
+
116
+ ### Customized List
117
+
118
+ ```typescript
119
+ import React from 'react';
120
+
121
+ import styled from 'styled-components';
122
+
123
+ import List from '@splunk/react-ui/List';
124
+
125
+ const StyledList = styled(List)`
126
+ list-style-type: lower-roman;
127
+ `;
128
+
129
+
130
+ function CustomizedList() {
131
+ return (
132
+ <StyledList ordered>
133
+ <List.Item>First Item</List.Item>
134
+ <List.Item>Second Item</List.Item>
135
+ <List.Item>Third Item</List.Item>
136
+ </StyledList>
137
+ );
138
+ }
139
+
140
+ export default CustomizedList;
141
+ ```
142
+
143
+
144
+
145
+
146
+ ## API
147
+
148
+
149
+ ### List API
150
+
151
+ #### Props
152
+
153
+ | Name | Type | Required | Default | Description |
154
+ |------|------|------|------|------|
155
+ | children | React.ReactNode | no | | |
156
+ | elementRef | React.Ref<HTMLOListElement \| HTMLUListElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. `HTMLUListElement` if type is 'disc', `HTMLOListElement` otherwise. |
157
+ | ordered | boolean | no | | Sets the element as an `HTMLOListElement` otherwise it defaults to `HTMLUListElement`. |
158
+
159
+
160
+
161
+ ### List.Item API
162
+
163
+ A container for items of a `List`.
164
+
165
+ #### Props
166
+
167
+ | Name | Type | Required | Default | Description |
168
+ |------|------|------|------|------|
169
+ | children | React.ReactNode | no | | |
170
+ | elementRef | React.Ref<HTMLLIElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. |
171
+
172
+
173
+
174
+
175
+
176
+ ## Accessibility
177
+
178
+ ## Visual Design
179
+ - Color contrast ratio **MUST** be [SC 1.4.3][1]:
180
+ - &gt= 3:1 for icon and caret (&gt) against page background
181
+ - &gt= 4:5:1 for functional text against page background
182
+
183
+ ## Implementation
184
+ - **MUST** use HTML semantics: `<ul>` or `<ol>` with `<li>` child elements, or `<dl>` with `<dt>` and `<dd>` child elements [SC 1.3.1][2]
185
+
186
+ [1]: https://www.w3.org/TR/WCAG21/#contrast-minimum
187
+ [2]: https://www.w3.org/TR/WCAG21/#info-and-relationships
188
+
189
+
@@ -0,0 +1,179 @@
1
+ # Markdown
2
+
3
+ ## Examples
4
+
5
+
6
+ ### example
7
+
8
+ ```typescript
9
+ import React from 'react';
10
+
11
+ import Markdown from '@splunk/react-ui/Markdown';
12
+
13
+ const example = `
14
+ # Products overview
15
+
16
+ - Platform
17
+ - Security:
18
+ - Splunk Enterprise Security
19
+ - Splunk Mission Control
20
+
21
+ * Observability
22
+ * Splunk Infrastructure Monitoring
23
+ * Splunk IT Service Intelligence
24
+
25
+ ## Keep your digital systems securely up and running
26
+ Fend off threat actors. Diminish downtime. Fix issues faster. Do it all with Splunk, the key to enterprise resilience.
27
+
28
+ 1. Prevent major issues
29
+ 1. Absorb shocks
30
+ 1. Accelerate transformation
31
+
32
+ ### Sandbox
33
+
34
+ function lookAway() {
35
+ head.turn('left');
36
+ }
37
+
38
+
39
+ Link to [Overview](Overview)
40
+ `;
41
+
42
+
43
+ function BasicExample() {
44
+ return <Markdown text={example} />;
45
+ }
46
+
47
+ export default BasicExample;
48
+ ```
49
+
50
+
51
+
52
+ ### I18n
53
+
54
+ Combine with gettext interpolation.
55
+
56
+ ```typescript
57
+ /* eslint-disable prefer-template */
58
+ import React from 'react';
59
+
60
+ import Markdown from '@splunk/react-ui/Markdown';
61
+ import { _ } from '@splunk/ui-utils/i18n';
62
+
63
+
64
+ function I18nExample() {
65
+ const text = _(
66
+ '### UI internationalization\n' +
67
+ 'Translate text generated by Python code, JavaScript code, views, menus and Mako templates. Set language/locale ' +
68
+ 'specific alternatives for static resources such as images, CSS, other media.\n\n' +
69
+ '[Learn more](https://www.splunk.com/en_us/search.html?q=i18n&size=n_10_n) about Splunk software translation.\n'
70
+ );
71
+ return <Markdown text={text} />;
72
+ }
73
+
74
+ export default I18nExample;
75
+ ```
76
+
77
+
78
+
79
+ ### render-props
80
+
81
+ ```typescript
82
+ import React from 'react';
83
+
84
+ import Link from '@splunk/react-ui/Link';
85
+ import List from '@splunk/react-ui/List';
86
+ import Markdown, { LinkRenderer, ListRenderer } from '@splunk/react-ui/Markdown';
87
+
88
+ const externalURLs: Array<string> = ['https://www.google.com', 'https://www.splunk.com/'];
89
+
90
+ const example = `
91
+ ### Link
92
+
93
+ Internal Link to [Overview](Overview)
94
+
95
+ External Link to [Splunk](https://www.splunk.com/)
96
+
97
+ ### List
98
+
99
+ #### Solution
100
+
101
+ 1. Advanced threat detection
102
+ 2. Automation and Orchestration
103
+ 3. Extend visibility from on-premises to the cloud
104
+
105
+ - Incident management
106
+ - Isolate problems in cloud-native environments
107
+ - IT modernization
108
+ `;
109
+
110
+
111
+ const linkRenderer: LinkRenderer = ({ title, href, children }) => {
112
+ const isExternal = href && externalURLs.indexOf(href) >= 0;
113
+
114
+ return (
115
+ <Link title={title} to={href} openInNewContext={isExternal}>
116
+ {children}
117
+ </Link>
118
+ );
119
+ };
120
+
121
+ const listRenderer: ListRenderer = ({ ordered, children }) => {
122
+ return <List ordered={ordered}>{children}</List>;
123
+ };
124
+
125
+ function RendererExample() {
126
+ return <Markdown text={example} linkRenderer={linkRenderer} listRenderer={listRenderer} />;
127
+ }
128
+
129
+ export default RendererExample;
130
+ ```
131
+
132
+
133
+
134
+
135
+ ## API
136
+
137
+
138
+ ### Markdown API
139
+
140
+ The `Markdown` component renders the given Markdown text as a React component.
141
+ The component prefers @splunk/react-ui components over plain HTML components. For example
142
+ links are rendered as the `@splunk/react-ui/Link` component instead of plain `<a>` tag.
143
+
144
+ #### Props
145
+
146
+ | Name | Type | Required | Default | Description |
147
+ |------|------|------|------|------|
148
+ | blockquoteRenderer | BlockquoteRenderer | no | | A custom blockquote renderer. The function is passed an object containing `children`. |
149
+ | codeBlockRenderer | CodeBlockRenderer | no | | A custom code block renderer. The function is passed an object containing `language`, and `children`. It supports the same languages as the `Code` component. |
150
+ | codeRenderer | CodeRenderer | no | | A custom code literal renderer. The function is passed an object containing `children`. |
151
+ | elementRef | React.Ref<HTMLElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. |
152
+ | headingRenderer | HeadingRenderer \| AnchorHeadingRenderer | no | | A custom heading renderer. The function is passed an object containing `level` from 1 to 6 and `children`. |
153
+ | imageRenderer | ImageRenderer | no | | A custom image renderer. The function is passed an object containing `src`, `title`, and `alt`. |
154
+ | itemRenderer | ItemRenderer | no | | A custom list item renderer. The function is passed an object containing `children`. |
155
+ | linkRenderer | LinkRenderer | no | | A custom link renderer. This is useful for single-page apps that need to handle links internally. The function is passed an object containing `href`, `title`, and `children`. |
156
+ | listRenderer | ListRenderer | no | | A custom list renderer. The function is passed an object containing `ordered`, `depth`, and `children`. |
157
+ | paragraphRenderer | ParagraphRenderer | no | | A custom paragraph renderer. The function is passed an object containing `children`. |
158
+ | text | string | yes | | The content to be parsed and rendered. |
159
+
160
+ #### Types
161
+
162
+ | Name | Type | Description |
163
+ |------|------|------|
164
+ | AnchorHeadingRenderer | (props: { children: React.ReactNode[]; level: number; }) => RemarkReturn | |
165
+ | BlockquoteRenderer | (props: { children: React.ReactNode[] }) => RemarkReturn | |
166
+ | CodeBlockRenderer | (props: { language?: string; children: React.ReactNode[]; }) => RemarkReturn | |
167
+ | CodeRenderer | (props: { children: React.ReactNode[] }) => RemarkReturn | |
168
+ | HeadingRenderer | (props: { children: React.ReactNode[]; level: number }) => RemarkReturn | |
169
+ | ImageRenderer | (props: { alt?: string; src?: string; title?: string }) => RemarkReturn | |
170
+ | ItemRenderer | (props: { children: React.ReactNode[] }) => RemarkReturn | |
171
+ | LinkRenderer | (props: { children: React.ReactNode[]; href?: string; title?: string; }) => RemarkReturn | |
172
+ | ListRenderer | (props: { children: React.ReactNode[]; depth: number; ordered: boolean; }) => RemarkReturn | |
173
+ | ParagraphRenderer | (props: { children: React.ReactNode[] }) => RemarkReturn | |
174
+ | RemarkReturn | React.ReactElement<any, any> \| null | |
175
+
176
+
177
+
178
+
179
+