@ecohouse/ui 0.1.5 → 0.1.7

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 (57) hide show
  1. package/README.md +34 -3
  2. package/dist/index.cjs +946 -102
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +349 -157
  5. package/dist/index.d.ts +349 -157
  6. package/dist/index.js +930 -104
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/components/Badge/Badge.stories.tsx +52 -0
  10. package/src/components/Badge/Badge.tsx +131 -0
  11. package/src/components/Badge/index.ts +2 -0
  12. package/src/components/CommentCard/CommentCard.stories.tsx +31 -0
  13. package/src/components/CommentCard/CommentCard.tsx +209 -0
  14. package/src/components/CommentCard/index.ts +2 -0
  15. package/src/components/Counter/Counter.stories.tsx +46 -0
  16. package/src/components/Counter/Counter.tsx +135 -0
  17. package/src/components/Counter/index.ts +2 -0
  18. package/src/components/RatingInput/RatingInput.stories.tsx +41 -0
  19. package/src/components/RatingInput/RatingInput.tsx +168 -0
  20. package/src/components/RatingInput/index.ts +2 -0
  21. package/src/components/SegmentedToggle/SegmentedToggle.stories.tsx +63 -0
  22. package/src/components/SegmentedToggle/SegmentedToggle.tsx +221 -0
  23. package/src/components/SegmentedToggle/index.ts +2 -0
  24. package/src/components/StatCard/StatCard.stories.tsx +20 -0
  25. package/src/components/StatCard/StatCard.tsx +61 -0
  26. package/src/components/StatCard/index.ts +2 -0
  27. package/src/components/index.ts +18 -0
  28. package/src/icons/Minus/MinusIcon.tsx +20 -0
  29. package/src/icons/Minus/MinusIcon.web.tsx +19 -0
  30. package/src/icons/Minus/index.ts +1 -0
  31. package/src/icons/Minus/minusPath.ts +1 -0
  32. package/src/icons/Plus/PlusIcon.tsx +20 -0
  33. package/src/icons/Plus/PlusIcon.web.tsx +19 -0
  34. package/src/icons/Plus/index.ts +1 -0
  35. package/src/icons/Plus/plusPath.ts +1 -0
  36. package/src/icons/Sidebar/SidebarIcon.tsx +21 -0
  37. package/src/icons/Sidebar/SidebarIcon.web.tsx +27 -0
  38. package/src/icons/Sidebar/index.ts +1 -0
  39. package/src/icons/Sidebar/sidebarPath.ts +3 -0
  40. package/src/icons/Star/StarIcon.tsx +35 -0
  41. package/src/icons/Star/StarIcon.web.tsx +41 -0
  42. package/src/icons/Star/index.ts +2 -0
  43. package/src/icons/Star/starPath.ts +3 -0
  44. package/src/icons/StarFilled/StarFilledIcon.tsx +28 -0
  45. package/src/icons/StarFilled/StarFilledIcon.web.tsx +34 -0
  46. package/src/icons/StarFilled/index.ts +1 -0
  47. package/src/icons/UsersAlt/UsersAltIcon.tsx +14 -0
  48. package/src/icons/UsersAlt/UsersAltIcon.web.tsx +13 -0
  49. package/src/icons/UsersAlt/index.ts +1 -0
  50. package/src/icons/UsersAlt/usersAltPath.ts +2 -0
  51. package/src/icons/index.ts +7 -0
  52. package/src/icons/registry.ts +18 -2
  53. package/src/index.ts +34 -1
  54. package/src/theme/colors.test.ts +6 -0
  55. package/src/theme/colors.ts +6 -0
  56. package/src/theme/index.ts +6 -0
  57. package/src/theme/typography.ts +77 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecohouse/ui",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "Cross-platform presentation-only UI components for EcoHouse (React Native + React Native Web)",
@@ -0,0 +1,52 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { View, StyleSheet } from "react-native";
3
+ import { HomeIcon } from "../../icons";
4
+ import { Badge } from "./Badge";
5
+
6
+ const meta = {
7
+ title: "Components/Badge",
8
+ component: Badge,
9
+ args: {
10
+ label: "Label",
11
+ variant: "default",
12
+ icon: HomeIcon,
13
+ },
14
+ argTypes: {
15
+ variant: {
16
+ control: "select",
17
+ options: ["default", "transparent"],
18
+ },
19
+ },
20
+ parameters: {
21
+ backgrounds: { default: "black" },
22
+ },
23
+ } satisfies Meta<typeof Badge>;
24
+
25
+ export default meta;
26
+ type Story = StoryObj<typeof meta>;
27
+
28
+ export const Default: Story = {};
29
+
30
+ export const Transparent: Story = {
31
+ args: { variant: "transparent" },
32
+ };
33
+
34
+ export const WithNoIcon: Story = {
35
+ args: { icon: undefined },
36
+ };
37
+
38
+ export const AllVariants: Story = {
39
+ render: () => (
40
+ <View style={storyStyles.column}>
41
+ <Badge label="Label" icon={HomeIcon} variant="default" />
42
+ <Badge label="Label" icon={HomeIcon} variant="transparent" />
43
+ </View>
44
+ ),
45
+ };
46
+
47
+ const storyStyles = StyleSheet.create({
48
+ column: {
49
+ gap: 12,
50
+ alignItems: "flex-start",
51
+ },
52
+ });
@@ -0,0 +1,131 @@
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 } from "../../icons";
12
+ import { badgeTypography, colors } from "../../theme";
13
+ import { mergeRefs } from "../../utils/mergeRefs";
14
+ import { useApplyWebClassName } from "../../utils/useApplyWebClassName";
15
+
16
+ export type BadgeVariant = "default" | "transparent";
17
+
18
+ export interface BadgeProps extends Omit<ViewProps, "style" | "children"> {
19
+ label: string;
20
+ variant?: BadgeVariant;
21
+ icon?: IconComponent;
22
+ style?: StyleProp<ViewStyle>;
23
+ className?: string;
24
+ }
25
+
26
+ const ICON_SIZE = 20;
27
+
28
+ const webBlurStyle: ViewStyle =
29
+ Platform.OS === "web"
30
+ ? ({
31
+ backdropFilter: "blur(10.3px)",
32
+ WebkitBackdropFilter: "blur(10.3px)",
33
+ } as ViewStyle)
34
+ : {};
35
+
36
+ /**
37
+ * Variant chrome — icon color is part of the variant, not a separate prop.
38
+ * - default: grey fill, no border, white icon
39
+ * - transparent: muted white fill + 1px border, primary icon, blur on web
40
+ */
41
+ const variantConfig = {
42
+ default: {
43
+ backgroundColor: colors.grey750,
44
+ iconColor: colors.white,
45
+ border: false,
46
+ blur: false,
47
+ },
48
+ transparent: {
49
+ backgroundColor: colors.whiteAlpha5,
50
+ iconColor: colors.primary,
51
+ border: true,
52
+ blur: true,
53
+ },
54
+ } as const satisfies Record<
55
+ BadgeVariant,
56
+ { backgroundColor: string; iconColor: string; border: boolean; blur: boolean }
57
+ >;
58
+
59
+ export const Badge = forwardRef<ComponentRef<typeof View>, BadgeProps>(function Badge(
60
+ { label, variant = "default", icon: Icon, style, className, accessibilityLabel, ...rest },
61
+ forwardedRef,
62
+ ) {
63
+ const containerRef = useRef<ComponentRef<typeof View>>(null);
64
+ const preset = variantConfig[variant];
65
+ const resolvedClassName = className?.trim() || undefined;
66
+ const setContainerRef = useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
67
+
68
+ useApplyWebClassName(containerRef, resolvedClassName);
69
+
70
+ return (
71
+ <View
72
+ {...rest}
73
+ ref={setContainerRef}
74
+ style={[
75
+ styles.base,
76
+ { backgroundColor: preset.backgroundColor },
77
+ preset.border ? styles.transparentBorder : null,
78
+ preset.blur ? webBlurStyle : null,
79
+ style,
80
+ ]}
81
+ accessibilityRole="text"
82
+ accessibilityLabel={accessibilityLabel ?? label}
83
+ >
84
+ {Icon ? (
85
+ <View style={styles.iconSlot}>
86
+ <Icon size={ICON_SIZE} color={preset.iconColor} />
87
+ </View>
88
+ ) : null}
89
+
90
+ <Text style={[styles.label, Platform.OS === "android" ? styles.labelAndroid : null]}>
91
+ {label}
92
+ </Text>
93
+ </View>
94
+ );
95
+ });
96
+
97
+ const styles = StyleSheet.create({
98
+ base: {
99
+ flexDirection: "row",
100
+ alignItems: "center",
101
+ alignSelf: "flex-start",
102
+ minHeight: 44,
103
+ paddingVertical: 12,
104
+ paddingHorizontal: 16,
105
+ gap: 12,
106
+ borderRadius: 79,
107
+ overflow: "hidden",
108
+ borderWidth: 0,
109
+ borderColor: "transparent",
110
+ borderStyle: "solid",
111
+ },
112
+ transparentBorder: {
113
+ borderWidth: 1,
114
+ borderColor: colors.whiteAlpha5,
115
+ borderStyle: "solid",
116
+ },
117
+ iconSlot: {
118
+ width: ICON_SIZE,
119
+ height: ICON_SIZE,
120
+ alignItems: "center",
121
+ justifyContent: "center",
122
+ flexShrink: 0,
123
+ },
124
+ label: {
125
+ ...badgeTypography,
126
+ color: colors.white,
127
+ },
128
+ labelAndroid: {
129
+ includeFontPadding: false,
130
+ },
131
+ });
@@ -0,0 +1,2 @@
1
+ export { Badge } from "./Badge";
2
+ export type { BadgeProps, BadgeVariant } from "./Badge";
@@ -0,0 +1,31 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { CommentCard } from "./CommentCard";
3
+
4
+ const meta = {
5
+ title: "Components/Comment Card",
6
+ component: CommentCard,
7
+ args: {
8
+ userName: "Աննա Սարգսյան",
9
+ date: "Հուլիս 2026",
10
+ commentText:
11
+ "Աննկարագրելի գեղեցիկ և հանգիստ վայր։ QR-ով մուտքն անչափ հարմար էր, իսկ քոթեջի ներսում ամեն ինչ մտածված էր մինչև ամենափոքր մանրուքը։",
12
+ rating: 4,
13
+ imageUrl: "https://i.pravatar.cc/150?img=47",
14
+ },
15
+ parameters: {
16
+ backgrounds: { default: "black" },
17
+ },
18
+ } satisfies Meta<typeof CommentCard>;
19
+
20
+ export default meta;
21
+ type Story = StoryObj<typeof meta>;
22
+
23
+ export const Default: Story = {};
24
+
25
+ export const WithoutImage: Story = {
26
+ args: { imageUrl: undefined },
27
+ };
28
+
29
+ export const ShortComment: Story = {
30
+ args: { commentText: "Հիանալի վայր և սպասարկում։" },
31
+ };
@@ -0,0 +1,209 @@
1
+ import { forwardRef, useEffect, useMemo, useRef, useState, type ComponentRef } from "react";
2
+ import {
3
+ Image,
4
+ Pressable,
5
+ StyleSheet,
6
+ Text,
7
+ View,
8
+ type StyleProp,
9
+ type TextStyle,
10
+ type ViewProps,
11
+ type ViewStyle,
12
+ } from "react-native";
13
+ import { UserIcon } from "../../icons";
14
+ import { colors, commentCardTypography } from "../../theme";
15
+ import { mergeRefs } from "../../utils/mergeRefs";
16
+ import { useApplyWebClassName } from "../../utils/useApplyWebClassName";
17
+ import { RatingInput } from "../RatingInput";
18
+
19
+ export interface CommentCardProps extends Omit<ViewProps, "style" | "children"> {
20
+ userName: string;
21
+ date: string;
22
+ commentText: string;
23
+ rating: number;
24
+ imageUrl?: string | null;
25
+ maxCommentLines?: number;
26
+ maxCommentLength?: number;
27
+ readMoreLabel?: string;
28
+ readLessLabel?: string;
29
+ onExpandedChange?: (expanded: boolean) => void;
30
+ style?: StyleProp<ViewStyle>;
31
+ commentStyle?: StyleProp<TextStyle>;
32
+ className?: string;
33
+ }
34
+
35
+ const CARD_WIDTH = 370;
36
+ const CARD_MIN_HEIGHT = 173;
37
+ const AVATAR_SIZE = 44;
38
+
39
+ export const CommentCard = forwardRef<ComponentRef<typeof View>, CommentCardProps>(
40
+ function CommentCard(
41
+ {
42
+ userName,
43
+ date,
44
+ commentText,
45
+ rating,
46
+ imageUrl,
47
+ maxCommentLines = 3,
48
+ maxCommentLength = 111,
49
+ readMoreLabel = "Դիտել ավելին",
50
+ readLessLabel = "Փակել",
51
+ onExpandedChange,
52
+ style,
53
+ commentStyle,
54
+ className,
55
+ ...rest
56
+ },
57
+ forwardedRef,
58
+ ) {
59
+ const containerRef = useRef<ComponentRef<typeof View>>(null);
60
+ const setContainerRef = useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
61
+ const [imageFailed, setImageFailed] = useState(false);
62
+ const [expanded, setExpanded] = useState(false);
63
+ const [actionHovered, setActionHovered] = useState(false);
64
+ const hasImage = Boolean(imageUrl) && !imageFailed;
65
+ const shouldShowAction = Array.from(commentText).length >= maxCommentLength;
66
+
67
+ useApplyWebClassName(containerRef, className);
68
+
69
+ useEffect(() => {
70
+ setImageFailed(false);
71
+ }, [imageUrl]);
72
+
73
+ useEffect(() => {
74
+ setExpanded(false);
75
+ setActionHovered(false);
76
+ }, [commentText, maxCommentLength, maxCommentLines]);
77
+
78
+ const toggleExpanded = () => {
79
+ const next = !expanded;
80
+ setExpanded(next);
81
+ onExpandedChange?.(next);
82
+ };
83
+
84
+ return (
85
+ <View {...rest} ref={setContainerRef} style={[styles.root, style]}>
86
+ <View style={styles.header}>
87
+ <View style={styles.avatar}>
88
+ {hasImage ? (
89
+ <Image
90
+ source={{ uri: imageUrl ?? undefined }}
91
+ style={styles.avatarImage}
92
+ onError={() => setImageFailed(true)}
93
+ />
94
+ ) : (
95
+ <UserIcon size={20} color={colors.primary} />
96
+ )}
97
+ </View>
98
+
99
+ <View style={styles.identity}>
100
+ <Text numberOfLines={1} style={styles.name}>
101
+ {userName}
102
+ </Text>
103
+ <Text numberOfLines={1} style={styles.date}>
104
+ {date}
105
+ </Text>
106
+ </View>
107
+
108
+ <RatingInput value={rating} readOnly showValue={false} size={16} />
109
+ </View>
110
+
111
+ <Text
112
+ numberOfLines={expanded ? undefined : maxCommentLines}
113
+ style={[styles.comment, commentStyle]}
114
+ >
115
+ {commentText}
116
+ </Text>
117
+
118
+ {shouldShowAction ? (
119
+ <Pressable
120
+ onPress={toggleExpanded}
121
+ accessibilityRole="button"
122
+ accessibilityState={{ expanded }}
123
+ hitSlop={6}
124
+ onHoverIn={() => setActionHovered(true)}
125
+ onHoverOut={() => setActionHovered(false)}
126
+ style={styles.action}
127
+ >
128
+ <Text
129
+ style={[
130
+ styles.actionText,
131
+ expanded && styles.closeActionText,
132
+ actionHovered &&
133
+ (expanded ? styles.closeActionTextHovered : styles.openActionTextHovered),
134
+ ]}
135
+ >
136
+ {expanded ? readLessLabel : readMoreLabel}
137
+ </Text>
138
+ </Pressable>
139
+ ) : null}
140
+ </View>
141
+ );
142
+ },
143
+ );
144
+
145
+ const styles = StyleSheet.create({
146
+ root: {
147
+ width: CARD_WIDTH,
148
+ minHeight: CARD_MIN_HEIGHT,
149
+ padding: 16,
150
+ gap: 12,
151
+ borderRadius: 12,
152
+ backgroundColor: colors.grey750,
153
+ },
154
+ header: {
155
+ flexDirection: "row",
156
+ alignItems: "center",
157
+ gap: 8,
158
+ },
159
+ avatar: {
160
+ width: AVATAR_SIZE,
161
+ height: AVATAR_SIZE,
162
+ flexShrink: 0,
163
+ alignItems: "center",
164
+ justifyContent: "center",
165
+ overflow: "hidden",
166
+ borderRadius: AVATAR_SIZE / 2,
167
+ backgroundColor: colors.grey600,
168
+ },
169
+ avatarImage: {
170
+ width: AVATAR_SIZE,
171
+ height: AVATAR_SIZE,
172
+ },
173
+ identity: {
174
+ minWidth: 0,
175
+ flex: 1,
176
+ gap: 4,
177
+ },
178
+ name: {
179
+ ...commentCardTypography.name,
180
+ color: colors.white,
181
+ },
182
+ date: {
183
+ ...commentCardTypography.date,
184
+ color: colors.grey0,
185
+ },
186
+ comment: {
187
+ ...commentCardTypography.comment,
188
+ color: colors.white,
189
+ },
190
+ action: {
191
+ alignSelf: "flex-start",
192
+ marginTop: "auto",
193
+ minHeight: 16,
194
+ justifyContent: "center",
195
+ },
196
+ actionText: {
197
+ ...commentCardTypography.action,
198
+ color: colors.white,
199
+ },
200
+ closeActionText: {
201
+ color: colors.primary,
202
+ },
203
+ openActionTextHovered: {
204
+ color: colors.primary,
205
+ },
206
+ closeActionTextHovered: {
207
+ color: colors.white,
208
+ },
209
+ });
@@ -0,0 +1,2 @@
1
+ export { CommentCard } from "./CommentCard";
2
+ export type { CommentCardProps } from "./CommentCard";
@@ -0,0 +1,46 @@
1
+ import { useState } from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react-vite";
3
+ import { Counter } from "./Counter";
4
+
5
+ const meta = {
6
+ title: "Components/Counter",
7
+ component: Counter,
8
+ args: {
9
+ defaultValue: 1,
10
+ min: 1,
11
+ },
12
+ argTypes: {
13
+ value: { control: "number" },
14
+ defaultValue: { control: "number" },
15
+ min: { control: "number" },
16
+ max: { control: "number" },
17
+ step: { control: "number" },
18
+ disabled: { control: "boolean" },
19
+ onValueChange: { action: "valueChange" },
20
+ },
21
+ parameters: {
22
+ backgrounds: { default: "black" },
23
+ },
24
+ } satisfies Meta<typeof Counter>;
25
+
26
+ export default meta;
27
+ type Story = StoryObj<typeof meta>;
28
+
29
+ export const Default: Story = {};
30
+
31
+ export const AtMaximum: Story = {
32
+ args: { defaultValue: 5, max: 5 },
33
+ };
34
+
35
+ export const Disabled: Story = {
36
+ args: { disabled: true },
37
+ };
38
+
39
+ function ControlledCounter() {
40
+ const [value, setValue] = useState(1);
41
+ return <Counter value={value} min={1} max={5} onValueChange={setValue} />;
42
+ }
43
+
44
+ export const Controlled: Story = {
45
+ render: () => <ControlledCounter />,
46
+ };
@@ -0,0 +1,135 @@
1
+ import { forwardRef, useMemo, useRef, useState, type ComponentRef } from "react";
2
+ import {
3
+ Platform,
4
+ Pressable,
5
+ StyleSheet,
6
+ Text,
7
+ View,
8
+ type PressableProps,
9
+ type StyleProp,
10
+ type ViewProps,
11
+ type ViewStyle,
12
+ } from "react-native";
13
+ import { MinusIcon, PlusIcon } from "../../icons";
14
+ import { colors, counterTypography } from "../../theme";
15
+ import { mergeRefs } from "../../utils/mergeRefs";
16
+ import { useApplyWebClassName } from "../../utils/useApplyWebClassName";
17
+
18
+ export interface CounterProps extends Omit<ViewProps, "style" | "children"> {
19
+ value?: number;
20
+ defaultValue?: number;
21
+ onValueChange?: (value: number) => void;
22
+ min?: number;
23
+ max?: number;
24
+ step?: number;
25
+ disabled?: boolean;
26
+ style?: StyleProp<ViewStyle>;
27
+ className?: string;
28
+ hitSlop?: PressableProps["hitSlop"];
29
+ }
30
+
31
+ const BUTTON_SIZE = 32;
32
+
33
+ const webBlurStyle: ViewStyle =
34
+ Platform.OS === "web"
35
+ ? ({
36
+ backdropFilter: "blur(20px)",
37
+ WebkitBackdropFilter: "blur(20px)",
38
+ } as ViewStyle)
39
+ : {};
40
+
41
+ function clamp(value: number, min: number, max?: number) {
42
+ return Math.max(min, max === undefined ? value : Math.min(value, max));
43
+ }
44
+
45
+ export const Counter = forwardRef<ComponentRef<typeof View>, CounterProps>(function Counter(
46
+ {
47
+ value,
48
+ defaultValue,
49
+ onValueChange,
50
+ min = 1,
51
+ max,
52
+ step = 1,
53
+ disabled = false,
54
+ style,
55
+ className,
56
+ hitSlop,
57
+ ...rest
58
+ },
59
+ forwardedRef,
60
+ ) {
61
+ const containerRef = useRef<ComponentRef<typeof View>>(null);
62
+ const isControlled = value !== undefined;
63
+ const [uncontrolledValue, setUncontrolledValue] = useState(() =>
64
+ clamp(defaultValue ?? min, min, max),
65
+ );
66
+ const resolvedValue = clamp(isControlled ? value : uncontrolledValue, min, max);
67
+ const resolvedClassName = className?.trim() || undefined;
68
+ const setContainerRef = useMemo(() => mergeRefs(containerRef, forwardedRef), [forwardedRef]);
69
+ const decrementDisabled = disabled || resolvedValue <= min;
70
+ const incrementDisabled = disabled || (max !== undefined && resolvedValue >= max);
71
+
72
+ useApplyWebClassName(containerRef, resolvedClassName);
73
+
74
+ const updateValue = (nextValue: number) => {
75
+ const next = clamp(nextValue, min, max);
76
+ if (next === resolvedValue) return;
77
+ if (!isControlled) setUncontrolledValue(next);
78
+ onValueChange?.(next);
79
+ };
80
+
81
+ return (
82
+ <View {...rest} ref={setContainerRef} style={[styles.base, style]}>
83
+ <Pressable
84
+ disabled={decrementDisabled}
85
+ hitSlop={hitSlop}
86
+ onPress={() => updateValue(resolvedValue - step)}
87
+ accessibilityRole="button"
88
+ accessibilityLabel="Decrease value"
89
+ accessibilityState={{ disabled: decrementDisabled }}
90
+ style={[styles.button, webBlurStyle, decrementDisabled && styles.buttonDisabled]}
91
+ >
92
+ <MinusIcon />
93
+ </Pressable>
94
+
95
+ <Text style={styles.value}>{resolvedValue}</Text>
96
+
97
+ <Pressable
98
+ disabled={incrementDisabled}
99
+ hitSlop={hitSlop}
100
+ onPress={() => updateValue(resolvedValue + step)}
101
+ accessibilityRole="button"
102
+ accessibilityLabel="Increase value"
103
+ accessibilityState={{ disabled: incrementDisabled }}
104
+ style={[styles.button, webBlurStyle, incrementDisabled && styles.buttonDisabled]}
105
+ >
106
+ <PlusIcon />
107
+ </Pressable>
108
+ </View>
109
+ );
110
+ });
111
+
112
+ const styles = StyleSheet.create({
113
+ base: {
114
+ flexDirection: "row",
115
+ alignItems: "center",
116
+ alignSelf: "flex-start",
117
+ gap: 17,
118
+ },
119
+ button: {
120
+ width: BUTTON_SIZE,
121
+ height: BUTTON_SIZE,
122
+ alignItems: "center",
123
+ justifyContent: "center",
124
+ borderWidth: 1,
125
+ borderColor: colors.whiteAlpha10,
126
+ borderRadius: 39,
127
+ },
128
+ buttonDisabled: {
129
+ opacity: 0.25,
130
+ },
131
+ value: {
132
+ ...counterTypography,
133
+ color: colors.white,
134
+ },
135
+ });
@@ -0,0 +1,2 @@
1
+ export { Counter } from "./Counter";
2
+ export type { CounterProps } from "./Counter";
@@ -0,0 +1,41 @@
1
+ import { useState } from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react-vite";
3
+ import { RatingInput } from "./RatingInput";
4
+
5
+ const meta = {
6
+ title: "Components/Rating Input",
7
+ component: RatingInput,
8
+ args: {
9
+ defaultValue: 5,
10
+ showValue: true,
11
+ disabled: false,
12
+ },
13
+ argTypes: {
14
+ onValueChange: { action: "valueChange" },
15
+ },
16
+ parameters: {
17
+ backgrounds: { default: "black" },
18
+ },
19
+ } satisfies Meta<typeof RatingInput>;
20
+
21
+ export default meta;
22
+ type Story = StoryObj<typeof meta>;
23
+
24
+ export const WithValue: Story = {};
25
+
26
+ export const WithoutValue: Story = {
27
+ args: { showValue: false },
28
+ };
29
+
30
+ export const ReadOnly: Story = {
31
+ args: { defaultValue: 4, readOnly: true },
32
+ };
33
+
34
+ function ControlledRatingInput() {
35
+ const [value, setValue] = useState(3);
36
+ return <RatingInput value={value} onValueChange={setValue} />;
37
+ }
38
+
39
+ export const Controlled: Story = {
40
+ render: () => <ControlledRatingInput />,
41
+ };