slim-select 1.27.0 → 2.0.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.
Files changed (155) hide show
  1. package/.nvmrc +1 -0
  2. package/.prettierrc +6 -0
  3. package/.vscode/extensions.json +3 -0
  4. package/.vscode/settings.json +15 -5
  5. package/README.md +2 -1
  6. package/dist/helper.d.ts +1 -4
  7. package/dist/index.d.ts +38 -58
  8. package/dist/render.d.ts +109 -0
  9. package/dist/select.d.ts +31 -20
  10. package/dist/settings.d.ts +33 -0
  11. package/dist/slimselect.cjs.js +2 -0
  12. package/dist/slimselect.cjs.js.map +1 -0
  13. package/dist/slimselect.css +1 -2
  14. package/dist/slimselect.css.map +1 -0
  15. package/dist/slimselect.es.js +2 -0
  16. package/dist/slimselect.es.js.map +1 -0
  17. package/dist/slimselect.global.js +2 -0
  18. package/dist/slimselect.global.js.map +1 -0
  19. package/dist/slimselect.js +2 -1956
  20. package/dist/slimselect.js.map +1 -0
  21. package/dist/slimselect.umd.js +2 -0
  22. package/dist/slimselect.umd.js.map +1 -0
  23. package/dist/store.d.ts +71 -0
  24. package/docs/assets/check-mark.svg +6 -0
  25. package/docs/assets/data.js +59 -0
  26. package/docs/assets/home.css +1 -0
  27. package/docs/assets/home.js +1 -0
  28. package/docs/assets/index.css +1 -0
  29. package/docs/assets/index.js +16 -0
  30. package/docs/assets/index2.js +274 -0
  31. package/docs/assets/index3.js +126 -0
  32. package/docs/assets/index4.js +60 -0
  33. package/docs/assets/install.js +34 -0
  34. package/docs/assets/selects.js +55 -0
  35. package/docs/index.html +18 -5
  36. package/docs.go +3 -1
  37. package/index.html +16 -0
  38. package/jest.config.js +7 -0
  39. package/package.json +39 -39
  40. package/src/docs/app.vue +185 -76
  41. package/src/docs/assets/scss/_variables.scss +26 -10
  42. package/src/docs/assets/scss/alert.scss +12 -0
  43. package/src/docs/assets/scss/animations.scss +5 -3
  44. package/src/docs/assets/scss/button.scss +21 -0
  45. package/src/docs/assets/scss/index.scss +8 -6
  46. package/src/docs/assets/scss/input.scss +2 -2
  47. package/src/docs/assets/scss/layout.scss +195 -65
  48. package/src/docs/assets/scss/misc.scss +144 -34
  49. package/src/docs/assets/scss/prism.scss +155 -153
  50. package/src/docs/env.d.ts +12 -0
  51. package/src/docs/images/check-mark.svg +6 -0
  52. package/src/docs/images/chrome.svg +22 -0
  53. package/src/docs/images/firefox.svg +58 -0
  54. package/src/docs/images/github.png +0 -0
  55. package/src/docs/images/ie.svg +11 -0
  56. package/src/docs/images/npm.png +0 -0
  57. package/src/docs/images/opera.svg +15 -0
  58. package/src/docs/images/safari.svg +22 -0
  59. package/src/docs/main.ts +27 -0
  60. package/src/docs/pages/data.vue +130 -0
  61. package/src/docs/pages/events/addable.vue +79 -0
  62. package/src/docs/pages/events/before_after_change.vue +140 -0
  63. package/src/docs/pages/events/before_after_open_close.vue +122 -0
  64. package/src/docs/pages/events/error.vue +59 -0
  65. package/src/docs/pages/events/index.vue +33 -0
  66. package/src/docs/pages/events/search.vue +154 -0
  67. package/src/docs/pages/events/search_filter.vue +45 -0
  68. package/src/docs/pages/home.vue +96 -116
  69. package/src/docs/pages/install.vue +47 -74
  70. package/src/docs/pages/methods/destroy.vue +66 -0
  71. package/src/docs/pages/methods/enable_disable.vue +70 -0
  72. package/src/docs/pages/methods/get_data.vue +81 -0
  73. package/src/docs/pages/methods/get_selected.vue +78 -0
  74. package/src/docs/pages/methods/index.vue +36 -0
  75. package/src/docs/pages/methods/open_close.vue +63 -0
  76. package/src/docs/pages/methods/search.vue +62 -0
  77. package/src/docs/pages/methods/set_data.vue +106 -0
  78. package/src/docs/pages/methods/set_selected.vue +70 -0
  79. package/src/docs/pages/selects.vue +108 -114
  80. package/src/docs/pages/settings/always_open.vue +88 -0
  81. package/src/docs/pages/settings/close_on_select.vue +69 -0
  82. package/src/docs/pages/settings/content_location.vue +64 -0
  83. package/src/docs/pages/settings/content_position.vue +86 -0
  84. package/src/docs/pages/settings/css.vue +73 -0
  85. package/src/docs/pages/settings/data_attributes.vue +39 -0
  86. package/src/docs/pages/settings/deselect.vue +69 -0
  87. package/src/docs/pages/settings/display.vue +88 -0
  88. package/src/docs/pages/settings/hide_selected.vue +73 -0
  89. package/src/docs/pages/settings/html.vue +86 -0
  90. package/src/docs/pages/settings/index.vue +73 -0
  91. package/src/docs/pages/settings/mandatory.vue +91 -0
  92. package/src/docs/pages/settings/min_max.vue +61 -0
  93. package/src/docs/pages/settings/open_position.vue +60 -0
  94. package/src/docs/pages/settings/placeholder.vue +72 -0
  95. package/src/docs/pages/settings/search.vue +140 -0
  96. package/src/docs/pages/settings/select.vue +32 -0
  97. package/src/docs/pages/settings/select_by_group.vue +46 -0
  98. package/src/docs/pages/settings/show_tooltip.vue +44 -0
  99. package/src/docs/pages/settings/styles.vue +51 -0
  100. package/src/docs/router.ts +41 -13
  101. package/src/slim-select/helper.ts +25 -86
  102. package/src/slim-select/index.ts +318 -413
  103. package/src/slim-select/render.test.ts +39 -0
  104. package/src/slim-select/render.ts +1129 -0
  105. package/src/slim-select/rollup.config.mjs +39 -0
  106. package/src/slim-select/select.test.ts +155 -0
  107. package/src/slim-select/select.ts +280 -107
  108. package/src/slim-select/settings.ts +68 -0
  109. package/src/slim-select/slimselect.scss +263 -278
  110. package/src/slim-select/store.test.ts +220 -0
  111. package/src/slim-select/store.ts +320 -0
  112. package/src/slim-select/tsconfig.json +11 -5
  113. package/src/vue/slimselect.vue +61 -0
  114. package/tsconfig.json +10 -29
  115. package/vite.config.ts +18 -0
  116. package/.browserslistrc +0 -4
  117. package/.postcssrc.js +0 -5
  118. package/.travis.yml +0 -22
  119. package/babel.config.js +0 -5
  120. package/dist/config.d.ts +0 -83
  121. package/dist/data.d.ts +0 -50
  122. package/dist/slim.d.ts +0 -50
  123. package/dist/slimselect.min.css +0 -1
  124. package/dist/slimselect.min.js +0 -1
  125. package/dist/slimselect.min.mjs +0 -1
  126. package/docs/css/app.d5840d21.css +0 -1
  127. package/docs/css/chunk-vendors.4db6930d.css +0 -1
  128. package/docs/css/home.57020178.css +0 -1
  129. package/docs/css/install.baa5d3fb.css +0 -1
  130. package/docs/css/methods.728c742a.css +0 -1
  131. package/docs/css/options.b28a32ef.css +0 -1
  132. package/docs/css/selects.1a7e1e6a.css +0 -1
  133. package/docs/js/app.db13c724.js +0 -2
  134. package/docs/js/app.db13c724.js.map +0 -1
  135. package/docs/js/chunk-vendors.cc40aa28.js +0 -28
  136. package/docs/js/chunk-vendors.cc40aa28.js.map +0 -1
  137. package/docs/js/home.8bcb44fd.js +0 -2
  138. package/docs/js/home.8bcb44fd.js.map +0 -1
  139. package/docs/js/install.02f31028.js +0 -2
  140. package/docs/js/install.02f31028.js.map +0 -1
  141. package/docs/js/methods.1b31e988.js +0 -11
  142. package/docs/js/methods.1b31e988.js.map +0 -1
  143. package/docs/js/options.39fe1005.js +0 -2
  144. package/docs/js/options.39fe1005.js.map +0 -1
  145. package/docs/js/selects.f4d0b859.js +0 -2
  146. package/docs/js/selects.f4d0b859.js.map +0 -1
  147. package/src/docs/pages/methods.vue +0 -427
  148. package/src/docs/pages/options.vue +0 -1480
  149. package/src/main.ts +0 -29
  150. package/src/shims-vue.d.ts +0 -8
  151. package/src/slim-select/config.ts +0 -118
  152. package/src/slim-select/data.ts +0 -377
  153. package/src/slim-select/slim.ts +0 -770
  154. package/tslint.json +0 -26
  155. package/vue.config.js +0 -23
@@ -0,0 +1,274 @@
1
+ import{d as l,S as o,_ as i,o as a,c,a as e,f as t,b as v,g as r,h as p}from"./index.js";const j=l({name:"AlwaysOpen",mounted(){new o({select:this.$refs.alwaysOpenSingle,settings:{alwaysOpen:!0,contentLocation:this.$refs.alwaysOpenSingleContent,contentPosition:"relative"}}),new o({select:this.$refs.alwaysOpenMultiple,settings:{alwaysOpen:!0,contentLocation:this.$refs.alwaysOpenMultipleContent,contentPosition:"relative"}})}}),L={id:"alwaysOpen",class:"content"},G=e("h2",{class:"header"},"alwaysOpen",-1),A=e("p",null," alwaysOpen option is used to keep the select open at all times. This is useful for when you want to display the options at all times. ",-1),I={class:"row"},R={style:{height:"auto"}},k={ref:"alwaysOpenSingle"},q=e("option",{value:"value1"},"Value 1",-1),N=e("option",{value:"value2"},"Value 2",-1),U=e("option",{value:"value3"},"Value 3",-1),W=[q,N,U],Y={ref:"alwaysOpenSingleContent"},F={style:{height:"auto"}},z={ref:"alwaysOpenMultiple",multiple:""},J=e("option",{value:"value1"},"Value 1",-1),K=e("option",{value:"value2"},"Value 2",-1),Q=e("option",{value:"value3"},"Value 3",-1),X=e("option",{value:"value4"},"Value 4",-1),Z=[J,K,Q,X],ee={ref:"alwaysOpenMultipleContent"},te=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
2
+ new SlimSelect({
3
+ select: '#selectElement',
4
+ settings: {
5
+ alwaysOpen: true,
6
+
7
+ // In various situations it may be useful to set the contentLocation
8
+ // to an element that will display best
9
+ contentLocation: document.getElementById('local'), ,
10
+ contentPosition: 'relative',
11
+ }
12
+ })
13
+ `),t(`
14
+ `)],-1),oe=e("pre",null,[t(" "),e("code",{class:"language-html"},`
15
+ <select id="selectElement">
16
+ <option value="value1">Value 1</option>
17
+ <option value="value2">Value 2</option>
18
+ <option value="value3">Value 3</option>
19
+ </select>
20
+
21
+ <!-- The content will go in this div -->
22
+ <div id="local"></div>
23
+ `),t(`
24
+ `)],-1);function se(s,n,u,d,_,h){return a(),c("div",L,[G,A,e("div",I,[e("div",R,[e("select",k,W,512),e("div",Y,null,512)]),e("div",F,[e("select",z,Z,512),e("div",ee,null,512)])]),te,oe])}const ne=i(j,[["render",se]]),le=l({name:"CloseOnSelect",mounted(){new o({select:this.$refs.closeOnSelectSingle,settings:{closeOnSelect:!1}}),new o({select:this.$refs.closeOnSelectMultiple,settings:{closeOnSelect:!1,selectByGroup:!0}})}}),ie={id:"closeOnSelect",class:"content"},ae=e("h2",{class:"header"},"closeOnSelect",-1),ce=e("p",null," closeOnSelect is a boolean value in which determines whether or not to close the content area upon selecting a value. ",-1),ue={class:"row"},de={ref:"closeOnSelectSingle"},_e=v('<option value="value1">Value 1</option><option value="value2">Value 2</option><option value="value3">Value 3</option><optgroup label="Super Values"><option value="value11">Value 1</option><option value="value22">Value 2</option><option value="value33">Value 3</option></optgroup>',4),he=[_e],re={ref:"closeOnSelectMultiple",multiple:""},pe=v('<option value="value1">Value 1</option><option value="value2">Value 2</option><option value="value3">Value 3</option><optgroup label="Super Values"><option value="value11">Value 1</option><option value="value22">Value 2</option><option value="value33">Value 3</option></optgroup>',4),ve=[pe],$e=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
25
+ new SlimSelect({
26
+ select: '#search',
27
+ settings: {
28
+ closeOnSelect: false,
29
+ },
30
+ })
31
+ `),t(`
32
+ `)],-1);function me(s,n,u,d,_,h){return a(),c("div",ie,[ae,ce,e("div",ue,[e("select",de,he,512),e("select",re,ve,512)]),$e])}const ge=i(le,[["render",me]]),fe=l({name:"ContentLocation",mounted(){new o({select:this.$refs.contentLocation,settings:{contentLocation:this.$refs.local}})}}),we={id:"contentLocation",class:"content"},Se=e("h2",{class:"header"},"contentLocation",-1),ye=e("p",null," contentLocation will allow you to set the location of where the content section of slim select. By default every content div is appended to the body. ",-1),Ve=e("p",null," The content container is the bottom half of slim select. This includes the search input field and available options ",-1),be={class:"row"},xe={ref:"contentLocation",style:{width:"50%"}},Me=e("option",{value:"value1"},"Value 1",-1),De=e("option",{value:"value2"},"Value 2",-1),Oe=e("option",{value:"value3"},"Value 3",-1),Pe=[Me,De,Oe],Be={ref:"local"},Te=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
33
+ new SlimSelect({
34
+ select: '#selectElement',
35
+ settings: {
36
+ contentLocation: document.getElementById('local')
37
+ }
38
+ })
39
+ `),t(`
40
+ `)],-1),Ce=e("pre",null,[t(" "),e("code",{class:"language-html"},`
41
+ <select id="contentLocation">
42
+ <option value="value1">Value 1</option>
43
+ <option value="value2">Value 2</option>
44
+ <option value="value3">Value 3</option>
45
+ </select>
46
+
47
+ <!-- The content will go in this div -->
48
+ <div id="local"></div>
49
+ `),t(`
50
+ `)],-1);function He(s,n,u,d,_,h){return a(),c("div",we,[Se,ye,Ve,e("div",be,[e("select",xe,Pe,512),e("div",Be,null,512)]),Te,Ce])}const Ee=i(fe,[["render",He]]),je=l({name:"ContentPosition",mounted(){new o({select:this.$refs.contentPositionRelative,settings:{contentPosition:"relative",contentLocation:this.$refs.contentPositionRelativeContent}}),new o({select:this.$refs.contentPositionAbsolute,settings:{contentPosition:"absolute"}})}});const Le={id:"contentPosition",class:"content"},Ge=e("h2",{class:"header"},"contentPosition",-1),Ae=e("p",null,[t("contentPosition will set the css position to either relative. Default is "),e("b",null,"'absolute'")],-1),Ie=e("div",{class:"alert info"}," If you do use relative position be sure to set the contentLocation to an element that will work best for your use case. Otherwise SlimSelect will add you content to the body of the html. See example usage below. ",-1),Re={class:"row"},ke={ref:"contentPositionRelative",class:"relative"},qe=e("option",{"data-placeholder":"true"},"Relative",-1),Ne=e("option",{value:"value1"},"Value 1",-1),Ue=e("option",{value:"value2"},"Value 2",-1),We=e("option",{value:"value3"},"Value 3",-1),Ye=[qe,Ne,Ue,We],Fe={ref:"contentPositionRelativeContent"},ze={ref:"contentPositionAbsolute",class:"absolute"},Je=e("option",{"data-placeholder":"true"},"Absolute",-1),Ke=e("option",{value:"value1"},"Value 1",-1),Qe=e("option",{value:"value2"},"Value 2",-1),Xe=e("option",{value:"value3"},"Value 3",-1),Ze=[Je,Ke,Qe,Xe],et=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
51
+ new SlimSelect({
52
+ select: '#selectElement',
53
+ settings: {
54
+ contentPosition: 'relative' // 'absolute' or 'relative'
55
+
56
+ // To help with relative positioning
57
+ // you can set the contentLocation
58
+ contentLocation: document.getElementById('local')
59
+ }
60
+ })
61
+ `),t(`
62
+ `)],-1);function tt(s,n,u,d,_,h){return a(),c("div",Le,[Ge,Ae,Ie,e("div",Re,[e("select",ke,Ye,512),e("div",Fe,null,512),e("select",ze,Ze,512)]),et])}const ot=i(je,[["render",tt]]),st=l({name:"Css",mounted(){new o({select:this.$refs.selectClass}),new o({select:this.$refs.optionClass})}});const nt={id:"cssClass",class:"content"},lt=e("h2",{class:"header"},"css class",-1),it=e("p",null," Slim select will inherit any classes that were added to the original select element. This includes options as well. ",-1),at={class:"row"},ct={ref:"selectClass",class:"select-class"},ut=e("option",{value:"value1"},"Value 1",-1),dt=e("option",{value:"value2"},"Value 2",-1),_t=e("option",{value:"value3"},"Value 3",-1),ht=[ut,dt,_t],rt={ref:"optionClass",class:"option-class"},pt=e("option",{class:"red",value:"value1"},"Red",-1),vt=e("option",{class:"green",value:"value2"},"Green",-1),$t=e("option",{class:"blue",value:"value3"},"Blue",-1),mt=[pt,vt,$t],gt=e("pre",null,[t(" "),e("code",{class:"language-html"},`
63
+ <select id="select-class" class="classItems">
64
+ <option class="red" value="value1">Value 1</option>
65
+ <option class="green" value="value2">Value 2</option>
66
+ <option class="blue" value="value3">Value 3</option>
67
+ </select>
68
+ `),t(`
69
+ `)],-1);function ft(s,n,u,d,_,h){return a(),c("div",nt,[lt,it,e("div",at,[e("select",ct,ht,512),e("select",rt,mt,512)]),gt])}const wt=i(st,[["render",ft]]),St=l({name:"DataAttributes",mounted(){new o({select:this.$refs.optionsSingle}),new o({select:this.$refs.optionsMultiple})}}),yt={id:"dataAttributes",class:"content"},Vt=e("h2",{class:"header"},"Data Attributes",-1),bt=e("p",null," Slim select will take on attributes of the original as best as possible. Below are example usages of attributes added to the underlining select options that slim select picked up and used ",-1),xt={class:"row"},Mt={ref:"optionsSingle"},Dt=v('<option data-placeholder="true"></option><option value="value1" data-info="Here is info">Data Attributes</option><option value="value2" disabled>Disabled Option</option><option value="value3" class="green">Class Green</option><option value="value4" style="color:purple;">Inline Style</option>',5),Ot=[Dt],Pt={ref:"optionsMultiple",multiple:""},Bt=e("option",{value:"value1","data-info":"Here is info"},"Data Attributes",-1),Tt=e("option",{value:"value2",disabled:""},"Disabled Option",-1),Ct=e("option",{value:"value3",class:"green"},"Class Green",-1),Ht=e("option",{value:"value4",style:{color:"purple"}},"Inline Style",-1),Et=[Bt,Tt,Ct,Ht];function jt(s,n,u,d,_,h){return a(),c("div",yt,[Vt,bt,e("div",xt,[e("select",Mt,Ot,512),e("select",Pt,Et,512)])])}const Lt=i(St,[["render",jt]]),Gt=l({name:"Deselect",mounted(){new o({select:this.$refs.allowDeselectSingle,settings:{allowDeselect:!0}}),new o({select:this.$refs.allowDeselectMultiple,settings:{allowDeselect:!0}})}}),At={id:"allowDeselect",class:"content"},It=e("h2",{class:"header"},"allowDeselect",-1),Rt=e("p",null,"This will allow you to deselect a value on a single/multiple select dropdown.",-1),kt=e("p",null,"Be sure to have an empty option data placeholder so slim select has an empty string value to select.",-1),qt={class:"row"},Nt={ref:"allowDeselectSingle"},Ut=e("option",{"data-placeholder":"true"},null,-1),Wt=e("option",{value:"value1"},"Value 1",-1),Yt=e("option",{value:"value2"},"Value 2",-1),Ft=e("option",{value:"value3"},"Value 3",-1),zt=[Ut,Wt,Yt,Ft],Jt={ref:"allowDeselectMultiple",multiple:""},Kt=e("option",{"data-placeholder":"true"},null,-1),Qt=e("option",{value:"value1"},"Value 1",-1),Xt=e("option",{value:"value2"},"Value 2",-1),Zt=e("option",{value:"value3"},"Value 3",-1),eo=[Kt,Qt,Xt,Zt],to=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
70
+ new SlimSelect({
71
+ select: '#selectElement',
72
+ settings: {
73
+ allowDeselect: true
74
+ }
75
+ })
76
+ `),t(`
77
+ `)],-1),oo=e("pre",null,[t(" "),e("code",{class:"language-html"},`
78
+ <!-- Requires emtpy data-placeholder option -->
79
+ <select id="allowDeselect">
80
+ <option data-placeholder="true"></option>
81
+ <option value="value1">Value 1</option>
82
+ <option value="value2">Value 2</option>
83
+ <option value="value3">Value 3</option>
84
+ </select>
85
+ `),t(`
86
+ `)],-1);function so(s,n,u,d,_,h){return a(),c("div",At,[It,Rt,kt,e("div",qt,[e("select",Nt,zt,512),e("select",Jt,eo,512)]),to,oo])}const no=i(Gt,[["render",so]]),lo=l({name:"Display",mounted(){const s=new o({select:this.$refs.selectdisplay}),n=[{value:"value1",text:"Value 1",display:!1},{value:"value2",text:"Value 2"},{value:"value3",text:"Value 3"}];s.setData(n),s.setSelected(["value1","value3"]),new o({select:this.$refs.selectdisplay2})}}),io={id:"display",class:"content"},ao=e("h2",{class:"header"},"display",-1),co=e("p",null,"Allows to hide elements of selected values.",-1),uo={class:"row"},_o={ref:"selectdisplay",multiple:""},ho=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
87
+ const displaySelect = new SlimSelect({
88
+ select: '#selectElement'
89
+ })
90
+
91
+ const displayData = [
92
+ { value: 'value1', text: 'Value 1', display: false },
93
+ { value: 'value2', text: 'Value 2' },
94
+ { value: 'value3', text: 'Value 3' },
95
+ ]
96
+
97
+ displaySelect.setData(displayData)
98
+ displaySelect.set(['value1', 'value3'])
99
+ `),t(`
100
+ `)],-1),ro=e("pre",null,[t(" "),e("code",{class:"language-html"},`
101
+ <select id="selectMultiMandatory" multiple></select>
102
+ `),t(`
103
+ `)],-1),po=e("p",null,"Or",-1),vo={class:"row"},$o={ref:"selectdisplay2",multiple:""},mo=e("option",{value:"value1",style:{display:"none"},selected:""},"Value 1",-1),go=e("option",{value:"value2",selected:""},"Value 2",-1),fo=e("option",{value:"value3"},"Value 3",-1),wo=[mo,go,fo],So=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
104
+ const slim = new SlimSelect({
105
+ select: '#selectElement'
106
+ });
107
+ `),t(`
108
+ `)],-1),yo=e("pre",null,[t(" "),e("code",{class:"language-html"},`
109
+ <select id="selectdisplay2" multiple>
110
+ <option value="value1" style="display: none;" selected>Value 1</option>
111
+ <option value="value2" selected>Value 2</option>
112
+ <option value="value3">Value 3</option>
113
+ </select>
114
+ `),t(`
115
+ `)],-1);function Vo(s,n,u,d,_,h){return a(),c("div",io,[ao,co,e("div",uo,[e("select",_o,null,512)]),ho,ro,po,e("div",vo,[e("select",$o,wo,512)]),So,yo])}const bo=i(lo,[["render",Vo]]),xo=l({name:"HideSelected",mounted(){new o({select:this.$refs.hideSelectedSingle,settings:{hideSelected:!0}}),new o({select:this.$refs.hideSelectedMultiple,settings:{hideSelected:!0}})}}),Mo={id:"hideSelected",class:"content"},Do=e("h2",{class:"header"},"hideSelected",-1),Oo=e("p",null,"hideSelected setting is used to hide the current selected option in the options dropdown.",-1),Po={class:"row"},Bo={ref:"hideSelectedSingle"},To=e("option",{"data-placeholder":"true"},null,-1),Co=e("option",{value:"value1"},"Value 1",-1),Ho=e("option",{value:"value2"},"Value 2",-1),Eo=e("option",{value:"value3"},"Value 3",-1),jo=[To,Co,Ho,Eo],Lo={ref:"hideSelectedMultiple",multiple:""},Go=e("option",{value:"value1"},"Value 1",-1),Ao=e("option",{value:"value2"},"Value 2",-1),Io=e("option",{value:"value3"},"Value 3",-1),Ro=[Go,Ao,Io],ko=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
116
+ new SlimSelect({
117
+ select: '#selectElement',
118
+ settings: {
119
+ hideSelected: true,
120
+ }
121
+ })
122
+ `),t(`
123
+ `)],-1),qo=e("pre",null,[t(" "),e("code",{class:"language-html"},`
124
+ <select id="hideSelectedSingle">
125
+ <option data-placeholder="true"></option>
126
+ <option value="value1">Value 1</option>
127
+ <option value="value2">Value 2</option>
128
+ <option value="value3">Value 3</option>
129
+ </select>
130
+
131
+ <select id="hideSelectedMultiple">
132
+ <option value="value1">Value 1</option>
133
+ <option value="value2">Value 2</option>
134
+ <option value="value3">Value 3</option>
135
+ </select>
136
+ `),t(`
137
+ `)],-1);function No(s,n,u,d,_,h){return a(),c("div",Mo,[Do,Oo,e("div",Po,[e("select",Bo,jo,512),e("select",Lo,Ro,512)]),ko,qo])}const Uo=i(xo,[["render",No]]),Wo=l({name:"Html",mounted(){new o({select:this.$refs.selectHtmlSingle,settings:{searchHighlight:!0},data:[{html:"<b>Bold Text</b>",text:"Bold Text",value:"bold text"},{html:"<i>Slim Select you are awesome</i>",text:"Slim Select awesome"},{html:'<div style="border: solid 1px #666666;">Border</div>',text:"Border",value:"border"}]}),new o({select:this.$refs.selectHtmlMulti,settings:{searchHighlight:!0},data:[{html:"<b>Bold Text</b>",text:"Bold Text",value:"bold text"},{html:"<i>Slim Select you are awesome</i>",text:"Slim Select awesome"},{html:'<div style="border: solid 1px #666666;">Border</div>',text:"Border",value:"border"}]})}}),Yo={id:"html",class:"content"},Fo=e("h2",{class:"header"},"html",-1),zo=e("p",null," Slim select has the ability to set custom html for the selected values and options dropdown. By default if the html field is set it will use that for the selected values and the options dropdown. For a multiple select selected values it will always use the text field. ",-1),Jo={class:"row"},Ko={ref:"selectHtmlSingle"},Qo={ref:"selectHtmlMulti",multiple:""},Xo=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
138
+ var select = new SlimSelect({
139
+ select: '#selectElement',
140
+ data: [
141
+ {html: '<img height="30" width="30" src="http://lorempixel.com/30/30" />\xA0Image', text: 'Image', value: 'image'},
142
+ {html: '<b>Bold Text</b>', text: 'Bold Text', value: 'bold text'},
143
+ {html: '<div style="border: solid 1px #666666;">Border</div>', text: 'Border', value: 'border'},
144
+ {html: '<i>Slim Select you are awesome</i>', text: 'Slim Select awesome'}
145
+ ]
146
+ })
147
+ `),t(`
148
+ `)],-1);function Zo(s,n,u,d,_,h){return a(),c("div",Yo,[Fo,zo,e("div",Jo,[e("select",Ko,null,512),e("select",Qo,null,512)]),Xo])}const es=i(Wo,[["render",Zo]]),ts=l({name:"Mandatory",mounted(){const s=new o({select:this.$refs.selectMultiMandatory}),n=[{value:"value1",text:"Value 1",mandatory:!0},{value:"value2",text:"Value 2"},{value:"value3",text:"Value 3"}];s.setData(n),s.setSelected(["value1","value3"]),new o({select:this.$refs.selectMultiMandatory2})}}),os={id:"mandatory",class:"content"},ss=e("h2",{class:"header"},"mandatory",-1),ns=e("p",null," When using multi select you can set a mandatory on the option to prevent capability to deselect particular option. Note options with mandatory flag is not selected by default, you need select them yourselfs. ",-1),ls={class:"row"},is={ref:"selectMultiMandatory",multiple:""},as=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
149
+ const slim = new SlimSelect({
150
+ select: '#selectElement'
151
+ });
152
+
153
+ const data = [
154
+ { value: 'value1', text: 'Value 1', mandatory: true },
155
+ { value: 'value2', text: 'Value 2' },
156
+ { value: 'value3', text: 'Value 3' },
157
+ ]
158
+
159
+ slim.setData(data)
160
+ slim.set(["value1", "value3"])
161
+ `),t(`
162
+ `)],-1),cs=e("pre",null,[t(" "),e("code",{class:"language-html"},`
163
+ <select id="selectMultiMandatory" multiple></select>
164
+ `),t(`
165
+ `)],-1),us=e("p",null,"Or",-1),ds={class:"row"},_s={ref:"selectMultiMandatory2",multiple:""},hs=e("option",{value:"value1","data-mandatory":"true",selected:""},"Value 1",-1),rs=e("option",{value:"value2",selected:""},"Value 2",-1),ps=e("option",{value:"value3"},"Value 3",-1),vs=[hs,rs,ps],$s=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
166
+ const slim = new SlimSelect({
167
+ select: '#selectElement'
168
+ });
169
+ `),t(`
170
+ `)],-1),ms=e("pre",null,[t(" "),e("code",{class:"language-html"},`
171
+ <select id="selectMultiMandatory" multiple>
172
+ <option value="value1" data-mandatory="true" selected>Value 1</option>
173
+ <option value="value2" selected>Value 2</option>
174
+ <option value="value3">Value 3</option>
175
+ </select>
176
+ `),t(`
177
+ `)],-1);function gs(s,n,u,d,_,h){return a(),c("div",os,[ss,ns,e("div",ls,[e("select",is,null,512)]),as,cs,us,e("div",ds,[e("select",_s,vs,512)]),$s,ms])}const fs=i(ts,[["render",gs]]),ws=l({name:"MinMax",mounted(){new o({select:this.$refs.selectMultiMax,settings:{minSelected:2,maxSelected:5}})}}),Ss={id:"minmax",class:"content"},ys=e("h2",{class:"header"},"Min/Max Selected",-1),Vs=e("p",null,"When using multi select you can set a min and/or max on the amount of selections you can have.",-1),bs={class:"row"},xs={ref:"selectMultiMax",multiple:""},Ms=v('<option value="value1">Value 1</option><option value="value2">Value 2</option><option value="value3">Value 3</option><option value="value4">Value 4</option><option value="value5">Value 5</option><option value="value6">Value 6</option>',6),Ds=[Ms],Os=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
178
+ let slim = new SlimSelect({
179
+ select: '#selectElement',
180
+ settings: {
181
+ minSelected: 2,
182
+ maxSelected: 5,
183
+ },
184
+ })
185
+ `),t(`
186
+ `)],-1),Ps=e("pre",null,[t(" "),e("code",{class:"language-html"},`
187
+ <select id="selectMultiMax" multiple>
188
+ <option value="value1">Value 1</option>
189
+ <option value="value2">Value 2</option>
190
+ <option value="value3">Value 3</option>
191
+ <option value="value4">Value 4</option>
192
+ <option value="value5">Value 5</option>
193
+ <option value="value6">Value 6</option>
194
+ </select>
195
+ `),t(`
196
+ `)],-1);function Bs(s,n,u,d,_,h){return a(),c("div",Ss,[ys,Vs,e("div",bs,[e("select",xs,Ds,512)]),Os,Ps])}const Ts=i(ws,[["render",Bs]]),Cs=l({name:"OpenPosition",mounted(){new o({select:this.$refs.openPositionUp,settings:{openPosition:"up"}}),new o({select:this.$refs.openPositionDown,settings:{openPosition:"down"}})}}),Hs={id:"openPosition",class:"content"},Es=e("h2",{class:"header"},"openPosition",-1),js=e("p",null," openPosition is a string value that will decide where to show your content when it comes out. By default slim select will try to put the content where it can without going off screen. But you may want to always show it in one direction. ",-1),Ls=e("p",null,[t("Possible Options: "),e("b",null,"'auto', 'up' or 'down'"),t(". Default is "),e("b",null,"'auto'")],-1),Gs={class:"row"},As={ref:"openPositionUp"},Is=e("option",{value:"up1"},"Up 1",-1),Rs=e("option",{value:"up2"},"Up 2",-1),ks=e("option",{value:"up3"},"Up 3",-1),qs=[Is,Rs,ks],Ns={ref:"openPositionDown"},Us=e("option",{value:"down1"},"Down 1",-1),Ws=e("option",{value:"down2"},"Down 2",-1),Ys=e("option",{value:"down3"},"Down 3",-1),Fs=[Us,Ws,Ys],zs=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
197
+ new SlimSelect({
198
+ select: '#selectElement',
199
+ settings: {
200
+ openPosition: 'auto' // 'auto', 'up' or 'down'
201
+ }
202
+ })
203
+ `),t(`
204
+ `)],-1);function Js(s,n,u,d,_,h){return a(),c("div",Hs,[Es,js,Ls,e("div",Gs,[e("select",As,qs,512),e("select",Ns,Fs,512)]),zs])}const Ks=i(Cs,[["render",Js]]),Qs=l({name:"Placeholder",mounted(){new o({select:this.$refs.placeholderSingle,settings:{placeholderText:"Custom Placeholder Text"}}),new o({select:this.$refs.placeholderMultiple,settings:{placeholderText:"Custom Placeholder Text"}})}}),Xs={id:"placeholder",class:"content"},Zs=e("h2",{class:"header"},"placeholderText",-1),en=e("p",null,' Placeholders consists of setting the placeholder option value. The only difference is single selects require an empty option with data-placeholder set to true. Default value is "Select Value". ',-1),tn={class:"row"},on={ref:"placeholderSingle"},sn=e("option",{"data-placeholder":"true"},null,-1),nn=e("option",{value:"value1"},"Value 1",-1),ln=e("option",{value:"value2"},"Value 2",-1),an=e("option",{value:"value3"},"Value 3",-1),cn=[sn,nn,ln,an],un={ref:"placeholderMultiple",multiple:""},dn=e("option",{value:"value1"},"Value 1",-1),_n=e("option",{value:"value2"},"Value 2",-1),hn=e("option",{value:"value3"},"Value 3",-1),rn=[dn,_n,hn],pn=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
205
+ new SlimSelect({
206
+ select: '#placeholder',
207
+ settings: {
208
+ placeholderText: 'Custom Placeholder Text',
209
+ }
210
+ })
211
+ `),t(`
212
+ `)],-1),vn=e("pre",null,[t(" "),e("code",{class:"language-html"},`
213
+ <!-- Set empty option with data-placeholder if you to have placeholder -->
214
+ <!-- text for single select, otherwise first option will be selected -->
215
+ <select id="placeholderSingle">
216
+ <option data-placeholder="true"></option>
217
+ <option value="value1">Value 1</option>
218
+ <option value="value2">Value 2</option>
219
+ <option value="value3">Value 3</option>
220
+ </select>
221
+ `),t(`
222
+ `)],-1);function $n(s,n,u,d,_,h){return a(),c("div",Xs,[Zs,en,e("div",tn,[e("select",on,cn,512),e("select",un,rn,512)]),pn,vn])}const mn=i(Qs,[["render",$n]]),gn=l({name:"Search",mounted(){new o({select:this.$refs.showSearchSingle,settings:{showSearch:!1}}),new o({select:this.$refs.searchTextSingle,settings:{searchText:"Sorry, nothing to see here"}}),new o({select:this.$refs.searchPlaceholderSingle,settings:{searchPlaceholder:"Search for the good stuff!"}}),new o({select:this.$refs.searchHighlightSingle,settings:{searchHighlight:!0}}),new o({select:this.$refs.showSearchMulti,settings:{showSearch:!1}}),new o({select:this.$refs.searchTextMulti,settings:{searchText:"Sorry nothing to see here"}}),new o({select:this.$refs.searchPlaceholderMulti,settings:{searchPlaceholder:"Search for the good stuff!"}}),new o({select:this.$refs.searchHighlightMulti,settings:{searchHighlight:!0}})}}),fn={id:"search",class:"content"},wn=v('<h2 class="header">showSearch / searchText / searchingText / searchHighlight</h2><p><b>showSearch</b> - is a boolean value that will decide whether or not to show the search. Default is true.</p><p><b>searchText</b> - is a string value that will show in the event there are no results. Default is &#39;No Results&#39;. </p><p><b>searchingText</b> - is a string value that will show during an fetch search request. Default is &#39;Searching...&#39;. </p><p><b>searchPlaceholder</b> - is a string value that will set the value of the input search placeholder text. Default is &#39;Search&#39;. </p><p><b>searchHighlight</b> - is a boolean value that will highlight search results. Default is false.</p>',6),Sn={class:"row",style:{padding:"0 0 var(--spacing-half) 0"}},yn={ref:"showSearchSingle"},Vn=e("option",{value:"dog"},"Dog",-1),bn=e("option",{value:"cat"},"Cat",-1),xn=e("option",{value:"bird"},"Bird",-1),Mn=[Vn,bn,xn],Dn={ref:"searchTextSingle"},On=e("option",{value:"dog"},"Dog",-1),Pn=e("option",{value:"cat"},"Cat",-1),Bn=e("option",{value:"bird"},"Bird",-1),Tn=[On,Pn,Bn],Cn={ref:"searchPlaceholderSingle"},Hn=e("option",{value:"dog"},"Dog",-1),En=e("option",{value:"cat"},"Cat",-1),jn=e("option",{value:"bird"},"Bird",-1),Ln=[Hn,En,jn],Gn={ref:"searchHighlightSingle"},An=e("option",{value:"dog"},"Dog",-1),In=e("option",{value:"cat"},"Cat",-1),Rn=e("option",{value:"bird"},"Bird",-1),kn=[An,In,Rn],qn={class:"row"},Nn={ref:"showSearchMulti",multiple:""},Un=e("option",{value:"dog"},"Dog",-1),Wn=e("option",{value:"cat"},"Cat",-1),Yn=e("option",{value:"bird"},"Bird",-1),Fn=[Un,Wn,Yn],zn={ref:"searchTextMulti",multiple:""},Jn=e("option",{value:"dog"},"Dog",-1),Kn=e("option",{value:"cat"},"Cat",-1),Qn=e("option",{value:"bird"},"Bird",-1),Xn=[Jn,Kn,Qn],Zn={ref:"searchPlaceholderMulti",multiple:""},el=e("option",{value:"dog"},"Dog",-1),tl=e("option",{value:"cat"},"Cat",-1),ol=e("option",{value:"bird"},"Bird",-1),sl=[el,tl,ol],nl={ref:"searchHighlightMulti",multiple:""},ll=e("option",{value:"dog"},"Dog",-1),il=e("option",{value:"cat"},"Cat",-1),al=e("option",{value:"bird"},"Bird",-1),cl=[ll,il,al],ul=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
223
+ let slim = new SlimSelect({
224
+ select: '#selectElement',
225
+ settings: {
226
+ showSearch: false,
227
+ searchText: 'Sorry nothing to see here',
228
+ searchPlaceholder: 'Search for the good stuff!',
229
+ searchHighlight: true
230
+ }
231
+ })
232
+ `),t(`
233
+ `)],-1);function dl(s,n,u,d,_,h){return a(),c("div",fn,[wn,e("div",Sn,[e("select",yn,Mn,512),e("select",Dn,Tn,512),e("select",Cn,Ln,512),e("select",Gn,kn,512)]),e("div",qn,[e("select",Nn,Fn,512),e("select",zn,Xn,512),e("select",Zn,sl,512),e("select",nl,cl,512)]),ul])}const _l=i(gn,[["render",dl]]),hl=l({name:"Select"}),rl={id:"select",class:"content"},pl=e("h2",{class:"header"},"select",-1),vl=e("p",null," The select field is used to identify the select element that will be used to create slim select. You can use any value you normally would in a querySelector or pass the element directly. ",-1),$l=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
234
+ new SlimSelect({
235
+ select: '#selectElement',
236
+ // or
237
+ select: document.querySelector('#selectElement')
238
+ })
239
+
240
+ // If you already have a currenlty running SlimSelect but lost the reference to it.
241
+ // You can access from the original select element.
242
+ let el = document.querySelector('#selectElement')
243
+ el.slim.open() // Or any other options/methods
244
+ `),t(`
245
+ `)],-1),ml=[pl,vl,$l];function gl(s,n,u,d,_,h){return a(),c("div",rl,ml)}const fl=i(hl,[["render",gl]]),wl=l({name:"SelectByGroup",mounted(){new o({select:this.$refs.selectByGroup,settings:{selectByGroup:!0}})}}),Sl={id:"selectByGroup",class:"content"},yl=e("h2",{class:"header"},"selectByGroup",-1),Vl=e("p",null," selectByGroup option is used to enable the selection of all options under a specific group by clicking that option group's label. ",-1),bl={ref:"selectByGroup",multiple:""},xl=e("optgroup",{label:"Label 1"},[e("option",{value:"value1"},"Value 1"),e("option",{value:"value2"},"Value 2"),e("option",{value:"value3"},"Value 3")],-1),Ml=[xl],Dl=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
246
+ new SlimSelect({
247
+ select: '#selectByGroup',
248
+ settings: {
249
+ selectByGroup: true
250
+ }
251
+ })
252
+ `),t(`
253
+ `)],-1);function Ol(s,n,u,d,_,h){return a(),c("div",Sl,[yl,Vl,e("select",bl,Ml,512),Dl])}const Pl=i(wl,[["render",Ol]]),Bl=l({name:"ShowTooltip",mounted(){new o({select:this.$refs.showOptionTooltips,settings:{showOptionTooltips:!0}})}}),Tl={id:"showOptionTooltips",class:"content"},Cl=e("h2",{class:"header"},"showOptionTooltips",-1),Hl=e("p",null," showOptionTooltips option is used to active displaying the on-hover tooltips for select options. The tooltip text is equal to the option text content. ",-1),El={ref:"showOptionTooltips"},jl=e("option",{value:"value1"},"Value 1",-1),Ll=e("option",{value:"value2"},"Value 2",-1),Gl=e("option",{value:"value3"},"Value 3",-1),Al=[jl,Ll,Gl],Il=e("pre",null,[t(" "),e("code",{class:"language-javascript"},`
254
+ new SlimSelect({
255
+ select: '#selectElement',
256
+ settings: {
257
+ showOptionTooltips: true,
258
+ }
259
+ })
260
+ `),t(`
261
+ `)],-1);function Rl(s,n,u,d,_,h){return a(),c("div",Tl,[Cl,Hl,e("select",El,Al,512),Il])}const kl=i(Bl,[["render",Rl]]),ql=l({name:"Styles",mounted(){new o({select:this.$refs.selectStyle}),new o({select:this.$refs.optionStyle})}}),Nl={id:"inlineStyles",class:"content"},Ul=e("h2",{class:"header"},"inline styles",-1),Wl=e("p",null," Slim select will inherit any styles that were added to the original select element. This includes options as well. ",-1),Yl={class:"row"},Fl={ref:"selectStyle",style:{color:"red"}},zl=e("option",{value:"value1"},"Value 1",-1),Jl=e("option",{value:"value2"},"Value 2",-1),Kl=e("option",{value:"value3"},"Value 3",-1),Ql=[zl,Jl,Kl],Xl={ref:"optionStyle"},Zl=e("option",{style:{color:"red"},value:"value1"},"Red",-1),ei=e("option",{style:{color:"green"}},"Green",-1),ti=e("option",{style:{color:"blue"}},"Blue",-1),oi=[Zl,ei,ti],si=e("pre",null,[t(" "),e("code",{class:"language-html"},`
262
+ <select id="select-style" style="color: red;">
263
+ <option value="value1">Value 1</option>
264
+ <option value="value2">Value 2</option>
265
+ <option value="value3">Value 3</option>
266
+ </select>
267
+
268
+ <select id="option-style">
269
+ <option style="color: red;" value="value1">Red</option>
270
+ <option style="color: green;">Green</option>
271
+ <option style="color: blue;">Blue</option>
272
+ </select>
273
+ `),t(`
274
+ `)],-1);function ni(s,n,u,d,_,h){return a(),c("div",Nl,[Ul,Wl,e("div",Yl,[e("select",Fl,Ql,512),e("select",Xl,oi,512)]),si])}const li=i(ql,[["render",ni]]),ii=l({name:"Settings",components:{Select:fl,AlwaysOpen:ne,ContentLocation:Ee,ContentPosition:ot,OpenPosition:Ks,Placeholder:mn,Deselect:no,Display:bo,Mandatory:fs,MinMax:Ts,DataAttributes:Lt,Css:wt,Styles:li,Html:es,Search:_l,CloseOnSelect:ge,ShowTooltip:kl,SelectByGroup:Pl,HideSelected:Uo}}),ai={id:"settings",class:"contents"};function ci(s,n,u,d,_,h){const $=r("Select"),m=r("AlwaysOpen"),g=r("ContentLocation"),f=r("ContentPosition"),w=r("OpenPosition"),S=r("Placeholder"),y=r("Deselect"),V=r("Display"),b=r("Mandatory"),x=r("MinMax"),M=r("DataAttributes"),D=r("Css"),O=r("Styles"),P=r("Html"),B=r("Search"),T=r("CloseOnSelect"),C=r("ShowTooltip"),H=r("SelectByGroup"),E=r("HideSelected");return a(),c("div",ai,[p($),p(m),p(g),p(f),p(w),p(S),p(y),p(V),p(b),p(x),p(M),p(D),p(O),p(P),p(B),p(T),p(C),p(H),p(E)])}const di=i(ii,[["render",ci]]);export{di as default};
@@ -0,0 +1,126 @@
1
+ import{d as _,S as r,_ as g,o as a,c as l,f as n,t as d,i as v,a as e,F as O,j as w,k as V,g as p,h as f}from"./index.js";const y=_({name:"Error",data(){return{errorSingle:null,errMsg:""}},mounted(){this.errorSingle=new r({select:this.$refs.errorSingle,events:{error:t=>{this.errMsg=t.message}}})}}),M={id:"error",class:"content"},A=e("h2",{class:"header"},"error",-1),k=e("p",null,"The error event is fired when an error occurs. The error message is passed as the first argument.",-1),j=e("div",{class:"alert info"}," If you are are having issues with slim select finding the select element. Try delaying new SlimSelect() call as the select dom element might not be available yet. ",-1),F={key:0},T=e("b",null,"Error:",-1),E={class:"row"},B={ref:"notError"},x=e("option",{value:"1"},"Option 1",-1),L=e("option",{value:"2"},"Option 2",-1),N=e("option",{value:"3"},"Option 3",-1),D=[x,L,N],P=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
2
+ var select = new SlimSelect({
3
+ select: '#selectElement',
4
+ events: {
5
+ error: function(err) {
6
+ console.error(err)
7
+ }
8
+ }
9
+ })
10
+ `),n(`
11
+ `)],-1);function R(t,s,c,h,u,o){return a(),l("div",M,[A,k,j,t.errMsg!==""?(a(),l("div",F,[T,n(" "+d(t.errMsg),1)])):v("",!0),e("div",E,[e("select",B,D,512)]),P])}const H=g(y,[["render",R]]),I=_({name:"BeforeAfterChange",data(){return{beforeChangeSingle:[],beforeChangeMultiple:[],afterChangeSingle:[],afterChangeMultiple:[]}},mounted(){new r({select:this.$refs.beforeChangeSingle,events:{beforeChange:(t,s)=>{this.beforeChangeSingle=s}}}),new r({select:this.$refs.beforeChangeMultiple,events:{beforeChange:(t,s)=>(this.beforeChangeMultiple=s,!0)}}),new r({select:this.$refs.afterChangeSingle,events:{afterChange:t=>{this.afterChangeSingle=t}}}),new r({select:this.$refs.afterChangeMultiple,events:{afterChange:t=>{this.afterChangeMultiple=t}}})}}),J={id:"beforeChange",class:"content"},U=e("h2",{class:"header"},"beforeChange",-1),z=e("p",null," beforeOnChange will trigger a callback on an option click and will allow you the ability to halt if the value it produces isnt to your liking. In order to stop the change from happening just return false on the callback. Returning nothing or true will allow it to continue as normal. ",-1),q={key:0},G={ref:"beforeChangeSingle"},K=e("option",{value:"value1"},"Value 1",-1),Q=e("option",{value:"value2"},"Value 2",-1),W=e("option",{value:"value3"},"Value 3",-1),X=[K,Q,W],Y=e("br",null,null,-1),Z={key:1},ee={ref:"beforeChangeMultiple",multiple:""},te=e("option",{value:"value1",selected:""},"Value 1",-1),ne=e("option",{value:"value2"},"Value 2",-1),se=e("option",{value:"value3"},"Value 3",-1),oe=[te,ne,se],ae=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
12
+ new SlimSelect({
13
+ select: '#selectElement',
14
+ events: {
15
+ beforeChange: (newVal, oldVal) => {
16
+ console.log(newVal)
17
+ return false // this will stop the change from happening
18
+ }
19
+ }
20
+ })
21
+ `),n(`
22
+ `)],-1),le={id:"afterChange",class:"content"},re=e("h2",{class:"header"},"afterChange",-1),ie=e("p",null,"afterChange will trigger a callback after the value of the select dropdown has changed.",-1),ce={key:0},he={ref:"afterChangeSingle"},ue=e("option",{value:"value1"},"Value 1",-1),de=e("option",{value:"value2"},"Value 2",-1),_e=e("option",{value:"value3"},"Value 3",-1),pe=[ue,de,_e],fe=e("br",null,null,-1),ge={key:1},ve={ref:"afterChangeMultiple",multiple:""},me=e("option",{value:"value1",selected:""},"Value 1",-1),$e=e("option",{value:"value2"},"Value 2",-1),be=e("option",{value:"value3"},"Value 3",-1),Se=[me,$e,be],Ce=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
23
+ new SlimSelect({
24
+ select: '#selectElement',
25
+ events: {
26
+ afterChange: (newVal) => {
27
+ console.log(newVal)
28
+ }
29
+ }
30
+ })
31
+ `),n(`
32
+ `)],-1);function we(t,s,c,h,u,o){return a(),l(O,null,[e("div",J,[U,z,t.beforeChangeSingle?(a(),l("div",q,[e("strong",null,"Before change: "+d(t.beforeChangeSingle),1)])):v("",!0),e("select",G,X,512),Y,t.beforeChangeMultiple?(a(),l("div",Z,[e("strong",null,"Before change: "+d(t.beforeChangeMultiple),1)])):v("",!0),e("select",ee,oe,512),ae]),e("div",le,[re,ie,t.afterChangeSingle?(a(),l("div",ce,[e("strong",null,"After change: "+d(t.afterChangeSingle),1)])):v("",!0),e("select",he,pe,512),fe,t.afterChangeMultiple?(a(),l("div",ge,[e("strong",null,"After change: "+d(t.afterChangeMultiple),1)])):v("",!0),e("select",ve,Se,512),Ce])],64)}const Oe=g(I,[["render",we]]),Ve=_({name:"BeForeAfterOpenClose",data(){return{beforeAfterOpenCloseSingle:null,singleState:"",beforeAfterOpenCloseMultiple:null,multipleState:""}},mounted(){this.beforeAfterOpenCloseSingle=new r({select:this.$refs.beforeAfterOpenCloseSingle,events:{beforeOpen:()=>{this.setState("single","beforeOpen")},afterOpen:()=>{this.setState("single","afterOpen")},beforeClose:()=>{this.setState("single","beforeClose")},afterClose:()=>{this.setState("single","afterClose")}}}),this.beforeAfterOpenCloseMultiple=new r({select:this.$refs.beforeAfterOpenCloseMultiple,events:{beforeOpen:()=>{this.setState("multiple","beforeOpen")},afterOpen:()=>{this.setState("multiple","afterOpen")},beforeClose:()=>{this.setState("multiple","beforeClose")},afterClose:()=>{this.setState("multiple","afterClose")}}})},methods:{setState(t,s){t==="single"?this.singleState=s:this.multipleState=s,setTimeout(()=>{t==="single"?this.singleState="":this.multipleState=""},1e3)}}}),ye={id:"open",class:"content"},Me=e("h2",{class:"header"},"beforeOpen / afterOpen / beforeClose / afterClose",-1),Ae=e("p",null," The beforeOpen, afterOpen, beforeClose, and afterClose events will fire before and after the select is opened and closed. ",-1),ke={class:"row"},je={ref:"beforeAfterOpenCloseSingle"},Fe=e("option",{value:"value1"},"Value 1",-1),Te=e("option",{value:"value2"},"Value 2",-1),Ee=e("option",{value:"value3"},"Value 3",-1),Be=[Fe,Te,Ee],xe={ref:"beforeAfterOpenCloseMultiple",multiple:""},Le=e("option",{value:"value1"},"Value 1",-1),Ne=e("option",{value:"value2"},"Value 2",-1),De=e("option",{value:"value3"},"Value 3",-1),Pe=[Le,Ne,De],Re=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
33
+ var select = new SlimSelect({
34
+ select: '#selectElement',
35
+ events: {
36
+ beforeOpen: () => {
37
+ console.log('before open')
38
+ },
39
+ afterOpen: () => {
40
+ console.log('after open')
41
+ },
42
+ beforeClose: () => {
43
+ console.log('before close')
44
+ },
45
+ afterClose: () => {
46
+ console.log('after close')
47
+ },
48
+ },
49
+ })
50
+ `),n(`
51
+ `)],-1);function He(t,s,c,h,u,o){return a(),l("div",ye,[Me,Ae,e("div",ke,[e("div",null,[e("div",null,"State: "+d(t.singleState),1),e("select",je,Be,512)]),e("div",null,[e("div",null,"State: "+d(t.multipleState),1),e("select",xe,Pe,512)])]),Re])}const Ie=g(Ve,[["render",He]]),Je={id:"search",class:"content"},Ue=e("h2",{class:"header"},"search",-1),ze=e("p",null,[n(" Slim select allows you to syncronize result values from your promise response."),e("br"),n(" Call callback() method with slimselect data, false or string with specific string. ")],-1),qe={class:"row"},Ge=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
52
+ new SlimSelect({
53
+ select: '#selectElement',
54
+ events: {
55
+ search: (search, currentData) => {
56
+ return new Promise((resolve, reject) => {
57
+ if (search.length < 2) {
58
+ return reject('Search must be at least 2 characters')
59
+ }
60
+
61
+ // Fetch random first and last name data
62
+ fetch('https://api.gofakeit.com/json', {
63
+ method: 'POST',
64
+ headers: {
65
+ 'Content-Type': 'application/json',
66
+ },
67
+ body: JSON.stringify({
68
+ type: 'array',
69
+ rowcount: 10,
70
+ indent: false,
71
+ fields: [
72
+ { name: 'first_name', function: 'firstname', params: {} },
73
+ { name: 'last_name', function: 'lastname', params: {} },
74
+ ],
75
+ }),
76
+ })
77
+ .then((response) => response.json())
78
+ .then((data) => {
79
+ // Take data and generate array of options
80
+ const options = data.map((person) => {
81
+ return {
82
+ text: \`\${person.first_name} \${person.last_name}\`,
83
+ value: \`\${person.first_name} \${person.last_name}\`,
84
+ }
85
+ })
86
+
87
+ resolve(options)
88
+ })
89
+ })
90
+ }
91
+ }
92
+ })
93
+ `),n(`
94
+ `)],-1),Ke=_({__name:"search",setup(t){let s=[],c=w(null),h=w(null);fetch("https://api.gofakeit.com/json",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"array",rowcount:1e3,indent:!1,fields:[{name:"first_name",function:"firstname",params:{}},{name:"last_name",function:"lastname",params:{}}]})}).then(o=>o.json()).then(o=>{s=o}),V(()=>{new r({select:c.value,settings:{placeholderText:"Search First or Last Name",searchingText:"Searching Users...",searchHighlight:!0},events:{search:u}}),new r({select:h.value,settings:{placeholderText:"Search First or Last Name",searchingText:"Searching Users...",searchHighlight:!0},events:{search:u}})});function u(o,b){return new Promise((S,m)=>{if(o.length<2)return m("Search must be at least 2 characters");const $=s.filter(i=>i.first_name.toLowerCase().includes(o.toLowerCase())||i.last_name.toLowerCase().includes(o.toLowerCase()));if($.length===0)return m("No results found");let C=$.map(i=>({text:`${i.first_name} ${i.last_name}`,value:`${i.first_name} ${i.last_name}`}));setTimeout(()=>{S(C)},300)})}return(o,b)=>(a(),l("div",Je,[Ue,ze,e("div",qe,[e("select",{ref_key:"searchSingle",ref:c},null,512),e("select",{ref_key:"searchMultiple",ref:h,multiple:""},null,512)]),Ge]))}}),Qe=_({name:"SearchFilter",mounted(){new r({select:this.$refs.searchFilter,events:{searchFilter:(t,s)=>t.text.substr(0,s.length)===s}})}}),We={id:"searchFilter",class:"content"},Xe=e("h2",{class:"header"},"searchFilter",-1),Ye=e("p",null,"searchFilter event is used to replace the default matching algorithm.",-1),Ze=e("p",null,[n("See Data for the proper object interface of "),e("em",null,"option"),n(".")],-1),et={ref:"searchFilter"},tt=e("option",{value:"apple"},"Apple",-1),nt=e("option",{value:"orange"},"Orange",-1),st=e("option",{value:"pineapple"},"Pineapple",-1),ot=[tt,nt,st],at=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
95
+ new SlimSelect({
96
+ select: '#selectElement',
97
+ events: {
98
+ // Exact case sensitive start of string match
99
+ searchFilter: (option, search) => {
100
+ return option.text.substr(0, search.length) === search
101
+ }
102
+ }
103
+ })
104
+ `),n(`
105
+ `)],-1);function lt(t,s,c,h,u,o){return a(),l("div",We,[Xe,Ye,Ze,e("select",et,ot,512),at])}const rt=g(Qe,[["render",lt]]),it=_({name:"Addable",mounted(){new r({select:this.$refs.addableSingle,events:{addable:t=>t}}),new r({select:this.$refs.addableMultiple,events:{addable:t=>({text:t,value:t.toLowerCase()})}})}}),ct={id:"addable",class:"content"},ht=e("h2",{class:"header"},"addable",-1),ut=e("p",null,"Slim select has the ability to dynamically add options via the search input field",-1),dt=e("p",null," addable is a callback which takes a function parameter. The return value can either be a string or an option object. ",-1),_t={class:"row"},pt={ref:"addableSingle"},ft=e("option",{value:"value1"},"Value 1",-1),gt=e("option",{value:"value2"},"Value 2",-1),vt=e("option",{value:"value3"},"Value 3",-1),mt=[ft,gt,vt],$t={ref:"addableMultiple",multiple:""},bt=e("option",{value:"value1"},"Value 1",-1),St=e("option",{value:"value2"},"Value 2",-1),Ct=e("option",{value:"value3"},"Value 3",-1),wt=[bt,St,Ct],Ot=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
106
+ new SlimSelect({
107
+ select: '#selectElement',
108
+
109
+ events: {
110
+ addable: function (value) {
111
+ // return false or null if you do not want to allow value to be submitted
112
+ if (value === 'bad') {return false}
113
+
114
+ // Return the value string
115
+ return value // Optional - value alteration // ex: value.toLowerCase()
116
+
117
+ // Optional - Return a valid data object. See methods/setData for list of valid options
118
+ return {
119
+ text: value,
120
+ value: value.toLowerCase()
121
+ }
122
+ }
123
+ }
124
+ })
125
+ `),n(`
126
+ `)],-1);function Vt(t,s,c,h,u,o){return a(),l("div",ct,[ht,ut,dt,e("div",_t,[e("select",pt,mt,512),e("select",$t,wt,512)]),Ot])}const yt=g(it,[["render",Vt]]),Mt=_({name:"Events",components:{Error:H,BeforeAfterChange:Oe,BeforeAfterOpenClose:Ie,Search:Ke,SearchFilter:rt,Addable:yt}}),At={id:"events",class:"contents"};function kt(t,s,c,h,u,o){const b=p("Error"),S=p("BeforeAfterChange"),m=p("BeforeAfterOpenClose"),$=p("Search"),C=p("SearchFilter"),i=p("Addable");return a(),l("div",At,[f(b),f(S),f(m),f($),f(C),f(i)])}const Ft=g(Mt,[["render",kt]]);export{Ft as default};
@@ -0,0 +1,60 @@
1
+ import{d as u,S as i,_ as r,o,c as a,a as e,f as l,t as $,i as g,b as y,g as c,h as d,w}from"./index.js";const M=u({name:"GetSelected",data(){return{selectedSingle:null,selectedSingleValue:[],selectedMultiple:null,selectedMultipleValue:[]}},mounted(){this.selectedSingle=new i({select:this.$refs.selectedSingle}),this.selectedMultiple=new i({select:this.$refs.selectedMultiple})},methods:{getSelected(){this.selectedSingleValue=this.selectedSingle.getSelected(),this.selectedMultipleValue=this.selectedMultiple.getSelected()}}}),E={id:"getSelected",class:"content"},k=e("h2",{class:"header"},"getSelected",-1),O=e("p",null,"The getSelected method will return an array of the currently selected value strings.",-1),C=e("div",{class:"alert info"}," Whether or not its a single or multiple select, getSelected will always return an array. ",-1),G={class:"row"},T={ref:"selectedSingle"},j=e("option",{value:"value1"},"Value 1",-1),N=e("option",{value:"value2"},"Value 2",-1),B=e("option",{value:"value3"},"Value 3",-1),W=[j,N,B],I={key:0,class:"pad-t-m pad-b-m"},A=e("b",null,"Single Select Value:",-1),J={ref:"selectedMultiple",multiple:""},P=e("option",{value:"value1"},"Value 1",-1),Y=e("option",{value:"value2",selected:""},"Value 2",-1),q=e("option",{value:"value3",selected:""},"Value 3",-1),z=[P,Y,q],F={key:0,class:"pad-t-m pad-b-m"},H=e("b",null,"Multi Select Value:",-1),K=e("pre",null,[l(" "),e("code",{class:"language-javascript"},`
2
+ var select = new SlimSelect({
3
+ select: '#selectElement'
4
+ })
5
+ var values = select.getSelected() // Will return an array of strings
6
+ console.log(values)
7
+ `),l(`
8
+ `)],-1);function L(t,s,h,p,_,v){return o(),a("div",E,[k,O,C,e("div",G,[e("div",{class:"btn",onClick:s[0]||(s[0]=(...n)=>t.getSelected&&t.getSelected(...n))},"Get Selected"),e("div",null,[e("select",T,W,512),t.selectedSingleValue.length?(o(),a("div",I,[A,l(" "+$(t.selectedSingleValue),1)])):g("",!0)]),e("div",null,[e("select",J,z,512),t.selectedMultipleValue.length?(o(),a("div",F,[H,l(" "+$(t.selectedMultipleValue),1)])):g("",!0)])]),K])}const Q=r(M,[["render",L]]),R=u({name:"SetSelected",data(){return{selectedSingle:null,selectedMultiple:null}},mounted(){this.selectedSingle=new i({select:this.$refs.selectedSingle}),this.selectedMultiple=new i({select:this.$refs.selectedMultiple})},methods:{setSelected(){this.selectedSingle.open(),this.selectedSingle.setSelected("value2"),this.selectedMultiple.open(),this.selectedMultiple.setSelected(["value1","value3"]),setTimeout(()=>{this.selectedSingle.close(),this.selectedMultiple.close()},1e3)}}}),U={id:"setSelected",class:"content"},X=e("h2",{class:"header"},"setSelected",-1),Z=e("p",null,"The setSelected method will set the selected value(s) of the select.",-1),x=e("p",null,"setSelected will accept both string or array of strings.",-1),ee={class:"row"},te={ref:"selectedSingle"},se=e("option",{value:"value1"},"Value 1",-1),le=e("option",{value:"value2"},"Value 2",-1),ne=e("option",{value:"value3"},"Value 3",-1),oe=[se,le,ne],ae={ref:"selectedMultiple",multiple:""},ie=e("option",{value:"value1"},"Value 1",-1),ce=e("option",{value:"value2"},"Value 2",-1),de=e("option",{value:"value3"},"Value 3",-1),ue=[ie,ce,de],re=e("pre",null,[l(" "),e("code",{class:"language-javascript"},`
9
+ var select = new SlimSelect({
10
+ select: '#selectElement'
11
+ })
12
+ select.setSelected('value1' /* or */ ['value1', 'value3'])
13
+ console.log(select.getSelected())
14
+ `),l(`
15
+ `)],-1);function he(t,s,h,p,_,v){return o(),a("div",U,[X,Z,x,e("div",ee,[e("div",{class:"btn",onClick:s[0]||(s[0]=(...n)=>t.setSelected&&t.setSelected(...n))},"Set Selected"),e("select",te,oe,512),e("select",ae,ue,512)]),re])}const pe=r(R,[["render",he]]),_e=u({name:"GetData",data(){return{getDataOptions:null,getDataOptionsValue:[],getDataOptgroups:null,getDataOptgroupsValue:[]}},mounted(){this.getDataOptions=new i({select:this.$refs.getDataOptions}),this.getDataOptgroups=new i({select:this.$refs.getDataOptgroups})},methods:{getData(){this.getDataOptionsValue=this.getDataOptions.getData(),this.getDataOptgroupsValue=this.getDataOptgroups.getData()}}}),ve={id:"getData",class:"content"},$e=e("h2",{class:"header"},"getData",-1),ge=e("p",null,"The getData method will return an array of the full data set.",-1),Se={class:"row"},me={ref:"getDataOptions"},fe=e("option",{value:"value1"},"Value 1",-1),be=e("option",{value:"value2"},"Value 2",-1),De=e("option",{value:"value3"},"Value 3",-1),Ve=[fe,be,De],ye={key:0,class:"pad-t-m pad-b-m"},we=e("b",null,"Option Data:",-1),Me={ref:"getDataOptgroups",multiple:""},Ee=y('<optgroup label="Group 1"><option value="value1">Value 1</option><option value="value2">Value 2</option><option value="value3">Value 3</option></optgroup><optgroup label="Group 2"><option value="value4">Value 4</option><option value="value5">Value 5</option><option value="value6">Value 6</option></optgroup>',2),ke=[Ee],Oe={key:0,class:"pad-t-m pad-b-m"},Ce=e("b",null,"Optgroup Data:",-1),Ge=e("pre",null,[l(" "),e("code",{class:"language-javascript"},`
16
+ var select = new SlimSelect({
17
+ select: '#selectElement'
18
+ })
19
+ var data = select.getData() // Will return an array of options and optgroups
20
+ console.log(data)
21
+ `),l(`
22
+ `)],-1);function Te(t,s,h,p,_,v){return o(),a("div",ve,[$e,ge,e("div",Se,[e("div",{class:"btn",onClick:s[0]||(s[0]=(...n)=>t.getData&&t.getData(...n))},"Get Data"),e("div",null,[e("select",me,Ve,512),t.getDataOptionsValue.length?(o(),a("div",ye,[we,l(" "+$(t.getDataOptionsValue),1)])):g("",!0)]),e("div",null,[e("select",Me,ke,512),t.getDataOptgroupsValue.length?(o(),a("div",Oe,[Ce,l(" "+$(t.getDataOptgroupsValue),1)])):g("",!0)])]),Ge])}const je=r(_e,[["render",Te]]),Ne=u({name:"SetData",data(){return{setDataSingle:null,setDataMultiple:null}},mounted(){this.setDataSingle=new i({select:this.$refs.setDataSingle,events:{error:t=>{console.error(t)}}}),this.setDataMultiple=new i({select:this.$refs.setDataMultiple,events:{error:t=>{console.error(t)}}})},methods:{setData(){fetch("https://api.gofakeit.com/json",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"array",rowcount:10,indent:!1,fields:[{name:"text",function:"generate",params:{str:"{firstname} {lastname}"}},{name:"selected",function:"bool"}]})}).then(t=>t.json()).then(t=>{this.setDataSingle.setData(t),this.setDataMultiple.setData(t)}).catch(t=>console.error(t))}}}),Be={id:"setData",class:"content"},We=e("h2",{class:"header"},"setData",-1),Ie=e("p",null," The setData method can take in an array of objects. This will set the options of the original select and rerender slim select. ",-1),Ae=e("div",{class:"alert info"}," If you use a single select but an option is not selected it will select the first option. ",-1),Je=e("div",{class:"alert info"}," If you use a single select but pass in data with multiple selected options, the first option will be selected. ",-1),Pe={class:"alert info"},Ye={class:"row"},qe={ref:"setDataSingle"},ze={ref:"setDataMultiple",multiple:""},Fe=e("pre",null,[l(" "),e("code",{class:"language-javascript"},`
23
+ var select = new SlimSelect({
24
+ select: '#selectElement'
25
+ })
26
+
27
+ // Array of objects
28
+ select.setData([
29
+ {text: 'Value 1', value: 'value1'},
30
+ {text: 'Value 2', value: 'value2'},
31
+ {
32
+ label: 'Group 1',
33
+ options: [
34
+ {text: 'Value 3', value: 'value3'},
35
+ {text: 'Value 4', value: 'value4'},
36
+ ]
37
+ }
38
+ ])
39
+ `),l(`
40
+ `)],-1);function He(t,s,h,p,_,v){const n=c("router-link");return o(),a("div",Be,[We,Ie,Ae,Je,e("div",Pe,[l(" To get a better break down of possible data options see "),d(n,{to:"/data#types"},{default:w(()=>[l("data")]),_:1})]),e("div",Ye,[e("div",{class:"btn",onClick:s[0]||(s[0]=(...S)=>t.setData&&t.setData(...S))},"Set Data"),e("select",qe,null,512),e("select",ze,null,512)]),Fe])}const Ke=r(Ne,[["render",He]]),Le=u({name:"EnableDisable",data(){return{setEnableSingle:null,setEnableMultiple:null}},mounted(){this.setEnableSingle=new i({select:this.$refs.setEnableSingle}),this.setEnableMultiple=new i({select:this.$refs.setEnableMultiple})},methods:{setEnable(){this.setEnableSingle.enable(),this.setEnableMultiple.enable()},setDisable(){this.setEnableSingle.disable(),this.setEnableMultiple.disable()}}}),Qe={id:"enableDisable",class:"content"},Re=e("h2",{class:"header"},"enable / disable",-1),Ue=e("p",null,[l(" These methods will enable or disable the select dropdown. "),e("br"),l(" You may also set disabled on your original select and slim-select will pick that up. ")],-1),Xe={class:"row"},Ze={ref:"setEnableSingle",disabled:""},xe=e("option",{value:"value1"},"Value 1",-1),et=e("option",{value:"value2"},"Value 2",-1),tt=e("option",{value:"value3"},"Value 3",-1),st=[xe,et,tt],lt={ref:"setEnableMultiple",multiple:"",disabled:""},nt=e("option",{value:"value1"},"Value 1",-1),ot=e("option",{value:"value2"},"Value 2",-1),at=e("option",{value:"value3"},"Value 3",-1),it=[nt,ot,at],ct=e("pre",null,[l(" "),e("code",{class:"language-javascript"},`
41
+ var select = new SlimSelect({
42
+ select: '#selectElement'
43
+ })
44
+ select.enable()
45
+ // or
46
+ select.disable()
47
+ `),l(`
48
+ `)],-1);function dt(t,s,h,p,_,v){return o(),a("div",Qe,[Re,Ue,e("div",Xe,[t.setEnableSingle&&!t.setEnableSingle.settings.isEnabled?(o(),a("div",{key:0,class:"btn",onClick:s[0]||(s[0]=(...n)=>t.setEnable&&t.setEnable(...n))},"Enable")):(o(),a("div",{key:1,class:"btn",onClick:s[1]||(s[1]=(...n)=>t.setDisable&&t.setDisable(...n))},"Disable")),e("select",Ze,st,512),e("select",lt,it,512)]),ct])}const ut=r(Le,[["render",dt]]),rt=u({name:"Search",data(){return{searchSingle:null,searchMultiple:null}},mounted(){this.searchSingle=new i({select:this.$refs.searchSingle}),this.searchMultiple=new i({select:this.$refs.searchMultiple})},methods:{setSearch(){this.searchSingle.open(),this.searchSingle.search("value 2"),this.searchMultiple.open(),this.searchMultiple.search("value 2")}}}),ht={id:"search",class:"content"},pt=e("h2",{class:"header"},"search",-1),_t=e("p",null,"The search method will update the search input field and search the data against that value.",-1),vt={class:"row"},$t={ref:"searchSingle"},gt=e("option",{value:"value1"},"Value 1",-1),St=e("option",{value:"value2"},"Value 2",-1),mt=e("option",{value:"value3"},"Value 3",-1),ft=[gt,St,mt],bt={ref:"searchMultiple",multiple:""},Dt=e("option",{value:"value1"},"Value 1",-1),Vt=e("option",{value:"value2"},"Value 2",-1),yt=e("option",{value:"value3"},"Value 3",-1),wt=[Dt,Vt,yt],Mt=e("pre",null,[l(" "),e("code",{class:"language-javascript"},`
49
+ var select = new SlimSelect({
50
+ select: '#selectElement'
51
+ })
52
+ select.search('value')
53
+ `),l(`
54
+ `)],-1);function Et(t,s,h,p,_,v){return o(),a("div",ht,[pt,_t,e("div",vt,[e("div",{class:"btn",onClick:s[0]||(s[0]=(...n)=>t.setSearch&&t.setSearch(...n))},"Set Search"),e("select",$t,ft,512),e("select",bt,wt,512)]),Mt])}const kt=r(rt,[["render",Et]]),Ot=u({name:"Destroy",data(){return{destroySingle:null,destroyMultiple:null}},mounted(){this.create()},methods:{create(){this.destroySingle=new i({select:this.$refs.destroySingle}),this.destroyMultiple=new i({select:this.$refs.destroyMultiple})},destroy(){this.destroySingle.destroy(),this.destroySingle=null,this.destroyMultiple.destroy(),this.destroyMultiple=null}}}),Ct={id:"destroy",class:"content"},Gt=e("h2",{class:"header"},"destroy",-1),Tt=e("p",null,"The destroy method will remove slim-select and display your original select.",-1),jt={class:"row"},Nt={ref:"destroySingle"},Bt=e("option",{value:"value1"},"Value 1",-1),Wt=e("option",{value:"value2"},"Value 2",-1),It=e("option",{value:"value3"},"Value 3",-1),At=[Bt,Wt,It],Jt={ref:"destroyMultiple",multiple:""},Pt=e("option",{value:"value1"},"Value 1",-1),Yt=e("option",{value:"value2"},"Value 2",-1),qt=e("option",{value:"value3"},"Value 3",-1),zt=[Pt,Yt,qt],Ft=e("pre",null,[l(" "),e("code",{class:"language-javascript"},`
55
+ var select = new SlimSelect({
56
+ select: '#selectElement'
57
+ })
58
+ select.destroy()
59
+ `),l(`
60
+ `)],-1);function Ht(t,s,h,p,_,v){return o(),a("div",Ct,[Gt,Tt,e("div",jt,[t.destroySingle?(o(),a("div",{key:1,class:"btn",onClick:s[1]||(s[1]=(...n)=>t.destroy&&t.destroy(...n))},"Destroy")):(o(),a("div",{key:0,class:"btn",onClick:s[0]||(s[0]=(...n)=>t.create&&t.create(...n))},"Create")),e("select",Nt,At,512),e("select",Jt,zt,512)]),Ft])}const Kt=r(Ot,[["render",Ht]]),Lt=u({name:"Methods",components:{GetSelected:Q,SetSelected:pe,GetData:je,SetData:Ke,EnableDisable:ut,Search:kt,Destroy:Kt}}),Qt={id:"methods",class:"contents"};function Rt(t,s,h,p,_,v){const n=c("GetSelected"),S=c("SetSelected"),m=c("GetData"),f=c("SetData"),b=c("EnableDisable"),D=c("Search"),V=c("Destroy");return o(),a("div",Qt,[d(n),d(S),d(m),d(f),d(b),d(D),d(V)])}const Xt=r(Lt,[["render",Rt]]);export{Xt as default};
@@ -0,0 +1,34 @@
1
+ import{e as N,d as $,_ as O,o as V,c as I,a as n,f as L,t as R,b as M}from"./index.js";var U={exports:{}};(function(d,y){(function(w,g){d.exports=g()})(N,function(){return function w(g,j,_){var o=window,p="application/octet-stream",c=_||p,e=g,a=!j&&!_&&e,s=document.createElement("a"),k=function(t){return String(t)},i=o.Blob||o.MozBlob||o.WebKitBlob||k,m=j||"download",l,S;if(i=i.call?i.bind(o):Blob,String(this)==="true"&&(e=[e,c],c=e[0],e=e[1]),a&&a.length<2048&&(m=a.split("/").pop().split("?")[0],s.href=a,s.href.indexOf(a)!==-1)){var u=new XMLHttpRequest;return u.open("GET",a,!0),u.responseType="blob",u.onload=function(t){w(t.target.response,m,p)},setTimeout(function(){u.send()},0),u}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(e))if(e.length>1024*1024*1.999&&i!==k)e=B(e),c=e.type||p;else return navigator.msSaveBlob?navigator.msSaveBlob(B(e),m):f(e);else if(/([\x80-\xff])/.test(e)){var b=0,x=new Uint8Array(e.length),A=x.length;for(b;b<A;++b)x[b]=e.charCodeAt(b);e=new i([x],{type:c})}l=e instanceof i?e:new i([e],{type:c});function B(t){var r=t.split(/[:;,]/),h=r[1],E=r[2]=="base64"?atob:decodeURIComponent,C=E(r.pop()),T=C.length,v=0,D=new Uint8Array(T);for(v;v<T;++v)D[v]=C.charCodeAt(v);return new i([D],{type:h})}function f(t,r){if("download"in s)return s.href=t,s.setAttribute("download",m),s.className="download-js-link",s.innerHTML="downloading...",s.style.display="none",document.body.appendChild(s),setTimeout(function(){s.click(),document.body.removeChild(s),r===!0&&setTimeout(function(){o.URL.revokeObjectURL(s.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(t)&&(t="data:"+t.replace(/^data:([\w\/\-\+]+)/,p)),window.open(t)||confirm(`Displaying New Document
2
+
3
+ Use Save As... to download, then click back to return to this page.`)&&(location.href=t),!0;var h=document.createElement("iframe");document.body.appendChild(h),!r&&/^data:/.test(t)&&(t="data:"+t.replace(/^data:([\w\/\-\+]+)/,p)),h.src=t,setTimeout(function(){document.body.removeChild(h)},333)}if(navigator.msSaveBlob)return navigator.msSaveBlob(l,m);if(o.URL)f(o.URL.createObjectURL(l),!0);else{if(typeof l=="string"||l.constructor===k)try{return f("data:"+c+";base64,"+o.btoa(l))}catch{return f("data:"+c+","+encodeURIComponent(l))}S=new FileReader,S.onload=function(t){f(this.result)},S.readAsDataURL(l)}return!0}})})(U);const H=U.exports,G="slim-select",q="Slim advanced select dropdown",z="1.27.1",J="Brian Voelker <brian@webiswhatido.com> (http://webiswhatido.com)",K="https://slimselectjs.com",W="MIT",X={url:"https://github.com/brianvoe/slim-select/issues"},F="dist/slimselect.min.js",P="dist/slimselect.esm.js",Q="dist/slimselect.min.js",Y="dist/index.d.ts",Z="dist/index.d.ts",ee="dist/slimselect.min.css",te="src/slim-select/slimselect.scss",se={type:"git",url:"git+https://github.com/brianvoe/slim-select.git"},ne=["select","vanilla","dropdown","search","multiselect"],oe={jestinit:"ts-jest config:init",dev:"vite --port=1111",format:'prettier --write --cache --parser typescript "src/**/*.ts"',build:"npm run build:clean && npm run build:docs && npm run build:library","build:clean":"rimraf ./dist/*","build:docs":"vite build","build:library":"npm run build:library:js && npm run build:library:css","build:library:js":"cd src/slim-select && rollup --config ./rollup.config.mjs && cd ../../","build:library:css":"cd src/slim-select && sass ./slimselect.scss ../../dist/slimselect.css --style=compressed && cd ../../",test:"jest"},ie={"@jest/globals":"^29.3.1","@rollup/plugin-typescript":"^9.0.2","@types/downloadjs":"^1.4.3","@vitejs/plugin-vue":"^3.2.0",clipboard:"^2.0.11",downloadjs:"^1.4.7",jest:"^29.3.1","jest-environment-jsdom":"^29.3.1",prettier:"^2.7.1",prismjs:"^1.29.0",rimraf:"^3.0.2",rollup:"^2.79.1","rollup-plugin-terser":"^7.0.2",sass:"^1.56.1","ts-jest":"^29.0.3",tslib:"^2.4.1",typescript:"^4.9.3",vite:"^3.2.4",vue:"^3.2.45","vue-router":"^4.1.6","vue-tsc":"^1.0.9",vuex:"^4.0.2"},le={name:G,description:q,version:z,author:J,homepage:K,license:W,bugs:X,main:F,module:P,unpkg:Q,types:Y,typings:Z,style:ee,sass:te,repository:se,keywords:ne,scripts:oe,devDependencies:ie},ce=$({name:"Install",data:()=>({version:le.version}),methods:{downloadLink(){H(`https://cdnjs.cloudflare.com/ajax/libs/slim-select/${this.version}/slimselect.min.js`)}}}),ae={id:"install",class:"contents"},re=M(`<div id="npm" class="content"><h2>Npm</h2><p>Most common usage is npm</p><pre class="install-code"> <code class="language-bash">
4
+ npm install slim-select
5
+ </code>
6
+ </pre><pre class="example-code"> <code class="language-javascript">
7
+ import SlimSelect from &#39;slim-select&#39;
8
+
9
+ new SlimSelect({
10
+ select: &#39;#selectElement&#39;
11
+ })
12
+ </code>
13
+ </pre></div>`,1),de={id:"cdn",class:"content"},pe=n("h2",null,"Cdn",-1),me=n("p",null,"Cdn has a url link you can grab.",-1),ue=n("div",{class:"alert info"},"New releases may be delayed until the next time its indexed",-1),be={class:"install-code"},fe={class:"language-html"},he={id:"download",class:"content"},ve=n("h2",null,"Download",-1),ge=n("p",null,"Download the latest minified version of slim select",-1);function ye(d,y,w,g,j,_){return V(),I("div",ae,[re,n("div",de,[pe,me,ue,n("pre",be,[L(" "),n("code",fe,`
14
+ <html>
15
+ <head>
16
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/slim-select/`+R(d.version)+`/slimselect.min.js"><\/script>
17
+ <link href="https://cdnjs.cloudflare.com/ajax/libs/slim-select/`+R(d.version)+`/slimselect.min.css" rel="stylesheet"></link>
18
+
19
+ <script>
20
+ new SlimSelect({
21
+ select: '#selectElement'
22
+ })
23
+ <script>
24
+ </head>
25
+ <body>
26
+ <select id="selectElement">
27
+ <option>Option 1</option>
28
+ <option>Option 2</option>
29
+ <option>Option 3</option>
30
+ </select>
31
+ </body>
32
+ </html>
33
+ `,1),L(`
34
+ `)])]),n("div",he,[ve,ge,n("div",{class:"btn",onClick:y[0]||(y[0]=o=>d.downloadLink())},"Click Here To Download")])])}const je=O(ce,[["render",ye]]);export{je as default};