@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.
- package/Accordion.js +6 -6
- package/Anchor.js +2 -1
- package/Box.js +83 -34
- package/CHANGELOG.md +51 -0
- package/Calendar.js +134 -134
- package/Clickable.js +131 -94
- package/CollapsiblePanel.js +175 -137
- package/ComboBox.js +32 -27
- package/ControlGroup.js +92 -91
- package/DefinitionList.js +9 -9
- package/Drawer.d.ts +2 -0
- package/Drawer.js +679 -0
- package/Dropdown.js +27 -18
- package/DualListbox.js +1 -1
- package/File.js +35 -35
- package/JSONTree.js +73 -72
- package/Link.js +2 -2
- package/MIGRATION.md +10 -0
- package/Menu.js +403 -261
- package/Modal.js +263 -252
- package/Monogram.js +2 -2
- package/Multiselect.js +551 -385
- package/Number.js +2 -1
- package/Paginator.js +14 -12
- package/Popover.js +4 -1
- package/README.md +11 -0
- package/RadioBar.js +1 -1
- package/Search.js +111 -95
- package/Select.js +42 -40
- package/SelectBase.js +819 -715
- package/SidePanel.js +346 -167
- package/SlidingPanels.js +11 -11
- package/StepBar.js +7 -7
- package/Switch.js +5 -5
- package/Table.js +116 -119
- package/Text.js +48 -48
- package/TextArea.js +7 -7
- package/TransitionOpen.js +188 -169
- package/docs-llm/Accordion.md +267 -0
- package/docs-llm/Anchor Menu.md +115 -0
- package/docs-llm/Anchor.md +54 -0
- package/docs-llm/AnimationToggle.md +254 -0
- package/docs-llm/Avatar.md +292 -0
- package/docs-llm/Badge.md +212 -0
- package/docs-llm/Breadcrumbs.md +306 -0
- package/docs-llm/Button Group.md +53 -0
- package/docs-llm/Button.md +361 -0
- package/docs-llm/Card Layout.md +286 -0
- package/docs-llm/Card.md +619 -0
- package/docs-llm/Checkbox.md +218 -0
- package/docs-llm/Chip.md +291 -0
- package/docs-llm/Clickable.md +160 -0
- package/docs-llm/Code.md +292 -0
- package/docs-llm/Collapsible Panel.md +744 -0
- package/docs-llm/Color.md +253 -0
- package/docs-llm/Column Layout.md +391 -0
- package/docs-llm/Combo Box.md +540 -0
- package/docs-llm/Control Group.md +594 -0
- package/docs-llm/Date.md +270 -0
- package/docs-llm/Definition List.md +278 -0
- package/docs-llm/Divider.md +216 -0
- package/docs-llm/Drawer.md +414 -0
- package/docs-llm/Dropdown.md +472 -0
- package/docs-llm/Dual Listbox.md +325 -0
- package/docs-llm/File.md +653 -0
- package/docs-llm/Form Rows.md +374 -0
- package/docs-llm/Heading.md +179 -0
- package/docs-llm/Image.md +109 -0
- package/docs-llm/JSON Tree.md +260 -0
- package/docs-llm/Layer.md +74 -0
- package/docs-llm/Layout.md +50 -0
- package/docs-llm/Link.md +318 -0
- package/docs-llm/List.md +189 -0
- package/docs-llm/Markdown.md +179 -0
- package/docs-llm/Menu.md +735 -0
- package/docs-llm/Message Bar.md +236 -0
- package/docs-llm/Message.md +248 -0
- package/docs-llm/Modal.md +443 -0
- package/docs-llm/Monogram.md +159 -0
- package/docs-llm/Multiselect.md +939 -0
- package/docs-llm/Notifications.md +46 -0
- package/docs-llm/Number.md +298 -0
- package/docs-llm/Paginator.md +395 -0
- package/docs-llm/Paragraph.md +148 -0
- package/docs-llm/Phone Number.md +254 -0
- package/docs-llm/Popover.md +166 -0
- package/docs-llm/Progress.md +141 -0
- package/docs-llm/Radio Bar.md +303 -0
- package/docs-llm/Radio List.md +350 -0
- package/docs-llm/Resize.md +362 -0
- package/docs-llm/Screen Reader Content.md +73 -0
- package/docs-llm/Scroll Container Context.md +155 -0
- package/docs-llm/Scroll.md +152 -0
- package/docs-llm/Search.md +381 -0
- package/docs-llm/Select.md +985 -0
- package/docs-llm/Side Panel.md +777 -0
- package/docs-llm/Slider.md +339 -0
- package/docs-llm/Sliding Panels.md +340 -0
- package/docs-llm/Split Button.md +295 -0
- package/docs-llm/Static Content.md +90 -0
- package/docs-llm/Step Bar.md +292 -0
- package/docs-llm/Switch.md +268 -0
- package/docs-llm/Tab Bar.md +439 -0
- package/docs-llm/Tab Layout.md +398 -0
- package/docs-llm/Table.md +2642 -0
- package/docs-llm/Text Area.md +253 -0
- package/docs-llm/Text.md +339 -0
- package/docs-llm/Tooltip.md +325 -0
- package/docs-llm/Transition Open.md +406 -0
- package/docs-llm/Tree.md +591 -0
- package/docs-llm/Typography.md +125 -0
- package/docs-llm/Wait Spinner.md +121 -0
- package/docs-llm/llms.txt +101 -0
- package/package.json +6 -5
- package/types/src/Box/Box.d.ts +2 -10
- package/types/src/Drawer/Body.d.ts +17 -0
- package/types/src/Drawer/Drawer.d.ts +114 -0
- package/types/src/Drawer/DrawerContext.d.ts +11 -0
- package/types/src/Drawer/Footer.d.ts +25 -0
- package/types/src/Drawer/Header.d.ts +41 -0
- package/types/src/Drawer/docs/examples/Basic.d.ts +6 -0
- package/types/src/Drawer/docs/examples/ContainerPosition.d.ts +7 -0
- package/types/src/Drawer/docs/examples/InitialFocus.d.ts +9 -0
- package/types/src/Drawer/docs/examples/InlinePosition.d.ts +7 -0
- package/types/src/Drawer/docs/examples/PagePosition.d.ts +7 -0
- package/types/src/Drawer/index.d.ts +2 -0
- package/types/src/JSONTree/JSONTree.d.ts +12 -5
- package/types/src/JSONTree/renderTreeItems.d.ts +2 -1
- package/types/src/Menu/Item.d.ts +2 -1
- package/types/src/Menu/docs/examples/SelectableCheckbox.d.ts +7 -0
- package/types/src/Modal/Modal.d.ts +1 -2
- package/types/src/Multiselect/Compact.d.ts +8 -3
- package/types/src/Multiselect/Multiselect.d.ts +8 -3
- package/types/src/Multiselect/Normal.d.ts +8 -3
- package/types/src/Multiselect/Option.d.ts +6 -3
- package/types/src/Multiselect/docs/examples/Disabled.d.ts +1 -0
- package/types/src/Select/Option.d.ts +6 -3
- package/types/src/Select/Select.d.ts +8 -5
- package/types/src/Select/docs/examples/Dimmed.d.ts +7 -0
- package/types/src/SelectBase/OptionBase.d.ts +6 -3
- package/types/src/SelectBase/SelectBase.d.ts +8 -3
- package/types/src/SidePanel/SidePanel.d.ts +43 -2
- package/types/src/SidePanel/docs/examples/DockLayout.d.ts +17 -0
- package/types/src/SidePanel/docs/examples/InitialFocus.d.ts +9 -0
- package/types/src/TransitionOpen/TransitionOpen.d.ts +29 -4
- package/types/src/useKeyPress/index.d.ts +9 -2
- package/types/src/useOnClickOutside/index.d.ts +2 -0
- package/types/src/useOnClickOutside/useOnClickOutside.d.ts +4 -0
- package/useKeyPress.js +23 -18
- package/useOnClickOutside.d.ts +2 -0
- package/useOnClickOutside.js +79 -0
- package/types/src/RadioList/docs/examples/Row.d.ts +0 -6
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Typography
|
|
2
|
+
|
|
3
|
+
## Examples
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Styled
|
|
7
|
+
|
|
8
|
+
```typescript
|
|
9
|
+
import React from 'react';
|
|
10
|
+
|
|
11
|
+
import styled from 'styled-components';
|
|
12
|
+
|
|
13
|
+
import Link from '@splunk/react-ui/Link';
|
|
14
|
+
import Typography from '@splunk/react-ui/Typography';
|
|
15
|
+
import { mixins } from '@splunk/themes';
|
|
16
|
+
|
|
17
|
+
const Styled = styled.div`
|
|
18
|
+
${mixins.prose()}
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
function Basic() {
|
|
23
|
+
return (
|
|
24
|
+
<Styled>
|
|
25
|
+
<Typography as="h4" variant="title3">
|
|
26
|
+
Using SPL
|
|
27
|
+
</Typography>
|
|
28
|
+
<Typography as="p" family="sansSerif" size={16} lineHeight="snug">
|
|
29
|
+
Search Processing Language, or{' '}
|
|
30
|
+
<Typography as="strong" weight="bold" color="active">
|
|
31
|
+
SPL
|
|
32
|
+
</Typography>
|
|
33
|
+
, is designed by Splunk for use with Splunk software.{' '}
|
|
34
|
+
</Typography>{' '}
|
|
35
|
+
<Typography as="p" variant="body">
|
|
36
|
+
SPL encompasses all the search commands and their functions, arguments, and clauses.
|
|
37
|
+
Here is an example of SPL:{' '}
|
|
38
|
+
<Typography as="code" variant="monoBody" color="active">
|
|
39
|
+
sourcetype=access_* status=200 action=purchase categoryId=simulation
|
|
40
|
+
</Typography>{' '}
|
|
41
|
+
.{' '}
|
|
42
|
+
</Typography>
|
|
43
|
+
<Typography as="p" family="sansSerif" size={14}>
|
|
44
|
+
You can learn more about SPL by reading the{' '}
|
|
45
|
+
<Link to="https://docs.splunk.com/Documentation/SplunkCloud/latest/Search/Aboutthesearchlanguage">
|
|
46
|
+
SPL documentation
|
|
47
|
+
</Link>
|
|
48
|
+
.
|
|
49
|
+
</Typography>
|
|
50
|
+
</Styled>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default Basic;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## API
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Typography API
|
|
64
|
+
|
|
65
|
+
Typography renders text content with styling based on the Splunk Design System.
|
|
66
|
+
|
|
67
|
+
#### Props
|
|
68
|
+
|
|
69
|
+
| Name | Type | Required | Default | Description |
|
|
70
|
+
|------|------|------|------|------|
|
|
71
|
+
| as | \| 'p' \| 'h1' \| 'h2' \| 'h3' \| 'h4' \| 'h5' \| 'h6' \| 'span' \| 'blockquote' \| 'dd' \| 'dl' \| 'dt' \| 'figcaption' \| 'figure' \| 'li' \| 'ol' \| 'ul' \| 'pre' \| 'abbr' \| 'cite' \| 'code' \| 'data' \| 'dfn' \| 'em' \| 'u' \| 'time' \| 'sup' \| 'sub' \| 'strong' \| 'small' \| 'samp' \| 's' \| 'var' \| 'ruby' \| 'rt' \| 'rp' | yes | | Tag for the element to render children content into. Use the most semantically appropriate tag. Layout elements like `div` are not allowed; use the `typography` mixin from `@splunk/themes` instead. |
|
|
72
|
+
| children | React.ReactNode | yes | | Text and inline icons |
|
|
73
|
+
| color | 'active' \| 'default' \| 'disabled' \| 'inverted' \| 'muted' \| 'inherit' | no | | Set the color to a system-standard color: e.g. `active` for `@splunk/themes/variables.contentColorActive`. |
|
|
74
|
+
| elementRef | React.Ref<HTMLElement> | no | | A React ref which is set to the DOM element when the component mounts, and null when it unmounts. |
|
|
75
|
+
| family | 'sansSerif' \| 'monospace' \| 'title' | no | | Set the font-family to sans-serif or monospace based on current theme. |
|
|
76
|
+
| lineHeight | 'single' \| 'tight' \| 'snug' \| 'comfortable' \| 'relaxed' \| 'spacious' \| 'normal' | no | | Set the line-height to a system-standard size. |
|
|
77
|
+
| size | 24 \| 20 \| 18 \| 16 \| 14 \| 12 | no | | Set the size to a system-standard size. |
|
|
78
|
+
| variant | TypographyVariant | no | | A variant from the Splunk Design System's Type: 'body', 'title1', 'title2', 'title3', 'title4', 'title5', 'title6', 'largeBody', 'smallBody', 'monoBody', or 'monoSmallBody'. |
|
|
79
|
+
| weight | 'light' \| 'normal' \| 'semiBold' \| 'bold' \| 'extraBold' \| 'heavy' | no | | Set the font-weight to a system-standard value. The following standard weight names are supported, using camelCase syntax. See: [font-weight \| MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight#common_weight_name_mapping) |
|
|
80
|
+
| withReset | boolean | no | true | Remove all browser-default styles and apply theme-specific defaults. |
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## Accessibility
|
|
87
|
+
|
|
88
|
+
## Font size
|
|
89
|
+
|
|
90
|
+
* Although WCAG do not set a minimum font-size, the Splunk Design System does not support a font-size smaller than 12px.
|
|
91
|
+
Smaller font sizes **SHOULD** be avoided. They can render illegibly on some platforms and our inclusive design aims
|
|
92
|
+
to reduce the need for users to have to override styling to make content readable.
|
|
93
|
+
|
|
94
|
+
## Contrast
|
|
95
|
+
|
|
96
|
+
* Color contrast ratio **MUST** be [SC 1.4.3][1]
|
|
97
|
+
* >= 4.5:1 for normal text: 14 pt (typically 18.66px) and bold or larger
|
|
98
|
+
* >= 3:1 for large text: 18 pt (typically 24px) or larger
|
|
99
|
+
* For high contrast mode, ratios **MUST** be >=7:1 for normal text and >=4.5:1 for large text [SC 1.4.6][2]
|
|
100
|
+
|
|
101
|
+
> Check the [Color combinations](/Packages/themes/ColorCombinations) tool in `@splunk/themes` documentation to validate
|
|
102
|
+
which background colors can be used with the design system's text colors.
|
|
103
|
+
|
|
104
|
+
## Interaction Model
|
|
105
|
+
|
|
106
|
+
* **MUST NOT** lose content or functionality when the user adapts [SC 1.4.12][3]
|
|
107
|
+
* Line height (line spacing) to at least 1.5 times the font size;
|
|
108
|
+
* Spacing following paragraphs to at least 2 times the font size;
|
|
109
|
+
* Letter spacing (tracking) to at least 0.12 times the font size;
|
|
110
|
+
* Word spacing to at least 0.16 times the font size
|
|
111
|
+
* Line spacing (leading) **MUST** be at least space-and-a-half within paragraphs, and paragraph spacing is at least 1.5 times larger than the line spacing [SC 1.4.8][4]
|
|
112
|
+
|
|
113
|
+
## Implementation
|
|
114
|
+
|
|
115
|
+
* **SHOULD** use correct [phrasing elements][5] to describe the semantics of the content.
|
|
116
|
+
|
|
117
|
+
> Always choose the best semantic element to describe the content and apply styling based on visual design. Typography allows for the semantics and the visual style of elements to be set independently via the `as` and `variant` props respectively.
|
|
118
|
+
|
|
119
|
+
[1]: https://www.w3.org/WAI/GL/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html
|
|
120
|
+
[2]: https://www.w3.org/TR/WCAG21/#contrast-enhanced
|
|
121
|
+
[3]: https://www.w3.org/TR/WCAG21/#text-spacing
|
|
122
|
+
[4]: https://www.w3.org/TR/WCAG21/#visual-presentation
|
|
123
|
+
[5]: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#phrasing_content
|
|
124
|
+
|
|
125
|
+
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# Wait Spinner
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
> Image: Illustration of a Wait Spinner.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## When to use this component
|
|
10
|
+
A Wait Spinner component is a looped animation and an example of an indeterminate loading indicator, as it expresses an unspecified amount of time.
|
|
11
|
+
- If you need to represent a loading element for less than a few seconds.
|
|
12
|
+
|
|
13
|
+
## When to use another component
|
|
14
|
+
- If the wait exceeds a few seconds and loading progression can be calculated, use a determinate loading indicator like `Progress`, which considers loading time.
|
|
15
|
+
- If the wait will be less than 1 second, no loading indicator is needed.
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
graph TD
|
|
19
|
+
accDescr: Decision tree that guides on when to use the WaitSpinner component or something else
|
|
20
|
+
A(Is the loading time less than a few seconds?) -- Yes --- B(Is the loading time less than a second?)
|
|
21
|
+
B -- Yes --- C(No indicator)
|
|
22
|
+
B -- No --- D(Wait Spinner)
|
|
23
|
+
A -- No --- E(Progress)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Check out
|
|
27
|
+
- [Progress][1]
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### Loading messages
|
|
32
|
+
Including a loading message with the Wait Spinner adds an additional affordance for communicating the content’s state. This is useful for users who disable animations, which results in a static Wait Spinner.
|
|
33
|
+
|
|
34
|
+
> Image: Examples of Wait Spinners. In the first example with heart eyes emoji, the Wait Spinner is accompanied by a loading message saying,
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Use one Wait Spinner
|
|
38
|
+
A group of Wait Spinners can create visual overload for users. Replace a series of adjacent Wait Spinners with a single one.
|
|
39
|
+
|
|
40
|
+
> Image: Examples of using Wait Spinners for loading a list of items. The first example with heart eyes emoji shows the list title,
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Sizing
|
|
44
|
+
Choose an appropriate size based on the context and visibility requirements.
|
|
45
|
+
|
|
46
|
+
> Image: Examples of using a Wait Spinner component on a full page. In the first example with heart eyes emoji, the Wait Spinner and accompanied label can clearly be read. In the second example with a grimacing emoji, the Wait Spinner and accompanied label are much smaller and hardly legible, displaying a misuse of a smaller Wait Spinner size.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Incremental loading
|
|
50
|
+
If loading a larger space, consider displaying each item as it loads.
|
|
51
|
+
|
|
52
|
+
> Image: In this example, there is a full-page map visual with the label
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## Content
|
|
56
|
+
|
|
57
|
+
### Loading …
|
|
58
|
+
For the loading message, use the format, [Loading …]. If the element loading can be summarized in 1-2 words, the format can be improved by replacing the [...] with [element].
|
|
59
|
+
|
|
60
|
+
> Image: Examples of loading messages for Wait Spinner labels. The first example with heart eyes emoji has a Wait Spinner with a label uses the format;
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
### Concise labeling
|
|
64
|
+
Avoiding the use of articles ("a," "an," "the") and end punctuation.
|
|
65
|
+
|
|
66
|
+
> Image: Examples of loading messages for Wait Spinner labels. The first example with heart eyes emoji has a Wait Spinner with a label uses the format;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
[1]: ./Progress
|
|
71
|
+
|
|
72
|
+
## Examples
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Basic
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import React from 'react';
|
|
79
|
+
|
|
80
|
+
import P from '@splunk/react-ui/Paragraph';
|
|
81
|
+
import WaitSpinner from '@splunk/react-ui/WaitSpinner';
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
function Basic() {
|
|
85
|
+
return (
|
|
86
|
+
<>
|
|
87
|
+
<P>Default size:</P>
|
|
88
|
+
<WaitSpinner />
|
|
89
|
+
<br />
|
|
90
|
+
<P>Medium size:</P>
|
|
91
|
+
<WaitSpinner size="medium" />
|
|
92
|
+
<br />
|
|
93
|
+
<P>Large size:</P>
|
|
94
|
+
<WaitSpinner size="large" />
|
|
95
|
+
</>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export default Basic;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
## API
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### WaitSpinner API
|
|
109
|
+
|
|
110
|
+
#### Props
|
|
111
|
+
|
|
112
|
+
| Name | Type | Required | Default | Description |
|
|
113
|
+
|------|------|------|------|------|
|
|
114
|
+
| elementRef | React.Ref<HTMLDivElement> | no | | A React ref which is set to the DOM element when the component mounts and null when it unmounts. |
|
|
115
|
+
| screenReaderText | string \| null | no | _('Waiting') | A string to display to screen readers. Set the prop to `null` or an empty string to hide the spinner from screen readers, such as when there is already a text label beside it. |
|
|
116
|
+
| size | 'small' \| 'medium' \| 'large' | no | 'small' | Size of WaitSpinner. |
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# React UI (@splunk/react-ui)
|
|
2
|
+
|
|
3
|
+
A library of UI components, all independent of the Splunk Enterprise environment.
|
|
4
|
+
|
|
5
|
+
## Base
|
|
6
|
+
|
|
7
|
+
- **Anchor**
|
|
8
|
+
- **Avatar**
|
|
9
|
+
- **Badge**
|
|
10
|
+
- **Button**
|
|
11
|
+
- **Card**
|
|
12
|
+
- **Card Layout**
|
|
13
|
+
- **Chip**
|
|
14
|
+
- **Code**
|
|
15
|
+
- **Collapsible Panel**
|
|
16
|
+
- **Drawer**
|
|
17
|
+
- **JSON Tree**
|
|
18
|
+
- **Link**
|
|
19
|
+
- **Markdown**
|
|
20
|
+
- **Modal**
|
|
21
|
+
- **Paginator**
|
|
22
|
+
- **Progress**
|
|
23
|
+
- **Split Button**
|
|
24
|
+
- **Step Bar**
|
|
25
|
+
- **Switch**
|
|
26
|
+
- **Tab Bar**
|
|
27
|
+
- **Tab Layout**
|
|
28
|
+
- **Table**
|
|
29
|
+
- **Tooltip**
|
|
30
|
+
- **Wait Spinner**
|
|
31
|
+
|
|
32
|
+
## Content
|
|
33
|
+
|
|
34
|
+
- **Definition List**
|
|
35
|
+
- **Heading**
|
|
36
|
+
- **List**
|
|
37
|
+
- **Paragraph**
|
|
38
|
+
- **Prose**
|
|
39
|
+
- **Typography**
|
|
40
|
+
|
|
41
|
+
## Data Entry
|
|
42
|
+
|
|
43
|
+
- **Checkbox**
|
|
44
|
+
- **Color**
|
|
45
|
+
- **Combo Box**
|
|
46
|
+
- **Control Group**
|
|
47
|
+
- **Date**
|
|
48
|
+
- **Dual Listbox**
|
|
49
|
+
- **File**
|
|
50
|
+
- **Form Rows**
|
|
51
|
+
- **Image**
|
|
52
|
+
- **Multiselect**
|
|
53
|
+
- **Number**
|
|
54
|
+
- **Phone Number**
|
|
55
|
+
- **Radio Bar**
|
|
56
|
+
- **Radio List**
|
|
57
|
+
- **Select**
|
|
58
|
+
- **Search**
|
|
59
|
+
- **Slider**
|
|
60
|
+
- **Static Content**
|
|
61
|
+
- **Text**
|
|
62
|
+
- **Text Area**
|
|
63
|
+
|
|
64
|
+
## Navigation
|
|
65
|
+
|
|
66
|
+
- **Anchor Menu**
|
|
67
|
+
- **Breadcrumbs**
|
|
68
|
+
|
|
69
|
+
## Notifications
|
|
70
|
+
|
|
71
|
+
- **Notifications**
|
|
72
|
+
- **Message**
|
|
73
|
+
- **Message Bar**
|
|
74
|
+
|
|
75
|
+
## Utilities
|
|
76
|
+
|
|
77
|
+
- **AnimationToggle**
|
|
78
|
+
- **Button Group**
|
|
79
|
+
- **Clickable**
|
|
80
|
+
- **Column Layout**
|
|
81
|
+
- **Divider**
|
|
82
|
+
- **Dropdown**
|
|
83
|
+
- **Layer**
|
|
84
|
+
- **Layout**
|
|
85
|
+
- **Menu**
|
|
86
|
+
- **Popover**
|
|
87
|
+
- **Resize**
|
|
88
|
+
- **Screen Reader Content**
|
|
89
|
+
- **Scroll**
|
|
90
|
+
- **Scroll Container Context**
|
|
91
|
+
- **Side Panel**
|
|
92
|
+
- **Sliding Panels**
|
|
93
|
+
- **Transition Open**
|
|
94
|
+
- **Tree**
|
|
95
|
+
- **useKeyPress**
|
|
96
|
+
|
|
97
|
+
## Deprecated
|
|
98
|
+
|
|
99
|
+
- **Accordion**
|
|
100
|
+
- **Monogram**
|
|
101
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splunk/react-ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.0",
|
|
4
4
|
"description": "Library of React components that implement the Splunk design language",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Splunk Inc.",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"@dnd-kit/sortable": "^8.0.0",
|
|
46
46
|
"@dnd-kit/utilities": "^3.2.2",
|
|
47
47
|
"@react-spring/web": "^9.7.5",
|
|
48
|
-
"@splunk/react-icons": "^5.
|
|
49
|
-
"@splunk/themes": "^1.
|
|
48
|
+
"@splunk/react-icons": "^5.9.0",
|
|
49
|
+
"@splunk/themes": "^1.6.0",
|
|
50
50
|
"@splunk/ui-utils": "^1.12.0",
|
|
51
51
|
"decimal.js-light": "^2.5.1",
|
|
52
52
|
"intl-tel-input": "^25.3.2",
|
|
@@ -63,9 +63,10 @@
|
|
|
63
63
|
"@babel/core": "^7.28.0",
|
|
64
64
|
"@babel/plugin-transform-runtime": "^7.28.0",
|
|
65
65
|
"@splunk/babel-preset": "^4.0.0",
|
|
66
|
-
"@splunk/docs-gen": "^1.
|
|
66
|
+
"@splunk/docs-gen": "^1.4.0",
|
|
67
67
|
"@splunk/eslint-config": "^5.0.0",
|
|
68
|
-
"@splunk/
|
|
68
|
+
"@splunk/eslint-plugin-splunk-ui": "^0.1.0",
|
|
69
|
+
"@splunk/react-docs": "^1.6.0",
|
|
69
70
|
"@splunk/stylelint-config": "^5.0.0",
|
|
70
71
|
"@splunk/test-runner-utils": "^0.4.1",
|
|
71
72
|
"@splunk/webpack-configs": "^7.0.3",
|
package/types/src/Box/Box.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { ComponentProps } from '../utils/types';
|
|
4
3
|
interface BoxPropsBase {
|
|
5
4
|
children?: React.ReactNode;
|
|
@@ -15,13 +14,6 @@ type BoxProps = ComponentProps<BoxPropsBase, 'div'>;
|
|
|
15
14
|
/**
|
|
16
15
|
* Box is a utility component to normalize and abstract common layout styles.
|
|
17
16
|
*/
|
|
18
|
-
declare
|
|
19
|
-
declare namespace Box {
|
|
20
|
-
var propTypes: {
|
|
21
|
-
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
22
|
-
elementRef: PropTypes.Requireable<object>;
|
|
23
|
-
flex: PropTypes.Requireable<boolean>;
|
|
24
|
-
inline: PropTypes.Requireable<boolean>;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
17
|
+
declare const Box: React.ForwardRefExoticComponent<BoxPropsBase & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref" | "css" | keyof BoxPropsBase> & React.RefAttributes<HTMLElement>>;
|
|
27
18
|
export default Box;
|
|
19
|
+
export type { BoxProps, BoxPropsBase };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { ComponentProps } from '../utils/types';
|
|
4
|
+
interface BodyPropsBase {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
type BodyProps = ComponentProps<BodyPropsBase, 'div'>;
|
|
8
|
+
/**
|
|
9
|
+
* A styled container for `Drawer` body content.
|
|
10
|
+
*/
|
|
11
|
+
declare function Body({ children, ...otherProps }: BodyProps): React.JSX.Element;
|
|
12
|
+
declare namespace Body {
|
|
13
|
+
var propTypes: {
|
|
14
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export default Body;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import Body from './Body';
|
|
4
|
+
import Footer from './Footer';
|
|
5
|
+
import Header from './Header';
|
|
6
|
+
import { ComponentProps } from '../utils/types';
|
|
7
|
+
/** @public */
|
|
8
|
+
type DrawerRequestCloseHandler = (data: {
|
|
9
|
+
event: React.MouseEvent<HTMLDivElement | HTMLAnchorElement | HTMLButtonElement> | MouseEvent | KeyboardEvent | TouchEvent;
|
|
10
|
+
reason: 'clickAway' | 'escapeKey' | 'clickCloseButton';
|
|
11
|
+
}) => void;
|
|
12
|
+
type DrawerInitialFocus = 'first' | 'container' | (React.Component & {
|
|
13
|
+
focus: () => void;
|
|
14
|
+
}) | HTMLElement | null;
|
|
15
|
+
interface DrawerPropsBase {
|
|
16
|
+
/**
|
|
17
|
+
* Any renderable children can be passed to the `Drawer`.
|
|
18
|
+
*
|
|
19
|
+
* To use the default `Drawer` styles, use the
|
|
20
|
+
* `Drawer.Header`, `Drawer.Body`, and `Drawer.Footer`.
|
|
21
|
+
*/
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Set to `true` to enable closing the Drawer by clicking the scrim (overlay).
|
|
25
|
+
*
|
|
26
|
+
* Only applies to `position="page"` because other position modes do not have a scrim.
|
|
27
|
+
*
|
|
28
|
+
* When `false` (default), the scrim is still displayed to block interaction with
|
|
29
|
+
* underlying content, but clicking it will not close the Drawer.
|
|
30
|
+
*
|
|
31
|
+
* Closing on click away should be avoided as it can lead to accidental dismissal
|
|
32
|
+
* of the drawer causing data loss or disruption of a user's workflow.
|
|
33
|
+
* Only enable click outside to dismiss when:
|
|
34
|
+
* - The drawer content is non-critical or purely informational
|
|
35
|
+
* - Accidental dismissal will not result in loss of progress, data, or important context
|
|
36
|
+
*
|
|
37
|
+
* When enabled, `onRequestClose` will receive an event with reason `clickAway`.
|
|
38
|
+
*/
|
|
39
|
+
closeOnClickAway?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Show dividers between header, body and footer.
|
|
42
|
+
*/
|
|
43
|
+
divider?: 'header' | 'footer' | 'both' | 'none';
|
|
44
|
+
/**
|
|
45
|
+
* A React ref which is set to the DOM element when the component mounts and null when it unmounts.
|
|
46
|
+
*/
|
|
47
|
+
elementRef?: React.Ref<HTMLDivElement>;
|
|
48
|
+
/**
|
|
49
|
+
* Allows focus to be set to a component other than the default.
|
|
50
|
+
* Supports `first` (first focusable element in the drawer), `container` (focus the drawer itself), or a ref.
|
|
51
|
+
*/
|
|
52
|
+
initialFocus?: DrawerInitialFocus;
|
|
53
|
+
/**
|
|
54
|
+
* Called when a close event occurs.
|
|
55
|
+
*
|
|
56
|
+
* The callback is passed the event and a reason, which is `escapeKey`, `clickAway`, or `clickCloseButton`.
|
|
57
|
+
*
|
|
58
|
+
* Generally, use this callback to toggle the `open` prop.
|
|
59
|
+
*/
|
|
60
|
+
onRequestClose?: DrawerRequestCloseHandler;
|
|
61
|
+
/**
|
|
62
|
+
* Set `open` to `true` to open the drawer and `false` to close it.
|
|
63
|
+
*/
|
|
64
|
+
open?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The layout mode for the drawer.
|
|
67
|
+
* - `page`: Positions relative to the viewport (default)
|
|
68
|
+
* - `container`: Positions relative to nearest positioned ancestor
|
|
69
|
+
* - `inline`: Renders inline without portal, allowing content to reflow around the drawer
|
|
70
|
+
*/
|
|
71
|
+
position?: 'page' | 'container' | 'inline';
|
|
72
|
+
/**
|
|
73
|
+
* Pass the ref of the invoking element (or other element that follows the logical flow of the application) to automatically move focus
|
|
74
|
+
* to the invoking element on `Drawer` close. If using a ref is not possible, you *must* pass a function that sets focus to the appropriate element.
|
|
75
|
+
* This function will be called after `onRequestClose`.
|
|
76
|
+
*
|
|
77
|
+
* Recommended when `position` is `page` to ensure proper focus management.
|
|
78
|
+
*/
|
|
79
|
+
returnFocus?: React.MutableRefObject<(React.Component & {
|
|
80
|
+
focus: () => void;
|
|
81
|
+
}) | HTMLElement | null> | (() => void);
|
|
82
|
+
/**
|
|
83
|
+
* Width of the drawer.
|
|
84
|
+
*/
|
|
85
|
+
width?: string;
|
|
86
|
+
}
|
|
87
|
+
interface DrawerPageProps extends DrawerPropsBase {
|
|
88
|
+
position?: 'page';
|
|
89
|
+
}
|
|
90
|
+
interface DrawerNonPageProps extends DrawerPropsBase {
|
|
91
|
+
position: 'container' | 'inline';
|
|
92
|
+
closeOnClickAway?: never;
|
|
93
|
+
}
|
|
94
|
+
type DrawerProps = ComponentProps<DrawerPageProps | DrawerNonPageProps, 'div', 'onAnimationStart' | 'onAnimationEnd'>;
|
|
95
|
+
declare function Drawer({ children, closeOnClickAway, elementRef, divider, initialFocus, onRequestClose, open, position, returnFocus, width, className, ...otherProps }: DrawerProps): React.JSX.Element;
|
|
96
|
+
declare namespace Drawer {
|
|
97
|
+
var propTypes: {
|
|
98
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
99
|
+
closeOnClickAway: PropTypes.Requireable<boolean>;
|
|
100
|
+
divider: PropTypes.Requireable<string>;
|
|
101
|
+
elementRef: PropTypes.Requireable<object>;
|
|
102
|
+
initialFocus: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
|
|
103
|
+
onRequestClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
104
|
+
open: PropTypes.Requireable<boolean>;
|
|
105
|
+
position: PropTypes.Requireable<string>;
|
|
106
|
+
returnFocus: PropTypes.Requireable<object>;
|
|
107
|
+
width: PropTypes.Requireable<string>;
|
|
108
|
+
};
|
|
109
|
+
var Header: typeof import("./Header").default;
|
|
110
|
+
var Footer: typeof import("./Footer").default;
|
|
111
|
+
var Body: typeof import("./Body").default;
|
|
112
|
+
}
|
|
113
|
+
export default Drawer;
|
|
114
|
+
export { Body, Header, Footer, DrawerRequestCloseHandler };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DrawerRequestCloseHandler } from '@splunk/react-ui/Drawer';
|
|
2
|
+
export interface DrawerContext {
|
|
3
|
+
divider?: 'header' | 'footer' | 'both' | 'none';
|
|
4
|
+
titleId?: string;
|
|
5
|
+
subtitleId?: string;
|
|
6
|
+
onRequestClose?: DrawerRequestCloseHandler;
|
|
7
|
+
onSubtitleRender?: (hasSubtitle: boolean) => void;
|
|
8
|
+
onTitleRender?: (hasTitle: boolean) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const DrawerContext: import("react").Context<DrawerContext>;
|
|
11
|
+
export default DrawerContext;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { ComponentProps } from '../utils/types';
|
|
4
|
+
interface FooterPropsBase {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Controls the layout and styling for children.
|
|
8
|
+
*
|
|
9
|
+
* `auto` will style children for common use cases, such as: buttons; controls; documentation links; or a combination.
|
|
10
|
+
* Set `none` when custom styling is needed.
|
|
11
|
+
*/
|
|
12
|
+
layout?: 'auto' | 'none';
|
|
13
|
+
}
|
|
14
|
+
type FooterProps = ComponentProps<FooterPropsBase, 'div'>;
|
|
15
|
+
/**
|
|
16
|
+
* A styled container for `Drawer` footer content.
|
|
17
|
+
*/
|
|
18
|
+
declare function Footer({ children, layout, ...otherProps }: FooterProps): React.JSX.Element;
|
|
19
|
+
declare namespace Footer {
|
|
20
|
+
var propTypes: {
|
|
21
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
22
|
+
layout: PropTypes.Requireable<string>;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export default Footer;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { ComponentProps } from '../utils/types';
|
|
4
|
+
interface HeaderPropsBase {
|
|
5
|
+
/**
|
|
6
|
+
* `children` might be passed instead of a title. Note that `children` aren't
|
|
7
|
+
* rendered if a title is provided.
|
|
8
|
+
*/
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Hide the closeButton in the Header if `onRequestClose` is provided to `Drawer`.
|
|
12
|
+
*/
|
|
13
|
+
hideCloseButton?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* The icon to show before the title.
|
|
16
|
+
*/
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Used as the main heading.
|
|
20
|
+
*/
|
|
21
|
+
title?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Used as the subheading. Only shown if `title` is also present.
|
|
24
|
+
*/
|
|
25
|
+
subtitle?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
type HeaderProps = ComponentProps<HeaderPropsBase, 'div'>;
|
|
28
|
+
/**
|
|
29
|
+
* A styled container for `Drawer` header content.
|
|
30
|
+
*/
|
|
31
|
+
declare function Header({ children, icon, hideCloseButton, title, subtitle, ...otherProps }: HeaderProps): React.JSX.Element;
|
|
32
|
+
declare namespace Header {
|
|
33
|
+
var propTypes: {
|
|
34
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
35
|
+
icon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
36
|
+
hideCloseButton: PropTypes.Requireable<boolean>;
|
|
37
|
+
title: PropTypes.Requireable<string>;
|
|
38
|
+
subtitle: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export default Header;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @name Initial focus
|
|
4
|
+
* @description Initial focus can be set to a different element using the `initialFocus` prop.
|
|
5
|
+
* Use `'first'` to focus the first focusable element, `'container'` to focus the drawer itself,
|
|
6
|
+
* or pass a ref to a specific element.
|
|
7
|
+
*/
|
|
8
|
+
declare function InitialFocus(): React.JSX.Element;
|
|
9
|
+
export default InitialFocus;
|