@coorpacademy/components 11.40.18-react18.3 → 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":[]}
@@ -38,7 +38,7 @@ const Selection = props => {
38
38
  key: item._id,
39
39
  squeezed: true,
40
40
  isSelected: true,
41
- testID: `choice-${item._id}`,
41
+ testID: `choice-${item._id}-selected`,
42
42
  onPress: onPress(item),
43
43
  questionType: "qcmDrag"
44
44
  }, item.label));
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":["React","useEffect","useState","View","StyleSheet","QuestionChoice","useTemplateContext","createSelectionStyle","theme","create","choice","margin","spacing","micro","selectionArea","flexWrap","flexDirection","text","color","colors","gray","medium","Selection","props","templateContext","onPress","styleSheet","setStylesheet","_stylesheet","choices","mappedSortedChoices","map","item","createElement","style","key","_id","squeezed","isSelected","testID","questionType","label","createStyleSheet","container","flex","pickableChoices","line","borderWidth","borderColor","borderRadius","marginHorizontal","marginBottom","marginTop","height","QuestionDraggable","selectedChoices","filter","selected"],"sources":["../../../../../src/molecule/questions/mobile/draggable/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {View, StyleSheet, ViewStyle, TextStyle} from 'react-native';\nimport QuestionChoice from '../../../../atom/choice/index.native';\nimport {useTemplateContext} from '../../../../template/app-review/template-context';\nimport {Theme} from '../../../../variables/theme.native';\n\nimport type {SelectableChoice} from '../../types';\n\nexport interface DropZoneProps {\n choices: Array<SelectableChoice>;\n onPress: (item: SelectableChoice) => () => void;\n}\n\ntype DropZoneStyleSheet = {\n choice: ViewStyle;\n selectionArea: ViewStyle;\n text: TextStyle;\n};\n\nconst createSelectionStyle = (theme: Theme): DropZoneStyleSheet =>\n StyleSheet.create({\n choice: {\n margin: theme.spacing.micro\n },\n selectionArea: {\n flexWrap: 'wrap',\n flexDirection: 'row'\n },\n text: {\n color: theme.colors.gray.medium\n }\n });\n\nconst Selection = (props: DropZoneProps) => {\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n const {onPress} = props;\n\n const [styleSheet, setStylesheet] = useState<DropZoneStyleSheet | null>(null);\n\n useEffect(() => {\n const _stylesheet = createSelectionStyle(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!styleSheet) {\n return null;\n }\n\n const {choices} = props;\n const mappedSortedChoices = choices.map(item => (\n <QuestionChoice\n style={styleSheet.choice}\n key={item._id}\n squeezed\n isSelected\n testID={`choice-${item._id}`}\n onPress={onPress(item)}\n questionType=\"qcmDrag\"\n >\n {item.label}\n </QuestionChoice>\n ));\n\n return <View style={styleSheet.selectionArea}>{mappedSortedChoices}</View>;\n};\n\nexport interface Props {\n choices: Array<SelectableChoice>;\n testID?: string;\n onPress: (item: SelectableChoice) => () => void;\n}\n\ntype QuestionDraggableStyleSheet = {\n container: ViewStyle;\n pickableChoices: ViewStyle;\n choice: ViewStyle;\n line: ViewStyle;\n};\n\nconst createStyleSheet = (theme: Theme): QuestionDraggableStyleSheet =>\n StyleSheet.create({\n container: {\n flex: 1\n },\n pickableChoices: {\n flexDirection: 'row',\n flexWrap: 'wrap'\n },\n choice: {\n margin: theme.spacing.micro\n },\n line: {\n borderWidth: 1,\n borderColor: '#E1E1E3',\n borderRadius: 17,\n marginHorizontal: 4,\n marginBottom: 24,\n marginTop: 16,\n height: 2\n }\n });\n\nconst QuestionDraggable = (props: Props) => {\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n\n const [styleSheet, setStylesheet] = useState<QuestionDraggableStyleSheet | null>(null);\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!styleSheet) {\n return null;\n }\n\n const {choices, onPress, testID} = props;\n const selectedChoices = choices.filter(item => item.selected);\n\n const pickableChoices = choices\n .filter(item => !item.selected)\n .map((item: SelectableChoice) => (\n <QuestionChoice\n style={styleSheet.choice}\n key={item._id}\n squeezed\n testID={`choice-${item._id}-unselected`}\n onPress={onPress(item)}\n questionType=\"qcmDrag\"\n >\n {item.label}\n </QuestionChoice>\n ));\n\n return (\n <View testID={testID} style={styleSheet.container}>\n <Selection choices={selectedChoices} onPress={onPress} />\n <View style={styleSheet.line} />\n <View style={styleSheet.pickableChoices}>{pickableChoices}</View>\n </View>\n );\n};\n\nexport default QuestionDraggable;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAGC,SAAS,EAAEC,QAAQ,QAAO,OAAO;AAChD,SAAQC,IAAI,EAAEC,UAAU,QAA6B,cAAc;AACnE,OAAOC,cAAc,MAAM,sCAAsC;AACjE,SAAQC,kBAAkB,QAAO,kDAAkD;AAgBnF,MAAMC,oBAAoB,GAAIC,KAAY,IACxCJ,UAAU,CAACK,MAAM,CAAC;EAChBC,MAAM,EAAE;IACNC,MAAM,EAAEH,KAAK,CAACI,OAAO,CAACC;EACxB,CAAC;EACDC,aAAa,EAAE;IACbC,QAAQ,EAAE,MAAM;IAChBC,aAAa,EAAE;EACjB,CAAC;EACDC,IAAI,EAAE;IACJC,KAAK,EAAEV,KAAK,CAACW,MAAM,CAACC,IAAI,CAACC;EAC3B;AACF,CAAC,CAAC;AAEJ,MAAMC,SAAS,GAAIC,KAAoB,IAAK;EAC1C,MAAMC,eAAe,GAAGlB,kBAAkB,CAAC,CAAC;EAC5C,MAAM;IAACE;EAAK,CAAC,GAAGgB,eAAe;EAC/B,MAAM;IAACC;EAAO,CAAC,GAAGF,KAAK;EAEvB,MAAM,CAACG,UAAU,EAAEC,aAAa,CAAC,GAAGzB,QAAQ,CAA4B,IAAI,CAAC;EAE7ED,SAAS,CAAC,MAAM;IACd,MAAM2B,WAAW,GAAGrB,oBAAoB,CAACC,KAAK,CAAC;IAC/CmB,aAAa,CAACC,WAAW,CAAC;EAC5B,CAAC,EAAE,CAACpB,KAAK,CAAC,CAAC;EAEX,IAAI,CAACkB,UAAU,EAAE;IACf,OAAO,IAAI;EACb;EAEA,MA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EX,CAAC;AAED,eAAeS,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":["React","useEffect","useState","View","StyleSheet","QuestionChoice","useTemplateContext","createSelectionStyle","theme","create","choice","margin","spacing","micro","selectionArea","flexWrap","flexDirection","text","color","colors","gray","medium","Selection","props","templateContext","onPress","styleSheet","setStylesheet","_stylesheet","choices","mappedSortedChoices","map","item","createElement","style","key","_id","squeezed","isSelected","testID","questionType","label","createStyleSheet","container","flex","pickableChoices","line","borderWidth","borderColor","borderRadius","marginHorizontal","marginBottom","marginTop","height","QuestionDraggable","selectedChoices","filter","selected"],"sources":["../../../../../src/molecule/questions/mobile/draggable/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {View, StyleSheet, ViewStyle, TextStyle} from 'react-native';\nimport QuestionChoice from '../../../../atom/choice/index.native';\nimport {useTemplateContext} from '../../../../template/app-review/template-context';\nimport {Theme} from '../../../../variables/theme.native';\n\nimport type {SelectableChoice} from '../../types';\n\nexport interface DropZoneProps {\n choices: Array<SelectableChoice>;\n onPress: (item: SelectableChoice) => () => void;\n}\n\ntype DropZoneStyleSheet = {\n choice: ViewStyle;\n selectionArea: ViewStyle;\n text: TextStyle;\n};\n\nconst createSelectionStyle = (theme: Theme): DropZoneStyleSheet =>\n StyleSheet.create({\n choice: {\n margin: theme.spacing.micro\n },\n selectionArea: {\n flexWrap: 'wrap',\n flexDirection: 'row'\n },\n text: {\n color: theme.colors.gray.medium\n }\n });\n\nconst Selection = (props: DropZoneProps) => {\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n const {onPress} = props;\n\n const [styleSheet, setStylesheet] = useState<DropZoneStyleSheet | null>(null);\n\n useEffect(() => {\n const _stylesheet = createSelectionStyle(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!styleSheet) {\n return null;\n }\n\n const {choices} = props;\n const mappedSortedChoices = choices.map(item => (\n <QuestionChoice\n style={styleSheet.choice}\n key={item._id}\n squeezed\n isSelected\n testID={`choice-${item._id}-selected`}\n onPress={onPress(item)}\n questionType=\"qcmDrag\"\n >\n {item.label}\n </QuestionChoice>\n ));\n\n return <View style={styleSheet.selectionArea}>{mappedSortedChoices}</View>;\n};\n\nexport interface Props {\n choices: Array<SelectableChoice>;\n testID?: string;\n onPress: (item: SelectableChoice) => () => void;\n}\n\ntype QuestionDraggableStyleSheet = {\n container: ViewStyle;\n pickableChoices: ViewStyle;\n choice: ViewStyle;\n line: ViewStyle;\n};\n\nconst createStyleSheet = (theme: Theme): QuestionDraggableStyleSheet =>\n StyleSheet.create({\n container: {\n flex: 1\n },\n pickableChoices: {\n flexDirection: 'row',\n flexWrap: 'wrap'\n },\n choice: {\n margin: theme.spacing.micro\n },\n line: {\n borderWidth: 1,\n borderColor: '#E1E1E3',\n borderRadius: 17,\n marginHorizontal: 4,\n marginBottom: 24,\n marginTop: 16,\n height: 2\n }\n });\n\nconst QuestionDraggable = (props: Props) => {\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n\n const [styleSheet, setStylesheet] = useState<QuestionDraggableStyleSheet | null>(null);\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!styleSheet) {\n return null;\n }\n\n const {choices, onPress, testID} = props;\n const selectedChoices = choices.filter(item => item.selected);\n\n const pickableChoices = choices\n .filter(item => !item.selected)\n .map((item: SelectableChoice) => (\n <QuestionChoice\n style={styleSheet.choice}\n key={item._id}\n squeezed\n testID={`choice-${item._id}-unselected`}\n onPress={onPress(item)}\n questionType=\"qcmDrag\"\n >\n {item.label}\n </QuestionChoice>\n ));\n\n return (\n <View testID={testID} style={styleSheet.container}>\n <Selection choices={selectedChoices} onPress={onPress} />\n <View style={styleSheet.line} />\n <View style={styleSheet.pickableChoices}>{pickableChoices}</View>\n </View>\n );\n};\n\nexport default QuestionDraggable;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAGC,SAAS,EAAEC,QAAQ,QAAO,OAAO;AACh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AACxB,IAAI,IAAIA,IAAI,CAACyB,QAAQ,CAAC;EAE7D,MAAMZ,eAAe,GAAGhB,OAAO,CAC5B2B,MAAM,CAACxB,IAAI,IAAI,CAACA,IAAI,CAACyB,QAAQ,CAAC,CAC9B1B,GAAG,CAAEC,IAAsB,iBAC1BhC,KAAA,CAAAiC,aAAA,CAAC5B,cAAc;IACb6B,KAAK,EAAER,UAAU,CAAChB,MAAO;IACzByB,GAAG,EAAEH,IAAI,CAACI,GAAI;IACdC,QAAQ;IACRE,MAAM,EAAE,UAAUP,IAAI,CAACI,GAAG,aAAc;IACxCX,OAAO,EAAEA,OAAO,CAACO,IAAI,CAAE;IACvBQ,YAAY,EAAC;EAAS,GAErBR,IAAI,CAACS,KACQ,CACjB,CAAC;EAEJ,oBACEzC,KAAA,CAAAiC,aAAA,CAAC9B,IAAI;IAACoC,MAAM,EAAEA,MAAO;IAACL,KAAK,EAAER,UAAU,CAACiB;EAAU,gBAChD3C,KAAA,CAAAiC,aAAA,CAACX,SAAS;IAACO,OAAO,EAAE0B,eAAgB;IAAC9B,OAAO,EAAEA;EAAQ,CAAE,CAAC,eACzDzB,KAAA,CAAAiC,aAAA,CAAC9B,IAAI;IAAC+B,KAAK,EAAER,UAAU,CAACoB;EAAK,CAAE,CAAC,eAChC9C,KAAA,CAAAiC,aAAA,CAAC9B,IAAI;IAAC+B,KAAK,EAAER,UAAU,CAACmB;EAAgB,GAAEA,eAAsB,CAC5D,CAAC;AAEX,CAAC;AAED,eAAeS,iBAAiB","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,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AO,CAAC,IAAI,EAAE,EAAE;MAC5C;IAAE,GAEDH,SACG,CAAC;EAEX,CAAC,EACD,CAACb,aAAa,CAChB,CAAC;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":[]}
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,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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a;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":[]}
@@ -45,7 +45,7 @@ const Selection = props => {
45
45
  key: item._id,
46
46
  squeezed: true,
47
47
  isSelected: true,
48
- testID: `choice-${item._id}`,
48
+ testID: `choice-${item._id}-selected`,
49
49
  onPress: onPress(item),
50
50
  questionType: "qcmDrag"
51
51
  }, item.label));
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":["_react","_interopRequireWildcard","require","_reactNative","_index","_interopRequireDefault","_templateContext","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createSelectionStyle","theme","StyleSheet","create","choice","margin","spacing","micro","selectionArea","flexWrap","flexDirection","text","color","colors","gray","medium","Selection","props","templateContext","useTemplateContext","onPress","styleSheet","setStylesheet","useState","useEffect","_stylesheet","choices","mappedSortedChoices","map","item","createElement","style","key","_id","squeezed","isSelected","testID","questionType","label","View","createStyleSheet","container","flex","pickableChoices","line","borderWidth","borderColor","borderRadius","marginHorizontal","marginBottom","marginTop","height","QuestionDraggable","selectedChoices","filter","selected","_default","exports"],"sources":["../../../../../src/molecule/questions/mobile/draggable/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {View, StyleSheet, ViewStyle, TextStyle} from 'react-native';\nimport QuestionChoice from '../../../../atom/choice/index.native';\nimport {useTemplateContext} from '../../../../template/app-review/template-context';\nimport {Theme} from '../../../../variables/theme.native';\n\nimport type {SelectableChoice} from '../../types';\n\nexport interface DropZoneProps {\n choices: Array<SelectableChoice>;\n onPress: (item: SelectableChoice) => () => void;\n}\n\ntype DropZoneStyleSheet = {\n choice: ViewStyle;\n selectionArea: ViewStyle;\n text: TextStyle;\n};\n\nconst createSelectionStyle = (theme: Theme): DropZoneStyleSheet =>\n StyleSheet.create({\n choice: {\n margin: theme.spacing.micro\n },\n selectionArea: {\n flexWrap: 'wrap',\n flexDirection: 'row'\n },\n text: {\n color: theme.colors.gray.medium\n }\n });\n\nconst Selection = (props: DropZoneProps) => {\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n const {onPress} = props;\n\n const [styleSheet, setStylesheet] = useState<DropZoneStyleSheet | null>(null);\n\n useEffect(() => {\n const _stylesheet = createSelectionStyle(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!styleSheet) {\n return null;\n }\n\n const {choices} = props;\n const mappedSortedChoices = choices.map(item => (\n <QuestionChoice\n style={styleSheet.choice}\n key={item._id}\n squeezed\n isSelected\n testID={`choice-${item._id}`}\n onPress={onPress(item)}\n questionType=\"qcmDrag\"\n >\n {item.label}\n </QuestionChoice>\n ));\n\n return <View style={styleSheet.selectionArea}>{mappedSortedChoices}</View>;\n};\n\nexport interface Props {\n choices: Array<SelectableChoice>;\n testID?: string;\n onPress: (item: SelectableChoice) => () => void;\n}\n\ntype QuestionDraggableStyleSheet = {\n container: ViewStyle;\n pickableChoices: ViewStyle;\n choice: ViewStyle;\n line: ViewStyle;\n};\n\nconst createStyleSheet = (theme: Theme): QuestionDraggableStyleSheet =>\n StyleSheet.create({\n container: {\n flex: 1\n },\n pickableChoices: {\n flexDirection: 'row',\n flexWrap: 'wrap'\n },\n choice: {\n margin: theme.spacing.micro\n },\n line: {\n borderWidth: 1,\n borderColor: '#E1E1E3',\n borderRadius: 17,\n marginHorizontal: 4,\n marginBottom: 24,\n marginTop: 16,\n height: 2\n }\n });\n\nconst QuestionDraggable = (props: Props) => {\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n\n const [styleSheet, setStylesheet] = useState<QuestionDraggableStyleSheet | null>(null);\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!styleSheet) {\n return null;\n }\n\n const {choices, onPress, testID} = props;\n const selectedChoices = choices.filter(item => item.selected);\n\n const pickableChoices = choices\n .filter(item => !item.selected)\n .map((item: SelectableChoice) => (\n <QuestionChoice\n style={styleSheet.choice}\n key={item._id}\n squeezed\n testID={`choice-${item._id}-unselected`}\n onPress={onPress(item)}\n questionType=\"qcmDrag\"\n >\n {item.label}\n </QuestionChoice>\n ));\n\n return (\n <View testID={testID} style={styleSheet.container}>\n <Selection choices={selectedChoices} onPress={onPress} />\n <View style={styleSheet.line} />\n <View style={styleSheet.pickableChoices}>{pickableChoices}</View>\n </View>\n );\n};\n\nexport default QuestionDraggable;\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAAoF,SAAAG,uBAAAE,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,SAAAN,wBAAAM,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAA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AA,CAACtD,YAAA,CAAA+D,IAAI;IAACH,MAAM,EAAEA,MAAO;IAACL,KAAK,EAAEV,UAAU,CAACoB;EAAU,gBAChDpE,MAAA,CAAAS,OAAA,CAAAgD,aAAA,CAACd,SAAS;IAACU,OAAO,EAAE2B,eAAgB;IAACjC,OAAO,EAAEA;EAAQ,CAAE,CAAC,eACzD/C,MAAA,CAAAS,OAAA,CAAAgD,aAAA,CAACtD,YAAA,CAAA+D,IAAI;IAACR,KAAK,EAAEV,UAAU,CAACuB;EAAK,CAAE,CAAC,eAChCvE,MAAA,CAAAS,OAAA,CAAAgD,aAAA,CAACtD,YAAA,CAAA+D,IAAI;IAACR,KAAK,EAAEV,UAAU,CAACsB;EAAgB,GAAEA,eAAsB,CAC5D,CAAC;AAEX,CAAC;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAA3E,OAAA,GAEasE,iBAAiB","ignoreList":[]}
1
+ {"version":3,"file":"index.native.js","names":["_react","_interopRequireWildcard","require","_reactNative","_index","_interopRequireDefault","_templateContext","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createSelectionStyle","theme","StyleSheet","create","choice","margin","spacing","micro","selectionArea","flexWrap","flexDirection","text","color","colors","gray","medium","Selection","props","templateContext","useTemplateContext","onPress","styleSheet","setStylesheet","useState","useEffect","_stylesheet","choices","mappedSortedChoices","map","item","createElement","style","key","_id","squeezed","isSelected","testID","questionType","label","View","createStyleSheet","container","flex","pickableChoices","line","borderWidth","borderColor","borderRadius","marginHorizontal","marginBottom","marginTop","height","QuestionDraggable","selectedChoices","filter","selected","_default","exports"],"sources":["../../../../../src/molecule/questions/mobile/draggable/index.native.tsx"],"sourcesContent":["import React, {useEffect, useState} from 'react';\nimport {View, StyleSheet, ViewStyle, TextStyle} from 'react-native';\nimport QuestionChoice from '../../../../atom/choice/index.native';\nimport {useTemplateContext} from '../../../../template/app-review/template-context';\nimport {Theme} from '../../../../variables/theme.native';\n\nimport type {SelectableChoice} from '../../types';\n\nexport interface DropZoneProps {\n choices: Array<SelectableChoice>;\n onPress: (item: SelectableChoice) => () => void;\n}\n\ntype DropZoneStyleSheet = {\n choice: ViewStyle;\n selectionArea: ViewStyle;\n text: TextStyle;\n};\n\nconst createSelectionStyle = (theme: Theme): DropZoneStyleSheet =>\n StyleSheet.create({\n choice: {\n margin: theme.spacing.micro\n },\n selectionArea: {\n flexWrap: 'wrap',\n flexDirection: 'row'\n },\n text: {\n color: theme.colors.gray.medium\n }\n });\n\nconst Selection = (props: DropZoneProps) => {\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n const {onPress} = props;\n\n const [styleSheet, setStylesheet] = useState<DropZoneStyleSheet | null>(null);\n\n useEffect(() => {\n const _stylesheet = createSelectionStyle(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!styleSheet) {\n return null;\n }\n\n const {choices} = props;\n const mappedSortedChoices = choices.map(item => (\n <QuestionChoice\n style={styleSheet.choice}\n key={item._id}\n squeezed\n isSelected\n testID={`choice-${item._id}-selected`}\n onPress={onPress(item)}\n questionType=\"qcmDrag\"\n >\n {item.label}\n </QuestionChoice>\n ));\n\n return <View style={styleSheet.selectionArea}>{mappedSortedChoices}</View>;\n};\n\nexport interface Props {\n choices: Array<SelectableChoice>;\n testID?: string;\n onPress: (item: SelectableChoice) => () => void;\n}\n\ntype QuestionDraggableStyleSheet = {\n container: ViewStyle;\n pickableChoices: ViewStyle;\n choice: ViewStyle;\n line: ViewStyle;\n};\n\nconst createStyleSheet = (theme: Theme): QuestionDraggableStyleSheet =>\n StyleSheet.create({\n container: {\n flex: 1\n },\n pickableChoices: {\n flexDirection: 'row',\n flexWrap: 'wrap'\n },\n choice: {\n margin: theme.spacing.micro\n },\n line: {\n borderWidth: 1,\n borderColor: '#E1E1E3',\n borderRadius: 17,\n marginHorizontal: 4,\n marginBottom: 24,\n marginTop: 16,\n height: 2\n }\n });\n\nconst QuestionDraggable = (props: Props) => {\n const templateContext = useTemplateContext();\n const {theme} = templateContext;\n\n const [styleSheet, setStylesheet] = useState<QuestionDraggableStyleSheet | null>(null);\n\n useEffect(() => {\n const _stylesheet = createStyleSheet(theme);\n setStylesheet(_stylesheet);\n }, [theme]);\n\n if (!styleSheet) {\n return null;\n }\n\n const {choices, onPress, testID} = props;\n const selectedChoices = choices.filter(item => item.selected);\n\n const pickableChoices = choices\n .filter(item => !item.selected)\n .map((item: SelectableChoice) => (\n <QuestionChoice\n style={styleSheet.choice}\n key={item._id}\n squeezed\n testID={`choice-${item._id}-unselected`}\n onPress={onPress(item)}\n questionType=\"qcmDrag\"\n >\n {item.label}\n </QuestionChoice>\n ));\n\n return (\n <View testID={testID} style={styleSheet.container}>\n <Selection choices={selectedChoices} onPress={onPress} />\n <View style={styleSheet.line} />\n <View style={styleSheet.pickableChoices}>{pickableChoices}</View>\n </View>\n );\n};\n\nexport default QuestionDraggable;\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AAAoF,SAAAG,uBAAAE,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,SAAAN,wBAAAM,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,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AAA,CAACtD,YAAA,CAAA+D,IAAI;IAACH,MAAM,EAAEA,MAAO;IAACL,KAAK,EAAEV,UAAU,CAACoB;EAAU,gBAChDpE,MAAA,CAAAS,OAAA,CAAAgD,aAAA,CAACd,SAAS;IAACU,OAAO,EAAE2B,eAAgB;IAACjC,OAAO,EAAEA;EAAQ,CAAE,CAAC,eACzD/C,MAAA,CAAAS,OAAA,CAAAgD,aAAA,CAACtD,YAAA,CAAA+D,IAAI;IAACR,KAAK,EAAEV,UAAU,CAACuB;EAAK,CAAE,CAAC,eAChCvE,MAAA,CAAAS,OAAA,CAAAgD,aAAA,CAACtD,YAAA,CAAA+D,IAAI;IAACR,KAAK,EAAEV,UAAU,CAACsB;EAAgB,GAAEA,eAAsB,CAC5D,CAAC;AAEX,CAAC;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAA3E,OAAA,GAEasE,iBAAiB","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coorpacademy/components",
3
- "version": "11.40.18-react18.3+e6781731d",
3
+ "version": "11.40.18-react18.8+4aa3bb383",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -65,7 +65,7 @@
65
65
  "@fortawesome/free-solid-svg-icons": "^6.5.1",
66
66
  "@fortawesome/react-fontawesome": "^0.2.0",
67
67
  "@jwplayer/jwplayer-react": "^1.1.0",
68
- "@jwplayer/jwplayer-react-native": "^1.1.3",
68
+ "@jwplayer/jwplayer-react-native": "^1.2.0",
69
69
  "@react-native-community/slider": "^4.3.2",
70
70
  "@types/react": "^18.0.0",
71
71
  "@types/react-dom": "^18.0.0",
@@ -170,5 +170,5 @@
170
170
  "last 2 versions",
171
171
  "IE 11"
172
172
  ],
173
- "gitHead": "e6781731d47392cbf2e664bf94830ac50afc83a0"
173
+ "gitHead": "4aa3bb3831ea49e0fe2af6b9e93be0df87f56d5f"
174
174
  }