@fountain-ui/core 2.0.0-beta.32 → 2.0.0-beta.33

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.
@@ -9,18 +9,20 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
+ var _styles = require("@fountain-ui/styles");
13
+
12
14
  var _Modal = _interopRequireDefault(require("../Modal"));
13
15
 
14
16
  var _Paper = _interopRequireDefault(require("../Paper"));
15
17
 
16
- var _styles = require("../styles");
18
+ var _styles2 = require("../styles");
17
19
 
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
21
 
20
22
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
23
 
22
24
  const useStyles = function () {
23
- const theme = (0, _styles.useTheme)();
25
+ const theme = (0, _styles2.useTheme)();
24
26
  const {
25
27
  width
26
28
  } = (0, _reactNative.useWindowDimensions)();
@@ -53,6 +55,7 @@ function Dialog(props) {
53
55
  children,
54
56
  fullScreen = false,
55
57
  onClose,
58
+ style = {},
56
59
  visible,
57
60
  ...otherProps
58
61
  } = props;
@@ -65,7 +68,7 @@ function Dialog(props) {
65
68
  }, otherProps), /*#__PURE__*/_react.default.createElement(_Paper.default, {
66
69
  elevation: 24,
67
70
  square: fullScreen,
68
- style: fullScreen ? styles.paperFullScreen : styles.paper
71
+ style: (0, _styles.css)([fullScreen ? styles.paperFullScreen : styles.paper, style])
69
72
  }, children));
70
73
  }
71
74
 
@@ -1 +1 @@
1
- {"version":3,"names":["useStyles","theme","useTheme","width","useWindowDimensions","margin","spacing","root","alignItems","justifyContent","zIndex","dialog","paper","maxWidth","overflow","paperFullScreen","flexGrow","animation","animationFullScreen","height","Dialog","props","children","fullScreen","onClose","visible","otherProps","styles"],"sources":["Dialog.tsx"],"sourcesContent":["import React from 'react';\nimport { useWindowDimensions } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport Modal from '../Modal';\nimport Paper from '../Paper';\nimport { useTheme } from '../styles';\nimport type DialogProps from './DialogProps';\n\ntype DialogStyleKeys =\n | 'root'\n | 'paper'\n | 'paperFullScreen'\n | 'animation'\n | 'animationFullScreen';\n\ntype DialogStyles = NamedStylesStringUnion<DialogStyleKeys>;\n\nconst useStyles: UseStyles<DialogStyles> = function (): DialogStyles {\n const theme = useTheme();\n\n const { width } = useWindowDimensions();\n\n const margin = theme.spacing(4);\n\n return {\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: theme.zIndex.dialog,\n },\n paper: {\n margin,\n maxWidth: 328,\n overflow: 'hidden',\n width: width - margin * 2,\n },\n paperFullScreen: {\n flexGrow: 1,\n },\n animation: {},\n animationFullScreen: {\n width: '100%',\n height: '100%',\n },\n };\n};\n\nexport default function Dialog(props: DialogProps) {\n const {\n children,\n fullScreen = false,\n onClose,\n visible,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n return (\n <Modal\n animationStyle={fullScreen ? styles.animationFullScreen : styles.animation}\n onClose={onClose}\n visible={visible}\n style={styles.root}\n {...otherProps}\n >\n <Paper\n elevation={24}\n square={fullScreen}\n style={fullScreen ? styles.paperFullScreen : styles.paper}\n >\n {children}\n </Paper>\n </Modal>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;;;AAYA,MAAMA,SAAkC,GAAG,YAA0B;EACjE,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAM;IAAEC;EAAF,IAAY,IAAAC,gCAAA,GAAlB;EAEA,MAAMC,MAAM,GAAGJ,KAAK,CAACK,OAAN,CAAc,CAAd,CAAf;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,UAAU,EAAE,QADV;MAEFC,cAAc,EAAE,QAFd;MAGFC,MAAM,EAAET,KAAK,CAACS,MAAN,CAAaC;IAHnB,CADH;IAMHC,KAAK,EAAE;MACHP,MADG;MAEHQ,QAAQ,EAAE,GAFP;MAGHC,QAAQ,EAAE,QAHP;MAIHX,KAAK,EAAEA,KAAK,GAAGE,MAAM,GAAG;IAJrB,CANJ;IAYHU,eAAe,EAAE;MACbC,QAAQ,EAAE;IADG,CAZd;IAeHC,SAAS,EAAE,EAfR;IAgBHC,mBAAmB,EAAE;MACjBf,KAAK,EAAE,MADU;MAEjBgB,MAAM,EAAE;IAFS;EAhBlB,CAAP;AAqBH,CA5BD;;AA8Be,SAASC,MAAT,CAAgBC,KAAhB,EAAoC;EAC/C,MAAM;IACFC,QADE;IAEFC,UAAU,GAAG,KAFX;IAGFC,OAHE;IAIFC,OAJE;IAKF,GAAGC;EALD,IAMFL,KANJ;EAQA,MAAMM,MAAM,GAAG3B,SAAS,EAAxB;EAEA,oBACI,6BAAC,cAAD;IACI,cAAc,EAAEuB,UAAU,GAAGI,MAAM,CAACT,mBAAV,GAAgCS,MAAM,CAACV,SADrE;IAEI,OAAO,EAAEO,OAFb;IAGI,OAAO,EAAEC,OAHb;IAII,KAAK,EAAEE,MAAM,CAACpB;EAJlB,GAKQmB,UALR,gBAOI,6BAAC,cAAD;IACI,SAAS,EAAE,EADf;IAEI,MAAM,EAAEH,UAFZ;IAGI,KAAK,EAAEA,UAAU,GAAGI,MAAM,CAACZ,eAAV,GAA4BY,MAAM,CAACf;EAHxD,GAKKU,QALL,CAPJ,CADJ;AAiBH;;AAAA"}
1
+ {"version":3,"names":["useStyles","theme","useTheme","width","useWindowDimensions","margin","spacing","root","alignItems","justifyContent","zIndex","dialog","paper","maxWidth","overflow","paperFullScreen","flexGrow","animation","animationFullScreen","height","Dialog","props","children","fullScreen","onClose","style","visible","otherProps","styles","css"],"sources":["Dialog.tsx"],"sourcesContent":["import React from 'react';\nimport { useWindowDimensions } from 'react-native';\nimport { css, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport Modal from '../Modal';\nimport Paper from '../Paper';\nimport { useTheme } from '../styles';\nimport type DialogProps from './DialogProps';\n\ntype DialogStyleKeys =\n | 'root'\n | 'paper'\n | 'paperFullScreen'\n | 'animation'\n | 'animationFullScreen';\n\ntype DialogStyles = NamedStylesStringUnion<DialogStyleKeys>;\n\nconst useStyles: UseStyles<DialogStyles> = function (): DialogStyles {\n const theme = useTheme();\n\n const { width } = useWindowDimensions();\n\n const margin = theme.spacing(4);\n\n return {\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: theme.zIndex.dialog,\n },\n paper: {\n margin,\n maxWidth: 328,\n overflow: 'hidden',\n width: width - margin * 2,\n },\n paperFullScreen: {\n flexGrow: 1,\n },\n animation: {},\n animationFullScreen: {\n width: '100%',\n height: '100%',\n },\n };\n};\n\nexport default function Dialog(props: DialogProps) {\n const {\n children,\n fullScreen = false,\n onClose,\n style = {},\n visible,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n return (\n <Modal\n animationStyle={fullScreen ? styles.animationFullScreen : styles.animation}\n onClose={onClose}\n visible={visible}\n style={styles.root}\n {...otherProps}\n >\n <Paper\n elevation={24}\n square={fullScreen}\n style={css([\n fullScreen ? styles.paperFullScreen : styles.paper,\n style,\n ])}\n >\n {children}\n </Paper>\n </Modal>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAYA,MAAMA,SAAkC,GAAG,YAA0B;EACjE,MAAMC,KAAK,GAAG,IAAAC,iBAAA,GAAd;EAEA,MAAM;IAAEC;EAAF,IAAY,IAAAC,gCAAA,GAAlB;EAEA,MAAMC,MAAM,GAAGJ,KAAK,CAACK,OAAN,CAAc,CAAd,CAAf;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,UAAU,EAAE,QADV;MAEFC,cAAc,EAAE,QAFd;MAGFC,MAAM,EAAET,KAAK,CAACS,MAAN,CAAaC;IAHnB,CADH;IAMHC,KAAK,EAAE;MACHP,MADG;MAEHQ,QAAQ,EAAE,GAFP;MAGHC,QAAQ,EAAE,QAHP;MAIHX,KAAK,EAAEA,KAAK,GAAGE,MAAM,GAAG;IAJrB,CANJ;IAYHU,eAAe,EAAE;MACbC,QAAQ,EAAE;IADG,CAZd;IAeHC,SAAS,EAAE,EAfR;IAgBHC,mBAAmB,EAAE;MACjBf,KAAK,EAAE,MADU;MAEjBgB,MAAM,EAAE;IAFS;EAhBlB,CAAP;AAqBH,CA5BD;;AA8Be,SAASC,MAAT,CAAgBC,KAAhB,EAAoC;EAC/C,MAAM;IACFC,QADE;IAEFC,UAAU,GAAG,KAFX;IAGFC,OAHE;IAIFC,KAAK,GAAG,EAJN;IAKFC,OALE;IAMF,GAAGC;EAND,IAOFN,KAPJ;EASA,MAAMO,MAAM,GAAG5B,SAAS,EAAxB;EAEA,oBACI,6BAAC,cAAD;IACI,cAAc,EAAEuB,UAAU,GAAGK,MAAM,CAACV,mBAAV,GAAgCU,MAAM,CAACX,SADrE;IAEI,OAAO,EAAEO,OAFb;IAGI,OAAO,EAAEE,OAHb;IAII,KAAK,EAAEE,MAAM,CAACrB;EAJlB,GAKQoB,UALR,gBAOI,6BAAC,cAAD;IACI,SAAS,EAAE,EADf;IAEI,MAAM,EAAEJ,UAFZ;IAGI,KAAK,EAAE,IAAAM,WAAA,EAAI,CACPN,UAAU,GAAGK,MAAM,CAACb,eAAV,GAA4Ba,MAAM,CAAChB,KADtC,EAEPa,KAFO,CAAJ;EAHX,GAQKH,QARL,CAPJ,CADJ;AAoBH;;AAAA"}
@@ -87,7 +87,9 @@ const styles = _styles.StyleSheet.create({
87
87
 
88
88
  const Typography = /*#__PURE__*/_react.default.forwardRef(function Typography(props, ref) {
89
89
  const {
90
+ accessibilityRole,
90
91
  align = 'inherit',
92
+ ariaLevel,
91
93
  disableFontScaling = false,
92
94
  children,
93
95
  color: colorProp = 'inherit',
@@ -112,12 +114,13 @@ const Typography = /*#__PURE__*/_react.default.forwardRef(function Typography(pr
112
114
  textAlign: align === 'inherit' ? 'auto' : align
113
115
  }, textWrapStyle, fontStyle, style]);
114
116
  const accessibility = accessibilityMap[variant];
115
- const accessibilityRole = href !== undefined ? 'link' : accessibility === null || accessibility === void 0 ? void 0 : accessibility.accessibilityRole;
117
+ const variantRole = href !== undefined ? 'link' : accessibility === null || accessibility === void 0 ? void 0 : accessibility.accessibilityRole;
118
+ const variantLevel = accessibility === null || accessibility === void 0 ? void 0 : accessibility['area-level'];
116
119
  return /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
117
120
  ref: ref,
121
+ accessibilityRole: accessibilityRole || variantRole,
118
122
  allowFontScaling: !disableFontScaling,
119
- accessibilityRole: accessibilityRole,
120
- "aria-level": accessibility === null || accessibility === void 0 ? void 0 : accessibility['area-level'],
123
+ "aria-level": ariaLevel || variantLevel,
121
124
  children: children,
122
125
  ellipsizeMode: ellipsizeMode // @ts-ignore
123
126
  ,
@@ -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","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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AGlBgB,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
+ {"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","ariaLevel","disableFontScaling","children","color","ellipsizeMode","href","numberOfLines","onPress","selectable","style","variant","useTheme","fontStyle","createFontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","css","textAlign","accessibility","variantRole","variantLevel","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 accessibilityRole,\n align = 'inherit',\n ariaLevel,\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 variantRole = href !== undefined ? 'link' : accessibility?.accessibilityRole;\n const variantLevel = accessibility?.['area-level'];\n\n return (\n <Text\n ref={ref}\n accessibilityRole={accessibilityRole || variantRole}\n allowFontScaling={!disableFontScaling}\n aria-level={ariaLevel || variantLevel}\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,C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EoC,QAAQ,EAAE;EAAZ,CAA9D,GAAuF,EAA7G;EAEA,MAAMC,SAAS,GAAG,IAAAC,WAAA,EAAI,CAClB/B,MAAM,CAACG,IADW,EAElB;IAAE6B,SAAS,EAAErB,KAAK,KAAK,SAAV,GAAsB,MAAtB,GAA+BA;EAA5C,CAFkB,EAGlBiB,aAHkB,EAIlBJ,SAJkB,EAKlBH,KALkB,CAAJ,CAAlB;EAQA,MAAMY,aAAa,GAAG1D,gBAAgB,CAAC+C,OAAD,CAAtC;EACA,MAAMY,WAAW,GAAGjB,IAAI,KAAKvB,SAAT,GAAqB,MAArB,GAA8BuC,aAA9B,aAA8BA,aAA9B,uBAA8BA,aAAa,CAAExD,iBAAjE;EACA,MAAM0D,YAAY,GAAGF,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAG,YAAH,CAAlC;EAEA,oBACI,6BAAC,iBAAD;IACI,GAAG,EAAEvB,GADT;IAEI,iBAAiB,EAAEjC,iBAAiB,IAAIyD,WAF5C;IAGI,gBAAgB,EAAE,CAACrB,kBAHvB;IAII,cAAYD,SAAS,IAAIuB,YAJ7B;IAKI,QAAQ,EAAErB,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,CAvDkB,CAAnB;;4BAyDevB,cAAA,CAAM6B,IAAN,CAAW9B,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 * 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":""}
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 * Applies HTML tag at web and communicates purpose of component at app\n */\n accessibilityRole?: AccessibilityProps['accessibilityRole'];\n\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 * Applies HTML heading level\n */\n ariaLevel?: number;\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":""}
@@ -2,6 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
 
3
3
  import React from 'react';
4
4
  import { useWindowDimensions } from 'react-native';
5
+ import { css } from '@fountain-ui/styles';
5
6
  import Modal from '../Modal';
6
7
  import Paper from '../Paper';
7
8
  import { useTheme } from '../styles';
@@ -40,6 +41,7 @@ export default function Dialog(props) {
40
41
  children,
41
42
  fullScreen = false,
42
43
  onClose,
44
+ style = {},
43
45
  visible,
44
46
  ...otherProps
45
47
  } = props;
@@ -52,7 +54,7 @@ export default function Dialog(props) {
52
54
  }, otherProps), /*#__PURE__*/React.createElement(Paper, {
53
55
  elevation: 24,
54
56
  square: fullScreen,
55
- style: fullScreen ? styles.paperFullScreen : styles.paper
57
+ style: css([fullScreen ? styles.paperFullScreen : styles.paper, style])
56
58
  }, children));
57
59
  }
58
60
  ;
@@ -1 +1 @@
1
- {"version":3,"names":["React","useWindowDimensions","Modal","Paper","useTheme","useStyles","theme","width","margin","spacing","root","alignItems","justifyContent","zIndex","dialog","paper","maxWidth","overflow","paperFullScreen","flexGrow","animation","animationFullScreen","height","Dialog","props","children","fullScreen","onClose","visible","otherProps","styles"],"sources":["Dialog.tsx"],"sourcesContent":["import React from 'react';\nimport { useWindowDimensions } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport Modal from '../Modal';\nimport Paper from '../Paper';\nimport { useTheme } from '../styles';\nimport type DialogProps from './DialogProps';\n\ntype DialogStyleKeys =\n | 'root'\n | 'paper'\n | 'paperFullScreen'\n | 'animation'\n | 'animationFullScreen';\n\ntype DialogStyles = NamedStylesStringUnion<DialogStyleKeys>;\n\nconst useStyles: UseStyles<DialogStyles> = function (): DialogStyles {\n const theme = useTheme();\n\n const { width } = useWindowDimensions();\n\n const margin = theme.spacing(4);\n\n return {\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: theme.zIndex.dialog,\n },\n paper: {\n margin,\n maxWidth: 328,\n overflow: 'hidden',\n width: width - margin * 2,\n },\n paperFullScreen: {\n flexGrow: 1,\n },\n animation: {},\n animationFullScreen: {\n width: '100%',\n height: '100%',\n },\n };\n};\n\nexport default function Dialog(props: DialogProps) {\n const {\n children,\n fullScreen = false,\n onClose,\n visible,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n return (\n <Modal\n animationStyle={fullScreen ? styles.animationFullScreen : styles.animation}\n onClose={onClose}\n visible={visible}\n style={styles.root}\n {...otherProps}\n >\n <Paper\n elevation={24}\n square={fullScreen}\n style={fullScreen ? styles.paperFullScreen : styles.paper}\n >\n {children}\n </Paper>\n </Modal>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,mBAAT,QAAoC,cAApC;AAEA,OAAOC,KAAP,MAAkB,UAAlB;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,SAASC,QAAT,QAAyB,WAAzB;;AAYA,MAAMC,SAAkC,GAAG,YAA0B;EACjE,MAAMC,KAAK,GAAGF,QAAQ,EAAtB;EAEA,MAAM;IAAEG;EAAF,IAAYN,mBAAmB,EAArC;EAEA,MAAMO,MAAM,GAAGF,KAAK,CAACG,OAAN,CAAc,CAAd,CAAf;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,UAAU,EAAE,QADV;MAEFC,cAAc,EAAE,QAFd;MAGFC,MAAM,EAAEP,KAAK,CAACO,MAAN,CAAaC;IAHnB,CADH;IAMHC,KAAK,EAAE;MACHP,MADG;MAEHQ,QAAQ,EAAE,GAFP;MAGHC,QAAQ,EAAE,QAHP;MAIHV,KAAK,EAAEA,KAAK,GAAGC,MAAM,GAAG;IAJrB,CANJ;IAYHU,eAAe,EAAE;MACbC,QAAQ,EAAE;IADG,CAZd;IAeHC,SAAS,EAAE,EAfR;IAgBHC,mBAAmB,EAAE;MACjBd,KAAK,EAAE,MADU;MAEjBe,MAAM,EAAE;IAFS;EAhBlB,CAAP;AAqBH,CA5BD;;AA8BA,eAAe,SAASC,MAAT,CAAgBC,KAAhB,EAAoC;EAC/C,MAAM;IACFC,QADE;IAEFC,UAAU,GAAG,KAFX;IAGFC,OAHE;IAIFC,OAJE;IAKF,GAAGC;EALD,IAMFL,KANJ;EAQA,MAAMM,MAAM,GAAGzB,SAAS,EAAxB;EAEA,oBACI,oBAAC,KAAD;IACI,cAAc,EAAEqB,UAAU,GAAGI,MAAM,CAACT,mBAAV,GAAgCS,MAAM,CAACV,SADrE;IAEI,OAAO,EAAEO,OAFb;IAGI,OAAO,EAAEC,OAHb;IAII,KAAK,EAAEE,MAAM,CAACpB;EAJlB,GAKQmB,UALR,gBAOI,oBAAC,KAAD;IACI,SAAS,EAAE,EADf;IAEI,MAAM,EAAEH,UAFZ;IAGI,KAAK,EAAEA,UAAU,GAAGI,MAAM,CAACZ,eAAV,GAA4BY,MAAM,CAACf;EAHxD,GAKKU,QALL,CAPJ,CADJ;AAiBH;AAAA"}
1
+ {"version":3,"names":["React","useWindowDimensions","css","Modal","Paper","useTheme","useStyles","theme","width","margin","spacing","root","alignItems","justifyContent","zIndex","dialog","paper","maxWidth","overflow","paperFullScreen","flexGrow","animation","animationFullScreen","height","Dialog","props","children","fullScreen","onClose","style","visible","otherProps","styles"],"sources":["Dialog.tsx"],"sourcesContent":["import React from 'react';\nimport { useWindowDimensions } from 'react-native';\nimport { css, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport Modal from '../Modal';\nimport Paper from '../Paper';\nimport { useTheme } from '../styles';\nimport type DialogProps from './DialogProps';\n\ntype DialogStyleKeys =\n | 'root'\n | 'paper'\n | 'paperFullScreen'\n | 'animation'\n | 'animationFullScreen';\n\ntype DialogStyles = NamedStylesStringUnion<DialogStyleKeys>;\n\nconst useStyles: UseStyles<DialogStyles> = function (): DialogStyles {\n const theme = useTheme();\n\n const { width } = useWindowDimensions();\n\n const margin = theme.spacing(4);\n\n return {\n root: {\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: theme.zIndex.dialog,\n },\n paper: {\n margin,\n maxWidth: 328,\n overflow: 'hidden',\n width: width - margin * 2,\n },\n paperFullScreen: {\n flexGrow: 1,\n },\n animation: {},\n animationFullScreen: {\n width: '100%',\n height: '100%',\n },\n };\n};\n\nexport default function Dialog(props: DialogProps) {\n const {\n children,\n fullScreen = false,\n onClose,\n style = {},\n visible,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n return (\n <Modal\n animationStyle={fullScreen ? styles.animationFullScreen : styles.animation}\n onClose={onClose}\n visible={visible}\n style={styles.root}\n {...otherProps}\n >\n <Paper\n elevation={24}\n square={fullScreen}\n style={css([\n fullScreen ? styles.paperFullScreen : styles.paper,\n style,\n ])}\n >\n {children}\n </Paper>\n </Modal>\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,mBAAT,QAAoC,cAApC;AACA,SAASC,GAAT,QAAuD,qBAAvD;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,OAAOC,KAAP,MAAkB,UAAlB;AACA,SAASC,QAAT,QAAyB,WAAzB;;AAYA,MAAMC,SAAkC,GAAG,YAA0B;EACjE,MAAMC,KAAK,GAAGF,QAAQ,EAAtB;EAEA,MAAM;IAAEG;EAAF,IAAYP,mBAAmB,EAArC;EAEA,MAAMQ,MAAM,GAAGF,KAAK,CAACG,OAAN,CAAc,CAAd,CAAf;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,UAAU,EAAE,QADV;MAEFC,cAAc,EAAE,QAFd;MAGFC,MAAM,EAAEP,KAAK,CAACO,MAAN,CAAaC;IAHnB,CADH;IAMHC,KAAK,EAAE;MACHP,MADG;MAEHQ,QAAQ,EAAE,GAFP;MAGHC,QAAQ,EAAE,QAHP;MAIHV,KAAK,EAAEA,KAAK,GAAGC,MAAM,GAAG;IAJrB,CANJ;IAYHU,eAAe,EAAE;MACbC,QAAQ,EAAE;IADG,CAZd;IAeHC,SAAS,EAAE,EAfR;IAgBHC,mBAAmB,EAAE;MACjBd,KAAK,EAAE,MADU;MAEjBe,MAAM,EAAE;IAFS;EAhBlB,CAAP;AAqBH,CA5BD;;AA8BA,eAAe,SAASC,MAAT,CAAgBC,KAAhB,EAAoC;EAC/C,MAAM;IACFC,QADE;IAEFC,UAAU,GAAG,KAFX;IAGFC,OAHE;IAIFC,KAAK,GAAG,EAJN;IAKFC,OALE;IAMF,GAAGC;EAND,IAOFN,KAPJ;EASA,MAAMO,MAAM,GAAG1B,SAAS,EAAxB;EAEA,oBACI,oBAAC,KAAD;IACI,cAAc,EAAEqB,UAAU,GAAGK,MAAM,CAACV,mBAAV,GAAgCU,MAAM,CAACX,SADrE;IAEI,OAAO,EAAEO,OAFb;IAGI,OAAO,EAAEE,OAHb;IAII,KAAK,EAAEE,MAAM,CAACrB;EAJlB,GAKQoB,UALR,gBAOI,oBAAC,KAAD;IACI,SAAS,EAAE,EADf;IAEI,MAAM,EAAEJ,UAFZ;IAGI,KAAK,EAAEzB,GAAG,CAAC,CACPyB,UAAU,GAAGK,MAAM,CAACb,eAAV,GAA4Ba,MAAM,CAAChB,KADtC,EAEPa,KAFO,CAAD;EAHd,GAQKH,QARL,CAPJ,CADJ;AAoBH;AAAA"}
@@ -74,7 +74,9 @@ const styles = StyleSheet.create({
74
74
  });
75
75
  const Typography = /*#__PURE__*/React.forwardRef(function Typography(props, ref) {
76
76
  const {
77
+ accessibilityRole,
77
78
  align = 'inherit',
79
+ ariaLevel,
78
80
  disableFontScaling = false,
79
81
  children,
80
82
  color: colorProp = 'inherit',
@@ -99,12 +101,13 @@ const Typography = /*#__PURE__*/React.forwardRef(function Typography(props, ref)
99
101
  textAlign: align === 'inherit' ? 'auto' : align
100
102
  }, textWrapStyle, fontStyle, style]);
101
103
  const accessibility = accessibilityMap[variant];
102
- const accessibilityRole = href !== undefined ? 'link' : accessibility === null || accessibility === void 0 ? void 0 : accessibility.accessibilityRole;
104
+ const variantRole = href !== undefined ? 'link' : accessibility === null || accessibility === void 0 ? void 0 : accessibility.accessibilityRole;
105
+ const variantLevel = accessibility === null || accessibility === void 0 ? void 0 : accessibility['area-level'];
103
106
  return /*#__PURE__*/React.createElement(Text, {
104
107
  ref: ref,
108
+ accessibilityRole: accessibilityRole || variantRole,
105
109
  allowFontScaling: !disableFontScaling,
106
- accessibilityRole: accessibilityRole,
107
- "aria-level": accessibility === null || accessibility === void 0 ? void 0 : accessibility['area-level'],
110
+ "aria-level": ariaLevel || variantLevel,
108
111
  children: children,
109
112
  ellipsizeMode: ellipsizeMode // @ts-ignore
110
113
  ,
@@ -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","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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GADT;IAEI,gBAAgB,EAAE,CAACE,kBAFvB;IAGI,iBAAiB,EAAEhC,iBAHvB;IAII,cAAYiD,aAAZ,aAAYA,aAAZ,uBAAYA,aAAa,CAAG,YAAH,CAJ7B;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
+ {"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","ariaLevel","disableFontScaling","children","color","ellipsizeMode","href","numberOfLines","onPress","selectable","style","variant","fontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","textAlign","accessibility","variantRole","variantLevel","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 accessibilityRole,\n align = 'inherit',\n ariaLevel,\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 variantRole = href !== undefined ? 'link' : accessibility?.accessibilityRole;\n const variantLevel = accessibility?.['area-level'];\n\n return (\n <Text\n ref={ref}\n accessibilityRole={accessibilityRole || variantRole}\n allowFontScaling={!disableFontScaling}\n aria-level={ariaLevel || variantLevel}\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,SAAS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sB,MAAtB,GAA+BA;EAA5C,CAFkB,EAGlBe,aAHkB,EAIlBH,SAJkB,EAKlBF,KALkB,CAAD,CAArB;EAQA,MAAMS,aAAa,GAAGpD,gBAAgB,CAAC4C,OAAD,CAAtC;EACA,MAAMS,WAAW,GAAGd,IAAI,KAAKrB,SAAT,GAAqB,MAArB,GAA8BkC,aAA9B,aAA8BA,aAA9B,uBAA8BA,aAAa,CAAElD,iBAAjE;EACA,MAAMoD,YAAY,GAAGF,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAG,YAAH,CAAlC;EAEA,oBACI,oBAAC,IAAD;IACI,GAAG,EAAEpB,GADT;IAEI,iBAAiB,EAAE9B,iBAAiB,IAAImD,WAF5C;IAGI,gBAAgB,EAAE,CAAClB,kBAHvB;IAII,cAAYD,SAAS,IAAIoB,YAJ7B;IAKI,QAAQ,EAAElB,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,CAvDkB,CAAnB;AAyDA,4BAAezD,KAAK,CAAC8D,IAAN,CAAW1B,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 * 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":""}
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 * Applies HTML tag at web and communicates purpose of component at app\n */\n accessibilityRole?: AccessibilityProps['accessibilityRole'];\n\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 * Applies HTML heading level\n */\n ariaLevel?: number;\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":""}
@@ -13,12 +13,20 @@ export interface AccessibilityMap extends Partial<{
13
13
  }> {
14
14
  }
15
15
  export default interface TypographyProps extends ComponentProps<{
16
+ /**
17
+ * Applies HTML tag at web and communicates purpose of component at app
18
+ */
19
+ accessibilityRole?: AccessibilityProps['accessibilityRole'];
16
20
  /**
17
21
  * Set the text-align on the component.
18
22
  * The value 'justify' is not supported on Android and fallbacks to left.
19
23
  * @default 'inherit'
20
24
  */
21
25
  align?: TypographyAlign;
26
+ /**
27
+ * Applies HTML heading level
28
+ */
29
+ ariaLevel?: number;
22
30
  /**
23
31
  * Specifies whether fonts should scale to respect Text Size accessibility settings.
24
32
  * @default false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fountain-ui/core",
3
- "version": "2.0.0-beta.32",
3
+ "version": "2.0.0-beta.33",
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": "b95359524cf4e246be3dce3580f3d587502429e6"
70
+ "gitHead": "11146e1f82cb8ae3d2743e72ea50eacbe1307035"
71
71
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useWindowDimensions } from 'react-native';
3
- import { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';
3
+ import { css, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';
4
4
  import Modal from '../Modal';
5
5
  import Paper from '../Paper';
6
6
  import { useTheme } from '../styles';
@@ -50,6 +50,7 @@ export default function Dialog(props: DialogProps) {
50
50
  children,
51
51
  fullScreen = false,
52
52
  onClose,
53
+ style = {},
53
54
  visible,
54
55
  ...otherProps
55
56
  } = props;
@@ -67,7 +68,10 @@ export default function Dialog(props: DialogProps) {
67
68
  <Paper
68
69
  elevation={24}
69
70
  square={fullScreen}
70
- style={fullScreen ? styles.paperFullScreen : styles.paper}
71
+ style={css([
72
+ fullScreen ? styles.paperFullScreen : styles.paper,
73
+ style,
74
+ ])}
71
75
  >
72
76
  {children}
73
77
  </Paper>
@@ -45,7 +45,9 @@ const styles = StyleSheet.create({
45
45
 
46
46
  const Typography = React.forwardRef<Text, TypographyProps>(function Typography(props, ref) {
47
47
  const {
48
+ accessibilityRole,
48
49
  align = 'inherit',
50
+ ariaLevel,
49
51
  disableFontScaling = false,
50
52
  children,
51
53
  color: colorProp = 'inherit',
@@ -77,14 +79,15 @@ const Typography = React.forwardRef<Text, TypographyProps>(function Typography(p
77
79
  ]);
78
80
 
79
81
  const accessibility = accessibilityMap[variant];
80
- const accessibilityRole = href !== undefined ? 'link' : accessibility?.accessibilityRole;
82
+ const variantRole = href !== undefined ? 'link' : accessibility?.accessibilityRole;
83
+ const variantLevel = accessibility?.['area-level'];
81
84
 
82
85
  return (
83
86
  <Text
84
87
  ref={ref}
88
+ accessibilityRole={accessibilityRole || variantRole}
85
89
  allowFontScaling={!disableFontScaling}
86
- accessibilityRole={accessibilityRole}
87
- aria-level={accessibility?.['area-level']}
90
+ aria-level={ariaLevel || variantLevel}
88
91
  children={children}
89
92
  ellipsizeMode={ellipsizeMode}
90
93
  // @ts-ignore
@@ -39,6 +39,11 @@ export interface AccessibilityMap extends Partial<{
39
39
  }> {}
40
40
 
41
41
  export default interface TypographyProps extends ComponentProps<{
42
+ /**
43
+ * Applies HTML tag at web and communicates purpose of component at app
44
+ */
45
+ accessibilityRole?: AccessibilityProps['accessibilityRole'];
46
+
42
47
  /**
43
48
  * Set the text-align on the component.
44
49
  * The value 'justify' is not supported on Android and fallbacks to left.
@@ -46,6 +51,11 @@ export default interface TypographyProps extends ComponentProps<{
46
51
  */
47
52
  align?: TypographyAlign;
48
53
 
54
+ /**
55
+ * Applies HTML heading level
56
+ */
57
+ ariaLevel?: number;
58
+
49
59
  /**
50
60
  * Specifies whether fonts should scale to respect Text Size accessibility settings.
51
61
  * @default false