@redis-ui/components 42.8.0 → 43.2.1
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/HighlightedIcon/HighlightedIcon.cjs +26 -0
- package/dist/HighlightedIcon/HighlightedIcon.d.ts +3 -0
- package/dist/HighlightedIcon/HighlightedIcon.js +26 -0
- package/dist/HighlightedIcon/HighlightedIcon.style.cjs +49 -0
- package/dist/HighlightedIcon/HighlightedIcon.style.d.ts +5 -0
- package/dist/HighlightedIcon/HighlightedIcon.style.js +47 -0
- package/dist/HighlightedIcon/HighlightedIcon.types.d.ts +8 -0
- package/dist/HighlightedIcon/index.d.ts +3 -0
- 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/Stepper.cjs +14 -5
- package/dist/Stepper/Stepper.d.ts +2 -0
- package/dist/Stepper/Stepper.js +14 -5
- package/dist/Stepper/Stepper.utils.cjs +12 -0
- package/dist/Stepper/Stepper.utils.d.ts +2 -0
- package/dist/Stepper/Stepper.utils.js +12 -0
- package/dist/Stepper/components/Compose/Compose.d.ts +1 -0
- package/dist/Stepper/components/Step/Step.cjs +2 -0
- package/dist/Stepper/components/Step/Step.d.ts +1 -0
- package/dist/Stepper/components/Step/Step.js +2 -0
- package/dist/Stepper/components/Step/components/Compose/Compose.cjs +5 -10
- package/dist/Stepper/components/Step/components/Compose/Compose.js +5 -10
- package/dist/Stepper/components/Step/components/Separator/Separator.cjs +15 -0
- package/dist/Stepper/components/Step/components/Separator/Separator.d.ts +3 -0
- package/dist/Stepper/components/Step/components/Separator/Separator.js +15 -0
- package/dist/Stepper/components/Step/components/Separator/Separator.style.cjs +24 -0
- package/dist/Stepper/components/Step/components/Separator/Separator.style.d.ts +1 -0
- package/dist/Stepper/components/Step/components/Separator/Separator.style.js +22 -0
- package/dist/Stepper/components/Step/components/Separator/Separator.types.d.ts +5 -0
- 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 +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +98 -90
- package/package.json +10 -9
- package/skills/redis-ui-components/SKILL.md +126 -0
- package/skills/redis-ui-components/references/ActionIconButton.md +96 -0
- package/skills/redis-ui-components/references/AppBar.md +161 -0
- package/skills/redis-ui-components/references/AppSelectionMenu.md +184 -0
- package/skills/redis-ui-components/references/AutoCompleteSelect.md +193 -0
- package/skills/redis-ui-components/references/Badge.md +77 -0
- package/skills/redis-ui-components/references/Banner.md +563 -0
- package/skills/redis-ui-components/references/BoxSelectionGroup.md +487 -0
- package/skills/redis-ui-components/references/Breadcrumbs.md +214 -0
- package/skills/redis-ui-components/references/Button.md +169 -0
- package/skills/redis-ui-components/references/ButtonGroup.md +126 -0
- package/skills/redis-ui-components/references/Card.md +56 -0
- package/skills/redis-ui-components/references/Checkbox.md +171 -0
- package/skills/redis-ui-components/references/Chip.md +154 -0
- package/skills/redis-ui-components/references/ChipList.md +307 -0
- package/skills/redis-ui-components/references/CopyToClipboardButton.md +47 -0
- package/skills/redis-ui-components/references/CountryFlag.md +57 -0
- package/skills/redis-ui-components/references/Drawer.md +298 -0
- package/skills/redis-ui-components/references/Filters.md +162 -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/FormField.md +678 -0
- package/skills/redis-ui-components/references/IconButton.md +63 -0
- package/skills/redis-ui-components/references/Input.md +295 -0
- package/skills/redis-ui-components/references/KeyValueList.md +501 -0
- package/skills/redis-ui-components/references/Label.md +238 -0
- package/skills/redis-ui-components/references/Link.md +402 -0
- package/skills/redis-ui-components/references/Loader.md +100 -0
- package/skills/redis-ui-components/references/Menu.md +988 -0
- package/skills/redis-ui-components/references/MidBar.md +358 -0
- package/skills/redis-ui-components/references/Modal.md +525 -0
- package/skills/redis-ui-components/references/MoreInfoIcon.md +119 -0
- package/skills/redis-ui-components/references/MultiSelect.md +558 -0
- package/skills/redis-ui-components/references/NumericInput.md +322 -0
- package/skills/redis-ui-components/references/Overflow.md +127 -0
- package/skills/redis-ui-components/references/Pagination.md +151 -0
- package/skills/redis-ui-components/references/PasswordInput.md +262 -0
- package/skills/redis-ui-components/references/Popover.md +868 -0
- package/skills/redis-ui-components/references/ProfileIcon.md +65 -0
- package/skills/redis-ui-components/references/ProgressBar.md +103 -0
- package/skills/redis-ui-components/references/QuantityCounter.md +555 -0
- package/skills/redis-ui-components/references/RadioGroup.md +265 -0
- package/skills/redis-ui-components/references/ScreenReaderAnnounce.md +147 -0
- package/skills/redis-ui-components/references/SearchBar.md +242 -0
- package/skills/redis-ui-components/references/SearchInput.md +213 -0
- package/skills/redis-ui-components/references/Section.md +349 -0
- package/skills/redis-ui-components/references/Select.md +517 -0
- package/skills/redis-ui-components/references/SideBar.md +468 -0
- package/skills/redis-ui-components/references/Slider.md +398 -0
- package/skills/redis-ui-components/references/Stepper.md +288 -0
- package/skills/redis-ui-components/references/Switch.md +193 -0
- package/skills/redis-ui-components/references/Tabs.md +383 -0
- package/skills/redis-ui-components/references/TextArea.md +139 -0
- package/skills/redis-ui-components/references/TextButton.md +217 -0
- package/skills/redis-ui-components/references/Toast.md +399 -0
- package/skills/redis-ui-components/references/ToggleButton.md +163 -0
- package/skills/redis-ui-components/references/Tooltip.md +636 -0
- package/skills/redis-ui-components/references/Typography.md +323 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# CountryFlag
|
|
2
|
+
|
|
3
|
+
Country flag image component that loads flagcdn assets and falls back to an empty placeholder until the image is valid.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { CountryFlag } from '@redislabsdev/redis-ui-components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
|------|------|---------|-------------|
|
|
15
|
+
| countryCode | `string` | required | Country code used to resolve the flag image |
|
|
16
|
+
| native img props | `React.HTMLAttributes<HTMLImageElement>` | - | Standard image attributes forwarded to the rendered flag image |
|
|
17
|
+
|
|
18
|
+
The component also extends all native `React.HTMLAttributes<HTMLImageElement>` props.
|
|
19
|
+
|
|
20
|
+
## Examples
|
|
21
|
+
|
|
22
|
+
### Playground
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { CountryFlag } from '@redislabsdev/redis-ui-components';
|
|
26
|
+
|
|
27
|
+
<CountryFlag countryCode="us" />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Empty
|
|
31
|
+
|
|
32
|
+
> If the `countryCode` is wrong or empty, the component shows an empty flag.
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { CountryFlag } from '@redislabsdev/redis-ui-components';
|
|
36
|
+
|
|
37
|
+
<CountryFlag countryCode="" />
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Gallery
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import countries from './codes.json';
|
|
44
|
+
import { CountryFlag } from '@redislabsdev/redis-ui-components';
|
|
45
|
+
|
|
46
|
+
<>
|
|
47
|
+
{Object.entries(countries).map(([code, name]) => (
|
|
48
|
+
<CountryFlag key={code} countryCode={code} title={`${code}:${name}`} />
|
|
49
|
+
))}
|
|
50
|
+
</>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Notes
|
|
54
|
+
|
|
55
|
+
- Flags are loaded from `flagcdn.com`.
|
|
56
|
+
- The component renders a placeholder image until the actual flag asset loads successfully.
|
|
57
|
+
- `uk`, `tp`, and `fx` are normalized to `gb`, `tl`, and `fr` before the flag URL is resolved.
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
# Drawer
|
|
2
|
+
|
|
3
|
+
A sliding overlay panel for focused workflows, with collapsible or persistent behavior and composable header, description, body, and footer sections.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Drawer } from '@redislabsdev/redis-ui-components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
> Footer examples use icons from `@redislabsdev/redis-ui-icons`:
|
|
12
|
+
> ```tsx
|
|
13
|
+
> import { StarsIcon } from '@redislabsdev/redis-ui-icons';
|
|
14
|
+
> ```
|
|
15
|
+
|
|
16
|
+
## Props
|
|
17
|
+
|
|
18
|
+
| Prop | Type | Default | Description |
|
|
19
|
+
|------|------|---------|-------------|
|
|
20
|
+
| persistent | `boolean` | `false` | Keeps the drawer from closing on outside click or `Esc`, and suppresses the default header close button. |
|
|
21
|
+
| open | `boolean` | required | Controls whether the drawer is open. |
|
|
22
|
+
| onOpenChange | `(open: boolean) => void` | - | Called when the open state changes. |
|
|
23
|
+
| containerElement | `HTMLElement` | - | Portal container to render the drawer into instead of `body`. |
|
|
24
|
+
| zIndex | `number` | `theme.core.zIndex.zIndex9998` | Z-index used for the drawer overlay and content. |
|
|
25
|
+
| onDrawerWillOpen | `() => void` | - | Fires when the open animation starts. |
|
|
26
|
+
| onDrawerDidOpen | `() => void` | - | Fires when the open animation ends. |
|
|
27
|
+
| onDrawerWillClose | `() => void` | - | Fires when the close animation starts. |
|
|
28
|
+
| onDrawerDidClose | `() => void` | - | Fires when the close animation ends. |
|
|
29
|
+
|
|
30
|
+
The component also accepts the native `HTMLAttributes<HTMLDivElement>` props.
|
|
31
|
+
|
|
32
|
+
## Sub-components
|
|
33
|
+
|
|
34
|
+
- `Drawer.Header` - Default header wrapper that renders a title and, in non-persistent mode, a close button.
|
|
35
|
+
- `Drawer.Description` - Accessible description wrapper for drawer content.
|
|
36
|
+
- `Drawer.Body` - Main content area inside the drawer.
|
|
37
|
+
- `Drawer.Footer` - Default footer wrapper for primary, secondary, and tertiary actions.
|
|
38
|
+
- `Drawer.Header.Compose` - Custom header layout container.
|
|
39
|
+
- `Drawer.Header.Title` - Drawer heading helper for custom header compositions.
|
|
40
|
+
- `Drawer.Description.Text` - Typography helper for drawer description text.
|
|
41
|
+
- `Drawer.Footer.Compose` - Custom footer layout container.
|
|
42
|
+
- `Drawer.Footer.ActionButtonsContainer` - Container for footer action buttons.
|
|
43
|
+
|
|
44
|
+
### `Drawer.Header`
|
|
45
|
+
|
|
46
|
+
| Prop | Type | Default | Description |
|
|
47
|
+
|------|------|---------|-------------|
|
|
48
|
+
| title | `string` | required | Header title text. |
|
|
49
|
+
| titleHidden | `boolean` | `false` | Visually hides the title while keeping it accessible. |
|
|
50
|
+
|
|
51
|
+
It also accepts the native `HTMLAttributes<HTMLDivElement>` props through the composed header container.
|
|
52
|
+
|
|
53
|
+
### `Drawer.Header.Compose`
|
|
54
|
+
|
|
55
|
+
Accepts the native `HTMLAttributes<HTMLDivElement>` props for the custom header container.
|
|
56
|
+
|
|
57
|
+
### `Drawer.Header.Title`
|
|
58
|
+
|
|
59
|
+
| Prop | Type | Default | Description |
|
|
60
|
+
|------|------|---------|-------------|
|
|
61
|
+
| hidden | `boolean` | `false` | Visually hides the title while keeping it accessible. |
|
|
62
|
+
|
|
63
|
+
It inherits the `Typography.Heading` props.
|
|
64
|
+
|
|
65
|
+
### `Drawer.Description`
|
|
66
|
+
|
|
67
|
+
| Prop | Type | Default | Description |
|
|
68
|
+
|------|------|---------|-------------|
|
|
69
|
+
| hidden | `boolean` | `false` | Visually hides the description while keeping it accessible. |
|
|
70
|
+
|
|
71
|
+
It also accepts the native `HTMLAttributes<HTMLDivElement>` props through the description container.
|
|
72
|
+
|
|
73
|
+
### `Drawer.Description.Text`
|
|
74
|
+
|
|
75
|
+
It inherits the `Typography.Heading` props.
|
|
76
|
+
|
|
77
|
+
### `Drawer.Body`
|
|
78
|
+
|
|
79
|
+
| Prop | Type | Default | Description |
|
|
80
|
+
|------|------|---------|-------------|
|
|
81
|
+
| focusableForScroll | `boolean` | `true` | Adds focus and region semantics when the body content is scrollable. |
|
|
82
|
+
|
|
83
|
+
It also accepts the native `HTMLAttributes<HTMLDivElement>` props.
|
|
84
|
+
|
|
85
|
+
### `Drawer.Footer`
|
|
86
|
+
|
|
87
|
+
| Prop | Type | Default | Description |
|
|
88
|
+
|------|------|---------|-------------|
|
|
89
|
+
| primaryButtonText | `string` | - | Text for the primary action button. |
|
|
90
|
+
| secondaryButtonText | `string` | - | Text for the secondary action button. |
|
|
91
|
+
| tertiaryButtonText | `string` | - | Text for the tertiary text button. |
|
|
92
|
+
| tertiaryButtonIcon | `IconType` | - | Optional icon rendered before the tertiary button text. |
|
|
93
|
+
| primaryButtonDisabled | `boolean` | - | Disables the primary action button. |
|
|
94
|
+
| secondaryButtonDisabled | `boolean` | - | Disables the secondary action button. |
|
|
95
|
+
| tertiaryButtonDisabled | `boolean` | - | Disables the tertiary action button. |
|
|
96
|
+
| onPrimaryButtonClick | `(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void` | - | Primary button click handler. |
|
|
97
|
+
| onSecondaryButtonClick | `(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void` | - | Secondary button click handler. |
|
|
98
|
+
| onTertiaryButtonClick | `(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void` | - | Tertiary button click handler. |
|
|
99
|
+
|
|
100
|
+
It also accepts the native `HTMLAttributes<HTMLDivElement>` props.
|
|
101
|
+
|
|
102
|
+
### `Drawer.Footer.Compose`
|
|
103
|
+
|
|
104
|
+
Accepts the native `HTMLAttributes<HTMLDivElement>` props for the custom footer container.
|
|
105
|
+
|
|
106
|
+
### `Drawer.Footer.ActionButtonsContainer`
|
|
107
|
+
|
|
108
|
+
Accepts the native `HTMLAttributes<HTMLDivElement>` props for the action button container.
|
|
109
|
+
|
|
110
|
+
## Examples
|
|
111
|
+
|
|
112
|
+
### Basic Usage
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { Button, Drawer } from '@redislabsdev/redis-ui-components';
|
|
116
|
+
import { StarsIcon } from '@redislabsdev/redis-ui-icons';
|
|
117
|
+
import { useState } from 'react';
|
|
118
|
+
|
|
119
|
+
function Render() {
|
|
120
|
+
const [open, setOpen] = useState(false);
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<>
|
|
124
|
+
<Button onClick={() => setOpen(true)}>Open drawer</Button>
|
|
125
|
+
|
|
126
|
+
<Drawer open={open} onOpenChange={setOpen}>
|
|
127
|
+
<Drawer.Header title="Drawer.Header" titleHidden={false} />
|
|
128
|
+
<Drawer.Description hidden={false}>Drawer.Description</Drawer.Description>
|
|
129
|
+
<Drawer.Body>Drawer.Body</Drawer.Body>
|
|
130
|
+
<Drawer.Footer
|
|
131
|
+
primaryButtonText="Primary"
|
|
132
|
+
secondaryButtonText="Secondary"
|
|
133
|
+
tertiaryButtonText="Tertiary"
|
|
134
|
+
tertiaryButtonIcon={StarsIcon}
|
|
135
|
+
onPrimaryButtonClick={() => setOpen(false)}
|
|
136
|
+
onSecondaryButtonClick={() => setOpen(false)}
|
|
137
|
+
/>
|
|
138
|
+
</Drawer>
|
|
139
|
+
</>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Collapsible
|
|
145
|
+
|
|
146
|
+
> The auto collapsible mode is the default mode for the Drawer. It allows closing the drawer automatically when the user clicks outside or presses the `Esc` key. In this mode `Drawer.Header` will have the close button.
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import { Button, Drawer } from '@redislabsdev/redis-ui-components';
|
|
150
|
+
import { useState } from 'react';
|
|
151
|
+
|
|
152
|
+
import { StoryDrawerBodyContent } from './story.components';
|
|
153
|
+
|
|
154
|
+
function Render() {
|
|
155
|
+
const [open, setOpen] = useState(false);
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<>
|
|
159
|
+
<Button onClick={() => setOpen(true)}>Open drawer</Button>
|
|
160
|
+
|
|
161
|
+
<Drawer open={open} onOpenChange={setOpen}>
|
|
162
|
+
<Drawer.Header title="Collapsible drawer" />
|
|
163
|
+
<Drawer.Body>
|
|
164
|
+
<StoryDrawerBodyContent />
|
|
165
|
+
</Drawer.Body>
|
|
166
|
+
<Drawer.Footer secondaryButtonText="Close" onSecondaryButtonClick={() => setOpen(false)} />
|
|
167
|
+
</Drawer>
|
|
168
|
+
</>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Persistent
|
|
174
|
+
|
|
175
|
+
> The persistent mode prevents the drawer from being accidentally closed, which could result in the loss of filled form data. Use `persistent` prop to enable this mode. You'll need to manage open state manually and close the drawer explicitly.
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
import { Button, Drawer, Typography } from '@redislabsdev/redis-ui-components';
|
|
179
|
+
import { useState } from 'react';
|
|
180
|
+
|
|
181
|
+
function Render() {
|
|
182
|
+
const [open, setOpen] = useState(false);
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<>
|
|
186
|
+
<Button onClick={() => setOpen(true)}>Open drawer</Button>
|
|
187
|
+
|
|
188
|
+
<Drawer persistent open={open} onOpenChange={setOpen}>
|
|
189
|
+
<Drawer.Header title="Persistent drawer" />
|
|
190
|
+
<Drawer.Body>
|
|
191
|
+
<Typography.Heading size="S">Persistent drawers usually contain forms</Typography.Heading>
|
|
192
|
+
<br />
|
|
193
|
+
<Typography.Body>
|
|
194
|
+
The persistent mode prevents the drawer from being accidentally closed, which could
|
|
195
|
+
result in the loss of filled form data.
|
|
196
|
+
</Typography.Body>
|
|
197
|
+
</Drawer.Body>
|
|
198
|
+
<Drawer.Footer
|
|
199
|
+
primaryButtonText="Submit"
|
|
200
|
+
secondaryButtonText="Cancel"
|
|
201
|
+
onSecondaryButtonClick={() => setOpen(false)}
|
|
202
|
+
onPrimaryButtonClick={() => setOpen(false)}
|
|
203
|
+
/>
|
|
204
|
+
</Drawer>
|
|
205
|
+
</>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### InContainer
|
|
211
|
+
|
|
212
|
+
> Drawer can be opened under a specified container instead of `body`. Use `containerElement` prop to set the container element.
|
|
213
|
+
|
|
214
|
+
```tsx
|
|
215
|
+
import { Button, Drawer } from '@redislabsdev/redis-ui-components';
|
|
216
|
+
import { useState } from 'react';
|
|
217
|
+
|
|
218
|
+
import { StoryDrawerBodyContent } from './story.components';
|
|
219
|
+
import * as S from './story.style';
|
|
220
|
+
|
|
221
|
+
function Render() {
|
|
222
|
+
const [open, setOpen] = useState(false);
|
|
223
|
+
const [container, setContainer] = useState<HTMLDivElement | null>(null);
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<S.StoryDrawerContainer ref={setContainer}>
|
|
227
|
+
<Button onClick={() => setOpen(true)}>Open drawer</Button>
|
|
228
|
+
|
|
229
|
+
<Drawer open={open} onOpenChange={setOpen} containerElement={container || undefined}>
|
|
230
|
+
<Drawer.Header title="Drawer in container" />
|
|
231
|
+
<Drawer.Body>
|
|
232
|
+
<StoryDrawerBodyContent />
|
|
233
|
+
</Drawer.Body>
|
|
234
|
+
</Drawer>
|
|
235
|
+
</S.StoryDrawerContainer>
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Composition
|
|
241
|
+
|
|
242
|
+
> Use `Drawer.Header.Compose` and `Drawer.Footer.Compose` to compose the header and footer. `Drawer.Body` can have any children.
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
import { Button, Drawer, Typography } from '@redislabsdev/redis-ui-components';
|
|
246
|
+
import { useState } from 'react';
|
|
247
|
+
|
|
248
|
+
import { StoryDrawerBodyContent } from './story.components';
|
|
249
|
+
import { StoryGroupTitle, StoryHList, StoryVList } from '../../helpers/Story.style';
|
|
250
|
+
|
|
251
|
+
function Render() {
|
|
252
|
+
const [open, setOpen] = useState(false);
|
|
253
|
+
|
|
254
|
+
return (
|
|
255
|
+
<>
|
|
256
|
+
<Button onClick={() => setOpen(true)}>Open drawer</Button>
|
|
257
|
+
|
|
258
|
+
<Drawer open={open} onOpenChange={setOpen}>
|
|
259
|
+
<Drawer.Header.Compose>
|
|
260
|
+
<StoryHList>
|
|
261
|
+
<Drawer.Header.Title>Drawer.Header.Title</Drawer.Header.Title>
|
|
262
|
+
<Button>Custom Header content</Button>
|
|
263
|
+
</StoryHList>
|
|
264
|
+
</Drawer.Header.Compose>
|
|
265
|
+
<Drawer.Description>
|
|
266
|
+
<StoryHList>
|
|
267
|
+
<Drawer.Description.Text>Drawer.Description.Text</Drawer.Description.Text>
|
|
268
|
+
<Button>Custom Description content</Button>
|
|
269
|
+
</StoryHList>
|
|
270
|
+
</Drawer.Description>
|
|
271
|
+
<Drawer.Body>
|
|
272
|
+
<StoryVList $align="stretch">
|
|
273
|
+
<StoryGroupTitle>Drawer.Body: any content</StoryGroupTitle>
|
|
274
|
+
<StoryDrawerBodyContent />
|
|
275
|
+
</StoryVList>
|
|
276
|
+
</Drawer.Body>
|
|
277
|
+
<Drawer.Footer.Compose>
|
|
278
|
+
<Typography.Body>Custom Footer content</Typography.Body>
|
|
279
|
+
<Drawer.Footer.ActionButtonsContainer>
|
|
280
|
+
<Button variant="secondary-invert" onClick={() => setOpen(false)}>
|
|
281
|
+
Custom Close
|
|
282
|
+
</Button>
|
|
283
|
+
</Drawer.Footer.ActionButtonsContainer>
|
|
284
|
+
</Drawer.Footer.Compose>
|
|
285
|
+
</Drawer>
|
|
286
|
+
</>
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Notes
|
|
292
|
+
|
|
293
|
+
- The default mode is collapsible: outside clicks and the `Esc` key close the drawer, and `Drawer.Header` shows a close button.
|
|
294
|
+
- Use `persistent` when the drawer contains form state that should not be lost accidentally.
|
|
295
|
+
- Use `containerElement` when the drawer should render into a specific container instead of `body`.
|
|
296
|
+
- `Drawer.Header.Compose` and `Drawer.Footer.Compose` are the intended escape hatches for custom layouts.
|
|
297
|
+
- `Drawer.Body` can contain any children, including other interactive components and scrollable content.
|
|
298
|
+
- When composing the drawer, keep a proper title through `Drawer.Header.title` or `Drawer.Header.Title` so the dialog remains accessible.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Filters
|
|
2
|
+
|
|
3
|
+
Controlled filter bar for combining menu-based filters, a clear action, and an active-chip summary. Use the composition API when you need to place the controls in a custom layout.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Filters } from '@redislabsdev/redis-ui-components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
|------|------|---------|-------------|
|
|
15
|
+
| availableFilters | `FilterItemConfig[]` | required | Filter definitions to render. Each item provides a key, label, options, and optional filter type. |
|
|
16
|
+
| activeFilters | `FilterActive[]` | required | Current active filter state. |
|
|
17
|
+
| onChange | `(activeFilters: FilterActive[]) => void` | required | Called when the active filter selection changes. |
|
|
18
|
+
| showSearchLimit | `number` | `7` | Minimum number of options before a filter shows a search input. |
|
|
19
|
+
|
|
20
|
+
`Filters` extends `HTMLAttributes<HTMLDivElement>` except `onChange`, so you can pass standard div props to the root container.
|
|
21
|
+
|
|
22
|
+
### Exported Types
|
|
23
|
+
|
|
24
|
+
- `FilterType` - `'MultiSelect' | 'MultiTreeSelect'`
|
|
25
|
+
- `FilterItemConfig` - filter definition with `key`, `label`, `options`, optional `type`, and optional `showSearch`
|
|
26
|
+
- `FilterOption` - option definition with `label`, `value`, optional `id`, optional `chipLabel`, and optional nested `descendants`
|
|
27
|
+
- `FilterActive` - active filter entry with `key`, `selectedOptions`, and optional `type`
|
|
28
|
+
|
|
29
|
+
## Sub-components
|
|
30
|
+
|
|
31
|
+
- `Filters.Compose` - Provides Filters context and debounced change handling for custom compositions.
|
|
32
|
+
- `Filters.FiltersContainer` - Wrapper for the filter trigger row.
|
|
33
|
+
- `Filters.MultiSelectFilter` - Checkbox-based menu for flat multi-select filters.
|
|
34
|
+
- `Filters.MultiTreeSelectFilter` - Tree-based menu for hierarchical filters.
|
|
35
|
+
- `Filters.Clear` - Clear-all action bound to the current filter state.
|
|
36
|
+
- `Filters.Chips` - Renders chips for the active filters and handles removal.
|
|
37
|
+
|
|
38
|
+
### Filters.Compose Props
|
|
39
|
+
|
|
40
|
+
| Prop | Type | Default | Description |
|
|
41
|
+
|------|------|---------|-------------|
|
|
42
|
+
| availableFilters | `FilterItemConfig[]` | required | Filter definitions available to the composition. |
|
|
43
|
+
| activeFilters | `FilterActive[]` | required | Current active filter state. |
|
|
44
|
+
| onChange | `(activeFilters: FilterActive[]) => void` | required | Called when the active filter selection changes. |
|
|
45
|
+
| showSearchLimit | `number` | `7` | Minimum number of options before a filter shows a search input. |
|
|
46
|
+
| children | `React.ReactNode` | required | Custom composition content rendered inside the Filters context. |
|
|
47
|
+
|
|
48
|
+
### Filters.FiltersContainer Props
|
|
49
|
+
|
|
50
|
+
Inherits `HTMLAttributes<HTMLDivElement>`.
|
|
51
|
+
|
|
52
|
+
### Filters.MultiSelectFilter Props
|
|
53
|
+
|
|
54
|
+
| Prop | Type | Default | Description |
|
|
55
|
+
|------|------|---------|-------------|
|
|
56
|
+
| filter | `FilterItemConfig` | required | Filter configuration used to build the menu. |
|
|
57
|
+
| showSearchLimit | `number` | required | Minimum option count before the search input renders. |
|
|
58
|
+
|
|
59
|
+
`Filters.MultiSelectFilter` also accepts all `MenuProps` except `children`.
|
|
60
|
+
|
|
61
|
+
### Filters.MultiTreeSelectFilter Props
|
|
62
|
+
|
|
63
|
+
| Prop | Type | Default | Description |
|
|
64
|
+
|------|------|---------|-------------|
|
|
65
|
+
| filter | `FilterItemConfig` | required | Tree filter configuration used to build the menu. |
|
|
66
|
+
| showSearchLimit | `number` | required | Minimum option count before the search input renders. |
|
|
67
|
+
|
|
68
|
+
`Filters.MultiTreeSelectFilter` uses the same prop surface as `Filters.MultiSelectFilter` and also accepts all `MenuProps` except `children`.
|
|
69
|
+
|
|
70
|
+
### Filters.Clear Props
|
|
71
|
+
|
|
72
|
+
`Filters.Clear` inherits `TextButtonProps`.
|
|
73
|
+
|
|
74
|
+
### Filters.Chips Props
|
|
75
|
+
|
|
76
|
+
`Filters.Chips` inherits `Omit<ChipListProps, 'chips'>`.
|
|
77
|
+
|
|
78
|
+
## Examples
|
|
79
|
+
|
|
80
|
+
### Basic Usage
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { Filters } from '@redislabsdev/redis-ui-components';
|
|
84
|
+
import { useArgState } from '../../helpers/useArgState';
|
|
85
|
+
|
|
86
|
+
function Render(args) {
|
|
87
|
+
const [activeFilters, setActiveFilters] = useArgState({
|
|
88
|
+
arg: args.activeFilters,
|
|
89
|
+
event: args.onChange,
|
|
90
|
+
getNewState: (_, [value]) => value
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return <Filters {...args} activeFilters={activeFilters} onChange={setActiveFilters} />;
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Controlled
|
|
98
|
+
|
|
99
|
+
> Filters work in controlled mode only.<br/>
|
|
100
|
+
> Component requires array of filters with type and options `availableFilters`,
|
|
101
|
+
> selected filter values `activeFilters`,
|
|
102
|
+
> and `onChange` handler to update selection
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { useState } from 'react';
|
|
106
|
+
import { Filters } from '@redislabsdev/redis-ui-components';
|
|
107
|
+
import { availableFilters, defaultFilters } from './FiltersStory.data';
|
|
108
|
+
|
|
109
|
+
function Render() {
|
|
110
|
+
const [activeFilters, setActiveFilters] = useState(defaultFilters);
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<Filters
|
|
114
|
+
availableFilters={availableFilters}
|
|
115
|
+
activeFilters={activeFilters}
|
|
116
|
+
onChange={setActiveFilters}
|
|
117
|
+
/>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Composition
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { useState } from 'react';
|
|
126
|
+
import { Filters } from '@redislabsdev/redis-ui-components';
|
|
127
|
+
import { availableFilters, defaultFilters } from './FiltersStory.data';
|
|
128
|
+
|
|
129
|
+
function Render() {
|
|
130
|
+
const [activeFilters, setActiveFilters] = useState(defaultFilters);
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<Filters.Compose
|
|
134
|
+
availableFilters={availableFilters}
|
|
135
|
+
activeFilters={activeFilters}
|
|
136
|
+
onChange={setActiveFilters}
|
|
137
|
+
>
|
|
138
|
+
<div style={{ display: 'flex', gap: '15px', alignItems: 'center', padding: '5px 0' }}>
|
|
139
|
+
<Filters.FiltersContainer>
|
|
140
|
+
{availableFilters.map((filter) => {
|
|
141
|
+
const FilterComponent =
|
|
142
|
+
filter.type === 'MultiTreeSelect'
|
|
143
|
+
? Filters.MultiTreeSelectFilter
|
|
144
|
+
: Filters.MultiSelectFilter;
|
|
145
|
+
|
|
146
|
+
return <FilterComponent key={filter.key} filter={filter} showSearchLimit={7} />;
|
|
147
|
+
})}
|
|
148
|
+
</Filters.FiltersContainer>
|
|
149
|
+
<Filters.Clear />
|
|
150
|
+
</div>
|
|
151
|
+
<Filters.Chips />
|
|
152
|
+
</Filters.Compose>
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Notes
|
|
158
|
+
|
|
159
|
+
- `Filters` works in controlled mode only.
|
|
160
|
+
- `showSearchLimit` defaults to `7` and controls when a search input appears inside a filter menu.
|
|
161
|
+
- `Filters.Clear` clears the current selection and is disabled when there are no active filters.
|
|
162
|
+
- `Filters.Chips` derives chip labels from the active filters and caps the chip list at two rows.
|
|
@@ -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"`).
|