@hoddy-ui/next 2.5.67 → 2.5.69

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.mts CHANGED
@@ -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";
@@ -231,6 +231,7 @@ interface TypographyProps extends TextProps {
231
231
  color?: colorTypes | (string & {});
232
232
  style?: StyleProp<TextStyle | ViewStyle>;
233
233
  textCase?: "capitalize" | "uppercase" | "lowercase" | undefined;
234
+ lineHeight?: number;
234
235
  variant?: "caption" | "body1" | "body2" | "h6" | "h5" | "h4" | "h3" | "h2" | "h1";
235
236
  align?: "center" | "left" | "right";
236
237
  gutterBottom?: number;
@@ -325,6 +326,7 @@ type AnimatorProps = (BaseAnimatorProps & {
325
326
  type: "thrownup";
326
327
  });
327
328
 
329
+ type TypographyVariant = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body1" | "body2" | "caption";
328
330
  /**
329
331
  * Configuration options for the Hoddy UI library
330
332
  *
@@ -344,6 +346,12 @@ type AnimatorProps = (BaseAnimatorProps & {
344
346
  * 500: "Inter-Medium",
345
347
  * 600: "Inter-SemiBold",
346
348
  * 700: "Inter-Bold"
349
+ * },
350
+ * fontSizes: {
351
+ * h1: 48,
352
+ * h2: 40,
353
+ * body1: 16,
354
+ * caption: 12
347
355
  * }
348
356
  * }
349
357
  * });
@@ -364,6 +372,10 @@ type configProps = {
364
372
  fontWeights?: {
365
373
  [K in 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900]?: string;
366
374
  };
375
+ /** Custom font sizes for each typography variant (values in pixels, will be scaled with ms()) */
376
+ fontSizes?: {
377
+ [K in TypographyVariant]?: number;
378
+ };
367
379
  };
368
380
  };
369
381
  declare function initialize(config: configProps): void;
@@ -384,7 +396,7 @@ declare const CheckBox: FC<CheckboxProps>;
384
396
 
385
397
  declare const showFlashMessage: (msg: FlashMessageProps) => void;
386
398
 
387
- declare const FormWrapper: React.FC<FormWrapperProps>;
399
+ declare const FormWrapper: React.ForwardRefExoticComponent<FormWrapperProps & React.RefAttributes<ScrollView>>;
388
400
 
389
401
  declare const RatingInput: FC<RatingInputProps>;
390
402
  declare const RatingStars: FC<RatingStarsProps>;
package/dist/index.d.ts CHANGED
@@ -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";
@@ -231,6 +231,7 @@ interface TypographyProps extends TextProps {
231
231
  color?: colorTypes | (string & {});
232
232
  style?: StyleProp<TextStyle | ViewStyle>;
233
233
  textCase?: "capitalize" | "uppercase" | "lowercase" | undefined;
234
+ lineHeight?: number;
234
235
  variant?: "caption" | "body1" | "body2" | "h6" | "h5" | "h4" | "h3" | "h2" | "h1";
235
236
  align?: "center" | "left" | "right";
236
237
  gutterBottom?: number;
@@ -325,6 +326,7 @@ type AnimatorProps = (BaseAnimatorProps & {
325
326
  type: "thrownup";
326
327
  });
327
328
 
329
+ type TypographyVariant = "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "body1" | "body2" | "caption";
328
330
  /**
329
331
  * Configuration options for the Hoddy UI library
330
332
  *
@@ -344,6 +346,12 @@ type AnimatorProps = (BaseAnimatorProps & {
344
346
  * 500: "Inter-Medium",
345
347
  * 600: "Inter-SemiBold",
346
348
  * 700: "Inter-Bold"
349
+ * },
350
+ * fontSizes: {
351
+ * h1: 48,
352
+ * h2: 40,
353
+ * body1: 16,
354
+ * caption: 12
347
355
  * }
348
356
  * }
349
357
  * });
@@ -364,6 +372,10 @@ type configProps = {
364
372
  fontWeights?: {
365
373
  [K in 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900]?: string;
366
374
  };
375
+ /** Custom font sizes for each typography variant (values in pixels, will be scaled with ms()) */
376
+ fontSizes?: {
377
+ [K in TypographyVariant]?: number;
378
+ };
367
379
  };
368
380
  };
369
381
  declare function initialize(config: configProps): void;
@@ -384,7 +396,7 @@ declare const CheckBox: FC<CheckboxProps>;
384
396
 
385
397
  declare const showFlashMessage: (msg: FlashMessageProps) => void;
386
398
 
387
- declare const FormWrapper: React.FC<FormWrapperProps>;
399
+ declare const FormWrapper: React.ForwardRefExoticComponent<FormWrapperProps & React.RefAttributes<ScrollView>>;
388
400
 
389
401
  declare const RatingInput: FC<RatingInputProps>;
390
402
  declare const RatingStars: FC<RatingStarsProps>;
package/dist/index.js CHANGED
@@ -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,
@@ -288,24 +299,18 @@ var Typography = (0, import_react.forwardRef)(
288
299
  fontFamily,
289
300
  // NEW PROP ADDED
290
301
  fontSize,
302
+ lineHeight,
291
303
  ...props
292
304
  }, ref) => {
293
305
  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];
306
+ const config2 = getConfig();
307
+ const customFontSizes = config2.TYPOGRAPHY?.fontSizes;
308
+ const baseFontSize = customFontSizes?.[variant] ?? DEFAULT_FONT_SIZES[variant];
309
+ const f = fontSize || baseFontSize;
310
+ const lh = lineHeight || f * 1.2;
306
311
  const styles = import_react_native.StyleSheet.create({
307
312
  text: {
308
- lineHeight: f * 1.2,
313
+ lineHeight: lh,
309
314
  fontSize: f,
310
315
  marginBottom: (0, import_react_native_size_matters.ms)(gutterBottom) || 0,
311
316
  color: colors2[color]?.main || color,
@@ -913,56 +918,59 @@ var CheckBox = ({
913
918
  // ../src/Components/FormWrapper.tsx
914
919
  var import_react10 = __toESM(require("react"));
915
920
  var import_react_native10 = require("react-native");
916
- var import_react_native_size_matters7 = require("react-native-size-matters");
917
921
  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,
922
+ var import_react_native_size_matters7 = require("react-native-size-matters");
923
+ var FormWrapper = (0, import_react10.forwardRef)(
924
+ ({
925
+ children,
926
+ behavior = import_react_native10.Platform.OS === "ios" ? "padding" : "height",
927
+ contentContainerStyle,
928
+ mode = "scroll",
929
+ keyboardVerticalOffset = 10,
930
+ style = {},
931
+ onScroll
932
+ }, ref) => {
933
+ const { bottom } = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
934
+ const defaultOffset = import_react_native10.Platform.OS === "ios" ? -bottom : -bottom * 2;
935
+ const styles = import_react_native_size_matters7.ScaledSheet.create({
936
+ root: {
937
+ width: "100%",
938
+ flex: 1,
939
+ ...style
940
+ }
941
+ });
942
+ 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(
943
+ import_react_native10.KeyboardAvoidingView,
954
944
  {
955
- onScroll,
956
- showsVerticalScrollIndicator: false,
957
- scrollEventThrottle: 40,
958
- keyboardDismissMode: "interactive",
959
- contentContainerStyle,
960
- keyboardShouldPersistTaps: "handled"
945
+ style: styles.root,
946
+ behavior,
947
+ contentContainerStyle: styles.root,
948
+ keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
961
949
  },
962
950
  children
963
- )
964
- );
965
- };
951
+ )) : /* @__PURE__ */ import_react10.default.createElement(
952
+ import_react_native10.KeyboardAvoidingView,
953
+ {
954
+ behavior,
955
+ style: styles.root,
956
+ keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
957
+ },
958
+ /* @__PURE__ */ import_react10.default.createElement(
959
+ import_react_native10.ScrollView,
960
+ {
961
+ ref,
962
+ onScroll,
963
+ showsVerticalScrollIndicator: false,
964
+ scrollEventThrottle: 40,
965
+ keyboardDismissMode: "interactive",
966
+ contentContainerStyle,
967
+ keyboardShouldPersistTaps: "handled"
968
+ },
969
+ children
970
+ )
971
+ );
972
+ }
973
+ );
966
974
 
967
975
  // ../src/Components/StarRating.tsx
968
976
  var import_vector_icons5 = require("@expo/vector-icons");