@ecohouse/ui 0.1.4 → 0.1.5
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/README.md +33 -13
- package/dist/index.cjs +805 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +113 -10
- package/dist/index.d.ts +113 -10
- package/dist/index.js +802 -151
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Avatar/Avatar.tsx +19 -71
- package/src/components/DatePicker/DatePicker.stories.tsx +172 -0
- package/src/components/DatePicker/DatePicker.tsx +628 -0
- package/src/components/DatePicker/index.ts +7 -0
- package/src/components/index.ts +8 -0
- package/src/icons/CalendarOutline/CalendarOutlineIcon.tsx +25 -0
- package/src/icons/CalendarOutline/CalendarOutlineIcon.web.tsx +31 -0
- package/src/icons/CalendarOutline/calendarOutlinePath.ts +3 -0
- package/src/icons/CalendarOutline/index.ts +1 -0
- package/src/icons/ChevronLeft/ChevronLeftIcon.tsx +21 -0
- package/src/icons/ChevronLeft/ChevronLeftIcon.web.tsx +27 -0
- package/src/icons/ChevronLeft/chevronLeftPath.ts +2 -0
- package/src/icons/ChevronLeft/index.ts +1 -0
- package/src/icons/index.ts +2 -0
- package/src/icons/registry.ts +17 -2
- package/src/index.ts +20 -1
- package/src/primitives/MenuItem/MenuItem.stories.tsx +98 -0
- package/src/primitives/MenuItem/MenuItem.tsx +138 -0
- package/src/primitives/MenuItem/index.ts +2 -0
- package/src/primitives/index.ts +2 -0
- package/src/theme/colors.ts +1 -0
- package/src/theme/index.ts +1 -0
- package/src/theme/typography.ts +40 -0
- package/src/utils/dateUtils.ts +86 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef, useRef, useMemo, useState, useCallback, useEffect, useLayoutEffect } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Pressable, View, Text, StyleSheet, Platform, Image, TouchableOpacity, TextInput, ScrollView, Animated, Easing } from 'react-native';
|
|
3
3
|
import Svg, { Path } from 'react-native-svg';
|
|
4
4
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -34,6 +34,7 @@ var colors = {
|
|
|
34
34
|
red: "#A63E3E",
|
|
35
35
|
lightGrey: "#B7B7B7",
|
|
36
36
|
primaryMuted: "#B464360F",
|
|
37
|
+
primaryHover: "#B4643633",
|
|
37
38
|
redMuted: "#A63E3E0F",
|
|
38
39
|
redHover: "#A63E3E33",
|
|
39
40
|
grey0: grey["0"],
|
|
@@ -142,6 +143,38 @@ var avatarTypography = {
|
|
|
142
143
|
letterSpacing: 0
|
|
143
144
|
}
|
|
144
145
|
};
|
|
146
|
+
var datePickerTypography = {
|
|
147
|
+
field: {
|
|
148
|
+
fontFamily: fonts.sans,
|
|
149
|
+
fontSize: 12,
|
|
150
|
+
fontWeight: "400",
|
|
151
|
+
lineHeight: 12,
|
|
152
|
+
letterSpacing: 0.36
|
|
153
|
+
},
|
|
154
|
+
/** Calendar month/year heading — Bold, centered, White. */
|
|
155
|
+
monthHeading: {
|
|
156
|
+
fontFamily: fonts.sans,
|
|
157
|
+
fontSize: 14,
|
|
158
|
+
fontWeight: "700",
|
|
159
|
+
lineHeight: 14,
|
|
160
|
+
letterSpacing: 0
|
|
161
|
+
},
|
|
162
|
+
/** Weekday header (ԵՐ, ԵՔ, ...) — Regular, uppercase, centered, Grey/300. */
|
|
163
|
+
weekday: {
|
|
164
|
+
fontFamily: fonts.sans,
|
|
165
|
+
fontSize: 12,
|
|
166
|
+
fontWeight: "400",
|
|
167
|
+
lineHeight: 12,
|
|
168
|
+
letterSpacing: 0
|
|
169
|
+
},
|
|
170
|
+
day: {
|
|
171
|
+
fontFamily: fonts.sans,
|
|
172
|
+
fontSize: 14,
|
|
173
|
+
fontWeight: "400",
|
|
174
|
+
lineHeight: 14,
|
|
175
|
+
letterSpacing: 0
|
|
176
|
+
}
|
|
177
|
+
};
|
|
145
178
|
var textareaTypography = {
|
|
146
179
|
label: {
|
|
147
180
|
fontFamily: fonts.sans,
|
|
@@ -242,6 +275,25 @@ function CalendarIcon({ size = 20, color = colors.primary, strokeWidth = 1.5 })
|
|
|
242
275
|
) });
|
|
243
276
|
}
|
|
244
277
|
|
|
278
|
+
// src/icons/CalendarOutline/calendarOutlinePath.ts
|
|
279
|
+
var CALENDAR_OUTLINE_PATH = "M10.6667 1.33334V4.00001M5.33333 1.33334V4.00001M2 6.66668H14M5.2 2.66668H10.8C11.9201 2.66668 12.4802 2.66668 12.908 2.88466C13.2843 3.07641 13.5903 3.38237 13.782 3.7587C14 4.18652 14 4.74657 14 5.86668V11.4667C14 12.5868 14 13.1468 13.782 13.5747C13.5903 13.951 13.2843 14.2569 12.908 14.4487C12.4802 14.6667 11.9201 14.6667 10.8 14.6667H5.2C4.0799 14.6667 3.51984 14.6667 3.09202 14.4487C2.71569 14.2569 2.40973 13.951 2.21799 13.5747C2 13.1468 2 12.5868 2 11.4667V5.86668C2 4.74657 2 4.18652 2.21799 3.7587C2.40973 3.38237 2.71569 3.07641 3.09202 2.88466C3.51984 2.66668 4.0799 2.66668 5.2 2.66668Z";
|
|
280
|
+
function CalendarOutlineIcon({
|
|
281
|
+
size = 20,
|
|
282
|
+
color = colors.primary,
|
|
283
|
+
strokeWidth = 1.5
|
|
284
|
+
}) {
|
|
285
|
+
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx(
|
|
286
|
+
Path,
|
|
287
|
+
{
|
|
288
|
+
d: CALENDAR_OUTLINE_PATH,
|
|
289
|
+
stroke: color,
|
|
290
|
+
strokeWidth,
|
|
291
|
+
strokeLinecap: "round",
|
|
292
|
+
strokeLinejoin: "round"
|
|
293
|
+
}
|
|
294
|
+
) });
|
|
295
|
+
}
|
|
296
|
+
|
|
245
297
|
// src/icons/Camera/cameraPath.ts
|
|
246
298
|
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";
|
|
247
299
|
function CameraIcon({ size = 24, color = colors.primary, strokeWidth = 2 }) {
|
|
@@ -306,6 +358,21 @@ function ChevronDownIcon({
|
|
|
306
358
|
) });
|
|
307
359
|
}
|
|
308
360
|
|
|
361
|
+
// src/icons/ChevronLeft/chevronLeftPath.ts
|
|
362
|
+
var CHEVRON_LEFT_PATH = "M12.5 15L7.5 10L12.5 5";
|
|
363
|
+
function ChevronLeftIcon({ size = 20, color = colors.primary, strokeWidth = 2 }) {
|
|
364
|
+
return /* @__PURE__ */ jsx(Svg, { width: size, height: size, viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx(
|
|
365
|
+
Path,
|
|
366
|
+
{
|
|
367
|
+
d: CHEVRON_LEFT_PATH,
|
|
368
|
+
stroke: color,
|
|
369
|
+
strokeWidth,
|
|
370
|
+
strokeLinecap: "round",
|
|
371
|
+
strokeLinejoin: "round"
|
|
372
|
+
}
|
|
373
|
+
) });
|
|
374
|
+
}
|
|
375
|
+
|
|
309
376
|
// src/icons/Clock/clockPath.ts
|
|
310
377
|
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";
|
|
311
378
|
function ClockIcon({ size = 24, color = colors.primary, strokeWidth = 2 }) {
|
|
@@ -600,10 +667,12 @@ var icons = {
|
|
|
600
667
|
bell: BellIcon,
|
|
601
668
|
building: BuildingIcon,
|
|
602
669
|
calendar: CalendarIcon,
|
|
670
|
+
calendarOutline: CalendarOutlineIcon,
|
|
603
671
|
camera: CameraIcon,
|
|
604
672
|
check: CheckIcon,
|
|
605
673
|
checkBadge: CheckBadgeIcon,
|
|
606
674
|
chevronDown: ChevronDownIcon,
|
|
675
|
+
chevronLeft: ChevronLeftIcon,
|
|
607
676
|
clock: ClockIcon,
|
|
608
677
|
facebook: FacebookIcon,
|
|
609
678
|
heart: HeartIcon,
|
|
@@ -625,8 +694,19 @@ var icons = {
|
|
|
625
694
|
};
|
|
626
695
|
var iconNames = Object.keys(icons);
|
|
627
696
|
var iconGroups = {
|
|
628
|
-
navigation: ["arrowRight", "chevronDown", "home", "navigate"],
|
|
629
|
-
actions: [
|
|
697
|
+
navigation: ["arrowRight", "chevronDown", "chevronLeft", "home", "navigate"],
|
|
698
|
+
actions: [
|
|
699
|
+
"show",
|
|
700
|
+
"bell",
|
|
701
|
+
"camera",
|
|
702
|
+
"key",
|
|
703
|
+
"check",
|
|
704
|
+
"checkBadge",
|
|
705
|
+
"search",
|
|
706
|
+
"calendar",
|
|
707
|
+
"calendarOutline",
|
|
708
|
+
"heart"
|
|
709
|
+
],
|
|
630
710
|
objects: ["bag", "building", "clock", "user", "video"],
|
|
631
711
|
communication: ["mail", "phone"],
|
|
632
712
|
social: ["facebook", "instagram", "linkedin"],
|
|
@@ -692,13 +772,104 @@ function useApplyWebClassName(ref, className, enabled = true) {
|
|
|
692
772
|
};
|
|
693
773
|
}, [ref, className, enabled]);
|
|
694
774
|
}
|
|
775
|
+
var ITEM_RADIUS = 12;
|
|
776
|
+
var ICON_SIZE = 16;
|
|
777
|
+
var MenuItem = forwardRef(function MenuItem2({
|
|
778
|
+
icon,
|
|
779
|
+
label,
|
|
780
|
+
onPress,
|
|
781
|
+
disabled = false,
|
|
782
|
+
backgroundColor,
|
|
783
|
+
hoverColor,
|
|
784
|
+
style,
|
|
785
|
+
labelStyle,
|
|
786
|
+
className,
|
|
787
|
+
accessibilityLabel,
|
|
788
|
+
hitSlop = 4,
|
|
789
|
+
onHoverIn,
|
|
790
|
+
onHoverOut,
|
|
791
|
+
onPressIn,
|
|
792
|
+
onPressOut,
|
|
793
|
+
...rest
|
|
794
|
+
}, forwardedRef) {
|
|
795
|
+
const containerRef = useRef(null);
|
|
796
|
+
const setContainerRef = useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
|
|
797
|
+
const [hovered, setHovered] = useState(false);
|
|
798
|
+
useApplyWebClassName(containerRef, className);
|
|
799
|
+
const resolvedBackground = hovered ? hoverColor ?? colors.grey600 : backgroundColor ?? "transparent";
|
|
800
|
+
const resolvedAccessibilityLabel = accessibilityLabel ?? label;
|
|
801
|
+
return /* @__PURE__ */ jsxs(
|
|
802
|
+
Pressable,
|
|
803
|
+
{
|
|
804
|
+
...rest,
|
|
805
|
+
ref: setContainerRef,
|
|
806
|
+
onPress,
|
|
807
|
+
disabled,
|
|
808
|
+
hitSlop,
|
|
809
|
+
onHoverIn: (event) => {
|
|
810
|
+
setHovered(true);
|
|
811
|
+
onHoverIn?.(event);
|
|
812
|
+
},
|
|
813
|
+
onHoverOut: (event) => {
|
|
814
|
+
setHovered(false);
|
|
815
|
+
onHoverOut?.(event);
|
|
816
|
+
},
|
|
817
|
+
onPressIn: (event) => {
|
|
818
|
+
setHovered(true);
|
|
819
|
+
onPressIn?.(event);
|
|
820
|
+
},
|
|
821
|
+
onPressOut: (event) => {
|
|
822
|
+
setHovered(false);
|
|
823
|
+
onPressOut?.(event);
|
|
824
|
+
},
|
|
825
|
+
accessibilityRole: "menuitem",
|
|
826
|
+
accessibilityLabel: resolvedAccessibilityLabel,
|
|
827
|
+
accessibilityState: { disabled },
|
|
828
|
+
style: [
|
|
829
|
+
styles.root,
|
|
830
|
+
{ backgroundColor: resolvedBackground },
|
|
831
|
+
disabled && styles.disabled,
|
|
832
|
+
style
|
|
833
|
+
],
|
|
834
|
+
children: [
|
|
835
|
+
icon ? /* @__PURE__ */ jsx(View, { style: styles.iconSlot, children: icon }) : null,
|
|
836
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.label, labelStyle], numberOfLines: 1, children: label })
|
|
837
|
+
]
|
|
838
|
+
}
|
|
839
|
+
);
|
|
840
|
+
});
|
|
841
|
+
var styles = StyleSheet.create({
|
|
842
|
+
root: {
|
|
843
|
+
minHeight: 40,
|
|
844
|
+
borderRadius: ITEM_RADIUS,
|
|
845
|
+
paddingVertical: 12,
|
|
846
|
+
paddingHorizontal: 12,
|
|
847
|
+
flexDirection: "row",
|
|
848
|
+
alignItems: "center",
|
|
849
|
+
gap: 8,
|
|
850
|
+
alignSelf: "stretch"
|
|
851
|
+
},
|
|
852
|
+
disabled: {
|
|
853
|
+
opacity: 0.5
|
|
854
|
+
},
|
|
855
|
+
iconSlot: {
|
|
856
|
+
width: ICON_SIZE,
|
|
857
|
+
height: ICON_SIZE,
|
|
858
|
+
alignItems: "center",
|
|
859
|
+
justifyContent: "center",
|
|
860
|
+
flexShrink: 0
|
|
861
|
+
},
|
|
862
|
+
label: {
|
|
863
|
+
...avatarTypography.menuItem,
|
|
864
|
+
color: colors.white,
|
|
865
|
+
flex: 1
|
|
866
|
+
}
|
|
867
|
+
});
|
|
695
868
|
var IMAGE_SIZE = 48;
|
|
696
869
|
var CONTAINER_RADIUS = 71;
|
|
697
870
|
var CHEVRON_SIZE = 20;
|
|
698
871
|
var FALLBACK_ICON_SIZE = 20;
|
|
699
872
|
var MENU_RADIUS = 16;
|
|
700
|
-
var MENU_ITEM_RADIUS = 12;
|
|
701
|
-
var MENU_ITEM_ICON_SIZE = 16;
|
|
702
873
|
var Avatar = forwardRef(function Avatar2({
|
|
703
874
|
name,
|
|
704
875
|
email,
|
|
@@ -721,8 +892,8 @@ var Avatar = forwardRef(function Avatar2({
|
|
|
721
892
|
const containerRef = useRef(null);
|
|
722
893
|
const setContainerRef = useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
|
|
723
894
|
const [imageFailed, setImageFailed] = useState(false);
|
|
724
|
-
const
|
|
725
|
-
const hasMenu =
|
|
895
|
+
const resolvedMenuItems = menuItems ?? [];
|
|
896
|
+
const hasMenu = resolvedMenuItems.length > 0;
|
|
726
897
|
const isInteractive = onPress != null || hasMenu;
|
|
727
898
|
const isOpenControlled = typeof openProp === "boolean";
|
|
728
899
|
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
@@ -732,7 +903,6 @@ var Avatar = forwardRef(function Avatar2({
|
|
|
732
903
|
(next) => {
|
|
733
904
|
if (!isOpenControlled) setUncontrolledOpen(next);
|
|
734
905
|
onOpenChange?.(next);
|
|
735
|
-
if (!next) setHoveredKey(null);
|
|
736
906
|
},
|
|
737
907
|
[isOpenControlled, onOpenChange]
|
|
738
908
|
);
|
|
@@ -785,7 +955,7 @@ var Avatar = forwardRef(function Avatar2({
|
|
|
785
955
|
}, [isOpen, closeAndFocusTrigger]);
|
|
786
956
|
const hasImage = Boolean(imageUrl) && !imageFailed;
|
|
787
957
|
const resolvedAccessibilityLabel = accessibilityLabel ?? [name, email].filter(Boolean).join(", ");
|
|
788
|
-
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [
|
|
958
|
+
return /* @__PURE__ */ jsxs(View, { ref: wrapperRef, style: [styles2.wrapper, isOpen && styles2.wrapperOpen], children: [
|
|
789
959
|
/* @__PURE__ */ jsxs(
|
|
790
960
|
Pressable,
|
|
791
961
|
{
|
|
@@ -797,55 +967,42 @@ var Avatar = forwardRef(function Avatar2({
|
|
|
797
967
|
accessibilityRole: isInteractive ? "button" : void 0,
|
|
798
968
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
799
969
|
accessibilityState: isInteractive ? { disabled, expanded: hasMenu ? isOpen : void 0 } : void 0,
|
|
800
|
-
style: [
|
|
970
|
+
style: [styles2.root, disabled && styles2.disabled, style],
|
|
801
971
|
children: [
|
|
802
|
-
/* @__PURE__ */ jsx(View, { style:
|
|
972
|
+
/* @__PURE__ */ jsx(View, { style: styles2.imageWrap, children: hasImage ? /* @__PURE__ */ jsx(
|
|
803
973
|
Image,
|
|
804
974
|
{
|
|
805
975
|
source: { uri: imageUrl ?? void 0 },
|
|
806
|
-
style:
|
|
976
|
+
style: styles2.image,
|
|
807
977
|
onError: () => setImageFailed(true)
|
|
808
978
|
}
|
|
809
|
-
) : /* @__PURE__ */ jsx(View, { style:
|
|
810
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
811
|
-
/* @__PURE__ */ jsx(Text, { style:
|
|
812
|
-
email ? /* @__PURE__ */ jsx(Text, { style:
|
|
979
|
+
) : /* @__PURE__ */ jsx(View, { style: styles2.imageFallback, children: /* @__PURE__ */ jsx(UserIcon, { size: FALLBACK_ICON_SIZE, color: colors.primary }) }) }),
|
|
980
|
+
/* @__PURE__ */ jsxs(View, { style: styles2.textColumn, children: [
|
|
981
|
+
/* @__PURE__ */ jsx(Text, { style: styles2.name, numberOfLines: 1, children: name }),
|
|
982
|
+
email ? /* @__PURE__ */ jsx(Text, { style: styles2.email, numberOfLines: 1, children: email }) : null
|
|
813
983
|
] }),
|
|
814
|
-
showChevron ? /* @__PURE__ */ jsx(View, { style: [
|
|
984
|
+
showChevron ? /* @__PURE__ */ jsx(View, { style: [styles2.chevronSlot, isOpen && styles2.chevronOpen], children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: CHEVRON_SIZE, color: isOpen ? colors.primary : colors.grey100 }) }) : null
|
|
815
985
|
]
|
|
816
986
|
}
|
|
817
987
|
),
|
|
818
|
-
hasMenu && isOpen ? /* @__PURE__ */ jsx(View, { style: [
|
|
988
|
+
hasMenu && isOpen ? /* @__PURE__ */ jsx(View, { style: [styles2.menu, menuWidth != null && { right: void 0, width: menuWidth }], children: resolvedMenuItems.map((item) => {
|
|
819
989
|
const itemKey = item.key ?? item.label;
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
return /* @__PURE__ */ jsxs(
|
|
823
|
-
Pressable,
|
|
990
|
+
return /* @__PURE__ */ jsx(
|
|
991
|
+
MenuItem,
|
|
824
992
|
{
|
|
825
|
-
|
|
993
|
+
icon: item.icon,
|
|
994
|
+
label: item.label,
|
|
826
995
|
disabled: item.disabled,
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
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
|
-
]
|
|
996
|
+
backgroundColor: item.backgroundColor,
|
|
997
|
+
hoverColor: item.hoverColor,
|
|
998
|
+
onPress: () => handleItemPress(item)
|
|
842
999
|
},
|
|
843
1000
|
itemKey
|
|
844
1001
|
);
|
|
845
1002
|
}) }) : null
|
|
846
1003
|
] });
|
|
847
1004
|
});
|
|
848
|
-
var
|
|
1005
|
+
var styles2 = StyleSheet.create({
|
|
849
1006
|
wrapper: {
|
|
850
1007
|
position: "relative",
|
|
851
1008
|
alignSelf: "flex-start"
|
|
@@ -928,30 +1085,6 @@ var styles = StyleSheet.create({
|
|
|
928
1085
|
elevation: 8
|
|
929
1086
|
}
|
|
930
1087
|
})
|
|
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
1088
|
}
|
|
956
1089
|
});
|
|
957
1090
|
var variantConfig = {
|
|
@@ -1026,7 +1159,7 @@ var Button = forwardRef(
|
|
|
1026
1159
|
useApplyWebClassName(textRef, textClassName);
|
|
1027
1160
|
const iconNode = customIcon ?? /* @__PURE__ */ jsx(ArrowRightIcon, { size: metrics.iconSize, color: preset.iconColor });
|
|
1028
1161
|
const containerStyle = [
|
|
1029
|
-
|
|
1162
|
+
styles3.base,
|
|
1030
1163
|
{
|
|
1031
1164
|
minHeight: metrics.minHeight,
|
|
1032
1165
|
borderRadius: metrics.borderRadius,
|
|
@@ -1037,15 +1170,15 @@ var Button = forwardRef(
|
|
|
1037
1170
|
paddingRight: hasIcon ? metrics.paddingRightWithIcon : metrics.paddingRight,
|
|
1038
1171
|
gap: hasIcon ? metrics.gap : 0
|
|
1039
1172
|
},
|
|
1040
|
-
disabled &&
|
|
1173
|
+
disabled && styles3.disabled,
|
|
1041
1174
|
style
|
|
1042
1175
|
];
|
|
1043
1176
|
const labelStyle = [
|
|
1044
|
-
|
|
1177
|
+
styles3.label,
|
|
1045
1178
|
metrics.text,
|
|
1046
1179
|
{ color: preset.textColor },
|
|
1047
|
-
Platform.OS === "android" ?
|
|
1048
|
-
!hasIcon &&
|
|
1180
|
+
Platform.OS === "android" ? styles3.labelAndroid : null,
|
|
1181
|
+
!hasIcon && styles3.labelCentered,
|
|
1049
1182
|
textStyle
|
|
1050
1183
|
];
|
|
1051
1184
|
return /* @__PURE__ */ jsxs(
|
|
@@ -1066,7 +1199,7 @@ var Button = forwardRef(
|
|
|
1066
1199
|
View,
|
|
1067
1200
|
{
|
|
1068
1201
|
style: [
|
|
1069
|
-
|
|
1202
|
+
styles3.iconContainer,
|
|
1070
1203
|
{
|
|
1071
1204
|
width: metrics.iconContainerSize,
|
|
1072
1205
|
height: metrics.iconContainerSize,
|
|
@@ -1082,7 +1215,7 @@ var Button = forwardRef(
|
|
|
1082
1215
|
);
|
|
1083
1216
|
}
|
|
1084
1217
|
);
|
|
1085
|
-
var
|
|
1218
|
+
var styles3 = StyleSheet.create({
|
|
1086
1219
|
base: {
|
|
1087
1220
|
flexDirection: "row",
|
|
1088
1221
|
alignItems: "center",
|
|
@@ -1160,13 +1293,13 @@ var Checkbox = forwardRef(function Checkbox2({
|
|
|
1160
1293
|
accessibilityRole: "checkbox",
|
|
1161
1294
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
1162
1295
|
accessibilityState: { checked: isActive, disabled },
|
|
1163
|
-
style: [
|
|
1296
|
+
style: [styles4.root, disabled && styles4.disabled, style],
|
|
1164
1297
|
children: [
|
|
1165
1298
|
/* @__PURE__ */ jsx(
|
|
1166
1299
|
View,
|
|
1167
1300
|
{
|
|
1168
1301
|
style: [
|
|
1169
|
-
|
|
1302
|
+
styles4.box,
|
|
1170
1303
|
{
|
|
1171
1304
|
backgroundColor: chrome.backgroundColor,
|
|
1172
1305
|
borderColor: chrome.borderColor
|
|
@@ -1175,12 +1308,12 @@ var Checkbox = forwardRef(function Checkbox2({
|
|
|
1175
1308
|
children: isActive ? /* @__PURE__ */ jsx(CheckIcon, { size: CHECK_SIZE, color: colors.primary, strokeWidth: CHECK_STROKE }) : null
|
|
1176
1309
|
}
|
|
1177
1310
|
),
|
|
1178
|
-
labelContent != null && labelContent !== false ? typeof labelContent === "string" || typeof labelContent === "number" ? /* @__PURE__ */ jsx(Text, { style: [
|
|
1311
|
+
labelContent != null && labelContent !== false ? typeof labelContent === "string" || typeof labelContent === "number" ? /* @__PURE__ */ jsx(Text, { style: [styles4.label, labelStyle], children: labelContent }) : labelContent : null
|
|
1179
1312
|
]
|
|
1180
1313
|
}
|
|
1181
1314
|
);
|
|
1182
1315
|
});
|
|
1183
|
-
var
|
|
1316
|
+
var styles4 = StyleSheet.create({
|
|
1184
1317
|
root: {
|
|
1185
1318
|
flexDirection: "row",
|
|
1186
1319
|
alignItems: "center",
|
|
@@ -1204,7 +1337,525 @@ var styles3 = StyleSheet.create({
|
|
|
1204
1337
|
color: colors.white
|
|
1205
1338
|
}
|
|
1206
1339
|
});
|
|
1207
|
-
|
|
1340
|
+
|
|
1341
|
+
// src/utils/dateUtils.ts
|
|
1342
|
+
function startOfDay(date) {
|
|
1343
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
1344
|
+
}
|
|
1345
|
+
function isSameDay(a, b) {
|
|
1346
|
+
if (a == null || b == null) return false;
|
|
1347
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
1348
|
+
}
|
|
1349
|
+
function isSameMonth(a, b) {
|
|
1350
|
+
return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
|
|
1351
|
+
}
|
|
1352
|
+
function addMonths(date, amount) {
|
|
1353
|
+
return new Date(date.getFullYear(), date.getMonth() + amount, 1);
|
|
1354
|
+
}
|
|
1355
|
+
function isBefore(a, b) {
|
|
1356
|
+
return startOfDay(a).getTime() < startOfDay(b).getTime();
|
|
1357
|
+
}
|
|
1358
|
+
function isAfter(a, b) {
|
|
1359
|
+
return startOfDay(a).getTime() > startOfDay(b).getTime();
|
|
1360
|
+
}
|
|
1361
|
+
function isWithinRange(date, start, end) {
|
|
1362
|
+
const time = startOfDay(date).getTime();
|
|
1363
|
+
return time >= startOfDay(start).getTime() && time <= startOfDay(end).getTime();
|
|
1364
|
+
}
|
|
1365
|
+
function isDateDisabled(date, min, max) {
|
|
1366
|
+
if (min && isBefore(date, min)) return true;
|
|
1367
|
+
if (max && isAfter(date, max)) return true;
|
|
1368
|
+
return false;
|
|
1369
|
+
}
|
|
1370
|
+
function formatDate(date) {
|
|
1371
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
1372
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
1373
|
+
return `${day}.${month}.${date.getFullYear()}`;
|
|
1374
|
+
}
|
|
1375
|
+
function getMonthMatrix(monthDate, weekStartsOn = 1) {
|
|
1376
|
+
const year = monthDate.getFullYear();
|
|
1377
|
+
const month = monthDate.getMonth();
|
|
1378
|
+
const firstOfMonth = new Date(year, month, 1);
|
|
1379
|
+
const firstWeekday = firstOfMonth.getDay();
|
|
1380
|
+
const leadingDays = (firstWeekday - weekStartsOn + 7) % 7;
|
|
1381
|
+
const gridStart = new Date(year, month, 1 - leadingDays);
|
|
1382
|
+
const weeks = [];
|
|
1383
|
+
let cursor = gridStart;
|
|
1384
|
+
for (let week = 0; week < 6; week += 1) {
|
|
1385
|
+
const days = [];
|
|
1386
|
+
for (let day = 0; day < 7; day += 1) {
|
|
1387
|
+
days.push(cursor);
|
|
1388
|
+
cursor = new Date(cursor.getFullYear(), cursor.getMonth(), cursor.getDate() + 1);
|
|
1389
|
+
}
|
|
1390
|
+
weeks.push(days);
|
|
1391
|
+
}
|
|
1392
|
+
return weeks;
|
|
1393
|
+
}
|
|
1394
|
+
var DEFAULT_MONTH_NAMES = [
|
|
1395
|
+
"\u0540\u0578\u0582\u0576\u057E\u0561\u0580",
|
|
1396
|
+
"\u0553\u0565\u057F\u0580\u057E\u0561\u0580",
|
|
1397
|
+
"\u0544\u0561\u0580\u057F",
|
|
1398
|
+
"\u0531\u057A\u0580\u056B\u056C",
|
|
1399
|
+
"\u0544\u0561\u0575\u056B\u057D",
|
|
1400
|
+
"\u0540\u0578\u0582\u0576\u056B\u057D",
|
|
1401
|
+
"\u0540\u0578\u0582\u056C\u056B\u057D",
|
|
1402
|
+
"\u0555\u0563\u0578\u057D\u057F\u0578\u057D",
|
|
1403
|
+
"\u054D\u0565\u057A\u057F\u0565\u0574\u0562\u0565\u0580",
|
|
1404
|
+
"\u0540\u0578\u056F\u057F\u0565\u0574\u0562\u0565\u0580",
|
|
1405
|
+
"\u0546\u0578\u0575\u0565\u0574\u0562\u0565\u0580",
|
|
1406
|
+
"\u0534\u0565\u056F\u057F\u0565\u0574\u0562\u0565\u0580"
|
|
1407
|
+
];
|
|
1408
|
+
var DEFAULT_WEEKDAY_LABELS = ["\u0535\u0550", "\u0535\u0554", "\u0549\u0550", "\u0540\u0546", "\u0548\u0552\u0550", "\u0547\u0532", "\u053F\u0550"];
|
|
1409
|
+
var EMPTY_RANGE = { start: null, end: null };
|
|
1410
|
+
var DEFAULT_WIDTH = 380;
|
|
1411
|
+
var TRIGGER_HEIGHT = 44;
|
|
1412
|
+
var TRIGGER_RADIUS = 60;
|
|
1413
|
+
var MENU_RADIUS2 = 20;
|
|
1414
|
+
var ICON_SIZE2 = 20;
|
|
1415
|
+
var NAV_ICON_SIZE = 20;
|
|
1416
|
+
var DAY_CELL_HEIGHT = 44;
|
|
1417
|
+
var DAY_CIRCLE_SIZE = 44;
|
|
1418
|
+
var DatePicker = forwardRef(
|
|
1419
|
+
function DatePicker2(props, forwardedRef) {
|
|
1420
|
+
const {
|
|
1421
|
+
placeholder = "Select date",
|
|
1422
|
+
open: openProp,
|
|
1423
|
+
defaultOpen = false,
|
|
1424
|
+
onOpenChange,
|
|
1425
|
+
disabled = false,
|
|
1426
|
+
closeOnSelect = true,
|
|
1427
|
+
minDate,
|
|
1428
|
+
maxDate,
|
|
1429
|
+
defaultVisibleMonth,
|
|
1430
|
+
monthNames = DEFAULT_MONTH_NAMES,
|
|
1431
|
+
weekdayLabels = DEFAULT_WEEKDAY_LABELS,
|
|
1432
|
+
formatValue = formatDate,
|
|
1433
|
+
weekStartsOn = 1,
|
|
1434
|
+
style,
|
|
1435
|
+
className,
|
|
1436
|
+
accessibilityLabel,
|
|
1437
|
+
// Pulled out only to keep them off `rest` (which is spread onto the root View);
|
|
1438
|
+
// the real values are read from `props` directly below to preserve discriminated typing.
|
|
1439
|
+
range: _range,
|
|
1440
|
+
value: _value,
|
|
1441
|
+
defaultValue: _defaultValue,
|
|
1442
|
+
onValueChange: _onValueChange,
|
|
1443
|
+
...rest
|
|
1444
|
+
} = props;
|
|
1445
|
+
const isRange = props.range === true;
|
|
1446
|
+
const valueProp = props.value;
|
|
1447
|
+
const rootRef = useRef(null);
|
|
1448
|
+
const triggerRef = useRef(null);
|
|
1449
|
+
const setRootRef = useMemo(() => mergeRefs(rootRef, forwardedRef), [forwardedRef]);
|
|
1450
|
+
const isOpenControlled = typeof openProp === "boolean";
|
|
1451
|
+
const isValueControlled = valueProp !== void 0;
|
|
1452
|
+
const [uncontrolledSingle, setUncontrolledSingle] = useState(
|
|
1453
|
+
!isRange ? props.defaultValue ?? null : null
|
|
1454
|
+
);
|
|
1455
|
+
const [uncontrolledRange, setUncontrolledRange] = useState(
|
|
1456
|
+
isRange ? props.defaultValue ?? EMPTY_RANGE : EMPTY_RANGE
|
|
1457
|
+
);
|
|
1458
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
1459
|
+
const [hoveredDayKey, setHoveredDayKey] = useState(null);
|
|
1460
|
+
const rangeValue = isRange ? isValueControlled ? valueProp ?? EMPTY_RANGE : uncontrolledRange : EMPTY_RANGE;
|
|
1461
|
+
const singleValue = !isRange ? isValueControlled ? valueProp ?? null : uncontrolledSingle : null;
|
|
1462
|
+
const isOpen = isOpenControlled ? openProp : uncontrolledOpen;
|
|
1463
|
+
const [visibleMonth, setVisibleMonth] = useState(() => {
|
|
1464
|
+
const anchor = defaultVisibleMonth ?? (isRange ? rangeValue.start : singleValue) ?? /* @__PURE__ */ new Date();
|
|
1465
|
+
return new Date(anchor.getFullYear(), anchor.getMonth(), 1);
|
|
1466
|
+
});
|
|
1467
|
+
useApplyWebClassName(rootRef, className);
|
|
1468
|
+
const setOpen = useCallback(
|
|
1469
|
+
(next) => {
|
|
1470
|
+
if (!isOpenControlled) setUncontrolledOpen(next);
|
|
1471
|
+
onOpenChange?.(next);
|
|
1472
|
+
if (next) {
|
|
1473
|
+
const anchor = (isRange ? rangeValue.start : singleValue) ?? /* @__PURE__ */ new Date();
|
|
1474
|
+
setVisibleMonth(new Date(anchor.getFullYear(), anchor.getMonth(), 1));
|
|
1475
|
+
} else {
|
|
1476
|
+
setHoveredDayKey(null);
|
|
1477
|
+
}
|
|
1478
|
+
},
|
|
1479
|
+
[isOpenControlled, isRange, onOpenChange, rangeValue.start, singleValue]
|
|
1480
|
+
);
|
|
1481
|
+
useEffect(() => {
|
|
1482
|
+
if (Platform.OS !== "web" || !isOpen) return;
|
|
1483
|
+
const handlePointerDown = (event) => {
|
|
1484
|
+
const root = rootRef.current;
|
|
1485
|
+
const target = event.target;
|
|
1486
|
+
if (root?.contains && target instanceof Node && !root.contains(target)) {
|
|
1487
|
+
setOpen(false);
|
|
1488
|
+
}
|
|
1489
|
+
};
|
|
1490
|
+
document.addEventListener("mousedown", handlePointerDown);
|
|
1491
|
+
document.addEventListener("touchstart", handlePointerDown);
|
|
1492
|
+
return () => {
|
|
1493
|
+
document.removeEventListener("mousedown", handlePointerDown);
|
|
1494
|
+
document.removeEventListener("touchstart", handlePointerDown);
|
|
1495
|
+
};
|
|
1496
|
+
}, [isOpen, setOpen]);
|
|
1497
|
+
const focusTrigger = useCallback(() => {
|
|
1498
|
+
const node = triggerRef.current;
|
|
1499
|
+
node?.focus?.();
|
|
1500
|
+
}, []);
|
|
1501
|
+
const closeAndFocusTrigger = useCallback(() => {
|
|
1502
|
+
setOpen(false);
|
|
1503
|
+
focusTrigger();
|
|
1504
|
+
}, [focusTrigger, setOpen]);
|
|
1505
|
+
useEffect(() => {
|
|
1506
|
+
if (Platform.OS !== "web" || !isOpen) return;
|
|
1507
|
+
const handleKeyDown = (event) => {
|
|
1508
|
+
if (event.key === "Escape") {
|
|
1509
|
+
event.preventDefault();
|
|
1510
|
+
closeAndFocusTrigger();
|
|
1511
|
+
}
|
|
1512
|
+
};
|
|
1513
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
1514
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
1515
|
+
}, [isOpen, closeAndFocusTrigger]);
|
|
1516
|
+
const handleTriggerPress = () => {
|
|
1517
|
+
if (disabled) return;
|
|
1518
|
+
setOpen(!isOpen);
|
|
1519
|
+
};
|
|
1520
|
+
const handleDayPress = useCallback(
|
|
1521
|
+
(day) => {
|
|
1522
|
+
if (disabled || isDateDisabled(day, minDate, maxDate)) return;
|
|
1523
|
+
const picked = startOfDay(day);
|
|
1524
|
+
if (!isRange) {
|
|
1525
|
+
if (!isValueControlled) setUncontrolledSingle(picked);
|
|
1526
|
+
props.onValueChange?.(picked);
|
|
1527
|
+
if (closeOnSelect) setOpen(false);
|
|
1528
|
+
return;
|
|
1529
|
+
}
|
|
1530
|
+
const { start, end } = rangeValue;
|
|
1531
|
+
const startingNewRange = !start || start && end;
|
|
1532
|
+
const nextRange = startingNewRange ? { start: picked, end: null } : isBefore(picked, start) ? { start: picked, end: null } : { start, end: picked };
|
|
1533
|
+
if (!isValueControlled) setUncontrolledRange(nextRange);
|
|
1534
|
+
props.onValueChange?.(nextRange);
|
|
1535
|
+
if (closeOnSelect && nextRange.start && nextRange.end) setOpen(false);
|
|
1536
|
+
},
|
|
1537
|
+
[
|
|
1538
|
+
closeOnSelect,
|
|
1539
|
+
disabled,
|
|
1540
|
+
isRange,
|
|
1541
|
+
isValueControlled,
|
|
1542
|
+
maxDate,
|
|
1543
|
+
minDate,
|
|
1544
|
+
props,
|
|
1545
|
+
rangeValue,
|
|
1546
|
+
setOpen
|
|
1547
|
+
]
|
|
1548
|
+
);
|
|
1549
|
+
const handlePrevMonth = () => setVisibleMonth((current) => addMonths(current, -1));
|
|
1550
|
+
const handleNextMonth = () => setVisibleMonth((current) => addMonths(current, 1));
|
|
1551
|
+
const weeks = useMemo(
|
|
1552
|
+
() => getMonthMatrix(visibleMonth, weekStartsOn),
|
|
1553
|
+
[visibleMonth, weekStartsOn]
|
|
1554
|
+
);
|
|
1555
|
+
const today = useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
1556
|
+
const hasValue = isRange ? rangeValue.start != null : singleValue != null;
|
|
1557
|
+
const triggerLabel = isRange ? rangeValue.start && rangeValue.end ? `${formatValue(rangeValue.start)} - ${formatValue(rangeValue.end)}` : rangeValue.start ? `${formatValue(rangeValue.start)} - ...` : placeholder : singleValue ? formatValue(singleValue) : placeholder;
|
|
1558
|
+
const triggerBorderColor = isOpen ? colors.primaryMuted : colors.grey700;
|
|
1559
|
+
const triggerTextColor = hasValue ? colors.white : colors.grey100;
|
|
1560
|
+
const resolvedAccessibilityLabel = accessibilityLabel ?? placeholder;
|
|
1561
|
+
return /* @__PURE__ */ jsx(
|
|
1562
|
+
View,
|
|
1563
|
+
{
|
|
1564
|
+
...rest,
|
|
1565
|
+
ref: setRootRef,
|
|
1566
|
+
style: [styles5.root, isOpen && styles5.rootOpen, disabled && styles5.disabled, style],
|
|
1567
|
+
accessibilityState: { disabled, expanded: isOpen },
|
|
1568
|
+
children: /* @__PURE__ */ jsxs(View, { style: [styles5.triggerWrap, isOpen && styles5.triggerWrapOpen], children: [
|
|
1569
|
+
/* @__PURE__ */ jsxs(
|
|
1570
|
+
Pressable,
|
|
1571
|
+
{
|
|
1572
|
+
ref: triggerRef,
|
|
1573
|
+
onPress: handleTriggerPress,
|
|
1574
|
+
disabled,
|
|
1575
|
+
accessibilityRole: "button",
|
|
1576
|
+
accessibilityLabel: resolvedAccessibilityLabel,
|
|
1577
|
+
accessibilityState: { disabled, expanded: isOpen },
|
|
1578
|
+
style: [
|
|
1579
|
+
styles5.trigger,
|
|
1580
|
+
{ borderColor: triggerBorderColor, backgroundColor: colors.grey700 }
|
|
1581
|
+
],
|
|
1582
|
+
children: [
|
|
1583
|
+
/* @__PURE__ */ jsx(Text, { style: [styles5.triggerText, { color: triggerTextColor }], numberOfLines: 1, children: triggerLabel }),
|
|
1584
|
+
/* @__PURE__ */ jsx(View, { style: styles5.iconSlot, children: /* @__PURE__ */ jsx(CalendarOutlineIcon, { size: ICON_SIZE2, color: colors.grey100 }) })
|
|
1585
|
+
]
|
|
1586
|
+
}
|
|
1587
|
+
),
|
|
1588
|
+
isOpen ? /* @__PURE__ */ jsxs(View, { style: styles5.menu, children: [
|
|
1589
|
+
/* @__PURE__ */ jsxs(View, { style: styles5.calendarHeader, children: [
|
|
1590
|
+
/* @__PURE__ */ jsx(
|
|
1591
|
+
Pressable,
|
|
1592
|
+
{
|
|
1593
|
+
onPress: handlePrevMonth,
|
|
1594
|
+
hitSlop: 8,
|
|
1595
|
+
accessibilityRole: "button",
|
|
1596
|
+
accessibilityLabel: "Previous month",
|
|
1597
|
+
style: styles5.navButton,
|
|
1598
|
+
children: /* @__PURE__ */ jsx(ChevronLeftIcon, { size: NAV_ICON_SIZE, color: colors.white })
|
|
1599
|
+
}
|
|
1600
|
+
),
|
|
1601
|
+
/* @__PURE__ */ jsxs(Text, { style: styles5.monthHeading, children: [
|
|
1602
|
+
monthNames[visibleMonth.getMonth()],
|
|
1603
|
+
" ",
|
|
1604
|
+
visibleMonth.getFullYear()
|
|
1605
|
+
] }),
|
|
1606
|
+
/* @__PURE__ */ jsx(
|
|
1607
|
+
Pressable,
|
|
1608
|
+
{
|
|
1609
|
+
onPress: handleNextMonth,
|
|
1610
|
+
hitSlop: 8,
|
|
1611
|
+
accessibilityRole: "button",
|
|
1612
|
+
accessibilityLabel: "Next month",
|
|
1613
|
+
style: styles5.navButton,
|
|
1614
|
+
children: /* @__PURE__ */ jsx(View, { style: styles5.navIconMirror, children: /* @__PURE__ */ jsx(ChevronLeftIcon, { size: NAV_ICON_SIZE, color: colors.white }) })
|
|
1615
|
+
}
|
|
1616
|
+
)
|
|
1617
|
+
] }),
|
|
1618
|
+
/* @__PURE__ */ jsxs(View, { children: [
|
|
1619
|
+
/* @__PURE__ */ jsx(View, { style: styles5.weekdayRow, children: weekdayLabels.map((weekdayLabel, index) => /* @__PURE__ */ jsx(View, { style: styles5.dayCellWrap, children: /* @__PURE__ */ jsx(Text, { style: styles5.weekdayText, children: weekdayLabel }) }, `${weekdayLabel}-${index}`)) }),
|
|
1620
|
+
weeks.map((week, weekIndex) => {
|
|
1621
|
+
let rangeHighlightStyle = null;
|
|
1622
|
+
if (isRange && rangeValue.start && rangeValue.end) {
|
|
1623
|
+
const rangeIndices = week.reduce((acc, day, index) => {
|
|
1624
|
+
if (isWithinRange(day, rangeValue.start, rangeValue.end)) {
|
|
1625
|
+
acc.push(index);
|
|
1626
|
+
}
|
|
1627
|
+
return acc;
|
|
1628
|
+
}, []);
|
|
1629
|
+
if (rangeIndices.length > 0) {
|
|
1630
|
+
const first = rangeIndices[0];
|
|
1631
|
+
const last = rangeIndices[rangeIndices.length - 1];
|
|
1632
|
+
const startsHere = isSameDay(week[first], rangeValue.start);
|
|
1633
|
+
const endsHere = isSameDay(week[last], rangeValue.end);
|
|
1634
|
+
const cellPct = 100 / 7;
|
|
1635
|
+
const halfCellPct = cellPct / 2;
|
|
1636
|
+
let leftPct = first * cellPct;
|
|
1637
|
+
let widthPct = (last - first + 1) * cellPct;
|
|
1638
|
+
if (startsHere) {
|
|
1639
|
+
leftPct += halfCellPct;
|
|
1640
|
+
widthPct -= halfCellPct;
|
|
1641
|
+
}
|
|
1642
|
+
if (endsHere) {
|
|
1643
|
+
widthPct -= halfCellPct;
|
|
1644
|
+
}
|
|
1645
|
+
if (widthPct > 0) {
|
|
1646
|
+
rangeHighlightStyle = {
|
|
1647
|
+
left: `${leftPct}%`,
|
|
1648
|
+
width: `${widthPct}%`
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
return /* @__PURE__ */ jsxs(
|
|
1654
|
+
View,
|
|
1655
|
+
{
|
|
1656
|
+
style: [styles5.weekRow, weekIndex > 0 && styles5.weekRowSpaced],
|
|
1657
|
+
children: [
|
|
1658
|
+
rangeHighlightStyle ? /* @__PURE__ */ jsx(
|
|
1659
|
+
View,
|
|
1660
|
+
{
|
|
1661
|
+
pointerEvents: "none",
|
|
1662
|
+
style: [styles5.rangeHighlight, rangeHighlightStyle]
|
|
1663
|
+
}
|
|
1664
|
+
) : null,
|
|
1665
|
+
week.map((day, dayIndex) => {
|
|
1666
|
+
const inCurrentMonth = isSameMonth(day, visibleMonth);
|
|
1667
|
+
const isToday = isSameDay(day, today);
|
|
1668
|
+
const isSelectedSingle = !isRange && isSameDay(day, singleValue);
|
|
1669
|
+
const isRangeStart = isRange && isSameDay(day, rangeValue.start);
|
|
1670
|
+
const isRangeEnd = isRange && isSameDay(day, rangeValue.end);
|
|
1671
|
+
const isSelectedEndpoint = isSelectedSingle || isRangeStart || isRangeEnd;
|
|
1672
|
+
const dayDisabled = disabled || isDateDisabled(day, minDate, maxDate);
|
|
1673
|
+
const dayKey = startOfDay(day).getTime();
|
|
1674
|
+
const isHovered = !dayDisabled && !isSelectedEndpoint && hoveredDayKey === dayKey;
|
|
1675
|
+
const dayTextColor = isSelectedEndpoint ? colors.white : dayDisabled ? colors.grey400 : isToday ? colors.primary : !inCurrentMonth ? colors.grey300 : colors.white;
|
|
1676
|
+
return /* @__PURE__ */ jsxs(
|
|
1677
|
+
Pressable,
|
|
1678
|
+
{
|
|
1679
|
+
onPress: () => handleDayPress(day),
|
|
1680
|
+
disabled: dayDisabled,
|
|
1681
|
+
onHoverIn: () => setHoveredDayKey(dayKey),
|
|
1682
|
+
onHoverOut: () => setHoveredDayKey((current) => current === dayKey ? null : current),
|
|
1683
|
+
onPressIn: () => setHoveredDayKey(dayKey),
|
|
1684
|
+
onPressOut: () => setHoveredDayKey((current) => current === dayKey ? null : current),
|
|
1685
|
+
style: styles5.dayCellWrap,
|
|
1686
|
+
accessibilityRole: "button",
|
|
1687
|
+
accessibilityLabel: formatValue(day),
|
|
1688
|
+
accessibilityState: {
|
|
1689
|
+
disabled: dayDisabled,
|
|
1690
|
+
selected: isSelectedEndpoint
|
|
1691
|
+
},
|
|
1692
|
+
children: [
|
|
1693
|
+
/* @__PURE__ */ jsx(
|
|
1694
|
+
View,
|
|
1695
|
+
{
|
|
1696
|
+
style: [
|
|
1697
|
+
styles5.dayCircle,
|
|
1698
|
+
isSelectedEndpoint && styles5.dayCircleSelected,
|
|
1699
|
+
isHovered && styles5.dayCircleHovered
|
|
1700
|
+
],
|
|
1701
|
+
children: /* @__PURE__ */ jsx(Text, { style: [styles5.dayText, { color: dayTextColor }], children: day.getDate() })
|
|
1702
|
+
}
|
|
1703
|
+
),
|
|
1704
|
+
isToday && !isSelectedEndpoint ? /* @__PURE__ */ jsx(View, { style: styles5.todayDot }) : null
|
|
1705
|
+
]
|
|
1706
|
+
},
|
|
1707
|
+
dayIndex
|
|
1708
|
+
);
|
|
1709
|
+
})
|
|
1710
|
+
]
|
|
1711
|
+
},
|
|
1712
|
+
weekIndex
|
|
1713
|
+
);
|
|
1714
|
+
})
|
|
1715
|
+
] })
|
|
1716
|
+
] }) : null
|
|
1717
|
+
] })
|
|
1718
|
+
}
|
|
1719
|
+
);
|
|
1720
|
+
}
|
|
1721
|
+
);
|
|
1722
|
+
var styles5 = StyleSheet.create({
|
|
1723
|
+
root: {
|
|
1724
|
+
width: DEFAULT_WIDTH,
|
|
1725
|
+
gap: 8,
|
|
1726
|
+
alignSelf: "flex-start"
|
|
1727
|
+
},
|
|
1728
|
+
rootOpen: {
|
|
1729
|
+
zIndex: 30
|
|
1730
|
+
},
|
|
1731
|
+
disabled: {
|
|
1732
|
+
opacity: 0.6
|
|
1733
|
+
},
|
|
1734
|
+
triggerWrap: {
|
|
1735
|
+
position: "relative",
|
|
1736
|
+
zIndex: 1
|
|
1737
|
+
},
|
|
1738
|
+
triggerWrapOpen: {
|
|
1739
|
+
zIndex: 20
|
|
1740
|
+
},
|
|
1741
|
+
trigger: {
|
|
1742
|
+
height: TRIGGER_HEIGHT,
|
|
1743
|
+
borderRadius: TRIGGER_RADIUS,
|
|
1744
|
+
borderWidth: 1,
|
|
1745
|
+
paddingVertical: 10,
|
|
1746
|
+
paddingHorizontal: 16,
|
|
1747
|
+
flexDirection: "row",
|
|
1748
|
+
alignItems: "center",
|
|
1749
|
+
gap: 10,
|
|
1750
|
+
overflow: "hidden"
|
|
1751
|
+
},
|
|
1752
|
+
triggerText: {
|
|
1753
|
+
...datePickerTypography.field,
|
|
1754
|
+
flex: 1,
|
|
1755
|
+
minWidth: 0
|
|
1756
|
+
},
|
|
1757
|
+
iconSlot: {
|
|
1758
|
+
width: ICON_SIZE2,
|
|
1759
|
+
height: ICON_SIZE2,
|
|
1760
|
+
alignItems: "center",
|
|
1761
|
+
justifyContent: "center",
|
|
1762
|
+
flexShrink: 0
|
|
1763
|
+
},
|
|
1764
|
+
menu: {
|
|
1765
|
+
position: "absolute",
|
|
1766
|
+
top: "100%",
|
|
1767
|
+
left: 0,
|
|
1768
|
+
right: 0,
|
|
1769
|
+
marginTop: 8,
|
|
1770
|
+
zIndex: 10,
|
|
1771
|
+
borderRadius: MENU_RADIUS2,
|
|
1772
|
+
padding: 12,
|
|
1773
|
+
gap: 0,
|
|
1774
|
+
backgroundColor: colors.grey700,
|
|
1775
|
+
...Platform.select({
|
|
1776
|
+
web: {
|
|
1777
|
+
boxShadow: `0 8px 24px ${colors.black}73`
|
|
1778
|
+
},
|
|
1779
|
+
default: {
|
|
1780
|
+
elevation: 8
|
|
1781
|
+
}
|
|
1782
|
+
})
|
|
1783
|
+
},
|
|
1784
|
+
calendarHeader: {
|
|
1785
|
+
height: 36,
|
|
1786
|
+
flexDirection: "row",
|
|
1787
|
+
alignItems: "center",
|
|
1788
|
+
justifyContent: "space-between"
|
|
1789
|
+
},
|
|
1790
|
+
navButton: {
|
|
1791
|
+
width: 36,
|
|
1792
|
+
height: 36,
|
|
1793
|
+
alignItems: "center",
|
|
1794
|
+
justifyContent: "center"
|
|
1795
|
+
},
|
|
1796
|
+
navIconMirror: {
|
|
1797
|
+
transform: [{ scaleX: -1 }]
|
|
1798
|
+
},
|
|
1799
|
+
monthHeading: {
|
|
1800
|
+
...datePickerTypography.monthHeading,
|
|
1801
|
+
color: colors.white,
|
|
1802
|
+
textAlign: "center"
|
|
1803
|
+
},
|
|
1804
|
+
weekdayRow: {
|
|
1805
|
+
flexDirection: "row"
|
|
1806
|
+
},
|
|
1807
|
+
weekdayText: {
|
|
1808
|
+
...datePickerTypography.weekday,
|
|
1809
|
+
color: colors.grey300,
|
|
1810
|
+
textAlign: "center",
|
|
1811
|
+
textTransform: "uppercase"
|
|
1812
|
+
},
|
|
1813
|
+
weekRow: {
|
|
1814
|
+
flexDirection: "row",
|
|
1815
|
+
position: "relative"
|
|
1816
|
+
},
|
|
1817
|
+
weekRowSpaced: {
|
|
1818
|
+
marginTop: 8
|
|
1819
|
+
},
|
|
1820
|
+
rangeHighlight: {
|
|
1821
|
+
position: "absolute",
|
|
1822
|
+
top: (DAY_CELL_HEIGHT - DAY_CIRCLE_SIZE) / 2,
|
|
1823
|
+
bottom: (DAY_CELL_HEIGHT - DAY_CIRCLE_SIZE) / 2,
|
|
1824
|
+
borderRadius: DAY_CIRCLE_SIZE / 2,
|
|
1825
|
+
backgroundColor: colors.primaryHover
|
|
1826
|
+
},
|
|
1827
|
+
dayCellWrap: {
|
|
1828
|
+
flex: 1,
|
|
1829
|
+
height: DAY_CELL_HEIGHT,
|
|
1830
|
+
alignItems: "center",
|
|
1831
|
+
justifyContent: "center"
|
|
1832
|
+
},
|
|
1833
|
+
dayCircle: {
|
|
1834
|
+
width: DAY_CIRCLE_SIZE,
|
|
1835
|
+
height: DAY_CIRCLE_SIZE,
|
|
1836
|
+
borderRadius: DAY_CIRCLE_SIZE / 2,
|
|
1837
|
+
alignItems: "center",
|
|
1838
|
+
justifyContent: "center"
|
|
1839
|
+
},
|
|
1840
|
+
dayCircleSelected: {
|
|
1841
|
+
backgroundColor: colors.primary
|
|
1842
|
+
},
|
|
1843
|
+
dayCircleHovered: {
|
|
1844
|
+
backgroundColor: colors.grey600
|
|
1845
|
+
},
|
|
1846
|
+
dayText: {
|
|
1847
|
+
...datePickerTypography.day
|
|
1848
|
+
},
|
|
1849
|
+
todayDot: {
|
|
1850
|
+
position: "absolute",
|
|
1851
|
+
bottom: 2,
|
|
1852
|
+
width: 4,
|
|
1853
|
+
height: 4,
|
|
1854
|
+
borderRadius: 2,
|
|
1855
|
+
backgroundColor: colors.primary
|
|
1856
|
+
}
|
|
1857
|
+
});
|
|
1858
|
+
var DEFAULT_WIDTH2 = 308;
|
|
1208
1859
|
var sizeConfig2 = {
|
|
1209
1860
|
lg: {
|
|
1210
1861
|
height: 44,
|
|
@@ -1328,13 +1979,13 @@ var Input = forwardRef(function Input2({
|
|
|
1328
1979
|
const rightIconNode = rightIcon ?? /* @__PURE__ */ jsx(ShowIcon, { size: metrics.iconSize, color: chrome.rightIconColor });
|
|
1329
1980
|
useApplyWebClassName(rootRef, className);
|
|
1330
1981
|
useApplyWebClassName(inputRef, inputClassName);
|
|
1331
|
-
return /* @__PURE__ */ jsxs(View, { ref: rootRef, style: [
|
|
1332
|
-
showLabel && label ? /* @__PURE__ */ jsx(Text, { style: [
|
|
1982
|
+
return /* @__PURE__ */ jsxs(View, { ref: rootRef, style: [styles6.root, disabled && styles6.disabled, style], children: [
|
|
1983
|
+
showLabel && label ? /* @__PURE__ */ jsx(Text, { style: [styles6.label, { color: chrome.labelColor }], children: label }) : null,
|
|
1333
1984
|
/* @__PURE__ */ jsxs(
|
|
1334
1985
|
View,
|
|
1335
1986
|
{
|
|
1336
1987
|
style: [
|
|
1337
|
-
|
|
1988
|
+
styles6.field,
|
|
1338
1989
|
{
|
|
1339
1990
|
height: metrics.height,
|
|
1340
1991
|
borderRadius: metrics.borderRadius,
|
|
@@ -1349,7 +2000,7 @@ var Input = forwardRef(function Input2({
|
|
|
1349
2000
|
fieldStyle
|
|
1350
2001
|
],
|
|
1351
2002
|
children: [
|
|
1352
|
-
hasLeftIcon ? /* @__PURE__ */ jsx(View, { style: [
|
|
2003
|
+
hasLeftIcon ? /* @__PURE__ */ jsx(View, { style: [styles6.iconSlot, { width: metrics.iconSize, height: metrics.iconSize }], children: leftIconNode }) : null,
|
|
1353
2004
|
/* @__PURE__ */ jsx(
|
|
1354
2005
|
TextInput,
|
|
1355
2006
|
{
|
|
@@ -1373,11 +2024,11 @@ var Input = forwardRef(function Input2({
|
|
|
1373
2024
|
onBlur?.(event);
|
|
1374
2025
|
},
|
|
1375
2026
|
style: [
|
|
1376
|
-
|
|
2027
|
+
styles6.input,
|
|
1377
2028
|
metrics.text,
|
|
1378
2029
|
{ color: chrome.textColor },
|
|
1379
|
-
Platform.OS === "web" ?
|
|
1380
|
-
Platform.OS === "android" ?
|
|
2030
|
+
Platform.OS === "web" ? styles6.inputWeb : null,
|
|
2031
|
+
Platform.OS === "android" ? styles6.inputAndroid : null,
|
|
1381
2032
|
inputStyle
|
|
1382
2033
|
],
|
|
1383
2034
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
@@ -1389,22 +2040,22 @@ var Input = forwardRef(function Input2({
|
|
|
1389
2040
|
{
|
|
1390
2041
|
onPress: onRightIconPress,
|
|
1391
2042
|
disabled,
|
|
1392
|
-
style: [
|
|
2043
|
+
style: [styles6.iconSlot, { width: metrics.iconSize, height: metrics.iconSize }],
|
|
1393
2044
|
accessibilityRole: "button",
|
|
1394
2045
|
accessibilityLabel: rightIconAccessibilityLabel,
|
|
1395
2046
|
hitSlop: 8,
|
|
1396
2047
|
children: rightIconNode
|
|
1397
2048
|
}
|
|
1398
|
-
) : /* @__PURE__ */ jsx(View, { style: [
|
|
2049
|
+
) : /* @__PURE__ */ jsx(View, { style: [styles6.iconSlot, { width: metrics.iconSize, height: metrics.iconSize }], children: rightIconNode }) : null
|
|
1399
2050
|
]
|
|
1400
2051
|
}
|
|
1401
2052
|
),
|
|
1402
|
-
showHint && hint ? /* @__PURE__ */ jsx(Text, { style: [
|
|
2053
|
+
showHint && hint ? /* @__PURE__ */ jsx(Text, { style: [styles6.hint, { color: chrome.hintColor }], children: hint }) : null
|
|
1403
2054
|
] });
|
|
1404
2055
|
});
|
|
1405
|
-
var
|
|
2056
|
+
var styles6 = StyleSheet.create({
|
|
1406
2057
|
root: {
|
|
1407
|
-
width:
|
|
2058
|
+
width: DEFAULT_WIDTH2,
|
|
1408
2059
|
gap: 8,
|
|
1409
2060
|
alignSelf: "flex-start"
|
|
1410
2061
|
},
|
|
@@ -1439,13 +2090,13 @@ var styles4 = StyleSheet.create({
|
|
|
1439
2090
|
...inputTypography.hint
|
|
1440
2091
|
}
|
|
1441
2092
|
});
|
|
1442
|
-
var
|
|
1443
|
-
var
|
|
1444
|
-
var
|
|
1445
|
-
var
|
|
2093
|
+
var DEFAULT_WIDTH3 = 308;
|
|
2094
|
+
var TRIGGER_HEIGHT2 = 44;
|
|
2095
|
+
var TRIGGER_RADIUS2 = 60;
|
|
2096
|
+
var MENU_RADIUS3 = 24;
|
|
1446
2097
|
var MENU_MAX_LIST_HEIGHT = 248;
|
|
1447
|
-
var
|
|
1448
|
-
var
|
|
2098
|
+
var ITEM_RADIUS2 = 12;
|
|
2099
|
+
var ICON_SIZE3 = 20;
|
|
1449
2100
|
var CHIP_GAP = 6;
|
|
1450
2101
|
var FALLBACK_ELLIPSIS_WIDTH = 20;
|
|
1451
2102
|
function itemBackground(state) {
|
|
@@ -1518,25 +2169,25 @@ function MultiValueChips({ options, disabled, onRemove }) {
|
|
|
1518
2169
|
const next = Math.ceil(event.nativeEvent.layout.width);
|
|
1519
2170
|
setEllipsisWidth((current) => current === next ? current : next);
|
|
1520
2171
|
};
|
|
1521
|
-
return /* @__PURE__ */ jsxs(View, { style:
|
|
1522
|
-
/* @__PURE__ */ jsxs(View, { pointerEvents: "none", style:
|
|
2172
|
+
return /* @__PURE__ */ jsxs(View, { style: styles7.multiValueRoot, children: [
|
|
2173
|
+
/* @__PURE__ */ jsxs(View, { pointerEvents: "none", style: styles7.measureRow, children: [
|
|
1523
2174
|
options.map((option) => /* @__PURE__ */ jsxs(
|
|
1524
2175
|
View,
|
|
1525
2176
|
{
|
|
1526
|
-
style:
|
|
2177
|
+
style: styles7.chip,
|
|
1527
2178
|
onLayout: (event) => handleChipLayout(option.value, event),
|
|
1528
2179
|
children: [
|
|
1529
|
-
/* @__PURE__ */ jsx(Text, { style:
|
|
1530
|
-
/* @__PURE__ */ jsx(Text, { style:
|
|
2180
|
+
/* @__PURE__ */ jsx(Text, { style: styles7.chipLabel, numberOfLines: 1, children: option.label }),
|
|
2181
|
+
/* @__PURE__ */ jsx(Text, { style: styles7.chipRemove, children: "\xD7" })
|
|
1531
2182
|
]
|
|
1532
2183
|
},
|
|
1533
2184
|
`measure-${option.value}`
|
|
1534
2185
|
)),
|
|
1535
|
-
/* @__PURE__ */ jsx(View, { style:
|
|
2186
|
+
/* @__PURE__ */ jsx(View, { style: styles7.ellipsis, onLayout: handleEllipsisLayout, children: /* @__PURE__ */ jsx(Text, { style: styles7.ellipsisText, children: "..." }) })
|
|
1536
2187
|
] }),
|
|
1537
|
-
/* @__PURE__ */ jsxs(View, { style:
|
|
1538
|
-
visible.map((option) => /* @__PURE__ */ jsxs(View, { style:
|
|
1539
|
-
/* @__PURE__ */ jsx(Text, { style:
|
|
2188
|
+
/* @__PURE__ */ jsxs(View, { style: styles7.chipsRow, onLayout: handleContainerLayout, children: [
|
|
2189
|
+
visible.map((option) => /* @__PURE__ */ jsxs(View, { style: styles7.chip, children: [
|
|
2190
|
+
/* @__PURE__ */ jsx(Text, { style: styles7.chipLabel, numberOfLines: 1, children: option.label }),
|
|
1540
2191
|
/* @__PURE__ */ jsx(
|
|
1541
2192
|
Pressable,
|
|
1542
2193
|
{
|
|
@@ -1548,11 +2199,11 @@ function MultiValueChips({ options, disabled, onRemove }) {
|
|
|
1548
2199
|
hitSlop: 6,
|
|
1549
2200
|
accessibilityRole: "button",
|
|
1550
2201
|
accessibilityLabel: `Remove ${option.label}`,
|
|
1551
|
-
children: /* @__PURE__ */ jsx(Text, { style:
|
|
2202
|
+
children: /* @__PURE__ */ jsx(Text, { style: styles7.chipRemove, children: "\xD7" })
|
|
1552
2203
|
}
|
|
1553
2204
|
)
|
|
1554
2205
|
] }, option.value)),
|
|
1555
|
-
hasOverflow ? /* @__PURE__ */ jsx(View, { style:
|
|
2206
|
+
hasOverflow ? /* @__PURE__ */ jsx(View, { style: styles7.ellipsis, children: /* @__PURE__ */ jsx(Text, { style: styles7.ellipsisText, children: "..." }) }) : null
|
|
1556
2207
|
] })
|
|
1557
2208
|
] });
|
|
1558
2209
|
}
|
|
@@ -1763,7 +2414,7 @@ var Select = forwardRef(
|
|
|
1763
2414
|
const leftIconNode = leftIcon ?? /* @__PURE__ */ jsx(
|
|
1764
2415
|
UserIcon,
|
|
1765
2416
|
{
|
|
1766
|
-
size:
|
|
2417
|
+
size: ICON_SIZE3,
|
|
1767
2418
|
color: error ? colors.red : isOpen ? colors.primary : colors.grey100
|
|
1768
2419
|
}
|
|
1769
2420
|
);
|
|
@@ -1779,11 +2430,11 @@ var Select = forwardRef(
|
|
|
1779
2430
|
{
|
|
1780
2431
|
...rest,
|
|
1781
2432
|
ref: setRootRef,
|
|
1782
|
-
style: [
|
|
2433
|
+
style: [styles7.root, isOpen && styles7.rootOpen, disabled && styles7.disabled, style],
|
|
1783
2434
|
accessibilityState: { disabled, expanded: isOpen },
|
|
1784
2435
|
children: [
|
|
1785
|
-
showLabel && label ? /* @__PURE__ */ jsx(Text, { style: [
|
|
1786
|
-
/* @__PURE__ */ jsxs(View, { style: [
|
|
2436
|
+
showLabel && label ? /* @__PURE__ */ jsx(Text, { style: [styles7.label, { color: labelColor }], children: label }) : null,
|
|
2437
|
+
/* @__PURE__ */ jsxs(View, { style: [styles7.triggerWrap, isOpen && styles7.triggerWrapOpen], children: [
|
|
1787
2438
|
/* @__PURE__ */ jsxs(
|
|
1788
2439
|
Pressable,
|
|
1789
2440
|
{
|
|
@@ -1794,29 +2445,29 @@ var Select = forwardRef(
|
|
|
1794
2445
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
1795
2446
|
accessibilityState: { disabled, expanded: isOpen },
|
|
1796
2447
|
style: [
|
|
1797
|
-
|
|
2448
|
+
styles7.trigger,
|
|
1798
2449
|
{
|
|
1799
2450
|
borderColor: triggerBorderColor,
|
|
1800
2451
|
backgroundColor: colors.grey700
|
|
1801
2452
|
}
|
|
1802
2453
|
],
|
|
1803
2454
|
children: [
|
|
1804
|
-
hasLeftIcon ? /* @__PURE__ */ jsx(View, { style:
|
|
1805
|
-
/* @__PURE__ */ jsx(View, { style:
|
|
2455
|
+
hasLeftIcon ? /* @__PURE__ */ jsx(View, { style: styles7.iconSlot, children: leftIconNode }) : null,
|
|
2456
|
+
/* @__PURE__ */ jsx(View, { style: styles7.triggerContent, children: multiple && hasValue ? /* @__PURE__ */ jsx(
|
|
1806
2457
|
MultiValueChips,
|
|
1807
2458
|
{
|
|
1808
2459
|
options: selectedOptions,
|
|
1809
2460
|
disabled,
|
|
1810
2461
|
onRemove: handleRemoveChip
|
|
1811
2462
|
}
|
|
1812
|
-
) : /* @__PURE__ */ jsx(Text, { style: [
|
|
1813
|
-
/* @__PURE__ */ jsx(View, { style: [
|
|
2463
|
+
) : /* @__PURE__ */ jsx(Text, { style: [styles7.triggerText, { color: triggerTextColor }], numberOfLines: 1, children: multiple ? placeholder : singleLabel }) }),
|
|
2464
|
+
/* @__PURE__ */ jsx(View, { style: [styles7.iconSlot, isOpen && styles7.chevronOpen], children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: ICON_SIZE3, color: isOpen ? colors.primary : colors.grey100 }) })
|
|
1814
2465
|
]
|
|
1815
2466
|
}
|
|
1816
2467
|
),
|
|
1817
|
-
isOpen ? /* @__PURE__ */ jsxs(View, { style:
|
|
1818
|
-
showSearch ? /* @__PURE__ */ jsxs(View, { style:
|
|
1819
|
-
/* @__PURE__ */ jsx(View, { style:
|
|
2468
|
+
isOpen ? /* @__PURE__ */ jsxs(View, { style: styles7.menu, children: [
|
|
2469
|
+
showSearch ? /* @__PURE__ */ jsxs(View, { style: styles7.searchField, children: [
|
|
2470
|
+
/* @__PURE__ */ jsx(View, { style: styles7.iconSlot, children: /* @__PURE__ */ jsx(SearchIcon, { size: ICON_SIZE3, color: colors.grey100 }) }),
|
|
1820
2471
|
/* @__PURE__ */ jsx(
|
|
1821
2472
|
TextInput,
|
|
1822
2473
|
{
|
|
@@ -1827,9 +2478,9 @@ var Select = forwardRef(
|
|
|
1827
2478
|
placeholder: searchPlaceholder,
|
|
1828
2479
|
placeholderTextColor: colors.grey100,
|
|
1829
2480
|
style: [
|
|
1830
|
-
|
|
1831
|
-
Platform.OS === "web" ?
|
|
1832
|
-
Platform.OS === "android" ?
|
|
2481
|
+
styles7.searchInput,
|
|
2482
|
+
Platform.OS === "web" ? styles7.searchInputWeb : null,
|
|
2483
|
+
Platform.OS === "android" ? styles7.searchInputAndroid : null
|
|
1833
2484
|
],
|
|
1834
2485
|
accessibilityLabel: searchPlaceholder
|
|
1835
2486
|
}
|
|
@@ -1838,12 +2489,12 @@ var Select = forwardRef(
|
|
|
1838
2489
|
/* @__PURE__ */ jsxs(
|
|
1839
2490
|
ScrollView,
|
|
1840
2491
|
{
|
|
1841
|
-
style:
|
|
1842
|
-
contentContainerStyle:
|
|
2492
|
+
style: styles7.optionList,
|
|
2493
|
+
contentContainerStyle: styles7.optionListContent,
|
|
1843
2494
|
keyboardShouldPersistTaps: "handled",
|
|
1844
2495
|
showsVerticalScrollIndicator: false,
|
|
1845
2496
|
children: [
|
|
1846
|
-
loading ? /* @__PURE__ */ jsx(View, { style:
|
|
2497
|
+
loading ? /* @__PURE__ */ jsx(View, { style: styles7.statusRow, children: /* @__PURE__ */ jsx(Text, { style: styles7.statusText, children: "Loading..." }) }) : filteredOptions.length === 0 ? /* @__PURE__ */ jsx(View, { style: styles7.statusRow, children: /* @__PURE__ */ jsx(Text, { style: styles7.statusText, children: emptyText }) }) : null,
|
|
1847
2498
|
!loading && filteredOptions.map((option) => {
|
|
1848
2499
|
const isSelected = selectedValues.includes(option.value);
|
|
1849
2500
|
const isHovered = hoveredValue === option.value;
|
|
@@ -1860,14 +2511,14 @@ var Select = forwardRef(
|
|
|
1860
2511
|
accessibilityRole: multiple ? "checkbox" : "button",
|
|
1861
2512
|
accessibilityState: { selected: isSelected, checked: isSelected, disabled },
|
|
1862
2513
|
style: [
|
|
1863
|
-
|
|
2514
|
+
styles7.item,
|
|
1864
2515
|
{
|
|
1865
2516
|
backgroundColor: itemBackground(visualState)
|
|
1866
2517
|
}
|
|
1867
2518
|
],
|
|
1868
2519
|
children: [
|
|
1869
|
-
multiple ? /* @__PURE__ */ jsx(View, { pointerEvents: "none", style:
|
|
1870
|
-
/* @__PURE__ */ jsx(Text, { style:
|
|
2520
|
+
multiple ? /* @__PURE__ */ jsx(View, { pointerEvents: "none", style: styles7.itemCheckbox, children: /* @__PURE__ */ jsx(Checkbox, { value: isSelected, variant: "light" }) }) : null,
|
|
2521
|
+
/* @__PURE__ */ jsx(Text, { style: styles7.itemLabel, numberOfLines: 1, children: option.label })
|
|
1871
2522
|
]
|
|
1872
2523
|
},
|
|
1873
2524
|
option.value
|
|
@@ -1878,15 +2529,15 @@ var Select = forwardRef(
|
|
|
1878
2529
|
)
|
|
1879
2530
|
] }) : null
|
|
1880
2531
|
] }),
|
|
1881
|
-
showHint && hint ? /* @__PURE__ */ jsx(Text, { style: [
|
|
2532
|
+
showHint && hint ? /* @__PURE__ */ jsx(Text, { style: [styles7.hint, { color: hintColor }], children: hint }) : null
|
|
1882
2533
|
]
|
|
1883
2534
|
}
|
|
1884
2535
|
);
|
|
1885
2536
|
}
|
|
1886
2537
|
);
|
|
1887
|
-
var
|
|
2538
|
+
var styles7 = StyleSheet.create({
|
|
1888
2539
|
root: {
|
|
1889
|
-
width:
|
|
2540
|
+
width: DEFAULT_WIDTH3,
|
|
1890
2541
|
gap: 8,
|
|
1891
2542
|
alignSelf: "flex-start"
|
|
1892
2543
|
},
|
|
@@ -1907,8 +2558,8 @@ var styles5 = StyleSheet.create({
|
|
|
1907
2558
|
zIndex: 20
|
|
1908
2559
|
},
|
|
1909
2560
|
trigger: {
|
|
1910
|
-
height:
|
|
1911
|
-
borderRadius:
|
|
2561
|
+
height: TRIGGER_HEIGHT2,
|
|
2562
|
+
borderRadius: TRIGGER_RADIUS2,
|
|
1912
2563
|
borderWidth: 1,
|
|
1913
2564
|
paddingVertical: 12,
|
|
1914
2565
|
paddingHorizontal: 16,
|
|
@@ -1974,8 +2625,8 @@ var styles5 = StyleSheet.create({
|
|
|
1974
2625
|
lineHeight: 16
|
|
1975
2626
|
},
|
|
1976
2627
|
iconSlot: {
|
|
1977
|
-
width:
|
|
1978
|
-
height:
|
|
2628
|
+
width: ICON_SIZE3,
|
|
2629
|
+
height: ICON_SIZE3,
|
|
1979
2630
|
alignItems: "center",
|
|
1980
2631
|
justifyContent: "center",
|
|
1981
2632
|
flexShrink: 0
|
|
@@ -1990,7 +2641,7 @@ var styles5 = StyleSheet.create({
|
|
|
1990
2641
|
right: 0,
|
|
1991
2642
|
marginTop: 8,
|
|
1992
2643
|
zIndex: 10,
|
|
1993
|
-
borderRadius:
|
|
2644
|
+
borderRadius: MENU_RADIUS3,
|
|
1994
2645
|
padding: 12,
|
|
1995
2646
|
gap: 8,
|
|
1996
2647
|
backgroundColor: colors.grey700,
|
|
@@ -2020,7 +2671,7 @@ var styles5 = StyleSheet.create({
|
|
|
2020
2671
|
},
|
|
2021
2672
|
searchField: {
|
|
2022
2673
|
height: 40,
|
|
2023
|
-
borderRadius:
|
|
2674
|
+
borderRadius: ITEM_RADIUS2,
|
|
2024
2675
|
paddingHorizontal: 12,
|
|
2025
2676
|
flexDirection: "row",
|
|
2026
2677
|
alignItems: "center",
|
|
@@ -2042,7 +2693,7 @@ var styles5 = StyleSheet.create({
|
|
|
2042
2693
|
},
|
|
2043
2694
|
item: {
|
|
2044
2695
|
minHeight: 43,
|
|
2045
|
-
borderRadius:
|
|
2696
|
+
borderRadius: ITEM_RADIUS2,
|
|
2046
2697
|
padding: 12,
|
|
2047
2698
|
flexDirection: "row",
|
|
2048
2699
|
alignItems: "center",
|
|
@@ -2060,7 +2711,7 @@ var styles5 = StyleSheet.create({
|
|
|
2060
2711
|
...selectTypography.hint
|
|
2061
2712
|
}
|
|
2062
2713
|
});
|
|
2063
|
-
var
|
|
2714
|
+
var DEFAULT_WIDTH4 = 308;
|
|
2064
2715
|
var FIELD_HEIGHT = 100;
|
|
2065
2716
|
var FIELD_RADIUS = 16;
|
|
2066
2717
|
var FIELD_PADDING_VERTICAL = 12;
|
|
@@ -2146,13 +2797,13 @@ var Textarea = forwardRef(function Textarea2({
|
|
|
2146
2797
|
const resolvedAccessibilityLabel = accessibilityLabel ?? (showLabel ? void 0 : label);
|
|
2147
2798
|
useApplyWebClassName(rootRef, className);
|
|
2148
2799
|
useApplyWebClassName(inputRef, inputClassName);
|
|
2149
|
-
return /* @__PURE__ */ jsxs(View, { ref: rootRef, style: [
|
|
2150
|
-
showLabel && label ? /* @__PURE__ */ jsx(Text, { style: [
|
|
2800
|
+
return /* @__PURE__ */ jsxs(View, { ref: rootRef, style: [styles8.root, disabled && styles8.disabled, style], children: [
|
|
2801
|
+
showLabel && label ? /* @__PURE__ */ jsx(Text, { style: [styles8.label, { color: chrome.labelColor }], children: label }) : null,
|
|
2151
2802
|
/* @__PURE__ */ jsx(
|
|
2152
2803
|
View,
|
|
2153
2804
|
{
|
|
2154
2805
|
style: [
|
|
2155
|
-
|
|
2806
|
+
styles8.field,
|
|
2156
2807
|
{
|
|
2157
2808
|
borderColor: chrome.borderColor,
|
|
2158
2809
|
backgroundColor: chrome.backgroundColor
|
|
@@ -2184,11 +2835,11 @@ var Textarea = forwardRef(function Textarea2({
|
|
|
2184
2835
|
onBlur?.(event);
|
|
2185
2836
|
},
|
|
2186
2837
|
style: [
|
|
2187
|
-
|
|
2838
|
+
styles8.input,
|
|
2188
2839
|
textareaTypography.field,
|
|
2189
2840
|
{ color: chrome.textColor },
|
|
2190
|
-
Platform.OS === "web" ?
|
|
2191
|
-
Platform.OS === "android" ?
|
|
2841
|
+
Platform.OS === "web" ? styles8.inputWeb : null,
|
|
2842
|
+
Platform.OS === "android" ? styles8.inputAndroid : null,
|
|
2192
2843
|
inputStyle
|
|
2193
2844
|
],
|
|
2194
2845
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
@@ -2197,12 +2848,12 @@ var Textarea = forwardRef(function Textarea2({
|
|
|
2197
2848
|
)
|
|
2198
2849
|
}
|
|
2199
2850
|
),
|
|
2200
|
-
showHint && hint ? /* @__PURE__ */ jsx(Text, { style: [
|
|
2851
|
+
showHint && hint ? /* @__PURE__ */ jsx(Text, { style: [styles8.hint, { color: chrome.hintColor }], children: hint }) : null
|
|
2201
2852
|
] });
|
|
2202
2853
|
});
|
|
2203
|
-
var
|
|
2854
|
+
var styles8 = StyleSheet.create({
|
|
2204
2855
|
root: {
|
|
2205
|
-
width:
|
|
2856
|
+
width: DEFAULT_WIDTH4,
|
|
2206
2857
|
gap: 8,
|
|
2207
2858
|
alignSelf: "flex-start"
|
|
2208
2859
|
},
|
|
@@ -2300,13 +2951,13 @@ var Toggle = forwardRef(function Toggle2({
|
|
|
2300
2951
|
accessibilityRole: "switch",
|
|
2301
2952
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
2302
2953
|
accessibilityState: { checked: isActive, disabled },
|
|
2303
|
-
style: [
|
|
2954
|
+
style: [styles9.pressable, disabled && styles9.disabled, style],
|
|
2304
2955
|
children: [
|
|
2305
2956
|
/* @__PURE__ */ jsx(
|
|
2306
2957
|
Animated.View,
|
|
2307
2958
|
{
|
|
2308
2959
|
style: [
|
|
2309
|
-
|
|
2960
|
+
styles9.track,
|
|
2310
2961
|
{
|
|
2311
2962
|
backgroundColor: trackBackgroundColor
|
|
2312
2963
|
}
|
|
@@ -2315,7 +2966,7 @@ var Toggle = forwardRef(function Toggle2({
|
|
|
2315
2966
|
Animated.View,
|
|
2316
2967
|
{
|
|
2317
2968
|
style: [
|
|
2318
|
-
|
|
2969
|
+
styles9.thumb,
|
|
2319
2970
|
{
|
|
2320
2971
|
transform: [{ translateX: thumbTranslateX }]
|
|
2321
2972
|
}
|
|
@@ -2324,12 +2975,12 @@ var Toggle = forwardRef(function Toggle2({
|
|
|
2324
2975
|
)
|
|
2325
2976
|
}
|
|
2326
2977
|
),
|
|
2327
|
-
labelContent != null && labelContent !== false ? typeof labelContent === "string" || typeof labelContent === "number" ? /* @__PURE__ */ jsx(Text, { style: [
|
|
2978
|
+
labelContent != null && labelContent !== false ? typeof labelContent === "string" || typeof labelContent === "number" ? /* @__PURE__ */ jsx(Text, { style: [styles9.label, labelStyle], children: labelContent }) : labelContent : null
|
|
2328
2979
|
]
|
|
2329
2980
|
}
|
|
2330
2981
|
);
|
|
2331
2982
|
});
|
|
2332
|
-
var
|
|
2983
|
+
var styles9 = StyleSheet.create({
|
|
2333
2984
|
pressable: {
|
|
2334
2985
|
flexDirection: "row",
|
|
2335
2986
|
alignItems: "center",
|
|
@@ -2358,6 +3009,6 @@ var styles7 = StyleSheet.create({
|
|
|
2358
3009
|
}
|
|
2359
3010
|
});
|
|
2360
3011
|
|
|
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 };
|
|
3012
|
+
export { ArrowRightIcon, Avatar, BagIcon, BellIcon, BuildingIcon, Button, CalendarIcon, CalendarOutlineIcon, CameraIcon, CheckBadgeIcon, CheckIcon, Checkbox, ChevronDownIcon, ChevronLeftIcon, ClockIcon, DatePicker, FacebookIcon, HeartIcon, HelpCircleIcon, HomeIcon, Icon, Input, InstagramIcon, KeyIcon, LayoutGridIcon, LinkedInIcon, LogOutIcon, MailIcon, MenuItem, NavigateIcon, PhoneIcon, SearchIcon, Select, SettingsIcon, ShowIcon, Textarea, Toggle, UserIcon, VideoIcon, avatarTypography, buttonTypography, colors, datePickerTypography, fonts, getIconsByGroup, grey, iconGroupNames, iconGroups, iconNames, icons, inputTypography, selectTypography, textareaTypography };
|
|
2362
3013
|
//# sourceMappingURL=index.js.map
|
|
2363
3014
|
//# sourceMappingURL=index.js.map
|