@fountain-ui/core 2.0.0-beta.28 → 2.0.0-beta.29

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.
@@ -88,6 +88,7 @@ const styles = _styles.StyleSheet.create({
88
88
  const Typography = /*#__PURE__*/_react.default.forwardRef(function Typography(props, ref) {
89
89
  const {
90
90
  align = 'inherit',
91
+ disableFontScaling = false,
91
92
  children,
92
93
  color: colorProp = 'inherit',
93
94
  ellipsizeMode = 'tail',
@@ -114,6 +115,7 @@ const Typography = /*#__PURE__*/_react.default.forwardRef(function Typography(pr
114
115
  const accessibilityRole = href !== undefined ? 'link' : accessibility === null || accessibility === void 0 ? void 0 : accessibility.accessibilityRole;
115
116
  return /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
116
117
  ref: ref,
118
+ allowFontScaling: !disableFontScaling,
117
119
  accessibilityRole: accessibilityRole,
118
120
  "aria-level": accessibility === null || accessibility === void 0 ? void 0 : accessibility['area-level'],
119
121
  children: children,
@@ -1 +1 @@
1
- {"version":3,"names":["accessibilityMap","h1","accessibilityRole","h2","h3","subtitle1","subtitle2","body1","body2","caption1","caption2","flag","selectColor","theme","colorProp","palette","text","Platform","OS","undefined","primary","secondary","accent","hint","main","styles","StyleSheet","create","root","flexShrink","maxWidth","Typography","React","forwardRef","props","ref","align","children","color","ellipsizeMode","href","numberOfLines","onPress","selectable","style","variant","useTheme","fontStyle","createFontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","css","textAlign","accessibility","memo"],"sources":["Typography.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, Text, TextStyle } from 'react-native';\nimport type { Theme } from '@fountain-ui/styles';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport TypographyProps, { AccessibilityMap, TypographyColor } from './TypographyProps';\n\nconst accessibilityMap: AccessibilityMap = {\n h1: { accessibilityRole: 'header', 'area-level': 1 },\n h2: { accessibilityRole: 'header', 'area-level': 2 },\n h3: { accessibilityRole: 'header', 'area-level': 3 },\n subtitle1: { accessibilityRole: 'header', 'area-level': 6 },\n subtitle2: { accessibilityRole: 'header', 'area-level': 6 },\n body1: { accessibilityRole: 'text' },\n body2: { accessibilityRole: 'text' },\n caption1: { accessibilityRole: 'text' },\n caption2: { accessibilityRole: 'text' },\n flag: { accessibilityRole: 'text' },\n};\n\nfunction selectColor(theme: Theme, colorProp: TypographyColor): string | undefined {\n const palette = theme.palette.text;\n\n switch (colorProp) {\n case 'inherit':\n return Platform.OS === 'web' ? 'inherit' : undefined;\n case 'textPrimary':\n return palette.primary;\n case 'textSecondary':\n return palette.secondary;\n case 'textAccent':\n return palette.accent;\n case 'textHint':\n return palette.hint;\n }\n\n return theme.palette[colorProp]?.main;\n}\n\nconst styles = StyleSheet.create({\n root: {\n flexShrink: 1,\n ...(Platform.OS === 'web' ? { maxWidth: '100%' } : {}),\n },\n});\n\nconst Typography = React.forwardRef<Text, TypographyProps>(function Typography(props, ref) {\n const {\n align = 'inherit',\n children,\n color: colorProp = 'inherit',\n ellipsizeMode = 'tail',\n href,\n numberOfLines,\n onPress,\n selectable,\n style,\n variant = 'body1',\n } = props;\n\n const theme = useTheme();\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography[variant],\n color: selectColor(theme, colorProp),\n });\n\n // To prevent white-space: pre, word-wrap:break-word style conflicting issue at safari browser.\n const textWrapStyle = numberOfLines && numberOfLines > 0 && Platform.OS === 'web' ? { wordWrap: 'normal' } : {};\n\n const textStyle = css([\n styles.root,\n { textAlign: align === 'inherit' ? 'auto' : align },\n textWrapStyle as TextStyle,\n fontStyle,\n style,\n ]);\n\n const accessibility = accessibilityMap[variant];\n const accessibilityRole = href !== undefined ? 'link' : accessibility?.accessibilityRole;\n\n return (\n <Text\n ref={ref}\n accessibilityRole={accessibilityRole}\n aria-level={accessibility?.['area-level']}\n children={children}\n ellipsizeMode={ellipsizeMode}\n // @ts-ignore\n href={href}\n numberOfLines={numberOfLines}\n onPress={onPress}\n select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H,KALkB,CAAJ,CAAlB;EAQA,MAAMY,aAAa,GAAGxD,gBAAgB,CAAC6C,OAAD,CAAtC;EACA,MAAM3C,iBAAiB,GAAGsC,IAAI,KAAKrB,SAAT,GAAqB,MAArB,GAA8BqC,aAA9B,aAA8BA,aAA9B,uBAA8BA,aAAa,CAAEtD,iBAAvE;EAEA,oBACI,6BAAC,iBAAD;IACI,GAAG,EAAEiC,GADT;IAEI,iBAAiB,EAAEjC,iBAFvB;IAGI,cAAYsD,aAAZ,aAAYA,aAAZ,uBAAYA,aAAa,CAAG,YAAH,CAH7B;IAII,QAAQ,EAAEnB,QAJd;IAKI,aAAa,EAAEE,aALnB,CAMI;IANJ;IAOI,IAAI,EAAEC,IAPV;IAQI,aAAa,EAAEC,aARnB;IASI,OAAO,EAAEC,OATb;IAUI,UAAU,EAAEC,UAVhB;IAWI,KAAK,EAAEU;EAXX,EADJ;AAeH,CAlDkB,CAAnB;;4BAoDerB,cAAA,CAAMyB,IAAN,CAAW1B,UAAX,C"}
1
+ {"version":3,"names":["accessibilityMap","h1","accessibilityRole","h2","h3","subtitle1","subtitle2","body1","body2","caption1","caption2","flag","selectColor","theme","colorProp","palette","text","Platform","OS","undefined","primary","secondary","accent","hint","main","styles","StyleSheet","create","root","flexShrink","maxWidth","Typography","React","forwardRef","props","ref","align","disableFontScaling","children","color","ellipsizeMode","href","numberOfLines","onPress","selectable","style","variant","useTheme","fontStyle","createFontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","css","textAlign","accessibility","memo"],"sources":["Typography.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, Text, TextStyle } from 'react-native';\nimport type { Theme } from '@fountain-ui/styles';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport TypographyProps, { AccessibilityMap, TypographyColor } from './TypographyProps';\n\nconst accessibilityMap: AccessibilityMap = {\n h1: { accessibilityRole: 'header', 'area-level': 1 },\n h2: { accessibilityRole: 'header', 'area-level': 2 },\n h3: { accessibilityRole: 'header', 'area-level': 3 },\n subtitle1: { accessibilityRole: 'header', 'area-level': 6 },\n subtitle2: { accessibilityRole: 'header', 'area-level': 6 },\n body1: { accessibilityRole: 'text' },\n body2: { accessibilityRole: 'text' },\n caption1: { accessibilityRole: 'text' },\n caption2: { accessibilityRole: 'text' },\n flag: { accessibilityRole: 'text' },\n};\n\nfunction selectColor(theme: Theme, colorProp: TypographyColor): string | undefined {\n const palette = theme.palette.text;\n\n switch (colorProp) {\n case 'inherit':\n return Platform.OS === 'web' ? 'inherit' : undefined;\n case 'textPrimary':\n return palette.primary;\n case 'textSecondary':\n return palette.secondary;\n case 'textAccent':\n return palette.accent;\n case 'textHint':\n return palette.hint;\n }\n\n return theme.palette[colorProp]?.main;\n}\n\nconst styles = StyleSheet.create({\n root: {\n flexShrink: 1,\n ...(Platform.OS === 'web' ? { maxWidth: '100%' } : {}),\n },\n});\n\nconst Typography = React.forwardRef<Text, TypographyProps>(function Typography(props, ref) {\n const {\n align = 'inherit',\n disableFontScaling = false,\n children,\n color: colorProp = 'inherit',\n ellipsizeMode = 'tail',\n href,\n numberOfLines,\n onPress,\n selectable,\n style,\n variant = 'body1',\n } = props;\n\n const theme = useTheme();\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography[variant],\n color: selectColor(theme, colorProp),\n });\n\n // To prevent white-space: pre, word-wrap:break-word style conflicting issue at safari browser.\n const textWrapStyle = numberOfLines && numberOfLines > 0 && Platform.OS === 'web' ? { wordWrap: 'normal' } : {};\n\n const textStyle = css([\n styles.root,\n { textAlign: align === 'inherit' ? 'auto' : align },\n textWrapStyle as TextStyle,\n fontStyle,\n style,\n ]);\n\n const accessibility = accessibilityMap[variant];\n const accessibilityRole = href !== undefined ? 'link' : accessibility?.accessibilityRole;\n\n return (\n <Text\n ref={ref}\n allowFontScaling={!disableFontScaling}\n accessibilityRole={accessibilityRole}\n aria-level={accessibility?.['area-level']}\n children={children}\n ellipsizeMode={ellipsizeMode}\n // @ts-ignore\n href={href}\n numberOfLines={numberOfLines}\n onPress={onPress}\n selectable={selectable}\n style={textStyle}\n />\n );\n});\n\nexport default React.memo(Typography);\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;AAGA,MAAMA,gBAAkC,GAAG;EACvCC,EAAE,EAAE;IAAEC,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CADmC;EAEvCC,EAAE,EAAE;IAAED,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAFmC;EAGvCE,EAAE,EAAE;IAAEF,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAHmC;EAIvCG,SAAS,EAAE;IAAEH,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAJ4B;EAKvCI,SAAS,EAAE;IAAEJ,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAL4B;EAMvCK,KAAK,EAAE;IAAEL,iBAAiB,EAAE;EAArB,CANgC;EAOvCM,KAAK,EAAE;IAAEN,iBAAiB,EAAE;EAArB,CAPgC;EAQvCO,QAAQ,EAAE;IAAEP,iBAAiB,EAAE;EAArB,CAR6B;EASvCQ,QAAQ,EAAE;IAAER,iBAAiB,EAAE;EAArB,CAT6B;EAUvCS,IAAI,EAAE;IAAET,iBAAiB,EAAE;EAArB;AAViC,CAA3C;;AAaA,SAASU,WAAT,CAAqBC,KAArB,EAAmCC,SAAnC,EAAmF;EAAA;;EAC/E,MAAMC,OAAO,GAAGF,KAAK,CAACE,OAAN,CAAcC,IAA9B;;EAEA,QAAQF,SAAR;IACI,KAAK,SAAL;MACI,OAAOG,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GAAwB,SAAxB,GAAoCC,SAA3C;;IACJ,KAAK,aAAL;MACI,OAAOJ,OAAO,CAACK,OAAf;;IACJ,KAAK,eAAL;MACI,OAAOL,OAAO,CAACM,SAAf;;IACJ,KAAK,YAAL;MACI,OAAON,OAAO,CAACO,MAAf;;IACJ,KAAK,UAAL;MACI,OAAOP,OAAO,CA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GAA+BA;EAA5C,CAFkB,EAGlBgB,aAHkB,EAIlBJ,SAJkB,EAKlBH,KALkB,CAAJ,CAAlB;EAQA,MAAMY,aAAa,GAAGzD,gBAAgB,CAAC8C,OAAD,CAAtC;EACA,MAAM5C,iBAAiB,GAAGuC,IAAI,KAAKtB,SAAT,GAAqB,MAArB,GAA8BsC,aAA9B,aAA8BA,aAA9B,uBAA8BA,aAAa,CAAEvD,iBAAvE;EAEA,oBACI,6BAAC,iBAAD;IACI,GAAG,EAAEiC,GADT;IAEI,gBAAgB,EAAE,CAACE,kBAFvB;IAGI,iBAAiB,EAAEnC,iBAHvB;IAII,cAAYuD,aAAZ,aAAYA,aAAZ,uBAAYA,aAAa,CAAG,YAAH,CAJ7B;IAKI,QAAQ,EAAEnB,QALd;IAMI,aAAa,EAAEE,aANnB,CAOI;IAPJ;IAQI,IAAI,EAAEC,IARV;IASI,aAAa,EAAEC,aATnB;IAUI,OAAO,EAAEC,OAVb;IAWI,UAAU,EAAEC,UAXhB;IAYI,KAAK,EAAEU;EAZX,EADJ;AAgBH,CApDkB,CAAnB;;4BAsDetB,cAAA,CAAM0B,IAAN,CAAW3B,UAAX,C"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TypographyProps.ts"],"sourcesContent":["import React from 'react';\nimport type { AccessibilityProps, TextProps } from 'react-native';\nimport type { ComponentProps } from '../types';\n\nexport type TypographyAlign = 'inherit' | 'left' | 'center' | 'right' | 'justify';\n\nexport type TypographyColor =\n | 'inherit'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'warning'\n | 'error'\n | 'accent'\n | 'textPrimary'\n | 'textSecondary'\n | 'textAccent'\n | 'textHint';\n\nexport type TypographyVariant =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'subtitle1'\n | 'subtitle2'\n | 'body1'\n | 'body2'\n | 'caption1'\n | 'caption2'\n | 'flag';\n\nexport interface Accessibility {\n accessibilityRole: AccessibilityProps['accessibilityRole'];\n 'area-level'?: number;\n}\n\nexport interface AccessibilityMap extends Partial<{\n [key: string]: Accessibility;\n}> {}\n\nexport default interface TypographyProps extends ComponentProps<{\n /**\n * Set the text-align on the component.\n * The value 'justify' is not supported on Android and fallbacks to left.\n * @default 'inherit'\n */\n align?: TypographyAlign;\n\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'inherit'\n */\n color?: TypographyColor;\n\n /**\n * The text ellipsis mode.\n * @default 'tail'\n */\n ellipsizeMode?: TextProps['ellipsizeMode'];\n\n /**\n * Internal use only. The hyperlink of the text.\n */\n href?: string;\n\n /**\n * Used to truncate the text with an ellipsis after computing the text\n * layout, including line wrapping, such that the total number of lines\n * does not exceed this number.\n */\n numberOfLines?: TextProps['numberOfLines'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n onPress?: TextProps['onPress'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n selectable?: boolean;\n\n /**\n * Applies the theme typography styles.\n * @default 'body1'\n */\n variant?: TypographyVariant;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["TypographyProps.ts"],"sourcesContent":["import React from 'react';\nimport type { AccessibilityProps, TextProps } from 'react-native';\nimport type { ComponentProps } from '../types';\n\nexport type TypographyAlign = 'inherit' | 'left' | 'center' | 'right' | 'justify';\n\nexport type TypographyColor =\n | 'inherit'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'warning'\n | 'error'\n | 'accent'\n | 'textPrimary'\n | 'textSecondary'\n | 'textAccent'\n | 'textHint';\n\nexport type TypographyVariant =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'subtitle1'\n | 'subtitle2'\n | 'body1'\n | 'body2'\n | 'caption1'\n | 'caption2'\n | 'flag';\n\nexport interface Accessibility {\n accessibilityRole: AccessibilityProps['accessibilityRole'];\n 'area-level'?: number;\n}\n\nexport interface AccessibilityMap extends Partial<{\n [key: string]: Accessibility;\n}> {}\n\nexport default interface TypographyProps extends ComponentProps<{\n /**\n * Set the text-align on the component.\n * The value 'justify' is not supported on Android and fallbacks to left.\n * @default 'inherit'\n */\n align?: TypographyAlign;\n\n /**\n * Specifies whether fonts should scale to respect Text Size accessibility settings.\n * @default false\n */\n disableFontScaling?: boolean;\n\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'inherit'\n */\n color?: TypographyColor;\n\n /**\n * The text ellipsis mode.\n * @default 'tail'\n */\n ellipsizeMode?: TextProps['ellipsizeMode'];\n\n /**\n * Internal use only. The hyperlink of the text.\n */\n href?: string;\n\n /**\n * Used to truncate the text with an ellipsis after computing the text\n * layout, including line wrapping, such that the total number of lines\n * does not exceed this number.\n */\n numberOfLines?: TextProps['numberOfLines'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n onPress?: TextProps['onPress'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n selectable?: boolean;\n\n /**\n * Applies the theme typography styles.\n * @default 'body1'\n */\n variant?: TypographyVariant;\n}> {}\n"],"mappings":""}
@@ -75,6 +75,7 @@ const styles = StyleSheet.create({
75
75
  const Typography = /*#__PURE__*/React.forwardRef(function Typography(props, ref) {
76
76
  const {
77
77
  align = 'inherit',
78
+ disableFontScaling = false,
78
79
  children,
79
80
  color: colorProp = 'inherit',
80
81
  ellipsizeMode = 'tail',
@@ -101,6 +102,7 @@ const Typography = /*#__PURE__*/React.forwardRef(function Typography(props, ref)
101
102
  const accessibilityRole = href !== undefined ? 'link' : accessibility === null || accessibility === void 0 ? void 0 : accessibility.accessibilityRole;
102
103
  return /*#__PURE__*/React.createElement(Text, {
103
104
  ref: ref,
105
+ allowFontScaling: !disableFontScaling,
104
106
  accessibilityRole: accessibilityRole,
105
107
  "aria-level": accessibility === null || accessibility === void 0 ? void 0 : accessibility['area-level'],
106
108
  children: children,
@@ -1 +1 @@
1
- {"version":3,"names":["React","Platform","Text","createFontStyle","css","StyleSheet","useTheme","accessibilityMap","h1","accessibilityRole","h2","h3","subtitle1","subtitle2","body1","body2","caption1","caption2","flag","selectColor","theme","colorProp","palette","text","OS","undefined","primary","secondary","accent","hint","main","styles","create","root","flexShrink","maxWidth","Typography","forwardRef","props","ref","align","children","color","ellipsizeMode","href","numberOfLines","onPress","selectable","style","variant","fontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","textAlign","accessibility","memo"],"sources":["Typography.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, Text, TextStyle } from 'react-native';\nimport type { Theme } from '@fountain-ui/styles';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport TypographyProps, { AccessibilityMap, TypographyColor } from './TypographyProps';\n\nconst accessibilityMap: AccessibilityMap = {\n h1: { accessibilityRole: 'header', 'area-level': 1 },\n h2: { accessibilityRole: 'header', 'area-level': 2 },\n h3: { accessibilityRole: 'header', 'area-level': 3 },\n subtitle1: { accessibilityRole: 'header', 'area-level': 6 },\n subtitle2: { accessibilityRole: 'header', 'area-level': 6 },\n body1: { accessibilityRole: 'text' },\n body2: { accessibilityRole: 'text' },\n caption1: { accessibilityRole: 'text' },\n caption2: { accessibilityRole: 'text' },\n flag: { accessibilityRole: 'text' },\n};\n\nfunction selectColor(theme: Theme, colorProp: TypographyColor): string | undefined {\n const palette = theme.palette.text;\n\n switch (colorProp) {\n case 'inherit':\n return Platform.OS === 'web' ? 'inherit' : undefined;\n case 'textPrimary':\n return palette.primary;\n case 'textSecondary':\n return palette.secondary;\n case 'textAccent':\n return palette.accent;\n case 'textHint':\n return palette.hint;\n }\n\n return theme.palette[colorProp]?.main;\n}\n\nconst styles = StyleSheet.create({\n root: {\n flexShrink: 1,\n ...(Platform.OS === 'web' ? { maxWidth: '100%' } : {}),\n },\n});\n\nconst Typography = React.forwardRef<Text, TypographyProps>(function Typography(props, ref) {\n const {\n align = 'inherit',\n children,\n color: colorProp = 'inherit',\n ellipsizeMode = 'tail',\n href,\n numberOfLines,\n onPress,\n selectable,\n style,\n variant = 'body1',\n } = props;\n\n const theme = useTheme();\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography[variant],\n color: selectColor(theme, colorProp),\n });\n\n // To prevent white-space: pre, word-wrap:break-word style conflicting issue at safari browser.\n const textWrapStyle = numberOfLines && numberOfLines > 0 && Platform.OS === 'web' ? { wordWrap: 'normal' } : {};\n\n const textStyle = css([\n styles.root,\n { textAlign: align === 'inherit' ? 'auto' : align },\n textWrapStyle as TextStyle,\n fontStyle,\n style,\n ]);\n\n const accessibility = accessibilityMap[variant];\n const accessibilityRole = href !== undefined ? 'link' : accessibility?.accessibilityRole;\n\n return (\n <Text\n ref={ref}\n accessibilityRole={accessibilityRole}\n aria-level={accessibility?.['area-level']}\n children={children}\n ellipsizeMode={ellipsizeMode}\n // @ts-ignore\n href={href}\n numberOfLines={numberOfLines}\n onPress={onPress}\n selectable={selectable}\n style={textStyle}\n />\n );\n});\n\nexport default React.memo(Typography);\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA0C,cAA1C;AAEA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,UAA/B,EAA2CC,QAA3C,QAA2D,WAA3D;AAGA,MAAMC,gBAAkC,GAAG;EACvCC,EAAE,EAAE;IAAEC,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CADmC;EAEvCC,EAAE,EAAE;IAAED,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAFmC;EAGvCE,EAAE,EAAE;IAAEF,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAHmC;EAIvCG,SAAS,EAAE;IAAEH,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAJ4B;EAKvCI,SAAS,EAAE;IAAEJ,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAL4B;EAMvCK,KAAK,EAAE;IAAEL,iBAAiB,EAAE;EAArB,CANgC;E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CAAnB;AAoDA,4BAAevD,KAAK,CAAC0D,IAAN,CAAWtB,UAAX,CAAf"}
1
+ {"version":3,"names":["React","Platform","Text","createFontStyle","css","StyleSheet","useTheme","accessibilityMap","h1","accessibilityRole","h2","h3","subtitle1","subtitle2","body1","body2","caption1","caption2","flag","selectColor","theme","colorProp","palette","text","OS","undefined","primary","secondary","accent","hint","main","styles","create","root","flexShrink","maxWidth","Typography","forwardRef","props","ref","align","disableFontScaling","children","color","ellipsizeMode","href","numberOfLines","onPress","selectable","style","variant","fontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","textAlign","accessibility","memo"],"sources":["Typography.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, Text, TextStyle } from 'react-native';\nimport type { Theme } from '@fountain-ui/styles';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport TypographyProps, { AccessibilityMap, TypographyColor } from './TypographyProps';\n\nconst accessibilityMap: AccessibilityMap = {\n h1: { accessibilityRole: 'header', 'area-level': 1 },\n h2: { accessibilityRole: 'header', 'area-level': 2 },\n h3: { accessibilityRole: 'header', 'area-level': 3 },\n subtitle1: { accessibilityRole: 'header', 'area-level': 6 },\n subtitle2: { accessibilityRole: 'header', 'area-level': 6 },\n body1: { accessibilityRole: 'text' },\n body2: { accessibilityRole: 'text' },\n caption1: { accessibilityRole: 'text' },\n caption2: { accessibilityRole: 'text' },\n flag: { accessibilityRole: 'text' },\n};\n\nfunction selectColor(theme: Theme, colorProp: TypographyColor): string | undefined {\n const palette = theme.palette.text;\n\n switch (colorProp) {\n case 'inherit':\n return Platform.OS === 'web' ? 'inherit' : undefined;\n case 'textPrimary':\n return palette.primary;\n case 'textSecondary':\n return palette.secondary;\n case 'textAccent':\n return palette.accent;\n case 'textHint':\n return palette.hint;\n }\n\n return theme.palette[colorProp]?.main;\n}\n\nconst styles = StyleSheet.create({\n root: {\n flexShrink: 1,\n ...(Platform.OS === 'web' ? { maxWidth: '100%' } : {}),\n },\n});\n\nconst Typography = React.forwardRef<Text, TypographyProps>(function Typography(props, ref) {\n const {\n align = 'inherit',\n disableFontScaling = false,\n children,\n color: colorProp = 'inherit',\n ellipsizeMode = 'tail',\n href,\n numberOfLines,\n onPress,\n selectable,\n style,\n variant = 'body1',\n } = props;\n\n const theme = useTheme();\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography[variant],\n color: selectColor(theme, colorProp),\n });\n\n // To prevent white-space: pre, word-wrap:break-word style conflicting issue at safari browser.\n const textWrapStyle = numberOfLines && numberOfLines > 0 && Platform.OS === 'web' ? { wordWrap: 'normal' } : {};\n\n const textStyle = css([\n styles.root,\n { textAlign: align === 'inherit' ? 'auto' : align },\n textWrapStyle as TextStyle,\n fontStyle,\n style,\n ]);\n\n const accessibility = accessibilityMap[variant];\n const accessibilityRole = href !== undefined ? 'link' : accessibility?.accessibilityRole;\n\n return (\n <Text\n ref={ref}\n allowFontScaling={!disableFontScaling}\n accessibilityRole={accessibilityRole}\n aria-level={accessibility?.['area-level']}\n children={children}\n ellipsizeMode={ellipsizeMode}\n // @ts-ignore\n href={href}\n numberOfLines={numberOfLines}\n onPress={onPress}\n selectable={selectable}\n style={textStyle}\n />\n );\n});\n\nexport default React.memo(Typography);\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,EAAmBC,IAAnB,QAA0C,cAA1C;AAEA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,UAA/B,EAA2CC,QAA3C,QAA2D,WAA3D;AAGA,MAAMC,gBAAkC,GAAG;EACvCC,EAAE,EAAE;IAAEC,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CADmC;EAEvCC,EAAE,EAAE;IAAED,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAFmC;EAGvCE,EAAE,EAAE;IAAEF,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAHmC;EAIvCG,SAAS,EAAE;IAAEH,iBAAiB,EAAE,QAArB;IAA+B,c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AJ7B;IAKI,QAAQ,EAAEhB,QALd;IAMI,aAAa,EAAEE,aANnB,CAOI;IAPJ;IAQI,IAAI,EAAEC,IARV;IASI,aAAa,EAAEC,aATnB;IAUI,OAAO,EAAEC,OAVb;IAWI,UAAU,EAAEC,UAXhB;IAYI,KAAK,EAAEQ;EAZX,EADJ;AAgBH,CApDkB,CAAnB;AAsDA,4BAAexD,KAAK,CAAC2D,IAAN,CAAWvB,UAAX,CAAf"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TypographyProps.ts"],"sourcesContent":["import React from 'react';\nimport type { AccessibilityProps, TextProps } from 'react-native';\nimport type { ComponentProps } from '../types';\n\nexport type TypographyAlign = 'inherit' | 'left' | 'center' | 'right' | 'justify';\n\nexport type TypographyColor =\n | 'inherit'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'warning'\n | 'error'\n | 'accent'\n | 'textPrimary'\n | 'textSecondary'\n | 'textAccent'\n | 'textHint';\n\nexport type TypographyVariant =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'subtitle1'\n | 'subtitle2'\n | 'body1'\n | 'body2'\n | 'caption1'\n | 'caption2'\n | 'flag';\n\nexport interface Accessibility {\n accessibilityRole: AccessibilityProps['accessibilityRole'];\n 'area-level'?: number;\n}\n\nexport interface AccessibilityMap extends Partial<{\n [key: string]: Accessibility;\n}> {}\n\nexport default interface TypographyProps extends ComponentProps<{\n /**\n * Set the text-align on the component.\n * The value 'justify' is not supported on Android and fallbacks to left.\n * @default 'inherit'\n */\n align?: TypographyAlign;\n\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'inherit'\n */\n color?: TypographyColor;\n\n /**\n * The text ellipsis mode.\n * @default 'tail'\n */\n ellipsizeMode?: TextProps['ellipsizeMode'];\n\n /**\n * Internal use only. The hyperlink of the text.\n */\n href?: string;\n\n /**\n * Used to truncate the text with an ellipsis after computing the text\n * layout, including line wrapping, such that the total number of lines\n * does not exceed this number.\n */\n numberOfLines?: TextProps['numberOfLines'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n onPress?: TextProps['onPress'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n selectable?: boolean;\n\n /**\n * Applies the theme typography styles.\n * @default 'body1'\n */\n variant?: TypographyVariant;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["TypographyProps.ts"],"sourcesContent":["import React from 'react';\nimport type { AccessibilityProps, TextProps } from 'react-native';\nimport type { ComponentProps } from '../types';\n\nexport type TypographyAlign = 'inherit' | 'left' | 'center' | 'right' | 'justify';\n\nexport type TypographyColor =\n | 'inherit'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'warning'\n | 'error'\n | 'accent'\n | 'textPrimary'\n | 'textSecondary'\n | 'textAccent'\n | 'textHint';\n\nexport type TypographyVariant =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'subtitle1'\n | 'subtitle2'\n | 'body1'\n | 'body2'\n | 'caption1'\n | 'caption2'\n | 'flag';\n\nexport interface Accessibility {\n accessibilityRole: AccessibilityProps['accessibilityRole'];\n 'area-level'?: number;\n}\n\nexport interface AccessibilityMap extends Partial<{\n [key: string]: Accessibility;\n}> {}\n\nexport default interface TypographyProps extends ComponentProps<{\n /**\n * Set the text-align on the component.\n * The value 'justify' is not supported on Android and fallbacks to left.\n * @default 'inherit'\n */\n align?: TypographyAlign;\n\n /**\n * Specifies whether fonts should scale to respect Text Size accessibility settings.\n * @default false\n */\n disableFontScaling?: boolean;\n\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'inherit'\n */\n color?: TypographyColor;\n\n /**\n * The text ellipsis mode.\n * @default 'tail'\n */\n ellipsizeMode?: TextProps['ellipsizeMode'];\n\n /**\n * Internal use only. The hyperlink of the text.\n */\n href?: string;\n\n /**\n * Used to truncate the text with an ellipsis after computing the text\n * layout, including line wrapping, such that the total number of lines\n * does not exceed this number.\n */\n numberOfLines?: TextProps['numberOfLines'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n onPress?: TextProps['onPress'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n selectable?: boolean;\n\n /**\n * Applies the theme typography styles.\n * @default 'body1'\n */\n variant?: TypographyVariant;\n}> {}\n"],"mappings":""}
@@ -19,6 +19,11 @@ export default interface TypographyProps extends ComponentProps<{
19
19
  * @default 'inherit'
20
20
  */
21
21
  align?: TypographyAlign;
22
+ /**
23
+ * Specifies whether fonts should scale to respect Text Size accessibility settings.
24
+ * @default false
25
+ */
26
+ disableFontScaling?: boolean;
22
27
  /**
23
28
  * The content of the component.
24
29
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fountain-ui/core",
3
- "version": "2.0.0-beta.28",
3
+ "version": "2.0.0-beta.29",
4
4
  "author": "Fountain-UI Team",
5
5
  "description": "React components that implement Tappytoon's Fountain Design.",
6
6
  "license": "MIT",
@@ -67,5 +67,5 @@
67
67
  "publishConfig": {
68
68
  "access": "public"
69
69
  },
70
- "gitHead": "f39cb631cba9cee26400c78434afbde2204c33e6"
70
+ "gitHead": "7823b50021767d8276747a139fbd1e067a1f9632"
71
71
  }
@@ -46,6 +46,7 @@ const styles = StyleSheet.create({
46
46
  const Typography = React.forwardRef<Text, TypographyProps>(function Typography(props, ref) {
47
47
  const {
48
48
  align = 'inherit',
49
+ disableFontScaling = false,
49
50
  children,
50
51
  color: colorProp = 'inherit',
51
52
  ellipsizeMode = 'tail',
@@ -81,6 +82,7 @@ const Typography = React.forwardRef<Text, TypographyProps>(function Typography(p
81
82
  return (
82
83
  <Text
83
84
  ref={ref}
85
+ allowFontScaling={!disableFontScaling}
84
86
  accessibilityRole={accessibilityRole}
85
87
  aria-level={accessibility?.['area-level']}
86
88
  children={children}
@@ -46,6 +46,12 @@ export default interface TypographyProps extends ComponentProps<{
46
46
  */
47
47
  align?: TypographyAlign;
48
48
 
49
+ /**
50
+ * Specifies whether fonts should scale to respect Text Size accessibility settings.
51
+ * @default false
52
+ */
53
+ disableFontScaling?: boolean;
54
+
49
55
  /**
50
56
  * The content of the component.
51
57
  */