@ecohouse/ui 0.1.12 → 0.1.13

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.d.cts CHANGED
@@ -438,7 +438,10 @@ type DatePickerRangeProps = DatePickerBaseProps & {
438
438
  type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;
439
439
  declare const DatePicker: react.ForwardRefExoticComponent<DatePickerProps & react.RefAttributes<View>>;
440
440
 
441
+ type StatefulIcon = ReactNode | IconComponent;
442
+
441
443
  type InputSize = "lg" | "sm";
444
+ type InputIcon = StatefulIcon;
442
445
  interface InputProps extends Omit<TextInputProps, "style" | "editable"> {
443
446
  label?: string;
444
447
  showLabel?: boolean;
@@ -449,9 +452,9 @@ interface InputProps extends Omit<TextInputProps, "style" | "editable"> {
449
452
  error?: boolean;
450
453
  /** External — non-interactive. */
451
454
  disabled?: boolean;
452
- leftIcon?: ReactNode;
455
+ leftIcon?: InputIcon;
453
456
  showLeftIcon?: boolean;
454
- rightIcon?: ReactNode;
457
+ rightIcon?: InputIcon;
455
458
  showRightIcon?: boolean;
456
459
  onRightIconPress?: () => void;
457
460
  /** Accessible name for the right icon button, when `onRightIconPress` is set. */
@@ -468,6 +471,7 @@ type SelectOption = {
468
471
  label: string;
469
472
  value: string;
470
473
  };
474
+ type SelectIcon = StatefulIcon;
471
475
  type SelectBaseProps = Omit<ViewProps, "style" | "children"> & {
472
476
  label?: string;
473
477
  showLabel?: boolean;
@@ -480,7 +484,7 @@ type SelectBaseProps = Omit<ViewProps, "style" | "children"> & {
480
484
  onOpenChange?: (open: boolean) => void;
481
485
  disabled?: boolean;
482
486
  error?: boolean;
483
- leftIcon?: ReactNode;
487
+ leftIcon?: SelectIcon;
484
488
  showLeftIcon?: boolean;
485
489
  showSearch?: boolean;
486
490
  searchPlaceholder?: string;
@@ -871,4 +875,4 @@ declare const textareaTypography: {
871
875
  };
872
876
  };
873
877
 
874
- export { ArrowRightIcon, Avatar, type AvatarMenuItem, type AvatarProps, BRAND_LOGO_COLORS, BRAND_LOGO_DEFAULT_HEIGHT, BRAND_LOGO_DEFAULT_WIDTH, Badge, type BadgeProps, type BadgeVariant, BagIcon, BellIcon, BrandLogo, type BrandLogoProps, type BrandLogoVariant, BuildingIcon, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CalendarIcon, CalendarOutlineIcon, CameraIcon, CheckBadgeIcon, CheckIcon, Checkbox, type CheckboxProps, type CheckboxVariant, ChevronDownIcon, ChevronLeftIcon, ClockIcon, CommentCard, type CommentCardProps, Counter, type CounterProps, DatePicker, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, type DateRange, FacebookIcon, GlobeIcon, type GreyStep, HeartIcon, HelpCircleIcon, HomeIcon, Icon, type IconByNameProps, type IconComponent, type IconGroup, type IconName, type IconProps, Input, type InputProps, type InputSize, InstagramIcon, KeyIcon, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, LayoutGridIcon, LinkedInIcon, LogOutIcon, MailIcon, MenuIcon, type MenuIconProps, MenuItem, type MenuItemProps, MinusIcon, NavigateIcon, PhoneIcon, PlusIcon, RatingInput, type RatingInputProps, SearchIcon, SegmentedToggle, type SegmentedToggleOption, type SegmentedToggleProps, Select, type SelectMultipleProps, type SelectOption, type SelectProps, type SelectSingleProps, SettingsIcon, ShowIcon, SidebarIcon, StarFilledIcon, StarIcon, type StarIconProps, StatCard, type StatCardProps, Textarea, type TextareaProps, Toggle, type ToggleProps, UserIcon, UsersAltIcon, VideoIcon, avatarTypography, badgeTypography, buttonTypography, colors, commentCardTypography, counterTypography, datePickerTypography, defaultLanguageOptions, fonts, getIconsByGroup, grey, iconGroupNames, iconGroups, iconNames, icons, inputTypography, languageSwitcherTypography, ratingTypography, segmentedToggleTypography, selectTypography, statCardTypography, textareaTypography };
878
+ export { ArrowRightIcon, Avatar, type AvatarMenuItem, type AvatarProps, BRAND_LOGO_COLORS, BRAND_LOGO_DEFAULT_HEIGHT, BRAND_LOGO_DEFAULT_WIDTH, Badge, type BadgeProps, type BadgeVariant, BagIcon, BellIcon, BrandLogo, type BrandLogoProps, type BrandLogoVariant, BuildingIcon, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CalendarIcon, CalendarOutlineIcon, CameraIcon, CheckBadgeIcon, CheckIcon, Checkbox, type CheckboxProps, type CheckboxVariant, ChevronDownIcon, ChevronLeftIcon, ClockIcon, CommentCard, type CommentCardProps, Counter, type CounterProps, DatePicker, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, type DateRange, FacebookIcon, GlobeIcon, type GreyStep, HeartIcon, HelpCircleIcon, HomeIcon, Icon, type IconByNameProps, type IconComponent, type IconGroup, type IconName, type IconProps, Input, type InputIcon, type InputProps, type InputSize, InstagramIcon, KeyIcon, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, LayoutGridIcon, LinkedInIcon, LogOutIcon, MailIcon, MenuIcon, type MenuIconProps, MenuItem, type MenuItemProps, MinusIcon, NavigateIcon, PhoneIcon, PlusIcon, RatingInput, type RatingInputProps, SearchIcon, SegmentedToggle, type SegmentedToggleOption, type SegmentedToggleProps, Select, type SelectIcon, type SelectMultipleProps, type SelectOption, type SelectProps, type SelectSingleProps, SettingsIcon, ShowIcon, SidebarIcon, StarFilledIcon, StarIcon, type StarIconProps, StatCard, type StatCardProps, Textarea, type TextareaProps, Toggle, type ToggleProps, UserIcon, UsersAltIcon, VideoIcon, avatarTypography, badgeTypography, buttonTypography, colors, commentCardTypography, counterTypography, datePickerTypography, defaultLanguageOptions, fonts, getIconsByGroup, grey, iconGroupNames, iconGroups, iconNames, icons, inputTypography, languageSwitcherTypography, ratingTypography, segmentedToggleTypography, selectTypography, statCardTypography, textareaTypography };
package/dist/index.d.ts CHANGED
@@ -438,7 +438,10 @@ type DatePickerRangeProps = DatePickerBaseProps & {
438
438
  type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps;
439
439
  declare const DatePicker: react.ForwardRefExoticComponent<DatePickerProps & react.RefAttributes<View>>;
440
440
 
441
+ type StatefulIcon = ReactNode | IconComponent;
442
+
441
443
  type InputSize = "lg" | "sm";
444
+ type InputIcon = StatefulIcon;
442
445
  interface InputProps extends Omit<TextInputProps, "style" | "editable"> {
443
446
  label?: string;
444
447
  showLabel?: boolean;
@@ -449,9 +452,9 @@ interface InputProps extends Omit<TextInputProps, "style" | "editable"> {
449
452
  error?: boolean;
450
453
  /** External — non-interactive. */
451
454
  disabled?: boolean;
452
- leftIcon?: ReactNode;
455
+ leftIcon?: InputIcon;
453
456
  showLeftIcon?: boolean;
454
- rightIcon?: ReactNode;
457
+ rightIcon?: InputIcon;
455
458
  showRightIcon?: boolean;
456
459
  onRightIconPress?: () => void;
457
460
  /** Accessible name for the right icon button, when `onRightIconPress` is set. */
@@ -468,6 +471,7 @@ type SelectOption = {
468
471
  label: string;
469
472
  value: string;
470
473
  };
474
+ type SelectIcon = StatefulIcon;
471
475
  type SelectBaseProps = Omit<ViewProps, "style" | "children"> & {
472
476
  label?: string;
473
477
  showLabel?: boolean;
@@ -480,7 +484,7 @@ type SelectBaseProps = Omit<ViewProps, "style" | "children"> & {
480
484
  onOpenChange?: (open: boolean) => void;
481
485
  disabled?: boolean;
482
486
  error?: boolean;
483
- leftIcon?: ReactNode;
487
+ leftIcon?: SelectIcon;
484
488
  showLeftIcon?: boolean;
485
489
  showSearch?: boolean;
486
490
  searchPlaceholder?: string;
@@ -871,4 +875,4 @@ declare const textareaTypography: {
871
875
  };
872
876
  };
873
877
 
874
- export { ArrowRightIcon, Avatar, type AvatarMenuItem, type AvatarProps, BRAND_LOGO_COLORS, BRAND_LOGO_DEFAULT_HEIGHT, BRAND_LOGO_DEFAULT_WIDTH, Badge, type BadgeProps, type BadgeVariant, BagIcon, BellIcon, BrandLogo, type BrandLogoProps, type BrandLogoVariant, BuildingIcon, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CalendarIcon, CalendarOutlineIcon, CameraIcon, CheckBadgeIcon, CheckIcon, Checkbox, type CheckboxProps, type CheckboxVariant, ChevronDownIcon, ChevronLeftIcon, ClockIcon, CommentCard, type CommentCardProps, Counter, type CounterProps, DatePicker, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, type DateRange, FacebookIcon, GlobeIcon, type GreyStep, HeartIcon, HelpCircleIcon, HomeIcon, Icon, type IconByNameProps, type IconComponent, type IconGroup, type IconName, type IconProps, Input, type InputProps, type InputSize, InstagramIcon, KeyIcon, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, LayoutGridIcon, LinkedInIcon, LogOutIcon, MailIcon, MenuIcon, type MenuIconProps, MenuItem, type MenuItemProps, MinusIcon, NavigateIcon, PhoneIcon, PlusIcon, RatingInput, type RatingInputProps, SearchIcon, SegmentedToggle, type SegmentedToggleOption, type SegmentedToggleProps, Select, type SelectMultipleProps, type SelectOption, type SelectProps, type SelectSingleProps, SettingsIcon, ShowIcon, SidebarIcon, StarFilledIcon, StarIcon, type StarIconProps, StatCard, type StatCardProps, Textarea, type TextareaProps, Toggle, type ToggleProps, UserIcon, UsersAltIcon, VideoIcon, avatarTypography, badgeTypography, buttonTypography, colors, commentCardTypography, counterTypography, datePickerTypography, defaultLanguageOptions, fonts, getIconsByGroup, grey, iconGroupNames, iconGroups, iconNames, icons, inputTypography, languageSwitcherTypography, ratingTypography, segmentedToggleTypography, selectTypography, statCardTypography, textareaTypography };
878
+ export { ArrowRightIcon, Avatar, type AvatarMenuItem, type AvatarProps, BRAND_LOGO_COLORS, BRAND_LOGO_DEFAULT_HEIGHT, BRAND_LOGO_DEFAULT_WIDTH, Badge, type BadgeProps, type BadgeVariant, BagIcon, BellIcon, BrandLogo, type BrandLogoProps, type BrandLogoVariant, BuildingIcon, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CalendarIcon, CalendarOutlineIcon, CameraIcon, CheckBadgeIcon, CheckIcon, Checkbox, type CheckboxProps, type CheckboxVariant, ChevronDownIcon, ChevronLeftIcon, ClockIcon, CommentCard, type CommentCardProps, Counter, type CounterProps, DatePicker, type DatePickerProps, type DatePickerRangeProps, type DatePickerSingleProps, type DateRange, FacebookIcon, GlobeIcon, type GreyStep, HeartIcon, HelpCircleIcon, HomeIcon, Icon, type IconByNameProps, type IconComponent, type IconGroup, type IconName, type IconProps, Input, type InputIcon, type InputProps, type InputSize, InstagramIcon, KeyIcon, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, LayoutGridIcon, LinkedInIcon, LogOutIcon, MailIcon, MenuIcon, type MenuIconProps, MenuItem, type MenuItemProps, MinusIcon, NavigateIcon, PhoneIcon, PlusIcon, RatingInput, type RatingInputProps, SearchIcon, SegmentedToggle, type SegmentedToggleOption, type SegmentedToggleProps, Select, type SelectIcon, type SelectMultipleProps, type SelectOption, type SelectProps, type SelectSingleProps, SettingsIcon, ShowIcon, SidebarIcon, StarFilledIcon, StarIcon, type StarIconProps, StatCard, type StatCardProps, Textarea, type TextareaProps, Toggle, type ToggleProps, UserIcon, UsersAltIcon, VideoIcon, avatarTypography, badgeTypography, buttonTypography, colors, commentCardTypography, counterTypography, datePickerTypography, defaultLanguageOptions, fonts, getIconsByGroup, grey, iconGroupNames, iconGroups, iconNames, icons, inputTypography, languageSwitcherTypography, ratingTypography, segmentedToggleTypography, selectTypography, statCardTypography, textareaTypography };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { forwardRef, useRef, useMemo, useState, useCallback, useEffect, useLayoutEffect } from 'react';
1
+ import { forwardRef, useRef, useMemo, useState, useCallback, useEffect, useLayoutEffect, isValidElement, cloneElement } from 'react';
2
2
  import { Pressable, View, Text, StyleSheet, Platform, Image, Animated, Easing, TouchableOpacity, TextInput, ScrollView } from 'react-native';
3
3
  import Svg, { Path } from 'react-native-svg';
4
4
  import { jsxs, jsx } from 'react/jsx-runtime';
@@ -2752,6 +2752,19 @@ var styles10 = StyleSheet.create({
2752
2752
  backgroundColor: colors.primary
2753
2753
  }
2754
2754
  });
2755
+ function renderStatefulIcon(icon, FallbackIcon, props) {
2756
+ if (icon == null) {
2757
+ return /* @__PURE__ */ jsx(FallbackIcon, { ...props });
2758
+ }
2759
+ if (typeof icon === "function") {
2760
+ const Icon2 = icon;
2761
+ return /* @__PURE__ */ jsx(Icon2, { ...props });
2762
+ }
2763
+ if (isValidElement(icon)) {
2764
+ return cloneElement(icon, props);
2765
+ }
2766
+ return icon;
2767
+ }
2755
2768
  var DEFAULT_WIDTH2 = 308;
2756
2769
  var sizeConfig2 = {
2757
2770
  lg: {
@@ -2831,11 +2844,11 @@ function chromeFor(state) {
2831
2844
  }
2832
2845
  }
2833
2846
  var Input = forwardRef(function Input2({
2834
- label = "Label",
2847
+ label,
2835
2848
  showLabel = true,
2836
- hint = "Hint",
2849
+ hint,
2837
2850
  showHint = true,
2838
- placeholder = "placeholder",
2851
+ placeholder,
2839
2852
  size = "lg",
2840
2853
  disabled = false,
2841
2854
  error = false,
@@ -2872,8 +2885,14 @@ var Input = forwardRef(function Input2({
2872
2885
  const resolvedAccessibilityLabel = accessibilityLabel ?? (showLabel ? void 0 : label);
2873
2886
  const hasLeftIcon = showLeftIcon || leftIcon != null;
2874
2887
  const hasRightIcon = showRightIcon || rightIcon != null;
2875
- const leftIconNode = leftIcon ?? /* @__PURE__ */ jsx(UserIcon, { size: metrics.iconSize, color: chrome.leftIconColor });
2876
- const rightIconNode = rightIcon ?? /* @__PURE__ */ jsx(ShowIcon, { size: metrics.iconSize, color: chrome.rightIconColor });
2888
+ const leftIconNode = renderStatefulIcon(leftIcon, UserIcon, {
2889
+ size: metrics.iconSize,
2890
+ color: chrome.leftIconColor
2891
+ });
2892
+ const rightIconNode = renderStatefulIcon(rightIcon, ShowIcon, {
2893
+ size: metrics.iconSize,
2894
+ color: chrome.rightIconColor
2895
+ });
2877
2896
  useApplyWebClassName(rootRef, className);
2878
2897
  useApplyWebClassName(inputRef, inputClassName);
2879
2898
  return /* @__PURE__ */ jsxs(View, { ref: rootRef, style: [styles11.root, disabled && styles11.disabled, style], children: [
@@ -3107,11 +3126,11 @@ function MultiValueChips({ options, disabled, onRemove }) {
3107
3126
  var Select = forwardRef(
3108
3127
  function Select2(props, forwardedRef) {
3109
3128
  const {
3110
- label = "Label",
3129
+ label,
3111
3130
  showLabel = true,
3112
3131
  hint,
3113
- showHint = false,
3114
- placeholder = "placeholder",
3132
+ showHint = true,
3133
+ placeholder,
3115
3134
  options,
3116
3135
  open: openProp,
3117
3136
  defaultOpen = false,
@@ -3308,13 +3327,10 @@ var Select = forwardRef(
3308
3327
  handleSelect,
3309
3328
  setOpen
3310
3329
  ]);
3311
- const leftIconNode = leftIcon ?? /* @__PURE__ */ jsx(
3312
- UserIcon,
3313
- {
3314
- size: ICON_SIZE7,
3315
- color: error ? colors.red : isOpen ? colors.primary : colors.grey100
3316
- }
3317
- );
3330
+ const leftIconNode = renderStatefulIcon(leftIcon, UserIcon, {
3331
+ size: ICON_SIZE7,
3332
+ color: error ? colors.red : isOpen ? colors.primary : colors.grey100
3333
+ });
3318
3334
  const hasLeftIcon = showLeftIcon || leftIcon != null;
3319
3335
  const triggerBorderColor = error ? colors.redMuted : isOpen ? colors.primaryMuted : colors.grey700;
3320
3336
  const triggerTextColor = hasValue ? error ? colors.red : colors.white : error ? colors.red : colors.grey100;