@scripso-homepad/ui 0.3.6 → 0.3.8

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 (38) hide show
  1. package/README.md +238 -79
  2. package/dist/index.cjs +1225 -85
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +324 -18
  5. package/dist/index.d.ts +324 -18
  6. package/dist/index.js +1204 -89
  7. package/dist/index.js.map +1 -1
  8. package/package.json +18 -6
  9. package/src/components/Button.stories.tsx +77 -57
  10. package/src/components/Button.tsx +154 -123
  11. package/src/components/CountryCodeSelector.stories.tsx +61 -0
  12. package/src/components/CountryCodeSelector.tsx +273 -0
  13. package/src/components/Input.stories.tsx +126 -0
  14. package/src/components/Input.tsx +221 -0
  15. package/src/components/Label.tsx +56 -0
  16. package/src/components/PhoneInput.stories.tsx +85 -0
  17. package/src/components/PhoneInput.tsx +172 -0
  18. package/src/data/countries.ts +98 -0
  19. package/src/icons/ArrowUpRightIcon.tsx +29 -0
  20. package/src/icons/ArrowUpRightIcon.web.tsx +35 -0
  21. package/src/icons/ChevronDownIcon.tsx +29 -0
  22. package/src/icons/ChevronDownIcon.web.tsx +35 -0
  23. package/src/icons/EyeIcon.tsx +36 -0
  24. package/src/icons/EyeIcon.web.tsx +42 -0
  25. package/src/icons/EyeOffIcon.tsx +29 -0
  26. package/src/icons/EyeOffIcon.web.tsx +35 -0
  27. package/src/icons/KeyIcon.tsx +36 -0
  28. package/src/icons/KeyIcon.web.tsx +42 -0
  29. package/src/icons/arrowUpRightPath.ts +2 -0
  30. package/src/icons/chevronDownPath.ts +1 -0
  31. package/src/icons/eyeIconPaths.ts +8 -0
  32. package/src/icons/keyIconPaths.ts +5 -0
  33. package/src/index.ts +42 -0
  34. package/src/theme/input.ts +154 -0
  35. package/src/theme/tokens.ts +272 -0
  36. package/src/utils/countryDropdownScrollStyles.ts +52 -0
  37. package/src/utils/countryFlag.ts +9 -0
  38. package/src/utils/useApplyWebClassName.ts +3 -2
@@ -0,0 +1,98 @@
1
+ export type Country = {
2
+ code: string;
3
+ name: string;
4
+ dialCode: string;
5
+ };
6
+
7
+ export const defaultCountry: Country = {
8
+ code: "AM",
9
+ name: "Armenia",
10
+ dialCode: "+374",
11
+ };
12
+
13
+ export const countries: Country[] = [
14
+ defaultCountry,
15
+ { code: "AF", name: "Afghanistan", dialCode: "+93" },
16
+ { code: "AL", name: "Albania", dialCode: "+355" },
17
+ { code: "DZ", name: "Algeria", dialCode: "+213" },
18
+ { code: "AR", name: "Argentina", dialCode: "+54" },
19
+ { code: "AU", name: "Australia", dialCode: "+61" },
20
+ { code: "AT", name: "Austria", dialCode: "+43" },
21
+ { code: "AZ", name: "Azerbaijan", dialCode: "+994" },
22
+ { code: "BH", name: "Bahrain", dialCode: "+973" },
23
+ { code: "BY", name: "Belarus", dialCode: "+375" },
24
+ { code: "BE", name: "Belgium", dialCode: "+32" },
25
+ { code: "BR", name: "Brazil", dialCode: "+55" },
26
+ { code: "BG", name: "Bulgaria", dialCode: "+359" },
27
+ { code: "CA", name: "Canada", dialCode: "+1" },
28
+ { code: "CL", name: "Chile", dialCode: "+56" },
29
+ { code: "CN", name: "China", dialCode: "+86" },
30
+ { code: "CO", name: "Colombia", dialCode: "+57" },
31
+ { code: "HR", name: "Croatia", dialCode: "+385" },
32
+ { code: "CY", name: "Cyprus", dialCode: "+357" },
33
+ { code: "CZ", name: "Czech Republic", dialCode: "+420" },
34
+ { code: "DK", name: "Denmark", dialCode: "+45" },
35
+ { code: "EG", name: "Egypt", dialCode: "+20" },
36
+ { code: "EE", name: "Estonia", dialCode: "+372" },
37
+ { code: "FI", name: "Finland", dialCode: "+358" },
38
+ { code: "FR", name: "France", dialCode: "+33" },
39
+ { code: "GE", name: "Georgia", dialCode: "+995" },
40
+ { code: "DE", name: "Germany", dialCode: "+49" },
41
+ { code: "GR", name: "Greece", dialCode: "+30" },
42
+ { code: "HK", name: "Hong Kong", dialCode: "+852" },
43
+ { code: "HU", name: "Hungary", dialCode: "+36" },
44
+ { code: "IN", name: "India", dialCode: "+91" },
45
+ { code: "ID", name: "Indonesia", dialCode: "+62" },
46
+ { code: "IR", name: "Iran", dialCode: "+98" },
47
+ { code: "IQ", name: "Iraq", dialCode: "+964" },
48
+ { code: "IE", name: "Ireland", dialCode: "+353" },
49
+ { code: "IL", name: "Israel", dialCode: "+972" },
50
+ { code: "IT", name: "Italy", dialCode: "+39" },
51
+ { code: "JP", name: "Japan", dialCode: "+81" },
52
+ { code: "JO", name: "Jordan", dialCode: "+962" },
53
+ { code: "KZ", name: "Kazakhstan", dialCode: "+7" },
54
+ { code: "KW", name: "Kuwait", dialCode: "+965" },
55
+ { code: "LV", name: "Latvia", dialCode: "+371" },
56
+ { code: "LB", name: "Lebanon", dialCode: "+961" },
57
+ { code: "LT", name: "Lithuania", dialCode: "+370" },
58
+ { code: "LU", name: "Luxembourg", dialCode: "+352" },
59
+ { code: "MY", name: "Malaysia", dialCode: "+60" },
60
+ { code: "MX", name: "Mexico", dialCode: "+52" },
61
+ { code: "MD", name: "Moldova", dialCode: "+373" },
62
+ { code: "NL", name: "Netherlands", dialCode: "+31" },
63
+ { code: "NZ", name: "New Zealand", dialCode: "+64" },
64
+ { code: "NG", name: "Nigeria", dialCode: "+234" },
65
+ { code: "NO", name: "Norway", dialCode: "+47" },
66
+ { code: "PK", name: "Pakistan", dialCode: "+92" },
67
+ { code: "PS", name: "Palestine", dialCode: "+970" },
68
+ { code: "PH", name: "Philippines", dialCode: "+63" },
69
+ { code: "PL", name: "Poland", dialCode: "+48" },
70
+ { code: "PT", name: "Portugal", dialCode: "+351" },
71
+ { code: "QA", name: "Qatar", dialCode: "+974" },
72
+ { code: "RO", name: "Romania", dialCode: "+40" },
73
+ { code: "RU", name: "Russia", dialCode: "+7" },
74
+ { code: "SA", name: "Saudi Arabia", dialCode: "+966" },
75
+ { code: "RS", name: "Serbia", dialCode: "+381" },
76
+ { code: "SG", name: "Singapore", dialCode: "+65" },
77
+ { code: "SK", name: "Slovakia", dialCode: "+421" },
78
+ { code: "SI", name: "Slovenia", dialCode: "+386" },
79
+ { code: "ZA", name: "South Africa", dialCode: "+27" },
80
+ { code: "KR", name: "South Korea", dialCode: "+82" },
81
+ { code: "ES", name: "Spain", dialCode: "+34" },
82
+ { code: "SE", name: "Sweden", dialCode: "+46" },
83
+ { code: "CH", name: "Switzerland", dialCode: "+41" },
84
+ { code: "SY", name: "Syria", dialCode: "+963" },
85
+ { code: "TW", name: "Taiwan", dialCode: "+886" },
86
+ { code: "TH", name: "Thailand", dialCode: "+66" },
87
+ { code: "TR", name: "Turkey", dialCode: "+90" },
88
+ { code: "UA", name: "Ukraine", dialCode: "+380" },
89
+ { code: "AE", name: "United Arab Emirates", dialCode: "+971" },
90
+ { code: "GB", name: "United Kingdom", dialCode: "+44" },
91
+ { code: "US", name: "United States", dialCode: "+1" },
92
+ { code: "UZ", name: "Uzbekistan", dialCode: "+998" },
93
+ { code: "VN", name: "Vietnam", dialCode: "+84" },
94
+ ];
95
+
96
+ export function findCountry(code: string): Country {
97
+ return countries.find((country) => country.code === code) ?? defaultCountry;
98
+ }
@@ -0,0 +1,29 @@
1
+ import Svg, { Path } from "react-native-svg";
2
+ import { ARROW_UP_RIGHT_PATH } from "./arrowUpRightPath";
3
+
4
+ export { ARROW_UP_RIGHT_PATH } from "./arrowUpRightPath";
5
+
6
+ interface ArrowUpRightIconProps {
7
+ size?: number;
8
+ color?: string;
9
+ strokeWidth?: number;
10
+ }
11
+
12
+ /** Native — react-native-svg (peer dependency). */
13
+ export function ArrowUpRightIcon({
14
+ size = 20,
15
+ color = "#08275d",
16
+ strokeWidth = 2,
17
+ }: ArrowUpRightIconProps) {
18
+ return (
19
+ <Svg width={size} height={size} viewBox="0 0 20 20" fill="none">
20
+ <Path
21
+ d={ARROW_UP_RIGHT_PATH}
22
+ stroke={color}
23
+ strokeWidth={strokeWidth}
24
+ strokeLinecap="round"
25
+ strokeLinejoin="round"
26
+ />
27
+ </Svg>
28
+ );
29
+ }
@@ -0,0 +1,35 @@
1
+ import { ARROW_UP_RIGHT_PATH } from "./arrowUpRightPath";
2
+
3
+ interface ArrowUpRightIconProps {
4
+ size?: number;
5
+ color?: string;
6
+ strokeWidth?: number;
7
+ }
8
+
9
+ /** Web / Storybook — plain SVG (no react-native-svg). */
10
+ export function ArrowUpRightIcon({
11
+ size = 20,
12
+ color = "#08275d",
13
+ strokeWidth = 2,
14
+ }: ArrowUpRightIconProps) {
15
+ return (
16
+ <svg
17
+ width={size}
18
+ height={size}
19
+ viewBox="0 0 20 20"
20
+ fill="none"
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ aria-hidden
23
+ >
24
+ <path
25
+ d={ARROW_UP_RIGHT_PATH}
26
+ stroke={color}
27
+ strokeWidth={strokeWidth}
28
+ strokeLinecap="round"
29
+ strokeLinejoin="round"
30
+ />
31
+ </svg>
32
+ );
33
+ }
34
+
35
+ export { ARROW_UP_RIGHT_PATH } from "./arrowUpRightPath";
@@ -0,0 +1,29 @@
1
+ import Svg, { Path } from "react-native-svg";
2
+ import { CHEVRON_DOWN_PATH } from "./chevronDownPath";
3
+
4
+ export { CHEVRON_DOWN_PATH } from "./chevronDownPath";
5
+
6
+ interface ChevronDownIconProps {
7
+ size?: number;
8
+ color?: string;
9
+ strokeWidth?: number;
10
+ }
11
+
12
+ /** Native — react-native-svg (peer dependency). */
13
+ export function ChevronDownIcon({
14
+ size = 16,
15
+ color = "#dadde0",
16
+ strokeWidth = 2,
17
+ }: ChevronDownIconProps) {
18
+ return (
19
+ <Svg width={size} height={size} viewBox="0 0 16 16" fill="none">
20
+ <Path
21
+ d={CHEVRON_DOWN_PATH}
22
+ stroke={color}
23
+ strokeWidth={strokeWidth}
24
+ strokeLinecap="round"
25
+ strokeLinejoin="round"
26
+ />
27
+ </Svg>
28
+ );
29
+ }
@@ -0,0 +1,35 @@
1
+ import { CHEVRON_DOWN_PATH } from "./chevronDownPath";
2
+
3
+ interface ChevronDownIconProps {
4
+ size?: number;
5
+ color?: string;
6
+ strokeWidth?: number;
7
+ }
8
+
9
+ /** Web / Storybook — plain SVG (no react-native-svg). */
10
+ export function ChevronDownIcon({
11
+ size = 16,
12
+ color = "#dadde0",
13
+ strokeWidth = 2,
14
+ }: ChevronDownIconProps) {
15
+ return (
16
+ <svg
17
+ width={size}
18
+ height={size}
19
+ viewBox="0 0 16 16"
20
+ fill="none"
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ aria-hidden
23
+ >
24
+ <path
25
+ d={CHEVRON_DOWN_PATH}
26
+ stroke={color}
27
+ strokeWidth={strokeWidth}
28
+ strokeLinecap="round"
29
+ strokeLinejoin="round"
30
+ />
31
+ </svg>
32
+ );
33
+ }
34
+
35
+ export { CHEVRON_DOWN_PATH } from "./chevronDownPath";
@@ -0,0 +1,36 @@
1
+ import Svg, { Path } from "react-native-svg";
2
+ import { EYE_OPEN_OUTLINE_PATH, EYE_OPEN_PUPIL_PATH } from "./eyeIconPaths";
3
+
4
+ export { EYE_OPEN_OUTLINE_PATH, EYE_OPEN_PUPIL_PATH } from "./eyeIconPaths";
5
+
6
+ interface EyeIconProps {
7
+ size?: number;
8
+ color?: string;
9
+ strokeWidth?: number;
10
+ }
11
+
12
+ /** Native — open eye (password hidden). */
13
+ export function EyeIcon({
14
+ size = 20,
15
+ color = "#c7cdd1",
16
+ strokeWidth = 2,
17
+ }: EyeIconProps) {
18
+ return (
19
+ <Svg width={size} height={size} viewBox="0 0 20 20" fill="none">
20
+ <Path
21
+ d={EYE_OPEN_OUTLINE_PATH}
22
+ stroke={color}
23
+ strokeWidth={strokeWidth}
24
+ strokeLinecap="round"
25
+ strokeLinejoin="round"
26
+ />
27
+ <Path
28
+ d={EYE_OPEN_PUPIL_PATH}
29
+ stroke={color}
30
+ strokeWidth={strokeWidth}
31
+ strokeLinecap="round"
32
+ strokeLinejoin="round"
33
+ />
34
+ </Svg>
35
+ );
36
+ }
@@ -0,0 +1,42 @@
1
+ import { EYE_OPEN_OUTLINE_PATH, EYE_OPEN_PUPIL_PATH } from "./eyeIconPaths";
2
+
3
+ interface EyeIconProps {
4
+ size?: number;
5
+ color?: string;
6
+ strokeWidth?: number;
7
+ }
8
+
9
+ /** Web — open eye (password hidden). */
10
+ export function EyeIcon({
11
+ size = 20,
12
+ color = "#c7cdd1",
13
+ strokeWidth = 2,
14
+ }: EyeIconProps) {
15
+ return (
16
+ <svg
17
+ width={size}
18
+ height={size}
19
+ viewBox="0 0 20 20"
20
+ fill="none"
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ aria-hidden
23
+ >
24
+ <path
25
+ d={EYE_OPEN_OUTLINE_PATH}
26
+ stroke={color}
27
+ strokeWidth={strokeWidth}
28
+ strokeLinecap="round"
29
+ strokeLinejoin="round"
30
+ />
31
+ <path
32
+ d={EYE_OPEN_PUPIL_PATH}
33
+ stroke={color}
34
+ strokeWidth={strokeWidth}
35
+ strokeLinecap="round"
36
+ strokeLinejoin="round"
37
+ />
38
+ </svg>
39
+ );
40
+ }
41
+
42
+ export { EYE_OPEN_OUTLINE_PATH, EYE_OPEN_PUPIL_PATH } from "./eyeIconPaths";
@@ -0,0 +1,29 @@
1
+ import Svg, { Path } from "react-native-svg";
2
+ import { EYE_OFF_PATH } from "./eyeIconPaths";
3
+
4
+ export { EYE_OFF_PATH } from "./eyeIconPaths";
5
+
6
+ interface EyeOffIconProps {
7
+ size?: number;
8
+ color?: string;
9
+ strokeWidth?: number;
10
+ }
11
+
12
+ /** Native — slashed eye (password visible). */
13
+ export function EyeOffIcon({
14
+ size = 20,
15
+ color = "#c7cdd1",
16
+ strokeWidth = 2,
17
+ }: EyeOffIconProps) {
18
+ return (
19
+ <Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
20
+ <Path
21
+ d={EYE_OFF_PATH}
22
+ stroke={color}
23
+ strokeWidth={strokeWidth}
24
+ strokeLinecap="round"
25
+ strokeLinejoin="round"
26
+ />
27
+ </Svg>
28
+ );
29
+ }
@@ -0,0 +1,35 @@
1
+ import { EYE_OFF_PATH } from "./eyeIconPaths";
2
+
3
+ interface EyeOffIconProps {
4
+ size?: number;
5
+ color?: string;
6
+ strokeWidth?: number;
7
+ }
8
+
9
+ /** Web — slashed eye (password visible). */
10
+ export function EyeOffIcon({
11
+ size = 20,
12
+ color = "#c7cdd1",
13
+ strokeWidth = 2,
14
+ }: EyeOffIconProps) {
15
+ return (
16
+ <svg
17
+ width={size}
18
+ height={size}
19
+ viewBox="0 0 24 24"
20
+ fill="none"
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ aria-hidden
23
+ >
24
+ <path
25
+ d={EYE_OFF_PATH}
26
+ stroke={color}
27
+ strokeWidth={strokeWidth}
28
+ strokeLinecap="round"
29
+ strokeLinejoin="round"
30
+ />
31
+ </svg>
32
+ );
33
+ }
34
+
35
+ export { EYE_OFF_PATH } from "./eyeIconPaths";
@@ -0,0 +1,36 @@
1
+ import Svg, { Path } from "react-native-svg";
2
+ import { KEY_ICON_BODY_PATH, KEY_ICON_DOT_PATH } from "./keyIconPaths";
3
+
4
+ export { KEY_ICON_BODY_PATH, KEY_ICON_DOT_PATH } from "./keyIconPaths";
5
+
6
+ interface KeyIconProps {
7
+ size?: number;
8
+ color?: string;
9
+ strokeWidth?: number;
10
+ }
11
+
12
+ /** Native — react-native-svg (peer dependency). */
13
+ export function KeyIcon({
14
+ size = 20,
15
+ color = "#c7cdd1",
16
+ strokeWidth = 2,
17
+ }: KeyIconProps) {
18
+ return (
19
+ <Svg width={size} height={size} viewBox="0 0 19 19" fill="none">
20
+ <Path
21
+ d={KEY_ICON_BODY_PATH}
22
+ stroke={color}
23
+ strokeWidth={strokeWidth}
24
+ strokeLinecap="round"
25
+ strokeLinejoin="round"
26
+ />
27
+ <Path
28
+ d={KEY_ICON_DOT_PATH}
29
+ stroke={color}
30
+ strokeWidth={strokeWidth}
31
+ strokeLinecap="round"
32
+ strokeLinejoin="round"
33
+ />
34
+ </Svg>
35
+ );
36
+ }
@@ -0,0 +1,42 @@
1
+ import { KEY_ICON_BODY_PATH, KEY_ICON_DOT_PATH } from "./keyIconPaths";
2
+
3
+ interface KeyIconProps {
4
+ size?: number;
5
+ color?: string;
6
+ strokeWidth?: number;
7
+ }
8
+
9
+ /** Web / Storybook — plain SVG (no react-native-svg). */
10
+ export function KeyIcon({
11
+ size = 20,
12
+ color = "#c7cdd1",
13
+ strokeWidth = 2,
14
+ }: KeyIconProps) {
15
+ return (
16
+ <svg
17
+ width={size}
18
+ height={size}
19
+ viewBox="0 0 19 19"
20
+ fill="none"
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ aria-hidden
23
+ >
24
+ <path
25
+ d={KEY_ICON_BODY_PATH}
26
+ stroke={color}
27
+ strokeWidth={strokeWidth}
28
+ strokeLinecap="round"
29
+ strokeLinejoin="round"
30
+ />
31
+ <path
32
+ d={KEY_ICON_DOT_PATH}
33
+ stroke={color}
34
+ strokeWidth={strokeWidth}
35
+ strokeLinecap="round"
36
+ strokeLinejoin="round"
37
+ />
38
+ </svg>
39
+ );
40
+ }
41
+
42
+ export { KEY_ICON_BODY_PATH, KEY_ICON_DOT_PATH } from "./keyIconPaths";
@@ -0,0 +1,2 @@
1
+ export const ARROW_UP_RIGHT_PATH =
2
+ "M14.1667 14.1668V5.8335H5.83333M14.1667 5.8335L5.83333 14.1668";
@@ -0,0 +1 @@
1
+ export const CHEVRON_DOWN_PATH = "M4 6L8 10L12 6";
@@ -0,0 +1,8 @@
1
+ export const EYE_OPEN_OUTLINE_PATH =
2
+ "M1.71835 10.2898C1.6489 10.1027 1.6489 9.89691 1.71835 9.70981C2.39476 8.06969 3.54294 6.66735 5.01732 5.68056C6.4917 4.69378 8.22588 4.16699 10 4.16699C11.7741 4.16699 13.5083 4.69378 14.9827 5.68056C16.4571 6.66735 17.6053 8.06969 18.2817 9.70981C18.3511 9.89691 18.3511 10.1027 18.2817 10.2898C17.6053 11.9299 16.4571 13.3323 14.9827 14.3191C13.5083 15.3058 11.7741 15.8326 10 15.8326C8.22588 15.8326 6.4917 15.3058 5.01732 14.3191C3.54294 13.3323 2.39476 11.9299 1.71835 10.2898Z";
3
+
4
+ export const EYE_OPEN_PUPIL_PATH =
5
+ "M10 12.4998C11.3807 12.4998 12.5 11.3805 12.5 9.99981C12.5 8.6191 11.3807 7.49981 10 7.49981C8.6193 7.49981 7.50001 8.6191 7.50001 9.99981C7.50001 11.3805 8.6193 12.4998 10 12.4998Z";
6
+
7
+ export const EYE_OFF_PATH =
8
+ "M10.733 5.076C13.0624 4.7984 15.4186 5.29082 17.4419 6.47805C19.4651 7.66528 21.0442 9.48208 21.938 11.651C22.0213 11.8755 22.0213 12.1225 21.938 12.347C21.5705 13.238 21.0848 14.0755 20.494 14.837M14.084 14.158C13.5182 14.7045 12.7604 15.0069 11.9738 15C11.1872 14.9932 10.4348 14.6777 9.87854 14.1215C9.32232 13.5652 9.00681 12.8128 8.99998 12.0262C8.99314 11.2396 9.29553 10.4818 9.842 9.916M17.479 17.499C16.1525 18.2848 14.6725 18.776 13.1394 18.9394C11.6063 19.1028 10.056 18.9345 8.59363 18.4459C7.13131 17.9573 5.79119 17.1599 4.66421 16.1077C3.53723 15.0556 2.64975 13.7734 2.062 12.348C1.97866 12.1235 1.97866 11.8765 2.062 11.652C2.94863 9.50186 4.50867 7.69725 6.508 6.509M2 2L22 22";
@@ -0,0 +1,5 @@
1
+ export const KEY_ICON_BODY_PATH =
2
+ "M1.48833 13.8769C1.17575 14.1894 1.00009 14.6132 1 15.0552V16.8652C1 17.0862 1.0878 17.2982 1.24408 17.4545C1.40036 17.6107 1.61232 17.6985 1.83333 17.6985H4.33333C4.55435 17.6985 4.76631 17.6107 4.92259 17.4545C5.07887 17.2982 5.16667 17.0862 5.16667 16.8652V16.0319C5.16667 15.8109 5.25446 15.5989 5.41074 15.4426C5.56702 15.2863 5.77899 15.1985 6 15.1985H6.83333C7.05435 15.1985 7.26631 15.1107 7.42259 14.9545C7.57887 14.7982 7.66667 14.5862 7.66667 14.3652V13.5319C7.66667 13.3109 7.75446 13.0989 7.91074 12.9426C8.06702 12.7863 8.27899 12.6985 8.5 12.6985H8.64333C9.08532 12.6984 9.50918 12.5228 9.82167 12.2102L10.5 11.5319C11.6582 11.9353 12.919 11.9338 14.0762 11.5275C15.2334 11.1212 16.2185 10.3342 16.8703 9.29531C17.5221 8.25638 17.802 7.02702 17.6643 5.80832C17.5265 4.58962 16.9793 3.45375 16.112 2.58651C15.2448 1.71928 14.1089 1.17202 12.8902 1.03428C11.6715 0.896534 10.4422 1.17645 9.40323 1.82824C8.3643 2.48003 7.57733 3.4651 7.17104 4.6223C6.76475 5.77951 6.76321 7.04034 7.16667 8.19854L1.48833 13.8769Z";
3
+
4
+ export const KEY_ICON_DOT_PATH =
5
+ "M13.0833 6.03187C13.3135 6.03187 13.5 5.84532 13.5 5.61521C13.5 5.38509 13.3135 5.19854 13.0833 5.19854C12.8532 5.19854 12.6667 5.38509 12.6667 5.61521C12.6667 5.84532 12.8532 6.03187 13.0833 6.03187Z";
package/src/index.ts CHANGED
@@ -4,3 +4,45 @@ export type {
4
4
  ButtonSize,
5
5
  ButtonVariant,
6
6
  } from "./components/Button";
7
+
8
+ export { Input } from "./components/Input";
9
+ export type { InputProps } from "./components/Input";
10
+
11
+ export { PhoneInput } from "./components/PhoneInput";
12
+ export type { PhoneInputProps } from "./components/PhoneInput";
13
+
14
+ export { CountryCodeSelector } from "./components/CountryCodeSelector";
15
+ export type { CountryCodeSelectorProps } from "./components/CountryCodeSelector";
16
+
17
+ export {
18
+ countries,
19
+ defaultCountry,
20
+ findCountry,
21
+ } from "./data/countries";
22
+ export type { Country } from "./data/countries";
23
+
24
+ export { Label } from "./components/Label";
25
+ export type { LabelProps } from "./components/Label";
26
+
27
+ export {
28
+ colors,
29
+ brand,
30
+ emeraldGreen,
31
+ navy,
32
+ rubyRed,
33
+ stormGray,
34
+ buttonTypography,
35
+ labelTypography,
36
+ fonts,
37
+ fontSize,
38
+ fontWeight,
39
+ radii,
40
+ shadows,
41
+ spacing,
42
+ } from "./theme/tokens";
43
+ export type {
44
+ EmeraldGreenStep,
45
+ NavyStep,
46
+ RubyRedStep,
47
+ StormGrayStep,
48
+ } from "./theme/tokens";
@@ -0,0 +1,154 @@
1
+ import { Platform, StyleSheet, type TextStyle, type ViewStyle } from "react-native";
2
+ import { colors, fonts, fontSize, fontWeight, radii } from "./tokens";
3
+
4
+ export const INPUT_HEIGHT = 52;
5
+ export const INPUT_ICON_SIZE = 20;
6
+ export const INPUT_ICON_GAP = 10;
7
+ export const INPUT_OUTLINE_WIDTH = 2;
8
+
9
+ export type InputVisualState =
10
+ | "default"
11
+ | "focused"
12
+ | "error"
13
+ | "disabled";
14
+
15
+ export interface InputStateFlags {
16
+ focused?: boolean;
17
+ error?: boolean;
18
+ disabled?: boolean;
19
+ }
20
+
21
+ export function resolveInputVisualState({
22
+ focused = false,
23
+ error = false,
24
+ disabled = false,
25
+ }: InputStateFlags): InputVisualState {
26
+ if (disabled) return "disabled";
27
+ if (error) return "error";
28
+ if (focused) return "focused";
29
+ return "default";
30
+ }
31
+
32
+ interface FieldStyleSet {
33
+ container: ViewStyle;
34
+ outline: ViewStyle;
35
+ text: TextStyle;
36
+ placeholder: string;
37
+ icon: string;
38
+ }
39
+
40
+ function createOutlineStyle(ringColor: string): ViewStyle {
41
+ return {
42
+ borderRadius: radii.lg + INPUT_OUTLINE_WIDTH,
43
+ borderWidth: INPUT_OUTLINE_WIDTH,
44
+ borderColor: ringColor,
45
+ padding: 0,
46
+ backgroundColor: colors.transparent,
47
+ width: "100%",
48
+ alignSelf: "stretch",
49
+ ...(Platform.OS !== "web" ? { overflow: "hidden" as const } : null),
50
+ };
51
+ }
52
+
53
+ const defaultOutline = createOutlineStyle(colors.transparent);
54
+
55
+ export function getInputFieldStyles(state: InputVisualState): FieldStyleSet {
56
+ const containerBase: ViewStyle = {
57
+ borderRadius: radii.lg,
58
+ ...(Platform.OS !== "web" ? { overflow: "hidden" as const } : null),
59
+ };
60
+
61
+ switch (state) {
62
+ case "disabled":
63
+ return {
64
+ outline: defaultOutline,
65
+ container: {
66
+ ...containerBase,
67
+ borderWidth: 1,
68
+ borderColor: colors.stormGray50,
69
+ backgroundColor: colors.stormGray50,
70
+ },
71
+ text: { color: colors.stormGray300 },
72
+ placeholder: colors.stormGray300,
73
+ icon: colors.stormGray150,
74
+ };
75
+ case "error":
76
+ return {
77
+ outline: createOutlineStyle(colors.inputOutlineError),
78
+ container: {
79
+ ...containerBase,
80
+ borderWidth: 1,
81
+ borderColor: colors.inputError,
82
+ backgroundColor: colors.white,
83
+ },
84
+ text: { color: colors.inputError },
85
+ placeholder: colors.stormGray200,
86
+ icon: colors.inputError,
87
+ };
88
+ case "focused":
89
+ return {
90
+ outline: createOutlineStyle(colors.inputOutlineFocus),
91
+ container: {
92
+ ...containerBase,
93
+ borderWidth: 1,
94
+ borderColor: colors.navy,
95
+ backgroundColor: colors.white,
96
+ },
97
+ text: { color: colors.slateBlue },
98
+ placeholder: colors.stormGray200,
99
+ icon: colors.navy,
100
+ };
101
+ default:
102
+ return {
103
+ outline: defaultOutline,
104
+ container: {
105
+ ...containerBase,
106
+ borderWidth: 1,
107
+ borderColor: colors.stormGray50,
108
+ backgroundColor: colors.white,
109
+ },
110
+ text: { color: colors.slateBlue },
111
+ placeholder: colors.stormGray200,
112
+ icon: colors.stormGray150,
113
+ };
114
+ }
115
+ }
116
+
117
+ export const inputFieldMetrics = StyleSheet.create({
118
+ container: {
119
+ flexDirection: "row",
120
+ alignItems: "center",
121
+ height: INPUT_HEIGHT,
122
+ minHeight: INPUT_HEIGHT,
123
+ maxHeight: INPUT_HEIGHT,
124
+ borderRadius: radii.lg,
125
+ padding: 16,
126
+ gap: INPUT_ICON_GAP,
127
+ ...(Platform.OS === "web"
128
+ ? ({ boxSizing: "border-box" } as ViewStyle)
129
+ : null),
130
+ },
131
+ input: {
132
+ flex: 1,
133
+ alignSelf: "stretch",
134
+ fontFamily: fonts.sans,
135
+ fontSize: fontSize.md,
136
+ fontWeight: fontWeight.medium,
137
+ lineHeight: Platform.OS === "web" ? fontSize.md : 20,
138
+ paddingVertical: 0,
139
+ paddingHorizontal: 0,
140
+ margin: 0,
141
+ borderWidth: 0,
142
+ backgroundColor: colors.transparent,
143
+ ...(Platform.OS === "android"
144
+ ? { includeFontPadding: false }
145
+ : null),
146
+ ...(Platform.OS === "web"
147
+ ? ({
148
+ height: "100%",
149
+ minHeight: 0,
150
+ outlineStyle: "none",
151
+ } as TextStyle)
152
+ : null),
153
+ },
154
+ });