Skip to content

Commit ff8046e

Browse files
committed
feat: New component CSelect initial release
1 parent bc92d47 commit ff8046e

File tree

7 files changed

+1299
-3
lines changed

7 files changed

+1299
-3
lines changed

js/index.esm.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Modal from './src/modal'
1616
import MultiSelect from './src/multi-select'
1717
import Popover from './src/popover'
1818
import Scrollspy from './src/scrollspy'
19+
import Select from './src/select'
1920
import Sidebar from './src/sidebar'
2021
import Tab from './src/tab'
2122
import Toast from './src/toast'
@@ -33,6 +34,7 @@ export {
3334
MultiSelect,
3435
Popover,
3536
Scrollspy,
37+
Select,
3638
Sidebar,
3739
Tab,
3840
Toast,

js/index.umd.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Modal from './src/modal'
1616
import MultiSelect from './src/multi-select'
1717
import Popover from './src/popover'
1818
import Scrollspy from './src/scrollspy'
19+
import Select from './src/select'
1920
import Sidebar from './src/sidebar'
2021
import Tab from './src/tab'
2122
import Toast from './src/toast'
@@ -34,6 +35,7 @@ export default {
3435
MultiSelect,
3536
Popover,
3637
Scrollspy,
38+
Select,
3739
Sidebar,
3840
Tab,
3941
Toast,

js/src/multi-select.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,21 @@ const CLASSNAME_TAGS = 'c-multi-select-tags'
6363
const CLASSNAME_LABEL = 'c-label'
6464

6565
const Default = {
66+
inline: true,
67+
multiple: false,
6668
options: [],
67-
selected: []
69+
search: false,
70+
selected: [],
71+
tags: false
6872
}
6973

7074
const DefaultType = {
75+
inline: 'boolean',
76+
multiple: 'boolean',
7177
options: 'array',
72-
selected: 'array'
78+
search: 'boolean',
79+
selected: 'array',
80+
tags: 'boolean'
7381
}
7482

7583
/**
@@ -205,7 +213,10 @@ class MultiSelect {
205213
_createNativeSelect(data) {
206214
const select = document.createElement('select')
207215
select.classList.add(CLASSNAME_MULTI_SELECT)
208-
select.multiple = true
216+
217+
if (this._config.multiple) {
218+
select.multiple = true
219+
}
209220

210221
this._createNativeOptions(select, data)
211222

@@ -263,6 +274,7 @@ class MultiSelect {
263274
_createSearchInput() {
264275
const input = document.createElement('input')
265276
input.classList.add(CLASSNAME_SEARCH)
277+
input.placeholder = "Select..."
266278
this._clone.insertBefore(input, this._clone.firstChild)
267279
}
268280

0 commit comments

Comments
 (0)