@ecohouse/ui 0.1.35 → 0.1.38
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 +3 -0
- package/dist/index.cjs +1221 -531
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +231 -128
- package/dist/index.d.ts +231 -128
- package/dist/index.js +1144 -463
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.stories.tsx +47 -0
- package/src/components/Accordion/Accordion.tsx +165 -0
- package/src/components/Accordion/index.ts +2 -0
- package/src/components/AutocompleteInput/AutocompleteInput.stories.tsx +80 -0
- package/src/components/AutocompleteInput/AutocompleteInput.tsx +313 -0
- package/src/components/AutocompleteInput/index.ts +2 -0
- package/src/components/Counter/Counter.tsx +61 -26
- package/src/components/QuantityInput/QuantityInput.stories.tsx +45 -0
- package/src/components/QuantityInput/QuantityInput.tsx +153 -0
- package/src/components/QuantityInput/index.ts +2 -0
- package/src/components/SegmentedToggle/SegmentedToggle.stories.tsx +9 -0
- package/src/components/SegmentedToggle/SegmentedToggle.tsx +19 -13
- package/src/components/index.ts +9 -0
- package/src/icons/ArrowLeft/ArrowLeftIcon.test.ts +10 -0
- package/src/icons/ArrowLeft/ArrowLeftIcon.tsx +21 -0
- package/src/icons/ArrowLeft/ArrowLeftIcon.web.tsx +26 -0
- package/src/icons/ArrowLeft/arrowLeftPath.ts +3 -0
- package/src/icons/ArrowLeft/index.ts +1 -0
- package/src/icons/CurrentLocation/CurrentLocationIcon.test.ts +10 -0
- package/src/icons/CurrentLocation/CurrentLocationIcon.tsx +25 -0
- package/src/icons/CurrentLocation/CurrentLocationIcon.web.tsx +30 -0
- package/src/icons/CurrentLocation/currentLocationPath.ts +3 -0
- package/src/icons/CurrentLocation/index.ts +1 -0
- package/src/icons/MoreHorizontal/MoreHorizontalIcon.tsx +26 -0
- package/src/icons/MoreHorizontal/MoreHorizontalIcon.web.tsx +25 -0
- package/src/icons/MoreHorizontal/index.ts +1 -0
- package/src/icons/MoreHorizontal/moreHorizontalPath.ts +2 -0
- package/src/icons/TableView/TableViewIcon.tsx +20 -0
- package/src/icons/TableView/TableViewIcon.web.tsx +26 -0
- package/src/icons/TableView/index.ts +1 -0
- package/src/icons/TableView/tableViewPath.ts +2 -0
- package/src/icons/index.ts +4 -0
- package/src/icons/registry.ts +12 -0
- package/src/index.ts +15 -0
- package/src/primitives/IconStatusBadge/IconStatusBadge.stories.tsx +21 -0
- package/src/primitives/IconStatusBadge/IconStatusBadge.tsx +76 -0
- package/src/primitives/IconStatusBadge/index.ts +2 -0
- package/src/primitives/InfoCardV2/InfoCardV2.stories.tsx +64 -0
- package/src/primitives/InfoCardV2/InfoCardV2.tsx +116 -0
- package/src/primitives/InfoCardV2/index.ts +2 -0
- package/src/primitives/index.ts +7 -0
- package/src/theme/colors.test.ts +1 -0
- package/src/theme/colors.ts +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { colors } from "../../theme";
|
|
2
|
+
import type { IconProps } from "../types";
|
|
3
|
+
import { TABLE_VIEW_PATH } from "./tableViewPath";
|
|
4
|
+
|
|
5
|
+
export { TABLE_VIEW_PATH } from "./tableViewPath";
|
|
6
|
+
|
|
7
|
+
export function TableViewIcon({ size = 17, color = colors.grey400, strokeWidth = 2 }: IconProps) {
|
|
8
|
+
return (
|
|
9
|
+
<svg
|
|
10
|
+
width={size}
|
|
11
|
+
height={size}
|
|
12
|
+
viewBox="0 0 17 17"
|
|
13
|
+
fill="none"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
aria-hidden
|
|
16
|
+
>
|
|
17
|
+
<path
|
|
18
|
+
d={TABLE_VIEW_PATH}
|
|
19
|
+
stroke={color}
|
|
20
|
+
strokeWidth={strokeWidth}
|
|
21
|
+
strokeLinecap="round"
|
|
22
|
+
strokeLinejoin="round"
|
|
23
|
+
/>
|
|
24
|
+
</svg>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TableViewIcon, TABLE_VIEW_PATH } from "./TableViewIcon";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export const TABLE_VIEW_PATH =
|
|
2
|
+
"M1 6L16 6M6 1L6 16M5 1H12C13.4001 1 14.1002 1 14.635 1.27248C15.1054 1.51217 15.4878 1.89462 15.7275 2.36502C16 2.8998 16 3.59987 16 5V12C16 13.4001 16 14.1002 15.7275 14.635C15.4878 15.1054 15.1054 15.4878 14.635 15.7275C14.1002 16 13.4001 16 12 16H5C3.59987 16 2.8998 16 2.36502 15.7275C1.89462 15.4878 1.51217 15.1054 1.27248 14.635C1 14.1002 1 13.4001 1 12V5C1 3.59987 1 2.8998 1.27248 2.36502C1.51217 1.89462 1.89462 1.51217 2.36502 1.27248C2.8998 1 3.59987 1 5 1Z";
|
package/src/icons/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ export { AmenityIcon } from "./Amenity";
|
|
|
9
9
|
export type { AmenityIconProps, AmenityName } from "./Amenity";
|
|
10
10
|
export { AlertTriangleIcon } from "./AlertTriangle";
|
|
11
11
|
export { AppleIcon } from "./Store";
|
|
12
|
+
export { ArrowLeftIcon } from "./ArrowLeft";
|
|
12
13
|
export { ArrowRightIcon } from "./ArrowRight";
|
|
13
14
|
export { BagIcon } from "./Bag";
|
|
14
15
|
export { BanIcon } from "./Ban";
|
|
@@ -24,6 +25,7 @@ export { ChevronDownIcon } from "./ChevronDown";
|
|
|
24
25
|
export { ChevronLeftIcon } from "./ChevronLeft";
|
|
25
26
|
export { ClockIcon } from "./Clock";
|
|
26
27
|
export { CloseIcon } from "./Close";
|
|
28
|
+
export { CurrentLocationIcon } from "./CurrentLocation";
|
|
27
29
|
export { EditIcon } from "./Edit";
|
|
28
30
|
export {
|
|
29
31
|
BathroomsIcon,
|
|
@@ -70,6 +72,7 @@ export { MapCollapseIcon, MapExpandIcon } from "./MapControls";
|
|
|
70
72
|
export { MenuIcon } from "./Menu";
|
|
71
73
|
export type { MenuIconProps } from "./Menu";
|
|
72
74
|
export { MenuLinesIcon } from "./MenuLines";
|
|
75
|
+
export { MoreHorizontalIcon } from "./MoreHorizontal";
|
|
73
76
|
export { NavigateIcon } from "./Navigate";
|
|
74
77
|
export { PhoneIcon } from "./Phone";
|
|
75
78
|
export { PlusIcon } from "./Plus";
|
|
@@ -83,6 +86,7 @@ export { SidebarIcon } from "./Sidebar";
|
|
|
83
86
|
export { SortIcon } from "./Sort";
|
|
84
87
|
export { StarIcon } from "./Star";
|
|
85
88
|
export { StarFilledIcon } from "./StarFilled";
|
|
89
|
+
export { TableViewIcon } from "./TableView";
|
|
86
90
|
export { UserIcon } from "./User";
|
|
87
91
|
export { UsersAltIcon } from "./UsersAlt";
|
|
88
92
|
export { VideoIcon } from "./Video";
|
package/src/icons/registry.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ArrowRightIcon } from "./ArrowRight";
|
|
2
|
+
import { ArrowLeftIcon } from "./ArrowLeft";
|
|
2
3
|
import { AlertTriangleIcon } from "./AlertTriangle";
|
|
3
4
|
import { AppleIcon, GooglePlayIcon } from "./Store";
|
|
4
5
|
import { BagIcon } from "./Bag";
|
|
@@ -15,6 +16,7 @@ import { ChevronDownIcon } from "./ChevronDown";
|
|
|
15
16
|
import { ChevronLeftIcon } from "./ChevronLeft";
|
|
16
17
|
import { ClockIcon } from "./Clock";
|
|
17
18
|
import { CloseIcon } from "./Close";
|
|
19
|
+
import { CurrentLocationIcon } from "./CurrentLocation";
|
|
18
20
|
import { EditIcon } from "./Edit";
|
|
19
21
|
import {
|
|
20
22
|
BathroomsIcon,
|
|
@@ -60,6 +62,7 @@ import { MapCollapseIcon, MapExpandIcon } from "./MapControls";
|
|
|
60
62
|
import { MenuIcon } from "./Menu";
|
|
61
63
|
import { MenuLinesIcon } from "./MenuLines";
|
|
62
64
|
import { MinusIcon } from "./Minus";
|
|
65
|
+
import { MoreHorizontalIcon } from "./MoreHorizontal";
|
|
63
66
|
import { NavigateIcon } from "./Navigate";
|
|
64
67
|
import { PhoneIcon } from "./Phone";
|
|
65
68
|
import { PlusIcon } from "./Plus";
|
|
@@ -72,6 +75,7 @@ import { SidebarIcon } from "./Sidebar";
|
|
|
72
75
|
import { SortIcon } from "./Sort";
|
|
73
76
|
import { StarIcon } from "./Star";
|
|
74
77
|
import { StarFilledIcon } from "./StarFilled";
|
|
78
|
+
import { TableViewIcon } from "./TableView";
|
|
75
79
|
import { UserIcon } from "./User";
|
|
76
80
|
import { UsersAltIcon } from "./UsersAlt";
|
|
77
81
|
import { VideoIcon } from "./Video";
|
|
@@ -83,6 +87,7 @@ export const icons = {
|
|
|
83
87
|
alertTriangle: AlertTriangleIcon,
|
|
84
88
|
areaExpand: AreaExpandIcon,
|
|
85
89
|
apple: AppleIcon,
|
|
90
|
+
arrowLeft: ArrowLeftIcon,
|
|
86
91
|
arrowRight: ArrowRightIcon,
|
|
87
92
|
bag: BagIcon,
|
|
88
93
|
ban: BanIcon,
|
|
@@ -99,6 +104,7 @@ export const icons = {
|
|
|
99
104
|
chevronLeft: ChevronLeftIcon,
|
|
100
105
|
clock: ClockIcon,
|
|
101
106
|
close: CloseIcon,
|
|
107
|
+
currentLocation: CurrentLocationIcon,
|
|
102
108
|
edit: EditIcon,
|
|
103
109
|
clockFilled: ClockFilledIcon,
|
|
104
110
|
copy: CopyIcon,
|
|
@@ -133,6 +139,7 @@ export const icons = {
|
|
|
133
139
|
menu: MenuIcon,
|
|
134
140
|
menuLines: MenuLinesIcon,
|
|
135
141
|
minus: MinusIcon,
|
|
142
|
+
moreHorizontal: MoreHorizontalIcon,
|
|
136
143
|
navigate: NavigateIcon,
|
|
137
144
|
noSmoking: NoSmokingIcon,
|
|
138
145
|
paw: PawIcon,
|
|
@@ -152,6 +159,7 @@ export const icons = {
|
|
|
152
159
|
sort: SortIcon,
|
|
153
160
|
star: StarIcon,
|
|
154
161
|
starFilled: StarFilledIcon,
|
|
162
|
+
tableView: TableViewIcon,
|
|
155
163
|
tooltipArrow: TooltipArrowIcon,
|
|
156
164
|
trash: TrashIcon,
|
|
157
165
|
user: UserIcon,
|
|
@@ -168,9 +176,11 @@ export const iconNames = Object.keys(icons) as IconName[];
|
|
|
168
176
|
|
|
169
177
|
export const iconGroups = {
|
|
170
178
|
navigation: [
|
|
179
|
+
"arrowLeft",
|
|
171
180
|
"arrowRight",
|
|
172
181
|
"chevronDown",
|
|
173
182
|
"chevronLeft",
|
|
183
|
+
"currentLocation",
|
|
174
184
|
"home",
|
|
175
185
|
"listView",
|
|
176
186
|
"locationPin",
|
|
@@ -181,6 +191,7 @@ export const iconGroups = {
|
|
|
181
191
|
"menu",
|
|
182
192
|
"menuLines",
|
|
183
193
|
"navigate",
|
|
194
|
+
"tableView",
|
|
184
195
|
],
|
|
185
196
|
actions: [
|
|
186
197
|
"show",
|
|
@@ -211,6 +222,7 @@ export const iconGroups = {
|
|
|
211
222
|
"star",
|
|
212
223
|
"starFilled",
|
|
213
224
|
"minus",
|
|
225
|
+
"moreHorizontal",
|
|
214
226
|
"plus",
|
|
215
227
|
"refresh",
|
|
216
228
|
"refundStatus",
|
package/src/index.ts
CHANGED
|
@@ -9,8 +9,10 @@ export {
|
|
|
9
9
|
InfoTile,
|
|
10
10
|
ContactInfoCard,
|
|
11
11
|
AccordionItem,
|
|
12
|
+
Accordion,
|
|
12
13
|
StepList,
|
|
13
14
|
Counter,
|
|
15
|
+
QuantityInput,
|
|
14
16
|
SegmentedToggle,
|
|
15
17
|
Sidebar,
|
|
16
18
|
LanguageSwitcher,
|
|
@@ -22,6 +24,7 @@ export {
|
|
|
22
24
|
FloatingActionButton,
|
|
23
25
|
Modal,
|
|
24
26
|
Input,
|
|
27
|
+
AutocompleteInput,
|
|
25
28
|
VerificationCodeInput,
|
|
26
29
|
Select,
|
|
27
30
|
Textarea,
|
|
@@ -45,8 +48,10 @@ export type {
|
|
|
45
48
|
InfoTileProps,
|
|
46
49
|
ContactInfoCardProps,
|
|
47
50
|
AccordionItemProps,
|
|
51
|
+
AccordionProps,
|
|
48
52
|
StepListProps,
|
|
49
53
|
CounterProps,
|
|
54
|
+
QuantityInputProps,
|
|
50
55
|
SegmentedToggleOption,
|
|
51
56
|
SegmentedToggleProps,
|
|
52
57
|
SidebarProps,
|
|
@@ -71,6 +76,8 @@ export type {
|
|
|
71
76
|
InputIcon,
|
|
72
77
|
InputProps,
|
|
73
78
|
InputSize,
|
|
79
|
+
AutocompleteInputProps,
|
|
80
|
+
AutocompleteOption,
|
|
74
81
|
VerificationCodeInputHandle,
|
|
75
82
|
VerificationCodeInputProps,
|
|
76
83
|
SelectIcon,
|
|
@@ -94,6 +101,8 @@ export {
|
|
|
94
101
|
BRAND_LOGO_DEFAULT_HEIGHT,
|
|
95
102
|
BRAND_LOGO_DEFAULT_WIDTH,
|
|
96
103
|
FavoritesButton,
|
|
104
|
+
IconStatusBadge,
|
|
105
|
+
InfoCardV2,
|
|
97
106
|
MenuItem,
|
|
98
107
|
} from "./primitives";
|
|
99
108
|
export type {
|
|
@@ -102,6 +111,8 @@ export type {
|
|
|
102
111
|
BrandLogoProps,
|
|
103
112
|
BrandLogoVariant,
|
|
104
113
|
FavoritesButtonProps,
|
|
114
|
+
IconStatusBadgeProps,
|
|
115
|
+
InfoCardV2Props,
|
|
105
116
|
MenuItemProps,
|
|
106
117
|
} from "./primitives";
|
|
107
118
|
|
|
@@ -115,6 +126,7 @@ export {
|
|
|
115
126
|
iconGroups,
|
|
116
127
|
iconGroupNames,
|
|
117
128
|
getIconsByGroup,
|
|
129
|
+
ArrowLeftIcon,
|
|
118
130
|
ArrowRightIcon,
|
|
119
131
|
BagIcon,
|
|
120
132
|
BanIcon,
|
|
@@ -130,6 +142,7 @@ export {
|
|
|
130
142
|
ChevronLeftIcon,
|
|
131
143
|
ClockIcon,
|
|
132
144
|
CloseIcon,
|
|
145
|
+
CurrentLocationIcon,
|
|
133
146
|
EditIcon,
|
|
134
147
|
BathroomsIcon,
|
|
135
148
|
BedroomsIcon,
|
|
@@ -137,6 +150,7 @@ export {
|
|
|
137
150
|
GuestsIcon,
|
|
138
151
|
RatingStarIcon,
|
|
139
152
|
SaveHeartIcon,
|
|
153
|
+
MoreHorizontalIcon,
|
|
140
154
|
AreaExpandIcon,
|
|
141
155
|
CheckSuccessIcon,
|
|
142
156
|
ClockFilledIcon,
|
|
@@ -188,6 +202,7 @@ export {
|
|
|
188
202
|
SortIcon,
|
|
189
203
|
StarIcon,
|
|
190
204
|
StarFilledIcon,
|
|
205
|
+
TableViewIcon,
|
|
191
206
|
UserIcon,
|
|
192
207
|
UsersAltIcon,
|
|
193
208
|
VideoIcon,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { LockIcon } from "../../icons";
|
|
3
|
+
import { IconStatusBadge } from "./IconStatusBadge";
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Primitives/Icon Status Badge",
|
|
7
|
+
component: IconStatusBadge,
|
|
8
|
+
args: {
|
|
9
|
+
icon: LockIcon,
|
|
10
|
+
iconProps: { color: "#60C27A" },
|
|
11
|
+
label: "Available",
|
|
12
|
+
},
|
|
13
|
+
parameters: { backgrounds: { default: "black" } },
|
|
14
|
+
} satisfies Meta<typeof IconStatusBadge>;
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
|
|
19
|
+
export const Armenian: Story = { args: { label: "Ազատ" } };
|
|
20
|
+
export const English: Story = {};
|
|
21
|
+
export const Russian: Story = { args: { label: "Свободен" } };
|
|
@@ -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,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
|
+
});
|
package/src/primitives/index.ts
CHANGED
|
@@ -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,
|
package/src/theme/colors.test.ts
CHANGED
|
@@ -16,6 +16,7 @@ describe("design tokens", () => {
|
|
|
16
16
|
expect(colors.whiteAlpha86).toBe("#FFFFFFDB");
|
|
17
17
|
expect(colors.whiteAlpha40).toBe("#FFFFFF66");
|
|
18
18
|
expect(colors.whiteAlpha20).toBe("#FFFFFF33");
|
|
19
|
+
expect(colors.whiteAlpha1).toBe("#FFFFFF03");
|
|
19
20
|
expect(colors.whiteAlpha6).toBe("#FFFFFF0F");
|
|
20
21
|
expect(colors.whiteAlpha10).toBe("#FFFFFF1A");
|
|
21
22
|
expect(colors.whiteAlpha5).toBe("#FFFFFF0D");
|
package/src/theme/colors.ts
CHANGED