@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,63 @@
1
+ # IconButton
2
+
3
+ A button with only an icon and no text. Use `ActionIconButton` instead if you need an icon button with background color.
4
+
5
+ ## Import
6
+ ```tsx
7
+ import { IconButton } from '@redislabsdev/redis-ui-components';
8
+ ```
9
+
10
+ > If the component uses icons in examples, also note:
11
+ > ```tsx
12
+ > import { ActiveActiveIcon } from '@redislabsdev/redis-ui-icons';
13
+ > ```
14
+
15
+ ## Props
16
+ | Prop | Type | Default | Description |
17
+ |------|------|---------|-------------|
18
+ | icon | `IconType` | *required* | The icon component to render inside the button |
19
+ | title | `string` | - | Title attribute for the icon container |
20
+ | size | `'XXL' \| 'XL' \| 'L' \| 'M' \| 'S' \| 'XS'` | `'M'` | The size of the icon button |
21
+ | disabled | `boolean` | `false` | Whether the button is disabled |
22
+
23
+ The component also extends all native `ButtonHTMLAttributes<HTMLButtonElement>` props.
24
+
25
+ ## Examples
26
+
27
+ ### Playground
28
+ ```tsx
29
+ import { IconButton } from '@redislabsdev/redis-ui-components';
30
+ import { ActiveActiveIcon } from '@redislabsdev/redis-ui-icons';
31
+
32
+ <IconButton size="XL" disabled={false} icon={ActiveActiveIcon} />;
33
+ ```
34
+
35
+ ### Sizes
36
+ > 6 sizes are supported with `M` being the default.
37
+ ```tsx
38
+ import { IconButton } from '@redislabsdev/redis-ui-components';
39
+ import { ActiveActiveIcon } from '@redislabsdev/redis-ui-icons';
40
+
41
+ <>
42
+ <IconButton size="XS" icon={ActiveActiveIcon} />
43
+ <IconButton size="S" icon={ActiveActiveIcon} />
44
+ <IconButton size="M" icon={ActiveActiveIcon} />
45
+ <IconButton size="L" icon={ActiveActiveIcon} />
46
+ <IconButton size="XL" icon={ActiveActiveIcon} />
47
+ <IconButton size="XXL" icon={ActiveActiveIcon} />
48
+ </>
49
+ ```
50
+
51
+ ### Disabled
52
+ > IconButton can be disabled by setting the `disabled` prop to `true`. This will disable any hover styles and prevent click events from firing.
53
+ ```tsx
54
+ import { IconButton } from '@redislabsdev/redis-ui-components';
55
+ import { ActiveActiveIcon } from '@redislabsdev/redis-ui-icons';
56
+
57
+ <IconButton icon={ActiveActiveIcon} size="XL" disabled />;
58
+ ```
59
+
60
+ ## Notes
61
+ - `M` is the default size.
62
+ - The button renders with `type="button"` by default.
63
+ - The component forwards refs to the underlying `<button>` element.
@@ -0,0 +1,295 @@
1
+ # Input
2
+
3
+ A text input component with validation states, loading and reset affordances, auto-sizing support, and full compose/read-only customization. Use `FormField` when you need labels or other external decoration around the input.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { Input, FormField } from '@redislabsdev/redis-ui-components';
9
+ ```
10
+
11
+ > Some examples also use icons from `@redislabsdev/redis-ui-icons/multicolor`:
12
+ > ```tsx
13
+ > import {
14
+ > AmericanExpressIcon,
15
+ > DinersIcon,
16
+ > GeniricIcon,
17
+ > JcbIcon,
18
+ > MasterCardIcon,
19
+ > PayPalIcon,
20
+ > UnionPayIcon,
21
+ > VisaIcon
22
+ > } from '@redislabsdev/redis-ui-icons/multicolor';
23
+ > ```
24
+
25
+ ## Props
26
+
27
+ | Prop | Type | Default | Description |
28
+ |------|------|---------|-------------|
29
+ | id | `string` | - | Shared id for the compose wrapper and the inner input. |
30
+ | variant | `'outline' \| 'underline'` | `'outline'` | Visual style for the input wrapper. |
31
+ | error | `ReactElement \| string` | - | Error content. Enables error state and tooltip content. |
32
+ | valid | `boolean` | - | Enables the success state. |
33
+ | readOnly | `boolean` | - | Switches the input into read-only mode. |
34
+ | value | `string` | - | Controlled input value. |
35
+ | defaultValue | `string` | - | Uncontrolled initial value. |
36
+ | onChange | `(value: string) => void` | - | Called when the parsed value changes. |
37
+ | parser | `(value: string, extra: { event?: ChangeEvent }) => string` | - | Normalizes user input before it is stored or emitted. |
38
+ | formatter | `(value: string, extra: { event?: ChangeEvent }) => string` | - | Formats the stored value before display. |
39
+ | readonlyRender | `ReadOnlyRenderComponent` | `DefaultReadonlyRender` | Custom renderer used when `readOnly` is enabled. |
40
+ | readonlyProps | `HTMLAttributes<HTMLElement>` | - | Props passed to the read-only wrapper. |
41
+ | allowReset | `boolean` | `false` | Shows the reset button when a value is present. |
42
+ | loading | `boolean` | - | Shows the loading indicator. |
43
+ | autoSize | `boolean` | `false` | Makes the inner input size itself to the current value. |
44
+
45
+ The component also accepts standard `div` attributes on the compose wrapper and native `input` attributes on `Input.Tag`, excluding `children`, `defaultValue`, `value`, `onChange`, and `readOnly` from the inner input props.
46
+
47
+ ## Sub-components
48
+
49
+ - `Input.Compose` - Compose wrapper that manages value state, validation state, read-only rendering, and layout.
50
+ - `Input.Tag` - The underlying input element. Supports `autoSize`.
51
+ - `Input.ResetButton` - Clear/reset action button used when there is a value.
52
+ - `Input.StatusIndicator` - Error/success status indicator with tooltip support for errors.
53
+ - `Input.LoadingIndicator` - Inline loading spinner shown while `loading` is true.
54
+ - `Input.ReadonlyValue` - Styled read-only text renderer used by the compose wrapper.
55
+
56
+ ## Examples
57
+
58
+ ### Playground
59
+
60
+ ```tsx
61
+ <Input placeholder="Input" type="text" id="custom-id" disabled={false} />
62
+ ```
63
+
64
+ ### Status
65
+
66
+ > Adding `valid` enables the success state.
67
+ >
68
+ > Adding text to `error` enables the error state and shows the error message in the tooltip.
69
+ >
70
+ > Error state overrides valid state.
71
+
72
+ ```tsx
73
+ <>
74
+ Valid status
75
+ <Input placeholder="Text Input" valid />
76
+ Error status
77
+ <Input placeholder="Text Input" error="Error message" />
78
+ </>
79
+ ```
80
+
81
+ ### Loading
82
+
83
+ > Adding `loading` enables the loading indicator.
84
+ >
85
+ > It can be used together with other indicators and states.
86
+
87
+ ```tsx
88
+ <>
89
+ Loading indicator
90
+ <Input placeholder="Text Input" loading />
91
+ With other elements
92
+ <Input placeholder="Text Input" defaultValue="value" valid allowReset loading />
93
+ </>
94
+ ```
95
+
96
+ ### ResetButton
97
+
98
+ > Input allows user to clean the value. Set `allowReset` prop to show Reset button.
99
+
100
+ ```tsx
101
+ <Input placeholder="Text Input" defaultValue="orange" allowReset />
102
+ ```
103
+
104
+ ### DisabledAndReadonly
105
+
106
+ > Adding `disabled` or `readOnly` switches the component to the corresponding state.
107
+ >
108
+ > In read-only mode only the value is visible. Other indicators are ignored.
109
+ >
110
+ > `readOnly` overrides `disabled`.
111
+
112
+ ```tsx
113
+ <>
114
+ Disabled
115
+ <Input disabled placeholder="Type text" />
116
+ Disabled with value
117
+ <Input disabled defaultValue="orange" />
118
+ Disabled with indicators
119
+ <Input disabled defaultValue="banana" error="Error message" allowReset />
120
+ Read only
121
+ <Input value="read-only input value" readOnly />
122
+ </>
123
+ ```
124
+
125
+ ### WithLabel
126
+
127
+ > Component does not have its own label or other external decoration elements.
128
+ >
129
+ > Use `FormField` for those cases. If a custom id is specified, `FormField` inherits it;
130
+ > otherwise the label is connected automatically via a generated id.
131
+ >
132
+ > Custom ids must start with a letter to work correctly.
133
+ >
134
+ > `FormField` also inherits status and some states from the input.
135
+
136
+ ```tsx
137
+ import { FormField, Input } from '@redislabsdev/redis-ui-components';
138
+
139
+ <>
140
+ <FormField label="FormField Label with custom id">
141
+ <Input placeholder="Text Input" id="custom-id" />
142
+ </FormField>
143
+ <FormField
144
+ label="FormField Label with auto-generated id"
145
+ additionalText="FormField additional text"
146
+ >
147
+ <Input placeholder="Text Input" />
148
+ </FormField>
149
+ <FormField
150
+ label="FormField Label with read-only mode"
151
+ additionalText="FormField additional text"
152
+ >
153
+ <Input value="read-only input value" readOnly />
154
+ </FormField>
155
+ </>
156
+ ```
157
+
158
+ ### Variants
159
+
160
+ ```tsx
161
+ <>
162
+ <FormField label="Outline (default)" additionalText="outline">
163
+ <Input placeholder="Text Input" />
164
+ </FormField>
165
+ <FormField label="Underline" additionalText="underline">
166
+ <Input placeholder="Text Input" variant="underline" />
167
+ </FormField>
168
+ </>
169
+ ```
170
+
171
+ ### AutoSize
172
+
173
+ > Regular text input ignores `width: auto`.
174
+ >
175
+ > Add `autoSize` to make the input grow with its content.
176
+
177
+ ```tsx
178
+ <>
179
+ Type text in the input boxes to see how it auto-sizes
180
+ <Input autoSize placeholder="placeholder" />
181
+ Input without placeholder:
182
+ <Input autoSize defaultValue="edit value" />
183
+ </>
184
+ ```
185
+
186
+ ### ParserAndFormatter
187
+
188
+ > `parser` normalizes the user input before it is stored or emitted.
189
+ >
190
+ > `formatter` controls how the stored value is displayed.
191
+ >
192
+ > They can be used independently or together.
193
+
194
+ ```tsx
195
+ import { useState } from 'react';
196
+ import { Input } from '@redislabsdev/redis-ui-components';
197
+
198
+ const parser = (val: string) => val.match(/(\d+)/g)?.join('') || '';
199
+ const formatter = (val: string) =>
200
+ val.match(/(\d{1,4})/g)?.filter((_, i) => i < 4).join(' ') || '';
201
+
202
+ function Render() {
203
+ const [value, setValue] = useState('1234567898765432');
204
+
205
+ return (
206
+ <>
207
+ Uncontrolled mode
208
+ <Input parser={parser} formatter={formatter} defaultValue="1234567898765432" />
209
+ Controlled mode
210
+ <Input
211
+ parser={parser}
212
+ formatter={formatter}
213
+ defaultValue="1234567898765432"
214
+ value={value}
215
+ onChange={setValue}
216
+ />
217
+ controlled state value: {value}
218
+ </>
219
+ );
220
+ }
221
+ ```
222
+
223
+ ### ComposeCreditCard
224
+
225
+ ```tsx
226
+ import { useState } from 'react';
227
+ import { Input } from '@redislabsdev/redis-ui-components';
228
+ import {
229
+ AmericanExpressIcon,
230
+ DinersIcon,
231
+ GeniricIcon,
232
+ JcbIcon,
233
+ MasterCardIcon,
234
+ PayPalIcon,
235
+ UnionPayIcon,
236
+ VisaIcon
237
+ } from '@redislabsdev/redis-ui-icons/multicolor';
238
+
239
+ const CCIcons = [
240
+ GeniricIcon,
241
+ AmericanExpressIcon,
242
+ DinersIcon,
243
+ MasterCardIcon,
244
+ JcbIcon,
245
+ PayPalIcon,
246
+ UnionPayIcon,
247
+ VisaIcon
248
+ ];
249
+
250
+ const getIconFromCardNumber = (value: string) => CCIcons[value.length % CCIcons.length];
251
+ const formatCardNumber = (value: string) => (value.match(/(\d{1,4})/g) || []).join(' ');
252
+
253
+ function Render() {
254
+ const [value, setValue] = useState('');
255
+ const Icon = getIconFromCardNumber(value);
256
+
257
+ return (
258
+ <Input.Compose
259
+ onChange={(val) => setValue(val.replaceAll(' ', '').substring(0, 16))}
260
+ value={formatCardNumber(value)}
261
+ >
262
+ <Input.Tag placeholder="Enter Card Number" />
263
+ <Icon customSize="32" />
264
+ </Input.Compose>
265
+ );
266
+ }
267
+ ```
268
+
269
+ ### ComposeReadOnly
270
+
271
+ > The story uses `useArgs` to toggle `readOnly` at runtime.
272
+
273
+ ```tsx
274
+ import { Button, Input } from '@redislabsdev/redis-ui-components';
275
+
276
+ <>
277
+ <Input.Compose {...args}>
278
+ <Input.Tag />
279
+ </Input.Compose>
280
+ <Button onClick={() => setArgs({ readOnly: !readOnly })} style={{ alignSelf: 'flex-start' }}>
281
+ Toggle Read-Only
282
+ </Button>
283
+ </>
284
+ ```
285
+
286
+ ## Notes
287
+
288
+ - `error` enables the error state and overrides `valid`.
289
+ - `loading` can be combined with validation and reset states.
290
+ - `allowReset` shows the reset button when the input has a value.
291
+ - `readOnly` overrides `disabled`, and read-only mode hides the indicator affordances.
292
+ - Use `FormField` when you need a label or other external decoration around the input.
293
+ - Custom ids passed through `FormField` must start with a letter.
294
+ - `autoSize` is required when you want the text input to grow with its contents.
295
+ - `parser` and `formatter` can be used independently or together for controlled and uncontrolled input flows.