@ni/nimble-components 29.7.7 → 29.7.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/all-components-bundle.js +31 -13
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +18 -9
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/patterns/dropdown/styles.js +11 -5
- package/dist/esm/patterns/dropdown/styles.js.map +1 -1
- package/dist/esm/rich-text/mention-listbox/index.d.ts +12 -1
- package/dist/esm/rich-text/mention-listbox/index.js +15 -6
- package/dist/esm/rich-text/mention-listbox/index.js.map +1 -1
- package/dist/esm/rich-text/mention-listbox/styles.js +3 -2
- package/dist/esm/rich-text/mention-listbox/styles.js.map +1 -1
- package/dist/esm/rich-text/mention-listbox/template.js +2 -0
- package/dist/esm/rich-text/mention-listbox/template.js.map +1 -1
- package/package.json +1 -1
|
@@ -3138,18 +3138,23 @@ const pg="nimble-icon-arrow-expander-down",fg="above",mg="underline",gg="outline
|
|
|
3138
3138
|
flex-direction: column;
|
|
3139
3139
|
overflow-y: auto;
|
|
3140
3140
|
width: 100%;
|
|
3141
|
+
--ni-private-listbox-visible-option-count: 10.5;
|
|
3142
|
+
--ni-private-listbox-anchor-element-gap: ${Sl};
|
|
3141
3143
|
--ni-private-listbox-padding: ${Sl};
|
|
3142
3144
|
--ni-private-listbox-filter-height: 0px;
|
|
3143
3145
|
--ni-private-listbox-loading-indicator-height: 0px;
|
|
3144
3146
|
max-height: min(
|
|
3145
3147
|
calc(
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3148
|
+
var(--ni-private-listbox-anchor-element-gap) +
|
|
3149
|
+
2 * ${$l} +
|
|
3150
|
+
var(--ni-private-listbox-padding) +
|
|
3151
|
+
${Cl} * var(--ni-private-listbox-visible-option-count) +
|
|
3152
|
+
var(--ni-private-listbox-filter-height) +
|
|
3153
|
+
var(--ni-private-listbox-loading-indicator-height)
|
|
3149
3154
|
),
|
|
3150
3155
|
calc(
|
|
3151
|
-
var(--ni-private-listbox-available-viewport-height) -
|
|
3152
|
-
|
|
3156
|
+
var(--ni-private-listbox-available-viewport-height) -
|
|
3157
|
+
var(--ni-private-listbox-anchor-element-gap)
|
|
3153
3158
|
)
|
|
3154
3159
|
);
|
|
3155
3160
|
box-shadow: ${Nl};
|
|
@@ -7261,8 +7266,9 @@ const H_="nimble-toolbar",U_="Bold",q_="Italics",j_="Bulleted List",W_="Numbered
|
|
|
7261
7266
|
}
|
|
7262
7267
|
|
|
7263
7268
|
.listbox {
|
|
7269
|
+
--ni-private-listbox-visible-option-count: 5.5;
|
|
7270
|
+
--ni-private-listbox-anchor-element-gap: 0px;
|
|
7264
7271
|
min-width: ${Rl};
|
|
7265
|
-
max-height: calc(5.5 * ${Cl});
|
|
7266
7272
|
}
|
|
7267
7273
|
`,J_=Q`
|
|
7268
7274
|
<template>
|
|
@@ -7283,6 +7289,8 @@ const H_="nimble-toolbar",U_="Bold",q_="Italics",j_="Bulleted List",W_="Numbered
|
|
|
7283
7289
|
role="listbox"
|
|
7284
7290
|
@click="${(t,e)=>t.clickHandler(e.event)}"
|
|
7285
7291
|
?disabled="${t=>t.disabled}"
|
|
7292
|
+
style="--ni-private-listbox-available-viewport-height: ${t=>t.availableViewportHeight}px;"
|
|
7293
|
+
${Ut("listbox")}
|
|
7286
7294
|
>
|
|
7287
7295
|
<slot name="option"
|
|
7288
7296
|
${ie({filter:t=>t instanceof HTMLElement&&qn.slottedOptionFilter(t),flatten:!0,property:"slottedOptions"})}
|
|
@@ -7292,16 +7300,17 @@ const H_="nimble-toolbar",U_="Bold",q_="Italics",j_="Bulleted List",W_="Numbered
|
|
|
7292
7300
|
</${Oh}>
|
|
7293
7301
|
</template>
|
|
7294
7302
|
`,Q_=t=>t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase()
|
|
7295
|
-
class tM extends Fi{constructor(){super(...arguments),this.filter="",this.filteredOptions=[],this.anchorElementIntersectionObserver=new IntersectionObserver((t=>{t[0]?.isIntersecting||this.setOpen(!1)}),{threshold:1,root:document})}close(){this.setOpen(!1)}get options(){return x.track(this,"options"),this.filteredOptions?.length?this.filteredOptions:[]}set options(t){this._options=t,x.notify(this,"options")}show(t){
|
|
7303
|
+
class tM extends Fi{constructor(){super(...arguments),this.availableViewportHeight=0,this.filter="",this.filteredOptions=[],this.anchorElementIntersectionObserver=new IntersectionObserver((t=>{t[0]?.isIntersecting||this.setOpen(!1)}),{threshold:1,root:document})}close(){this.setOpen(!1)}get options(){return x.track(this,"options"),this.filteredOptions?.length?this.filteredOptions:[]}set options(t){this._options=t,x.notify(this,"options")}show(t){const e=t.anchorNode.getBoundingClientRect().bottom
|
|
7304
|
+
this.availableViewportHeight=Math.trunc(window.innerHeight-e),this.filter=t.filter,this.anchorElement=t.anchorNode,this.setOpen(!0),this.filterOptions()}keydownHandler(t){if(!this.open)return!1
|
|
7296
7305
|
switch(t.key){case Ba:case Aa:{if(!this.hasSelectableOptions)return!1
|
|
7297
7306
|
const t={href:this.firstSelectedOption.value,displayName:this.firstSelectedOption.text}
|
|
7298
|
-
return this
|
|
7307
|
+
return this.$emit("mention-selected",t),this.setOpen(!1),!0}case Ta:return this.setOpen(!1),!1
|
|
7299
7308
|
default:return super.keydownHandler(t),!1}}filterOptions(){if(this.filter){const t=Q_(this.filter)
|
|
7300
7309
|
this.filteredOptions=this._options.filter((e=>Q_(e.text).includes(t)))}else this.filteredOptions=this._options
|
|
7301
7310
|
this._options.forEach((t=>{t.hidden=!this.filteredOptions.includes(t)})),this.filteredOptions.length?(this.selectedOptions=[this.filteredOptions[0]],this.selectedIndex=this.options.indexOf(this.firstSelectedOption)):(this.selectedOptions=[],this.selectedIndex=-1)}slottedOptionsChanged(t,e){super.slottedOptionsChanged(t,e),this.filterOptions()}clickHandler(t){const e=t.target.closest("option,[role=option]")
|
|
7302
7311
|
if(!e||e.disabled)return!1
|
|
7303
7312
|
const n={href:e.value,displayName:e.text}
|
|
7304
|
-
return this
|
|
7313
|
+
return this.$emit("mention-selected",n),this.setOpen(!1),!0}anchorElementChanged(t,e){t&&this.anchorElementIntersectionObserver.unobserve(t),this.region&&this.anchorElement&&(this.region.anchorElement=this.anchorElement,this.region.update(),this.anchorElementIntersectionObserver.observe(e))}regionChanged(){this.regionNotifier&&this.regionNotifier.unsubscribe(this),this.regionNotifier=x.getNotifier(this.region),this.regionNotifier.subscribe(this)}handleChange(t,e){super.handleChange(t,e),"initialLayoutComplete"===e&&this.focusAndScrollOptionIntoView()}focusAndScrollOptionIntoView(){this.open&&this.firstSelectedOption&&requestAnimationFrame((()=>{this.firstSelectedOption?.scrollIntoView({block:"nearest"})}))}setOpen(t){this.open=t}}t([C],tM.prototype,"open",void 0),t([C],tM.prototype,"region",void 0),t([C],tM.prototype,"availableViewportHeight",void 0),t([C],tM.prototype,"anchorElement",void 0)
|
|
7305
7314
|
const eM=tM.compose({baseName:"rich-text-mention-listbox",template:J_,styles:X_})
|
|
7306
7315
|
_i.getOrCreate().withPrefix("nimble").register(eM())
|
|
7307
7316
|
const nM="nimble-rich-text-mention-listbox",iM=Q`
|