Commit ddf65276 authored by Amir.h Yeganemehr's avatar Amir.h Yeganemehr

Initial commit

parents
The MIT License (MIT)
Copyright (c) 2014-2016 flatlogic.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
/// <reference types="jquery"/>
interface JQuery {
bootstrapCheckbox();
}
\ No newline at end of file
/// <reference path="./index.d.ts"/>
import * as $ from "jquery";
$.fn.bootstrapCheckbox = function(){
function setClasses(){
let $label = $(this).parents('label');
let checked:boolean = $(this).prop('checked');
if(checked){
if(!$label.hasClass('checked')){
$label.addClass('checked');
}
$label.removeClass('indeterminate');
}else{
$label.removeClass('checked');
let indeterminate:boolean = $(this).prop('checked');
if(indeterminate){
$label.addClass('indeterminate');
}
}
}
let $checkboxs = $(this);
$checkboxs.each(setClasses);
$checkboxs.on('change', setClasses);
$checkboxs.on('focus', function(){
$(this).parents('label').addClass('focus');
});
$checkboxs.on('blur', function(){
$(this).parents('label').removeClass('focus');
});
}
\ No newline at end of file
This diff is collapsed.
@import "node_modules/bootstrap/less/variables.less";
@import "node_modules/bootstrap/less/mixins.less";
@import "node_modules/font-awesome/less/variables.less";
//
// Checkboxes
// --------------------------------------------------
@font-family-icon: 'FontAwesome';
@fa-var-check: "\f00c";
@check-icon: @fa-var-check;
.checkbox-variant(@parent, @color) {
.@{parent} label.checked, label.@{parent}.checked{
&::before {
background-color: @color;
border-color: @color;
}
&::after {
color: #fff;
}
}
}
.checkbox-variant-indeterminate(@parent, @color) {
.@{parent} label.indeterminate, label.@{parent}.indeterminate{
&::before {
background-color: @color;
border-color: @color;
}
&::after {
background-color: #fff;
}
}
}
.checkbox{
padding-left: 14px;
&&-circle label::before{
border-radius: 50%;
}
}
.checkbox label, label.checkbox-inline{
display: inline-block;
vertical-align: middle;
position: relative;
padding-left: 20px;
&::before{
content: "";
display: inline-block;
position: absolute;
width: 18px;
height: 18px;
left: 0;
margin-top: 3px;
border: 1px solid @input-border;
border-radius: 3px;
background-color: #fff;
.transition(~"border 0.15s ease-in-out, color 0.15s ease-in-out");
}
&::after{
display: inline-block;
position: absolute;
width: 16px;
height: 16px;
left: 0;
top: 0;
margin-top: 4px;
padding-left: 3px;
padding-top: 1px;
font-size: 11px;
color: @input-color;
}
&.focus{
&::before{
.tab-focus();
}
}
&.checked{
&::after{
font-family: @font-family-icon;
content: @check-icon;
}
}
&.indeterminate{
&::after{
display: block;
content: " ";
width: 10px;
height: 3px;
background-color: #555555;
border-radius: 2px;
margin-left: -16.5px;
margin-top: 7px;
}
}
&.disabled{
opacity: 0.65;
&::before{
background-color: @input-bg-disabled;
cursor: not-allowed;
}
}
input[type="checkbox"]{
opacity: 0;
z-index: 1;
cursor: pointer;
&:disabled {
cursor: not-allowed;
}
&:disabled + label{
opacity: 0.65;
&::before{
background-color: @input-bg-disabled;
cursor: not-allowed;
}
}
}
}
.checkbox-variant(checkbox-primary, @brand-primary);
.checkbox-variant(checkbox-danger, @brand-danger);
.checkbox-variant(checkbox-info, @brand-info);
.checkbox-variant(checkbox-warning, @brand-warning);
.checkbox-variant(checkbox-success, @brand-success);
.checkbox-variant-indeterminate(checkbox-primary, @brand-primary);
.checkbox-variant-indeterminate(checkbox-danger, @brand-danger);
.checkbox-variant-indeterminate(checkbox-info, @brand-info);
.checkbox-variant-indeterminate(checkbox-warning, @brand-warning);
.checkbox-variant-indeterminate(checkbox-success, @brand-success);
//
// Radios
// --------------------------------------------------
.radio-variant(@parent, @color) {
.@{parent} label, label.@{parent}{
&::after{
background-color: @color;
}
&.checked{
&::before {
border-color: @color;
}
&::after{
background-color: @color;
}
}
}
}
.radio{
padding-left: 20px;
input[type="radio"]{
opacity: 0;
z-index: 1;
cursor: pointer;
&:disabled{
cursor: not-allowed;
}
}
}
.radio label, label.radio-inline{
display: inline-block;
vertical-align: middle;
position: relative;
padding-left: 20px;
&::before{
content: "";
display: inline-block;
position: absolute;
width: 17px;
height: 17px;
left: 0;
margin-top: 3px;
border: 1px solid @input-border;
border-radius: 50%;
background-color: #fff;
.transition(border 0.15s ease-in-out);
}
&::after{
display: inline-block;
position: absolute;
content: " ";
width: 11px;
height: 11px;
left: 3px;
top: 3px;
margin-top: 3px;
border-radius: 50%;
background-color: @input-color;
.scale(0, 0);
.transition-transform(.1s cubic-bezier(.8,-0.33,.2,1.33));
//curve - http://cubic-bezier.com/#.8,-0.33,.2,1.33
}
&.focus{
&::before{
.tab-focus();
}
}
&.checked{
&::after{
.scale(1, 1);
}
}
&.disabled{
opacity: 0.65;
&::before{
cursor: not-allowed;
}
}
}
.radio-variant(radio-primary, @brand-primary);
.radio-variant(radio-danger, @brand-danger);
.radio-variant(radio-info, @brand-info);
.radio-variant(radio-warning, @brand-warning);
.radio-variant(radio-success, @brand-success);
.radio, .checkbox{
label.checked{
&:after {
font-family: @font-family-icon;
content: @check-icon;
}
}
}
body.rtl, html.rtl, html[dir=rtl]{
.checkbox label, label.checkbox-inline{
padding-right: 20px;
padding-left: 0;
&::before{
left: auto;
right:0;
}
&::after{
left:auto;
right: 0;
padding-left: 0;
padding-right: 3px;
}
&.indeterminated{
&::after{
margin-left: 0;
margin-right: -16.5px;
}
}
}
.radio label, label.radio-inilne{
padding-left: 0;
padding-right: 20px;
&::before{
left: auto;
right: 0;
}
&::after{
left: auto;
right: 3px;
}
}
}
\ No newline at end of file
{
"name": "jquery-bootstrap-checkbox",
"description": "Font Awesome Bootstrap Checkboxes & Radios. jquery and css way to make inputs look prettier.",
"license": "MIT",
"homepage": "https://git.jeyserver.com/yeganemehr/jquery-bootstrap-checkbox",
"author": {
"name": "yeganemehr",
"url": "http://yeganemehr.ir"
},
"bugs": {
"url": "https://git.jeyserver.com/yeganemehr/jquery-bootstrap-checkbox"
},
"dependencies": {
"jquery": "^3.2.1",
"bootstrap": "^3.3.7",
"font-awesome": "^4.7.0"
},
"devDependencies": {},
"optionalDependencies": {},
"keywords": [
"jquery",
"bootstrap",
"font-awesome",
"less"
],
"main": "index.ts",
"repository": {
"type": "git",
"url": "git+https://git.jeyserver.com/yeganemehr/jquery-bootstrap-checkbox.git"
},
"version": "1.0.0"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment