@ecohouse/ui 0.1.54 → 0.1.55
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 +151 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +151 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Avatar/Avatar.stories.tsx +8 -0
- package/src/components/Avatar/Avatar.tsx +103 -8
- package/src/components/Avatar/index.ts +1 -1
- package/src/components/LanguageSwitcher/LanguageSwitcher.tsx +45 -25
- package/src/components/index.ts +1 -1
- package/src/index.ts +1 -0
- package/src/theme/colors.test.ts +2 -1
- package/src/theme/colors.ts +2 -1
package/dist/index.cjs
CHANGED
|
@@ -28541,9 +28541,10 @@ var colors = {
|
|
|
28541
28541
|
whiteAlpha40: "#FFFFFF66",
|
|
28542
28542
|
whiteAlpha20: "#FFFFFF33",
|
|
28543
28543
|
whiteAlpha1: "#FFFFFF03",
|
|
28544
|
+
whiteAlpha5: "#FFFFFF0D",
|
|
28544
28545
|
whiteAlpha6: "#FFFFFF0F",
|
|
28546
|
+
whiteAlpha7: "#FFFFFF12",
|
|
28545
28547
|
whiteAlpha10: "#FFFFFF1A",
|
|
28546
|
-
whiteAlpha5: "#FFFFFF0D",
|
|
28547
28548
|
dark: "#090909",
|
|
28548
28549
|
red: "#A63E3E",
|
|
28549
28550
|
lightGrey: "#B7B7B7",
|
|
@@ -31301,10 +31302,19 @@ function BrandLogo({
|
|
|
31301
31302
|
);
|
|
31302
31303
|
}
|
|
31303
31304
|
var IMAGE_SIZE = 48;
|
|
31305
|
+
var CONTAINER_HEIGHT = 56;
|
|
31304
31306
|
var CONTAINER_RADIUS = 71;
|
|
31305
31307
|
var CHEVRON_SIZE = 20;
|
|
31306
31308
|
var FALLBACK_ICON_SIZE = 20;
|
|
31307
31309
|
var MENU_RADIUS = 16;
|
|
31310
|
+
var triggerWebBlurStyle = reactNative.Platform.OS === "web" ? {
|
|
31311
|
+
backdropFilter: "blur(40px)",
|
|
31312
|
+
WebkitBackdropFilter: "blur(40px)"
|
|
31313
|
+
} : {};
|
|
31314
|
+
var menuWebBlurStyle = reactNative.Platform.OS === "web" ? {
|
|
31315
|
+
backdropFilter: "blur(40px)",
|
|
31316
|
+
WebkitBackdropFilter: "blur(40px)"
|
|
31317
|
+
} : {};
|
|
31308
31318
|
var Avatar = react.forwardRef(function Avatar2({
|
|
31309
31319
|
name,
|
|
31310
31320
|
email,
|
|
@@ -31312,6 +31322,7 @@ var Avatar = react.forwardRef(function Avatar2({
|
|
|
31312
31322
|
onPress,
|
|
31313
31323
|
disabled = false,
|
|
31314
31324
|
showChevron = true,
|
|
31325
|
+
variant = "light",
|
|
31315
31326
|
menuItems,
|
|
31316
31327
|
open: openProp,
|
|
31317
31328
|
defaultOpen = false,
|
|
@@ -31333,6 +31344,7 @@ var Avatar = react.forwardRef(function Avatar2({
|
|
|
31333
31344
|
const isOpenControlled = typeof openProp === "boolean";
|
|
31334
31345
|
const [uncontrolledOpen, setUncontrolledOpen] = react.useState(defaultOpen);
|
|
31335
31346
|
const isOpen = hasMenu && (isOpenControlled ? openProp : uncontrolledOpen);
|
|
31347
|
+
const isLightVariant = variant === "light";
|
|
31336
31348
|
useApplyWebClassName(containerRef, className);
|
|
31337
31349
|
const setOpen = react.useCallback(
|
|
31338
31350
|
(next) => {
|
|
@@ -31402,7 +31414,13 @@ var Avatar = react.forwardRef(function Avatar2({
|
|
|
31402
31414
|
accessibilityRole: isInteractive ? "button" : void 0,
|
|
31403
31415
|
accessibilityLabel: resolvedAccessibilityLabel,
|
|
31404
31416
|
accessibilityState: isInteractive ? { disabled, expanded: hasMenu ? isOpen : void 0 } : void 0,
|
|
31405
|
-
style: [
|
|
31417
|
+
style: [
|
|
31418
|
+
styles6.root,
|
|
31419
|
+
isLightVariant ? styles6.rootLight : styles6.rootDark,
|
|
31420
|
+
isLightVariant && triggerWebBlurStyle,
|
|
31421
|
+
disabled && styles6.disabled,
|
|
31422
|
+
style
|
|
31423
|
+
],
|
|
31406
31424
|
children: [
|
|
31407
31425
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: styles6.imageWrap, children: hasImage ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
31408
31426
|
reactNative.Image,
|
|
@@ -31411,30 +31429,71 @@ var Avatar = react.forwardRef(function Avatar2({
|
|
|
31411
31429
|
style: styles6.image,
|
|
31412
31430
|
onError: () => setImageFailed(true)
|
|
31413
31431
|
}
|
|
31414
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
31432
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
31433
|
+
reactNative.View,
|
|
31434
|
+
{
|
|
31435
|
+
style: [
|
|
31436
|
+
styles6.imageFallback,
|
|
31437
|
+
isLightVariant ? styles6.imageFallbackLight : styles6.imageFallbackDark
|
|
31438
|
+
],
|
|
31439
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31440
|
+
UserIcon,
|
|
31441
|
+
{
|
|
31442
|
+
size: FALLBACK_ICON_SIZE,
|
|
31443
|
+
color: isLightVariant ? colors.white : colors.primary
|
|
31444
|
+
}
|
|
31445
|
+
)
|
|
31446
|
+
}
|
|
31447
|
+
) }),
|
|
31415
31448
|
/* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles6.textColumn, children: [
|
|
31416
31449
|
/* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: styles6.name, numberOfLines: 1, children: name }),
|
|
31417
|
-
email ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
31450
|
+
email ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
31451
|
+
reactNative.Text,
|
|
31452
|
+
{
|
|
31453
|
+
style: [styles6.email, isLightVariant ? styles6.emailLight : styles6.emailDark],
|
|
31454
|
+
numberOfLines: 1,
|
|
31455
|
+
children: email
|
|
31456
|
+
}
|
|
31457
|
+
) : null
|
|
31418
31458
|
] }),
|
|
31419
|
-
showChevron ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles6.chevronSlot, isOpen && styles6.chevronOpen], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31459
|
+
showChevron ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles6.chevronSlot, isOpen && styles6.chevronOpen], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31460
|
+
ChevronDownIcon,
|
|
31461
|
+
{
|
|
31462
|
+
size: CHEVRON_SIZE,
|
|
31463
|
+
color: isLightVariant ? colors.white : isOpen ? colors.primary : colors.grey100
|
|
31464
|
+
}
|
|
31465
|
+
) }) : null
|
|
31420
31466
|
]
|
|
31421
31467
|
}
|
|
31422
31468
|
),
|
|
31423
|
-
hasMenu && isOpen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
31424
|
-
|
|
31425
|
-
|
|
31426
|
-
|
|
31427
|
-
|
|
31428
|
-
|
|
31429
|
-
|
|
31430
|
-
|
|
31431
|
-
|
|
31432
|
-
|
|
31433
|
-
|
|
31434
|
-
|
|
31435
|
-
|
|
31436
|
-
|
|
31437
|
-
|
|
31469
|
+
hasMenu && isOpen ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
31470
|
+
reactNative.View,
|
|
31471
|
+
{
|
|
31472
|
+
style: [
|
|
31473
|
+
styles6.menu,
|
|
31474
|
+
isLightVariant ? styles6.menuLight : styles6.menuDark,
|
|
31475
|
+
isLightVariant && menuWebBlurStyle,
|
|
31476
|
+
menuWidth != null && { right: void 0, width: menuWidth }
|
|
31477
|
+
],
|
|
31478
|
+
children: resolvedMenuItems.map((item) => {
|
|
31479
|
+
const itemKey = item.key ?? item.label;
|
|
31480
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
31481
|
+
MenuItem,
|
|
31482
|
+
{
|
|
31483
|
+
icon: item.icon,
|
|
31484
|
+
label: item.label,
|
|
31485
|
+
disabled: item.disabled,
|
|
31486
|
+
backgroundColor: item.backgroundColor,
|
|
31487
|
+
hoverColor: item.hoverColor ?? (isLightVariant ? colors.whiteAlpha7 : void 0),
|
|
31488
|
+
labelStyle: item.labelStyle,
|
|
31489
|
+
onPress: () => handleItemPress(item),
|
|
31490
|
+
style: isLightVariant ? item.backgroundColor ? styles6.emphasizedMenuItem : styles6.menuItem : void 0
|
|
31491
|
+
},
|
|
31492
|
+
itemKey
|
|
31493
|
+
);
|
|
31494
|
+
})
|
|
31495
|
+
}
|
|
31496
|
+
) : null
|
|
31438
31497
|
] });
|
|
31439
31498
|
});
|
|
31440
31499
|
var styles6 = reactNative.StyleSheet.create({
|
|
@@ -31446,6 +31505,7 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
31446
31505
|
zIndex: 20
|
|
31447
31506
|
},
|
|
31448
31507
|
root: {
|
|
31508
|
+
height: CONTAINER_HEIGHT,
|
|
31449
31509
|
flexDirection: "row",
|
|
31450
31510
|
alignItems: "center",
|
|
31451
31511
|
alignSelf: "flex-start",
|
|
@@ -31454,7 +31514,12 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
31454
31514
|
paddingBottom: 4,
|
|
31455
31515
|
paddingLeft: 4,
|
|
31456
31516
|
paddingRight: 12,
|
|
31457
|
-
borderRadius: CONTAINER_RADIUS
|
|
31517
|
+
borderRadius: CONTAINER_RADIUS
|
|
31518
|
+
},
|
|
31519
|
+
rootLight: {
|
|
31520
|
+
backgroundColor: colors.whiteAlpha5
|
|
31521
|
+
},
|
|
31522
|
+
rootDark: {
|
|
31458
31523
|
backgroundColor: colors.grey700
|
|
31459
31524
|
},
|
|
31460
31525
|
disabled: {
|
|
@@ -31475,7 +31540,15 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
31475
31540
|
width: IMAGE_SIZE,
|
|
31476
31541
|
height: IMAGE_SIZE,
|
|
31477
31542
|
alignItems: "center",
|
|
31478
|
-
justifyContent: "center"
|
|
31543
|
+
justifyContent: "center"
|
|
31544
|
+
},
|
|
31545
|
+
imageFallbackLight: {
|
|
31546
|
+
borderRadius: IMAGE_SIZE / 2,
|
|
31547
|
+
backgroundColor: "transparent",
|
|
31548
|
+
borderWidth: 1,
|
|
31549
|
+
borderColor: colors.whiteAlpha10
|
|
31550
|
+
},
|
|
31551
|
+
imageFallbackDark: {
|
|
31479
31552
|
backgroundColor: colors.grey600
|
|
31480
31553
|
},
|
|
31481
31554
|
textColumn: {
|
|
@@ -31488,7 +31561,12 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
31488
31561
|
color: colors.white
|
|
31489
31562
|
},
|
|
31490
31563
|
email: {
|
|
31491
|
-
...avatarTypography.email
|
|
31564
|
+
...avatarTypography.email
|
|
31565
|
+
},
|
|
31566
|
+
emailLight: {
|
|
31567
|
+
color: colors.whiteAlpha60
|
|
31568
|
+
},
|
|
31569
|
+
emailDark: {
|
|
31492
31570
|
color: colors.grey0
|
|
31493
31571
|
},
|
|
31494
31572
|
chevronSlot: {
|
|
@@ -31510,7 +31588,15 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
31510
31588
|
zIndex: 10,
|
|
31511
31589
|
borderRadius: MENU_RADIUS,
|
|
31512
31590
|
padding: 8,
|
|
31513
|
-
gap: 8
|
|
31591
|
+
gap: 8
|
|
31592
|
+
},
|
|
31593
|
+
menuLight: {
|
|
31594
|
+
borderWidth: 1,
|
|
31595
|
+
borderColor: colors.whiteAlpha10,
|
|
31596
|
+
backgroundColor: colors.whiteAlpha5,
|
|
31597
|
+
overflow: "hidden"
|
|
31598
|
+
},
|
|
31599
|
+
menuDark: {
|
|
31514
31600
|
backgroundColor: colors.grey700,
|
|
31515
31601
|
...reactNative.Platform.select({
|
|
31516
31602
|
web: {
|
|
@@ -31520,6 +31606,16 @@ var styles6 = reactNative.StyleSheet.create({
|
|
|
31520
31606
|
elevation: 8
|
|
31521
31607
|
}
|
|
31522
31608
|
})
|
|
31609
|
+
},
|
|
31610
|
+
menuItem: {
|
|
31611
|
+
height: 32,
|
|
31612
|
+
minHeight: 32,
|
|
31613
|
+
paddingVertical: 6
|
|
31614
|
+
},
|
|
31615
|
+
emphasizedMenuItem: {
|
|
31616
|
+
height: 46,
|
|
31617
|
+
minHeight: 46,
|
|
31618
|
+
paddingVertical: 11
|
|
31523
31619
|
}
|
|
31524
31620
|
});
|
|
31525
31621
|
var IMAGE_SIZE2 = 32;
|
|
@@ -33529,6 +33625,7 @@ var defaultLanguageOptions = [
|
|
|
33529
33625
|
];
|
|
33530
33626
|
var CONTROL_WIDTH = 96;
|
|
33531
33627
|
var CONTROL_HEIGHT = 35;
|
|
33628
|
+
var MENU_WIDTH = 90;
|
|
33532
33629
|
var ICON_SIZE9 = 16;
|
|
33533
33630
|
var ICON_BUTTON_SIZE2 = 32;
|
|
33534
33631
|
var ICON_MENU_WIDTH = 67;
|
|
@@ -33536,6 +33633,10 @@ var ICON_MENU_HEIGHT = 129;
|
|
|
33536
33633
|
var ICON_MENU_TOP = 39;
|
|
33537
33634
|
var ITEM_HEIGHT = 35;
|
|
33538
33635
|
var ACTIVE_ITEM_BACKGROUND = "#E38E5E12";
|
|
33636
|
+
var menuWebBlurStyle2 = reactNative.Platform.OS === "web" ? {
|
|
33637
|
+
backdropFilter: "blur(40px)",
|
|
33638
|
+
WebkitBackdropFilter: "blur(40px)"
|
|
33639
|
+
} : {};
|
|
33539
33640
|
var LanguageSwitcher = react.forwardRef(
|
|
33540
33641
|
function LanguageSwitcher2({
|
|
33541
33642
|
options = defaultLanguageOptions,
|
|
@@ -33640,7 +33741,7 @@ var LanguageSwitcher = react.forwardRef(
|
|
|
33640
33741
|
onHoverOut: () => setTriggerHovered(false),
|
|
33641
33742
|
style: ({ pressed }) => [
|
|
33642
33743
|
isIconVariant ? styles22.triggerIcon : styles22.trigger,
|
|
33643
|
-
!isIconVariant && (triggerHovered || pressed
|
|
33744
|
+
!isIconVariant && (triggerHovered || pressed) && styles22.triggerActive
|
|
33644
33745
|
],
|
|
33645
33746
|
children: [
|
|
33646
33747
|
/* @__PURE__ */ jsxRuntime.jsx(GlobeIcon, { size: ICON_SIZE9, color: colors.white, strokeWidth: isIconVariant ? 1.5 : 2 }),
|
|
@@ -33654,7 +33755,11 @@ var LanguageSwitcher = react.forwardRef(
|
|
|
33654
33755
|
isOpen && options.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
33655
33756
|
reactNative.View,
|
|
33656
33757
|
{
|
|
33657
|
-
style: [
|
|
33758
|
+
style: [
|
|
33759
|
+
styles22.menu,
|
|
33760
|
+
!isIconVariant && menuWebBlurStyle2,
|
|
33761
|
+
isIconVariant ? styles22.menuIcon : styles22.menuDefault
|
|
33762
|
+
],
|
|
33658
33763
|
accessibilityRole: "menu",
|
|
33659
33764
|
children: options.map((option) => {
|
|
33660
33765
|
const selected = option.value === selectedValue;
|
|
@@ -33669,15 +33774,15 @@ var LanguageSwitcher = react.forwardRef(
|
|
|
33669
33774
|
onHoverOut: () => setHoveredValue(null),
|
|
33670
33775
|
style: ({ pressed }) => [
|
|
33671
33776
|
styles22.item,
|
|
33672
|
-
isIconVariant ? styles22.itemIcon :
|
|
33777
|
+
isIconVariant ? styles22.itemIcon : styles22.itemDefault,
|
|
33673
33778
|
selected ? isIconVariant ? styles22.itemSelectedIcon : styles22.itemSelected : (hoveredValue === option.value || pressed) && styles22.itemHovered
|
|
33674
33779
|
],
|
|
33675
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
33780
|
+
children: ({ pressed }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
33676
33781
|
reactNative.Text,
|
|
33677
33782
|
{
|
|
33678
33783
|
style: [
|
|
33679
33784
|
styles22.itemLabel,
|
|
33680
|
-
selected
|
|
33785
|
+
(selected || hoveredValue === option.value || pressed) && styles22.itemLabelActive
|
|
33681
33786
|
],
|
|
33682
33787
|
children: option.label
|
|
33683
33788
|
}
|
|
@@ -33762,10 +33867,14 @@ var styles22 = reactNative.StyleSheet.create({
|
|
|
33762
33867
|
},
|
|
33763
33868
|
menuDefault: {
|
|
33764
33869
|
top: CONTROL_HEIGHT + 8,
|
|
33765
|
-
left:
|
|
33766
|
-
width:
|
|
33767
|
-
|
|
33768
|
-
|
|
33870
|
+
left: (CONTROL_WIDTH - MENU_WIDTH) / 2,
|
|
33871
|
+
width: MENU_WIDTH,
|
|
33872
|
+
height: 129,
|
|
33873
|
+
gap: 4,
|
|
33874
|
+
backgroundColor: colors.whiteAlpha5,
|
|
33875
|
+
borderWidth: 1,
|
|
33876
|
+
borderColor: colors.whiteAlpha10,
|
|
33877
|
+
borderRadius: 16
|
|
33769
33878
|
},
|
|
33770
33879
|
menuIcon: {
|
|
33771
33880
|
top: ICON_MENU_TOP,
|
|
@@ -33793,11 +33902,15 @@ var styles22 = reactNative.StyleSheet.create({
|
|
|
33793
33902
|
width: 51,
|
|
33794
33903
|
alignSelf: "stretch"
|
|
33795
33904
|
},
|
|
33905
|
+
itemDefault: {
|
|
33906
|
+
width: 74,
|
|
33907
|
+
alignSelf: "center"
|
|
33908
|
+
},
|
|
33796
33909
|
itemHovered: {
|
|
33797
|
-
backgroundColor: colors.
|
|
33910
|
+
backgroundColor: colors.whiteAlpha7
|
|
33798
33911
|
},
|
|
33799
33912
|
itemSelected: {
|
|
33800
|
-
backgroundColor: colors.
|
|
33913
|
+
backgroundColor: colors.whiteAlpha7
|
|
33801
33914
|
},
|
|
33802
33915
|
itemSelectedIcon: {
|
|
33803
33916
|
backgroundColor: ACTIVE_ITEM_BACKGROUND
|
|
@@ -33805,13 +33918,10 @@ var styles22 = reactNative.StyleSheet.create({
|
|
|
33805
33918
|
itemLabel: {
|
|
33806
33919
|
...languageSwitcherTypography,
|
|
33807
33920
|
...reactNative.Platform.select({ web: { fontFamily: `${fonts.sans}, sans-serif` } }),
|
|
33808
|
-
color: colors.
|
|
33809
|
-
},
|
|
33810
|
-
itemLabelSelected: {
|
|
33811
|
-
color: colors.primary
|
|
33921
|
+
color: colors.whiteAlpha60
|
|
33812
33922
|
},
|
|
33813
|
-
|
|
33814
|
-
color: colors.
|
|
33923
|
+
itemLabelActive: {
|
|
33924
|
+
color: colors.white
|
|
33815
33925
|
}
|
|
33816
33926
|
});
|
|
33817
33927
|
var ICON_SIZE10 = 25.63181;
|