lion/packages/input-iban
CircleCI b7ea11c767 chore: release new versions
- @lion/accordion@0.1.3
 - @lion/ajax@0.4.4
 - @lion/button@0.7.8
 - @lion/calendar@0.9.6
 - @lion/checkbox-group@0.11.5
 - @lion/core@0.8.0
 - @lion/dialog@0.7.10
 - @lion/fieldset@0.13.12
 - @lion/form-core@0.2.5
 - @lion/form-integrations@0.1.18
 - @lion/form@0.6.12
 - @lion/helpers@0.5.3
 - @lion/icon@0.6.5
 - @lion/input-amount@0.7.12
 - @lion/input-date@0.7.12
 - @lion/input-datepicker@0.14.15
 - @lion/input-email@0.8.12
 - @lion/input-iban@0.9.12
 - @lion/input-range@0.4.12
 - @lion/input@0.7.12
 - @lion/localize@0.13.1
 - @lion/overlays@0.16.10
 - providence-analytics@0.2.2
 - @lion/radio-group@0.11.5
 - @lion/select-rich@0.18.17
 - @lion/select@0.7.12
 - singleton-manager@1.1.1
 - @lion/steps@0.5.4
 - @lion/switch@0.10.13
 - @lion/tabs@0.5.0
 - @lion/textarea@0.7.12
 - @lion/tooltip@0.12.5
 - @lion/validate-messages@0.2.4
2020-07-13 09:47:50 +00:00
..
src chore: fix demo links and move back icon intro 2020-06-08 17:39:29 +02:00
test feat: merge field/validate/choice-input/form-group into @lion/form-core 2020-05-29 17:01:15 +02:00
translations feat: finalize validation and adopt it everywhere 2019-11-18 15:30:08 +01:00
CHANGELOG.md chore: release new versions 2020-07-13 09:47:50 +00:00
index.js feat: finalize validation and adopt it everywhere 2019-11-18 15:30:08 +01:00
lion-input-iban.js feat: release inital public lion version 2019-04-26 10:37:57 +02:00
package.json chore: release new versions 2020-07-13 09:47:50 +00:00
README.md chore: fix demo links and move back icon intro 2020-06-08 17:39:29 +02:00

Input IBAN

lion-input-iban component is based on the generic text input field. Its purpose is to provide a way for users to fill in an IBAN (International Bank Account Number).

import { html } from 'lit-html';
import { loadDefaultFeedbackMessages } from '@lion/validate-messages';
import { IsCountryIBAN } from './src/validators.js';

import './lion-input-iban.js';

export default {
  title: 'Forms/Input Iban',
};

loadDefaultFeedbackMessages();
export const main = () => {
  return html` <lion-input-iban label="Account" name="account"></lion-input-iban> `;
};

Features

  • Based on lion-input
  • Default label in different languages
  • Makes use of IBAN specific validate with corresponding error messages in different languages
    • IsIBAN (default)
    • IsCountryIBAN
  • Parses IBANs automatically
  • Formats IBANs automatically

How to use

Installation

npm i --save @lion/input-amount
import { LionInputIban } from '@lion/input-iban';
// or
import '@lion/input-amount/lion-input-amount.js';

Examples

Prefilled

export const prefilled = () => html`
  <lion-input-iban .modelValue=${'NL20INGB0001234567'} name="iban" label="IBAN"></lion-input-iban>
`;

Faulty Prefilled

export const faultyPrefilled = () => html`
  <lion-input-iban
    .modelValue=${'NL20INGB0001234567XXXX'}
    name="iban"
    label="IBAN"
  ></lion-input-iban>
`;

Country Restrictions

By default, we validate the input to ensure the IBAN is valid. To get the default feedback message for this default validator, use loadDefaultFeedbackMessages from @lion/form-core.

In the example below, we show how to use an additional validator that restricts the input-iban to IBANs from only certain countries.

export const countryRestrictions = () => html`
  <lion-input-iban
    .modelValue=${'DE89370400440532013000'}
    .validators=${[new IsCountryIBAN('NL')]}
    name="iban"
    label="IBAN"
  ></lion-input-iban>
  <br />
  <small>Demo instructions: you can use NL20 INGB 0001 2345 67</small>
`;