Metadata-Version: 2.5
Name: django-wagtail-icon-chooser
Version: 0.1.1
Summary: Searchable Lucide icon chooser for Wagtail admin fields and StreamFields
Project-URL: Homepage, https://github.com/AymaneNahji/django-wagtail-icon-chooser
Project-URL: Documentation, https://github.com/AymaneNahji/django-wagtail-icon-chooser#readme
Project-URL: Repository, https://github.com/AymaneNahji/django-wagtail-icon-chooser
Author-email: Aymane Nahji <aymanenahjidev@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: cms,django,icons,lucide,wagtail
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5
Classifier: Framework :: Wagtail
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Requires-Dist: django>=5.0
Requires-Dist: wagtail>=6.0
Provides-Extra: dev
Requires-Dist: pytest-django>=4.11; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Description-Content-Type: text/markdown

# django-wagtail-icon-chooser

**Lucide icons in Wagtail admin** — searchable modal picker for fields and StreamFields, with bundled vendor assets so production does not depend on a CDN.

Portable Django package · MIT · by [Aymane Nahji](mailto:aymanenahjidev@gmail.com)

[![Python 3.11+](https://img.shields.io/badge/python-3.11%2B-blue.svg)](https://www.python.org/downloads/)
[![Django 5+](https://img.shields.io/badge/django-5%2B-092e20.svg)](https://www.djangoproject.com/)
[![Wagtail 6+](https://img.shields.io/badge/wagtail-6%2B-007d7e.svg)](https://wagtail.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

---

## Why this package

Menu links, feature cards, and CTAs often need a consistent icon set. This app stores **PascalCase** Lucide names (e.g. `Handshake`, `Building2`) — the same convention [lucide-react](https://lucide.dev/icons/) uses on the frontend, so your headless or React site can map values without ad hoc transforms.

- **No models or migrations** in the chooser app itself — only your StreamField migrations when you add the block.
- **Virtualized search** over the full icon set in a Wagtail-native modal.
- **Offline-friendly static files** — Lucide UMD + Clusterize ship inside the wheel.

---

## Quick start

```bash
pip install django-wagtail-icon-chooser
```

```python
INSTALLED_APPS = [
    # ...
    "wagtail",
    "wagtail_icon_chooser",
]
```

```python
from wagtail import blocks
from wagtail_icon_chooser import IconChooserBlock

class MenuLinkBlock(blocks.StructBlock):
    icon = IconChooserBlock(required=True)
    label = blocks.CharBlock(required=True)
    url = blocks.CharBlock(required=True)
```

Run `collectstatic` when you deploy so admin JavaScript and CSS are served.

---

## Features

| Feature | Detail |
|---------|--------|
| `IconChooserBlock` | Drop into any `StructBlock` or `StreamField` |
| `IconChooserWidget` | Use on custom admin fields if needed |
| Search | Fast filter across the bundled Lucide build |
| Overrides | Point settings at a CDN or newer Lucide build |
| AI-ready | Works with **[django-wagtail-ai-generation](https://github.com/AymaneNahji/django-wagtail-ai-generation)** as `lucide_icon` in generated JSON |

Integration guide (settings, static layout, headless notes): **[wagtail_icon_chooser/README.md](wagtail_icon_chooser/README.md)**.

---

## Optional settings

Override static paths when you want a CDN or a pinned Lucide version:

```python
WAGTAIL_ICON_CHOOSER_LUCIDE_JS = "https://unpkg.com/lucide@0.542.0/dist/umd/lucide.min.js"
```

Defaults and full list: see the package README.

---

## Requirements

| Dependency | Version |
|------------|---------|
| Python | 3.11+ |
| Django | 5.0+ |
| Wagtail | 6.0+ |

---

## Develop & test

```bash
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
PYTHONPATH=. DJANGO_SETTINGS_MODULE=tests_project.settings python -m django test wagtail_icon_chooser
```

---

## Wagtail toolkit

| Package | Role |
|---------|------|
| [django-wagtail-ai-generation](https://github.com/AymaneNahji/django-wagtail-ai-generation) | AI assistant; understands `IconChooserBlock` in schema |
| [django-wagtail-blocks-exchange](https://github.com/AymaneNahji/django-wagtail-blocks-exchange) | Copy blocks; icon values travel as plain strings |

---

## License

MIT — see [LICENSE](LICENSE).