@pie-lib/charting 4.5.11-next.605 → 4.5.11-next.613
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.
- package/lib/mark-label.js +1 -1
- package/lib/mark-label.js.map +1 -1
- package/package.json +2 -2
- package/src/mark-label.jsx +5 -2
package/lib/mark-label.js
CHANGED
package/lib/mark-label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mark-label.js","names":["styles","theme","input","fontFamily","typography","fontSize","border","color","primaryDark","correct","incorrect","disabled","backgroundColor","MarkLabel","props","useState","setInput","_ref","useCallback","node","mark","classes","externalInputRef","inputRef","barWidth","rotate","correctness","autoFocus","label","setLabel","onChange","e","target","value","onChangeProp","extraStyle","width","textAlign","useEffect","r","cn","minWidth","background","boxSizing","paddingLeft","paddingRight","position","pointerEvents","top","left","transformOrigin","transform","propTypes","PropTypes","bool","func","graphProps","types","GraphPropsType","object","number","shape","string","withStyles"],"sources":["../src/mark-label.jsx"],"sourcesContent":["import React, { useState, useCallback, useEffect } from 'react';\nimport cn from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport AutosizeInput from 'react-input-autosize';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { correct, incorrect, disabled } from './common/styles';\nimport { color } from '@pie-lib/render-ui';\n\nconst styles = theme => ({\n input: {\n float: 'right',\n fontFamily: theme.typography.fontFamily,\n fontSize: theme.typography.fontSize,\n border: 'none',\n color: color.primaryDark(),\n '&.correct': correct('color'),\n '&.incorrect': incorrect('color'),\n '&.disabled': {
|
|
1
|
+
{"version":3,"file":"mark-label.js","names":["styles","theme","input","fontFamily","typography","fontSize","border","color","primaryDark","correct","incorrect","disabled","backgroundColor","MarkLabel","props","useState","setInput","_ref","useCallback","node","mark","classes","externalInputRef","inputRef","barWidth","rotate","correctness","autoFocus","label","setLabel","onChange","e","target","value","onChangeProp","extraStyle","width","textAlign","useEffect","r","cn","minWidth","background","boxSizing","paddingLeft","paddingRight","position","pointerEvents","top","left","transformOrigin","transform","propTypes","PropTypes","bool","func","graphProps","types","GraphPropsType","object","number","shape","string","withStyles"],"sources":["../src/mark-label.jsx"],"sourcesContent":["import React, { useState, useCallback, useEffect } from 'react';\nimport cn from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport AutosizeInput from 'react-input-autosize';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { correct, incorrect, disabled } from './common/styles';\nimport { color } from '@pie-lib/render-ui';\n\nconst styles = theme => ({\n input: {\n float: 'right',\n fontFamily: theme.typography.fontFamily,\n fontSize: theme.typography.fontSize,\n border: 'none',\n color: color.primaryDark(),\n '&.correct': correct('color'),\n '&.incorrect': incorrect('color'),\n '&.disabled': {\n ...disabled('color'),\n backgroundColor: 'transparent !important'\n }\n }\n});\n\nexport const MarkLabel = props => {\n // eslint-disable-next-line no-unused-vars\n const [input, setInput] = useState(null);\n const _ref = useCallback(node => setInput(node), null);\n\n const {\n mark,\n classes,\n disabled,\n inputRef: externalInputRef,\n barWidth,\n rotate,\n correctness,\n autoFocus\n } = props;\n const [label, setLabel] = useState(mark.label);\n const onChange = e => setLabel(e.target.value);\n const onChangeProp = e => props.onChange(e.target.value);\n let extraStyle = {};\n\n if (rotate) {\n extraStyle = {\n width: 'unset',\n textAlign: 'left'\n };\n }\n\n // useState only sets the value once, to synch props to state need useEffect\n useEffect(() => {\n setLabel(mark.label);\n }, [mark.label]);\n\n return (\n <AutosizeInput\n autoFocus={autoFocus}\n inputRef={r => {\n _ref(r);\n externalInputRef(r);\n }}\n disabled={disabled}\n inputClassName={cn(classes.input, correctness && correctness.label, disabled && 'disabled')}\n inputStyle={{\n minWidth: barWidth,\n textAlign: 'center',\n background: 'transparent',\n boxSizing: 'border-box',\n paddingLeft: 0,\n paddingRight: 0,\n ...extraStyle\n }}\n value={label}\n style={{\n position: 'fixed',\n pointerEvents: 'auto',\n top: 0,\n left: 0,\n minWidth: barWidth,\n transformOrigin: 'left',\n transform: `rotate(${rotate}deg)`\n }}\n onChange={onChange}\n onBlur={onChangeProp}\n />\n );\n};\n\nMarkLabel.propTypes = {\n disabled: PropTypes.bool,\n onChange: PropTypes.func,\n graphProps: types.GraphPropsType,\n classes: PropTypes.object,\n inputRef: PropTypes.func,\n mark: PropTypes.object,\n barWidth: PropTypes.number,\n rotate: PropTypes.number,\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string\n })\n};\n\nexport default withStyles(styles)(MarkLabel);\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACvBC,KAAK,EAAE;MACL,SAAO,OADF;MAELC,UAAU,EAAEF,KAAK,CAACG,UAAN,CAAiBD,UAFxB;MAGLE,QAAQ,EAAEJ,KAAK,CAACG,UAAN,CAAiBC,QAHtB;MAILC,MAAM,EAAE,MAJH;MAKLC,KAAK,EAAEA,eAAA,CAAMC,WAAN,EALF;MAML,aAAa,IAAAC,gBAAA,EAAQ,OAAR,CANR;MAOL,eAAe,IAAAC,kBAAA,EAAU,OAAV,CAPV;MAQL,8CACK,IAAAC,iBAAA,EAAS,OAAT,CADL;QAEEC,eAAe,EAAE;MAFnB;IARK;EADgB,CAAL;AAAA,CAApB;;AAgBO,IAAMC,SAAS,GAAG,SAAZA,SAAY,CAAAC,KAAK,EAAI;EAChC;EACA,gBAA0B,IAAAC,eAAA,EAAS,IAAT,CAA1B;EAAA;EAAA,IAAOb,KAAP;EAAA,IAAcc,QAAd;;EACA,IAAMC,IAAI,GAAG,IAAAC,kBAAA,EAAY,UAAAC,IAAI;IAAA,OAAIH,QAAQ,CAACG,IAAD,CAAZ;EAAA,CAAhB,EAAoC,IAApC,CAAb;;EAEA,IACEC,IADF,GASIN,KATJ,CACEM,IADF;EAAA,IAEEC,OAFF,GASIP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access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "4.5.11-next.
|
|
6
|
+
"version": "4.5.11-next.613+6448502d",
|
|
7
7
|
"description": "charting",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"react",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": "^16.8.1"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "6448502d571db81f0112e2d753f25fab6f60c271"
|
|
47
47
|
}
|
package/src/mark-label.jsx
CHANGED
|
@@ -16,7 +16,10 @@ const styles = theme => ({
|
|
|
16
16
|
color: color.primaryDark(),
|
|
17
17
|
'&.correct': correct('color'),
|
|
18
18
|
'&.incorrect': incorrect('color'),
|
|
19
|
-
'&.disabled': {
|
|
19
|
+
'&.disabled': {
|
|
20
|
+
...disabled('color'),
|
|
21
|
+
backgroundColor: 'transparent !important'
|
|
22
|
+
}
|
|
20
23
|
}
|
|
21
24
|
});
|
|
22
25
|
|
|
@@ -72,7 +75,7 @@ export const MarkLabel = props => {
|
|
|
72
75
|
}}
|
|
73
76
|
value={label}
|
|
74
77
|
style={{
|
|
75
|
-
position: '
|
|
78
|
+
position: 'fixed',
|
|
76
79
|
pointerEvents: 'auto',
|
|
77
80
|
top: 0,
|
|
78
81
|
left: 0,
|