@nubisco/ui 5.4.1 → 5.6.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 (161) hide show
  1. package/README.md +4 -3
  2. package/dist/{Blueprint-BgmsyoIu.js → Blueprint-ClU0eIiy.js} +2 -2
  3. package/dist/{Blueprint-CvOpJq_7.cjs → Blueprint-DbehXPR2.cjs} +1 -1
  4. package/dist/{BlueprintCard-BdT657ax.cjs → BlueprintCard-MDfxqPyE.cjs} +1 -1
  5. package/dist/{BlueprintCard-BJlyW5LC.js → BlueprintCard-VfWPpR6_.js} +1 -1
  6. package/dist/{BlueprintControls-DCUQ9LQ7.cjs → BlueprintControls-BR12TLQ1.cjs} +1 -1
  7. package/dist/{BlueprintControls-DwGxskS4.js → BlueprintControls-pnaU1lCY.js} +1 -1
  8. package/dist/Button-Cw4D6w9K.js +121 -0
  9. package/dist/Button-D-XSNjSL.cjs +1 -0
  10. package/dist/{Confirm-bPSArUzM.js → Confirm-BewLtgMD.js} +1 -1
  11. package/dist/{Confirm-Dmhkb56Q.cjs → Confirm-DHWWbfmu.cjs} +1 -1
  12. package/dist/{DataTable-DueT6mHP.js → DataTable-CVih75pn.js} +1 -1
  13. package/dist/{DataTable-CtjSxLmA.cjs → DataTable-DLuSmiTV.cjs} +1 -1
  14. package/dist/{FileUploader-OqfHo3LH.js → FileUploader-Ba0H8UPw.js} +1 -1
  15. package/dist/{FileUploader-DEBpnSuZ.cjs → FileUploader-CN7XPX9n.cjs} +1 -1
  16. package/dist/InfoHint-DX3lgnTX.cjs +1 -0
  17. package/dist/{InfoHint-Dvdnc-vI.js → InfoHint-DjAgTkgL.js} +32 -32
  18. package/dist/Menu-BSbPfsiE.cjs +1 -0
  19. package/dist/{Menu-Dzg_RrG-.js → Menu-Dy1JwMdl.js} +31 -17
  20. package/dist/{MenuBarItem-DyS1SWrP.js → MenuBarItem-CYofbcgq.js} +1 -1
  21. package/dist/{MenuBarItem-ma4XHwRB.cjs → MenuBarItem-Ya88A6xZ.cjs} +1 -1
  22. package/dist/{NotificationCenter-BYQdkoja.cjs → NotificationCenter-DCi4hoKm.cjs} +1 -1
  23. package/dist/{NotificationCenter-_K5ZQ82b.js → NotificationCenter-Yhez667P.js} +1 -1
  24. package/dist/{Pagination-NaWfr8Rs.cjs → Pagination-CcZB4Lp_.cjs} +1 -1
  25. package/dist/{Pagination-Mu8uhAwJ.js → Pagination-DDIc4vUH.js} +2 -2
  26. package/dist/Select-BMamCNcN.cjs +1 -0
  27. package/dist/Select-CB4BSCaj.js +405 -0
  28. package/dist/Submenu-QgPVi2bN.cjs +1 -0
  29. package/dist/Submenu-SQTJc81U.js +148 -0
  30. package/dist/TableOfContents-BD-79w4n.cjs +1 -0
  31. package/dist/TableOfContents-fTZdpn-L.js +253 -0
  32. package/dist/{Tree-DUfjBsuG.js → Tree-DHdPsRXV.js} +1 -1
  33. package/dist/{Tree-CHJvaRgP.cjs → Tree-DI_ouWnv.cjs} +1 -1
  34. package/dist/TreeNode-CME77z98.js +165 -0
  35. package/dist/TreeNode-CpV3GOzv.cjs +1 -0
  36. package/dist/{Walkthrough-DpGi2slp.js → Walkthrough-B4E8LruL.js} +1 -1
  37. package/dist/{Walkthrough-ClLGKPYd.cjs → Walkthrough-DuX31BAz.cjs} +1 -1
  38. package/dist/all.cjs +1 -1
  39. package/dist/all.mjs +59 -57
  40. package/dist/component-styles.json +5 -0
  41. package/dist/components/AiLabel.cjs +1 -1
  42. package/dist/components/AiLabel.mjs +1 -1
  43. package/dist/components/Blueprint.cjs +1 -1
  44. package/dist/components/Blueprint.mjs +1 -1
  45. package/dist/components/BlueprintBackground.cjs +1 -1
  46. package/dist/components/BlueprintBackground.mjs +1 -1
  47. package/dist/components/BlueprintCard.cjs +1 -1
  48. package/dist/components/BlueprintCard.mjs +1 -1
  49. package/dist/components/BlueprintControls.cjs +1 -1
  50. package/dist/components/BlueprintControls.mjs +1 -1
  51. package/dist/components/BlueprintMinimap.cjs +1 -1
  52. package/dist/components/BlueprintMinimap.mjs +1 -1
  53. package/dist/components/BottomPanel.cjs +1 -1
  54. package/dist/components/BottomPanel.mjs +1 -1
  55. package/dist/components/Button.cjs +1 -1
  56. package/dist/components/Button.mjs +1 -1
  57. package/dist/components/Button.vue.d.ts +6 -9
  58. package/dist/components/Button.vue.d.ts.map +1 -1
  59. package/dist/components/Confirm.cjs +1 -1
  60. package/dist/components/Confirm.mjs +1 -1
  61. package/dist/components/DataTable.cjs +1 -1
  62. package/dist/components/DataTable.mjs +1 -1
  63. package/dist/components/FileUploader.cjs +1 -1
  64. package/dist/components/FileUploader.mjs +1 -1
  65. package/dist/components/Form.cjs +1 -1
  66. package/dist/components/Form.mjs +1 -1
  67. package/dist/components/ImageCropper.cjs +1 -1
  68. package/dist/components/ImageCropper.mjs +1 -1
  69. package/dist/components/InfoHint.cjs +1 -1
  70. package/dist/components/InfoHint.mjs +1 -1
  71. package/dist/components/InfoHint.vue.d.ts.map +1 -1
  72. package/dist/components/Menu.cjs +1 -1
  73. package/dist/components/Menu.d.ts +7 -0
  74. package/dist/components/Menu.mjs +1 -1
  75. package/dist/components/Menu.vue.d.ts.map +1 -1
  76. package/dist/components/MenuBarItem.cjs +1 -1
  77. package/dist/components/MenuBarItem.mjs +1 -1
  78. package/dist/components/NotificationCenter.cjs +1 -1
  79. package/dist/components/NotificationCenter.mjs +1 -1
  80. package/dist/components/Pagination.cjs +1 -1
  81. package/dist/components/Pagination.mjs +1 -1
  82. package/dist/components/Select.cjs +1 -1
  83. package/dist/components/Select.d.ts +10 -0
  84. package/dist/components/Select.mjs +1 -1
  85. package/dist/components/Select.vue.d.ts +7 -7
  86. package/dist/components/Select.vue.d.ts.map +1 -1
  87. package/dist/components/ShellPanel.cjs +1 -1
  88. package/dist/components/ShellPanel.mjs +1 -1
  89. package/dist/components/Submenu.cjs +1 -1
  90. package/dist/components/Submenu.mjs +1 -1
  91. package/dist/components/Submenu.vue.d.ts.map +1 -1
  92. package/dist/components/TableOfContents.cjs +1 -0
  93. package/dist/components/TableOfContents.d.ts +104 -0
  94. package/dist/components/TableOfContents.mjs +2 -0
  95. package/dist/components/TableOfContents.vue.d.ts +44 -0
  96. package/dist/components/TableOfContents.vue.d.ts.map +1 -0
  97. package/dist/components/TableOfContentsList.vue.d.ts +14 -0
  98. package/dist/components/TableOfContentsList.vue.d.ts.map +1 -0
  99. package/dist/components/Tabs.cjs +1 -1
  100. package/dist/components/Tabs.mjs +1 -1
  101. package/dist/components/Tree.cjs +1 -1
  102. package/dist/components/Tree.d.ts +14 -0
  103. package/dist/components/Tree.mjs +1 -1
  104. package/dist/components/TreeNode.cjs +1 -1
  105. package/dist/components/TreeNode.mjs +1 -1
  106. package/dist/components/TreeNode.vue.d.ts +2 -0
  107. package/dist/components/TreeNode.vue.d.ts.map +1 -1
  108. package/dist/components/Walkthrough.cjs +1 -1
  109. package/dist/components/Walkthrough.mjs +1 -1
  110. package/dist/components/index.d.ts.map +1 -1
  111. package/dist/components/manifest.d.ts +1 -0
  112. package/dist/components/manifest.d.ts.map +1 -1
  113. package/dist/components/manifest.js +1 -0
  114. package/dist/composables/useBlueprint.composable.cjs +1 -1
  115. package/dist/composables/useBlueprint.composable.mjs +1 -1
  116. package/dist/composables/useConfirm.composable.cjs +1 -1
  117. package/dist/composables/useConfirm.composable.mjs +1 -1
  118. package/dist/global.d.ts +4 -0
  119. package/dist/index.cjs +1 -1
  120. package/dist/index.mjs +38 -37
  121. package/dist/main.d.ts +2 -0
  122. package/dist/main.d.ts.map +1 -1
  123. package/dist/styles/Button.css +1 -1
  124. package/dist/styles/InfoHint.css +1 -1
  125. package/dist/styles/Select.css +1 -1
  126. package/dist/styles/TableOfContents.css +1 -0
  127. package/dist/styles/TreeNode.css +1 -1
  128. package/dist/ui.css +5 -4
  129. package/package.json +1 -1
  130. package/dist/Button-B2ngznxj.cjs +0 -1
  131. package/dist/Button-CnwG9SUU.js +0 -99
  132. package/dist/InfoHint-BOYN7Jig.cjs +0 -1
  133. package/dist/Menu-CTCkLSMW.cjs +0 -1
  134. package/dist/Select-BbsEiJ4j.cjs +0 -1
  135. package/dist/Select-Ep1fFBFj.js +0 -378
  136. package/dist/Submenu-D5C02DV5.js +0 -123
  137. package/dist/Submenu-DuMYz-uf.cjs +0 -1
  138. package/dist/TreeNode-CyOc2r4y.cjs +0 -1
  139. package/dist/TreeNode-S_qQNbsJ.js +0 -143
  140. /package/dist/{AiLabel-BmUhIOFk.js → AiLabel-BciBQAKB.js} +0 -0
  141. /package/dist/{AiLabel-PATTi5dO.cjs → AiLabel-ClnMVvCl.cjs} +0 -0
  142. /package/dist/{Blueprint.context-BOAtPYlo.js → Blueprint.context-CHfek6nW.js} +0 -0
  143. /package/dist/{Blueprint.context-BUzhZPrF.cjs → Blueprint.context-C_y0TS6a.cjs} +0 -0
  144. /package/dist/{BlueprintBackground-Cd_30GvD.cjs → BlueprintBackground-D58A6eXS.cjs} +0 -0
  145. /package/dist/{BlueprintBackground-1IxGPyUh.js → BlueprintBackground-SJ-ibrkF.js} +0 -0
  146. /package/dist/{BlueprintMinimap-w3Y0VvIx.cjs → BlueprintMinimap-BPqaGiY0.cjs} +0 -0
  147. /package/dist/{BlueprintMinimap-CmFRuqou.js → BlueprintMinimap-De8KVP54.js} +0 -0
  148. /package/dist/{BottomPanel-VNTVAMs3.js → BottomPanel-C7VWbs0V.js} +0 -0
  149. /package/dist/{BottomPanel-CK1NsXtz.cjs → BottomPanel-Di3pv797.cjs} +0 -0
  150. /package/dist/{Form-HC4yg8DG.js → Form-BPHdzd8_.js} +0 -0
  151. /package/dist/{Form-rRMK9twU.cjs → Form-C-l_4RHC.cjs} +0 -0
  152. /package/dist/{ImageCropper-BKKcVuPn.cjs → ImageCropper-BbW7o5mE.cjs} +0 -0
  153. /package/dist/{ImageCropper-CR8HCvg4.js → ImageCropper-DS3QiZ-X.js} +0 -0
  154. /package/dist/{ShellPanel-DnleEQR7.js → ShellPanel-B1byDSRC.js} +0 -0
  155. /package/dist/{ShellPanel-62ajcug-.cjs → ShellPanel-c3FBvVMm.cjs} +0 -0
  156. /package/dist/{Tabs-B2XvVchi.cjs → Tabs-B4r8l7vl.cjs} +0 -0
  157. /package/dist/{Tabs-CSizMNKI.js → Tabs-Cs5i4IGp.js} +0 -0
  158. /package/dist/{TreeContext-XcdJsmjK.cjs → TreeContext-BH2qpPud.cjs} +0 -0
  159. /package/dist/{TreeContext-RyZC10Bs.js → TreeContext-DMADOfuO.js} +0 -0
  160. /package/dist/{pixi-scene-BLuFyySv.cjs → pixi-scene-BmwgRql_.cjs} +0 -0
  161. /package/dist/{pixi-scene-BEkv7XH4.js → pixi-scene-CeviVGrf.js} +0 -0
@@ -1 +0,0 @@
1
- require(`./chunk-D-qHiVGv.cjs`);let e=require(`vue`);var t=(0,e.defineComponent)({__name:`Menu`,props:{open:{type:Boolean,default:!1},size:{default:`md`},minWidth:{default:160},maxWidth:{default:288}},emits:[`close`,`update:open`],setup(t,{expose:n,emit:r}){let i=t,a=r,o=(0,e.ref)(null),s=(0,e.ref)(-1),c=(0,e.reactive)([]),l=(0,e.computed)(()=>({position:`fixed`,top:`${u.top}px`,left:`${u.left}px`,minWidth:`${i.minWidth}px`,maxWidth:`${i.maxWidth}px`,zIndex:`var(--nb-zindex-menu)`})),u=(0,e.reactive)({top:0,left:0});function d(e){u.top=e.bottom,u.left=e.left}function f(e,t){u.top=t,u.left=e}function p(){a(`close`),a(`update:open`,!1)}function m(e){return c.includes(e)||c.push(e),c.indexOf(e)}function h(e){let t=c.indexOf(e);t>=0&&c.splice(t,1)}(0,e.provide)(`nb-menu`,{size:i.size,close:p,highlightedIndex:s.value,registerItem:m,unregisterItem:h});function g(){return o.value?Array.from(o.value.querySelectorAll(`[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]`)).filter(e=>!e.closest(`.nb-submenu`)):[]}function _(e){let t=g();e>=0&&e<t.length&&(s.value=e,t[e].focus())}function v(e){let t=g();if(t.length)if(e.key===`ArrowDown`){e.preventDefault(),e.stopPropagation();let n=s.value+1;for(;n<t.length&&t[n]?.getAttribute(`aria-disabled`)===`true`;)n++;n<t.length&&_(n)}else if(e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let n=s.value-1;for(;n>=0&&t[n]?.getAttribute(`aria-disabled`)===`true`;)n--;n>=0&&_(n)}else e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),p()):e.key===`Tab`&&p()}function y(e){let t=e.target;o.value&&!o.value.contains(t)&&p()}function b(){if(!o.value)return;let e=o.value.getBoundingClientRect();e.right>window.innerWidth&&(u.left=Math.max(8,window.innerWidth-e.width-8)),e.bottom>window.innerHeight&&(u.top=Math.max(8,window.innerHeight-e.height-8));let t=window.innerHeight-u.top-8;o.value.style.maxHeight=`${t}px`}return(0,e.watch)(()=>i.open,t=>{t?(s.value=-1,document.addEventListener(`mousedown`,y),(0,e.nextTick)(()=>{b(),g().length>0&&_(0)})):(s.value=-1,document.removeEventListener(`mousedown`,y))}),(0,e.onBeforeUnmount)(()=>{document.removeEventListener(`mousedown`,y)}),n({setPosition:d,setPositionXY:f,close:p,el:o}),(n,r)=>((0,e.openBlock)(),(0,e.createBlock)(e.Teleport,{to:`body`},[(0,e.createVNode)(e.Transition,{name:`nb-menu`},{default:(0,e.withCtx)(()=>[t.open?((0,e.openBlock)(),(0,e.createElementBlock)(`ul`,{key:0,ref_key:`menuRef`,ref:o,role:`menu`,class:(0,e.normalizeClass)([`nb-menu`,`nb-menu--${t.size}`]),style:(0,e.normalizeStyle)(l.value),onKeydown:v},[(0,e.renderSlot)(n.$slots,`default`)],38)):(0,e.createCommentVNode)(``,!0)]),_:3})]))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return t}});
@@ -1 +0,0 @@
1
- require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Icon-C8R_r_In.cjs`),t=require(`./Label-DtXh4XR5.cjs`),n=require(`./Message-D8ZE4uGZ.cjs`),r=require(`./Grid-DTZTlxd_.cjs`);let i=require(`vue`),a=require(`@nubisco/ui/icons/caret-down`),o=require(`@nubisco/ui/icons/caret-up`);var s=[`id`,`aria-expanded`,`aria-disabled`,`aria-required`,`disabled`],c=[`id`,`aria-expanded`,`aria-disabled`,`aria-required`,`disabled`],l={key:1,class:`nb-select__inner-label`},u={key:0,class:`nb-select__asterisk`,"aria-hidden":`true`},d=[`aria-multiselectable`],f=[`aria-selected`,`aria-disabled`,`onMouseenter`,`onClick`],p={key:0,class:`nb-select__option-check`,"aria-hidden":`true`},m={key:0,viewBox:`0 0 10 8`,fill:`none`,width:`10`,height:`8`},h={class:`nb-select__option-label`},g={key:0,class:`nb-select__empty`},_=[`placeholder`,`onKeydown`],v=(0,i.defineComponent)({__name:`Select`,props:{modelValue:{default:null},options:{default:()=>[]},multiple:{type:Boolean,default:!1},creatable:{type:Boolean,default:!1},createPlaceholder:{default:``},placeholder:{default:`Select…`},name:{default:``},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},id:{default:void 0},label:{default:``},error:{default:``},warning:{default:``},helper:{default:``},variant:{default:`default`},size:{default:`md`}},emits:[`update:modelValue`,`change`,`create`],setup(v,{expose:y,emit:b}){let x=v,S=b,C=(0,i.ref)(``);function w(){let e=C.value.trim();e&&(S(`create`,e),C.value=``)}let T=(0,i.ref)(!1),E=(0,i.ref)(!1),D=(0,i.ref)(-1),O=(0,i.ref)(null),k=(0,i.ref)(null),A=(0,i.ref)(null),j=(0,i.ref)({position:`fixed`,top:`0px`,left:`0px`,width:`0px`,zIndex:`9999`}),M=`nb-select-${(0,i.useId)()}`,N=(0,i.computed)(()=>x.id??M),P=(0,i.computed)(()=>x.modelValue==null?[]:Array.isArray(x.modelValue)?x.modelValue:[x.modelValue]),F=(0,i.computed)(()=>{if(P.value.length===0)return``;let e=x.options??[];return x.multiple?P.value.length===1?e.find(e=>e.value===P.value[0])?.label??String(P.value[0]):P.value.length===2?P.value.map(t=>e.find(e=>e.value===t)?.label??String(t)).join(`, `):`${P.value.length} selected`:e.find(e=>e.value===P.value[0])?.label??String(P.value[0])});function I(e){return P.value.includes(e)}function L(e){if(e.disabled)return;let t;if(x.multiple){let n=[...P.value],r=n.indexOf(e.value);r>=0?n.splice(r,1):n.push(e.value),t=n}else t=e.value,B();S(`update:modelValue`,t),S(`change`,t)}function R(){if(!k.value)return;let e=k.value.getBoundingClientRect(),t=A.value?.offsetHeight??0,n=window.innerHeight-e.bottom,r=e.top;j.value={position:`fixed`,top:t>0&&n<t&&r>n?`${e.top-t}px`:`${e.bottom}px`,left:`${e.left}px`,width:`${e.width}px`,zIndex:`9999`}}function z(){if(x.disabled)return;T.value=!0,R();let e=x.options??[];D.value=P.value.length>0?Math.max(0,e.findIndex(e=>e.value===P.value[0])):-1,(0,i.nextTick)(()=>{R(),G()})}function B(){T.value=!1,D.value=-1}function V(){T.value?B():z()}function H(e){let t=e.target,n=O.value?.contains(t)??!1,r=A.value?.contains(t)??!1;!n&&!r&&B()}function U(){T.value&&R()}(0,i.watch)(T,e=>{e?(document.addEventListener(`mousedown`,H),window.addEventListener(`scroll`,U,!0),window.addEventListener(`resize`,U)):(document.removeEventListener(`mousedown`,H),window.removeEventListener(`scroll`,U,!0),window.removeEventListener(`resize`,U))}),(0,i.onBeforeUnmount)(()=>{document.removeEventListener(`mousedown`,H),window.removeEventListener(`scroll`,U,!0),window.removeEventListener(`resize`,U)});function W(e){let t=x.options??[];if(!T.value){(e.key===`Enter`||e.key===` `||e.key===`ArrowDown`)&&(e.preventDefault(),z());return}e.key===`Escape`?(B(),e.preventDefault()):e.key===`Tab`?B():e.key===`ArrowDown`?(e.preventDefault(),D.value=Math.min(D.value+1,t.length-1),G()):e.key===`ArrowUp`?(e.preventDefault(),D.value=Math.max(D.value-1,0),G()):(e.key===`Enter`||e.key===` `)&&D.value>=0&&(e.preventDefault(),L(t[D.value]))}function G(){(0,i.nextTick)(()=>{!A.value||D.value<0||A.value.querySelectorAll(`.nb-select__option`)[D.value]?.scrollIntoView({block:`nearest`})})}let K=(0,i.computed)(()=>[`nb-select`,`nb-select--${x.variant}`,`nb-select--${x.size}`,{"nb-select--open":T.value,"nb-select--focused":E.value&&!T.value,"nb-select--error":!!x.error,"nb-select--warning":!x.error&&!!x.warning,"nb-select--multiple":x.multiple}]);return y({open:z,close:B}),(y,b)=>((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,null,[(0,i.createElementVNode)(`div`,{ref_key:`rootRef`,ref:O,class:(0,i.normalizeClass)(K.value),onKeydown:W},[v.variant===`default`?((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:0},[y.$slots.label?(0,i.renderSlot)(y.$slots,`label`,{key:0}):v.label?((0,i.openBlock)(),(0,i.createBlock)(t.t,{key:1,for:N.value,required:v.required,disabled:v.disabled},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(v.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,i.createCommentVNode)(``,!0),(0,i.createElementVNode)(`button`,{id:N.value,ref_key:`triggerRef`,ref:k,type:`button`,class:`nb-select__trigger`,role:`combobox`,"aria-expanded":T.value,"aria-haspopup":`listbox`,"aria-disabled":v.disabled||void 0,"aria-required":v.required||void 0,disabled:v.disabled||void 0,onClick:V,onFocus:b[0]||=e=>E.value=!0,onBlur:b[1]||=e=>E.value=!1},[(0,i.createElementVNode)(`span`,{class:(0,i.normalizeClass)([`nb-select__value`,{"nb-select__value--placeholder":!F.value}])},[F.value?(0,i.renderSlot)(y.$slots,`value`,{key:0,values:P.value},()=>[(0,i.createTextVNode)((0,i.toDisplayString)(F.value),1)]):((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:1},[(0,i.createTextVNode)((0,i.toDisplayString)(v.placeholder),1)],64))],2),v.error?((0,i.openBlock)(),(0,i.createBlock)(n.t,{key:0,variant:`error`,"icon-only":!0,class:`nb-select__status-icon`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(v.error),1)]),_:1})):v.warning?((0,i.openBlock)(),(0,i.createBlock)(n.t,{key:1,variant:`warning`,"icon-only":!0,class:`nb-select__status-icon`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(v.warning),1)]),_:1})):(0,i.createCommentVNode)(``,!0),(0,i.createVNode)(r.t,{align:`center`,justify:`center`,class:`nb-select__caret`},{default:(0,i.withCtx)(()=>[(0,i.createVNode)(e.t,{name:T.value?(0,i.unref)(o.regular):(0,i.unref)(a.regular),size:16},null,8,[`name`])]),_:1})],40,s),v.error?((0,i.openBlock)(),(0,i.createBlock)(n.t,{key:2,variant:`error`,class:`nb-select__message`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(v.error),1)]),_:1})):v.warning?((0,i.openBlock)(),(0,i.createBlock)(n.t,{key:3,variant:`warning`,class:`nb-select__message`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(v.warning),1)]),_:1})):v.helper?((0,i.openBlock)(),(0,i.createBlock)(n.t,{key:4,variant:`helper`,class:`nb-select__message`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(v.helper),1)]),_:1})):(0,i.createCommentVNode)(``,!0)],64)):v.variant===`fluid`?((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:1},[(0,i.createElementVNode)(`button`,{id:N.value,ref_key:`triggerRef`,ref:k,type:`button`,class:`nb-select__trigger`,role:`combobox`,"aria-expanded":T.value,"aria-haspopup":`listbox`,"aria-disabled":v.disabled||void 0,"aria-required":v.required||void 0,disabled:v.disabled||void 0,onClick:V,onFocus:b[2]||=e=>E.value=!0,onBlur:b[3]||=e=>E.value=!1},[v.label||y.$slots.label?((0,i.openBlock)(),(0,i.createBlock)(r.t,{key:0,dir:`row`,align:`center`,gap:`xs`,class:`nb-select__inner-header`},{default:(0,i.withCtx)(()=>[y.$slots.label?(0,i.renderSlot)(y.$slots,`label`,{key:0}):((0,i.openBlock)(),(0,i.createElementBlock)(`label`,l,[(0,i.createTextVNode)((0,i.toDisplayString)(v.label)+` `,1),v.required?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,u,`*`)):(0,i.createCommentVNode)(``,!0)])),v.helper&&!v.error&&!v.warning?((0,i.openBlock)(),(0,i.createBlock)(n.t,{key:2,variant:`helper`,"icon-only":!0,class:`nb-select__inner-message`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(v.helper),1)]),_:1})):(0,i.createCommentVNode)(``,!0)]),_:3})):(0,i.createCommentVNode)(``,!0),(0,i.createVNode)(r.t,{dir:`row`,align:`end`,flex:``,class:`nb-select__value-row`},{default:(0,i.withCtx)(()=>[(0,i.createElementVNode)(`span`,{class:(0,i.normalizeClass)([`nb-select__value`,{"nb-select__value--placeholder":!F.value}])},[F.value?(0,i.renderSlot)(y.$slots,`value`,{key:0,values:P.value},()=>[(0,i.createTextVNode)((0,i.toDisplayString)(F.value),1)]):((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:1},[(0,i.createTextVNode)((0,i.toDisplayString)(v.placeholder),1)],64))],2),(0,i.createVNode)(r.t,{align:`center`,justify:`center`,class:`nb-select__caret`},{default:(0,i.withCtx)(()=>[(0,i.createVNode)(e.t,{name:T.value?(0,i.unref)(o.regular):(0,i.unref)(a.regular),size:16},null,8,[`name`])]),_:1})]),_:3})],40,c),v.error?((0,i.openBlock)(),(0,i.createBlock)(n.t,{key:0,variant:`error`,class:`nb-select__fluid-message`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(v.error),1)]),_:1})):v.warning?((0,i.openBlock)(),(0,i.createBlock)(n.t,{key:1,variant:`warning`,class:`nb-select__fluid-message`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(v.warning),1)]),_:1})):(0,i.createCommentVNode)(``,!0)],64)):(0,i.createCommentVNode)(``,!0)],34),((0,i.openBlock)(),(0,i.createBlock)(i.Teleport,{to:`body`},[T.value?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:0,ref_key:`dropdownRef`,ref:A,class:`nb-select__dropdown`,style:(0,i.normalizeStyle)(j.value),role:`listbox`,"aria-multiselectable":v.multiple||void 0},[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(v.options,(e,t)=>((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:e.value,class:(0,i.normalizeClass)([`nb-select__option`,{"nb-select__option--selected":I(e.value),"nb-select__option--highlighted":D.value===t,"nb-select__option--disabled":e.disabled}]),role:`option`,"aria-selected":I(e.value),"aria-disabled":e.disabled||void 0,onMouseenter:e=>D.value=t,onClick:t=>L(e)},[v.multiple?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,p,[I(e.value)?((0,i.openBlock)(),(0,i.createElementBlock)(`svg`,m,[...b[7]||=[(0,i.createElementVNode)(`path`,{d:`M1 4l3 3 5-6`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,-1)]])):(0,i.createCommentVNode)(``,!0)])):(0,i.createCommentVNode)(``,!0),(0,i.createElementVNode)(`span`,h,[(0,i.renderSlot)(y.$slots,`option`,{option:e},()=>[(0,i.createTextVNode)((0,i.toDisplayString)(e.label),1)])])],42,f))),128)),!v.options||v.options.length===0?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,g,` No options `)):(0,i.createCommentVNode)(``,!0),v.creatable?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:1,class:`nb-select__create`,onMousedown:b[6]||=(0,i.withModifiers)(()=>{},[`prevent`])},[(0,i.withDirectives)((0,i.createElementVNode)(`input`,{"onUpdate:modelValue":b[4]||=e=>C.value=e,type:`text`,class:`nb-select__create-input`,placeholder:v.createPlaceholder||`Add new…`,onKeydown:[(0,i.withKeys)((0,i.withModifiers)(w,[`prevent`]),[`enter`]),b[5]||=(0,i.withModifiers)(()=>{},[`stop`])]},null,40,_),[[i.vModelText,C.value]])],32)):(0,i.createCommentVNode)(``,!0)],12,d)):(0,i.createCommentVNode)(``,!0)]))],64))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return v}});
@@ -1,378 +0,0 @@
1
- import { t as e } from "./Icon-rREAqsu0.js";
2
- import { t } from "./Label-glcQoGCr.js";
3
- import { t as n } from "./Message-Ciyc2nN6.js";
4
- import { t as r } from "./Grid-CgUyhsw4.js";
5
- import { Fragment as i, Teleport as ee, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createTextVNode as u, createVNode as d, defineComponent as f, nextTick as p, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as te, openBlock as g, ref as _, renderList as ne, renderSlot as v, toDisplayString as y, unref as b, useId as x, vModelText as S, watch as re, withCtx as C, withDirectives as ie, withKeys as ae, withModifiers as w } from "vue";
6
- import { regular as T } from "@nubisco/ui/icons/caret-down";
7
- import { regular as E } from "@nubisco/ui/icons/caret-up";
8
- //#region src/components/Select.vue?vue&type=script&setup=true&lang.ts
9
- var D = [
10
- "id",
11
- "aria-expanded",
12
- "aria-disabled",
13
- "aria-required",
14
- "disabled"
15
- ], O = [
16
- "id",
17
- "aria-expanded",
18
- "aria-disabled",
19
- "aria-required",
20
- "disabled"
21
- ], oe = {
22
- key: 1,
23
- class: "nb-select__inner-label"
24
- }, se = {
25
- key: 0,
26
- class: "nb-select__asterisk",
27
- "aria-hidden": "true"
28
- }, k = ["aria-multiselectable"], ce = [
29
- "aria-selected",
30
- "aria-disabled",
31
- "onMouseenter",
32
- "onClick"
33
- ], le = {
34
- key: 0,
35
- class: "nb-select__option-check",
36
- "aria-hidden": "true"
37
- }, ue = {
38
- key: 0,
39
- viewBox: "0 0 10 8",
40
- fill: "none",
41
- width: "10",
42
- height: "8"
43
- }, de = { class: "nb-select__option-label" }, fe = {
44
- key: 0,
45
- class: "nb-select__empty"
46
- }, pe = ["placeholder", "onKeydown"], A = /* @__PURE__ */ f({
47
- __name: "Select",
48
- props: {
49
- modelValue: { default: null },
50
- options: { default: () => [] },
51
- multiple: {
52
- type: Boolean,
53
- default: !1
54
- },
55
- creatable: {
56
- type: Boolean,
57
- default: !1
58
- },
59
- createPlaceholder: { default: "" },
60
- placeholder: { default: "Select…" },
61
- name: { default: "" },
62
- disabled: {
63
- type: Boolean,
64
- default: !1
65
- },
66
- required: {
67
- type: Boolean,
68
- default: !1
69
- },
70
- id: { default: void 0 },
71
- label: { default: "" },
72
- error: { default: "" },
73
- warning: { default: "" },
74
- helper: { default: "" },
75
- variant: { default: "default" },
76
- size: { default: "md" }
77
- },
78
- emits: [
79
- "update:modelValue",
80
- "change",
81
- "create"
82
- ],
83
- setup(f, { expose: A, emit: me }) {
84
- let j = f, M = me, N = _("");
85
- function P() {
86
- let e = N.value.trim();
87
- e && (M("create", e), N.value = "");
88
- }
89
- let F = _(!1), I = _(!1), L = _(-1), R = _(null), z = _(null), B = _(null), V = _({
90
- position: "fixed",
91
- top: "0px",
92
- left: "0px",
93
- width: "0px",
94
- zIndex: "9999"
95
- }), he = `nb-select-${x()}`, H = a(() => j.id ?? he), U = a(() => j.modelValue == null ? [] : Array.isArray(j.modelValue) ? j.modelValue : [j.modelValue]), W = a(() => {
96
- if (U.value.length === 0) return "";
97
- let e = j.options ?? [];
98
- return j.multiple ? U.value.length === 1 ? e.find((e) => e.value === U.value[0])?.label ?? String(U.value[0]) : U.value.length === 2 ? U.value.map((t) => e.find((e) => e.value === t)?.label ?? String(t)).join(", ") : `${U.value.length} selected` : e.find((e) => e.value === U.value[0])?.label ?? String(U.value[0]);
99
- });
100
- function G(e) {
101
- return U.value.includes(e);
102
- }
103
- function K(e) {
104
- if (e.disabled) return;
105
- let t;
106
- if (j.multiple) {
107
- let n = [...U.value], r = n.indexOf(e.value);
108
- r >= 0 ? n.splice(r, 1) : n.push(e.value), t = n;
109
- } else t = e.value, Y();
110
- M("update:modelValue", t), M("change", t);
111
- }
112
- function q() {
113
- if (!z.value) return;
114
- let e = z.value.getBoundingClientRect(), t = B.value?.offsetHeight ?? 0, n = window.innerHeight - e.bottom, r = e.top;
115
- V.value = {
116
- position: "fixed",
117
- top: t > 0 && n < t && r > n ? `${e.top - t}px` : `${e.bottom}px`,
118
- left: `${e.left}px`,
119
- width: `${e.width}px`,
120
- zIndex: "9999"
121
- };
122
- }
123
- function J() {
124
- if (j.disabled) return;
125
- F.value = !0, q();
126
- let e = j.options ?? [];
127
- L.value = U.value.length > 0 ? Math.max(0, e.findIndex((e) => e.value === U.value[0])) : -1, p(() => {
128
- q(), $();
129
- });
130
- }
131
- function Y() {
132
- F.value = !1, L.value = -1;
133
- }
134
- function X() {
135
- F.value ? Y() : J();
136
- }
137
- function Z(e) {
138
- let t = e.target, n = R.value?.contains(t) ?? !1, r = B.value?.contains(t) ?? !1;
139
- !n && !r && Y();
140
- }
141
- function Q() {
142
- F.value && q();
143
- }
144
- re(F, (e) => {
145
- e ? (document.addEventListener("mousedown", Z), window.addEventListener("scroll", Q, !0), window.addEventListener("resize", Q)) : (document.removeEventListener("mousedown", Z), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q));
146
- }), te(() => {
147
- document.removeEventListener("mousedown", Z), window.removeEventListener("scroll", Q, !0), window.removeEventListener("resize", Q);
148
- });
149
- function ge(e) {
150
- let t = j.options ?? [];
151
- if (!F.value) {
152
- (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), J());
153
- return;
154
- }
155
- e.key === "Escape" ? (Y(), e.preventDefault()) : e.key === "Tab" ? Y() : e.key === "ArrowDown" ? (e.preventDefault(), L.value = Math.min(L.value + 1, t.length - 1), $()) : e.key === "ArrowUp" ? (e.preventDefault(), L.value = Math.max(L.value - 1, 0), $()) : (e.key === "Enter" || e.key === " ") && L.value >= 0 && (e.preventDefault(), K(t[L.value]));
156
- }
157
- function $() {
158
- p(() => {
159
- !B.value || L.value < 0 || B.value.querySelectorAll(".nb-select__option")[L.value]?.scrollIntoView({ block: "nearest" });
160
- });
161
- }
162
- let _e = a(() => [
163
- "nb-select",
164
- `nb-select--${j.variant}`,
165
- `nb-select--${j.size}`,
166
- {
167
- "nb-select--open": F.value,
168
- "nb-select--focused": I.value && !F.value,
169
- "nb-select--error": !!j.error,
170
- "nb-select--warning": !j.error && !!j.warning,
171
- "nb-select--multiple": j.multiple
172
- }
173
- ]);
174
- return A({
175
- open: J,
176
- close: Y
177
- }), (a, p) => (g(), c(i, null, [l("div", {
178
- ref_key: "rootRef",
179
- ref: R,
180
- class: m(_e.value),
181
- onKeydown: ge
182
- }, [f.variant === "default" ? (g(), c(i, { key: 0 }, [
183
- a.$slots.label ? v(a.$slots, "label", { key: 0 }) : f.label ? (g(), o(t, {
184
- key: 1,
185
- for: H.value,
186
- required: f.required,
187
- disabled: f.disabled
188
- }, {
189
- default: C(() => [u(y(f.label), 1)]),
190
- _: 1
191
- }, 8, [
192
- "for",
193
- "required",
194
- "disabled"
195
- ])) : s("", !0),
196
- l("button", {
197
- id: H.value,
198
- ref_key: "triggerRef",
199
- ref: z,
200
- type: "button",
201
- class: "nb-select__trigger",
202
- role: "combobox",
203
- "aria-expanded": F.value,
204
- "aria-haspopup": "listbox",
205
- "aria-disabled": f.disabled || void 0,
206
- "aria-required": f.required || void 0,
207
- disabled: f.disabled || void 0,
208
- onClick: X,
209
- onFocus: p[0] ||= (e) => I.value = !0,
210
- onBlur: p[1] ||= (e) => I.value = !1
211
- }, [
212
- l("span", { class: m(["nb-select__value", { "nb-select__value--placeholder": !W.value }]) }, [W.value ? v(a.$slots, "value", {
213
- key: 0,
214
- values: U.value
215
- }, () => [u(y(W.value), 1)]) : (g(), c(i, { key: 1 }, [u(y(f.placeholder), 1)], 64))], 2),
216
- f.error ? (g(), o(n, {
217
- key: 0,
218
- variant: "error",
219
- "icon-only": !0,
220
- class: "nb-select__status-icon"
221
- }, {
222
- default: C(() => [u(y(f.error), 1)]),
223
- _: 1
224
- })) : f.warning ? (g(), o(n, {
225
- key: 1,
226
- variant: "warning",
227
- "icon-only": !0,
228
- class: "nb-select__status-icon"
229
- }, {
230
- default: C(() => [u(y(f.warning), 1)]),
231
- _: 1
232
- })) : s("", !0),
233
- d(r, {
234
- align: "center",
235
- justify: "center",
236
- class: "nb-select__caret"
237
- }, {
238
- default: C(() => [d(e, {
239
- name: F.value ? b(E) : b(T),
240
- size: 16
241
- }, null, 8, ["name"])]),
242
- _: 1
243
- })
244
- ], 40, D),
245
- f.error ? (g(), o(n, {
246
- key: 2,
247
- variant: "error",
248
- class: "nb-select__message"
249
- }, {
250
- default: C(() => [u(y(f.error), 1)]),
251
- _: 1
252
- })) : f.warning ? (g(), o(n, {
253
- key: 3,
254
- variant: "warning",
255
- class: "nb-select__message"
256
- }, {
257
- default: C(() => [u(y(f.warning), 1)]),
258
- _: 1
259
- })) : f.helper ? (g(), o(n, {
260
- key: 4,
261
- variant: "helper",
262
- class: "nb-select__message"
263
- }, {
264
- default: C(() => [u(y(f.helper), 1)]),
265
- _: 1
266
- })) : s("", !0)
267
- ], 64)) : f.variant === "fluid" ? (g(), c(i, { key: 1 }, [l("button", {
268
- id: H.value,
269
- ref_key: "triggerRef",
270
- ref: z,
271
- type: "button",
272
- class: "nb-select__trigger",
273
- role: "combobox",
274
- "aria-expanded": F.value,
275
- "aria-haspopup": "listbox",
276
- "aria-disabled": f.disabled || void 0,
277
- "aria-required": f.required || void 0,
278
- disabled: f.disabled || void 0,
279
- onClick: X,
280
- onFocus: p[2] ||= (e) => I.value = !0,
281
- onBlur: p[3] ||= (e) => I.value = !1
282
- }, [f.label || a.$slots.label ? (g(), o(r, {
283
- key: 0,
284
- dir: "row",
285
- align: "center",
286
- gap: "xs",
287
- class: "nb-select__inner-header"
288
- }, {
289
- default: C(() => [a.$slots.label ? v(a.$slots, "label", { key: 0 }) : (g(), c("label", oe, [u(y(f.label) + " ", 1), f.required ? (g(), c("span", se, "*")) : s("", !0)])), f.helper && !f.error && !f.warning ? (g(), o(n, {
290
- key: 2,
291
- variant: "helper",
292
- "icon-only": !0,
293
- class: "nb-select__inner-message"
294
- }, {
295
- default: C(() => [u(y(f.helper), 1)]),
296
- _: 1
297
- })) : s("", !0)]),
298
- _: 3
299
- })) : s("", !0), d(r, {
300
- dir: "row",
301
- align: "end",
302
- flex: "",
303
- class: "nb-select__value-row"
304
- }, {
305
- default: C(() => [l("span", { class: m(["nb-select__value", { "nb-select__value--placeholder": !W.value }]) }, [W.value ? v(a.$slots, "value", {
306
- key: 0,
307
- values: U.value
308
- }, () => [u(y(W.value), 1)]) : (g(), c(i, { key: 1 }, [u(y(f.placeholder), 1)], 64))], 2), d(r, {
309
- align: "center",
310
- justify: "center",
311
- class: "nb-select__caret"
312
- }, {
313
- default: C(() => [d(e, {
314
- name: F.value ? b(E) : b(T),
315
- size: 16
316
- }, null, 8, ["name"])]),
317
- _: 1
318
- })]),
319
- _: 3
320
- })], 40, O), f.error ? (g(), o(n, {
321
- key: 0,
322
- variant: "error",
323
- class: "nb-select__fluid-message"
324
- }, {
325
- default: C(() => [u(y(f.error), 1)]),
326
- _: 1
327
- })) : f.warning ? (g(), o(n, {
328
- key: 1,
329
- variant: "warning",
330
- class: "nb-select__fluid-message"
331
- }, {
332
- default: C(() => [u(y(f.warning), 1)]),
333
- _: 1
334
- })) : s("", !0)], 64)) : s("", !0)], 34), (g(), o(ee, { to: "body" }, [F.value ? (g(), c("div", {
335
- key: 0,
336
- ref_key: "dropdownRef",
337
- ref: B,
338
- class: "nb-select__dropdown",
339
- style: h(V.value),
340
- role: "listbox",
341
- "aria-multiselectable": f.multiple || void 0
342
- }, [
343
- (g(!0), c(i, null, ne(f.options, (e, t) => (g(), c("div", {
344
- key: e.value,
345
- class: m(["nb-select__option", {
346
- "nb-select__option--selected": G(e.value),
347
- "nb-select__option--highlighted": L.value === t,
348
- "nb-select__option--disabled": e.disabled
349
- }]),
350
- role: "option",
351
- "aria-selected": G(e.value),
352
- "aria-disabled": e.disabled || void 0,
353
- onMouseenter: (e) => L.value = t,
354
- onClick: (t) => K(e)
355
- }, [f.multiple ? (g(), c("span", le, [G(e.value) ? (g(), c("svg", ue, [...p[7] ||= [l("path", {
356
- d: "M1 4l3 3 5-6",
357
- stroke: "currentColor",
358
- "stroke-width": "1.5",
359
- "stroke-linecap": "round",
360
- "stroke-linejoin": "round"
361
- }, null, -1)]])) : s("", !0)])) : s("", !0), l("span", de, [v(a.$slots, "option", { option: e }, () => [u(y(e.label), 1)])])], 42, ce))), 128)),
362
- !f.options || f.options.length === 0 ? (g(), c("div", fe, " No options ")) : s("", !0),
363
- f.creatable ? (g(), c("div", {
364
- key: 1,
365
- class: "nb-select__create",
366
- onMousedown: p[6] ||= w(() => {}, ["prevent"])
367
- }, [ie(l("input", {
368
- "onUpdate:modelValue": p[4] ||= (e) => N.value = e,
369
- type: "text",
370
- class: "nb-select__create-input",
371
- placeholder: f.createPlaceholder || "Add new…",
372
- onKeydown: [ae(w(P, ["prevent"]), ["enter"]), p[5] ||= w(() => {}, ["stop"])]
373
- }, null, 40, pe), [[S, N.value]])], 32)) : s("", !0)
374
- ], 12, k)) : s("", !0)]))], 64));
375
- }
376
- });
377
- //#endregion
378
- export { A as t };
@@ -1,123 +0,0 @@
1
- import { t as e } from "./Icon-rREAqsu0.js";
2
- import { Fragment as t, Teleport as n, Transition as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, inject as d, nextTick as f, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as h, openBlock as g, ref as _, renderSlot as v, toDisplayString as y, unref as b, withCtx as x, withKeys as S, withModifiers as C } from "vue";
3
- import { regular as w } from "@nubisco/ui/icons/caret-right";
4
- //#region src/components/Submenu.vue?vue&type=script&setup=true&lang.ts
5
- var T = [
6
- "aria-expanded",
7
- "aria-disabled",
8
- "onKeydown"
9
- ], E = { class: "nb-menu-item__label" }, D = /* @__PURE__ */ u({
10
- __name: "Submenu",
11
- props: {
12
- icon: { default: void 0 },
13
- label: {},
14
- disabled: {
15
- type: Boolean,
16
- default: !1
17
- }
18
- },
19
- setup(u) {
20
- let D = u, O = _(null), k = _(null), A = _(!1), j = d("nb-menu", null), M = null, N = null, P = i(() => `nb-menu--${j?.size ?? "md"}`), F = _({
21
- position: "fixed",
22
- top: "0px",
23
- left: "0px",
24
- zIndex: "var(--nb-zindex-menu)"
25
- });
26
- function I() {
27
- if (!O.value) return;
28
- let e = O.value.getBoundingClientRect(), t = e.right, n = e.top;
29
- t + 200 > window.innerWidth && (t = e.left - 200), n + 200 > window.innerHeight && (n = Math.max(8, window.innerHeight - 200)), F.value = {
30
- position: "fixed",
31
- top: `${n}px`,
32
- left: `${t}px`,
33
- zIndex: "var(--nb-zindex-menu)"
34
- };
35
- }
36
- function L() {
37
- D.disabled || (z(), A.value = !0, I(), f(() => {
38
- if (k.value && O.value) {
39
- let e = O.value.getBoundingClientRect(), t = k.value.getBoundingClientRect(), n = e.right;
40
- n + t.width > window.innerWidth && (n = e.left - t.width);
41
- let r = e.top;
42
- r + t.height > window.innerHeight && (r = Math.max(8, window.innerHeight - t.height)), F.value = {
43
- position: "fixed",
44
- top: `${r}px`,
45
- left: `${n}px`,
46
- zIndex: "var(--nb-zindex-menu)"
47
- };
48
- }
49
- }));
50
- }
51
- function R() {
52
- z(), A.value = !1;
53
- }
54
- function z() {
55
- M &&= (clearTimeout(M), null), N &&= (clearTimeout(N), null);
56
- }
57
- function B() {
58
- z(), M = setTimeout(L, 150);
59
- }
60
- function V() {
61
- z(), N = setTimeout(R, 150);
62
- }
63
- function H() {
64
- z();
65
- }
66
- function U() {
67
- z(), N = setTimeout(R, 150);
68
- }
69
- function W() {
70
- D.disabled || (A.value ? R() : L());
71
- }
72
- return h(() => {
73
- z();
74
- }), (i, d) => (g(), s(t, null, [c("li", {
75
- ref_key: "triggerRef",
76
- ref: O,
77
- class: p(["nb-menu-item nb-submenu-trigger", {
78
- "nb-menu-item--disabled": u.disabled,
79
- "nb-menu-item--highlighted": A.value
80
- }]),
81
- role: "menuitem",
82
- "aria-haspopup": "menu",
83
- "aria-expanded": A.value,
84
- "aria-disabled": u.disabled || void 0,
85
- tabindex: -1,
86
- onMouseenter: B,
87
- onMouseleave: V,
88
- onKeydown: [
89
- S(C(L, ["prevent"]), ["right"]),
90
- S(C(R, ["prevent"]), ["left"]),
91
- S(C(R, ["prevent"]), ["escape"])
92
- ],
93
- onClick: W
94
- }, [
95
- u.icon ? (g(), a(e, {
96
- key: 0,
97
- name: u.icon,
98
- size: 16,
99
- class: "nb-menu-item__icon"
100
- }, null, 8, ["name"])) : o("", !0),
101
- c("span", E, y(u.label), 1),
102
- l(e, {
103
- name: b(w),
104
- size: 14,
105
- class: "nb-submenu-trigger__caret"
106
- }, null, 8, ["name"])
107
- ], 42, T), (g(), a(n, { to: "body" }, [l(r, { name: "nb-submenu" }, {
108
- default: x(() => [A.value ? (g(), s("ul", {
109
- key: 0,
110
- ref_key: "submenuRef",
111
- ref: k,
112
- role: "menu",
113
- class: p(["nb-menu nb-submenu", [P.value]]),
114
- style: m(F.value),
115
- onMouseenter: H,
116
- onMouseleave: U
117
- }, [v(i.$slots, "default")], 38)) : o("", !0)]),
118
- _: 3
119
- })]))], 64));
120
- }
121
- });
122
- //#endregion
123
- export { D as t };
@@ -1 +0,0 @@
1
- require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Icon-C8R_r_In.cjs`);let t=require(`vue`),n=require(`@nubisco/ui/icons/caret-right`);var r=[`aria-expanded`,`aria-disabled`,`onKeydown`],i={class:`nb-menu-item__label`},a=(0,t.defineComponent)({__name:`Submenu`,props:{icon:{default:void 0},label:{},disabled:{type:Boolean,default:!1}},setup(a){let o=a,s=(0,t.ref)(null),c=(0,t.ref)(null),l=(0,t.ref)(!1),u=(0,t.inject)(`nb-menu`,null),d=null,f=null,p=(0,t.computed)(()=>`nb-menu--${u?.size??`md`}`),m=(0,t.ref)({position:`fixed`,top:`0px`,left:`0px`,zIndex:`var(--nb-zindex-menu)`});function h(){if(!s.value)return;let e=s.value.getBoundingClientRect(),t=e.right,n=e.top;t+200>window.innerWidth&&(t=e.left-200),n+200>window.innerHeight&&(n=Math.max(8,window.innerHeight-200)),m.value={position:`fixed`,top:`${n}px`,left:`${t}px`,zIndex:`var(--nb-zindex-menu)`}}function g(){o.disabled||(v(),l.value=!0,h(),(0,t.nextTick)(()=>{if(c.value&&s.value){let e=s.value.getBoundingClientRect(),t=c.value.getBoundingClientRect(),n=e.right;n+t.width>window.innerWidth&&(n=e.left-t.width);let r=e.top;r+t.height>window.innerHeight&&(r=Math.max(8,window.innerHeight-t.height)),m.value={position:`fixed`,top:`${r}px`,left:`${n}px`,zIndex:`var(--nb-zindex-menu)`}}}))}function _(){v(),l.value=!1}function v(){d&&=(clearTimeout(d),null),f&&=(clearTimeout(f),null)}function y(){v(),d=setTimeout(g,150)}function b(){v(),f=setTimeout(_,150)}function x(){v()}function S(){v(),f=setTimeout(_,150)}function C(){o.disabled||(l.value?_():g())}return(0,t.onBeforeUnmount)(()=>{v()}),(o,u)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createElementVNode)(`li`,{ref_key:`triggerRef`,ref:s,class:(0,t.normalizeClass)([`nb-menu-item nb-submenu-trigger`,{"nb-menu-item--disabled":a.disabled,"nb-menu-item--highlighted":l.value}]),role:`menuitem`,"aria-haspopup":`menu`,"aria-expanded":l.value,"aria-disabled":a.disabled||void 0,tabindex:-1,onMouseenter:y,onMouseleave:b,onKeydown:[(0,t.withKeys)((0,t.withModifiers)(g,[`prevent`]),[`right`]),(0,t.withKeys)((0,t.withModifiers)(_,[`prevent`]),[`left`]),(0,t.withKeys)((0,t.withModifiers)(_,[`prevent`]),[`escape`])],onClick:C},[a.icon?((0,t.openBlock)(),(0,t.createBlock)(e.t,{key:0,name:a.icon,size:16,class:`nb-menu-item__icon`},null,8,[`name`])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,i,(0,t.toDisplayString)(a.label),1),(0,t.createVNode)(e.t,{name:(0,t.unref)(n.regular),size:14,class:`nb-submenu-trigger__caret`},null,8,[`name`])],42,r),((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{to:`body`},[(0,t.createVNode)(t.Transition,{name:`nb-submenu`},{default:(0,t.withCtx)(()=>[l.value?((0,t.openBlock)(),(0,t.createElementBlock)(`ul`,{key:0,ref_key:`submenuRef`,ref:c,role:`menu`,class:(0,t.normalizeClass)([`nb-menu nb-submenu`,[p.value]]),style:(0,t.normalizeStyle)(m.value),onMouseenter:x,onMouseleave:S},[(0,t.renderSlot)(o.$slots,`default`)],38)):(0,t.createCommentVNode)(``,!0)]),_:3})]))],64))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return a}});
@@ -1 +0,0 @@
1
- require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./Icon-C8R_r_In.cjs`),n=require(`./TreeContext-XcdJsmjK.cjs`);let r=require(`vue`),i=require(`@nubisco/ui/icons/caret-right`);var a=[`draggable`,`aria-expanded`,`aria-selected`,`aria-disabled`,`aria-grabbed`],o={key:1,class:`nb-tree-node__toggle-spacer`},s={class:`nb-tree-node__label-text`},c={key:3,class:`nb-tree-node__actions`},l={key:0,role:`group`,class:`nb-tree-node__children`},u=(0,r.defineComponent)({__name:`TreeNode`,props:{id:{},label:{},icon:{default:void 0},disabled:{type:Boolean,default:!1},depth:{default:null},draggable:{type:[Boolean,null],default:null}},emits:[`select`,`toggle`,`contextmenu`,`dblclick`],setup(e,{emit:u}){let d=e,f=u,p=(0,r.useSlots)(),m=(0,r.inject)(n.n),h=(0,r.inject)(n.t,0),g=(0,r.computed)(()=>d.depth??h);(0,r.provide)(n.t,g.value+1);let _=(0,r.computed)(()=>!!p.default),v=(0,r.computed)(()=>m?.expandedIds.has(d.id)??!1),y=(0,r.computed)(()=>m?.selectedId===d.id),b=(0,r.computed)(()=>m?.compact??!1),x=(0,r.computed)(()=>b.value?`24px`:`32px`),S=(0,r.computed)(()=>`${16+g.value*16}px`),C=(0,r.computed)(()=>d.disabled?!1:d.draggable===null?m?.draggable??!1:d.draggable),w=(0,r.computed)(()=>m?.drag.dragId===d.id),T=(0,r.computed)(()=>m?.drag.dropTargetId===d.id),E=(0,r.computed)(()=>T.value?m?.drag.dropPosition:null);function D(){d.disabled||!m||(m.select(d.id),f(`select`,d.id),_.value&&(m.toggle(d.id),f(`toggle`,d.id,!v.value)))}function O(e){e.stopPropagation(),!(d.disabled||!m)&&(m.toggle(d.id),f(`toggle`,d.id,!v.value))}function k(){d.disabled||(_.value&&m&&m.toggle(d.id),f(`dblclick`,d.id))}function A(e){f(`contextmenu`,e,d.id)}function j(e){!C.value||!m||!e.dataTransfer||(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,d.id),m.onDragStart(d.id))}function M(e,t){let n=t.getBoundingClientRect(),r=e.clientY-n.top,i=n.height;return r<i*.25?`before`:r>i*.75?`after`:_.value?`inside`:r<i*.5?`before`:`after`}function N(e){if(!m||m.drag.dragId===d.id||d.disabled)return;e.preventDefault(),e.stopPropagation(),e.dataTransfer&&(e.dataTransfer.dropEffect=`move`);let t=e.currentTarget.querySelector(`.nb-tree-node__label`);t&&m.onDragOver(d.id,M(e,t))}function P(e){if(!m)return;let t=e.relatedTarget,n=e.currentTarget;(!t||!n.contains(t))&&m.onDragLeave(d.id)}function F(e){e.preventDefault(),e.stopPropagation(),m&&m.onDrop()}function I(){m&&m.onDragEnd()}function L(e){m&&(e.key===`Enter`?(e.preventDefault(),D()):e.key===`ArrowRight`&&_.value?(e.preventDefault(),v.value||(m.toggle(d.id),f(`toggle`,d.id,!0))):e.key===`ArrowLeft`?(e.preventDefault(),v.value&&(m.toggle(d.id),f(`toggle`,d.id,!1))):e.key===`F2`&&(e.preventDefault(),f(`dblclick`,d.id)))}return(n,u)=>((0,r.openBlock)(),(0,r.createElementBlock)(`li`,{role:`treeitem`,tabindex:`-1`,draggable:C.value||void 0,"aria-expanded":_.value?v.value:void 0,"aria-selected":y.value,"aria-disabled":e.disabled||void 0,"aria-grabbed":C.value?w.value:void 0,class:(0,r.normalizeClass)([`nb-tree-node`,{"nb-tree-node--selected":y.value,"nb-tree-node--disabled":e.disabled,"nb-tree-node--branch":_.value,"nb-tree-node--leaf":!_.value,"nb-tree-node--dragging":w.value,"nb-tree-node--drop-before":E.value===`before`,"nb-tree-node--drop-after":E.value===`after`,"nb-tree-node--drop-inside":E.value===`inside`}]),onClick:(0,r.withModifiers)(D,[`stop`]),onDblclick:(0,r.withModifiers)(k,[`stop`]),onContextmenu:(0,r.withModifiers)(A,[`prevent`]),onKeydown:L,onDragstart:j,onDragover:N,onDragleave:P,onDrop:F,onDragend:I},[(0,r.createElementVNode)(`div`,{class:`nb-tree-node__label`,style:(0,r.normalizeStyle)({minHeight:x.value,paddingInlineStart:S.value})},[_.value?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,{key:0,class:`nb-tree-node__toggle`,onClick:O},[(0,r.createVNode)(t.t,{name:(0,r.unref)(i.regular),size:`xs`,class:(0,r.normalizeClass)([`nb-tree-node__toggle-icon`,{"nb-tree-node__toggle-icon--expanded":v.value}])},null,8,[`name`,`class`])])):((0,r.openBlock)(),(0,r.createElementBlock)(`span`,o)),e.icon?((0,r.openBlock)(),(0,r.createBlock)(t.t,{key:2,name:e.icon,size:`sm`,class:`nb-tree-node__icon`},null,8,[`name`])):(0,r.createCommentVNode)(``,!0),(0,r.createElementVNode)(`span`,s,[(0,r.renderSlot)(n.$slots,`label`,{},()=>[(0,r.createTextVNode)((0,r.toDisplayString)(e.label),1)],!0)]),n.$slots.actions?((0,r.openBlock)(),(0,r.createElementBlock)(`span`,c,[(0,r.renderSlot)(n.$slots,`actions`,{},void 0,!0)])):(0,r.createCommentVNode)(``,!0)],4),_.value&&v.value?((0,r.openBlock)(),(0,r.createElementBlock)(`ul`,l,[(0,r.renderSlot)(n.$slots,`default`,{},void 0,!0)])):(0,r.createCommentVNode)(``,!0)],42,a))}}),d=e.t(u,[[`__scopeId`,`data-v-b43c88e0`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return d}});