mirror of
https://github.com/maputnik/editor.git
synced 2026-06-30 19:17:26 +00:00
More jsx to tsx migration
This commit is contained in:
Generated
+10
@@ -77,6 +77,7 @@
|
|||||||
"@types/react": "^16.14.52",
|
"@types/react": "^16.14.52",
|
||||||
"@types/react-aria-modal": "^4.0.9",
|
"@types/react-aria-modal": "^4.0.9",
|
||||||
"@types/react-autocomplete": "^1.8.9",
|
"@types/react-autocomplete": "^1.8.9",
|
||||||
|
"@types/react-collapse": "^5.0.4",
|
||||||
"@types/react-color": "^3.0.10",
|
"@types/react-color": "^3.0.10",
|
||||||
"@types/react-dom": "^16.9.24",
|
"@types/react-dom": "^16.9.24",
|
||||||
"@types/react-file-reader-input": "^2.0.4",
|
"@types/react-file-reader-input": "^2.0.4",
|
||||||
@@ -4906,6 +4907,15 @@
|
|||||||
"@types/react": "*"
|
"@types/react": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/react-collapse": {
|
||||||
|
"version": "5.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/react-collapse/-/react-collapse-5.0.4.tgz",
|
||||||
|
"integrity": "sha512-tM5cVB6skGLneNYnRK2E3R56VOHguSeJQHslGPTIMC58ytL3oelT8L/l1onkwHGn5vSEs2BEq2Olzrur+YdliA==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/react": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/react-color": {
|
"node_modules/@types/react-color": {
|
||||||
"version": "3.0.10",
|
"version": "3.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/@types/react-color/-/react-color-3.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/@types/react-color/-/react-color-3.0.10.tgz",
|
||||||
|
|||||||
@@ -106,6 +106,7 @@
|
|||||||
"@types/react": "^16.14.52",
|
"@types/react": "^16.14.52",
|
||||||
"@types/react-aria-modal": "^4.0.9",
|
"@types/react-aria-modal": "^4.0.9",
|
||||||
"@types/react-autocomplete": "^1.8.9",
|
"@types/react-autocomplete": "^1.8.9",
|
||||||
|
"@types/react-collapse": "^5.0.4",
|
||||||
"@types/react-color": "^3.0.10",
|
"@types/react-color": "^3.0.10",
|
||||||
"@types/react-dom": "^16.9.24",
|
"@types/react-dom": "^16.9.24",
|
||||||
"@types/react-file-reader-input": "^2.0.4",
|
"@types/react-file-reader-input": "^2.0.4",
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
import { Collapse as ReactCollapse } from 'react-collapse'
|
import { Collapse as ReactCollapse } from 'react-collapse'
|
||||||
import {reducedMotionEnabled} from '../../libs/accessibility'
|
import {reducedMotionEnabled} from '../libs/accessibility'
|
||||||
|
|
||||||
|
|
||||||
export default class Collapse extends React.Component {
|
type CollapseProps = {
|
||||||
static propTypes = {
|
isActive: boolean
|
||||||
isActive: PropTypes.bool.isRequired,
|
children: React.ReactElement
|
||||||
children: PropTypes.element.isRequired
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
export default class Collapse extends React.Component<CollapseProps> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
isActive: true
|
isActive: true
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
import {MdArrowDropDown, MdArrowDropUp} from 'react-icons/md'
|
import {MdArrowDropDown, MdArrowDropUp} from 'react-icons/md'
|
||||||
|
|
||||||
export default class Collapser extends React.Component {
|
type CollapserProps = {
|
||||||
static propTypes = {
|
isCollapsed: boolean
|
||||||
isCollapsed: PropTypes.bool.isRequired,
|
style?: object
|
||||||
style: PropTypes.object,
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class Collapser extends React.Component<CollapserProps> {
|
||||||
render() {
|
render() {
|
||||||
const iconStyle = {
|
const iconStyle = {
|
||||||
width: 20,
|
width: 20,
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import React from 'react'
|
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
import Block from './Block'
|
|
||||||
import InputAutocomplete from './InputAutocomplete'
|
|
||||||
|
|
||||||
|
|
||||||
export default class FieldAutocomplete extends React.Component {
|
|
||||||
static propTypes = {
|
|
||||||
...InputAutocomplete.propTypes,
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const {props} = this;
|
|
||||||
|
|
||||||
return <Block label={props.label}>
|
|
||||||
<InputAutocomplete {...props} />
|
|
||||||
</Block>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import Block from './Block'
|
||||||
|
import InputAutocomplete, { InputAutocompleteProps } from './InputAutocomplete'
|
||||||
|
|
||||||
|
|
||||||
|
type FieldAutocompleteProps = InputAutocompleteProps & {
|
||||||
|
label?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export default class FieldAutocomplete extends React.Component<FieldAutocompleteProps> {
|
||||||
|
render() {
|
||||||
|
const {props} = this;
|
||||||
|
|
||||||
|
return <Block label={props.label}>
|
||||||
|
<InputAutocomplete {...props} />
|
||||||
|
</Block>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
|
||||||
|
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import InputString from './InputString'
|
import InputString from './InputString'
|
||||||
|
|
||||||
export default class FieldComment extends React.Component {
|
type FieldCommentProps = {
|
||||||
static propTypes = {
|
value?: string
|
||||||
value: PropTypes.string,
|
onChange(...args: unknown[]): unknown
|
||||||
onChange: PropTypes.func.isRequired,
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class FieldComment extends React.Component<FieldCommentProps> {
|
||||||
render() {
|
render() {
|
||||||
const fieldSpec = {
|
const fieldSpec = {
|
||||||
doc: "Comments for the current layer. This is non-standard and not in the spec."
|
doc: "Comments for the current layer. This is non-standard and not in the spec."
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import throttle from 'lodash.throttle'
|
import throttle from 'lodash.throttle'
|
||||||
|
|
||||||
export default {
|
// Throttle for 3 seconds so when a user enables it they don't have to refresh the page.
|
||||||
// Throttle for 3 seconds so when a user enables it they don't have to refresh the page.
|
const reducedMotionEnabled = throttle(() => {
|
||||||
reducedMotionEnabled: throttle(() => {
|
return window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
||||||
return window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
}, 3000)
|
||||||
}, 3000)
|
|
||||||
}
|
export { reducedMotionEnabled }
|
||||||
|
|||||||
Reference in New Issue
Block a user