@ecohouse/ui 0.1.2 → 0.1.4

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 (74) hide show
  1. package/dist/index.cjs +1734 -155
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +287 -13
  4. package/dist/index.d.ts +287 -13
  5. package/dist/index.js +1720 -159
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/components/Avatar/Avatar.stories.tsx +133 -0
  9. package/src/components/Avatar/Avatar.tsx +389 -0
  10. package/src/components/Avatar/index.ts +2 -0
  11. package/src/components/Button/Button.tsx +106 -88
  12. package/src/components/Checkbox/Checkbox.stories.tsx +112 -0
  13. package/src/components/Checkbox/Checkbox.tsx +150 -0
  14. package/src/components/Checkbox/index.ts +2 -0
  15. package/src/components/Input/Input.stories.tsx +11 -40
  16. package/src/components/Input/Input.tsx +58 -54
  17. package/src/components/Input/index.ts +1 -1
  18. package/src/components/Select/Select.stories.tsx +196 -0
  19. package/src/components/Select/Select.tsx +851 -0
  20. package/src/components/Select/index.ts +2 -0
  21. package/src/components/Textarea/Textarea.stories.tsx +71 -0
  22. package/src/components/Textarea/Textarea.tsx +241 -0
  23. package/src/components/Textarea/index.ts +2 -0
  24. package/src/components/Toggle/Toggle.stories.tsx +100 -0
  25. package/src/components/Toggle/Toggle.tsx +176 -0
  26. package/src/components/Toggle/index.ts +2 -0
  27. package/src/components/index.ts +16 -1
  28. package/src/icons/Calendar/CalendarIcon.tsx +21 -0
  29. package/src/icons/Calendar/CalendarIcon.web.tsx +27 -0
  30. package/src/icons/Calendar/calendarPath.ts +3 -0
  31. package/src/icons/Calendar/index.ts +1 -0
  32. package/src/icons/Check/CheckIcon.tsx +26 -0
  33. package/src/icons/Check/CheckIcon.web.tsx +32 -0
  34. package/src/icons/Check/checkPath.ts +2 -0
  35. package/src/icons/Check/index.ts +1 -0
  36. package/src/icons/ChevronDown/ChevronDownIcon.tsx +30 -0
  37. package/src/icons/ChevronDown/ChevronDownIcon.web.tsx +36 -0
  38. package/src/icons/ChevronDown/chevronDownPath.ts +2 -0
  39. package/src/icons/ChevronDown/index.ts +1 -0
  40. package/src/icons/Heart/HeartIcon.tsx +23 -0
  41. package/src/icons/Heart/HeartIcon.web.tsx +29 -0
  42. package/src/icons/Heart/heartPath.ts +3 -0
  43. package/src/icons/Heart/index.ts +1 -0
  44. package/src/icons/HelpCircle/HelpCircleIcon.tsx +25 -0
  45. package/src/icons/HelpCircle/HelpCircleIcon.web.tsx +31 -0
  46. package/src/icons/HelpCircle/helpCirclePath.ts +3 -0
  47. package/src/icons/HelpCircle/index.ts +1 -0
  48. package/src/icons/LayoutGrid/LayoutGridIcon.tsx +25 -0
  49. package/src/icons/LayoutGrid/LayoutGridIcon.web.tsx +31 -0
  50. package/src/icons/LayoutGrid/index.ts +1 -0
  51. package/src/icons/LayoutGrid/layoutGridPath.ts +3 -0
  52. package/src/icons/LogOut/LogOutIcon.tsx +21 -0
  53. package/src/icons/LogOut/LogOutIcon.web.tsx +27 -0
  54. package/src/icons/LogOut/index.ts +1 -0
  55. package/src/icons/LogOut/logOutPath.ts +3 -0
  56. package/src/icons/Search/SearchIcon.tsx +37 -0
  57. package/src/icons/Search/SearchIcon.web.tsx +43 -0
  58. package/src/icons/Search/index.ts +1 -0
  59. package/src/icons/Search/searchPath.ts +5 -0
  60. package/src/icons/Settings/SettingsIcon.tsx +21 -0
  61. package/src/icons/Settings/SettingsIcon.web.tsx +27 -0
  62. package/src/icons/Settings/index.ts +1 -0
  63. package/src/icons/Settings/settingsPath.ts +3 -0
  64. package/src/icons/Video/VideoIcon.tsx +24 -0
  65. package/src/icons/Video/VideoIcon.web.tsx +30 -0
  66. package/src/icons/Video/index.ts +1 -0
  67. package/src/icons/Video/videoPath.ts +5 -0
  68. package/src/icons/index.ts +10 -0
  69. package/src/icons/registry.ts +24 -3
  70. package/src/index.ts +31 -3
  71. package/src/theme/colors.ts +1 -0
  72. package/src/theme/index.ts +8 -1
  73. package/src/theme/typography.ts +77 -2
  74. package/src/utils/mergeRefs.ts +20 -0
@@ -2,19 +2,29 @@ import { ArrowRightIcon } from "./ArrowRight";
2
2
  import { BagIcon } from "./Bag";
3
3
  import { BellIcon } from "./Bell";
4
4
  import { BuildingIcon } from "./Building";
5
+ import { CalendarIcon } from "./Calendar";
5
6
  import { CameraIcon } from "./Camera";
7
+ import { CheckIcon } from "./Check";
6
8
  import { CheckBadgeIcon } from "./CheckBadge";
9
+ import { ChevronDownIcon } from "./ChevronDown";
7
10
  import { ClockIcon } from "./Clock";
8
11
  import { FacebookIcon } from "./Facebook";
12
+ import { HeartIcon } from "./Heart";
13
+ import { HelpCircleIcon } from "./HelpCircle";
9
14
  import { HomeIcon } from "./Home";
10
15
  import { InstagramIcon } from "./Instagram";
11
16
  import { KeyIcon } from "./Key";
17
+ import { LayoutGridIcon } from "./LayoutGrid";
12
18
  import { LinkedInIcon } from "./LinkedIn";
19
+ import { LogOutIcon } from "./LogOut";
13
20
  import { MailIcon } from "./Mail";
14
21
  import { NavigateIcon } from "./Navigate";
15
22
  import { PhoneIcon } from "./Phone";
23
+ import { SearchIcon } from "./Search";
24
+ import { SettingsIcon } from "./Settings";
16
25
  import { ShowIcon } from "./Show";
17
26
  import { UserIcon } from "./User";
27
+ import { VideoIcon } from "./Video";
18
28
  import type { IconComponent } from "./types";
19
29
 
20
30
  export const icons = {
@@ -22,19 +32,29 @@ export const icons = {
22
32
  bag: BagIcon,
23
33
  bell: BellIcon,
24
34
  building: BuildingIcon,
35
+ calendar: CalendarIcon,
25
36
  camera: CameraIcon,
37
+ check: CheckIcon,
26
38
  checkBadge: CheckBadgeIcon,
39
+ chevronDown: ChevronDownIcon,
27
40
  clock: ClockIcon,
28
41
  facebook: FacebookIcon,
42
+ heart: HeartIcon,
43
+ helpCircle: HelpCircleIcon,
29
44
  home: HomeIcon,
30
45
  instagram: InstagramIcon,
31
46
  key: KeyIcon,
47
+ layoutGrid: LayoutGridIcon,
32
48
  linkedin: LinkedInIcon,
49
+ logOut: LogOutIcon,
33
50
  mail: MailIcon,
34
51
  navigate: NavigateIcon,
35
52
  phone: PhoneIcon,
53
+ search: SearchIcon,
54
+ settings: SettingsIcon,
36
55
  show: ShowIcon,
37
56
  user: UserIcon,
57
+ video: VideoIcon,
38
58
  } as const satisfies Record<string, IconComponent>;
39
59
 
40
60
  export type IconName = keyof typeof icons;
@@ -42,11 +62,12 @@ export type IconName = keyof typeof icons;
42
62
  export const iconNames = Object.keys(icons) as IconName[];
43
63
 
44
64
  export const iconGroups = {
45
- navigation: ["arrowRight", "home", "navigate"],
46
- actions: ["show", "bell", "camera", "key", "checkBadge"],
47
- objects: ["bag", "building", "clock", "user"],
65
+ navigation: ["arrowRight", "chevronDown", "home", "navigate"],
66
+ actions: ["show", "bell", "camera", "key", "check", "checkBadge", "search", "calendar", "heart"],
67
+ objects: ["bag", "building", "clock", "user", "video"],
48
68
  communication: ["mail", "phone"],
49
69
  social: ["facebook", "instagram", "linkedin"],
70
+ interface: ["layoutGrid", "settings", "helpCircle", "logOut"],
50
71
  } as const satisfies Record<string, readonly IconName[]>;
51
72
 
52
73
  export type IconGroup = keyof typeof iconGroups;
package/src/index.ts CHANGED
@@ -1,11 +1,20 @@
1
- export { Button, Input } from "./components";
1
+ export { Avatar, Button, Checkbox, Input, Select, Textarea, Toggle } from "./components";
2
2
  export type {
3
+ AvatarProps,
4
+ AvatarMenuItem,
3
5
  ButtonProps,
4
6
  ButtonSize,
5
7
  ButtonVariant,
8
+ CheckboxProps,
9
+ CheckboxVariant,
6
10
  InputProps,
7
11
  InputSize,
8
- InputState,
12
+ SelectOption,
13
+ SelectProps,
14
+ SelectSingleProps,
15
+ SelectMultipleProps,
16
+ TextareaProps,
17
+ ToggleProps,
9
18
  } from "./components";
10
19
 
11
20
  export {
@@ -19,21 +28,40 @@ export {
19
28
  BagIcon,
20
29
  BellIcon,
21
30
  BuildingIcon,
31
+ CalendarIcon,
22
32
  CameraIcon,
33
+ CheckIcon,
23
34
  CheckBadgeIcon,
35
+ ChevronDownIcon,
24
36
  ClockIcon,
25
37
  FacebookIcon,
38
+ HeartIcon,
39
+ HelpCircleIcon,
26
40
  HomeIcon,
27
41
  InstagramIcon,
28
42
  KeyIcon,
43
+ LayoutGridIcon,
29
44
  LinkedInIcon,
45
+ LogOutIcon,
30
46
  MailIcon,
31
47
  NavigateIcon,
32
48
  PhoneIcon,
49
+ SearchIcon,
50
+ SettingsIcon,
33
51
  ShowIcon,
34
52
  UserIcon,
53
+ VideoIcon,
35
54
  } from "./icons";
36
55
  export type { IconProps, IconName, IconGroup, IconComponent, IconByNameProps } from "./icons";
37
56
 
38
- export { colors, grey, buttonTypography, inputTypography, fonts } from "./theme";
57
+ export {
58
+ colors,
59
+ grey,
60
+ avatarTypography,
61
+ buttonTypography,
62
+ inputTypography,
63
+ selectTypography,
64
+ textareaTypography,
65
+ fonts,
66
+ } from "./theme";
39
67
  export type { GreyStep } from "./theme";
@@ -27,6 +27,7 @@ export const colors = {
27
27
  lightGrey: "#B7B7B7",
28
28
  primaryMuted: "#B464360F",
29
29
  redMuted: "#A63E3E0F",
30
+ redHover: "#A63E3E33",
30
31
 
31
32
  grey0: grey["0"],
32
33
  grey50: grey["0.5"],
@@ -1,4 +1,11 @@
1
1
  export { colors, grey } from "./colors";
2
2
  export type { GreyStep } from "./colors";
3
3
 
4
- export { fonts, buttonTypography, inputTypography } from "./typography";
4
+ export {
5
+ fonts,
6
+ avatarTypography,
7
+ buttonTypography,
8
+ inputTypography,
9
+ selectTypography,
10
+ textareaTypography,
11
+ } from "./typography";
@@ -26,9 +26,34 @@ export const inputTypography = {
26
26
  fontFamily: fonts.sans,
27
27
  fontSize: 12,
28
28
  fontWeight: "500" as const,
29
- lineHeight: 16,
29
+ lineHeight: 12,
30
+ letterSpacing: 0.36,
31
+ },
32
+ field: {
33
+ fontFamily: fonts.sans,
34
+ fontSize: 14,
35
+ fontWeight: "400" as const,
36
+ lineHeight: 19,
30
37
  letterSpacing: 0,
31
38
  },
39
+ hint: {
40
+ fontFamily: fonts.sans,
41
+ fontSize: 12,
42
+ fontWeight: "400" as const,
43
+ lineHeight: 12,
44
+ letterSpacing: 0.36,
45
+ },
46
+ } as const;
47
+
48
+ /** Select label / field / hint typography — Medium/Regular 12–14, letter-spacing 3%. */
49
+ export const selectTypography = {
50
+ label: {
51
+ fontFamily: fonts.sans,
52
+ fontSize: 12,
53
+ fontWeight: "500" as const,
54
+ lineHeight: 12,
55
+ letterSpacing: 0.36,
56
+ },
32
57
  field: {
33
58
  fontFamily: fonts.sans,
34
59
  fontSize: 14,
@@ -40,7 +65,57 @@ export const inputTypography = {
40
65
  fontFamily: fonts.sans,
41
66
  fontSize: 12,
42
67
  fontWeight: "400" as const,
43
- lineHeight: 16,
68
+ lineHeight: 12,
69
+ letterSpacing: 0.36,
70
+ },
71
+ } as const;
72
+
73
+ /** Avatar name / email / menu-item typography — 100% line-height, 0 letter-spacing. */
74
+ export const avatarTypography = {
75
+ name: {
76
+ fontFamily: fonts.sans,
77
+ fontSize: 14,
78
+ fontWeight: "600" as const,
79
+ lineHeight: 14,
80
+ letterSpacing: 0,
81
+ },
82
+ email: {
83
+ fontFamily: fonts.sans,
84
+ fontSize: 12,
85
+ fontWeight: "400" as const,
86
+ lineHeight: 12,
87
+ letterSpacing: 0,
88
+ },
89
+ menuItem: {
90
+ fontFamily: fonts.sans,
91
+ fontSize: 12,
92
+ fontWeight: "600" as const,
93
+ lineHeight: 12,
94
+ letterSpacing: 0,
95
+ },
96
+ } as const;
97
+
98
+ /** Textarea label / field / hint typography — Medium/Regular 12–14, letter-spacing 3%. */
99
+ export const textareaTypography = {
100
+ label: {
101
+ fontFamily: fonts.sans,
102
+ fontSize: 12,
103
+ fontWeight: "500" as const,
104
+ lineHeight: 12,
105
+ letterSpacing: 0.36,
106
+ },
107
+ field: {
108
+ fontFamily: fonts.sans,
109
+ fontSize: 14,
110
+ fontWeight: "400" as const,
111
+ lineHeight: 19,
44
112
  letterSpacing: 0,
45
113
  },
114
+ hint: {
115
+ fontFamily: fonts.sans,
116
+ fontSize: 12,
117
+ fontWeight: "400" as const,
118
+ lineHeight: 12,
119
+ letterSpacing: 0.36,
120
+ },
46
121
  } as const;
@@ -0,0 +1,20 @@
1
+ import type { ForwardedRef, MutableRefObject, RefCallback } from "react";
2
+
3
+ /**
4
+ * Combines a component's internal ref (used e.g. by `useApplyWebClassName`)
5
+ * with an optional externally-forwarded ref, so consumers can still call
6
+ * `.focus()`/`.measure()` on the underlying native node via `ref`.
7
+ */
8
+ export function mergeRefs<T>(
9
+ internalRef: MutableRefObject<T | null>,
10
+ forwardedRef: ForwardedRef<T>,
11
+ ): RefCallback<T> {
12
+ return (node) => {
13
+ internalRef.current = node;
14
+ if (typeof forwardedRef === "function") {
15
+ forwardedRef(node);
16
+ } else if (forwardedRef) {
17
+ forwardedRef.current = node;
18
+ }
19
+ };
20
+ }