@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.
Files changed (228) hide show
  1. package/dist/AutoCompleteSelect/AutoCompleteSelect.cjs +7 -1
  2. package/dist/AutoCompleteSelect/AutoCompleteSelect.js +7 -1
  3. package/dist/AutoCompleteSelect/hooks/useAutoCompleteSelect.cjs +7 -1
  4. package/dist/AutoCompleteSelect/hooks/useAutoCompleteSelect.d.ts +8 -1
  5. package/dist/AutoCompleteSelect/hooks/useAutoCompleteSelect.js +7 -1
  6. package/dist/BoxSelectionGroup/components/Item/components/BoxStateIndicator/BoxStateIndicator.cjs +8 -4
  7. package/dist/BoxSelectionGroup/components/Item/components/BoxStateIndicator/BoxStateIndicator.js +8 -4
  8. package/dist/BoxSelectionGroup/components/Item/components/Compose/Compose.style.cjs +18 -4
  9. package/dist/BoxSelectionGroup/components/Item/components/Compose/Compose.style.js +18 -4
  10. package/dist/BoxSelectionGroup/hooks/useBoxSelectionGroup.cjs +3 -1
  11. package/dist/BoxSelectionGroup/hooks/useBoxSelectionGroup.js +3 -1
  12. package/dist/Button/Button.style.cjs +4 -1
  13. package/dist/Button/Button.style.js +4 -1
  14. package/dist/Button/Button.style.utils.cjs +16 -1
  15. package/dist/Button/Button.style.utils.js +16 -1
  16. package/dist/Button/Button.types.cjs +1 -1
  17. package/dist/Button/Button.types.d.ts +1 -1
  18. package/dist/Button/Button.types.js +1 -1
  19. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.cjs +59 -0
  20. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.d.ts +4 -0
  21. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.js +57 -0
  22. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.style.cjs +40 -0
  23. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.style.d.ts +8 -0
  24. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.style.js +38 -0
  25. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.types.d.ts +5 -0
  26. package/dist/Button/TextButton/TextButton.style.cjs +4 -1
  27. package/dist/Button/TextButton/TextButton.style.js +4 -1
  28. package/dist/Button/TextButton/TextButton.types.cjs +1 -1
  29. package/dist/Button/TextButton/TextButton.types.d.ts +1 -1
  30. package/dist/Button/TextButton/TextButton.types.js +1 -1
  31. package/dist/Button/index.d.ts +2 -0
  32. package/dist/Checkbox/components/Label/Label.style.cjs +15 -3
  33. package/dist/Checkbox/components/Label/Label.style.js +15 -3
  34. package/dist/Chip/components/CloseButton/CloseButton.cjs +3 -1
  35. package/dist/Chip/components/CloseButton/CloseButton.js +3 -1
  36. package/dist/Chip/components/Compose/Compose.style.cjs +4 -1
  37. package/dist/Chip/components/Compose/Compose.style.js +4 -1
  38. package/dist/Drawer/components/Description/Description.cjs +3 -1
  39. package/dist/Drawer/components/Description/Description.js +3 -1
  40. package/dist/Helpers/contexts/Popper/PopperCollisionBoundaryManager.cjs +3 -1
  41. package/dist/Helpers/contexts/Popper/PopperCollisionBoundaryManager.js +3 -1
  42. package/dist/Helpers/contexts/PrimitiveContextState.cjs +28 -16
  43. package/dist/Helpers/contexts/PrimitiveContextState.js +28 -16
  44. package/dist/Helpers/contexts/SharedId.context.cjs +9 -5
  45. package/dist/Helpers/contexts/SharedId.context.js +9 -5
  46. package/dist/Helpers/css.utils.cjs +18 -4
  47. package/dist/Helpers/css.utils.d.ts +15 -3
  48. package/dist/Helpers/css.utils.js +18 -4
  49. package/dist/Helpers/hooks/useScrollable.cjs +3 -1
  50. package/dist/Helpers/hooks/useScrollable.js +3 -1
  51. package/dist/Helpers/react.utils.cjs +6 -2
  52. package/dist/Helpers/react.utils.js +6 -2
  53. package/dist/HighlightedIcon/HighlightedIcon.cjs +26 -0
  54. package/dist/HighlightedIcon/HighlightedIcon.d.ts +3 -0
  55. package/dist/HighlightedIcon/HighlightedIcon.js +26 -0
  56. package/dist/HighlightedIcon/HighlightedIcon.style.cjs +49 -0
  57. package/dist/HighlightedIcon/HighlightedIcon.style.d.ts +5 -0
  58. package/dist/HighlightedIcon/HighlightedIcon.style.js +47 -0
  59. package/dist/HighlightedIcon/HighlightedIcon.types.d.ts +8 -0
  60. package/dist/HighlightedIcon/index.d.ts +3 -0
  61. package/dist/Inputs/QuantityCounter/components/InputGroup/components/ValueLabel/ValueLabel.cjs +9 -5
  62. package/dist/Inputs/QuantityCounter/components/InputGroup/components/ValueLabel/ValueLabel.js +9 -5
  63. package/dist/Inputs/components/Compose/Compose.style.cjs +29 -6
  64. package/dist/Inputs/components/Compose/Compose.style.js +29 -6
  65. package/dist/Inputs/hooks/numericInput/numericInput.utils.cjs +12 -4
  66. package/dist/Inputs/hooks/numericInput/numericInput.utils.js +12 -4
  67. package/dist/Inputs/hooks/numericInput/useNumericInput.cjs +15 -3
  68. package/dist/Inputs/hooks/numericInput/useNumericInput.js +15 -3
  69. package/dist/Loader/Loader.cjs +1 -0
  70. package/dist/Loader/Loader.js +1 -0
  71. package/dist/Menu/components/Content/components/Item/Components/Compose/Compose.style.cjs +19 -4
  72. package/dist/Menu/components/Content/components/Item/Components/Compose/Compose.style.js +19 -4
  73. package/dist/Menu/components/Content/components/Label/components/Compose/Compose.style.cjs +4 -1
  74. package/dist/Menu/components/Content/components/Label/components/Compose/Compose.style.js +4 -1
  75. package/dist/Modal/components/Content/components/Compose/Compose.cjs +3 -1
  76. package/dist/Modal/components/Content/components/Compose/Compose.js +3 -1
  77. package/dist/Modal/components/Content/components/Description/Description.cjs +3 -1
  78. package/dist/Modal/components/Content/components/Description/Description.js +3 -1
  79. package/dist/MultiSelect/components/Compose/hooks/useMultiSelectContextApi.cjs +3 -1
  80. package/dist/MultiSelect/components/Compose/hooks/useMultiSelectContextApi.js +3 -1
  81. package/dist/MultiSelect/components/Trigger/components/MultiValue/MultiValue.cjs +3 -1
  82. package/dist/MultiSelect/components/Trigger/components/MultiValue/MultiValue.js +3 -1
  83. package/dist/Overflow/Overflow.cjs +3 -1
  84. package/dist/Overflow/Overflow.js +3 -1
  85. package/dist/Overflow/Overflow.utils.cjs +15 -6
  86. package/dist/Overflow/Overflow.utils.js +15 -6
  87. package/dist/Overflow/components/OverflowContainer/OverflowContainer.cjs +3 -1
  88. package/dist/Overflow/components/OverflowContainer/OverflowContainer.js +3 -1
  89. package/dist/Pagination/components/PageSizeSelect.cjs +3 -1
  90. package/dist/Pagination/components/PageSizeSelect.js +3 -1
  91. package/dist/Popover/components/Content/Content.cjs +3 -1
  92. package/dist/Popover/components/Content/Content.js +3 -1
  93. package/dist/Popover/components/Content/components/Footer/Footer.cjs +3 -1
  94. package/dist/Popover/components/Content/components/Footer/Footer.js +3 -1
  95. package/dist/RadioGroup/components/Item/components/Label/Label.style.cjs +15 -3
  96. package/dist/RadioGroup/components/Item/components/Label/Label.style.js +15 -3
  97. package/dist/ScreenReaderAnnounce/ScreenReaderAnnounce.cjs +3 -1
  98. package/dist/ScreenReaderAnnounce/ScreenReaderAnnounce.js +3 -1
  99. package/dist/Section/components/Header/components/CollapseButton/CollapseButton.cjs +3 -1
  100. package/dist/Section/components/Header/components/CollapseButton/CollapseButton.js +3 -1
  101. package/dist/Select/components/Content/components/Option/components/Compose/Compose.style.cjs +16 -4
  102. package/dist/Select/components/Content/components/Option/components/Compose/Compose.style.js +16 -4
  103. package/dist/Select/components/Content/components/OptionList/OptionList.cjs +6 -4
  104. package/dist/Select/components/Content/components/OptionList/OptionList.js +6 -4
  105. package/dist/Select/components/Content/components/OptionList/Virtual.cjs +9 -5
  106. package/dist/Select/components/Content/components/OptionList/Virtual.js +9 -5
  107. package/dist/Select/components/Context/hooks/useSearch.cjs +3 -1
  108. package/dist/Select/components/Context/hooks/useSearch.js +3 -1
  109. package/dist/Select/components/Trigger/components/Compose/Compose.style.cjs +33 -7
  110. package/dist/Select/components/Trigger/components/Compose/Compose.style.js +33 -7
  111. package/dist/SideBar/components/Item/Item.style.cjs +14 -3
  112. package/dist/SideBar/components/Item/Item.style.js +14 -3
  113. package/dist/Skeleton/components/Circle/Circle.cjs +1 -1
  114. package/dist/Skeleton/components/Circle/Circle.js +1 -1
  115. package/dist/Skeleton/components/Square/Square.cjs +1 -1
  116. package/dist/Skeleton/components/Square/Square.js +1 -1
  117. package/dist/Slider/components/Label/Compose/Compose.cjs +3 -1
  118. package/dist/Slider/components/Label/Compose/Compose.js +3 -1
  119. package/dist/Slider/components/Mark/Compose/Compose.cjs +3 -1
  120. package/dist/Slider/components/Mark/Compose/Compose.js +3 -1
  121. package/dist/Slider/hooks/useOffset.cjs +3 -1
  122. package/dist/Slider/hooks/useOffset.js +3 -1
  123. package/dist/Stepper/Stepper.cjs +14 -5
  124. package/dist/Stepper/Stepper.d.ts +2 -0
  125. package/dist/Stepper/Stepper.js +14 -5
  126. package/dist/Stepper/Stepper.utils.cjs +12 -0
  127. package/dist/Stepper/Stepper.utils.d.ts +2 -0
  128. package/dist/Stepper/Stepper.utils.js +12 -0
  129. package/dist/Stepper/components/Compose/Compose.d.ts +1 -0
  130. package/dist/Stepper/components/Step/Step.cjs +2 -0
  131. package/dist/Stepper/components/Step/Step.d.ts +1 -0
  132. package/dist/Stepper/components/Step/Step.js +2 -0
  133. package/dist/Stepper/components/Step/components/Compose/Compose.cjs +5 -10
  134. package/dist/Stepper/components/Step/components/Compose/Compose.js +5 -10
  135. package/dist/Stepper/components/Step/components/Separator/Separator.cjs +15 -0
  136. package/dist/Stepper/components/Step/components/Separator/Separator.d.ts +3 -0
  137. package/dist/Stepper/components/Step/components/Separator/Separator.js +15 -0
  138. package/dist/Stepper/components/Step/components/Separator/Separator.style.cjs +24 -0
  139. package/dist/Stepper/components/Step/components/Separator/Separator.style.d.ts +1 -0
  140. package/dist/Stepper/components/Step/components/Separator/Separator.style.js +22 -0
  141. package/dist/Stepper/components/Step/components/Separator/Separator.types.d.ts +5 -0
  142. package/dist/Stepper/hooks/useStepperInteractive.cjs +12 -4
  143. package/dist/Stepper/hooks/useStepperInteractive.js +12 -4
  144. package/dist/Switch/components/Switcher/Switcher.cjs +3 -1
  145. package/dist/Switch/components/Switcher/Switcher.js +3 -1
  146. package/dist/Switch/components/Switcher/Switcher.style.cjs +31 -8
  147. package/dist/Switch/components/Switcher/Switcher.style.js +31 -8
  148. package/dist/Tabs/components/TabBar/components/Trigger/components/Marker/Marker.style.cjs +24 -5
  149. package/dist/Tabs/components/TabBar/components/Trigger/components/Marker/Marker.style.js +24 -5
  150. package/dist/Tabs/components/TabBar/components/Trigger/components/Tab/Tab.style.cjs +24 -5
  151. package/dist/Tabs/components/TabBar/components/Trigger/components/Tab/Tab.style.js +24 -5
  152. package/dist/ThemeModeSwitch/useThemeModeSwitch.cjs +6 -2
  153. package/dist/ThemeModeSwitch/useThemeModeSwitch.js +6 -2
  154. package/dist/Toast/core/content.helper.cjs +8 -4
  155. package/dist/Toast/core/content.helper.js +8 -4
  156. package/dist/Tooltip/components/Content/Content.cjs +3 -1
  157. package/dist/Tooltip/components/Content/Content.js +3 -1
  158. package/dist/TreeView/TreeView.cjs +3 -1
  159. package/dist/TreeView/TreeView.js +3 -1
  160. package/dist/TreeView/components/TreeItem/components/Compose/Compose.cjs +6 -4
  161. package/dist/TreeView/components/TreeItem/components/Compose/Compose.js +6 -4
  162. package/dist/Typography/Typography.types.cjs +4 -0
  163. package/dist/Typography/Typography.types.d.ts +2 -1
  164. package/dist/Typography/Typography.types.js +4 -0
  165. package/dist/index.cjs +8 -0
  166. package/dist/index.d.ts +1 -0
  167. package/dist/index.js +98 -90
  168. package/package.json +10 -9
  169. package/skills/redis-ui-components/SKILL.md +126 -0
  170. package/skills/redis-ui-components/references/ActionIconButton.md +96 -0
  171. package/skills/redis-ui-components/references/AppBar.md +161 -0
  172. package/skills/redis-ui-components/references/AppSelectionMenu.md +184 -0
  173. package/skills/redis-ui-components/references/AutoCompleteSelect.md +193 -0
  174. package/skills/redis-ui-components/references/Badge.md +77 -0
  175. package/skills/redis-ui-components/references/Banner.md +563 -0
  176. package/skills/redis-ui-components/references/BoxSelectionGroup.md +487 -0
  177. package/skills/redis-ui-components/references/Breadcrumbs.md +214 -0
  178. package/skills/redis-ui-components/references/Button.md +169 -0
  179. package/skills/redis-ui-components/references/ButtonGroup.md +126 -0
  180. package/skills/redis-ui-components/references/Card.md +56 -0
  181. package/skills/redis-ui-components/references/Checkbox.md +171 -0
  182. package/skills/redis-ui-components/references/Chip.md +154 -0
  183. package/skills/redis-ui-components/references/ChipList.md +307 -0
  184. package/skills/redis-ui-components/references/CopyToClipboardButton.md +47 -0
  185. package/skills/redis-ui-components/references/CountryFlag.md +57 -0
  186. package/skills/redis-ui-components/references/Drawer.md +298 -0
  187. package/skills/redis-ui-components/references/Filters.md +162 -0
  188. package/skills/redis-ui-components/references/FlexDivider.md +152 -0
  189. package/skills/redis-ui-components/references/FlexGroup.md +149 -0
  190. package/skills/redis-ui-components/references/FlexItem.md +58 -0
  191. package/skills/redis-ui-components/references/FlexSplit.md +37 -0
  192. package/skills/redis-ui-components/references/FormField.md +678 -0
  193. package/skills/redis-ui-components/references/IconButton.md +63 -0
  194. package/skills/redis-ui-components/references/Input.md +295 -0
  195. package/skills/redis-ui-components/references/KeyValueList.md +501 -0
  196. package/skills/redis-ui-components/references/Label.md +238 -0
  197. package/skills/redis-ui-components/references/Link.md +402 -0
  198. package/skills/redis-ui-components/references/Loader.md +100 -0
  199. package/skills/redis-ui-components/references/Menu.md +988 -0
  200. package/skills/redis-ui-components/references/MidBar.md +358 -0
  201. package/skills/redis-ui-components/references/Modal.md +525 -0
  202. package/skills/redis-ui-components/references/MoreInfoIcon.md +119 -0
  203. package/skills/redis-ui-components/references/MultiSelect.md +558 -0
  204. package/skills/redis-ui-components/references/NumericInput.md +322 -0
  205. package/skills/redis-ui-components/references/Overflow.md +127 -0
  206. package/skills/redis-ui-components/references/Pagination.md +151 -0
  207. package/skills/redis-ui-components/references/PasswordInput.md +262 -0
  208. package/skills/redis-ui-components/references/Popover.md +868 -0
  209. package/skills/redis-ui-components/references/ProfileIcon.md +65 -0
  210. package/skills/redis-ui-components/references/ProgressBar.md +103 -0
  211. package/skills/redis-ui-components/references/QuantityCounter.md +555 -0
  212. package/skills/redis-ui-components/references/RadioGroup.md +265 -0
  213. package/skills/redis-ui-components/references/ScreenReaderAnnounce.md +147 -0
  214. package/skills/redis-ui-components/references/SearchBar.md +242 -0
  215. package/skills/redis-ui-components/references/SearchInput.md +213 -0
  216. package/skills/redis-ui-components/references/Section.md +349 -0
  217. package/skills/redis-ui-components/references/Select.md +517 -0
  218. package/skills/redis-ui-components/references/SideBar.md +468 -0
  219. package/skills/redis-ui-components/references/Slider.md +398 -0
  220. package/skills/redis-ui-components/references/Stepper.md +288 -0
  221. package/skills/redis-ui-components/references/Switch.md +193 -0
  222. package/skills/redis-ui-components/references/Tabs.md +383 -0
  223. package/skills/redis-ui-components/references/TextArea.md +139 -0
  224. package/skills/redis-ui-components/references/TextButton.md +217 -0
  225. package/skills/redis-ui-components/references/Toast.md +399 -0
  226. package/skills/redis-ui-components/references/ToggleButton.md +163 -0
  227. package/skills/redis-ui-components/references/Tooltip.md +636 -0
  228. package/skills/redis-ui-components/references/Typography.md +323 -0
@@ -0,0 +1,399 @@
1
+ # Toast
2
+
3
+ Imperative notification API with a companion `Toaster` container and a compound `Toast` component for fully custom layouts. It supports semantic variants, custom icons, auto-closing actions, and multiple containers.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { Toast, Toaster, toast } from '@redislabsdev/redis-ui-components';
9
+ ```
10
+
11
+ > The icon examples use:
12
+ > ```tsx
13
+ > import { ShardIcon } from '@redislabsdev/redis-ui-icons';
14
+ > ```
15
+
16
+ ## Props
17
+
18
+ | Prop | Type | Default | Description |
19
+ |------|------|---------|-------------|
20
+ | message | `ReactNode` | - | Main toast message content. |
21
+ | description | `ReactNode` | - | Supporting text rendered under the message. |
22
+ | actions | `{ primary?: ToastActionType; secondary?: ToastActionType }` | - | Primary and secondary action button configs. |
23
+ | customIcon | `IconType` | - | Overrides the default semantic icon. |
24
+ | showIcon | `boolean` | `true` | Shows or hides the leading icon. |
25
+ | showCloseButton | `boolean` | `true` | Shows or hides the close button. |
26
+ | compose wrapper props | `ChildFree<ComposeElementProps>` | - | Additional container props forwarded to the composed toast root. |
27
+
28
+ The root `Toast` component also accepts the same content props as `toast(...)` and forwards them to `Toast.Compose`.
29
+
30
+ ## Sub-components
31
+
32
+ - `Toast.Compose` - Semantic container for fully custom toast layouts.
33
+ - `Toast.Icon` - Variant-aware icon slot for composed toasts.
34
+ - `Toast.Message` - Message wrapper used when composing a toast body.
35
+ - `Toast.Description` - Description wrapper used when composing a toast body.
36
+ - `Toast.Content` - Default content block that renders the message and description slots.
37
+ - `Toast.Content.Compose` - Low-level content container for custom body layouts.
38
+ - `Toast.Content.Message` - Low-level message slot used inside content compositions.
39
+ - `Toast.Content.Description` - Low-level description slot used inside content compositions.
40
+ - `Toast.Actions` - Default action block that renders primary and secondary actions.
41
+ - `Toast.Actions.Compose` - Low-level action container for custom action layouts.
42
+ - `Toast.Actions.Action` - Action button primitive used in custom action layouts.
43
+ - `Toast.CloseButton` - Close button primitive that dismisses the toast.
44
+
45
+ ### Toast.Compose Props
46
+
47
+ | Prop | Type | Default | Description |
48
+ |------|------|---------|-------------|
49
+ | variant | `ToastVariant` | current toast variant | Semantic variant inherited from the toast context. |
50
+ | size | `SemanticContainerSize` | `M` | Toast container size. |
51
+ | compose wrapper props | `ComposeElementProps` | - | Additional props forwarded to the toast compose container. |
52
+
53
+ ### Toast.Icon Props
54
+
55
+ | Prop | Type | Default | Description |
56
+ |------|------|---------|-------------|
57
+ | icon | `IconType` | - | Optional custom icon component. |
58
+ | icon props | `MonochromeIconProps` | `size="M"` | Additional monochrome icon props, such as custom color and size. |
59
+
60
+ ### Toast.Message Props
61
+
62
+ | Prop | Type | Default | Description |
63
+ |------|------|---------|-------------|
64
+ | body props | `TypographyBodyProps` | - | Typography body props forwarded to the message slot. |
65
+
66
+ ### Toast.Description Props
67
+
68
+ | Prop | Type | Default | Description |
69
+ |------|------|---------|-------------|
70
+ | body props | `TypographyBodyProps` | - | Typography body props forwarded to the description slot. |
71
+
72
+ ### Toast.Content Props
73
+
74
+ | Prop | Type | Default | Description |
75
+ |------|------|---------|-------------|
76
+ | message | `ReactNode` | - | Message content shown in the toast body. |
77
+ | description | `ReactNode` | - | Supporting text shown under the message. |
78
+ | compose wrapper props | `ChildFree<ComposeElementProps>` | - | Additional props forwarded to the content container. |
79
+
80
+ `Toast.Content` also exposes `Compose`, `Message`, and `Description` for custom body layouts.
81
+
82
+ ### Toast.Actions Props
83
+
84
+ | Prop | Type | Default | Description |
85
+ |------|------|---------|-------------|
86
+ | primary | `ToastActionType` | - | Primary action button configuration. |
87
+ | secondary | `ToastActionType` | - | Secondary action button configuration. |
88
+ | compose wrapper props | `ChildFree<ComposeElementProps>` | - | Additional props forwarded to the actions container. |
89
+
90
+ `Toast.Actions` also exposes `Compose` and `Action` for custom action layouts.
91
+
92
+ ### Toast.Actions.Action Props
93
+
94
+ | Prop | Type | Default | Description |
95
+ |------|------|---------|-------------|
96
+ | label | `string` | required | Action label. |
97
+ | onClick | `VoidFunction` | required | Action handler. |
98
+ | icon | `IconType` | - | Optional leading icon. |
99
+ | closes | `boolean` | `false` | Closes the toast after the handler runs. |
100
+ | variant | `SemanticOutlineVariant` | - | Outline variant used by the underlying semantic button. |
101
+ | disabled | `boolean` | `false` | Disables the action button. |
102
+ | button props | `RestSemanticButtonProps` | - | Additional native button props. |
103
+
104
+ ### Toast.CloseButton Props
105
+
106
+ | Prop | Type | Default | Description |
107
+ |------|------|---------|-------------|
108
+ | size | `SemanticSize` | - | Close button size. |
109
+ | variant | `SemanticVariant` | - | Semantic variant used for styling. |
110
+ | button props | `RestSemanticCloseButtonProps` | - | Additional native button props. |
111
+
112
+ `Toast.CloseButton` falls back to the default `CancelIcon` when no children are provided.
113
+
114
+ ## Examples
115
+
116
+ ### BasicToast
117
+
118
+ ```tsx
119
+ import { toast } from '@redislabsdev/redis-ui-components';
120
+
121
+ toast('Basic simple toast');
122
+ ```
123
+
124
+ ### Playground
125
+
126
+ ```tsx
127
+ import { toast, ToastContentParams, ToastOptions } from '@redislabsdev/redis-ui-components';
128
+ import { unflatten } from '../../helpers/unflatten';
129
+
130
+ function launchToast(args: Record<string, unknown>) {
131
+ const { message, description, actions, customIcon, showIcon, showCloseButton, ...rest } =
132
+ unflatten(args) as ToastContentParams & ToastOptions;
133
+
134
+ rest.autoClose = rest.autoClose !== false && rest['autoClose (delay)'];
135
+
136
+ toast({ message, description, actions, customIcon, showIcon, showCloseButton }, rest);
137
+ }
138
+ ```
139
+
140
+ ### SemanticToasts
141
+
142
+ > We support a few different semantic variants of toasts.
143
+
144
+ ```tsx
145
+ import { toast, ToastVariant } from '@redislabsdev/redis-ui-components';
146
+
147
+ const semanticVariants: Exclude<ToastVariant, 'informative'>[] = [
148
+ 'danger',
149
+ 'attention',
150
+ 'notice',
151
+ 'success'
152
+ ];
153
+
154
+ semanticVariants.forEach((variant) => {
155
+ toast[variant]({
156
+ message: (
157
+ <>
158
+ This is <strong>{variant}</strong> toast
159
+ </>
160
+ )
161
+ });
162
+ });
163
+ ```
164
+
165
+ ### ToastUpdate
166
+
167
+ > If you need to apply new content to an existing toast or change some options, call `toast.update` with the toast id and new parameters. Changed values will be applied over previous values. You cannot reset a value without setting the new one.
168
+
169
+ ```tsx
170
+ import { toast } from '@redislabsdev/redis-ui-components';
171
+
172
+ const toastId = toast('Default toast');
173
+
174
+ toast.update(toastId, 'Updated toast, same variant', { role: 'status' });
175
+ toast.update(toastId, 'Updated toast, variant is Danger', {
176
+ variant: toast.Variant.Danger
177
+ });
178
+ ```
179
+
180
+ ### MessageAndDescription
181
+
182
+ ```tsx
183
+ import { toast } from '@redislabsdev/redis-ui-components';
184
+
185
+ toast.notice({
186
+ message: 'This is toast message',
187
+ description: 'with description'
188
+ });
189
+ ```
190
+
191
+ ### MessageOnly
192
+
193
+ ```tsx
194
+ import { toast } from '@redislabsdev/redis-ui-components';
195
+
196
+ toast.notice({
197
+ message: 'This toast has only message'
198
+ });
199
+ ```
200
+
201
+ ### DescriptionOnly
202
+
203
+ ```tsx
204
+ import { toast } from '@redislabsdev/redis-ui-components';
205
+
206
+ toast.notice({
207
+ description: 'This toast has only description'
208
+ });
209
+ ```
210
+
211
+ ### ContentFormatting
212
+
213
+ > Content parts can contain any JSX elements.
214
+
215
+ ```tsx
216
+ import { toast } from '@redislabsdev/redis-ui-components';
217
+
218
+ toast.notice({
219
+ message: (
220
+ <>
221
+ This is toast with <i>formatted</i> <strong>content</strong>
222
+ </>
223
+ ),
224
+ description: (
225
+ <>
226
+ It supports single line or paragraph content with{' '}
227
+ <u style={{ color: 'green' }}>custom styling</u>
228
+ </>
229
+ )
230
+ });
231
+ ```
232
+
233
+ ### Actions
234
+
235
+ > Each Toast can contain two independent action buttons: primary and secondary. Each of them can be added to the toast or omitted.
236
+
237
+ ```tsx
238
+ import { toast } from '@redislabsdev/redis-ui-components';
239
+
240
+ const onClick = () => {};
241
+
242
+ toast.notice({
243
+ message: 'Toast with actions',
244
+ actions: {
245
+ primary: { label: 'Action 1', onClick },
246
+ secondary: { label: 'Action 2', onClick }
247
+ }
248
+ });
249
+ ```
250
+
251
+ ### AutoClosingActions
252
+
253
+ > Each Toast Action allows you to close the toast automatically after performing the action. Use the `closes` flag to enable it.
254
+
255
+ ```tsx
256
+ import { toast } from '@redislabsdev/redis-ui-components';
257
+
258
+ const onClick = () => {};
259
+
260
+ toast.notice({
261
+ message: 'Toast with actions',
262
+ actions: {
263
+ primary: { label: 'Closing', onClick, closes: true },
264
+ secondary: { label: 'Non-closing', onClick, closes: false }
265
+ }
266
+ });
267
+ ```
268
+
269
+ ### CustomIcon
270
+
271
+ > Toast can have a custom icon. Use the `customIcon` property to specify it.
272
+
273
+ ```tsx
274
+ import { toast } from '@redislabsdev/redis-ui-components';
275
+ import { ShardIcon } from '@redislabsdev/redis-ui-icons';
276
+
277
+ toast.danger({ message: 'Toast with custom icon', customIcon: ShardIcon });
278
+ ```
279
+
280
+ ### InvisibleIcon
281
+
282
+ > Icon of the toast can be hidden. Use `showIcon = false` to hide it.
283
+
284
+ ```tsx
285
+ import { toast } from '@redislabsdev/redis-ui-components';
286
+
287
+ toast.success({ message: 'Toast without icon', showIcon: false });
288
+ ```
289
+
290
+ ### CloseButton
291
+
292
+ > Close button of the toast can be hidden. Use `showCloseButton = false` to hide it.
293
+
294
+ ```tsx
295
+ import { toast } from '@redislabsdev/redis-ui-components';
296
+
297
+ toast.notice({ message: 'Toast without close button', showCloseButton: false });
298
+ ```
299
+
300
+ ### ComponentContent
301
+
302
+ > Toast can be specified as a React element. Note that the React element must implement the entire toast, not just its content. The `Toast` component is designed to simplify that.
303
+
304
+ ```tsx
305
+ import { Toast, toast } from '@redislabsdev/redis-ui-components';
306
+
307
+ toast.success(
308
+ <Toast
309
+ message="React component toast"
310
+ description="This toast is built using <Toast/> component instance"
311
+ />
312
+ );
313
+ ```
314
+
315
+ ### CompositionContent
316
+
317
+ > Toast component can be composed using the `Toast.Compose` element. Pass the composed element as the content parameter.
318
+
319
+ ```tsx
320
+ import { Toast, toast } from '@redislabsdev/redis-ui-components';
321
+ import { ShardIcon } from '@redislabsdev/redis-ui-icons';
322
+
323
+ toast(
324
+ <Toast.Compose style={{ backgroundColor: '#80ecf0a8', borderColor: '#a6d7d9', color: '#0a585b' }}>
325
+ <Toast.Icon icon={ShardIcon} customColor="#00999f" />
326
+ <Toast.Message>
327
+ This toast composed using custom icon and message with overridden style
328
+ </Toast.Message>
329
+ </Toast.Compose>
330
+ );
331
+ ```
332
+
333
+ ### HiddenToaster
334
+
335
+ ```tsx
336
+ import { Toaster } from '@redislabsdev/redis-ui-components';
337
+
338
+ <Toaster autoClose={10000} position="top-center" className="sb-unstyled" />
339
+ ```
340
+
341
+ ### MultipleContainers
342
+
343
+ > Multiple toast containers can be used simultaneously by providing a unique `containerId` to each `Toaster`. Toasts can be directed to specific containers by passing the same `containerId` in toast options.
344
+ >
345
+ > In react-toastify v10, the `enableMultiContainer` prop is no longer needed. Multi-container support works automatically when `containerId` is provided.
346
+
347
+ ```tsx
348
+ import { Button, toast, Toaster } from '@redislabsdev/redis-ui-components';
349
+
350
+ <div style={{ minHeight: '300px' }}>
351
+ <Toaster containerId="notifications" position="top-right" autoClose={5000} className="sb-unstyled" />
352
+ <Toaster containerId="alerts" position="bottom-left" autoClose={false} className="sb-unstyled" />
353
+
354
+ <Button
355
+ onClick={() =>
356
+ toast.success({ message: 'Operation completed successfully!' }, { containerId: 'notifications' })
357
+ }
358
+ >
359
+ Success (top-right)
360
+ </Button>
361
+ <Button
362
+ onClick={() =>
363
+ toast.notice({ message: 'Here is some information' }, { containerId: 'notifications' })
364
+ }
365
+ >
366
+ Info (top-right)
367
+ </Button>
368
+ <Button
369
+ onClick={() =>
370
+ toast.danger(
371
+ { message: 'An error occurred', description: 'Please check your input and try again' },
372
+ { containerId: 'alerts' }
373
+ )
374
+ }
375
+ >
376
+ Error (bottom-left)
377
+ </Button>
378
+ <Button
379
+ onClick={() =>
380
+ toast.attention(
381
+ { message: 'Warning', description: 'This action cannot be undone' },
382
+ { containerId: 'alerts' }
383
+ )
384
+ }
385
+ >
386
+ Warning (bottom-left)
387
+ </Button>
388
+ </div>
389
+ ```
390
+
391
+ ## Notes
392
+
393
+ - Mount `Toaster` once per app, and use `containerId` when you need multiple containers.
394
+ - `toast` exposes semantic helper methods and enums, including `notice`, `attention`, `danger`, `success`, `Variant`, and `Position`.
395
+ - `toast.update` applies new values over the existing toast state; it does not reset fields back to defaults.
396
+ - `showIcon` and `showCloseButton` only hide the toast chrome; the toast content still renders.
397
+ - `Toast.Compose` is the escape hatch for fully custom toast layouts.
398
+ - `Toast.Message` and `Toast.Description` can render any JSX, not just strings.
399
+ - `Toast.Actions.Action` can auto-close the toast when `closes` is set to `true`.
@@ -0,0 +1,163 @@
1
+ # ToggleButton
2
+
3
+ A button with two stable states: regular and pressed. It supports both controlled and uncontrolled usage, can show a count indicator, and can render icons inside the button content.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { ToggleButton } from '@redislabsdev/redis-ui-components';
9
+ ```
10
+
11
+ ## Props
12
+
13
+ | Prop | Type | Default | Description |
14
+ |------|------|---------|-------------|
15
+ | `pressed` | `boolean` | - | Controlled pressed state |
16
+ | `defaultPressed` | `boolean` | - | Initial pressed state for uncontrolled usage |
17
+ | `onPressedChange` | `(pressed: boolean) => void` | - | Called when the pressed state changes |
18
+ | `onClick` | `(pressed: boolean) => void` | - | Deprecated alias for `onPressedChange` |
19
+ | `children` | `React.ReactNode` | - | Button content |
20
+ | `disabled` | `boolean` | `false` | Whether the button is disabled |
21
+
22
+ The component also extends all native `ButtonHTMLAttributes<HTMLButtonElement>` props, except `onClick` which is re-typed to receive the pressed state.
23
+
24
+ ## Sub-components
25
+
26
+ - `ToggleButton.IndicatorCount` - Renders a numeric badge inside the toggle button and clamps values above 999 to `999+`.
27
+
28
+ ### ToggleButton.IndicatorCount Props
29
+
30
+ | Prop | Type | Default | Description |
31
+ |------|------|---------|-------------|
32
+ | `count` | `number` | *required* | Count value to display |
33
+
34
+ The component also extends all `Typography.Body` props except `children`.
35
+
36
+ ## Examples
37
+
38
+ ### Playground
39
+
40
+ ```tsx
41
+ import { ToggleButton } from '@redislabsdev/redis-ui-components';
42
+
43
+ <ToggleButton disabled={false}>Toggle Button</ToggleButton>
44
+ ```
45
+
46
+ ### DefaultPressed
47
+
48
+ > Pressed state can be initially set by using `defaultPressed` prop.
49
+
50
+ ```tsx
51
+ import { ToggleButton } from '@redislabsdev/redis-ui-components';
52
+
53
+ <ToggleButton defaultPressed>Initially pressed</ToggleButton>
54
+ ```
55
+
56
+ ### Controlled
57
+
58
+ > Toggle button state can be controlled.
59
+ > Use `pressed` and `onPressedChange` props to control it.
60
+
61
+ ```tsx
62
+ import { useState } from 'react';
63
+ import { Button, ToggleButton } from '@redislabsdev/redis-ui-components';
64
+
65
+ const [pressed, setPressed] = useState(false);
66
+
67
+ <>
68
+ <Button onClick={() => setPressed(false)}>Set `pressed=false`</Button>
69
+ <Button onClick={() => setPressed(true)}>Set `pressed=true`</Button>
70
+ <ToggleButton pressed={pressed} onPressedChange={setPressed}>
71
+ Controlled Toggle Button
72
+ </ToggleButton>
73
+ </>
74
+ ```
75
+
76
+ ### Disabled
77
+
78
+ > Buttons can be disabled by setting the `disabled` prop to `true`.
79
+ > This will disable any hover styles and prevent click events from firing.
80
+
81
+ ```tsx
82
+ import { ToggleButton } from '@redislabsdev/redis-ui-components';
83
+
84
+ <>
85
+ <ToggleButton disabled>Disabled</ToggleButton>
86
+ <ToggleButton disabled defaultPressed>
87
+ Pressed - Disabled
88
+ </ToggleButton>
89
+ </>
90
+ ```
91
+
92
+ ### WithCountIndicator
93
+
94
+ > To add count indicator to a ToggleButton, use the `ToggleButton.IndicatorCount` component.
95
+ > This component can be placed anywhere inside the `ToggleButton` component.
96
+
97
+ ```tsx
98
+ import { ToggleButton } from '@redislabsdev/redis-ui-components';
99
+
100
+ <>
101
+ <ToggleButton>
102
+ Button
103
+ <ToggleButton.IndicatorCount count={1} />
104
+ </ToggleButton>
105
+ <ToggleButton>
106
+ <ToggleButton.IndicatorCount count={10} />
107
+ Button
108
+ </ToggleButton>
109
+ <ToggleButton>
110
+ Button
111
+ <ToggleButton.IndicatorCount count={100} />
112
+ </ToggleButton>
113
+ <ToggleButton>
114
+ Button
115
+ <ToggleButton.IndicatorCount count={1000} />
116
+ </ToggleButton>
117
+ </>
118
+ ```
119
+
120
+ ### WithIcon
121
+
122
+ > To add an icon to a ToggleButton, use the `Button.Icon` component.
123
+ > This component can be placed anywhere inside the `ToggleButton` component.
124
+ > It will automatically be sized and colored to match its parent ToggleButton.
125
+ >
126
+ > Do not use this component if you need a round icon-only Button. Instead,
127
+ > use the IconButton or ActionIconButton components.
128
+ >
129
+ > If you need to pass props to the icon element you should declare it as a separate component.
130
+ >
131
+ > Do not declare components inside other components (like an inline arrow function or any other way),
132
+ > or at least wrap them in `useMemo`,
133
+ > otherwise it will cause re-render of the element on every render of the parent component.
134
+
135
+ ```tsx
136
+ import { ToggleButton, Button } from '@redislabsdev/redis-ui-components';
137
+ import { ChevronDownIcon, ContractIcon, MarketplaceIcon } from '@redislabsdev/redis-ui-icons';
138
+
139
+ <>
140
+ <ToggleButton>
141
+ <Button.Icon icon={ContractIcon} />
142
+ Left Icon
143
+ </ToggleButton>
144
+ <ToggleButton>
145
+ Right Icon
146
+ <Button.Icon icon={MarketplaceIcon} />
147
+ </ToggleButton>
148
+ <ToggleButton>
149
+ Icon & Indicator
150
+ <ToggleButton.IndicatorCount count={1} />
151
+ <Button.Icon customSize="1rem" icon={ChevronDownIcon} />
152
+ </ToggleButton>
153
+ </>
154
+ ```
155
+
156
+ ## Notes
157
+
158
+ - `ToggleButton` supports both uncontrolled mode with `defaultPressed` and controlled mode with `pressed` plus `onPressedChange`.
159
+ - `onClick` is deprecated; use `onPressedChange` instead.
160
+ - `ToggleButton.IndicatorCount` can be placed anywhere inside the toggle button.
161
+ - Values above `999` render as `999+`.
162
+ - For icon-only round buttons, use `IconButton` or `ActionIconButton` instead of `Button.Icon`.
163
+ - The component forwards refs to the underlying `<button>` element.