@ni/nimble-components 29.7.7 → 29.7.9
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 +51 -22
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +23 -14
- 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/dist/esm/select/index.js +20 -9
- package/dist/esm/select/index.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`
|
|
@@ -9308,7 +9317,7 @@ let NT=class extends Fi{}
|
|
|
9308
9317
|
class LT extends(An(NT)){constructor(){super(...arguments),this.proxy=document.createElement("select")}}const BT=t=>!t.visuallyHidden&&!t.disabled&&!t.hidden,PT=t=>!t.visuallyHidden&&!t.hidden
|
|
9309
9318
|
class zT extends LT{constructor(){super(...arguments),this.appearance=mg,this.errorVisible=!1,this.filterMode=wg.none,this.clearable=!1,this.loadingVisible=!1,this.displayPlaceholder=!1,this.open=!1,this.listboxId=Va("listbox-"),this.hasOverflow=!1,this.filteredOptions=[],this.filter="",this.availableViewportHeight=0,this._value="",this.forcedPosition=!1}get collapsible(){return!(this.multiple||"number"==typeof this.size)}connectedCallback(){super.connectedCallback(),this.forcedPosition=!!this.positionAttribute,this.open&&this.initializeOpenState()}get value(){return x.track(this,"value"),this._value}set value(t){const e=this._value
|
|
9310
9319
|
let n=t
|
|
9311
|
-
if(this.options?.length){const t=this.options.findIndex((t=>t.value===n)),e=this.options[this.selectedIndex]?.value??null,i=this.options[t]?.value??null;-1!==t&&e===i||(n="",this.selectedIndex=t),n=this.firstSelectedOption?.value??n}e
|
|
9320
|
+
if(this.options?.length){const t=this.options.findIndex((t=>t.value===n)),e=this.options[this.selectedIndex]?.value??null,i=this.options[t]?.value??null;-1!==t&&e===i||(n="",this.selectedIndex=t),n=this.firstSelectedOption?.value??n}e!==n&&(this._value=n,super.valueChanged(e,n),x.notify(this,"value"),this.updateDisplayValue())}get displayValue(){return x.track(this,"displayValue"),this.firstSelectedOption?.text??""}anchoredRegionChanged(t,e){this.anchoredRegion&&this.control&&(this.anchoredRegion.anchorElement=this.control)}controlChanged(t,e){this.anchoredRegion&&this.control&&(this.anchoredRegion.anchorElement=this.control)}slottedOptionsChanged(t,e){const n=this.value
|
|
9312
9321
|
this.options.forEach((t=>{const e=x.getNotifier(t)
|
|
9313
9322
|
e.unsubscribe(this,"value"),e.unsubscribe(this,"hidden"),e.unsubscribe(this,"disabled")})),t?.filter(FT).forEach((t=>{const e=x.getNotifier(t)
|
|
9314
9323
|
e.unsubscribe(this,"hidden"),e.unsubscribe(this,"visuallyHidden"),e.unsubscribe(this,"listOptions")}))
|
|
@@ -9320,7 +9329,7 @@ e.subscribe(this,"hidden"),e.subscribe(this,"visuallyHidden"),e.subscribe(this,"
|
|
|
9320
9329
|
let e=!1
|
|
9321
9330
|
if(this.open){const n=t.target.closest("option,[role=option]")
|
|
9322
9331
|
if(e=null!==n,n?.disabled)return}const n=this.selectedIndex
|
|
9323
|
-
super.clickHandler(t),this.open
|
|
9332
|
+
super.clickHandler(t),this.open&&this.selectedIndex!==n&&e&&this.updateValue(!0),this.open=this.collapsible&&!this.open}handleChange(t,e){const n=t
|
|
9324
9333
|
switch(e){case"value":this.updateValue()
|
|
9325
9334
|
break
|
|
9326
9335
|
case"selected":RT(n)&&n.selected?this.selectedIndex=this.options.indexOf(n):this.clearSelect()
|
|
@@ -9342,17 +9351,17 @@ return!this.isSameNode(e)||(this.focus(),!0)}keydownHandler(t){const e=this.sele
|
|
|
9342
9351
|
super.keydownHandler(t)
|
|
9343
9352
|
const n=t.key
|
|
9344
9353
|
if(t.ctrlKey||t.shiftKey)return!0
|
|
9345
|
-
let i=this.openActiveIndex??this.selectedIndex
|
|
9354
|
+
let i=this.openActiveIndex??this.selectedIndex,s=!1
|
|
9346
9355
|
switch(n){case La:if(this.open&&this.filterMode!==wg.none)break
|
|
9347
9356
|
t.preventDefault(),this.collapsible&&this.typeAheadExpired&&(this.open=!this.open),this.open||this.focus()
|
|
9348
9357
|
break
|
|
9349
9358
|
case Oa:case Da:t.preventDefault()
|
|
9350
9359
|
break
|
|
9351
9360
|
case Aa:if(t.preventDefault(),0===this.filteredOptions.length||this.filteredOptions.every((t=>t.disabled)))return!1
|
|
9352
|
-
this.open=!this.open,this.
|
|
9361
|
+
this.open?s=!0:this.open=!0,s&&this.focus()
|
|
9353
9362
|
break
|
|
9354
9363
|
case Ta:if(!this.open){if(this.clearable)return this.clearSelect(),this.updateValue(!0),!0
|
|
9355
|
-
break}this.collapsible&&this.open&&(t.preventDefault(),this.open=!1),i=this.selectedIndex,this.focus()}return this.open||this.selectedIndex
|
|
9364
|
+
break}this.collapsible&&this.open&&(t.preventDefault(),this.open=!1),i=this.selectedIndex,this.focus()}return this.open&&!s||(this.selectedIndex!==i&&(this.selectedIndex=i),e!==this.selectedIndex&&this.updateValue(!0)),s&&(this.open=!1),!(n===Ma||n===Ea)}selectedIndexChanged(t,e){this.setSelectedOptions(),this.open&&this.setActiveOption(this.selectedIndex),this.updateValue()}typeaheadBufferChanged(t,e){if(this.$fastController.isConnected){const t=this.getTypeaheadMatches()
|
|
9356
9365
|
if(t.length){const e=this.options.indexOf(t[0])
|
|
9357
9366
|
this.open&&this.filterMode!==wg.none||this.setActiveOption(e)}this.typeaheadExpired=!1}}disabledChanged(t,e){super.disabledChanged&&super.disabledChanged(t,e),this.ariaDisabled=this.disabled?"true":"false"}formResetCallback(){this.setProxyOptions(),super.setDefaultSelectedOption(),-1===this.selectedIndex&&(this.selectedIndex=0)}selectNextOption(){for(let t=(this.openActiveIndex??this.selectedIndex)+1;t<this.options.length;t++){const e=this.options[t]
|
|
9358
9367
|
if(RT(e)&&BT(e)){this.setActiveOption(t)
|