@korsolutions/ui 0.0.51 → 0.0.53

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 (262) hide show
  1. package/AGENTS.md +32 -19
  2. package/dist/module/components/alert/components/alert-description.js.map +1 -1
  3. package/dist/module/components/button/components/button-label.js.map +1 -1
  4. package/dist/module/components/index.js +1 -0
  5. package/dist/module/components/index.js.map +1 -1
  6. package/dist/module/components/input/numeric-input.js +1 -1
  7. package/dist/module/components/input/numeric-input.js.map +1 -1
  8. package/dist/module/components/input/variants/default.js +9 -2
  9. package/dist/module/components/input/variants/default.js.map +1 -1
  10. package/dist/module/components/input/variants/secondary.js +9 -2
  11. package/dist/module/components/input/variants/secondary.js.map +1 -1
  12. package/dist/module/components/link/variants/default.js.map +1 -1
  13. package/dist/module/components/menu/components/menu-trigger.js +1 -1
  14. package/dist/module/components/menu/components/menu-trigger.js.map +1 -1
  15. package/dist/module/components/phone-input/index.js +4 -0
  16. package/dist/module/components/phone-input/index.js.map +1 -0
  17. package/dist/module/components/phone-input/phone-input.js +165 -0
  18. package/dist/module/components/phone-input/phone-input.js.map +1 -0
  19. package/dist/module/components/phone-input/types.js +4 -0
  20. package/dist/module/components/phone-input/types.js.map +1 -0
  21. package/dist/module/components/phone-input/variants/default.js +128 -0
  22. package/dist/module/components/phone-input/variants/default.js.map +1 -0
  23. package/dist/module/components/phone-input/variants/index.js +7 -0
  24. package/dist/module/components/phone-input/variants/index.js.map +1 -0
  25. package/dist/module/components/select/components/select-trigger.js +2 -2
  26. package/dist/module/components/select/components/select-trigger.js.map +1 -1
  27. package/dist/module/components/tabs/variants/default.js.map +1 -1
  28. package/dist/module/components/toast/components/toast-icon.js.map +1 -1
  29. package/dist/module/components/toast/manager.js +2 -2
  30. package/dist/module/components/toast/manager.js.map +1 -1
  31. package/dist/module/components/typography/variants/body-lg.js.map +1 -1
  32. package/dist/module/components/typography/variants/body-md.js.map +1 -1
  33. package/dist/module/components/typography/variants/body-sm.js.map +1 -1
  34. package/dist/module/components/typography/variants/heading-lg.js.map +1 -1
  35. package/dist/module/components/typography/variants/heading-md.js.map +1 -1
  36. package/dist/module/components/typography/variants/heading-sm.js.map +1 -1
  37. package/dist/module/data/countries.js +476 -0
  38. package/dist/module/data/countries.js.map +1 -0
  39. package/dist/module/hooks/index.js +1 -0
  40. package/dist/module/hooks/index.js.map +1 -1
  41. package/dist/module/hooks/use-phone-mask.js +121 -0
  42. package/dist/module/hooks/use-phone-mask.js.map +1 -0
  43. package/dist/module/hooks/use-relative-position.js.map +1 -1
  44. package/dist/module/index.js +2 -2
  45. package/dist/module/index.js.map +1 -1
  46. package/dist/module/themes/default/colors.js +28 -28
  47. package/dist/module/themes/default/colors.js.map +1 -1
  48. package/dist/module/themes/provider.js.map +1 -1
  49. package/dist/module/themes/utils.js.map +1 -1
  50. package/dist/module/utils/input-utils.js.map +1 -1
  51. package/dist/module/utils/normalize-layout.js.map +1 -1
  52. package/dist/module/utils/use-themed-styles.js.map +1 -1
  53. package/dist/typescript/src/components/alert/components/alert-body.d.ts.map +1 -1
  54. package/dist/typescript/src/components/alert/components/alert-description.d.ts +2 -2
  55. package/dist/typescript/src/components/alert/components/alert-description.d.ts.map +1 -1
  56. package/dist/typescript/src/components/alert/components/alert-icon.d.ts.map +1 -1
  57. package/dist/typescript/src/components/alert/components/alert-root.d.ts.map +1 -1
  58. package/dist/typescript/src/components/alert/components/alert-title.d.ts.map +1 -1
  59. package/dist/typescript/src/components/alert/variants/default.d.ts +1 -1
  60. package/dist/typescript/src/components/alert/variants/default.d.ts.map +1 -1
  61. package/dist/typescript/src/components/alert/variants/destructive.d.ts +1 -1
  62. package/dist/typescript/src/components/alert/variants/destructive.d.ts.map +1 -1
  63. package/dist/typescript/src/components/alert-dialog/components/alert-dialog-trigger.d.ts.map +1 -1
  64. package/dist/typescript/src/components/alert-dialog/variants/default.d.ts +1 -1
  65. package/dist/typescript/src/components/alert-dialog/variants/default.d.ts.map +1 -1
  66. package/dist/typescript/src/components/avatar/variants/default.d.ts +1 -1
  67. package/dist/typescript/src/components/avatar/variants/default.d.ts.map +1 -1
  68. package/dist/typescript/src/components/badge/components/badge-root.d.ts.map +1 -1
  69. package/dist/typescript/src/components/badge/variants/default.d.ts +1 -1
  70. package/dist/typescript/src/components/badge/variants/default.d.ts.map +1 -1
  71. package/dist/typescript/src/components/badge/variants/secondary.d.ts +1 -1
  72. package/dist/typescript/src/components/badge/variants/secondary.d.ts.map +1 -1
  73. package/dist/typescript/src/components/button/components/button-label.d.ts +2 -1
  74. package/dist/typescript/src/components/button/components/button-label.d.ts.map +1 -1
  75. package/dist/typescript/src/components/button/variants/default.d.ts +1 -1
  76. package/dist/typescript/src/components/button/variants/default.d.ts.map +1 -1
  77. package/dist/typescript/src/components/button/variants/secondary.d.ts +1 -1
  78. package/dist/typescript/src/components/button/variants/secondary.d.ts.map +1 -1
  79. package/dist/typescript/src/components/calendar/variants/default.d.ts +1 -1
  80. package/dist/typescript/src/components/calendar/variants/default.d.ts.map +1 -1
  81. package/dist/typescript/src/components/card/card-body.d.ts.map +1 -1
  82. package/dist/typescript/src/components/card/card-footer.d.ts.map +1 -1
  83. package/dist/typescript/src/components/card/card-header.d.ts.map +1 -1
  84. package/dist/typescript/src/components/card/card-root.d.ts.map +1 -1
  85. package/dist/typescript/src/components/card/card-title.d.ts.map +1 -1
  86. package/dist/typescript/src/components/card/variants/default.d.ts +1 -1
  87. package/dist/typescript/src/components/card/variants/default.d.ts.map +1 -1
  88. package/dist/typescript/src/components/checkbox/variants/default.d.ts +1 -1
  89. package/dist/typescript/src/components/checkbox/variants/default.d.ts.map +1 -1
  90. package/dist/typescript/src/components/checkbox/variants/outlined.d.ts +1 -1
  91. package/dist/typescript/src/components/checkbox/variants/outlined.d.ts.map +1 -1
  92. package/dist/typescript/src/components/empty/variants/default.d.ts +1 -1
  93. package/dist/typescript/src/components/empty/variants/default.d.ts.map +1 -1
  94. package/dist/typescript/src/components/field/variants/default.d.ts +1 -1
  95. package/dist/typescript/src/components/field/variants/default.d.ts.map +1 -1
  96. package/dist/typescript/src/components/icon/icon.d.ts.map +1 -1
  97. package/dist/typescript/src/components/index.d.ts +1 -0
  98. package/dist/typescript/src/components/index.d.ts.map +1 -1
  99. package/dist/typescript/src/components/input/input.d.ts.map +1 -1
  100. package/dist/typescript/src/components/input/numeric-input.d.ts +1 -1
  101. package/dist/typescript/src/components/input/numeric-input.d.ts.map +1 -1
  102. package/dist/typescript/src/components/input/variants/default.d.ts +1 -1
  103. package/dist/typescript/src/components/input/variants/default.d.ts.map +1 -1
  104. package/dist/typescript/src/components/input/variants/secondary.d.ts +1 -1
  105. package/dist/typescript/src/components/input/variants/secondary.d.ts.map +1 -1
  106. package/dist/typescript/src/components/link/variants/default.d.ts.map +1 -1
  107. package/dist/typescript/src/components/menu/components/menu-trigger.d.ts +1 -1
  108. package/dist/typescript/src/components/menu/components/menu-trigger.d.ts.map +1 -1
  109. package/dist/typescript/src/components/menu/context.d.ts.map +1 -1
  110. package/dist/typescript/src/components/menu/variants/default.d.ts +1 -1
  111. package/dist/typescript/src/components/menu/variants/default.d.ts.map +1 -1
  112. package/dist/typescript/src/components/phone-input/index.d.ts +3 -0
  113. package/dist/typescript/src/components/phone-input/index.d.ts.map +1 -0
  114. package/dist/typescript/src/components/phone-input/phone-input.d.ts +16 -0
  115. package/dist/typescript/src/components/phone-input/phone-input.d.ts.map +1 -0
  116. package/dist/typescript/src/components/phone-input/types.d.ts +15 -0
  117. package/dist/typescript/src/components/phone-input/types.d.ts.map +1 -0
  118. package/dist/typescript/src/components/phone-input/variants/default.d.ts +3 -0
  119. package/dist/typescript/src/components/phone-input/variants/default.d.ts.map +1 -0
  120. package/dist/typescript/src/components/phone-input/variants/index.d.ts +5 -0
  121. package/dist/typescript/src/components/phone-input/variants/index.d.ts.map +1 -0
  122. package/dist/typescript/src/components/popover/components/popover-trigger.d.ts.map +1 -1
  123. package/dist/typescript/src/components/popover/context.d.ts.map +1 -1
  124. package/dist/typescript/src/components/popover/variants/default.d.ts +1 -1
  125. package/dist/typescript/src/components/popover/variants/default.d.ts.map +1 -1
  126. package/dist/typescript/src/components/popover/variants/unstyled.d.ts +1 -1
  127. package/dist/typescript/src/components/popover/variants/unstyled.d.ts.map +1 -1
  128. package/dist/typescript/src/components/progress/variants/default.d.ts +1 -1
  129. package/dist/typescript/src/components/progress/variants/default.d.ts.map +1 -1
  130. package/dist/typescript/src/components/select/components/select-trigger.d.ts.map +1 -1
  131. package/dist/typescript/src/components/select/context.d.ts.map +1 -1
  132. package/dist/typescript/src/components/select/variants/default.d.ts +1 -1
  133. package/dist/typescript/src/components/select/variants/default.d.ts.map +1 -1
  134. package/dist/typescript/src/components/tabs/variants/default.d.ts +1 -1
  135. package/dist/typescript/src/components/tabs/variants/default.d.ts.map +1 -1
  136. package/dist/typescript/src/components/tabs/variants/line.d.ts +1 -1
  137. package/dist/typescript/src/components/tabs/variants/line.d.ts.map +1 -1
  138. package/dist/typescript/src/components/textarea/variants/default.d.ts +1 -1
  139. package/dist/typescript/src/components/textarea/variants/default.d.ts.map +1 -1
  140. package/dist/typescript/src/components/toast/components/toast-icon.d.ts +1 -1
  141. package/dist/typescript/src/components/toast/components/toast-icon.d.ts.map +1 -1
  142. package/dist/typescript/src/components/toast/manager.d.ts.map +1 -1
  143. package/dist/typescript/src/components/typography/variants/body-lg.d.ts.map +1 -1
  144. package/dist/typescript/src/components/typography/variants/body-md.d.ts.map +1 -1
  145. package/dist/typescript/src/components/typography/variants/body-sm.d.ts.map +1 -1
  146. package/dist/typescript/src/components/typography/variants/heading-lg.d.ts.map +1 -1
  147. package/dist/typescript/src/components/typography/variants/heading-md.d.ts.map +1 -1
  148. package/dist/typescript/src/components/typography/variants/heading-sm.d.ts.map +1 -1
  149. package/dist/typescript/src/data/countries.d.ts +17 -0
  150. package/dist/typescript/src/data/countries.d.ts.map +1 -0
  151. package/dist/typescript/src/hooks/index.d.ts +1 -0
  152. package/dist/typescript/src/hooks/index.d.ts.map +1 -1
  153. package/dist/typescript/src/hooks/use-phone-mask.d.ts +20 -0
  154. package/dist/typescript/src/hooks/use-phone-mask.d.ts.map +1 -0
  155. package/dist/typescript/src/hooks/use-relative-position.d.ts +1 -1
  156. package/dist/typescript/src/hooks/use-relative-position.d.ts.map +1 -1
  157. package/dist/typescript/src/index.d.ts +2 -2
  158. package/dist/typescript/src/index.d.ts.map +1 -1
  159. package/dist/typescript/src/themes/provider.d.ts +1 -1
  160. package/dist/typescript/src/themes/provider.d.ts.map +1 -1
  161. package/dist/typescript/src/themes/types.d.ts +1 -1
  162. package/dist/typescript/src/themes/types.d.ts.map +1 -1
  163. package/dist/typescript/src/themes/utils.d.ts.map +1 -1
  164. package/dist/typescript/src/utils/input-utils.d.ts.map +1 -1
  165. package/dist/typescript/src/utils/normalize-layout.d.ts +1 -1
  166. package/dist/typescript/src/utils/normalize-layout.d.ts.map +1 -1
  167. package/dist/typescript/src/utils/use-themed-styles.d.ts.map +1 -1
  168. package/package.json +1 -1
  169. package/src/components/alert/components/alert-body.tsx +1 -1
  170. package/src/components/alert/components/alert-description.tsx +5 -3
  171. package/src/components/alert/components/alert-icon.tsx +1 -1
  172. package/src/components/alert/components/alert-root.tsx +1 -1
  173. package/src/components/alert/components/alert-title.tsx +2 -2
  174. package/src/components/alert/variants/default.tsx +2 -2
  175. package/src/components/alert/variants/destructive.tsx +2 -2
  176. package/src/components/alert-dialog/components/alert-dialog-trigger.tsx +1 -1
  177. package/src/components/alert-dialog/variants/default.tsx +2 -2
  178. package/src/components/avatar/variants/default.tsx +2 -2
  179. package/src/components/badge/components/badge-label.tsx +1 -1
  180. package/src/components/badge/components/badge-root.tsx +2 -2
  181. package/src/components/badge/variants/default.tsx +2 -2
  182. package/src/components/badge/variants/secondary.tsx +2 -2
  183. package/src/components/button/components/button-label.tsx +3 -2
  184. package/src/components/button/variants/default.tsx +3 -3
  185. package/src/components/button/variants/secondary.tsx +3 -3
  186. package/src/components/calendar/components/calendar-day.tsx +1 -1
  187. package/src/components/calendar/components/calendar-nav-button.tsx +1 -1
  188. package/src/components/calendar/components/calendar-title.tsx +1 -1
  189. package/src/components/calendar/components/calendar-weeks.tsx +1 -1
  190. package/src/components/calendar/variants/default.tsx +2 -2
  191. package/src/components/card/card-body.tsx +2 -2
  192. package/src/components/card/card-footer.tsx +2 -2
  193. package/src/components/card/card-header.tsx +2 -2
  194. package/src/components/card/card-root.tsx +2 -2
  195. package/src/components/card/card-title.tsx +3 -3
  196. package/src/components/card/variants/default.tsx +2 -2
  197. package/src/components/checkbox/variants/default.tsx +2 -2
  198. package/src/components/checkbox/variants/outlined.tsx +2 -2
  199. package/src/components/empty/variants/default.tsx +2 -2
  200. package/src/components/field/variants/default.tsx +2 -2
  201. package/src/components/icon/icon.tsx +1 -1
  202. package/src/components/icon/variants/default.tsx +1 -1
  203. package/src/components/index.ts +1 -0
  204. package/src/components/input/input.tsx +1 -1
  205. package/src/components/input/numeric-input.tsx +8 -2
  206. package/src/components/input/variants/default.tsx +10 -3
  207. package/src/components/input/variants/secondary.tsx +10 -3
  208. package/src/components/link/variants/default.tsx +2 -2
  209. package/src/components/menu/components/menu-content.tsx +1 -1
  210. package/src/components/menu/components/menu-root.tsx +1 -1
  211. package/src/components/menu/components/menu-trigger.tsx +40 -38
  212. package/src/components/menu/context.ts +1 -1
  213. package/src/components/menu/variants/default.tsx +2 -2
  214. package/src/components/phone-input/index.ts +2 -0
  215. package/src/components/phone-input/phone-input.tsx +220 -0
  216. package/src/components/phone-input/types.ts +20 -0
  217. package/src/components/phone-input/variants/default.tsx +124 -0
  218. package/src/components/phone-input/variants/index.ts +5 -0
  219. package/src/components/popover/components/popover-content.tsx +2 -2
  220. package/src/components/popover/components/popover-root.tsx +1 -1
  221. package/src/components/popover/components/popover-trigger.tsx +2 -2
  222. package/src/components/popover/context.ts +1 -1
  223. package/src/components/popover/variants/default.tsx +2 -2
  224. package/src/components/popover/variants/unstyled.tsx +2 -2
  225. package/src/components/progress/components/progress-indicator.tsx +1 -1
  226. package/src/components/progress/components/progress-root.tsx +1 -1
  227. package/src/components/progress/variants/default.tsx +2 -2
  228. package/src/components/scroll-bar/scroll-bar.tsx +1 -1
  229. package/src/components/select/components/select-content.tsx +2 -2
  230. package/src/components/select/components/select-option.tsx +1 -1
  231. package/src/components/select/components/select-overlay.tsx +1 -1
  232. package/src/components/select/components/select-root.tsx +2 -2
  233. package/src/components/select/components/select-trigger.tsx +35 -9
  234. package/src/components/select/context.ts +1 -1
  235. package/src/components/select/variants/default.tsx +2 -2
  236. package/src/components/tabs/variants/default.tsx +2 -2
  237. package/src/components/tabs/variants/line.tsx +2 -2
  238. package/src/components/textarea/variants/default.tsx +2 -2
  239. package/src/components/toast/components/toast-icon.tsx +8 -2
  240. package/src/components/toast/manager.tsx +11 -4
  241. package/src/components/toast/variants/danger.tsx +1 -1
  242. package/src/components/toast/variants/default.tsx +1 -1
  243. package/src/components/toast/variants/success.tsx +1 -1
  244. package/src/components/typography/variants/body-lg.tsx +1 -1
  245. package/src/components/typography/variants/body-md.tsx +1 -1
  246. package/src/components/typography/variants/body-sm.tsx +1 -1
  247. package/src/components/typography/variants/heading-lg.tsx +1 -1
  248. package/src/components/typography/variants/heading-md.tsx +1 -1
  249. package/src/components/typography/variants/heading-sm.tsx +1 -1
  250. package/src/data/countries.ts +88 -0
  251. package/src/hooks/index.ts +1 -0
  252. package/src/hooks/use-phone-mask.ts +183 -0
  253. package/src/hooks/use-relative-position.ts +94 -18
  254. package/src/index.tsx +8 -3
  255. package/src/themes/default/colors.ts +28 -28
  256. package/src/themes/provider.tsx +23 -5
  257. package/src/themes/types.ts +1 -1
  258. package/src/themes/utils.ts +5 -2
  259. package/src/utils/input-utils.ts +5 -2
  260. package/src/utils/normalize-layout.ts +5 -2
  261. package/src/utils/use-themed-styles.ts +11 -3
  262. package/tsconfig.json +14 -7
@@ -1,5 +1,5 @@
1
- import { type CalendarStyles } from "@/components";
2
- import { useThemedStyles } from "@/utils/use-themed-styles";
1
+ import { type CalendarStyles } from "../..";
2
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
3
 
4
4
  export const useCalendarVariantDefault = (): CalendarStyles => {
5
5
  return useThemedStyles(
@@ -1,5 +1,5 @@
1
- import type { PropsWithRender } from "@/types/props.types";
2
- import { calculateComposedStyles } from "@/utils/calculate-styles";
1
+ import type { PropsWithRender } from "../../types/props.types";
2
+ import { calculateComposedStyles } from "../../utils/calculate-styles";
3
3
  import React from "react";
4
4
  import { type StyleProp, View, type ViewStyle } from "react-native";
5
5
  import { useCard } from "./context";
@@ -1,5 +1,5 @@
1
- import type { PropsWithRender } from "@/types/props.types";
2
- import { calculateComposedStyles } from "@/utils/calculate-styles";
1
+ import type { PropsWithRender } from "../../types/props.types";
2
+ import { calculateComposedStyles } from "../../utils/calculate-styles";
3
3
  import React from "react";
4
4
  import { type StyleProp, View, type ViewStyle } from "react-native";
5
5
  import { useCard } from "./context";
@@ -1,5 +1,5 @@
1
- import type { PropsWithRender } from "@/types/props.types";
2
- import { calculateComposedStyles } from "@/utils/calculate-styles";
1
+ import type { PropsWithRender } from "../../types/props.types";
2
+ import { calculateComposedStyles } from "../../utils/calculate-styles";
3
3
  import React from "react";
4
4
  import { type StyleProp, View, type ViewStyle } from "react-native";
5
5
  import { useCard } from "./context";
@@ -1,5 +1,5 @@
1
- import type { PropsWithRender } from "@/types/props.types";
2
- import { calculateComposedStyles } from "@/utils/calculate-styles";
1
+ import type { PropsWithRender } from "../../types/props.types";
2
+ import { calculateComposedStyles } from "../../utils/calculate-styles";
3
3
  import React from "react";
4
4
  import { type StyleProp, View, type ViewStyle } from "react-native";
5
5
  import { CardContext } from "./context";
@@ -1,6 +1,6 @@
1
- import type { TextChildren } from "@/types/element.types";
2
- import type { PropsWithRender } from "@/types/props.types";
3
- import { calculateComposedStyles } from "@/utils/calculate-styles";
1
+ import type { TextChildren } from "../../types/element.types";
2
+ import type { PropsWithRender } from "../../types/props.types";
3
+ import { calculateComposedStyles } from "../../utils/calculate-styles";
4
4
  import React from "react";
5
5
  import { type StyleProp, Text, type TextStyle } from "react-native";
6
6
  import { useCard } from "./context";
@@ -1,5 +1,5 @@
1
- import { type CardStyles } from "@/components";
2
- import { useThemedStyles } from "@/utils/use-themed-styles";
1
+ import { type CardStyles } from "../..";
2
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
3
 
4
4
  export function useCardVariantDefault(): CardStyles {
5
5
  return useThemedStyles(
@@ -1,5 +1,5 @@
1
- import { type CheckboxStyles } from "@/components";
2
- import { useThemedStyles } from "@/utils/use-themed-styles";
1
+ import { type CheckboxStyles } from "../..";
2
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
3
 
4
4
  export const useCheckboxVariantDefault = (): CheckboxStyles => {
5
5
  return useThemedStyles(
@@ -1,5 +1,5 @@
1
- import { type CheckboxStyles } from "@/components";
2
- import { useThemedStyles } from "@/utils/use-themed-styles";
1
+ import { type CheckboxStyles } from "../..";
2
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
3
 
4
4
  export const useCheckboxVariantOutlined = (): CheckboxStyles => {
5
5
  return useThemedStyles(
@@ -1,5 +1,5 @@
1
- import { type EmptyStyles } from "@/components";
2
- import { useThemedStyles } from "@/utils/use-themed-styles";
1
+ import { type EmptyStyles } from "../..";
2
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
3
 
4
4
  export function useEmptyVariantDefault(): EmptyStyles {
5
5
  return useThemedStyles(
@@ -1,5 +1,5 @@
1
- import { type FieldStyles } from "@/components";
2
- import { useThemedStyles } from "@/utils/use-themed-styles";
1
+ import { type FieldStyles } from "../..";
2
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
3
 
4
4
  export const useFieldVariantDefault = (): FieldStyles => {
5
5
  return useThemedStyles(
@@ -1,4 +1,4 @@
1
- import type { PropsWithRequiredRender, SvgProps } from "@/types/props.types";
1
+ import type { PropsWithRequiredRender, SvgProps } from "../../types/props.types";
2
2
  import React from "react";
3
3
  import { IconVariants } from "./variants";
4
4
 
@@ -1,4 +1,4 @@
1
- import { useThemedStyles } from "@/utils/use-themed-styles";
1
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
2
2
  import { type IconProps } from "../icon";
3
3
 
4
4
  export function useIconVariantDefault(): IconProps {
@@ -13,6 +13,7 @@ export * from "./input";
13
13
  export * from "./link";
14
14
  export * from "./list";
15
15
  export * from "./menu";
16
+ export * from "./phone-input";
16
17
  export * from "./popover";
17
18
  export * from "./portal";
18
19
  export * from "./progress";
@@ -1,4 +1,4 @@
1
- import type { TextInputRef } from "@/types/element.types";
1
+ import type { TextInputRef } from "../../types/element.types";
2
2
  import { forwardRef, useState } from "react";
3
3
  import { StyleSheet, TextInput, type TextInputProps } from "react-native";
4
4
  import { useFieldOptional } from "../field/context";
@@ -1,9 +1,15 @@
1
- import { useNumericMask, type NumericMaskFormat } from "@/hooks/use-numeric-mask";
2
1
  import React, { useEffect } from "react";
2
+ import {
3
+ useNumericMask,
4
+ type NumericMaskFormat,
5
+ } from "../../hooks/use-numeric-mask";
3
6
  import { Input, type InputProps } from "./input";
4
7
  import { InputVariants } from "./variants";
5
8
 
6
- export interface NumericInputProps extends Omit<InputProps, "value" | "onChange" | "keyboardType"> {
9
+ export interface NumericInputProps extends Omit<
10
+ InputProps,
11
+ "value" | "onChange" | "keyboardType"
12
+ > {
7
13
  variant?: keyof typeof InputVariants;
8
14
  value?: number | null;
9
15
  onChange?: (value: number | null) => void;
@@ -1,5 +1,6 @@
1
- import { type InputStyles } from "@/components";
2
- import { useThemedStyles } from "@/utils/use-themed-styles";
1
+ import { Platform } from "react-native";
2
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
+ import { type InputStyles } from "../types";
3
4
 
4
5
  export function useInputVariantDefault(): InputStyles {
5
6
  return useThemedStyles(
@@ -14,11 +15,17 @@ export function useInputVariantDefault(): InputStyles {
14
15
  backgroundColor: colors.surface,
15
16
  paddingVertical: 12,
16
17
  paddingHorizontal: 16,
17
- outlineWidth: 0,
18
18
  fontFamily,
19
19
  fontSize,
20
20
  height: 48,
21
21
  color: colors.foreground,
22
+ outlineWidth: 0,
23
+ ...Platform.select({
24
+ default: {},
25
+ web: {
26
+ outline: "none",
27
+ },
28
+ }),
22
29
  },
23
30
  },
24
31
  focused: {
@@ -1,5 +1,6 @@
1
- import { type InputStyles } from "@/components";
2
- import { useThemedStyles } from "@/utils/use-themed-styles";
1
+ import { Platform } from "react-native";
2
+ import { type InputStyles } from "../..";
3
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
4
 
4
5
  export function useInputVariantSecondary(): InputStyles {
5
6
  return useThemedStyles(
@@ -14,11 +15,17 @@ export function useInputVariantSecondary(): InputStyles {
14
15
  backgroundColor: colors.background,
15
16
  paddingVertical: 12,
16
17
  paddingHorizontal: 16,
17
- outlineWidth: 0,
18
18
  fontFamily,
19
19
  fontSize,
20
20
  height: 48,
21
21
  color: colors.foreground,
22
+ outlineWidth: 0,
23
+ ...Platform.select({
24
+ default: {},
25
+ web: {
26
+ outline: "none",
27
+ },
28
+ }),
22
29
  },
23
30
  },
24
31
  focused: {
@@ -1,5 +1,5 @@
1
- import { useThemedStyles } from "@/utils/use-themed-styles";
2
1
  import { type TextStyle } from "react-native";
2
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
3
 
4
4
  export function useLinkVariantDefault(): TextStyle {
5
5
  return useThemedStyles(
@@ -9,6 +9,6 @@ export function useLinkVariantDefault(): TextStyle {
9
9
  fontFamily,
10
10
  textDecorationLine: "underline",
11
11
  letterSpacing,
12
- })
12
+ }),
13
13
  );
14
14
  }
@@ -1,4 +1,4 @@
1
- import { useRelativePosition } from "@/hooks/use-relative-position";
1
+ import { useRelativePosition } from "../../../hooks/use-relative-position";
2
2
  import React from "react";
3
3
  import { type StyleProp, View, type ViewStyle } from "react-native";
4
4
  import { useMenu } from "../context";
@@ -1,4 +1,4 @@
1
- import { DEFAULT_LAYOUT, DEFAULT_POSITION, type LayoutPosition } from "@/hooks/use-relative-position";
1
+ import { DEFAULT_LAYOUT, DEFAULT_POSITION, type LayoutPosition } from "../../../hooks/use-relative-position";
2
2
  import React, { useState } from "react";
3
3
  import { type LayoutRectangle } from "react-native";
4
4
  import { MenuContext } from "../context";
@@ -1,7 +1,7 @@
1
- import type { ViewRef } from "@/types/element.types";
2
- import { measureLayoutPosition } from "@/utils/normalize-layout";
3
1
  import React, { forwardRef, useImperativeHandle, useRef } from "react";
4
2
  import { type PressableProps } from "react-native";
3
+ import type { ViewRef } from "../../../types/element.types";
4
+ import { measureLayoutPosition } from "../../../utils/normalize-layout";
5
5
  import { useMenu } from "../context";
6
6
 
7
7
  export interface MenuTriggerProps extends PressableProps {
@@ -13,45 +13,47 @@ export interface MenuTriggerRef {
13
13
  close: () => void;
14
14
  }
15
15
 
16
- export const MenuTrigger = forwardRef<MenuTriggerRef, MenuTriggerProps>((props, ref) => {
17
- const menu = useMenu();
18
- const triggerRef = useRef<ViewRef>(null);
16
+ export const MenuTrigger = forwardRef<MenuTriggerRef, MenuTriggerProps>(
17
+ (props, ref) => {
18
+ const menu = useMenu();
19
+ const triggerRef = useRef<ViewRef>(null);
19
20
 
20
- const onTriggerPress = async () => {
21
- if (!menu.isOpen) {
22
- measureLayoutPosition(triggerRef.current, (layout) => {
23
- menu.setTriggerPosition(layout);
24
- menu.setIsOpen(true);
25
- });
26
- } else {
27
- menu.setIsOpen(false);
28
- }
29
- };
21
+ const onTriggerPress = async () => {
22
+ if (!menu.isOpen) {
23
+ measureLayoutPosition(triggerRef.current, (layout) => {
24
+ menu.setTriggerPosition(layout);
25
+ menu.setIsOpen(true);
26
+ });
27
+ } else {
28
+ menu.setIsOpen(false);
29
+ }
30
+ };
30
31
 
31
- useImperativeHandle(ref, () => ({
32
- open: () => {
33
- triggerRef.current?.measureInWindow((pageX, pageY, width, height) => {
34
- menu.setTriggerPosition({
35
- height,
36
- width,
37
- pageX,
38
- pageY,
32
+ useImperativeHandle(ref, () => ({
33
+ open: () => {
34
+ triggerRef.current?.measureInWindow((pageX, pageY, width, height) => {
35
+ menu.setTriggerPosition({
36
+ height,
37
+ width,
38
+ pageX,
39
+ pageY,
40
+ });
41
+ menu.setIsOpen(true);
39
42
  });
40
- menu.setIsOpen(true);
41
- });
42
- },
43
- close: () => menu.setIsOpen(false),
44
- }));
43
+ },
44
+ close: () => menu.setIsOpen(false),
45
+ }));
45
46
 
46
- return React.cloneElement(props.children, {
47
- ref: triggerRef,
48
- onPress: onTriggerPress,
49
- role: "button",
50
- accessible: true,
51
- accessibilityRole: "button",
52
- accessibilityState: { expanded: menu.isOpen },
53
- ...props.children.props,
54
- });
55
- });
47
+ return React.cloneElement(props.children, {
48
+ ref: triggerRef,
49
+ onPress: onTriggerPress,
50
+ role: "button",
51
+ accessible: true,
52
+ accessibilityRole: "button",
53
+ accessibilityState: { expanded: menu.isOpen },
54
+ ...props.children.props,
55
+ });
56
+ },
57
+ );
56
58
 
57
59
  MenuTrigger.displayName = "MenuTrigger";
@@ -1,4 +1,4 @@
1
- import type { LayoutPosition } from "@/hooks/use-relative-position";
1
+ import type { LayoutPosition } from "../../hooks/use-relative-position";
2
2
  import { createContext, type Dispatch, useContext } from "react";
3
3
  import type { LayoutRectangle } from "react-native";
4
4
  import type { MenuStyles } from "./types";
@@ -1,5 +1,5 @@
1
- import { type MenuStyles } from "@/components";
2
- import { useThemedStyles } from "@/utils/use-themed-styles";
1
+ import { type MenuStyles } from "../..";
2
+ import { useThemedStyles } from "../../../utils/use-themed-styles";
3
3
 
4
4
  export const useMenuVariantDefault = (): MenuStyles => {
5
5
  return useThemedStyles(
@@ -0,0 +1,2 @@
1
+ export { PhoneInput, type PhoneInputProps } from "./phone-input";
2
+ export type { PhoneInputState, PhoneInputStyles } from "./types";
@@ -0,0 +1,220 @@
1
+ import type { CountryData } from "../../data/countries";
2
+ import { usePhoneMask } from "../../hooks/use-phone-mask";
3
+ import { DEFAULT_LAYOUT, DEFAULT_POSITION, type LayoutPosition, useRelativePosition } from "../../hooks/use-relative-position";
4
+ import type { ViewRef } from "../../types/element.types";
5
+ import { measureLayoutPosition } from "../../utils/normalize-layout";
6
+ import React, { useRef, useState } from "react";
7
+ import {
8
+ Keyboard,
9
+ type LayoutRectangle,
10
+ Platform,
11
+ Pressable,
12
+ ScrollView,
13
+ type StyleProp,
14
+ StyleSheet,
15
+ Text,
16
+ TextInput,
17
+ View,
18
+ type ViewStyle,
19
+ } from "react-native";
20
+ import { Portal } from "../portal";
21
+ import type { PhoneInputState } from "./types";
22
+ import { PhoneInputVariants } from "./variants";
23
+
24
+ export interface PhoneInputProps {
25
+ value?: string;
26
+ onChange?: (value: string) => void;
27
+ defaultCountry?: string;
28
+ countries?: CountryData[];
29
+ placeholder?: string;
30
+ isDisabled?: boolean;
31
+ variant?: keyof typeof PhoneInputVariants;
32
+ style?: StyleProp<ViewStyle>;
33
+ }
34
+
35
+ const calculateState = (isDisabled: boolean, isFocused: boolean): PhoneInputState => {
36
+ if (isDisabled) return "disabled";
37
+ if (isFocused) return "focused";
38
+ return "default";
39
+ };
40
+
41
+ export function PhoneInput({
42
+ value,
43
+ onChange,
44
+ defaultCountry = "US",
45
+ countries,
46
+ placeholder,
47
+ isDisabled = false,
48
+ variant = "default",
49
+ style,
50
+ }: PhoneInputProps) {
51
+ const variantStyles = PhoneInputVariants[variant]();
52
+ const [isFocused, setIsFocused] = useState(false);
53
+ const [isPickerOpen, setIsPickerOpen] = useState(false);
54
+ const [searchQuery, setSearchQuery] = useState("");
55
+ const [triggerPosition, setTriggerPosition] = useState<LayoutPosition>(DEFAULT_POSITION);
56
+ const [contentLayout, setContentLayout] = useState<LayoutRectangle>(DEFAULT_LAYOUT);
57
+ const triggerRef = useRef<ViewRef>(null);
58
+
59
+ const state = calculateState(isDisabled, isFocused);
60
+
61
+ const phoneMask = usePhoneMask({
62
+ value,
63
+ defaultCountry,
64
+ onChange,
65
+ countries,
66
+ });
67
+
68
+ const rootStyles = StyleSheet.flatten([variantStyles.root?.default, variantStyles.root?.[state], style]);
69
+ const countryButtonStyles = StyleSheet.flatten([variantStyles.countryButton?.default, variantStyles.countryButton?.[state]]);
70
+ const countryButtonTextStyles = StyleSheet.flatten([variantStyles.countryButtonText?.default, variantStyles.countryButtonText?.[state]]);
71
+ const separatorStyles = StyleSheet.flatten([variantStyles.separator?.default, variantStyles.separator?.[state]]);
72
+ const inputStyles = StyleSheet.flatten([variantStyles.input?.default, variantStyles.input?.[state]]);
73
+
74
+ const openPicker = () => {
75
+ if (isDisabled) return;
76
+ if (Platform.OS !== "web") {
77
+ Keyboard.dismiss();
78
+ }
79
+ measureLayoutPosition(triggerRef.current, (layout) => {
80
+ setTriggerPosition(layout);
81
+ setSearchQuery("");
82
+ setIsPickerOpen(true);
83
+ });
84
+ };
85
+
86
+ const closePicker = () => {
87
+ setIsPickerOpen(false);
88
+ setSearchQuery("");
89
+ };
90
+
91
+ const selectCountry = (country: CountryData) => {
92
+ phoneMask.setCountry(country.code);
93
+ closePicker();
94
+ };
95
+
96
+ const filteredCountries = searchQuery
97
+ ? phoneMask.countries.filter((c) => c.name.toLowerCase().includes(searchQuery.toLowerCase()))
98
+ : phoneMask.countries;
99
+
100
+ return (
101
+ <>
102
+ <View ref={triggerRef} style={rootStyles}>
103
+ <Pressable onPress={openPicker} disabled={isDisabled} style={countryButtonStyles}>
104
+ <Text style={countryButtonTextStyles}>
105
+ {phoneMask.country.flag} +{phoneMask.country.dialCode}
106
+ </Text>
107
+ </Pressable>
108
+ <View style={separatorStyles} />
109
+ <TextInput
110
+ value={phoneMask.displayValue}
111
+ onChangeText={phoneMask.onChangeText}
112
+ keyboardType={phoneMask.keyboardType}
113
+ placeholder={placeholder}
114
+ placeholderTextColor={StyleSheet.flatten(variantStyles.countryButtonText?.disabled)?.color}
115
+ readOnly={isDisabled}
116
+ onFocus={() => setIsFocused(true)}
117
+ onBlur={() => setIsFocused(false)}
118
+ style={inputStyles}
119
+ />
120
+ </View>
121
+
122
+ {isPickerOpen && (
123
+ <CountryPicker
124
+ countries={filteredCountries}
125
+ selectedCode={phoneMask.country.code}
126
+ searchQuery={searchQuery}
127
+ onSearchChange={setSearchQuery}
128
+ onSelect={selectCountry}
129
+ onClose={closePicker}
130
+ triggerPosition={triggerPosition}
131
+ contentLayout={contentLayout}
132
+ onContentLayout={setContentLayout}
133
+ variantStyles={variantStyles}
134
+ state={state}
135
+ />
136
+ )}
137
+ </>
138
+ );
139
+ }
140
+
141
+ interface CountryPickerProps {
142
+ countries: CountryData[];
143
+ selectedCode: string;
144
+ searchQuery: string;
145
+ onSearchChange: (query: string) => void;
146
+ onSelect: (country: CountryData) => void;
147
+ onClose: () => void;
148
+ triggerPosition: LayoutPosition;
149
+ contentLayout: LayoutRectangle;
150
+ onContentLayout: (layout: LayoutRectangle) => void;
151
+ variantStyles: ReturnType<(typeof PhoneInputVariants)["default"]>;
152
+ state: PhoneInputState;
153
+ }
154
+
155
+ function CountryPicker({
156
+ countries,
157
+ selectedCode,
158
+ searchQuery,
159
+ onSearchChange,
160
+ onSelect,
161
+ onClose,
162
+ triggerPosition,
163
+ contentLayout,
164
+ onContentLayout,
165
+ variantStyles,
166
+ state,
167
+ }: CountryPickerProps) {
168
+ const positionStyle = useRelativePosition({
169
+ align: "start",
170
+ triggerPosition,
171
+ contentLayout,
172
+ alignOffset: 0,
173
+ preferredSide: "bottom",
174
+ sideOffset: 4,
175
+ });
176
+
177
+ const overlayStyles = StyleSheet.flatten([variantStyles.pickerOverlay?.default, variantStyles.pickerOverlay?.[state]]);
178
+ const contentStyles = StyleSheet.flatten([variantStyles.pickerContent?.default, variantStyles.pickerContent?.[state]]);
179
+ const searchStyles = StyleSheet.flatten([variantStyles.pickerSearch?.default, variantStyles.pickerSearch?.[state]]);
180
+
181
+ return (
182
+ <Portal name="phone-input-country-picker">
183
+ <Pressable onPress={onClose} style={[StyleSheet.absoluteFill, overlayStyles]} />
184
+ <View
185
+ style={[positionStyle, contentStyles, { width: triggerPosition.width }]}
186
+ onLayout={(e) => onContentLayout(e.nativeEvent.layout)}
187
+ pointerEvents="box-none"
188
+ >
189
+ <TextInput
190
+ value={searchQuery}
191
+ onChangeText={onSearchChange}
192
+ placeholder="Search countries..."
193
+ autoFocus
194
+ style={searchStyles}
195
+ />
196
+ <ScrollView keyboardShouldPersistTaps="handled">
197
+ {countries.map((country) => {
198
+ const isSelected = country.code === selectedCode;
199
+ const optionStyles = StyleSheet.flatten([
200
+ variantStyles.pickerOption?.default,
201
+ isSelected && variantStyles.pickerOption?.selected,
202
+ ]);
203
+ const optionTextStyles = StyleSheet.flatten([
204
+ variantStyles.pickerOptionText?.default,
205
+ isSelected && variantStyles.pickerOptionText?.selected,
206
+ ]);
207
+
208
+ return (
209
+ <Pressable key={country.code} onPress={() => onSelect(country)} style={optionStyles}>
210
+ <Text style={optionTextStyles}>
211
+ {country.flag} {country.name} +{country.dialCode}
212
+ </Text>
213
+ </Pressable>
214
+ );
215
+ })}
216
+ </ScrollView>
217
+ </View>
218
+ </Portal>
219
+ );
220
+ }
@@ -0,0 +1,20 @@
1
+ import type { StyleProp, TextStyle, ViewStyle } from "react-native";
2
+
3
+ export type PhoneInputState = "default" | "focused" | "disabled";
4
+
5
+ export interface PhoneInputStyles {
6
+ root?: Partial<Record<PhoneInputState, StyleProp<ViewStyle>>>;
7
+ countryButton?: Partial<Record<PhoneInputState, StyleProp<ViewStyle>>>;
8
+ countryButtonText?: Partial<Record<PhoneInputState, StyleProp<TextStyle>>>;
9
+ separator?: Partial<Record<PhoneInputState, StyleProp<ViewStyle>>>;
10
+ input?: Partial<Record<PhoneInputState, StyleProp<TextStyle>>>;
11
+ pickerOverlay?: Partial<Record<PhoneInputState, StyleProp<ViewStyle>>>;
12
+ pickerContent?: Partial<Record<PhoneInputState, StyleProp<ViewStyle>>>;
13
+ pickerOption?: Partial<
14
+ Record<PhoneInputState | "selected", StyleProp<ViewStyle>>
15
+ >;
16
+ pickerOptionText?: Partial<
17
+ Record<PhoneInputState | "selected", StyleProp<TextStyle>>
18
+ >;
19
+ pickerSearch?: Partial<Record<PhoneInputState, StyleProp<TextStyle>>>;
20
+ }