@redis-ui/styles 21.13.0 → 21.14.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/README.md +110 -0
- package/dist/index.js +122 -4
- package/dist/index.umd.cjs +1 -1
- package/dist/themes/themeDark/theme/components/select.js +28 -1
- package/dist/themes/themeDarkNext/theme/components/breadcrumbs.js +1 -0
- package/dist/themes/themeDarkNext/theme/components/select.js +28 -1
- package/dist/themes/themeLight/theme/components/select.js +28 -1
- package/dist/themes/themeLightNext/theme/components/breadcrumbs.js +1 -0
- package/dist/themes/themeLightNext/theme/components/select.js +28 -1
- package/dist/themes/types/theme/components/breadcrumbs.types.d.ts +2 -0
- package/dist/themes/types/theme/components/select.types.d.ts +27 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# @redis-ui/styles
|
|
2
|
+
|
|
3
|
+
Design tokens, themes and global styles for Redis UI. Every Redis UI package (`components`, `table`, `charts`, `icons`) reads its colors, spacing, typography and component styles from the theme this package provides.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @redis-ui/styles styled-components modern-normalize
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependencies: `react` and `react-dom` 18 or 19, `styled-components` 5, `modern-normalize` 3.
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
Import the CSS once in your app entry, then provide a theme and render `CommonStyles`:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import 'modern-normalize/modern-normalize.css';
|
|
19
|
+
import '@redis-ui/styles/normalized-styles.css';
|
|
20
|
+
import '@redis-ui/styles/fonts.css';
|
|
21
|
+
import { ThemeProvider } from 'styled-components';
|
|
22
|
+
import { CommonStyles, themes } from '@redis-ui/styles';
|
|
23
|
+
|
|
24
|
+
<ThemeProvider theme={themes.light}>
|
|
25
|
+
<CommonStyles />
|
|
26
|
+
<App />
|
|
27
|
+
</ThemeProvider>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
| Export | What it is |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `@redis-ui/styles/normalized-styles.css` | Resets for Redis UI elements, so global app styles don't override them. Import it after your normalization sheet. To add your own, target `[class*="RedisUI"]` |
|
|
33
|
+
| `@redis-ui/styles/fonts.css` | Fonts for the classic `themes` |
|
|
34
|
+
| `@redis-ui/styles/fonts-next.css` | Fonts for `themesNext` |
|
|
35
|
+
| `CommonStyles` | Global styles from the theme (body, scrollbars), plus a reduced-motion safety net for users with `prefers-reduced-motion: reduce` |
|
|
36
|
+
|
|
37
|
+
## Themes
|
|
38
|
+
|
|
39
|
+
Two theme bundles are exported, each with a `light` and a `dark` theme:
|
|
40
|
+
|
|
41
|
+
| Bundle | Fonts | Use for |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| `themes` | `fonts.css` | The current (classic) Redis brand |
|
|
44
|
+
| `themesNext` | `fonts-next.css` | The next brand, used by the Redis Ultra console |
|
|
45
|
+
|
|
46
|
+
Use one bundle per app, and import the fonts file that matches it. To try components in both, use the theme switcher in [Storybook](https://redislabsdev.github.io/redis-ui/).
|
|
47
|
+
|
|
48
|
+
The `theme` export is the classic light theme and is meant for tests only. Don't use it in apps.
|
|
49
|
+
|
|
50
|
+
### Light/dark switching
|
|
51
|
+
|
|
52
|
+
`SwitchableModeThemeProvider` replaces `ThemeProvider` when the user can switch modes. It persists the choice under `storageKey`:
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { CommonStyles, SwitchableModeThemeProvider, themes } from '@redis-ui/styles';
|
|
56
|
+
|
|
57
|
+
<SwitchableModeThemeProvider
|
|
58
|
+
lightTheme={themes.light}
|
|
59
|
+
darkTheme={themes.dark}
|
|
60
|
+
storageKey="redis-ui-theme-mode"
|
|
61
|
+
>
|
|
62
|
+
<CommonStyles />
|
|
63
|
+
<App />
|
|
64
|
+
</SwitchableModeThemeProvider>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Pair it with the `ThemeModeSwitch` component from `@redis-ui/components`. See **Others → Theme Providers → Theme Mode Switching** in Storybook.
|
|
68
|
+
|
|
69
|
+
## Using the theme in your own styles
|
|
70
|
+
|
|
71
|
+
A theme has three parts:
|
|
72
|
+
|
|
73
|
+
- `core`: the scales (`space`, `font`, `icon`, `shadow`, `zIndex`, `motion`, `focus`), e.g. `theme.core.space.space400`
|
|
74
|
+
- `semantic.color`: semantic colors by role (`text`, `background`, `border`, `icon`), e.g. `theme.semantic.color.background.neutral100`
|
|
75
|
+
- `components`: per-component tokens used by Redis UI components, e.g. `theme.components.button`
|
|
76
|
+
|
|
77
|
+
Read it in styled-components, or with the `useTheme` hook:
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import styled from 'styled-components';
|
|
81
|
+
import { useTheme } from '@redis-ui/styles';
|
|
82
|
+
|
|
83
|
+
const Panel = styled.div`
|
|
84
|
+
padding: ${({ theme }) => theme.core.space.space400};
|
|
85
|
+
background: ${({ theme }) => theme.semantic.color.background.neutral100};
|
|
86
|
+
`;
|
|
87
|
+
|
|
88
|
+
const { mode } = useTheme(); // 'light' | 'dark'
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Use tokens instead of hard-coded values, so your UI follows both themes and both modes.
|
|
92
|
+
|
|
93
|
+
## Other exports
|
|
94
|
+
|
|
95
|
+
- `getFocusStyle()` / `getFocusStyleProperties()`: the design system's focus ring, for custom interactive elements
|
|
96
|
+
- `usePrefersReducedMotion()`: `true` when the user asked for reduced motion
|
|
97
|
+
- `useStorage()`: the persisted-value hook used by mode switching
|
|
98
|
+
- `withOpacity()` / `withContrast()`: color helpers
|
|
99
|
+
- Theme types (`Theme`, `ThemePair`, ...)
|
|
100
|
+
|
|
101
|
+
## Development
|
|
102
|
+
|
|
103
|
+
The themes live in `src/themes/<themeLight|themeDark|themeLightNext|themeDarkNext>/`. Each one has `tokens.ts` (semantic colors and core scales) and `theme/components/*` (component tokens). A change to one bundle usually needs the same change in its light/dark sibling. To add or retire a whole bundle (a rebrand), follow the `redis-ui-rebrand-theme` skill in `.agents/skills`.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npm run build -w packages/styles
|
|
107
|
+
npm run lint -w packages/styles
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This package has no unit tests. Changes show up in the components' stories and visual tests. See the [root README](https://github.com/redislabsdev/redis-ui) for Storybook, visual testing and releasing.
|
package/dist/index.js
CHANGED
|
@@ -3214,13 +3214,42 @@ var mt = (e) => e.reduce((e, t) => (e.light.push(t.light), e.dark.push(t.dark),
|
|
|
3214
3214
|
borderRadius: "0.4rem",
|
|
3215
3215
|
triggerOffset: "0.4rem",
|
|
3216
3216
|
maxHeight: "50vh",
|
|
3217
|
-
search: {
|
|
3217
|
+
search: {
|
|
3218
|
+
margin: "0.8rem 1.6rem",
|
|
3219
|
+
inline: {
|
|
3220
|
+
padding: "1.1rem 1.3rem",
|
|
3221
|
+
gap: "0.9rem",
|
|
3222
|
+
fontSize: m.core.font.fontSize.s13,
|
|
3223
|
+
iconSize: "1.4rem"
|
|
3224
|
+
}
|
|
3225
|
+
},
|
|
3218
3226
|
footer: {
|
|
3219
3227
|
blockPadding: "1rem 0.2rem",
|
|
3220
3228
|
inlinePadding: "1.6rem",
|
|
3221
3229
|
separator: {
|
|
3222
3230
|
size: "1px",
|
|
3223
3231
|
color: m.semantic.color.border.secondary300
|
|
3232
|
+
},
|
|
3233
|
+
action: {
|
|
3234
|
+
padding: "1.1rem 1.5rem",
|
|
3235
|
+
gap: "0.9rem",
|
|
3236
|
+
fontSize: m.core.font.fontSize.s13,
|
|
3237
|
+
iconSize: "1.3rem",
|
|
3238
|
+
textColor: m.semantic.color.text.secondary950,
|
|
3239
|
+
iconColor: m.semantic.color.icon.secondary950,
|
|
3240
|
+
hoverBgColor: m.semantic.color.background.secondary100
|
|
3241
|
+
}
|
|
3242
|
+
},
|
|
3243
|
+
compact: {
|
|
3244
|
+
listPadding: "0.5rem",
|
|
3245
|
+
borderColor: m.semantic.color.border.secondary300,
|
|
3246
|
+
option: {
|
|
3247
|
+
height: "3.6rem",
|
|
3248
|
+
fontSize: m.core.font.fontSize.s13,
|
|
3249
|
+
padding: "0 0.4rem 0 1rem",
|
|
3250
|
+
gap: "0.9rem",
|
|
3251
|
+
borderRadius: "0.4rem",
|
|
3252
|
+
indicatorSize: "1.4rem"
|
|
3224
3253
|
}
|
|
3225
3254
|
},
|
|
3226
3255
|
option: {
|
|
@@ -6195,13 +6224,42 @@ var mt = (e) => e.reduce((e, t) => (e.light.push(t.light), e.dark.push(t.dark),
|
|
|
6195
6224
|
borderRadius: "0.4rem",
|
|
6196
6225
|
triggerOffset: "0.4rem",
|
|
6197
6226
|
maxHeight: "50vh",
|
|
6198
|
-
search: {
|
|
6227
|
+
search: {
|
|
6228
|
+
margin: "0.8rem 1.6rem",
|
|
6229
|
+
inline: {
|
|
6230
|
+
padding: "1.1rem 1.3rem",
|
|
6231
|
+
gap: "0.9rem",
|
|
6232
|
+
fontSize: L.core.font.fontSize.s13,
|
|
6233
|
+
iconSize: "1.4rem"
|
|
6234
|
+
}
|
|
6235
|
+
},
|
|
6199
6236
|
footer: {
|
|
6200
6237
|
blockPadding: "1rem 0.2rem",
|
|
6201
6238
|
inlinePadding: "1.6rem",
|
|
6202
6239
|
separator: {
|
|
6203
6240
|
size: "1px",
|
|
6204
6241
|
color: L.semantic.color.border.secondary800
|
|
6242
|
+
},
|
|
6243
|
+
action: {
|
|
6244
|
+
padding: "1.1rem 1.5rem",
|
|
6245
|
+
gap: "0.9rem",
|
|
6246
|
+
fontSize: L.core.font.fontSize.s13,
|
|
6247
|
+
iconSize: "1.3rem",
|
|
6248
|
+
textColor: L.semantic.color.text.secondary50,
|
|
6249
|
+
iconColor: L.semantic.color.icon.secondary400,
|
|
6250
|
+
hoverBgColor: L.semantic.color.background.secondary800
|
|
6251
|
+
}
|
|
6252
|
+
},
|
|
6253
|
+
compact: {
|
|
6254
|
+
listPadding: "0.5rem",
|
|
6255
|
+
borderColor: L.semantic.color.border.secondary800,
|
|
6256
|
+
option: {
|
|
6257
|
+
height: "3.6rem",
|
|
6258
|
+
fontSize: L.core.font.fontSize.s13,
|
|
6259
|
+
padding: "0 0.4rem 0 1rem",
|
|
6260
|
+
gap: "0.9rem",
|
|
6261
|
+
borderRadius: "0.4rem",
|
|
6262
|
+
indicatorSize: "1.4rem"
|
|
6205
6263
|
}
|
|
6206
6264
|
},
|
|
6207
6265
|
option: {
|
|
@@ -7859,6 +7917,7 @@ var mt = (e) => e.reduce((e, t) => (e.light.push(t.light), e.dark.push(t.dark),
|
|
|
7859
7917
|
defaultItem: { gap: "0.4rem" }
|
|
7860
7918
|
}, Fr = {
|
|
7861
7919
|
gap: V.core.space.space100,
|
|
7920
|
+
fontSize: V.core.font.fontSize.s13,
|
|
7862
7921
|
link: { states: {
|
|
7863
7922
|
normal: { textColor: V.semantic.color.text.secondary500 },
|
|
7864
7923
|
hover: { textColor: V.semantic.color.text.secondary950 },
|
|
@@ -9202,13 +9261,42 @@ var mt = (e) => e.reduce((e, t) => (e.light.push(t.light), e.dark.push(t.dark),
|
|
|
9202
9261
|
borderRadius: "0.5rem",
|
|
9203
9262
|
triggerOffset: "0.4rem",
|
|
9204
9263
|
maxHeight: "50vh",
|
|
9205
|
-
search: {
|
|
9264
|
+
search: {
|
|
9265
|
+
margin: "0.8rem 1.6rem",
|
|
9266
|
+
inline: {
|
|
9267
|
+
padding: "1.1rem 1.3rem",
|
|
9268
|
+
gap: "0.9rem",
|
|
9269
|
+
fontSize: V.core.font.fontSize.s13,
|
|
9270
|
+
iconSize: "1.4rem"
|
|
9271
|
+
}
|
|
9272
|
+
},
|
|
9206
9273
|
footer: {
|
|
9207
9274
|
blockPadding: "1rem 0.2rem",
|
|
9208
9275
|
inlinePadding: "1.6rem",
|
|
9209
9276
|
separator: {
|
|
9210
9277
|
size: "1px",
|
|
9211
9278
|
color: V.semantic.color.text.secondary200
|
|
9279
|
+
},
|
|
9280
|
+
action: {
|
|
9281
|
+
padding: "1.1rem 1.5rem",
|
|
9282
|
+
gap: "0.9rem",
|
|
9283
|
+
fontSize: V.core.font.fontSize.s13,
|
|
9284
|
+
iconSize: "1.3rem",
|
|
9285
|
+
textColor: V.semantic.color.text.secondary950,
|
|
9286
|
+
iconColor: V.semantic.color.icon.secondary500,
|
|
9287
|
+
hoverBgColor: V.semantic.color.background.neutral100
|
|
9288
|
+
}
|
|
9289
|
+
},
|
|
9290
|
+
compact: {
|
|
9291
|
+
listPadding: "0.5rem",
|
|
9292
|
+
borderColor: V.semantic.color.text.secondary200,
|
|
9293
|
+
option: {
|
|
9294
|
+
height: "3.6rem",
|
|
9295
|
+
fontSize: V.core.font.fontSize.s13,
|
|
9296
|
+
padding: "0 0.4rem 0 1rem",
|
|
9297
|
+
gap: "0.9rem",
|
|
9298
|
+
borderRadius: "0.4rem",
|
|
9299
|
+
indicatorSize: "1.4rem"
|
|
9212
9300
|
}
|
|
9213
9301
|
},
|
|
9214
9302
|
option: {
|
|
@@ -10892,6 +10980,7 @@ var mt = (e) => e.reduce((e, t) => (e.light.push(t.light), e.dark.push(t.dark),
|
|
|
10892
10980
|
defaultItem: { gap: "0.4rem" }
|
|
10893
10981
|
}, Ki = {
|
|
10894
10982
|
gap: K.core.space.space100,
|
|
10983
|
+
fontSize: K.core.font.fontSize.s13,
|
|
10895
10984
|
link: { states: {
|
|
10896
10985
|
normal: { textColor: K.semantic.color.text.secondary300 },
|
|
10897
10986
|
hover: { textColor: K.semantic.color.text.secondary0 },
|
|
@@ -12236,13 +12325,42 @@ var mt = (e) => e.reduce((e, t) => (e.light.push(t.light), e.dark.push(t.dark),
|
|
|
12236
12325
|
borderRadius: "0.5rem",
|
|
12237
12326
|
triggerOffset: "0.4rem",
|
|
12238
12327
|
maxHeight: "50vh",
|
|
12239
|
-
search: {
|
|
12328
|
+
search: {
|
|
12329
|
+
margin: "0.8rem 1.6rem",
|
|
12330
|
+
inline: {
|
|
12331
|
+
padding: "1.1rem 1.3rem",
|
|
12332
|
+
gap: "0.9rem",
|
|
12333
|
+
fontSize: K.core.font.fontSize.s13,
|
|
12334
|
+
iconSize: "1.4rem"
|
|
12335
|
+
}
|
|
12336
|
+
},
|
|
12240
12337
|
footer: {
|
|
12241
12338
|
blockPadding: "1rem 0.2rem",
|
|
12242
12339
|
inlinePadding: "1.6rem",
|
|
12243
12340
|
separator: {
|
|
12244
12341
|
size: "1px",
|
|
12245
12342
|
color: K.semantic.color.text.secondary700
|
|
12343
|
+
},
|
|
12344
|
+
action: {
|
|
12345
|
+
padding: "1.1rem 1.5rem",
|
|
12346
|
+
gap: "0.9rem",
|
|
12347
|
+
fontSize: K.core.font.fontSize.s13,
|
|
12348
|
+
iconSize: "1.3rem",
|
|
12349
|
+
textColor: K.semantic.color.text.secondary0,
|
|
12350
|
+
iconColor: K.semantic.color.icon.secondary400,
|
|
12351
|
+
hoverBgColor: K.semantic.color.background.secondary900
|
|
12352
|
+
}
|
|
12353
|
+
},
|
|
12354
|
+
compact: {
|
|
12355
|
+
listPadding: "0.5rem",
|
|
12356
|
+
borderColor: K.semantic.color.text.secondary700,
|
|
12357
|
+
option: {
|
|
12358
|
+
height: "3.6rem",
|
|
12359
|
+
fontSize: K.core.font.fontSize.s13,
|
|
12360
|
+
padding: "0 0.4rem 0 1rem",
|
|
12361
|
+
gap: "0.9rem",
|
|
12362
|
+
borderRadius: "0.4rem",
|
|
12363
|
+
indicatorSize: "1.4rem"
|
|
12246
12364
|
}
|
|
12247
12365
|
},
|
|
12248
12366
|
option: {
|