@ecohouse/ui 0.1.2 → 0.1.4
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/index.cjs +1734 -155
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +287 -13
- package/dist/index.d.ts +287 -13
- package/dist/index.js +1720 -159
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Avatar/Avatar.stories.tsx +133 -0
- package/src/components/Avatar/Avatar.tsx +389 -0
- package/src/components/Avatar/index.ts +2 -0
- package/src/components/Button/Button.tsx +106 -88
- package/src/components/Checkbox/Checkbox.stories.tsx +112 -0
- package/src/components/Checkbox/Checkbox.tsx +150 -0
- package/src/components/Checkbox/index.ts +2 -0
- package/src/components/Input/Input.stories.tsx +11 -40
- package/src/components/Input/Input.tsx +58 -54
- package/src/components/Input/index.ts +1 -1
- package/src/components/Select/Select.stories.tsx +196 -0
- package/src/components/Select/Select.tsx +851 -0
- package/src/components/Select/index.ts +2 -0
- package/src/components/Textarea/Textarea.stories.tsx +71 -0
- package/src/components/Textarea/Textarea.tsx +241 -0
- package/src/components/Textarea/index.ts +2 -0
- package/src/components/Toggle/Toggle.stories.tsx +100 -0
- package/src/components/Toggle/Toggle.tsx +176 -0
- package/src/components/Toggle/index.ts +2 -0
- package/src/components/index.ts +16 -1
- package/src/icons/Calendar/CalendarIcon.tsx +21 -0
- package/src/icons/Calendar/CalendarIcon.web.tsx +27 -0
- package/src/icons/Calendar/calendarPath.ts +3 -0
- package/src/icons/Calendar/index.ts +1 -0
- package/src/icons/Check/CheckIcon.tsx +26 -0
- package/src/icons/Check/CheckIcon.web.tsx +32 -0
- package/src/icons/Check/checkPath.ts +2 -0
- package/src/icons/Check/index.ts +1 -0
- package/src/icons/ChevronDown/ChevronDownIcon.tsx +30 -0
- package/src/icons/ChevronDown/ChevronDownIcon.web.tsx +36 -0
- package/src/icons/ChevronDown/chevronDownPath.ts +2 -0
- package/src/icons/ChevronDown/index.ts +1 -0
- package/src/icons/Heart/HeartIcon.tsx +23 -0
- package/src/icons/Heart/HeartIcon.web.tsx +29 -0
- package/src/icons/Heart/heartPath.ts +3 -0
- package/src/icons/Heart/index.ts +1 -0
- package/src/icons/HelpCircle/HelpCircleIcon.tsx +25 -0
- package/src/icons/HelpCircle/HelpCircleIcon.web.tsx +31 -0
- package/src/icons/HelpCircle/helpCirclePath.ts +3 -0
- package/src/icons/HelpCircle/index.ts +1 -0
- package/src/icons/LayoutGrid/LayoutGridIcon.tsx +25 -0
- package/src/icons/LayoutGrid/LayoutGridIcon.web.tsx +31 -0
- package/src/icons/LayoutGrid/index.ts +1 -0
- package/src/icons/LayoutGrid/layoutGridPath.ts +3 -0
- package/src/icons/LogOut/LogOutIcon.tsx +21 -0
- package/src/icons/LogOut/LogOutIcon.web.tsx +27 -0
- package/src/icons/LogOut/index.ts +1 -0
- package/src/icons/LogOut/logOutPath.ts +3 -0
- package/src/icons/Search/SearchIcon.tsx +37 -0
- package/src/icons/Search/SearchIcon.web.tsx +43 -0
- package/src/icons/Search/index.ts +1 -0
- package/src/icons/Search/searchPath.ts +5 -0
- package/src/icons/Settings/SettingsIcon.tsx +21 -0
- package/src/icons/Settings/SettingsIcon.web.tsx +27 -0
- package/src/icons/Settings/index.ts +1 -0
- package/src/icons/Settings/settingsPath.ts +3 -0
- package/src/icons/Video/VideoIcon.tsx +24 -0
- package/src/icons/Video/VideoIcon.web.tsx +30 -0
- package/src/icons/Video/index.ts +1 -0
- package/src/icons/Video/videoPath.ts +5 -0
- package/src/icons/index.ts +10 -0
- package/src/icons/registry.ts +24 -3
- package/src/index.ts +31 -3
- package/src/theme/colors.ts +1 -0
- package/src/theme/index.ts +8 -1
- package/src/theme/typography.ts +77 -2
- package/src/utils/mergeRefs.ts +20 -0
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useRef, useState, useLayoutEffect } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { forwardRef, useRef, useMemo, useState, useCallback, useEffect, useLayoutEffect } from 'react';
|
|
2
|
+
import { Platform, View, Pressable, Image, Text, StyleSheet, TouchableOpacity, TextInput, ScrollView, Animated, Easing } from 'react-native';
|
|
3
3
|
import Svg, { Path } from 'react-native-svg';
|
|
4
|
-
import {
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
|
-
// src/components/
|
|
6
|
+
// src/components/Avatar/Avatar.tsx
|
|
7
7
|
|
|
8
8
|
// src/icons/ArrowRight/arrowRightPath.ts
|
|
9
9
|
var ARROW_RIGHT_PATH = "M4.16667 10H15.8333M15.8333 10L10 4.16667M15.8333 10L10 15.8333";
|
|
@@ -35,6 +35,7 @@ var colors = {
|
|
|
35
35
|
lightGrey: "#B7B7B7",
|
|
36
36
|
primaryMuted: "#B464360F",
|
|
37
37
|
redMuted: "#A63E3E0F",
|
|
38
|
+
redHover: "#A63E3E33",
|
|
38
39
|
grey0: grey["0"],
|
|
39
40
|
grey50: grey["0.5"],
|
|
40
41
|
grey100: grey["1"],
|
|
@@ -77,9 +78,32 @@ var inputTypography = {
|
|
|
77
78
|
fontFamily: fonts.sans,
|
|
78
79
|
fontSize: 12,
|
|
79
80
|
fontWeight: "500",
|
|
80
|
-
lineHeight:
|
|
81
|
+
lineHeight: 12,
|
|
82
|
+
letterSpacing: 0.36
|
|
83
|
+
},
|
|
84
|
+
field: {
|
|
85
|
+
fontFamily: fonts.sans,
|
|
86
|
+
fontSize: 14,
|
|
87
|
+
fontWeight: "400",
|
|
88
|
+
lineHeight: 19,
|
|
81
89
|
letterSpacing: 0
|
|
82
90
|
},
|
|
91
|
+
hint: {
|
|
92
|
+
fontFamily: fonts.sans,
|
|
93
|
+
fontSize: 12,
|
|
94
|
+
fontWeight: "400",
|
|
95
|
+
lineHeight: 12,
|
|
96
|
+
letterSpacing: 0.36
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
var selectTypography = {
|
|
100
|
+
label: {
|
|
101
|
+
fontFamily: fonts.sans,
|
|
102
|
+
fontSize: 12,
|
|
103
|
+
fontWeight: "500",
|
|
104
|
+
lineHeight: 12,
|
|
105
|
+
letterSpacing: 0.36
|
|
106
|
+
},
|
|
83
107
|
field: {
|
|
84
108
|
fontFamily: fonts.sans,
|
|
85
109
|
fontSize: 14,
|
|
@@ -91,8 +115,54 @@ var inputTypography = {
|
|
|
91
115
|
fontFamily: fonts.sans,
|
|
92
116
|
fontSize: 12,
|
|
93
117
|
fontWeight: "400",
|
|
94
|
-
lineHeight:
|
|
118
|
+
lineHeight: 12,
|
|
119
|
+
letterSpacing: 0.36
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
var avatarTypography = {
|
|
123
|
+
name: {
|
|
124
|
+
fontFamily: fonts.sans,
|
|
125
|
+
fontSize: 14,
|
|
126
|
+
fontWeight: "600",
|
|
127
|
+
lineHeight: 14,
|
|
128
|
+
letterSpacing: 0
|
|
129
|
+
},
|
|
130
|
+
email: {
|
|
131
|
+
fontFamily: fonts.sans,
|
|
132
|
+
fontSize: 12,
|
|
133
|
+
fontWeight: "400",
|
|
134
|
+
lineHeight: 12,
|
|
135
|
+
letterSpacing: 0
|
|
136
|
+
},
|
|
137
|
+
menuItem: {
|
|
138
|
+
fontFamily: fonts.sans,
|
|
139
|
+
fontSize: 12,
|
|
140
|
+
fontWeight: "600",
|
|
141
|
+
lineHeight: 12,
|
|
142
|
+
letterSpacing: 0
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
var textareaTypography = {
|
|
146
|
+
label: {
|
|
147
|
+
fontFamily: fonts.sans,
|
|
148
|
+
fontSize: 12,
|
|
149
|
+
fontWeight: "500",
|
|
150
|
+
lineHeight: 12,
|
|
151
|
+
letterSpacing: 0.36
|
|
152
|
+
},
|
|
153
|
+
field: {
|
|
154
|
+
fontFamily: fonts.sans,
|
|
155
|
+
fontSize: 14,
|
|
156
|
+
fontWeight: "400",
|
|
157
|
+
lineHeight: 19,
|
|
95
158
|
letterSpacing: 0
|
|
159
|
+
},
|
|
160
|
+
hint: {
|
|
161
|
+
fontFamily: fonts.sans,
|
|
162
|
+
fontSize: 12,
|
|
163
|
+
fontWeight: "400",
|
|
164
|
+
lineHeight: 12,
|
|
165
|
+
letterSpacing: 0.36
|
|
96
166
|
}
|
|
97
167
|
};
|
|
98
168
|
function ArrowRightIcon({
|
|
@@ -157,6 +227,21 @@ function BuildingIcon({ size = 20, color = colors.primary, strokeWidth = 2 }) {
|
|
|
157
227
|
) });
|
|
158
228
|
}
|
|
159
229
|
|
|
230
|
+
// src/icons/Calendar/calendarPath.ts
|
|
231
|
+
var CALENDAR_PATH = "M14 6.66668H2M14 8.33334V5.86668C14 4.74657 14 4.18652 13.782 3.7587C13.5903 3.38237 13.2843 3.07641 12.908 2.88466C12.4802 2.66668 11.9201 2.66668 10.8 2.66668H5.2C4.0799 2.66668 3.51984 2.66668 3.09202 2.88466C2.71569 3.07641 2.40973 3.38237 2.21799 3.7587C2 4.18652 2 4.74657 2 5.86668V11.4667C2 12.5868 2 13.1468 2.21799 13.5747C2.40973 13.951 2.71569 14.2569 3.09202 14.4487C3.51984 14.6667 4.0799 14.6667 5.2 14.6667H8M10.6667 1.33334V4.00001M5.33333 1.33334V4.00001M9.66667 12.6667L11 14L14 11";
|
|
232
|
+
function CalendarIcon({ size = 20, color = colors.primary, strokeWidth = 1.5 }) {
|
|
233
|
+
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx(
|
|
234
|
+
Path,
|
|
235
|
+
{
|
|
236
|
+
d: CALENDAR_PATH,
|
|
237
|
+
stroke: color,
|
|
238
|
+
strokeWidth,
|
|
239
|
+
strokeLinecap: "round",
|
|
240
|
+
strokeLinejoin: "round"
|
|
241
|
+
}
|
|
242
|
+
) });
|
|
243
|
+
}
|
|
244
|
+
|
|
160
245
|
// src/icons/Camera/cameraPath.ts
|
|
161
246
|
var CAMERA_PATH = "M9.48898 7H6.2002C5.08009 7 4.51962 7 4.0918 7.21799C3.71547 7.40973 3.40973 7.71547 3.21799 8.0918C3 8.51962 3 9.08009 3 10.2002V15.8002C3 16.9203 3 17.4796 3.21799 17.9074C3.40973 18.2837 3.71547 18.5905 4.0918 18.7822C4.5192 19 5.07899 19 6.19691 19H17.8031C18.921 19 19.48 19 19.9074 18.7822C20.2837 18.5905 20.5905 18.2837 20.7822 17.9074C21 17.48 21 16.921 21 15.8031V10.1969C21 9.07899 21 8.5192 20.7822 8.0918C20.5905 7.71547 20.2837 7.40973 19.9074 7.21799C19.4796 7 18.9203 7 17.8002 7H14.5108M9.48898 7H9.55078M9.48898 7C9.50151 7.00001 9.51468 7 9.52857 7L9.55078 7M9.48898 7C9.38286 6.99995 9.32339 6.99941 9.27637 6.99414C8.68878 6.92835 8.28578 6.36908 8.40918 5.79084C8.42066 5.73703 8.44336 5.66894 8.4883 5.53412L8.49023 5.52841C8.54156 5.37443 8.56723 5.29743 8.59558 5.22949C8.88586 4.53389 9.54322 4.06083 10.2949 4.00541C10.3683 4 10.449 4 10.6113 4H13.3886C13.5509 4 13.6322 4 13.7057 4.00541C14.4574 4.06083 15.114 4.53389 15.4043 5.22949C15.4326 5.29743 15.4584 5.37434 15.5098 5.52832C15.556 5.66699 15.5791 5.73636 15.5908 5.79093C15.7142 6.36917 15.3118 6.92835 14.7242 6.99414C14.6772 6.99941 14.6171 6.99995 14.5108 7M9.55078 7H14.449M14.449 7H14.5108M14.449 7L14.4712 7C14.4851 7 14.4983 7.00001 14.5108 7M12 16C10.3431 16 9 14.6569 9 13C9 11.3431 10.3431 10 12 10C13.6569 10 15 11.3431 15 13C15 14.6569 13.6569 16 12 16Z";
|
|
162
247
|
function CameraIcon({ size = 24, color = colors.primary, strokeWidth = 2 }) {
|
|
@@ -172,6 +257,21 @@ function CameraIcon({ size = 24, color = colors.primary, strokeWidth = 2 }) {
|
|
|
172
257
|
) });
|
|
173
258
|
}
|
|
174
259
|
|
|
260
|
+
// src/icons/Check/checkPath.ts
|
|
261
|
+
var CHECK_PATH = "M4.16669 10.8333L7.50002 14.1667L15.8334 5.83334";
|
|
262
|
+
function CheckIcon({ size = 20, color = colors.primary, strokeWidth = 2 }) {
|
|
263
|
+
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx(
|
|
264
|
+
Path,
|
|
265
|
+
{
|
|
266
|
+
d: CHECK_PATH,
|
|
267
|
+
stroke: color,
|
|
268
|
+
strokeWidth,
|
|
269
|
+
strokeLinecap: "round",
|
|
270
|
+
strokeLinejoin: "round"
|
|
271
|
+
}
|
|
272
|
+
) });
|
|
273
|
+
}
|
|
274
|
+
|
|
175
275
|
// src/icons/CheckBadge/checkBadgePath.ts
|
|
176
276
|
var CHECK_BADGE_PATH = "M12.5 8.33317L9.16663 11.6665L7.49996 9.99984M11.0384 2.88233L12.0558 3.74941C12.3122 3.96786 12.6305 4.09992 12.9662 4.12671L14.2987 4.23291C15.0822 4.29543 15.7045 4.91733 15.767 5.70077L15.8729 7.03353C15.8997 7.36925 16.0322 7.68799 16.2507 7.94433L17.1174 8.96152C17.6272 9.5597 17.6272 10.4396 17.1175 11.0378L16.2508 12.0551C16.0323 12.3115 15.9 12.6303 15.8732 12.9661L15.7666 14.2986C15.704 15.082 15.0827 15.7043 14.2993 15.7668L12.9663 15.8732C12.6305 15.9 12.312 16.0317 12.0556 16.2502L11.0384 17.1173C10.4402 17.627 9.55973 17.6271 8.96155 17.1174L7.9443 16.2502C7.68796 16.0318 7.36938 15.8998 7.03365 15.8731L5.70064 15.7668C4.9172 15.7043 4.29588 15.0822 4.23336 14.2987L4.12675 12.9661C4.09996 12.6304 3.96759 12.3118 3.74915 12.0555L2.88245 11.0378C2.37268 10.4397 2.37244 9.56002 2.88221 8.96184L3.74969 7.94418C3.96814 7.68784 4.09923 7.36926 4.12602 7.03353L4.23263 5.70093C4.29515 4.91749 4.91826 4.29535 5.70171 4.23283L7.03324 4.12663C7.36897 4.09984 7.68771 3.96788 7.94404 3.74943L8.96164 2.88233C9.55982 2.37256 10.4402 2.37256 11.0384 2.88233Z";
|
|
177
277
|
function CheckBadgeIcon({ size = 20, color = colors.primary, strokeWidth = 2 }) {
|
|
@@ -187,6 +287,25 @@ function CheckBadgeIcon({ size = 20, color = colors.primary, strokeWidth = 2 })
|
|
|
187
287
|
) });
|
|
188
288
|
}
|
|
189
289
|
|
|
290
|
+
// src/icons/ChevronDown/chevronDownPath.ts
|
|
291
|
+
var CHEVRON_DOWN_PATH = "M5 7.5L10 12.5L15 7.5";
|
|
292
|
+
function ChevronDownIcon({
|
|
293
|
+
size = 20,
|
|
294
|
+
color = colors.primary,
|
|
295
|
+
strokeWidth = 2
|
|
296
|
+
}) {
|
|
297
|
+
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx(
|
|
298
|
+
Path,
|
|
299
|
+
{
|
|
300
|
+
d: CHEVRON_DOWN_PATH,
|
|
301
|
+
stroke: color,
|
|
302
|
+
strokeWidth,
|
|
303
|
+
strokeLinecap: "round",
|
|
304
|
+
strokeLinejoin: "round"
|
|
305
|
+
}
|
|
306
|
+
) });
|
|
307
|
+
}
|
|
308
|
+
|
|
190
309
|
// src/icons/Clock/clockPath.ts
|
|
191
310
|
var CLOCK_PATH = "M12 7V12H17M12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21Z";
|
|
192
311
|
function ClockIcon({ size = 24, color = colors.primary, strokeWidth = 2 }) {
|
|
@@ -208,6 +327,42 @@ function FacebookIcon({ size = 20, color = colors.white }) {
|
|
|
208
327
|
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx(Path, { d: FACEBOOK_PATH, fill: color }) });
|
|
209
328
|
}
|
|
210
329
|
|
|
330
|
+
// src/icons/Heart/heartPath.ts
|
|
331
|
+
var HEART_PATH = "M7.99547 3.42388C6.66257 1.8656 4.43987 1.44643 2.76984 2.87334C1.0998 4.30026 0.864686 6.68598 2.17617 8.3736C3.26659 9.77674 6.56656 12.7361 7.64811 13.6939C7.76911 13.801 7.82961 13.8546 7.90018 13.8757C7.96178 13.8941 8.02917 13.8941 8.09077 13.8757C8.16134 13.8546 8.22184 13.801 8.34284 13.6939C9.42439 12.7361 12.7244 9.77674 13.8148 8.3736C15.1263 6.68598 14.9199 4.28525 13.2211 2.87334C11.5224 1.46144 9.32838 1.8656 7.99547 3.42388Z";
|
|
332
|
+
function HeartIcon({ size = 20, color = colors.primary, strokeWidth = 1.5 }) {
|
|
333
|
+
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx(
|
|
334
|
+
Path,
|
|
335
|
+
{
|
|
336
|
+
d: HEART_PATH,
|
|
337
|
+
stroke: color,
|
|
338
|
+
strokeWidth,
|
|
339
|
+
strokeLinecap: "round",
|
|
340
|
+
strokeLinejoin: "round",
|
|
341
|
+
fillRule: "evenodd",
|
|
342
|
+
clipRule: "evenodd"
|
|
343
|
+
}
|
|
344
|
+
) });
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// src/icons/HelpCircle/helpCirclePath.ts
|
|
348
|
+
var HELP_CIRCLE_PATH = "M6.99971 6.00149C7.11717 5.66757 7.34902 5.386 7.6542 5.20665C7.95937 5.0273 8.31817 4.96174 8.66705 5.02158C9.01593 5.08142 9.33238 5.2628 9.56034 5.5336C9.7883 5.8044 9.91306 6.14714 9.91254 6.50112C9.91254 7.50037 8.41365 8 8.41365 8M8.43298 10H8.43964M8.33304 13.3333C11.4627 13.3333 13.9997 10.7963 13.9997 7.66667C13.9997 4.53705 11.4627 2 8.33304 2C5.20343 2 2.66638 4.53705 2.66638 7.66667C2.66638 8.3 2.77027 8.90906 2.96196 9.47774C3.03409 9.69175 3.07016 9.79875 3.07666 9.88095C3.08309 9.96213 3.07823 10.019 3.05814 10.098C3.03781 10.1779 2.99291 10.261 2.9031 10.4272L1.81267 12.4456C1.65713 12.7335 1.57936 12.8774 1.59676 12.9885C1.61192 13.0853 1.66887 13.1705 1.75249 13.2215C1.84849 13.2801 2.01124 13.2632 2.33674 13.2296L5.75075 12.8767C5.85414 12.866 5.90583 12.8606 5.95295 12.8624C5.99929 12.8642 6.03201 12.8686 6.0772 12.879C6.12315 12.8896 6.18092 12.9118 6.29648 12.9564C6.92851 13.1999 7.61519 13.3333 8.33304 13.3333Z";
|
|
349
|
+
function HelpCircleIcon({
|
|
350
|
+
size = 20,
|
|
351
|
+
color = colors.primary,
|
|
352
|
+
strokeWidth = 1.5
|
|
353
|
+
}) {
|
|
354
|
+
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx(
|
|
355
|
+
Path,
|
|
356
|
+
{
|
|
357
|
+
d: HELP_CIRCLE_PATH,
|
|
358
|
+
stroke: color,
|
|
359
|
+
strokeWidth,
|
|
360
|
+
strokeLinecap: "round",
|
|
361
|
+
strokeLinejoin: "round"
|
|
362
|
+
}
|
|
363
|
+
) });
|
|
364
|
+
}
|
|
365
|
+
|
|
211
366
|
// src/icons/Home/homePath.ts
|
|
212
367
|
var HOME_PATH = "M1.66675 16.6667H3.33341M3.33341 16.6667H8.33341M3.33341 16.6667V9.54352C3.33341 9.09823 3.33341 8.87548 3.38756 8.66828C3.43554 8.48466 3.51491 8.31089 3.6215 8.15387C3.74178 7.97668 3.90895 7.82974 4.24406 7.53652L8.24538 4.03537C8.86662 3.49178 9.17726 3.21997 9.5271 3.11652C9.83559 3.02529 10.1644 3.02529 10.4729 3.11652C10.823 3.22005 11.1341 3.49212 11.7563 4.03652L15.7563 7.53652C16.0914 7.82974 16.2586 7.97668 16.3789 8.15387C16.4855 8.31089 16.5642 8.48466 16.6122 8.66828C16.6664 8.87548 16.6667 9.09824 16.6667 9.54352V16.6667M8.33341 16.6667H11.6667M8.33341 16.6667V13.3334C8.33341 12.4129 9.07961 11.6667 10.0001 11.6667C10.9206 11.6667 11.6667 12.4129 11.6667 13.3334V16.6667M11.6667 16.6667H16.6667M16.6667 16.6667H18.3334";
|
|
213
368
|
function HomeIcon({ size = 20, color = colors.primary, strokeWidth = 2 }) {
|
|
@@ -244,12 +399,46 @@ function KeyIcon({ size = 20, color = colors.primary, strokeWidth = 2 }) {
|
|
|
244
399
|
) });
|
|
245
400
|
}
|
|
246
401
|
|
|
402
|
+
// src/icons/LayoutGrid/layoutGridPath.ts
|
|
403
|
+
var LAYOUT_GRID_PATH = "M4.33333 4.33333H4.34M11.6667 4.33333H11.6733M4.33333 11.6667H4.34M8.66667 8.66667H8.67333M11.6667 11.6667H11.6733M11.3333 14H14V11.3333M9.33333 11V14M14 9.33333H11M10.4 6.66667H12.9333C13.3067 6.66667 13.4934 6.66667 13.636 6.594C13.7614 6.53009 13.8634 6.4281 13.9273 6.30266C14 6.16005 14 5.97337 14 5.6V3.06667C14 2.6933 14 2.50661 13.9273 2.36401C13.8634 2.23856 13.7614 2.13658 13.636 2.07266C13.4934 2 13.3067 2 12.9333 2H10.4C10.0266 2 9.83995 2 9.69734 2.07266C9.5719 2.13658 9.46991 2.23856 9.406 2.36401C9.33333 2.50661 9.33333 2.6933 9.33333 3.06667V5.6C9.33333 5.97337 9.33333 6.16005 9.406 6.30266C9.46991 6.4281 9.5719 6.53009 9.69734 6.594C9.83995 6.66667 10.0266 6.66667 10.4 6.66667ZM3.06667 6.66667H5.6C5.97337 6.66667 6.16005 6.66667 6.30266 6.594C6.4281 6.53009 6.53009 6.4281 6.594 6.30266C6.66667 6.16005 6.66667 5.97337 6.66667 5.6V3.06667C6.66667 2.6933 6.66667 2.50661 6.594 2.36401C6.53009 2.23856 6.4281 2.13658 6.30266 2.07266C6.16005 2 5.97337 2 5.6 2H3.06667C2.6933 2 2.50661 2 2.36401 2.07266C2.23856 2.13658 2.13658 2.23856 2.07266 2.36401C2 2.50661 2 2.6933 2 3.06667V5.6C2 5.97337 2 6.16005 2.07266 6.30266C2.13658 6.4281 2.23856 6.53009 2.36401 6.594C2.50661 6.66667 2.6933 6.66667 3.06667 6.66667ZM3.06667 14H5.6C5.97337 14 6.16005 14 6.30266 13.9273C6.4281 13.8634 6.53009 13.7614 6.594 13.636C6.66667 13.4934 6.66667 13.3067 6.66667 12.9333V10.4C6.66667 10.0266 6.66667 9.83995 6.594 9.69734C6.53009 9.5719 6.4281 9.46991 6.30266 9.406C6.16005 9.33333 5.97337 9.33333 5.6 9.33333H3.06667C2.6933 9.33333 2.50661 9.33333 2.36401 9.406C2.23856 9.46991 2.13658 9.5719 2.07266 9.69734C2 9.83995 2 10.0266 2 10.4V12.9333C2 13.3067 2 13.4934 2.07266 13.636C2.13658 13.7614 2.23856 13.8634 2.36401 13.9273C2.50661 14 2.6933 14 3.06667 14Z";
|
|
404
|
+
function LayoutGridIcon({
|
|
405
|
+
size = 20,
|
|
406
|
+
color = colors.primary,
|
|
407
|
+
strokeWidth = 1.5
|
|
408
|
+
}) {
|
|
409
|
+
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx(
|
|
410
|
+
Path,
|
|
411
|
+
{
|
|
412
|
+
d: LAYOUT_GRID_PATH,
|
|
413
|
+
stroke: color,
|
|
414
|
+
strokeWidth,
|
|
415
|
+
strokeLinecap: "round",
|
|
416
|
+
strokeLinejoin: "round"
|
|
417
|
+
}
|
|
418
|
+
) });
|
|
419
|
+
}
|
|
420
|
+
|
|
247
421
|
// src/icons/LinkedIn/linkedinPath.ts
|
|
248
422
|
var LINKEDIN_PATH = "M15.8333 2.50098C16.2754 2.50098 16.6993 2.67657 17.0118 2.98913C17.3244 3.30169 17.5 3.72562 17.5 4.16764V15.8343C17.5 16.2763 17.3244 16.7003 17.0118 17.0128C16.6993 17.3254 16.2754 17.501 15.8333 17.501H4.16667C3.72464 17.501 3.30072 17.3254 2.98816 17.0128C2.67559 16.7003 2.5 16.2763 2.5 15.8343V4.16764C2.5 3.72562 2.67559 3.30169 2.98816 2.98913C3.30072 2.67657 3.72464 2.50098 4.16667 2.50098H15.8333ZM15.4167 15.4176V11.001C15.4167 10.2805 15.1304 9.58948 14.621 9.08C14.1115 8.57053 13.4205 8.28431 12.7 8.28431C11.9917 8.28431 11.1667 8.71764 10.7667 9.36764V8.44264H8.44167V15.4176H10.7667V11.3093C10.7667 10.6676 11.2833 10.1426 11.925 10.1426C12.2344 10.1426 12.5312 10.2656 12.75 10.4844C12.9687 10.7031 13.0917 10.9999 13.0917 11.3093V15.4176H15.4167ZM5.73333 7.13431C6.10464 7.13431 6.46073 6.98681 6.72328 6.72426C6.98583 6.46171 7.13333 6.10561 7.13333 5.73431C7.13333 4.95931 6.50833 4.32598 5.73333 4.32598C5.35982 4.32598 5.0016 4.47435 4.73749 4.73847C4.47338 5.00258 4.325 5.3608 4.325 5.73431C4.325 6.50931 4.95833 7.13431 5.73333 7.13431ZM6.89167 15.4176V8.44264H4.58333V15.4176H6.89167Z";
|
|
249
423
|
function LinkedInIcon({ size = 20, color = colors.white }) {
|
|
250
424
|
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx(Path, { d: LINKEDIN_PATH, fill: color }) });
|
|
251
425
|
}
|
|
252
426
|
|
|
427
|
+
// src/icons/LogOut/logOutPath.ts
|
|
428
|
+
var LOG_OUT_PATH = "M10.6667 4.66667L14 8L10.6667 11.3333M14 8H6M8 11.3333C8 11.5304 8 11.6289 7.99268 11.7143C7.91655 12.6013 7.26324 13.3312 6.39002 13.5049C6.30602 13.5216 6.20801 13.5324 6.01223 13.5542L5.3313 13.6299C4.30832 13.7435 3.7968 13.8004 3.39044 13.6703C2.84862 13.4969 2.40628 13.101 2.17412 12.5817C2 12.1921 2 11.6775 2 10.6482V5.3518C2 4.32251 2 3.80787 2.17412 3.41835C2.40628 2.89899 2.84862 2.50307 3.39044 2.32969C3.79681 2.19965 4.3083 2.25648 5.33129 2.37015L6.01223 2.44581C6.20808 2.46757 6.306 2.47845 6.39002 2.49515C7.26324 2.66877 7.91655 3.39869 7.99268 4.28574C8 4.37109 8 4.46962 8 4.66667";
|
|
429
|
+
function LogOutIcon({ size = 20, color = colors.red, strokeWidth = 1.5 }) {
|
|
430
|
+
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx(
|
|
431
|
+
Path,
|
|
432
|
+
{
|
|
433
|
+
d: LOG_OUT_PATH,
|
|
434
|
+
stroke: color,
|
|
435
|
+
strokeWidth,
|
|
436
|
+
strokeLinecap: "round",
|
|
437
|
+
strokeLinejoin: "round"
|
|
438
|
+
}
|
|
439
|
+
) });
|
|
440
|
+
}
|
|
441
|
+
|
|
253
442
|
// src/icons/Mail/mailPath.ts
|
|
254
443
|
var MAIL_PATH = "M3.33333 4.99984L8.42303 8.84339L8.42473 8.8448C8.98987 9.25924 9.27261 9.46658 9.5823 9.54668C9.85602 9.61748 10.1438 9.61748 10.4175 9.54668C10.7274 9.46651 11.011 9.25856 11.5771 8.84339C11.5771 8.84339 14.8417 6.33812 16.6667 4.99984M2.5 13.1667V6.83333C2.5 5.89991 2.5 5.43285 2.68166 5.07633C2.84144 4.76273 3.09623 4.50795 3.40983 4.34816C3.76635 4.1665 4.23341 4.1665 5.16683 4.1665H14.8335C15.7669 4.1665 16.233 4.1665 16.5895 4.34816C16.9031 4.50795 17.1587 4.76273 17.3185 5.07633C17.5 5.43251 17.5 5.899 17.5 6.8306V13.1695C17.5 14.1011 17.5 14.5669 17.3185 14.9231C17.1587 15.2367 16.9031 15.4919 16.5895 15.6517C16.2333 15.8332 15.7675 15.8332 14.8359 15.8332H5.16409C4.23249 15.8332 3.766 15.8332 3.40983 15.6517C3.09623 15.4919 2.84144 15.2367 2.68166 14.9231C2.5 14.5666 2.5 14.1001 2.5 13.1667Z";
|
|
255
444
|
function MailIcon({ size = 20, color = colors.primary, strokeWidth = 2 }) {
|
|
@@ -295,6 +484,53 @@ function PhoneIcon({ size = 20, color = colors.primary, strokeWidth = 2 }) {
|
|
|
295
484
|
) });
|
|
296
485
|
}
|
|
297
486
|
|
|
487
|
+
// src/icons/Search/searchPath.ts
|
|
488
|
+
var SEARCH_CIRCLE_PATH = "M9.16667 15.8333C12.8486 15.8333 15.8333 12.8486 15.8333 9.16667C15.8333 5.48477 12.8486 2.5 9.16667 2.5C5.48477 2.5 2.5 5.48477 2.5 9.16667C2.5 12.8486 5.48477 15.8333 9.16667 15.8333Z";
|
|
489
|
+
var SEARCH_HANDLE_PATH = "M17.5 17.5L13.875 13.875";
|
|
490
|
+
function SearchIcon({
|
|
491
|
+
size = 20,
|
|
492
|
+
color = colors.primary,
|
|
493
|
+
strokeWidth = 2
|
|
494
|
+
}) {
|
|
495
|
+
return /* @__PURE__ */ jsxs(Svg, { width: size, height: size, viewBox: "0 0 20 20", fill: "none", children: [
|
|
496
|
+
/* @__PURE__ */ jsx(
|
|
497
|
+
Path,
|
|
498
|
+
{
|
|
499
|
+
d: SEARCH_CIRCLE_PATH,
|
|
500
|
+
stroke: color,
|
|
501
|
+
strokeWidth,
|
|
502
|
+
strokeLinecap: "round",
|
|
503
|
+
strokeLinejoin: "round"
|
|
504
|
+
}
|
|
505
|
+
),
|
|
506
|
+
/* @__PURE__ */ jsx(
|
|
507
|
+
Path,
|
|
508
|
+
{
|
|
509
|
+
d: SEARCH_HANDLE_PATH,
|
|
510
|
+
stroke: color,
|
|
511
|
+
strokeWidth,
|
|
512
|
+
strokeLinecap: "round",
|
|
513
|
+
strokeLinejoin: "round"
|
|
514
|
+
}
|
|
515
|
+
)
|
|
516
|
+
] });
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// src/icons/Settings/settingsPath.ts
|
|
520
|
+
var SETTINGS_PATH = "M8.00004 10C9.10461 10 10 9.10457 10 8C10 6.89543 9.10461 6 8.00004 6C6.89547 6 6.00004 6.89543 6.00004 8C6.00004 9.10457 6.89547 10 8.00004 10Z M12.4849 9.81818C12.4042 10.001 12.3801 10.2038 12.4158 10.4004C12.4514 10.597 12.5452 10.7784 12.6849 10.9212L12.7213 10.9576C12.834 11.0702 12.9234 11.2038 12.9844 11.351C13.0454 11.4981 13.0768 11.6559 13.0768 11.8152C13.0768 11.9744 13.0454 12.1322 12.9844 12.2793C12.9234 12.4265 12.834 12.5602 12.7213 12.6727C12.6087 12.7854 12.475 12.8748 12.3278 12.9358C12.1807 12.9968 12.023 13.0282 11.8637 13.0282C11.7044 13.0282 11.5467 12.9968 11.3995 12.9358C11.2524 12.8748 11.1187 12.7854 11.0061 12.6727L10.9697 12.6364C10.8269 12.4966 10.6455 12.4029 10.4489 12.3673C10.2523 12.3316 10.0495 12.3557 9.86671 12.4364C9.68745 12.5132 9.53458 12.6408 9.42689 12.8034C9.31921 12.966 9.26142 13.1565 9.26065 13.3515V13.4545C9.26065 13.776 9.13294 14.0843 8.90562 14.3116C8.67831 14.539 8.37 14.6667 8.04853 14.6667C7.72705 14.6667 7.41874 14.539 7.19143 14.3116C6.96411 14.0843 6.8364 13.776 6.8364 13.4545V13.4C6.83171 13.1994 6.76678 13.0048 6.65005 12.8416C6.53331 12.6784 6.37018 12.5541 6.18186 12.4848C5.99906 12.4042 5.79629 12.3801 5.59968 12.4158C5.40308 12.4514 5.22166 12.5451 5.07883 12.6849L5.04246 12.7212C4.92989 12.8339 4.79621 12.9233 4.64906 12.9843C4.50191 13.0453 4.34418 13.0767 4.18489 13.0767C4.0256 13.0767 3.86787 13.0453 3.72072 12.9843C3.57357 12.9233 3.43989 12.8339 3.32731 12.7212C3.21461 12.6086 3.12521 12.475 3.06421 12.3278C3.00321 12.1807 2.97181 12.0229 2.97181 11.8636C2.97181 11.7043 3.00321 11.5466 3.06421 11.3995C3.12521 11.2523 3.21461 11.1186 3.32731 11.0061L3.36368 10.9697C3.5034 10.8269 3.59712 10.6454 3.63277 10.4488C3.66842 10.2522 3.64435 10.0495 3.56368 9.86667C3.48685 9.68741 3.35929 9.53454 3.19669 9.42686C3.03409 9.31917 2.84355 9.26139 2.64853 9.26061H2.5455C2.22402 9.26061 1.91571 9.1329 1.6884 8.90559C1.46108 8.67827 1.33337 8.36996 1.33337 8.04849C1.33337 7.72701 1.46108 7.4187 1.6884 7.19139C1.91571 6.96407 2.22402 6.83637 2.5455 6.83637H2.60004C2.80064 6.83167 2.9952 6.76674 3.1584 6.65001C3.32161 6.53328 3.44593 6.37014 3.51519 6.18182C3.59587 5.99902 3.61993 5.79625 3.58429 5.59965C3.54864 5.40304 3.45491 5.22163 3.31519 5.07879L3.27883 5.04243C3.16613 4.92985 3.07672 4.79617 3.01573 4.64902C2.95473 4.50187 2.92333 4.34414 2.92333 4.18485C2.92333 4.02556 2.95473 3.86783 3.01573 3.72068C3.07672 3.57353 3.16613 3.43985 3.27883 3.32728C3.3914 3.21458 3.52509 3.12517 3.67223 3.06417C3.81938 3.00317 3.97711 2.97178 4.1364 2.97178C4.2957 2.97178 4.45343 3.00317 4.60057 3.06417C4.74772 3.12517 4.88141 3.21458 4.99398 3.32728L5.03034 3.36364C5.17318 3.50336 5.3546 3.59708 5.5512 3.63273C5.7478 3.66838 5.95058 3.64431 6.13337 3.56364H6.18186C6.36111 3.48681 6.51399 3.35925 6.62167 3.19665C6.72935 3.03405 6.78714 2.84351 6.78792 2.64849V2.54546C6.78792 2.22398 6.91562 1.91567 7.14294 1.68836C7.37026 1.46104 7.67857 1.33334 8.00004 1.33334C8.32151 1.33334 8.62982 1.46104 8.85714 1.68836C9.08446 1.91567 9.21216 2.22398 9.21216 2.54546V2.6C9.21294 2.79502 9.27073 2.98556 9.37841 3.14816C9.48609 3.31076 9.63897 3.43833 9.81822 3.51515C10.001 3.59583 10.2038 3.6199 10.4004 3.58425C10.597 3.5486 10.7784 3.45487 10.9213 3.31515L10.9576 3.27879C11.0702 3.16609 11.2039 3.07669 11.351 3.01569C11.4982 2.95469 11.6559 2.92329 11.8152 2.92329C11.9745 2.92329 12.1322 2.95469 12.2794 3.01569C12.4265 3.07669 12.5602 3.16609 12.6728 3.27879C12.7855 3.39136 12.8749 3.52505 12.9359 3.6722C12.9969 3.81935 13.0283 3.97707 13.0283 4.13637C13.0283 4.29566 12.9969 4.45339 12.9359 4.60054C12.8749 4.74769 12.7855 4.88137 12.6728 4.99394L12.6364 5.03031C12.4967 5.17314 12.403 5.35456 12.3673 5.55116C12.3317 5.74776 12.3557 5.95054 12.4364 6.13334V6.18182C12.5132 6.36107 12.6408 6.51395 12.8034 6.62163C12.966 6.72932 13.1565 6.7871 13.3516 6.78788H13.4546C13.7761 6.78788 14.0844 6.91559 14.3117 7.1429C14.539 7.37022 14.6667 7.67853 14.6667 8C14.6667 8.32148 14.539 8.62978 14.3117 8.8571C14.0844 9.08442 13.7761 9.21212 13.4546 9.21212H13.4C13.205 9.2129 13.0145 9.27069 12.8519 9.37837C12.6893 9.48605 12.5617 9.63893 12.4849 9.81818Z";
|
|
521
|
+
function SettingsIcon({ size = 20, color = colors.primary, strokeWidth = 1.5 }) {
|
|
522
|
+
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx(
|
|
523
|
+
Path,
|
|
524
|
+
{
|
|
525
|
+
d: SETTINGS_PATH,
|
|
526
|
+
stroke: color,
|
|
527
|
+
strokeWidth,
|
|
528
|
+
strokeLinecap: "round",
|
|
529
|
+
strokeLinejoin: "round"
|
|
530
|
+
}
|
|
531
|
+
) });
|
|
532
|
+
}
|
|
533
|
+
|
|
298
534
|
// src/icons/Show/showPath.ts
|
|
299
535
|
var SHOW_PATH = "M1.66669 10C1.66669 10 4.16669 4.16667 10 4.16667C15.8334 4.16667 18.3334 10 18.3334 10C18.3334 10 15.8334 15.8333 10 15.8333C4.16669 15.8333 1.66669 10 1.66669 10Z";
|
|
300
536
|
var SHOW_PUPIL_PATH = "M10 12.5C11.3807 12.5 12.5 11.3807 12.5 10C12.5 8.61929 11.3807 7.5 10 7.5C8.61929 7.5 7.5 8.61929 7.5 10C7.5 11.3807 8.61929 12.5 10 12.5Z";
|
|
@@ -338,33 +574,63 @@ function UserIcon({ size = 20, color = colors.primary, strokeWidth = 2 }) {
|
|
|
338
574
|
) });
|
|
339
575
|
}
|
|
340
576
|
|
|
577
|
+
// src/icons/Video/videoPath.ts
|
|
578
|
+
var VIDEO_PATHS = [
|
|
579
|
+
"M14.6667 5.95424C14.6667 5.55036 14.6667 5.34843 14.5868 5.25492C14.5175 5.17378 14.4136 5.13072 14.3072 5.13909C14.1846 5.14874 14.0418 5.29153 13.7563 5.57712L11.3334 7.99999L13.7563 10.4229C14.0418 10.7085 14.1846 10.8512 14.3072 10.8609C14.4136 10.8693 14.5175 10.8262 14.5868 10.7451C14.6667 10.6516 14.6667 10.4496 14.6667 10.0457V5.95424Z",
|
|
580
|
+
"M1.33337 6.53333C1.33337 5.41322 1.33337 4.85317 1.55136 4.42535C1.74311 4.04902 2.04907 3.74306 2.42539 3.55132C2.85322 3.33333 3.41327 3.33333 4.53337 3.33333H8.13337C9.25348 3.33333 9.81353 3.33333 10.2414 3.55132C10.6177 3.74306 10.9236 4.04902 11.1154 4.42535C11.3334 4.85317 11.3334 5.41322 11.3334 6.53333V9.46666C11.3334 10.5868 11.3334 11.1468 11.1154 11.5746C10.9236 11.951 10.6177 12.2569 10.2414 12.4487C9.81353 12.6667 9.25348 12.6667 8.13337 12.6667H4.53337C3.41327 12.6667 2.85322 12.6667 2.42539 12.4487C2.04907 12.2569 1.74311 11.951 1.55136 11.5746C1.33337 11.1468 1.33337 10.5868 1.33337 9.46666V6.53333Z"
|
|
581
|
+
];
|
|
582
|
+
function VideoIcon({ size = 20, color = colors.primary, strokeWidth = 1.5 }) {
|
|
583
|
+
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 16 16", fill: "none", children: VIDEO_PATHS.map((path) => /* @__PURE__ */ jsx(
|
|
584
|
+
Path,
|
|
585
|
+
{
|
|
586
|
+
d: path,
|
|
587
|
+
stroke: color,
|
|
588
|
+
strokeWidth,
|
|
589
|
+
strokeLinecap: "round",
|
|
590
|
+
strokeLinejoin: "round"
|
|
591
|
+
},
|
|
592
|
+
path
|
|
593
|
+
)) });
|
|
594
|
+
}
|
|
595
|
+
|
|
341
596
|
// src/icons/registry.ts
|
|
342
597
|
var icons = {
|
|
343
598
|
arrowRight: ArrowRightIcon,
|
|
344
599
|
bag: BagIcon,
|
|
345
600
|
bell: BellIcon,
|
|
346
601
|
building: BuildingIcon,
|
|
602
|
+
calendar: CalendarIcon,
|
|
347
603
|
camera: CameraIcon,
|
|
604
|
+
check: CheckIcon,
|
|
348
605
|
checkBadge: CheckBadgeIcon,
|
|
606
|
+
chevronDown: ChevronDownIcon,
|
|
349
607
|
clock: ClockIcon,
|
|
350
608
|
facebook: FacebookIcon,
|
|
609
|
+
heart: HeartIcon,
|
|
610
|
+
helpCircle: HelpCircleIcon,
|
|
351
611
|
home: HomeIcon,
|
|
352
612
|
instagram: InstagramIcon,
|
|
353
613
|
key: KeyIcon,
|
|
614
|
+
layoutGrid: LayoutGridIcon,
|
|
354
615
|
linkedin: LinkedInIcon,
|
|
616
|
+
logOut: LogOutIcon,
|
|
355
617
|
mail: MailIcon,
|
|
356
618
|
navigate: NavigateIcon,
|
|
357
619
|
phone: PhoneIcon,
|
|
620
|
+
search: SearchIcon,
|
|
621
|
+
settings: SettingsIcon,
|
|
358
622
|
show: ShowIcon,
|
|
359
|
-
user: UserIcon
|
|
623
|
+
user: UserIcon,
|
|
624
|
+
video: VideoIcon
|
|
360
625
|
};
|
|
361
626
|
var iconNames = Object.keys(icons);
|
|
362
627
|
var iconGroups = {
|
|
363
|
-
navigation: ["arrowRight", "home", "navigate"],
|
|
364
|
-
actions: ["show", "bell", "camera", "key", "checkBadge"],
|
|
365
|
-
objects: ["bag", "building", "clock", "user"],
|
|
628
|
+
navigation: ["arrowRight", "chevronDown", "home", "navigate"],
|
|
629
|
+
actions: ["show", "bell", "camera", "key", "check", "checkBadge", "search", "calendar", "heart"],
|
|
630
|
+
objects: ["bag", "building", "clock", "user", "video"],
|
|
366
631
|
communication: ["mail", "phone"],
|
|
367
|
-
social: ["facebook", "instagram", "linkedin"]
|
|
632
|
+
social: ["facebook", "instagram", "linkedin"],
|
|
633
|
+
interface: ["layoutGrid", "settings", "helpCircle", "logOut"]
|
|
368
634
|
};
|
|
369
635
|
var iconGroupNames = Object.keys(iconGroups);
|
|
370
636
|
function getIconsByGroup(group) {
|
|
@@ -374,6 +640,18 @@ function Icon({ name, ...props }) {
|
|
|
374
640
|
const Component = icons[name];
|
|
375
641
|
return /* @__PURE__ */ jsx(Component, { ...props });
|
|
376
642
|
}
|
|
643
|
+
|
|
644
|
+
// src/utils/mergeRefs.ts
|
|
645
|
+
function mergeRefs(internalRef, forwardedRef) {
|
|
646
|
+
return (node) => {
|
|
647
|
+
internalRef.current = node;
|
|
648
|
+
if (typeof forwardedRef === "function") {
|
|
649
|
+
forwardedRef(node);
|
|
650
|
+
} else if (forwardedRef) {
|
|
651
|
+
forwardedRef.current = node;
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
}
|
|
377
655
|
function hasClassList(node) {
|
|
378
656
|
return typeof node === "object" && node !== null && "classList" in node && typeof node.classList?.add === "function";
|
|
379
657
|
}
|
|
@@ -414,129 +692,399 @@ function useApplyWebClassName(ref, className, enabled = true) {
|
|
|
414
692
|
};
|
|
415
693
|
}, [ref, className, enabled]);
|
|
416
694
|
}
|
|
417
|
-
var
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
iconColor: colors.white
|
|
429
|
-
}
|
|
430
|
-
};
|
|
431
|
-
var sizeConfig = {
|
|
432
|
-
lg: {
|
|
433
|
-
minHeight: 44,
|
|
434
|
-
borderRadius: 40,
|
|
435
|
-
paddingVertical: 4,
|
|
436
|
-
paddingLeft: 20,
|
|
437
|
-
paddingRightWithIcon: 4,
|
|
438
|
-
paddingRight: 20,
|
|
439
|
-
gap: 20,
|
|
440
|
-
text: buttonTypography.lg,
|
|
441
|
-
iconContainerSize: 36,
|
|
442
|
-
iconSize: 20
|
|
443
|
-
},
|
|
444
|
-
sm: {
|
|
445
|
-
minHeight: 32,
|
|
446
|
-
borderRadius: 40,
|
|
447
|
-
paddingVertical: 6,
|
|
448
|
-
paddingLeft: 12,
|
|
449
|
-
paddingRightWithIcon: 4,
|
|
450
|
-
paddingRight: 12,
|
|
451
|
-
gap: 12,
|
|
452
|
-
text: buttonTypography.sm,
|
|
453
|
-
iconContainerSize: 20,
|
|
454
|
-
iconSize: 12
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
function Button({
|
|
458
|
-
title,
|
|
459
|
-
children,
|
|
695
|
+
var IMAGE_SIZE = 48;
|
|
696
|
+
var CONTAINER_RADIUS = 71;
|
|
697
|
+
var CHEVRON_SIZE = 20;
|
|
698
|
+
var FALLBACK_ICON_SIZE = 20;
|
|
699
|
+
var MENU_RADIUS = 16;
|
|
700
|
+
var MENU_ITEM_RADIUS = 12;
|
|
701
|
+
var MENU_ITEM_ICON_SIZE = 16;
|
|
702
|
+
var Avatar = forwardRef(function Avatar2({
|
|
703
|
+
name,
|
|
704
|
+
email,
|
|
705
|
+
imageUrl,
|
|
460
706
|
onPress,
|
|
461
707
|
disabled = false,
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
708
|
+
showChevron = true,
|
|
709
|
+
menuItems,
|
|
710
|
+
open: openProp,
|
|
711
|
+
defaultOpen = false,
|
|
712
|
+
onOpenChange,
|
|
713
|
+
menuWidth,
|
|
466
714
|
style,
|
|
467
|
-
textStyle,
|
|
468
715
|
className,
|
|
469
|
-
|
|
470
|
-
|
|
716
|
+
accessibilityLabel,
|
|
717
|
+
hitSlop = 8,
|
|
718
|
+
...rest
|
|
719
|
+
}, forwardedRef) {
|
|
720
|
+
const wrapperRef = useRef(null);
|
|
471
721
|
const containerRef = useRef(null);
|
|
472
|
-
const
|
|
473
|
-
const
|
|
474
|
-
const
|
|
475
|
-
const
|
|
476
|
-
const
|
|
477
|
-
const
|
|
478
|
-
const
|
|
479
|
-
const
|
|
480
|
-
useApplyWebClassName(containerRef,
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
minHeight: metrics.minHeight,
|
|
487
|
-
borderRadius: metrics.borderRadius,
|
|
488
|
-
backgroundColor: preset.backgroundColor,
|
|
489
|
-
paddingTop: metrics.paddingVertical,
|
|
490
|
-
paddingBottom: metrics.paddingVertical,
|
|
491
|
-
paddingLeft: metrics.paddingLeft,
|
|
492
|
-
paddingRight: hasIcon ? metrics.paddingRightWithIcon : metrics.paddingRight,
|
|
493
|
-
gap: hasIcon ? metrics.gap : 0
|
|
722
|
+
const setContainerRef = useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
|
|
723
|
+
const [imageFailed, setImageFailed] = useState(false);
|
|
724
|
+
const [hoveredKey, setHoveredKey] = useState(null);
|
|
725
|
+
const hasMenu = Boolean(menuItems && menuItems.length > 0);
|
|
726
|
+
const isInteractive = onPress != null || hasMenu;
|
|
727
|
+
const isOpenControlled = typeof openProp === "boolean";
|
|
728
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
729
|
+
const isOpen = hasMenu && (isOpenControlled ? openProp : uncontrolledOpen);
|
|
730
|
+
useApplyWebClassName(containerRef, className);
|
|
731
|
+
const setOpen = useCallback(
|
|
732
|
+
(next) => {
|
|
733
|
+
if (!isOpenControlled) setUncontrolledOpen(next);
|
|
734
|
+
onOpenChange?.(next);
|
|
735
|
+
if (!next) setHoveredKey(null);
|
|
494
736
|
},
|
|
495
|
-
|
|
496
|
-
style
|
|
497
|
-
];
|
|
498
|
-
const labelStyle = [
|
|
499
|
-
styles.label,
|
|
500
|
-
metrics.text,
|
|
501
|
-
{ color: preset.textColor },
|
|
502
|
-
Platform.OS === "android" ? styles.labelAndroid : null,
|
|
503
|
-
!hasIcon && styles.labelCentered,
|
|
504
|
-
textStyle
|
|
505
|
-
];
|
|
506
|
-
return /* @__PURE__ */ jsxs(
|
|
507
|
-
TouchableOpacity,
|
|
508
|
-
{
|
|
509
|
-
ref: containerRef,
|
|
510
|
-
style: containerStyle,
|
|
511
|
-
onPress,
|
|
512
|
-
disabled,
|
|
513
|
-
activeOpacity: 0.7,
|
|
514
|
-
accessibilityRole: "button",
|
|
515
|
-
accessibilityState: { disabled },
|
|
516
|
-
children: [
|
|
517
|
-
hasCustomChildren ? children : /* @__PURE__ */ jsx(Text, { ref: textRef, style: labelStyle, children: label }),
|
|
518
|
-
hasIcon ? /* @__PURE__ */ jsx(
|
|
519
|
-
View,
|
|
520
|
-
{
|
|
521
|
-
style: [
|
|
522
|
-
styles.iconContainer,
|
|
523
|
-
{
|
|
524
|
-
width: metrics.iconContainerSize,
|
|
525
|
-
height: metrics.iconContainerSize,
|
|
526
|
-
borderRadius: metrics.iconContainerSize / 2,
|
|
527
|
-
backgroundColor: preset.iconBadgeBackgroundColor
|
|
528
|
-
}
|
|
529
|
-
],
|
|
530
|
-
children: iconNode
|
|
531
|
-
}
|
|
532
|
-
) : null
|
|
533
|
-
]
|
|
534
|
-
}
|
|
737
|
+
[isOpenControlled, onOpenChange]
|
|
535
738
|
);
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
739
|
+
const focusTrigger = useCallback(() => {
|
|
740
|
+
const node = containerRef.current;
|
|
741
|
+
node?.focus?.();
|
|
742
|
+
}, []);
|
|
743
|
+
const closeAndFocusTrigger = useCallback(() => {
|
|
744
|
+
setOpen(false);
|
|
745
|
+
focusTrigger();
|
|
746
|
+
}, [focusTrigger, setOpen]);
|
|
747
|
+
const handlePress = (event) => {
|
|
748
|
+
onPress?.(event);
|
|
749
|
+
if (hasMenu) setOpen(!isOpen);
|
|
750
|
+
};
|
|
751
|
+
const handleItemPress = useCallback(
|
|
752
|
+
(item) => {
|
|
753
|
+
if (item.disabled) return;
|
|
754
|
+
item.onPress();
|
|
755
|
+
closeAndFocusTrigger();
|
|
756
|
+
},
|
|
757
|
+
[closeAndFocusTrigger]
|
|
758
|
+
);
|
|
759
|
+
useEffect(() => {
|
|
760
|
+
if (Platform.OS !== "web" || !isOpen) return;
|
|
761
|
+
const handlePointerDown = (event) => {
|
|
762
|
+
const wrapper = wrapperRef.current;
|
|
763
|
+
const target = event.target;
|
|
764
|
+
if (wrapper?.contains && target instanceof Node && !wrapper.contains(target)) {
|
|
765
|
+
setOpen(false);
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
document.addEventListener("mousedown", handlePointerDown);
|
|
769
|
+
document.addEventListener("touchstart", handlePointerDown);
|
|
770
|
+
return () => {
|
|
771
|
+
document.removeEventListener("mousedown", handlePointerDown);
|
|
772
|
+
document.removeEventListener("touchstart", handlePointerDown);
|
|
773
|
+
};
|
|
774
|
+
}, [isOpen, setOpen]);
|
|
775
|
+
useEffect(() => {
|
|
776
|
+
if (Platform.OS !== "web" || !isOpen) return;
|
|
777
|
+
const handleKeyDown = (event) => {
|
|
778
|
+
if (event.key === "Escape") {
|
|
779
|
+
event.preventDefault();
|
|
780
|
+
closeAndFocusTrigger();
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
784
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
785
|
+
}, [isOpen, closeAndFocusTrigger]);
|
|
786
|
+
const hasImage = Boolean(imageUrl) && !imageFailed;
|
|
787
|
+
const resolvedAccessibilityLabel = accessibilityLabel ?? [name, email].filter(Boolean).join(", ");
|
|
788
|
+
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [styles.wrapper, isOpen && styles.wrapperOpen], children: [
|
|
789
|
+
/* @__PURE__ */ jsxs(
|
|
790
|
+
Pressable,
|
|
791
|
+
{
|
|
792
|
+
...rest,
|
|
793
|
+
ref: setContainerRef,
|
|
794
|
+
onPress: handlePress,
|
|
795
|
+
disabled: disabled || !isInteractive,
|
|
796
|
+
hitSlop: isInteractive ? hitSlop : void 0,
|
|
797
|
+
accessibilityRole: isInteractive ? "button" : void 0,
|
|
798
|
+
accessibilityLabel: resolvedAccessibilityLabel,
|
|
799
|
+
accessibilityState: isInteractive ? { disabled, expanded: hasMenu ? isOpen : void 0 } : void 0,
|
|
800
|
+
style: [styles.root, disabled && styles.disabled, style],
|
|
801
|
+
children: [
|
|
802
|
+
/* @__PURE__ */ jsx(View, { style: styles.imageWrap, children: hasImage ? /* @__PURE__ */ jsx(
|
|
803
|
+
Image,
|
|
804
|
+
{
|
|
805
|
+
source: { uri: imageUrl ?? void 0 },
|
|
806
|
+
style: styles.image,
|
|
807
|
+
onError: () => setImageFailed(true)
|
|
808
|
+
}
|
|
809
|
+
) : /* @__PURE__ */ jsx(View, { style: styles.imageFallback, children: /* @__PURE__ */ jsx(UserIcon, { size: FALLBACK_ICON_SIZE, color: colors.primary }) }) }),
|
|
810
|
+
/* @__PURE__ */ jsxs(View, { style: styles.textColumn, children: [
|
|
811
|
+
/* @__PURE__ */ jsx(Text, { style: styles.name, numberOfLines: 1, children: name }),
|
|
812
|
+
email ? /* @__PURE__ */ jsx(Text, { style: styles.email, numberOfLines: 1, children: email }) : null
|
|
813
|
+
] }),
|
|
814
|
+
showChevron ? /* @__PURE__ */ jsx(View, { style: [styles.chevronSlot, isOpen && styles.chevronOpen], children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: CHEVRON_SIZE, color: isOpen ? colors.primary : colors.grey100 }) }) : null
|
|
815
|
+
]
|
|
816
|
+
}
|
|
817
|
+
),
|
|
818
|
+
hasMenu && isOpen ? /* @__PURE__ */ jsx(View, { style: [styles.menu, menuWidth != null && { right: void 0, width: menuWidth }], children: menuItems.map((item) => {
|
|
819
|
+
const itemKey = item.key ?? item.label;
|
|
820
|
+
const isHovered = hoveredKey === itemKey;
|
|
821
|
+
const backgroundColor = isHovered ? item.hoverColor ?? colors.grey600 : item.backgroundColor ?? "transparent";
|
|
822
|
+
return /* @__PURE__ */ jsxs(
|
|
823
|
+
Pressable,
|
|
824
|
+
{
|
|
825
|
+
onPress: () => handleItemPress(item),
|
|
826
|
+
disabled: item.disabled,
|
|
827
|
+
onHoverIn: () => setHoveredKey(itemKey),
|
|
828
|
+
onHoverOut: () => setHoveredKey((current) => current === itemKey ? null : current),
|
|
829
|
+
onPressIn: () => setHoveredKey(itemKey),
|
|
830
|
+
onPressOut: () => setHoveredKey((current) => current === itemKey ? null : current),
|
|
831
|
+
accessibilityRole: "menuitem",
|
|
832
|
+
accessibilityState: { disabled: item.disabled },
|
|
833
|
+
style: [
|
|
834
|
+
styles.menuItem,
|
|
835
|
+
{ backgroundColor },
|
|
836
|
+
item.disabled && styles.menuItemDisabled
|
|
837
|
+
],
|
|
838
|
+
children: [
|
|
839
|
+
item.icon ? /* @__PURE__ */ jsx(View, { style: styles.menuItemIcon, children: item.icon }) : null,
|
|
840
|
+
/* @__PURE__ */ jsx(Text, { style: styles.menuItemLabel, numberOfLines: 1, children: item.label })
|
|
841
|
+
]
|
|
842
|
+
},
|
|
843
|
+
itemKey
|
|
844
|
+
);
|
|
845
|
+
}) }) : null
|
|
846
|
+
] });
|
|
847
|
+
});
|
|
848
|
+
var styles = StyleSheet.create({
|
|
849
|
+
wrapper: {
|
|
850
|
+
position: "relative",
|
|
851
|
+
alignSelf: "flex-start"
|
|
852
|
+
},
|
|
853
|
+
wrapperOpen: {
|
|
854
|
+
zIndex: 20
|
|
855
|
+
},
|
|
856
|
+
root: {
|
|
857
|
+
flexDirection: "row",
|
|
858
|
+
alignItems: "center",
|
|
859
|
+
alignSelf: "flex-start",
|
|
860
|
+
gap: 12,
|
|
861
|
+
paddingTop: 4,
|
|
862
|
+
paddingBottom: 4,
|
|
863
|
+
paddingLeft: 4,
|
|
864
|
+
paddingRight: 12,
|
|
865
|
+
borderRadius: CONTAINER_RADIUS,
|
|
866
|
+
backgroundColor: colors.grey700
|
|
867
|
+
},
|
|
868
|
+
disabled: {
|
|
869
|
+
opacity: 0.6
|
|
870
|
+
},
|
|
871
|
+
imageWrap: {
|
|
872
|
+
width: IMAGE_SIZE,
|
|
873
|
+
height: IMAGE_SIZE,
|
|
874
|
+
borderRadius: IMAGE_SIZE / 2,
|
|
875
|
+
overflow: "hidden",
|
|
876
|
+
flexShrink: 0
|
|
877
|
+
},
|
|
878
|
+
image: {
|
|
879
|
+
width: IMAGE_SIZE,
|
|
880
|
+
height: IMAGE_SIZE
|
|
881
|
+
},
|
|
882
|
+
imageFallback: {
|
|
883
|
+
width: IMAGE_SIZE,
|
|
884
|
+
height: IMAGE_SIZE,
|
|
885
|
+
alignItems: "center",
|
|
886
|
+
justifyContent: "center",
|
|
887
|
+
backgroundColor: colors.grey600
|
|
888
|
+
},
|
|
889
|
+
textColumn: {
|
|
890
|
+
minWidth: 0,
|
|
891
|
+
flexShrink: 1,
|
|
892
|
+
gap: 3
|
|
893
|
+
},
|
|
894
|
+
name: {
|
|
895
|
+
...avatarTypography.name,
|
|
896
|
+
color: colors.white
|
|
897
|
+
},
|
|
898
|
+
email: {
|
|
899
|
+
...avatarTypography.email,
|
|
900
|
+
color: colors.grey0
|
|
901
|
+
},
|
|
902
|
+
chevronSlot: {
|
|
903
|
+
width: CHEVRON_SIZE,
|
|
904
|
+
height: CHEVRON_SIZE,
|
|
905
|
+
alignItems: "center",
|
|
906
|
+
justifyContent: "center",
|
|
907
|
+
flexShrink: 0
|
|
908
|
+
},
|
|
909
|
+
chevronOpen: {
|
|
910
|
+
transform: [{ rotate: "180deg" }]
|
|
911
|
+
},
|
|
912
|
+
menu: {
|
|
913
|
+
position: "absolute",
|
|
914
|
+
top: "100%",
|
|
915
|
+
left: 0,
|
|
916
|
+
right: 0,
|
|
917
|
+
marginTop: 8,
|
|
918
|
+
zIndex: 10,
|
|
919
|
+
borderRadius: MENU_RADIUS,
|
|
920
|
+
padding: 8,
|
|
921
|
+
gap: 8,
|
|
922
|
+
backgroundColor: colors.grey700,
|
|
923
|
+
...Platform.select({
|
|
924
|
+
web: {
|
|
925
|
+
boxShadow: `0 8px 24px ${colors.black}73`
|
|
926
|
+
},
|
|
927
|
+
default: {
|
|
928
|
+
elevation: 8
|
|
929
|
+
}
|
|
930
|
+
})
|
|
931
|
+
},
|
|
932
|
+
menuItem: {
|
|
933
|
+
minHeight: 40,
|
|
934
|
+
borderRadius: MENU_ITEM_RADIUS,
|
|
935
|
+
paddingVertical: 12,
|
|
936
|
+
paddingHorizontal: 12,
|
|
937
|
+
flexDirection: "row",
|
|
938
|
+
alignItems: "center",
|
|
939
|
+
gap: 8
|
|
940
|
+
},
|
|
941
|
+
menuItemDisabled: {
|
|
942
|
+
opacity: 0.5
|
|
943
|
+
},
|
|
944
|
+
menuItemIcon: {
|
|
945
|
+
width: MENU_ITEM_ICON_SIZE,
|
|
946
|
+
height: MENU_ITEM_ICON_SIZE,
|
|
947
|
+
alignItems: "center",
|
|
948
|
+
justifyContent: "center",
|
|
949
|
+
flexShrink: 0
|
|
950
|
+
},
|
|
951
|
+
menuItemLabel: {
|
|
952
|
+
...avatarTypography.menuItem,
|
|
953
|
+
color: colors.white,
|
|
954
|
+
flex: 1
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
var variantConfig = {
|
|
958
|
+
primary: {
|
|
959
|
+
backgroundColor: colors.primary,
|
|
960
|
+
textColor: colors.white,
|
|
961
|
+
iconBadgeBackgroundColor: colors.white,
|
|
962
|
+
iconColor: colors.primary
|
|
963
|
+
},
|
|
964
|
+
secondary: {
|
|
965
|
+
backgroundColor: colors.grey500,
|
|
966
|
+
textColor: colors.white,
|
|
967
|
+
iconBadgeBackgroundColor: colors.grey600,
|
|
968
|
+
iconColor: colors.white
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
var sizeConfig = {
|
|
972
|
+
lg: {
|
|
973
|
+
minHeight: 44,
|
|
974
|
+
borderRadius: 40,
|
|
975
|
+
paddingVertical: 4,
|
|
976
|
+
paddingLeft: 20,
|
|
977
|
+
paddingRightWithIcon: 4,
|
|
978
|
+
paddingRight: 20,
|
|
979
|
+
gap: 20,
|
|
980
|
+
text: buttonTypography.lg,
|
|
981
|
+
iconContainerSize: 36,
|
|
982
|
+
iconSize: 20
|
|
983
|
+
},
|
|
984
|
+
sm: {
|
|
985
|
+
minHeight: 32,
|
|
986
|
+
borderRadius: 40,
|
|
987
|
+
paddingVertical: 6,
|
|
988
|
+
paddingLeft: 12,
|
|
989
|
+
paddingRightWithIcon: 4,
|
|
990
|
+
paddingRight: 12,
|
|
991
|
+
gap: 12,
|
|
992
|
+
text: buttonTypography.sm,
|
|
993
|
+
iconContainerSize: 20,
|
|
994
|
+
iconSize: 12
|
|
995
|
+
}
|
|
996
|
+
};
|
|
997
|
+
var Button = forwardRef(
|
|
998
|
+
function Button2({
|
|
999
|
+
title,
|
|
1000
|
+
children,
|
|
1001
|
+
onPress,
|
|
1002
|
+
disabled = false,
|
|
1003
|
+
variant = "primary",
|
|
1004
|
+
size = "lg",
|
|
1005
|
+
showIcon = false,
|
|
1006
|
+
icon,
|
|
1007
|
+
style,
|
|
1008
|
+
textStyle,
|
|
1009
|
+
className,
|
|
1010
|
+
textClassName,
|
|
1011
|
+
accessibilityLabel,
|
|
1012
|
+
...rest
|
|
1013
|
+
}, forwardedRef) {
|
|
1014
|
+
const containerRef = useRef(null);
|
|
1015
|
+
const textRef = useRef(null);
|
|
1016
|
+
const preset = variantConfig[variant];
|
|
1017
|
+
const metrics = sizeConfig[size];
|
|
1018
|
+
const label = typeof children !== "undefined" ? children : title;
|
|
1019
|
+
const hasCustomChildren = typeof children !== "undefined";
|
|
1020
|
+
const customIcon = icon != null && typeof icon !== "boolean" ? icon : void 0;
|
|
1021
|
+
const hasIcon = showIcon || icon === true || customIcon != null;
|
|
1022
|
+
const resolvedContainerClassName = className?.trim() || void 0;
|
|
1023
|
+
const resolvedAccessibilityLabel = accessibilityLabel ?? (typeof label === "string" ? label : void 0);
|
|
1024
|
+
const setContainerRef = useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
|
|
1025
|
+
useApplyWebClassName(containerRef, resolvedContainerClassName);
|
|
1026
|
+
useApplyWebClassName(textRef, textClassName);
|
|
1027
|
+
const iconNode = customIcon ?? /* @__PURE__ */ jsx(ArrowRightIcon, { size: metrics.iconSize, color: preset.iconColor });
|
|
1028
|
+
const containerStyle = [
|
|
1029
|
+
styles2.base,
|
|
1030
|
+
{
|
|
1031
|
+
minHeight: metrics.minHeight,
|
|
1032
|
+
borderRadius: metrics.borderRadius,
|
|
1033
|
+
backgroundColor: preset.backgroundColor,
|
|
1034
|
+
paddingTop: metrics.paddingVertical,
|
|
1035
|
+
paddingBottom: metrics.paddingVertical,
|
|
1036
|
+
paddingLeft: metrics.paddingLeft,
|
|
1037
|
+
paddingRight: hasIcon ? metrics.paddingRightWithIcon : metrics.paddingRight,
|
|
1038
|
+
gap: hasIcon ? metrics.gap : 0
|
|
1039
|
+
},
|
|
1040
|
+
disabled && styles2.disabled,
|
|
1041
|
+
style
|
|
1042
|
+
];
|
|
1043
|
+
const labelStyle = [
|
|
1044
|
+
styles2.label,
|
|
1045
|
+
metrics.text,
|
|
1046
|
+
{ color: preset.textColor },
|
|
1047
|
+
Platform.OS === "android" ? styles2.labelAndroid : null,
|
|
1048
|
+
!hasIcon && styles2.labelCentered,
|
|
1049
|
+
textStyle
|
|
1050
|
+
];
|
|
1051
|
+
return /* @__PURE__ */ jsxs(
|
|
1052
|
+
TouchableOpacity,
|
|
1053
|
+
{
|
|
1054
|
+
...rest,
|
|
1055
|
+
ref: setContainerRef,
|
|
1056
|
+
style: containerStyle,
|
|
1057
|
+
onPress,
|
|
1058
|
+
disabled,
|
|
1059
|
+
activeOpacity: 0.7,
|
|
1060
|
+
accessibilityRole: "button",
|
|
1061
|
+
accessibilityLabel: resolvedAccessibilityLabel,
|
|
1062
|
+
accessibilityState: { disabled },
|
|
1063
|
+
children: [
|
|
1064
|
+
hasCustomChildren ? children : /* @__PURE__ */ jsx(Text, { ref: textRef, style: labelStyle, children: label }),
|
|
1065
|
+
hasIcon ? /* @__PURE__ */ jsx(
|
|
1066
|
+
View,
|
|
1067
|
+
{
|
|
1068
|
+
style: [
|
|
1069
|
+
styles2.iconContainer,
|
|
1070
|
+
{
|
|
1071
|
+
width: metrics.iconContainerSize,
|
|
1072
|
+
height: metrics.iconContainerSize,
|
|
1073
|
+
borderRadius: metrics.iconContainerSize / 2,
|
|
1074
|
+
backgroundColor: preset.iconBadgeBackgroundColor
|
|
1075
|
+
}
|
|
1076
|
+
],
|
|
1077
|
+
children: iconNode
|
|
1078
|
+
}
|
|
1079
|
+
) : null
|
|
1080
|
+
]
|
|
1081
|
+
}
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1084
|
+
);
|
|
1085
|
+
var styles2 = StyleSheet.create({
|
|
1086
|
+
base: {
|
|
1087
|
+
flexDirection: "row",
|
|
540
1088
|
alignItems: "center",
|
|
541
1089
|
alignSelf: "flex-start",
|
|
542
1090
|
borderWidth: 0
|
|
@@ -557,6 +1105,105 @@ var styles = StyleSheet.create({
|
|
|
557
1105
|
flexShrink: 0
|
|
558
1106
|
}
|
|
559
1107
|
});
|
|
1108
|
+
var BOX_SIZE = 20;
|
|
1109
|
+
var BOX_RADIUS = 6;
|
|
1110
|
+
var CHECK_SIZE = 12;
|
|
1111
|
+
var CHECK_STROKE = 2.5;
|
|
1112
|
+
var variantChrome = {
|
|
1113
|
+
default: {
|
|
1114
|
+
backgroundColor: colors.dark,
|
|
1115
|
+
borderColor: colors.grey700
|
|
1116
|
+
},
|
|
1117
|
+
light: {
|
|
1118
|
+
backgroundColor: colors.grey700,
|
|
1119
|
+
borderColor: colors.grey500
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
var Checkbox = forwardRef(function Checkbox2({
|
|
1123
|
+
value,
|
|
1124
|
+
defaultValue = false,
|
|
1125
|
+
onValueChange,
|
|
1126
|
+
disabled = false,
|
|
1127
|
+
variant = "default",
|
|
1128
|
+
label,
|
|
1129
|
+
children,
|
|
1130
|
+
style,
|
|
1131
|
+
labelStyle,
|
|
1132
|
+
className,
|
|
1133
|
+
hitSlop = 8,
|
|
1134
|
+
accessibilityLabel,
|
|
1135
|
+
...rest
|
|
1136
|
+
}, forwardedRef) {
|
|
1137
|
+
const containerRef = useRef(null);
|
|
1138
|
+
const isControlled = typeof value === "boolean";
|
|
1139
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
1140
|
+
const isActive = isControlled ? value : uncontrolledValue;
|
|
1141
|
+
const chrome = variantChrome[variant];
|
|
1142
|
+
const labelContent = children ?? label;
|
|
1143
|
+
const resolvedAccessibilityLabel = accessibilityLabel ?? (typeof labelContent === "string" ? labelContent : void 0);
|
|
1144
|
+
const setContainerRef = useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
|
|
1145
|
+
useApplyWebClassName(containerRef, className);
|
|
1146
|
+
const handlePress = () => {
|
|
1147
|
+
if (disabled) return;
|
|
1148
|
+
const next = !isActive;
|
|
1149
|
+
if (!isControlled) setUncontrolledValue(next);
|
|
1150
|
+
onValueChange?.(next);
|
|
1151
|
+
};
|
|
1152
|
+
return /* @__PURE__ */ jsxs(
|
|
1153
|
+
Pressable,
|
|
1154
|
+
{
|
|
1155
|
+
...rest,
|
|
1156
|
+
ref: setContainerRef,
|
|
1157
|
+
onPress: handlePress,
|
|
1158
|
+
disabled,
|
|
1159
|
+
hitSlop,
|
|
1160
|
+
accessibilityRole: "checkbox",
|
|
1161
|
+
accessibilityLabel: resolvedAccessibilityLabel,
|
|
1162
|
+
accessibilityState: { checked: isActive, disabled },
|
|
1163
|
+
style: [styles3.root, disabled && styles3.disabled, style],
|
|
1164
|
+
children: [
|
|
1165
|
+
/* @__PURE__ */ jsx(
|
|
1166
|
+
View,
|
|
1167
|
+
{
|
|
1168
|
+
style: [
|
|
1169
|
+
styles3.box,
|
|
1170
|
+
{
|
|
1171
|
+
backgroundColor: chrome.backgroundColor,
|
|
1172
|
+
borderColor: chrome.borderColor
|
|
1173
|
+
}
|
|
1174
|
+
],
|
|
1175
|
+
children: isActive ? /* @__PURE__ */ jsx(CheckIcon, { size: CHECK_SIZE, color: colors.primary, strokeWidth: CHECK_STROKE }) : null
|
|
1176
|
+
}
|
|
1177
|
+
),
|
|
1178
|
+
labelContent != null && labelContent !== false ? typeof labelContent === "string" || typeof labelContent === "number" ? /* @__PURE__ */ jsx(Text, { style: [styles3.label, labelStyle], children: labelContent }) : labelContent : null
|
|
1179
|
+
]
|
|
1180
|
+
}
|
|
1181
|
+
);
|
|
1182
|
+
});
|
|
1183
|
+
var styles3 = StyleSheet.create({
|
|
1184
|
+
root: {
|
|
1185
|
+
flexDirection: "row",
|
|
1186
|
+
alignItems: "center",
|
|
1187
|
+
alignSelf: "flex-start",
|
|
1188
|
+
gap: 10
|
|
1189
|
+
},
|
|
1190
|
+
disabled: {
|
|
1191
|
+
opacity: 0.5
|
|
1192
|
+
},
|
|
1193
|
+
box: {
|
|
1194
|
+
width: BOX_SIZE,
|
|
1195
|
+
height: BOX_SIZE,
|
|
1196
|
+
borderRadius: BOX_RADIUS,
|
|
1197
|
+
borderWidth: 1,
|
|
1198
|
+
alignItems: "center",
|
|
1199
|
+
justifyContent: "center",
|
|
1200
|
+
flexShrink: 0
|
|
1201
|
+
},
|
|
1202
|
+
label: {
|
|
1203
|
+
...inputTypography.field,
|
|
1204
|
+
color: colors.white
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
560
1207
|
var DEFAULT_WIDTH = 308;
|
|
561
1208
|
var sizeConfig2 = {
|
|
562
1209
|
lg: {
|
|
@@ -578,14 +1225,12 @@ var sizeConfig2 = {
|
|
|
578
1225
|
text: inputTypography.hint
|
|
579
1226
|
}
|
|
580
1227
|
};
|
|
581
|
-
function
|
|
582
|
-
state,
|
|
1228
|
+
function resolveVisualState({
|
|
583
1229
|
disabled,
|
|
584
1230
|
error,
|
|
585
1231
|
focused,
|
|
586
1232
|
hasValue
|
|
587
1233
|
}) {
|
|
588
|
-
if (state) return state;
|
|
589
1234
|
if (disabled) return "disabled";
|
|
590
1235
|
if (error) return "error";
|
|
591
1236
|
if (focused) return "active";
|
|
@@ -637,13 +1282,12 @@ function chromeFor(state) {
|
|
|
637
1282
|
return base;
|
|
638
1283
|
}
|
|
639
1284
|
}
|
|
640
|
-
|
|
1285
|
+
var Input = forwardRef(function Input2({
|
|
641
1286
|
label = "Label",
|
|
642
1287
|
showLabel = true,
|
|
643
1288
|
hint = "Hint",
|
|
644
1289
|
showHint = true,
|
|
645
1290
|
placeholder = "placeholder",
|
|
646
|
-
state: stateProp,
|
|
647
1291
|
size = "lg",
|
|
648
1292
|
disabled = false,
|
|
649
1293
|
error = false,
|
|
@@ -657,43 +1301,40 @@ function Input({
|
|
|
657
1301
|
rightIcon,
|
|
658
1302
|
showRightIcon = false,
|
|
659
1303
|
onRightIconPress,
|
|
1304
|
+
rightIconAccessibilityLabel,
|
|
660
1305
|
style,
|
|
661
1306
|
fieldStyle,
|
|
662
1307
|
inputStyle,
|
|
663
1308
|
className,
|
|
664
1309
|
inputClassName,
|
|
1310
|
+
accessibilityLabel,
|
|
665
1311
|
...textInputProps
|
|
666
|
-
}) {
|
|
1312
|
+
}, forwardedRef) {
|
|
667
1313
|
const rootRef = useRef(null);
|
|
668
1314
|
const inputRef = useRef(null);
|
|
1315
|
+
const setInputRef = useMemo(() => mergeRefs(inputRef, forwardedRef), [forwardedRef]);
|
|
669
1316
|
const [focused, setFocused] = useState(false);
|
|
670
1317
|
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue ?? "");
|
|
671
1318
|
const metrics = sizeConfig2[size];
|
|
672
1319
|
const isControlled = typeof value === "string";
|
|
673
1320
|
const currentValue = isControlled ? value : uncontrolledValue;
|
|
674
1321
|
const hasValue = currentValue.length > 0;
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
error,
|
|
679
|
-
focused,
|
|
680
|
-
hasValue
|
|
681
|
-
});
|
|
682
|
-
const chrome = chromeFor(resolvedState);
|
|
683
|
-
const isDisabled = resolvedState === "disabled" || disabled;
|
|
1322
|
+
const visualState = resolveVisualState({ disabled, error, focused, hasValue });
|
|
1323
|
+
const chrome = chromeFor(visualState);
|
|
1324
|
+
const resolvedAccessibilityLabel = accessibilityLabel ?? (showLabel ? void 0 : label);
|
|
684
1325
|
const hasLeftIcon = showLeftIcon || leftIcon != null;
|
|
685
1326
|
const hasRightIcon = showRightIcon || rightIcon != null;
|
|
686
1327
|
const leftIconNode = leftIcon ?? /* @__PURE__ */ jsx(UserIcon, { size: metrics.iconSize, color: chrome.leftIconColor });
|
|
687
1328
|
const rightIconNode = rightIcon ?? /* @__PURE__ */ jsx(ShowIcon, { size: metrics.iconSize, color: chrome.rightIconColor });
|
|
688
1329
|
useApplyWebClassName(rootRef, className);
|
|
689
1330
|
useApplyWebClassName(inputRef, inputClassName);
|
|
690
|
-
return /* @__PURE__ */ jsxs(View, { ref: rootRef, style: [
|
|
691
|
-
showLabel && label ? /* @__PURE__ */ jsx(Text, { style: [
|
|
1331
|
+
return /* @__PURE__ */ jsxs(View, { ref: rootRef, style: [styles4.root, disabled && styles4.disabled, style], children: [
|
|
1332
|
+
showLabel && label ? /* @__PURE__ */ jsx(Text, { style: [styles4.label, { color: chrome.labelColor }], children: label }) : null,
|
|
692
1333
|
/* @__PURE__ */ jsxs(
|
|
693
1334
|
View,
|
|
694
1335
|
{
|
|
695
1336
|
style: [
|
|
696
|
-
|
|
1337
|
+
styles4.field,
|
|
697
1338
|
{
|
|
698
1339
|
height: metrics.height,
|
|
699
1340
|
borderRadius: metrics.borderRadius,
|
|
@@ -708,15 +1349,15 @@ function Input({
|
|
|
708
1349
|
fieldStyle
|
|
709
1350
|
],
|
|
710
1351
|
children: [
|
|
711
|
-
hasLeftIcon ? /* @__PURE__ */ jsx(View, { style: [
|
|
1352
|
+
hasLeftIcon ? /* @__PURE__ */ jsx(View, { style: [styles4.iconSlot, { width: metrics.iconSize, height: metrics.iconSize }], children: leftIconNode }) : null,
|
|
712
1353
|
/* @__PURE__ */ jsx(
|
|
713
1354
|
TextInput,
|
|
714
1355
|
{
|
|
715
|
-
ref:
|
|
1356
|
+
ref: setInputRef,
|
|
716
1357
|
...textInputProps,
|
|
717
1358
|
value: isControlled ? value : void 0,
|
|
718
1359
|
defaultValue: isControlled ? void 0 : defaultValue,
|
|
719
|
-
editable: !
|
|
1360
|
+
editable: !disabled,
|
|
720
1361
|
placeholder,
|
|
721
1362
|
placeholderTextColor: chrome.placeholderColor,
|
|
722
1363
|
onChangeText: (text) => {
|
|
@@ -732,34 +1373,36 @@ function Input({
|
|
|
732
1373
|
onBlur?.(event);
|
|
733
1374
|
},
|
|
734
1375
|
style: [
|
|
735
|
-
|
|
1376
|
+
styles4.input,
|
|
736
1377
|
metrics.text,
|
|
737
1378
|
{ color: chrome.textColor },
|
|
738
|
-
Platform.OS === "web" ?
|
|
739
|
-
Platform.OS === "android" ?
|
|
1379
|
+
Platform.OS === "web" ? styles4.inputWeb : null,
|
|
1380
|
+
Platform.OS === "android" ? styles4.inputAndroid : null,
|
|
740
1381
|
inputStyle
|
|
741
1382
|
],
|
|
742
|
-
|
|
1383
|
+
accessibilityLabel: resolvedAccessibilityLabel,
|
|
1384
|
+
accessibilityState: { disabled }
|
|
743
1385
|
}
|
|
744
1386
|
),
|
|
745
1387
|
hasRightIcon ? onRightIconPress ? /* @__PURE__ */ jsx(
|
|
746
1388
|
TouchableOpacity,
|
|
747
1389
|
{
|
|
748
1390
|
onPress: onRightIconPress,
|
|
749
|
-
disabled
|
|
750
|
-
style: [
|
|
1391
|
+
disabled,
|
|
1392
|
+
style: [styles4.iconSlot, { width: metrics.iconSize, height: metrics.iconSize }],
|
|
751
1393
|
accessibilityRole: "button",
|
|
1394
|
+
accessibilityLabel: rightIconAccessibilityLabel,
|
|
752
1395
|
hitSlop: 8,
|
|
753
1396
|
children: rightIconNode
|
|
754
1397
|
}
|
|
755
|
-
) : /* @__PURE__ */ jsx(View, { style: [
|
|
1398
|
+
) : /* @__PURE__ */ jsx(View, { style: [styles4.iconSlot, { width: metrics.iconSize, height: metrics.iconSize }], children: rightIconNode }) : null
|
|
756
1399
|
]
|
|
757
1400
|
}
|
|
758
1401
|
),
|
|
759
|
-
showHint && hint ? /* @__PURE__ */ jsx(Text, { style: [
|
|
1402
|
+
showHint && hint ? /* @__PURE__ */ jsx(Text, { style: [styles4.hint, { color: chrome.hintColor }], children: hint }) : null
|
|
760
1403
|
] });
|
|
761
|
-
}
|
|
762
|
-
var
|
|
1404
|
+
});
|
|
1405
|
+
var styles4 = StyleSheet.create({
|
|
763
1406
|
root: {
|
|
764
1407
|
width: DEFAULT_WIDTH,
|
|
765
1408
|
gap: 8,
|
|
@@ -796,7 +1439,925 @@ var styles2 = StyleSheet.create({
|
|
|
796
1439
|
...inputTypography.hint
|
|
797
1440
|
}
|
|
798
1441
|
});
|
|
1442
|
+
var DEFAULT_WIDTH2 = 308;
|
|
1443
|
+
var TRIGGER_HEIGHT = 44;
|
|
1444
|
+
var TRIGGER_RADIUS = 60;
|
|
1445
|
+
var MENU_RADIUS2 = 24;
|
|
1446
|
+
var MENU_MAX_LIST_HEIGHT = 248;
|
|
1447
|
+
var ITEM_RADIUS = 12;
|
|
1448
|
+
var ICON_SIZE = 20;
|
|
1449
|
+
var CHIP_GAP = 6;
|
|
1450
|
+
var FALLBACK_ELLIPSIS_WIDTH = 20;
|
|
1451
|
+
function itemBackground(state) {
|
|
1452
|
+
switch (state) {
|
|
1453
|
+
case "hover":
|
|
1454
|
+
return colors.grey600;
|
|
1455
|
+
case "selected":
|
|
1456
|
+
return colors.primaryMuted;
|
|
1457
|
+
default:
|
|
1458
|
+
return "transparent";
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
function toArray(value) {
|
|
1462
|
+
if (value == null || value === "") return [];
|
|
1463
|
+
return Array.isArray(value) ? value : [value];
|
|
1464
|
+
}
|
|
1465
|
+
function resolveVisibleOptions(options, containerWidth, chipWidths, ellipsisWidth) {
|
|
1466
|
+
if (options.length === 0) return { visible: [], hasOverflow: false };
|
|
1467
|
+
if (containerWidth <= 0) return { visible: options.slice(0, 1), hasOverflow: options.length > 1 };
|
|
1468
|
+
const visible = [];
|
|
1469
|
+
let used = 0;
|
|
1470
|
+
for (let index = 0; index < options.length; index += 1) {
|
|
1471
|
+
const option = options[index];
|
|
1472
|
+
const chipWidth = chipWidths[option.value];
|
|
1473
|
+
if (chipWidth == null) {
|
|
1474
|
+
if (visible.length === 0) visible.push(option);
|
|
1475
|
+
break;
|
|
1476
|
+
}
|
|
1477
|
+
const remainingAfter = options.length - index - 1;
|
|
1478
|
+
const gap = visible.length > 0 ? CHIP_GAP : 0;
|
|
1479
|
+
const reserve = remainingAfter > 0 ? CHIP_GAP + ellipsisWidth : 0;
|
|
1480
|
+
const nextUsed = used + gap + chipWidth;
|
|
1481
|
+
if (visible.length > 0 && nextUsed + reserve > containerWidth) {
|
|
1482
|
+
return { visible, hasOverflow: true };
|
|
1483
|
+
}
|
|
1484
|
+
visible.push(option);
|
|
1485
|
+
used = nextUsed;
|
|
1486
|
+
}
|
|
1487
|
+
return { visible, hasOverflow: visible.length < options.length };
|
|
1488
|
+
}
|
|
1489
|
+
function MultiValueChips({ options, disabled, onRemove }) {
|
|
1490
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
1491
|
+
const [chipWidths, setChipWidths] = useState({});
|
|
1492
|
+
const [ellipsisWidth, setEllipsisWidth] = useState(FALLBACK_ELLIPSIS_WIDTH);
|
|
1493
|
+
useEffect(() => {
|
|
1494
|
+
setChipWidths((current) => {
|
|
1495
|
+
const validValues = new Set(options.map((option) => option.value));
|
|
1496
|
+
const keys = Object.keys(current);
|
|
1497
|
+
if (keys.every((key) => validValues.has(key))) return current;
|
|
1498
|
+
const next = {};
|
|
1499
|
+
for (const key of keys) {
|
|
1500
|
+
if (validValues.has(key)) next[key] = current[key];
|
|
1501
|
+
}
|
|
1502
|
+
return next;
|
|
1503
|
+
});
|
|
1504
|
+
}, [options]);
|
|
1505
|
+
const { visible, hasOverflow } = useMemo(
|
|
1506
|
+
() => resolveVisibleOptions(options, containerWidth, chipWidths, ellipsisWidth),
|
|
1507
|
+
[chipWidths, containerWidth, ellipsisWidth, options]
|
|
1508
|
+
);
|
|
1509
|
+
const handleContainerLayout = (event) => {
|
|
1510
|
+
const next = Math.floor(event.nativeEvent.layout.width);
|
|
1511
|
+
setContainerWidth((current) => current === next ? current : next);
|
|
1512
|
+
};
|
|
1513
|
+
const handleChipLayout = (value, event) => {
|
|
1514
|
+
const next = Math.ceil(event.nativeEvent.layout.width);
|
|
1515
|
+
setChipWidths((current) => current[value] === next ? current : { ...current, [value]: next });
|
|
1516
|
+
};
|
|
1517
|
+
const handleEllipsisLayout = (event) => {
|
|
1518
|
+
const next = Math.ceil(event.nativeEvent.layout.width);
|
|
1519
|
+
setEllipsisWidth((current) => current === next ? current : next);
|
|
1520
|
+
};
|
|
1521
|
+
return /* @__PURE__ */ jsxs(View, { style: styles5.multiValueRoot, children: [
|
|
1522
|
+
/* @__PURE__ */ jsxs(View, { pointerEvents: "none", style: styles5.measureRow, children: [
|
|
1523
|
+
options.map((option) => /* @__PURE__ */ jsxs(
|
|
1524
|
+
View,
|
|
1525
|
+
{
|
|
1526
|
+
style: styles5.chip,
|
|
1527
|
+
onLayout: (event) => handleChipLayout(option.value, event),
|
|
1528
|
+
children: [
|
|
1529
|
+
/* @__PURE__ */ jsx(Text, { style: styles5.chipLabel, numberOfLines: 1, children: option.label }),
|
|
1530
|
+
/* @__PURE__ */ jsx(Text, { style: styles5.chipRemove, children: "\xD7" })
|
|
1531
|
+
]
|
|
1532
|
+
},
|
|
1533
|
+
`measure-${option.value}`
|
|
1534
|
+
)),
|
|
1535
|
+
/* @__PURE__ */ jsx(View, { style: styles5.ellipsis, onLayout: handleEllipsisLayout, children: /* @__PURE__ */ jsx(Text, { style: styles5.ellipsisText, children: "..." }) })
|
|
1536
|
+
] }),
|
|
1537
|
+
/* @__PURE__ */ jsxs(View, { style: styles5.chipsRow, onLayout: handleContainerLayout, children: [
|
|
1538
|
+
visible.map((option) => /* @__PURE__ */ jsxs(View, { style: styles5.chip, children: [
|
|
1539
|
+
/* @__PURE__ */ jsx(Text, { style: styles5.chipLabel, numberOfLines: 1, children: option.label }),
|
|
1540
|
+
/* @__PURE__ */ jsx(
|
|
1541
|
+
Pressable,
|
|
1542
|
+
{
|
|
1543
|
+
onPress: (event) => {
|
|
1544
|
+
event?.stopPropagation?.();
|
|
1545
|
+
onRemove(option.value);
|
|
1546
|
+
},
|
|
1547
|
+
disabled,
|
|
1548
|
+
hitSlop: 6,
|
|
1549
|
+
accessibilityRole: "button",
|
|
1550
|
+
accessibilityLabel: `Remove ${option.label}`,
|
|
1551
|
+
children: /* @__PURE__ */ jsx(Text, { style: styles5.chipRemove, children: "\xD7" })
|
|
1552
|
+
}
|
|
1553
|
+
)
|
|
1554
|
+
] }, option.value)),
|
|
1555
|
+
hasOverflow ? /* @__PURE__ */ jsx(View, { style: styles5.ellipsis, children: /* @__PURE__ */ jsx(Text, { style: styles5.ellipsisText, children: "..." }) }) : null
|
|
1556
|
+
] })
|
|
1557
|
+
] });
|
|
1558
|
+
}
|
|
1559
|
+
var Select = forwardRef(
|
|
1560
|
+
function Select2(props, forwardedRef) {
|
|
1561
|
+
const {
|
|
1562
|
+
label = "Label",
|
|
1563
|
+
showLabel = true,
|
|
1564
|
+
hint,
|
|
1565
|
+
showHint = false,
|
|
1566
|
+
placeholder = "placeholder",
|
|
1567
|
+
options,
|
|
1568
|
+
open: openProp,
|
|
1569
|
+
defaultOpen = false,
|
|
1570
|
+
onOpenChange,
|
|
1571
|
+
disabled = false,
|
|
1572
|
+
error = false,
|
|
1573
|
+
leftIcon,
|
|
1574
|
+
showLeftIcon = true,
|
|
1575
|
+
showSearch = true,
|
|
1576
|
+
searchPlaceholder = "Search...",
|
|
1577
|
+
onSearchChange,
|
|
1578
|
+
loading = false,
|
|
1579
|
+
emptyText = "No results",
|
|
1580
|
+
style,
|
|
1581
|
+
className,
|
|
1582
|
+
accessibilityLabel,
|
|
1583
|
+
// Pulled out only to keep them off `rest` (which is spread onto the root View);
|
|
1584
|
+
// the real values are read from `props` directly below to preserve discriminated typing.
|
|
1585
|
+
multiple: _multiple,
|
|
1586
|
+
value: _value,
|
|
1587
|
+
defaultValue: _defaultValue,
|
|
1588
|
+
onValueChange: _onValueChange,
|
|
1589
|
+
...rest
|
|
1590
|
+
} = props;
|
|
1591
|
+
const multiple = props.multiple === true;
|
|
1592
|
+
const valueProp = props.value;
|
|
1593
|
+
const rootRef = useRef(null);
|
|
1594
|
+
const triggerRef = useRef(null);
|
|
1595
|
+
const searchInputRef = useRef(null);
|
|
1596
|
+
const setRootRef = useMemo(() => mergeRefs(rootRef, forwardedRef), [forwardedRef]);
|
|
1597
|
+
const isOpenControlled = typeof openProp === "boolean";
|
|
1598
|
+
const isValueControlled = valueProp !== void 0;
|
|
1599
|
+
const [uncontrolledSingle, setUncontrolledSingle] = useState(
|
|
1600
|
+
!multiple ? props.defaultValue ?? "" : ""
|
|
1601
|
+
);
|
|
1602
|
+
const [uncontrolledMultiple, setUncontrolledMultiple] = useState(
|
|
1603
|
+
multiple ? props.defaultValue ?? [] : []
|
|
1604
|
+
);
|
|
1605
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
1606
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
1607
|
+
const [hoveredValue, setHoveredValue] = useState(null);
|
|
1608
|
+
const selectedValues = useMemo(() => {
|
|
1609
|
+
const current = isValueControlled ? valueProp : multiple ? uncontrolledMultiple : uncontrolledSingle;
|
|
1610
|
+
return toArray(current);
|
|
1611
|
+
}, [isValueControlled, multiple, valueProp, uncontrolledMultiple, uncontrolledSingle]);
|
|
1612
|
+
const isOpen = isOpenControlled ? openProp : uncontrolledOpen;
|
|
1613
|
+
const selectedOptions = useMemo(
|
|
1614
|
+
() => selectedValues.map((value) => options.find((option) => option.value === value)).filter((option) => option != null),
|
|
1615
|
+
[options, selectedValues]
|
|
1616
|
+
);
|
|
1617
|
+
const hasValue = selectedOptions.length > 0;
|
|
1618
|
+
const isExternalSearch = onSearchChange != null;
|
|
1619
|
+
const filteredOptions = useMemo(() => {
|
|
1620
|
+
if (isExternalSearch) return options;
|
|
1621
|
+
const query = searchQuery.trim().toLowerCase();
|
|
1622
|
+
if (!query) return options;
|
|
1623
|
+
return options.filter((option) => option.label.toLowerCase().includes(query));
|
|
1624
|
+
}, [isExternalSearch, options, searchQuery]);
|
|
1625
|
+
useApplyWebClassName(rootRef, className);
|
|
1626
|
+
const setOpen = useCallback(
|
|
1627
|
+
(next) => {
|
|
1628
|
+
if (!isOpenControlled) setUncontrolledOpen(next);
|
|
1629
|
+
onOpenChange?.(next);
|
|
1630
|
+
if (next) {
|
|
1631
|
+
setHoveredValue(selectedValues[0] ?? null);
|
|
1632
|
+
} else {
|
|
1633
|
+
setSearchQuery("");
|
|
1634
|
+
setHoveredValue(null);
|
|
1635
|
+
onSearchChange?.("");
|
|
1636
|
+
}
|
|
1637
|
+
},
|
|
1638
|
+
[isOpenControlled, onOpenChange, onSearchChange, selectedValues]
|
|
1639
|
+
);
|
|
1640
|
+
const handleSearchChange = (text) => {
|
|
1641
|
+
setSearchQuery(text);
|
|
1642
|
+
onSearchChange?.(text);
|
|
1643
|
+
};
|
|
1644
|
+
useEffect(() => {
|
|
1645
|
+
if (Platform.OS !== "web" || !isOpen) return;
|
|
1646
|
+
const handlePointerDown = (event) => {
|
|
1647
|
+
const root = rootRef.current;
|
|
1648
|
+
const target = event.target;
|
|
1649
|
+
if (root?.contains && target instanceof Node && !root.contains(target)) {
|
|
1650
|
+
setOpen(false);
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
document.addEventListener("mousedown", handlePointerDown);
|
|
1654
|
+
document.addEventListener("touchstart", handlePointerDown);
|
|
1655
|
+
return () => {
|
|
1656
|
+
document.removeEventListener("mousedown", handlePointerDown);
|
|
1657
|
+
document.removeEventListener("touchstart", handlePointerDown);
|
|
1658
|
+
};
|
|
1659
|
+
}, [isOpen, setOpen]);
|
|
1660
|
+
const commitValues = useCallback(
|
|
1661
|
+
(nextValues) => {
|
|
1662
|
+
if (multiple) {
|
|
1663
|
+
if (!isValueControlled) setUncontrolledMultiple(nextValues);
|
|
1664
|
+
props.onValueChange?.(nextValues);
|
|
1665
|
+
return;
|
|
1666
|
+
}
|
|
1667
|
+
const nextValue = nextValues[0] ?? "";
|
|
1668
|
+
if (!isValueControlled) setUncontrolledSingle(nextValue);
|
|
1669
|
+
props.onValueChange?.(nextValue);
|
|
1670
|
+
},
|
|
1671
|
+
[isValueControlled, multiple, props]
|
|
1672
|
+
);
|
|
1673
|
+
const handleTriggerPress = () => {
|
|
1674
|
+
if (disabled) return;
|
|
1675
|
+
setOpen(!isOpen);
|
|
1676
|
+
};
|
|
1677
|
+
const handleSelect = useCallback(
|
|
1678
|
+
(optionValue) => {
|
|
1679
|
+
if (disabled) return;
|
|
1680
|
+
if (multiple) {
|
|
1681
|
+
const exists = selectedValues.includes(optionValue);
|
|
1682
|
+
const nextValues = exists ? selectedValues.filter((value) => value !== optionValue) : [...selectedValues, optionValue];
|
|
1683
|
+
commitValues(nextValues);
|
|
1684
|
+
return;
|
|
1685
|
+
}
|
|
1686
|
+
commitValues([optionValue]);
|
|
1687
|
+
setOpen(false);
|
|
1688
|
+
},
|
|
1689
|
+
[commitValues, disabled, multiple, selectedValues, setOpen]
|
|
1690
|
+
);
|
|
1691
|
+
const handleRemoveChip = (optionValue) => {
|
|
1692
|
+
if (disabled || !multiple) return;
|
|
1693
|
+
commitValues(selectedValues.filter((value) => value !== optionValue));
|
|
1694
|
+
};
|
|
1695
|
+
const focusTrigger = useCallback(() => {
|
|
1696
|
+
const node = triggerRef.current;
|
|
1697
|
+
node?.focus?.();
|
|
1698
|
+
}, []);
|
|
1699
|
+
const closeAndFocusTrigger = useCallback(() => {
|
|
1700
|
+
setOpen(false);
|
|
1701
|
+
focusTrigger();
|
|
1702
|
+
}, [focusTrigger, setOpen]);
|
|
1703
|
+
useEffect(() => {
|
|
1704
|
+
if (Platform.OS !== "web") return;
|
|
1705
|
+
const isTriggerFocused = () => document.activeElement === triggerRef.current;
|
|
1706
|
+
const isSearchFocused = () => document.activeElement === searchInputRef.current;
|
|
1707
|
+
const handleKeyDown = (event) => {
|
|
1708
|
+
if (!isOpen) {
|
|
1709
|
+
if (!isTriggerFocused() || disabled) return;
|
|
1710
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter") {
|
|
1711
|
+
event.preventDefault();
|
|
1712
|
+
setOpen(true);
|
|
1713
|
+
}
|
|
1714
|
+
return;
|
|
1715
|
+
}
|
|
1716
|
+
if (event.key === "Escape") {
|
|
1717
|
+
event.preventDefault();
|
|
1718
|
+
closeAndFocusTrigger();
|
|
1719
|
+
return;
|
|
1720
|
+
}
|
|
1721
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
1722
|
+
event.preventDefault();
|
|
1723
|
+
setHoveredValue((current) => {
|
|
1724
|
+
if (filteredOptions.length === 0) return current;
|
|
1725
|
+
const currentIndex = filteredOptions.findIndex((option) => option.value === current);
|
|
1726
|
+
const delta = event.key === "ArrowDown" ? 1 : -1;
|
|
1727
|
+
const nextIndex = currentIndex === -1 ? delta === 1 ? 0 : filteredOptions.length - 1 : Math.min(Math.max(currentIndex + delta, 0), filteredOptions.length - 1);
|
|
1728
|
+
return filteredOptions[nextIndex]?.value ?? current;
|
|
1729
|
+
});
|
|
1730
|
+
return;
|
|
1731
|
+
}
|
|
1732
|
+
if (isSearchFocused() && (event.key === "Home" || event.key === "End" || event.key === " ")) {
|
|
1733
|
+
return;
|
|
1734
|
+
}
|
|
1735
|
+
if (event.key === "Home" || event.key === "End") {
|
|
1736
|
+
if (filteredOptions.length === 0) return;
|
|
1737
|
+
event.preventDefault();
|
|
1738
|
+
setHoveredValue(
|
|
1739
|
+
event.key === "Home" ? filteredOptions[0].value : filteredOptions[filteredOptions.length - 1].value
|
|
1740
|
+
);
|
|
1741
|
+
return;
|
|
1742
|
+
}
|
|
1743
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
1744
|
+
if (hoveredValue == null) return;
|
|
1745
|
+
event.preventDefault();
|
|
1746
|
+
handleSelect(hoveredValue);
|
|
1747
|
+
if (!multiple) focusTrigger();
|
|
1748
|
+
}
|
|
1749
|
+
};
|
|
1750
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
1751
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
1752
|
+
}, [
|
|
1753
|
+
isOpen,
|
|
1754
|
+
disabled,
|
|
1755
|
+
filteredOptions,
|
|
1756
|
+
hoveredValue,
|
|
1757
|
+
multiple,
|
|
1758
|
+
closeAndFocusTrigger,
|
|
1759
|
+
focusTrigger,
|
|
1760
|
+
handleSelect,
|
|
1761
|
+
setOpen
|
|
1762
|
+
]);
|
|
1763
|
+
const leftIconNode = leftIcon ?? /* @__PURE__ */ jsx(
|
|
1764
|
+
UserIcon,
|
|
1765
|
+
{
|
|
1766
|
+
size: ICON_SIZE,
|
|
1767
|
+
color: error ? colors.red : isOpen ? colors.primary : colors.grey100
|
|
1768
|
+
}
|
|
1769
|
+
);
|
|
1770
|
+
const hasLeftIcon = showLeftIcon || leftIcon != null;
|
|
1771
|
+
const triggerBorderColor = error ? colors.redMuted : isOpen ? colors.primaryMuted : colors.grey700;
|
|
1772
|
+
const triggerTextColor = hasValue ? error ? colors.red : colors.white : error ? colors.red : colors.grey100;
|
|
1773
|
+
const labelColor = error ? colors.red : colors.white;
|
|
1774
|
+
const hintColor = error ? colors.red : colors.grey100;
|
|
1775
|
+
const singleLabel = selectedOptions[0]?.label ?? placeholder;
|
|
1776
|
+
const resolvedAccessibilityLabel = accessibilityLabel ?? (typeof label === "string" ? label : void 0);
|
|
1777
|
+
return /* @__PURE__ */ jsxs(
|
|
1778
|
+
View,
|
|
1779
|
+
{
|
|
1780
|
+
...rest,
|
|
1781
|
+
ref: setRootRef,
|
|
1782
|
+
style: [styles5.root, isOpen && styles5.rootOpen, disabled && styles5.disabled, style],
|
|
1783
|
+
accessibilityState: { disabled, expanded: isOpen },
|
|
1784
|
+
children: [
|
|
1785
|
+
showLabel && label ? /* @__PURE__ */ jsx(Text, { style: [styles5.label, { color: labelColor }], children: label }) : null,
|
|
1786
|
+
/* @__PURE__ */ jsxs(View, { style: [styles5.triggerWrap, isOpen && styles5.triggerWrapOpen], children: [
|
|
1787
|
+
/* @__PURE__ */ jsxs(
|
|
1788
|
+
Pressable,
|
|
1789
|
+
{
|
|
1790
|
+
ref: triggerRef,
|
|
1791
|
+
onPress: handleTriggerPress,
|
|
1792
|
+
disabled,
|
|
1793
|
+
accessibilityRole: "combobox",
|
|
1794
|
+
accessibilityLabel: resolvedAccessibilityLabel,
|
|
1795
|
+
accessibilityState: { disabled, expanded: isOpen },
|
|
1796
|
+
style: [
|
|
1797
|
+
styles5.trigger,
|
|
1798
|
+
{
|
|
1799
|
+
borderColor: triggerBorderColor,
|
|
1800
|
+
backgroundColor: colors.grey700
|
|
1801
|
+
}
|
|
1802
|
+
],
|
|
1803
|
+
children: [
|
|
1804
|
+
hasLeftIcon ? /* @__PURE__ */ jsx(View, { style: styles5.iconSlot, children: leftIconNode }) : null,
|
|
1805
|
+
/* @__PURE__ */ jsx(View, { style: styles5.triggerContent, children: multiple && hasValue ? /* @__PURE__ */ jsx(
|
|
1806
|
+
MultiValueChips,
|
|
1807
|
+
{
|
|
1808
|
+
options: selectedOptions,
|
|
1809
|
+
disabled,
|
|
1810
|
+
onRemove: handleRemoveChip
|
|
1811
|
+
}
|
|
1812
|
+
) : /* @__PURE__ */ jsx(Text, { style: [styles5.triggerText, { color: triggerTextColor }], numberOfLines: 1, children: multiple ? placeholder : singleLabel }) }),
|
|
1813
|
+
/* @__PURE__ */ jsx(View, { style: [styles5.iconSlot, isOpen && styles5.chevronOpen], children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: ICON_SIZE, color: isOpen ? colors.primary : colors.grey100 }) })
|
|
1814
|
+
]
|
|
1815
|
+
}
|
|
1816
|
+
),
|
|
1817
|
+
isOpen ? /* @__PURE__ */ jsxs(View, { style: styles5.menu, children: [
|
|
1818
|
+
showSearch ? /* @__PURE__ */ jsxs(View, { style: styles5.searchField, children: [
|
|
1819
|
+
/* @__PURE__ */ jsx(View, { style: styles5.iconSlot, children: /* @__PURE__ */ jsx(SearchIcon, { size: ICON_SIZE, color: colors.grey100 }) }),
|
|
1820
|
+
/* @__PURE__ */ jsx(
|
|
1821
|
+
TextInput,
|
|
1822
|
+
{
|
|
1823
|
+
ref: searchInputRef,
|
|
1824
|
+
value: searchQuery,
|
|
1825
|
+
onChangeText: handleSearchChange,
|
|
1826
|
+
editable: !disabled,
|
|
1827
|
+
placeholder: searchPlaceholder,
|
|
1828
|
+
placeholderTextColor: colors.grey100,
|
|
1829
|
+
style: [
|
|
1830
|
+
styles5.searchInput,
|
|
1831
|
+
Platform.OS === "web" ? styles5.searchInputWeb : null,
|
|
1832
|
+
Platform.OS === "android" ? styles5.searchInputAndroid : null
|
|
1833
|
+
],
|
|
1834
|
+
accessibilityLabel: searchPlaceholder
|
|
1835
|
+
}
|
|
1836
|
+
)
|
|
1837
|
+
] }) : null,
|
|
1838
|
+
/* @__PURE__ */ jsxs(
|
|
1839
|
+
ScrollView,
|
|
1840
|
+
{
|
|
1841
|
+
style: styles5.optionList,
|
|
1842
|
+
contentContainerStyle: styles5.optionListContent,
|
|
1843
|
+
keyboardShouldPersistTaps: "handled",
|
|
1844
|
+
showsVerticalScrollIndicator: false,
|
|
1845
|
+
children: [
|
|
1846
|
+
loading ? /* @__PURE__ */ jsx(View, { style: styles5.statusRow, children: /* @__PURE__ */ jsx(Text, { style: styles5.statusText, children: "Loading..." }) }) : filteredOptions.length === 0 ? /* @__PURE__ */ jsx(View, { style: styles5.statusRow, children: /* @__PURE__ */ jsx(Text, { style: styles5.statusText, children: emptyText }) }) : null,
|
|
1847
|
+
!loading && filteredOptions.map((option) => {
|
|
1848
|
+
const isSelected = selectedValues.includes(option.value);
|
|
1849
|
+
const isHovered = hoveredValue === option.value;
|
|
1850
|
+
const visualState = isSelected ? "selected" : isHovered ? "hover" : "default";
|
|
1851
|
+
return /* @__PURE__ */ jsxs(
|
|
1852
|
+
Pressable,
|
|
1853
|
+
{
|
|
1854
|
+
onPress: () => handleSelect(option.value),
|
|
1855
|
+
disabled,
|
|
1856
|
+
onHoverIn: () => setHoveredValue(option.value),
|
|
1857
|
+
onHoverOut: () => setHoveredValue((current) => current === option.value ? null : current),
|
|
1858
|
+
onPressIn: () => setHoveredValue(option.value),
|
|
1859
|
+
onPressOut: () => setHoveredValue((current) => current === option.value ? null : current),
|
|
1860
|
+
accessibilityRole: multiple ? "checkbox" : "button",
|
|
1861
|
+
accessibilityState: { selected: isSelected, checked: isSelected, disabled },
|
|
1862
|
+
style: [
|
|
1863
|
+
styles5.item,
|
|
1864
|
+
{
|
|
1865
|
+
backgroundColor: itemBackground(visualState)
|
|
1866
|
+
}
|
|
1867
|
+
],
|
|
1868
|
+
children: [
|
|
1869
|
+
multiple ? /* @__PURE__ */ jsx(View, { pointerEvents: "none", style: styles5.itemCheckbox, children: /* @__PURE__ */ jsx(Checkbox, { value: isSelected, variant: "light" }) }) : null,
|
|
1870
|
+
/* @__PURE__ */ jsx(Text, { style: styles5.itemLabel, numberOfLines: 1, children: option.label })
|
|
1871
|
+
]
|
|
1872
|
+
},
|
|
1873
|
+
option.value
|
|
1874
|
+
);
|
|
1875
|
+
})
|
|
1876
|
+
]
|
|
1877
|
+
}
|
|
1878
|
+
)
|
|
1879
|
+
] }) : null
|
|
1880
|
+
] }),
|
|
1881
|
+
showHint && hint ? /* @__PURE__ */ jsx(Text, { style: [styles5.hint, { color: hintColor }], children: hint }) : null
|
|
1882
|
+
]
|
|
1883
|
+
}
|
|
1884
|
+
);
|
|
1885
|
+
}
|
|
1886
|
+
);
|
|
1887
|
+
var styles5 = StyleSheet.create({
|
|
1888
|
+
root: {
|
|
1889
|
+
width: DEFAULT_WIDTH2,
|
|
1890
|
+
gap: 8,
|
|
1891
|
+
alignSelf: "flex-start"
|
|
1892
|
+
},
|
|
1893
|
+
rootOpen: {
|
|
1894
|
+
zIndex: 30
|
|
1895
|
+
},
|
|
1896
|
+
disabled: {
|
|
1897
|
+
opacity: 0.6
|
|
1898
|
+
},
|
|
1899
|
+
label: {
|
|
1900
|
+
...selectTypography.label
|
|
1901
|
+
},
|
|
1902
|
+
triggerWrap: {
|
|
1903
|
+
position: "relative",
|
|
1904
|
+
zIndex: 1
|
|
1905
|
+
},
|
|
1906
|
+
triggerWrapOpen: {
|
|
1907
|
+
zIndex: 20
|
|
1908
|
+
},
|
|
1909
|
+
trigger: {
|
|
1910
|
+
height: TRIGGER_HEIGHT,
|
|
1911
|
+
borderRadius: TRIGGER_RADIUS,
|
|
1912
|
+
borderWidth: 1,
|
|
1913
|
+
paddingVertical: 12,
|
|
1914
|
+
paddingHorizontal: 16,
|
|
1915
|
+
flexDirection: "row",
|
|
1916
|
+
alignItems: "center",
|
|
1917
|
+
gap: 10,
|
|
1918
|
+
overflow: "hidden"
|
|
1919
|
+
},
|
|
1920
|
+
triggerContent: {
|
|
1921
|
+
flex: 1,
|
|
1922
|
+
justifyContent: "center",
|
|
1923
|
+
minWidth: 0,
|
|
1924
|
+
overflow: "hidden"
|
|
1925
|
+
},
|
|
1926
|
+
triggerText: {
|
|
1927
|
+
...selectTypography.field
|
|
1928
|
+
},
|
|
1929
|
+
multiValueRoot: {
|
|
1930
|
+
width: "100%",
|
|
1931
|
+
position: "relative"
|
|
1932
|
+
},
|
|
1933
|
+
measureRow: {
|
|
1934
|
+
position: "absolute",
|
|
1935
|
+
left: 0,
|
|
1936
|
+
top: 0,
|
|
1937
|
+
flexDirection: "row",
|
|
1938
|
+
opacity: 0,
|
|
1939
|
+
zIndex: -1
|
|
1940
|
+
},
|
|
1941
|
+
chipsRow: {
|
|
1942
|
+
flexDirection: "row",
|
|
1943
|
+
alignItems: "center",
|
|
1944
|
+
gap: CHIP_GAP,
|
|
1945
|
+
overflow: "hidden"
|
|
1946
|
+
},
|
|
1947
|
+
chip: {
|
|
1948
|
+
flexDirection: "row",
|
|
1949
|
+
alignItems: "center",
|
|
1950
|
+
gap: 4,
|
|
1951
|
+
paddingVertical: 2,
|
|
1952
|
+
paddingHorizontal: 8,
|
|
1953
|
+
borderRadius: 999,
|
|
1954
|
+
backgroundColor: colors.grey600,
|
|
1955
|
+
flexShrink: 0
|
|
1956
|
+
},
|
|
1957
|
+
chipLabel: {
|
|
1958
|
+
...selectTypography.hint,
|
|
1959
|
+
color: colors.white,
|
|
1960
|
+
maxWidth: 120
|
|
1961
|
+
},
|
|
1962
|
+
chipRemove: {
|
|
1963
|
+
color: colors.grey100,
|
|
1964
|
+
fontSize: 14,
|
|
1965
|
+
lineHeight: 14
|
|
1966
|
+
},
|
|
1967
|
+
ellipsis: {
|
|
1968
|
+
flexShrink: 0,
|
|
1969
|
+
paddingHorizontal: 2
|
|
1970
|
+
},
|
|
1971
|
+
ellipsisText: {
|
|
1972
|
+
...selectTypography.field,
|
|
1973
|
+
color: colors.white,
|
|
1974
|
+
lineHeight: 16
|
|
1975
|
+
},
|
|
1976
|
+
iconSlot: {
|
|
1977
|
+
width: ICON_SIZE,
|
|
1978
|
+
height: ICON_SIZE,
|
|
1979
|
+
alignItems: "center",
|
|
1980
|
+
justifyContent: "center",
|
|
1981
|
+
flexShrink: 0
|
|
1982
|
+
},
|
|
1983
|
+
chevronOpen: {
|
|
1984
|
+
transform: [{ rotate: "180deg" }]
|
|
1985
|
+
},
|
|
1986
|
+
menu: {
|
|
1987
|
+
position: "absolute",
|
|
1988
|
+
top: "100%",
|
|
1989
|
+
left: 0,
|
|
1990
|
+
right: 0,
|
|
1991
|
+
marginTop: 8,
|
|
1992
|
+
zIndex: 10,
|
|
1993
|
+
borderRadius: MENU_RADIUS2,
|
|
1994
|
+
padding: 12,
|
|
1995
|
+
gap: 8,
|
|
1996
|
+
backgroundColor: colors.grey700,
|
|
1997
|
+
...Platform.select({
|
|
1998
|
+
web: {
|
|
1999
|
+
boxShadow: `0 8px 24px ${colors.black}73`
|
|
2000
|
+
},
|
|
2001
|
+
default: {
|
|
2002
|
+
elevation: 8
|
|
2003
|
+
}
|
|
2004
|
+
})
|
|
2005
|
+
},
|
|
2006
|
+
optionList: {
|
|
2007
|
+
maxHeight: MENU_MAX_LIST_HEIGHT
|
|
2008
|
+
},
|
|
2009
|
+
optionListContent: {
|
|
2010
|
+
gap: 8
|
|
2011
|
+
},
|
|
2012
|
+
statusRow: {
|
|
2013
|
+
minHeight: 43,
|
|
2014
|
+
padding: 12,
|
|
2015
|
+
justifyContent: "center"
|
|
2016
|
+
},
|
|
2017
|
+
statusText: {
|
|
2018
|
+
...selectTypography.field,
|
|
2019
|
+
color: colors.grey100
|
|
2020
|
+
},
|
|
2021
|
+
searchField: {
|
|
2022
|
+
height: 40,
|
|
2023
|
+
borderRadius: ITEM_RADIUS,
|
|
2024
|
+
paddingHorizontal: 12,
|
|
2025
|
+
flexDirection: "row",
|
|
2026
|
+
alignItems: "center",
|
|
2027
|
+
gap: 8,
|
|
2028
|
+
backgroundColor: colors.grey800
|
|
2029
|
+
},
|
|
2030
|
+
searchInput: {
|
|
2031
|
+
...selectTypography.field,
|
|
2032
|
+
flex: 1,
|
|
2033
|
+
color: colors.white,
|
|
2034
|
+
paddingVertical: 0,
|
|
2035
|
+
margin: 0
|
|
2036
|
+
},
|
|
2037
|
+
searchInputWeb: {
|
|
2038
|
+
outlineStyle: "none"
|
|
2039
|
+
},
|
|
2040
|
+
searchInputAndroid: {
|
|
2041
|
+
includeFontPadding: false
|
|
2042
|
+
},
|
|
2043
|
+
item: {
|
|
2044
|
+
minHeight: 43,
|
|
2045
|
+
borderRadius: ITEM_RADIUS,
|
|
2046
|
+
padding: 12,
|
|
2047
|
+
flexDirection: "row",
|
|
2048
|
+
alignItems: "center",
|
|
2049
|
+
gap: 8
|
|
2050
|
+
},
|
|
2051
|
+
itemCheckbox: {
|
|
2052
|
+
flexShrink: 0
|
|
2053
|
+
},
|
|
2054
|
+
itemLabel: {
|
|
2055
|
+
...selectTypography.field,
|
|
2056
|
+
color: colors.white,
|
|
2057
|
+
flex: 1
|
|
2058
|
+
},
|
|
2059
|
+
hint: {
|
|
2060
|
+
...selectTypography.hint
|
|
2061
|
+
}
|
|
2062
|
+
});
|
|
2063
|
+
var DEFAULT_WIDTH3 = 308;
|
|
2064
|
+
var FIELD_HEIGHT = 100;
|
|
2065
|
+
var FIELD_RADIUS = 16;
|
|
2066
|
+
var FIELD_PADDING_VERTICAL = 12;
|
|
2067
|
+
var FIELD_PADDING_HORIZONTAL = 16;
|
|
2068
|
+
function resolveVisualState2({
|
|
2069
|
+
disabled,
|
|
2070
|
+
error,
|
|
2071
|
+
focused,
|
|
2072
|
+
hasValue
|
|
2073
|
+
}) {
|
|
2074
|
+
if (disabled) return "disabled";
|
|
2075
|
+
if (error) return "error";
|
|
2076
|
+
if (focused) return "active";
|
|
2077
|
+
if (hasValue) return "filled";
|
|
2078
|
+
return "default";
|
|
2079
|
+
}
|
|
2080
|
+
function chromeFor2(state) {
|
|
2081
|
+
const base = {
|
|
2082
|
+
borderColor: colors.grey700,
|
|
2083
|
+
backgroundColor: colors.grey700,
|
|
2084
|
+
textColor: colors.white,
|
|
2085
|
+
placeholderColor: colors.grey100,
|
|
2086
|
+
labelColor: colors.white,
|
|
2087
|
+
hintColor: colors.grey100
|
|
2088
|
+
};
|
|
2089
|
+
switch (state) {
|
|
2090
|
+
case "active":
|
|
2091
|
+
return {
|
|
2092
|
+
...base,
|
|
2093
|
+
borderColor: colors.primaryMuted
|
|
2094
|
+
};
|
|
2095
|
+
case "error":
|
|
2096
|
+
return {
|
|
2097
|
+
...base,
|
|
2098
|
+
borderColor: colors.redMuted,
|
|
2099
|
+
textColor: colors.red,
|
|
2100
|
+
placeholderColor: colors.red,
|
|
2101
|
+
labelColor: colors.red,
|
|
2102
|
+
hintColor: colors.red
|
|
2103
|
+
};
|
|
2104
|
+
case "filled":
|
|
2105
|
+
return base;
|
|
2106
|
+
case "disabled":
|
|
2107
|
+
return {
|
|
2108
|
+
...base,
|
|
2109
|
+
textColor: colors.grey0
|
|
2110
|
+
};
|
|
2111
|
+
default:
|
|
2112
|
+
return base;
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
var Textarea = forwardRef(function Textarea2({
|
|
2116
|
+
label = "Label",
|
|
2117
|
+
showLabel = true,
|
|
2118
|
+
hint = "Hint",
|
|
2119
|
+
showHint = true,
|
|
2120
|
+
placeholder = "placeholder",
|
|
2121
|
+
disabled = false,
|
|
2122
|
+
error = false,
|
|
2123
|
+
value,
|
|
2124
|
+
defaultValue,
|
|
2125
|
+
onChangeText,
|
|
2126
|
+
onFocus,
|
|
2127
|
+
onBlur,
|
|
2128
|
+
style,
|
|
2129
|
+
fieldStyle,
|
|
2130
|
+
inputStyle,
|
|
2131
|
+
className,
|
|
2132
|
+
inputClassName,
|
|
2133
|
+
accessibilityLabel,
|
|
2134
|
+
...textInputProps
|
|
2135
|
+
}, forwardedRef) {
|
|
2136
|
+
const rootRef = useRef(null);
|
|
2137
|
+
const inputRef = useRef(null);
|
|
2138
|
+
const setInputRef = useMemo(() => mergeRefs(inputRef, forwardedRef), [forwardedRef]);
|
|
2139
|
+
const [focused, setFocused] = useState(false);
|
|
2140
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue ?? "");
|
|
2141
|
+
const isControlled = typeof value === "string";
|
|
2142
|
+
const currentValue = isControlled ? value : uncontrolledValue;
|
|
2143
|
+
const hasValue = currentValue.length > 0;
|
|
2144
|
+
const visualState = resolveVisualState2({ disabled, error, focused, hasValue });
|
|
2145
|
+
const chrome = chromeFor2(visualState);
|
|
2146
|
+
const resolvedAccessibilityLabel = accessibilityLabel ?? (showLabel ? void 0 : label);
|
|
2147
|
+
useApplyWebClassName(rootRef, className);
|
|
2148
|
+
useApplyWebClassName(inputRef, inputClassName);
|
|
2149
|
+
return /* @__PURE__ */ jsxs(View, { ref: rootRef, style: [styles6.root, disabled && styles6.disabled, style], children: [
|
|
2150
|
+
showLabel && label ? /* @__PURE__ */ jsx(Text, { style: [styles6.label, { color: chrome.labelColor }], children: label }) : null,
|
|
2151
|
+
/* @__PURE__ */ jsx(
|
|
2152
|
+
View,
|
|
2153
|
+
{
|
|
2154
|
+
style: [
|
|
2155
|
+
styles6.field,
|
|
2156
|
+
{
|
|
2157
|
+
borderColor: chrome.borderColor,
|
|
2158
|
+
backgroundColor: chrome.backgroundColor
|
|
2159
|
+
},
|
|
2160
|
+
fieldStyle
|
|
2161
|
+
],
|
|
2162
|
+
children: /* @__PURE__ */ jsx(
|
|
2163
|
+
TextInput,
|
|
2164
|
+
{
|
|
2165
|
+
ref: setInputRef,
|
|
2166
|
+
...textInputProps,
|
|
2167
|
+
multiline: true,
|
|
2168
|
+
textAlignVertical: "top",
|
|
2169
|
+
value: isControlled ? value : void 0,
|
|
2170
|
+
defaultValue: isControlled ? void 0 : defaultValue,
|
|
2171
|
+
editable: !disabled,
|
|
2172
|
+
placeholder,
|
|
2173
|
+
placeholderTextColor: chrome.placeholderColor,
|
|
2174
|
+
onChangeText: (text) => {
|
|
2175
|
+
if (!isControlled) setUncontrolledValue(text);
|
|
2176
|
+
onChangeText?.(text);
|
|
2177
|
+
},
|
|
2178
|
+
onFocus: (event) => {
|
|
2179
|
+
setFocused(true);
|
|
2180
|
+
onFocus?.(event);
|
|
2181
|
+
},
|
|
2182
|
+
onBlur: (event) => {
|
|
2183
|
+
setFocused(false);
|
|
2184
|
+
onBlur?.(event);
|
|
2185
|
+
},
|
|
2186
|
+
style: [
|
|
2187
|
+
styles6.input,
|
|
2188
|
+
textareaTypography.field,
|
|
2189
|
+
{ color: chrome.textColor },
|
|
2190
|
+
Platform.OS === "web" ? styles6.inputWeb : null,
|
|
2191
|
+
Platform.OS === "android" ? styles6.inputAndroid : null,
|
|
2192
|
+
inputStyle
|
|
2193
|
+
],
|
|
2194
|
+
accessibilityLabel: resolvedAccessibilityLabel,
|
|
2195
|
+
accessibilityState: { disabled }
|
|
2196
|
+
}
|
|
2197
|
+
)
|
|
2198
|
+
}
|
|
2199
|
+
),
|
|
2200
|
+
showHint && hint ? /* @__PURE__ */ jsx(Text, { style: [styles6.hint, { color: chrome.hintColor }], children: hint }) : null
|
|
2201
|
+
] });
|
|
2202
|
+
});
|
|
2203
|
+
var styles6 = StyleSheet.create({
|
|
2204
|
+
root: {
|
|
2205
|
+
width: DEFAULT_WIDTH3,
|
|
2206
|
+
gap: 8,
|
|
2207
|
+
alignSelf: "flex-start"
|
|
2208
|
+
},
|
|
2209
|
+
disabled: {
|
|
2210
|
+
opacity: 0.6
|
|
2211
|
+
},
|
|
2212
|
+
label: {
|
|
2213
|
+
...textareaTypography.label
|
|
2214
|
+
},
|
|
2215
|
+
field: {
|
|
2216
|
+
height: FIELD_HEIGHT,
|
|
2217
|
+
borderRadius: FIELD_RADIUS,
|
|
2218
|
+
borderWidth: 1,
|
|
2219
|
+
paddingTop: FIELD_PADDING_VERTICAL,
|
|
2220
|
+
paddingBottom: FIELD_PADDING_VERTICAL,
|
|
2221
|
+
paddingLeft: FIELD_PADDING_HORIZONTAL,
|
|
2222
|
+
paddingRight: FIELD_PADDING_HORIZONTAL
|
|
2223
|
+
},
|
|
2224
|
+
input: {
|
|
2225
|
+
flex: 1,
|
|
2226
|
+
paddingVertical: 0,
|
|
2227
|
+
margin: 0
|
|
2228
|
+
},
|
|
2229
|
+
inputWeb: {
|
|
2230
|
+
outlineStyle: "none",
|
|
2231
|
+
resize: "none"
|
|
2232
|
+
},
|
|
2233
|
+
inputAndroid: {
|
|
2234
|
+
includeFontPadding: false
|
|
2235
|
+
},
|
|
2236
|
+
hint: {
|
|
2237
|
+
...textareaTypography.hint
|
|
2238
|
+
}
|
|
2239
|
+
});
|
|
2240
|
+
var TRACK_WIDTH = 44;
|
|
2241
|
+
var TRACK_HEIGHT = 24;
|
|
2242
|
+
var TRACK_RADIUS = 43;
|
|
2243
|
+
var TRACK_PADDING = 4;
|
|
2244
|
+
var THUMB_SIZE = TRACK_HEIGHT - TRACK_PADDING * 2;
|
|
2245
|
+
var THUMB_TRAVEL = TRACK_WIDTH - TRACK_PADDING * 2 - THUMB_SIZE;
|
|
2246
|
+
var ANIMATION_DURATION = 300;
|
|
2247
|
+
var Toggle = forwardRef(function Toggle2({
|
|
2248
|
+
value,
|
|
2249
|
+
defaultValue = false,
|
|
2250
|
+
onValueChange,
|
|
2251
|
+
disabled = false,
|
|
2252
|
+
label,
|
|
2253
|
+
children,
|
|
2254
|
+
accessibilityLabel,
|
|
2255
|
+
style,
|
|
2256
|
+
labelStyle,
|
|
2257
|
+
className,
|
|
2258
|
+
hitSlop = 10,
|
|
2259
|
+
...rest
|
|
2260
|
+
}, forwardedRef) {
|
|
2261
|
+
const containerRef = useRef(null);
|
|
2262
|
+
const isControlled = typeof value === "boolean";
|
|
2263
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
|
|
2264
|
+
const isActive = isControlled ? value : uncontrolledValue;
|
|
2265
|
+
const labelContent = children ?? label;
|
|
2266
|
+
const resolvedAccessibilityLabel = accessibilityLabel ?? (typeof labelContent === "string" ? labelContent : void 0);
|
|
2267
|
+
const setContainerRef = useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
|
|
2268
|
+
const progress = useRef(new Animated.Value(isActive ? 1 : 0)).current;
|
|
2269
|
+
useApplyWebClassName(containerRef, className);
|
|
2270
|
+
useEffect(() => {
|
|
2271
|
+
Animated.timing(progress, {
|
|
2272
|
+
toValue: isActive ? 1 : 0,
|
|
2273
|
+
duration: ANIMATION_DURATION,
|
|
2274
|
+
easing: Easing.out(Easing.ease),
|
|
2275
|
+
useNativeDriver: false
|
|
2276
|
+
}).start();
|
|
2277
|
+
}, [isActive, progress]);
|
|
2278
|
+
const handlePress = () => {
|
|
2279
|
+
if (disabled) return;
|
|
2280
|
+
const next = !isActive;
|
|
2281
|
+
if (!isControlled) setUncontrolledValue(next);
|
|
2282
|
+
onValueChange?.(next);
|
|
2283
|
+
};
|
|
2284
|
+
const trackBackgroundColor = progress.interpolate({
|
|
2285
|
+
inputRange: [0, 1],
|
|
2286
|
+
outputRange: [colors.grey700, colors.primary]
|
|
2287
|
+
});
|
|
2288
|
+
const thumbTranslateX = progress.interpolate({
|
|
2289
|
+
inputRange: [0, 1],
|
|
2290
|
+
outputRange: [0, THUMB_TRAVEL]
|
|
2291
|
+
});
|
|
2292
|
+
return /* @__PURE__ */ jsxs(
|
|
2293
|
+
Pressable,
|
|
2294
|
+
{
|
|
2295
|
+
...rest,
|
|
2296
|
+
ref: setContainerRef,
|
|
2297
|
+
onPress: handlePress,
|
|
2298
|
+
disabled,
|
|
2299
|
+
hitSlop,
|
|
2300
|
+
accessibilityRole: "switch",
|
|
2301
|
+
accessibilityLabel: resolvedAccessibilityLabel,
|
|
2302
|
+
accessibilityState: { checked: isActive, disabled },
|
|
2303
|
+
style: [styles7.pressable, disabled && styles7.disabled, style],
|
|
2304
|
+
children: [
|
|
2305
|
+
/* @__PURE__ */ jsx(
|
|
2306
|
+
Animated.View,
|
|
2307
|
+
{
|
|
2308
|
+
style: [
|
|
2309
|
+
styles7.track,
|
|
2310
|
+
{
|
|
2311
|
+
backgroundColor: trackBackgroundColor
|
|
2312
|
+
}
|
|
2313
|
+
],
|
|
2314
|
+
children: /* @__PURE__ */ jsx(
|
|
2315
|
+
Animated.View,
|
|
2316
|
+
{
|
|
2317
|
+
style: [
|
|
2318
|
+
styles7.thumb,
|
|
2319
|
+
{
|
|
2320
|
+
transform: [{ translateX: thumbTranslateX }]
|
|
2321
|
+
}
|
|
2322
|
+
]
|
|
2323
|
+
}
|
|
2324
|
+
)
|
|
2325
|
+
}
|
|
2326
|
+
),
|
|
2327
|
+
labelContent != null && labelContent !== false ? typeof labelContent === "string" || typeof labelContent === "number" ? /* @__PURE__ */ jsx(Text, { style: [styles7.label, labelStyle], children: labelContent }) : labelContent : null
|
|
2328
|
+
]
|
|
2329
|
+
}
|
|
2330
|
+
);
|
|
2331
|
+
});
|
|
2332
|
+
var styles7 = StyleSheet.create({
|
|
2333
|
+
pressable: {
|
|
2334
|
+
flexDirection: "row",
|
|
2335
|
+
alignItems: "center",
|
|
2336
|
+
alignSelf: "flex-start",
|
|
2337
|
+
gap: 10
|
|
2338
|
+
},
|
|
2339
|
+
disabled: {
|
|
2340
|
+
opacity: 0.6
|
|
2341
|
+
},
|
|
2342
|
+
track: {
|
|
2343
|
+
width: TRACK_WIDTH,
|
|
2344
|
+
height: TRACK_HEIGHT,
|
|
2345
|
+
borderRadius: TRACK_RADIUS,
|
|
2346
|
+
padding: TRACK_PADDING,
|
|
2347
|
+
justifyContent: "center"
|
|
2348
|
+
},
|
|
2349
|
+
thumb: {
|
|
2350
|
+
width: THUMB_SIZE,
|
|
2351
|
+
height: THUMB_SIZE,
|
|
2352
|
+
borderRadius: THUMB_SIZE / 2,
|
|
2353
|
+
backgroundColor: colors.white
|
|
2354
|
+
},
|
|
2355
|
+
label: {
|
|
2356
|
+
...inputTypography.field,
|
|
2357
|
+
color: colors.white
|
|
2358
|
+
}
|
|
2359
|
+
});
|
|
799
2360
|
|
|
800
|
-
export { ArrowRightIcon, BagIcon, BellIcon, BuildingIcon, Button, CameraIcon, CheckBadgeIcon, ClockIcon, FacebookIcon, HomeIcon, Icon, Input, InstagramIcon, KeyIcon, LinkedInIcon, MailIcon, NavigateIcon, PhoneIcon, ShowIcon, UserIcon, buttonTypography, colors, fonts, getIconsByGroup, grey, iconGroupNames, iconGroups, iconNames, icons, inputTypography };
|
|
2361
|
+
export { ArrowRightIcon, Avatar, BagIcon, BellIcon, BuildingIcon, Button, CalendarIcon, CameraIcon, CheckBadgeIcon, CheckIcon, Checkbox, ChevronDownIcon, ClockIcon, FacebookIcon, HeartIcon, HelpCircleIcon, HomeIcon, Icon, Input, InstagramIcon, KeyIcon, LayoutGridIcon, LinkedInIcon, LogOutIcon, MailIcon, NavigateIcon, PhoneIcon, SearchIcon, Select, SettingsIcon, ShowIcon, Textarea, Toggle, UserIcon, VideoIcon, avatarTypography, buttonTypography, colors, fonts, getIconsByGroup, grey, iconGroupNames, iconGroups, iconNames, icons, inputTypography, selectTypography, textareaTypography };
|
|
801
2362
|
//# sourceMappingURL=index.js.map
|
|
802
2363
|
//# sourceMappingURL=index.js.map
|