@ecohouse/ui 0.1.4 → 0.1.6

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 (61) hide show
  1. package/README.md +66 -15
  2. package/dist/index.cjs +1293 -147
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +358 -154
  5. package/dist/index.d.ts +358 -154
  6. package/dist/index.js +1278 -149
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/components/Avatar/Avatar.tsx +19 -71
  10. package/src/components/Badge/Badge.stories.tsx +52 -0
  11. package/src/components/Badge/Badge.tsx +131 -0
  12. package/src/components/Badge/index.ts +2 -0
  13. package/src/components/Counter/Counter.stories.tsx +46 -0
  14. package/src/components/Counter/Counter.tsx +135 -0
  15. package/src/components/Counter/index.ts +2 -0
  16. package/src/components/DatePicker/DatePicker.stories.tsx +172 -0
  17. package/src/components/DatePicker/DatePicker.tsx +628 -0
  18. package/src/components/DatePicker/index.ts +7 -0
  19. package/src/components/SegmentedToggle/SegmentedToggle.stories.tsx +63 -0
  20. package/src/components/SegmentedToggle/SegmentedToggle.tsx +221 -0
  21. package/src/components/SegmentedToggle/index.ts +2 -0
  22. package/src/components/StatCard/StatCard.stories.tsx +20 -0
  23. package/src/components/StatCard/StatCard.tsx +61 -0
  24. package/src/components/StatCard/index.ts +2 -0
  25. package/src/components/index.ts +20 -0
  26. package/src/icons/CalendarOutline/CalendarOutlineIcon.tsx +25 -0
  27. package/src/icons/CalendarOutline/CalendarOutlineIcon.web.tsx +31 -0
  28. package/src/icons/CalendarOutline/calendarOutlinePath.ts +3 -0
  29. package/src/icons/CalendarOutline/index.ts +1 -0
  30. package/src/icons/ChevronLeft/ChevronLeftIcon.tsx +21 -0
  31. package/src/icons/ChevronLeft/ChevronLeftIcon.web.tsx +27 -0
  32. package/src/icons/ChevronLeft/chevronLeftPath.ts +2 -0
  33. package/src/icons/ChevronLeft/index.ts +1 -0
  34. package/src/icons/Minus/MinusIcon.tsx +20 -0
  35. package/src/icons/Minus/MinusIcon.web.tsx +19 -0
  36. package/src/icons/Minus/index.ts +1 -0
  37. package/src/icons/Minus/minusPath.ts +1 -0
  38. package/src/icons/Plus/PlusIcon.tsx +20 -0
  39. package/src/icons/Plus/PlusIcon.web.tsx +19 -0
  40. package/src/icons/Plus/index.ts +1 -0
  41. package/src/icons/Plus/plusPath.ts +1 -0
  42. package/src/icons/Sidebar/SidebarIcon.tsx +21 -0
  43. package/src/icons/Sidebar/SidebarIcon.web.tsx +27 -0
  44. package/src/icons/Sidebar/index.ts +1 -0
  45. package/src/icons/Sidebar/sidebarPath.ts +3 -0
  46. package/src/icons/UsersAlt/UsersAltIcon.tsx +14 -0
  47. package/src/icons/UsersAlt/UsersAltIcon.web.tsx +13 -0
  48. package/src/icons/UsersAlt/index.ts +1 -0
  49. package/src/icons/UsersAlt/usersAltPath.ts +2 -0
  50. package/src/icons/index.ts +6 -0
  51. package/src/icons/registry.ts +29 -4
  52. package/src/index.ts +38 -1
  53. package/src/primitives/MenuItem/MenuItem.stories.tsx +98 -0
  54. package/src/primitives/MenuItem/MenuItem.tsx +138 -0
  55. package/src/primitives/MenuItem/index.ts +2 -0
  56. package/src/primitives/index.ts +2 -0
  57. package/src/theme/colors.test.ts +6 -0
  58. package/src/theme/colors.ts +7 -0
  59. package/src/theme/index.ts +5 -0
  60. package/src/theme/typography.ts +76 -0
  61. package/src/utils/dateUtils.ts +86 -0
package/README.md CHANGED
@@ -4,11 +4,28 @@ Cross-platform UI component library for EcoHouse. Built with React Native primit
4
4
 
5
5
  ## Components
6
6
 
7
- | Component | Description |
8
- | --------- | --------------------------------------------------------------------------- |
9
- | `Button` | Pill CTA — `primary` / `secondary`, sizes `lg` / `sm`, optional arrow badge |
10
- | `Input` | Text field with label, hint, left/right icons, error & disabled states |
11
- | `Icon` | Dynamic icon by name from the registry (`<Icon name="user" />`) |
7
+ | Component | Description |
8
+ | ------------ | ----------------------------------------------------------------------------- |
9
+ | `Button` | Pill CTA — `primary` / `secondary`, sizes `lg` / `sm`, optional arrow badge |
10
+ | `Badge` | Pill label chip `default` / `transparent`, optional leading icon |
11
+ | `Input` | Text field with label, hint, left/right icons, error & disabled states |
12
+ | `Checkbox` | Square checkbox with optional label, controlled or uncontrolled |
13
+ | `Toggle` | Animated on/off switch with optional label |
14
+ | `Select` | Single/multi-select dropdown with search and keyboard navigation |
15
+ | `DatePicker` | Single/range calendar dropdown with month navigation and min/max bounds |
16
+ | `Textarea` | Multi-line text field, same label/hint/state chrome as `Input` |
17
+ | `Avatar` | Logged-in user chip (image/name/email) with an optional account dropdown menu |
18
+ | `Icon` | Dynamic icon by name from the registry (`<Icon name="user" />`) |
19
+
20
+ ## Primitives
21
+
22
+ Small reusable building blocks (Storybook: **Primitives /***):
23
+
24
+ | Component | Description |
25
+ | ---------- | ----------------------------------------------------------------------- |
26
+ | `MenuItem` | Option row (icon + label + action) — used in Avatar menus or standalone |
27
+
28
+ Full props: [`docs/components.md`](./docs/components.md).
12
29
 
13
30
  Named icon exports (`UserIcon`, `HomeIcon`, …) are also available. Full icon list: [`docs/icons.md`](./docs/icons.md).
14
31
 
@@ -107,13 +124,15 @@ import "@ecohouse/ui/web/typography.css";
107
124
  ## Usage
108
125
 
109
126
  ```tsx
110
- import { Button, Input, Icon, UserIcon, ShowIcon, colors } from "@ecohouse/ui";
127
+ import { Button, Badge, Input, Icon, HomeIcon, UserIcon, ShowIcon, colors } from "@ecohouse/ui";
111
128
 
112
129
  export function Example() {
113
130
  return (
114
131
  <>
115
132
  <Button title="Continue" variant="primary" size="lg" showIcon onPress={() => {}} />
116
133
 
134
+ <Badge label="Home" icon={HomeIcon} variant="transparent" />
135
+
117
136
  <Input
118
137
  label="Password"
119
138
  placeholder="••••••••"
@@ -135,6 +154,8 @@ Same API on web and mobile.
135
154
 
136
155
  ## API
137
156
 
157
+ Quick reference for `Button`, `Badge`, `Input`, and `Icon` below. Full API for `Checkbox`, `Toggle`, `Select`, `DatePicker`, `Textarea`, `Avatar`, and `MenuItem` lives in [`docs/components.md`](./docs/components.md).
158
+
138
159
  ### `Button`
139
160
 
140
161
  Pill CTA — sizes `lg` (44px) / `sm` (32px). Secondary fill uses `colors.grey500`.
@@ -154,6 +175,26 @@ Pill CTA — sizes `lg` (44px) / `sm` (32px). Secondary fill uses `colors.grey50
154
175
  <Button title="Cancel" variant="secondary" size="sm" onPress={() => {}} />
155
176
  ```
156
177
 
178
+ ### `Badge`
179
+
180
+ Pill label chip — `default` / `transparent`. Optional leading `HomeIcon` (color follows the variant).
181
+
182
+ | Prop | Type | Default | Description |
183
+ | --------- | ---------------------------- | ----------- | -------------------------- |
184
+ | `label` | `string` | required | Chip text |
185
+ | `variant` | `"default" \| "transparent"` | `"default"` | Fill / border / icon color |
186
+ | `icon` | `IconComponent` | — | Optional leading icon |
187
+
188
+ | Variant | Fill | Border | Icon color |
189
+ | ------------- | --------- | --------------- | ---------- |
190
+ | `default` | `grey750` | none | white |
191
+ | `transparent` | white 5% | 1px `#FFFFFF0D` | primary |
192
+
193
+ ```tsx
194
+ <Badge label="Label" />
195
+ <Badge label="Label" icon={HomeIcon} variant="transparent" />
196
+ ```
197
+
157
198
  ### `Input`
158
199
 
159
200
  Extends React Native `TextInput` props. Default size `lg` (44px pill, radius 60).
@@ -198,17 +239,27 @@ More: [`docs/icons.md`](./docs/icons.md), [`docs/components.md`](./docs/componen
198
239
  ## Design tokens
199
240
 
200
241
  ```tsx
201
- import { colors, grey, fonts, buttonTypography, inputTypography } from "@ecohouse/ui";
242
+ import {
243
+ colors,
244
+ grey,
245
+ fonts,
246
+ badgeTypography,
247
+ buttonTypography,
248
+ inputTypography,
249
+ } from "@ecohouse/ui";
202
250
  ```
203
251
 
204
- | Token | Value | Use |
205
- | ------------------- | --------------- | -------------------------- |
206
- | `primary` | `#B46436` | Brand / active left icon |
207
- | `primaryMuted` | `#B464360F` | Input active border |
208
- | `red` | `#A63E3E` | Error text / icons |
209
- | `redMuted` | `#A63E3E0F` | Input error border |
210
- | `black` / `white` | `#000` / `#fff` | Surfaces / labels |
211
- | `grey0` `grey950` | Grey scale | e.g. `grey700` = `#171717` |
252
+ | Token | Value | Use |
253
+ | ------------------- | --------------- | ----------------------------------------- |
254
+ | `primary` | `#B46436` | Brand / active left icon / open chevron |
255
+ | `primaryMuted` | `#B464360F` | Input active border |
256
+ | `primaryHover` | `#B4643633` | DatePicker in-range day background |
257
+ | `red` | `#A63E3E` | Error text / icons / `LogOutIcon` default |
258
+ | `redMuted` | `#A63E3E0F` | Input error border / subtle danger row |
259
+ | `redHover` | `#A63E3E33` | Danger row hover background |
260
+ | `green` | `#34A853` | Success / positive |
261
+ | `black` / `white` | `#000` / `#fff` | Surfaces / labels |
262
+ | `grey0` … `grey950` | Grey scale | e.g. `grey700` = `#171717` |
212
263
 
213
264
  ```tsx
214
265
  colors.primary;