Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

Commit

Permalink
v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Erwin Heldy G committed May 23, 2021
1 parent 46e3f70 commit 6fa2863
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 30 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Erwin Heldy G
Copyright (c) 2021 Erwin Heldy G

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Tagin
Simple tag input for Bootstrap 4
Simple tag input for Bootstrap. Support bootstrap v4 and v5.

Demo: [https://tagin.netlify.app/](https://tagin.netlify.app/)

#### Features
* Custom separator
* Enable / disable duplicates
* Custom transfrom
* Custom transform
* Fast
* Small
* No depedencies
10 changes: 5 additions & 5 deletions dist/css/tagin.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/tagin.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/tagin.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://unpkg.com/bootstrap@4.5.3/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://unpkg.com/bootstrap@5.0.1/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="css/tagin.min.css">
<title>Tagin</title>
</head>
Expand Down
16 changes: 9 additions & 7 deletions dist/js/tagin.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ function tagin(el, option = {}) {
fakeEl.remove()
}
function addTag(force = false) {
const value = transform(input.value.replace(new RegExp(escapeRegex(separator), 'g'), '').trim())
const value = transform(input.value.trim())
if (value === '') { input.value = '' }
if (input.value.includes(separator) || (force && input.value != '')) {
if (getTags().includes(value) && duplicate === 'false') {
alertExist(value)
} else {
input.insertAdjacentHTML('beforebegin', templateTag(value))
updateValue()
}
value.split(separator).filter(i => i != '').forEach(val => {
if (getTags().includes(val) && duplicate === 'false') {
alertExist(val)
} else {
input.insertAdjacentHTML('beforebegin', templateTag(val))
updateValue()
}
})
input.value = ''
input.removeAttribute('style')
}
Expand Down
2 changes: 1 addition & 1 deletion dist/js/tagin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions js/tagin.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,17 @@ function tagin(el, option = {}) {
fakeEl.remove()
}
function addTag(force = false) {
const value = transform(input.value.replace(new RegExp(escapeRegex(separator), 'g'), '').trim())
const value = transform(input.value.trim())
if (value === '') { input.value = '' }
if (input.value.includes(separator) || (force && input.value != '')) {
if (getTags().includes(value) && duplicate === 'false') {
alertExist(value)
} else {
input.insertAdjacentHTML('beforebegin', templateTag(value))
updateValue()
}
value.split(separator).filter(i => i != '').forEach(val => {
if (getTags().includes(val) && duplicate === 'false') {
alertExist(val)
} else {
input.insertAdjacentHTML('beforebegin', templateTag(val))
updateValue()
}
})
input.value = ''
input.removeAttribute('style')
}
Expand Down
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
{
"name": "tagin",
"version": "1.2.0",
"version": "1.3.0",
"description": "Simple tag input for Bootstrap",
"keywords": [
"tag",
"bootstrap",
"bootstrap tag",
"tag input"
],
"main": "index.js",
"repository": "https://github.com/erwinheldy/tagin.git",
"author": "Erwin Heldy G <[email protected]>",
"license": "MIT",
"dependencies": {
"bootstrap": "4.5.3"
"bootstrap": "5.0.1"
},
"devDependencies": {
"gulp": "4.0.2",
"gulp-autoprefixer": "7.0.1",
"gulp-clean-css": "4.3.0",
"gulp-rename": "2.0.0",
"gulp-sass": "4.1.0",
"gulp-terser": "1.4.1"
"gulp-terser": "2.0.1"
}
}
2 changes: 1 addition & 1 deletion scss/tagin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
border-color: $input-focus-border-color;
outline: 0;
@if $enable-shadows {
box-shadow: $input-box-shadow, $input-focus-box-shadow;
@include box-shadow($input-box-shadow, $input-focus-box-shadow);
} @else {
box-shadow: $input-focus-box-shadow;
}
Expand Down

0 comments on commit 6fa2863

Please sign in to comment.