@scripso-homepad/ui 0.3.8 → 0.4.0
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.
- package/dist/chunk-C7GHBVMM.js +614 -0
- package/dist/chunk-C7GHBVMM.js.map +1 -0
- package/dist/index.cjs +33 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +29 -624
- package/dist/index.js.map +1 -1
- package/dist/web/index.cjs +1211 -0
- package/dist/web/index.cjs.map +1 -0
- package/dist/web/index.d.cts +156 -0
- package/dist/web/index.d.ts +156 -0
- package/dist/web/index.js +761 -0
- package/dist/web/index.js.map +1 -0
- package/package.json +26 -2
- package/src/components/Input.tsx +12 -1
- package/src/web/hooks/useMediaQuery.ts +23 -0
- package/src/web/hooks/useOnClickOutside.ts +30 -0
- package/src/web/icons/BellIcon.tsx +27 -0
- package/src/web/icons/BuildingIcon.tsx +55 -0
- package/src/web/index.ts +37 -0
- package/src/web/layout/AppHeader.stories.tsx +85 -0
- package/src/web/layout/AppHeader.tsx +115 -0
- package/src/web/layout/BuildingSelect.stories.tsx +60 -0
- package/src/web/layout/BuildingSelect.tsx +208 -0
- package/src/web/layout/DashboardLayout.stories.tsx +87 -0
- package/src/web/layout/DashboardLayout.tsx +37 -0
- package/src/web/layout/Sidebar.stories.tsx +80 -0
- package/src/web/layout/Sidebar.tsx +244 -0
- package/src/web/layout/SidebarMobileHeader.stories.tsx +47 -0
- package/src/web/layout/SidebarMobileHeader.tsx +48 -0
- package/src/web/layout/SidebarNavItem.tsx +60 -0
- package/src/web/layout/SidebarUserCard.tsx +79 -0
- package/src/web/layout/story-fixtures.tsx +93 -0
- package/src/web/layout/story-helpers.tsx +5 -0
- package/src/web/layout/types.ts +48 -0
- package/src/web/utils/cn.ts +6 -0
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { colors, buttonTypography, fontSize, fontWeight, fonts, spacing, radii, INPUT_ICON_GAP, useApplyWebClassName, resolveInputVisualState, getInputFieldStyles, Label, inputFieldMetrics } from './chunk-C7GHBVMM.js';
|
|
2
|
+
export { Input, Label, brand, buttonTypography, colors, emeraldGreen, fontSize, fontWeight, fonts, labelTypography, navy, radii, rubyRed, shadows, spacing, stormGray } from './chunk-C7GHBVMM.js';
|
|
3
|
+
import { useRef, useState, useLayoutEffect } from 'react';
|
|
4
|
+
import { StyleSheet, Platform, TouchableOpacity, Text, View, Pressable, ScrollView, Modal, TextInput, Dimensions } from 'react-native';
|
|
3
5
|
import Svg, { Path } from 'react-native-svg';
|
|
4
6
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
7
|
|
|
6
|
-
// src/components/Button.tsx
|
|
7
|
-
|
|
8
8
|
// src/icons/arrowUpRightPath.ts
|
|
9
9
|
var ARROW_UP_RIGHT_PATH = "M14.1667 14.1668V5.8335H5.83333M14.1667 5.8335L5.83333 14.1668";
|
|
10
10
|
function ArrowUpRightIcon({
|
|
@@ -23,264 +23,6 @@ function ArrowUpRightIcon({
|
|
|
23
23
|
}
|
|
24
24
|
) });
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
// src/theme/tokens.ts
|
|
28
|
-
var stormGray = {
|
|
29
|
-
"0": "#fbfcfc",
|
|
30
|
-
"0.5": "#eceef0",
|
|
31
|
-
"1": "#dadde0",
|
|
32
|
-
"1.5": "#c7cdd1",
|
|
33
|
-
"2": "#b5bcc1",
|
|
34
|
-
"3": "#8f9aa3",
|
|
35
|
-
"4": "#6a7984",
|
|
36
|
-
"5": "#455765",
|
|
37
|
-
"6": "#374651",
|
|
38
|
-
"7": "#29343d",
|
|
39
|
-
"8": "#1c2328",
|
|
40
|
-
"8.5": "#151a1e"
|
|
41
|
-
};
|
|
42
|
-
var navy = {
|
|
43
|
-
"0": "#f8f9fb",
|
|
44
|
-
"0.5": "#e5e9ef",
|
|
45
|
-
"1": "#cdd3df",
|
|
46
|
-
"1.5": "#b4bece",
|
|
47
|
-
"2": "#9ca8be",
|
|
48
|
-
"3": "#6a7d9e",
|
|
49
|
-
"4": "#39527d",
|
|
50
|
-
"5": "#08275d",
|
|
51
|
-
"6": "#061f4a",
|
|
52
|
-
"7": "#051738",
|
|
53
|
-
"8": "#031025",
|
|
54
|
-
"8.5": "#020c1c"
|
|
55
|
-
};
|
|
56
|
-
var rubyRed = {
|
|
57
|
-
"0": "#fff5f6",
|
|
58
|
-
"0.5": "#f7dddf",
|
|
59
|
-
"1": "#efc4c8",
|
|
60
|
-
"1.5": "#e7acb1",
|
|
61
|
-
"2": "#df939a",
|
|
62
|
-
"3": "#ce626d",
|
|
63
|
-
"4": "#be313f",
|
|
64
|
-
"5": "#ae0011",
|
|
65
|
-
"6": "#8b000e",
|
|
66
|
-
"7": "#68000a",
|
|
67
|
-
"8": "#460007",
|
|
68
|
-
"8.5": "#340005"
|
|
69
|
-
};
|
|
70
|
-
var emeraldGreen = {
|
|
71
|
-
"0": "#f0fbf5",
|
|
72
|
-
"0.5": "#dcf2e5",
|
|
73
|
-
"1": "#c8e8d5",
|
|
74
|
-
"1.5": "#b4dfc5",
|
|
75
|
-
"2": "#a0d5b5",
|
|
76
|
-
"3": "#77c394",
|
|
77
|
-
"4": "#4fb074",
|
|
78
|
-
"5": "#279d54",
|
|
79
|
-
"6": "#1f7e43",
|
|
80
|
-
"7": "#175e32",
|
|
81
|
-
"8": "#103f22",
|
|
82
|
-
"8.5": "#0c2f19"
|
|
83
|
-
};
|
|
84
|
-
var brand = {
|
|
85
|
-
slateBlue: "#182e3c",
|
|
86
|
-
stormGray: stormGray["5"],
|
|
87
|
-
navy: navy["5"],
|
|
88
|
-
rubyRed: rubyRed["5"],
|
|
89
|
-
emeraldGreen: emeraldGreen["5"]
|
|
90
|
-
};
|
|
91
|
-
var colors = {
|
|
92
|
-
// Brand colors
|
|
93
|
-
slateBlue: brand.slateBlue,
|
|
94
|
-
// Emerald Green — Figma scale + brand swatch
|
|
95
|
-
emeraldGreen0: emeraldGreen["0"],
|
|
96
|
-
emeraldGreen50: emeraldGreen["0.5"],
|
|
97
|
-
emeraldGreen100: emeraldGreen["1"],
|
|
98
|
-
emeraldGreen150: emeraldGreen["1.5"],
|
|
99
|
-
emeraldGreen200: emeraldGreen["2"],
|
|
100
|
-
emeraldGreen300: emeraldGreen["3"],
|
|
101
|
-
emeraldGreen400: emeraldGreen["4"],
|
|
102
|
-
emeraldGreen500: emeraldGreen["5"],
|
|
103
|
-
emeraldGreen600: emeraldGreen["6"],
|
|
104
|
-
emeraldGreen700: emeraldGreen["7"],
|
|
105
|
-
emeraldGreen800: emeraldGreen["8"],
|
|
106
|
-
emeraldGreen850: emeraldGreen["8.5"],
|
|
107
|
-
/** Primary brand emerald green — Figma Emerald Green 5 */
|
|
108
|
-
emeraldGreen: brand.emeraldGreen,
|
|
109
|
-
// Ruby Red — Figma scale + brand swatch
|
|
110
|
-
rubyRed0: rubyRed["0"],
|
|
111
|
-
rubyRed50: rubyRed["0.5"],
|
|
112
|
-
rubyRed100: rubyRed["1"],
|
|
113
|
-
rubyRed150: rubyRed["1.5"],
|
|
114
|
-
rubyRed200: rubyRed["2"],
|
|
115
|
-
rubyRed300: rubyRed["3"],
|
|
116
|
-
rubyRed400: rubyRed["4"],
|
|
117
|
-
rubyRed500: rubyRed["5"],
|
|
118
|
-
rubyRed600: rubyRed["6"],
|
|
119
|
-
rubyRed700: rubyRed["7"],
|
|
120
|
-
rubyRed800: rubyRed["8"],
|
|
121
|
-
rubyRed850: rubyRed["8.5"],
|
|
122
|
-
/** Primary brand ruby red — Figma Ruby Red 5 */
|
|
123
|
-
rubyRed: brand.rubyRed,
|
|
124
|
-
// Navy — Figma scale + brand swatch
|
|
125
|
-
navy0: navy["0"],
|
|
126
|
-
navy50: navy["0.5"],
|
|
127
|
-
navy100: navy["1"],
|
|
128
|
-
navy150: navy["1.5"],
|
|
129
|
-
navy200: navy["2"],
|
|
130
|
-
navy300: navy["3"],
|
|
131
|
-
navy400: navy["4"],
|
|
132
|
-
navy500: navy["5"],
|
|
133
|
-
navy600: navy["6"],
|
|
134
|
-
navy700: navy["7"],
|
|
135
|
-
navy800: navy["8"],
|
|
136
|
-
navy850: navy["8.5"],
|
|
137
|
-
/** Primary brand navy — Figma Navy 5 */
|
|
138
|
-
navy: brand.navy,
|
|
139
|
-
// Storm Gray — Figma scale + brand swatch
|
|
140
|
-
stormGray0: stormGray["0"],
|
|
141
|
-
stormGray50: stormGray["0.5"],
|
|
142
|
-
stormGray100: stormGray["1"],
|
|
143
|
-
stormGray150: stormGray["1.5"],
|
|
144
|
-
stormGray200: stormGray["2"],
|
|
145
|
-
stormGray300: stormGray["3"],
|
|
146
|
-
stormGray400: stormGray["4"],
|
|
147
|
-
stormGray500: stormGray["5"],
|
|
148
|
-
/** Figma brand swatch "Storm Gray" — same as `stormGray500` */
|
|
149
|
-
stormGrayBrand: brand.stormGray,
|
|
150
|
-
stormGray600: stormGray["6"],
|
|
151
|
-
stormGray700: stormGray["7"],
|
|
152
|
-
stormGray800: stormGray["8"],
|
|
153
|
-
stormGray850: stormGray["8.5"],
|
|
154
|
-
/** @deprecated Use `stormGray0` */
|
|
155
|
-
storm0: stormGray["0"],
|
|
156
|
-
/** @deprecated Use `stormGray50` */
|
|
157
|
-
storm50: stormGray["0.5"],
|
|
158
|
-
/** @deprecated Use `stormGray200` */
|
|
159
|
-
storm200: stormGray["2"],
|
|
160
|
-
/** @deprecated Use `stormGray300` */
|
|
161
|
-
storm300: stormGray["3"],
|
|
162
|
-
/** @deprecated Use `stormGray500` */
|
|
163
|
-
storm500: stormGray["5"],
|
|
164
|
-
/** @deprecated Use `stormGray700` */
|
|
165
|
-
storm700: stormGray["7"],
|
|
166
|
-
/** @deprecated Use `stormGray850` */
|
|
167
|
-
storm900: stormGray["8.5"],
|
|
168
|
-
countrySelectorSelectedBg: `${stormGray["0.5"]}99`,
|
|
169
|
-
white: "#ffffff",
|
|
170
|
-
error: "#dc2626",
|
|
171
|
-
errorDark: "#b3261e",
|
|
172
|
-
errorLight: "#fee2e2",
|
|
173
|
-
/** @deprecated Use `rubyRed` */
|
|
174
|
-
inputError: brand.rubyRed,
|
|
175
|
-
inputOutlineFocus: navy["0.5"],
|
|
176
|
-
inputOutlineError: rubyRed["0.5"],
|
|
177
|
-
warning: "#92400e",
|
|
178
|
-
warningBg: "#fef3c7",
|
|
179
|
-
success: "#28a745",
|
|
180
|
-
successMuted: "#9fd4a8",
|
|
181
|
-
/** @deprecated Use `emeraldGreen` */
|
|
182
|
-
green: brand.emeraldGreen,
|
|
183
|
-
transparent: "transparent"
|
|
184
|
-
};
|
|
185
|
-
var radii = {
|
|
186
|
-
sm: 8,
|
|
187
|
-
md: 12,
|
|
188
|
-
lg: 16,
|
|
189
|
-
xl: 20,
|
|
190
|
-
full: 9999
|
|
191
|
-
};
|
|
192
|
-
var spacing = {
|
|
193
|
-
xs: 4,
|
|
194
|
-
sm: 8,
|
|
195
|
-
md: 12,
|
|
196
|
-
lg: 16,
|
|
197
|
-
xl: 24,
|
|
198
|
-
xxl: 32
|
|
199
|
-
};
|
|
200
|
-
var fontSize = {
|
|
201
|
-
xs: 11,
|
|
202
|
-
sm: 12,
|
|
203
|
-
md: 14,
|
|
204
|
-
base: 16,
|
|
205
|
-
lg: 18,
|
|
206
|
-
xl: 24,
|
|
207
|
-
xxl: 32
|
|
208
|
-
};
|
|
209
|
-
var fontWeight = {
|
|
210
|
-
regular: "400",
|
|
211
|
-
medium: "500",
|
|
212
|
-
semibold: "600",
|
|
213
|
-
bold: "700"
|
|
214
|
-
};
|
|
215
|
-
var fonts = {
|
|
216
|
-
sans: "Noto Sans Armenian"
|
|
217
|
-
};
|
|
218
|
-
var labelTypography = {
|
|
219
|
-
fontFamily: fonts.sans,
|
|
220
|
-
fontSize: fontSize.sm,
|
|
221
|
-
fontWeight: fontWeight.medium,
|
|
222
|
-
lineHeight: fontSize.sm,
|
|
223
|
-
letterSpacing: 0
|
|
224
|
-
};
|
|
225
|
-
var buttonTypography = {
|
|
226
|
-
lg: {
|
|
227
|
-
fontFamily: fonts.sans,
|
|
228
|
-
fontSize: 14,
|
|
229
|
-
fontWeight: fontWeight.semibold,
|
|
230
|
-
lineHeight: 18,
|
|
231
|
-
letterSpacing: 0
|
|
232
|
-
},
|
|
233
|
-
sm: {
|
|
234
|
-
fontFamily: fonts.sans,
|
|
235
|
-
fontSize: 12,
|
|
236
|
-
fontWeight: fontWeight.semibold,
|
|
237
|
-
lineHeight: 16,
|
|
238
|
-
letterSpacing: 0
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
var shadows = {
|
|
242
|
-
card: {
|
|
243
|
-
shadowColor: colors.navy,
|
|
244
|
-
shadowOffset: { width: 0, height: 4 },
|
|
245
|
-
shadowOpacity: 0.05,
|
|
246
|
-
shadowRadius: 20,
|
|
247
|
-
elevation: 2
|
|
248
|
-
},
|
|
249
|
-
cardLg: {
|
|
250
|
-
shadowColor: colors.navy,
|
|
251
|
-
shadowOffset: { width: 0, height: 4 },
|
|
252
|
-
shadowOpacity: 0.1,
|
|
253
|
-
shadowRadius: 20,
|
|
254
|
-
elevation: 4
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
function hasClassList(node) {
|
|
258
|
-
return typeof node === "object" && node !== null && "classList" in node && typeof node.classList?.add === "function";
|
|
259
|
-
}
|
|
260
|
-
function resolveWebElement(ref) {
|
|
261
|
-
const node = ref.current;
|
|
262
|
-
if (!node) return null;
|
|
263
|
-
if (hasClassList(node)) return node;
|
|
264
|
-
const host = node;
|
|
265
|
-
if (hasClassList(host._touchableNode)) return host._touchableNode;
|
|
266
|
-
if (typeof host.getScrollableNode === "function") {
|
|
267
|
-
const scrollNode = host.getScrollableNode();
|
|
268
|
-
if (hasClassList(scrollNode)) return scrollNode;
|
|
269
|
-
}
|
|
270
|
-
return null;
|
|
271
|
-
}
|
|
272
|
-
function useApplyWebClassName(ref, className, enabled = true) {
|
|
273
|
-
useLayoutEffect(() => {
|
|
274
|
-
if (!enabled || Platform.OS !== "web" || !className?.trim()) return;
|
|
275
|
-
const element = resolveWebElement(ref);
|
|
276
|
-
if (!element) return;
|
|
277
|
-
const classes = className.trim().split(/\s+/);
|
|
278
|
-
element.classList.add(...classes);
|
|
279
|
-
return () => {
|
|
280
|
-
element.classList.remove(...classes);
|
|
281
|
-
};
|
|
282
|
-
}, [ref, className, enabled]);
|
|
283
|
-
}
|
|
284
26
|
var variantConfig = {
|
|
285
27
|
white: {
|
|
286
28
|
backgroundColor: colors.white,
|
|
@@ -452,343 +194,6 @@ var styles = StyleSheet.create({
|
|
|
452
194
|
}
|
|
453
195
|
});
|
|
454
196
|
|
|
455
|
-
// src/icons/eyeIconPaths.ts
|
|
456
|
-
var EYE_OPEN_OUTLINE_PATH = "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";
|
|
457
|
-
var EYE_OPEN_PUPIL_PATH = "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";
|
|
458
|
-
var EYE_OFF_PATH = "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";
|
|
459
|
-
function EyeIcon({
|
|
460
|
-
size = 20,
|
|
461
|
-
color = "#c7cdd1",
|
|
462
|
-
strokeWidth = 2
|
|
463
|
-
}) {
|
|
464
|
-
return /* @__PURE__ */ jsxs(Svg, { width: size, height: size, viewBox: "0 0 20 20", fill: "none", children: [
|
|
465
|
-
/* @__PURE__ */ jsx(
|
|
466
|
-
Path,
|
|
467
|
-
{
|
|
468
|
-
d: EYE_OPEN_OUTLINE_PATH,
|
|
469
|
-
stroke: color,
|
|
470
|
-
strokeWidth,
|
|
471
|
-
strokeLinecap: "round",
|
|
472
|
-
strokeLinejoin: "round"
|
|
473
|
-
}
|
|
474
|
-
),
|
|
475
|
-
/* @__PURE__ */ jsx(
|
|
476
|
-
Path,
|
|
477
|
-
{
|
|
478
|
-
d: EYE_OPEN_PUPIL_PATH,
|
|
479
|
-
stroke: color,
|
|
480
|
-
strokeWidth,
|
|
481
|
-
strokeLinecap: "round",
|
|
482
|
-
strokeLinejoin: "round"
|
|
483
|
-
}
|
|
484
|
-
)
|
|
485
|
-
] });
|
|
486
|
-
}
|
|
487
|
-
function EyeOffIcon({
|
|
488
|
-
size = 20,
|
|
489
|
-
color = "#c7cdd1",
|
|
490
|
-
strokeWidth = 2
|
|
491
|
-
}) {
|
|
492
|
-
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx(
|
|
493
|
-
Path,
|
|
494
|
-
{
|
|
495
|
-
d: EYE_OFF_PATH,
|
|
496
|
-
stroke: color,
|
|
497
|
-
strokeWidth,
|
|
498
|
-
strokeLinecap: "round",
|
|
499
|
-
strokeLinejoin: "round"
|
|
500
|
-
}
|
|
501
|
-
) });
|
|
502
|
-
}
|
|
503
|
-
var INPUT_HEIGHT = 52;
|
|
504
|
-
var INPUT_ICON_SIZE = 20;
|
|
505
|
-
var INPUT_ICON_GAP = 10;
|
|
506
|
-
var INPUT_OUTLINE_WIDTH = 2;
|
|
507
|
-
function resolveInputVisualState({
|
|
508
|
-
focused = false,
|
|
509
|
-
error = false,
|
|
510
|
-
disabled = false
|
|
511
|
-
}) {
|
|
512
|
-
if (disabled) return "disabled";
|
|
513
|
-
if (error) return "error";
|
|
514
|
-
if (focused) return "focused";
|
|
515
|
-
return "default";
|
|
516
|
-
}
|
|
517
|
-
function createOutlineStyle(ringColor) {
|
|
518
|
-
return {
|
|
519
|
-
borderRadius: radii.lg + INPUT_OUTLINE_WIDTH,
|
|
520
|
-
borderWidth: INPUT_OUTLINE_WIDTH,
|
|
521
|
-
borderColor: ringColor,
|
|
522
|
-
padding: 0,
|
|
523
|
-
backgroundColor: colors.transparent,
|
|
524
|
-
width: "100%",
|
|
525
|
-
alignSelf: "stretch",
|
|
526
|
-
...Platform.OS !== "web" ? { overflow: "hidden" } : null
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
|
-
var defaultOutline = createOutlineStyle(colors.transparent);
|
|
530
|
-
function getInputFieldStyles(state) {
|
|
531
|
-
const containerBase = {
|
|
532
|
-
borderRadius: radii.lg,
|
|
533
|
-
...Platform.OS !== "web" ? { overflow: "hidden" } : null
|
|
534
|
-
};
|
|
535
|
-
switch (state) {
|
|
536
|
-
case "disabled":
|
|
537
|
-
return {
|
|
538
|
-
outline: defaultOutline,
|
|
539
|
-
container: {
|
|
540
|
-
...containerBase,
|
|
541
|
-
borderWidth: 1,
|
|
542
|
-
borderColor: colors.stormGray50,
|
|
543
|
-
backgroundColor: colors.stormGray50
|
|
544
|
-
},
|
|
545
|
-
text: { color: colors.stormGray300 },
|
|
546
|
-
placeholder: colors.stormGray300,
|
|
547
|
-
icon: colors.stormGray150
|
|
548
|
-
};
|
|
549
|
-
case "error":
|
|
550
|
-
return {
|
|
551
|
-
outline: createOutlineStyle(colors.inputOutlineError),
|
|
552
|
-
container: {
|
|
553
|
-
...containerBase,
|
|
554
|
-
borderWidth: 1,
|
|
555
|
-
borderColor: colors.inputError,
|
|
556
|
-
backgroundColor: colors.white
|
|
557
|
-
},
|
|
558
|
-
text: { color: colors.inputError },
|
|
559
|
-
placeholder: colors.stormGray200,
|
|
560
|
-
icon: colors.inputError
|
|
561
|
-
};
|
|
562
|
-
case "focused":
|
|
563
|
-
return {
|
|
564
|
-
outline: createOutlineStyle(colors.inputOutlineFocus),
|
|
565
|
-
container: {
|
|
566
|
-
...containerBase,
|
|
567
|
-
borderWidth: 1,
|
|
568
|
-
borderColor: colors.navy,
|
|
569
|
-
backgroundColor: colors.white
|
|
570
|
-
},
|
|
571
|
-
text: { color: colors.slateBlue },
|
|
572
|
-
placeholder: colors.stormGray200,
|
|
573
|
-
icon: colors.navy
|
|
574
|
-
};
|
|
575
|
-
default:
|
|
576
|
-
return {
|
|
577
|
-
outline: defaultOutline,
|
|
578
|
-
container: {
|
|
579
|
-
...containerBase,
|
|
580
|
-
borderWidth: 1,
|
|
581
|
-
borderColor: colors.stormGray50,
|
|
582
|
-
backgroundColor: colors.white
|
|
583
|
-
},
|
|
584
|
-
text: { color: colors.slateBlue },
|
|
585
|
-
placeholder: colors.stormGray200,
|
|
586
|
-
icon: colors.stormGray150
|
|
587
|
-
};
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
var inputFieldMetrics = StyleSheet.create({
|
|
591
|
-
container: {
|
|
592
|
-
flexDirection: "row",
|
|
593
|
-
alignItems: "center",
|
|
594
|
-
height: INPUT_HEIGHT,
|
|
595
|
-
minHeight: INPUT_HEIGHT,
|
|
596
|
-
maxHeight: INPUT_HEIGHT,
|
|
597
|
-
borderRadius: radii.lg,
|
|
598
|
-
padding: 16,
|
|
599
|
-
gap: INPUT_ICON_GAP,
|
|
600
|
-
...Platform.OS === "web" ? { boxSizing: "border-box" } : null
|
|
601
|
-
},
|
|
602
|
-
input: {
|
|
603
|
-
flex: 1,
|
|
604
|
-
alignSelf: "stretch",
|
|
605
|
-
fontFamily: fonts.sans,
|
|
606
|
-
fontSize: fontSize.md,
|
|
607
|
-
fontWeight: fontWeight.medium,
|
|
608
|
-
lineHeight: Platform.OS === "web" ? fontSize.md : 20,
|
|
609
|
-
paddingVertical: 0,
|
|
610
|
-
paddingHorizontal: 0,
|
|
611
|
-
margin: 0,
|
|
612
|
-
borderWidth: 0,
|
|
613
|
-
backgroundColor: colors.transparent,
|
|
614
|
-
...Platform.OS === "android" ? { includeFontPadding: false } : null,
|
|
615
|
-
...Platform.OS === "web" ? {
|
|
616
|
-
height: "100%",
|
|
617
|
-
minHeight: 0,
|
|
618
|
-
outlineStyle: "none"
|
|
619
|
-
} : null
|
|
620
|
-
}
|
|
621
|
-
});
|
|
622
|
-
function Label({
|
|
623
|
-
children,
|
|
624
|
-
required = false,
|
|
625
|
-
disabled = false,
|
|
626
|
-
style,
|
|
627
|
-
className,
|
|
628
|
-
...props
|
|
629
|
-
}) {
|
|
630
|
-
const ref = useRef(null);
|
|
631
|
-
useApplyWebClassName(ref, className);
|
|
632
|
-
return /* @__PURE__ */ jsxs(
|
|
633
|
-
Text,
|
|
634
|
-
{
|
|
635
|
-
ref,
|
|
636
|
-
style: [styles2.label, disabled && styles2.labelDisabled, style],
|
|
637
|
-
accessibilityRole: "text",
|
|
638
|
-
...props,
|
|
639
|
-
children: [
|
|
640
|
-
children,
|
|
641
|
-
required ? /* @__PURE__ */ jsx(Text, { style: styles2.required, children: " *" }) : null
|
|
642
|
-
]
|
|
643
|
-
}
|
|
644
|
-
);
|
|
645
|
-
}
|
|
646
|
-
var styles2 = StyleSheet.create({
|
|
647
|
-
label: {
|
|
648
|
-
...labelTypography,
|
|
649
|
-
color: colors.slateBlue
|
|
650
|
-
},
|
|
651
|
-
labelDisabled: {
|
|
652
|
-
color: colors.stormGray400
|
|
653
|
-
},
|
|
654
|
-
required: {
|
|
655
|
-
color: colors.inputError
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
function renderInputIcon(icon, color) {
|
|
659
|
-
if (!icon) return null;
|
|
660
|
-
if (isValidElement(icon)) {
|
|
661
|
-
return cloneElement(icon, {
|
|
662
|
-
size: icon.props.size ?? INPUT_ICON_SIZE,
|
|
663
|
-
color: icon.props.color ?? color
|
|
664
|
-
});
|
|
665
|
-
}
|
|
666
|
-
return icon;
|
|
667
|
-
}
|
|
668
|
-
function Input({
|
|
669
|
-
label,
|
|
670
|
-
leftIcon,
|
|
671
|
-
rightIcon,
|
|
672
|
-
error,
|
|
673
|
-
hint,
|
|
674
|
-
containerStyle,
|
|
675
|
-
style,
|
|
676
|
-
className,
|
|
677
|
-
labelClassName,
|
|
678
|
-
inputClassName,
|
|
679
|
-
errorClassName,
|
|
680
|
-
hintClassName,
|
|
681
|
-
editable = true,
|
|
682
|
-
secureTextEntry,
|
|
683
|
-
showPasswordToggle,
|
|
684
|
-
onFocus,
|
|
685
|
-
onBlur,
|
|
686
|
-
...props
|
|
687
|
-
}) {
|
|
688
|
-
const wrapperRef = useRef(null);
|
|
689
|
-
const inputRef = useRef(null);
|
|
690
|
-
const helperRef = useRef(null);
|
|
691
|
-
const [focused, setFocused] = useState(false);
|
|
692
|
-
const [passwordVisible, setPasswordVisible] = useState(false);
|
|
693
|
-
useApplyWebClassName(wrapperRef, className);
|
|
694
|
-
useApplyWebClassName(inputRef, inputClassName);
|
|
695
|
-
useApplyWebClassName(helperRef, error ? errorClassName : hintClassName);
|
|
696
|
-
const isDisabled = editable === false;
|
|
697
|
-
const passwordToggleEnabled = secureTextEntry === true && showPasswordToggle !== false && rightIcon == null;
|
|
698
|
-
const effectiveSecureTextEntry = passwordToggleEnabled ? !passwordVisible : secureTextEntry;
|
|
699
|
-
const visualState = resolveInputVisualState({
|
|
700
|
-
focused,
|
|
701
|
-
error: Boolean(error),
|
|
702
|
-
disabled: isDisabled
|
|
703
|
-
});
|
|
704
|
-
const fieldStyles = getInputFieldStyles(visualState);
|
|
705
|
-
const iconColor = fieldStyles.icon;
|
|
706
|
-
function handleFocus(event) {
|
|
707
|
-
setFocused(true);
|
|
708
|
-
onFocus?.(event);
|
|
709
|
-
}
|
|
710
|
-
function handleBlur(event) {
|
|
711
|
-
setFocused(false);
|
|
712
|
-
onBlur?.(event);
|
|
713
|
-
}
|
|
714
|
-
const helperMessage = error ?? hint;
|
|
715
|
-
function togglePasswordVisibility() {
|
|
716
|
-
if (!isDisabled) {
|
|
717
|
-
setPasswordVisible((visible) => !visible);
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
const trailingIcon = passwordToggleEnabled ? /* @__PURE__ */ jsx(
|
|
721
|
-
Pressable,
|
|
722
|
-
{
|
|
723
|
-
onPress: togglePasswordVisibility,
|
|
724
|
-
disabled: isDisabled,
|
|
725
|
-
accessibilityRole: "button",
|
|
726
|
-
accessibilityLabel: passwordVisible ? "Hide password" : "Show password",
|
|
727
|
-
hitSlop: 8,
|
|
728
|
-
style: styles3.iconPressable,
|
|
729
|
-
children: renderInputIcon(
|
|
730
|
-
passwordVisible ? /* @__PURE__ */ jsx(EyeOffIcon, {}) : /* @__PURE__ */ jsx(EyeIcon, {}),
|
|
731
|
-
iconColor
|
|
732
|
-
)
|
|
733
|
-
}
|
|
734
|
-
) : rightIcon ? renderInputIcon(rightIcon, iconColor) : null;
|
|
735
|
-
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [styles3.wrapper, containerStyle], children: [
|
|
736
|
-
label ? /* @__PURE__ */ jsx(Label, { disabled: isDisabled, className: labelClassName, children: label }) : null,
|
|
737
|
-
/* @__PURE__ */ jsx(View, { style: fieldStyles.outline, children: /* @__PURE__ */ jsxs(View, { style: [inputFieldMetrics.container, fieldStyles.container], children: [
|
|
738
|
-
leftIcon ? /* @__PURE__ */ jsx(View, { style: styles3.iconSlot, children: renderInputIcon(leftIcon, iconColor) }) : null,
|
|
739
|
-
/* @__PURE__ */ jsx(
|
|
740
|
-
TextInput,
|
|
741
|
-
{
|
|
742
|
-
ref: inputRef,
|
|
743
|
-
style: [
|
|
744
|
-
inputFieldMetrics.input,
|
|
745
|
-
fieldStyles.text,
|
|
746
|
-
style
|
|
747
|
-
],
|
|
748
|
-
placeholderTextColor: fieldStyles.placeholder,
|
|
749
|
-
editable,
|
|
750
|
-
secureTextEntry: effectiveSecureTextEntry,
|
|
751
|
-
onFocus: handleFocus,
|
|
752
|
-
onBlur: handleBlur,
|
|
753
|
-
accessibilityState: { disabled: isDisabled },
|
|
754
|
-
...props
|
|
755
|
-
}
|
|
756
|
-
),
|
|
757
|
-
trailingIcon ? /* @__PURE__ */ jsx(View, { style: styles3.iconSlot, children: trailingIcon }) : null
|
|
758
|
-
] }) }),
|
|
759
|
-
helperMessage ? /* @__PURE__ */ jsx(Text, { ref: helperRef, style: error ? styles3.error : styles3.hint, children: helperMessage }) : null
|
|
760
|
-
] });
|
|
761
|
-
}
|
|
762
|
-
var styles3 = StyleSheet.create({
|
|
763
|
-
wrapper: {
|
|
764
|
-
width: "100%",
|
|
765
|
-
gap: spacing.sm
|
|
766
|
-
},
|
|
767
|
-
iconSlot: {
|
|
768
|
-
width: INPUT_ICON_SIZE,
|
|
769
|
-
height: INPUT_ICON_SIZE,
|
|
770
|
-
alignItems: "center",
|
|
771
|
-
justifyContent: "center",
|
|
772
|
-
flexShrink: 0
|
|
773
|
-
},
|
|
774
|
-
iconPressable: {
|
|
775
|
-
width: INPUT_ICON_SIZE,
|
|
776
|
-
height: INPUT_ICON_SIZE,
|
|
777
|
-
alignItems: "center",
|
|
778
|
-
justifyContent: "center"
|
|
779
|
-
},
|
|
780
|
-
error: {
|
|
781
|
-
fontSize: 12,
|
|
782
|
-
lineHeight: 16,
|
|
783
|
-
color: colors.inputError
|
|
784
|
-
},
|
|
785
|
-
hint: {
|
|
786
|
-
fontSize: 12,
|
|
787
|
-
lineHeight: 16,
|
|
788
|
-
color: colors.stormGray300
|
|
789
|
-
}
|
|
790
|
-
});
|
|
791
|
-
|
|
792
197
|
// src/data/countries.ts
|
|
793
198
|
var defaultCountry = {
|
|
794
199
|
code: "AM",
|
|
@@ -1018,13 +423,13 @@ function CountryCodeSelector({
|
|
|
1018
423
|
accessibilityRole: "button",
|
|
1019
424
|
onPress: () => handleSelect(item.code),
|
|
1020
425
|
style: [
|
|
1021
|
-
|
|
1022
|
-
isSelected &&
|
|
1023
|
-
!isLast &&
|
|
426
|
+
styles2.option,
|
|
427
|
+
isSelected && styles2.optionSelected,
|
|
428
|
+
!isLast && styles2.optionSpacing
|
|
1024
429
|
],
|
|
1025
430
|
children: [
|
|
1026
|
-
/* @__PURE__ */ jsx(Text, { style:
|
|
1027
|
-
/* @__PURE__ */ jsx(Text, { style:
|
|
431
|
+
/* @__PURE__ */ jsx(Text, { style: styles2.flag, children: countryCodeToFlagEmoji(item.code) }),
|
|
432
|
+
/* @__PURE__ */ jsx(Text, { style: styles2.optionDialCode, children: item.dialCode })
|
|
1028
433
|
]
|
|
1029
434
|
},
|
|
1030
435
|
item.code
|
|
@@ -1034,8 +439,8 @@ function CountryCodeSelector({
|
|
|
1034
439
|
ScrollView,
|
|
1035
440
|
{
|
|
1036
441
|
ref: scrollRef,
|
|
1037
|
-
style:
|
|
1038
|
-
contentContainerStyle:
|
|
442
|
+
style: styles2.dropdownScroll,
|
|
443
|
+
contentContainerStyle: styles2.dropdownContent,
|
|
1039
444
|
keyboardShouldPersistTaps: "handled",
|
|
1040
445
|
showsVerticalScrollIndicator: true,
|
|
1041
446
|
bounces: false,
|
|
@@ -1043,7 +448,7 @@ function CountryCodeSelector({
|
|
|
1043
448
|
children: optionList
|
|
1044
449
|
}
|
|
1045
450
|
);
|
|
1046
|
-
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [
|
|
451
|
+
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [styles2.root, style], children: [
|
|
1047
452
|
/* @__PURE__ */ jsxs(
|
|
1048
453
|
Pressable,
|
|
1049
454
|
{
|
|
@@ -1052,13 +457,13 @@ function CountryCodeSelector({
|
|
|
1052
457
|
disabled,
|
|
1053
458
|
onPress: handleOpen,
|
|
1054
459
|
style: [
|
|
1055
|
-
|
|
1056
|
-
disabled ?
|
|
1057
|
-
Platform.OS === "web" ?
|
|
460
|
+
styles2.trigger,
|
|
461
|
+
disabled ? styles2.triggerDisabled : styles2.triggerEnabled,
|
|
462
|
+
Platform.OS === "web" ? styles2.triggerWeb : null
|
|
1058
463
|
],
|
|
1059
464
|
children: [
|
|
1060
|
-
/* @__PURE__ */ jsx(Text, { style:
|
|
1061
|
-
/* @__PURE__ */ jsx(Text, { style: [
|
|
465
|
+
/* @__PURE__ */ jsx(Text, { style: styles2.flag, children: countryCodeToFlagEmoji(selected.code) }),
|
|
466
|
+
/* @__PURE__ */ jsx(Text, { style: [styles2.dialCode, { color: textColor }], children: selected.dialCode }),
|
|
1062
467
|
/* @__PURE__ */ jsx(ChevronDownIcon, { size: CHEVRON_SIZE, color: colors.stormGray100 })
|
|
1063
468
|
]
|
|
1064
469
|
}
|
|
@@ -1070,11 +475,11 @@ function CountryCodeSelector({
|
|
|
1070
475
|
transparent: true,
|
|
1071
476
|
animationType: "fade",
|
|
1072
477
|
onRequestClose: closeDropdown,
|
|
1073
|
-
children: /* @__PURE__ */ jsx(Pressable, { style:
|
|
478
|
+
children: /* @__PURE__ */ jsx(Pressable, { style: styles2.overlay, onPress: closeDropdown, children: anchor ? /* @__PURE__ */ jsx(
|
|
1074
479
|
View,
|
|
1075
480
|
{
|
|
1076
481
|
style: [
|
|
1077
|
-
|
|
482
|
+
styles2.dropdown,
|
|
1078
483
|
{
|
|
1079
484
|
top: dropdownTop,
|
|
1080
485
|
left: anchor.x,
|
|
@@ -1088,7 +493,7 @@ function CountryCodeSelector({
|
|
|
1088
493
|
)
|
|
1089
494
|
] });
|
|
1090
495
|
}
|
|
1091
|
-
var
|
|
496
|
+
var styles2 = StyleSheet.create({
|
|
1092
497
|
root: {
|
|
1093
498
|
alignSelf: "flex-start",
|
|
1094
499
|
flexShrink: 0
|
|
@@ -1209,26 +614,26 @@ function PhoneInput({
|
|
|
1209
614
|
onBlur?.(event);
|
|
1210
615
|
}
|
|
1211
616
|
const helperMessage = error ?? hint;
|
|
1212
|
-
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [
|
|
617
|
+
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [styles3.wrapper, containerStyle], children: [
|
|
1213
618
|
label ? /* @__PURE__ */ jsx(Label, { disabled: isDisabled, className: labelClassName, children: label }) : null,
|
|
1214
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
619
|
+
/* @__PURE__ */ jsxs(View, { style: styles3.row, children: [
|
|
1215
620
|
/* @__PURE__ */ jsx(
|
|
1216
621
|
CountryCodeSelector,
|
|
1217
622
|
{
|
|
1218
623
|
value: countryCode,
|
|
1219
624
|
onValueChange: onCountryCodeChange,
|
|
1220
625
|
disabled: isDisabled,
|
|
1221
|
-
style:
|
|
626
|
+
style: styles3.countrySelector
|
|
1222
627
|
}
|
|
1223
628
|
),
|
|
1224
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1225
|
-
/* @__PURE__ */ jsx(View, { style: [phoneFieldStyles.outline,
|
|
629
|
+
/* @__PURE__ */ jsxs(View, { style: styles3.phoneColumn, children: [
|
|
630
|
+
/* @__PURE__ */ jsx(View, { style: [phoneFieldStyles.outline, styles3.phoneOutline], children: /* @__PURE__ */ jsx(
|
|
1226
631
|
View,
|
|
1227
632
|
{
|
|
1228
633
|
style: [
|
|
1229
634
|
inputFieldMetrics.container,
|
|
1230
635
|
phoneFieldStyles.container,
|
|
1231
|
-
|
|
636
|
+
styles3.phoneField
|
|
1232
637
|
],
|
|
1233
638
|
children: /* @__PURE__ */ jsx(
|
|
1234
639
|
TextInput,
|
|
@@ -1250,12 +655,12 @@ function PhoneInput({
|
|
|
1250
655
|
)
|
|
1251
656
|
}
|
|
1252
657
|
) }),
|
|
1253
|
-
helperMessage ? /* @__PURE__ */ jsx(Text, { ref: helperRef, style: error ?
|
|
658
|
+
helperMessage ? /* @__PURE__ */ jsx(Text, { ref: helperRef, style: error ? styles3.error : styles3.hint, children: helperMessage }) : null
|
|
1254
659
|
] })
|
|
1255
660
|
] })
|
|
1256
661
|
] });
|
|
1257
662
|
}
|
|
1258
|
-
var
|
|
663
|
+
var styles3 = StyleSheet.create({
|
|
1259
664
|
wrapper: {
|
|
1260
665
|
width: "100%",
|
|
1261
666
|
gap: spacing.sm
|
|
@@ -1291,6 +696,6 @@ var styles5 = StyleSheet.create({
|
|
|
1291
696
|
}
|
|
1292
697
|
});
|
|
1293
698
|
|
|
1294
|
-
export { Button, CountryCodeSelector,
|
|
699
|
+
export { Button, CountryCodeSelector, PhoneInput, countries, defaultCountry, findCountry };
|
|
1295
700
|
//# sourceMappingURL=index.js.map
|
|
1296
701
|
//# sourceMappingURL=index.js.map
|