@redis-ui/components 42.8.0 → 43.0.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/dist/AutoCompleteSelect/AutoCompleteSelect.cjs +7 -1
- package/dist/AutoCompleteSelect/AutoCompleteSelect.js +7 -1
- package/dist/AutoCompleteSelect/hooks/useAutoCompleteSelect.cjs +7 -1
- package/dist/AutoCompleteSelect/hooks/useAutoCompleteSelect.d.ts +8 -1
- package/dist/AutoCompleteSelect/hooks/useAutoCompleteSelect.js +7 -1
- package/dist/BoxSelectionGroup/components/Item/components/BoxStateIndicator/BoxStateIndicator.cjs +8 -4
- package/dist/BoxSelectionGroup/components/Item/components/BoxStateIndicator/BoxStateIndicator.js +8 -4
- package/dist/BoxSelectionGroup/components/Item/components/Compose/Compose.style.cjs +18 -4
- package/dist/BoxSelectionGroup/components/Item/components/Compose/Compose.style.js +18 -4
- package/dist/BoxSelectionGroup/hooks/useBoxSelectionGroup.cjs +3 -1
- package/dist/BoxSelectionGroup/hooks/useBoxSelectionGroup.js +3 -1
- package/dist/Button/Button.style.cjs +4 -1
- package/dist/Button/Button.style.js +4 -1
- package/dist/Button/Button.style.utils.cjs +16 -1
- package/dist/Button/Button.style.utils.js +16 -1
- package/dist/Button/Button.types.cjs +1 -1
- package/dist/Button/Button.types.d.ts +1 -1
- package/dist/Button/Button.types.js +1 -1
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.cjs +59 -0
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.d.ts +4 -0
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.js +57 -0
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.style.cjs +40 -0
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.style.d.ts +8 -0
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.style.js +38 -0
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.types.d.ts +5 -0
- package/dist/Button/TextButton/TextButton.style.cjs +4 -1
- package/dist/Button/TextButton/TextButton.style.js +4 -1
- package/dist/Button/TextButton/TextButton.types.cjs +1 -1
- package/dist/Button/TextButton/TextButton.types.d.ts +1 -1
- package/dist/Button/TextButton/TextButton.types.js +1 -1
- package/dist/Button/index.d.ts +2 -0
- package/dist/Checkbox/components/Label/Label.style.cjs +15 -3
- package/dist/Checkbox/components/Label/Label.style.js +15 -3
- package/dist/Chip/components/CloseButton/CloseButton.cjs +3 -1
- package/dist/Chip/components/CloseButton/CloseButton.js +3 -1
- package/dist/Chip/components/Compose/Compose.style.cjs +4 -1
- package/dist/Chip/components/Compose/Compose.style.js +4 -1
- package/dist/Drawer/components/Description/Description.cjs +3 -1
- package/dist/Drawer/components/Description/Description.js +3 -1
- package/dist/Helpers/contexts/Popper/PopperCollisionBoundaryManager.cjs +3 -1
- package/dist/Helpers/contexts/Popper/PopperCollisionBoundaryManager.js +3 -1
- package/dist/Helpers/contexts/PrimitiveContextState.cjs +28 -16
- package/dist/Helpers/contexts/PrimitiveContextState.js +28 -16
- package/dist/Helpers/contexts/SharedId.context.cjs +9 -5
- package/dist/Helpers/contexts/SharedId.context.js +9 -5
- package/dist/Helpers/css.utils.cjs +18 -4
- package/dist/Helpers/css.utils.d.ts +15 -3
- package/dist/Helpers/css.utils.js +18 -4
- package/dist/Helpers/hooks/useScrollable.cjs +3 -1
- package/dist/Helpers/hooks/useScrollable.js +3 -1
- package/dist/Helpers/react.utils.cjs +6 -2
- package/dist/Helpers/react.utils.js +6 -2
- package/dist/Inputs/QuantityCounter/components/InputGroup/components/ValueLabel/ValueLabel.cjs +9 -5
- package/dist/Inputs/QuantityCounter/components/InputGroup/components/ValueLabel/ValueLabel.js +9 -5
- package/dist/Inputs/components/Compose/Compose.style.cjs +29 -6
- package/dist/Inputs/components/Compose/Compose.style.js +29 -6
- package/dist/Inputs/hooks/numericInput/numericInput.utils.cjs +12 -4
- package/dist/Inputs/hooks/numericInput/numericInput.utils.js +12 -4
- package/dist/Inputs/hooks/numericInput/useNumericInput.cjs +15 -3
- package/dist/Inputs/hooks/numericInput/useNumericInput.js +15 -3
- package/dist/Loader/Loader.cjs +1 -0
- package/dist/Loader/Loader.js +1 -0
- package/dist/Menu/components/Content/components/Item/Components/Compose/Compose.style.cjs +19 -4
- package/dist/Menu/components/Content/components/Item/Components/Compose/Compose.style.js +19 -4
- package/dist/Menu/components/Content/components/Label/components/Compose/Compose.style.cjs +4 -1
- package/dist/Menu/components/Content/components/Label/components/Compose/Compose.style.js +4 -1
- package/dist/Modal/components/Content/components/Compose/Compose.cjs +3 -1
- package/dist/Modal/components/Content/components/Compose/Compose.js +3 -1
- package/dist/Modal/components/Content/components/Description/Description.cjs +3 -1
- package/dist/Modal/components/Content/components/Description/Description.js +3 -1
- package/dist/MultiSelect/components/Compose/hooks/useMultiSelectContextApi.cjs +3 -1
- package/dist/MultiSelect/components/Compose/hooks/useMultiSelectContextApi.js +3 -1
- package/dist/MultiSelect/components/Trigger/components/MultiValue/MultiValue.cjs +3 -1
- package/dist/MultiSelect/components/Trigger/components/MultiValue/MultiValue.js +3 -1
- package/dist/Overflow/Overflow.cjs +3 -1
- package/dist/Overflow/Overflow.js +3 -1
- package/dist/Overflow/Overflow.utils.cjs +15 -6
- package/dist/Overflow/Overflow.utils.js +15 -6
- package/dist/Overflow/components/OverflowContainer/OverflowContainer.cjs +3 -1
- package/dist/Overflow/components/OverflowContainer/OverflowContainer.js +3 -1
- package/dist/Pagination/components/PageSizeSelect.cjs +3 -1
- package/dist/Pagination/components/PageSizeSelect.js +3 -1
- package/dist/Popover/components/Content/Content.cjs +3 -1
- package/dist/Popover/components/Content/Content.js +3 -1
- package/dist/Popover/components/Content/components/Footer/Footer.cjs +3 -1
- package/dist/Popover/components/Content/components/Footer/Footer.js +3 -1
- package/dist/RadioGroup/components/Item/components/Label/Label.style.cjs +15 -3
- package/dist/RadioGroup/components/Item/components/Label/Label.style.js +15 -3
- package/dist/ScreenReaderAnnounce/ScreenReaderAnnounce.cjs +3 -1
- package/dist/ScreenReaderAnnounce/ScreenReaderAnnounce.js +3 -1
- package/dist/Section/components/Header/components/CollapseButton/CollapseButton.cjs +3 -1
- package/dist/Section/components/Header/components/CollapseButton/CollapseButton.js +3 -1
- package/dist/Select/components/Content/components/Option/components/Compose/Compose.style.cjs +16 -4
- package/dist/Select/components/Content/components/Option/components/Compose/Compose.style.js +16 -4
- package/dist/Select/components/Content/components/OptionList/OptionList.cjs +6 -4
- package/dist/Select/components/Content/components/OptionList/OptionList.js +6 -4
- package/dist/Select/components/Content/components/OptionList/Virtual.cjs +9 -5
- package/dist/Select/components/Content/components/OptionList/Virtual.js +9 -5
- package/dist/Select/components/Context/hooks/useSearch.cjs +3 -1
- package/dist/Select/components/Context/hooks/useSearch.js +3 -1
- package/dist/Select/components/Trigger/components/Compose/Compose.style.cjs +33 -7
- package/dist/Select/components/Trigger/components/Compose/Compose.style.js +33 -7
- package/dist/SideBar/components/Item/Item.style.cjs +14 -3
- package/dist/SideBar/components/Item/Item.style.js +14 -3
- package/dist/Skeleton/components/Circle/Circle.cjs +1 -1
- package/dist/Skeleton/components/Circle/Circle.js +1 -1
- package/dist/Skeleton/components/Square/Square.cjs +1 -1
- package/dist/Skeleton/components/Square/Square.js +1 -1
- package/dist/Slider/components/Label/Compose/Compose.cjs +3 -1
- package/dist/Slider/components/Label/Compose/Compose.js +3 -1
- package/dist/Slider/components/Mark/Compose/Compose.cjs +3 -1
- package/dist/Slider/components/Mark/Compose/Compose.js +3 -1
- package/dist/Slider/hooks/useOffset.cjs +3 -1
- package/dist/Slider/hooks/useOffset.js +3 -1
- package/dist/Stepper/components/Step/components/Compose/Compose.cjs +3 -1
- package/dist/Stepper/components/Step/components/Compose/Compose.js +3 -1
- package/dist/Stepper/hooks/useStepperInteractive.cjs +12 -4
- package/dist/Stepper/hooks/useStepperInteractive.js +12 -4
- package/dist/Switch/components/Switcher/Switcher.cjs +3 -1
- package/dist/Switch/components/Switcher/Switcher.js +3 -1
- package/dist/Switch/components/Switcher/Switcher.style.cjs +31 -8
- package/dist/Switch/components/Switcher/Switcher.style.js +31 -8
- package/dist/Tabs/components/TabBar/components/Trigger/components/Marker/Marker.style.cjs +24 -5
- package/dist/Tabs/components/TabBar/components/Trigger/components/Marker/Marker.style.js +24 -5
- package/dist/Tabs/components/TabBar/components/Trigger/components/Tab/Tab.style.cjs +24 -5
- package/dist/Tabs/components/TabBar/components/Trigger/components/Tab/Tab.style.js +24 -5
- package/dist/ThemeModeSwitch/useThemeModeSwitch.cjs +6 -2
- package/dist/ThemeModeSwitch/useThemeModeSwitch.js +6 -2
- package/dist/Toast/core/content.helper.cjs +8 -4
- package/dist/Toast/core/content.helper.js +8 -4
- package/dist/Tooltip/components/Content/Content.cjs +3 -1
- package/dist/Tooltip/components/Content/Content.js +3 -1
- package/dist/TreeView/TreeView.cjs +3 -1
- package/dist/TreeView/TreeView.js +3 -1
- package/dist/TreeView/components/TreeItem/components/Compose/Compose.cjs +6 -4
- package/dist/TreeView/components/TreeItem/components/Compose/Compose.js +6 -4
- package/dist/Typography/Typography.types.cjs +4 -0
- package/dist/Typography/Typography.types.d.ts +2 -1
- package/dist/Typography/Typography.types.js +4 -0
- package/dist/index.cjs +4 -0
- package/dist/index.js +94 -90
- package/package.json +10 -9
- package/skills/redis-ui-components/SKILL.md +128 -0
- package/skills/redis-ui-components/references/Button.md +169 -0
- package/skills/redis-ui-components/references/FlexDivider.md +152 -0
- package/skills/redis-ui-components/references/FlexGroup.md +149 -0
- package/skills/redis-ui-components/references/FlexItem.md +58 -0
- package/skills/redis-ui-components/references/FlexSplit.md +37 -0
- package/skills/redis-ui-components/references/Select.md +517 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# FlexDivider
|
|
2
|
+
|
|
3
|
+
A visual separator line used to divide content within flex layouts. Automatically adapts its orientation based on the parent `FlexGroup` direction, or can be explicitly set when used in custom containers. Supports configurable padding, spacing, and automatic hiding of redundant dividers.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { FlexDivider } from '@redislabsdev/redis-ui-components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
|------|------|---------|-------------|
|
|
15
|
+
| `padding` | `'XXS' \| 'XS' \| 'S' \| 'M' \| 'L' \| 'XL' \| 'XXL' \| 'none' \| string` | `'none'` | Paddings from the edges of the container to the divider line. Accepts predefined sizes or custom CSS dimension values. |
|
|
16
|
+
| `spacing` | `'XXS' \| 'XS' \| 'S' \| 'M' \| 'L' \| 'XL' \| 'XXL' \| 'none' \| string` | `'none'` | Additional margins between the divider line and adjacent elements. Gap of flex container is preferred. |
|
|
17
|
+
| `orientation` | `'horizontal' \| 'vertical'` | — | The orientation of the divider line when used in a custom container. `FlexGroup` automatically defines its orientation, so this is only needed outside of `FlexGroup`. |
|
|
18
|
+
| `autoHide` | `boolean` | `true` | Hide extra dividers if there are multiple ones next to each other or if one is displayed as the first/last element. |
|
|
19
|
+
|
|
20
|
+
## Examples
|
|
21
|
+
|
|
22
|
+
### Playground
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
<FlexGroup direction="row" align="stretch">
|
|
26
|
+
<div>a</div>
|
|
27
|
+
<FlexDivider />
|
|
28
|
+
<div>b</div>
|
|
29
|
+
<div>c</div>
|
|
30
|
+
</FlexGroup>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### AutoHiding
|
|
34
|
+
|
|
35
|
+
> `FlexDivider` allows you to automatically hide unnecessary dividers. If a divider appears as the first/last element or is duplicated, it will be hidden. To prevent automatic hiding, set the `autoHide` property for that particular divider to `false`.
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { FlexGroup, FlexDivider, Switch } from '@redislabsdev/redis-ui-components';
|
|
39
|
+
import { useState } from 'react';
|
|
40
|
+
|
|
41
|
+
const [autoHide, setAutoHide] = useState(true);
|
|
42
|
+
|
|
43
|
+
<FlexGroup direction="row" align="stretch" justify="center">
|
|
44
|
+
<FlexDivider autoHide={autoHide} />
|
|
45
|
+
<div>a</div>
|
|
46
|
+
<FlexDivider autoHide={autoHide} />
|
|
47
|
+
<FlexDivider autoHide={autoHide} />
|
|
48
|
+
<div>b</div>
|
|
49
|
+
<FlexDivider autoHide={autoHide} />
|
|
50
|
+
<div>c</div>
|
|
51
|
+
<FlexDivider autoHide={autoHide} />
|
|
52
|
+
</FlexGroup>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Paddings
|
|
56
|
+
|
|
57
|
+
> `FlexDivider` allows control `padding` from the edge of container to the line. Supports predefined sizes (XXS ... XXL, none) or custom values (in format of one/two CSS dimensions).
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<FlexGroup>
|
|
61
|
+
<div>S:</div>
|
|
62
|
+
<FlexDivider padding="S" />
|
|
63
|
+
<div>M:</div>
|
|
64
|
+
<FlexDivider padding="M" />
|
|
65
|
+
<div>L:</div>
|
|
66
|
+
<FlexDivider padding="L" />
|
|
67
|
+
<div>custom:</div>
|
|
68
|
+
<FlexDivider padding="5rem 2rem" />
|
|
69
|
+
</FlexGroup>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Spacing
|
|
73
|
+
|
|
74
|
+
> `FlexDivider` allows control `spacing` between the divider and adjacent elements. Supports predefined sizes (XXS ... XXL, none) or custom values (in format of one/two CSS dimensions).
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
<FlexGroup gap="0">
|
|
78
|
+
<div>S:</div>
|
|
79
|
+
<FlexDivider spacing="S" />
|
|
80
|
+
<div>M:</div>
|
|
81
|
+
<FlexDivider spacing="M" />
|
|
82
|
+
<div>L:</div>
|
|
83
|
+
<FlexDivider spacing="L" />
|
|
84
|
+
<div>custom:</div>
|
|
85
|
+
<FlexDivider spacing="3rem 1rem" />
|
|
86
|
+
</FlexGroup>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### HorizontalContainer
|
|
90
|
+
|
|
91
|
+
> Shows `FlexDivider` usage in horizontal (`row`) layouts. Demonstrates how dividers work in `FlexGroup` containers, custom flex containers, and the limitations with block-level containers.
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
{/* Inside FlexGroup - orientation is automatic */}
|
|
95
|
+
<FlexGroup justify="center" align="stretch">
|
|
96
|
+
<div>a</div>
|
|
97
|
+
<FlexDivider />
|
|
98
|
+
<div>b</div>
|
|
99
|
+
<FlexDivider />
|
|
100
|
+
<div>c</div>
|
|
101
|
+
</FlexGroup>
|
|
102
|
+
|
|
103
|
+
{/* Inside a custom flex container - orientation must be set explicitly */}
|
|
104
|
+
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'center', gap: 10 }}>
|
|
105
|
+
<div>a</div>
|
|
106
|
+
<FlexDivider orientation="vertical" />
|
|
107
|
+
<div>b</div>
|
|
108
|
+
<FlexDivider orientation="vertical" />
|
|
109
|
+
<div>c</div>
|
|
110
|
+
</div>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### VerticalContainer
|
|
114
|
+
|
|
115
|
+
> Shows `FlexDivider` usage in vertical (`column`) layouts. Compares behavior across `FlexGroup` containers, custom flex containers, and custom block containers.
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
{/* FlexGroup column container */}
|
|
119
|
+
<FlexGroup direction="column" align="stretch" gap="M">
|
|
120
|
+
<div>a</div>
|
|
121
|
+
<FlexDivider padding="S" />
|
|
122
|
+
<div>b</div>
|
|
123
|
+
<FlexDivider />
|
|
124
|
+
<div>c</div>
|
|
125
|
+
</FlexGroup>
|
|
126
|
+
|
|
127
|
+
{/* Custom flex column container */}
|
|
128
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '1.2rem' }}>
|
|
129
|
+
<div>a</div>
|
|
130
|
+
<FlexDivider orientation="horizontal" padding="S" />
|
|
131
|
+
<div>b</div>
|
|
132
|
+
<FlexDivider orientation="horizontal" />
|
|
133
|
+
<div>c</div>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
{/* Custom block container */}
|
|
137
|
+
<div>
|
|
138
|
+
<div>a</div>
|
|
139
|
+
<FlexDivider orientation="horizontal" spacing="M" padding="S" />
|
|
140
|
+
<div>b</div>
|
|
141
|
+
<FlexDivider orientation="horizontal" spacing="M" />
|
|
142
|
+
<div>c</div>
|
|
143
|
+
</div>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Notes
|
|
147
|
+
|
|
148
|
+
- When used inside a `FlexGroup`, the divider automatically detects the container's direction and renders with the correct orientation. No need to set the `orientation` prop.
|
|
149
|
+
- When used in a custom flex container (not `FlexGroup`), you must explicitly set `orientation` to `'vertical'` (for row layouts) or `'horizontal'` (for column layouts).
|
|
150
|
+
- `FlexDivider` does not work with horizontal block containers out of the box; additional styling is required.
|
|
151
|
+
- The `autoHide` feature (enabled by default) uses CSS adjacency selectors to hide dividers that are first, last, or consecutive, keeping the layout clean even when items are conditionally rendered.
|
|
152
|
+
- Both `padding` and `spacing` accept predefined size tokens (`XXS` through `XXL`, `none`) or arbitrary CSS dimension strings (e.g., `"5rem 2rem"`).
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# FlexGroup
|
|
2
|
+
|
|
3
|
+
A flexible layout container that arranges its children using CSS flexbox. It supports configurable direction, gap sizing (with predefined T-Shirt sizes or theme values), alignment, justification, and wrapping. It extends `FlexItem`, so it can also be nested as a flex child.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
```tsx
|
|
7
|
+
import { FlexGroup } from '@redislabsdev/redis-ui-components';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Props
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
|------|------|---------|-------------|
|
|
13
|
+
| gap | `'XXS' \| 'XS' \| 'S' \| 'M' \| 'L' \| 'XL' \| 'XXL' \| string` | `'S'` | Gap size between items. Supports predefined T-Shirt sizes and free text for applying values from theme |
|
|
14
|
+
| direction | `'column' \| 'row' \| 'column-reverse' \| 'row-reverse'` | `'row'` | Flex direction |
|
|
15
|
+
| align | `'start' \| 'end' \| 'center' \| 'stretch'` | `'center'` (row) / `'stretch'` (column) | Align items along the cross axis |
|
|
16
|
+
| justify | `'start' \| 'end' \| 'center' \| 'space-between' \| 'space-around' \| 'space-evenly'` | - | Justify content along the main axis |
|
|
17
|
+
| wrap | `boolean` | - | Whether items should wrap to new lines |
|
|
18
|
+
| flex | `'auto' \| 'none' \| string` | - | Flex grow/shrink/basis value (inherited from FlexItem) |
|
|
19
|
+
| selfAlign | `'start' \| 'end' \| 'center' \| 'stretch'` | - | Align self in parent flex container along the cross axis (inherited from FlexItem) |
|
|
20
|
+
| component | `string \| ComponentType` | `'div'` | Use a different component with Flex styling (inherited from FlexItem) |
|
|
21
|
+
|
|
22
|
+
The component also extends all native HTML element props via `ComposeElementProps`.
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
### Playground
|
|
27
|
+
```tsx
|
|
28
|
+
import { FlexGroup } from '@redislabsdev/redis-ui-components';
|
|
29
|
+
|
|
30
|
+
<FlexGroup direction="row" gap="S">
|
|
31
|
+
<div>a</div>
|
|
32
|
+
<div>b</div>
|
|
33
|
+
<div>c</div>
|
|
34
|
+
<div>d</div>
|
|
35
|
+
</FlexGroup>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Complex Layout: Descriptions
|
|
39
|
+
> This example demonstrates the use of `FlexGroup`, `FlexDivider`, and `FlexSplit` to create a complex layout with varying directions, spacing, alignments, and more.
|
|
40
|
+
```tsx
|
|
41
|
+
import { FlexGroup, FlexDivider, FlexSplit, MoreInfoIcon, Typography } from '@redislabsdev/redis-ui-components';
|
|
42
|
+
import { CheckBoldIcon } from '@redislabsdev/redis-ui-icons';
|
|
43
|
+
|
|
44
|
+
const Title = ({ children }) => <Typography.Heading size="L">{children}</Typography.Heading>;
|
|
45
|
+
const Property = ({ children }) => <Typography.Body>{children}</Typography.Body>;
|
|
46
|
+
const Value = ({ children }) => (
|
|
47
|
+
<Typography.Body color="secondary" style={{ textAlign: 'end' }}>
|
|
48
|
+
{children}
|
|
49
|
+
</Typography.Body>
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const descriptions1 = [
|
|
53
|
+
{
|
|
54
|
+
name: (
|
|
55
|
+
<FlexGroup>
|
|
56
|
+
Total Memory <MoreInfoIcon tooltip="Total memory available" />
|
|
57
|
+
</FlexGroup>
|
|
58
|
+
),
|
|
59
|
+
value: '250 MB'
|
|
60
|
+
},
|
|
61
|
+
{ name: 'Connections', value: '256' },
|
|
62
|
+
{ name: 'CIDR Allow Rules', value: '4' },
|
|
63
|
+
{ name: 'Recommended network usage', value: '< 100 GB' }
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const descriptions2 = [
|
|
67
|
+
{ name: 'High Availability', value: 'Off' },
|
|
68
|
+
{ name: 'Daily and instant backups', value: <CheckBoldIcon color="success500" style={{ display: 'block' }} /> },
|
|
69
|
+
{
|
|
70
|
+
name: (
|
|
71
|
+
<FlexGroup>
|
|
72
|
+
Max ops/sec <MoreInfoIcon tooltip="Max operations per second" />
|
|
73
|
+
</FlexGroup>
|
|
74
|
+
),
|
|
75
|
+
value: '1000'
|
|
76
|
+
}
|
|
77
|
+
];
|
|
78
|
+
|
|
79
|
+
<FlexGroup direction="column" gap="XL">
|
|
80
|
+
<Title>Database details</Title>
|
|
81
|
+
<FlexDivider />
|
|
82
|
+
<FlexGroup gap="XXL" align="start">
|
|
83
|
+
<FlexGroup direction="column" gap="XL" flex="1">
|
|
84
|
+
{descriptions1.flatMap((prop) => (
|
|
85
|
+
<>
|
|
86
|
+
<FlexGroup justify="space-between">
|
|
87
|
+
<Property>{prop.name}</Property>
|
|
88
|
+
<FlexSplit />
|
|
89
|
+
<Value>{prop.value}</Value>
|
|
90
|
+
</FlexGroup>
|
|
91
|
+
<FlexDivider />
|
|
92
|
+
</>
|
|
93
|
+
))}
|
|
94
|
+
</FlexGroup>
|
|
95
|
+
<FlexDivider />
|
|
96
|
+
<FlexGroup direction="column" gap="XL" flex="1">
|
|
97
|
+
{descriptions2.flatMap((prop) => (
|
|
98
|
+
<>
|
|
99
|
+
<FlexDivider />
|
|
100
|
+
<FlexGroup>
|
|
101
|
+
<Property>{prop.name}</Property>
|
|
102
|
+
<FlexSplit />
|
|
103
|
+
<Value>{prop.value}</Value>
|
|
104
|
+
</FlexGroup>
|
|
105
|
+
</>
|
|
106
|
+
))}
|
|
107
|
+
</FlexGroup>
|
|
108
|
+
</FlexGroup>
|
|
109
|
+
</FlexGroup>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Complex Layout: Toolbar
|
|
113
|
+
> This example demonstrates the use of `FlexGroup`, `FlexDivider`, and `FlexSplit` to create a complex toolbar layout.
|
|
114
|
+
```tsx
|
|
115
|
+
import { Badge, Button, FlexDivider, FlexGroup, FlexItem, FlexSplit, IconButton, MoreInfoIcon, SearchInput, Typography } from '@redislabsdev/redis-ui-components';
|
|
116
|
+
import { CopyIcon, MenuIcon, MarketplaceIcon } from '@redislabsdev/redis-ui-icons';
|
|
117
|
+
|
|
118
|
+
<FlexGroup gap="XL" style={{ paddingInline: '2.4rem', minHeight: '5.6rem' }}>
|
|
119
|
+
<FlexGroup gap="L" flex="none">
|
|
120
|
+
<FlexGroup gap="S">
|
|
121
|
+
<MarketplaceIcon size="XL" />
|
|
122
|
+
<Typography.Heading size="L">Title</Typography.Heading>
|
|
123
|
+
<MoreInfoIcon tooltip="Info" />
|
|
124
|
+
</FlexGroup>
|
|
125
|
+
<Badge label="Badge" variant="informative" />
|
|
126
|
+
</FlexGroup>
|
|
127
|
+
<FlexDivider padding="M" />
|
|
128
|
+
<FlexItem>
|
|
129
|
+
<SearchInput />
|
|
130
|
+
</FlexItem>
|
|
131
|
+
<FlexSplit />
|
|
132
|
+
<FlexDivider padding="M" />
|
|
133
|
+
<FlexGroup gap="XL">
|
|
134
|
+
<Button>Action</Button>
|
|
135
|
+
</FlexGroup>
|
|
136
|
+
<FlexDivider padding="M" />
|
|
137
|
+
<FlexGroup gap="XL">
|
|
138
|
+
<IconButton icon={CopyIcon} size="L" />
|
|
139
|
+
<IconButton icon={MenuIcon} size="XL" />
|
|
140
|
+
</FlexGroup>
|
|
141
|
+
</FlexGroup>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Notes
|
|
145
|
+
- `FlexGroup` extends `FlexItem` internally, so it can be used both as a flex container and as a flex child within a parent `FlexGroup`.
|
|
146
|
+
- The default `align` value is context-aware: it defaults to `'center'` for row directions and `'stretch'` for column directions.
|
|
147
|
+
- The `gap` prop accepts T-Shirt sizes (`XXS` through `XXL`) which map to theme-defined spacing values. You can also pass arbitrary CSS values or theme token strings.
|
|
148
|
+
- Use `FlexGroup` together with `FlexItem`, `FlexSplit`, and `FlexDivider` to compose complex layouts. `FlexSplit` pushes subsequent items to the end, and `FlexDivider` adds visual separators.
|
|
149
|
+
- The `flex` prop (inherited from `FlexItem`) is useful for controlling how a `FlexGroup` sizes within a parent flex container (e.g., `flex="1"` for equal distribution, `flex="none"` for intrinsic sizing).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# FlexItem
|
|
2
|
+
|
|
3
|
+
A flex item wrapper component that controls individual item behavior within a flex container. It supports custom flex grow/shrink/basis values, self-alignment, and rendering as a different HTML element or component.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
```tsx
|
|
7
|
+
import { FlexItem } from '@redislabsdev/redis-ui-components';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Props
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
|------|------|---------|-------------|
|
|
13
|
+
| flex | `'auto' \| 'none' \| string` | - | Flex grow/shrink/basis value |
|
|
14
|
+
| selfAlign | `'start' \| 'end' \| 'center' \| 'stretch'` | - | Align self in parent flex container along the cross axis of the parent flex |
|
|
15
|
+
| component | `string \| ComponentType` | `'div'` | Use different component with Flex styling |
|
|
16
|
+
| children | `ReactNode` | - | Content to render inside the flex item |
|
|
17
|
+
|
|
18
|
+
The component also extends all native `HTMLAttributes<HTMLElement>` props (excluding `children` and `content`).
|
|
19
|
+
|
|
20
|
+
## Examples
|
|
21
|
+
|
|
22
|
+
### Toolbar with FlexItem
|
|
23
|
+
> From the FlexGroup "Complex Layout: Toolbar" story. Demonstrates using `FlexItem` to wrap a search input within a flex toolbar layout.
|
|
24
|
+
```tsx
|
|
25
|
+
import { FlexGroup, FlexItem, FlexSplit, FlexDivider, SearchInput, Button, Badge, IconButton } from '@redislabsdev/redis-ui-components';
|
|
26
|
+
import { MarketplaceIcon, CopyIcon, MenuIcon } from '@redislabsdev/redis-ui-icons';
|
|
27
|
+
|
|
28
|
+
<FlexGroup gap="XL" style={{ paddingInline: '2.4rem', minHeight: '5.6rem' }}>
|
|
29
|
+
<FlexGroup gap="L" flex="none">
|
|
30
|
+
<FlexGroup gap="S">
|
|
31
|
+
<MarketplaceIcon size="XL" />
|
|
32
|
+
<Typography.Heading size="L">Title</Typography.Heading>
|
|
33
|
+
</FlexGroup>
|
|
34
|
+
<Badge label="Badge" variant="informative" />
|
|
35
|
+
</FlexGroup>
|
|
36
|
+
<FlexDivider padding="M" />
|
|
37
|
+
<FlexItem>
|
|
38
|
+
<SearchInput />
|
|
39
|
+
</FlexItem>
|
|
40
|
+
<FlexSplit />
|
|
41
|
+
<FlexDivider padding="M" />
|
|
42
|
+
<FlexGroup gap="XL">
|
|
43
|
+
<Button>Action</Button>
|
|
44
|
+
</FlexGroup>
|
|
45
|
+
<FlexDivider padding="M" />
|
|
46
|
+
<FlexGroup gap="XL">
|
|
47
|
+
<IconButton icon={CopyIcon} size="L" />
|
|
48
|
+
<IconButton icon={MenuIcon} size="XL" />
|
|
49
|
+
</FlexGroup>
|
|
50
|
+
</FlexGroup>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Notes
|
|
54
|
+
- `FlexItem` is typically used inside a `FlexGroup` to control individual item sizing and alignment.
|
|
55
|
+
- The `flex` prop maps directly to the CSS `flex` shorthand property (e.g., `"auto"`, `"none"`, `"1"`, `"0 0 200px"`).
|
|
56
|
+
- The `selfAlign` prop maps to the CSS `align-self` property, allowing an item to override the parent's `align` setting.
|
|
57
|
+
- Use the `component` prop to render as a different element (e.g., `component="span"`) or a custom React component while preserving flex item styling.
|
|
58
|
+
- `FlexItem` renders as a `div` by default.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# FlexSplit
|
|
2
|
+
|
|
3
|
+
A layout utility component used inside `FlexGroup` to push sibling elements apart. It creates an auto-margin split point that pushes the next sibling to the opposite end of the flex container. Works with all flex directions (`row`, `column`, `row-reverse`, `column-reverse`). Uses `display: contents` so it does not affect the layout itself.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { FlexSplit } from '@redislabsdev/redis-ui-components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
|------|------|---------|-------------|
|
|
15
|
+
| `extraMinSpace` | `string` | `undefined` | Space added to the existing gap at the split point. If no component exists before the split, or the split is the last element, it is not applied. If the component before the split has margin adjacent to the split, that margin will be overridden. |
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Playground
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { FlexGroup, FlexSplit } from '@redislabsdev/redis-ui-components';
|
|
23
|
+
|
|
24
|
+
<FlexGroup direction="row" style={{ minWidth: '40rem', minHeight: '12rem' }}>
|
|
25
|
+
<div>a</div>
|
|
26
|
+
<FlexSplit />
|
|
27
|
+
<div>b</div>
|
|
28
|
+
<div>c</div>
|
|
29
|
+
</FlexGroup>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Notes
|
|
33
|
+
|
|
34
|
+
- `FlexSplit` must be used as a direct child of `FlexGroup`. It relies on `FlexGroup`'s `data-flex-direction` attribute to determine which margin direction to apply.
|
|
35
|
+
- The component renders as a `div` with `display: contents`, so it produces no visible box in the layout.
|
|
36
|
+
- When `extraMinSpace` is provided, it sets a minimum margin on the element preceding the split, ensuring a guaranteed gap between the two groups of items.
|
|
37
|
+
- Direction-aware: automatically adjusts margin logic for `row`, `column`, `row-reverse`, and `column-reverse` layouts.
|