npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@equinor/fusion-wc-textinput

v1.1.2

Published

<!--prettier-ignore-start--> # `<fusion-wc-textinput>` [![Published on npm](https://img.shields.io/npm/v/@equinor/fusion-wc-textinput.svg)](https://www.npmjs.com/package/@equinor/fusion-wc-textinput)

Downloads

9,338

Readme

<fusion-wc-textinput> Published on npm

Storybook

Material Web Component

Installation

npm install @equinor/fusion-wc-textinput

Example Usage

<fwc-textinput label='My Label' icon="settings"></fwc-textinput>

Properties/Attributes

Name | Type | Description ------------------------- | ----------------------------- | ----------- value | string | The input control's value. type | TextInputType* | A string specifying the type of control to render. variant | TextInputVariant** | Input style variant to render. label | string | Sets floating label value. placeholder | string | Sets disappearing input placeholder. prefix | string | Prefix text to display before the input. suffix | string | Suffix text to display after the input. icon | IconName*** | Leading icon to display in input. See fwc-icon. iconTrailing | IconName*** | Trailing icon to display in input. See fwc-icon. disabled | boolean | Whether or not the input should be disabled. charCounter | boolean | TextInputCharCounter****| Note: requries maxLength to be set. Display character counter with max length. helper | string | Helper text to display below the input. Display default only when focused. helperPersistent | boolean | Always show the helper text despite focus. required | boolean | Displays error state if value is empty and input is blurred. maxLength | number | Maximum length to accept input. validationMessage | string | Message to show in the error color when the textinput is invalid. (Helper text will not be visible) pattern | string | HTMLInputElement.prototype.pattern (empty string will unset attribute) min | number|string | HTMLInputElement.prototype.min (empty string will unset attribute) max | number|string | HTMLInputElement.prototype.max (empty string will unset attribute) size | number|null | HTMLInputElement.prototype.size (null will unset attribute) step | number|null | HTMLInputElement.prototype.step (null will unset attribute) autoValidate | boolean | Reports validity on value change rather than only on blur. validity | ValidityState (readonly) | The ValidityState of the textinput. willValidate | boolean (readonly) | HTMLInputElement.prototype.willValidate validityTransform | ValidityTransform*****|null | Callback called before each validation check. See the validation section for more details. validateOnInitialRender | boolean | Runs validation check on initial render. name | string | Sets the name attribute on the internal input.***

* TextInputType is exported by fwc-textinput.

type TextInputType = 'text'|'search'|'tel'|'url'|'email'|'password'|
    'date'|'month'|'week'|'time'|'datetime-local'|'number'|'color';

** TextInputVariant is exported by fwc-textinput.

export type TextInputVariant = 'filled' | 'outlined';

*** IconName is exported by fwc-icon.

type IconName = keyof typeof edsIcons | string;

**** TextInputCharCounter is exported by fwc-textinput.

type TextInputCharCounter = 'external' | 'internal';

***** ValidityTransform is exported by fwc-textinput.

type ValidityTransform = (value: string, nativeValidity: ValidityState) => Partial<ValidityState>

****** The name property should only be used for browser autofill as webcomponent form participation does not currently consider the name attribute. See #289.

Methods

| Name | Description | -------- | ------------- | checkValidity() => boolean | Returns true if the textinput passes validity checks. Returns false and fires an invalid event on the textinput otherwise. NOTE: When accessing any property or function that checks validity at textinput initial boot up, you may have to await <fwc-textinput>.updateComplete. | reportValidity() => boolean | Runs checkValidity() method, and if it returns false, then it reports to the user that the input is invalid. | setCustomValidity(message:string) => void | Sets a custom validity message (also overwrites validationMessage). If this message is not the empty string, then the element is suffering from a custom validity error and does not validate. | layout() => Promise<void> | Re-calculate layout. If a textinput is styled with display:none before it is first rendered, and it has a label that is floating, then you must call layout() the first time you remove display:none, or else the notch surrounding the label will not render correctly.

Validation

<fwc-textinput> follows the basic <input> constraint validation model. It exposes:

  • required
  • maxLength
  • pattern
  • min
  • max
  • step
  • validity
  • willValidate
  • checkValidity()
  • reportValidity()
  • setCustomValidity(message)

Additionally, it implements more features such as:

  • validationMessage
  • validateOnInitialRender
  • and validityTransform

By default, <fwc-textinput> will report validation on blur.