From 5236bc0d8b775abea7870de4b98e810ac33c7097 Mon Sep 17 00:00:00 2001 From: Erim Icel Date: Sat, 4 Jan 2025 23:53:18 +0000 Subject: [PATCH 1/3] Add demo page --- demo/.DS_Store | Bin 0 -> 6148 bytes demo/css/select2-tailwindcss-theme.min.css | 1 + demo/index.html | 23 +++++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 demo/.DS_Store create mode 100644 demo/css/select2-tailwindcss-theme.min.css create mode 100644 demo/index.html diff --git a/demo/.DS_Store b/demo/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ef4c05a398730c3e6fe5de1f5d8081d3e4a39380 GIT binary patch literal 6148 zcmeHK%}T>S5Z-O8Z7D(y3Oz1(Eg0KU5HBIt7cim+m718M!I&*gY7Qlkv%Zi|;`2DO zy8(+ii`W_1{pNQ!`$6`HF~;3hc+8l^80$bomr}+-rTf8EG|y+& z{+UcNKT76HRS<=9NV&a^l2GQZTqR+uYCRq3g3PS`dOaEr2Vyj_i-B054DEp!PsT;j z?Hn8)onFkIQ4!=z8BY(4mEMkBd z_-738*3_H2uqbo3{#YKKwF25bG!)D$Q2_yc;}QS{?jwB_)Nz42 + + + + + + Select2 Tailwindcss Theme + + + + + + + + + + +

+ Hello world! +

+ + + \ No newline at end of file From 1958dec725113147d8674d33af162afb96aa7f09 Mon Sep 17 00:00:00 2001 From: Erim Icel Date: Sun, 5 Jan 2025 00:44:58 +0000 Subject: [PATCH 2/3] Demo pages --- demo/css/select2-tailwindcss-theme.min.css | 1 - demo/css/tailwind.css | 3 + demo/index.html | 139 ++++++++++++++++++++- demo/js/script.js | 11 ++ demo/tailwind.config.js | 11 ++ demo/tailwind.css | 7 ++ package.json | 3 +- 7 files changed, 167 insertions(+), 8 deletions(-) delete mode 100644 demo/css/select2-tailwindcss-theme.min.css create mode 100644 demo/css/tailwind.css create mode 100644 demo/js/script.js create mode 100644 demo/tailwind.config.js create mode 100644 demo/tailwind.css diff --git a/demo/css/select2-tailwindcss-theme.min.css b/demo/css/select2-tailwindcss-theme.min.css deleted file mode 100644 index 2398dbb..0000000 --- a/demo/css/select2-tailwindcss-theme.min.css +++ /dev/null @@ -1 +0,0 @@ -@charset "UTF-8";.select2-container--tailwindcss-3{@apply block w-full}.select2-container--tailwindcss-3.select2-container--open .select2-dropdown{@apply w-full py-1 mt-1 overflow-auto text-base bg-white border-none rounded-md shadow-lg max-h-60 ring-1 ring-black/5 ring-opacity-5 focus:outline-none sm:text-sm}.select2-container--tailwindcss-3.select2-container--open .select2-dropdown--below{@apply origin-top}.select2-container--tailwindcss-3.select2-container--open .select2-dropdown--above{@apply origin-bottom}.select2-container--tailwindcss-3 .select2-search--dropdown .select2-search__field{@apply block w-full px-3 py-1.5 text-sm placeholder-gray-400 border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500}.select2-container--tailwindcss-3 .select2-results__options{@apply overflow-auto max-h-60}.select2-container--tailwindcss-3 .select2-results__option{@apply relative py-2 pl-3 text-gray-900 transition-colors duration-150 ease-in-out cursor-default select-none pr-9}.select2-container--tailwindcss-3 .select2-results__option--highlighted{@apply text-white bg-indigo-600}.select2-container--tailwindcss-3 .select2-results__option--selected{@apply font-medium text-blue-900 bg-blue-100}.select2-container--tailwindcss-3 .select2-results__option--selected:after{@apply absolute inset-y-0 flex items-center text-blue-600 right-3;content:"✓"}.select2-container--tailwindcss-3 .select2-results__group{@apply cursor-default bg-gray-50 px-3 py-1.5 text-xs font-medium uppercase tracking-wider text-gray-700}.select2-container--tailwindcss-3 .select2-results__option--loading{@apply flex items-center justify-center py-4 text-gray-400}.select2-container--tailwindcss-3 .select2-results__option--loading:after{@apply w-5 h-5 border-2 border-gray-300 rounded-full animate-spin border-t-blue-600;content:""}.select2-container--tailwindcss-3 .select2-selection--single{@apply relative w-full h-9 py-1.5 pl-3 pr-8 text-left transition-colors duration-200 ease-in-out bg-white border border-gray-300 rounded-md cursor-default focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 sm:text-sm}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__rendered{@apply block pl-0 pr-0 text-gray-900 truncate}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__placeholder{@apply text-gray-400}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__arrow{@apply absolute inset-y-0 right-0 flex items-center pr-2}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__arrow b{@apply w-5 h-5 text-gray-400;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:contain}.select2-container--tailwindcss-3.select2-container--disabled .select2-selection--single{@apply text-gray-500 cursor-not-allowed bg-gray-50}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__clear{@apply float-right pr-0 mr-0 font-bold text-gray-400 cursor-pointer hover:text-gray-600}.select2-container--tailwindcss-3.select2-container--focus .select2-selection--single{@apply border-blue-500 ring-1 ring-blue-500}.select2-container--tailwindcss-3.select2-container--error .select2-selection--single{@apply border-red-500 ring-1 ring-red-500}.select2-container--tailwindcss-3[dir=rtl] .select2-selection--single .select2-selection__rendered{@apply pl-10 pr-3}.select2-container--tailwindcss-3 .select2-selection--multiple{@apply min-h-[2.25rem] rounded-md border border-gray-300 bg-white py-1 px-2 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__rendered{@apply inline float-left}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__choice{@apply m-1 inline-flex items-center rounded-md bg-blue-100 px-2.5 py-0.5 text-sm font-medium text-blue-800}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__choice__remove{@apply -ml-1 mr-1.5 h-4 w-4 items-center flex justify-center rounded-full text-blue-600 hover:bg-blue-200 hover:text-blue-900}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-search--inline .select2-search__field{@apply h-8 p-0 text-sm placeholder-gray-400 bg-transparent border-0 focus:outline-none focus:ring-0}.select2-container--tailwindcss-3.select2-container--disabled .select2-selection--multiple{@apply text-gray-500 cursor-not-allowed bg-gray-50}.select2-container--tailwindcss-3 .select2-selection--multiple.select2-selection--clearable{@apply pr-4}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__clear{@apply absolute top-0 right-0 mt-2 mr-4 font-bold text-gray-400 cursor-pointer hover:text-gray-600}.select2-container--tailwindcss-3.select2-container--focus .select2-selection--multiple{@apply border-blue-500 ring-1 ring-blue-500}.select2-container--tailwindcss-3.select2-container--error .select2-selection--multiple{@apply border-red-500 ring-1 ring-red-500} \ No newline at end of file diff --git a/demo/css/tailwind.css b/demo/css/tailwind.css new file mode 100644 index 0000000..3b693f2 --- /dev/null +++ b/demo/css/tailwind.css @@ -0,0 +1,3 @@ +@charset "UTF-8";*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: } + +/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.select2-container--tailwindcss-3{display:block;width:100%}.select2-container--tailwindcss-3.select2-container--open .select2-dropdown{border-radius:.375rem;border-style:none;margin-top:.25rem;max-height:15rem;overflow:auto;width:100%;--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1));font-size:1rem;line-height:1.5rem;padding-bottom:.25rem;padding-top:.25rem;--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-color:rgba(0,0,0,.05);--tw-ring-opacity:0.05}.select2-container--tailwindcss-3.select2-container--open .select2-dropdown:focus{outline:2px solid transparent;outline-offset:2px}@media (min-width:640px){.select2-container--tailwindcss-3.select2-container--open .select2-dropdown{font-size:.875rem;line-height:1.25rem}}.select2-container--tailwindcss-3.select2-container--open .select2-dropdown--below{transform-origin:top}.select2-container--tailwindcss-3.select2-container--open .select2-dropdown--above{transform-origin:bottom}.select2-container--tailwindcss-3 .select2-search--dropdown .select2-search__field{border-radius:.375rem;display:block;width:100%;--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1));font-size:.875rem;line-height:1.25rem;padding:.375rem .75rem}.select2-container--tailwindcss-3 .select2-search--dropdown .select2-search__field::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}.select2-container--tailwindcss-3 .select2-search--dropdown .select2-search__field::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}.select2-container--tailwindcss-3 .select2-search--dropdown .select2-search__field{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.select2-container--tailwindcss-3 .select2-search--dropdown .select2-search__field:focus{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1));outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.select2-container--tailwindcss-3 .select2-results__options{max-height:15rem;overflow:auto}.select2-container--tailwindcss-3 .select2-results__option{cursor:default;padding:.5rem 2.25rem .5rem .75rem;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1));transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.select2-container--tailwindcss-3 .select2-results__option--highlighted{--tw-bg-opacity:1;background-color:rgb(79 70 229/var(--tw-bg-opacity,1));--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-results__option--selected{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1));font-weight:500;--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-results__option--selected:after{align-items:center;bottom:0;display:flex;position:absolute;right:.75rem;top:0;--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1));content:"✓"}.select2-container--tailwindcss-3 .select2-results__group{cursor:default;--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1));font-size:.75rem;font-weight:500;letter-spacing:.05em;line-height:1rem;padding:.375rem .75rem;text-transform:uppercase;--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-results__option--loading{align-items:center;display:flex;justify-content:center;padding-bottom:1rem;padding-top:1rem;--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-results__option--loading:after{height:1.25rem;width:1.25rem}@keyframes spin{to{transform:rotate(1turn)}}.select2-container--tailwindcss-3 .select2-results__option--loading:after{animation:spin 1s linear infinite;border-color:rgb(209 213 219/var(--tw-border-opacity,1));border-radius:9999px;border-width:2px;--tw-border-opacity:1;border-top-color:rgb(37 99 235/var(--tw-border-opacity,1));content:""}.select2-container--tailwindcss-3 .select2-selection--single{border-radius:.375rem;border-width:1px;cursor:default;height:2.25rem;position:relative;width:100%;--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1));--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1));padding:.375rem 2rem .375rem .75rem;text-align:left;transition-duration:.2s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.select2-container--tailwindcss-3 .select2-selection--single:focus{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1));outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}@media (min-width:640px){.select2-container--tailwindcss-3 .select2-selection--single{font-size:.875rem;line-height:1.25rem}}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__rendered{display:block;overflow:hidden;padding-left:0;padding-right:0;text-overflow:ellipsis;white-space:nowrap;--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__placeholder{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__arrow{align-items:center;bottom:0;display:flex;padding-right:.5rem;position:absolute;right:0;top:0}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__arrow b{height:1.25rem;width:1.25rem;--tw-text-opacity:1;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:contain;color:rgb(156 163 175/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3.select2-container--disabled .select2-selection--single{cursor:not-allowed;--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1));--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:0;padding-right:0;--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__clear:hover{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3.select2-container--focus .select2-selection--single{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.select2-container--tailwindcss-3.select2-container--error .select2-selection--single{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgb(239 68 68/var(--tw-ring-opacity,1))}.select2-container--tailwindcss-3[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-left:2.5rem;padding-right:.75rem}.select2-container--tailwindcss-3 .select2-selection--multiple{border-radius:.375rem;border-width:1px;min-height:2.25rem;--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1));--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1));padding:.25rem .5rem}.select2-container--tailwindcss-3 .select2-selection--multiple:focus{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1));outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__rendered{display:inline;float:left}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__choice{align-items:center;border-radius:.375rem;display:inline-flex;margin:.25rem;--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1));font-size:.875rem;font-weight:500;line-height:1.25rem;padding:.125rem .625rem;--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__choice__remove{align-items:center;border-radius:9999px;display:flex;height:1rem;justify-content:center;margin-left:-.25rem;margin-right:.375rem;width:1rem;--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__choice__remove:hover{--tw-bg-opacity:1;background-color:rgb(191 219 254/var(--tw-bg-opacity,1));--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-search--inline .select2-search__field{background-color:transparent;border-width:0;font-size:.875rem;height:2rem;line-height:1.25rem;padding:0}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-search--inline .select2-search__field::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-search--inline .select2-search__field::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-search--inline .select2-search__field:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.select2-container--tailwindcss-3.select2-container--disabled .select2-selection--multiple{cursor:not-allowed;--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1));--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-selection--multiple.select2-selection--clearable{padding-right:1rem}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__clear{cursor:pointer;font-weight:700;margin-right:1rem;margin-top:.5rem;position:absolute;right:0;top:0;--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__clear:hover{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.select2-container--tailwindcss-3.select2-container--focus .select2-selection--multiple{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.select2-container--tailwindcss-3.select2-container--error .select2-selection--multiple{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgb(239 68 68/var(--tw-ring-opacity,1))} \ No newline at end of file diff --git a/demo/index.html b/demo/index.html index 823c4a9..19ee96e 100644 --- a/demo/index.html +++ b/demo/index.html @@ -7,17 +7,144 @@ Select2 Tailwindcss Theme - - + + -

- Hello world! -

+ +

+ Example of erimicel/select2-tailwindcss-theme +

+ +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
+ Prepend +
+ +
+
+ +
+ Append +
+
+
+
+ Prepend +
+ +
+ Append +
+
+
+ +
+ + +
+ Something is wrong. +
+
+
+
+ + - \ No newline at end of file + diff --git a/demo/js/script.js b/demo/js/script.js new file mode 100644 index 0000000..43fad40 --- /dev/null +++ b/demo/js/script.js @@ -0,0 +1,11 @@ +$(function () { + $('select').each(function () { + $(this).select2({ + theme: 'tailwindcss-3', + width: $(this).data('width') ? $(this).data('width') : $(this).hasClass('w-100') ? '100%' : 'style', + placeholder: $(this).data('placeholder'), + allowClear: Boolean($(this).data('allow-clear')), + closeOnSelect: !$(this).attr('multiple'), + }); + }); +}); \ No newline at end of file diff --git a/demo/tailwind.config.js b/demo/tailwind.config.js new file mode 100644 index 0000000..7dbbb94 --- /dev/null +++ b/demo/tailwind.config.js @@ -0,0 +1,11 @@ +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: [ + './**/*.{html,js}', + ], + theme: { + extend: {}, + }, + plugins: [], +} + diff --git a/demo/tailwind.css b/demo/tailwind.css new file mode 100644 index 0000000..30d832f --- /dev/null +++ b/demo/tailwind.css @@ -0,0 +1,7 @@ +@charset "UTF-8"; + +@tailwind base; +@tailwind components; +@tailwind utilities; + +.select2-container--tailwindcss-3{@apply block w-full}.select2-container--tailwindcss-3.select2-container--open .select2-dropdown{@apply w-full py-1 mt-1 overflow-auto text-base bg-white border-none rounded-md shadow-lg max-h-60 ring-1 ring-black/5 ring-opacity-5 focus:outline-none sm:text-sm}.select2-container--tailwindcss-3.select2-container--open .select2-dropdown--below{@apply origin-top}.select2-container--tailwindcss-3.select2-container--open .select2-dropdown--above{@apply origin-bottom}.select2-container--tailwindcss-3 .select2-search--dropdown .select2-search__field{@apply block w-full px-3 py-1.5 text-sm placeholder-gray-400 border-gray-300 rounded-md shadow-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500}.select2-container--tailwindcss-3 .select2-results__options{@apply overflow-auto max-h-60}.select2-container--tailwindcss-3 .select2-results__option{@apply relative py-2 pl-3 text-gray-900 transition-colors duration-150 ease-in-out cursor-default select-none pr-9}.select2-container--tailwindcss-3 .select2-results__option--highlighted{@apply text-white bg-indigo-600}.select2-container--tailwindcss-3 .select2-results__option--selected{@apply font-medium text-blue-900 bg-blue-100}.select2-container--tailwindcss-3 .select2-results__option--selected:after{@apply absolute inset-y-0 flex items-center text-blue-600 right-3;content:"✓"}.select2-container--tailwindcss-3 .select2-results__group{@apply cursor-default bg-gray-50 px-3 py-1.5 text-xs font-medium uppercase tracking-wider text-gray-700}.select2-container--tailwindcss-3 .select2-results__option--loading{@apply flex items-center justify-center py-4 text-gray-400}.select2-container--tailwindcss-3 .select2-results__option--loading:after{@apply w-5 h-5 border-2 border-gray-300 rounded-full animate-spin border-t-blue-600;content:""}.select2-container--tailwindcss-3 .select2-selection--single{@apply relative w-full h-9 py-1.5 pl-3 pr-8 text-left transition-colors duration-200 ease-in-out bg-white border border-gray-300 rounded-md cursor-default focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 sm:text-sm}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__rendered{@apply block pl-0 pr-0 text-gray-900 truncate}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__placeholder{@apply text-gray-400}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__arrow{@apply absolute inset-y-0 right-0 flex items-center pr-2}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__arrow b{@apply w-5 h-5 text-gray-400;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");background-position:50%;background-repeat:no-repeat;background-size:contain}.select2-container--tailwindcss-3.select2-container--disabled .select2-selection--single{@apply text-gray-500 cursor-not-allowed bg-gray-50}.select2-container--tailwindcss-3 .select2-selection--single .select2-selection__clear{@apply float-right pr-0 mr-0 font-bold text-gray-400 cursor-pointer hover:text-gray-600}.select2-container--tailwindcss-3.select2-container--focus .select2-selection--single{@apply border-blue-500 ring-1 ring-blue-500}.select2-container--tailwindcss-3.select2-container--error .select2-selection--single{@apply border-red-500 ring-1 ring-red-500}.select2-container--tailwindcss-3[dir=rtl] .select2-selection--single .select2-selection__rendered{@apply pl-10 pr-3}.select2-container--tailwindcss-3 .select2-selection--multiple{@apply min-h-[2.25rem] rounded-md border border-gray-300 bg-white py-1 px-2 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__rendered{@apply inline float-left}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__choice{@apply m-1 inline-flex items-center rounded-md bg-blue-100 px-2.5 py-0.5 text-sm font-medium text-blue-800}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__choice__remove{@apply -ml-1 mr-1.5 h-4 w-4 items-center flex justify-center rounded-full text-blue-600 hover:bg-blue-200 hover:text-blue-900}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-search--inline .select2-search__field{@apply h-8 p-0 text-sm placeholder-gray-400 bg-transparent border-0 focus:outline-none focus:ring-0}.select2-container--tailwindcss-3.select2-container--disabled .select2-selection--multiple{@apply text-gray-500 cursor-not-allowed bg-gray-50}.select2-container--tailwindcss-3 .select2-selection--multiple.select2-selection--clearable{@apply pr-4}.select2-container--tailwindcss-3 .select2-selection--multiple .select2-selection__clear{@apply absolute top-0 right-0 mt-2 mr-4 font-bold text-gray-400 cursor-pointer hover:text-gray-600}.select2-container--tailwindcss-3.select2-container--focus .select2-selection--multiple{@apply border-blue-500 ring-1 ring-blue-500}.select2-container--tailwindcss-3.select2-container--error .select2-selection--multiple{@apply border-red-500 ring-1 ring-red-500} diff --git a/package.json b/package.json index f5ddfc3..c98b9fb 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "build": "sass src/select2-tailwindcss-theme.scss dist/select2-tailwindcss-theme.css", "build:min": "MINIFY=true npx postcss dist/select2-tailwindcss-theme.css -o dist/select2-tailwindcss-theme.min.css --verbose", "build:plain": "VERBOSE=true npx postcss dist/select2-tailwindcss-theme.css -o dist/select2-tailwindcss-theme-plain.css --verbose", - "build:plain:min": "MINIFY=true VERBOSE=true npx postcss dist/select2-tailwindcss-theme.css -o dist/select2-tailwindcss-theme-plain.min.css --verbose" + "build:plain:min": "MINIFY=true VERBOSE=true npx postcss dist/select2-tailwindcss-theme.css -o dist/select2-tailwindcss-theme-plain.min.css --verbose", + "build:demo": "npx tailwindcss -i ./demo/tailwind.css -o ./demo/css/tailwind.css --minify" }, "repository": { "type": "git", From c61fa3bdc041bca4892a99195784491a291736e5 Mon Sep 17 00:00:00 2001 From: Erim Icel Date: Sun, 5 Jan 2025 01:11:05 +0000 Subject: [PATCH 3/3] Add docs --- README.md | 2 +- demo/index.html | 150 --------------------------- demo/js/script.js | 11 -- {demo => docs}/.DS_Store | Bin docs/README.md | 3 + {demo => docs}/css/tailwind.css | 0 docs/index.html | 164 ++++++++++++++++++++++++++++++ {demo => docs}/tailwind.config.js | 0 {demo => docs}/tailwind.css | 0 9 files changed, 168 insertions(+), 162 deletions(-) delete mode 100644 demo/index.html delete mode 100644 demo/js/script.js rename {demo => docs}/.DS_Store (100%) create mode 100644 docs/README.md rename {demo => docs}/css/tailwind.css (100%) create mode 100644 docs/index.html rename {demo => docs}/tailwind.config.js (100%) rename {demo => docs}/tailwind.css (100%) diff --git a/README.md b/README.md index 327bbb9..4fb5b5e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ NPM Links -[Select2](https://github.com/select2/select2) v4 theme for TailwindCSS v3.4 +[Select2](https://github.com/select2/select2) v4 theme for TailwindCSS v3.4, inspired by [select2-bootstrap4-theme](https://github.com/ttskch/select2-bootstrap4-theme) ## Live demo diff --git a/demo/index.html b/demo/index.html deleted file mode 100644 index 19ee96e..0000000 --- a/demo/index.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - Select2 Tailwindcss Theme - - - - - - - - - - - -

- Example of erimicel/select2-tailwindcss-theme -

- -
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- -
-
- Prepend -
- -
-
- -
- Append -
-
-
-
- Prepend -
- -
- Append -
-
-
- -
- - -
- Something is wrong. -
-
-
-
- - - - - diff --git a/demo/js/script.js b/demo/js/script.js deleted file mode 100644 index 43fad40..0000000 --- a/demo/js/script.js +++ /dev/null @@ -1,11 +0,0 @@ -$(function () { - $('select').each(function () { - $(this).select2({ - theme: 'tailwindcss-3', - width: $(this).data('width') ? $(this).data('width') : $(this).hasClass('w-100') ? '100%' : 'style', - placeholder: $(this).data('placeholder'), - allowClear: Boolean($(this).data('allow-clear')), - closeOnSelect: !$(this).attr('multiple'), - }); - }); -}); \ No newline at end of file diff --git a/demo/.DS_Store b/docs/.DS_Store similarity index 100% rename from demo/.DS_Store rename to docs/.DS_Store diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..f50dcae --- /dev/null +++ b/docs/README.md @@ -0,0 +1,3 @@ +# Live demo + +https://erimicel.github.io/select2-tailwindcss-theme/ \ No newline at end of file diff --git a/demo/css/tailwind.css b/docs/css/tailwind.css similarity index 100% rename from demo/css/tailwind.css rename to docs/css/tailwind.css diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..8a8478a --- /dev/null +++ b/docs/index.html @@ -0,0 +1,164 @@ + + + + + + + Select2 Tailwindcss Theme + + + + + + + + + + +
+

Select2 Tailwindcss Theme Demo

+
+ +
+

+ Examples of + + @erimicel/select2-tailwindcss-theme + +

+ +
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+ Prepend + +
+ +
+ + Append +
+ +
+ Prepend + + Append +
+
+ + +
+ + +

Something is wrong.

+
+
+
+ +
+

Select2 4.1.0-rc.0, TailwindCSS 3.4.17, jQuery 3.7.1

+
+ + + + + + \ No newline at end of file diff --git a/demo/tailwind.config.js b/docs/tailwind.config.js similarity index 100% rename from demo/tailwind.config.js rename to docs/tailwind.config.js diff --git a/demo/tailwind.css b/docs/tailwind.css similarity index 100% rename from demo/tailwind.css rename to docs/tailwind.css