@lemonadejs/dropdown 3.1.10 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -62,33 +62,105 @@ export default function App() {
62
62
  }
63
63
  ```
64
64
 
65
+ Quick example with React
66
+
67
+ ```jsx
68
+ import React, { useRef } from 'react';
69
+ import Dropdown from '@lemonadejs/dropdown/dist/react';
70
+ import '@lemonadejs/dropdown/dist/style.css'
71
+ import '@lemonadejs/modal/dist/style.css';
72
+
73
+ const data = [
74
+ { text: "Red", value: 1 },
75
+ { text: "Blue", value: 2 },
76
+ { text: "Green", value: 3 },
77
+ { text: "Yellow", value: 4 },
78
+ { text: "Purple", value: 5 },
79
+ { text: "Gray", value: 6 },
80
+ ]
81
+ export default function App() {
82
+ const dropdown = useRef();
83
+ return (
84
+ <div>
85
+ <Dropdown data={data} ref={dropdown} value={1} />
86
+ </div>);
87
+ }
88
+ ```
89
+
90
+ Quick example with Vue
91
+
92
+ ```vue
93
+ <template>
94
+ <Dropdown :data="data" :value="1" />
95
+ </template>
96
+
97
+ <script>
98
+ import Dropdown from '@lemonadejs/dropdown/dist/vue'
99
+ import '@lemonadejs/dropdown/dist/style.css'
100
+ import '@lemonadejs/modal/dist/style.css'
101
+
102
+ export default {
103
+ name: 'App',
104
+ components: {
105
+ Dropdown
106
+ },
107
+ data() {
108
+ return {
109
+ data: [
110
+ { text: "Red", value: 1 },
111
+ { text: "Blue", value: 2 },
112
+ { text: "Green", value: 3 },
113
+ { text: "Yellow", value: 4 },
114
+ { text: "Purple", value: 5 },
115
+ { text: "Gray", value: 6 },
116
+ ]
117
+ };
118
+ },
119
+ }
120
+ </script>
121
+ ```
122
+
65
123
  ### Settings
66
124
 
67
- | Attribute | Description |
68
- |-----------|-------------|
69
- | data: Item[] | An array of options to be displayed. Each item should follow the structure defined in the 'Item Details' section. |
70
- | multiple?: boolean | If provided, enables the multiple selection mode, allowing users to select more than one option simultaneously. |
71
- | autocomplete?: boolean | If provided, enables the autocomplete feature, displaying an input field that allows users to filter and quickly find options in the Dropdown. |
72
- | value?: string | Represents the current value or selected option in the Dropdown. |
73
- | type?: string | Specifies the type of display the Dropdown will use. It can be "searchbar" for a search bar interface, "picker" for a selection picker, or "default" for the default dropdown appearance. |
74
- | insert?: boolean | Enables the `insert` feature, allowing users to add a new option directly by typing the title text and clicking on the plus symbol. |
125
+ | Attribute | Description |
126
+ |------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
127
+ | data: Item[] | An array of options to be displayed. Each item should follow the structure defined in the 'Item Details' section. |
128
+ | multiple?: boolean | If provided, enables the multiple selection mode, allowing users to select more than one option simultaneously. |
129
+ | autocomplete?: boolean | If provided, enables the autocomplete feature, displaying an input field that allows users to filter and quickly find options in the Dropdown. |
130
+ | value?: string | Represents the current value or selected option in the Dropdown. |
131
+ | type?: string | Specifies the type of display the Dropdown will use. It can be "searchbar" for a search bar interface, "picker" for a selection picker, or "default" for the default dropdown appearance. |
132
+ | insert?: boolean | Enables the `insert` feature, allowing users to add a new option directly by typing the title text and clicking on the plus symbol. |
133
+ | format?: number | Data format type, usually in the form of { id: name } or { value: text } |
134
+ | width?: number | Specifies the width of the dropdown. |
135
+ | placeholder?: string | Placeholder text to guide users in the dropdown. |
136
+ | url?: string | Specifies the URL for fetching the data. Do not declare the `data` attribute for the url to function properly. |
75
137
 
76
138
  ### Item Details
77
139
 
78
- | Attribute | Description |
79
- | --------- | ----------- |
80
- | value?: number or string | Represents the identifier or unique value associated with the option. |
81
- | group?: string | Indicates the group to which the option belongs, allowing for segregation and organization. |
82
- | text?: string | Displays the label or text associated with the option. |
83
- | image?: string | Specifies the image URL to be displayed alongside the option. |
140
+ | Attribute | Description |
141
+ |--------------------------|---------------------------------------------------------------------------------------------|
142
+ | value?: number or string | Represents the identifier or unique value associated with the option. |
143
+ | group?: string | Indicates the group to which the option belongs, allowing for segregation and organization. |
144
+ | text?: string | Displays the label or text associated with the option. |
145
+ | image?: string | Specifies the image URL to be displayed alongside the option. |
146
+ | synonyms?: string[] | Keywords for easier item identification |
147
+ | disabled?: boolean | Indicates whether the item is currently disabled |
148
+ | color?: string | Specifies the color associated with the item |
84
149
 
85
150
  ### Events
86
151
 
87
- | Event | Trigger |
88
- | ----- | ------- |
89
- | onclose?: () => void | Invoked when the dropdown modal is closed. |
152
+ | Event | Trigger |
153
+ |-------------------------------------------|----------------------------------------------------------------------------|
154
+ | onclose?: () => void | Invoked when the dropdown modal is closed. |
90
155
  | onbeforeinsert?: (instance, Item) => void | Invoked before an item is added to the options through the insert feature. |
91
- | oninsert?: (instance, Item) => void | Invoked after an item is added to the options through the insert feature. |
156
+ | oninsert?: (instance, Item) => void | Invoked after an item is added to the options through the insert feature. |
157
+ | onchange?: (instance, Item) => void | Invoked when the value changes. |
158
+ | onload?: (instance, Item) => void | Invoked when appended to the DOM. |
159
+ | onsearch?: (instance, Item) => void | Invoked when searching for an item.
160
+ |
161
+ | onbeforesearch?: (instance, Item) => void | Invoked before initiating a search.
162
+ |
163
+ | onopen?: (instance) => void | Invoked when the dropdown is opened. |
92
164
 
93
165
  ## License
94
166
 
@@ -96,5 +168,5 @@ The [LemonadeJS](https://lemonadejs.net) LemonadeJS Dropdown is released under t
96
168
 
97
169
  ## Other Tools
98
170
 
99
- - [jSuites](https://jsuites.net/v4/)
171
+ - [jSuites](https://jsuites.net/docs)
100
172
  - [Jspreadsheet Data Grid](https://jspreadsheet.com)
package/dist/index.d.ts CHANGED
@@ -43,6 +43,8 @@ declare namespace Dropdown {
43
43
  placeholder?: string;
44
44
  /** Allow insert new items */
45
45
  insert?: boolean;
46
+ /** Specifies the URL for fetching the data. */
47
+ url?: string;
46
48
  /** Event handler for value changes */
47
49
  onchange?: (obj: object, newValue: string|number) => void;
48
50
  /** Event handler for when the dropdown is ready */
package/dist/index.js CHANGED
@@ -13,8 +13,8 @@ if (!Modal && typeof (require) === 'function') {
13
13
 
14
14
  ; (function (global, factory) {
15
15
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
16
- typeof define === 'function' && define.amd ? define(factory) :
17
- global.Dropdown = factory();
16
+ typeof define === 'function' && define.amd ? define(factory) :
17
+ global.Dropdown = factory();
18
18
  }(this, (function () {
19
19
 
20
20
  // Default row height
@@ -26,10 +26,10 @@ if (!Modal && typeof (require) === 'function') {
26
26
  * @param {number|number[]} a2
27
27
  */
28
28
  const compareValues = function (a1, a2) {
29
- if (! a1 || ! a2) {
29
+ if (!a1 || !a2) {
30
30
  return false;
31
31
  }
32
- if (! Array.isArray(a1) || ! Array.isArray(a2)) {
32
+ if (!Array.isArray(a1) || !Array.isArray(a2)) {
33
33
  if (a1 === a2) {
34
34
  return true;
35
35
  } else {
@@ -49,13 +49,13 @@ if (!Modal && typeof (require) === 'function') {
49
49
  return true;
50
50
  }
51
51
 
52
- const lazyLoading = function(self) {
52
+ const lazyLoading = function (self) {
53
53
  /**
54
54
  * Get the position from top of a row by its index
55
55
  * @param item
56
56
  * @returns {number}
57
57
  */
58
- const getRowPosition = function(item) {
58
+ const getRowPosition = function (item) {
59
59
  // Position from top
60
60
  let top = 0;
61
61
  if (item) {
@@ -71,7 +71,7 @@ if (!Modal && typeof (require) === 'function') {
71
71
  return top;
72
72
  }
73
73
 
74
- const updateScroll = function() {
74
+ const updateScroll = function () {
75
75
  let items = self.rows;
76
76
  if (items) {
77
77
  // Before control
@@ -104,7 +104,7 @@ if (!Modal && typeof (require) === 'function') {
104
104
  return false;
105
105
  }
106
106
 
107
- const getVisibleRows = function(reset) {
107
+ const getVisibleRows = function (reset) {
108
108
  let items = self.rows;
109
109
  if (items) {
110
110
  let adjust;
@@ -139,7 +139,7 @@ if (!Modal && typeof (require) === 'function') {
139
139
  }
140
140
 
141
141
  // Update visible rows
142
- if (reset || ! compareValues(rows, self.result)) {
142
+ if (reset || !compareValues(rows, self.result)) {
143
143
  // Render the items
144
144
  self.result = rows;
145
145
  // Adjust scroll height
@@ -151,7 +151,7 @@ if (!Modal && typeof (require) === 'function') {
151
151
  // Item height
152
152
  let h = item.el.offsetHeight;
153
153
  // Update row height
154
- if (! item.height || h !== item.height) {
154
+ if (!item.height || h !== item.height) {
155
155
  // Keep item height
156
156
  item.height = h;
157
157
  // Adjust total height
@@ -194,7 +194,7 @@ if (!Modal && typeof (require) === 'function') {
194
194
  /**
195
195
  * Will adjust the items based on the scroll position offset
196
196
  */
197
- self.adjustPosition = function(item) {
197
+ self.adjustPosition = function (item) {
198
198
  if (item.el) {
199
199
  let h = item.el.offsetHeight;
200
200
  let calc = item.el.offsetTop + h;
@@ -209,7 +209,7 @@ if (!Modal && typeof (require) === 'function') {
209
209
  }
210
210
 
211
211
  // Controls
212
- const scrollControls = function() {
212
+ const scrollControls = function () {
213
213
  getVisibleRows(false);
214
214
  }
215
215
 
@@ -221,11 +221,11 @@ if (!Modal && typeof (require) === 'function') {
221
221
  scroll.classList.add('lm-lazy-scroll');
222
222
  // Force the height and add scrolling
223
223
  el.appendChild(scroll);
224
- el.addEventListener('scroll', scrollControls);
225
- el.addEventListener('wheel', scrollControls);
224
+ el.addEventListener('scroll', scrollControls, { passive: true });
225
+ el.addEventListener('wheel', scrollControls, { passive: true });
226
226
  self.container.classList.add('lm-lazy-items');
227
227
 
228
- self.goto = function(item) {
228
+ self.goto = function (item) {
229
229
  el.scrollTop = getRowPosition(item);
230
230
  let adjust = getVisibleRows(false);
231
231
  if (adjust) {
@@ -251,7 +251,7 @@ if (!Modal && typeof (require) === 'function') {
251
251
  // Control events
252
252
  let ignoreEvents = false;
253
253
  // Default widht
254
- if (! self.width) {
254
+ if (!self.width) {
255
255
  self.width = 260;
256
256
  }
257
257
  // Lazy loading global instance
@@ -261,29 +261,29 @@ if (!Modal && typeof (require) === 'function') {
261
261
  let onchange = self.onchange;
262
262
 
263
263
  // Cursor controllers
264
- const setCursor = function(index, force) {
264
+ const setCursor = function (index, force) {
265
265
  let item = self.rows[index];
266
266
 
267
- if (typeof(item) !== 'undefined') {
267
+ if (typeof (item) !== 'undefined') {
268
268
  // Set cursor number
269
269
  cursor = index;
270
270
  // Set visual indication
271
271
  item.cursor = true;
272
272
  // Go to the item on the scroll in case the item is not on the viewport
273
- if (! (item.el && item.el.parentNode) || force === true) {
273
+ if (!(item.el && item.el.parentNode) || force === true) {
274
274
  // Goto method
275
275
  self.goto(item);
276
276
  }
277
277
  // Adjust cursor position
278
- setTimeout(function() {
278
+ setTimeout(function () {
279
279
  self.adjustPosition(item);
280
280
  });
281
281
  }
282
282
  }
283
283
 
284
- const removeCursor = function(reset) {
284
+ const removeCursor = function (reset) {
285
285
  if (cursor !== null) {
286
- if (typeof(self.rows[cursor]) !== 'undefined') {
286
+ if (typeof (self.rows[cursor]) !== 'undefined') {
287
287
  self.rows[cursor].cursor = false;
288
288
  }
289
289
  if (reset) {
@@ -293,7 +293,7 @@ if (!Modal && typeof (require) === 'function') {
293
293
  }
294
294
  }
295
295
 
296
- const moveCursor = function(direction, jump) {
296
+ const moveCursor = function (direction, jump) {
297
297
  // Remove cursor
298
298
  removeCursor();
299
299
  // Last item
@@ -329,7 +329,7 @@ if (!Modal && typeof (require) === 'function') {
329
329
  setCursor(cursor);
330
330
  }
331
331
 
332
- const setData = function() {
332
+ const setData = function () {
333
333
  // Estimate width
334
334
  let width = self.width;
335
335
  // Re-order to make sure groups are in sequence
@@ -378,7 +378,7 @@ if (!Modal && typeof (require) === 'function') {
378
378
  self.rows = self.data;
379
379
  }
380
380
 
381
- const updateLabel = function() {
381
+ const updateLabel = function () {
382
382
  if (value && value.length) {
383
383
  self.input.textContent = value.filter(v => v.selected).map(i => i.text).join('; ');
384
384
  } else {
@@ -386,11 +386,11 @@ if (!Modal && typeof (require) === 'function') {
386
386
  }
387
387
  }
388
388
 
389
- const setValue = function(v) {
389
+ const setValue = function (v) {
390
390
  // Values
391
391
  let newValue;
392
- if (! Array.isArray(v)) {
393
- if (typeof(v) === 'string') {
392
+ if (!Array.isArray(v)) {
393
+ if (typeof (v) === 'string') {
394
394
  newValue = v.split(';');
395
395
  } else {
396
396
  newValue = [v];
@@ -403,7 +403,7 @@ if (!Modal && typeof (require) === 'function') {
403
403
  value = [];
404
404
 
405
405
  if (Array.isArray(self.data)) {
406
- self.data.map(function(s) {
406
+ self.data.map(function (s) {
407
407
  // Select values
408
408
  if (newValue.indexOf(s.value) !== -1) {
409
409
  s.selected = true;
@@ -418,12 +418,12 @@ if (!Modal && typeof (require) === 'function') {
418
418
  updateLabel();
419
419
 
420
420
  // Component onchange
421
- if (typeof(onchange) === 'function') {
421
+ if (typeof (onchange) === 'function') {
422
422
  onchange.call(self, self, getValue());
423
423
  }
424
424
  }
425
425
 
426
- const getValue = function() {
426
+ const getValue = function () {
427
427
  if (self.multiple) {
428
428
  if (value && value.length) {
429
429
  return value.filter(v => v.selected).map(i => i.value);
@@ -438,7 +438,7 @@ if (!Modal && typeof (require) === 'function') {
438
438
  }
439
439
  }
440
440
 
441
- const onclose = function() {
441
+ const onclose = function () {
442
442
  // Cursor
443
443
  removeCursor(true);
444
444
  // Reset search
@@ -455,7 +455,7 @@ if (!Modal && typeof (require) === 'function') {
455
455
  let newValue = getValue();
456
456
 
457
457
  // If that is different from the component value
458
- if (! compareValues(newValue, self.value)) {
458
+ if (!compareValues(newValue, self.value)) {
459
459
  self.value = newValue;
460
460
  } else {
461
461
  // Update label
@@ -465,15 +465,15 @@ if (!Modal && typeof (require) === 'function') {
465
465
  // Identify the new state of the dropdown
466
466
  self.state = false;
467
467
 
468
- if (typeof(self.onclose) === 'function') {
468
+ if (typeof (self.onclose) === 'function') {
469
469
  self.onclose(self);
470
470
  }
471
471
  }
472
472
 
473
- const onopen = function() {
473
+ const onopen = function () {
474
474
  self.state = true;
475
475
  // Value
476
- let v = value[value.length-1];
476
+ let v = value[value.length - 1];
477
477
  // Make sure goes back to the top of the scroll
478
478
  if (self.container.parentNode.scrollTop > 0) {
479
479
  self.container.parentNode.scrollTop = 0;
@@ -493,14 +493,14 @@ if (!Modal && typeof (require) === 'function') {
493
493
  self.input.focus();
494
494
  }
495
495
 
496
- if (typeof(self.onopen) === 'function') {
496
+ if (typeof (self.onopen) === 'function') {
497
497
  self.onopen(self);
498
498
  }
499
499
  }
500
500
 
501
501
 
502
- self.add = async function(e) {
503
- if (! self.input.textContent) {
502
+ self.add = async function (e) {
503
+ if (!self.input.textContent) {
504
504
  return false;
505
505
  }
506
506
 
@@ -513,7 +513,7 @@ if (!Modal && typeof (require) === 'function') {
513
513
  }
514
514
 
515
515
  // Event
516
- if (typeof(self.onbeforeinsert) === 'function') {
516
+ if (typeof (self.onbeforeinsert) === 'function') {
517
517
  let elClass = self.el.classList;
518
518
  elClass.add('lm-dropdown-loading');
519
519
  let ret = await self.onbeforeinsert(self, s);
@@ -533,16 +533,16 @@ if (!Modal && typeof (require) === 'function') {
533
533
  self.close();
534
534
 
535
535
  // Event
536
- if (typeof(self.oninsert) === 'function') {
536
+ if (typeof (self.oninsert) === 'function') {
537
537
  self.oninsert(self, s);
538
538
  }
539
539
  }
540
540
 
541
- self.search = function(e) {
541
+ self.search = function (e) {
542
542
  if (self.state && self.autocomplete) {
543
543
  // Filter options
544
544
  let data;
545
- if (! self.input.textContent) {
545
+ if (!self.input.textContent) {
546
546
  data = self.data;
547
547
  } else {
548
548
  data = self.data.filter(item => {
@@ -572,7 +572,7 @@ if (!Modal && typeof (require) === 'function') {
572
572
  }
573
573
  }
574
574
 
575
- self.toggle = function() {
575
+ self.toggle = function () {
576
576
  if (self.modal) {
577
577
  if (self.modal.closed) {
578
578
  self.open();
@@ -582,7 +582,7 @@ if (!Modal && typeof (require) === 'function') {
582
582
  }
583
583
  }
584
584
 
585
- self.click = function(e) {
585
+ self.click = function (e) {
586
586
  if (self.autocomplete) {
587
587
  let x;
588
588
  if (e.changedTouches && e.changedTouches[0]) {
@@ -600,7 +600,7 @@ if (!Modal && typeof (require) === 'function') {
600
600
  }
601
601
  }
602
602
 
603
- self.select = function(e, s) {
603
+ self.select = function (e, s) {
604
604
  if (s) {
605
605
  if (self.multiple === true) {
606
606
  let position = value.indexOf(s);
@@ -631,7 +631,7 @@ if (!Modal && typeof (require) === 'function') {
631
631
  }
632
632
  }
633
633
 
634
- self.getGroup = function() {
634
+ self.getGroup = function () {
635
635
  if (this.group && this.header) {
636
636
  return this.group;
637
637
  } else {
@@ -660,27 +660,50 @@ if (!Modal && typeof (require) === 'function') {
660
660
  // Remove search
661
661
  self.input.remove();
662
662
  }
663
+
664
+ if (!Array.isArray(self.data)) {
665
+ self.data = [];
666
+ }
667
+
668
+ if (self.url && self.data.length === 0) {
669
+ const xhr = new XMLHttpRequest();
670
+
671
+ xhr.onreadystatechange = function () {
672
+ if (xhr.readyState === 4) {
673
+ if (xhr.status === 200) {
674
+ self.data = JSON.parse(xhr.responseText);
675
+ } else {
676
+ console.error('Failed to fetch data. Status code: ' + xhr.status);
677
+ }
678
+ }
679
+ };
680
+
681
+ xhr.open('GET', self.url, true);
682
+ xhr.setRequestHeader('Content-Type', 'text/json')
683
+ xhr.send();
684
+ }
685
+
663
686
  // Loading controls
664
687
  lazyloading = lazyLoading(self);
665
688
  // Process the data
666
689
  setData();
667
690
  // Set value
668
- if (typeof(self.value) !== 'undefined') {
691
+ if (typeof (self.value) !== 'undefined') {
669
692
  setValue(self.value);
670
693
  }
671
694
  // Focus out of the component
672
- self.el.addEventListener('focusout', function(e) {
695
+ self.el.addEventListener('focusout', function (e) {
673
696
  if (self.modal) {
674
- if (! (e.relatedTarget && self.el.contains(e.relatedTarget)) && !self.el.contains(e.relatedTarget)) {
675
- if (! self.modal.closed) {
697
+ if (!(e.relatedTarget && self.el.contains(e.relatedTarget)) && !self.el.contains(e.relatedTarget)) {
698
+ if (!self.modal.closed) {
676
699
  self.modal.closed = true;
677
700
  }
678
701
  }
679
702
  }
680
703
  })
681
704
  // Key events
682
- self.el.addEventListener('keydown', function(e) {
683
- if (! self.modal.closed) {
705
+ self.el.addEventListener('keydown', function (e) {
706
+ if (!self.modal.closed) {
684
707
  let prevent = false;
685
708
  if (e.key === 'ArrowUp') {
686
709
  moveCursor(-1);
@@ -690,19 +713,19 @@ if (!Modal && typeof (require) === 'function') {
690
713
  prevent = true;
691
714
  } else if (e.key === 'Home') {
692
715
  moveCursor(-1, true);
693
- if (! self.autocomplete) {
716
+ if (!self.autocomplete) {
694
717
  prevent = true;
695
718
  }
696
719
  } else if (e.key === 'End') {
697
720
  moveCursor(1, true);
698
- if (! self.autocomplete) {
721
+ if (!self.autocomplete) {
699
722
  prevent = true;
700
723
  }
701
724
  } else if (e.key === 'Enter') {
702
725
  self.select(e, self.rows[cursor]);
703
726
  prevent = true;
704
727
  } else {
705
- if (e.keyCode === 32 && ! self.autocomplete) {
728
+ if (e.keyCode === 32 && !self.autocomplete) {
706
729
  self.select(e, self.rows[cursor]);
707
730
  }
708
731
  }
@@ -718,12 +741,12 @@ if (!Modal && typeof (require) === 'function') {
718
741
  }
719
742
  });
720
743
  // Custom event by the developer
721
- if (typeof(onload) === 'function') {
744
+ if (typeof (onload) === 'function') {
722
745
  onload(self);
723
746
  }
724
747
  }
725
748
 
726
- self.onchange = function(prop) {
749
+ self.onchange = function (prop) {
727
750
  if (prop === 'value') {
728
751
  setValue(self.value);
729
752
  } else if (prop === 'data') {
@@ -731,7 +754,7 @@ if (!Modal && typeof (require) === 'function') {
731
754
  self.value = null;
732
755
  }
733
756
 
734
- if (typeof(lazyloading) === 'function') {
757
+ if (typeof (lazyloading) === 'function') {
735
758
  lazyloading(prop);
736
759
  }
737
760
  }
@@ -740,7 +763,7 @@ if (!Modal && typeof (require) === 'function') {
740
763
  * Sanitize any HTML from be paste on the search
741
764
  * @param e
742
765
  */
743
- self.onpaste = function(e) {
766
+ self.onpaste = function (e) {
744
767
  let text;
745
768
  if (e.clipboardData || e.originalEvent.clipboardData) {
746
769
  text = (e.originalEvent || e).clipboardData.getData('text/plain');
package/dist/style.css CHANGED
@@ -27,7 +27,7 @@
27
27
  padding: 0;
28
28
  min-width: initial;
29
29
  min-height: 5px;
30
- border: 1px solid #ccc;
30
+ border: 1px solid var(--lm-border-color, #ccc);
31
31
  border-radius: 0;
32
32
  }
33
33
 
@@ -44,8 +44,15 @@
44
44
  cursor: pointer;
45
45
  box-sizing: border-box;
46
46
  width: 100%;
47
- border: 1px solid #ccc;
47
+ background: var(--lm-background-color, #fff);
48
+ border: 1px solid var(--lm-border-color, #ccc);
48
49
  min-height: 1em;
50
+ border-radius: 2px;
51
+ }
52
+
53
+ .lm-dropdown-input:focus {
54
+ outline: 2px solid var(--lm-border-outline, #000);
55
+ outline-offset: -1px;
49
56
  }
50
57
 
51
58
  .lm-dropdown-input::after {
@@ -260,27 +267,16 @@
260
267
  max-height: initial;
261
268
  }
262
269
 
263
- /** Lazyloading */
264
-
265
- .lm-lazy {
266
- position: relative;
267
- overflow-y: auto;
268
- overflow-x: hidden;
269
- display: flex;
270
- box-sizing: border-box;
271
- height: 100%;
270
+ .lm-dropdown .lm-lazy {
271
+ scrollbar-width: thin;
272
272
  }
273
273
 
274
- .lm-lazy-scroll {
275
- position: absolute;
276
- width: 1px;
274
+ .lm-dropdown .lm-lazy::-webkit-scrollbar {
275
+ height: 12px;
277
276
  }
278
277
 
279
- .lm-lazy-items {
280
- position: sticky;
281
- top: 0;
282
- box-sizing: border-box;
283
- width: 100%;
278
+ .lm-dropdown .lm-lazy::-webkit-scrollbar {
279
+ width: 12px;
284
280
  }
285
281
 
286
282
  .lm-dropdown-loading .lm-dropdown-add::after {
@@ -295,14 +291,41 @@
295
291
  border-top-color: transparent;
296
292
  border-width: 1px;
297
293
  border-radius: 50%;
298
- animation: spin .8s linear infinite;
294
+ animation: lm-dropdown-spin .8s linear infinite;
299
295
  }
300
296
 
301
- @keyframes spin {
297
+ @keyframes lm-dropdown-spin {
302
298
  from {
303
- transform:rotate(0deg);
299
+ transform: rotate(0deg);
304
300
  }
305
301
  to {
306
- transform:rotate(360deg);
302
+ transform: rotate(360deg);
307
303
  }
304
+ }
305
+
306
+ .lm-dark-mode .lm-dropdown-item > div {
307
+ color: white;
308
+ }
309
+
310
+ /** Lazyloading */
311
+
312
+ .lm-lazy {
313
+ position: relative;
314
+ overflow-y: auto;
315
+ overflow-x: hidden;
316
+ display: flex;
317
+ box-sizing: border-box;
318
+ height: 100%;
319
+ }
320
+
321
+ .lm-lazy-scroll {
322
+ position: absolute;
323
+ width: 1px;
324
+ }
325
+
326
+ .lm-lazy-items {
327
+ position: sticky;
328
+ top: 0;
329
+ box-sizing: border-box;
330
+ width: 100%;
308
331
  }
package/package.json CHANGED
@@ -14,10 +14,10 @@
14
14
  "javascript plugins"
15
15
  ],
16
16
  "dependencies": {
17
- "lemonadejs": "^4.1.1",
18
- "@lemonadejs/modal": "^2.7.1"
17
+ "lemonadejs": "^4.2.1",
18
+ "@lemonadejs/modal": "^2.8.0"
19
19
  },
20
20
  "main": "dist/index.js",
21
21
  "types": "dist/index.d.ts",
22
- "version": "3.1.10"
22
+ "version": "3.2.0"
23
23
  }