New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@canutin/svelte-currency-input

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@canutin/svelte-currency-input - npm Package Compare versions

Comparing version 0.7.2 to 0.8.0

8

CurrencyInput.svelte.d.ts

@@ -13,2 +13,10 @@ import { SvelteComponentTyped } from "svelte";

fractionDigits?: number | undefined;
inputClasses?: {
wrapper?: string | undefined;
unformatted?: string | undefined;
formatted?: string | undefined;
formattedPositive?: string | undefined;
formattedNegative?: string | undefined;
formattedZero?: string | undefined;
} | null | undefined;
};

@@ -15,0 +23,0 @@ events: {

2

package.json
{
"name": "@canutin/svelte-currency-input",
"version": "0.7.2",
"version": "0.8.0",
"exports": {

@@ -5,0 +5,0 @@ "./package.json": "./package.json",

@@ -18,3 +18,3 @@ # svelte-currency-input

- Simple [API](#api)
- Minimal [default styling](https://github.com/canutin/svelte-currency-input/blob/main/src/lib/CurrencyInput.svelte#L88-L118), easy to [customize](#styling)
- Minimal default styling, easy to [customize](#styling)

@@ -73,8 +73,39 @@ ## Usage

| fractionDigits | `number` | `2` | Sets `maximumFractionDigits` in [`Intl.NumberFormat()` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#minimumfractiondigits) used for formatting the currency. Supported digits: `0` to `20` |
| inputClasses | `object` | [See below](#Styling) | Selectively overrides any class names passed |
## Styling
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:
There are two ways of customizing the styling of the input:
1. Passing it your own CSS classes
2. Overriding the styles using the existing class names
```html
You can **override all of the class names** by passing an object to `inputClasses` that has **one or more** of these properties:
```typescript
interface InputClasses {
wrapper?: string; // <div> that contains the two <input> elements
unformatted?: string; // <input type="hidden"> that contains the unformatted value
formatted?: string; // <input type="text"> that contains the formatted value
formattedPositive?: string; // Class added when the formatted input is positive
formattedNegative?: string; // Class added when the formatted input is negative
formattedZero?: string; // Class added when the formatted input is zero
}
```
Usage (with [Tailwind CSS](https://tailwindcss.com/) as an example):
```svelte
<CurrencyInput name="total" value="{420.69}" inputClasses={
{
wrapper: "form-control block",
formatted: 'py-1.5 text-gray-700',
formattedPositive: 'text-green-700',
formattedNegative: 'text-red-700'
}
} />
```
Alternatively you can **write your own CSS** by overriding the [default styles](https://github.com/canutin/svelte-currency-input/blob/main/src/lib/CurrencyInput.svelte) which use [BEM naming conventions](https://getbem.com/naming/). To do so apply your styles as shown below:
```svelte
<div class="my-currency-input">

@@ -81,0 +112,0 @@ <CurrencyInput name="total" value="{420.69}" />

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc