@ni/ok-components 1.6.4 → 1.6.6

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.
@@ -21,7 +21,9 @@ if("undefined"!=typeof self)return self
21
21
  if("undefined"!=typeof window)return window
22
22
  try{return new Function("return this")()}catch{return{}}}()
23
23
  void 0===a.trustedTypes&&(a.trustedTypes={createPolicy:(t,e)=>e})
24
- const l={configurable:!1,enumerable:!1,writable:!1}
24
+ for(const t of["Node","Element","HTMLElement","ShadowRoot","Event","CustomEvent","MutationObserver","ResizeObserver","IntersectionObserver","CSSStyleSheet"])void 0===a[t]&&(a[t]=class{})
25
+ if(void 0===a.customElements){const t=new Map,e=new Map
26
+ a.customElements={define(n,i){t.has(n)||(t.set(n,i),e.set(i,n))},get:e=>t.get(e),getName:t=>e.get(t)??null,whenDefined:()=>Promise.resolve(),upgrade(){}}}const l={configurable:!1,enumerable:!1,writable:!1}
25
27
  void 0===a.FAST&&Reflect.defineProperty(a,"FAST",{value:Object.create(null),...l})
26
28
  const c=a.FAST
27
29
  if(void 0===c.getById){const t=Object.create(null)
@@ -36,7 +38,7 @@ function n(){if(e.length)throw e.shift()}function i(t){try{t.call()}catch(t){e.p
36
38
  for(;e<t.length;)if(i(t[e]),e++,e>1024){for(let n=0,i=t.length-e;n<i;n++)t[n]=t[n+e]
37
39
  t.length-=e,e=0}t.length=0}return Object.freeze({enqueue:function(e){t.length<1&&a.requestAnimationFrame(o),t.push(e)},process:o})}),p=a.trustedTypes.createPolicy("fast-html",{createHTML:t=>t})
38
40
  let f=p
39
- const m=`fast-${Math.random().toString(36).substring(2,8)}`,g=`${m}{`,v=`}${m}`,b=Object.freeze({supportsAdoptedStyleSheets:Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(t){if(f!==p)throw new Error("The HTML policy can only be set once.")
41
+ const m=`fast-${Math.random().toString(36).substring(2,8)}`,g=`${m}{`,v=`}${m}`,b=Object.freeze({supportsAdoptedStyleSheets:"undefined"!=typeof document&&"undefined"!=typeof CSSStyleSheet&&Array.isArray(document.adoptedStyleSheets)&&"replace"in CSSStyleSheet.prototype,setHTMLPolicy(t){if(f!==p)throw new Error("The HTML policy can only be set once.")
40
42
  f=t},createHTML:t=>f.createHTML(t),isMarker:t=>t&&8===t.nodeType&&t.data.startsWith(m),extractDirectiveIndexFromMarker:t=>parseInt(t.data.replace(`${m}:`,"")),createInterpolationPlaceholder:t=>`${g}${t}${v}`,createCustomAttributePlaceholder(t,e){return`${t}="${this.createInterpolationPlaceholder(e)}"`},createBlockPlaceholder:t=>`\x3c!--${m}:${t}--\x3e`,queueUpdate:u.enqueue,processUpdates:u.process,nextUpdate:()=>new Promise(u.enqueue),setAttribute(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)},setBooleanAttribute(t,e,n){n?t.setAttribute(e,""):t.removeAttribute(e)},removeChildNodes(t){for(let e=t.firstChild;null!==e;e=t.firstChild)t.removeChild(e)},createTemplateWalker:t=>document.createTreeWalker(t,133,null,!1)})
41
43
  class y{constructor(t,e){this.sub1=void 0,this.sub2=void 0,this.spillover=void 0,this.source=t,this.sub1=e}has(t){return void 0===this.spillover?this.sub1===t||this.sub2===t:-1!==this.spillover.indexOf(t)}subscribe(t){const e=this.spillover
42
44
  if(void 0===e){if(this.has(t))return
@@ -597,7 +599,7 @@ this.slottedBreadcrumbItems.forEach(e=>{const n=e===t
597
599
  this.setItemSeparator(e,n),this.setAriaCurrent(e,n)})}}setItemSeparator(t,e){t instanceof _n&&(t.separator=!e)}findChildWithHref(t){return t.childElementCount>0?t.querySelector("a[href]"):t.shadowRoot?.childElementCount?t.shadowRoot?.querySelector("a[href]"):null}setAriaCurrent(t,e){const n=this.findChildWithHref(t)
598
600
  null===n&&t.hasAttribute("href")&&t instanceof _n?e?t.setAttribute("aria-current","page"):t.removeAttribute("aria-current"):null!==n&&(e?n.setAttribute("aria-current","page"):n.removeAttribute("aria-current"))}}
599
601
  t([C],In.prototype,"slottedBreadcrumbItems",void 0)
600
- const Mn="form-associated-proxy",En="ElementInternals",An=En in window&&"setFormValue"in window[En].prototype,Tn=new WeakMap
602
+ const Mn="form-associated-proxy",En="ElementInternals",An="undefined"!=typeof window&&En in window&&"setFormValue"in window[En].prototype,Tn=new WeakMap
601
603
  function On(t){const e=class extends t{static get formAssociated(){return An}get validity(){return this.elementInternals?this.elementInternals.validity:this.proxy.validity}get form(){return this.elementInternals?this.elementInternals.form:this.proxy.form}get validationMessage(){return this.elementInternals?this.elementInternals.validationMessage:this.proxy.validationMessage}get willValidate(){return this.elementInternals?this.elementInternals.willValidate:this.proxy.willValidate}get labels(){if(this.elementInternals)return Object.freeze(Array.from(this.elementInternals.labels))
602
604
  if(this.proxy instanceof HTMLElement&&this.proxy.ownerDocument&&this.id){const t=this.proxy.labels,e=Array.from(this.proxy.getRootNode().querySelectorAll(`[for='${this.id}']`)),n=t?e.concat(Array.from(t)):e
603
605
  return Object.freeze(n)}return d}valueChanged(t,e){this.dirtyValue=!0,this.proxy instanceof HTMLElement&&(this.proxy.value=this.value),this.currentValue=this.value,this.setFormValue(this.value),this.validate()}currentValueChanged(){this.value=this.currentValue}initialValueChanged(t,e){this.dirtyValue||(this.value=this.initialValue,this.dirtyValue=!1)}disabledChanged(t,e){this.proxy instanceof HTMLElement&&(this.proxy.disabled=this.disabled),b.queueUpdate(()=>this.classList.toggle("disabled",this.disabled))}nameChanged(t,e){this.proxy instanceof HTMLElement&&(this.proxy.name=this.name)}requiredChanged(t,e){this.proxy instanceof HTMLElement&&(this.proxy.required=this.required),b.queueUpdate(()=>this.classList.toggle("required",this.required)),this.validate()}get elementInternals(){if(!An)return null
@@ -686,7 +688,7 @@ class ni{}function ii(t){const e=t.parentElement
686
688
  if(e)return e
687
689
  {const e=t.getRootNode()
688
690
  if(e.host instanceof HTMLElement)return e.host}return null}t([C],ni.prototype,"ariaAutoComplete",void 0),t([C],ni.prototype,"ariaControls",void 0),je(ni,Wn),je(ei,ne,ni)
689
- const oi=document.createElement("div")
691
+ const oi="undefined"==typeof document?{}:document.createElement("div")
690
692
  class ri{setProperty(t,e){b.queueUpdate(()=>this.target.setProperty(t,e))}removeProperty(t){b.queueUpdate(()=>this.target.removeProperty(t))}}class si extends ri{constructor(){super()
691
693
  const t=new CSSStyleSheet
692
694
  this.target=t.cssRules[t.insertRule(":root{}")].style,document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}}class ai extends ri{constructor(){super(),this.style=document.createElement("style"),document.head.appendChild(this.style)
@@ -705,9 +707,10 @@ const n=pi.getOrCreate(this.normalizeRoot(t))
705
707
  for(const t in di.properties)n.setProperty(t,di.properties[t])}}static unregisterRoot(t){const{roots:e}=di
706
708
  if(e.has(t)){e.delete(t)
707
709
  const n=pi.getOrCreate(di.normalizeRoot(t))
708
- for(const t in di.properties)n.removeProperty(t)}}static normalizeRoot(t){return t===oi?document:t}}const hi=new WeakMap,ui=b.supportsAdoptedStyleSheets?class extends ri{constructor(t){super()
710
+ for(const t in di.properties)n.removeProperty(t)}}static normalizeRoot(t){return t===oi&&"undefined"!=typeof document?document:t}}const hi=new WeakMap,ui=b.supportsAdoptedStyleSheets?class extends ri{constructor(t){super()
709
711
  const e=new CSSStyleSheet
710
- e[nt]=!0,this.target=e.cssRules[e.insertRule(":host{}")].style,t.$fastController.addStyles(Q.create([e]))}}:li,pi=Object.freeze({getOrCreate(t){if(hi.has(t))return hi.get(t)
712
+ e[nt]=!0,this.target=e.cssRules[e.insertRule(":host{}")].style,t.$fastController.addStyles(Q.create([e]))}}:li,pi=Object.freeze({getOrCreate(t){if("undefined"==typeof document)return{setProperty(){},removeProperty(){}}
713
+ if(hi.has(t))return hi.get(t)
711
714
  let e
712
715
  return t===oi?e=new di:t instanceof Document?e=b.supportsAdoptedStyleSheets?new si:new ai:e=t instanceof kt?new ui(t):new ci(t),hi.set(t,e),e}})
713
716
  class fi extends St{get appliedTo(){return[...this._appliedTo]}static from(t){return new fi({name:"string"==typeof t?t:t.name,cssCustomPropertyName:"string"==typeof t?t:void 0===t.cssCustomPropertyName?t.name:t.cssCustomPropertyName})}static isCSSDesignToken(t){return"string"==typeof t.cssCustomProperty}static isDerivedDesignTokenValue(t){return"function"==typeof t}static{this.uniqueId=(()=>{let t=0
@@ -1016,7 +1019,7 @@ class Vo extends xn{}const Ho=t=>`${zo(t)}:host{box-sizing:border-box;}*{box-siz
1016
1019
  color-scheme: dark;
1017
1020
  }
1018
1021
  `
1019
- class ka{constructor(){this.lang=document.documentElement.lang
1022
+ class ka{constructor(){if(this.lang="undefined"==typeof document?"":document.documentElement.lang,"undefined"==typeof document)return
1020
1023
  new MutationObserver(t=>{for(const e of t)"attributes"===e.type&&"lang"===e.attributeName&&(this.lang=e.target.lang)}).observe(document.documentElement,{attributeFilter:["lang"]})}}t([C],ka.prototype,"lang",void 0)
1021
1024
  const Sa=new ka
1022
1025
  function $a(t){try{return new Intl.Locale(t),!0}catch(t){return!1}}const _a=xi.create({name:"lang",cssCustomPropertyName:null}).withDefault(()=>$a(Sa.lang)?Sa.lang:"en-US"),Ia=xi.create({name:"direction",cssCustomPropertyName:null}).withDefault(mn.ltr),Ma=xi.create({name:"theme",cssCustomPropertyName:null}).withDefault(qo)
@@ -11894,9 +11897,6 @@ const Bz=_t`
11894
11897
  --ni-private-switch-indicator-size: 24px;
11895
11898
  --ni-private-switch-indicator-inner-size: 18px;
11896
11899
  --ni-private-switch-indicator-margin: -2px;
11897
- padding-bottom: calc(
11898
- ${Ac} - var(--ni-private-switch-height)
11899
- );
11900
11900
  }
11901
11901
 
11902
11902
  :host([disabled]) {
@@ -11921,6 +11921,9 @@ const Bz=_t`
11921
11921
  .switch-container {
11922
11922
  display: flex;
11923
11923
  align-items: center;
11924
+ ${""}
11925
+ padding-top: 2px;
11926
+ padding-bottom: 6px;
11924
11927
  }
11925
11928
 
11926
11929
  slot[name='unchecked-message']::slotted(*) {
@@ -17833,11 +17836,11 @@ const E3=_t`
17833
17836
  ></${rg}>
17834
17837
  ${Ev}
17835
17838
  </div>`
17836
- class T3 extends(Av(He)){constructor(){super(...arguments),this.value="",this.maxLength=-1,this.processing=!1,this.sendDisabled=!1,this.isInputEmpty=!0,this.scrollbarWidth=-1,this.footerActionsIsEmpty=!0,this.attachmentsIsEmpty=!0,this.updateScrollbarWidthQueued=!1}slottedFooterActionsElementsChanged(t,e){this.footerActionsIsEmpty=void 0===e||0===e.length}slottedAttachmentsElementsChanged(t,e){this.attachmentsIsEmpty=void 0===e||0===e.length}textAreaKeydownHandler(t){return!(t.key===sn&&!t.shiftKey)||(this.processing||this.sendButtonClickHandler(),!1)}textAreaInputHandler(){this.value=this.textArea.value,this.isInputEmpty=0===this.textArea.value.length,this.adjustTextAreaHeight(),this.queueUpdateScrollbarWidth()}placeholderChanged(){this.queueUpdateScrollbarWidth()}valueChanged(){this.textArea&&(this.textArea.value=this.value,this.isInputEmpty=0===this.textArea.value.length,this.adjustTextAreaHeight(),this.queueUpdateScrollbarWidth())}connectedCallback(){super.connectedCallback(),this.textArea.value=this.value,this.isInputEmpty=0===this.textArea.value.length,this.adjustTextAreaHeight(),this.resizeObserver=new ResizeObserver(()=>this.onResize()),this.resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect()}sendButtonClickHandler(){if(this.shouldDisableSendButton())return
17839
+ class T3 extends(Av(He)){constructor(){super(...arguments),this.value="",this.maxLength=-1,this.processing=!1,this.sendDisabled=!1,this.isInputEmpty=!0,this.scrollbarWidth=-1,this.footerActionsIsEmpty=!0,this.attachmentsIsEmpty=!0,this.updateScrollbarWidthQueued=!1,this.fieldSizingSupported=CSS.supports("field-sizing","content")}slottedFooterActionsElementsChanged(t,e){this.footerActionsIsEmpty=void 0===e||0===e.length}slottedAttachmentsElementsChanged(t,e){this.attachmentsIsEmpty=void 0===e||0===e.length}textAreaKeydownHandler(t){return!(t.key===sn&&!t.shiftKey)||(this.processing||this.sendButtonClickHandler(),!1)}textAreaInputHandler(){this.value=this.textArea.value,this.isInputEmpty=0===this.textArea.value.length,this.adjustTextAreaHeight(),this.queueUpdateScrollbarWidth()}placeholderChanged(){this.queueUpdateScrollbarWidth()}valueChanged(){this.textArea&&(this.textArea.value=this.value,this.isInputEmpty=0===this.textArea.value.length,this.adjustTextAreaHeight(),this.queueUpdateScrollbarWidth())}connectedCallback(){super.connectedCallback(),this.textArea.value=this.value,this.isInputEmpty=0===this.textArea.value.length,this.adjustTextAreaHeight(),this.resizeObserver=new ResizeObserver(()=>this.onResize()),this.resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect()}sendButtonClickHandler(){if(this.shouldDisableSendButton())return
17837
17840
  const t={text:this.textArea.value}
17838
- this.resetInput(),this.$emit("send",t)}stopButtonClickHandler(){this.processing&&(this.$emit("stop"),this.textArea?.blur())}shouldDisableSendButton(){return this.sendDisabled||0===this.textArea.value.length}resetInput(){this.value="",this.isInputEmpty=!0,this.textArea&&(this.textArea.value="",this.adjustTextAreaHeight(),this.textArea.focus())}onResize(){this.adjustTextAreaHeight(),this.scrollbarWidth=this.textArea.offsetWidth-this.textArea.clientWidth}queueUpdateScrollbarWidth(){this.$fastController.isConnected&&(this.updateScrollbarWidthQueued||(this.updateScrollbarWidthQueued=!0,b.queueUpdate(()=>this.updateScrollbarWidth())))}adjustTextAreaHeight(){if(T3.fieldSizingSupported||!this.textArea)return
17841
+ this.resetInput(),this.$emit("send",t)}stopButtonClickHandler(){this.processing&&(this.$emit("stop"),this.textArea?.blur())}shouldDisableSendButton(){return this.sendDisabled||0===this.textArea.value.length}resetInput(){this.value="",this.isInputEmpty=!0,this.textArea&&(this.textArea.value="",this.adjustTextAreaHeight(),this.textArea.focus())}onResize(){this.adjustTextAreaHeight(),this.scrollbarWidth=this.textArea.offsetWidth-this.textArea.clientWidth}queueUpdateScrollbarWidth(){this.$fastController.isConnected&&(this.updateScrollbarWidthQueued||(this.updateScrollbarWidthQueued=!0,b.queueUpdate(()=>this.updateScrollbarWidth())))}adjustTextAreaHeight(){if(this.fieldSizingSupported||!this.textArea)return
17839
17842
  const t=this.textArea
17840
- t.style.height="auto",t.style.height=`${t.scrollHeight}px`}updateScrollbarWidth(){this.updateScrollbarWidthQueued=!1,this.scrollbarWidth=this.textArea.offsetWidth-this.textArea.clientWidth}}T3.fieldSizingSupported=CSS.supports("field-sizing","content"),t([pt],T3.prototype,"placeholder",void 0),t([pt({attribute:"send-button-label"})],T3.prototype,"sendButtonLabel",void 0),t([pt({attribute:"stop-button-label"})],T3.prototype,"stopButtonLabel",void 0),t([pt],T3.prototype,"value",void 0),t([pt({attribute:"tabindex",converter:ht})],T3.prototype,"tabIndex",void 0),t([pt({attribute:"maxlength",converter:ht})],T3.prototype,"maxLength",void 0),t([pt({attribute:"processing",mode:"boolean"})],T3.prototype,"processing",void 0),t([pt({attribute:"send-disabled",mode:"boolean"})],T3.prototype,"sendDisabled",void 0),t([C],T3.prototype,"textArea",void 0),t([C],T3.prototype,"isInputEmpty",void 0),t([C],T3.prototype,"scrollbarWidth",void 0),t([C],T3.prototype,"footerActionsIsEmpty",void 0),t([C],T3.prototype,"slottedFooterActionsElements",void 0),t([C],T3.prototype,"attachmentsIsEmpty",void 0),t([C],T3.prototype,"slottedAttachmentsElements",void 0)
17843
+ t.style.height="auto",t.style.height=`${t.scrollHeight}px`}updateScrollbarWidth(){this.updateScrollbarWidthQueued=!1,this.scrollbarWidth=this.textArea.offsetWidth-this.textArea.clientWidth}}t([pt],T3.prototype,"placeholder",void 0),t([pt({attribute:"send-button-label"})],T3.prototype,"sendButtonLabel",void 0),t([pt({attribute:"stop-button-label"})],T3.prototype,"stopButtonLabel",void 0),t([pt],T3.prototype,"value",void 0),t([pt({attribute:"tabindex",converter:ht})],T3.prototype,"tabIndex",void 0),t([pt({attribute:"maxlength",converter:ht})],T3.prototype,"maxLength",void 0),t([pt({attribute:"processing",mode:"boolean"})],T3.prototype,"processing",void 0),t([pt({attribute:"send-disabled",mode:"boolean"})],T3.prototype,"sendDisabled",void 0),t([C],T3.prototype,"textArea",void 0),t([C],T3.prototype,"isInputEmpty",void 0),t([C],T3.prototype,"scrollbarWidth",void 0),t([C],T3.prototype,"footerActionsIsEmpty",void 0),t([C],T3.prototype,"slottedFooterActionsElements",void 0),t([C],T3.prototype,"attachmentsIsEmpty",void 0),t([C],T3.prototype,"slottedAttachmentsElements",void 0)
17841
17844
  const O3=T3.compose({baseName:"chat-input",template:A3,styles:E3,shadowOptions:{delegatesFocus:!0}})
17842
17845
  Ii.getOrCreate().withPrefix("spright").register(O3())
17843
17846
  const D3={system:void 0,outbound:"outbound",inbound:"inbound"},R3=_t`