@coorpacademy/components 11.40.18-react18.7 → 11.40.18-react18.8

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 +1 @@
1
- {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/atom/html/index.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAO,SAAS,EAAE,UAAU,EAAE,SAAS,EAAsB,MAAM,cAAc,CAAC;AAqBzF,oBAAY,KAAK,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAqBF,QAAA,MAAM,IAAI,UAAW,KAAK,sBA4IzB,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/atom/html/index.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAO,SAAS,EAAE,UAAU,EAAE,SAAS,EAAsB,MAAM,cAAc,CAAC;AAqBzF,oBAAY,KAAK,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAqBF,QAAA,MAAM,IAAI,UAAW,KAAK,sBA8IzB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -94,8 +94,9 @@ const Html = props => {
94
94
  }
95
95
  }
96
96
  const SpanRenderer = useCallback((htmlAttribs, _children) => /*#__PURE__*/React.createElement(Text, {
97
- numberOfLines: numberOfLines
98
- }, _children), [numberOfLines]);
97
+ numberOfLines: numberOfLines,
98
+ style: baseFontStyle
99
+ }, _children), [numberOfLines, baseFontStyle]);
99
100
  const FontRenderer = useCallback((htmlAttribs, _children) => {
100
101
  if (htmlAttribs.color) {
101
102
  disableBaseFontStyleColor(true);
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":["React","useCallback","useMemo","useState","View","useWindowDimensions","RenderHTML","HTML_ANCHOR_TEXT_COLOR","useTemplateContext","Text","HtmlBase","props","createElement","Html","templateContext","width","contentWidth","isDisabledBaseFontStyleColor","disableBaseFontStyleColor","theme","children","fontSize","containerStyle","imageStyle","style","testID","anchorTextColor","isTextCentered","numberOfLines","styles","p","marginVertical","textAlign","u","textDecorationLine","i","fontStyle","b","fontWeight","bold","s","tagsStyles","h1","h2","h3","h4","h5","h6","a","color","img","baseFontStyle","colors","black","Array","isArray","styleObject","reduce","result","child","SpanRenderer","htmlAttribs","_children","FontRenderer","key","replace","renderers","font","span","source","html","undefined","ignoredStyles"],"sources":["../../../src/atom/html/index.native.tsx"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport {View, ViewStyle, ImageStyle, TextStyle, useWindowDimensions} from 'react-native';\nimport RenderHTML, {\n CustomRendererProps,\n MixedStyleRecord,\n RenderHTMLProps,\n TBlock\n} from 'react-native-render-html';\n\nimport {HTML_ANCHOR_TEXT_COLOR} from '../../variables/theme.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport Text from '../text/index.native';\n\ninterface CustomRenderHTMLProps extends RenderHTMLProps {\n baseFontStyle?: TextStyle;\n testID?: string;\n}\n\nconst HtmlBase = (props: CustomRenderHTMLProps) => {\n return <RenderHTML {...props} />;\n};\n\nexport type Props = {\n children: string;\n fontSize?: TextStyle['fontSize'];\n numberOfLines?: number;\n onLinkPress?: (url: string) => void;\n containerStyle?: ViewStyle;\n anchorTextColor?: string;\n imageStyle?: ImageStyle;\n style?: ViewStyle | ViewStyle[];\n testID?: string;\n isTextCentered?: boolean;\n};\n\ntype Styles = {\n p: {\n marginVertical: ViewStyle['marginVertical'];\n textAlign: TextStyle['textAlign'];\n };\n u: {\n textDecorationLine: TextStyle['textDecorationLine'];\n };\n i: {\n fontStyle: TextStyle['fontStyle'];\n };\n b: {\n fontWeight: TextStyle['fontWeight'];\n };\n s: {\n textDecorationLine: TextStyle['textDecorationLine'];\n };\n};\n\nconst Html = (props: Props) => {\n const templateContext = useTemplateContext();\n const {width: contentWidth} = useWindowDimensions();\n const [isDisabledBaseFontStyleColor, disableBaseFontStyleColor] = useState<boolean>(false);\n const {theme} = templateContext;\n const {\n children,\n fontSize,\n containerStyle,\n imageStyle,\n style,\n testID,\n anchorTextColor = HTML_ANCHOR_TEXT_COLOR,\n isTextCentered,\n numberOfLines\n } = props;\n\n // Don't use StyleSheet there, it's not a react style\n const styles: Styles = {\n p: {\n marginVertical: 0,\n textAlign: 'center'\n },\n u: {\n textDecorationLine: 'underline'\n },\n i: {\n fontStyle: 'italic'\n },\n b: {\n fontWeight: theme.fontWeight.bold\n },\n s: {\n textDecorationLine: 'line-through'\n }\n };\n\n const tagsStyles = {\n ...styles,\n h1: {fontSize},\n h2: {fontSize},\n h3: {fontSize},\n h4: {fontSize},\n h5: {fontSize},\n h6: {fontSize},\n a: {color: anchorTextColor},\n img: imageStyle || {}\n } as MixedStyleRecord;\n\n let baseFontStyle: TextStyle = useMemo(\n () => ({fontSize, color: theme.colors.black}),\n [fontSize, theme]\n );\n\n if (style) {\n if (Array.isArray(style)) {\n const styleObject = style.reduce((result, child) => ({\n ...result,\n ...child\n }));\n baseFontStyle = {\n ...baseFontStyle,\n ...styleObject\n };\n } else {\n baseFontStyle = {\n ...baseFontStyle,\n ...style\n };\n }\n }\n\n const SpanRenderer = useCallback(\n (htmlAttribs: CustomRendererProps<TBlock>, _children: string) => (\n <Text numberOfLines={numberOfLines}>{_children}</Text>\n ),\n [numberOfLines]\n );\n\n interface HtmlAttrib extends CustomRendererProps<TBlock> {\n color?: string;\n }\n\n const FontRenderer = useCallback(\n (htmlAttribs: HtmlAttrib, _children: string) => {\n if (htmlAttribs.color) {\n disableBaseFontStyleColor(true);\n }\n\n return (\n <Text\n key={1}\n style={{\n ...baseFontStyle,\n color: htmlAttribs.color?.replace(/ /g, '')\n }}\n >\n {_children}\n </Text>\n );\n },\n [baseFontStyle]\n );\n\n const renderers = {\n font: FontRenderer,\n span: SpanRenderer\n };\n\n return (\n <View testID={testID} style={containerStyle}>\n <HtmlBase\n // to text-align center on android\n // we have to encapsulate between <p> tag\n // and use custom style define on <p>\n // definition in component style doesn't work\n source={{\n // eslint-disable-next-line no-nested-ternary\n html: isTextCentered\n ? `<p>${children}</p>`\n : numberOfLines\n ? `<span>${children}</span>`\n : `${children}`\n }}\n contentWidth={contentWidth}\n tagsStyles={tagsStyles}\n baseFontStyle={{\n ...baseFontStyle,\n color: isDisabledBaseFontStyleColor ? undefined : baseFontStyle.color\n }}\n renderers={renderers}\n // this is exceptionally for the onboarding course\n // is the only course that has a gif in the context but the img tag\n // comes with width & height attr and these makes this lib do not render the gif\n // so to avoid it, we decided to ignore these attr\n ignoredStyles={['width', 'height']}\n testID=\"html-base\"\n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CAAC,IAAI,CAAC;IACjC;IAEA,oBACElB,KAAA,CAAAY,aAAA,CAACH,IAAI;MACHuD,GAAG,EAAE,CAAE;MACPxC,KAAK,EAAE;QACL,GAAG2B,aAAa;QAChBF,KAAK,EAAEY,WAAW,CAACZ,KAAK,EAAEgB,OAAO,CAAC,IAAI,EAAE,EAAE;MAC5C;IAAE,GAEDH,SACG,CAAC;EAEX,CAAC,EACD,CAACX,aAAa,CAChB,CAAC;EAED,MAAMe,SAAS,GAAG;IAChBC,IAAI,EAAEJ,YAAY;IAClBK,IAAI,EAAER;EACR,CAAC;EAED,oBACE5D,KAAA,CAAAY,aAAA,CAACR,IAAI;IAACqB,MAAM,EAAEA,MAAO;IAACD,KAAK,EAAEF;EAAe,gBAC1CtB,KAAA,CAAAY,aAAA,CAACF;EACC;EACA;EACA;EACA;EAAA;IACA2D,MAAM,EAAE;MACN;MACAC,IAAI,EAAE3C,cAAc,GAChB,MAAMP,QAAQ,MAAM,GACpBQ,aAAa,GACb,SAASR,QAAQ,SAAS,GAC1B,GAAGA,QAAQ;IACjB,CAAE;IACFJ,YAAY,EAAEA,YAAa;IAC3ByB,UAAU,EAAEA,UAAW;IACvBU,aAAa,EAAE;MACb,GAAGA,aAAa;MAChBF,KAAK,EAAEhC,4BAA4B,GAAGsD,SAAS,GAAGpB,aAAa,CAACF;IAClE,CAAE;IACFiB,SAAS,EAAEA;IACX;IACA;IACA;IACA;IAAA;IACAM,aAAa,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAE;IACnC/C,MAAM,EAAC;EAAW,CACnB,CACG,CAAC;AAEX,CAAC;AAED,eAAeZ,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":["React","useCallback","useMemo","useState","View","useWindowDimensions","RenderHTML","HTML_ANCHOR_TEXT_COLOR","useTemplateContext","Text","HtmlBase","props","createElement","Html","templateContext","width","contentWidth","isDisabledBaseFontStyleColor","disableBaseFontStyleColor","theme","children","fontSize","containerStyle","imageStyle","style","testID","anchorTextColor","isTextCentered","numberOfLines","styles","p","marginVertical","textAlign","u","textDecorationLine","i","fontStyle","b","fontWeight","bold","s","tagsStyles","h1","h2","h3","h4","h5","h6","a","color","img","baseFontStyle","colors","black","Array","isArray","styleObject","reduce","result","child","SpanRenderer","htmlAttribs","_children","FontRenderer","key","replace","renderers","font","span","source","html","undefined","ignoredStyles"],"sources":["../../../src/atom/html/index.native.tsx"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport {View, ViewStyle, ImageStyle, TextStyle, useWindowDimensions} from 'react-native';\nimport RenderHTML, {\n CustomRendererProps,\n MixedStyleRecord,\n RenderHTMLProps,\n TBlock\n} from 'react-native-render-html';\n\nimport {HTML_ANCHOR_TEXT_COLOR} from '../../variables/theme.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport Text from '../text/index.native';\n\ninterface CustomRenderHTMLProps extends RenderHTMLProps {\n baseFontStyle?: TextStyle;\n testID?: string;\n}\n\nconst HtmlBase = (props: CustomRenderHTMLProps) => {\n return <RenderHTML {...props} />;\n};\n\nexport type Props = {\n children: string;\n fontSize?: TextStyle['fontSize'];\n numberOfLines?: number;\n onLinkPress?: (url: string) => void;\n containerStyle?: ViewStyle;\n anchorTextColor?: string;\n imageStyle?: ImageStyle;\n style?: ViewStyle | ViewStyle[];\n testID?: string;\n isTextCentered?: boolean;\n};\n\ntype Styles = {\n p: {\n marginVertical: ViewStyle['marginVertical'];\n textAlign: TextStyle['textAlign'];\n };\n u: {\n textDecorationLine: TextStyle['textDecorationLine'];\n };\n i: {\n fontStyle: TextStyle['fontStyle'];\n };\n b: {\n fontWeight: TextStyle['fontWeight'];\n };\n s: {\n textDecorationLine: TextStyle['textDecorationLine'];\n };\n};\n\nconst Html = (props: Props) => {\n const templateContext = useTemplateContext();\n const {width: contentWidth} = useWindowDimensions();\n const [isDisabledBaseFontStyleColor, disableBaseFontStyleColor] = useState<boolean>(false);\n const {theme} = templateContext;\n const {\n children,\n fontSize,\n containerStyle,\n imageStyle,\n style,\n testID,\n anchorTextColor = HTML_ANCHOR_TEXT_COLOR,\n isTextCentered,\n numberOfLines\n } = props;\n\n // Don't use StyleSheet there, it's not a react style\n const styles: Styles = {\n p: {\n marginVertical: 0,\n textAlign: 'center'\n },\n u: {\n textDecorationLine: 'underline'\n },\n i: {\n fontStyle: 'italic'\n },\n b: {\n fontWeight: theme.fontWeight.bold\n },\n s: {\n textDecorationLine: 'line-through'\n }\n };\n\n const tagsStyles = {\n ...styles,\n h1: {fontSize},\n h2: {fontSize},\n h3: {fontSize},\n h4: {fontSize},\n h5: {fontSize},\n h6: {fontSize},\n a: {color: anchorTextColor},\n img: imageStyle || {}\n } as MixedStyleRecord;\n\n let baseFontStyle: TextStyle = useMemo(\n () => ({fontSize, color: theme.colors.black}),\n [fontSize, theme]\n );\n\n if (style) {\n if (Array.isArray(style)) {\n const styleObject = style.reduce((result, child) => ({\n ...result,\n ...child\n }));\n baseFontStyle = {\n ...baseFontStyle,\n ...styleObject\n };\n } else {\n baseFontStyle = {\n ...baseFontStyle,\n ...style\n };\n }\n }\n\n const SpanRenderer = useCallback(\n (htmlAttribs: CustomRendererProps<TBlock>, _children: string) => (\n <Text numberOfLines={numberOfLines} style={baseFontStyle}>\n {_children}\n </Text>\n ),\n [numberOfLines, baseFontStyle]\n );\n\n interface HtmlAttrib extends CustomRendererProps<TBlock> {\n color?: string;\n }\n\n const FontRenderer = useCallback(\n (htmlAttribs: HtmlAttrib, _children: string) => {\n if (htmlAttribs.color) {\n disableBaseFontStyleColor(true);\n }\n\n return (\n <Text\n key={1}\n style={{\n ...baseFontStyle,\n color: htmlAttribs.color?.replace(/ /g, '')\n }}\n >\n {_children}\n </Text>\n );\n },\n [baseFontStyle]\n );\n\n const renderers = {\n font: FontRenderer,\n span: SpanRenderer\n };\n\n return (\n <View testID={testID} style={containerStyle}>\n <HtmlBase\n // to text-align center on android\n // we have to encapsulate between <p> tag\n // and use custom style define on <p>\n // definition in component style doesn't work\n source={{\n // eslint-disable-next-line no-nested-ternary\n html: isTextCentered\n ? `<p>${children}</p>`\n : numberOfLines\n ? `<span>${children}</span>`\n : `${children}`\n }}\n contentWidth={contentWidth}\n tagsStyles={tagsStyles}\n baseFontStyle={{\n ...baseFontStyle,\n color: isDisabledBaseFontStyleColor ? undefined : baseFontStyle.color\n }}\n renderers={renderers}\n // this is exceptionally for the onboarding course\n // is the only course that has a gif in the context but the img tag\n // comes with width & height attr and these makes this lib do not render the gif\n // so to avoid it, we decided to ignore these attr\n ignoredStyles={['width', 'height']}\n testID=\"html-base\"\n />\n </View>\n );\n};\n\nexport default Html;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAGC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAO,OAAO;AAC3D,SAAQC,IAAI,EAAoCC,mBAAmB,QAAO,cAAc;AACxF,OAAOC,UAAU,MAKV,0BAA0B;AAEjC,SAAQC,sBAAsB,QAAO,8BAA8B;AACnE,SAAQC,kBAAkB,QAAO,4CAA4C;AAC7E,OAAOC,IAAI,MAAM,sBAAsB;AAOvC,MAAMC,QAAQ,GAAIC,KAA4B,IAAK;EACjD,oBAAOX,KAAA,CAAAY,aAAA,CAACN,UAAU,EAAKK,KAAQ,CAAC;AAClC,CAAC;AAkCD,MAAME,IAAI,GAAIF,KAAY,IAAK;EAC7B,MAAMG,eAAe,GAAGN,kBAAkB,CAAC,CAAC;EAC5C,MAAM;IAACO,KAAK,EAAEC;EAAY,CAAC,GAAGX,mBAAmB,CAAC,CAAC;EACnD,MAAM,CAACY,4BAA4B,EAAEC,yBAAyB,CAAC,GAAGf,QAAQ,CAAU,KAAK,CAAC;EAC1F,MAAM;IAACgB;EAAK,CAAC,GAAGL,eAAe;EAC/B,MAAM;IACJM,QAAQ;IACRC,QAAQ;IACRC,cAAc;IACdC,UAAU;IACVC,KAAK;IACLC,MAAM;IACNC,eAAe,GAAGnB,sBAAsB;IACxCoB,cAAc;IACdC;EACF,CAAC,GAAGjB,KAAK;;EAET;EACA,MA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B,SAAS,EAAEA;IACX;IACA;IACA;IACA;IAAA;IACAM,aAAa,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAE;IACnC/C,MAAM,EAAC;EAAW,CACnB,CACG,CAAC;AAEX,CAAC;AAED,eAAeZ,IAAI","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/atom/html/index.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAO,SAAS,EAAE,UAAU,EAAE,SAAS,EAAsB,MAAM,cAAc,CAAC;AAqBzF,oBAAY,KAAK,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAqBF,QAAA,MAAM,IAAI,UAAW,KAAK,sBA4IzB,CAAC;AAEF,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../../../src/atom/html/index.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAO,SAAS,EAAE,UAAU,EAAE,SAAS,EAAsB,MAAM,cAAc,CAAC;AAqBzF,oBAAY,KAAK,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAqBF,QAAA,MAAM,IAAI,UAAW,KAAK,sBA8IzB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -101,8 +101,9 @@ const Html = props => {
101
101
  }
102
102
  }
103
103
  const SpanRenderer = (0, _react.useCallback)((htmlAttribs, _children) => /*#__PURE__*/_react.default.createElement(_index.default, {
104
- numberOfLines: numberOfLines
105
- }, _children), [numberOfLines]);
104
+ numberOfLines: numberOfLines,
105
+ style: baseFontStyle
106
+ }, _children), [numberOfLines, baseFontStyle]);
106
107
  const FontRenderer = (0, _react.useCallback)((htmlAttribs, _children) => {
107
108
  if (htmlAttribs.color) {
108
109
  disableBaseFontStyleColor(true);
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeRenderHtml","_interopRequireDefault","_theme","_templateContext","_index","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","HtmlBase","props","createElement","Html","templateContext","useTemplateContext","width","contentWidth","useWindowDimensions","isDisabledBaseFontStyleColor","disableBaseFontStyleColor","useState","theme","children","fontSize","containerStyle","imageStyle","style","testID","anchorTextColor","HTML_ANCHOR_TEXT_COLOR","isTextCentered","numberOfLines","styles","p","marginVertical","textAlign","textDecorationLine","fontStyle","b","fontWeight","bold","s","tagsStyles","h1","h2","h3","h4","h5","h6","color","img","baseFontStyle","useMemo","colors","black","Array","isArray","styleObject","reduce","result","child","SpanRenderer","useCallback","htmlAttribs","_children","FontRenderer","key","replace","renderers","font","span","View","source","html","undefined","ignoredStyles","_default","exports"],"sources":["../../../src/atom/html/index.native.tsx"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport {View, ViewStyle, ImageStyle, TextStyle, useWindowDimensions} from 'react-native';\nimport RenderHTML, {\n CustomRendererProps,\n MixedStyleRecord,\n RenderHTMLProps,\n TBlock\n} from 'react-native-render-html';\n\nimport {HTML_ANCHOR_TEXT_COLOR} from '../../variables/theme.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport Text from '../text/index.native';\n\ninterface CustomRenderHTMLProps extends RenderHTMLProps {\n baseFontStyle?: TextStyle;\n testID?: string;\n}\n\nconst HtmlBase = (props: CustomRenderHTMLProps) => {\n return <RenderHTML {...props} />;\n};\n\nexport type Props = {\n children: string;\n fontSize?: TextStyle['fontSize'];\n numberOfLines?: number;\n onLinkPress?: (url: string) => void;\n containerStyle?: ViewStyle;\n anchorTextColor?: string;\n imageStyle?: ImageStyle;\n style?: ViewStyle | ViewStyle[];\n testID?: string;\n isTextCentered?: boolean;\n};\n\ntype Styles = {\n p: {\n marginVertical: ViewStyle['marginVertical'];\n textAlign: TextStyle['textAlign'];\n };\n u: {\n textDecorationLine: TextStyle['textDecorationLine'];\n };\n i: {\n fontStyle: TextStyle['fontStyle'];\n };\n b: {\n fontWeight: TextStyle['fontWeight'];\n };\n s: {\n textDecorationLine: TextStyle['textDecorationLine'];\n };\n};\n\nconst Html = (props: Props) => {\n const templateContext = useTemplateContext();\n const {width: contentWidth} = useWindowDimensions();\n const [isDisabledBaseFontStyleColor, disableBaseFontStyleColor] = useState<boolean>(false);\n const {theme} = templateContext;\n const {\n children,\n fontSize,\n containerStyle,\n imageStyle,\n style,\n testID,\n anchorTextColor = HTML_ANCHOR_TEXT_COLOR,\n isTextCentered,\n numberOfLines\n } = props;\n\n // Don't use StyleSheet there, it's not a react style\n const styles: Styles = {\n p: {\n marginVertical: 0,\n textAlign: 'center'\n },\n u: {\n textDecorationLine: 'underline'\n },\n i: {\n fontStyle: 'italic'\n },\n b: {\n fontWeight: theme.fontWeight.bold\n },\n s: {\n textDecorationLine: 'line-through'\n }\n };\n\n const tagsStyles = {\n ...styles,\n h1: {fontSize},\n h2: {fontSize},\n h3: {fontSize},\n h4: {fontSize},\n h5: {fontSize},\n h6: {fontSize},\n a: {color: anchorTextColor},\n img: imageStyle || {}\n } as MixedStyleRecord;\n\n let baseFontStyle: TextStyle = useMemo(\n () => ({fontSize, color: theme.colors.black}),\n [fontSize, theme]\n );\n\n if (style) {\n if (Array.isArray(style)) {\n const styleObject = style.reduce((result, child) => ({\n ...result,\n ...child\n }));\n baseFontStyle = {\n ...baseFontStyle,\n ...styleObject\n };\n } else {\n baseFontStyle = {\n ...baseFontStyle,\n ...style\n };\n }\n }\n\n const SpanRenderer = useCallback(\n (htmlAttribs: CustomRendererProps<TBlock>, _children: string) => (\n <Text numberOfLines={numberOfLines}>{_children}</Text>\n ),\n [numberOfLines]\n );\n\n interface HtmlAttrib extends CustomRendererProps<TBlock> {\n color?: string;\n }\n\n const FontRenderer = useCallback(\n (htmlAttribs: HtmlAttrib, _children: string) => {\n if (htmlAttribs.color) {\n disableBaseFontStyleColor(true);\n }\n\n return (\n <Text\n key={1}\n style={{\n ...baseFontStyle,\n color: htmlAttribs.color?.replace(/ /g, '')\n }}\n >\n {_children}\n </Text>\n );\n },\n [baseFontStyle]\n );\n\n const renderers = {\n font: FontRenderer,\n span: SpanRenderer\n };\n\n return (\n <View testID={testID} style={containerStyle}>\n <HtmlBase\n // to text-align center on android\n // we have to encapsulate between <p> tag\n // and use custom style define on <p>\n // definition in component style doesn't work\n source={{\n // eslint-disable-next-line no-nested-ternary\n html: isTextCentered\n ? `<p>${children}</p>`\n : numberOfLines\n ? `<span>${children}</span>`\n : `${children}`\n }}\n contentWidth={contentWidth}\n tagsStyles={tagsStyles}\n baseFontStyle={{\n ...baseFontStyle,\n color: isDisabledBaseFontStyleColor ? undefined : baseFontStyle.color\n }}\n renderers={renderers}\n // this is exceptionally for the onboarding course\n // is the only course that has a gif in the context but the img tag\n // comes with width & height attr and these makes this lib do not render the gif\n // so to avoid it, we decided to ignore these attr\n ignoredStyles={['width', 'height']}\n testID=\"html-base\"\n />\n </View>\n );\n};\n\nexport default Html;\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAOA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAH,sBAAA,CAAAH,OAAA;AAAwC,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAf,CAA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,OAAO,EAAE,QAAQ,CAAE;IACnChD,MAAM,EAAC;EAAW,CACnB,CACG,CAAC;AAEX,CAAC;AAAC,IAAAiD,QAAA,GAAAC,OAAA,CAAAtF,OAAA,GAEaqB,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeRenderHtml","_interopRequireDefault","_theme","_templateContext","_index","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","HtmlBase","props","createElement","Html","templateContext","useTemplateContext","width","contentWidth","useWindowDimensions","isDisabledBaseFontStyleColor","disableBaseFontStyleColor","useState","theme","children","fontSize","containerStyle","imageStyle","style","testID","anchorTextColor","HTML_ANCHOR_TEXT_COLOR","isTextCentered","numberOfLines","styles","p","marginVertical","textAlign","textDecorationLine","fontStyle","b","fontWeight","bold","s","tagsStyles","h1","h2","h3","h4","h5","h6","color","img","baseFontStyle","useMemo","colors","black","Array","isArray","styleObject","reduce","result","child","SpanRenderer","useCallback","htmlAttribs","_children","FontRenderer","key","replace","renderers","font","span","View","source","html","undefined","ignoredStyles","_default","exports"],"sources":["../../../src/atom/html/index.native.tsx"],"sourcesContent":["import React, {useCallback, useMemo, useState} from 'react';\nimport {View, ViewStyle, ImageStyle, TextStyle, useWindowDimensions} from 'react-native';\nimport RenderHTML, {\n CustomRendererProps,\n MixedStyleRecord,\n RenderHTMLProps,\n TBlock\n} from 'react-native-render-html';\n\nimport {HTML_ANCHOR_TEXT_COLOR} from '../../variables/theme.native';\nimport {useTemplateContext} from '../../template/app-review/template-context';\nimport Text from '../text/index.native';\n\ninterface CustomRenderHTMLProps extends RenderHTMLProps {\n baseFontStyle?: TextStyle;\n testID?: string;\n}\n\nconst HtmlBase = (props: CustomRenderHTMLProps) => {\n return <RenderHTML {...props} />;\n};\n\nexport type Props = {\n children: string;\n fontSize?: TextStyle['fontSize'];\n numberOfLines?: number;\n onLinkPress?: (url: string) => void;\n containerStyle?: ViewStyle;\n anchorTextColor?: string;\n imageStyle?: ImageStyle;\n style?: ViewStyle | ViewStyle[];\n testID?: string;\n isTextCentered?: boolean;\n};\n\ntype Styles = {\n p: {\n marginVertical: ViewStyle['marginVertical'];\n textAlign: TextStyle['textAlign'];\n };\n u: {\n textDecorationLine: TextStyle['textDecorationLine'];\n };\n i: {\n fontStyle: TextStyle['fontStyle'];\n };\n b: {\n fontWeight: TextStyle['fontWeight'];\n };\n s: {\n textDecorationLine: TextStyle['textDecorationLine'];\n };\n};\n\nconst Html = (props: Props) => {\n const templateContext = useTemplateContext();\n const {width: contentWidth} = useWindowDimensions();\n const [isDisabledBaseFontStyleColor, disableBaseFontStyleColor] = useState<boolean>(false);\n const {theme} = templateContext;\n const {\n children,\n fontSize,\n containerStyle,\n imageStyle,\n style,\n testID,\n anchorTextColor = HTML_ANCHOR_TEXT_COLOR,\n isTextCentered,\n numberOfLines\n } = props;\n\n // Don't use StyleSheet there, it's not a react style\n const styles: Styles = {\n p: {\n marginVertical: 0,\n textAlign: 'center'\n },\n u: {\n textDecorationLine: 'underline'\n },\n i: {\n fontStyle: 'italic'\n },\n b: {\n fontWeight: theme.fontWeight.bold\n },\n s: {\n textDecorationLine: 'line-through'\n }\n };\n\n const tagsStyles = {\n ...styles,\n h1: {fontSize},\n h2: {fontSize},\n h3: {fontSize},\n h4: {fontSize},\n h5: {fontSize},\n h6: {fontSize},\n a: {color: anchorTextColor},\n img: imageStyle || {}\n } as MixedStyleRecord;\n\n let baseFontStyle: TextStyle = useMemo(\n () => ({fontSize, color: theme.colors.black}),\n [fontSize, theme]\n );\n\n if (style) {\n if (Array.isArray(style)) {\n const styleObject = style.reduce((result, child) => ({\n ...result,\n ...child\n }));\n baseFontStyle = {\n ...baseFontStyle,\n ...styleObject\n };\n } else {\n baseFontStyle = {\n ...baseFontStyle,\n ...style\n };\n }\n }\n\n const SpanRenderer = useCallback(\n (htmlAttribs: CustomRendererProps<TBlock>, _children: string) => (\n <Text numberOfLines={numberOfLines} style={baseFontStyle}>\n {_children}\n </Text>\n ),\n [numberOfLines, baseFontStyle]\n );\n\n interface HtmlAttrib extends CustomRendererProps<TBlock> {\n color?: string;\n }\n\n const FontRenderer = useCallback(\n (htmlAttribs: HtmlAttrib, _children: string) => {\n if (htmlAttribs.color) {\n disableBaseFontStyleColor(true);\n }\n\n return (\n <Text\n key={1}\n style={{\n ...baseFontStyle,\n color: htmlAttribs.color?.replace(/ /g, '')\n }}\n >\n {_children}\n </Text>\n );\n },\n [baseFontStyle]\n );\n\n const renderers = {\n font: FontRenderer,\n span: SpanRenderer\n };\n\n return (\n <View testID={testID} style={containerStyle}>\n <HtmlBase\n // to text-align center on android\n // we have to encapsulate between <p> tag\n // and use custom style define on <p>\n // definition in component style doesn't work\n source={{\n // eslint-disable-next-line no-nested-ternary\n html: isTextCentered\n ? `<p>${children}</p>`\n : numberOfLines\n ? `<span>${children}</span>`\n : `${children}`\n }}\n contentWidth={contentWidth}\n tagsStyles={tagsStyles}\n baseFontStyle={{\n ...baseFontStyle,\n color: isDisabledBaseFontStyleColor ? undefined : baseFontStyle.color\n }}\n renderers={renderers}\n // this is exceptionally for the onboarding course\n // is the only course that has a gif in the context but the img tag\n // comes with width & height attr and these makes this lib do not render the gif\n // so to avoid it, we decided to ignore these attr\n ignoredStyles={['width', 'height']}\n testID=\"html-base\"\n />\n </View>\n );\n};\n\nexport default Html;\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAC,sBAAA,CAAAH,OAAA;AAOA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAH,sBAAA,CAAAH,OAAA;AAAwC,SAAAG,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,K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;EAED,MAAMiB,SAAS,GAAG;IAChBC,IAAI,EAAEJ,YAAY;IAClBK,IAAI,EAAET;EACR,CAAC;EAED,oBACEjF,MAAA,CAAAW,OAAA,CAAAoB,aAAA,CAAC5B,YAAA,CAAAwF,IAAI;IAAC5C,MAAM,EAAEA,MAAO;IAACD,KAAK,EAAEF;EAAe,gBAC1C5C,MAAA,CAAAW,OAAA,CAAAoB,aAAA,CAACF;EACC;EACA;EACA;EACA;EAAA;IACA+D,MAAM,EAAE;MACN;MACAC,IAAI,EAAE3C,cAAc,GAChB,MAAMR,QAAQ,MAAM,GACpBS,aAAa,GACb,SAAST,QAAQ,SAAS,GAC1B,GAAGA,QAAQ;IACjB,CAAE;IACFN,YAAY,EAAEA,YAAa;IAC3B0B,UAAU,EAAEA,UAAW;IACvBS,aAAa,EAAE;MACb,GAAGA,aAAa;MAChBF,KAAK,EAAE/B,4BAA4B,GAAGwD,SAAS,GAAGvB,aAAa,CAACF;IAClE,CAAE;IACFmB,SAAS,EAAEA;IACX;IACA;IACA;IACA;IAAA;IACAO,aAAa,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAE;IACnChD,MAAM,EAAC;EAAW,CACnB,CACG,CAAC;AAEX,CAAC;AAAC,IAAAiD,QAAA,GAAAC,OAAA,CAAAtF,OAAA,GAEaqB,IAAI","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/components",
3
- "version": "11.40.18-react18.7+ac64e8e33",
3
+ "version": "11.40.18-react18.8+4aa3bb383",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -170,5 +170,5 @@
170
170
  "last 2 versions",
171
171
  "IE 11"
172
172
  ],
173
- "gitHead": "ac64e8e3309dbbf71639d6083ff61807bb7db805"
173
+ "gitHead": "4aa3bb3831ea49e0fe2af6b9e93be0df87f56d5f"
174
174
  }