@ecohouse/ui 0.1.11 → 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/README.md CHANGED
@@ -140,8 +140,8 @@ export function Example() {
140
140
  placeholder="••••••••"
141
141
  hint="Use at least 8 characters"
142
142
  secureTextEntry
143
- leftIcon={<UserIcon size={20} />}
144
- rightIcon={<ShowIcon size={20} />}
143
+ leftIcon={UserIcon}
144
+ rightIcon={ShowIcon}
145
145
  onRightIconPress={() => {}}
146
146
  onChangeText={() => {}}
147
147
  />
@@ -201,18 +201,18 @@ Pill label chip — `default` / `transparent`. Optional leading `HomeIcon` (colo
201
201
 
202
202
  Extends React Native `TextInput` props. Default size `lg` (44px pill, radius 60).
203
203
 
204
- | Prop | Type | Default | Description |
205
- | ------------------------ | ------------------------------------------------------------ | ------------------ | -------------------------- |
206
- | `label` / `showLabel` | `string` / `boolean` | `"Label"` / `true` | Top label |
207
- | `hint` / `showHint` | `string` / `boolean` | `"Hint"` / `true` | Bottom helper |
208
- | `placeholder` | `string` | `"placeholder"` | Field placeholder |
209
- | `size` | `"lg" \| "sm"` | `"lg"` | Field height |
210
- | `state` | `"default" \| "filled" \| "active" \| "error" \| "disabled"` | derived | Override auto state |
211
- | `disabled` / `error` | `boolean` | `false` | Disabled / error chrome |
212
- | `showLeftIcon` | `boolean` | `false` | Defaults to `UserIcon` |
213
- | `showRightIcon` | `boolean` | `false` | Defaults to `ShowIcon` |
214
- | `leftIcon` / `rightIcon` | `ReactNode` | — | Custom icons |
215
- | `onRightIconPress` | `() => void` | — | Makes right icon pressable |
204
+ | Prop | Type | Default | Description |
205
+ | ------------------------ | ------------------------------------------------------------ | ---------- | --------------------------------------------------------------- |
206
+ | `label` / `showLabel` | `string` / `boolean` | / `true` | Top label; omitted when no label is provided |
207
+ | `hint` / `showHint` | `string` / `boolean` | / `true` | Bottom helper; omitted when no hint is provided |
208
+ | `placeholder` | `string` | | Field placeholder |
209
+ | `size` | `"lg" \| "sm"` | `"lg"` | Field height |
210
+ | `state` | `"default" \| "filled" \| "active" \| "error" \| "disabled"` | derived | Override auto state |
211
+ | `disabled` / `error` | `boolean` | `false` | Disabled / error chrome |
212
+ | `showLeftIcon` | `boolean` | `false` | Defaults to `UserIcon` |
213
+ | `showRightIcon` | `boolean` | `false` | Defaults to `ShowIcon` |
214
+ | `leftIcon` / `rightIcon` | `InputIcon` | — | Custom icon component or element; receives state color and size |
215
+ | `onRightIconPress` | `() => void` | — | Makes right icon pressable |
216
216
 
217
217
  | State | Behavior |
218
218
  | ---------- | -------------------------------------------------------------------- |
package/dist/index.cjs CHANGED
@@ -621,6 +621,28 @@ function MailIcon({ size = 20, color = colors.primary, strokeWidth = 2 }) {
621
621
  ) });
622
622
  }
623
623
 
624
+ // src/icons/Menu/menuPath.ts
625
+ var MENU_PATH = "M8 12.6667H17.3333M1 6.83332H17.3333M8 0.999985H17.3333";
626
+ var MENU_CLOSE_PATH = "M15 1L1 15M1 1L15 15";
627
+ function MenuIcon({
628
+ size = 19,
629
+ color = colors.white,
630
+ strokeWidth = 2,
631
+ open = false
632
+ }) {
633
+ return /* @__PURE__ */ jsxRuntime.jsx(Svg__default.default, { width: size, height: size, viewBox: "0 0 19 19", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
634
+ Svg.Path,
635
+ {
636
+ d: open ? MENU_CLOSE_PATH : MENU_PATH,
637
+ stroke: color,
638
+ strokeWidth,
639
+ strokeLinecap: "round",
640
+ strokeLinejoin: "round",
641
+ transform: open ? "translate(1.5 1.5)" : "translate(0 2.5)"
642
+ }
643
+ ) });
644
+ }
645
+
624
646
  // src/icons/Minus/minusPath.ts
625
647
  var MINUS_PATH = "M3.33337 8H12.6667";
626
648
  function MinusIcon({ size = 16, color = colors.white, strokeWidth = 2 }) {
@@ -877,6 +899,7 @@ var icons = {
877
899
  linkedin: LinkedInIcon,
878
900
  logOut: LogOutIcon,
879
901
  mail: MailIcon,
902
+ menu: MenuIcon,
880
903
  minus: MinusIcon,
881
904
  navigate: NavigateIcon,
882
905
  phone: PhoneIcon,
@@ -893,7 +916,7 @@ var icons = {
893
916
  };
894
917
  var iconNames = Object.keys(icons);
895
918
  var iconGroups = {
896
- navigation: ["arrowRight", "chevronDown", "chevronLeft", "home", "navigate"],
919
+ navigation: ["arrowRight", "chevronDown", "chevronLeft", "home", "menu", "navigate"],
897
920
  actions: [
898
921
  "show",
899
922
  "bell",
@@ -2042,6 +2065,7 @@ var Button = react.forwardRef(
2042
2065
  paddingRight: hasIcon ? metrics.paddingRightWithIcon : metrics.paddingRight,
2043
2066
  gap: hasIcon ? metrics.gap : 0
2044
2067
  },
2068
+ hasIcon ? styles8.contentWithIcon : styles8.contentWithoutIcon,
2045
2069
  disabled && styles8.disabled,
2046
2070
  style
2047
2071
  ];
@@ -2097,6 +2121,12 @@ var styles8 = reactNative.StyleSheet.create({
2097
2121
  disabled: {
2098
2122
  opacity: 0.6
2099
2123
  },
2124
+ contentWithIcon: {
2125
+ justifyContent: "space-between"
2126
+ },
2127
+ contentWithoutIcon: {
2128
+ justifyContent: "center"
2129
+ },
2100
2130
  label: {},
2101
2131
  labelAndroid: {
2102
2132
  includeFontPadding: false
@@ -2303,6 +2333,7 @@ var DatePicker = react.forwardRef(
2303
2333
  weekdayLabels = DEFAULT_WEEKDAY_LABELS,
2304
2334
  formatValue = formatDate,
2305
2335
  weekStartsOn = 1,
2336
+ calendarStyle,
2306
2337
  style,
2307
2338
  className,
2308
2339
  accessibilityLabel,
@@ -2457,7 +2488,7 @@ var DatePicker = react.forwardRef(
2457
2488
  ]
2458
2489
  }
2459
2490
  ),
2460
- isOpen ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles10.menu, children: [
2491
+ isOpen ? /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: [styles10.menu, calendarStyle], children: [
2461
2492
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles10.calendarHeader, children: [
2462
2493
  /* @__PURE__ */ jsxRuntime.jsx(
2463
2494
  reactNative.Pressable,
@@ -2637,7 +2668,7 @@ var styles10 = reactNative.StyleSheet.create({
2637
2668
  position: "absolute",
2638
2669
  top: "100%",
2639
2670
  left: 0,
2640
- right: 0,
2671
+ width: DEFAULT_WIDTH,
2641
2672
  marginTop: 8,
2642
2673
  zIndex: 10,
2643
2674
  borderRadius: MENU_RADIUS2,
@@ -2727,6 +2758,19 @@ var styles10 = reactNative.StyleSheet.create({
2727
2758
  backgroundColor: colors.primary
2728
2759
  }
2729
2760
  });
2761
+ function renderStatefulIcon(icon, FallbackIcon, props) {
2762
+ if (icon == null) {
2763
+ return /* @__PURE__ */ jsxRuntime.jsx(FallbackIcon, { ...props });
2764
+ }
2765
+ if (typeof icon === "function") {
2766
+ const Icon2 = icon;
2767
+ return /* @__PURE__ */ jsxRuntime.jsx(Icon2, { ...props });
2768
+ }
2769
+ if (react.isValidElement(icon)) {
2770
+ return react.cloneElement(icon, props);
2771
+ }
2772
+ return icon;
2773
+ }
2730
2774
  var DEFAULT_WIDTH2 = 308;
2731
2775
  var sizeConfig2 = {
2732
2776
  lg: {
@@ -2806,11 +2850,11 @@ function chromeFor(state) {
2806
2850
  }
2807
2851
  }
2808
2852
  var Input = react.forwardRef(function Input2({
2809
- label = "Label",
2853
+ label,
2810
2854
  showLabel = true,
2811
- hint = "Hint",
2855
+ hint,
2812
2856
  showHint = true,
2813
- placeholder = "placeholder",
2857
+ placeholder,
2814
2858
  size = "lg",
2815
2859
  disabled = false,
2816
2860
  error = false,
@@ -2847,8 +2891,14 @@ var Input = react.forwardRef(function Input2({
2847
2891
  const resolvedAccessibilityLabel = accessibilityLabel ?? (showLabel ? void 0 : label);
2848
2892
  const hasLeftIcon = showLeftIcon || leftIcon != null;
2849
2893
  const hasRightIcon = showRightIcon || rightIcon != null;
2850
- const leftIconNode = leftIcon ?? /* @__PURE__ */ jsxRuntime.jsx(UserIcon, { size: metrics.iconSize, color: chrome.leftIconColor });
2851
- const rightIconNode = rightIcon ?? /* @__PURE__ */ jsxRuntime.jsx(ShowIcon, { size: metrics.iconSize, color: chrome.rightIconColor });
2894
+ const leftIconNode = renderStatefulIcon(leftIcon, UserIcon, {
2895
+ size: metrics.iconSize,
2896
+ color: chrome.leftIconColor
2897
+ });
2898
+ const rightIconNode = renderStatefulIcon(rightIcon, ShowIcon, {
2899
+ size: metrics.iconSize,
2900
+ color: chrome.rightIconColor
2901
+ });
2852
2902
  useApplyWebClassName(rootRef, className);
2853
2903
  useApplyWebClassName(inputRef, inputClassName);
2854
2904
  return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { ref: rootRef, style: [styles11.root, disabled && styles11.disabled, style], children: [
@@ -3082,11 +3132,11 @@ function MultiValueChips({ options, disabled, onRemove }) {
3082
3132
  var Select = react.forwardRef(
3083
3133
  function Select2(props, forwardedRef) {
3084
3134
  const {
3085
- label = "Label",
3135
+ label,
3086
3136
  showLabel = true,
3087
3137
  hint,
3088
- showHint = false,
3089
- placeholder = "placeholder",
3138
+ showHint = true,
3139
+ placeholder,
3090
3140
  options,
3091
3141
  open: openProp,
3092
3142
  defaultOpen = false,
@@ -3283,13 +3333,10 @@ var Select = react.forwardRef(
3283
3333
  handleSelect,
3284
3334
  setOpen
3285
3335
  ]);
3286
- const leftIconNode = leftIcon ?? /* @__PURE__ */ jsxRuntime.jsx(
3287
- UserIcon,
3288
- {
3289
- size: ICON_SIZE7,
3290
- color: error ? colors.red : isOpen ? colors.primary : colors.grey100
3291
- }
3292
- );
3336
+ const leftIconNode = renderStatefulIcon(leftIcon, UserIcon, {
3337
+ size: ICON_SIZE7,
3338
+ color: error ? colors.red : isOpen ? colors.primary : colors.grey100
3339
+ });
3293
3340
  const hasLeftIcon = showLeftIcon || leftIcon != null;
3294
3341
  const triggerBorderColor = error ? colors.redMuted : isOpen ? colors.primaryMuted : colors.grey700;
3295
3342
  const triggerTextColor = hasValue ? error ? colors.red : colors.white : error ? colors.red : colors.grey100;
@@ -4184,6 +4231,7 @@ exports.LayoutGridIcon = LayoutGridIcon;
4184
4231
  exports.LinkedInIcon = LinkedInIcon;
4185
4232
  exports.LogOutIcon = LogOutIcon;
4186
4233
  exports.MailIcon = MailIcon;
4234
+ exports.MenuIcon = MenuIcon;
4187
4235
  exports.MenuItem = MenuItem;
4188
4236
  exports.MinusIcon = MinusIcon;
4189
4237
  exports.NavigateIcon = NavigateIcon;