Skip to main content

No project description provided

Project description

PeasyWidgets

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pip install peasywidgets
  1. Add peasywidgets to Django INSTALLED_APPS
  2. Import the desired widgets
from peasywidgets.datalist_widgets import DatalistMultiple, DatalistSingle
from peasywidgets.filter_widgets import ChoiceFilterMultiple, ChoiceFilterSingle
  1. Run collectstatic and include the JavaScript in templates {% static 'peasywidgets.js' %} and optionally the CSS {% static peasywidgets.css %}

Styling

The following default CSS is available to use with Django's static template tag, otherwise use these selectors to write custom CSS/Tailwind directives.

/* peasywidgets.css */

p.choice-filter-errors {
    color: red;
}

.choice-filter-multi-container {
    border: 1px solid #ced4da;
    border-radius: .25rem;
    padding: 0.5rem;
}

.choice-filter-flex-row {
    display: flex;
    flex-direction: row;
    max-width: 100%;
}
.choice-filter-flex-col {
    display: flex;
    flex-direction: column;
}

.choice-filter-red {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.choice-filter-red:hover {
    color: #fff;
    background-color: #c82333;
    border-color: #bd2130;
}
input.choice-filter-multi-selected {
    flex-grow: 1;
    display: block;
    padding: 0;
    padding-top: 0.25rem;
    padding-left: 0.5rem;
    margin-left: 0.5rem;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #495057;
    background-color: rgb(237, 237, 255);
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: .25rem;
}

.choice-filter-selected-box {
    overflow-y: auto;
    margin-top: 0;
    max-height: 12rem;
    padding-right: 0.5rem;
}
button.choice-filter-rm-btn {
    height: 1.5rem;
    width: 1.5rem;
    padding: 0;
    border-radius: 100%;
    cursor: pointer;
    margin-top: auto;
    margin-bottom: auto;
    margin-left: 0.5rem;
    text-align: center;
}
button>svg {
    display: block;
    margin: auto;
}
.choice-filter-multi-input {
    border: none;
    background-color: transparent;
    flex-grow: 1;
    cursor: default;
}

input.choice-filter {
    border: 1px solid #ced4da;
    border-radius: .25rem;
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    width: 100%;
    margin-bottom: 0.5rem;
    cursor: pointer;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="black" viewBox="0 0 32 32"><path d="M16 22L6 10h20l-10 12z"/></svg>') no-repeat right .75rem center;
}

input.choice-filter.choice-filter-multi {
    margin-top: 0;
}

input.choice-filter.valid {
    background-color: rgb(237, 237, 255);
}

ul.choice-filter {
    list-style-type: none;
    margin-bottom: 0.5rem;
    max-height: 200px; 
    overflow-y: auto;
    overflow-x: hidden;
    position: absolute;
    background-color: white;
    border: 1px solid rgb(207, 207, 207);
    border-radius: 0.25rem;
    max-width: 90%;
    box-shadow: 0.4rem 0.6rem 1rem 0 rgb(153, 153, 153);
}

button.choice-filter {
    text-align: left;
    margin-bottom: 0.2rem;
    margin-top: 0.2rem;
    padding: 0 0.75rem;
    background-color: #fff;
    background-clip: padding-box;
    width: 100%;
}

button.choice-filter:focus, button.choice-filter:hover {
    background-color: blue;
    color: white;
}

License

peasywidgets is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

peasywidgets-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

peasywidgets-0.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file peasywidgets-0.1.0.tar.gz.

File metadata

  • Download URL: peasywidgets-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.24.1

File hashes

Hashes for peasywidgets-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b5f39a696930cecc46093393451055db43ae9e50b17d9a8ec4e802d3f4cf2b2b
MD5 cbfbad89f4e28dd9b5ed2d4f2dc4bf64
BLAKE2b-256 bf32e3a9acd582fe34eb5a67e2af1e0051c1f0c7bdf4f301679b9cfb2e794c41

See more details on using hashes here.

Provenance

File details

Details for the file peasywidgets-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for peasywidgets-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd678a2f225c1b7f162f78c702969ea42b74444d702ddb6659b9d5be55494ab9
MD5 f261ab6d6ac1a8e0b34e822bf1626387
BLAKE2b-256 9dde483ae676904ac6039e15fabb3c37612c5bd7283e6371dceab4cd48daf72f

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page