@ecohouse/ui 0.1.34 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +1 -0
  2. package/dist/index.cjs +903 -489
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +169 -129
  5. package/dist/index.d.ts +169 -129
  6. package/dist/index.js +901 -491
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/components/AccordionItem/AccordionItem.tsx +14 -11
  10. package/src/components/AccountHeader/AccountHeader.tsx +16 -0
  11. package/src/components/DatePicker/DatePicker.tsx +47 -14
  12. package/src/components/Input/Input.tsx +54 -21
  13. package/src/components/LanguageSwitcher/LanguageSwitcher.stories.tsx +11 -0
  14. package/src/components/LanguageSwitcher/LanguageSwitcher.tsx +103 -19
  15. package/src/components/LanguageSwitcher/index.ts +5 -1
  16. package/src/components/SegmentedToggle/SegmentedToggle.stories.tsx +9 -0
  17. package/src/components/SegmentedToggle/SegmentedToggle.tsx +19 -13
  18. package/src/components/Select/Select.tsx +90 -5
  19. package/src/components/Textarea/Textarea.tsx +29 -4
  20. package/src/components/index.ts +5 -1
  21. package/src/icons/Globe/GlobeIcon.tsx +2 -2
  22. package/src/icons/Globe/GlobeIcon.web.tsx +2 -2
  23. package/src/icons/Globe/globePath.ts +2 -2
  24. package/src/icons/Key/keyPath.ts +1 -1
  25. package/src/icons/MoreHorizontal/MoreHorizontalIcon.tsx +26 -0
  26. package/src/icons/MoreHorizontal/MoreHorizontalIcon.web.tsx +25 -0
  27. package/src/icons/MoreHorizontal/index.ts +1 -0
  28. package/src/icons/MoreHorizontal/moreHorizontalPath.ts +2 -0
  29. package/src/icons/TableView/TableViewIcon.tsx +20 -0
  30. package/src/icons/TableView/TableViewIcon.web.tsx +26 -0
  31. package/src/icons/TableView/index.ts +1 -0
  32. package/src/icons/TableView/tableViewPath.ts +2 -0
  33. package/src/icons/index.ts +2 -0
  34. package/src/icons/registry.ts +6 -0
  35. package/src/index.ts +7 -0
  36. package/src/primitives/IconStatusBadge/IconStatusBadge.stories.tsx +21 -0
  37. package/src/primitives/IconStatusBadge/IconStatusBadge.tsx +76 -0
  38. package/src/primitives/IconStatusBadge/index.ts +2 -0
  39. package/src/primitives/InfoCardV2/InfoCardV2.stories.tsx +64 -0
  40. package/src/primitives/InfoCardV2/InfoCardV2.tsx +116 -0
  41. package/src/primitives/InfoCardV2/index.ts +2 -0
  42. package/src/primitives/index.ts +7 -0
  43. package/src/theme/typography.ts +3 -3
@@ -0,0 +1,76 @@
1
+ import { forwardRef, useMemo, useRef, type ComponentRef } from "react";
2
+ import {
3
+ Platform,
4
+ StyleSheet,
5
+ Text,
6
+ View,
7
+ type StyleProp,
8
+ type ViewProps,
9
+ type ViewStyle,
10
+ } from "react-native";
11
+ import type { IconComponent, IconProps } from "../../icons";
12
+ import { colors, fonts } from "../../theme";
13
+ import { mergeRefs } from "../../utils/mergeRefs";
14
+ import { useApplyWebClassName } from "../../utils/useApplyWebClassName";
15
+
16
+ export interface IconStatusBadgeProps extends Omit<ViewProps, "style" | "children"> {
17
+ label: string;
18
+ icon: IconComponent;
19
+ iconProps?: Omit<IconProps, "size">;
20
+ iconSize?: number;
21
+ style?: StyleProp<ViewStyle>;
22
+ className?: string;
23
+ }
24
+
25
+ const webBlurStyle: ViewStyle =
26
+ Platform.OS === "web"
27
+ ? ({
28
+ backdropFilter: "blur(10px)",
29
+ WebkitBackdropFilter: "blur(10px)",
30
+ } as ViewStyle)
31
+ : {};
32
+
33
+ export const IconStatusBadge = forwardRef<ComponentRef<typeof View>, IconStatusBadgeProps>(
34
+ function IconStatusBadge(
35
+ { label, icon: Icon, iconProps, iconSize = 16, style, className, ...rest },
36
+ forwardedRef,
37
+ ) {
38
+ const badgeRef = useRef<ComponentRef<typeof View>>(null);
39
+ const setBadgeRef = useMemo(() => mergeRefs(badgeRef, forwardedRef), [forwardedRef]);
40
+
41
+ useApplyWebClassName(badgeRef, className);
42
+
43
+ return (
44
+ <View {...rest} ref={setBadgeRef} style={[styles.root, webBlurStyle, style]}>
45
+ <Icon {...iconProps} size={iconSize} />
46
+ <Text numberOfLines={1} style={styles.label}>
47
+ {label}
48
+ </Text>
49
+ </View>
50
+ );
51
+ },
52
+ );
53
+
54
+ const styles = StyleSheet.create({
55
+ root: {
56
+ minHeight: 34,
57
+ paddingHorizontal: 12,
58
+ paddingVertical: 8,
59
+ flexDirection: "row",
60
+ alignItems: "center",
61
+ justifyContent: "center",
62
+ gap: 10,
63
+ alignSelf: "flex-start",
64
+ borderRadius: 39,
65
+ borderWidth: 1,
66
+ borderColor: colors.whiteAlpha10,
67
+ backgroundColor: "#09090966",
68
+ },
69
+ label: {
70
+ color: colors.white,
71
+ fontFamily: fonts.sans,
72
+ fontSize: 12,
73
+ fontWeight: "700",
74
+ lineHeight: 15,
75
+ },
76
+ });
@@ -0,0 +1,2 @@
1
+ export { IconStatusBadge } from "./IconStatusBadge";
2
+ export type { IconStatusBadgeProps } from "./IconStatusBadge";
@@ -0,0 +1,64 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { StyleSheet, View } from "react-native";
3
+ import { BagIcon, HomeIcon, LockIcon } from "../../icons";
4
+ import { colors } from "../../theme";
5
+ import { InfoCardV2 } from "./InfoCardV2";
6
+
7
+ const meta = {
8
+ title: "Primitives/InfoCardV2",
9
+ component: InfoCardV2,
10
+ args: {
11
+ label: "Ընդհանուր քոթեջներ",
12
+ value: "12",
13
+ icon: HomeIcon,
14
+ },
15
+ parameters: {
16
+ backgrounds: { default: "black" },
17
+ },
18
+ } satisfies Meta<typeof InfoCardV2>;
19
+
20
+ export default meta;
21
+ type Story = StoryObj<typeof meta>;
22
+
23
+ export const Default: Story = {
24
+ render: (args) => (
25
+ <View style={styles.frame}>
26
+ <InfoCardV2 {...args} />
27
+ </View>
28
+ ),
29
+ };
30
+
31
+ export const OverviewRow: Story = {
32
+ render: () => (
33
+ <View style={styles.row}>
34
+ <InfoCardV2 label="Ընդհանուր քոթեջներ" value="12" icon={HomeIcon} />
35
+ <InfoCardV2 label="Զբաղված" value="8" icon={LockIcon} />
36
+ <InfoCardV2 label="Ազատ" value="4" icon={BagIcon} />
37
+ </View>
38
+ ),
39
+ };
40
+
41
+ export const WhiteIcon: Story = {
42
+ args: {
43
+ label: "Label",
44
+ value: "description",
45
+ icon: LockIcon,
46
+ iconProps: { color: colors.white },
47
+ },
48
+ render: (args) => (
49
+ <View style={styles.frame}>
50
+ <InfoCardV2 {...args} />
51
+ </View>
52
+ ),
53
+ };
54
+
55
+ const styles = StyleSheet.create({
56
+ frame: {
57
+ width: 411,
58
+ },
59
+ row: {
60
+ width: 1280,
61
+ flexDirection: "row",
62
+ gap: 24,
63
+ },
64
+ });
@@ -0,0 +1,116 @@
1
+ import { forwardRef, useMemo, useRef, type ComponentRef } from "react";
2
+ import {
3
+ StyleSheet,
4
+ Text,
5
+ View,
6
+ type StyleProp,
7
+ type ViewProps,
8
+ type ViewStyle,
9
+ } from "react-native";
10
+ import type { IconComponent, IconProps } from "../../icons";
11
+ import { colors, fonts } from "../../theme";
12
+ import { mergeRefs } from "../../utils/mergeRefs";
13
+ import { useApplyWebClassName } from "../../utils/useApplyWebClassName";
14
+
15
+ export interface InfoCardV2Props extends Omit<ViewProps, "style" | "children"> {
16
+ label: string;
17
+ value: string;
18
+ icon: IconComponent;
19
+ iconProps?: Omit<IconProps, "size">;
20
+ iconSize?: number;
21
+ style?: StyleProp<ViewStyle>;
22
+ className?: string;
23
+ }
24
+
25
+ const ICON_SLOT_SIZE = 41;
26
+ const ICON_SIZE = 20;
27
+
28
+ /** Dashboard metric card with a leading icon, muted label, and emphasized value. */
29
+ export const InfoCardV2 = forwardRef<ComponentRef<typeof View>, InfoCardV2Props>(
30
+ function InfoCardV2(
31
+ {
32
+ label,
33
+ value,
34
+ icon: Icon,
35
+ iconProps,
36
+ iconSize = ICON_SIZE,
37
+ style,
38
+ className,
39
+ accessibilityLabel,
40
+ ...rest
41
+ },
42
+ forwardedRef,
43
+ ) {
44
+ const containerRef = useRef<ComponentRef<typeof View>>(null);
45
+ const setContainerRef = useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
46
+
47
+ useApplyWebClassName(containerRef, className?.trim() || undefined);
48
+
49
+ return (
50
+ <View
51
+ {...rest}
52
+ ref={setContainerRef}
53
+ accessibilityRole="text"
54
+ accessibilityLabel={accessibilityLabel ?? `${label}. ${value}`}
55
+ style={[styles.root, style]}
56
+ >
57
+ <View style={styles.iconSlot}>
58
+ <Icon {...iconProps} size={iconSize} color={iconProps?.color ?? colors.primary} />
59
+ </View>
60
+ <View style={styles.content}>
61
+ <Text numberOfLines={1} style={styles.label}>
62
+ {label}
63
+ </Text>
64
+ <Text numberOfLines={1} style={styles.value}>
65
+ {value}
66
+ </Text>
67
+ </View>
68
+ </View>
69
+ );
70
+ },
71
+ );
72
+
73
+ const styles = StyleSheet.create({
74
+ root: {
75
+ minHeight: 65,
76
+ padding: 12,
77
+ flexDirection: "row",
78
+ alignItems: "center",
79
+ flexGrow: 1,
80
+ flexShrink: 0,
81
+ flexBasis: 0,
82
+ gap: 16,
83
+ borderRadius: 16,
84
+ backgroundColor: colors.grey700,
85
+ },
86
+ iconSlot: {
87
+ width: ICON_SLOT_SIZE,
88
+ height: ICON_SLOT_SIZE,
89
+ borderRadius: 10,
90
+ alignItems: "center",
91
+ justifyContent: "center",
92
+ flexShrink: 0,
93
+ backgroundColor: colors.grey600,
94
+ },
95
+ content: {
96
+ minWidth: 0,
97
+ flexShrink: 1,
98
+ gap: 6,
99
+ },
100
+ label: {
101
+ fontFamily: fonts.sans,
102
+ fontSize: 14,
103
+ fontWeight: "500",
104
+ lineHeight: 16,
105
+ letterSpacing: 0,
106
+ color: colors.lightGrey,
107
+ },
108
+ value: {
109
+ fontFamily: fonts.sans,
110
+ fontSize: 16,
111
+ fontWeight: "700",
112
+ lineHeight: 19,
113
+ letterSpacing: 0,
114
+ color: colors.white,
115
+ },
116
+ });
@@ -0,0 +1,2 @@
1
+ export { InfoCardV2 } from "./InfoCardV2";
2
+ export type { InfoCardV2Props } from "./InfoCardV2";
@@ -3,9 +3,16 @@ export type { AmenityProps, AmenityVariant } from "./Amenity";
3
3
 
4
4
  export { MenuItem } from "./MenuItem";
5
5
  export type { MenuItemProps } from "./MenuItem";
6
+
7
+ export { InfoCardV2 } from "./InfoCardV2";
8
+ export type { InfoCardV2Props } from "./InfoCardV2";
9
+
6
10
  export { FavoritesButton } from "./FavoritesButton";
7
11
  export type { FavoritesButtonProps } from "./FavoritesButton";
8
12
 
13
+ export { IconStatusBadge } from "./IconStatusBadge";
14
+ export type { IconStatusBadgeProps } from "./IconStatusBadge";
15
+
9
16
  export {
10
17
  BrandLogo,
11
18
  BRAND_LOGO_COLORS,
@@ -47,13 +47,13 @@ export const segmentedToggleTypography = {
47
47
  letterSpacing: 0,
48
48
  } as const;
49
49
 
50
- /** Language switcher trigger and option labels — SemiBold 14. */
50
+ /** Language switcher trigger and option labels — SemiBold 14, tracking 3%. */
51
51
  export const languageSwitcherTypography = {
52
52
  fontFamily: fonts.sans,
53
53
  fontSize: 14,
54
54
  fontWeight: "600" as const,
55
- lineHeight: 19,
56
- letterSpacing: 0,
55
+ lineHeight: 14,
56
+ letterSpacing: 0.42,
57
57
  } as const;
58
58
 
59
59
  /** Counter value — Bold 14, line-height 100%, letter-spacing 0. */