@vlrc-fe/components 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Form/FormFileUpload/index.d.ts +1 -1
- package/dist/Form/FormFileUpload/index.d.ts.map +1 -1
- package/dist/Form/index.d.ts +1 -1
- package/dist/Form/index.d.ts.map +1 -1
- package/dist/MultiSelect/type.d.ts +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +64 -40
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +46 -80
- package/dist/index100.cjs +1 -1
- package/dist/index100.js +22 -60
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +1147 -43
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +30 -64
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +31 -147
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +93 -19
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +80 -25
- package/dist/index106.cjs +1 -1
- package/dist/index106.js +9 -50
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +30 -156
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +350 -14
- package/dist/index109.cjs +1 -1
- package/dist/index109.js +11 -0
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +55 -60
- package/dist/index110.cjs +1 -0
- package/dist/index110.js +430 -0
- package/dist/index111.cjs +1 -0
- package/dist/index111.js +36 -0
- package/dist/index112.cjs +1 -0
- package/dist/index112.js +28 -0
- package/dist/index113.cjs +1 -0
- package/dist/index113.js +14 -0
- package/dist/index114.cjs +1 -0
- package/dist/index114.js +156 -0
- package/dist/index115.cjs +1 -0
- package/dist/index115.js +19 -0
- package/dist/index116.cjs +1 -0
- package/dist/index116.js +67 -0
- package/dist/index117.cjs +1 -0
- package/dist/index117.js +118 -0
- package/dist/index118.cjs +1 -0
- package/dist/index118.js +36 -0
- package/dist/index119.cjs +1 -0
- package/dist/index119.js +13 -0
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +44 -121
- package/dist/index120.cjs +1 -0
- package/dist/index120.js +31 -0
- package/dist/index121.cjs +1 -0
- package/dist/index121.js +37 -0
- package/dist/index122.cjs +1 -0
- package/dist/index122.js +123 -0
- package/dist/index123.cjs +1 -0
- package/dist/index123.js +44 -0
- package/dist/index124.cjs +1 -0
- package/dist/index124.js +43 -0
- package/dist/index125.cjs +1 -0
- package/dist/index125.js +14 -0
- package/dist/index126.cjs +1 -0
- package/dist/index126.js +64 -0
- package/dist/index127.cjs +1 -0
- package/dist/index127.js +23 -0
- package/dist/index128.cjs +1 -0
- package/dist/index128.js +34 -0
- package/dist/index129.cjs +1 -0
- package/dist/index129.js +27 -0
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +30 -12
- package/dist/index130.cjs +1 -0
- package/dist/index130.js +26 -0
- package/dist/index131.cjs +1 -0
- package/dist/index131.js +157 -0
- package/dist/index132.cjs +1 -0
- package/dist/index132.js +34 -0
- package/dist/index133.cjs +1 -0
- package/dist/index133.js +46 -0
- package/dist/index134.cjs +1 -0
- package/dist/index134.js +142 -0
- package/dist/index135.cjs +1 -0
- package/dist/index135.js +125 -0
- package/dist/index136.cjs +1 -0
- package/dist/index136.js +26 -0
- package/dist/index137.cjs +1 -0
- package/dist/index137.js +88 -0
- package/dist/index138.cjs +1 -0
- package/dist/index138.js +221 -0
- package/dist/index139.cjs +1 -0
- package/dist/index139.js +166 -0
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +8 -12
- package/dist/index140.cjs +1 -0
- package/dist/index140.js +126 -0
- package/dist/index141.cjs +1 -0
- package/dist/index141.js +15 -0
- package/dist/index142.cjs +1 -0
- package/dist/index142.js +9 -0
- package/dist/index143.cjs +1 -0
- package/dist/index143.js +17 -0
- package/dist/index144.cjs +1 -0
- package/dist/index144.js +22 -0
- package/dist/index145.cjs +1 -0
- package/dist/index145.js +18 -0
- package/dist/index146.cjs +1 -0
- package/dist/index146.js +6 -0
- package/dist/index147.cjs +1 -0
- package/dist/index147.js +7 -0
- package/dist/index148.cjs +1 -0
- package/dist/index148.js +8 -0
- package/dist/index149.cjs +1 -0
- package/dist/index149.js +7 -0
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +12 -112
- package/dist/index150.cjs +1 -0
- package/dist/index150.js +7 -0
- package/dist/index151.cjs +1 -0
- package/dist/index151.js +9 -0
- package/dist/index152.cjs +1 -0
- package/dist/index152.js +69 -0
- package/dist/index153.cjs +1 -0
- package/dist/index153.js +11 -0
- package/dist/index154.cjs +1 -0
- package/dist/index154.js +202 -0
- package/dist/index155.cjs +1 -0
- package/dist/index155.js +124 -0
- package/dist/index156.cjs +1 -0
- package/dist/index156.js +32 -0
- package/dist/index157.cjs +1 -0
- package/dist/index157.js +20 -0
- package/dist/index158.cjs +1 -0
- package/dist/index158.js +69 -0
- package/dist/index159.cjs +1 -0
- package/dist/index159.js +32 -0
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +4 -726
- package/dist/index160.cjs +1 -0
- package/dist/index160.js +11 -0
- package/dist/index161.cjs +1 -0
- package/dist/index161.js +280 -0
- package/dist/index162.cjs +1 -0
- package/dist/index162.js +157 -0
- package/dist/index163.cjs +1 -0
- package/dist/index163.js +20 -0
- package/dist/index164.cjs +1 -0
- package/dist/index164.js +10 -0
- package/dist/index165.cjs +1 -0
- package/dist/index165.js +14 -0
- package/dist/index166.cjs +1 -0
- package/dist/index166.js +8 -0
- package/dist/index167.cjs +1 -0
- package/dist/index167.js +8 -0
- package/dist/index168.cjs +1 -0
- package/dist/index168.js +11 -0
- package/dist/index169.cjs +1 -0
- package/dist/index169.js +10 -0
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +79 -339
- package/dist/index170.cjs +1 -0
- package/dist/index170.js +6 -0
- package/dist/index171.cjs +1 -0
- package/dist/index171.js +8 -0
- package/dist/index172.cjs +1 -0
- package/dist/index172.js +8 -0
- package/dist/index173.cjs +1 -0
- package/dist/index173.js +10 -0
- package/dist/index174.cjs +1 -0
- package/dist/index174.js +11 -0
- package/dist/index175.cjs +1 -0
- package/dist/index175.js +15 -0
- package/dist/index176.cjs +1 -0
- package/dist/index176.js +11 -0
- package/dist/index177.cjs +1 -0
- package/dist/index177.js +11 -0
- package/dist/index178.cjs +1 -0
- package/dist/index178.js +6 -0
- package/dist/index179.cjs +1 -0
- package/dist/index179.js +43 -0
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +19 -66
- package/dist/index180.cjs +1 -0
- package/dist/index180.js +382 -0
- package/dist/index181.cjs +1 -0
- package/dist/index181.js +40 -0
- package/dist/index182.cjs +1 -0
- package/dist/index182.js +23 -0
- package/dist/index183.cjs +1 -0
- package/dist/index183.js +59 -0
- package/dist/index184.cjs +1 -0
- package/dist/index184.js +55 -0
- package/dist/index185.cjs +1 -0
- package/dist/index185.js +54 -0
- package/dist/index186.cjs +1 -0
- package/dist/index186.js +57 -0
- package/dist/index187.cjs +1 -0
- package/dist/index187.js +57 -0
- package/dist/index188.cjs +1 -0
- package/dist/index188.js +88 -0
- package/dist/index189.cjs +1 -0
- package/dist/index189.js +66 -0
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +18 -8
- package/dist/index190.cjs +1 -0
- package/dist/index190.js +594 -0
- package/dist/index191.cjs +9 -0
- package/dist/index191.js +30 -0
- package/dist/index192.cjs +1 -0
- package/dist/index192.js +50 -0
- package/dist/index193.cjs +1 -0
- package/dist/index193.js +65 -0
- package/dist/index194.cjs +1 -0
- package/dist/index194.js +48 -0
- package/dist/index195.cjs +1 -0
- package/dist/index195.js +67 -0
- package/dist/index196.cjs +1 -0
- package/dist/index196.js +151 -0
- package/dist/index197.cjs +1 -0
- package/dist/index197.js +23 -0
- package/dist/index198.cjs +1 -0
- package/dist/index198.js +27 -0
- package/dist/index199.cjs +1 -0
- package/dist/index199.js +53 -0
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +51 -98
- package/dist/index200.cjs +1 -0
- package/dist/index200.js +161 -0
- package/dist/index201.cjs +1 -0
- package/dist/index201.js +16 -0
- package/dist/index202.cjs +1 -0
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +81 -28
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +64 -14
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +25 -22
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +1014 -33
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +22 -96
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +108 -25
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +15 -9
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +20 -66
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +81 -11
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +91 -29
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +14 -41
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +93 -12
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +22 -62
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +84 -22
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +85 -33
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +407 -25
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +170 -25
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +28 -154
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +158 -33
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +104 -45
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +337 -140
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +96 -124
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +319 -23
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +205 -81
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +33 -220
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +161 -163
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +20 -125
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +24 -14
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +167 -7
- package/dist/index5.js +26 -14
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +44 -15
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +15 -18
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +3 -17
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +5 -5
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +19 -4
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +24 -6
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +66 -4
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +14 -5
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +4 -8
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +50 -67
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +85 -46
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +6 -10
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +25 -199
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +13 -122
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +9 -30
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +3 -20
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +24 -66
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +68 -30
- package/dist/index67.cjs +38 -1
- package/dist/index67.js +3 -11
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +12 -279
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +50 -155
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +29 -85
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +115 -19
- package/dist/index71.cjs +4 -1
- package/dist/index71.js +6 -9
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +12 -12
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +539 -6
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +197 -6
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +120 -9
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +912 -8
- package/dist/index77.cjs +3 -1
- package/dist/index77.js +76 -4
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +120 -6
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +12 -6
- package/dist/index8.cjs +1 -1
- package/dist/index8.js +35 -62
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +14 -8
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +113 -9
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +725 -13
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +346 -9
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +74 -9
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +148 -4
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +31 -42
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +12 -380
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +345 -37
- package/dist/index89.cjs +20 -1
- package/dist/index89.js +40 -18
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +85 -17
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +113 -56
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +272 -51
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +129 -50
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +13 -54
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +28 -55
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +525 -80
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +75 -61
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +67 -583
- package/dist/index98.cjs +1 -9
- package/dist/index98.js +32 -27
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +17 -49
- package/dist/ui/alert-dialog.d.ts +15 -0
- package/dist/ui/alert-dialog.d.ts.map +1 -0
- package/dist/ui/alert.d.ts +10 -0
- package/dist/ui/alert.d.ts.map +1 -0
- package/dist/ui/aspect-ratio.d.ts +4 -0
- package/dist/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/ui/avatar.d.ts +7 -0
- package/dist/ui/avatar.d.ts.map +1 -0
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/breadcrumb.d.ts +12 -0
- package/dist/ui/breadcrumb.d.ts.map +1 -0
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/carousel.d.ts +20 -0
- package/dist/ui/carousel.d.ts.map +1 -0
- package/dist/ui/collapsible.d.ts +6 -0
- package/dist/ui/collapsible.d.ts.map +1 -0
- package/dist/ui/context-menu.d.ts +26 -0
- package/dist/ui/context-menu.d.ts.map +1 -0
- package/dist/ui/drawer.d.ts +14 -0
- package/dist/ui/drawer.d.ts.map +1 -0
- package/dist/ui/hover-card.d.ts +7 -0
- package/dist/ui/hover-card.d.ts.map +1 -0
- package/dist/ui/index.d.ts +23 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/input-otp.d.ts +12 -0
- package/dist/ui/input-otp.d.ts.map +1 -0
- package/dist/ui/menubar.d.ts +27 -0
- package/dist/ui/menubar.d.ts.map +1 -0
- package/dist/ui/navigation-menu.d.ts +15 -0
- package/dist/ui/navigation-menu.d.ts.map +1 -0
- package/dist/ui/pagination.d.ts +14 -0
- package/dist/ui/pagination.d.ts.map +1 -0
- package/dist/ui/resizable.d.ts +9 -0
- package/dist/ui/resizable.d.ts.map +1 -0
- package/dist/ui/sheet.d.ts +14 -0
- package/dist/ui/sheet.d.ts.map +1 -0
- package/dist/ui/sidebar.d.ts +70 -0
- package/dist/ui/sidebar.d.ts.map +1 -0
- package/dist/ui/skeleton.d.ts +3 -0
- package/dist/ui/skeleton.d.ts.map +1 -0
- package/dist/ui/slider.d.ts +5 -0
- package/dist/ui/slider.d.ts.map +1 -0
- package/dist/ui/switch.d.ts +5 -0
- package/dist/ui/switch.d.ts.map +1 -0
- package/dist/ui/tabs.d.ts +8 -0
- package/dist/ui/tabs.d.ts.map +1 -0
- package/dist/ui/toggle-group.d.ts +8 -0
- package/dist/ui/toggle-group.d.ts.map +1 -0
- package/dist/ui/toggle.d.ts +10 -0
- package/dist/ui/toggle.d.ts.map +1 -0
- package/package.json +23 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=e=>Array.isArray(e)&&e.length>0&&`heading`in e[0],t=(e,t)=>{if(e.length!==t.length)return!1;let n=[...e].sort(),r=[...t].sort();return n.every((e,t)=>e===r[t])},n=(t,n)=>{if(t.length===0)return{options:[],duplicates:[]};let r=e(t)?t.flatMap(e=>e.options):t,i=new Set,a=[],o=[];return r.forEach(e=>{i.has(e.value)?(a.push(e.value),n||o.push(e)):(i.add(e.value),o.push(e))}),{options:n?o:r,duplicates:a}},r=(e,t,n)=>{if(!e)return{maxCount:t,hideIcons:!1,compactMode:!1};if(e===!0){let e={mobile:{maxCount:2,hideIcons:!1,compactMode:!0},tablet:{maxCount:4,hideIcons:!1,compactMode:!1},desktop:{maxCount:6,hideIcons:!1,compactMode:!1}}[n];return{maxCount:e?.maxCount??t,hideIcons:e?.hideIcons??!1,compactMode:e?.compactMode??!1}}let r=e[n];return{maxCount:r?.maxCount??t,hideIcons:r?.hideIcons??!1,compactMode:r?.compactMode??!1}},i=(e,t)=>{if(t?.badgeAnimation)switch(t.badgeAnimation){case`bounce`:return e?`animate-bounce`:`hover:-translate-y-1 hover:scale-110`;case`pulse`:return`hover:animate-pulse`;case`wiggle`:return`hover:animate-wiggle`;case`fade`:return`hover:opacity-80`;case`slide`:return`hover:translate-x-1`;case`none`:return``;default:return``}return e?`animate-bounce`:``},a=e=>{if(e?.popoverAnimation)switch(e.popoverAnimation){case`scale`:return`animate-scaleIn`;case`slide`:return`animate-slideInDown`;case`fade`:return`animate-fadeIn`;case`flip`:return`animate-flipIn`;case`none`:return``;default:return``}return``},o=(t,n,r)=>!r||!n?t:t.length===0?[]:e(t)?t.map(e=>({...e,options:e.options.filter(e=>e.label.toLowerCase().includes(n.toLowerCase())||e.value.toLowerCase().includes(n.toLowerCase()))})).filter(e=>e.options.length>0):t.filter(e=>e.label.toLowerCase().includes(n.toLowerCase())||e.value.toLowerCase().includes(n.toLowerCase())),s=(e,t,n,r)=>({minWidth:n||(e===`mobile`?`0px`:`200px`),maxWidth:r||`100%`,width:t?`auto`:`100%`}),c=(e,t)=>{if(!t)return e.length;let n=t.toLowerCase();return e.filter(e=>e.label.toLowerCase().includes(n)||e.value.toLowerCase().includes(n)).length};exports.arraysEqual=t,exports.buildAllOptions=n,exports.buildBadgeAnimationClass=i,exports.buildPopoverAnimationClass=a,exports.buildWidthConstraints=s,exports.computeResponsiveSettings=r,exports.countMatchingOptions=c,exports.filterOptions=o,exports.isGroupedOptions=e;
|
package/dist/index138.js
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { cn as e } from "./index3.js";
|
|
2
|
+
import { Badge as t } from "./index19.js";
|
|
3
|
+
import { Command as n, CommandEmpty as r, CommandGroup as i, CommandInput as a, CommandItem as o, CommandList as s, CommandSeparator as c } from "./index35.js";
|
|
4
|
+
import { Separator as l } from "./index80.js";
|
|
5
|
+
import { multiSelectVariants as u } from "./index136.js";
|
|
6
|
+
import { isGroupedOptions as d } from "./index137.js";
|
|
7
|
+
import { CheckIcon as f, ChevronDown as p, XCircle as m, XIcon as h } from "lucide-react";
|
|
8
|
+
import "react";
|
|
9
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
10
|
+
//#region src/MultiSelect/renderers.tsx
|
|
11
|
+
var y = ({ politeMessage: e, assertiveMessage: t }) => /* @__PURE__ */ v("div", {
|
|
12
|
+
className: "sr-only",
|
|
13
|
+
children: [/* @__PURE__ */ _("div", {
|
|
14
|
+
"aria-live": "polite",
|
|
15
|
+
"aria-atomic": "true",
|
|
16
|
+
role: "status",
|
|
17
|
+
children: e
|
|
18
|
+
}), /* @__PURE__ */ _("div", {
|
|
19
|
+
"aria-live": "assertive",
|
|
20
|
+
"aria-atomic": "true",
|
|
21
|
+
role: "alert",
|
|
22
|
+
children: t
|
|
23
|
+
})]
|
|
24
|
+
}), b = ({ selectedValues: n, responsiveSettings: r, screenSize: i, singleLine: a, animation: o, animationConfig: s, badgeAnimationClass: c, variant: d, getOptionByValue: f, toggleOption: g, clearExtraOptions: y, handleClear: b }) => /* @__PURE__ */ v("div", {
|
|
25
|
+
className: "flex justify-between items-center w-full",
|
|
26
|
+
children: [/* @__PURE__ */ v("div", {
|
|
27
|
+
className: e("flex items-center gap-1", a ? "overflow-x-auto multiselect-singleline-scroll" : "flex-wrap", r.compactMode && "gap-0.5"),
|
|
28
|
+
style: a ? { paddingBottom: "4px" } : {},
|
|
29
|
+
children: [n.slice(0, r.maxCount).map((n) => {
|
|
30
|
+
let l = f(n), p = l?.icon, h = l?.style;
|
|
31
|
+
if (!l) return null;
|
|
32
|
+
let y = {
|
|
33
|
+
animationDuration: `${o}s`,
|
|
34
|
+
...h?.badgeColor && { backgroundColor: h.badgeColor },
|
|
35
|
+
...h?.gradient && {
|
|
36
|
+
background: h.gradient,
|
|
37
|
+
color: "white"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ v(t, {
|
|
41
|
+
className: e(c, u({ variant: d }), h?.gradient && "text-white border-transparent", r.compactMode && "text-xs px-1.5 py-0.5", i === "mobile" && "max-w-30 truncate", a && "shrink-0 whitespace-nowrap", "[&>svg]:pointer-events-auto"),
|
|
42
|
+
style: {
|
|
43
|
+
...y,
|
|
44
|
+
animationDuration: `${s?.duration || o}s`,
|
|
45
|
+
animationDelay: `${s?.delay || 0}s`
|
|
46
|
+
},
|
|
47
|
+
children: [
|
|
48
|
+
p && !r.hideIcons && /* @__PURE__ */ _(p, {
|
|
49
|
+
className: e("h-4 w-4 mr-2", r.compactMode && "h-3 w-3 mr-1", h?.iconColor && "text-current"),
|
|
50
|
+
...h?.iconColor && { style: { color: h.iconColor } }
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ _("span", {
|
|
53
|
+
className: e(i === "mobile" && "truncate"),
|
|
54
|
+
children: l.label
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ _("div", {
|
|
57
|
+
role: "button",
|
|
58
|
+
tabIndex: 0,
|
|
59
|
+
onClick: (e) => {
|
|
60
|
+
e.stopPropagation(), g(n);
|
|
61
|
+
},
|
|
62
|
+
onKeyDown: (e) => {
|
|
63
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), g(n));
|
|
64
|
+
},
|
|
65
|
+
"aria-label": `Remove ${l.label} from selection`,
|
|
66
|
+
className: "ml-2 h-4 w-4 cursor-pointer hover:bg-white/20 rounded-sm p-0.5 -m-0.5 focus:outline-none focus:ring-1 focus:ring-white/50",
|
|
67
|
+
children: /* @__PURE__ */ _(m, { className: e("h-3 w-3", r.compactMode && "h-2.5 w-2.5") })
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
}, n);
|
|
71
|
+
}).filter(Boolean), n.length > r.maxCount && /* @__PURE__ */ v(t, {
|
|
72
|
+
className: e("bg-transparent text-foreground border-foreground/1 hover:bg-transparent", c, u({ variant: d }), r.compactMode && "text-xs px-1.5 py-0.5", a && "shrink-0 whitespace-nowrap", "[&>svg]:pointer-events-auto"),
|
|
73
|
+
style: {
|
|
74
|
+
animationDuration: `${s?.duration || o}s`,
|
|
75
|
+
animationDelay: `${s?.delay || 0}s`
|
|
76
|
+
},
|
|
77
|
+
children: [`+ ${n.length - r.maxCount} more`, /* @__PURE__ */ _(m, {
|
|
78
|
+
className: e("ml-2 h-4 w-4 cursor-pointer", r.compactMode && "ml-1 h-3 w-3"),
|
|
79
|
+
onClick: (e) => {
|
|
80
|
+
e.stopPropagation(), y();
|
|
81
|
+
}
|
|
82
|
+
})]
|
|
83
|
+
})]
|
|
84
|
+
}), /* @__PURE__ */ v("div", {
|
|
85
|
+
className: "flex items-center justify-between",
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ _("div", {
|
|
88
|
+
role: "button",
|
|
89
|
+
tabIndex: 0,
|
|
90
|
+
onClick: (e) => {
|
|
91
|
+
e.stopPropagation(), b();
|
|
92
|
+
},
|
|
93
|
+
onKeyDown: (e) => {
|
|
94
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), b());
|
|
95
|
+
},
|
|
96
|
+
"aria-label": `Clear all ${n.length} selected options`,
|
|
97
|
+
className: "flex items-center justify-center h-4 w-4 mx-2 cursor-pointer text-muted-foreground hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 rounded-sm",
|
|
98
|
+
children: /* @__PURE__ */ _(h, { className: "h-4 w-4" })
|
|
99
|
+
}),
|
|
100
|
+
/* @__PURE__ */ _(l, {
|
|
101
|
+
orientation: "vertical",
|
|
102
|
+
className: "flex min-h-6 h-full"
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ _(p, {
|
|
105
|
+
className: "h-4 mx-2 cursor-pointer text-muted-foreground",
|
|
106
|
+
"aria-hidden": "true"
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
})]
|
|
110
|
+
}), x = ({ placeholder: e }) => /* @__PURE__ */ v("div", {
|
|
111
|
+
className: "flex items-center justify-between w-full mx-auto",
|
|
112
|
+
children: [/* @__PURE__ */ _("span", {
|
|
113
|
+
className: "text-sm text-muted-foreground mx-3",
|
|
114
|
+
children: e
|
|
115
|
+
}), /* @__PURE__ */ _(p, { className: "h-4 cursor-pointer text-muted-foreground mx-2" })]
|
|
116
|
+
}), S = ({ filteredOptions: t, hideSelectAll: u, searchValue: p, searchable: m, selectedValues: h, getAllOptions: y, toggleAll: b, toggleOption: x, handleClear: S, setIsPopoverOpen: C, handleInputKeyDown: w, setSearchValue: T, multiSelectId: E, emptyIndicator: D, screenSize: O }) => /* @__PURE__ */ v(n, { children: [
|
|
117
|
+
m && /* @__PURE__ */ _(a, {
|
|
118
|
+
placeholder: "Search options...",
|
|
119
|
+
onKeyDown: w,
|
|
120
|
+
value: p,
|
|
121
|
+
onValueChange: T,
|
|
122
|
+
"aria-label": "Search through available options",
|
|
123
|
+
"aria-describedby": `${E}-search-help`
|
|
124
|
+
}),
|
|
125
|
+
m && /* @__PURE__ */ _("div", {
|
|
126
|
+
id: `${E}-search-help`,
|
|
127
|
+
className: "sr-only",
|
|
128
|
+
children: "Type to filter options. Use arrow keys to navigate results."
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ v(s, {
|
|
131
|
+
className: e("max-h-[40vh] overflow-y-auto multiselect-scrollbar", O === "mobile" && "max-h-[50vh]", "overscroll-behavior-y-contain"),
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ _(r, { children: D || "No results found." }),
|
|
134
|
+
" ",
|
|
135
|
+
!u && !p && /* @__PURE__ */ _(i, { children: /* @__PURE__ */ v(o, {
|
|
136
|
+
onSelect: b,
|
|
137
|
+
role: "option",
|
|
138
|
+
"aria-selected": h.length === y().filter((e) => !e.disabled).length,
|
|
139
|
+
"aria-label": `Select all ${y().length} options`,
|
|
140
|
+
className: "cursor-pointer",
|
|
141
|
+
children: [/* @__PURE__ */ _("div", {
|
|
142
|
+
className: e("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary", h.length === y().filter((e) => !e.disabled).length ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"),
|
|
143
|
+
"aria-hidden": "true",
|
|
144
|
+
children: /* @__PURE__ */ _(f, { className: "h-4 w-4" })
|
|
145
|
+
}), /* @__PURE__ */ v("span", { children: [
|
|
146
|
+
"(Select All",
|
|
147
|
+
y().length > 20 ? ` - ${y().length} options` : "",
|
|
148
|
+
")"
|
|
149
|
+
] })]
|
|
150
|
+
}, "all") }),
|
|
151
|
+
d(t) ? t.map((t) => /* @__PURE__ */ _(i, {
|
|
152
|
+
heading: t.heading,
|
|
153
|
+
children: t.options.map((t) => {
|
|
154
|
+
let n = h.includes(t.value);
|
|
155
|
+
return /* @__PURE__ */ v(o, {
|
|
156
|
+
onSelect: () => x(t.value),
|
|
157
|
+
role: "option",
|
|
158
|
+
"aria-selected": n,
|
|
159
|
+
"aria-disabled": t.disabled,
|
|
160
|
+
"aria-label": `${t.label}${n ? ", selected" : ", not selected"}${t.disabled ? ", disabled" : ""}`,
|
|
161
|
+
className: e("cursor-pointer", t.disabled && "opacity-50 cursor-not-allowed"),
|
|
162
|
+
disabled: t.disabled,
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ _("div", {
|
|
165
|
+
className: e("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary", n ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"),
|
|
166
|
+
"aria-hidden": "true",
|
|
167
|
+
children: /* @__PURE__ */ _(f, { className: "h-4 w-4" })
|
|
168
|
+
}),
|
|
169
|
+
t.icon && /* @__PURE__ */ _(t.icon, {
|
|
170
|
+
className: "mr-2 h-4 w-4 text-muted-foreground",
|
|
171
|
+
"aria-hidden": "true"
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ _("span", { children: t.label })
|
|
174
|
+
]
|
|
175
|
+
}, t.value);
|
|
176
|
+
})
|
|
177
|
+
}, t.heading)) : /* @__PURE__ */ _(i, { children: t.map((t) => {
|
|
178
|
+
let n = h.includes(t.value);
|
|
179
|
+
return /* @__PURE__ */ v(o, {
|
|
180
|
+
onSelect: () => x(t.value),
|
|
181
|
+
role: "option",
|
|
182
|
+
"aria-selected": n,
|
|
183
|
+
"aria-disabled": t.disabled,
|
|
184
|
+
"aria-label": `${t.label}${n ? ", selected" : ", not selected"}${t.disabled ? ", disabled" : ""}`,
|
|
185
|
+
className: e("cursor-pointer", t.disabled && "opacity-50 cursor-not-allowed"),
|
|
186
|
+
disabled: t.disabled,
|
|
187
|
+
children: [
|
|
188
|
+
/* @__PURE__ */ _("div", {
|
|
189
|
+
className: e("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary", n ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"),
|
|
190
|
+
"aria-hidden": "true",
|
|
191
|
+
children: /* @__PURE__ */ _(f, { className: "h-4 w-4" })
|
|
192
|
+
}),
|
|
193
|
+
t.icon && /* @__PURE__ */ _(t.icon, {
|
|
194
|
+
className: "mr-2 h-4 w-4 text-muted-foreground",
|
|
195
|
+
"aria-hidden": "true"
|
|
196
|
+
}),
|
|
197
|
+
/* @__PURE__ */ _("span", { children: t.label })
|
|
198
|
+
]
|
|
199
|
+
}, t.value);
|
|
200
|
+
}) }),
|
|
201
|
+
/* @__PURE__ */ _(c, {}),
|
|
202
|
+
/* @__PURE__ */ _(i, { children: /* @__PURE__ */ v("div", {
|
|
203
|
+
className: "flex items-center justify-between",
|
|
204
|
+
children: [h.length > 0 && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(o, {
|
|
205
|
+
onSelect: S,
|
|
206
|
+
className: "flex-1 justify-center cursor-pointer",
|
|
207
|
+
children: "Clear"
|
|
208
|
+
}), /* @__PURE__ */ _(l, {
|
|
209
|
+
orientation: "vertical",
|
|
210
|
+
className: "flex min-h-6 h-full"
|
|
211
|
+
})] }), /* @__PURE__ */ _(o, {
|
|
212
|
+
onSelect: () => C(!1),
|
|
213
|
+
className: "flex-1 justify-center cursor-pointer max-w-full",
|
|
214
|
+
children: "Close"
|
|
215
|
+
})]
|
|
216
|
+
}) })
|
|
217
|
+
]
|
|
218
|
+
})
|
|
219
|
+
] });
|
|
220
|
+
//#endregion
|
|
221
|
+
export { y as LiveRegion, S as OptionsContent, x as PlaceholderContent, b as SelectedValuesContent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./index4.cjs"),t=require("./index20.cjs"),n=require("./index36.cjs"),r=require("./index81.cjs"),i=require("./index137.cjs"),a=require("./index138.cjs");let o=require("lucide-react");require("react");let s=require("react/jsx-runtime");var c=({politeMessage:e,assertiveMessage:t})=>(0,s.jsxs)(`div`,{className:`sr-only`,children:[(0,s.jsx)(`div`,{"aria-live":`polite`,"aria-atomic":`true`,role:`status`,children:e}),(0,s.jsx)(`div`,{"aria-live":`assertive`,"aria-atomic":`true`,role:`alert`,children:t})]}),l=({selectedValues:n,responsiveSettings:a,screenSize:c,singleLine:l,animation:u,animationConfig:d,badgeAnimationClass:f,variant:p,getOptionByValue:m,toggleOption:h,clearExtraOptions:g,handleClear:_})=>(0,s.jsxs)(`div`,{className:`flex justify-between items-center w-full`,children:[(0,s.jsxs)(`div`,{className:e.cn(`flex items-center gap-1`,l?`overflow-x-auto multiselect-singleline-scroll`:`flex-wrap`,a.compactMode&&`gap-0.5`),style:l?{paddingBottom:`4px`}:{},children:[n.slice(0,a.maxCount).map(n=>{let r=m(n),g=r?.icon,_=r?.style;if(!r)return null;let v={animationDuration:`${u}s`,..._?.badgeColor&&{backgroundColor:_.badgeColor},..._?.gradient&&{background:_.gradient,color:`white`}};return(0,s.jsxs)(t.Badge,{className:e.cn(f,i.multiSelectVariants({variant:p}),_?.gradient&&`text-white border-transparent`,a.compactMode&&`text-xs px-1.5 py-0.5`,c===`mobile`&&`max-w-30 truncate`,l&&`shrink-0 whitespace-nowrap`,`[&>svg]:pointer-events-auto`),style:{...v,animationDuration:`${d?.duration||u}s`,animationDelay:`${d?.delay||0}s`},children:[g&&!a.hideIcons&&(0,s.jsx)(g,{className:e.cn(`h-4 w-4 mr-2`,a.compactMode&&`h-3 w-3 mr-1`,_?.iconColor&&`text-current`),..._?.iconColor&&{style:{color:_.iconColor}}}),(0,s.jsx)(`span`,{className:e.cn(c===`mobile`&&`truncate`),children:r.label}),(0,s.jsx)(`div`,{role:`button`,tabIndex:0,onClick:e=>{e.stopPropagation(),h(n)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),h(n))},"aria-label":`Remove ${r.label} from selection`,className:`ml-2 h-4 w-4 cursor-pointer hover:bg-white/20 rounded-sm p-0.5 -m-0.5 focus:outline-none focus:ring-1 focus:ring-white/50`,children:(0,s.jsx)(o.XCircle,{className:e.cn(`h-3 w-3`,a.compactMode&&`h-2.5 w-2.5`)})})]},n)}).filter(Boolean),n.length>a.maxCount&&(0,s.jsxs)(t.Badge,{className:e.cn(`bg-transparent text-foreground border-foreground/1 hover:bg-transparent`,f,i.multiSelectVariants({variant:p}),a.compactMode&&`text-xs px-1.5 py-0.5`,l&&`shrink-0 whitespace-nowrap`,`[&>svg]:pointer-events-auto`),style:{animationDuration:`${d?.duration||u}s`,animationDelay:`${d?.delay||0}s`},children:[`+ ${n.length-a.maxCount} more`,(0,s.jsx)(o.XCircle,{className:e.cn(`ml-2 h-4 w-4 cursor-pointer`,a.compactMode&&`ml-1 h-3 w-3`),onClick:e=>{e.stopPropagation(),g()}})]})]}),(0,s.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,s.jsx)(`div`,{role:`button`,tabIndex:0,onClick:e=>{e.stopPropagation(),_()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),_())},"aria-label":`Clear all ${n.length} selected options`,className:`flex items-center justify-center h-4 w-4 mx-2 cursor-pointer text-muted-foreground hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1 rounded-sm`,children:(0,s.jsx)(o.XIcon,{className:`h-4 w-4`})}),(0,s.jsx)(r.Separator,{orientation:`vertical`,className:`flex min-h-6 h-full`}),(0,s.jsx)(o.ChevronDown,{className:`h-4 mx-2 cursor-pointer text-muted-foreground`,"aria-hidden":`true`})]})]}),u=({placeholder:e})=>(0,s.jsxs)(`div`,{className:`flex items-center justify-between w-full mx-auto`,children:[(0,s.jsx)(`span`,{className:`text-sm text-muted-foreground mx-3`,children:e}),(0,s.jsx)(o.ChevronDown,{className:`h-4 cursor-pointer text-muted-foreground mx-2`})]}),d=({filteredOptions:t,hideSelectAll:i,searchValue:c,searchable:l,selectedValues:u,getAllOptions:d,toggleAll:f,toggleOption:p,handleClear:m,setIsPopoverOpen:h,handleInputKeyDown:g,setSearchValue:_,multiSelectId:v,emptyIndicator:y,screenSize:b})=>(0,s.jsxs)(n.Command,{children:[l&&(0,s.jsx)(n.CommandInput,{placeholder:`Search options...`,onKeyDown:g,value:c,onValueChange:_,"aria-label":`Search through available options`,"aria-describedby":`${v}-search-help`}),l&&(0,s.jsx)(`div`,{id:`${v}-search-help`,className:`sr-only`,children:`Type to filter options. Use arrow keys to navigate results.`}),(0,s.jsxs)(n.CommandList,{className:e.cn(`max-h-[40vh] overflow-y-auto multiselect-scrollbar`,b===`mobile`&&`max-h-[50vh]`,`overscroll-behavior-y-contain`),children:[(0,s.jsx)(n.CommandEmpty,{children:y||`No results found.`}),` `,!i&&!c&&(0,s.jsx)(n.CommandGroup,{children:(0,s.jsxs)(n.CommandItem,{onSelect:f,role:`option`,"aria-selected":u.length===d().filter(e=>!e.disabled).length,"aria-label":`Select all ${d().length} options`,className:`cursor-pointer`,children:[(0,s.jsx)(`div`,{className:e.cn(`mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary`,u.length===d().filter(e=>!e.disabled).length?`bg-primary text-primary-foreground`:`opacity-50 [&_svg]:invisible`),"aria-hidden":`true`,children:(0,s.jsx)(o.CheckIcon,{className:`h-4 w-4`})}),(0,s.jsxs)(`span`,{children:[`(Select All`,d().length>20?` - ${d().length} options`:``,`)`]})]},`all`)}),a.isGroupedOptions(t)?t.map(t=>(0,s.jsx)(n.CommandGroup,{heading:t.heading,children:t.options.map(t=>{let r=u.includes(t.value);return(0,s.jsxs)(n.CommandItem,{onSelect:()=>p(t.value),role:`option`,"aria-selected":r,"aria-disabled":t.disabled,"aria-label":`${t.label}${r?`, selected`:`, not selected`}${t.disabled?`, disabled`:``}`,className:e.cn(`cursor-pointer`,t.disabled&&`opacity-50 cursor-not-allowed`),disabled:t.disabled,children:[(0,s.jsx)(`div`,{className:e.cn(`mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary`,r?`bg-primary text-primary-foreground`:`opacity-50 [&_svg]:invisible`),"aria-hidden":`true`,children:(0,s.jsx)(o.CheckIcon,{className:`h-4 w-4`})}),t.icon&&(0,s.jsx)(t.icon,{className:`mr-2 h-4 w-4 text-muted-foreground`,"aria-hidden":`true`}),(0,s.jsx)(`span`,{children:t.label})]},t.value)})},t.heading)):(0,s.jsx)(n.CommandGroup,{children:t.map(t=>{let r=u.includes(t.value);return(0,s.jsxs)(n.CommandItem,{onSelect:()=>p(t.value),role:`option`,"aria-selected":r,"aria-disabled":t.disabled,"aria-label":`${t.label}${r?`, selected`:`, not selected`}${t.disabled?`, disabled`:``}`,className:e.cn(`cursor-pointer`,t.disabled&&`opacity-50 cursor-not-allowed`),disabled:t.disabled,children:[(0,s.jsx)(`div`,{className:e.cn(`mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary`,r?`bg-primary text-primary-foreground`:`opacity-50 [&_svg]:invisible`),"aria-hidden":`true`,children:(0,s.jsx)(o.CheckIcon,{className:`h-4 w-4`})}),t.icon&&(0,s.jsx)(t.icon,{className:`mr-2 h-4 w-4 text-muted-foreground`,"aria-hidden":`true`}),(0,s.jsx)(`span`,{children:t.label})]},t.value)})}),(0,s.jsx)(n.CommandSeparator,{}),(0,s.jsx)(n.CommandGroup,{children:(0,s.jsxs)(`div`,{className:`flex items-center justify-between`,children:[u.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.CommandItem,{onSelect:m,className:`flex-1 justify-center cursor-pointer`,children:`Clear`}),(0,s.jsx)(r.Separator,{orientation:`vertical`,className:`flex min-h-6 h-full`})]}),(0,s.jsx)(n.CommandItem,{onSelect:()=>h(!1),className:`flex-1 justify-center cursor-pointer max-w-full`,children:`Close`})]})})]})]});exports.LiveRegion=c,exports.OptionsContent=d,exports.PlaceholderContent=u,exports.SelectedValuesContent=l;
|
package/dist/index139.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { arraysEqual as e, buildAllOptions as t, buildBadgeAnimationClass as n, buildPopoverAnimationClass as r, buildWidthConstraints as i, computeResponsiveSettings as ee, countMatchingOptions as a, filterOptions as te } from "./index137.js";
|
|
2
|
+
import { useCallback as o, useEffect as s, useId as ne, useImperativeHandle as re, useMemo as c, useRef as l, useState as u } from "react";
|
|
3
|
+
//#region src/MultiSelect/useMultiSelect.ts
|
|
4
|
+
var d = ({ forwardedRef: d, ...f }) => {
|
|
5
|
+
let { options: p, onValueChange: m, defaultValue: h = [], animationConfig: g, maxCount: _ = 3, responsive: v, minWidth: y, maxWidth: b, deduplicateOptions: x = !1, resetOnDefaultValueChange: S = !0, closeOnSelect: C = !1, searchable: w = !0, autoSize: T = !1, disabled: E = !1 } = f, [D, O] = u(h), [k, A] = u(!1), [j, M] = u(!1), [N, P] = u(""), [F, ie] = u("desktop"), [I, L] = u(""), [ae, R] = u(""), z = l(D.length), B = l(k), V = l(N), H = ne(), U = `${H}-listbox`, W = `${H}-description`, G = `${H}-count`, K = l(h), q = l(null), J = o((e, t = "polite") => {
|
|
6
|
+
t === "assertive" ? (R(e), setTimeout(() => R(""), 100)) : (L(e), setTimeout(() => L(""), 100));
|
|
7
|
+
}, []), Y = o(() => {
|
|
8
|
+
let { options: e, duplicates: n } = t(p, x);
|
|
9
|
+
return e;
|
|
10
|
+
}, [x, p]), X = o((e) => Y().find((t) => t.value === e), [Y]), oe = c(() => te(p, N, w), [
|
|
11
|
+
p,
|
|
12
|
+
N,
|
|
13
|
+
w
|
|
14
|
+
]), se = (e) => {
|
|
15
|
+
if (!E) {
|
|
16
|
+
if (e.key === "Enter") A(!0);
|
|
17
|
+
else if (e.key === "Backspace" && !e.currentTarget.value) {
|
|
18
|
+
let e = [...D];
|
|
19
|
+
e.pop(), O(e), m(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}, ce = (e) => {
|
|
23
|
+
if (E || X(e)?.disabled) return;
|
|
24
|
+
let t = D.includes(e) ? D.filter((t) => t !== e) : [...D, e];
|
|
25
|
+
O(t), m(t), C && A(!1);
|
|
26
|
+
}, Z = () => {
|
|
27
|
+
E || (O([]), m([]));
|
|
28
|
+
}, Q = () => {
|
|
29
|
+
E || A((e) => !e);
|
|
30
|
+
}, $ = c(() => ee(v, _, F), [
|
|
31
|
+
v,
|
|
32
|
+
_,
|
|
33
|
+
F
|
|
34
|
+
]), le = () => {
|
|
35
|
+
if (E) return;
|
|
36
|
+
let e = D.slice(0, $.maxCount);
|
|
37
|
+
O(e), m(e);
|
|
38
|
+
}, ue = () => {
|
|
39
|
+
if (E) return;
|
|
40
|
+
let e = Y().filter((e) => !e.disabled);
|
|
41
|
+
if (D.length === e.length) Z();
|
|
42
|
+
else {
|
|
43
|
+
let t = e.map((e) => e.value);
|
|
44
|
+
O(t), m(t);
|
|
45
|
+
}
|
|
46
|
+
C && A(!1);
|
|
47
|
+
}, de = c(() => i(F, T, y, b), [
|
|
48
|
+
T,
|
|
49
|
+
b,
|
|
50
|
+
y,
|
|
51
|
+
F
|
|
52
|
+
]);
|
|
53
|
+
s(() => {
|
|
54
|
+
if (!S) return;
|
|
55
|
+
let t = K.current;
|
|
56
|
+
e(t, h) || (e(D, h) || O(h), K.current = [...h]);
|
|
57
|
+
}, [
|
|
58
|
+
e,
|
|
59
|
+
h,
|
|
60
|
+
S,
|
|
61
|
+
D
|
|
62
|
+
]), s(() => {
|
|
63
|
+
k || P("");
|
|
64
|
+
}, [k]), s(() => {
|
|
65
|
+
let e = D.length, t = Y(), n = t.filter((e) => !e.disabled).length;
|
|
66
|
+
if (e !== z.current) {
|
|
67
|
+
let r = e - z.current;
|
|
68
|
+
if (r > 0) {
|
|
69
|
+
let i = D.slice(-r).map((e) => t.find((t) => t.value === e)?.label).filter(Boolean);
|
|
70
|
+
i.length === 1 ? J(`${i[0]} selected. ${e} of ${n} options selected.`) : J(`${i.length} options selected. ${e} of ${n} total selected.`);
|
|
71
|
+
} else r < 0 && J(`Option removed. ${e} of ${n} options selected.`);
|
|
72
|
+
z.current = e;
|
|
73
|
+
}
|
|
74
|
+
if (k !== B.current && (J(k ? `Dropdown opened. ${n} options available. Use arrow keys to navigate.` : "Dropdown closed."), B.current = k), N !== V.current && N !== void 0) {
|
|
75
|
+
if (N && k) {
|
|
76
|
+
let e = a(t, N);
|
|
77
|
+
J(`${e} option${e === 1 ? "" : "s"} found for "${N}"`);
|
|
78
|
+
}
|
|
79
|
+
V.current = N;
|
|
80
|
+
}
|
|
81
|
+
}, [
|
|
82
|
+
J,
|
|
83
|
+
a,
|
|
84
|
+
Y,
|
|
85
|
+
k,
|
|
86
|
+
N,
|
|
87
|
+
D
|
|
88
|
+
]), s(() => {
|
|
89
|
+
if (typeof window > "u") return;
|
|
90
|
+
let e = () => {
|
|
91
|
+
let e = window.innerWidth;
|
|
92
|
+
ie(e < 640 ? "mobile" : e < 1024 ? "tablet" : "desktop");
|
|
93
|
+
};
|
|
94
|
+
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
95
|
+
}, []);
|
|
96
|
+
let fe = c(() => n(j, g), [g, j]), pe = c(() => r(g), [g]);
|
|
97
|
+
return re(d, () => ({
|
|
98
|
+
reset: () => {
|
|
99
|
+
O(h), A(!1), P(""), m(h);
|
|
100
|
+
},
|
|
101
|
+
getSelectedValues: () => D,
|
|
102
|
+
setSelectedValues: (e) => {
|
|
103
|
+
O(e), m(e);
|
|
104
|
+
},
|
|
105
|
+
clear: () => {
|
|
106
|
+
O([]), m([]);
|
|
107
|
+
},
|
|
108
|
+
focus: () => {
|
|
109
|
+
if (q.current) {
|
|
110
|
+
q.current.focus();
|
|
111
|
+
let e = q.current.style.outline, t = q.current.style.outlineOffset;
|
|
112
|
+
q.current.style.outline = "2px solid hsl(var(--ring))", q.current.style.outlineOffset = "2px", setTimeout(() => {
|
|
113
|
+
q.current && (q.current.style.outline = e, q.current.style.outlineOffset = t);
|
|
114
|
+
}, 1e3);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}), [
|
|
118
|
+
h,
|
|
119
|
+
d,
|
|
120
|
+
m,
|
|
121
|
+
D
|
|
122
|
+
]), {
|
|
123
|
+
ids: {
|
|
124
|
+
multiSelectId: H,
|
|
125
|
+
listboxId: U,
|
|
126
|
+
triggerDescriptionId: W,
|
|
127
|
+
selectedCountId: G
|
|
128
|
+
},
|
|
129
|
+
state: {
|
|
130
|
+
selectedValues: D,
|
|
131
|
+
isPopoverOpen: k,
|
|
132
|
+
isAnimating: j,
|
|
133
|
+
searchValue: N,
|
|
134
|
+
screenSize: F
|
|
135
|
+
},
|
|
136
|
+
derived: {
|
|
137
|
+
filteredOptions: oe,
|
|
138
|
+
responsiveSettings: $,
|
|
139
|
+
widthConstraints: de,
|
|
140
|
+
badgeAnimationClass: fe,
|
|
141
|
+
popoverAnimationClass: pe
|
|
142
|
+
},
|
|
143
|
+
refs: { buttonRef: q },
|
|
144
|
+
helpers: {
|
|
145
|
+
getAllOptions: Y,
|
|
146
|
+
getOptionByValue: X
|
|
147
|
+
},
|
|
148
|
+
a11yMessages: {
|
|
149
|
+
politeMessage: I,
|
|
150
|
+
assertiveMessage: ae
|
|
151
|
+
},
|
|
152
|
+
handlers: {
|
|
153
|
+
setIsPopoverOpen: A,
|
|
154
|
+
handleTogglePopover: Q,
|
|
155
|
+
handleInputKeyDown: se,
|
|
156
|
+
toggleOption: ce,
|
|
157
|
+
handleClear: Z,
|
|
158
|
+
clearExtraOptions: le,
|
|
159
|
+
toggleAll: ue,
|
|
160
|
+
setSearchValue: P,
|
|
161
|
+
setIsAnimating: M
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
//#endregion
|
|
166
|
+
export { d as useMultiSelect };
|
package/dist/index14.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./index2.cjs"),t=require("./
|
|
1
|
+
const e=require("./index2.cjs"),t=require("./index13.cjs");let n=require("react");n=e.__toESM(n,1);let r=require("react/jsx-runtime");var i=Object.defineProperty,a=n.forwardRef(((e,t)=>i(e,`name`,{value:t,configurable:!0}))(function(e,n){let{ratio:i=1/1,style:a,...o}=e;return(0,r.jsx)(`div`,{style:{position:`relative`,width:`100%`,paddingBottom:`${100/i}%`},"data-radix-aspect-ratio-wrapper":``,children:(0,r.jsx)(t.Primitive.div,{...o,ref:n,style:{...a,position:`absolute`,top:0,right:0,bottom:0,left:0}})})},`AspectRatio`));exports.Root=a;
|
package/dist/index14.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import "
|
|
1
|
+
"use client";
|
|
2
|
+
import { Root as e } from "./index13.js";
|
|
3
3
|
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
decorative: a,
|
|
10
|
-
orientation: i,
|
|
11
|
-
className: e("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px", r),
|
|
12
|
-
...o
|
|
4
|
+
//#region src/ui/aspect-ratio.tsx
|
|
5
|
+
function n({ ...n }) {
|
|
6
|
+
return /* @__PURE__ */ t(e, {
|
|
7
|
+
"data-slot": "aspect-ratio",
|
|
8
|
+
...n
|
|
13
9
|
});
|
|
14
10
|
}
|
|
15
11
|
//#endregion
|
|
16
|
-
export {
|
|
12
|
+
export { n as AspectRatio };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./index138.cjs");let t=require("react");var n=({forwardedRef:n,...r})=>{let{options:i,onValueChange:a,defaultValue:o=[],animationConfig:s,maxCount:c=3,responsive:l,minWidth:u,maxWidth:d,deduplicateOptions:f=!1,resetOnDefaultValueChange:p=!0,closeOnSelect:m=!1,searchable:h=!0,autoSize:g=!1,disabled:_=!1}=r,[v,y]=(0,t.useState)(o),[b,x]=(0,t.useState)(!1),[S,C]=(0,t.useState)(!1),[w,T]=(0,t.useState)(``),[E,D]=(0,t.useState)(`desktop`),[O,k]=(0,t.useState)(``),[A,j]=(0,t.useState)(``),M=(0,t.useRef)(v.length),N=(0,t.useRef)(b),P=(0,t.useRef)(w),F=(0,t.useId)(),I=`${F}-listbox`,L=`${F}-description`,R=`${F}-count`,z=(0,t.useRef)(o),B=(0,t.useRef)(null),V=(0,t.useCallback)((e,t=`polite`)=>{t===`assertive`?(j(e),setTimeout(()=>j(``),100)):(k(e),setTimeout(()=>k(``),100))},[]),H=(0,t.useCallback)(()=>{let{options:t,duplicates:n}=e.buildAllOptions(i,f);return t},[f,i]),U=(0,t.useCallback)(e=>H().find(t=>t.value===e),[H]),W=(0,t.useMemo)(()=>e.filterOptions(i,w,h),[i,w,h]),G=e=>{if(!_){if(e.key===`Enter`)x(!0);else if(e.key===`Backspace`&&!e.currentTarget.value){let e=[...v];e.pop(),y(e),a(e)}}},K=e=>{if(_||U(e)?.disabled)return;let t=v.includes(e)?v.filter(t=>t!==e):[...v,e];y(t),a(t),m&&x(!1)},q=()=>{_||(y([]),a([]))},J=()=>{_||x(e=>!e)},Y=(0,t.useMemo)(()=>e.computeResponsiveSettings(l,c,E),[l,c,E]),X=()=>{if(_)return;let e=v.slice(0,Y.maxCount);y(e),a(e)},Z=()=>{if(_)return;let e=H().filter(e=>!e.disabled);if(v.length===e.length)q();else{let t=e.map(e=>e.value);y(t),a(t)}m&&x(!1)},Q=(0,t.useMemo)(()=>e.buildWidthConstraints(E,g,u,d),[g,d,u,E]);(0,t.useEffect)(()=>{if(!p)return;let t=z.current;e.arraysEqual(t,o)||(e.arraysEqual(v,o)||y(o),z.current=[...o])},[e.arraysEqual,o,p,v]),(0,t.useEffect)(()=>{b||T(``)},[b]),(0,t.useEffect)(()=>{let t=v.length,n=H(),r=n.filter(e=>!e.disabled).length;if(t!==M.current){let e=t-M.current;if(e>0){let i=v.slice(-e).map(e=>n.find(t=>t.value===e)?.label).filter(Boolean);i.length===1?V(`${i[0]} selected. ${t} of ${r} options selected.`):V(`${i.length} options selected. ${t} of ${r} total selected.`)}else e<0&&V(`Option removed. ${t} of ${r} options selected.`);M.current=t}if(b!==N.current&&(V(b?`Dropdown opened. ${r} options available. Use arrow keys to navigate.`:`Dropdown closed.`),N.current=b),w!==P.current&&w!==void 0){if(w&&b){let t=e.countMatchingOptions(n,w);V(`${t} option${t===1?``:`s`} found for "${w}"`)}P.current=w}},[V,e.countMatchingOptions,H,b,w,v]),(0,t.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{let e=window.innerWidth;D(e<640?`mobile`:e<1024?`tablet`:`desktop`)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let $=(0,t.useMemo)(()=>e.buildBadgeAnimationClass(S,s),[s,S]),ee=(0,t.useMemo)(()=>e.buildPopoverAnimationClass(s),[s]);return(0,t.useImperativeHandle)(n,()=>({reset:()=>{y(o),x(!1),T(``),a(o)},getSelectedValues:()=>v,setSelectedValues:e=>{y(e),a(e)},clear:()=>{y([]),a([])},focus:()=>{if(B.current){B.current.focus();let e=B.current.style.outline,t=B.current.style.outlineOffset;B.current.style.outline=`2px solid hsl(var(--ring))`,B.current.style.outlineOffset=`2px`,setTimeout(()=>{B.current&&(B.current.style.outline=e,B.current.style.outlineOffset=t)},1e3)}}}),[o,n,a,v]),{ids:{multiSelectId:F,listboxId:I,triggerDescriptionId:L,selectedCountId:R},state:{selectedValues:v,isPopoverOpen:b,isAnimating:S,searchValue:w,screenSize:E},derived:{filteredOptions:W,responsiveSettings:Y,widthConstraints:Q,badgeAnimationClass:$,popoverAnimationClass:ee},refs:{buttonRef:B},helpers:{getAllOptions:H,getOptionByValue:U},a11yMessages:{politeMessage:O,assertiveMessage:A},handlers:{setIsPopoverOpen:x,handleTogglePopover:J,handleInputKeyDown:G,toggleOption:K,handleClear:q,clearExtraOptions:X,toggleAll:Z,setSearchValue:T,setIsAnimating:C}}};exports.useMultiSelect=n;
|
package/dist/index140.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { cn as e } from "./index3.js";
|
|
2
|
+
import { Button as t } from "./index10.js";
|
|
3
|
+
import { Popover as n, PopoverContent as ee, PopoverTrigger as r } from "./index98.js";
|
|
4
|
+
import { Icons as te } from "./index134.js";
|
|
5
|
+
import { LiveRegion as ne, OptionsContent as re, PlaceholderContent as i, SelectedValuesContent as a } from "./index138.js";
|
|
6
|
+
import { useMultiSelect as o } from "./index139.js";
|
|
7
|
+
import "react";
|
|
8
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
|
+
//#region src/MultiSelect/MultiSelect.tsx
|
|
10
|
+
var u = ({ options: u, onValueChange: d, variant: f, defaultValue: p = [], value: m, placeholder: h = "Select options", animation: g = 0, animationConfig: _, maxCount: ie = 3, modalPopover: ae = !1, className: v, hideSelectAll: y = !1, searchable: b = !0, emptyIndicator: x, autoSize: S = !1, singleLine: C = !1, popoverClassName: w, disabled: T = !1, responsive: E, minWidth: D, maxWidth: O, deduplicateOptions: k = !1, resetOnDefaultValueChange: A = !0, closeOnSelect: j = !1, ref: M, ...N }) => {
|
|
11
|
+
let { ids: P, state: F, derived: I, refs: L, helpers: R, a11yMessages: z, handlers: B } = o({
|
|
12
|
+
options: u,
|
|
13
|
+
onValueChange: d,
|
|
14
|
+
defaultValue: m || p,
|
|
15
|
+
animation: g,
|
|
16
|
+
animationConfig: _,
|
|
17
|
+
maxCount: ie,
|
|
18
|
+
responsive: E,
|
|
19
|
+
minWidth: D,
|
|
20
|
+
maxWidth: O,
|
|
21
|
+
deduplicateOptions: k,
|
|
22
|
+
resetOnDefaultValueChange: A,
|
|
23
|
+
closeOnSelect: j,
|
|
24
|
+
searchable: b,
|
|
25
|
+
autoSize: S,
|
|
26
|
+
disabled: T,
|
|
27
|
+
forwardedRef: M
|
|
28
|
+
}), { selectedValues: V, isPopoverOpen: H, isAnimating: U, searchValue: W, screenSize: G } = F, { filteredOptions: K, responsiveSettings: q, widthConstraints: J, badgeAnimationClass: oe, popoverAnimationClass: se } = I, { buttonRef: ce } = L, { getAllOptions: Y, getOptionByValue: X } = R, { politeMessage: le, assertiveMessage: ue } = z, { setIsPopoverOpen: Z, handleTogglePopover: de, handleInputKeyDown: fe, toggleOption: Q, handleClear: $, clearExtraOptions: pe, toggleAll: me, setSearchValue: he, setIsAnimating: ge } = B, _e = (e) => {
|
|
29
|
+
T || Z(e);
|
|
30
|
+
}, ve = `Multi-select: ${V.length} of ${Y().length} options selected. ${h}`;
|
|
31
|
+
return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(ne, {
|
|
32
|
+
politeMessage: le,
|
|
33
|
+
assertiveMessage: ue
|
|
34
|
+
}), /* @__PURE__ */ l(n, {
|
|
35
|
+
open: H,
|
|
36
|
+
onOpenChange: _e,
|
|
37
|
+
modal: ae,
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ c("div", {
|
|
40
|
+
id: P.triggerDescriptionId,
|
|
41
|
+
className: "sr-only",
|
|
42
|
+
children: "Multi-select dropdown. Use arrow keys to navigate, Enter to select, and Escape to close."
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ c("div", {
|
|
45
|
+
id: P.selectedCountId,
|
|
46
|
+
className: "sr-only",
|
|
47
|
+
"aria-live": "polite",
|
|
48
|
+
children: V.length === 0 ? "No options selected" : `${V.length} option${V.length === 1 ? "" : "s"} selected: ${V.map((e) => X(e)?.label).filter(Boolean).join(", ")}`
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ c(r, {
|
|
51
|
+
asChild: !0,
|
|
52
|
+
children: /* @__PURE__ */ c(t, {
|
|
53
|
+
ref: ce,
|
|
54
|
+
...N,
|
|
55
|
+
onClick: de,
|
|
56
|
+
disabled: T,
|
|
57
|
+
role: "combobox",
|
|
58
|
+
"aria-expanded": H,
|
|
59
|
+
"aria-haspopup": "listbox",
|
|
60
|
+
"aria-controls": H ? P.listboxId : void 0,
|
|
61
|
+
"aria-describedby": `${P.triggerDescriptionId} ${P.selectedCountId}`,
|
|
62
|
+
"aria-label": ve,
|
|
63
|
+
className: e("flex p-1 rounded-md border min-h-10 h-auto items-center justify-between bg-inherit hover:bg-inherit [&_svg]:pointer-events-auto", S ? "w-auto" : "w-full", q.compactMode && "min-h-8 text-sm", G === "mobile" && "min-h-12 text-base", T && "opacity-50 cursor-not-allowed", v),
|
|
64
|
+
style: {
|
|
65
|
+
...J,
|
|
66
|
+
maxWidth: `min(${J.maxWidth}, 100%)`
|
|
67
|
+
},
|
|
68
|
+
children: V.length > 0 ? /* @__PURE__ */ c(a, {
|
|
69
|
+
selectedValues: V,
|
|
70
|
+
responsiveSettings: q,
|
|
71
|
+
screenSize: G,
|
|
72
|
+
singleLine: C,
|
|
73
|
+
animation: g,
|
|
74
|
+
animationConfig: _,
|
|
75
|
+
badgeAnimationClass: oe,
|
|
76
|
+
variant: f,
|
|
77
|
+
getOptionByValue: X,
|
|
78
|
+
toggleOption: Q,
|
|
79
|
+
clearExtraOptions: pe,
|
|
80
|
+
handleClear: $
|
|
81
|
+
}) : /* @__PURE__ */ c(i, { placeholder: h })
|
|
82
|
+
})
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ c(ee, {
|
|
85
|
+
id: P.listboxId,
|
|
86
|
+
role: "listbox",
|
|
87
|
+
"aria-multiselectable": "true",
|
|
88
|
+
"aria-label": "Available options",
|
|
89
|
+
className: e("w-auto p-0", se, G === "mobile" && "w-[85vw] max-w-70", G === "tablet" && "w-[70vw] max-w-md", G === "desktop" && "min-w-75", w),
|
|
90
|
+
style: {
|
|
91
|
+
animationDuration: `${_?.duration || g}s`,
|
|
92
|
+
animationDelay: `${_?.delay || 0}s`,
|
|
93
|
+
maxWidth: `min(${J.maxWidth}, 85vw)`,
|
|
94
|
+
maxHeight: G === "mobile" ? "70vh" : "60vh",
|
|
95
|
+
touchAction: "manipulation"
|
|
96
|
+
},
|
|
97
|
+
align: "start",
|
|
98
|
+
onEscapeKeyDown: () => Z(!1),
|
|
99
|
+
children: /* @__PURE__ */ c(re, {
|
|
100
|
+
filteredOptions: K,
|
|
101
|
+
hideSelectAll: y,
|
|
102
|
+
searchValue: W,
|
|
103
|
+
searchable: b,
|
|
104
|
+
selectedValues: V,
|
|
105
|
+
getAllOptions: Y,
|
|
106
|
+
toggleAll: me,
|
|
107
|
+
toggleOption: Q,
|
|
108
|
+
handleClear: $,
|
|
109
|
+
setIsPopoverOpen: Z,
|
|
110
|
+
handleInputKeyDown: fe,
|
|
111
|
+
setSearchValue: he,
|
|
112
|
+
multiSelectId: P.multiSelectId,
|
|
113
|
+
emptyIndicator: x,
|
|
114
|
+
screenSize: G
|
|
115
|
+
})
|
|
116
|
+
}),
|
|
117
|
+
g > 0 && V.length > 0 && /* @__PURE__ */ c(te.WandSparkles, {
|
|
118
|
+
className: e("cursor-pointer my-2 text-foreground bg-background w-3 h-3", U ? "" : "text-muted-foreground"),
|
|
119
|
+
onClick: () => ge(!U)
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
})] });
|
|
123
|
+
};
|
|
124
|
+
u.displayName = "MultiSelect";
|
|
125
|
+
//#endregion
|
|
126
|
+
export { u as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./index4.cjs"),t=require("./index11.cjs"),n=require("./index99.cjs"),r=require("./index135.cjs"),i=require("./index139.cjs"),a=require("./index140.cjs");require("react");let o=require("react/jsx-runtime");var s=({options:s,onValueChange:c,variant:l,defaultValue:ee=[],value:te,placeholder:u=`Select options`,animation:d=0,animationConfig:f,maxCount:p=3,modalPopover:ne=!1,className:m,hideSelectAll:h=!1,searchable:g=!0,emptyIndicator:_,autoSize:v=!1,singleLine:re=!1,popoverClassName:ie,disabled:y=!1,responsive:b,minWidth:x,maxWidth:S,deduplicateOptions:C=!1,resetOnDefaultValueChange:w=!0,closeOnSelect:T=!1,ref:E,...D})=>{let{ids:O,state:k,derived:A,refs:j,helpers:M,a11yMessages:N,handlers:P}=a.useMultiSelect({options:s,onValueChange:c,defaultValue:te||ee,animation:d,animationConfig:f,maxCount:p,responsive:b,minWidth:x,maxWidth:S,deduplicateOptions:C,resetOnDefaultValueChange:w,closeOnSelect:T,searchable:g,autoSize:v,disabled:y,forwardedRef:E}),{selectedValues:F,isPopoverOpen:I,isAnimating:L,searchValue:R,screenSize:z}=k,{filteredOptions:B,responsiveSettings:V,widthConstraints:H,badgeAnimationClass:U,popoverAnimationClass:W}=A,{buttonRef:G}=j,{getAllOptions:K,getOptionByValue:q}=M,{politeMessage:J,assertiveMessage:Y}=N,{setIsPopoverOpen:X,handleTogglePopover:ae,handleInputKeyDown:oe,toggleOption:Z,handleClear:Q,clearExtraOptions:$,toggleAll:se,setSearchValue:ce,setIsAnimating:le}=P,ue=e=>{y||X(e)},de=`Multi-select: ${F.length} of ${K().length} options selected. ${u}`;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(i.LiveRegion,{politeMessage:J,assertiveMessage:Y}),(0,o.jsxs)(n.Popover,{open:I,onOpenChange:ue,modal:ne,children:[(0,o.jsx)(`div`,{id:O.triggerDescriptionId,className:`sr-only`,children:`Multi-select dropdown. Use arrow keys to navigate, Enter to select, and Escape to close.`}),(0,o.jsx)(`div`,{id:O.selectedCountId,className:`sr-only`,"aria-live":`polite`,children:F.length===0?`No options selected`:`${F.length} option${F.length===1?``:`s`} selected: ${F.map(e=>q(e)?.label).filter(Boolean).join(`, `)}`}),(0,o.jsx)(n.PopoverTrigger,{asChild:!0,children:(0,o.jsx)(t.Button,{ref:G,...D,onClick:ae,disabled:y,role:`combobox`,"aria-expanded":I,"aria-haspopup":`listbox`,"aria-controls":I?O.listboxId:void 0,"aria-describedby":`${O.triggerDescriptionId} ${O.selectedCountId}`,"aria-label":de,className:e.cn(`flex p-1 rounded-md border min-h-10 h-auto items-center justify-between bg-inherit hover:bg-inherit [&_svg]:pointer-events-auto`,v?`w-auto`:`w-full`,V.compactMode&&`min-h-8 text-sm`,z===`mobile`&&`min-h-12 text-base`,y&&`opacity-50 cursor-not-allowed`,m),style:{...H,maxWidth:`min(${H.maxWidth}, 100%)`},children:F.length>0?(0,o.jsx)(i.SelectedValuesContent,{selectedValues:F,responsiveSettings:V,screenSize:z,singleLine:re,animation:d,animationConfig:f,badgeAnimationClass:U,variant:l,getOptionByValue:q,toggleOption:Z,clearExtraOptions:$,handleClear:Q}):(0,o.jsx)(i.PlaceholderContent,{placeholder:u})})}),(0,o.jsx)(n.PopoverContent,{id:O.listboxId,role:`listbox`,"aria-multiselectable":`true`,"aria-label":`Available options`,className:e.cn(`w-auto p-0`,W,z===`mobile`&&`w-[85vw] max-w-70`,z===`tablet`&&`w-[70vw] max-w-md`,z===`desktop`&&`min-w-75`,ie),style:{animationDuration:`${f?.duration||d}s`,animationDelay:`${f?.delay||0}s`,maxWidth:`min(${H.maxWidth}, 85vw)`,maxHeight:z===`mobile`?`70vh`:`60vh`,touchAction:`manipulation`},align:`start`,onEscapeKeyDown:()=>X(!1),children:(0,o.jsx)(i.OptionsContent,{filteredOptions:B,hideSelectAll:h,searchValue:R,searchable:g,selectedValues:F,getAllOptions:K,toggleAll:se,toggleOption:Z,handleClear:Q,setIsPopoverOpen:X,handleInputKeyDown:oe,setSearchValue:ce,multiSelectId:O.multiSelectId,emptyIndicator:_,screenSize:z})}),d>0&&F.length>0&&(0,o.jsx)(r.Icons.WandSparkles,{className:e.cn(`cursor-pointer my-2 text-foreground bg-background w-3 h-3`,L?``:`text-muted-foreground`),onClick:()=>le(!L)})]})]})};s.displayName=`MultiSelect`,exports.default=s;
|
package/dist/index141.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FormBase as e } from "./index135.js";
|
|
2
|
+
import t from "./index140.js";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/Form/FormMultiSelect/FormMultiSelect.tsx
|
|
5
|
+
var r = ({ options: r, ...i }) => /* @__PURE__ */ n(e, {
|
|
6
|
+
...i,
|
|
7
|
+
children: ({ onChange: e, value: i, ...a }) => /* @__PURE__ */ n(t, {
|
|
8
|
+
...a,
|
|
9
|
+
options: r,
|
|
10
|
+
onValueChange: e,
|
|
11
|
+
value: i
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { r as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./index136.cjs"),t=require("./index141.cjs");let n=require("react/jsx-runtime");var r=({options:r,...i})=>(0,n.jsx)(e.FormBase,{...i,children:({onChange:e,value:i,...a})=>(0,n.jsx)(t.default,{...a,options:r,onValueChange:e,value:i})});exports.default=r;
|
package/dist/index142.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.js
|
|
2
|
+
function e(e) {
|
|
3
|
+
return (t = {}) => {
|
|
4
|
+
let n = t.width ? String(t.width) : e.defaultWidth;
|
|
5
|
+
return e.formats[n] || e.formats[e.defaultWidth];
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { e as buildFormatLongFn };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}exports.buildFormatLongFn=e;
|
package/dist/index143.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/date-fns@4.4.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.js
|
|
2
|
+
function e(e) {
|
|
3
|
+
return (t, n) => {
|
|
4
|
+
let r = n?.context ? String(n.context) : "standalone", i;
|
|
5
|
+
if (r === "formatting" && e.formattingValues) {
|
|
6
|
+
let t = e.defaultFormattingWidth || e.defaultWidth, r = n?.width ? String(n.width) : t;
|
|
7
|
+
i = e.formattingValues[r] || e.formattingValues[t];
|
|
8
|
+
} else {
|
|
9
|
+
let t = e.defaultWidth, r = n?.width ? String(n.width) : e.defaultWidth;
|
|
10
|
+
i = e.values[r] || e.values[t];
|
|
11
|
+
}
|
|
12
|
+
let a = e.argumentCallback ? e.argumentCallback(t) : t;
|
|
13
|
+
return i[a];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { e as buildLocalizeFn };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}exports.buildLocalizeFn=e;
|