@tallyui/components 3.12.0 → 3.13.0

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,8 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { Text as RNText } from 'react-native';
3
3
  import { Slot, TextClassContext } from '@tallyui/primitives';
4
- import { cn } from '@tallyui/theme';
4
+ import { cn, MAX_FONT_SCALE } from '@tallyui/theme';
5
5
  import { cva, type VariantProps } from 'class-variance-authority';
6
+ import { withFont } from './font-text';
6
7
 
7
8
  const textVariants = cva('text-foreground web:select-text text-base', {
8
9
  variants: {
@@ -21,12 +22,12 @@ type TextProps = React.ComponentPropsWithoutRef<typeof RNText> &
21
22
  asChild?: boolean;
22
23
  };
23
24
 
24
- function Text({ className, variant, asChild = false, children, ...props }: TextProps) {
25
+ function Text({ className, variant, asChild = false, children, maxFontSizeMultiplier = MAX_FONT_SCALE, ...props }: TextProps) {
25
26
  const textClass = React.useContext(TextClassContext);
26
- const Component = asChild ? Slot : RNText;
27
+ const Component = withFont(asChild ? Slot : RNText);
27
28
 
28
29
  return (
29
- <Component className={cn(textVariants({ variant }), textClass, className)} {...props}>
30
+ <Component className={cn(textVariants({ variant }), textClass, className)} {...props} maxFontSizeMultiplier={maxFontSizeMultiplier}>
30
31
  {children}
31
32
  </Component>
32
33
  );