countries selection fixed
This commit is contained in:
@@ -1696,129 +1696,3 @@ html[data-wms-sidebar="collapsed"] .wms-sidebar {
|
||||
color: rgb(191 219 254);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Company/country Select2 dark override -------------------------------------------------
|
||||
Keep the Select2 country field visually consistent with the WMS dark form inputs. */
|
||||
.wms-select2-field .select2-container,
|
||||
.wms-select2-field .select2-container--wms,
|
||||
.wms-select2-field .select2-container--default {
|
||||
margin-top: 0.5rem !important;
|
||||
width: 100% !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.wms-select2-field .select2-container--wms .select2-selection--single,
|
||||
.wms-select2-field .select2-container--default .select2-selection--single {
|
||||
height: 3rem !important;
|
||||
min-height: 3rem !important;
|
||||
border: 1px solid rgb(63 63 70) !important;
|
||||
border-radius: 0.75rem !important;
|
||||
background: rgb(9 9 11) !important;
|
||||
box-shadow: none !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
}
|
||||
|
||||
.wms-select2-field .select2-container--wms.select2-container--focus .select2-selection--single,
|
||||
.wms-select2-field .select2-container--wms.select2-container--open .select2-selection--single,
|
||||
.wms-select2-field .select2-container--default.select2-container--focus .select2-selection--single,
|
||||
.wms-select2-field .select2-container--default.select2-container--open .select2-selection--single {
|
||||
border-color: rgb(59 130 246) !important;
|
||||
box-shadow: 0 0 0 3px rgb(59 130 246 / 0.24) !important;
|
||||
}
|
||||
|
||||
.wms-select2-field .select2-selection--single .select2-selection__rendered {
|
||||
width: 100% !important;
|
||||
padding-left: 1rem !important;
|
||||
padding-right: 3rem !important;
|
||||
color: rgb(244 244 245) !important;
|
||||
font-size: 0.875rem !important;
|
||||
font-weight: 500 !important;
|
||||
line-height: 3rem !important;
|
||||
}
|
||||
|
||||
.wms-select2-field .select2-selection--single .select2-selection__placeholder {
|
||||
color: rgb(161 161 170) !important;
|
||||
font-weight: 500 !important;
|
||||
}
|
||||
|
||||
.wms-select2-field .select2-selection--single .select2-selection__clear {
|
||||
position: absolute !important;
|
||||
right: 2.75rem !important;
|
||||
top: 0.5rem !important;
|
||||
width: 2rem !important;
|
||||
height: 2rem !important;
|
||||
color: rgb(161 161 170) !important;
|
||||
font-size: 1.2rem !important;
|
||||
line-height: 1.85rem !important;
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.wms-select2-field .select2-selection--single .select2-selection__arrow {
|
||||
position: absolute !important;
|
||||
top: 0.5rem !important;
|
||||
right: 0.625rem !important;
|
||||
width: 2rem !important;
|
||||
height: 2rem !important;
|
||||
border-radius: 0.625rem !important;
|
||||
background: rgb(39 39 42) !important;
|
||||
}
|
||||
|
||||
.wms-select2-field .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: rgb(212 212 216) transparent transparent transparent !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-dropdown,
|
||||
.select2-container--default .select2-dropdown {
|
||||
overflow: hidden !important;
|
||||
border: 1px solid rgb(63 63 70) !important;
|
||||
border-radius: 0.875rem !important;
|
||||
background: rgb(24 24 27) !important;
|
||||
color: rgb(244 244 245) !important;
|
||||
box-shadow: 0 24px 60px rgb(0 0 0 / 0.45) !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-search--dropdown,
|
||||
.select2-container--default .select2-search--dropdown {
|
||||
padding: 0.75rem !important;
|
||||
background: rgb(24 24 27) !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-search--dropdown .select2-search__field,
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
height: 2.75rem !important;
|
||||
border: 1px solid rgb(63 63 70) !important;
|
||||
border-radius: 0.75rem !important;
|
||||
background: rgb(9 9 11) !important;
|
||||
color: rgb(244 244 245) !important;
|
||||
padding: 0 0.875rem !important;
|
||||
font-size: 0.875rem !important;
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-results__options,
|
||||
.select2-container--default .select2-results__options {
|
||||
background: rgb(24 24 27) !important;
|
||||
max-height: 16rem !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-results__option,
|
||||
.select2-container--default .select2-results__option {
|
||||
padding: 0.75rem 1rem !important;
|
||||
color: rgb(244 244 245) !important;
|
||||
font-size: 0.875rem !important;
|
||||
font-weight: 500 !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-results__option--highlighted.select2-results__option--selectable,
|
||||
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
|
||||
background: rgb(37 99 235) !important;
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-results__option--selected,
|
||||
.select2-container--default .select2-results__option--selected {
|
||||
background: rgb(30 41 59) !important;
|
||||
color: rgb(191 219 254) !important;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
/* WMS Select2 professional dark theme.
|
||||
This file is imported after Select2's own CSS so it wins reliably. */
|
||||
/* WMS Select2 professional dark theme. */
|
||||
|
||||
.wms-select2-field {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.wms-select2-field .select2-container,
|
||||
.select2-container--wms {
|
||||
@@ -7,7 +10,12 @@
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.wms-select2-field select[data-wms-select2].select2-hidden-accessible {
|
||||
.wms-select2-field .select2-container {
|
||||
margin-top: 0.5rem !important;
|
||||
}
|
||||
|
||||
.wms-select2-field select[data-wms-select2].select2-hidden-accessible,
|
||||
.wms-select2-field select.wms-select2-control.select2-hidden-accessible {
|
||||
position: absolute !important;
|
||||
width: 1px !important;
|
||||
height: 1px !important;
|
||||
@@ -19,19 +27,14 @@
|
||||
margin: -1px !important;
|
||||
}
|
||||
|
||||
.wms-select2-field .select2-container {
|
||||
margin-top: 0.5rem !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-selection--single {
|
||||
position: relative !important;
|
||||
height: 3rem !important;
|
||||
min-height: 3rem !important;
|
||||
border: 1px solid rgb(63 63 70) !important;
|
||||
border-radius: 0.75rem !important;
|
||||
background: rgb(9 9 11) !important;
|
||||
box-shadow: 0 1px 2px rgb(0 0 0 / 0.2) !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
outline: none !important;
|
||||
transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease !important;
|
||||
}
|
||||
@@ -43,8 +46,8 @@
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-selection--single .select2-selection__rendered {
|
||||
width: 100% !important;
|
||||
padding: 0 3rem 0 1rem !important;
|
||||
height: 100% !important;
|
||||
padding: 0 2.75rem 0 1rem !important;
|
||||
color: rgb(244 244 245) !important;
|
||||
font-size: 0.875rem !important;
|
||||
font-weight: 500 !important;
|
||||
@@ -56,43 +59,58 @@
|
||||
font-weight: 500 !important;
|
||||
}
|
||||
|
||||
/* Keep the Select2 arrow as a plain chevron, not a boxed button. */
|
||||
.select2-container--wms .select2-selection--single .select2-selection__arrow {
|
||||
position: absolute !important;
|
||||
top: 0.5rem !important;
|
||||
right: 0.625rem !important;
|
||||
width: 2rem !important;
|
||||
height: 2rem !important;
|
||||
border-radius: 0.625rem !important;
|
||||
background: rgb(39 39 42) !important;
|
||||
top: 0 !important;
|
||||
right: 0.875rem !important;
|
||||
width: 1.25rem !important;
|
||||
height: 3rem !important;
|
||||
background: transparent !important;
|
||||
border: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: rgb(212 212 216) transparent transparent transparent !important;
|
||||
border-width: 5px 4px 0 4px !important;
|
||||
position: absolute !important;
|
||||
left: 50% !important;
|
||||
top: 50% !important;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
margin-left: -4px !important;
|
||||
margin-top: -2px !important;
|
||||
border-style: solid !important;
|
||||
border-width: 5px 4px 0 4px !important;
|
||||
border-color: rgb(212 212 216) transparent transparent transparent !important;
|
||||
}
|
||||
|
||||
.select2-container--wms.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: transparent transparent rgb(212 212 216) transparent !important;
|
||||
margin-top: -3px !important;
|
||||
border-width: 0 4px 5px 4px !important;
|
||||
border-color: transparent transparent rgb(212 212 216) transparent !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-selection--single .select2-selection__clear {
|
||||
position: absolute !important;
|
||||
right: 2.85rem !important;
|
||||
top: 0.5rem !important;
|
||||
width: 2rem !important;
|
||||
height: 2rem !important;
|
||||
border-radius: 0.625rem !important;
|
||||
top: 0 !important;
|
||||
right: 2.25rem !important;
|
||||
height: 3rem !important;
|
||||
width: 1.25rem !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
background: transparent !important;
|
||||
border: 0 !important;
|
||||
border-radius: 0 !important;
|
||||
box-shadow: none !important;
|
||||
color: rgb(161 161 170) !important;
|
||||
font-size: 1.25rem !important;
|
||||
line-height: 1.85rem !important;
|
||||
font-size: 1.1rem !important;
|
||||
font-weight: 700 !important;
|
||||
line-height: 3rem !important;
|
||||
text-align: center !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-selection--single .select2-selection__clear:hover {
|
||||
background: rgb(39 39 42) !important;
|
||||
color: rgb(244 244 245) !important;
|
||||
}
|
||||
|
||||
@@ -106,21 +124,26 @@
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-search--dropdown {
|
||||
padding: 0.75rem !important;
|
||||
padding: 0.625rem !important;
|
||||
background: rgb(24 24 27) !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-search--dropdown .select2-search__field {
|
||||
height: 2.75rem !important;
|
||||
height: 2.5rem !important;
|
||||
border: 1px solid rgb(63 63 70) !important;
|
||||
border-radius: 0.75rem !important;
|
||||
background: rgb(9 9 11) !important;
|
||||
color: rgb(244 244 245) !important;
|
||||
padding: 0 0.875rem !important;
|
||||
font-size: 0.875rem !important;
|
||||
font-weight: 500 !important;
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-search--dropdown .select2-search__field::placeholder {
|
||||
color: rgb(161 161 170) !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-search--dropdown .select2-search__field:focus {
|
||||
border-color: rgb(59 130 246) !important;
|
||||
box-shadow: 0 0 0 3px rgb(59 130 246 / 0.22) !important;
|
||||
@@ -132,7 +155,7 @@
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-results__option {
|
||||
padding: 0.75rem 1rem !important;
|
||||
padding: 0.7rem 1rem !important;
|
||||
color: rgb(244 244 245) !important;
|
||||
font-size: 0.875rem !important;
|
||||
font-weight: 500 !important;
|
||||
@@ -148,31 +171,29 @@
|
||||
color: rgb(191 219 254) !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-results__option[aria-disabled='true'] {
|
||||
color: rgb(113 113 122) !important;
|
||||
}
|
||||
|
||||
.select2-container--wms .select2-results__option[aria-disabled='true'],
|
||||
.select2-container--wms .select2-results__message {
|
||||
color: rgb(161 161 170) !important;
|
||||
}
|
||||
|
||||
/* Safety: any WMS Select2 target should disappear once Select2 has initialised,
|
||||
even if a view is not wrapped in .wms-select2-field. */
|
||||
select[data-wms-select2].select2-hidden-accessible,
|
||||
select[data-company-country-select2].select2-hidden-accessible,
|
||||
select[data-helpdesk-select2].select2-hidden-accessible {
|
||||
position: absolute !important;
|
||||
width: 1px !important;
|
||||
height: 1px !important;
|
||||
overflow: hidden !important;
|
||||
clip: rect(0 0 0 0) !important;
|
||||
white-space: nowrap !important;
|
||||
border: 0 !important;
|
||||
padding: 0 !important;
|
||||
margin: -1px !important;
|
||||
/* Fallback styling before Select2 initialises, matching WMS inputs. */
|
||||
.wms-select2-field > select[data-wms-select2],
|
||||
.wms-select2-field > select.wms-select2-control {
|
||||
margin-top: 0.5rem;
|
||||
height: 3rem;
|
||||
width: 100%;
|
||||
border-radius: 0.75rem;
|
||||
border: 1px solid rgb(63 63 70);
|
||||
background: rgb(9 9 11);
|
||||
color: rgb(244 244 245);
|
||||
padding: 0 1rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Keep country Select2 controls aligned with the surrounding WMS form fields. */
|
||||
.wms-select2-field .select2-container--wms {
|
||||
margin-top: 0.5rem !important;
|
||||
.wms-select2-field > select[data-wms-select2]:focus,
|
||||
.wms-select2-field > select.wms-select2-control:focus {
|
||||
border-color: rgb(59 130 246);
|
||||
box-shadow: 0 0 0 3px rgb(59 130 246 / 0.24);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
+22
-8
@@ -7,11 +7,13 @@ import $ from 'jquery';
|
||||
window.$ = $;
|
||||
window.jQuery = $;
|
||||
|
||||
import attachSelect2 from 'select2';
|
||||
import select2Factory from 'select2';
|
||||
import 'select2/dist/css/select2.min.css';
|
||||
import '../css/wms-select2.css';
|
||||
|
||||
attachSelect2(window.jQuery);
|
||||
if (typeof select2Factory === 'function') {
|
||||
select2Factory(window, $);
|
||||
}
|
||||
|
||||
const chartColours = [
|
||||
'rgb(8, 145, 178)',
|
||||
@@ -170,25 +172,27 @@ function initialiseSelect2() {
|
||||
return;
|
||||
}
|
||||
|
||||
$('[data-helpdesk-select2], [data-wms-select2], [data-company-country-select2]').each(function () {
|
||||
$('[data-helpdesk-select2], [data-wms-select2], .wms-select2-control').each(function () {
|
||||
const $select = $(this);
|
||||
|
||||
if ($select.hasClass('select2-hidden-accessible')) {
|
||||
return;
|
||||
$select.select2('destroy');
|
||||
}
|
||||
|
||||
const isMultiple = $select.prop('multiple');
|
||||
|
||||
const placeholder =
|
||||
$select.data('placeholder') ||
|
||||
$select.find('option[value=""]').first().text() ||
|
||||
(isMultiple ? 'Select options' : 'Select option');
|
||||
|
||||
$select.select2({
|
||||
theme: 'wms',
|
||||
width: '100%',
|
||||
allowClear: !isMultiple,
|
||||
closeOnSelect: !isMultiple,
|
||||
dropdownAutoWidth: false,
|
||||
placeholder:
|
||||
$select.data('placeholder') ||
|
||||
$select.find('option[value=""]').first().text() ||
|
||||
(isMultiple ? 'Select options' : 'Select option'),
|
||||
placeholder,
|
||||
sorter(data) {
|
||||
return data.sort((first, second) => first.text.localeCompare(second.text, undefined, {
|
||||
sensitivity: 'base',
|
||||
@@ -197,6 +201,16 @@ function initialiseSelect2() {
|
||||
},
|
||||
});
|
||||
|
||||
$select.off('select2:open.wms-select2');
|
||||
$select.on('select2:open.wms-select2', function () {
|
||||
const searchField = document.querySelector('.select2-container--open .select2-search__field');
|
||||
|
||||
if (searchField) {
|
||||
searchField.placeholder = placeholder;
|
||||
searchField.focus();
|
||||
}
|
||||
});
|
||||
|
||||
$select.off('change.select2-livewire');
|
||||
|
||||
$select.on('change.select2-livewire', function () {
|
||||
|
||||
Reference in New Issue
Block a user