@ecohouse/ui 0.1.0 → 0.1.2
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 +239 -36
- package/dist/index.cjs +649 -314
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +181 -258
- package/dist/index.d.ts +181 -258
- package/dist/index.js +626 -304
- package/dist/index.js.map +1 -1
- package/package.json +5 -7
- package/src/components/Button/Button.stories.tsx +98 -0
- package/src/components/{Button.tsx → Button/Button.tsx} +39 -71
- package/src/components/Button/index.ts +2 -0
- package/src/components/Input/Input.stories.tsx +118 -0
- package/src/components/Input/Input.tsx +327 -0
- package/src/components/Input/index.ts +2 -0
- package/src/components/index.ts +5 -0
- package/src/icons/{ArrowUpRightIcon.tsx → ArrowRight/ArrowRightIcon.tsx} +8 -7
- package/src/icons/{ArrowUpRightIcon.web.tsx → ArrowRight/ArrowRightIcon.web.tsx} +8 -7
- package/src/icons/ArrowRight/arrowRightPath.ts +2 -0
- package/src/icons/ArrowRight/index.ts +1 -0
- package/src/icons/Bag/BagIcon.tsx +20 -0
- package/src/icons/Bag/BagIcon.web.tsx +26 -0
- package/src/icons/Bag/bagPath.ts +2 -0
- package/src/icons/Bag/index.ts +1 -0
- package/src/icons/Bell/BellIcon.tsx +20 -0
- package/src/icons/Bell/BellIcon.web.tsx +26 -0
- package/src/icons/Bell/bellPath.ts +2 -0
- package/src/icons/Bell/index.ts +1 -0
- package/src/icons/Building/BuildingIcon.tsx +20 -0
- package/src/icons/Building/BuildingIcon.web.tsx +26 -0
- package/src/icons/Building/buildingPath.ts +2 -0
- package/src/icons/Building/index.ts +1 -0
- package/src/icons/Camera/CameraIcon.tsx +20 -0
- package/src/icons/Camera/CameraIcon.web.tsx +26 -0
- package/src/icons/Camera/cameraPath.ts +2 -0
- package/src/icons/Camera/index.ts +1 -0
- package/src/icons/CheckBadge/CheckBadgeIcon.tsx +20 -0
- package/src/icons/CheckBadge/CheckBadgeIcon.web.tsx +26 -0
- package/src/icons/CheckBadge/checkBadgePath.ts +2 -0
- package/src/icons/CheckBadge/index.ts +1 -0
- package/src/icons/Clock/ClockIcon.tsx +20 -0
- package/src/icons/Clock/ClockIcon.web.tsx +26 -0
- package/src/icons/Clock/clockPath.ts +2 -0
- package/src/icons/Clock/index.ts +1 -0
- package/src/icons/Facebook/FacebookIcon.tsx +14 -0
- package/src/icons/Facebook/FacebookIcon.web.tsx +20 -0
- package/src/icons/Facebook/facebookPath.ts +2 -0
- package/src/icons/Facebook/index.ts +1 -0
- package/src/icons/Home/HomeIcon.tsx +20 -0
- package/src/icons/Home/HomeIcon.web.tsx +26 -0
- package/src/icons/Home/homePath.ts +2 -0
- package/src/icons/Home/index.ts +1 -0
- package/src/icons/Icon.tsx +11 -0
- package/src/icons/Icons.stories.tsx +174 -0
- package/src/icons/Instagram/InstagramIcon.tsx +14 -0
- package/src/icons/Instagram/InstagramIcon.web.tsx +20 -0
- package/src/icons/Instagram/index.ts +1 -0
- package/src/icons/Instagram/instagramPath.ts +2 -0
- package/src/icons/Key/KeyIcon.tsx +20 -0
- package/src/icons/Key/KeyIcon.web.tsx +26 -0
- package/src/icons/Key/index.ts +1 -0
- package/src/icons/Key/keyPath.ts +2 -0
- package/src/icons/LinkedIn/LinkedInIcon.tsx +14 -0
- package/src/icons/LinkedIn/LinkedInIcon.web.tsx +20 -0
- package/src/icons/LinkedIn/index.ts +1 -0
- package/src/icons/LinkedIn/linkedinPath.ts +2 -0
- package/src/icons/Mail/MailIcon.tsx +20 -0
- package/src/icons/Mail/MailIcon.web.tsx +26 -0
- package/src/icons/Mail/index.ts +1 -0
- package/src/icons/Mail/mailPath.ts +2 -0
- package/src/icons/Navigate/NavigateIcon.tsx +20 -0
- package/src/icons/Navigate/NavigateIcon.web.tsx +26 -0
- package/src/icons/Navigate/index.ts +1 -0
- package/src/icons/Navigate/navigatePath.ts +2 -0
- package/src/icons/Phone/PhoneIcon.tsx +20 -0
- package/src/icons/Phone/PhoneIcon.web.tsx +26 -0
- package/src/icons/Phone/index.ts +1 -0
- package/src/icons/Phone/phonePath.ts +2 -0
- package/src/icons/Show/ShowIcon.tsx +33 -0
- package/src/icons/Show/ShowIcon.web.tsx +39 -0
- package/src/icons/Show/index.ts +1 -0
- package/src/icons/Show/showPath.ts +6 -0
- package/src/icons/User/UserIcon.tsx +26 -0
- package/src/icons/User/UserIcon.web.tsx +32 -0
- package/src/icons/User/index.ts +1 -0
- package/src/icons/User/userPath.ts +3 -0
- package/src/icons/index.ts +24 -0
- package/src/icons/registry.ts +58 -0
- package/src/icons/types.ts +9 -0
- package/src/index.ts +37 -21
- package/src/theme/colors.test.ts +12 -0
- package/src/theme/colors.ts +46 -0
- package/src/theme/index.ts +4 -0
- package/src/theme/typography.ts +46 -0
- package/src/web/styles/fonts.css +1 -0
- package/src/web/styles/typography.css +14 -92
- package/src/components/Button.stories.tsx +0 -135
- package/src/icons/arrowUpRightPath.ts +0 -1
- package/src/theme/tokens.test.ts +0 -10
- package/src/theme/tokens.ts +0 -286
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import { fn } from "storybook/test";
|
|
3
|
+
import { View, StyleSheet } from "react-native";
|
|
4
|
+
import { Input } from "./Input";
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Components/Input",
|
|
8
|
+
component: Input,
|
|
9
|
+
args: {
|
|
10
|
+
label: "Label",
|
|
11
|
+
showLabel: true,
|
|
12
|
+
hint: "Hint",
|
|
13
|
+
showHint: true,
|
|
14
|
+
placeholder: "placeholder",
|
|
15
|
+
size: "lg",
|
|
16
|
+
showLeftIcon: true,
|
|
17
|
+
showRightIcon: true,
|
|
18
|
+
onChangeText: fn(),
|
|
19
|
+
onRightIconPress: fn(),
|
|
20
|
+
},
|
|
21
|
+
argTypes: {
|
|
22
|
+
state: {
|
|
23
|
+
control: "select",
|
|
24
|
+
options: ["default", "filled", "active", "error", "disabled"],
|
|
25
|
+
},
|
|
26
|
+
size: {
|
|
27
|
+
control: "select",
|
|
28
|
+
options: ["lg", "sm"],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
} satisfies Meta<typeof Input>;
|
|
32
|
+
|
|
33
|
+
export default meta;
|
|
34
|
+
type Story = StoryObj<typeof meta>;
|
|
35
|
+
|
|
36
|
+
export const Default: Story = {
|
|
37
|
+
args: { state: "default" },
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const Filled: Story = {
|
|
41
|
+
args: { state: "filled", value: "Filled value" },
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const Active: Story = {
|
|
45
|
+
args: { state: "active" },
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Error: Story = {
|
|
49
|
+
args: { state: "error", hint: "Hint" },
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const Disabled: Story = {
|
|
53
|
+
args: { state: "disabled", value: "Disabled value" },
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const WithoutIcons: Story = {
|
|
57
|
+
args: { showLeftIcon: false, showRightIcon: false },
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const WithoutLabelAndHint: Story = {
|
|
61
|
+
args: { showLabel: false, showHint: false },
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const AllStates: Story = {
|
|
65
|
+
render: () => (
|
|
66
|
+
<View style={storyStyles.column}>
|
|
67
|
+
<Input
|
|
68
|
+
label="Label"
|
|
69
|
+
hint="Hint"
|
|
70
|
+
showLeftIcon
|
|
71
|
+
showRightIcon
|
|
72
|
+
placeholder="placeholder"
|
|
73
|
+
state="default"
|
|
74
|
+
/>
|
|
75
|
+
<Input
|
|
76
|
+
label="Label"
|
|
77
|
+
hint="Hint"
|
|
78
|
+
showLeftIcon
|
|
79
|
+
showRightIcon
|
|
80
|
+
placeholder="placeholder"
|
|
81
|
+
state="filled"
|
|
82
|
+
value="Filled value"
|
|
83
|
+
/>
|
|
84
|
+
<Input
|
|
85
|
+
label="Label"
|
|
86
|
+
hint="Hint"
|
|
87
|
+
showLeftIcon
|
|
88
|
+
showRightIcon
|
|
89
|
+
placeholder="placeholder"
|
|
90
|
+
state="active"
|
|
91
|
+
/>
|
|
92
|
+
<Input
|
|
93
|
+
label="Label"
|
|
94
|
+
hint="Hint"
|
|
95
|
+
showLeftIcon
|
|
96
|
+
showRightIcon
|
|
97
|
+
placeholder="placeholder"
|
|
98
|
+
state="error"
|
|
99
|
+
/>
|
|
100
|
+
<Input
|
|
101
|
+
label="Label"
|
|
102
|
+
hint="Hint"
|
|
103
|
+
showLeftIcon
|
|
104
|
+
showRightIcon
|
|
105
|
+
placeholder="placeholder"
|
|
106
|
+
state="disabled"
|
|
107
|
+
value="Disabled value"
|
|
108
|
+
/>
|
|
109
|
+
</View>
|
|
110
|
+
),
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const storyStyles = StyleSheet.create({
|
|
114
|
+
column: {
|
|
115
|
+
gap: 24,
|
|
116
|
+
alignItems: "flex-start",
|
|
117
|
+
},
|
|
118
|
+
});
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { useRef, useState, type ComponentRef, type ReactNode } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
Text,
|
|
6
|
+
TextInput,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
View,
|
|
9
|
+
type StyleProp,
|
|
10
|
+
type TextStyle,
|
|
11
|
+
type ViewStyle,
|
|
12
|
+
type TextInputProps,
|
|
13
|
+
} from "react-native";
|
|
14
|
+
import { ShowIcon } from "../../icons";
|
|
15
|
+
import { UserIcon } from "../../icons";
|
|
16
|
+
import { colors, inputTypography } from "../../theme";
|
|
17
|
+
import { useApplyWebClassName } from "../../utils/useApplyWebClassName";
|
|
18
|
+
|
|
19
|
+
export type InputState = "default" | "filled" | "active" | "error" | "disabled";
|
|
20
|
+
export type InputSize = "lg" | "sm";
|
|
21
|
+
|
|
22
|
+
export interface InputProps extends Omit<TextInputProps, "style" | "editable"> {
|
|
23
|
+
label?: string;
|
|
24
|
+
showLabel?: boolean;
|
|
25
|
+
hint?: string;
|
|
26
|
+
showHint?: boolean;
|
|
27
|
+
state?: InputState;
|
|
28
|
+
size?: InputSize;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
error?: boolean;
|
|
31
|
+
leftIcon?: ReactNode;
|
|
32
|
+
showLeftIcon?: boolean;
|
|
33
|
+
rightIcon?: ReactNode;
|
|
34
|
+
showRightIcon?: boolean;
|
|
35
|
+
onRightIconPress?: () => void;
|
|
36
|
+
style?: StyleProp<ViewStyle>;
|
|
37
|
+
fieldStyle?: StyleProp<ViewStyle>;
|
|
38
|
+
inputStyle?: StyleProp<TextStyle>;
|
|
39
|
+
className?: string;
|
|
40
|
+
inputClassName?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type FieldChrome = {
|
|
44
|
+
borderColor: string;
|
|
45
|
+
backgroundColor: string;
|
|
46
|
+
textColor: string;
|
|
47
|
+
placeholderColor: string;
|
|
48
|
+
leftIconColor: string;
|
|
49
|
+
rightIconColor: string;
|
|
50
|
+
labelColor: string;
|
|
51
|
+
hintColor: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const DEFAULT_WIDTH = 308;
|
|
55
|
+
|
|
56
|
+
const sizeConfig = {
|
|
57
|
+
lg: {
|
|
58
|
+
height: 44,
|
|
59
|
+
borderRadius: 60,
|
|
60
|
+
paddingVertical: 12,
|
|
61
|
+
paddingHorizontal: 16,
|
|
62
|
+
gap: 10,
|
|
63
|
+
iconSize: 20,
|
|
64
|
+
text: inputTypography.field,
|
|
65
|
+
},
|
|
66
|
+
sm: {
|
|
67
|
+
height: 32,
|
|
68
|
+
borderRadius: 60,
|
|
69
|
+
paddingVertical: 6,
|
|
70
|
+
paddingHorizontal: 12,
|
|
71
|
+
gap: 8,
|
|
72
|
+
iconSize: 16,
|
|
73
|
+
text: inputTypography.hint,
|
|
74
|
+
},
|
|
75
|
+
} as const satisfies Record<InputSize, Record<string, unknown>>;
|
|
76
|
+
|
|
77
|
+
function resolveState({
|
|
78
|
+
state,
|
|
79
|
+
disabled,
|
|
80
|
+
error,
|
|
81
|
+
focused,
|
|
82
|
+
hasValue,
|
|
83
|
+
}: {
|
|
84
|
+
state?: InputState;
|
|
85
|
+
disabled?: boolean;
|
|
86
|
+
error?: boolean;
|
|
87
|
+
focused: boolean;
|
|
88
|
+
hasValue: boolean;
|
|
89
|
+
}): InputState {
|
|
90
|
+
if (state) return state;
|
|
91
|
+
if (disabled) return "disabled";
|
|
92
|
+
if (error) return "error";
|
|
93
|
+
if (focused) return "active";
|
|
94
|
+
if (hasValue) return "filled";
|
|
95
|
+
return "default";
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function chromeFor(state: InputState): FieldChrome {
|
|
99
|
+
const base: FieldChrome = {
|
|
100
|
+
borderColor: colors.grey700,
|
|
101
|
+
backgroundColor: colors.grey700,
|
|
102
|
+
textColor: colors.white,
|
|
103
|
+
placeholderColor: colors.grey100,
|
|
104
|
+
leftIconColor: colors.grey100,
|
|
105
|
+
rightIconColor: colors.grey100,
|
|
106
|
+
labelColor: colors.white,
|
|
107
|
+
hintColor: colors.grey100,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
switch (state) {
|
|
111
|
+
case "active":
|
|
112
|
+
return {
|
|
113
|
+
...base,
|
|
114
|
+
borderColor: colors.primaryMuted,
|
|
115
|
+
leftIconColor: colors.primary,
|
|
116
|
+
};
|
|
117
|
+
case "error":
|
|
118
|
+
return {
|
|
119
|
+
...base,
|
|
120
|
+
borderColor: colors.redMuted,
|
|
121
|
+
textColor: colors.red,
|
|
122
|
+
placeholderColor: colors.red,
|
|
123
|
+
labelColor: colors.red,
|
|
124
|
+
hintColor: colors.red,
|
|
125
|
+
leftIconColor: colors.red,
|
|
126
|
+
};
|
|
127
|
+
case "filled":
|
|
128
|
+
return base;
|
|
129
|
+
case "disabled":
|
|
130
|
+
return {
|
|
131
|
+
...base,
|
|
132
|
+
borderColor: colors.grey700,
|
|
133
|
+
backgroundColor: colors.grey700,
|
|
134
|
+
textColor: colors.grey0,
|
|
135
|
+
leftIconColor: colors.grey0,
|
|
136
|
+
rightIconColor: colors.grey0,
|
|
137
|
+
labelColor: colors.white,
|
|
138
|
+
hintColor: colors.grey100,
|
|
139
|
+
};
|
|
140
|
+
default:
|
|
141
|
+
return base;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function Input({
|
|
146
|
+
label = "Label",
|
|
147
|
+
showLabel = true,
|
|
148
|
+
hint = "Hint",
|
|
149
|
+
showHint = true,
|
|
150
|
+
placeholder = "placeholder",
|
|
151
|
+
state: stateProp,
|
|
152
|
+
size = "lg",
|
|
153
|
+
disabled = false,
|
|
154
|
+
error = false,
|
|
155
|
+
value,
|
|
156
|
+
defaultValue,
|
|
157
|
+
onChangeText,
|
|
158
|
+
onFocus,
|
|
159
|
+
onBlur,
|
|
160
|
+
leftIcon,
|
|
161
|
+
showLeftIcon = false,
|
|
162
|
+
rightIcon,
|
|
163
|
+
showRightIcon = false,
|
|
164
|
+
onRightIconPress,
|
|
165
|
+
style,
|
|
166
|
+
fieldStyle,
|
|
167
|
+
inputStyle,
|
|
168
|
+
className,
|
|
169
|
+
inputClassName,
|
|
170
|
+
...textInputProps
|
|
171
|
+
}: InputProps) {
|
|
172
|
+
const rootRef = useRef<ComponentRef<typeof View>>(null);
|
|
173
|
+
const inputRef = useRef<ComponentRef<typeof TextInput>>(null);
|
|
174
|
+
const [focused, setFocused] = useState(false);
|
|
175
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue ?? "");
|
|
176
|
+
const metrics = sizeConfig[size];
|
|
177
|
+
|
|
178
|
+
const isControlled = typeof value === "string";
|
|
179
|
+
const currentValue = isControlled ? value : uncontrolledValue;
|
|
180
|
+
const hasValue = currentValue.length > 0;
|
|
181
|
+
|
|
182
|
+
const resolvedState = resolveState({
|
|
183
|
+
state: stateProp,
|
|
184
|
+
disabled,
|
|
185
|
+
error,
|
|
186
|
+
focused,
|
|
187
|
+
hasValue,
|
|
188
|
+
});
|
|
189
|
+
const chrome = chromeFor(resolvedState);
|
|
190
|
+
const isDisabled = resolvedState === "disabled" || disabled;
|
|
191
|
+
|
|
192
|
+
const hasLeftIcon = showLeftIcon || leftIcon != null;
|
|
193
|
+
const hasRightIcon = showRightIcon || rightIcon != null;
|
|
194
|
+
|
|
195
|
+
const leftIconNode = leftIcon ?? (
|
|
196
|
+
<UserIcon size={metrics.iconSize} color={chrome.leftIconColor} />
|
|
197
|
+
);
|
|
198
|
+
const rightIconNode = rightIcon ?? (
|
|
199
|
+
<ShowIcon size={metrics.iconSize} color={chrome.rightIconColor} />
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
useApplyWebClassName(rootRef, className);
|
|
203
|
+
useApplyWebClassName(inputRef, inputClassName);
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<View ref={rootRef} style={[styles.root, isDisabled && styles.disabled, style]}>
|
|
207
|
+
{showLabel && label ? (
|
|
208
|
+
<Text style={[styles.label, { color: chrome.labelColor }]}>{label}</Text>
|
|
209
|
+
) : null}
|
|
210
|
+
|
|
211
|
+
<View
|
|
212
|
+
style={[
|
|
213
|
+
styles.field,
|
|
214
|
+
{
|
|
215
|
+
height: metrics.height,
|
|
216
|
+
borderRadius: metrics.borderRadius,
|
|
217
|
+
paddingTop: metrics.paddingVertical,
|
|
218
|
+
paddingBottom: metrics.paddingVertical,
|
|
219
|
+
paddingLeft: metrics.paddingHorizontal,
|
|
220
|
+
paddingRight: metrics.paddingHorizontal,
|
|
221
|
+
gap: metrics.gap,
|
|
222
|
+
borderColor: chrome.borderColor,
|
|
223
|
+
backgroundColor: chrome.backgroundColor,
|
|
224
|
+
},
|
|
225
|
+
fieldStyle,
|
|
226
|
+
]}
|
|
227
|
+
>
|
|
228
|
+
{hasLeftIcon ? (
|
|
229
|
+
<View style={[styles.iconSlot, { width: metrics.iconSize, height: metrics.iconSize }]}>
|
|
230
|
+
{leftIconNode}
|
|
231
|
+
</View>
|
|
232
|
+
) : null}
|
|
233
|
+
|
|
234
|
+
<TextInput
|
|
235
|
+
ref={inputRef}
|
|
236
|
+
{...textInputProps}
|
|
237
|
+
value={isControlled ? value : undefined}
|
|
238
|
+
defaultValue={isControlled ? undefined : defaultValue}
|
|
239
|
+
editable={!isDisabled}
|
|
240
|
+
placeholder={placeholder}
|
|
241
|
+
placeholderTextColor={chrome.placeholderColor}
|
|
242
|
+
onChangeText={(text) => {
|
|
243
|
+
if (!isControlled) setUncontrolledValue(text);
|
|
244
|
+
onChangeText?.(text);
|
|
245
|
+
}}
|
|
246
|
+
onFocus={(event) => {
|
|
247
|
+
setFocused(true);
|
|
248
|
+
onFocus?.(event);
|
|
249
|
+
}}
|
|
250
|
+
onBlur={(event) => {
|
|
251
|
+
setFocused(false);
|
|
252
|
+
onBlur?.(event);
|
|
253
|
+
}}
|
|
254
|
+
style={[
|
|
255
|
+
styles.input,
|
|
256
|
+
metrics.text,
|
|
257
|
+
{ color: chrome.textColor },
|
|
258
|
+
Platform.OS === "web" ? styles.inputWeb : null,
|
|
259
|
+
Platform.OS === "android" ? styles.inputAndroid : null,
|
|
260
|
+
inputStyle,
|
|
261
|
+
]}
|
|
262
|
+
accessibilityState={{ disabled: isDisabled }}
|
|
263
|
+
/>
|
|
264
|
+
|
|
265
|
+
{hasRightIcon ? (
|
|
266
|
+
onRightIconPress ? (
|
|
267
|
+
<TouchableOpacity
|
|
268
|
+
onPress={onRightIconPress}
|
|
269
|
+
disabled={isDisabled}
|
|
270
|
+
style={[styles.iconSlot, { width: metrics.iconSize, height: metrics.iconSize }]}
|
|
271
|
+
accessibilityRole="button"
|
|
272
|
+
hitSlop={8}
|
|
273
|
+
>
|
|
274
|
+
{rightIconNode}
|
|
275
|
+
</TouchableOpacity>
|
|
276
|
+
) : (
|
|
277
|
+
<View style={[styles.iconSlot, { width: metrics.iconSize, height: metrics.iconSize }]}>
|
|
278
|
+
{rightIconNode}
|
|
279
|
+
</View>
|
|
280
|
+
)
|
|
281
|
+
) : null}
|
|
282
|
+
</View>
|
|
283
|
+
|
|
284
|
+
{showHint && hint ? (
|
|
285
|
+
<Text style={[styles.hint, { color: chrome.hintColor }]}>{hint}</Text>
|
|
286
|
+
) : null}
|
|
287
|
+
</View>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const styles = StyleSheet.create({
|
|
292
|
+
root: {
|
|
293
|
+
width: DEFAULT_WIDTH,
|
|
294
|
+
gap: 8,
|
|
295
|
+
alignSelf: "flex-start",
|
|
296
|
+
},
|
|
297
|
+
disabled: {
|
|
298
|
+
opacity: 0.6,
|
|
299
|
+
},
|
|
300
|
+
label: {
|
|
301
|
+
...inputTypography.label,
|
|
302
|
+
},
|
|
303
|
+
field: {
|
|
304
|
+
borderWidth: 1,
|
|
305
|
+
flexDirection: "row",
|
|
306
|
+
alignItems: "center",
|
|
307
|
+
},
|
|
308
|
+
input: {
|
|
309
|
+
flex: 1,
|
|
310
|
+
paddingVertical: 0,
|
|
311
|
+
margin: 0,
|
|
312
|
+
},
|
|
313
|
+
inputWeb: {
|
|
314
|
+
outlineStyle: "none",
|
|
315
|
+
} as TextStyle,
|
|
316
|
+
inputAndroid: {
|
|
317
|
+
includeFontPadding: false,
|
|
318
|
+
},
|
|
319
|
+
iconSlot: {
|
|
320
|
+
alignItems: "center",
|
|
321
|
+
justifyContent: "center",
|
|
322
|
+
flexShrink: 0,
|
|
323
|
+
},
|
|
324
|
+
hint: {
|
|
325
|
+
...inputTypography.hint,
|
|
326
|
+
},
|
|
327
|
+
});
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import Svg, { Path } from "react-native-svg";
|
|
2
|
-
import {
|
|
2
|
+
import { ARROW_RIGHT_PATH } from "./arrowRightPath";
|
|
3
|
+
import { colors } from "../../theme";
|
|
3
4
|
|
|
4
|
-
export {
|
|
5
|
+
export { ARROW_RIGHT_PATH } from "./arrowRightPath";
|
|
5
6
|
|
|
6
|
-
interface
|
|
7
|
+
interface ArrowRightIconProps {
|
|
7
8
|
size?: number;
|
|
8
9
|
color?: string;
|
|
9
10
|
strokeWidth?: number;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
/** Native — react-native-svg (peer dependency). */
|
|
13
|
-
export function
|
|
14
|
+
export function ArrowRightIcon({
|
|
14
15
|
size = 20,
|
|
15
|
-
color =
|
|
16
|
+
color = colors.primary,
|
|
16
17
|
strokeWidth = 2,
|
|
17
|
-
}:
|
|
18
|
+
}: ArrowRightIconProps) {
|
|
18
19
|
return (
|
|
19
20
|
<Svg width={size} height={size} viewBox="0 0 20 20" fill="none">
|
|
20
21
|
<Path
|
|
21
|
-
d={
|
|
22
|
+
d={ARROW_RIGHT_PATH}
|
|
22
23
|
stroke={color}
|
|
23
24
|
strokeWidth={strokeWidth}
|
|
24
25
|
strokeLinecap="round"
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ARROW_RIGHT_PATH } from "./arrowRightPath";
|
|
2
|
+
import { colors } from "../../theme";
|
|
2
3
|
|
|
3
|
-
interface
|
|
4
|
+
interface ArrowRightIconProps {
|
|
4
5
|
size?: number;
|
|
5
6
|
color?: string;
|
|
6
7
|
strokeWidth?: number;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
/** Web / Storybook — plain SVG (no react-native-svg). */
|
|
10
|
-
export function
|
|
11
|
+
export function ArrowRightIcon({
|
|
11
12
|
size = 20,
|
|
12
|
-
color =
|
|
13
|
+
color = colors.primary,
|
|
13
14
|
strokeWidth = 2,
|
|
14
|
-
}:
|
|
15
|
+
}: ArrowRightIconProps) {
|
|
15
16
|
return (
|
|
16
17
|
<svg
|
|
17
18
|
width={size}
|
|
@@ -22,7 +23,7 @@ export function ArrowUpRightIcon({
|
|
|
22
23
|
aria-hidden
|
|
23
24
|
>
|
|
24
25
|
<path
|
|
25
|
-
d={
|
|
26
|
+
d={ARROW_RIGHT_PATH}
|
|
26
27
|
stroke={color}
|
|
27
28
|
strokeWidth={strokeWidth}
|
|
28
29
|
strokeLinecap="round"
|
|
@@ -32,4 +33,4 @@ export function ArrowUpRightIcon({
|
|
|
32
33
|
);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export {
|
|
36
|
+
export { ARROW_RIGHT_PATH } from "./arrowRightPath";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ArrowRightIcon, ARROW_RIGHT_PATH } from "./ArrowRightIcon";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Svg, { Path } from "react-native-svg";
|
|
2
|
+
import { BAG_PATH } from "./bagPath";
|
|
3
|
+
import { colors } from "../../theme";
|
|
4
|
+
import type { IconProps } from "../types";
|
|
5
|
+
|
|
6
|
+
export { BAG_PATH } from "./bagPath";
|
|
7
|
+
|
|
8
|
+
export function BagIcon({ size = 24, color = colors.primary, strokeWidth = 2 }: IconProps) {
|
|
9
|
+
return (
|
|
10
|
+
<Svg width={size} height={size} viewBox="0 0 24 24" fill="none">
|
|
11
|
+
<Path
|
|
12
|
+
d={BAG_PATH}
|
|
13
|
+
stroke={color}
|
|
14
|
+
strokeWidth={strokeWidth}
|
|
15
|
+
strokeLinecap="round"
|
|
16
|
+
strokeLinejoin="round"
|
|
17
|
+
/>
|
|
18
|
+
</Svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BAG_PATH } from "./bagPath";
|
|
2
|
+
import { colors } from "../../theme";
|
|
3
|
+
import type { IconProps } from "../types";
|
|
4
|
+
|
|
5
|
+
export function BagIcon({ size = 24, color = colors.primary, strokeWidth = 2 }: IconProps) {
|
|
6
|
+
return (
|
|
7
|
+
<svg
|
|
8
|
+
width={size}
|
|
9
|
+
height={size}
|
|
10
|
+
viewBox="0 0 24 24"
|
|
11
|
+
fill="none"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
aria-hidden
|
|
14
|
+
>
|
|
15
|
+
<path
|
|
16
|
+
d={BAG_PATH}
|
|
17
|
+
stroke={color}
|
|
18
|
+
strokeWidth={strokeWidth}
|
|
19
|
+
strokeLinecap="round"
|
|
20
|
+
strokeLinejoin="round"
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { BAG_PATH } from "./bagPath";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export const BAG_PATH =
|
|
2
|
+
"M9.23047 9H7.2002C6.08009 9 5.51962 9 5.0918 9.21799C4.71547 9.40973 4.40973 9.71547 4.21799 10.0918C4 10.5196 4 11.0801 4 12.2002V17.8002C4 18.9203 4 19.4801 4.21799 19.9079C4.40973 20.2842 4.71547 20.5905 5.0918 20.7822C5.5192 21 6.07902 21 7.19694 21H16.8031C17.921 21 18.48 21 18.9074 20.7822C19.2837 20.5905 19.5905 20.2842 19.7822 19.9079C20 19.4805 20 18.9215 20 17.8036V12.1969C20 11.079 20 10.5192 19.7822 10.0918C19.5905 9.71547 19.2837 9.40973 18.9074 9.21799C18.4796 9 17.9203 9 16.8002 9H14.7689M9.23047 9H14.7689M9.23047 9C9.10302 9 9 8.89668 9 8.76923V6C9 4.34315 10.3431 3 12 3C13.6569 3 15 4.34315 15 6V8.76923C15 8.89668 14.8964 9 14.7689 9";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BagIcon, BAG_PATH } from "./BagIcon";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Svg, { Path } from "react-native-svg";
|
|
2
|
+
import { BELL_PATH } from "./bellPath";
|
|
3
|
+
import { colors } from "../../theme";
|
|
4
|
+
import type { IconProps } from "../types";
|
|
5
|
+
|
|
6
|
+
export { BELL_PATH } from "./bellPath";
|
|
7
|
+
|
|
8
|
+
export function BellIcon({ size = 20, color = colors.primary, strokeWidth = 2 }: IconProps) {
|
|
9
|
+
return (
|
|
10
|
+
<Svg width={size} height={size} viewBox="0 0 20 20" fill="none">
|
|
11
|
+
<Path
|
|
12
|
+
d={BELL_PATH}
|
|
13
|
+
stroke={color}
|
|
14
|
+
strokeWidth={strokeWidth}
|
|
15
|
+
strokeLinecap="round"
|
|
16
|
+
strokeLinejoin="round"
|
|
17
|
+
/>
|
|
18
|
+
</Svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BELL_PATH } from "./bellPath";
|
|
2
|
+
import { colors } from "../../theme";
|
|
3
|
+
import type { IconProps } from "../types";
|
|
4
|
+
|
|
5
|
+
export function BellIcon({ size = 20, color = colors.primary, strokeWidth = 2 }: IconProps) {
|
|
6
|
+
return (
|
|
7
|
+
<svg
|
|
8
|
+
width={size}
|
|
9
|
+
height={size}
|
|
10
|
+
viewBox="0 0 20 20"
|
|
11
|
+
fill="none"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
aria-hidden
|
|
14
|
+
>
|
|
15
|
+
<path
|
|
16
|
+
d={BELL_PATH}
|
|
17
|
+
stroke={color}
|
|
18
|
+
strokeWidth={strokeWidth}
|
|
19
|
+
strokeLinecap="round"
|
|
20
|
+
strokeLinejoin="round"
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { BELL_PATH } from "./bellPath";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export const BELL_PATH =
|
|
2
|
+
"M7.5 17.5H12.5M10 2.5C7.23858 2.5 5 4.73858 5 7.5C5 8.51208 5.3007 9.45393 5.81764 10.2411C6.61256 11.4515 7.00967 12.0564 7.06127 12.1467C7.52024 12.9508 7.43573 12.6672 7.49349 13.5913C7.49998 13.6952 7.5 13.8524 7.5 14.1667C7.5 14.6269 7.8731 15 8.33333 15L11.6667 15C12.1269 15 12.5 14.6269 12.5 14.1667C12.5 13.8524 12.5 13.6952 12.5065 13.5913C12.5643 12.6672 12.4793 12.9509 12.9382 12.1467C12.9898 12.0564 13.3876 11.4515 14.1825 10.2411C14.6995 9.45393 15.0002 8.51208 15.0002 7.5C15.0002 4.73858 12.7614 2.5 10 2.5Z";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BellIcon, BELL_PATH } from "./BellIcon";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Svg, { Path } from "react-native-svg";
|
|
2
|
+
import { BUILDING_PATH } from "./buildingPath";
|
|
3
|
+
import { colors } from "../../theme";
|
|
4
|
+
import type { IconProps } from "../types";
|
|
5
|
+
|
|
6
|
+
export { BUILDING_PATH } from "./buildingPath";
|
|
7
|
+
|
|
8
|
+
export function BuildingIcon({ size = 20, color = colors.primary, strokeWidth = 2 }: IconProps) {
|
|
9
|
+
return (
|
|
10
|
+
<Svg width={size} height={size} viewBox="0 0 20 20" fill="none">
|
|
11
|
+
<Path
|
|
12
|
+
d={BUILDING_PATH}
|
|
13
|
+
stroke={color}
|
|
14
|
+
strokeWidth={strokeWidth}
|
|
15
|
+
strokeLinecap="round"
|
|
16
|
+
strokeLinejoin="round"
|
|
17
|
+
/>
|
|
18
|
+
</Svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BUILDING_PATH } from "./buildingPath";
|
|
2
|
+
import { colors } from "../../theme";
|
|
3
|
+
import type { IconProps } from "../types";
|
|
4
|
+
|
|
5
|
+
export function BuildingIcon({ size = 20, color = colors.primary, strokeWidth = 2 }: IconProps) {
|
|
6
|
+
return (
|
|
7
|
+
<svg
|
|
8
|
+
width={size}
|
|
9
|
+
height={size}
|
|
10
|
+
viewBox="0 0 20 20"
|
|
11
|
+
fill="none"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
aria-hidden
|
|
14
|
+
>
|
|
15
|
+
<path
|
|
16
|
+
d={BUILDING_PATH}
|
|
17
|
+
stroke={color}
|
|
18
|
+
strokeWidth={strokeWidth}
|
|
19
|
+
strokeLinecap="round"
|
|
20
|
+
strokeLinejoin="round"
|
|
21
|
+
/>
|
|
22
|
+
</svg>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { BUILDING_PATH } from "./buildingPath";
|