@ecohouse/ui 0.1.32 → 0.1.34

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 (68) hide show
  1. package/dist/index.cjs +30063 -607
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +173 -10
  4. package/dist/index.d.ts +173 -10
  5. package/dist/index.js +29989 -547
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/components/AccordionItem/AccordionItem.stories.tsx +54 -0
  9. package/src/components/AccordionItem/AccordionItem.tsx +220 -0
  10. package/src/components/AccordionItem/index.ts +2 -0
  11. package/src/components/AccountHeader/AccountHeader.tsx +34 -29
  12. package/src/components/Button/Button.stories.tsx +10 -1
  13. package/src/components/Button/Button.tsx +32 -3
  14. package/src/components/ContactInfoCard/ContactInfoCard.stories.tsx +30 -0
  15. package/src/components/ContactInfoCard/ContactInfoCard.tsx +141 -0
  16. package/src/components/ContactInfoCard/index.ts +2 -0
  17. package/src/components/DatePicker/DatePicker.tsx +119 -46
  18. package/src/components/Modal/Modal.stories.tsx +100 -0
  19. package/src/components/Modal/Modal.tsx +165 -0
  20. package/src/components/Modal/index.ts +2 -0
  21. package/src/components/Select/Select.tsx +5 -2
  22. package/src/components/Sidebar/Sidebar.tsx +42 -12
  23. package/src/components/StepPager/StepPager.tsx +150 -0
  24. package/src/components/StepPager/index.ts +2 -0
  25. package/src/components/ToggleRow/ToggleRow.stories.tsx +46 -0
  26. package/src/components/ToggleRow/ToggleRow.tsx +121 -0
  27. package/src/components/ToggleRow/index.ts +2 -0
  28. package/src/components/VerificationCodeInput/VerificationCodeInput.tsx +80 -60
  29. package/src/components/index.ts +15 -0
  30. package/src/icons/Ban/BanIcon.tsx +15 -0
  31. package/src/icons/Ban/banPath.ts +2 -0
  32. package/src/icons/Ban/index.ts +1 -0
  33. package/src/icons/CameraFilled/CameraFilledIcon.tsx +15 -0
  34. package/src/icons/CameraFilled/CameraFilledIcon.web.tsx +21 -0
  35. package/src/icons/CameraFilled/cameraFilledPath.ts +2 -0
  36. package/src/icons/CameraFilled/index.ts +1 -0
  37. package/src/icons/Fullscreen/FullscreenIcon.tsx +21 -0
  38. package/src/icons/Fullscreen/fullscreenPath.ts +2 -0
  39. package/src/icons/Fullscreen/index.ts +1 -0
  40. package/src/icons/Headset/HeadsetIcon.tsx +26 -0
  41. package/src/icons/Headset/HeadsetIcon.web.tsx +25 -0
  42. package/src/icons/Headset/headsetPath.ts +6 -0
  43. package/src/icons/Headset/index.ts +1 -0
  44. package/src/icons/Hide/HideIcon.tsx +21 -0
  45. package/src/icons/Hide/HideIcon.web.tsx +27 -0
  46. package/src/icons/Hide/hidePath.ts +3 -0
  47. package/src/icons/Hide/index.ts +1 -0
  48. package/src/icons/Home/homePath.ts +1 -1
  49. package/src/icons/MenuLines/MenuLinesIcon.tsx +20 -0
  50. package/src/icons/MenuLines/MenuLinesIcon.web.tsx +26 -0
  51. package/src/icons/MenuLines/index.ts +1 -0
  52. package/src/icons/MenuLines/menuLinesPath.ts +3 -0
  53. package/src/icons/Sort/SortIcon.tsx +3 -3
  54. package/src/icons/Sort/SortIcon.web.tsx +2 -2
  55. package/src/icons/Sort/sortPath.ts +3 -2
  56. package/src/icons/VideoOff/VideoOffIcon.tsx +21 -0
  57. package/src/icons/VideoOff/VideoOffIcon.web.tsx +27 -0
  58. package/src/icons/VideoOff/index.ts +1 -0
  59. package/src/icons/VideoOff/videoOffPath.ts +2 -0
  60. package/src/icons/ZoomOut/ZoomOutIcon.tsx +21 -0
  61. package/src/icons/ZoomOut/index.ts +1 -0
  62. package/src/icons/ZoomOut/zoomOutPath.ts +2 -0
  63. package/src/icons/index.ts +8 -0
  64. package/src/icons/registry.ts +23 -0
  65. package/src/index.ts +20 -0
  66. package/src/theme/colors.test.ts +1 -1
  67. package/src/theme/typography.ts +4 -4
  68. package/src/utils/popoverAlign.ts +85 -0
package/src/index.ts CHANGED
@@ -5,7 +5,10 @@ export {
5
5
  Badge,
6
6
  StatusBadge,
7
7
  PaginationDots,
8
+ StepPager,
8
9
  InfoTile,
10
+ ContactInfoCard,
11
+ AccordionItem,
9
12
  StepList,
10
13
  Counter,
11
14
  SegmentedToggle,
@@ -17,11 +20,13 @@ export {
17
20
  Checkbox,
18
21
  DatePicker,
19
22
  FloatingActionButton,
23
+ Modal,
20
24
  Input,
21
25
  VerificationCodeInput,
22
26
  Select,
23
27
  Textarea,
24
28
  Toggle,
29
+ ToggleRow,
25
30
  RatingInput,
26
31
  CommentCard,
27
32
  Range,
@@ -36,7 +41,10 @@ export type {
36
41
  StatusBadgeProps,
37
42
  StatusBadgeTone,
38
43
  PaginationDotsProps,
44
+ StepPagerProps,
39
45
  InfoTileProps,
46
+ ContactInfoCardProps,
47
+ AccordionItemProps,
40
48
  StepListProps,
41
49
  CounterProps,
42
50
  SegmentedToggleOption,
@@ -58,6 +66,7 @@ export type {
58
66
  DatePickerVariant,
59
67
  DateRange,
60
68
  FloatingActionButtonProps,
69
+ ModalProps,
61
70
  InputIcon,
62
71
  InputProps,
63
72
  InputSize,
@@ -70,6 +79,7 @@ export type {
70
79
  SelectMultipleProps,
71
80
  TextareaProps,
72
81
  ToggleProps,
82
+ ToggleRowProps,
73
83
  RatingInputProps,
74
84
  CommentCardProps,
75
85
  RangeProps,
@@ -106,11 +116,13 @@ export {
106
116
  getIconsByGroup,
107
117
  ArrowRightIcon,
108
118
  BagIcon,
119
+ BanIcon,
109
120
  BellIcon,
110
121
  BuildingIcon,
111
122
  CalendarIcon,
112
123
  CalendarOutlineIcon,
113
124
  CameraIcon,
125
+ CameraFilledIcon,
114
126
  CheckIcon,
115
127
  CheckBadgeIcon,
116
128
  ChevronDownIcon,
@@ -139,10 +151,13 @@ export {
139
151
  TrashIcon,
140
152
  FacebookIcon,
141
153
  FiltersIcon,
154
+ FullscreenIcon,
142
155
  HeartIcon,
156
+ HeadsetIcon,
143
157
  GlobeIcon,
144
158
  GooglePlayIcon,
145
159
  HelpCircleIcon,
160
+ HideIcon,
146
161
  HomeIcon,
147
162
  InstagramIcon,
148
163
  KeyIcon,
@@ -158,6 +173,7 @@ export {
158
173
  MapCollapseIcon,
159
174
  MapExpandIcon,
160
175
  MenuIcon,
176
+ MenuLinesIcon,
161
177
  MinusIcon,
162
178
  NavigateIcon,
163
179
  PhoneIcon,
@@ -174,6 +190,8 @@ export {
174
190
  UserIcon,
175
191
  UsersAltIcon,
176
192
  VideoIcon,
193
+ VideoOffIcon,
194
+ ZoomOutIcon,
177
195
  } from "./icons";
178
196
  export type {
179
197
  IconProps,
@@ -208,3 +226,5 @@ export {
208
226
  export type { GreyStep } from "./theme";
209
227
 
210
228
  export { abbreviateMonthName, formatDate, formatDateDayShortMonth } from "./utils/dateUtils";
229
+ export { resolvePopoverAlign } from "./utils/popoverAlign";
230
+ export type { PopoverAlign, ResolvePopoverAlignOptions } from "./utils/popoverAlign";
@@ -30,7 +30,7 @@ describe("design tokens", () => {
30
30
  fontSize: 12,
31
31
  fontWeight: "400",
32
32
  letterSpacing: 0.36,
33
- lineHeight: 12,
33
+ lineHeight: 16,
34
34
  };
35
35
 
36
36
  expect(inputTypography.field).toMatchObject(fieldTypography);
@@ -119,7 +119,7 @@ export const inputTypography = {
119
119
  fontFamily: fonts.sans,
120
120
  fontSize: 12,
121
121
  fontWeight: "400" as const,
122
- lineHeight: 12,
122
+ lineHeight: 16,
123
123
  letterSpacing: 0.36,
124
124
  },
125
125
  hint: {
@@ -144,7 +144,7 @@ export const selectTypography = {
144
144
  fontFamily: fonts.sans,
145
145
  fontSize: 12,
146
146
  fontWeight: "400" as const,
147
- lineHeight: 12,
147
+ lineHeight: 16,
148
148
  letterSpacing: 0.36,
149
149
  },
150
150
  hint: {
@@ -169,7 +169,7 @@ export const avatarTypography = {
169
169
  fontFamily: fonts.sans,
170
170
  fontSize: 12,
171
171
  fontWeight: "400" as const,
172
- lineHeight: 12,
172
+ lineHeight: 14,
173
173
  letterSpacing: 0,
174
174
  },
175
175
  menuItem: {
@@ -255,7 +255,7 @@ export const textareaTypography = {
255
255
  fontFamily: fonts.sans,
256
256
  fontSize: 12,
257
257
  fontWeight: "400" as const,
258
- lineHeight: 12,
258
+ lineHeight: 16,
259
259
  letterSpacing: 0.36,
260
260
  },
261
261
  hint: {
@@ -0,0 +1,85 @@
1
+ export type PopoverAlign = "center" | "start" | "end";
2
+
3
+ export type ResolvePopoverAlignOptions = {
4
+ /** Trigger element bounds in viewport coordinates. */
5
+ triggerRect: Pick<DOMRect, "left" | "right" | "width">;
6
+ /** Popover panel width in px. */
7
+ panelWidth: number;
8
+ /** Viewport width in px. */
9
+ viewportWidth: number;
10
+ /** Minimum gap from the viewport edges. Defaults to 8. */
11
+ padding?: number;
12
+ /**
13
+ * `auto` (default): prefer center, then end (opens left), then start (opens right).
14
+ * Fixed values force that alignment.
15
+ */
16
+ preferred?: PopoverAlign | "auto";
17
+ };
18
+
19
+ function fitsCenter(
20
+ triggerRect: Pick<DOMRect, "left" | "width">,
21
+ panelWidth: number,
22
+ viewportWidth: number,
23
+ padding: number,
24
+ ) {
25
+ const centerX = triggerRect.left + triggerRect.width / 2;
26
+ const left = centerX - panelWidth / 2;
27
+ const right = centerX + panelWidth / 2;
28
+ return left >= padding && right <= viewportWidth - padding;
29
+ }
30
+
31
+ function fitsEnd(triggerRect: Pick<DOMRect, "right">, panelWidth: number, padding: number) {
32
+ return triggerRect.right - panelWidth >= padding;
33
+ }
34
+
35
+ function fitsStart(
36
+ triggerRect: Pick<DOMRect, "left">,
37
+ panelWidth: number,
38
+ viewportWidth: number,
39
+ padding: number,
40
+ ) {
41
+ return triggerRect.left + panelWidth <= viewportWidth - padding;
42
+ }
43
+
44
+ /**
45
+ * Picks horizontal popover alignment so the panel stays in view.
46
+ * Preference for `auto`: center → start (rightward) → end (leftward)
47
+ * when the trigger sits near the left edge (common for card actions).
48
+ */
49
+ export function resolvePopoverAlign({
50
+ triggerRect,
51
+ panelWidth,
52
+ viewportWidth,
53
+ padding = 8,
54
+ preferred = "auto",
55
+ }: ResolvePopoverAlignOptions): PopoverAlign {
56
+ if (preferred !== "auto") {
57
+ return preferred;
58
+ }
59
+
60
+ if (fitsCenter(triggerRect, panelWidth, viewportWidth, padding)) {
61
+ return "center";
62
+ }
63
+
64
+ const spaceLeft = triggerRect.right - padding;
65
+ const spaceRight = viewportWidth - padding - triggerRect.left;
66
+
67
+ // Prefer opening toward the side with more room.
68
+ if (spaceRight >= spaceLeft) {
69
+ if (fitsStart(triggerRect, panelWidth, viewportWidth, padding)) {
70
+ return "start";
71
+ }
72
+ if (fitsEnd(triggerRect, panelWidth, padding)) {
73
+ return "end";
74
+ }
75
+ } else {
76
+ if (fitsEnd(triggerRect, panelWidth, padding)) {
77
+ return "end";
78
+ }
79
+ if (fitsStart(triggerRect, panelWidth, viewportWidth, padding)) {
80
+ return "start";
81
+ }
82
+ }
83
+
84
+ return spaceRight >= spaceLeft ? "start" : "end";
85
+ }