@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.
- package/dist/index.cjs +30063 -607
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +173 -10
- package/dist/index.d.ts +173 -10
- package/dist/index.js +29989 -547
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AccordionItem/AccordionItem.stories.tsx +54 -0
- package/src/components/AccordionItem/AccordionItem.tsx +220 -0
- package/src/components/AccordionItem/index.ts +2 -0
- package/src/components/AccountHeader/AccountHeader.tsx +34 -29
- package/src/components/Button/Button.stories.tsx +10 -1
- package/src/components/Button/Button.tsx +32 -3
- package/src/components/ContactInfoCard/ContactInfoCard.stories.tsx +30 -0
- package/src/components/ContactInfoCard/ContactInfoCard.tsx +141 -0
- package/src/components/ContactInfoCard/index.ts +2 -0
- package/src/components/DatePicker/DatePicker.tsx +119 -46
- package/src/components/Modal/Modal.stories.tsx +100 -0
- package/src/components/Modal/Modal.tsx +165 -0
- package/src/components/Modal/index.ts +2 -0
- package/src/components/Select/Select.tsx +5 -2
- package/src/components/Sidebar/Sidebar.tsx +42 -12
- package/src/components/StepPager/StepPager.tsx +150 -0
- package/src/components/StepPager/index.ts +2 -0
- package/src/components/ToggleRow/ToggleRow.stories.tsx +46 -0
- package/src/components/ToggleRow/ToggleRow.tsx +121 -0
- package/src/components/ToggleRow/index.ts +2 -0
- package/src/components/VerificationCodeInput/VerificationCodeInput.tsx +80 -60
- package/src/components/index.ts +15 -0
- package/src/icons/Ban/BanIcon.tsx +15 -0
- package/src/icons/Ban/banPath.ts +2 -0
- package/src/icons/Ban/index.ts +1 -0
- package/src/icons/CameraFilled/CameraFilledIcon.tsx +15 -0
- package/src/icons/CameraFilled/CameraFilledIcon.web.tsx +21 -0
- package/src/icons/CameraFilled/cameraFilledPath.ts +2 -0
- package/src/icons/CameraFilled/index.ts +1 -0
- package/src/icons/Fullscreen/FullscreenIcon.tsx +21 -0
- package/src/icons/Fullscreen/fullscreenPath.ts +2 -0
- package/src/icons/Fullscreen/index.ts +1 -0
- package/src/icons/Headset/HeadsetIcon.tsx +26 -0
- package/src/icons/Headset/HeadsetIcon.web.tsx +25 -0
- package/src/icons/Headset/headsetPath.ts +6 -0
- package/src/icons/Headset/index.ts +1 -0
- package/src/icons/Hide/HideIcon.tsx +21 -0
- package/src/icons/Hide/HideIcon.web.tsx +27 -0
- package/src/icons/Hide/hidePath.ts +3 -0
- package/src/icons/Hide/index.ts +1 -0
- package/src/icons/Home/homePath.ts +1 -1
- package/src/icons/MenuLines/MenuLinesIcon.tsx +20 -0
- package/src/icons/MenuLines/MenuLinesIcon.web.tsx +26 -0
- package/src/icons/MenuLines/index.ts +1 -0
- package/src/icons/MenuLines/menuLinesPath.ts +3 -0
- package/src/icons/Sort/SortIcon.tsx +3 -3
- package/src/icons/Sort/SortIcon.web.tsx +2 -2
- package/src/icons/Sort/sortPath.ts +3 -2
- package/src/icons/VideoOff/VideoOffIcon.tsx +21 -0
- package/src/icons/VideoOff/VideoOffIcon.web.tsx +27 -0
- package/src/icons/VideoOff/index.ts +1 -0
- package/src/icons/VideoOff/videoOffPath.ts +2 -0
- package/src/icons/ZoomOut/ZoomOutIcon.tsx +21 -0
- package/src/icons/ZoomOut/index.ts +1 -0
- package/src/icons/ZoomOut/zoomOutPath.ts +2 -0
- package/src/icons/index.ts +8 -0
- package/src/icons/registry.ts +23 -0
- package/src/index.ts +20 -0
- package/src/theme/colors.test.ts +1 -1
- package/src/theme/typography.ts +4 -4
- 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";
|
package/src/theme/colors.test.ts
CHANGED
package/src/theme/typography.ts
CHANGED
|
@@ -119,7 +119,7 @@ export const inputTypography = {
|
|
|
119
119
|
fontFamily: fonts.sans,
|
|
120
120
|
fontSize: 12,
|
|
121
121
|
fontWeight: "400" as const,
|
|
122
|
-
lineHeight:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
+
}
|