<p align="center">
  <img src="screenshots/hero.png" alt="Metronic Extension" width="100%" />
</p>

<h1 align="center">Metronic Extension</h1>

<p align="center">
  Production-ready UI components, validators, and utilities that supercharge <a href="https://keenthemes.com/metronic">Metronic</a>-based applications.
</p>

<p align="center">
  <a href="https://www.npmjs.com/package/metronic-extension"><img src="https://img.shields.io/npm/v/metronic-extension.svg" alt="npm version" /></a>
  <a href="https://www.npmjs.com/package/metronic-extension"><img src="https://img.shields.io/npm/dm/metronic-extension.svg" alt="npm downloads" /></a>
  <a href="https://github.com/shumatsumonobu/metronic-extension/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/metronic-extension.svg" alt="license" /></a>
</p>

---

## What's Inside

### Components

| Component | Description |
|-----------|-------------|
| **DataTable** | Server-side processing, column visibility, subtables, and more |
| **BarChart / LineChart / PieChart** | ApexCharts wrappers with AJAX data loading |
| **Modal** | Subclassable modal with lifecycle hooks and form integration |
| **Dialog** | SweetAlert2-based confirm/alert dialogs styled for Metronic |
| **Validation** | Declarative form validation with custom rules |
| **Dropzone** | Drag & drop file upload with preview |
| **ImageInput** | Avatar / image upload with crop and preview |
| **Tagify** | Tag input with single-select mode support |
| **Tree** | jsTree wrapper with context menu and CRUD |
| **BlockUI** | Loading overlay for any element |
| **Toast** | Notification toasts |
| **APIClient** | Axios wrapper with error handling |

### Utilities & Validators

Format bytes, escape HTML, number formatting, type checks, and 15+ validators including IP, FQDN, URL, phone number (JP), data URI, and more.

---

## Demo

<p align="center">
  <img src="screenshots/demo-dashboard.jpg" alt="Demo Dashboard" width="100%" />
</p>

Live demo: **[shumatsumonobu.github.io/metronic-extension/demo/](https://shumatsumonobu.github.io/metronic-extension/demo/)**

---

## Documentation

<p align="center">
  <img src="screenshots/reference-api.png" alt="API Reference" width="100%" />
</p>

Full API reference with live examples: **[shumatsumonobu.github.io/metronic-extension](https://shumatsumonobu.github.io/metronic-extension/)**

---

## Installation

```sh
npm install metronic-extension
```

### ESM

```js
import {components} from 'metronic-extension';

const {DataTable, BarChart, Modal} = components;
```

### UMD (Script Tag)

```html
<script src="metronic-extension.bundle.js"></script>
<script>
  const {DataTable, BarChart, Modal} = metronicExtension.components;
</script>
```

---

## Quick Start

```js
import {components} from 'metronic-extension';

// Data Table with server-side processing
new components.DataTable(document.getElementById('myTable'), {
  ajax: {url: '/api/users'},
  columnDefs: [
    {targets: 0, data: 'name'},
    {targets: 1, data: 'email'},
    {targets: 2, data: 'role'},
  ],
});

// Bar Chart
new components.BarChart(document.getElementById('myChart'), {
  ajax: {url: '/api/revenue'},
});

// Confirm Dialog
const confirmed = await components.Dialog.confirm('Are you sure?');
```

---

## Changelog

See [CHANGELOG.md](CHANGELOG.md) for release history.

## Author

**shumatsumonobu**

* [github/shumatsumonobu](https://github.com/shumatsumonobu)
* [X/shumatsumonobu](https://x.com/shumatsumonobu)
* [facebook/takuya.motoshima.7](https://www.facebook.com/takuya.motoshima.7)

## License

[MIT](LICENSE)
