-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from TeamWertarbyte/migration/from-unicef
Migration/from unicef
- Loading branch information
Showing
22 changed files
with
3,217 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
], | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react-refresh'], | ||
rules: { | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: 'Check PR' | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
|
||
jobs: | ||
check-code: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Lint code | ||
run: npm run lint | ||
- name: Build library code | ||
run: npm run build | ||
check-versioning: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: amannn/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: 'Create release' | ||
|
||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://registry.npmjs.org/' | ||
scope: '@wertarbyte' | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Lint code | ||
run: npm run lint | ||
- name: Build library code | ||
run: npm run build | ||
- name: release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npx semantic-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
# UpdateHive specific files | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
|
||
src/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/node_modules | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"endOfLine": "auto" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"branches": ["master"], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/github", | ||
"@semantic-release/npm" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,83 @@ | ||
# material-ui-currency-textfield | ||
Currency textfield for React Material UI | ||
# CurrencyTextField - React Material UI Component | ||
|
||
## Overview | ||
|
||
`CurrencyTextField` is a [React][react] component built using [Material UI's][mui] `TextField` and `react-number-format`. It provides a text field for currency input, supporting custom formatting options. | ||
|
||
[react]: https://react.dev/ | ||
[mui]: https://mui.com/material-ui/ | ||
|
||
## Usage | ||
|
||
```jsx | ||
import * as React from 'react'; | ||
import Dinero from 'dinero.js'; | ||
import CurrencyTextField from '../lib/components/CurrencyTextField'; | ||
|
||
export const MyComponent: React.FC = () => { | ||
|
||
const [value, setValue] = React.useState<Dinero.Dinero>(); | ||
|
||
return ( | ||
<CurrencyTextField | ||
label={'Amount'} | ||
name={'amount'} | ||
value={value} | ||
variant={'outlined'} | ||
currencySymbol="€" | ||
currency="EUR" | ||
precision={2} | ||
minimumValue={0} | ||
decimalCharacter="," | ||
digitGroupSeparator="." | ||
onChange={(value) => { | ||
setValue(value); | ||
}} | ||
/> | ||
); | ||
}; | ||
``` | ||
|
||
## Documentation | ||
|
||
### Props | ||
|
||
|Name|Type|Default|Description| | ||
|---|---|---|---| | ||
|decimalCharacter|`string`|`'.'`|The character used as the decimal separator.| | ||
|digitGroupSeparator|`string`|`','`|The character used as the thousand separator.| | ||
|currency|`Dinero.Currency`|`'USD'`|ISO 4217 CURRENCY CODES as specified in the [documentation][iso]. Sorted and parsed| | ||
|currencySymbol|`string`|`'$'`|The symbol used as the currency prefix.| | ||
|minimumValue|`string` `number`|`'-10000000000000'`|The minimum allowable value as a string.| | ||
|maximumValue|`string` `number`|`'10000000000000'`|The maximum allowable value as a string.| | ||
|precision|`number`|`2`|The number of decimal places to display.| | ||
|value|`Dinero.Dinero`||The current value of the text field. Can be a number or a string.| | ||
|defaultValue|`Dinero.Dinero`||The default value of the text field.| | ||
|onChange|`func`||Callback function that is called when the value changes. Receives the new value and formatted value as arguments.| | ||
|onBlur|`func`||Callback function that is called when the input loses focus. Receives the event and value as arguments.| | ||
|
||
[iso]: https://www.iso.org/iso-4217-currency-codes.html | ||
|
||
## Installation | ||
|
||
```sh | ||
# npm | ||
npm install @wertarbyte/material-ui-currency-textfield | ||
|
||
# yarn | ||
yarn add @wertarbyte/material-ui-currency-textfield | ||
``` | ||
|
||
## Development | ||
|
||
### Testing | ||
|
||
The library can be easily testet in dev mode via the provided 'dev' script and App.tsx. | ||
|
||
``` | ||
# npm | ||
npm run dev | ||
# yarn | ||
yarn dev | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Currency TextField - React Material UI component</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
Oops, something went wrong.