slim-select 2.0.1 → 2.1.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 (85) hide show
  1. package/dist/{helper.d.ts → helpers.d.ts} +0 -0
  2. package/dist/index.d.ts +1 -7
  3. package/dist/render.d.ts +1 -1
  4. package/dist/settings.d.ts +1 -1
  5. package/dist/slimselect.cjs.js +1589 -2
  6. package/dist/slimselect.css +1 -1
  7. package/dist/slimselect.css.map +1 -1
  8. package/dist/slimselect.es.js +1587 -2
  9. package/dist/slimselect.global.js +1592 -2
  10. package/dist/slimselect.js +1595 -2
  11. package/dist/slimselect.min.js +1 -0
  12. package/dist/slimselect.umd.js +1595 -2
  13. package/dist/slimselect.umd.min.js +1 -0
  14. package/dist/store.d.ts +5 -5
  15. package/docs/404.html +18 -12
  16. package/docs/assets/home.js +1 -1
  17. package/docs/assets/index.css +1 -1
  18. package/docs/assets/index.js +7 -7
  19. package/docs/assets/index3.js +25 -16
  20. package/docs/assets/index5.js +147 -0
  21. package/docs/assets/install.js +6 -6
  22. package/docs/index.html +20 -2
  23. package/index.html +20 -2
  24. package/package.json +17 -6
  25. package/public/404.html +18 -12
  26. package/src/docs/app.vue +10 -4
  27. package/{docs → src/docs/assets}/images/check-mark.svg +0 -0
  28. package/{docs → src/docs/assets}/images/chrome.svg +0 -0
  29. package/{docs → src/docs/assets}/images/firefox.svg +0 -0
  30. package/{docs → src/docs/assets}/images/github.png +0 -0
  31. package/{docs → src/docs/assets}/images/ie.svg +0 -0
  32. package/{docs → src/docs/assets}/images/npm.png +0 -0
  33. package/{docs → src/docs/assets}/images/opera.svg +0 -0
  34. package/{docs → src/docs/assets}/images/safari.svg +0 -0
  35. package/src/docs/assets/scss/_variables.scss +1 -1
  36. package/src/docs/assets/scss/misc.scss +7 -0
  37. package/src/docs/env.d.ts +1 -0
  38. package/src/docs/pages/events/addable.vue +22 -6
  39. package/src/docs/pages/events/before_after_change.vue +15 -1
  40. package/src/docs/pages/events/search.vue +2 -1
  41. package/src/docs/pages/frameworks/index.vue +18 -0
  42. package/src/docs/pages/frameworks/vue.vue +405 -0
  43. package/src/docs/pages/home.vue +19 -19
  44. package/src/docs/pages/install.vue +27 -6
  45. package/src/docs/pages/methods/get_data.vue +2 -1
  46. package/src/docs/pages/methods/open_close.vue +1 -1
  47. package/src/docs/router.ts +5 -0
  48. package/src/slim-select/{helper.ts → helpers.ts} +0 -0
  49. package/src/slim-select/index.ts +2 -12
  50. package/src/slim-select/render.ts +84 -26
  51. package/src/slim-select/rollup.config.mjs +117 -30
  52. package/src/slim-select/select.ts +15 -6
  53. package/src/slim-select/settings.ts +1 -1
  54. package/src/slim-select/slimselect.scss +7 -0
  55. package/src/slim-select/store.ts +1 -1
  56. package/src/vue/dist/slimselectvue.es.js +1655 -0
  57. package/src/vue/dist/slimselectvue.global.js +1658 -0
  58. package/src/vue/dist/slimselectvue.ssr.js +1657 -0
  59. package/src/vue/hello.ts +5 -0
  60. package/src/vue/package.json +27 -0
  61. package/src/vue/rollup.config.mjs +44 -0
  62. package/src/vue/slimselect.vue +59 -43
  63. package/src/vue/tsconfig.json +14 -0
  64. package/dist/slimselect.cjs.js.map +0 -1
  65. package/dist/slimselect.es.js.map +0 -1
  66. package/dist/slimselect.global.js.map +0 -1
  67. package/dist/slimselect.js.map +0 -1
  68. package/dist/slimselect.umd.js.map +0 -1
  69. package/public/images/check-mark.svg +0 -6
  70. package/public/images/chrome.svg +0 -22
  71. package/public/images/firefox.svg +0 -58
  72. package/public/images/github.png +0 -0
  73. package/public/images/ie.svg +0 -11
  74. package/public/images/npm.png +0 -0
  75. package/public/images/opera.svg +0 -15
  76. package/public/images/safari.svg +0 -22
  77. package/public/index.html +0 -28
  78. package/src/docs/images/check-mark.svg +0 -6
  79. package/src/docs/images/chrome.svg +0 -22
  80. package/src/docs/images/firefox.svg +0 -58
  81. package/src/docs/images/github.png +0 -0
  82. package/src/docs/images/ie.svg +0 -11
  83. package/src/docs/images/npm.png +0 -0
  84. package/src/docs/images/opera.svg +0 -15
  85. package/src/docs/images/safari.svg +0 -22
@@ -1,4 +1,4 @@
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"},`
1
+ import{d as _,S as r,_ as g,o as a,c as l,f as s,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,[s(" "),e("code",{class:"language-javascript"},`
2
2
  var select = new SlimSelect({
3
3
  select: '#selectElement',
4
4
  events: {
@@ -7,8 +7,8 @@ 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 a
7
7
  }
8
8
  }
9
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"},`
10
+ `),s(`
11
+ `)],-1);function R(t,n,c,h,u,o){return a(),l("div",M,[A,k,j,t.errMsg!==""?(a(),l("div",F,[T,s(" "+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,settings:{allowDeselect:!0},events:{beforeChange:(t,n)=>(this.beforeChangeSingle=n,!0)}}),new r({select:this.$refs.beforeChangeMultiple,events:{beforeChange:(t,n)=>(this.beforeChangeMultiple=n,!0)}}),new r({select:this.$refs.afterChangeSingle,settings:{allowDeselect:!0},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=e("div",{class:"alert info"}," Be sure to return true to allow for the change to happen. False or nothing to cancel change. ",-1),G={key:0},K={ref:"beforeChangeSingle"},Q=e("option",{"data-placeholder":"true"},"Select Option",-1),W=e("option",{value:"value1"},"Value 1",-1),X=e("option",{value:"value2"},"Value 2",-1),Y=e("option",{value:"value3"},"Value 3",-1),Z=[Q,W,X,Y],ee=e("br",null,null,-1),te={key:1},ne={ref:"beforeChangeMultiple",multiple:""},se=e("option",{value:"value1",selected:""},"Value 1",-1),oe=e("option",{value:"value2"},"Value 2",-1),ae=e("option",{value:"value3"},"Value 3",-1),le=[se,oe,ae],re=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
12
12
  new SlimSelect({
13
13
  select: '#selectElement',
14
14
  events: {
@@ -18,8 +18,8 @@ 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 a
18
18
  }
19
19
  }
20
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"},`
21
+ `),s(`
22
+ `)],-1),ie={id:"afterChange",class:"content"},ce=e("h2",{class:"header"},"afterChange",-1),he=e("p",null,"afterChange will trigger a callback after the value of the select dropdown has changed.",-1),ue={key:0},de={ref:"afterChangeSingle"},_e=e("option",{"data-placeholder":"true"},"Select Option",-1),pe=e("option",{value:"value1"},"Value 1",-1),fe=e("option",{value:"value2"},"Value 2",-1),ge=e("option",{value:"value3"},"Value 3",-1),ve=[_e,pe,fe,ge],me=e("br",null,null,-1),$e={key:1},Se={ref:"afterChangeMultiple",multiple:""},be=e("option",{value:"value1",selected:""},"Value 1",-1),Ce=e("option",{value:"value2"},"Value 2",-1),we=e("option",{value:"value3"},"Value 3",-1),Oe=[be,Ce,we],Ve=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
23
23
  new SlimSelect({
24
24
  select: '#selectElement',
25
25
  events: {
@@ -28,8 +28,8 @@ 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 a
28
28
  }
29
29
  }
30
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"},`
31
+ `),s(`
32
+ `)],-1);function ye(t,n,c,h,u,o){return a(),l(O,null,[e("div",J,[U,z,q,t.beforeChangeSingle?(a(),l("div",G,[e("strong",null,"Before change: "+d(t.beforeChangeSingle),1)])):v("",!0),e("select",K,Z,512),ee,t.beforeChangeMultiple?(a(),l("div",te,[e("strong",null,"Before change: "+d(t.beforeChangeMultiple),1)])):v("",!0),e("select",ne,le,512),re]),e("div",ie,[ce,he,t.afterChangeSingle?(a(),l("div",ue,[e("strong",null,"After change: "+d(t.afterChangeSingle),1)])):v("",!0),e("select",de,ve,512),me,t.afterChangeMultiple?(a(),l("div",$e,[e("strong",null,"After change: "+d(t.afterChangeMultiple),1)])):v("",!0),e("select",Se,Oe,512),Ve])],64)}const Me=g(I,[["render",ye]]),Ae=_({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,n){t==="single"?this.singleState=n:this.multipleState=n,setTimeout(()=>{t==="single"?this.singleState="":this.multipleState=""},1e3)}}}),ke={id:"open",class:"content"},je=e("h2",{class:"header"},"beforeOpen / afterOpen / beforeClose / afterClose",-1),Fe=e("p",null," The beforeOpen, afterOpen, beforeClose, and afterClose events will fire before and after the select is opened and closed. ",-1),Te={class:"row"},Ee={ref:"beforeAfterOpenCloseSingle"},Be=e("option",{value:"value1"},"Value 1",-1),xe=e("option",{value:"value2"},"Value 2",-1),Le=e("option",{value:"value3"},"Value 3",-1),Ne=[Be,xe,Le],De={ref:"beforeAfterOpenCloseMultiple",multiple:""},Pe=e("option",{value:"value1"},"Value 1",-1),Re=e("option",{value:"value2"},"Value 2",-1),He=e("option",{value:"value3"},"Value 3",-1),Ie=[Pe,Re,He],Je=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
33
33
  var select = new SlimSelect({
34
34
  select: '#selectElement',
35
35
  events: {
@@ -47,8 +47,8 @@ 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 a
47
47
  },
48
48
  },
49
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"},`
50
+ `),s(`
51
+ `)],-1);function Ue(t,n,c,h,u,o){return a(),l("div",ke,[je,Fe,e("div",Te,[e("div",null,[e("div",null,"State: "+d(t.singleState),1),e("select",Ee,Ne,512)]),e("div",null,[e("div",null,"State: "+d(t.multipleState),1),e("select",De,Ie,512)])]),Je])}const ze=g(Ae,[["render",Ue]]),qe={id:"search",class:"content"},Ge=e("h2",{class:"header"},"search",-1),Ke=e("p",null,[s(" Slim select allows you to syncronize result values from your promise response."),e("br"),s(" Call callback() method with slimselect data, false or string with specific string. ")],-1),Qe={class:"row"},We=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
52
52
  new SlimSelect({
53
53
  select: '#selectElement',
54
54
  events: {
@@ -90,8 +90,8 @@ 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 a
90
90
  }
91
91
  }
92
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"},`
93
+ `),s(`
94
+ `)],-1),Xe=_({__name:"search",setup(t){let n=[],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=>{n=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,S){return new Promise((b,m)=>{if(o.length<2)return m("Search must be at least 2 characters");const $=n.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(()=>{b(C)},300)})}return(o,S)=>(a(),l("div",qe,[Ge,Ke,e("div",Qe,[e("select",{ref_key:"searchSingle",ref:c},null,512),e("select",{ref_key:"searchMultiple",ref:h,multiple:""},null,512)]),We]))}}),Ye=_({name:"SearchFilter",mounted(){new r({select:this.$refs.searchFilter,events:{searchFilter:(t,n)=>t.text.substr(0,n.length)===n}})}}),Ze={id:"searchFilter",class:"content"},et=e("h2",{class:"header"},"searchFilter",-1),tt=e("p",null,"searchFilter event is used to replace the default matching algorithm.",-1),nt=e("p",null,[s("See Data for the proper object interface of "),e("em",null,"option"),s(".")],-1),st={ref:"searchFilter"},ot=e("option",{value:"apple"},"Apple",-1),at=e("option",{value:"orange"},"Orange",-1),lt=e("option",{value:"pineapple"},"Pineapple",-1),rt=[ot,at,lt],it=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
95
95
  new SlimSelect({
96
96
  select: '#selectElement',
97
97
  events: {
@@ -101,8 +101,8 @@ 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 a
101
101
  }
102
102
  }
103
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"},`
104
+ `),s(`
105
+ `)],-1);function ct(t,n,c,h,u,o){return a(),l("div",Ze,[et,tt,nt,e("select",st,rt,512),it])}const ht=g(Ye,[["render",ct]]),ut=_({name:"Addable",mounted(){new r({select:this.$refs.addableSingle,events:{addable:t=>({text:t,value:t.toLowerCase()})}}),new r({select:this.$refs.addableMultiple,events:{addable:t=>new Promise(n=>{setTimeout(()=>{n({text:t,value:t})},100)})}})}}),dt={id:"addable",class:"content"},_t=e("h2",{class:"header"},"addable",-1),pt=e("p",null,"Slim select has the ability to dynamically add options via the search input field",-1),ft=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),gt={class:"row"},vt={ref:"addableSingle"},mt=e("option",{value:"value1"},"Value 1",-1),$t=e("option",{value:"value2"},"Value 2",-1),St=e("option",{value:"value3"},"Value 3",-1),bt=[mt,$t,St],Ct={ref:"addableMultiple",multiple:""},wt=e("option",{value:"value1"},"Value 1",-1),Ot=e("option",{value:"value2"},"Value 2",-1),Vt=e("option",{value:"value3"},"Value 3",-1),yt=[wt,Ot,Vt],Mt=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
106
106
  new SlimSelect({
107
107
  select: '#selectElement',
108
108
 
@@ -114,13 +114,22 @@ 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 a
114
114
  // Return the value string
115
115
  return value // Optional - value alteration // ex: value.toLowerCase()
116
116
 
117
- // Optional - Return a valid data object. See methods/setData for list of valid options
117
+ // Optional - Return a valid data object.
118
+ // See methods/setData for list of valid options
118
119
  return {
119
120
  text: value,
120
121
  value: value.toLowerCase()
121
122
  }
123
+
124
+ // Optional - Return a promise with either a string or data object
125
+ return new Promise((resolve) => {
126
+ resolve({
127
+ text: value,
128
+ value: value,
129
+ })
130
+ })
122
131
  }
123
132
  }
124
133
  })
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};
134
+ `),s(`
135
+ `)],-1);function At(t,n,c,h,u,o){return a(),l("div",dt,[_t,pt,ft,e("div",gt,[e("select",vt,bt,512),e("select",Ct,yt,512)]),Mt])}const kt=g(ut,[["render",At]]),jt=_({name:"Events",components:{Error:H,BeforeAfterChange:Me,BeforeAfterOpenClose:ze,Search:Xe,SearchFilter:ht,Addable:kt}}),Ft={id:"events",class:"contents"};function Tt(t,n,c,h,u,o){const S=p("Error"),b=p("BeforeAfterChange"),m=p("BeforeAfterOpenClose"),$=p("Search"),C=p("SearchFilter"),i=p("Addable");return a(),l("div",Ft,[f(S),f(b),f(m),f($),f(C),f(i)])}const Bt=g(jt,[["render",Tt]]);export{Bt as default};
@@ -0,0 +1,147 @@
1
+ import{d as m,S as O,_,o as c,c as d,l as y,g,a as e,h as s,w as i,f as n,t as r,i as C,F as S,r as f}from"./index.js";const b=m({name:"SlimSelect",props:{data:{type:Array},settings:{type:Object},events:{type:Object}},data(){return{slim:null}},mounted(){let t={select:this.$refs.slim};this.data&&(t.data=this.data),this.settings&&(t.settings=this.settings),this.events&&(t.events=this.events),this.slim=new O(t)},beforeUnmount(){this.slim&&this.slim.destroy()},watch:{data:{handler:function(t){this.slim&&this.slim.setData(t)},deep:!0}},methods:{getSlimSelect(){return this.slim}}}),w={ref:"slim"};function D(t,o,p,u,h,v){return c(),d("select",w,[y(t.$slots,"default")],512)}const $=_(b,[["render",D]]),V=m({name:"Vue",components:{SlimSelect:$},data(){return{settings:{showSearch:!1},data:[{value:"value1",text:"Value 1"},{value:"value2",text:"Value 2"},{value:"value3",text:"Value 3"}],dynamicData:[],afterChangeData:[],events:{afterChange:this.afterChange}}},mounted(){},methods:{changeData(){this.$refs.dataSingle.getSlimSelect().open(),this.$refs.dataMultiple.getSlimSelect().open(),setTimeout(()=>{this.data=[{value:"value4",text:"Value 4"},{value:"value5",text:"Value 5"},{value:"value6",text:"Value 6"}]},500)},afterChange(t){this.afterChangeData=t},randomDynamicData(){fetch("https://api.gofakeit.com/json",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"array",rowcount:20,indent:!1,fields:[{name:"key",function:"password",params:{lower:!0,upper:!0,numeric:!0,special:!1,space:!1,length:10}},{name:"first_name",function:"firstname",params:{}},{name:"last_name",function:"lastname",params:{}},{name:"selected",function:"number",params:{min:1,max:10}}]})}).then(t=>t.json()).then(t=>{this.dynamicData=t.map(o=>({id:o.id,text:`${o.first_name} ${o.last_name}`,value:`${o.first_name} ${o.last_name}`,selected:o.selected>=8}))})}}}),j={id:"vue",class:"content"},x=e("h2",{class:"header"},"Vue",-1),k=e("h3",null,"Install",-1),M=e("p",null,"The vue component is in a sub package under SlimSelect",-1),T=e("pre",null,[n(" "),e("code",{class:"language-bash"},`
2
+ npm install @slim-select/vue
3
+ `),n(`
4
+ `)],-1),N=e("br",null,null,-1),B=e("h3",null,"Simple example",-1),E={class:"row"},F=e("option",{value:"1"},"Option 1",-1),R=e("option",{value:"2"},"Option 2",-1),A=e("option",{value:"3"},"Option 3",-1),I=e("option",{value:"1"},"Option 1",-1),J=e("option",{value:"2"},"Option 2",-1),L=e("option",{value:"3"},"Option 3",-1),P=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
5
+ import { defineComponent } from 'vue'
6
+ import SlimSelect from '@slim-select/vue'
7
+
8
+ export default defineComponent({
9
+ components: {
10
+ SlimSelect,
11
+ },
12
+ })
13
+ `),n(`
14
+ `)],-1),U=e("pre",null,[n(" "),e("code",{class:"language-html"},`
15
+ <SlimSelect>
16
+ <option value="1">Option 1</option>
17
+ <option value="2">Option 2</option>
18
+ <option value="3">Option 3</option>
19
+ </SlimSelect>
20
+
21
+ <SlimSelect multiple>
22
+ <option value="1">Option 1</option>
23
+ <option value="2">Option 2</option>
24
+ <option value="3">Option 3</option>
25
+ </SlimSelect>
26
+ `),n(`
27
+ `)],-1),Y=e("br",null,null,-1),q=e("div",{class:"separator"},null,-1),z=e("br",null,null,-1),G=e("h3",null,"Settings",-1),H=e("p",null," Settings just like its passed as an object in normal SlimSelct will also be passed as an object to the component prop ",-1),K={class:"row"},Q=e("option",{value:"1"},"Option 1",-1),W=e("option",{value:"2"},"Option 2",-1),X=e("option",{value:"3"},"Option 3",-1),Z=e("option",{value:"1"},"Option 1",-1),ee=e("option",{value:"2"},"Option 2",-1),te=e("option",{value:"3"},"Option 3",-1),ne=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
28
+ import { defineComponent } from 'vue'
29
+ import SlimSelect from '@slim-select/vue'
30
+
31
+ export default defineComponent({
32
+ components: {
33
+ SlimSelect,
34
+ },
35
+ data() {
36
+ return {
37
+ settings: {
38
+ showSearch: false,
39
+ }
40
+ }
41
+ },
42
+ })
43
+ `),n(`
44
+ `)],-1),oe=e("pre",null,[n(" "),e("code",{class:"language-html"},`
45
+ <SlimSelect :settings="settings">
46
+ <option value="1">Option 1</option>
47
+ <option value="2">Option 2</option>
48
+ <option value="3">Option 3</option>
49
+ </SlimSelect>
50
+
51
+ <SlimSelect :settings="settings" multiple>
52
+ <option value="1">Option 1</option>
53
+ <option value="2">Option 2</option>
54
+ <option value="3">Option 3</option>
55
+ </SlimSelect>
56
+ `),n(`
57
+ `)],-1),le=e("br",null,null,-1),ae=e("div",{class:"separator"},null,-1),se=e("br",null,null,-1),ie=e("h3",null,"Data",-1),ce=e("p",null," Data just like its passed as an array in normal SlimSelct will also be passed as an array to the component prop. ",-1),de=e("div",{class:"alert info"}," You may pass data as a prop if you would like. But you can also have reactive options that when options change the select will update as well. See Reactivity below for more info. ",-1),pe={class:"row"},ue=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
58
+ import { defineComponent } from 'vue'
59
+ import SlimSelect from '@slim-select/vue'
60
+
61
+ export default defineComponent({
62
+ components: {
63
+ SlimSelect,
64
+ },
65
+ data() {
66
+ return {
67
+ data: [
68
+ { value: 'value1', text: 'Value 1' },
69
+ { value: 'value2', text: 'Value 2' },
70
+ { value: 'value3', text: 'Value 3' },
71
+ ],
72
+ }
73
+ },
74
+ })
75
+ `),n(`
76
+ `)],-1),re=e("pre",null,[n(" "),e("code",{class:"language-html"},`
77
+ <SlimSelect :data="data" />
78
+
79
+ <SlimSelect :data="data" multiple />
80
+ `),n(`
81
+ `)],-1),me=e("br",null,null,-1),_e=e("div",{class:"separator"},null,-1),he=e("br",null,null,-1),ve=e("h3",null,"Events",-1),Se=e("p",null," Events just like its passed as an object in normal SlimSelct will also be passed as an object to the component prop. ",-1),fe={key:0},ge=e("strong",null,"afterChange:",-1),Oe={class:"row"},ye=e("option",{value:"1"},"Option 1",-1),Ce=e("option",{value:"2"},"Option 2",-1),be=e("option",{value:"3"},"Option 3",-1),we=e("option",{value:"1"},"Option 1",-1),De=e("option",{value:"2"},"Option 2",-1),$e=e("option",{value:"3"},"Option 3",-1),Ve=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
82
+ import { defineComponent } from 'vue'
83
+ import SlimSelect from '@slim-select/vue'
84
+
85
+ export default defineComponent({
86
+ components: {
87
+ SlimSelect,
88
+ },
89
+ data() {
90
+ return {
91
+ data: [],
92
+ }
93
+ },
94
+ methods: {
95
+ afterChange(newVal) {
96
+ console.log(newVal)
97
+ },
98
+ },
99
+ })
100
+ `),n(`
101
+ `)],-1),je=e("pre",null,[n(" "),e("code",{class:"language-html"},`
102
+ <SlimSelect :events="events">
103
+ <option value="1">Option 1</option>
104
+ <option value="2">Option 2</option>
105
+ <option value="3">Option 3</option>
106
+ </SlimSelect>
107
+
108
+ <SlimSelect :events="events" multiple>
109
+ <option value="1">Option 1</option>
110
+ <option value="2">Option 2</option>
111
+ <option value="3">Option 3</option>
112
+ </SlimSelect>
113
+ `),n(`
114
+ `)],-1),xe=e("br",null,null,-1),ke=e("div",{class:"separator"},null,-1),Me=e("br",null,null,-1),Te=e("h3",null,"Reactivity",-1),Ne=e("p",null," Slim select will look out for any options changes that happen to the select options and SlimSelect will update accordingly. This is done via mutation observers. ",-1),Be={class:"row"},Ee=["value","selected"],Fe=["value","selected"],Re=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
115
+ import { defineComponent } from 'vue'
116
+ import SlimSelect from '@slim-select/vue'
117
+
118
+ export default defineComponent({
119
+ components: {
120
+ SlimSelect,
121
+ },
122
+ data() {
123
+ return {
124
+ dynamicData: []
125
+ }
126
+ },
127
+ methods: {
128
+ changeData() {
129
+ this.dynamicData = [
130
+ { id: 1, value: 1, text: 'Option 1', selected: true },
131
+ { id: 2, value: 2, text: 'Option 2', selected: false },
132
+ { id: 3, value: 3, text: 'Option 3', selected: false },
133
+ ]
134
+ },
135
+ },
136
+ })
137
+ `),n(`
138
+ `)],-1),Ae=e("pre",null,[n(" "),e("code",{class:"language-html"},`
139
+ <SlimSelect :events="events">
140
+ <option v-for="d in dynamicData" :key="d.id" :value="d.value" :selected="d.selected">{{ d.text }}</option>
141
+ </SlimSelect>
142
+
143
+ <SlimSelect :events="events" multiple>
144
+ <option v-for="d in dynamicData" :value="d.value" :selected="d.selected">{{ d.text }}</option>
145
+ </SlimSelect>
146
+ `),n(`
147
+ `)],-1);function Ie(t,o,p,u,h,v){const l=g("SlimSelect");return c(),d("div",j,[x,k,M,T,N,B,e("div",E,[s(l,null,{default:i(()=>[F,R,A]),_:1}),s(l,{multiple:""},{default:i(()=>[I,J,L]),_:1})]),P,U,Y,q,z,G,H,e("div",K,[s(l,{settings:t.settings},{default:i(()=>[Q,W,X]),_:1},8,["settings"]),s(l,{settings:t.settings,multiple:""},{default:i(()=>[Z,ee,te]),_:1},8,["settings"])]),ne,oe,le,ae,se,ie,ce,de,e("div",pe,[e("div",{class:"btn info",onClick:o[0]||(o[0]=(...a)=>t.changeData&&t.changeData(...a))},"Change data"),s(l,{ref:"dataSingle",data:t.data},null,8,["data"]),s(l,{ref:"dataMultiple",data:t.data,multiple:""},null,8,["data"])]),ue,re,me,_e,he,ve,Se,t.afterChangeData.length?(c(),d("div",fe,[ge,n(" "+r(t.afterChangeData),1)])):C("",!0),e("div",Oe,[s(l,{events:t.events},{default:i(()=>[ye,Ce,be]),_:1},8,["events"]),s(l,{events:t.events,multiple:""},{default:i(()=>[we,De,$e]),_:1},8,["events"])]),Ve,je,xe,ke,Me,Te,Ne,e("div",Be,[e("div",{class:"btn info",onClick:o[1]||(o[1]=(...a)=>t.randomDynamicData&&t.randomDynamicData(...a))},"Change data"),s(l,{ref:"randomDynamic"},{default:i(()=>[(c(!0),d(S,null,f(t.dynamicData,a=>(c(),d("option",{key:a.id,value:a.value,selected:a.selected},r(a.text),9,Ee))),128))]),_:1},512),s(l,{multiple:""},{default:i(()=>[(c(!0),d(S,null,f(t.dynamicData,a=>(c(),d("option",{value:a.value,selected:a.selected},r(a.text),9,Fe))),256))]),_:1})]),Re,Ae])}const Je=_(V,[["render",Ie]]),Le=m({name:"Events",components:{Vue:Je}}),Pe={id:"frameworks",class:"contents"};function Ue(t,o,p,u,h,v){const l=g("Vue");return c(),d("div",Pe,[s(l)])}const qe=_(Le,[["render",Ue]]);export{qe as default};
@@ -1,6 +1,6 @@
1
- import{e as N,d as $,_ as O,o as V,c as I,a as n,f as B,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=C(e),c=e.type||p;else return navigator.msSaveBlob?navigator.msSaveBlob(C(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 C(t){var r=t.split(/[:;,]/),h=r[1],E=r[2]=="base64"?atob:decodeURIComponent,T=E(r.pop()),D=T.length,v=0,L=new Uint8Array(D);for(v;v<D;++v)L[v]=T.charCodeAt(v);return new i([L],{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
1
+ import{e as M,d as $,_ as I,o as O,c as V,a as o,f as B,t as E,b as L}from"./index.js";var R={exports:{}};(function(d,w){(function(y,v){d.exports=v()})(M,function(){return function y(v,j,k){var n=window,p="application/octet-stream",r=k||p,e=v,c=!j&&!k&&e,t=document.createElement("a"),_=function(s){return String(s)},i=n.Blob||n.MozBlob||n.WebKitBlob||_,m=j||"download",l,S;if(i=i.call?i.bind(n):Blob,String(this)==="true"&&(e=[e,r],r=e[0],e=e[1]),c&&c.length<2048&&(m=c.split("/").pop().split("?")[0],t.href=c,t.href.indexOf(c)!==-1)){var u=new XMLHttpRequest;return u.open("GET",c,!0),u.responseType="blob",u.onload=function(s){y(s.target.response,m,p)},setTimeout(function(){u.send()},0),u}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(e))if(e.length>1024*1024*1.999&&i!==_)e=x(e),r=e.type||p;else return navigator.msSaveBlob?navigator.msSaveBlob(x(e),m):f(e);else if(/([\x80-\xff])/.test(e)){var b=0,C=new Uint8Array(e.length),N=C.length;for(b;b<N;++b)C[b]=e.charCodeAt(b);e=new i([C],{type:r})}l=e instanceof i?e:new i([e],{type:r});function x(s){var a=s.split(/[:;,]/),h=a[1],A=a[2]=="base64"?atob:decodeURIComponent,D=A(a.pop()),U=D.length,g=0,T=new Uint8Array(U);for(g;g<U;++g)T[g]=D.charCodeAt(g);return new i([T],{type:h})}function f(s,a){if("download"in t)return t.href=s,t.setAttribute("download",m),t.className="download-js-link",t.innerHTML="downloading...",t.style.display="none",document.body.appendChild(t),setTimeout(function(){t.click(),document.body.removeChild(t),a===!0&&setTimeout(function(){n.URL.revokeObjectURL(t.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(s)&&(s="data:"+s.replace(/^data:([\w\/\-\+]+)/,p)),window.open(s)||confirm(`Displaying New Document
2
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="2.0.0",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.js",P="dist/slimselect.es.js",Q="dist/slimselect.js",Y="dist/index.d.ts",Z="dist/index.d.ts",ee="dist/slimselect.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">
3
+ Use Save As... to download, then click back to return to this page.`)&&(location.href=s),!0;var h=document.createElement("iframe");document.body.appendChild(h),!a&&/^data:/.test(s)&&(s="data:"+s.replace(/^data:([\w\/\-\+]+)/,p)),h.src=s,setTimeout(function(){document.body.removeChild(h)},333)}if(navigator.msSaveBlob)return navigator.msSaveBlob(l,m);if(n.URL)f(n.URL.createObjectURL(l),!0);else{if(typeof l=="string"||l.constructor===_)try{return f("data:"+r+";base64,"+n.btoa(l))}catch{return f("data:"+r+","+encodeURIComponent(l))}S=new FileReader,S.onload=function(s){f(this.result)},S.readAsDataURL(l)}return!0}})})(R);const H=R.exports,G="slim-select",J="Slim advanced select dropdown",q="2.1.0",z="Brian Voelker <brian@webiswhatido.com> (http://webiswhatido.com)",F="https://slimselectjs.com",K="MIT",W={url:"https://github.com/brianvoe/slim-select/issues"},X="dist/slimselect.ssr.js",P="dist/slimselect.umd.js",Q="dist/slimselect.es.js",Y="dist/slimselect.umd.min.js",Z="dist/index.d.ts",ee="dist/index.d.ts",se="dist/slimselect.css",te="src/slim-select/slimselect.scss",ne=["src/vue"],oe={type:"git",url:"git+https://github.com/brianvoe/slim-select.git"},ie=["select","vanilla","dropdown","search","multiselect"],le={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 && npm run build:frameworks","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 ../../","build:frameworks":"npm run build --workspaces",test:"jest"},re={"@jest/globals":"^29.3.1","@rollup/plugin-babel":"^6.0.2","@rollup/plugin-commonjs":"^23.0.2","@rollup/plugin-node-resolve":"^15.0.1","@rollup/plugin-terser":"^0.1.0","@rollup/plugin-typescript":"^9.0.2","@slim-select/vue":"workspace:src/vue","@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-typescript2":"^0.34.1","rollup-plugin-vue":"^6.0.0",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"},ce={name:G,description:J,version:q,author:z,homepage:F,license:K,bugs:W,main:X,browser:P,module:Q,unpkg:Y,types:Z,typings:ee,style:se,sass:te,workspaces:ne,repository:oe,keywords:ie,scripts:le,devDependencies:re},ae=$({name:"Install",data:()=>({version:ce.version}),methods:{downloadLink(){H(`https://cdnjs.cloudflare.com/ajax/libs/slim-select/${this.version}/slimselect.min.js`)}}}),de={id:"install",class:"contents"},pe=L(`<div id="npm" class="content"><h2>Npm</h2><p>Most common usage is npm</p><pre class="install-code"> <code class="language-bash">
4
4
  npm install slim-select
5
5
  </code>
6
6
  </pre><pre class="example-code"> <code class="language-javascript">
@@ -10,11 +10,11 @@ Use Save As... to download, then click back to return to this page.`)&&(location
10
10
  select: &#39;#selectElement&#39;
11
11
  })
12
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("p",null,[B(" See full list of available options. "),n("a",{target:"_blank",href:"https://cdnjs.com/libraries/slim-select"},"cdnjs.com/libraries/slim-select")],-1),be=n("div",{class:"alert info"},"New releases may be delayed until the next time its indexed",-1),fe={class:"install-code"},he={class:"language-html"},ve={id:"download",class:"content"},ge=n("h2",null,"Download",-1),ye=n("p",null,"Download the latest minified version of slim select",-1);function we(d,y,w,g,j,_){return V(),I("div",ae,[re,n("div",de,[pe,me,ue,be,n("pre",fe,[B(" "),n("code",he,`
13
+ </pre></div>`,1),me={id:"cdn",class:"content"},ue=L('<h2>Cdn</h2><p> Cdn has a url link you can grab. Cdn exists on both <a target="_blank" href="https://cdnjs.com">cdnjs.com</a> and <a target="_blank" href="https://unpkg.com">unpkg.com</a></p><p> See full list of available options.<br><strong>cdnjs</strong> - <a target="_blank" href="https://cdnjs.com/libraries/slim-select">cdnjs.com/libraries/slim-select</a><br><strong>unpkg</strong> - <a target="_blank" href="https://unpkg.com/browse/slim-select/dist/">https://unpkg.com/browse/slim-select/dist/</a></p><ul><li>slimselct.js - UMD unminified</li><li>slimselct.min.js - UMD minified</li><li>slimselect.cjs.js - CommonJS (for Node) and ES module (for bundlers) build</li><li>slimselect.umd.js - UMD build for browsers</li><li>slimselect.es.js - ES module build for modern browsers</li><li>slimselect.global.js - IIFE build for modern browsers</li></ul><div class="alert info">New releases may be delayed until the next time its indexed</div>',5),be={class:"install-code"},fe={class:"language-html"},he={id:"download",class:"content"},ge=o("h2",null,"Download",-1),ve=o("p",null,"Download the latest minified umd version of slim select",-1),we=o("p",null,[B(" See full list of available downloadable options. "),o("a",{target:"_blank",href:"https://cdnjs.com/libraries/slim-select"},"cdnjs.com/libraries/slim-select")],-1);function ye(d,w,y,v,j,k){return O(),V("div",de,[pe,o("div",me,[ue,o("pre",be,[B(" "),o("code",fe,`
14
14
  <html>
15
15
  <head>
16
- <script src="https://cdnjs.cloudflare.com/ajax/libs/slim-select/`+R(d.version)+`/slimselect.js"><\/script>
17
- <link href="https://cdnjs.cloudflare.com/ajax/libs/slim-select/`+R(d.version)+`/slimselect.css" rel="stylesheet"></link>
16
+ <script src="unpkg.com/slim-select@`+E(d.version)+`/dist/slimselect.min.js"><\/script>
17
+ <link href="unpkg.com/slim-select@`+E(d.version)+`/dist/slimselect.css" rel="stylesheet"></link>
18
18
 
19
19
  <script>
20
20
  new SlimSelect({
@@ -31,4 +31,4 @@ Use Save As... to download, then click back to return to this page.`)&&(location
31
31
  </body>
32
32
  </html>
33
33
  `,1),B(`
34
- `)])]),n("div",ve,[ge,ye,n("div",{class:"btn",onClick:y[0]||(y[0]=o=>d.downloadLink())},"Click Here To Download")])])}const _e=O(ce,[["render",we]]);export{_e as default};
34
+ `)])]),o("div",he,[ge,ve,we,o("div",{class:"btn",onClick:w[0]||(w[0]=n=>d.downloadLink())},"Click Here To Download")])])}const ke=I(ae,[["render",ye]]);export{ke as default};
package/docs/index.html CHANGED
@@ -5,14 +5,32 @@
5
5
  <link rel="icon" href="/favicon.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Slim Select</title>
8
+ <meta name="description" content="Advanced select dropdown" />
9
+ <meta property="og:type" content="article" />
10
+ <meta property="og:title" content="Slim Select" />
11
+ <meta property="og:description" content="Advanced select dropdown" />
8
12
  <script type="module" crossorigin src="/assets/index.js"></script>
9
13
  <link rel="stylesheet" href="/assets/index.css">
10
14
  </head>
11
15
  <body>
12
16
  <noscript>
13
- <strong>We're sorry but this site doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
17
+ <strong
18
+ >We're sorry but this site doesn't work properly without JavaScript enabled. Please enable it to
19
+ continue.</strong
20
+ >
14
21
  </noscript>
15
22
  <div id="app"></div>
16
23
 
24
+ <!-- Google tag (gtag.js) -->
25
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-14PMXQVXTC"></script>
26
+ <script>
27
+ window.dataLayer = window.dataLayer || []
28
+ function gtag() {
29
+ dataLayer.push(arguments)
30
+ }
31
+ gtag('js', new Date())
32
+
33
+ gtag('config', 'G-14PMXQVXTC')
34
+ </script>
17
35
  </body>
18
- </html>
36
+ </html>
package/index.html CHANGED
@@ -5,12 +5,30 @@
5
5
  <link rel="icon" href="/favicon.ico" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Slim Select</title>
8
+ <meta name="description" content="Advanced select dropdown" />
9
+ <meta property="og:type" content="article" />
10
+ <meta property="og:title" content="Slim Select" />
11
+ <meta property="og:description" content="Advanced select dropdown" />
8
12
  </head>
9
13
  <body>
10
14
  <noscript>
11
- <strong>We're sorry but this site doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
15
+ <strong
16
+ >We're sorry but this site doesn't work properly without JavaScript enabled. Please enable it to
17
+ continue.</strong
18
+ >
12
19
  </noscript>
13
20
  <div id="app"></div>
14
21
  <script type="module" src="/src/docs/main.ts"></script>
22
+ <!-- Google tag (gtag.js) -->
23
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-14PMXQVXTC"></script>
24
+ <script>
25
+ window.dataLayer = window.dataLayer || []
26
+ function gtag() {
27
+ dataLayer.push(arguments)
28
+ }
29
+ gtag('js', new Date())
30
+
31
+ gtag('config', 'G-14PMXQVXTC')
32
+ </script>
15
33
  </body>
16
- </html>
34
+ </html>
package/package.json CHANGED
@@ -1,20 +1,24 @@
1
1
  {
2
2
  "name": "slim-select",
3
3
  "description": "Slim advanced select dropdown",
4
- "version": "2.0.1",
4
+ "version": "2.1.0",
5
5
  "author": "Brian Voelker <brian@webiswhatido.com> (http://webiswhatido.com)",
6
6
  "homepage": "https://slimselectjs.com",
7
7
  "license": "MIT",
8
8
  "bugs": {
9
9
  "url": "https://github.com/brianvoe/slim-select/issues"
10
10
  },
11
- "main": "dist/slimselect.js",
11
+ "main": "dist/slimselect.ssr.js",
12
+ "browser": "dist/slimselect.umd.js",
12
13
  "module": "dist/slimselect.es.js",
13
- "unpkg": "dist/slimselect.js",
14
+ "unpkg": "dist/slimselect.umd.min.js",
14
15
  "types": "dist/index.d.ts",
15
16
  "typings": "dist/index.d.ts",
16
17
  "style": "dist/slimselect.css",
17
18
  "sass": "src/slim-select/slimselect.scss",
19
+ "workspaces": [
20
+ "src/vue"
21
+ ],
18
22
  "repository": {
19
23
  "type": "git",
20
24
  "url": "git+https://github.com/brianvoe/slim-select.git"
@@ -27,20 +31,26 @@
27
31
  "multiselect"
28
32
  ],
29
33
  "scripts": {
30
- "jestinit": "ts-jest config:init",
31
34
  "dev": "vite --port=1111",
32
35
  "format": "prettier --write --cache --parser typescript \"src/**/*.ts\"",
33
- "build": "npm run build:clean && npm run build:docs && npm run build:library",
36
+ "build": "npm run build:clean && npm run build:docs && npm run build:library && npm run build:frameworks",
34
37
  "build:clean": "rimraf ./dist/*",
35
38
  "build:docs": "vite build",
36
39
  "build:library": "npm run build:library:js && npm run build:library:css",
37
40
  "build:library:js": "cd src/slim-select && rollup --config ./rollup.config.mjs && cd ../../",
38
41
  "build:library:css": "cd src/slim-select && sass ./slimselect.scss ../../dist/slimselect.css --style=compressed && cd ../../",
42
+ "build:frameworks": "npm run build --workspaces",
43
+ "publish": "npm publish && npm publish --workspaces",
39
44
  "test": "jest"
40
45
  },
41
46
  "devDependencies": {
42
47
  "@jest/globals": "^29.3.1",
48
+ "@rollup/plugin-babel": "^6.0.2",
49
+ "@rollup/plugin-commonjs": "^23.0.2",
50
+ "@rollup/plugin-node-resolve": "^15.0.1",
51
+ "@rollup/plugin-terser": "^0.1.0",
43
52
  "@rollup/plugin-typescript": "^9.0.2",
53
+ "@slim-select/vue": "workspace:src/vue",
44
54
  "@types/downloadjs": "^1.4.3",
45
55
  "@vitejs/plugin-vue": "^3.2.0",
46
56
  "clipboard": "^2.0.11",
@@ -51,7 +61,8 @@
51
61
  "prismjs": "^1.29.0",
52
62
  "rimraf": "^3.0.2",
53
63
  "rollup": "^2.79.1",
54
- "rollup-plugin-terser": "^7.0.2",
64
+ "rollup-plugin-typescript2": "^0.34.1",
65
+ "rollup-plugin-vue": "^6.0.0",
55
66
  "sass": "^1.56.1",
56
67
  "ts-jest": "^29.0.3",
57
68
  "tslib": "^2.4.1",
package/public/404.html CHANGED
@@ -1,8 +1,8 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <meta charset="utf-8">
5
- <title>Single Page Apps for GitHub Pages</title>
4
+ <meta charset="utf-8" />
5
+ <title>Slim Select</title>
6
6
  <script type="text/javascript">
7
7
  // Single Page Apps for GitHub Pages
8
8
  // https://github.com/rafrex/spa-github-pages
@@ -20,17 +20,23 @@
20
20
  // https://username.github.io/repo-name/one/two?a=b&c=d#qwe becomes
21
21
  // https://username.github.io/repo-name/?p=/one/two&q=a=b~and~c=d#qwe
22
22
  // Otherwise, leave pathPrefix as false.
23
- var pathPrefix = false;
24
- var l = window.location;
23
+ var pathPrefix = false
24
+ var l = window.location
25
25
  l.replace(
26
- l.protocol + '//' + l.hostname + (l.port ? ':' + l.port : '') +
27
- l.pathname.split('/').slice(0, 2 * pathPrefix).join('/') + '/?p=/' +
28
- l.pathname.slice(1).split('/').slice(pathPrefix).join('/').replace(/&/g, '~and~') +
29
- (l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
30
- l.hash
31
- );
26
+ l.protocol +
27
+ '//' +
28
+ l.hostname +
29
+ (l.port ? ':' + l.port : '') +
30
+ l.pathname
31
+ .split('/')
32
+ .slice(0, 2 * pathPrefix)
33
+ .join('/') +
34
+ '/?p=/' +
35
+ l.pathname.slice(1).split('/').slice(pathPrefix).join('/').replace(/&/g, '~and~') +
36
+ (l.search ? '&q=' + l.search.slice(1).replace(/&/g, '~and~') : '') +
37
+ l.hash,
38
+ )
32
39
  </script>
33
40
  </head>
34
- <body>
35
- </body>
41
+ <body></body>
36
42
  </html>
package/src/docs/app.vue CHANGED
@@ -1,7 +1,9 @@
1
1
  <script lang="ts">
2
2
  import { defineComponent } from 'vue'
3
3
 
4
- import SlimSelect, { debounce, Settings } from '../slim-select'
4
+ import SlimSelect from '../slim-select'
5
+ import Settings from '../slim-select/settings'
6
+ import { debounce } from '../slim-select/helpers'
5
7
 
6
8
  export default defineComponent({
7
9
  name: 'App',
@@ -75,6 +77,10 @@ export default defineComponent({
75
77
  { text: 'enableDisable', value: 'methods#enableDisable', class: 'mar-l-l' },
76
78
  { text: 'search', value: 'methods#search', class: 'mar-l-l' },
77
79
  { text: 'destroy', value: 'methods#destroy', class: 'mar-l-l' },
80
+
81
+ // Frameworks
82
+ { text: 'Frameworks', value: 'frameworks', class: 'label' },
83
+ { text: 'vue', value: 'frameworks#vue', class: 'mar-l-l' },
78
84
  ],
79
85
  }
80
86
  },
@@ -186,14 +192,14 @@ export default defineComponent({
186
192
  <header>
187
193
  <div class="top">
188
194
  <div class="text">
189
- <h1 class="logo">Slim Select</h1>
195
+ <h1 class="logo">Slim Select <small>2.0</small></h1>
190
196
  </div>
191
197
  <div class="socials">
192
198
  <a href="https://github.com/brianvoe/slim-select" target="_blank">
193
- <img src="./images/github.png" />
199
+ <img src="./assets/images/github.png" />
194
200
  </a>
195
201
  <a href="https://www.npmjs.com/package/slim-select" target="_blank">
196
- <img src="./images/npm.png" />
202
+ <img src="./assets/images/npm.png" />
197
203
  </a>
198
204
  </div>
199
205
  </div>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes