@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,525 @@
|
|
|
1
|
+
# Modal
|
|
2
|
+
|
|
3
|
+
Dialog component with customizable trigger and content, plus a compose API for advanced modal layouts.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Modal } from '@redislabsdev/redis-ui-components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
> Icons used in examples are imported separately from `@redislabsdev/redis-ui-icons`.
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
> The root `Modal` forwards the popup-related props used by `Modal.Content`, so the rows below apply to both surfaces. Compose surfaces also accept standard `div` attributes unless noted.
|
|
16
|
+
|
|
17
|
+
| Surface | Prop | Type | Default | Description |
|
|
18
|
+
|------|------|------|---------|-------------|
|
|
19
|
+
| `Modal` | `children` | `React.ReactNode` | - | Trigger content rendered inside `Modal.Trigger` |
|
|
20
|
+
| `Modal` | `defaultOpen` | `boolean` | - | Initial open state for uncontrolled usage |
|
|
21
|
+
| `Modal` | `open` | `boolean` | - | Controlled open state |
|
|
22
|
+
| `Modal` | `onOpenChange` | `(open: boolean) => void` | - | Called when the modal open state changes |
|
|
23
|
+
| `Modal` | `withButton` | `boolean` | `false` | Wraps plain text or multiple trigger nodes in an invisible button |
|
|
24
|
+
| `Modal.Content` | `title` | `ReactNode` | required | Dialog title shown in the header |
|
|
25
|
+
| `Modal.Content` | `description` | `ReactNode` | - | Optional description shown below the title |
|
|
26
|
+
| `Modal.Content` | `descriptionHidden` | `boolean` | `false` | Keeps the description visually hidden while preserving accessibility |
|
|
27
|
+
| `Modal.Content` | `content` | `ReactNode` | required | Body content rendered inside the modal |
|
|
28
|
+
| `Modal.Content` | `width` | `string` | - | Optional dialog body width |
|
|
29
|
+
| `Modal.Content` | `persistent` | `boolean` | `false` | Prevents closing by overlay click, `Esc`, and the close button |
|
|
30
|
+
| `Modal.Content` | `primaryButtonText` | `string` | - | Label for the primary action button |
|
|
31
|
+
| `Modal.Content` | `secondaryButtonText` | `string` | - | Label for the secondary action button |
|
|
32
|
+
| `Modal.Content` | `tertiaryButtonText` | `string` | - | Label for the tertiary action button |
|
|
33
|
+
| `Modal.Content` | `tertiaryButtonIcon` | `IconType` | - | Icon shown inside the tertiary action button |
|
|
34
|
+
| `Modal.Content` | `primaryButtonDisabled` | `boolean` | `false` | Disables the primary action button |
|
|
35
|
+
| `Modal.Content` | `secondaryButtonDisabled` | `boolean` | `false` | Disables the secondary action button |
|
|
36
|
+
| `Modal.Content` | `tertiaryButtonDisabled` | `boolean` | `false` | Disables the tertiary action button |
|
|
37
|
+
| `Modal.Content` | `onPrimaryButtonClick` | `(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void` | - | Handler for the primary action button |
|
|
38
|
+
| `Modal.Content` | `onSecondaryButtonClick` | `(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void` | `onCancel` | Handler for the secondary action button |
|
|
39
|
+
| `Modal.Content` | `onTertiaryButtonClick` | `(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void` | - | Handler for the tertiary action button |
|
|
40
|
+
| `Modal.Content` | `onCancel` | `VoidFunction` | - | Fired when the modal closes via overlay click, `Esc`, or close actions |
|
|
41
|
+
| `Modal.Compose` | `children` | `React.ReactNode` | required | Dialog root children |
|
|
42
|
+
| `Modal.Compose` | `defaultOpen` | `boolean` | - | Initial open state for the dialog root |
|
|
43
|
+
| `Modal.Compose` | `open` | `boolean` | - | Controlled open state for the dialog root |
|
|
44
|
+
| `Modal.Compose` | `onOpenChange` | `(open: boolean) => void` | - | Fired when the dialog root open state changes |
|
|
45
|
+
| `Modal.Trigger` | `children` | `React.ReactNode` | required | Trigger content rendered as the dialog trigger |
|
|
46
|
+
| `Modal.Trigger` | `withButton` | `boolean` | `false` | Wraps trigger content in an invisible button when plain text or multiple nodes are used |
|
|
47
|
+
| `Modal.Closable` | `children` | `React.ReactElement` | required | Child element wrapped in a dialog close action |
|
|
48
|
+
| `Modal.Content.Compose` | `children` | `React.ReactNode` | required | Low-level dialog content children |
|
|
49
|
+
| `Modal.Content.Compose` | `persistent` | `boolean` | `false` | Prevents closing from overlay clicks, `Esc`, and close actions |
|
|
50
|
+
| `Modal.Content.Compose` | `onCancel` | `VoidFunction` | - | Close callback used by escape, overlay, and close interactions |
|
|
51
|
+
| `Modal.Content.Header` | `title` | `ReactNode` | required | Header title content |
|
|
52
|
+
| `Modal.Content.Header` | `titleHidden` | `boolean` | `false` | Hides the title visually while keeping it accessible |
|
|
53
|
+
| `Modal.Content.Header.Compose` | `children` | `React.ReactNode` | required | Custom header container content |
|
|
54
|
+
| `Modal.Content.Header.Title` | `hidden` | `boolean` | `false` | Hides the title visually while keeping the dialog title accessible |
|
|
55
|
+
| `Modal.Content.Header.Title` | `Typography.Heading props` | - | - | Inherits the `Typography.Heading` prop surface |
|
|
56
|
+
| `Modal.Content.Description` | `children` | `React.ReactNode` | required | Description content rendered below the title |
|
|
57
|
+
| `Modal.Content.Description` | `hidden` | `boolean` | `false` | Hides the description visually while keeping it accessible |
|
|
58
|
+
| `Modal.Content.Description.Text` | `Typography.Heading props` | - | - | Typography wrapper for description text, rendered at size `XS` |
|
|
59
|
+
| `Modal.Content.Body` | `content` | `ReactNode` | required | Body content rendered inside the dialog body |
|
|
60
|
+
| `Modal.Content.Body` | `width` | `string` | - | Optional width for the body container |
|
|
61
|
+
| `Modal.Content.Body.Compose` | `children` | `React.ReactNode` | required | Custom body container content |
|
|
62
|
+
| `Modal.Content.Body.Compose` | `width` | `string` | - | Optional width for the body container |
|
|
63
|
+
| `Modal.Content.Body.Text` | `Typography.Body props` | - | - | Typography wrapper for body text |
|
|
64
|
+
| `Modal.Content.Footer` | `primaryButtonText` | `string` | - | Label for the primary action button |
|
|
65
|
+
| `Modal.Content.Footer` | `secondaryButtonText` | `string` | - | Label for the secondary action button |
|
|
66
|
+
| `Modal.Content.Footer` | `tertiaryButtonText` | `string` | - | Label for the tertiary action button |
|
|
67
|
+
| `Modal.Content.Footer` | `tertiaryButtonIcon` | `IconType` | - | Icon shown inside the tertiary action button |
|
|
68
|
+
| `Modal.Content.Footer` | `primaryButtonDisabled` | `boolean` | `false` | Disables the primary action button |
|
|
69
|
+
| `Modal.Content.Footer` | `secondaryButtonDisabled` | `boolean` | `false` | Disables the secondary action button |
|
|
70
|
+
| `Modal.Content.Footer` | `tertiaryButtonDisabled` | `boolean` | `false` | Disables the tertiary action button |
|
|
71
|
+
| `Modal.Content.Footer` | `onPrimaryButtonClick` | `(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void` | - | Handler for the primary action button |
|
|
72
|
+
| `Modal.Content.Footer` | `onSecondaryButtonClick` | `(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void` | `onCancel` | Handler for the secondary action button |
|
|
73
|
+
| `Modal.Content.Footer` | `onTertiaryButtonClick` | `(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void` | - | Handler for the tertiary action button |
|
|
74
|
+
| `Modal.Content.Footer.Compose` | `children` | `React.ReactNode` | required | Custom footer container content |
|
|
75
|
+
| `Modal.Content.Close` | `icon` | `IconType` | `CancelIcon` | Icon rendered inside the close button |
|
|
76
|
+
| `Modal.Content.Close` | `persistent` | `boolean` | `false` | Omits the close button when the dialog is persistent |
|
|
77
|
+
| `Modal.Content.Close` | `onClick` | `(event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void` | - | Close button click handler |
|
|
78
|
+
|
|
79
|
+
## Sub-components
|
|
80
|
+
|
|
81
|
+
- `Modal.Compose` - Low-level Radix dialog root for controlled and uncontrolled modal state.
|
|
82
|
+
- `Modal.Content` - Complete modal panel with header, description, body, footer, and close wiring.
|
|
83
|
+
- `Modal.Trigger` - Wraps trigger content and can use an invisible button wrapper with `withButton`.
|
|
84
|
+
- `Modal.Closable` - Wraps a custom element so it closes the dialog when clicked.
|
|
85
|
+
- `Modal.Content.Compose` - Base dialog content container used for fully custom layouts.
|
|
86
|
+
- `Modal.Content.Header` - Default header area that maps string titles to an accessible dialog title.
|
|
87
|
+
- `Modal.Content.Header.Compose` - Custom header container for fully composed headers.
|
|
88
|
+
- `Modal.Content.Header.Title` - Accessible title wrapper for custom header content.
|
|
89
|
+
- `Modal.Content.Description` - Default description area that hides empty content automatically.
|
|
90
|
+
- `Modal.Content.Description.Text` - Typography wrapper for description text.
|
|
91
|
+
- `Modal.Content.Body` - Default body area that renders string content or custom nodes.
|
|
92
|
+
- `Modal.Content.Body.Compose` - Custom body container for fully composed content layouts.
|
|
93
|
+
- `Modal.Content.Body.Text` - Typography wrapper for body text.
|
|
94
|
+
- `Modal.Content.Footer` - Default footer area with primary, secondary, and tertiary action buttons.
|
|
95
|
+
- `Modal.Content.Footer.Compose` - Custom footer container for custom action rows.
|
|
96
|
+
- `Modal.Content.Footer.Group` - Internal button group container used by the default footer layout.
|
|
97
|
+
- `Modal.Content.Close` - Close icon button rendered in the top-right of the modal.
|
|
98
|
+
|
|
99
|
+
## Examples
|
|
100
|
+
|
|
101
|
+
### Playground
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
import { Button, Modal } from '@redislabsdev/redis-ui-components';
|
|
105
|
+
|
|
106
|
+
<Modal
|
|
107
|
+
title="Modal headline"
|
|
108
|
+
content={`Modals display content that temporarily blocks interactions
|
|
109
|
+
within the main view of a site. It can contain critical information, require decisions, or contain entire feature workflows.`}
|
|
110
|
+
primaryButtonText="Submit"
|
|
111
|
+
secondaryButtonText="Cancel"
|
|
112
|
+
width="30rem"
|
|
113
|
+
>
|
|
114
|
+
<Button>Try me</Button>
|
|
115
|
+
</Modal>;
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### TriggerWithButton
|
|
119
|
+
|
|
120
|
+
> Modal Trigger has property `withButton` which allows wrapping trigger elements with invisible button.
|
|
121
|
+
>
|
|
122
|
+
> Use this property if you have multiple elements or your element doesn't work as trigger
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
import { Button, Modal } from '@redislabsdev/redis-ui-components';
|
|
126
|
+
|
|
127
|
+
<Modal title="Modal title" content="Modal content" withButton>
|
|
128
|
+
Plain text or multiple elements should be wrapped, using <strong>withButton</strong>
|
|
129
|
+
prop
|
|
130
|
+
</Modal>;
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### NonClosingOverlay
|
|
134
|
+
|
|
135
|
+
> Click out of the Modal will not close it, if `persistent` flag is set
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import { Button, Modal } from '@redislabsdev/redis-ui-components';
|
|
139
|
+
|
|
140
|
+
<Modal
|
|
141
|
+
title="Non-closing Overlay"
|
|
142
|
+
content='Click out of the Modal will not close it, if "persistent" flag is set'
|
|
143
|
+
secondaryButtonText="Close"
|
|
144
|
+
persistent
|
|
145
|
+
>
|
|
146
|
+
<Button>Try me</Button>
|
|
147
|
+
</Modal>;
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### ModalWith3Buttons
|
|
151
|
+
|
|
152
|
+
> Modal can contain 3 buttons
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
import { Button, Modal } from '@redislabsdev/redis-ui-components';
|
|
156
|
+
import { StarsIcon } from '@redislabsdev/redis-ui-icons';
|
|
157
|
+
|
|
158
|
+
<Modal
|
|
159
|
+
title="Modal"
|
|
160
|
+
content="Modal can have 3 buttons. Tertiary button can also be defined with icon"
|
|
161
|
+
primaryButtonText="Primary"
|
|
162
|
+
secondaryButtonText="Secondary"
|
|
163
|
+
tertiaryButtonText="Tertiary"
|
|
164
|
+
tertiaryButtonIcon={StarsIcon}
|
|
165
|
+
>
|
|
166
|
+
<Button>Try me</Button>
|
|
167
|
+
</Modal>;
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### DisabledButtons
|
|
171
|
+
|
|
172
|
+
> Modal buttons can be disabled
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
import { Button, Modal } from '@redislabsdev/redis-ui-components';
|
|
176
|
+
|
|
177
|
+
<Modal
|
|
178
|
+
title="Modal "
|
|
179
|
+
content="Each button can be disabled"
|
|
180
|
+
primaryButtonText="Primary"
|
|
181
|
+
primaryButtonDisabled
|
|
182
|
+
secondaryButtonText="Secondary"
|
|
183
|
+
secondaryButtonDisabled
|
|
184
|
+
>
|
|
185
|
+
<Button>Try me</Button>
|
|
186
|
+
</Modal>;
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### ProgrammaticallyOpened
|
|
190
|
+
|
|
191
|
+
> Modal can be opened programmatically by setting `open` or `defaultOpen` props
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import { useEffect, useState } from 'react';
|
|
195
|
+
import { Modal, Switch, Typography } from '@redislabsdev/redis-ui-components';
|
|
196
|
+
|
|
197
|
+
function Render() {
|
|
198
|
+
const [open, setOpen] = useState(false);
|
|
199
|
+
const [enabled, setEnabled] = useState(false);
|
|
200
|
+
const [countDown, setCountDown] = useState(5);
|
|
201
|
+
|
|
202
|
+
const resetTimer = () => {
|
|
203
|
+
setCountDown(5);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
useEffect(() => {
|
|
207
|
+
if (enabled) {
|
|
208
|
+
if (countDown > 0) {
|
|
209
|
+
const timer = setTimeout(() => {
|
|
210
|
+
setCountDown(countDown - 1);
|
|
211
|
+
}, 1000);
|
|
212
|
+
|
|
213
|
+
return () => clearTimeout(timer);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
setOpen(true);
|
|
217
|
+
} else {
|
|
218
|
+
resetTimer();
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return undefined;
|
|
222
|
+
}, [countDown, enabled]);
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
<>
|
|
226
|
+
<Switch checked={enabled} onCheckedChange={setEnabled} />
|
|
227
|
+
{enabled ? (
|
|
228
|
+
<>
|
|
229
|
+
<Typography.Heading size="M">
|
|
230
|
+
Modal will be open in {countDown} seconds
|
|
231
|
+
</Typography.Heading>
|
|
232
|
+
<Modal
|
|
233
|
+
open={open}
|
|
234
|
+
onOpenChange={(o) => {
|
|
235
|
+
setOpen(o);
|
|
236
|
+
|
|
237
|
+
if (!o) {
|
|
238
|
+
setEnabled(false);
|
|
239
|
+
}
|
|
240
|
+
}}
|
|
241
|
+
title="Modal headline"
|
|
242
|
+
content="Feel free to paste any kind of text on me but try to keep it short and to the point, and as informative as you can :)"
|
|
243
|
+
primaryButtonText="Submit"
|
|
244
|
+
secondaryButtonText="Cancel"
|
|
245
|
+
/>
|
|
246
|
+
</>
|
|
247
|
+
) : (
|
|
248
|
+
<Typography.Heading size="M">Switch timer ON</Typography.Heading>
|
|
249
|
+
)}
|
|
250
|
+
</>
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### StackModals
|
|
256
|
+
|
|
257
|
+
> Multiple modals can be opened in the controlled mode only.
|
|
258
|
+
> Do not use onOpenChanged event to close modal, because it will close the first modal, when opening second one.
|
|
259
|
+
|
|
260
|
+
```tsx
|
|
261
|
+
import { useState } from 'react';
|
|
262
|
+
import { Button, Modal } from '@redislabsdev/redis-ui-components';
|
|
263
|
+
|
|
264
|
+
function Render() {
|
|
265
|
+
const [open1, setOpen1] = useState(false);
|
|
266
|
+
const [open2, setOpen2] = useState(false);
|
|
267
|
+
|
|
268
|
+
const closeAll = () => {
|
|
269
|
+
setOpen2(false);
|
|
270
|
+
setOpen1(false);
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
return (
|
|
274
|
+
<>
|
|
275
|
+
<Modal
|
|
276
|
+
open={open1}
|
|
277
|
+
onOpenChange={(opened) => opened && setOpen1(true)}
|
|
278
|
+
title="Modal level 1"
|
|
279
|
+
content="Multiple modals can be opened in the controlled mode only"
|
|
280
|
+
width="90rem"
|
|
281
|
+
primaryButtonText="Open 2"
|
|
282
|
+
secondaryButtonText="Close 1"
|
|
283
|
+
persistent
|
|
284
|
+
onPrimaryButtonClick={() => setOpen2(true)}
|
|
285
|
+
onSecondaryButtonClick={() => setOpen1(false)}
|
|
286
|
+
>
|
|
287
|
+
<Button>Try me</Button>
|
|
288
|
+
</Modal>
|
|
289
|
+
<Modal
|
|
290
|
+
open={open2}
|
|
291
|
+
title="Modal level 2"
|
|
292
|
+
content="Dialogs can be programmatically closed one by one or all together"
|
|
293
|
+
width="30rem"
|
|
294
|
+
primaryButtonText="Close all"
|
|
295
|
+
secondaryButtonText="Close 2"
|
|
296
|
+
persistent
|
|
297
|
+
onPrimaryButtonClick={closeAll}
|
|
298
|
+
onSecondaryButtonClick={() => setOpen2(false)}
|
|
299
|
+
/>
|
|
300
|
+
</>
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## Modal.Content
|
|
306
|
+
|
|
307
|
+
`Modal.Content` defines the dialog look. It exposes the popup-related props used by `Modal` and supports full composition for custom headers, body, and footer layouts.
|
|
308
|
+
|
|
309
|
+
### Playground
|
|
310
|
+
|
|
311
|
+
```tsx
|
|
312
|
+
import { Button, Modal } from '@redislabsdev/redis-ui-components';
|
|
313
|
+
|
|
314
|
+
<Modal.Compose>
|
|
315
|
+
<Modal.Trigger>
|
|
316
|
+
<Button>Try me</Button>
|
|
317
|
+
</Modal.Trigger>
|
|
318
|
+
<Modal.Content
|
|
319
|
+
title="Modal headline"
|
|
320
|
+
description="This is a description text that appears below the title"
|
|
321
|
+
content={`Modal content defines the dialog look. It has basic definitions for headline, body and 3 action buttons. Also it allows to change the width of the dialog`}
|
|
322
|
+
primaryButtonText="Submit"
|
|
323
|
+
secondaryButtonText="Cancel"
|
|
324
|
+
width="30rem"
|
|
325
|
+
/>
|
|
326
|
+
</Modal.Compose>
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### ComplexHeaderAndBody
|
|
330
|
+
|
|
331
|
+
> Modal Header and Body can receive any elements and text formatting via props
|
|
332
|
+
> without necessity for composition
|
|
333
|
+
|
|
334
|
+
```tsx
|
|
335
|
+
import { Button, Modal } from '@redislabsdev/redis-ui-components';
|
|
336
|
+
import { StarsIcon } from '@redislabsdev/redis-ui-icons';
|
|
337
|
+
|
|
338
|
+
<Modal.Compose>
|
|
339
|
+
<Modal.Trigger>
|
|
340
|
+
<Button>Try me</Button>
|
|
341
|
+
</Modal.Trigger>
|
|
342
|
+
<Modal.Content
|
|
343
|
+
title={
|
|
344
|
+
<>
|
|
345
|
+
<StarsIcon />
|
|
346
|
+
<Modal.Content.Header.Title>
|
|
347
|
+
<em>Custom</em> Header and Body
|
|
348
|
+
</Modal.Content.Header.Title>
|
|
349
|
+
</>
|
|
350
|
+
}
|
|
351
|
+
content={
|
|
352
|
+
<>
|
|
353
|
+
Modal Header and Body can receive <strong>any</strong> elements and text formatting without
|
|
354
|
+
necessity for composition
|
|
355
|
+
<br /> <br /> <input type="checkbox" /> <input type="radio" name="a" />
|
|
356
|
+
<input type="radio" name="a" /> <button type="button">button</button>
|
|
357
|
+
<Modal.Closable>
|
|
358
|
+
<button type="button">closable button</button>
|
|
359
|
+
</Modal.Closable>
|
|
360
|
+
</>
|
|
361
|
+
}
|
|
362
|
+
secondaryButtonText="Close"
|
|
363
|
+
/>
|
|
364
|
+
</Modal.Compose>
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### ContentCompose
|
|
368
|
+
|
|
369
|
+
> Basic `Modal.Content` composition
|
|
370
|
+
|
|
371
|
+
```tsx
|
|
372
|
+
import { Button, Modal } from '@redislabsdev/redis-ui-components';
|
|
373
|
+
import { DeleteIcon } from '@redislabsdev/redis-ui-icons';
|
|
374
|
+
|
|
375
|
+
<Modal.Compose>
|
|
376
|
+
<Modal.Trigger>
|
|
377
|
+
<Button>Try me</Button>
|
|
378
|
+
</Modal.Trigger>
|
|
379
|
+
<Modal.Content.Compose>
|
|
380
|
+
<Modal.Content.Close icon={DeleteIcon} />
|
|
381
|
+
<Modal.Content.Header title="Header" />
|
|
382
|
+
<Modal.Content.Body content="Body text" width="30rem" />
|
|
383
|
+
<Modal.Content.Footer primaryButtonText="Submit" secondaryButtonText="Cancel" />
|
|
384
|
+
</Modal.Content.Compose>
|
|
385
|
+
</Modal.Compose>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### ContentHeaderCompose
|
|
389
|
+
|
|
390
|
+
> Composing `Modal.Content.Header`
|
|
391
|
+
|
|
392
|
+
```tsx
|
|
393
|
+
import { Button, Modal } from '@redislabsdev/redis-ui-components';
|
|
394
|
+
import { WandIcon } from '@redislabsdev/redis-ui-icons';
|
|
395
|
+
|
|
396
|
+
<Modal.Compose>
|
|
397
|
+
<Modal.Trigger>
|
|
398
|
+
<Button>Try me</Button>
|
|
399
|
+
</Modal.Trigger>
|
|
400
|
+
<Modal.Content.Compose>
|
|
401
|
+
<Modal.Content.Close />
|
|
402
|
+
<Modal.Content.Header.Compose
|
|
403
|
+
style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}
|
|
404
|
+
>
|
|
405
|
+
<WandIcon customSize="10rem" />
|
|
406
|
+
<Modal.Content.Header.Title>My Custom Title</Modal.Content.Header.Title>
|
|
407
|
+
</Modal.Content.Header.Compose>
|
|
408
|
+
<Modal.Content.Body content="Feel free to paste any kind of text on me but try to keep it short and to the point, and as informative as you can :)" />
|
|
409
|
+
<Modal.Content.Footer primaryButtonText="Submit" secondaryButtonText="Cancel" />
|
|
410
|
+
</Modal.Content.Compose>
|
|
411
|
+
</Modal.Compose>
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### ContentBodyCompose
|
|
415
|
+
|
|
416
|
+
> Composing `Modal.Content.Body`
|
|
417
|
+
|
|
418
|
+
```tsx
|
|
419
|
+
import { Button, Modal, Typography } from '@redislabsdev/redis-ui-components';
|
|
420
|
+
|
|
421
|
+
<Modal.Compose>
|
|
422
|
+
<Modal.Trigger>
|
|
423
|
+
<Button>Try me</Button>
|
|
424
|
+
</Modal.Trigger>
|
|
425
|
+
<Modal.Content.Compose>
|
|
426
|
+
<Modal.Content.Close />
|
|
427
|
+
<Modal.Content.Header title="My Custom Content" />
|
|
428
|
+
<Modal.Content.Body.Compose>
|
|
429
|
+
<Modal.Content.Body.Text>
|
|
430
|
+
Here can be any text, <Button variant="secondary-invert">element</Button>, or
|
|
431
|
+
<input type="text" value="anything you need to render" />
|
|
432
|
+
</Modal.Content.Body.Text>
|
|
433
|
+
<Typography.Body style={{ marginTop: '2rem' }} color="primary" size="L">
|
|
434
|
+
Another paragraph, but can be anything
|
|
435
|
+
</Typography.Body>
|
|
436
|
+
</Modal.Content.Body.Compose>
|
|
437
|
+
<Modal.Content.Footer primaryButtonText="Submit" secondaryButtonText="Cancel" />
|
|
438
|
+
</Modal.Content.Compose>
|
|
439
|
+
</Modal.Compose>
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
### ContentFooterCompose
|
|
443
|
+
|
|
444
|
+
> Basic `Modal.Content.Footer` composition
|
|
445
|
+
|
|
446
|
+
```tsx
|
|
447
|
+
import { Button, Modal, Typography } from '@redislabsdev/redis-ui-components';
|
|
448
|
+
import { StarsIcon } from '@redislabsdev/redis-ui-icons';
|
|
449
|
+
|
|
450
|
+
function Render() {
|
|
451
|
+
return (
|
|
452
|
+
<Modal.Compose>
|
|
453
|
+
<Modal.Trigger>
|
|
454
|
+
<Button>Try me</Button>
|
|
455
|
+
</Modal.Trigger>
|
|
456
|
+
<Modal.Content.Compose>
|
|
457
|
+
<Modal.Content.Close />
|
|
458
|
+
<Modal.Content.Header title="My Custom Footer" />
|
|
459
|
+
<Modal.Content.Body
|
|
460
|
+
content={
|
|
461
|
+
<>
|
|
462
|
+
Footer can contain anything.
|
|
463
|
+
<br />
|
|
464
|
+
Button should be wrapped with <strong>Modal.Closable</strong> to allow closing Modal
|
|
465
|
+
</>
|
|
466
|
+
}
|
|
467
|
+
/>
|
|
468
|
+
<Modal.Content.Footer.Compose style={{ justifyContent: 'space-between' }}>
|
|
469
|
+
<Typography.Body>Custom Footer text</Typography.Body>
|
|
470
|
+
<Modal.Closable>
|
|
471
|
+
<Button variant="secondary-invert">
|
|
472
|
+
<Button.Icon icon={StarsIcon} /> Custom Footer Button
|
|
473
|
+
</Button>
|
|
474
|
+
</Modal.Closable>
|
|
475
|
+
</Modal.Content.Footer.Compose>
|
|
476
|
+
</Modal.Content.Compose>
|
|
477
|
+
</Modal.Compose>
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
### CustomContentCompose
|
|
483
|
+
|
|
484
|
+
> Completely custom `Modal.Content` composition
|
|
485
|
+
|
|
486
|
+
```tsx
|
|
487
|
+
import { Button, Modal, TextButton, Typography } from '@redislabsdev/redis-ui-components';
|
|
488
|
+
import { SignoutIcon, StarsIcon } from '@redislabsdev/redis-ui-icons';
|
|
489
|
+
|
|
490
|
+
<Modal.Compose>
|
|
491
|
+
<Modal.Trigger>
|
|
492
|
+
<Button>Try me</Button>
|
|
493
|
+
</Modal.Trigger>
|
|
494
|
+
<Modal.Content.Compose>
|
|
495
|
+
<Modal.Content.Header.Title hidden>hidden accessible title</Modal.Content.Header.Title>
|
|
496
|
+
<div style={{ textAlign: 'right' }}>
|
|
497
|
+
<Modal.Closable>
|
|
498
|
+
<span>
|
|
499
|
+
<SignoutIcon size="XL" />
|
|
500
|
+
</span>
|
|
501
|
+
</Modal.Closable>
|
|
502
|
+
</div>
|
|
503
|
+
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
|
504
|
+
<StarsIcon customSize="15rem" />
|
|
505
|
+
<Typography.Heading size="XXL">Custom Modal.Content</Typography.Heading>
|
|
506
|
+
<Typography.Body>Modal content composition can be completely custom</Typography.Body>
|
|
507
|
+
<Modal.Closable>
|
|
508
|
+
<TextButton>Close</TextButton>
|
|
509
|
+
</Modal.Closable>
|
|
510
|
+
</div>
|
|
511
|
+
</Modal.Content.Compose>
|
|
512
|
+
</Modal.Compose>
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
## Notes
|
|
516
|
+
|
|
517
|
+
- `Modal.Trigger` can use `withButton` to wrap plain text or multiple nodes in an invisible button.
|
|
518
|
+
- `persistent` prevents closing the modal by overlay click, `Esc`, and the close button.
|
|
519
|
+
- `Modal` supports three action buttons, and the tertiary button can include an icon.
|
|
520
|
+
- Each action button can be disabled independently.
|
|
521
|
+
- Programmatic opening works through `open` or `defaultOpen`.
|
|
522
|
+
- Controlled modal stacking should use explicit state updates; do not rely on `onOpenChange` to close the first modal when opening another one.
|
|
523
|
+
- `Modal.Content.Header` must render an accessible title either via the `title` prop or `Modal.Content.Header.Title`.
|
|
524
|
+
- `Modal.Closable` is the wrapper to use when a custom button should close the dialog.
|
|
525
|
+
- `Modal.Content.Description` hides empty content automatically and can also be visually hidden with `hidden`.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# MoreInfoIcon
|
|
2
|
+
|
|
3
|
+
Icon button that wraps a tooltip and renders an info icon by default.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { MoreInfoIcon } from '@redislabsdev/redis-ui-components';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
> Examples that use custom icons also import them from `@redislabsdev/redis-ui-icons`.
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
|------|------|---------|-------------|
|
|
17
|
+
| tooltip | `React.ReactNode` | *required* | Tooltip content. If empty, the icon is not rendered. |
|
|
18
|
+
| tooltipProps | `Omit<TooltipProps, 'children' \| 'content' \| 'text'>` | - | Props passed to the underlying `Tooltip` component. |
|
|
19
|
+
| size | `IconSizeType` | `'L'` | Icon size. |
|
|
20
|
+
| customIcon | `IconType` | `InfoIcon` | Custom icon component to render instead of the default info icon. |
|
|
21
|
+
|
|
22
|
+
The component also extends native `HTMLAttributes<HTMLSpanElement>` props, excluding `content`, `children`, and `size`.
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
### Basic Usage
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { MoreInfoIcon } from '@redislabsdev/redis-ui-components';
|
|
30
|
+
|
|
31
|
+
<MoreInfoIcon tooltip="Info Tooltip" />
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### TooltipContent
|
|
35
|
+
|
|
36
|
+
> The story shows that empty tooltip content hides the icon. It also demonstrates passing tooltip content and tooltip props for custom placement and view-mode behavior.
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { MoreInfoIcon } from '@redislabsdev/redis-ui-components';
|
|
40
|
+
import { useViewMode } from '../../helpers/useViewMode';
|
|
41
|
+
import * as S from '../Label/Label.style';
|
|
42
|
+
|
|
43
|
+
const useStoryInfoIconProps = () => ({
|
|
44
|
+
defaultOpen: useViewMode().inStory
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
<>
|
|
48
|
+
<MoreInfoIcon tooltip={<span> </span>} />
|
|
49
|
+
<MoreInfoIcon tooltip={' '} />
|
|
50
|
+
<MoreInfoIcon
|
|
51
|
+
tooltip={
|
|
52
|
+
<>
|
|
53
|
+
<S.LabelInfoIconHeading>Custom</S.LabelInfoIconHeading>
|
|
54
|
+
<S.LabelInfoIconBody>colored content</S.LabelInfoIconBody>
|
|
55
|
+
<S.LabelInfoIconText>
|
|
56
|
+
with <strong>textColor</strong> prop
|
|
57
|
+
</S.LabelInfoIconText>
|
|
58
|
+
</>
|
|
59
|
+
}
|
|
60
|
+
tooltipProps={{
|
|
61
|
+
placement: 'bottom',
|
|
62
|
+
...useStoryInfoIconProps()
|
|
63
|
+
}}
|
|
64
|
+
/>
|
|
65
|
+
</>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### IconSize
|
|
69
|
+
|
|
70
|
+
> MoreInfoIcon supports the regular icon sizes. Use `size` to choose `S`, `M`, or `L`.
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { MoreInfoIcon } from '@redislabsdev/redis-ui-components';
|
|
74
|
+
import { useViewMode } from '../../helpers/useViewMode';
|
|
75
|
+
|
|
76
|
+
const defaultProps = { tooltipProps: { defaultOpen: useViewMode().inStory } };
|
|
77
|
+
|
|
78
|
+
<>
|
|
79
|
+
<MoreInfoIcon tooltip="Icon size S" size="S" {...defaultProps} />
|
|
80
|
+
<MoreInfoIcon tooltip="Icon size M" size="M" {...defaultProps} />
|
|
81
|
+
<MoreInfoIcon tooltip="Icon size L (default)" size="L" {...defaultProps} />
|
|
82
|
+
</>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### CustomIconAndColor
|
|
86
|
+
|
|
87
|
+
> MoreInfoIcon can render a custom icon. Use `customIcon` to set it.
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { MoreInfoIcon } from '@redislabsdev/redis-ui-components';
|
|
91
|
+
import { ToastDangerIcon, ToastCheckIcon } from '@redislabsdev/redis-ui-icons';
|
|
92
|
+
import { useTheme } from '@redislabsdev/redis-ui-styles';
|
|
93
|
+
import { useViewMode } from '../../helpers/useViewMode';
|
|
94
|
+
|
|
95
|
+
const defaultProps = { tooltipProps: { defaultOpen: useViewMode().inStory } };
|
|
96
|
+
const themeColors = useTheme().semantic.color;
|
|
97
|
+
|
|
98
|
+
<>
|
|
99
|
+
<MoreInfoIcon
|
|
100
|
+
tooltip={<span style={{ color: themeColors.text.danger500 }}>Error</span>}
|
|
101
|
+
customIcon={ToastDangerIcon}
|
|
102
|
+
style={{ color: themeColors.icon.danger500 }}
|
|
103
|
+
{...defaultProps}
|
|
104
|
+
/>
|
|
105
|
+
<MoreInfoIcon
|
|
106
|
+
tooltip="Success"
|
|
107
|
+
customIcon={ToastCheckIcon}
|
|
108
|
+
style={{ color: themeColors.icon.success300 }}
|
|
109
|
+
{...defaultProps}
|
|
110
|
+
/>
|
|
111
|
+
</>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Notes
|
|
115
|
+
|
|
116
|
+
- Empty tooltip content suppresses the icon entirely.
|
|
117
|
+
- The tooltip-content story notes that `tooltipProps` also covers `Tooltip.Content` behavior and icon-related props like `iconColor` and `size`.
|
|
118
|
+
- `tooltipProps` forwards placement and other tooltip behavior to the underlying `Tooltip`.
|
|
119
|
+
- `MoreInfoIcon` renders `InfoIcon` by default and uses `size="L"` when no size is provided.
|