Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@material/auto-init

Package Overview
Dependencies
Maintainers
9
Versions
1664
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@material/auto-init - npm Package Compare versions

Comparing version 0.24.0 to 0.25.0

2

package.json
{
"name": "@material/auto-init",
"description": "Declarative, easy-to-use auto-initialization for Material Components for the web",
"version": "0.24.0",
"version": "0.25.0",
"main": "index.js",

@@ -6,0 +6,0 @@ "license": "Apache-2.0",

@@ -33,6 +33,6 @@ <!--docs:

```html
<div class="mdc-textfield" data-mdc-auto-init="MDCTextfield">
<input class="mdc-textfield__input" type="text" id="input">
<label for="input" class="mdc-textfield__label">Input Label</label>
<div class="mdc-textfield__bottom-line"></div>
<div class="mdc-text-field" data-mdc-auto-init="MDCTextField">
<input class="mdc-text-field__input" type="text" id="input">
<label for="input" class="mdc-text-field__label">Input Label</label>
<div class="mdc-text-field__bottom-line"></div>
</div>

@@ -46,3 +46,3 @@

This will attach an [MDCTextfield](../mdc-textfield) instance to the root `<div>` element.
This will attach an [MDCTextField](../mdc-textfield) instance to the root `<div>` element.

@@ -55,14 +55,14 @@ #### Accessing the component instance

```html
<div class="mdc-textfield" data-mdc-auto-init="MDCTextfield">
<input class="mdc-textfield__input" type="text" id="input">
<label for="input" class="mdc-textfield__label">Input Label</label>
<div class="mdc-textfield__bottom-line"></div>
<div class="mdc-text-field" data-mdc-auto-init="MDCTextField">
<input class="mdc-text-field__input" type="text" id="input">
<label for="input" class="mdc-text-field__label">Input Label</label>
<div class="mdc-text-field__bottom-line"></div>
</div>
```
Once `mdc.autoInit()` is called, you can access the component instance via an `MDCTextfield`
Once `mdc.autoInit()` is called, you can access the component instance via an `MDCTextField`
property on that element.
```js
document.querySelector('.mdc-textfield').MDCTextfield.disabled = true;
document.querySelector('.mdc-text-field').MDCTextField.disabled = true;
```

@@ -80,9 +80,9 @@

import mdcAutoInit from '@material/auto-init';
import {MDCTextfield} from '@material/textfield';
import {MDCTextField} from '@material/textfield';
mdcAutoInit.register('MDCTextfield', MDCTextfield);
mdcAutoInit.register('MDCTextField', MDCTextField);
```
`mdcAutoInit.register()` tells `mdc-auto-init` that when it comes across an element with a
`data-mdc-auto-init` attribute set to `"MDCTextfield"`, it should initialize an `MDCTextfield`
`data-mdc-auto-init` attribute set to `"MDCTextField"`, it should initialize an `MDCTextField`
instance on that element. The `material-components-web` package does this for all components for

@@ -95,9 +95,9 @@ convenience.

import mdcAutoInit from '@material/auto-init';
import {MDCTextfield} from '@material/textfield';
import {MDCTextField} from '@material/textfield';
mdcAutoInit.register('My amazing text field!!!', MDCTextfield);
mdcAutoInit.register('My amazing text field!!!', MDCTextField);
```
```html
<div class="mdc-textfield" data-mdc-auto-init="My amazing text field!!!">
<div class="mdc-text-field" data-mdc-auto-init="My amazing text field!!!">
<!-- ... -->

@@ -114,3 +114,3 @@ </div>

```js
mdcAutoInit.deregister('MDCTextfield');
mdcAutoInit.deregister('MDCTextField');
```

@@ -117,0 +117,0 @@

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