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

adt-js-components

v1.3.4

Published

JavaScript components for Nette framework

Downloads

111

Readme

ADT JS Components

Installation

yarn add adt-js-components

Usage

import AdtJsComponents from 'adt-js-components'

Configuration

JsComponentsConfig.php and in config.neon services.jsComponents

Generic component

For example, there's an ExampleForm located in /app/Components/Forms/ExampleForm

  1. Create your own data selector, for example example-form.
  2. Attribute data-adt-example-form must be included in your HTML.
  3. path starts at /app but excludes it, so it will be Components/Forms/ExampleForm
  4. In /app/Components/Forms/ExampleForm create index.js with
const run = (options) => {
    ... your code ...
};

export default { run };
  1. In your project JS (app.js) add
AdtJsComponents.init('example-form', 'Components/Forms/ExampleForm');
  1. Example of resolve in your project webpack.config.js, if all applications js modules are relatively to app.
resolve: {
	modules: ['node_modules'],
	alias: {
		JsComponents: path.resolve(__dirname, 'app')
	}
}

Predefined components

Currency Input

Attribute data-adt-currency-input must be included in your HTML!

AdtJsComponents.initCurrencyInput();

Date Input

Attribute data-adt-date-input must be included in your HTML!

AdtJsComponents.initDateInput();

Recaptcha

Attribute data-adt-recaptcha must be included in your HTML!

AdtJsComponents.initRecaptcha();

Select 2

Attribute data-adt-select2 must be included in your HTML!

AdtJsComponents.initSelect2();

Submit Form

Attribute data-adt-submit-form must be included in your HTML!

AdtJsComponents.initSubmitForm();

On each submit before and after callback can be added. Before callback is invoked before submit and form is not submitted if the function return false. After callback is invoked after successed submit.

<script>
	function myConfirm() {
		return confirm('Do you realy want to submit the form?');
	}
	function myAlert() {
		alert('Data was saved.');
	}
</script>

<button ... data-adt-submit-form-before-callback="myConfirm" data-adt-submit-form-after-callback="myAlert">Submit</button>

Ajax Select

Attribute data-adt-ajax-select must be included in your HTML!

AdtJsComponents.initAjaxSelect();

Input Clear

Attribute data-adt-input-clear must be included in your HTML!

The option selector have to be set to select inputs to clear.

The option confirmMessage can be set to clear confirmation.

AdtJsComponents.initInputClear();
<div data-adt-input-clear="{selector: '.input-clear-all', confirmMessage: 'Do you really want to clear all inputs?'}">Clear all</div>
<div data-adt-input-clear="{selector: '.input-clear-special'}">Clear special</div>

<input type="text" name="input1" class="input-clear-all input-clear-special">
<input type="text" name="input2" class="input-clear-all">
<input type="text" name="input3" class="input-clear-all input-clear-special">