@redis-ui/components 51.25.0 → 51.27.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/dist/Button/CopyToClipboardButton/CopyToClipboardButton.cjs +17 -8
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.js +17 -8
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.types.d.ts +5 -1
- package/dist/Inputs/Input/Input.cjs +9 -2
- package/dist/Inputs/Input/Input.d.ts +4 -1
- package/dist/Inputs/Input/Input.js +9 -2
- package/dist/Inputs/Input/Input.types.d.ts +5 -1
- package/dist/Inputs/PasswordInput/components/Compose/Compose.types.d.ts +1 -1
- package/dist/Inputs/TextArea/TextArea.cjs +16 -6
- package/dist/Inputs/TextArea/TextArea.d.ts +3 -1
- package/dist/Inputs/TextArea/TextArea.js +16 -6
- package/dist/Inputs/TextArea/TextArea.types.d.ts +4 -1
- package/dist/Inputs/TextArea/components/CopyButton/CopyButton.cjs +7 -0
- package/dist/Inputs/TextArea/components/CopyButton/CopyButton.d.ts +2 -0
- package/dist/Inputs/TextArea/components/CopyButton/CopyButton.js +7 -0
- package/dist/Inputs/TextArea/components/CopyButton/CopyButton.style.cjs +17 -0
- package/dist/Inputs/TextArea/components/CopyButton/CopyButton.style.d.ts +1 -0
- package/dist/Inputs/TextArea/components/CopyButton/CopyButton.style.js +15 -0
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.cjs +3 -1
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.js +4 -2
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.style.cjs +8 -1
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.style.js +8 -1
- package/dist/Inputs/components/Compose/CommonCompose.cjs +23 -18
- package/dist/Inputs/components/Compose/CommonCompose.d.ts +1 -1
- package/dist/Inputs/components/Compose/CommonCompose.js +24 -19
- package/dist/Inputs/components/Compose/CommonCompose.types.d.ts +2 -0
- package/dist/Inputs/components/Compose/Compose.style.cjs +7 -0
- package/dist/Inputs/components/Compose/Compose.style.js +7 -0
- package/dist/Inputs/components/Compose/NumericCompose.types.d.ts +1 -1
- package/dist/Inputs/components/CopyButton/CopyButton.cjs +15 -0
- package/dist/Inputs/components/CopyButton/CopyButton.d.ts +2 -0
- package/dist/Inputs/components/CopyButton/CopyButton.js +15 -0
- package/dist/Inputs/components/CopyButton/CopyButton.style.cjs +17 -0
- package/dist/Inputs/components/CopyButton/CopyButton.style.d.ts +1 -0
- package/dist/Inputs/components/CopyButton/CopyButton.style.js +15 -0
- package/dist/Inputs/components/CopyButton/CopyButton.types.d.ts +6 -0
- package/dist/Inputs/components/CopyButton/CopyButton.types.js +1 -0
- package/dist/Inputs/components/InputTag/InputTag.cjs +3 -1
- package/dist/Inputs/components/InputTag/InputTag.js +4 -2
- package/dist/Inputs/components/InputTag/InputTag.style.cjs +1 -1
- package/dist/Inputs/components/InputTag/InputTag.style.js +1 -1
- package/dist/UseCaseList/UseCaseList.cjs +28 -0
- package/dist/UseCaseList/UseCaseList.d.ts +3 -0
- package/dist/UseCaseList/UseCaseList.js +28 -0
- package/dist/UseCaseList/UseCaseList.style.cjs +54 -0
- package/dist/UseCaseList/UseCaseList.style.d.ts +10 -0
- package/dist/UseCaseList/UseCaseList.style.js +48 -0
- package/dist/UseCaseList/UseCaseList.types.d.ts +12 -0
- package/dist/UseCaseList/UseCaseList.types.js +1 -0
- package/dist/UseCaseList/index.d.ts +2 -0
- package/dist/UseCaseList/index.js +2 -0
- package/dist/index.cjs +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/package.json +2 -2
- package/skills/redis-ui-components/SKILL.md +1 -0
- package/skills/redis-ui-components/references/CopyToClipboardButton.md +23 -1
- package/skills/redis-ui-components/references/Input.md +39 -2
- package/skills/redis-ui-components/references/SearchInput.md +1 -1
- package/skills/redis-ui-components/references/TextArea.md +19 -1
- package/skills/redis-ui-components/references/UseCaseList.md +86 -0
|
@@ -38,7 +38,10 @@ import { Input, FormField } from '@redis-ui/components';
|
|
|
38
38
|
| formatter | `(value: string, extra: { event?: ChangeEvent }) => string` | - | Formats the stored value before display. |
|
|
39
39
|
| readonlyRender | `ReadOnlyRenderComponent` | `DefaultReadonlyRender` | Custom renderer used when `readOnly` is enabled. |
|
|
40
40
|
| readonlyProps | `HTMLAttributes<HTMLElement>` | - | Props passed to the read-only wrapper. |
|
|
41
|
+
| boxedReadonly | `boolean` | `false` | `Input.Compose` only. Keeps the field box in read-only mode, with the inner input set to `readonly`, instead of `readonlyRender`. Set by `showCopyButton`. |
|
|
41
42
|
| allowReset | `boolean` | `false` | Shows the reset button when a value is present. |
|
|
43
|
+
| showCopyButton | `boolean` | `false` | Shows a copy button inside the box that copies the current value. With `readOnly`, keeps the box with a selectable, non-editable value. |
|
|
44
|
+
| copyButtonProps | `Partial<CopyToClipboardButtonProps>` (without `variant`) | - | Props for the copy button, such as `aria-label`, `copiedLabel` or `onCopy`. |
|
|
42
45
|
| loading | `boolean` | - | Shows the loading indicator. |
|
|
43
46
|
| autoSize | `boolean` | `false` | Makes the inner input size itself to the current value. |
|
|
44
47
|
|
|
@@ -49,6 +52,7 @@ The component also accepts standard `div` attributes on the compose wrapper and
|
|
|
49
52
|
- `Input.Compose` - Compose wrapper that manages value state, validation state, read-only rendering, and layout.
|
|
50
53
|
- `Input.Tag` - The underlying input element. Supports `autoSize`.
|
|
51
54
|
- `Input.ResetButton` - Clear/reset action button used when there is a value.
|
|
55
|
+
- `Input.CopyButton` - Copies the current value. Accepts `CopyToClipboardButton` props; `textToCopy` defaults to the field value. Stays enabled when the field is disabled.
|
|
52
56
|
- `Input.StatusIndicator` - Error/success status indicator with tooltip support for errors.
|
|
53
57
|
- `Input.LoadingIndicator` - Inline loading spinner shown while `loading` is true.
|
|
54
58
|
- `Input.ReadonlyValue` - Styled read-only text renderer used by the compose wrapper.
|
|
@@ -101,11 +105,42 @@ The component also accepts standard `div` attributes on the compose wrapper and
|
|
|
101
105
|
<Input placeholder="Text Input" defaultValue="orange" allowReset />
|
|
102
106
|
```
|
|
103
107
|
|
|
108
|
+
### CopyButton
|
|
109
|
+
|
|
110
|
+
> Set `showCopyButton` to show a copy button inside the field. With `readOnly`, the input keeps its box: the value can't be edited but can be focused, selected and copied, and a long value ends with an ellipsis. The font is left to the client.
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
<>
|
|
114
|
+
<Input
|
|
115
|
+
defaultValue="redis-cache-01"
|
|
116
|
+
allowReset
|
|
117
|
+
showCopyButton
|
|
118
|
+
copyButtonProps={{ 'aria-label': 'Copy name' }}
|
|
119
|
+
/>
|
|
120
|
+
<Input
|
|
121
|
+
value={projectId}
|
|
122
|
+
readOnly
|
|
123
|
+
showCopyButton
|
|
124
|
+
copyButtonProps={{ 'aria-label': 'Copy project ID', onCopy: () => showToast('Project ID copied') }}
|
|
125
|
+
style={{ fontFamily: theme.core.font.fontFamily.sourceCodeProRegular }}
|
|
126
|
+
/>
|
|
127
|
+
<Input defaultValue={endpoint} disabled showCopyButton copyButtonProps={{ 'aria-label': 'Copy endpoint' }} />
|
|
128
|
+
</>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
// compose
|
|
133
|
+
<Input.Compose value={projectId} readOnly boxedReadonly>
|
|
134
|
+
<Input.Tag />
|
|
135
|
+
<Input.CopyButton aria-label="Copy project ID" />
|
|
136
|
+
</Input.Compose>
|
|
137
|
+
```
|
|
138
|
+
|
|
104
139
|
### DisabledAndReadonly
|
|
105
140
|
|
|
106
141
|
> Adding `disabled` or `readOnly` switches the component to the corresponding state.
|
|
107
142
|
>
|
|
108
|
-
> In read-only mode only the value is visible. Other indicators are ignored.
|
|
143
|
+
> In read-only mode only the value is visible. Other indicators are ignored, unless `showCopyButton` is set: then the box stays, with the copy button, status and loading indicators.
|
|
109
144
|
>
|
|
110
145
|
> `readOnly` overrides `disabled`.
|
|
111
146
|
|
|
@@ -288,8 +323,10 @@ import { Button, Input } from '@redis-ui/components';
|
|
|
288
323
|
- `error` enables the error state and overrides `valid`.
|
|
289
324
|
- `loading` can be combined with validation and reset states.
|
|
290
325
|
- `allowReset` shows the reset button when the input has a value.
|
|
291
|
-
- `readOnly` overrides `disabled`, and read-only mode hides the indicator affordances.
|
|
326
|
+
- `readOnly` overrides `disabled`, and read-only mode hides the indicator affordances, unless `showCopyButton` keeps the box.
|
|
292
327
|
- Use `FormField` when you need a label or other external decoration around the input.
|
|
293
328
|
- Custom ids passed through `FormField` must start with a letter.
|
|
294
329
|
- `autoSize` is required when you want the text input to grow with its contents.
|
|
295
330
|
- `parser` and `formatter` can be used independently or together for controlled and uncontrolled input flows.
|
|
331
|
+
- `showCopyButton` keeps the box in read-only mode, so the copy button stays available. Use it for read-only values such as IDs and endpoints instead of a disabled input next to a separate copy button.
|
|
332
|
+
- Order inside the box: value, reset button, copy button, status indicator, loading indicator.
|
|
@@ -32,7 +32,7 @@ The component also accepts standard `input` attributes on the inner tag via `Res
|
|
|
32
32
|
|
|
33
33
|
## Sub-components
|
|
34
34
|
|
|
35
|
-
- `SearchInput.Compose` - Compose wrapper used for custom layouts around the search field.
|
|
35
|
+
- `SearchInput.Compose` - Compose wrapper used for custom layouts around the search field. Accepts `boxedReadonly` to keep the field box in read-only mode, with the inner input set to `readonly`, instead of the plain read-only text.
|
|
36
36
|
- `SearchInput.Tag` - The underlying input element. Supports `autoSize`.
|
|
37
37
|
- `SearchInput.ResetButton` - Clear/reset action button shown when a value is present.
|
|
38
38
|
- `SearchInput.StatusIndicator` - Error/success indicator with tooltip support for errors.
|
|
@@ -17,6 +17,8 @@ import { TextArea } from '@redis-ui/components';
|
|
|
17
17
|
| style | `React.CSSProperties` | - | Inline style applied to the composed wrapper |
|
|
18
18
|
| height | `string` | - | Explicit height for the composed textarea; falls back to theme-based sizing when omitted |
|
|
19
19
|
| readOnly | `boolean` | `false` | Switches the field into read-only mode |
|
|
20
|
+
| showCopyButton | `boolean` | `false` | Shows a copy button in the top-right corner of the box that copies the current value. With `readOnly`, keeps the box and scrolling with a selectable, non-editable value |
|
|
21
|
+
| copyButtonProps | `Partial<CopyToClipboardButtonProps>` (without `variant`) | - | Props for the copy button, such as `aria-label`, `copiedLabel` or `onCopy` |
|
|
20
22
|
| variant | `'outline' \| 'underline'` | `'outline'` | Visual variant of the composed field |
|
|
21
23
|
| error | `React.ReactElement \| string` | - | Error content; enables error status and tooltip text |
|
|
22
24
|
| valid | `boolean` | - | Enables valid/success status |
|
|
@@ -31,6 +33,7 @@ The component also accepts native `TextareaHTMLAttributes<HTMLTextAreaElement>`
|
|
|
31
33
|
- `TextArea.Compose` - Composable wrapper that wires value, status, read-only rendering, and layout state.
|
|
32
34
|
- `TextArea.Tag` - The underlying textarea element used by the composed field.
|
|
33
35
|
- `TextArea.StatusIndicator` - Status icon shown for valid and error states.
|
|
36
|
+
- `TextArea.CopyButton` - Copy button pinned to the top-right corner, left of the status indicator. `textToCopy` defaults to the field value. Use with `boxedReadonly` on `TextArea.Compose` to keep it in read-only mode.
|
|
34
37
|
- `TextArea.ReadonlyValue` - Read-only renderer used by the compose API.
|
|
35
38
|
|
|
36
39
|
## Examples
|
|
@@ -66,9 +69,23 @@ import { TextArea } from '@redis-ui/components';
|
|
|
66
69
|
</>
|
|
67
70
|
```
|
|
68
71
|
|
|
72
|
+
### CopyButton
|
|
73
|
+
|
|
74
|
+
> Set `showCopyButton` to show a copy button in the top-right corner. The text area reserves space for it, so it doesn't cover the text. With `readOnly`, the box and scrolling stay.
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
<TextArea
|
|
78
|
+
value={json}
|
|
79
|
+
readOnly
|
|
80
|
+
showCopyButton
|
|
81
|
+
copyButtonProps={{ 'aria-label': 'Copy JSON' }}
|
|
82
|
+
style={{ fontFamily: theme.core.font.fontFamily.sourceCodeProRegular }}
|
|
83
|
+
/>
|
|
84
|
+
```
|
|
85
|
+
|
|
69
86
|
### DisabledAndReadonly
|
|
70
87
|
|
|
71
|
-
> `disabled` and `readOnly` switch the component into those modes. Read-only mode shows only the value and ignores the other indicators. Read-only takes priority over disabled.
|
|
88
|
+
> `disabled` and `readOnly` switch the component into those modes. Read-only mode shows only the value and ignores the other indicators, unless `showCopyButton` is set, which keeps the box with the copy button and the status indicator. Read-only takes priority over disabled.
|
|
72
89
|
|
|
73
90
|
```tsx
|
|
74
91
|
import { TextArea } from '@redis-ui/components';
|
|
@@ -134,6 +151,7 @@ import { FormField, TextArea } from '@redis-ui/components';
|
|
|
134
151
|
|
|
135
152
|
- `error` overrides `valid` when both are present.
|
|
136
153
|
- `readOnly` overrides `disabled` when both are present.
|
|
154
|
+
- `showCopyButton` keeps the box in read-only mode. The copy button stays enabled when the field is disabled.
|
|
137
155
|
- Use `FormField` when you need a label, helper text, or automatic id wiring.
|
|
138
156
|
- A custom `id` used with `FormField` must start with a letter.
|
|
139
157
|
- The component forwards refs to the underlying `<textarea>` element.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# UseCaseList
|
|
2
|
+
|
|
3
|
+
A list of use cases, each a title with an optional description, separated by thin dividers. Use it on product landing pages and empty states to show what a product is for.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { UseCaseList, UseCaseListItem } from '@redis-ui/components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Icons in the examples come from:
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { DatabaseIcon, LeaderboardsIcon, NodesIcon } from '@redis-ui/icons';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| items | `UseCaseListItem[]` | required | Rows to render |
|
|
22
|
+
|
|
23
|
+
The component also extends `React.HTMLAttributes<HTMLUListElement>`, passed to the list.
|
|
24
|
+
|
|
25
|
+
### UseCaseListItem
|
|
26
|
+
|
|
27
|
+
| Field | Type | Description |
|
|
28
|
+
|-------|------|-------------|
|
|
29
|
+
| title | `string` | Row title |
|
|
30
|
+
| description | `ReactNode` | Optional secondary text below the title |
|
|
31
|
+
| icon | `ReactNode` | Optional rendered icon, sized `L`. Without one, the row shows its position as a two-digit number (`01`, `02`, ...) |
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Basic Usage
|
|
36
|
+
|
|
37
|
+
> Each row leads with its icon.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
const items: UseCaseListItem[] = [
|
|
41
|
+
{
|
|
42
|
+
title: 'Caching and session store',
|
|
43
|
+
description:
|
|
44
|
+
'Put Redis in front of a slower database, or hold session and token state that has to be read on every request.',
|
|
45
|
+
icon: <DatabaseIcon size="L" />
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: 'Real-time counters and leaderboards',
|
|
49
|
+
description:
|
|
50
|
+
'Sorted sets and atomic counters handle ranking, rate limiting and quotas at write speed.',
|
|
51
|
+
icon: <LeaderboardsIcon size="L" />
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
title: 'Queues and streams between services',
|
|
55
|
+
description: 'Hand work between services with predictable latency instead of polling a table.',
|
|
56
|
+
icon: <NodesIcon size="L" />
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
<UseCaseList items={items} style={{ width: '64rem' }} />
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Numbered
|
|
64
|
+
|
|
65
|
+
> Rows without an icon show their position as a two-digit number.
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
<UseCaseList items={items.map(({ title, description }) => ({ title, description }))} />
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Mixed
|
|
72
|
+
|
|
73
|
+
> Icons and numbers share one slot width, so the text of every row starts on the same line.
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
<UseCaseList
|
|
77
|
+
items={items.map(({ icon, ...item }, index) => (index === 1 ? item : { ...item, icon }))}
|
|
78
|
+
/>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Notes
|
|
82
|
+
|
|
83
|
+
- `icon` takes a rendered node, so both `@redis-ui/icons` icons and custom SVG components work. It inherits the secondary text color.
|
|
84
|
+
- The icon or number sits in a fixed slot as wide as an `L` icon, so the text of every row starts on the same line, even when only some rows have icons.
|
|
85
|
+
- Icons and numbers are decorative and hidden from assistive technology; the list semantics already announce each row's position.
|
|
86
|
+
- Put the section heading ("Use cases") on the page; the component renders only the list and fills the width it is given.
|