Skip to content

Commit

Permalink
Merge pull request #7 from prospa-group-oss/feature/PDT-9081-fix-sour…
Browse files Browse the repository at this point in the history
…ce-maps

PDT-9081: updated dependencies & fixed linting & added src for publishing
  • Loading branch information
shtbik authored Jan 10, 2022
2 parents 22b1ef3 + bbc14b7 commit 45e182e
Show file tree
Hide file tree
Showing 13 changed files with 4,542 additions and 110 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf


[*.md]
max_line_length = off
trim_trailing_whitespace = false
12 changes: 3 additions & 9 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended"
],
"plugins": ["react", "@typescript-eslint", "prettier"],
Expand All @@ -14,12 +14,7 @@
"node": true,
"es6": true
},
"rules": {
"@typescript-eslint/explicit-function-return-type": 0,
"react/display-name": 0,
"prettier/prettier": ["error", { "singleQuote": true }],
"no-console": 1
},
"rules": {},
"settings": {
"react": {
"pragma": "React",
Expand All @@ -28,6 +23,5 @@
},
"globals": {
"window": true
},
"parser": "@typescript-eslint/parser"
}
}
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 100,
"arrowParens": "avoid",
"semi": true,
"tabWidth": 2,
"useTabs": false,
"proseWrap": "always",
"singleQuote": true,
"trailingComma": "all",
"endOfLine": "lf"
}
44 changes: 23 additions & 21 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
# React Component for AddressFinder

This is a react wrapper component for [AddressFinder's](https://addressfinder.com.au/docs/widget_docs/) widget.
This is a react wrapper component for
[AddressFinder's](https://addressfinder.com.au/docs/widget_docs/) widget.

## Getting started

### Setup

Include the widget script manually
Include the widget script manually

```html
<script type="text/javascript" src="https://api.addressfinder.io/assets/v3/widget.js" async></script>
<script
type="text/javascript"
src="https://api.addressfinder.io/assets/v3/widget.js"
async
></script>
```

or the component will load the library for you if not found under the window object.


### Install

```sh
Expand Down Expand Up @@ -51,21 +55,22 @@ const component = ({

## Component props

| Prop | Type | Required | Default |
|--------------------|-------------|----------|---------------------------------------------------|
| id | string | yes | |
| addressFinderKey | string | yes | |
| onSelected | function | yes | |
| country | string | no | `AU` |
| container | HtmlElement | no | div with id `address-container-${id}` |
| inputClassName | string | no | '' |
| listClassName | string | no | `address-autocomplete__suggestions` |
| itemClassName | string | no | `address-autocomplete__suggestions__item` |
| hoverClassName | string | no | `address-autocomplete__suggestions__item--active` |
| Prop | Type | Required | Default |
| ---------------- | ----------- | -------- | ------------------------------------------------- |
| id | string | yes | |
| addressFinderKey | string | yes | |
| onSelected | function | yes | |
| country | string | no | `AU` |
| container | HtmlElement | no | div with id `address-container-${id}` |
| inputClassName | string | no | '' |
| listClassName | string | no | `address-autocomplete__suggestions` |
| itemClassName | string | no | `address-autocomplete__suggestions__item` |
| hoverClassName | string | no | `address-autocomplete__suggestions__item--active` |

### Prop: container

The container where suggestion list will be docked inside. If not provided, the list sits directly inside a `div` under the input.
The container where suggestion list will be docked inside. If not provided, the list sits directly
inside a `div` under the input.

### Prop: onSelected

Expand Down Expand Up @@ -98,9 +103,7 @@ export default ({
}: Props) => {
const { name, onChange, ...otherfields } = field;

const fieldClassName = `form-control${
touched[name] && errors[name] ? ' is-invalid' : ''
}`;
const fieldClassName = `form-control${touched[name] && errors[name] ? ' is-invalid' : ''}`;

return (
<WidgetInput
Expand All @@ -122,10 +125,9 @@ export default ({
/>
);
};

```

<br />
<br />

More to come - component wrapper AddressFinder apis...
More to come - component wrapper AddressFinder apis...
Loading

0 comments on commit 45e182e

Please sign in to comment.