@pie-lib/text-select 1.8.6-next.528 → 1.8.6-next.631
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.
|
@@ -67,6 +67,7 @@ var Token = /*#__PURE__*/function (_React$Component) {
|
|
|
67
67
|
highlight = _this$props.highlight,
|
|
68
68
|
correct = _this$props.correct,
|
|
69
69
|
animationsDisabled = _this$props.animationsDisabled;
|
|
70
|
+
var isTouchEnabled = !('ontouchstart' in window) || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
70
71
|
var className;
|
|
71
72
|
|
|
72
73
|
if (correct === undefined && selected && disabled) {
|
|
@@ -74,7 +75,7 @@ var Token = /*#__PURE__*/function (_React$Component) {
|
|
|
74
75
|
} else if (correct !== undefined) {
|
|
75
76
|
className = (0, _classnames["default"])(Token.rootClassName, classes.custom, correct === true && classes.correct, correct === false && classes.incorrect);
|
|
76
77
|
} else {
|
|
77
|
-
className = (0, _classnames["default"])(Token.rootClassName, classes.token, disabled && classes.disabled, selectable && !disabled && classes.selectable, selected && !disabled && classes.selected, selected && disabled && classes.disabledAndSelected, highlight && selectable && !disabled && !selected && classes.highlight, animationsDisabled && classes.print, classNameProp);
|
|
78
|
+
className = (0, _classnames["default"])(Token.rootClassName, classes.token, disabled && classes.disabled, selectable && !disabled && isTouchEnabled && classes.selectable, selected && !disabled && classes.selected, selected && disabled && classes.disabledAndSelected, highlight && selectable && !disabled && !selected && classes.highlight, animationsDisabled && classes.print, classNameProp);
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
@@ -126,14 +127,14 @@ var _default = (0, _styles.withStyles)(function (theme) {
|
|
|
126
127
|
backgroundColor: 'pink' // TODO hardcoded color
|
|
127
128
|
|
|
128
129
|
},
|
|
129
|
-
selectable: {
|
|
130
|
+
selectable: (0, _defineProperty2["default"])({}, theme.breakpoints.up(769), {
|
|
130
131
|
'&:hover': {
|
|
131
132
|
backgroundColor: _renderUi.color.primaryLight(),
|
|
132
133
|
'& > *': {
|
|
133
134
|
backgroundColor: _renderUi.color.primaryLight()
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
|
-
},
|
|
137
|
+
}),
|
|
137
138
|
selected: {
|
|
138
139
|
lineHeight: 2,
|
|
139
140
|
marginTop: theme.spacing.unit / 2,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","names":["TokenTypes","text","PropTypes","string","selectable","bool","Token","props","selected","classes","classNameProp","className","disabled","index","highlight","correct","animationsDisabled","undefined","classNames","token","disabledBlack","rootClassName","custom","incorrect","disabledAndSelected","print","__html","replace","React","Component","object","isRequired","withStyles","theme","cursor","textIndent","padding","spacing","unit","paddingRight","paddingLeft","transition","color","backgroundColor","primaryLight","lineHeight","marginTop","border","boxSizing","display"],"sources":["../../src/token-select/token.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { color } from '@pie-lib/render-ui';\n\nexport const TokenTypes = {\n text: PropTypes.string,\n selectable: PropTypes.bool\n};\n\nexport class Token extends React.Component {\n static rootClassName = 'tokenRootClass';\n\n static propTypes = {\n ...TokenTypes,\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n highlight: PropTypes.bool,\n correct: PropTypes.bool,\n text: PropTypes.string.isRequired\n };\n\n static defaultProps = {\n selectable: false,\n text: ''\n };\n\n render() {\n const {\n text,\n selectable,\n selected,\n classes,\n className: classNameProp,\n disabled,\n index,\n highlight,\n correct,\n animationsDisabled\n } = this.props;\n\n let className;\n\n if (correct === undefined && selected && disabled) {\n className = classNames(classes.token, classes.selected, classes.disabledBlack);\n } else if (correct !== undefined) {\n className = classNames(\n Token.rootClassName,\n classes.custom,\n correct === true && classes.correct,\n correct === false && classes.incorrect\n );\n } else {\n className = classNames(\n Token.rootClassName,\n classes.token,\n disabled && classes.disabled,\n selectable && !disabled && classes.selectable,\n selected && !disabled && classes.selected,\n selected && disabled && classes.disabledAndSelected,\n highlight && selectable && !disabled && !selected && classes.highlight,\n animationsDisabled && classes.print,\n classNameProp\n );\n }\n\n return (\n <span\n className={className}\n dangerouslySetInnerHTML={{ __html: (text || '').replace(/\\n/g, '<br>') }}\n data-indexkey={index}\n />\n );\n }\n}\n\nexport default withStyles(theme => {\n return {\n token: {\n cursor: 'pointer',\n textIndent: 0,\n padding: theme.spacing.unit / 2,\n paddingRight: 0,\n paddingLeft: 0,\n transition: 'background-color 100ms ease-in'\n },\n disabled: {\n cursor: 'inherit',\n color: 'grey' // TODO hardcoded color\n },\n disabledBlack: {\n cursor: 'inherit'\n },\n disabledAndSelected: {\n backgroundColor: 'pink' // TODO hardcoded color\n },\n selectable: {\n '&:hover': {\n
|
|
1
|
+
{"version":3,"file":"token.js","names":["TokenTypes","text","PropTypes","string","selectable","bool","Token","props","selected","classes","classNameProp","className","disabled","index","highlight","correct","animationsDisabled","isTouchEnabled","window","navigator","maxTouchPoints","msMaxTouchPoints","undefined","classNames","token","disabledBlack","rootClassName","custom","incorrect","disabledAndSelected","print","__html","replace","React","Component","object","isRequired","withStyles","theme","cursor","textIndent","padding","spacing","unit","paddingRight","paddingLeft","transition","color","backgroundColor","breakpoints","up","primaryLight","lineHeight","marginTop","border","boxSizing","display"],"sources":["../../src/token-select/token.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { color } from '@pie-lib/render-ui';\n\nexport const TokenTypes = {\n text: PropTypes.string,\n selectable: PropTypes.bool\n};\n\nexport class Token extends React.Component {\n static rootClassName = 'tokenRootClass';\n\n static propTypes = {\n ...TokenTypes,\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n highlight: PropTypes.bool,\n correct: PropTypes.bool,\n text: PropTypes.string.isRequired\n };\n\n static defaultProps = {\n selectable: false,\n text: ''\n };\n\n render() {\n const {\n text,\n selectable,\n selected,\n classes,\n className: classNameProp,\n disabled,\n index,\n highlight,\n correct,\n animationsDisabled\n } = this.props;\n const isTouchEnabled =\n !('ontouchstart' in window) || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;\n\n let className;\n\n if (correct === undefined && selected && disabled) {\n className = classNames(classes.token, classes.selected, classes.disabledBlack);\n } else if (correct !== undefined) {\n className = classNames(\n Token.rootClassName,\n classes.custom,\n correct === true && classes.correct,\n correct === false && classes.incorrect\n );\n } else {\n className = classNames(\n Token.rootClassName,\n classes.token,\n disabled && classes.disabled,\n selectable && !disabled && isTouchEnabled && classes.selectable,\n selected && !disabled && classes.selected,\n selected && disabled && classes.disabledAndSelected,\n highlight && selectable && !disabled && !selected && classes.highlight,\n animationsDisabled && classes.print,\n classNameProp\n );\n }\n\n return (\n <span\n className={className}\n dangerouslySetInnerHTML={{ __html: (text || '').replace(/\\n/g, '<br>') }}\n data-indexkey={index}\n />\n );\n }\n}\n\nexport default withStyles(theme => {\n return {\n token: {\n cursor: 'pointer',\n textIndent: 0,\n padding: theme.spacing.unit / 2,\n paddingRight: 0,\n paddingLeft: 0,\n transition: 'background-color 100ms ease-in'\n },\n disabled: {\n cursor: 'inherit',\n color: 'grey' // TODO hardcoded color\n },\n disabledBlack: {\n cursor: 'inherit'\n },\n disabledAndSelected: {\n backgroundColor: 'pink' // TODO hardcoded color\n },\n selectable: {\n [theme.breakpoints.up(769)]: {\n '&:hover': {\n backgroundColor: color.primaryLight(),\n '& > *': {\n backgroundColor: color.primaryLight()\n }\n }\n }\n },\n selected: {\n lineHeight: 2,\n marginTop: theme.spacing.unit / 2,\n '&:hover': {\n backgroundColor: color.primaryLight()\n },\n backgroundColor: color.primaryLight(),\n '& > *': {\n backgroundColor: color.primaryLight()\n }\n },\n highlight: {\n // TODO hardcoded color,\n border: 'dashed 2px gray',\n lineHeight: 2,\n boxSizing: 'border-box',\n marginTop: theme.spacing.unit / 2,\n display: 'inline-block',\n padding: theme.spacing.unit\n },\n print: {\n border: 'dashed 2px gray',\n lineHeight: 2,\n boxSizing: 'border-box',\n marginTop: theme.spacing.unit / 2,\n display: 'inline-block',\n padding: theme.spacing.unit,\n color: color.text()\n },\n\n custom: {\n display: 'initial'\n },\n correct: {\n backgroundColor: color.correct()\n },\n incorrect: {\n backgroundColor: color.incorrect()\n }\n };\n})(Token);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEO,IAAMA,UAAU,GAAG;EACxBC,IAAI,EAAEC,qBAAA,CAAUC,MADQ;EAExBC,UAAU,EAAEF,qBAAA,CAAUG;AAFE,CAAnB;;;IAKMC,K;;;;;;;;;;;;WAkBX,kBAAS;MACP,kBAWI,KAAKC,KAXT;MAAA,IACEN,IADF,eACEA,IADF;MAAA,IAEEG,UAFF,eAEEA,UAFF;MAAA,IAGEI,QAHF,eAGEA,QAHF;MAAA,IAIEC,OAJF,eAIEA,OAJF;MAAA,IAKaC,aALb,eAKEC,SALF;MAAA,IAMEC,QANF,eAMEA,QANF;MAAA,IAOEC,KAPF,eAOEA,KAPF;MAAA,IAQEC,SARF,eAQEA,SARF;MAAA,IASEC,OATF,eASEA,OATF;MAAA,IAUEC,kBAVF,eAUEA,kBAVF;MAYA,IAAMC,cAAc,GAClB,EAAE,kBAAkBC,MAApB,KAA+BC,SAAS,CAACC,cAAV,GAA2B,CAA1D,IAA+DD,SAAS,CAACE,gBAAV,GAA6B,CAD9F;MAGA,IAAIV,SAAJ;;MAEA,IAAII,OAAO,KAAKO,SAAZ,IAAyBd,QAAzB,IAAqCI,QAAzC,EAAmD;QACjDD,SAAS,GAAG,IAAAY,sBAAA,EAAWd,OAAO,CAACe,KAAnB,EAA0Bf,OAAO,CAACD,QAAlC,EAA4CC,OAAO,CAACgB,aAApD,CAAZ;MACD,CAFD,MAEO,IAAIV,OAAO,KAAKO,SAAhB,EAA2B;QAChCX,S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OAAO,EAAEH,KAAK,CAACI,OAAN,CAAcC;IAPd,CAxCN;IAiDLb,KAAK,EAAE;MACLwB,MAAM,EAAE,iBADH;MAELF,UAAU,EAAE,CAFP;MAGLG,SAAS,EAAE,YAHN;MAILF,SAAS,EAAEf,KAAK,CAACI,OAAN,CAAcC,IAAd,GAAqB,CAJ3B;MAKLa,OAAO,EAAE,cALJ;MAMLf,OAAO,EAAEH,KAAK,CAACI,OAAN,CAAcC,IANlB;MAOLI,KAAK,EAAEA,eAAA,CAAM9C,IAAN;IAPF,CAjDF;IA2DL0B,MAAM,EAAE;MACN6B,OAAO,EAAE;IADH,CA3DH;IA8DLzC,OAAO,EAAE;MACPiC,eAAe,EAAED,eAAA,CAAMhC,OAAN;IADV,CA9DJ;IAiELa,SAAS,EAAE;MACToB,eAAe,EAAED,eAAA,CAAMnB,SAAN;IADR;EAjEN,CAAP;AAqED,CAtEc,EAsEZtB,KAtEY,C"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.6-next.
|
|
6
|
+
"version": "1.8.6-next.631+34fed29b",
|
|
7
7
|
"description": "Some react components for text selection",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"react",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@pie-framework/parse-english": "^1.0.0",
|
|
21
|
-
"@pie-lib/render-ui": "^4.13.
|
|
21
|
+
"@pie-lib/render-ui": "^4.13.6",
|
|
22
22
|
"@pie-lib/style-utils": "^0.1.25",
|
|
23
23
|
"classnames": "^2.2.6",
|
|
24
24
|
"debug": "^4.1.1",
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
"@material-ui/core": "^3.8.3",
|
|
39
39
|
"react": "^16.8.1"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "34fed29bb26ac8eaf26ab02d3242425cb4056acd",
|
|
42
42
|
"scripts": {}
|
|
43
43
|
}
|
|
@@ -40,6 +40,8 @@ export class Token extends React.Component {
|
|
|
40
40
|
correct,
|
|
41
41
|
animationsDisabled
|
|
42
42
|
} = this.props;
|
|
43
|
+
const isTouchEnabled =
|
|
44
|
+
!('ontouchstart' in window) || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
|
|
43
45
|
|
|
44
46
|
let className;
|
|
45
47
|
|
|
@@ -57,7 +59,7 @@ export class Token extends React.Component {
|
|
|
57
59
|
Token.rootClassName,
|
|
58
60
|
classes.token,
|
|
59
61
|
disabled && classes.disabled,
|
|
60
|
-
selectable && !disabled && classes.selectable,
|
|
62
|
+
selectable && !disabled && isTouchEnabled && classes.selectable,
|
|
61
63
|
selected && !disabled && classes.selected,
|
|
62
64
|
selected && disabled && classes.disabledAndSelected,
|
|
63
65
|
highlight && selectable && !disabled && !selected && classes.highlight,
|
|
@@ -97,10 +99,12 @@ export default withStyles(theme => {
|
|
|
97
99
|
backgroundColor: 'pink' // TODO hardcoded color
|
|
98
100
|
},
|
|
99
101
|
selectable: {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
[theme.breakpoints.up(769)]: {
|
|
103
|
+
'&:hover': {
|
|
104
|
+
backgroundColor: color.primaryLight(),
|
|
105
|
+
'& > *': {
|
|
106
|
+
backgroundColor: color.primaryLight()
|
|
107
|
+
}
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
110
|
},
|