@hoddy-ui/core 2.5.39 → 2.5.43

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.
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode, FC } from 'react';
2
- import { ViewStyle, TextStyle, NativeSyntheticEvent, NativeScrollEvent, TextInputProps, TextProps, StyleProp, TextInput } from 'react-native';
2
+ import { ViewStyle, TextStyle, NativeSyntheticEvent, NativeScrollEvent, TextInputProps, TextProps, StyleProp, ScrollView, TextInput } from 'react-native';
3
3
 
4
4
  type ThemeTypes = "dark" | "light";
5
5
  type ThemeModes = "dark" | "light" | "default";
@@ -325,6 +325,7 @@ type AnimatorProps = (BaseAnimatorProps & {
325
325
  type: "thrownup";
326
326
  });
327
327
 
328
+ type TypographyVariant = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body1" | "body2" | "caption";
328
329
  /**
329
330
  * Configuration options for the Hoddy UI library
330
331
  *
@@ -344,6 +345,12 @@ type AnimatorProps = (BaseAnimatorProps & {
344
345
  * 500: "Inter-Medium",
345
346
  * 600: "Inter-SemiBold",
346
347
  * 700: "Inter-Bold"
348
+ * },
349
+ * fontSizes: {
350
+ * h1: 48,
351
+ * h2: 40,
352
+ * body1: 16,
353
+ * caption: 12
347
354
  * }
348
355
  * }
349
356
  * });
@@ -364,6 +371,10 @@ type configProps = {
364
371
  fontWeights?: {
365
372
  [K in 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900]?: string;
366
373
  };
374
+ /** Custom font sizes for each typography variant (values in pixels, will be scaled with ms()) */
375
+ fontSizes?: {
376
+ [K in TypographyVariant]?: number;
377
+ };
367
378
  };
368
379
  };
369
380
  declare function initialize(config: configProps): void;
@@ -384,7 +395,7 @@ declare const CheckBox: FC<CheckboxProps>;
384
395
 
385
396
  declare const showFlashMessage: (msg: FlashMessageProps) => void;
386
397
 
387
- declare const FormWrapper: React.FC<FormWrapperProps>;
398
+ declare const FormWrapper: React.ForwardRefExoticComponent<FormWrapperProps & React.RefAttributes<ScrollView>>;
388
399
 
389
400
  declare const RatingInput: FC<RatingInputProps>;
390
401
  declare const RatingStars: FC<RatingStarsProps>;
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode, FC } from 'react';
2
- import { ViewStyle, TextStyle, NativeSyntheticEvent, NativeScrollEvent, TextInputProps, TextProps, StyleProp, TextInput } from 'react-native';
2
+ import { ViewStyle, TextStyle, NativeSyntheticEvent, NativeScrollEvent, TextInputProps, TextProps, StyleProp, ScrollView, TextInput } from 'react-native';
3
3
 
4
4
  type ThemeTypes = "dark" | "light";
5
5
  type ThemeModes = "dark" | "light" | "default";
@@ -325,6 +325,7 @@ type AnimatorProps = (BaseAnimatorProps & {
325
325
  type: "thrownup";
326
326
  });
327
327
 
328
+ type TypographyVariant = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body1" | "body2" | "caption";
328
329
  /**
329
330
  * Configuration options for the Hoddy UI library
330
331
  *
@@ -344,6 +345,12 @@ type AnimatorProps = (BaseAnimatorProps & {
344
345
  * 500: "Inter-Medium",
345
346
  * 600: "Inter-SemiBold",
346
347
  * 700: "Inter-Bold"
348
+ * },
349
+ * fontSizes: {
350
+ * h1: 48,
351
+ * h2: 40,
352
+ * body1: 16,
353
+ * caption: 12
347
354
  * }
348
355
  * }
349
356
  * });
@@ -364,6 +371,10 @@ type configProps = {
364
371
  fontWeights?: {
365
372
  [K in 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900]?: string;
366
373
  };
374
+ /** Custom font sizes for each typography variant (values in pixels, will be scaled with ms()) */
375
+ fontSizes?: {
376
+ [K in TypographyVariant]?: number;
377
+ };
367
378
  };
368
379
  };
369
380
  declare function initialize(config: configProps): void;
@@ -384,7 +395,7 @@ declare const CheckBox: FC<CheckboxProps>;
384
395
 
385
396
  declare const showFlashMessage: (msg: FlashMessageProps) => void;
386
397
 
387
- declare const FormWrapper: React.FC<FormWrapperProps>;
398
+ declare const FormWrapper: React.ForwardRefExoticComponent<FormWrapperProps & React.RefAttributes<ScrollView>>;
388
399
 
389
400
  declare const RatingInput: FC<RatingInputProps>;
390
401
  declare const RatingStars: FC<RatingStarsProps>;
@@ -274,6 +274,17 @@ var getFontFamily = (fontWeight) => {
274
274
  };
275
275
 
276
276
  // ../src/Components/Typography.tsx
277
+ var DEFAULT_FONT_SIZES = {
278
+ h1: (0, import_react_native_size_matters.ms)(42),
279
+ h2: (0, import_react_native_size_matters.ms)(37),
280
+ h3: (0, import_react_native_size_matters.ms)(32),
281
+ h4: (0, import_react_native_size_matters.ms)(27),
282
+ h5: (0, import_react_native_size_matters.ms)(22),
283
+ h6: (0, import_react_native_size_matters.ms)(17),
284
+ body1: (0, import_react_native_size_matters.ms)(15),
285
+ body2: (0, import_react_native_size_matters.ms)(12),
286
+ caption: (0, import_react_native_size_matters.ms)(10)
287
+ };
277
288
  var Typography = (0, import_react.forwardRef)(
278
289
  ({
279
290
  children,
@@ -291,18 +302,10 @@ var Typography = (0, import_react.forwardRef)(
291
302
  ...props
292
303
  }, ref) => {
293
304
  const colors2 = useColors();
294
- const _fontSize = {
295
- h1: (0, import_react_native_size_matters.ms)(42),
296
- h2: (0, import_react_native_size_matters.ms)(37),
297
- h3: (0, import_react_native_size_matters.ms)(32),
298
- h4: (0, import_react_native_size_matters.ms)(27),
299
- h5: (0, import_react_native_size_matters.ms)(22),
300
- h6: (0, import_react_native_size_matters.ms)(17),
301
- body1: (0, import_react_native_size_matters.ms)(15),
302
- body2: (0, import_react_native_size_matters.ms)(12),
303
- caption: (0, import_react_native_size_matters.ms)(10)
304
- };
305
- const f = fontSize || _fontSize[variant];
305
+ const config2 = getConfig();
306
+ const customFontSizes = config2.TYPOGRAPHY?.fontSizes;
307
+ const baseFontSize = customFontSizes?.[variant] ?? DEFAULT_FONT_SIZES[variant];
308
+ const f = fontSize || baseFontSize;
306
309
  const styles = import_react_native.StyleSheet.create({
307
310
  text: {
308
311
  lineHeight: f * 1.2,
@@ -469,7 +472,6 @@ var ConfigureSystemUI = () => {
469
472
  const colors2 = useColors();
470
473
  (0, import_react3.useEffect)(() => {
471
474
  const config2 = getConfig();
472
- import_react_native3.Appearance.setColorScheme(theme);
473
475
  if (colors2) {
474
476
  SystemUI.setBackgroundColorAsync(colors2.white[1]);
475
477
  if (import_react_native3.Platform.OS === "android") {
@@ -506,15 +508,19 @@ var UIThemeProvider = ({ children }) => {
506
508
  type: "default",
507
509
  payload: colorScheme
508
510
  });
509
- } else
511
+ import_react_native3.Appearance.setColorScheme(void 0);
512
+ } else {
510
513
  themeDispatch({
511
514
  type: val
512
515
  });
516
+ import_react_native3.Appearance.setColorScheme(val);
517
+ }
513
518
  } else {
514
519
  themeDispatch({
515
520
  type: "default",
516
521
  payload: colorScheme
517
522
  });
523
+ import_react_native3.Appearance.setColorScheme(void 0);
518
524
  }
519
525
  });
520
526
  }, [colorScheme]);
@@ -910,56 +916,59 @@ var CheckBox = ({
910
916
  // ../src/Components/FormWrapper.tsx
911
917
  var import_react10 = __toESM(require("react"));
912
918
  var import_react_native10 = require("react-native");
913
- var import_react_native_size_matters7 = require("react-native-size-matters");
914
919
  var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
915
- var FormWrapper = ({
916
- children,
917
- behavior = import_react_native10.Platform.OS === "ios" ? "padding" : "height",
918
- contentContainerStyle,
919
- mode = "scroll",
920
- keyboardVerticalOffset = 10,
921
- style = {},
922
- onScroll
923
- }) => {
924
- const { bottom } = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
925
- const defaultOffset = import_react_native10.Platform.OS === "ios" ? -bottom : -bottom * 2;
926
- const styles = import_react_native_size_matters7.ScaledSheet.create({
927
- root: {
928
- width: "100%",
929
- flex: 1,
930
- ...style
931
- }
932
- });
933
- return mode === "static" ? /* @__PURE__ */ import_react10.default.createElement(import_react_native10.TouchableWithoutFeedback, { onPress: import_react_native10.Keyboard.dismiss, accessible: false }, /* @__PURE__ */ import_react10.default.createElement(
934
- import_react_native10.KeyboardAvoidingView,
935
- {
936
- style: styles.root,
937
- behavior,
938
- contentContainerStyle: styles.root,
939
- keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
940
- },
941
- children
942
- )) : /* @__PURE__ */ import_react10.default.createElement(
943
- import_react_native10.KeyboardAvoidingView,
944
- {
945
- behavior,
946
- style: styles.root,
947
- keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
948
- },
949
- /* @__PURE__ */ import_react10.default.createElement(
950
- import_react_native10.ScrollView,
920
+ var import_react_native_size_matters7 = require("react-native-size-matters");
921
+ var FormWrapper = (0, import_react10.forwardRef)(
922
+ ({
923
+ children,
924
+ behavior = import_react_native10.Platform.OS === "ios" ? "padding" : "height",
925
+ contentContainerStyle,
926
+ mode = "scroll",
927
+ keyboardVerticalOffset = 10,
928
+ style = {},
929
+ onScroll
930
+ }, ref) => {
931
+ const { bottom } = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
932
+ const defaultOffset = import_react_native10.Platform.OS === "ios" ? -bottom : -bottom * 2;
933
+ const styles = import_react_native_size_matters7.ScaledSheet.create({
934
+ root: {
935
+ width: "100%",
936
+ flex: 1,
937
+ ...style
938
+ }
939
+ });
940
+ return mode === "static" ? /* @__PURE__ */ import_react10.default.createElement(import_react_native10.TouchableWithoutFeedback, { onPress: import_react_native10.Keyboard.dismiss, accessible: false }, /* @__PURE__ */ import_react10.default.createElement(
941
+ import_react_native10.KeyboardAvoidingView,
951
942
  {
952
- onScroll,
953
- showsVerticalScrollIndicator: false,
954
- scrollEventThrottle: 40,
955
- keyboardDismissMode: "interactive",
956
- contentContainerStyle,
957
- keyboardShouldPersistTaps: "handled"
943
+ style: styles.root,
944
+ behavior,
945
+ contentContainerStyle: styles.root,
946
+ keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
958
947
  },
959
948
  children
960
- )
961
- );
962
- };
949
+ )) : /* @__PURE__ */ import_react10.default.createElement(
950
+ import_react_native10.KeyboardAvoidingView,
951
+ {
952
+ behavior,
953
+ style: styles.root,
954
+ keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
955
+ },
956
+ /* @__PURE__ */ import_react10.default.createElement(
957
+ import_react_native10.ScrollView,
958
+ {
959
+ ref,
960
+ onScroll,
961
+ showsVerticalScrollIndicator: false,
962
+ scrollEventThrottle: 40,
963
+ keyboardDismissMode: "interactive",
964
+ contentContainerStyle,
965
+ keyboardShouldPersistTaps: "handled"
966
+ },
967
+ children
968
+ )
969
+ );
970
+ }
971
+ );
963
972
 
964
973
  // ../src/Components/StarRating.tsx
965
974
  var import_vector_icons5 = require("@expo/vector-icons");
@@ -1064,7 +1073,7 @@ var Popup = ({
1064
1073
  marginBottom: import_react_native11.Platform.OS === "android" && keyboardVisible ? bottom : 0
1065
1074
  },
1066
1075
  container: {
1067
- paddingBottom: sheet && !bare ? bottom + (0, import_react_native_size_matters8.ms)(10) : void 0,
1076
+ paddingBottom: sheet && !bare ? bottom + (0, import_react_native_size_matters8.ms)(0) : void 0,
1068
1077
  backgroundColor: theme === "dark" ? "#111" : colors2.white[1],
1069
1078
  borderTopLeftRadius: 20,
1070
1079
  borderTopRightRadius: 20,
@@ -1075,7 +1084,9 @@ var Popup = ({
1075
1084
  ...style
1076
1085
  },
1077
1086
  content: {
1087
+ maxHeight: sheet && !bare ? import_react_native11.Dimensions.get("screen").height * 0.9 - bottom - (0, import_react_native_size_matters8.ms)(60) : void 0,
1078
1088
  paddingHorizontal: bare ? void 0 : "15@ms"
1089
+ // backgroundColor : "#f94",
1079
1090
  },
1080
1091
  title: {
1081
1092
  flexDirection: "row",
@@ -1105,7 +1116,8 @@ var Popup = ({
1105
1116
  animationType: "none",
1106
1117
  statusBarTranslucent: true,
1107
1118
  visible: modalOpen,
1108
- onRequestClose: closeAction
1119
+ onRequestClose: closeAction,
1120
+ navigationBarTranslucent: true
1109
1121
  },
1110
1122
  /* @__PURE__ */ import_react11.default.createElement(UIThemeProvider, null, /* @__PURE__ */ import_react11.default.createElement(import_react_native_reanimated2.default.View, { style: [styles.backdrop, backdropAnimatedStyle] }), /* @__PURE__ */ import_react11.default.createElement(
1111
1123
  import_react_native11.KeyboardAvoidingView,
@@ -1470,22 +1482,31 @@ var SelectMenu = ({
1470
1482
  title: label,
1471
1483
  disableAutoKeyboardManagement: true
1472
1484
  },
1473
- /* @__PURE__ */ import_react15.default.createElement(import_react_native15.View, { style: styles.content }, /* @__PURE__ */ import_react15.default.createElement(import_react_native15.View, { style: styles.header }, helperText && /* @__PURE__ */ import_react15.default.createElement(Typography_default, { variant: "body2", color: "textSecondary", gutterBottom: 5 }, helperText), searchEnabled && /* @__PURE__ */ import_react15.default.createElement(
1474
- TextField_default,
1475
- {
1476
- label: searchPlaceholder,
1477
- value: search,
1478
- type: "search",
1479
- onChangeText: setSearch,
1480
- variant: "outlined"
1481
- }
1482
- )), /* @__PURE__ */ import_react15.default.createElement(
1485
+ /* @__PURE__ */ import_react15.default.createElement(import_react_native15.View, { style: styles.content }, /* @__PURE__ */ import_react15.default.createElement(
1483
1486
  import_react_native15.FlatList,
1484
1487
  {
1485
1488
  removeClippedSubviews: true,
1486
1489
  keyExtractor: (item) => item.value,
1487
1490
  bounces: false,
1488
1491
  renderItem,
1492
+ ListHeaderComponent: /* @__PURE__ */ import_react15.default.createElement(import_react_native15.View, { style: styles.header }, helperText && /* @__PURE__ */ import_react15.default.createElement(
1493
+ Typography_default,
1494
+ {
1495
+ variant: "body2",
1496
+ color: "textSecondary",
1497
+ gutterBottom: 5
1498
+ },
1499
+ helperText
1500
+ ), searchEnabled && /* @__PURE__ */ import_react15.default.createElement(
1501
+ TextField_default,
1502
+ {
1503
+ label: searchPlaceholder,
1504
+ value: search,
1505
+ type: "search",
1506
+ onChangeText: setSearch,
1507
+ variant: "outlined"
1508
+ }
1509
+ )),
1489
1510
  data: options.filter(
1490
1511
  (item) => search.length > 1 ? item.label.toLowerCase().indexOf(search.toLowerCase()) > -1 : item
1491
1512
  ).sort((a, b) => a.label.localeCompare(b.label))
@@ -1760,7 +1781,14 @@ var TextField2 = import_react16.default.forwardRef(
1760
1781
  multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
1761
1782
  );
1762
1783
  const setFocused = (value2) => {
1763
- _setFocused(value2);
1784
+ if (options && value2) {
1785
+ import_react_native16.Keyboard.dismiss();
1786
+ setTimeout(() => {
1787
+ _setFocused(value2);
1788
+ }, 100);
1789
+ } else {
1790
+ _setFocused(value2);
1791
+ }
1764
1792
  };
1765
1793
  const styles = import_react_native_size_matters13.ScaledSheet.create({
1766
1794
  root: {