@korsolutions/ui 0.0.53 → 0.0.55

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 (260) hide show
  1. package/babel.config.js +1 -11
  2. package/dist/module/components/alert/components/alert-body.js.map +1 -1
  3. package/dist/module/components/alert/components/alert-description.js.map +1 -1
  4. package/dist/module/components/alert/components/alert-icon.js.map +1 -1
  5. package/dist/module/components/alert/components/alert-root.js.map +1 -1
  6. package/dist/module/components/alert/components/alert-title.js.map +1 -1
  7. package/dist/module/components/alert/index.js.map +1 -1
  8. package/dist/module/components/alert/variants/default.js.map +1 -1
  9. package/dist/module/components/alert/variants/destructive.js.map +1 -1
  10. package/dist/module/components/alert/variants/index.js.map +1 -1
  11. package/dist/module/components/alert-dialog/async-alert-dialog.js.map +1 -1
  12. package/dist/module/components/alert-dialog/components/alert-dialog-action.js.map +1 -1
  13. package/dist/module/components/alert-dialog/components/alert-dialog-cancel.js.map +1 -1
  14. package/dist/module/components/alert-dialog/components/alert-dialog-content.js.map +1 -1
  15. package/dist/module/components/alert-dialog/components/alert-dialog-description.js.map +1 -1
  16. package/dist/module/components/alert-dialog/components/alert-dialog-footer.js.map +1 -1
  17. package/dist/module/components/alert-dialog/components/alert-dialog-overlay.js.map +1 -1
  18. package/dist/module/components/alert-dialog/components/alert-dialog-portal.js.map +1 -1
  19. package/dist/module/components/alert-dialog/components/alert-dialog-root.js.map +1 -1
  20. package/dist/module/components/alert-dialog/components/alert-dialog-title.js.map +1 -1
  21. package/dist/module/components/alert-dialog/components/alert-dialog-trigger.js.map +1 -1
  22. package/dist/module/components/alert-dialog/index.js.map +1 -1
  23. package/dist/module/components/alert-dialog/variants/default.js.map +1 -1
  24. package/dist/module/components/alert-dialog/variants/index.js.map +1 -1
  25. package/dist/module/components/avatar/components/avatar-fallback.js.map +1 -1
  26. package/dist/module/components/avatar/components/avatar-image.js.map +1 -1
  27. package/dist/module/components/avatar/components/avatar-root.js.map +1 -1
  28. package/dist/module/components/avatar/index.js.map +1 -1
  29. package/dist/module/components/avatar/variants/default.js.map +1 -1
  30. package/dist/module/components/avatar/variants/index.js.map +1 -1
  31. package/dist/module/components/badge/components/badge-label.js.map +1 -1
  32. package/dist/module/components/badge/components/badge-root.js.map +1 -1
  33. package/dist/module/components/badge/index.js.map +1 -1
  34. package/dist/module/components/badge/variants/default.js.map +1 -1
  35. package/dist/module/components/badge/variants/index.js.map +1 -1
  36. package/dist/module/components/badge/variants/secondary.js.map +1 -1
  37. package/dist/module/components/button/components/button-label.js.map +1 -1
  38. package/dist/module/components/button/components/button-root.js.map +1 -1
  39. package/dist/module/components/button/components/button-spinner.js.map +1 -1
  40. package/dist/module/components/button/index.js.map +1 -1
  41. package/dist/module/components/button/variants/default.js.map +1 -1
  42. package/dist/module/components/button/variants/index.js.map +1 -1
  43. package/dist/module/components/button/variants/secondary.js.map +1 -1
  44. package/dist/module/components/calendar/components/calendar-day.js.map +1 -1
  45. package/dist/module/components/calendar/components/calendar-header.js.map +1 -1
  46. package/dist/module/components/calendar/components/calendar-nav-button.js.map +1 -1
  47. package/dist/module/components/calendar/components/calendar-root.js.map +1 -1
  48. package/dist/module/components/calendar/components/calendar-title.js.map +1 -1
  49. package/dist/module/components/calendar/components/calendar-week-labels.js.map +1 -1
  50. package/dist/module/components/calendar/components/calendar-weeks.js.map +1 -1
  51. package/dist/module/components/calendar/index.js.map +1 -1
  52. package/dist/module/components/calendar/variants/default.js.map +1 -1
  53. package/dist/module/components/calendar/variants/index.js.map +1 -1
  54. package/dist/module/components/card/card-body.js.map +1 -1
  55. package/dist/module/components/card/card-footer.js.map +1 -1
  56. package/dist/module/components/card/card-header.js.map +1 -1
  57. package/dist/module/components/card/card-root.js.map +1 -1
  58. package/dist/module/components/card/card-title.js.map +1 -1
  59. package/dist/module/components/card/index.js.map +1 -1
  60. package/dist/module/components/card/variants/default.js.map +1 -1
  61. package/dist/module/components/card/variants/index.js.map +1 -1
  62. package/dist/module/components/checkbox/components/checkbox-content.js.map +1 -1
  63. package/dist/module/components/checkbox/components/checkbox-description.js.map +1 -1
  64. package/dist/module/components/checkbox/components/checkbox-indicator.js.map +1 -1
  65. package/dist/module/components/checkbox/components/checkbox-root.js.map +1 -1
  66. package/dist/module/components/checkbox/components/checkbox-title.js.map +1 -1
  67. package/dist/module/components/checkbox/index.js.map +1 -1
  68. package/dist/module/components/checkbox/variants/default.js.map +1 -1
  69. package/dist/module/components/checkbox/variants/index.js.map +1 -1
  70. package/dist/module/components/checkbox/variants/outlined.js.map +1 -1
  71. package/dist/module/components/empty/components/empty-description.js.map +1 -1
  72. package/dist/module/components/empty/components/empty-media.js.map +1 -1
  73. package/dist/module/components/empty/components/empty-root.js.map +1 -1
  74. package/dist/module/components/empty/components/empty-title.js.map +1 -1
  75. package/dist/module/components/empty/index.js.map +1 -1
  76. package/dist/module/components/empty/variants/default.js.map +1 -1
  77. package/dist/module/components/empty/variants/index.js.map +1 -1
  78. package/dist/module/components/field/components/field-description.js.map +1 -1
  79. package/dist/module/components/field/components/field-error.js.map +1 -1
  80. package/dist/module/components/field/components/field-label.js.map +1 -1
  81. package/dist/module/components/field/components/field-root.js.map +1 -1
  82. package/dist/module/components/field/index.js.map +1 -1
  83. package/dist/module/components/field/variants/default.js.map +1 -1
  84. package/dist/module/components/field/variants/index.js.map +1 -1
  85. package/dist/module/components/icon/icon.js.map +1 -1
  86. package/dist/module/components/icon/index.js.map +1 -1
  87. package/dist/module/components/icon/variants/default.js.map +1 -1
  88. package/dist/module/components/icon/variants/index.js.map +1 -1
  89. package/dist/module/components/index.js.map +1 -1
  90. package/dist/module/components/input/index.js.map +1 -1
  91. package/dist/module/components/input/input.js.map +1 -1
  92. package/dist/module/components/input/numeric-input.js.map +1 -1
  93. package/dist/module/components/input/variants/default.js.map +1 -1
  94. package/dist/module/components/input/variants/index.js.map +1 -1
  95. package/dist/module/components/input/variants/secondary.js.map +1 -1
  96. package/dist/module/components/link/index.js.map +1 -1
  97. package/dist/module/components/link/link.js.map +1 -1
  98. package/dist/module/components/link/variants/default.js.map +1 -1
  99. package/dist/module/components/link/variants/index.js.map +1 -1
  100. package/dist/module/components/list/index.js.map +1 -1
  101. package/dist/module/components/menu/components/menu-content.js.map +1 -1
  102. package/dist/module/components/menu/components/menu-item.js.map +1 -1
  103. package/dist/module/components/menu/components/menu-overlay.js.map +1 -1
  104. package/dist/module/components/menu/components/menu-portal.js.map +1 -1
  105. package/dist/module/components/menu/components/menu-root.js.map +1 -1
  106. package/dist/module/components/menu/components/menu-trigger.js.map +1 -1
  107. package/dist/module/components/menu/index.js.map +1 -1
  108. package/dist/module/components/menu/variants/default.js.map +1 -1
  109. package/dist/module/components/menu/variants/index.js.map +1 -1
  110. package/dist/module/components/phone-input/components/country-picker.js +101 -0
  111. package/dist/module/components/phone-input/components/country-picker.js.map +1 -0
  112. package/dist/module/components/phone-input/components/phone-input-root.js +57 -0
  113. package/dist/module/components/phone-input/components/phone-input-root.js.map +1 -0
  114. package/dist/module/components/phone-input/components/phone-input.js +31 -0
  115. package/dist/module/components/phone-input/components/phone-input.js.map +1 -0
  116. package/dist/module/components/phone-input/context.js +12 -0
  117. package/dist/module/components/phone-input/context.js.map +1 -0
  118. package/dist/module/components/phone-input/index.js +8 -1
  119. package/dist/module/components/phone-input/index.js.map +1 -1
  120. package/dist/module/components/phone-input/variants/default.js +1 -1
  121. package/dist/module/components/phone-input/variants/default.js.map +1 -1
  122. package/dist/module/components/phone-input/variants/index.js.map +1 -1
  123. package/dist/module/components/popover/components/popover-close.js.map +1 -1
  124. package/dist/module/components/popover/components/popover-content.js.map +1 -1
  125. package/dist/module/components/popover/components/popover-overlay.js.map +1 -1
  126. package/dist/module/components/popover/components/popover-portal.js.map +1 -1
  127. package/dist/module/components/popover/components/popover-root.js.map +1 -1
  128. package/dist/module/components/popover/components/popover-trigger.js.map +1 -1
  129. package/dist/module/components/popover/index.js.map +1 -1
  130. package/dist/module/components/popover/variants/default.js.map +1 -1
  131. package/dist/module/components/popover/variants/index.js.map +1 -1
  132. package/dist/module/components/popover/variants/unstyled.js.map +1 -1
  133. package/dist/module/components/portal/index.js.map +1 -1
  134. package/dist/module/components/portal/portal.js.map +1 -1
  135. package/dist/module/components/portal/portal.web.js.map +1 -1
  136. package/dist/module/components/progress/components/progress-indicator.js.map +1 -1
  137. package/dist/module/components/progress/components/progress-root.js.map +1 -1
  138. package/dist/module/components/progress/index.js.map +1 -1
  139. package/dist/module/components/progress/variants/default.js.map +1 -1
  140. package/dist/module/components/progress/variants/index.js.map +1 -1
  141. package/dist/module/components/scroll-bar/index.js.map +1 -1
  142. package/dist/module/components/scroll-bar/scroll-bar.js.map +1 -1
  143. package/dist/module/components/select/components/select-content.js.map +1 -1
  144. package/dist/module/components/select/components/select-option.js.map +1 -1
  145. package/dist/module/components/select/components/select-overlay.js.map +1 -1
  146. package/dist/module/components/select/components/select-portal.js +10 -1
  147. package/dist/module/components/select/components/select-portal.js.map +1 -1
  148. package/dist/module/components/select/components/select-root.js.map +1 -1
  149. package/dist/module/components/select/components/select-trigger.js +5 -4
  150. package/dist/module/components/select/components/select-trigger.js.map +1 -1
  151. package/dist/module/components/select/index.js.map +1 -1
  152. package/dist/module/components/select/variants/default.js.map +1 -1
  153. package/dist/module/components/select/variants/index.js.map +1 -1
  154. package/dist/module/components/tabs/components/tabs-list.js.map +1 -1
  155. package/dist/module/components/tabs/components/tabs-root.js.map +1 -1
  156. package/dist/module/components/tabs/components/tabs-trigger-text.js.map +1 -1
  157. package/dist/module/components/tabs/components/tabs-trigger.js.map +1 -1
  158. package/dist/module/components/tabs/index.js.map +1 -1
  159. package/dist/module/components/tabs/variants/default.js.map +1 -1
  160. package/dist/module/components/tabs/variants/index.js.map +1 -1
  161. package/dist/module/components/tabs/variants/line.js.map +1 -1
  162. package/dist/module/components/textarea/index.js.map +1 -1
  163. package/dist/module/components/textarea/textarea.js.map +1 -1
  164. package/dist/module/components/textarea/variants/default.js.map +1 -1
  165. package/dist/module/components/textarea/variants/index.js.map +1 -1
  166. package/dist/module/components/toast/components/toast-body.js +16 -0
  167. package/dist/module/components/toast/components/toast-body.js.map +1 -0
  168. package/dist/module/components/toast/components/toast-description.js.map +1 -1
  169. package/dist/module/components/toast/components/toast-icon.js.map +1 -1
  170. package/dist/module/components/toast/components/toast-root.js.map +1 -1
  171. package/dist/module/components/toast/components/toast-title.js.map +1 -1
  172. package/dist/module/components/toast/index.js.map +1 -1
  173. package/dist/module/components/toast/manager.js +15 -5
  174. package/dist/module/components/toast/manager.js.map +1 -1
  175. package/dist/module/components/toast/variants/danger.js +6 -2
  176. package/dist/module/components/toast/variants/danger.js.map +1 -1
  177. package/dist/module/components/toast/variants/default.js +6 -2
  178. package/dist/module/components/toast/variants/default.js.map +1 -1
  179. package/dist/module/components/toast/variants/index.js.map +1 -1
  180. package/dist/module/components/toast/variants/success.js +6 -2
  181. package/dist/module/components/toast/variants/success.js.map +1 -1
  182. package/dist/module/components/typography/index.js.map +1 -1
  183. package/dist/module/components/typography/typography.js.map +1 -1
  184. package/dist/module/components/typography/variants/body-lg.js.map +1 -1
  185. package/dist/module/components/typography/variants/body-md.js.map +1 -1
  186. package/dist/module/components/typography/variants/body-sm.js.map +1 -1
  187. package/dist/module/components/typography/variants/heading-lg.js.map +1 -1
  188. package/dist/module/components/typography/variants/heading-md.js.map +1 -1
  189. package/dist/module/components/typography/variants/heading-sm.js.map +1 -1
  190. package/dist/module/components/typography/variants/index.js.map +1 -1
  191. package/dist/module/data/countries.js.map +1 -1
  192. package/dist/module/hooks/index.js.map +1 -1
  193. package/dist/module/hooks/use-phone-mask.js.map +1 -1
  194. package/dist/module/index.js +3 -1
  195. package/dist/module/index.js.map +1 -1
  196. package/dist/module/safe-area/index.js.map +1 -1
  197. package/dist/module/safe-area/provider.js.map +1 -1
  198. package/dist/module/themes/adapters/index.js.map +1 -1
  199. package/dist/module/themes/adapters/react-navigation.js.map +1 -1
  200. package/dist/module/themes/default/index.js.map +1 -1
  201. package/dist/module/themes/index.js.map +1 -1
  202. package/dist/module/themes/provider.js +11 -2
  203. package/dist/module/themes/provider.js.map +1 -1
  204. package/dist/module/utils/use-themed-styles.js.map +1 -1
  205. package/dist/typescript/babel.config.d.ts +1 -6
  206. package/dist/typescript/babel.config.d.ts.map +1 -1
  207. package/dist/typescript/src/components/phone-input/components/country-picker.d.ts +3 -0
  208. package/dist/typescript/src/components/phone-input/components/country-picker.d.ts.map +1 -0
  209. package/dist/typescript/src/components/phone-input/components/phone-input-root.d.ts +17 -0
  210. package/dist/typescript/src/components/phone-input/components/phone-input-root.d.ts.map +1 -0
  211. package/dist/typescript/src/components/phone-input/components/phone-input.d.ts +8 -0
  212. package/dist/typescript/src/components/phone-input/components/phone-input.d.ts.map +1 -0
  213. package/dist/typescript/src/components/phone-input/context.d.ts +17 -0
  214. package/dist/typescript/src/components/phone-input/context.d.ts.map +1 -0
  215. package/dist/typescript/src/components/phone-input/index.d.ts +8 -1
  216. package/dist/typescript/src/components/phone-input/index.d.ts.map +1 -1
  217. package/dist/typescript/src/components/select/components/select-portal.d.ts +1 -1
  218. package/dist/typescript/src/components/select/components/select-portal.d.ts.map +1 -1
  219. package/dist/typescript/src/components/select/components/select-trigger.d.ts.map +1 -1
  220. package/dist/typescript/src/components/toast/components/toast-body.d.ts +9 -0
  221. package/dist/typescript/src/components/toast/components/toast-body.d.ts.map +1 -0
  222. package/dist/typescript/src/components/toast/manager.d.ts.map +1 -1
  223. package/dist/typescript/src/components/toast/types.d.ts +2 -0
  224. package/dist/typescript/src/components/toast/types.d.ts.map +1 -1
  225. package/dist/typescript/src/components/toast/variants/danger.d.ts.map +1 -1
  226. package/dist/typescript/src/components/toast/variants/default.d.ts.map +1 -1
  227. package/dist/typescript/src/components/toast/variants/success.d.ts.map +1 -1
  228. package/dist/typescript/src/data/countries.d.ts +2 -1
  229. package/dist/typescript/src/data/countries.d.ts.map +1 -1
  230. package/dist/typescript/src/hooks/use-phone-mask.d.ts +2 -2
  231. package/dist/typescript/src/hooks/use-phone-mask.d.ts.map +1 -1
  232. package/dist/typescript/src/index.d.ts +4 -3
  233. package/dist/typescript/src/index.d.ts.map +1 -1
  234. package/dist/typescript/src/themes/provider.d.ts +10 -0
  235. package/dist/typescript/src/themes/provider.d.ts.map +1 -1
  236. package/package.json +2 -7
  237. package/src/components/phone-input/components/country-picker.tsx +155 -0
  238. package/src/components/phone-input/components/phone-input-root.tsx +85 -0
  239. package/src/components/phone-input/components/phone-input.tsx +43 -0
  240. package/src/components/phone-input/context.ts +32 -0
  241. package/src/components/phone-input/index.ts +10 -1
  242. package/src/components/phone-input/variants/default.tsx +1 -1
  243. package/src/components/select/components/select-portal.tsx +14 -2
  244. package/src/components/select/components/select-trigger.tsx +5 -6
  245. package/src/components/toast/components/toast-body.tsx +19 -0
  246. package/src/components/toast/manager.tsx +15 -5
  247. package/src/components/toast/types.ts +2 -0
  248. package/src/components/toast/variants/danger.tsx +6 -2
  249. package/src/components/toast/variants/default.tsx +6 -2
  250. package/src/components/toast/variants/success.tsx +6 -2
  251. package/src/data/countries.ts +606 -68
  252. package/src/hooks/use-phone-mask.ts +2 -2
  253. package/src/index.tsx +9 -3
  254. package/src/themes/provider.tsx +22 -1
  255. package/dist/module/components/phone-input/phone-input.js +0 -165
  256. package/dist/module/components/phone-input/phone-input.js.map +0 -1
  257. package/dist/typescript/src/components/phone-input/phone-input.d.ts +0 -16
  258. package/dist/typescript/src/components/phone-input/phone-input.d.ts.map +0 -1
  259. package/scripts/build.sh +0 -2
  260. package/src/components/phone-input/phone-input.tsx +0 -220
@@ -0,0 +1,32 @@
1
+ import { createContext, useContext } from "react";
2
+ import type { PhoneMask } from "../../hooks";
3
+ import type { ViewRef } from "../../types/element.types";
4
+ import type { PhoneInputState, PhoneInputStyles } from "./types";
5
+
6
+ export interface PhoneInputContext {
7
+ value: string | undefined;
8
+ onChange: ((value: string) => void) | undefined;
9
+
10
+ isFocused: boolean;
11
+ setIsFocused: (focused: boolean) => void;
12
+ isDisabled: boolean;
13
+
14
+ triggerRef: React.RefObject<ViewRef | null>;
15
+
16
+ phoneMask: PhoneMask;
17
+
18
+ state: PhoneInputState;
19
+ styles: PhoneInputStyles;
20
+ }
21
+
22
+ export const PhoneInputContext = createContext<PhoneInputContext | undefined>(
23
+ undefined,
24
+ );
25
+
26
+ export const usePhoneInput = () => {
27
+ const context = useContext(PhoneInputContext);
28
+ if (!context) {
29
+ throw new Error("usePhoneInput must be used within a PhoneInputRoot");
30
+ }
31
+ return context;
32
+ };
@@ -1,2 +1,11 @@
1
- export { PhoneInput, type PhoneInputProps } from "./phone-input";
2
1
  export type { PhoneInputState, PhoneInputStyles } from "./types";
2
+
3
+ import { CountryPicker } from "./components/country-picker";
4
+ import { PhoneInput as PhoneInputComponent } from "./components/phone-input";
5
+ import { PhoneInputRoot } from "./components/phone-input-root";
6
+
7
+ export const PhoneInput = {
8
+ Root: PhoneInputRoot,
9
+ CountryPicker,
10
+ Input: PhoneInputComponent,
11
+ };
@@ -55,7 +55,7 @@ export function usePhoneInputVariantDefault(): PhoneInputStyles {
55
55
  input: {
56
56
  default: {
57
57
  flex: 1,
58
- paddingHorizontal: 12,
58
+ paddingHorizontal: 16,
59
59
  fontFamily,
60
60
  fontSize,
61
61
  color: colors.foreground,
@@ -1,4 +1,5 @@
1
1
  import React, { useEffect } from "react";
2
+ import { View } from "react-native";
2
3
  import { Portal } from "../../portal";
3
4
  import { SelectContext, useSelect } from "../context";
4
5
 
@@ -16,12 +17,23 @@ export function SelectPortal(props: SelectPortalProps) {
16
17
  }, []);
17
18
 
18
19
  if (!select.isOpen) {
19
- return null;
20
+ return (
21
+ <View
22
+ style={{ display: "none" }}
23
+ aria-hidden
24
+ accessibilityElementsHidden
25
+ importantForAccessibility="no-hide-descendants"
26
+ >
27
+ {props.children}
28
+ </View>
29
+ );
20
30
  }
21
31
 
22
32
  return (
23
33
  <Portal name="select-portal">
24
- <SelectContext.Provider value={select}>{props.children}</SelectContext.Provider>
34
+ <SelectContext.Provider value={select}>
35
+ {props.children}
36
+ </SelectContext.Provider>
25
37
  </Portal>
26
38
  );
27
39
  }
@@ -62,18 +62,17 @@ export function SelectValue(props: SelectValueProps) {
62
62
  (option) => option.value === select.value,
63
63
  );
64
64
  const selectedOptionLabel = selectedOption?.label;
65
+ const displayValue = selectedOptionLabel ?? select.value;
65
66
 
66
67
  const composedStyles = calculateComposedStyles(
67
68
  select.styles,
68
69
  select.state,
69
- selectedOptionLabel ? "value" : "placeholder",
70
+ displayValue ? "value" : "placeholder",
70
71
  );
71
- if (typeof selectedOptionLabel !== "string") {
72
- return <>{selectedOptionLabel}</>;
72
+ if (!!displayValue && typeof displayValue !== "string") {
73
+ return <>{displayValue}</>;
73
74
  }
74
75
  return (
75
- <Text style={composedStyles}>
76
- {selectedOptionLabel ?? props.placeholder}
77
- </Text>
76
+ <Text style={composedStyles}>{displayValue ?? props.placeholder}</Text>
78
77
  );
79
78
  }
@@ -0,0 +1,19 @@
1
+ import type { PropsWithRender } from "../../../types/props.types";
2
+ import React from "react";
3
+ import { type StyleProp, View, type ViewStyle } from "react-native";
4
+ import { useToast } from "../context";
5
+
6
+ export interface ToastBodyProps {
7
+ children?: React.ReactNode;
8
+
9
+ style?: StyleProp<ViewStyle>;
10
+ }
11
+
12
+ export function ToastBody(props: PropsWithRender<ToastBodyProps>) {
13
+ const toast = useToast();
14
+
15
+ const composedStyle = [toast.styles?.body, props.style];
16
+
17
+ const Component = props.render ?? View;
18
+ return <Component {...props} style={composedStyle} />;
19
+ }
@@ -1,8 +1,11 @@
1
1
  import React, { useSyncExternalStore } from "react";
2
2
  import { StyleSheet, View } from "react-native";
3
3
  import { useSafeAreaInsets } from "../../safe-area";
4
+ import { useComponentsConfig } from "../../themes";
4
5
  import { Portal } from "../portal";
6
+ import { ToastBody } from "./components/toast-body";
5
7
  import { ToastDescription } from "./components/toast-description";
8
+ import { ToastIcon } from "./components/toast-icon";
6
9
  import { ToastRoot } from "./components/toast-root";
7
10
  import { ToastTitle } from "./components/toast-title";
8
11
  import { ToastVariants } from "./variants";
@@ -107,12 +110,19 @@ interface ToastProps {
107
110
  }
108
111
 
109
112
  export function ToastComponent(props: ToastProps) {
113
+ const config = useComponentsConfig();
114
+ const variant = props.variant ?? "default";
115
+ const IconComponent = config?.toast?.icons?.[variant];
116
+
110
117
  return (
111
- <ToastRoot variant={props.variant}>
112
- <ToastTitle>{props.title}</ToastTitle>
113
- {!!props.description && (
114
- <ToastDescription>{props.description}</ToastDescription>
115
- )}
118
+ <ToastRoot variant={variant}>
119
+ {!!IconComponent && <ToastIcon render={IconComponent} />}
120
+ <ToastBody>
121
+ <ToastTitle>{props.title}</ToastTitle>
122
+ {!!props.description && (
123
+ <ToastDescription>{props.description}</ToastDescription>
124
+ )}
125
+ </ToastBody>
116
126
  </ToastRoot>
117
127
  );
118
128
  }
@@ -1,3 +1,4 @@
1
+ import type { ToastBodyProps } from "./components/toast-body";
1
2
  import type { ToastDescriptionProps } from "./components/toast-description";
2
3
  import type { ToastIconProps } from "./components/toast-icon";
3
4
  import type { ToastRootProps } from "./components/toast-root";
@@ -5,6 +6,7 @@ import type { ToastTitleProps } from "./components/toast-title";
5
6
 
6
7
  export interface ToastStyles {
7
8
  root?: ToastRootProps["style"];
9
+ body?: ToastBodyProps["style"];
8
10
  icon?: ToastIconProps;
9
11
  title?: ToastTitleProps["style"];
10
12
  description?: ToastDescriptionProps["style"];
@@ -10,14 +10,18 @@ export const useToastVariantDanger = (): ToastStyles => {
10
10
  borderColor: colors.danger,
11
11
  borderRadius: radius,
12
12
  padding: 16,
13
- gap: 4,
13
+ gap: 12,
14
14
  minWidth: 300,
15
15
  maxWidth: 400,
16
16
  flexDirection: "row",
17
17
  },
18
+ body: {
19
+ flex: 1,
20
+ gap: 4,
21
+ },
18
22
  icon: {
19
23
  color: colors.foreground,
20
- size: 20,
24
+ size: 16,
21
25
  style: {
22
26
  marginTop: 2,
23
27
  },
@@ -10,14 +10,18 @@ export const useToastVariantDefault = (): ToastStyles => {
10
10
  borderColor: colors.border,
11
11
  borderRadius: radius,
12
12
  padding: 16,
13
- gap: 4,
13
+ gap: 12,
14
14
  minWidth: 300,
15
15
  maxWidth: 400,
16
16
  flexDirection: "row",
17
17
  },
18
+ body: {
19
+ flex: 1,
20
+ gap: 4,
21
+ },
18
22
  icon: {
19
23
  color: colors.foreground,
20
- size: 20,
24
+ size: 16,
21
25
  style: {
22
26
  marginTop: 2,
23
27
  },
@@ -10,14 +10,18 @@ export const useToastVariantSuccess = (): ToastStyles => {
10
10
  borderColor: colors.success,
11
11
  borderRadius: radius,
12
12
  padding: 16,
13
- gap: 4,
13
+ gap: 12,
14
14
  minWidth: 300,
15
15
  maxWidth: 400,
16
16
  flexDirection: "row",
17
17
  },
18
+ body: {
19
+ flex: 1,
20
+ gap: 4,
21
+ },
18
22
  icon: {
19
23
  color: colors.foreground,
20
- size: 20,
24
+ size: 16,
21
25
  style: {
22
26
  marginTop: 2,
23
27
  },