@scripso-homepad/ui 0.3.9 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-C7GHBVMM.js +614 -0
- package/dist/chunk-C7GHBVMM.js.map +1 -0
- package/dist/index.js +29 -635
- package/dist/index.js.map +1 -1
- package/dist/web/index.cjs +1189 -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 +739 -0
- package/dist/web/index.js.map +1 -0
- package/package.json +26 -2
- 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 +67 -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,354 +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
|
-
fieldClassName,
|
|
678
|
-
fieldStyle,
|
|
679
|
-
labelClassName,
|
|
680
|
-
inputClassName,
|
|
681
|
-
errorClassName,
|
|
682
|
-
hintClassName,
|
|
683
|
-
editable = true,
|
|
684
|
-
secureTextEntry,
|
|
685
|
-
showPasswordToggle,
|
|
686
|
-
onFocus,
|
|
687
|
-
onBlur,
|
|
688
|
-
...props
|
|
689
|
-
}) {
|
|
690
|
-
const wrapperRef = useRef(null);
|
|
691
|
-
const fieldRef = useRef(null);
|
|
692
|
-
const inputRef = useRef(null);
|
|
693
|
-
const helperRef = useRef(null);
|
|
694
|
-
const [focused, setFocused] = useState(false);
|
|
695
|
-
const [passwordVisible, setPasswordVisible] = useState(false);
|
|
696
|
-
useApplyWebClassName(wrapperRef, className);
|
|
697
|
-
useApplyWebClassName(fieldRef, fieldClassName);
|
|
698
|
-
useApplyWebClassName(inputRef, inputClassName);
|
|
699
|
-
useApplyWebClassName(helperRef, error ? errorClassName : hintClassName);
|
|
700
|
-
const isDisabled = editable === false;
|
|
701
|
-
const passwordToggleEnabled = secureTextEntry === true && showPasswordToggle !== false && rightIcon == null;
|
|
702
|
-
const effectiveSecureTextEntry = passwordToggleEnabled ? !passwordVisible : secureTextEntry;
|
|
703
|
-
const visualState = resolveInputVisualState({
|
|
704
|
-
focused,
|
|
705
|
-
error: Boolean(error),
|
|
706
|
-
disabled: isDisabled
|
|
707
|
-
});
|
|
708
|
-
const fieldStyles = getInputFieldStyles(visualState);
|
|
709
|
-
const iconColor = fieldStyles.icon;
|
|
710
|
-
function handleFocus(event) {
|
|
711
|
-
setFocused(true);
|
|
712
|
-
onFocus?.(event);
|
|
713
|
-
}
|
|
714
|
-
function handleBlur(event) {
|
|
715
|
-
setFocused(false);
|
|
716
|
-
onBlur?.(event);
|
|
717
|
-
}
|
|
718
|
-
const helperMessage = error ?? hint;
|
|
719
|
-
function togglePasswordVisibility() {
|
|
720
|
-
if (!isDisabled) {
|
|
721
|
-
setPasswordVisible((visible) => !visible);
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
const trailingIcon = passwordToggleEnabled ? /* @__PURE__ */ jsx(
|
|
725
|
-
Pressable,
|
|
726
|
-
{
|
|
727
|
-
onPress: togglePasswordVisibility,
|
|
728
|
-
disabled: isDisabled,
|
|
729
|
-
accessibilityRole: "button",
|
|
730
|
-
accessibilityLabel: passwordVisible ? "Hide password" : "Show password",
|
|
731
|
-
hitSlop: 8,
|
|
732
|
-
style: styles3.iconPressable,
|
|
733
|
-
children: renderInputIcon(
|
|
734
|
-
passwordVisible ? /* @__PURE__ */ jsx(EyeOffIcon, {}) : /* @__PURE__ */ jsx(EyeIcon, {}),
|
|
735
|
-
iconColor
|
|
736
|
-
)
|
|
737
|
-
}
|
|
738
|
-
) : rightIcon ? renderInputIcon(rightIcon, iconColor) : null;
|
|
739
|
-
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [styles3.wrapper, containerStyle], children: [
|
|
740
|
-
label ? /* @__PURE__ */ jsx(Label, { disabled: isDisabled, className: labelClassName, children: label }) : null,
|
|
741
|
-
/* @__PURE__ */ jsx(View, { style: fieldStyles.outline, children: /* @__PURE__ */ jsxs(
|
|
742
|
-
View,
|
|
743
|
-
{
|
|
744
|
-
ref: fieldRef,
|
|
745
|
-
style: [inputFieldMetrics.container, fieldStyles.container, fieldStyle],
|
|
746
|
-
children: [
|
|
747
|
-
leftIcon ? /* @__PURE__ */ jsx(View, { style: styles3.iconSlot, children: renderInputIcon(leftIcon, iconColor) }) : null,
|
|
748
|
-
/* @__PURE__ */ jsx(
|
|
749
|
-
TextInput,
|
|
750
|
-
{
|
|
751
|
-
ref: inputRef,
|
|
752
|
-
style: [
|
|
753
|
-
inputFieldMetrics.input,
|
|
754
|
-
fieldStyles.text,
|
|
755
|
-
style
|
|
756
|
-
],
|
|
757
|
-
placeholderTextColor: fieldStyles.placeholder,
|
|
758
|
-
editable,
|
|
759
|
-
secureTextEntry: effectiveSecureTextEntry,
|
|
760
|
-
onFocus: handleFocus,
|
|
761
|
-
onBlur: handleBlur,
|
|
762
|
-
accessibilityState: { disabled: isDisabled },
|
|
763
|
-
...props
|
|
764
|
-
}
|
|
765
|
-
),
|
|
766
|
-
trailingIcon ? /* @__PURE__ */ jsx(View, { style: styles3.iconSlot, children: trailingIcon }) : null
|
|
767
|
-
]
|
|
768
|
-
}
|
|
769
|
-
) }),
|
|
770
|
-
helperMessage ? /* @__PURE__ */ jsx(Text, { ref: helperRef, style: error ? styles3.error : styles3.hint, children: helperMessage }) : null
|
|
771
|
-
] });
|
|
772
|
-
}
|
|
773
|
-
var styles3 = StyleSheet.create({
|
|
774
|
-
wrapper: {
|
|
775
|
-
width: "100%",
|
|
776
|
-
gap: spacing.sm
|
|
777
|
-
},
|
|
778
|
-
iconSlot: {
|
|
779
|
-
width: INPUT_ICON_SIZE,
|
|
780
|
-
height: INPUT_ICON_SIZE,
|
|
781
|
-
alignItems: "center",
|
|
782
|
-
justifyContent: "center",
|
|
783
|
-
flexShrink: 0
|
|
784
|
-
},
|
|
785
|
-
iconPressable: {
|
|
786
|
-
width: INPUT_ICON_SIZE,
|
|
787
|
-
height: INPUT_ICON_SIZE,
|
|
788
|
-
alignItems: "center",
|
|
789
|
-
justifyContent: "center"
|
|
790
|
-
},
|
|
791
|
-
error: {
|
|
792
|
-
fontSize: 12,
|
|
793
|
-
lineHeight: 16,
|
|
794
|
-
color: colors.inputError
|
|
795
|
-
},
|
|
796
|
-
hint: {
|
|
797
|
-
fontSize: 12,
|
|
798
|
-
lineHeight: 16,
|
|
799
|
-
color: colors.stormGray300
|
|
800
|
-
}
|
|
801
|
-
});
|
|
802
|
-
|
|
803
197
|
// src/data/countries.ts
|
|
804
198
|
var defaultCountry = {
|
|
805
199
|
code: "AM",
|
|
@@ -1029,13 +423,13 @@ function CountryCodeSelector({
|
|
|
1029
423
|
accessibilityRole: "button",
|
|
1030
424
|
onPress: () => handleSelect(item.code),
|
|
1031
425
|
style: [
|
|
1032
|
-
|
|
1033
|
-
isSelected &&
|
|
1034
|
-
!isLast &&
|
|
426
|
+
styles2.option,
|
|
427
|
+
isSelected && styles2.optionSelected,
|
|
428
|
+
!isLast && styles2.optionSpacing
|
|
1035
429
|
],
|
|
1036
430
|
children: [
|
|
1037
|
-
/* @__PURE__ */ jsx(Text, { style:
|
|
1038
|
-
/* @__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 })
|
|
1039
433
|
]
|
|
1040
434
|
},
|
|
1041
435
|
item.code
|
|
@@ -1045,8 +439,8 @@ function CountryCodeSelector({
|
|
|
1045
439
|
ScrollView,
|
|
1046
440
|
{
|
|
1047
441
|
ref: scrollRef,
|
|
1048
|
-
style:
|
|
1049
|
-
contentContainerStyle:
|
|
442
|
+
style: styles2.dropdownScroll,
|
|
443
|
+
contentContainerStyle: styles2.dropdownContent,
|
|
1050
444
|
keyboardShouldPersistTaps: "handled",
|
|
1051
445
|
showsVerticalScrollIndicator: true,
|
|
1052
446
|
bounces: false,
|
|
@@ -1054,7 +448,7 @@ function CountryCodeSelector({
|
|
|
1054
448
|
children: optionList
|
|
1055
449
|
}
|
|
1056
450
|
);
|
|
1057
|
-
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [
|
|
451
|
+
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [styles2.root, style], children: [
|
|
1058
452
|
/* @__PURE__ */ jsxs(
|
|
1059
453
|
Pressable,
|
|
1060
454
|
{
|
|
@@ -1063,13 +457,13 @@ function CountryCodeSelector({
|
|
|
1063
457
|
disabled,
|
|
1064
458
|
onPress: handleOpen,
|
|
1065
459
|
style: [
|
|
1066
|
-
|
|
1067
|
-
disabled ?
|
|
1068
|
-
Platform.OS === "web" ?
|
|
460
|
+
styles2.trigger,
|
|
461
|
+
disabled ? styles2.triggerDisabled : styles2.triggerEnabled,
|
|
462
|
+
Platform.OS === "web" ? styles2.triggerWeb : null
|
|
1069
463
|
],
|
|
1070
464
|
children: [
|
|
1071
|
-
/* @__PURE__ */ jsx(Text, { style:
|
|
1072
|
-
/* @__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 }),
|
|
1073
467
|
/* @__PURE__ */ jsx(ChevronDownIcon, { size: CHEVRON_SIZE, color: colors.stormGray100 })
|
|
1074
468
|
]
|
|
1075
469
|
}
|
|
@@ -1081,11 +475,11 @@ function CountryCodeSelector({
|
|
|
1081
475
|
transparent: true,
|
|
1082
476
|
animationType: "fade",
|
|
1083
477
|
onRequestClose: closeDropdown,
|
|
1084
|
-
children: /* @__PURE__ */ jsx(Pressable, { style:
|
|
478
|
+
children: /* @__PURE__ */ jsx(Pressable, { style: styles2.overlay, onPress: closeDropdown, children: anchor ? /* @__PURE__ */ jsx(
|
|
1085
479
|
View,
|
|
1086
480
|
{
|
|
1087
481
|
style: [
|
|
1088
|
-
|
|
482
|
+
styles2.dropdown,
|
|
1089
483
|
{
|
|
1090
484
|
top: dropdownTop,
|
|
1091
485
|
left: anchor.x,
|
|
@@ -1099,7 +493,7 @@ function CountryCodeSelector({
|
|
|
1099
493
|
)
|
|
1100
494
|
] });
|
|
1101
495
|
}
|
|
1102
|
-
var
|
|
496
|
+
var styles2 = StyleSheet.create({
|
|
1103
497
|
root: {
|
|
1104
498
|
alignSelf: "flex-start",
|
|
1105
499
|
flexShrink: 0
|
|
@@ -1220,26 +614,26 @@ function PhoneInput({
|
|
|
1220
614
|
onBlur?.(event);
|
|
1221
615
|
}
|
|
1222
616
|
const helperMessage = error ?? hint;
|
|
1223
|
-
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [
|
|
617
|
+
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [styles3.wrapper, containerStyle], children: [
|
|
1224
618
|
label ? /* @__PURE__ */ jsx(Label, { disabled: isDisabled, className: labelClassName, children: label }) : null,
|
|
1225
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
619
|
+
/* @__PURE__ */ jsxs(View, { style: styles3.row, children: [
|
|
1226
620
|
/* @__PURE__ */ jsx(
|
|
1227
621
|
CountryCodeSelector,
|
|
1228
622
|
{
|
|
1229
623
|
value: countryCode,
|
|
1230
624
|
onValueChange: onCountryCodeChange,
|
|
1231
625
|
disabled: isDisabled,
|
|
1232
|
-
style:
|
|
626
|
+
style: styles3.countrySelector
|
|
1233
627
|
}
|
|
1234
628
|
),
|
|
1235
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1236
|
-
/* @__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(
|
|
1237
631
|
View,
|
|
1238
632
|
{
|
|
1239
633
|
style: [
|
|
1240
634
|
inputFieldMetrics.container,
|
|
1241
635
|
phoneFieldStyles.container,
|
|
1242
|
-
|
|
636
|
+
styles3.phoneField
|
|
1243
637
|
],
|
|
1244
638
|
children: /* @__PURE__ */ jsx(
|
|
1245
639
|
TextInput,
|
|
@@ -1261,12 +655,12 @@ function PhoneInput({
|
|
|
1261
655
|
)
|
|
1262
656
|
}
|
|
1263
657
|
) }),
|
|
1264
|
-
helperMessage ? /* @__PURE__ */ jsx(Text, { ref: helperRef, style: error ?
|
|
658
|
+
helperMessage ? /* @__PURE__ */ jsx(Text, { ref: helperRef, style: error ? styles3.error : styles3.hint, children: helperMessage }) : null
|
|
1265
659
|
] })
|
|
1266
660
|
] })
|
|
1267
661
|
] });
|
|
1268
662
|
}
|
|
1269
|
-
var
|
|
663
|
+
var styles3 = StyleSheet.create({
|
|
1270
664
|
wrapper: {
|
|
1271
665
|
width: "100%",
|
|
1272
666
|
gap: spacing.sm
|
|
@@ -1302,6 +696,6 @@ var styles5 = StyleSheet.create({
|
|
|
1302
696
|
}
|
|
1303
697
|
});
|
|
1304
698
|
|
|
1305
|
-
export { Button, CountryCodeSelector,
|
|
699
|
+
export { Button, CountryCodeSelector, PhoneInput, countries, defaultCountry, findCountry };
|
|
1306
700
|
//# sourceMappingURL=index.js.map
|
|
1307
701
|
//# sourceMappingURL=index.js.map
|