@redis-ui/components 51.7.0 → 51.7.2
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/README.md
CHANGED
|
@@ -7,9 +7,11 @@ The Redis UI component library — a themed, accessible React component library
|
|
|
7
7
|
Install the components package and its required peer dependencies:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm install @redis-ui/components @redis-ui/styles @redis-ui/icons styled-components
|
|
10
|
+
npm install @redis-ui/components @redis-ui/styles @redis-ui/icons styled-components modern-normalize
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
Peer dependencies: `react` and `react-dom` 18 or 19, `styled-components` 5, `@redis-ui/styles` 21.4 or later, `@redis-ui/icons` 8–10. For tables and charts, add [`@redis-ui/table`](https://www.npmjs.com/package/@redis-ui/table) and [`@redis-ui/charts`](https://www.npmjs.com/package/@redis-ui/charts).
|
|
14
|
+
|
|
13
15
|
## Setup
|
|
14
16
|
|
|
15
17
|
### 1. Import global styles
|
|
@@ -17,8 +19,9 @@ npm install @redis-ui/components @redis-ui/styles @redis-ui/icons styled-compone
|
|
|
17
19
|
Import the normalized styles and fonts from `@redis-ui/styles` in your app entry point:
|
|
18
20
|
|
|
19
21
|
```ts
|
|
22
|
+
import 'modern-normalize/modern-normalize.css';
|
|
20
23
|
import '@redis-ui/styles/normalized-styles.css';
|
|
21
|
-
import '@redis-ui/styles/fonts.css';
|
|
24
|
+
import '@redis-ui/styles/fonts.css'; // or fonts-next.css with themesNext, see below
|
|
22
25
|
```
|
|
23
26
|
|
|
24
27
|
### 2. Provide the theme and render global styles
|
|
@@ -27,26 +30,39 @@ Components read all design tokens (colors, spacing, typography, etc.) from a sty
|
|
|
27
30
|
|
|
28
31
|
You also need to render the `CommonStyles` global style component inside the theme provider. It applies theme-aware base styles to the body, scrollbars, and reduced-motion preferences.
|
|
29
32
|
|
|
33
|
+
Finally, wrap the app in `TooltipProvider`. Every `Tooltip`, including tooltips rendered inside other components, throws at render time without it.
|
|
34
|
+
|
|
30
35
|
```tsx
|
|
31
36
|
import { ThemeProvider } from 'styled-components';
|
|
32
37
|
import { themes, CommonStyles } from '@redis-ui/styles';
|
|
38
|
+
import { TooltipProvider } from '@redis-ui/components';
|
|
33
39
|
|
|
34
40
|
function App() {
|
|
35
41
|
return (
|
|
36
42
|
<ThemeProvider theme={themes.light}>
|
|
37
43
|
<CommonStyles />
|
|
38
|
-
{/* your app */}
|
|
44
|
+
<TooltipProvider>{/* your app */}</TooltipProvider>
|
|
39
45
|
</ThemeProvider>
|
|
40
46
|
);
|
|
41
47
|
}
|
|
42
48
|
```
|
|
43
49
|
|
|
50
|
+
#### Choosing a theme bundle
|
|
51
|
+
|
|
52
|
+
`@redis-ui/styles` exports two bundles, each with `light` and `dark`:
|
|
53
|
+
|
|
54
|
+
- `themes` with `fonts.css`: the current (classic) Redis brand
|
|
55
|
+
- `themesNext` with `fonts-next.css`: the next brand, used by the Redis Ultra console
|
|
56
|
+
|
|
57
|
+
Use one bundle per app. Pass `themesNext.light` (or `.dark`) wherever the examples use `themes.light`, and import the matching fonts file. See [`@redis-ui/styles`](https://www.npmjs.com/package/@redis-ui/styles).
|
|
58
|
+
|
|
44
59
|
#### Dark mode support
|
|
45
60
|
|
|
46
61
|
For automatic light/dark mode switching with persistence, use the `SwitchableModeThemeProvider`:
|
|
47
62
|
|
|
48
63
|
```tsx
|
|
49
64
|
import { SwitchableModeThemeProvider, themes, CommonStyles } from '@redis-ui/styles';
|
|
65
|
+
import { TooltipProvider } from '@redis-ui/components';
|
|
50
66
|
|
|
51
67
|
function App() {
|
|
52
68
|
return (
|
|
@@ -56,7 +72,7 @@ function App() {
|
|
|
56
72
|
storageKey="redis-ui-theme-mode"
|
|
57
73
|
>
|
|
58
74
|
<CommonStyles />
|
|
59
|
-
{/* your app */}
|
|
75
|
+
<TooltipProvider>{/* your app */}</TooltipProvider>
|
|
60
76
|
</SwitchableModeThemeProvider>
|
|
61
77
|
);
|
|
62
78
|
}
|
|
@@ -76,4 +92,14 @@ function MyPage() {
|
|
|
76
92
|
</div>
|
|
77
93
|
);
|
|
78
94
|
}
|
|
79
|
-
```
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Documentation
|
|
98
|
+
|
|
99
|
+
- **Storybook**: live examples, props tables and composition guides for the components: https://redislabsdev.github.io/redis-ui/
|
|
100
|
+
- **Agent skill**: `skills/redis-ui-components` ships in this package, with a reference for nearly every component (`Skeleton` and `TreeView` are still missing). See [Redis UI Skills](https://github.com/redislabsdev/redis-ui#redis-ui-skills) to link it into your project.
|
|
101
|
+
- **Release notes**: [GitHub Releases](https://github.com/redislabsdev/redis-ui/releases)
|
|
102
|
+
|
|
103
|
+
## Contributing
|
|
104
|
+
|
|
105
|
+
See [CONTRIBUTING.md](https://github.com/redislabsdev/redis-ui/blob/master/packages/components/CONTRIBUTING.md) for how components are built (Radix, folder structure, conventions, tests), and the [root README](https://github.com/redislabsdev/redis-ui) for Storybook, visual testing and releasing.
|
package/package.json
CHANGED
|
@@ -8,7 +8,13 @@ Popup component triggered by pointer hover, with customizable content, controlle
|
|
|
8
8
|
import { Tooltip, TooltipProvider } from '@redis-ui/components';
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
>
|
|
11
|
+
> **`TooltipProvider` is required.** Every `Tooltip` (including tooltips rendered inside other components) must have a `TooltipProvider` ancestor, or it throws at render time. Mount one once near the app root, inside the theme provider. It also sets the shared hover delay (`openDelayDuration`, default `0`). The examples below assume it is already mounted.
|
|
12
|
+
>
|
|
13
|
+
> ```tsx
|
|
14
|
+
> <TooltipProvider>
|
|
15
|
+
> <App />
|
|
16
|
+
> </TooltipProvider>
|
|
17
|
+
> ```
|
|
12
18
|
|
|
13
19
|
> Examples that use `InfoIcon` also import it from `@redis-ui/icons`.
|
|
14
20
|
|
|
@@ -626,7 +632,7 @@ function Render() {
|
|
|
626
632
|
|
|
627
633
|
## Notes
|
|
628
634
|
|
|
629
|
-
- `TooltipProvider` defaults `openDelayDuration` to `0`.
|
|
635
|
+
- `TooltipProvider` is required: without an ancestor provider, `Tooltip` throws (it is built on Radix Tooltip). It defaults `openDelayDuration` to `0`.
|
|
630
636
|
- `Tooltip.Content` hides itself when `content` is falsy.
|
|
631
637
|
- `Tooltip.Trigger` can wrap plain text, SVG, or multi-element triggers by setting `withButton`.
|
|
632
638
|
- `Tooltip.Compose` supports controlled and uncontrolled open state.
|