Skip to content

Commit

Permalink
Fixing common error states
Browse files Browse the repository at this point in the history
  • Loading branch information
erimicel committed Jan 5, 2025
1 parent e41a2f4 commit a35d507
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 47 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ https://erimicel.github.io/select2-tailwindcss-theme/
## Current issues to be fixed

- [ ] Prepend and Append Styles
- [ ] Error state
- [ ] Fix height of multi select box

## 📦 Installation
Expand Down
35 changes: 13 additions & 22 deletions dist/select2-tailwindcss-theme-plain.css
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,19 @@
content: ""
}

/* Error states */
.field_with_errors .select2-container--tailwindcss-3 .select2-selection,
select.is-invalid ~ .select2-container--tailwindcss-3 .select2-selection,
select:invalid ~ .select2-container--tailwindcss-3 .select2-selection{
--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))
}

/* Single Selection */
.select2-container--tailwindcss-3 .select2-selection--single{
position: relative;
Expand Down Expand Up @@ -314,17 +327,6 @@
--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))
}

/* Error state */
.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))
}

/* RTL Support */
.select2-container--tailwindcss-3[dir=rtl] .select2-selection--single .select2-selection__rendered{
padding-left: 2.5rem;
Expand Down Expand Up @@ -468,14 +470,3 @@
--tw-ring-opacity: 1;
--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))
}

/* Error state */
.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))
}
2 changes: 1 addition & 1 deletion dist/select2-tailwindcss-theme-plain.min.css

Large diffs are not rendered by default.

17 changes: 7 additions & 10 deletions dist/select2-tailwindcss-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@
content: "";
}

/* Error states */
.field_with_errors .select2-container--tailwindcss-3 .select2-selection,
select.is-invalid ~ .select2-container--tailwindcss-3 .select2-selection,
select:invalid ~ .select2-container--tailwindcss-3 .select2-selection {
@apply border-red-500 ring-1 ring-red-500;
}

/* Single Selection */
.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;
Expand Down Expand Up @@ -114,11 +121,6 @@
@apply border-blue-500 ring-1 ring-blue-500;
}

/* Error state */
.select2-container--tailwindcss-3.select2-container--error .select2-selection--single {
@apply border-red-500 ring-1 ring-red-500;
}

/* RTL Support */
.select2-container--tailwindcss-3[dir=rtl] .select2-selection--single .select2-selection__rendered {
@apply pl-10 pr-3;
Expand Down Expand Up @@ -168,8 +170,3 @@
.select2-container--tailwindcss-3.select2-container--focus .select2-selection--multiple {
@apply border-blue-500 ring-1 ring-blue-500;
}

/* Error state */
.select2-container--tailwindcss-3.select2-container--error .select2-selection--multiple {
@apply border-red-500 ring-1 ring-red-500;
}
2 changes: 1 addition & 1 deletion dist/select2-tailwindcss-theme.min.css

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

Loading

0 comments on commit a35d507

Please sign in to comment.