Skip to content

Commit ce6391c

Browse files
committed
Added TailwindCSS Dark Mode support.
1 parent 8771031 commit ce6391c

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to `laravel-simple-select` will be documented in this file
44

5+
## v1.3.0 - 2022-01-29
6+
7+
- Added TailwindCSS Dark Mode support.
8+
59
## v1.2.5 - 2021-11-21
610

711
- Fixed bugs in usage of integer as field value.

resources/views/components/simple-select.blade.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class="relative mt-1"
4444
>
4545
<div x-show="!selected || selected.length === 0" class="flex flex-wrap">
4646
<div class="text-gray-800 rounded-sm w-full truncate px-2 py-0.5 my-0.5 flex flex-row items-center">
47-
<div class="w-full px-2 truncate" x-text="placeholder">&nbsp;</div>
47+
<div class="w-full px-2 truncate dark:text-gray-500" x-text="placeholder">&nbsp;</div>
4848
<div x-show="!disabled" x-bind:class="{ 'cursor-pointer': !disabled }" class="h-6" x-on:click.prevent.stop="toggleSelect()">
4949
@include('simple-select::components.caret-icons')
5050
</div>
@@ -53,7 +53,7 @@ class="relative mt-1"
5353
@isset($attributes['multiple'])
5454
<div x-show="selected && typeof selected === 'object' && selected.length > 0" class="flex flex-wrap space-x-1">
5555
<template x-for="(value, index) in selected" :key="index">
56-
<div class="text-gray-800 rounded-full truncate bg-gray-300 px-2 py-0.5 my-0.5 flex flex-row items-center">
56+
<div class="text-gray-800 dark:text-gray-400 rounded-full truncate bg-gray-300 dark:bg-gray-800 px-2 py-0.5 my-0.5 flex flex-row items-center">
5757
{{-- Invisible inputs for standard form submission values --}}
5858
<input type="text" :name="`${name}[]`" x-model="value" style="display: none;" />
5959
<div class="px-2 truncate">
@@ -82,7 +82,7 @@ class="w-6"
8282
</div>
8383
@else
8484
<div x-show="selected" class="flex flex-wrap">
85-
<div class="text-gray-800 rounded-sm w-full truncate px-2 py-0.5 my-0.5 flex flex-row items-center">
85+
<div class="text-gray-800 dark:text-gray-400 rounded-sm w-full truncate px-2 py-0.5 my-0.5 flex flex-row items-center">
8686
{{-- Invisible input for standard form submission of values --}}
8787
<input type="text" :name="name" x-model="selected" :required="required" style="display: none;" />
8888
<div class="w-full px-2 truncate">
@@ -127,29 +127,29 @@ class="h-6"
127127
x-model="search"
128128
x-on:click.prevent.stop="open=true"
129129
:placeholder="searchInputPlaceholder"
130-
class="block w-full p-2 bg-gray-100 border border-gray-300 shadow-md focus:border-gray-200 focus:ring-0 sm:text-sm sm:leading-5"
130+
class="block w-full p-2 bg-gray-100 dark:bg-gray-800 border border-gray-300 dark:border-gray-700 dark:text-gray-200 shadow-md focus:border-gray-200 focus:ring-0 sm:text-sm sm:leading-5"
131131
/>
132132
<ul
133133
x-ref="simpleSelectOptionsList"
134-
class="absolute z-10 w-full py-1 overflow-auto text-base bg-white shadow-lg rounded-b-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"
134+
class="absolute z-10 w-full py-1 overflow-auto text-base bg-white dark:bg-gray-600 shadow-lg rounded-b-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm"
135135
tabindex="-1"
136136
role="listbox"
137137
>
138-
<div x-show="Object.values(options).length == 0 && search.toString().trim() == ''" x-text="noOptions" class="px-2 py-2"></div>
139-
<div x-show="Object.values(options).length == 0 && search.toString().trim() != ''" x-text="noResult" class="px-2 py-2"></div>
138+
<div x-show="Object.values(options).length == 0 && search.toString().trim() == ''" x-text="noOptions" class="px-2 py-2 dark:text-gray-400"></div>
139+
<div x-show="Object.values(options).length == 0 && search.toString().trim() != ''" x-text="noResult" class="px-2 py-2 dark:text-gray-400"></div>
140140
<template x-for="(option, index) in Object.values(options)" :key="index">
141141
<li
142142
:tabindex="index"
143143
class="relative py-2 pl-3 select-none pr-9 whitespace-nowrap"
144144
@isset($attributes['multiple'])
145145
x-bind:class="{
146-
'bg-gray-300 text-black hover:none': selected && selected.includes(getOptionValue(option, index)),
147-
'text-gray-900 cursor-defaul hover:bg-gray-200 hover:cursor-pointer focus:bg-gray-200': !(selected && selected.includes(getOptionValue(option, index))),
146+
'bg-gray-300 dark:bg-gray-700 text-black dark:text-gray-400 hover:none': selected && selected.includes(getOptionValue(option, index)),
147+
'text-gray-900 dark:text-gray-400 cursor-defaul hover:bg-gray-200 dark:hover:bg-gray-800 hover:cursor-pointer focus:bg-gray-200': !(selected && selected.includes(getOptionValue(option, index))),
148148
}"
149149
@else
150150
x-bind:class="{
151-
'bg-gray-300 text-black hover:none': selected == getOptionValue(option, index),
152-
'text-gray-900 cursor-defaul hover:bg-gray-200 hover:cursor-pointer focus:bg-gray-200': !(selected == getOptionValue(option, index)),
151+
'bg-gray-300 dark:bg-gray-700 text-black dark:text-gray-400 hover:none': selected == getOptionValue(option, index),
152+
'text-gray-900 dark:text-gray-400 cursor-defaul hover:bg-gray-200 dark:hover:bg-gray-800 hover:cursor-pointer focus:bg-gray-200': !(selected == getOptionValue(option, index)),
153153
}"
154154
@endisset
155155
x-on:click="selectOption(getOptionValue(option, index))"

0 commit comments

Comments
 (0)