@hoddy-ui/core 2.5.40 → 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,
@@ -913,56 +916,59 @@ var CheckBox = ({
913
916
  // ../src/Components/FormWrapper.tsx
914
917
  var import_react10 = __toESM(require("react"));
915
918
  var import_react_native10 = require("react-native");
916
- var import_react_native_size_matters7 = require("react-native-size-matters");
917
919
  var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
918
- var FormWrapper = ({
919
- children,
920
- behavior = import_react_native10.Platform.OS === "ios" ? "padding" : "height",
921
- contentContainerStyle,
922
- mode = "scroll",
923
- keyboardVerticalOffset = 10,
924
- style = {},
925
- onScroll
926
- }) => {
927
- const { bottom } = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
928
- const defaultOffset = import_react_native10.Platform.OS === "ios" ? -bottom : -bottom * 2;
929
- const styles = import_react_native_size_matters7.ScaledSheet.create({
930
- root: {
931
- width: "100%",
932
- flex: 1,
933
- ...style
934
- }
935
- });
936
- 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(
937
- import_react_native10.KeyboardAvoidingView,
938
- {
939
- style: styles.root,
940
- behavior,
941
- contentContainerStyle: styles.root,
942
- keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
943
- },
944
- children
945
- )) : /* @__PURE__ */ import_react10.default.createElement(
946
- import_react_native10.KeyboardAvoidingView,
947
- {
948
- behavior,
949
- style: styles.root,
950
- keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
951
- },
952
- /* @__PURE__ */ import_react10.default.createElement(
953
- 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,
954
942
  {
955
- onScroll,
956
- showsVerticalScrollIndicator: false,
957
- scrollEventThrottle: 40,
958
- keyboardDismissMode: "interactive",
959
- contentContainerStyle,
960
- keyboardShouldPersistTaps: "handled"
943
+ style: styles.root,
944
+ behavior,
945
+ contentContainerStyle: styles.root,
946
+ keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
961
947
  },
962
948
  children
963
- )
964
- );
965
- };
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
+ );
966
972
 
967
973
  // ../src/Components/StarRating.tsx
968
974
  var import_vector_icons5 = require("@expo/vector-icons");