@nubisco/ui 5.52.1 → 5.52.2
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/{AiProvider-CwQByPUa.js → AiProvider-D1Sn67yz.js} +1 -1
- package/dist/{AiProvider-YQRUV0n0.cjs → AiProvider-GiId484Q.cjs} +1 -1
- package/dist/{Breadcrumbs-C_dG1eHp.cjs → Breadcrumbs-Ck445rx6.cjs} +1 -1
- package/dist/{Breadcrumbs-DHHPeG-B.js → Breadcrumbs-DrXxTJB4.js} +1 -1
- package/dist/{ButtonSet-tmTOMWpZ.js → ButtonSet-2vJioRDT.js} +20 -20
- package/dist/{ButtonSet-CmM3Tj5N.cjs → ButtonSet-CbR2EwbT.cjs} +1 -1
- package/dist/{Confirm-q2m_4sBN.js → Confirm-CJQsUNOq.js} +1 -1
- package/dist/{Confirm-CQMJX0lc.cjs → Confirm-jHGXPMJE.cjs} +1 -1
- package/dist/{Modal-RgLIB-Gw.js → Modal-BywbXivu.js} +1 -1
- package/dist/{Modal-B2gNgKIK.cjs → Modal-GsDlHF-E.cjs} +1 -1
- package/dist/{Pagination-dhLORMeq.cjs → Pagination-CvvzkY1W.cjs} +1 -1
- package/dist/{Pagination-DLDVJush.js → Pagination-DccRxFxs.js} +1 -1
- package/dist/Select-C3AHxgi1.cjs +1 -0
- package/dist/{Select-CAXyp4ou.js → Select-e-sgQurr.js} +7 -5
- package/dist/{Walkthrough-CCb4OKc-.js → Walkthrough-BRtkSFsq.js} +2 -2
- package/dist/{Walkthrough-QtFJ_YOo.cjs → Walkthrough-DO75HV1w.cjs} +1 -1
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +8 -8
- package/dist/components/AiProvider.cjs +1 -1
- package/dist/components/AiProvider.mjs +1 -1
- package/dist/components/Breadcrumbs.cjs +1 -1
- package/dist/components/Breadcrumbs.mjs +1 -1
- package/dist/components/ButtonSet.cjs +1 -1
- package/dist/components/ButtonSet.mjs +1 -1
- package/dist/components/ButtonSet.vue.d.ts.map +1 -1
- package/dist/components/Confirm.cjs +1 -1
- package/dist/components/Confirm.mjs +1 -1
- package/dist/components/Modal.cjs +1 -1
- package/dist/components/Modal.mjs +1 -1
- package/dist/components/Pagination.cjs +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Select.cjs +1 -1
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Select.vue.d.ts.map +1 -1
- package/dist/components/Walkthrough.cjs +1 -1
- package/dist/components/Walkthrough.mjs +1 -1
- package/dist/components/Walkthrough.vue.d.ts.map +1 -1
- package/dist/composables/useConfirm.composable.cjs +1 -1
- package/dist/composables/useConfirm.composable.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +8 -8
- package/dist/plugins/vite/index.d.ts +28 -0
- package/dist/plugins/vite/index.d.ts.map +1 -1
- package/dist/plugins/vite/index.js +68 -3
- package/dist/styles/ButtonSet.css +1 -1
- package/dist/styles/Walkthrough.css +1 -1
- package/dist/ui.css +2 -2
- package/package.json +1 -1
- package/src/plugins/vite/index.ts +83 -3
- package/dist/Select-C77tReXr.cjs +0 -1
|
@@ -68,6 +68,21 @@ export interface INubiscoUIOptions {
|
|
|
68
68
|
* rather have the whole sheet.
|
|
69
69
|
*/
|
|
70
70
|
styles?: boolean
|
|
71
|
+
/**
|
|
72
|
+
* Pre-bundle in dev what this plugin makes the app import. Defaults to
|
|
73
|
+
* every component and every icon. Pass `false` to leave `optimizeDeps`
|
|
74
|
+
* alone, or an object to choose.
|
|
75
|
+
*/
|
|
76
|
+
optimizeDeps?:
|
|
77
|
+
| boolean
|
|
78
|
+
| {
|
|
79
|
+
/** Every component entry point. Defaults to true. */
|
|
80
|
+
components?: boolean
|
|
81
|
+
/** Every icon module. Defaults to true. */
|
|
82
|
+
icons?: boolean
|
|
83
|
+
/** Every flag module. Defaults to false: few apps show flags. */
|
|
84
|
+
flags?: boolean
|
|
85
|
+
}
|
|
71
86
|
/**
|
|
72
87
|
* Where the built library lives. Only the library's own build sets this.
|
|
73
88
|
*/
|
|
@@ -100,11 +115,78 @@ const RESOLVER_ENTRIES = Object.entries(COMPONENT_MANIFEST) as [
|
|
|
100
115
|
const FULL_SHEET =
|
|
101
116
|
/(?:^|["'\s(])@nubisco\/ui\/(?:css|dist\/ui\.css)(?=["'\s)]|$)/m
|
|
102
117
|
|
|
118
|
+
/** The glyph names the library ships, or none if the list is missing. */
|
|
119
|
+
function loadGlyphNames(distRoot: string, kind: 'icon' | 'flag'): string[] {
|
|
120
|
+
const file = path.join(distRoot, `${kind}s`, 'names.json')
|
|
121
|
+
if (!existsSync(file)) return []
|
|
122
|
+
return JSON.parse(readFileSync(file, 'utf8'))
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The deep imports this plugin writes into the app, for Vite to pre-bundle.
|
|
127
|
+
*
|
|
128
|
+
* The rewrites happen in `transform`, after Vite's start-up scan has read
|
|
129
|
+
* the app's source, so the scan never sees `@nubisco/ui/components/Button`
|
|
130
|
+
* or `@nubisco/ui/icons/house`. The first page that reaches one Vite has not
|
|
131
|
+
* bundled logs "optimized dependencies changed. reloading" and reloads the
|
|
132
|
+
* whole page: a nav click that seems to do nothing, or an app that restarts
|
|
133
|
+
* under the user. Listing them up front means the first bundle has them.
|
|
134
|
+
*
|
|
135
|
+
* Icons are listed by name because `'@nubisco/ui/icons/*'` cannot be: Vite
|
|
136
|
+
* expands a glob in `include` from the first value of the export, which is
|
|
137
|
+
* the one shared `module.d.ts`, so the pattern matches nothing.
|
|
138
|
+
*/
|
|
139
|
+
export function prebundleIds(
|
|
140
|
+
options: Pick<INubiscoUIOptions, 'components' | 'glyphs' | 'optimizeDeps'>,
|
|
141
|
+
distRoot: string,
|
|
142
|
+
): string[] {
|
|
143
|
+
const choice = options.optimizeDeps ?? true
|
|
144
|
+
if (choice === false) return []
|
|
145
|
+
const want = {
|
|
146
|
+
components: true,
|
|
147
|
+
icons: true,
|
|
148
|
+
flags: false,
|
|
149
|
+
...(typeof choice === 'object' ? choice : {}),
|
|
150
|
+
}
|
|
151
|
+
const glyphs = typeof options.glyphs === 'object' ? options.glyphs : {}
|
|
152
|
+
const pkg = '@nubisco/ui'
|
|
153
|
+
const ids: string[] = []
|
|
154
|
+
if (want.components && options.components !== false) {
|
|
155
|
+
for (const file of new Set(RESOLVER_ENTRIES.map(([, f]) => f))) {
|
|
156
|
+
ids.push(`${pkg}/components/${file}`)
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
for (const kind of ['icon', 'flag'] as const) {
|
|
160
|
+
if (!want[`${kind}s`] || options.glyphs === false) continue
|
|
161
|
+
if (glyphs[`${kind}s`] === false) continue
|
|
162
|
+
for (const name of loadGlyphNames(distRoot, kind)) {
|
|
163
|
+
ids.push(`${pkg}/${kind}s/${name}`)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return ids
|
|
167
|
+
}
|
|
168
|
+
|
|
103
169
|
export function nubiscoUI(options: INubiscoUIOptions = {}): Plugin[] {
|
|
104
170
|
const { components = true, glyphs = true, styles = true } = options
|
|
105
171
|
const componentOptions = typeof components === 'object' ? components : {}
|
|
106
172
|
const plugins: Plugin[] = []
|
|
107
173
|
let resolvedComponents = 0
|
|
174
|
+
const distRoot = options.distRoot ?? defaultDistRoot()
|
|
175
|
+
|
|
176
|
+
plugins.push({
|
|
177
|
+
name: 'nubisco-ui:optimize-deps',
|
|
178
|
+
apply: 'serve',
|
|
179
|
+
config() {
|
|
180
|
+
/*
|
|
181
|
+
* Only for an installed copy. A package linked from a workspace is
|
|
182
|
+
* served as source, which is what makes its edits hot-reload, and
|
|
183
|
+
* listing it here would bundle it and lose that.
|
|
184
|
+
*/
|
|
185
|
+
if (!distRoot.split(path.sep).includes('node_modules')) return
|
|
186
|
+
const include = prebundleIds(options, distRoot)
|
|
187
|
+
if (include.length) return { optimizeDeps: { include } }
|
|
188
|
+
},
|
|
189
|
+
})
|
|
108
190
|
|
|
109
191
|
if (glyphs !== false) {
|
|
110
192
|
plugins.push(nubiscoGlyphs(typeof glyphs === 'object' ? glyphs : {}))
|
|
@@ -114,9 +196,7 @@ export function nubiscoUI(options: INubiscoUIOptions = {}): Plugin[] {
|
|
|
114
196
|
const lookup = new Map(RESOLVER_ENTRIES)
|
|
115
197
|
// Set by the first non-vendor module found importing the full sheet.
|
|
116
198
|
let fullSheetImporter: string | null = null
|
|
117
|
-
const styleManifest = styles
|
|
118
|
-
? loadStyleManifest(options.distRoot ?? defaultDistRoot())
|
|
119
|
-
: {}
|
|
199
|
+
const styleManifest = styles ? loadStyleManifest(distRoot) : {}
|
|
120
200
|
|
|
121
201
|
plugins.push(
|
|
122
202
|
nubiscoImports({
|
package/dist/Select-C77tReXr.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./Button-5ClGtoaz.cjs`),t=require(`./Icon-CssV4E2-.cjs`),n=require(`./composables/useNbStrings.composable.cjs`),r=require(`./Label-CjxnZgNy.cjs`),i=require(`./Message-BJO4MjiQ.cjs`),a=require(`./Grid-BOtE_jXr.cjs`),o=require(`./composables/useFieldMessage.composable.cjs`),s=require(`./InputGroup.context-BHj-IvcT.cjs`),ee=require(`./composables/useMenuSurface.composable.cjs`);let c=require(`vue`),l=require(`@nubisco/ui/icons/caret-down`),u=require(`@nubisco/ui/icons/caret-up`),d=require(`@nubisco/ui/icons/x`);var te=[`id`,`aria-expanded`,`aria-controls`,`aria-activedescendant`,`aria-disabled`,`aria-required`,`aria-invalid`,`aria-describedby`,`disabled`],ne={key:2,class:`nb-select__clear-space`,"aria-hidden":`true`},re=[`id`,`aria-expanded`,`aria-controls`,`aria-activedescendant`,`aria-disabled`,`aria-required`,`aria-invalid`,`aria-describedby`,`disabled`],ie={key:1,class:`nb-select__inner-label`},ae={key:0,class:`nb-select__asterisk`,"aria-hidden":`true`},oe={key:0,class:`nb-select__clear-space`,"aria-hidden":`true`},se=[`id`,`aria-multiselectable`],ce={key:0,class:`nb-select__search`},le=[`placeholder`,`aria-label`,`aria-controls`,`aria-activedescendant`],ue=[`aria-labelledby`],de=[`id`],fe=[`id`,`data-index`,`aria-selected`,`aria-disabled`,`onMouseenter`,`onClick`],pe={key:0,class:`nb-select__option-check`,"aria-hidden":`true`},me={key:0,viewBox:`0 0 10 8`,fill:`none`,width:`10`,height:`8`},he={class:`nb-select__option-label`},ge={key:1,class:`nb-select__empty`},_e={key:2,class:`nb-select__empty`},ve=[`placeholder`,`onKeydown`],f=(0,c.defineComponent)({__name:`Select`,props:{modelValue:{default:null},options:{default:()=>[]},multiple:{type:Boolean,default:!1},creatable:{type:Boolean,default:!1},createPlaceholder:{default:``},clearable:{type:Boolean,default:!1},clearLabel:{default:void 0},searchable:{type:Boolean,default:!1},searchPlaceholder:{default:`Search`},noResultsLabel:{default:`No results`},anchor:{type:[Function,null],default:null},selectedMark:{default:`fill`},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(f,{expose:ye,emit:be}){let p=f,m=be,h=(e,{slots:t})=>e.wrap?(0,c.h)(`div`,{class:`nb-select__control`},t.default?.()):t.default?.();h.props=[`wrap`];let g=(0,c.ref)(``),_=(0,c.ref)(``),v=(0,c.ref)(null);function xe(){let e=g.value.trim();e&&(m(`create`,e),g.value=``)}let y=(0,c.ref)(!1),b=(0,c.ref)(!1),x=(0,c.ref)(-1),S=(0,c.ref)(null),C=(0,c.ref)(null),w=(0,c.useSlots)(),Se=()=>(typeof p.anchor==`function`?p.anchor():p.anchor)??C.value??S.value;function T(){(C.value??S.value?.querySelector(`button, [tabindex]`))?.focus()}let E=(0,c.ref)(null);ee.useMenuSurface(E);let D=(0,c.ref)({position:`fixed`,top:`0px`,left:`0px`,width:`0px`,zIndex:`9999`}),O=s.n(p,`nb-select-${(0,c.useId)()}`),k=O.id,A=O.disabled,j=O.grouped,{ids:M,messageId:Ce,invalid:N,live:P,key:F}=o.useFieldMessage(p,k),we=(0,c.computed)(()=>o.joinDescribedBy(j?void 0:Ce.value,O.describedBy.value)),Te=(0,c.computed)(()=>N.value??(O.status.value===`error`?`true`:void 0)),Ee=(0,c.computed)(()=>!j&&!!p.error||O.status.value===`error`),I=(0,c.computed)(()=>`${k.value}-listbox`),L=e=>`${k.value}-option-${e}`,R=(0,c.computed)(()=>y.value&&!p.searchable&&x.value>=0?L(x.value):void 0),z=(0,c.computed)(()=>p.modelValue==null?[]:Array.isArray(p.modelValue)?p.modelValue:[p.modelValue]),B=(0,c.computed)(()=>{if(!(p.multiple||z.value.length!==1))return(p.options??[]).find(e=>e.value===z.value[0])?.icon}),V=(0,c.computed)(()=>{if(z.value.length===0)return``;let e=p.options??[];return p.multiple?z.value.length===1?e.find(e=>e.value===z.value[0])?.label??String(z.value[0]):z.value.length===2?z.value.map(t=>e.find(e=>e.value===t)?.label??String(t)).join(`, `):`${z.value.length} selected`:e.find(e=>e.value===z.value[0])?.label??String(z.value[0])});function H(e){return z.value.includes(e)}let De=e=>e.normalize(`NFD`).replace(/\p{M}/gu,``).toLowerCase(),U=(0,c.computed)(()=>{let e=p.options??[],t=p.searchable?De(_.value.trim()):``,n=new Set;return e.forEach((e,r)=>{(!t||De(e.label).includes(t))&&n.add(r)}),n}),Oe=(0,c.computed)(()=>{let e=[];return(p.options??[]).forEach((t,n)=>{if(!U.value.has(n))return;let r=e[e.length-1];(!r||r.name!==t.group)&&e.push({key:`${e.length}:${t.group??``}`,name:t.group,labelId:`${k.value}-group-${e.length}`,entries:[]}),e[e.length-1].entries.push({option:t,index:n})}),e});function W(e,t){let n=p.options??[];for(let r=e+t;r>=0&&r<n.length;r+=t)if(!n[r].disabled&&U.value.has(r))return r;return e}function ke(e){if(e.disabled)return;let t;if(p.multiple){let n=[...z.value],r=n.indexOf(e.value);r>=0?n.splice(r,1):n.push(e.value),t=n}else t=e.value,q();m(`update:modelValue`,t),m(`change`,t)}function G(){let e=Se();if(!e)return;let t=e.getBoundingClientRect(),n=E.value?.offsetHeight??0,r=window.innerHeight-t.bottom,i=t.top,a=n>0&&r<n&&i>r,o=w.trigger?Math.max(t.width,240):t.width,s=w.trigger?Math.max(8,Math.min(t.left,window.innerWidth-o-8)):t.left;D.value={position:`fixed`,top:a?`${t.top-n}px`:`${t.bottom}px`,left:`${s}px`,width:`${o}px`,zIndex:`9999`}}function K(){if(A.value)return;y.value=!0,G();let e=p.options??[];x.value=z.value.length>0?Math.max(0,e.findIndex(e=>e.value===z.value[0])):-1,(0,c.nextTick)(()=>{G(),Z(),v.value?.focus({preventScroll:!0})})}function q(){let e=!!E.value?.contains(document.activeElement);y.value=!1,x.value=-1,_.value=``,e&&T()}function J(){y.value?q():K()}function Y(e){let t=e.target,n=S.value?.contains(t)??!1,r=E.value?.contains(t)??!1;!n&&!r&&q()}function X(){y.value&&G()}(0,c.watch)(y,e=>{e?(document.addEventListener(`mousedown`,Y),window.addEventListener(`scroll`,X,!0),window.addEventListener(`resize`,X)):(document.removeEventListener(`mousedown`,Y),window.removeEventListener(`scroll`,X,!0),window.removeEventListener(`resize`,X))}),(0,c.onBeforeUnmount)(()=>{document.removeEventListener(`mousedown`,Y),window.removeEventListener(`scroll`,X,!0),window.removeEventListener(`resize`,X)});function Ae(e){let t=p.options??[];if(!y.value){(e.key===`Enter`||e.key===` `||e.key===`ArrowDown`)&&(e.preventDefault(),K());return}e.key===`Escape`?(q(),e.preventDefault()):e.key===`Tab`?q():e.key===`ArrowDown`?(e.preventDefault(),x.value=W(x.value,1),Z()):e.key===`ArrowUp`?(e.preventDefault(),x.value>0&&(x.value=W(x.value,-1)),Z()):(e.key===`Enter`||e.key===` `)&&x.value>=0&&(e.preventDefault(),ke(t[x.value]))}function Z(){(0,c.nextTick)(()=>{!E.value||x.value<0||E.value.querySelector(`[data-index="${x.value}"]`)?.scrollIntoView({block:`nearest`})})}(0,c.watch)(_,()=>{if(!y.value)return;let e=W(-1,1);x.value=e===-1?-1:e,Z()});function je(e){if(e.key===` `){e.stopPropagation();return}if(e.key===`Home`||e.key===`End`){e.stopPropagation();return}Ae(e)}let Me=(0,c.computed)(()=>({isOpen:y.value,toggle:J,open:K,close:q,attrs:{"aria-expanded":y.value,"aria-haspopup":`listbox`,"aria-controls":y.value?I.value:void 0,"aria-activedescendant":R.value,"aria-invalid":N.value,onClick:J}})),Ne=n.useNbStrings(),Pe=(0,c.computed)(()=>p.clearLabel??Ne.value.selectClear),Q=(0,c.computed)(()=>p.clearable&&!A.value&&z.value.length>0);function $(){let e=p.multiple?[]:null;q(),m(`update:modelValue`,e),m(`change`,e),T()}let Fe=(0,c.computed)(()=>[`nb-select`,`nb-select--${p.variant}`,`nb-select--${O.size.value}`,{"nb-select--open":y.value,"nb-select--focused":b.value&&!y.value,"nb-select--error":Ee.value,"nb-select--warning":!Ee.value&&(!j&&!!p.warning||O.status.value===`warning`),"nb-select--multiple":p.multiple,"nb-select--bare":!!w.trigger}]);return ye({open:K,close:q}),(n,o)=>((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,null,[(0,c.createElementVNode)(`div`,{ref_key:`rootRef`,ref:S,class:(0,c.normalizeClass)(Fe.value),onKeydown:Ae},[n.$slots.trigger?(0,c.renderSlot)(n.$slots,`trigger`,(0,c.normalizeProps)((0,c.mergeProps)({key:0},Me.value))):f.variant===`default`?((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:1},[n.$slots.label&&!(0,c.unref)(j)?(0,c.renderSlot)(n.$slots,`label`,{key:0}):f.label&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(r.t,{key:1,for:(0,c.unref)(k),required:f.required,disabled:(0,c.unref)(A)},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,c.createCommentVNode)(``,!0),(0,c.createVNode)(h,{wrap:f.clearable},{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`button`,{id:(0,c.unref)(k),ref_key:`triggerRef`,ref:C,type:`button`,class:`nb-select__trigger`,role:`combobox`,"aria-expanded":y.value,"aria-haspopup":`listbox`,"aria-controls":y.value?I.value:void 0,"aria-activedescendant":R.value,"aria-disabled":(0,c.unref)(A)||void 0,"aria-required":f.required||void 0,"aria-invalid":Te.value,"aria-describedby":we.value,disabled:(0,c.unref)(A)||void 0,onClick:J,onFocus:o[0]||=e=>b.value=!0,onBlur:o[1]||=e=>b.value=!1},[(0,c.createElementVNode)(`span`,{class:(0,c.normalizeClass)([`nb-select__value`,{"nb-select__value--placeholder":!V.value,"nb-select__value--with-icon":!!B.value}])},[B.value?((0,c.openBlock)(),(0,c.createBlock)(t.t,{key:0,class:`nb-select__value-icon`,name:B.value,size:16},null,8,[`name`])):(0,c.createCommentVNode)(``,!0),V.value?(0,c.renderSlot)(n.$slots,`value`,{key:1,values:z.value},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(V.value),1)]):((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:2},[(0,c.createTextVNode)((0,c.toDisplayString)(f.placeholder),1)],64))],2),f.error&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{key:0,variant:`error`,"icon-only":!0,live:`off`,"aria-hidden":`true`,class:`nb-select__status-icon`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.error),1)]),_:1})):f.warning&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{key:1,variant:`warning`,"icon-only":!0,live:`off`,"aria-hidden":`true`,class:`nb-select__status-icon`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.warning),1)]),_:1})):(0,c.createCommentVNode)(``,!0),Q.value?((0,c.openBlock)(),(0,c.createElementBlock)(`span`,ne)):(0,c.createCommentVNode)(``,!0),(0,c.createVNode)(a.t,{align:`center`,justify:`center`,class:`nb-select__caret`},{default:(0,c.withCtx)(()=>[(0,c.createVNode)(t.t,{name:y.value?(0,c.unref)(u.regular):(0,c.unref)(l.regular),size:16},null,8,[`name`])]),_:1})],40,te),Q.value?((0,c.openBlock)(),(0,c.createBlock)(e.t,{key:0,variant:`ghost`,icon:(0,c.unref)(d.regular),size:`xs`,label:Pe.value,class:`nb-select__clear`,onClick:$,onKeydown:[o[2]||=(0,c.withKeys)((0,c.withModifiers)(()=>{},[`stop`]),[`enter`]),o[3]||=(0,c.withKeys)((0,c.withModifiers)(()=>{},[`stop`]),[`space`])]},null,8,[`icon`,`label`])):(0,c.createCommentVNode)(``,!0)]),_:3},8,[`wrap`]),f.error&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{id:(0,c.unref)(M).error,key:(0,c.unref)(F),variant:`error`,live:(0,c.unref)(P),class:`nb-select__message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.error),1)]),_:1},8,[`id`,`live`])):f.warning&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{id:(0,c.unref)(M).warning,key:(0,c.unref)(F),variant:`warning`,live:(0,c.unref)(P),class:`nb-select__message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.warning),1)]),_:1},8,[`id`,`live`])):f.helper&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{id:(0,c.unref)(M).helper,key:(0,c.unref)(F),variant:`helper`,live:(0,c.unref)(P),class:`nb-select__message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.helper),1)]),_:1},8,[`id`,`live`])):(0,c.createCommentVNode)(``,!0)],64)):f.variant===`fluid`?((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:2},[(0,c.createVNode)(h,{wrap:f.clearable},{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`button`,{id:(0,c.unref)(k),ref_key:`triggerRef`,ref:C,type:`button`,class:`nb-select__trigger`,role:`combobox`,"aria-expanded":y.value,"aria-haspopup":`listbox`,"aria-controls":y.value?I.value:void 0,"aria-activedescendant":R.value,"aria-disabled":(0,c.unref)(A)||void 0,"aria-required":f.required||void 0,"aria-invalid":Te.value,"aria-describedby":we.value,disabled:(0,c.unref)(A)||void 0,onClick:J,onFocus:o[4]||=e=>b.value=!0,onBlur:o[5]||=e=>b.value=!1},[(f.label||n.$slots.label)&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(a.t,{key:0,dir:`row`,align:`center`,gap:`xs`,class:`nb-select__inner-header`},{default:(0,c.withCtx)(()=>[n.$slots.label?(0,c.renderSlot)(n.$slots,`label`,{key:0}):((0,c.openBlock)(),(0,c.createElementBlock)(`label`,ie,[(0,c.createTextVNode)((0,c.toDisplayString)(f.label)+` `,1),f.required?((0,c.openBlock)(),(0,c.createElementBlock)(`span`,ae,`*`)):(0,c.createCommentVNode)(``,!0)])),f.helper&&!f.error&&!f.warning?((0,c.openBlock)(),(0,c.createBlock)(i.t,{key:2,id:(0,c.unref)(M).helper,variant:`helper`,"icon-only":!0,live:`off`,"aria-hidden":`true`,class:`nb-select__inner-message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.helper),1)]),_:1},8,[`id`])):(0,c.createCommentVNode)(``,!0)]),_:3})):(0,c.createCommentVNode)(``,!0),(0,c.createVNode)(a.t,{dir:`row`,align:`end`,flex:``,class:`nb-select__value-row`},{default:(0,c.withCtx)(()=>[(0,c.createElementVNode)(`span`,{class:(0,c.normalizeClass)([`nb-select__value`,{"nb-select__value--placeholder":!V.value,"nb-select__value--with-icon":!!B.value}])},[B.value?((0,c.openBlock)(),(0,c.createBlock)(t.t,{key:0,class:`nb-select__value-icon`,name:B.value,size:16},null,8,[`name`])):(0,c.createCommentVNode)(``,!0),V.value?(0,c.renderSlot)(n.$slots,`value`,{key:1,values:z.value},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(V.value),1)]):((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:2},[(0,c.createTextVNode)((0,c.toDisplayString)(f.placeholder),1)],64))],2),Q.value?((0,c.openBlock)(),(0,c.createElementBlock)(`span`,oe)):(0,c.createCommentVNode)(``,!0),(0,c.createVNode)(a.t,{align:`center`,justify:`center`,class:`nb-select__caret`},{default:(0,c.withCtx)(()=>[(0,c.createVNode)(t.t,{name:y.value?(0,c.unref)(u.regular):(0,c.unref)(l.regular),size:16},null,8,[`name`])]),_:1})]),_:3})],40,re),Q.value?((0,c.openBlock)(),(0,c.createBlock)(e.t,{key:0,variant:`ghost`,icon:(0,c.unref)(d.regular),size:`xs`,label:Pe.value,class:`nb-select__clear`,onClick:$,onKeydown:[o[6]||=(0,c.withKeys)((0,c.withModifiers)(()=>{},[`stop`]),[`enter`]),o[7]||=(0,c.withKeys)((0,c.withModifiers)(()=>{},[`stop`]),[`space`])]},null,8,[`icon`,`label`])):(0,c.createCommentVNode)(``,!0)]),_:3},8,[`wrap`]),f.error&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{id:(0,c.unref)(M).error,key:(0,c.unref)(F),variant:`error`,live:(0,c.unref)(P),class:`nb-select__fluid-message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.error),1)]),_:1},8,[`id`,`live`])):f.warning&&!(0,c.unref)(j)?((0,c.openBlock)(),(0,c.createBlock)(i.t,{id:(0,c.unref)(M).warning,key:(0,c.unref)(F),variant:`warning`,live:(0,c.unref)(P),class:`nb-select__fluid-message`},{default:(0,c.withCtx)(()=>[(0,c.createTextVNode)((0,c.toDisplayString)(f.warning),1)]),_:1},8,[`id`,`live`])):(0,c.createCommentVNode)(``,!0)],64)):(0,c.createCommentVNode)(``,!0)],34),((0,c.openBlock)(),(0,c.createBlock)(c.Teleport,{to:`body`},[(0,c.createVNode)(c.Transition,{name:`nb-select-pop`},{default:(0,c.withCtx)(()=>[y.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,id:I.value,ref_key:`dropdownRef`,ref:E,class:(0,c.normalizeClass)([`nb-select__dropdown`,{"nb-select__dropdown--check":f.selectedMark===`check`,"nb-select__dropdown--anchored":!!n.$slots.trigger}]),style:(0,c.normalizeStyle)(D.value),role:`listbox`,"aria-multiselectable":f.multiple||void 0},[f.searchable?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,ce,[(0,c.withDirectives)((0,c.createElementVNode)(`input`,{ref_key:`searchRef`,ref:v,"onUpdate:modelValue":o[8]||=e=>_.value=e,type:`search`,class:`nb-select__search-input`,autocomplete:`off`,spellcheck:`false`,placeholder:f.searchPlaceholder,"aria-label":f.searchPlaceholder,"aria-controls":I.value,"aria-activedescendant":x.value>=0?L(x.value):void 0,onKeydown:je},null,40,le),[[c.vModelText,_.value]])])):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(Oe.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:e.key,class:`nb-select__group`,role:`group`,"aria-labelledby":e.name?e.labelId:void 0},[e.name?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,id:e.labelId,class:`nb-select__group-label`},(0,c.toDisplayString)(e.name),9,de)):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(e.entries,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{id:L(e.index),key:e.option.value,"data-index":e.index,class:(0,c.normalizeClass)([`nb-select__option`,{"nb-select__option--selected":H(e.option.value),"nb-select__option--highlighted":x.value===e.index,"nb-select__option--disabled":e.option.disabled}]),role:`option`,"aria-selected":H(e.option.value),"aria-disabled":e.option.disabled||void 0,onMouseenter:t=>x.value=e.index,onClick:t=>ke(e.option)},[f.multiple||f.selectedMark===`check`?((0,c.openBlock)(),(0,c.createElementBlock)(`span`,pe,[H(e.option.value)?((0,c.openBlock)(),(0,c.createElementBlock)(`svg`,me,[...o[12]||=[(0,c.createElementVNode)(`path`,{d:`M1 4l3 3 5-6`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,-1)]])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),e.option.icon?((0,c.openBlock)(),(0,c.createBlock)(t.t,{key:1,class:`nb-select__option-icon`,name:e.option.icon,size:16},null,8,[`name`])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`span`,he,[(0,c.renderSlot)(n.$slots,`option`,{option:e.option},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.option.label),1)])])],42,fe))),128))],8,ue))),128)),!f.options||f.options.length===0?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,ge,` No options `)):f.searchable&&U.value.size===0?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,_e,(0,c.toDisplayString)(f.noResultsLabel),1)):(0,c.createCommentVNode)(``,!0),f.creatable?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:3,class:`nb-select__create`,onMousedown:o[11]||=(0,c.withModifiers)(()=>{},[`prevent`])},[(0,c.withDirectives)((0,c.createElementVNode)(`input`,{"onUpdate:modelValue":o[9]||=e=>g.value=e,type:`text`,class:`nb-select__create-input`,placeholder:f.createPlaceholder||`Add new…`,onKeydown:[(0,c.withKeys)((0,c.withModifiers)(xe,[`prevent`]),[`enter`]),o[10]||=(0,c.withModifiers)(()=>{},[`stop`])]},null,40,ve),[[c.vModelText,g.value]])],32)):(0,c.createCommentVNode)(``,!0)],14,se)):(0,c.createCommentVNode)(``,!0)]),_:3})]))],64))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|