@canutin/svelte-currency-input 0.1.0 → 0.1.2
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/README.md +12 -7
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -16,8 +16,8 @@ A form input that converts numbers to currencies as you type in localized format
|
|
|
16
16
|
|
|
17
17
|
- Formats **positive** and **negative** values
|
|
18
18
|
- Leverages [`Intl.NumberFormat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat) for **localizing** currency denominations and masking the input
|
|
19
|
-
-
|
|
20
|
-
- Minimal default styling,
|
|
19
|
+
- Simple [API](#api)
|
|
20
|
+
- Minimal [default styling](https://github.com/canutin/svelte-currency-input/blob/main/src/lib/CurrencyInput.svelte#L88-L118), easy to [customize](#styling)
|
|
21
21
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
|
@@ -61,11 +61,11 @@ This is more or less what `<CurrencyInput />` looks like under the hood:
|
|
|
61
61
|
| name | `string` | `total` | Applies the name to the [input fields](#how-it-works) for _unformatted_ (e.g `[name=total]`) and _formatted_ (e.g. `[name=formattedTotal]` in camelCase) values |
|
|
62
62
|
| required | `boolean` | `false` | Marks the inputs as required |
|
|
63
63
|
| disabled | `boolean` | `false` | Marks the inputs as disabled |
|
|
64
|
-
| isNegativeAllowed | `boolean` | `true` | If `
|
|
64
|
+
| isNegativeAllowed | `boolean` | `true` | If `false`, forces formatting only to positive values and ignores `--positive` and `--negative` styling modifiers |
|
|
65
65
|
|
|
66
66
|
## Styling
|
|
67
67
|
|
|
68
|
-
The default styles use [BEM naming conventions](https://getbem.com/naming/). To override the default styles apply your styles as shown below:
|
|
68
|
+
The [default styles](https://github.com/canutin/svelte-currency-input/blob/main/src/lib/CurrencyInput.svelte#L88-L118) use [BEM naming conventions](https://getbem.com/naming/). To override the default styles apply your styles as shown below:
|
|
69
69
|
|
|
70
70
|
```html
|
|
71
71
|
<div class="my-currency-input">
|
|
@@ -83,6 +83,11 @@ The default styles use [BEM naming conventions](https://getbem.com/naming/). To
|
|
|
83
83
|
/* ... */
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
/* Formatted input when the it's disabled */
|
|
87
|
+
div.my-currency-input :global(input.currencyInput__formatted:disabled) {
|
|
88
|
+
/* ... */
|
|
89
|
+
}
|
|
90
|
+
|
|
86
91
|
/* Formatted input when the value is zero */
|
|
87
92
|
div.my-currency-input :global(input.currencyInput__formatted--zero) {
|
|
88
93
|
/* ... */
|
|
@@ -104,9 +109,9 @@ The default styles use [BEM naming conventions](https://getbem.com/naming/). To
|
|
|
104
109
|
|
|
105
110
|
Here's ways in which you can contribute:
|
|
106
111
|
|
|
107
|
-
- Found a bug? Open a [new issue](https://github.com/
|
|
108
|
-
- Browse our [existing issues](https://github.com/
|
|
109
|
-
- Submit a [pull request](https://github.com/
|
|
112
|
+
- Found a bug? Open a [new issue](https://github.com/canutin/svelte-currency-input/issues/new)
|
|
113
|
+
- Browse our [existing issues](https://github.com/canutin/svelte-currency-input/issues)
|
|
114
|
+
- Submit a [pull request](https://github.com/canutin/svelte-currency-input/pulls)
|
|
110
115
|
|
|
111
116
|
## Developing
|
|
112
117
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canutin/svelte-currency-input",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./package.json": "./package.json",
|
|
6
6
|
".": "./CurrencyInput.svelte",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
],
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|
|
41
|
-
"url": "git+https://github.com/
|
|
41
|
+
"url": "git+https://github.com/canutin/svelte-currency-input.git"
|
|
42
42
|
},
|
|
43
43
|
"author": "Fernando Maclen <hello@fernando.is>",
|
|
44
44
|
"license": "MIT",
|
|
45
45
|
"bugs": {
|
|
46
|
-
"url": "https://github.com/
|
|
46
|
+
"url": "https://github.com/canutin/svelte-currency-input/issues"
|
|
47
47
|
},
|
|
48
|
-
"homepage": "https://github.com/
|
|
48
|
+
"homepage": "https://github.com/canutin/svelte-currency-input#readme",
|
|
49
49
|
"svelte": "./CurrencyInput.svelte"
|
|
50
50
|
}
|