diff --git a/src/components/FieldArray.jsx b/src/components/FieldArray.jsx
deleted file mode 100644
index 00103fc3..00000000
--- a/src/components/FieldArray.jsx
+++ /dev/null
@@ -1,21 +0,0 @@
-import React from 'react'
-import PropTypes from 'prop-types'
-import Block from './Block'
-import InputArray from './InputArray'
-import Fieldset from './Fieldset'
-
-export default class FieldArray extends React.Component {
- static propTypes = {
- ...InputArray.propTypes,
- name: PropTypes.string,
- }
-
- render() {
- const {props} = this;
-
- return
- }
-}
-
diff --git a/src/components/FieldArray.tsx b/src/components/FieldArray.tsx
new file mode 100644
index 00000000..1de04ee9
--- /dev/null
+++ b/src/components/FieldArray.tsx
@@ -0,0 +1,19 @@
+import React from 'react'
+import InputArray, { FieldArrayProps as InputArrayProps } from './InputArray'
+import Fieldset from './Fieldset'
+
+type FieldArrayProps = InputArrayProps & {
+ name?: string
+ fieldSpec?: {
+ doc: string
+ }
+};
+
+export default class FieldArray extends React.Component {
+ render() {
+ return
+ }
+}
+
diff --git a/src/components/FieldColor.jsx b/src/components/FieldColor.jsx
deleted file mode 100644
index 2e9067be..00000000
--- a/src/components/FieldColor.jsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import React from 'react'
-import PropTypes from 'prop-types'
-import Block from './Block'
-import InputColor from './InputColor'
-
-
-export default class FieldColor extends React.Component {
- static propTypes = {
- ...InputColor.propTypes,
- }
-
- render() {
- const {props} = this;
-
- return
-
-
- }
-}
-
diff --git a/src/components/FieldColor.tsx b/src/components/FieldColor.tsx
new file mode 100644
index 00000000..37d11b1a
--- /dev/null
+++ b/src/components/FieldColor.tsx
@@ -0,0 +1,21 @@
+import React from 'react'
+import Block from './Block'
+import InputColor, {InputColorProps} from './InputColor'
+
+
+type FieldColorProps = InputColorProps & {
+ label?: string
+ fieldSpec?: {
+ doc: string
+ }
+};
+
+
+export default class FieldColor extends React.Component {
+ render() {
+ return
+
+
+ }
+}
+
diff --git a/src/components/FieldEnum.tsx b/src/components/FieldEnum.tsx
index 054d3d3c..25a46689 100644
--- a/src/components/FieldEnum.tsx
+++ b/src/components/FieldEnum.tsx
@@ -3,15 +3,18 @@ import InputEnum, {InputEnumProps} from './InputEnum'
import Fieldset from './Fieldset';
-type FieldEnumProps = InputEnumProps & { label : string };
+type FieldEnumProps = InputEnumProps & {
+ label?: string;
+ fieldSpec?: {
+ doc: string
+ }
+};
export default class FieldEnum extends React.Component {
render() {
- const {props} = this;
-
- return
- }
-}
-
diff --git a/src/components/FieldMultiInput.tsx b/src/components/FieldMultiInput.tsx
new file mode 100644
index 00000000..994480d9
--- /dev/null
+++ b/src/components/FieldMultiInput.tsx
@@ -0,0 +1,20 @@
+import React from 'react'
+import InputMultiInput, {InputMultiInputProps} from './InputMultiInput'
+import Fieldset from './Fieldset'
+
+
+type FieldMultiInputProps = InputMultiInputProps & {
+ label?: string
+};
+
+
+export default class FieldMultiInput extends React.Component {
+ render() {
+ const {props} = this;
+
+ return
+
+
+ }
+}
+
diff --git a/src/components/FieldNumber.jsx b/src/components/FieldNumber.jsx
deleted file mode 100644
index 0d42ddf8..00000000
--- a/src/components/FieldNumber.jsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import React from 'react'
-import PropTypes from 'prop-types'
-import InputNumber from './InputNumber'
-import Block from './Block'
-
-
-export default class FieldNumber extends React.Component {
- static propTypes = {
- ...InputNumber.propTypes,
- }
-
- render() {
- const {props} = this;
- return
-
-
- }
-}
-
diff --git a/src/components/FieldNumber.tsx b/src/components/FieldNumber.tsx
new file mode 100644
index 00000000..4c8ede98
--- /dev/null
+++ b/src/components/FieldNumber.tsx
@@ -0,0 +1,20 @@
+import React from 'react'
+import InputNumber, {InputNumberProps} from './InputNumber'
+import Block from './Block'
+
+
+type FieldNumberProps = InputNumberProps & {
+ label?: string
+ fieldSpec?: {
+ doc: string
+ }
+};
+
+
+export default class FieldNumber extends React.Component {
+ render() {
+ return
+
+
+ }
+}
diff --git a/src/components/FieldSelect.jsx b/src/components/FieldSelect.jsx
deleted file mode 100644
index 1d279c6f..00000000
--- a/src/components/FieldSelect.jsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import React from 'react'
-import PropTypes from 'prop-types'
-import Block from './Block'
-import InputSelect from './InputSelect'
-
-
-export default class FieldSelect extends React.Component {
- static propTypes = {
- ...InputSelect.propTypes,
- }
-
- render() {
- const {props} = this;
-
- return
-
-
- }
-}
-
diff --git a/src/components/FieldSelect.tsx b/src/components/FieldSelect.tsx
new file mode 100644
index 00000000..2e0a7be6
--- /dev/null
+++ b/src/components/FieldSelect.tsx
@@ -0,0 +1,22 @@
+import React from 'react'
+import Block from './Block'
+import InputSelect, {InputSelectProps} from './InputSelect'
+
+
+type FieldSelectProps = InputSelectProps & {
+ label?: string
+ fieldSpec?: {
+ doc: string
+ }
+};
+
+
+export default class FieldSelect extends React.Component {
+ render() {
+ return
+
+
+ }
+}
+
+
diff --git a/src/components/FieldString.tsx b/src/components/FieldString.tsx
index bc5a137e..833d83ea 100644
--- a/src/components/FieldString.tsx
+++ b/src/components/FieldString.tsx
@@ -5,14 +5,15 @@ import InputString, {InputStringProps} from './InputString'
type FieldStringProps = InputStringProps & {
name?: string
label?: string
+ fieldSpec?: {
+ doc: string
+ }
};
export default class FieldString extends React.Component {
render() {
- const {props} = this;
-
- return
-
+ return
+
}
}
diff --git a/src/components/FieldUrl.tsx b/src/components/FieldUrl.tsx
index 9e7c23b0..2c4661fd 100644
--- a/src/components/FieldUrl.tsx
+++ b/src/components/FieldUrl.tsx
@@ -5,16 +5,17 @@ import Block from './Block'
type FieldUrlProps = InputUrlProps & {
label: string;
+ fieldSpec?: {
+ doc: string
+ }
};
export default class FieldUrl extends React.Component {
render () {
- const {props} = this;
-
return (
-
-
+
+
);
}
diff --git a/src/components/Fieldset.tsx b/src/components/Fieldset.tsx
index ab095064..db4b4a38 100644
--- a/src/components/Fieldset.tsx
+++ b/src/components/Fieldset.tsx
@@ -3,7 +3,7 @@ import FieldDocLabel from './FieldDocLabel'
import Doc from './Doc'
type FieldsetProps = {
- label: string,
+ label?: string,
fieldSpec?: { doc?: string },
action?: ReactElement,
};
diff --git a/src/components/InputArray.tsx b/src/components/InputArray.tsx
index ae4aa2da..0d2a79c3 100644
--- a/src/components/InputArray.tsx
+++ b/src/components/InputArray.tsx
@@ -3,7 +3,7 @@ import InputString from './InputString'
import InputNumber from './InputNumber'
export type FieldArrayProps = {
- value: string[]
+ value: string[] | number[]
type?: string
length?: number
default?: string[] | number[]
diff --git a/src/components/InputJson.tsx b/src/components/InputJson.tsx
index 21d49bc8..cf1d3529 100644
--- a/src/components/InputJson.tsx
+++ b/src/components/InputJson.tsx
@@ -11,7 +11,7 @@ import stringifyPretty from 'json-stringify-pretty-compact'
import '../util/codemirror-mgl';
-type InputJsonProps = {
+export type InputJsonProps = {
layer: any
maxHeight?: number
onChange?(...args: unknown[]): unknown
diff --git a/src/components/InputMultiInput.tsx b/src/components/InputMultiInput.tsx
index f58bbcc6..64529c48 100644
--- a/src/components/InputMultiInput.tsx
+++ b/src/components/InputMultiInput.tsx
@@ -1,7 +1,7 @@
import React from 'react'
import classnames from 'classnames'
-type InputMultiInputProps = {
+export type InputMultiInputProps = {
name?: string
value: string
options: any[]
diff --git a/src/components/InputSelect.tsx b/src/components/InputSelect.tsx
index e4b70930..9a8f9485 100644
--- a/src/components/InputSelect.tsx
+++ b/src/components/InputSelect.tsx
@@ -1,6 +1,6 @@
import React from 'react'
-type InputSelectProps = {
+export type InputSelectProps = {
value: string
"data-wd-key"?: string
options: [string, any][] | string[]
diff --git a/src/components/InputUrl.tsx b/src/components/InputUrl.tsx
index db50b8cd..2e22712a 100644
--- a/src/components/InputUrl.tsx
+++ b/src/components/InputUrl.tsx
@@ -53,7 +53,7 @@ export type FieldUrlProps = {
style?: object
default?: string
onChange(...args: unknown[]): unknown
- onInput(...args: unknown[]): unknown
+ onInput?(...args: unknown[]): unknown
multi?: boolean
required?: boolean
'aria-label'?: string
@@ -79,7 +79,7 @@ export default class FieldUrl extends React.Component {
diff --git a/src/components/ModalSettings.jsx b/src/components/ModalSettings.tsx
similarity index 85%
rename from src/components/ModalSettings.jsx
rename to src/components/ModalSettings.tsx
index 973a6886..14afc108 100644
--- a/src/components/ModalSettings.jsx
+++ b/src/components/ModalSettings.tsx
@@ -1,8 +1,6 @@
import React from 'react'
-import PropTypes from 'prop-types'
+import {LightSpecification, StyleSpecification, TransitionSpecification, latest} from '@maplibre/maplibre-gl-style-spec'
-import {latest} from '@maplibre/maplibre-gl-style-spec'
-import Block from './Block'
import FieldArray from './FieldArray'
import FieldNumber from './FieldNumber'
import FieldString from './FieldString'
@@ -13,16 +11,16 @@ import FieldColor from './FieldColor'
import Modal from './Modal'
import fieldSpecAdditional from '../libs/field-spec-additional'
-export default class ModalSettings extends React.Component {
- static propTypes = {
- mapStyle: PropTypes.object.isRequired,
- onStyleChanged: PropTypes.func.isRequired,
- onChangeMetadataProperty: PropTypes.func.isRequired,
- isOpen: PropTypes.bool.isRequired,
- onOpenToggle: PropTypes.func.isRequired,
- }
+type ModalSettingsProps = {
+ mapStyle: StyleSpecification
+ onStyleChanged(...args: unknown[]): unknown
+ onChangeMetadataProperty(...args: unknown[]): unknown
+ isOpen: boolean
+ onOpenToggle(...args: unknown[]): unknown
+};
- changeTransitionProperty(property, value) {
+export default class ModalSettings extends React.Component {
+ changeTransitionProperty(property: keyof TransitionSpecification, value: number | undefined) {
const transition = {
...this.props.mapStyle.transition,
}
@@ -40,7 +38,7 @@ export default class ModalSettings extends React.Component {
});
}
- changeLightProperty(property, value) {
+ changeLightProperty(property: keyof LightSpecification, value: any) {
const light = {
...this.props.mapStyle.light,
}
@@ -49,6 +47,7 @@ export default class ModalSettings extends React.Component {
delete light[property];
}
else {
+ // @ts-ignore
light[property] = value;
}
@@ -58,22 +57,24 @@ export default class ModalSettings extends React.Component {
});
}
- changeStyleProperty(property, value) {
+ changeStyleProperty(property: keyof StyleSpecification | "owner", value: any) {
const changedStyle = {
...this.props.mapStyle,
};
if (value === undefined) {
+ // @ts-ignore
delete changedStyle[property];
}
else {
+ // @ts-ignore
changedStyle[property] = value;
}
this.props.onStyleChanged(changedStyle);
}
render() {
- const metadata = this.props.mapStyle.metadata || {}
+ const metadata = this.props.mapStyle.metadata || {} as any;
const {onChangeMetadataProperty, mapStyle} = this.props;
const inputProps = { }
@@ -98,14 +99,14 @@ export default class ModalSettings extends React.Component {
label={"Owner"}
fieldSpec={{doc: "Owner ID of the style. Used by Mapbox or future style APIs."}}
data-wd-key="modal:settings.owner"
- value={this.props.mapStyle.owner}
+ value={(this.props.mapStyle as any).owner}
onChange={this.changeStyleProperty.bind(this, "owner")}
/>
@@ -113,7 +114,7 @@ export default class ModalSettings extends React.Component {
label="Glyphs URL"
fieldSpec={latest.$root.glyphs}
data-wd-key="modal:settings.glyphs"
- value={this.props.mapStyle.glyphs}
+ value={this.props.mapStyle.glyphs as string}
onChange={this.changeStyleProperty.bind(this, "glyphs")}
/>
@@ -138,7 +139,7 @@ export default class ModalSettings extends React.Component {
fieldSpec={latest.$root.center}
length={2}
type="number"
- value={mapStyle.center}
+ value={mapStyle.center || []}
default={latest.$root.center.default || [0, 0]}
onChange={this.changeStyleProperty.bind(this, "center")}
/>
@@ -175,7 +176,7 @@ export default class ModalSettings extends React.Component {
label={"Light anchor"}
fieldSpec={latest.light.anchor}
name="light-anchor"
- value={light.anchor}
+ value={light.anchor as string}
options={Object.keys(latest.light.anchor.values)}
default={latest.light.anchor.default}
onChange={this.changeLightProperty.bind(this, "anchor")}
@@ -185,7 +186,7 @@ export default class ModalSettings extends React.Component {
{...inputProps}
label={"Light color"}
fieldSpec={latest.light.color}
- value={light.color}
+ value={light.color as string}
default={latest.light.color.default}
onChange={this.changeLightProperty.bind(this, "color")}
/>
@@ -194,7 +195,7 @@ export default class ModalSettings extends React.Component {
{...inputProps}
label={"Light intensity"}
fieldSpec={latest.light.intensity}
- value={light.intensity}
+ value={light.intensity as number}
default={latest.light.intensity.default}
onChange={this.changeLightProperty.bind(this, "intensity")}
/>
@@ -205,7 +206,7 @@ export default class ModalSettings extends React.Component {
fieldSpec={latest.light.position}
type="number"
length={latest.light.position.length}
- value={light.position}
+ value={light.position as number[]}
default={latest.light.position.default}
onChange={this.changeLightProperty.bind(this, "position")}
/>
diff --git a/src/components/ModalShortcuts.jsx b/src/components/ModalShortcuts.tsx
similarity index 93%
rename from src/components/ModalShortcuts.jsx
rename to src/components/ModalShortcuts.tsx
index ebe8a0e9..dc7e14b4 100644
--- a/src/components/ModalShortcuts.jsx
+++ b/src/components/ModalShortcuts.tsx
@@ -1,15 +1,15 @@
import React from 'react'
-import PropTypes from 'prop-types'
import Modal from './Modal'
-export default class ModalShortcuts extends React.Component {
- static propTypes = {
- isOpen: PropTypes.bool.isRequired,
- onOpenToggle: PropTypes.func.isRequired,
- }
+type ModalShortcutsProps = {
+ isOpen: boolean
+ onOpenToggle(...args: unknown[]): unknown
+};
+
+export default class ModalShortcuts extends React.Component {
render() {
const help = [
{
diff --git a/src/components/ModalSurvey.jsx b/src/components/ModalSurvey.tsx
similarity index 85%
rename from src/components/ModalSurvey.jsx
rename to src/components/ModalSurvey.tsx
index 13ab9395..59c1d1f7 100644
--- a/src/components/ModalSurvey.jsx
+++ b/src/components/ModalSurvey.tsx
@@ -1,17 +1,17 @@
import React from 'react'
-import PropTypes from 'prop-types'
import InputButton from './InputButton'
import Modal from './Modal'
+// @ts-ignore
import logoImage from 'maputnik-design/logos/logo-color.svg'
-export default class ModalSurvey extends React.Component {
- static propTypes = {
- isOpen: PropTypes.bool.isRequired,
- onOpenToggle: PropTypes.func.isRequired,
- }
+type ModalSurveyProps = {
+ isOpen: boolean
+ onOpenToggle(...args: unknown[]): unknown
+};
+export default class ModalSurvey extends React.Component {
onClick = () => {
window.open('https://gregorywolanski.typeform.com/to/cPgaSY', '_blank');