@ni/ok-components 1.0.0 → 1.1.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.
@@ -16874,8 +16874,55 @@ const i1=_t`
16874
16874
  width: 80px;
16875
16875
  margin: ${Ec};
16876
16876
  }
16877
+
16878
+ .attachments {
16879
+ display: none;
16880
+ }
16881
+
16882
+ .attachments.has-content {
16883
+ display: flex;
16884
+ flex-wrap: wrap;
16885
+ gap: ${Ec};
16886
+ padding: ${Ec};
16887
+ max-height: calc(${Mc} * 3 + ${Ec} * 4 );
16888
+ overflow-y: auto;
16889
+ }
16890
+
16891
+ .attachments ::slotted(*) {
16892
+ height: ${Mc};
16893
+ }
16894
+
16895
+ .footer {
16896
+ display: flex;
16897
+ flex-direction: row;
16898
+ align-items: flex-end;
16899
+ justify-content: flex-end;
16900
+ }
16901
+
16902
+ .footer-actions {
16903
+ display: none;
16904
+ flex: 1;
16905
+ }
16906
+
16907
+ .footer-actions.has-content {
16908
+ display: flex;
16909
+ align-items: center;
16910
+ flex-wrap: wrap;
16911
+ column-gap: ${Ec};
16912
+ margin: ${Ec};
16913
+ }
16914
+
16915
+ .footer-actions ::slotted(*) {
16916
+ height: ${Mc};
16917
+ }
16877
16918
  `,o1=J`
16878
16919
  <div class="container">
16920
+ <section class="attachments ${t=>t.attachmentsIsEmpty?"":"has-content"}">
16921
+ <slot
16922
+ name="attachments"
16923
+ ${Qt({property:"slottedAttachmentsElements"})}
16924
+ ></slot>
16925
+ </section>
16879
16926
  <textarea
16880
16927
  ${Pt("textArea")}
16881
16928
  placeholder="${t=>t.placeholder}"
@@ -16885,19 +16932,27 @@ const i1=_t`
16885
16932
  @keydown="${(t,e)=>t.textAreaKeydownHandler(e.event)}"
16886
16933
  @input="${t=>t.textAreaInputHandler()}"
16887
16934
  ></textarea>
16888
- <${Vg}
16889
- class="action-button"
16890
- appearance="block"
16891
- appearance-variant="${t=>t.processing?"primary":"accent"}"
16892
- ?disabled=${t=>!t.processing&&(t.sendDisabled||t.isInputEmpty)}
16893
- @click=${t=>t.processing?t.stopButtonClickHandler():t.sendButtonClickHandler()}
16894
- tabindex="${t=>t.tabIndex}"
16895
- title=${t=>t.processing?t.stopButtonLabel:t.sendButtonLabel}
16896
- content-hidden
16897
- >
16898
- ${t=>t.processing?t.stopButtonLabel:t.sendButtonLabel}
16899
- ${Ut(t=>t.processing,J`<${xb} slot="start"></${xb}>`,J`<${wb} slot="start"></${wb}>`)}
16900
- </${Vg}>
16935
+ <section class="footer">
16936
+ <section class="footer-actions ${t=>t.footerActionsIsEmpty?"":"has-content"}">
16937
+ <slot
16938
+ name="footer-actions"
16939
+ ${Qt({property:"slottedFooterActionsElements"})}
16940
+ ></slot>
16941
+ </section>
16942
+ <${Vg}
16943
+ class="action-button"
16944
+ appearance="block"
16945
+ appearance-variant="${t=>t.processing?"primary":"accent"}"
16946
+ ?disabled=${t=>!t.processing&&(t.sendDisabled||t.isInputEmpty)}
16947
+ @click=${t=>t.processing?t.stopButtonClickHandler():t.sendButtonClickHandler()}
16948
+ tabindex="${t=>t.tabIndex}"
16949
+ title=${t=>t.processing?t.stopButtonLabel:t.sendButtonLabel}
16950
+ content-hidden
16951
+ >
16952
+ ${t=>t.processing?t.stopButtonLabel:t.sendButtonLabel}
16953
+ ${Ut(t=>t.processing,J`<${xb} slot="start"></${xb}>`,J`<${wb} slot="start"></${wb}>`)}
16954
+ </${Vg}>
16955
+ </section>
16901
16956
  <${Jm}
16902
16957
  severity="error"
16903
16958
  class="error-icon ${t=>t.scrollbarWidth>=0?"scrollbar-width-calculated":""}"
@@ -16905,11 +16960,11 @@ const i1=_t`
16905
16960
  ></${Jm}>
16906
16961
  ${xv}
16907
16962
  </div>`
16908
- class r1 extends(Cv(He)){constructor(){super(...arguments),this.value="",this.maxLength=-1,this.processing=!1,this.sendDisabled=!1,this.isInputEmpty=!0,this.scrollbarWidth=-1,this.updateScrollbarWidthQueued=!1}textAreaKeydownHandler(t){return!(t.key===sn&&!t.shiftKey)||(this.processing||this.sendButtonClickHandler(),!1)}textAreaInputHandler(){this.value=this.textArea.value,this.isInputEmpty=this.shouldDisableSendButton(),this.adjustTextAreaHeight(),this.queueUpdateScrollbarWidth()}placeholderChanged(){this.queueUpdateScrollbarWidth()}valueChanged(){this.textArea&&(this.textArea.value=this.value,this.isInputEmpty=this.shouldDisableSendButton(),this.adjustTextAreaHeight(),this.queueUpdateScrollbarWidth())}connectedCallback(){super.connectedCallback(),this.textArea.value=this.value,this.isInputEmpty=this.shouldDisableSendButton(),this.adjustTextAreaHeight(),this.resizeObserver=new ResizeObserver(()=>this.onResize()),this.resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect()}sendButtonClickHandler(){if(this.shouldDisableSendButton())return
16963
+ class r1 extends(Cv(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=this.shouldDisableSendButton(),this.adjustTextAreaHeight(),this.queueUpdateScrollbarWidth()}placeholderChanged(){this.queueUpdateScrollbarWidth()}valueChanged(){this.textArea&&(this.textArea.value=this.value,this.isInputEmpty=this.shouldDisableSendButton(),this.adjustTextAreaHeight(),this.queueUpdateScrollbarWidth())}connectedCallback(){super.connectedCallback(),this.textArea.value=this.value,this.isInputEmpty=this.shouldDisableSendButton(),this.adjustTextAreaHeight(),this.resizeObserver=new ResizeObserver(()=>this.onResize()),this.resizeObserver.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect()}sendButtonClickHandler(){if(this.shouldDisableSendButton())return
16909
16964
  const t={text:this.textArea.value}
16910
16965
  this.resetInput(),this.$emit("send",t)}stopButtonClickHandler(){this.processing&&(this.$emit("stop"),this.textArea?.blur())}shouldDisableSendButton(){return 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(r1.fieldSizingSupported||!this.textArea)return
16911
16966
  const t=this.textArea
16912
- t.style.height="auto",t.style.height=`${t.scrollHeight}px`}updateScrollbarWidth(){this.updateScrollbarWidthQueued=!1,this.scrollbarWidth=this.textArea.offsetWidth-this.textArea.clientWidth}}r1.fieldSizingSupported=CSS.supports("field-sizing","content"),t([pt],r1.prototype,"placeholder",void 0),t([pt({attribute:"send-button-label"})],r1.prototype,"sendButtonLabel",void 0),t([pt({attribute:"stop-button-label"})],r1.prototype,"stopButtonLabel",void 0),t([pt],r1.prototype,"value",void 0),t([pt({attribute:"tabindex",converter:ht})],r1.prototype,"tabIndex",void 0),t([pt({attribute:"maxlength",converter:ht})],r1.prototype,"maxLength",void 0),t([pt({attribute:"processing",mode:"boolean"})],r1.prototype,"processing",void 0),t([pt({attribute:"send-disabled",mode:"boolean"})],r1.prototype,"sendDisabled",void 0),t([C],r1.prototype,"textArea",void 0),t([C],r1.prototype,"isInputEmpty",void 0),t([C],r1.prototype,"scrollbarWidth",void 0)
16967
+ t.style.height="auto",t.style.height=`${t.scrollHeight}px`}updateScrollbarWidth(){this.updateScrollbarWidthQueued=!1,this.scrollbarWidth=this.textArea.offsetWidth-this.textArea.clientWidth}}r1.fieldSizingSupported=CSS.supports("field-sizing","content"),t([pt],r1.prototype,"placeholder",void 0),t([pt({attribute:"send-button-label"})],r1.prototype,"sendButtonLabel",void 0),t([pt({attribute:"stop-button-label"})],r1.prototype,"stopButtonLabel",void 0),t([pt],r1.prototype,"value",void 0),t([pt({attribute:"tabindex",converter:ht})],r1.prototype,"tabIndex",void 0),t([pt({attribute:"maxlength",converter:ht})],r1.prototype,"maxLength",void 0),t([pt({attribute:"processing",mode:"boolean"})],r1.prototype,"processing",void 0),t([pt({attribute:"send-disabled",mode:"boolean"})],r1.prototype,"sendDisabled",void 0),t([C],r1.prototype,"textArea",void 0),t([C],r1.prototype,"isInputEmpty",void 0),t([C],r1.prototype,"scrollbarWidth",void 0),t([C],r1.prototype,"footerActionsIsEmpty",void 0),t([C],r1.prototype,"slottedFooterActionsElements",void 0),t([C],r1.prototype,"attachmentsIsEmpty",void 0),t([C],r1.prototype,"slottedAttachmentsElements",void 0)
16913
16968
  const s1=r1.compose({baseName:"chat-input",template:o1,styles:i1,shadowOptions:{delegatesFocus:!0}})
16914
16969
  Mi.getOrCreate().withPrefix("spright").register(s1())
16915
16970
  const a1={system:void 0,outbound:"outbound",inbound:"inbound"},l1=_t`
@@ -17460,6 +17515,212 @@ class G1 extends He{constructor(){super(...arguments),this.header="",this.expand
17460
17515
  const Z1=G1.compose({baseName:"fv-accordion-item",template:W1,styles:j1})
17461
17516
  Mi.getOrCreate().withPrefix("ok").register(Z1())
17462
17517
  const K1=_t`
17518
+ @layer base, hover, focusVisible, active, disabled, top;
17519
+
17520
+ @layer base {
17521
+ ${z1("inline-block")}
17522
+
17523
+ :host {
17524
+ --ni-private-fv-search-input-inline-padding: ${Ac};
17525
+ --ni-private-fv-search-input-leading-inset: ${Ec};
17526
+ --ni-private-fv-search-input-leading-space: calc(var(--ni-private-fv-search-input-leading-inset) + ${Rc} + ${Ic});
17527
+ --ni-private-fv-search-input-trailing-space: calc(var(--ni-private-fv-search-input-inline-padding) + ${Rc});
17528
+ --ni-private-fv-search-input-border-color: rgba(${nc}, 0.3);
17529
+ --ni-private-fv-search-input-border-radius: 0px;
17530
+ min-width: 120px;
17531
+ height: ${_c};
17532
+ font: ${sd};
17533
+ color: ${ad};
17534
+ }
17535
+
17536
+ .search-input-container {
17537
+ position: relative;
17538
+ display: flex;
17539
+ align-items: center;
17540
+ width: 100%;
17541
+ height: 100%;
17542
+ border: ${Dc} solid transparent;
17543
+ border-radius: var(--ni-private-fv-search-input-border-radius);
17544
+ color: inherit;
17545
+ background-color: transparent;
17546
+ transition:
17547
+ border-color ${qd} ease-in-out,
17548
+ box-shadow ${qd} ease-in-out,
17549
+ background-color ${qd} ease-in-out;
17550
+ }
17551
+
17552
+ .search-input-container::after {
17553
+ content: '';
17554
+ position: absolute;
17555
+ inset-inline: 0;
17556
+ inset-block-end: calc(-1 * ${Dc});
17557
+ border-bottom: calc(${Dc} + 1px) solid ${lc};
17558
+ transform: scaleX(0);
17559
+ transform-origin: center;
17560
+ transition:
17561
+ transform ${qd} ease-in-out,
17562
+ border-bottom-color ${qd} ease-in-out;
17563
+ pointer-events: none;
17564
+ }
17565
+
17566
+ .search-input-icon {
17567
+ position: absolute;
17568
+ display: inline-flex;
17569
+ align-items: center;
17570
+ justify-content: center;
17571
+ top: 50%;
17572
+ inset-inline-start: var(--ni-private-fv-search-input-leading-inset);
17573
+ transform: translateY(-50%);
17574
+ color: ${rd};
17575
+ pointer-events: none;
17576
+ ${cc.cssCustomProperty}: ${rd};
17577
+ }
17578
+
17579
+ .search-input {
17580
+ -webkit-appearance: none;
17581
+ appearance: none;
17582
+ display: block;
17583
+ flex: 1 1 auto;
17584
+ min-width: 0;
17585
+ width: 100%;
17586
+ height: 100%;
17587
+ padding: 0 var(--ni-private-fv-search-input-trailing-space) 0 var(--ni-private-fv-search-input-leading-space);
17588
+ font: inherit;
17589
+ line-height: normal;
17590
+ color: inherit;
17591
+ border: none;
17592
+ outline: none;
17593
+ border-radius: 0;
17594
+ background: transparent;
17595
+ }
17596
+
17597
+ .search-input::placeholder {
17598
+ color: ${rd};
17599
+ }
17600
+
17601
+ .search-input-clear {
17602
+ -webkit-appearance: none;
17603
+ appearance: none;
17604
+ position: absolute;
17605
+ display: inline-flex;
17606
+ align-items: center;
17607
+ justify-content: center;
17608
+ top: 50%;
17609
+ inset-inline-end: 2px;
17610
+ height: calc(100% - 6px);
17611
+ aspect-ratio: 1;
17612
+ padding: 0;
17613
+ transform: translateY(-50%);
17614
+ color: ${rd};
17615
+ border: none;
17616
+ border-radius: 2px;
17617
+ background: transparent;
17618
+ cursor: pointer;
17619
+ ${cc.cssCustomProperty}: ${rd};
17620
+ }
17621
+
17622
+ :host([appearance='outline']) .search-input-container {
17623
+ border-color: var(--ni-private-fv-search-input-border-color);
17624
+ }
17625
+
17626
+ :host([appearance='block']) .search-input-container {
17627
+ background-color: rgba(${nc}, 0.1);
17628
+ }
17629
+
17630
+ :host([appearance='underline']) .search-input-container::after {
17631
+ transform: scaleX(1);
17632
+ border-bottom-color: var(--ni-private-fv-search-input-border-color);
17633
+ }
17634
+ }
17635
+
17636
+ @layer hover {
17637
+ .search-input-clear:hover {
17638
+ background: ${tc};
17639
+ }
17640
+
17641
+ :host([appearance='outline']) .search-input-container:hover {
17642
+ border-color: ${lc};
17643
+ box-shadow: 0 0 0 ${Dc} ${lc} inset;
17644
+ }
17645
+
17646
+ :host([appearance='block']) .search-input-container:hover::after {
17647
+ transform: scaleX(1);
17648
+ border-bottom-color: ${lc};
17649
+ }
17650
+
17651
+ :host([appearance='underline']) .search-input-container:hover::after {
17652
+ border-bottom-color: ${lc};
17653
+ }
17654
+
17655
+ :host([appearance='frameless']) .search-input-container:hover::after {
17656
+ transform: scaleX(1);
17657
+ border-bottom-color: ${lc};
17658
+ }
17659
+ }
17660
+
17661
+ @layer focusVisible {
17662
+ .search-input:focus-visible {
17663
+ outline: none;
17664
+ }
17665
+
17666
+ .search-input-clear:focus-visible {
17667
+ outline: ${Dc} solid ${lc};
17668
+ outline-offset: -1px;
17669
+ }
17670
+
17671
+ :host([appearance='outline']) .search-input-container:focus-within {
17672
+ border-color: ${lc};
17673
+ box-shadow: 0 0 0 ${Dc} ${lc} inset;
17674
+ }
17675
+
17676
+ :host([appearance='block']) .search-input-container:focus-within::after {
17677
+ transform: scaleX(1);
17678
+ border-bottom-color: ${lc};
17679
+ }
17680
+
17681
+ :host([appearance='underline']) .search-input-container:focus-within::after {
17682
+ border-bottom-color: ${lc};
17683
+ }
17684
+
17685
+ :host([appearance='frameless']) .search-input-container:focus-within::after {
17686
+ transform: scaleX(1);
17687
+ border-bottom-color: ${lc};
17688
+ }
17689
+ }
17690
+ `,Y1=J`
17691
+ <div class="search-input-container">
17692
+ <span class="search-input-icon" aria-hidden="true">
17693
+ <${vb}></${vb}>
17694
+ </span>
17695
+ <input
17696
+ class="search-input"
17697
+ part="control"
17698
+ id="control"
17699
+ type="text"
17700
+ aria-label="${t=>t.ariaLabel}"
17701
+ aria-labelledby="${t=>t.ariaLabelledby}"
17702
+ placeholder="${t=>t.placeholder}"
17703
+ :value="${t=>t.value}"
17704
+ @input="${t=>t.handleTextInput()}"
17705
+ @change="${t=>t.handleChange()}"
17706
+ ${Pt("control")}
17707
+ />
17708
+ ${Ut(t=>t.value.length>0,J`
17709
+ <button
17710
+ class="search-input-clear"
17711
+ type="button"
17712
+ aria-label="Clear search"
17713
+ @click="${t=>t.clear()}"
17714
+ >
17715
+ <${iv}></${iv}>
17716
+ </button>
17717
+ `)}
17718
+ </div>
17719
+ `,X1="outline"
17720
+ class J1 extends Gi{constructor(){super(...arguments),this.appearance=X1}handleChange(){this.value=this.control.value,super.handleChange()}clear(){return""===this.value||(this.value="",this.control.focus(),this.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))),!0}}t([pt],J1.prototype,"appearance",void 0)
17721
+ const Q1=J1.compose({baseName:"fv-search-input",baseClass:Gi,template:Y1,styles:K1,shadowOptions:{delegatesFocus:!0}})
17722
+ Mi.getOrCreate().withPrefix("ok").register(Q1())
17723
+ const t2=_t`
17463
17724
  ${z1("inline-block")}
17464
17725
 
17465
17726
  :host {
@@ -17482,10 +17743,10 @@ const K1=_t`
17482
17743
  :host([disabled]) slot {
17483
17744
  color: ${ld};
17484
17745
  }
17485
- `,Y1=J`<slot></slot>`
17486
- const X1=class extends He{}.compose({baseName:"ex-button",template:Y1,styles:K1})
17487
- Mi.getOrCreate().withPrefix("ok").register(X1())
17488
- const J1=_t`
17746
+ `,e2=J`<slot></slot>`
17747
+ const n2=class extends He{}.compose({baseName:"ex-button",template:e2,styles:t2})
17748
+ Mi.getOrCreate().withPrefix("ok").register(n2())
17749
+ const i2=_t`
17489
17750
  ${z1("inline-flex")}
17490
17751
 
17491
17752
  :host {
@@ -17499,12 +17760,12 @@ const J1=_t`
17499
17760
  width: 100%;
17500
17761
  height: 100%;
17501
17762
  }
17502
- `,Q1=J`<img aria-hidden="true" src=${t=>t.url}>`
17503
- class t2 extends Km{constructor(t){super(),this.url=t}static registerIconDynamic(t,e){const n="ok-ts-icon-dynamic-"
17763
+ `,o2=J`<img aria-hidden="true" src=${t=>t.url}>`
17764
+ class r2 extends Km{constructor(t){super(),this.url=t}static registerIconDynamic(t,e){const n="ok-ts-icon-dynamic-"
17504
17765
  if(!t.startsWith(n))throw new Error(`Icon tag name must start with '${n}', provided name: ${t}`)
17505
17766
  const i=t.substring(19)
17506
17767
  if(!/^[a-z][a-z]+$/.test(i))throw new Error(`Icon name must be lowercase [a-z] and at least two characters long, provided name: ${i}`)
17507
- const o=`TsIconDynamic${i.charAt(0).toUpperCase()+i.slice(1)}`,r=`ts-icon-dynamic-${i}`,s={[o]:class extends t2{constructor(){super(e)}}}[o].compose({baseName:r,template:Q1,styles:J1})
17508
- Mi.getOrCreate().withPrefix("ok").register(s())}}const e2=t2.compose({baseName:"ts-icon-dynamic",template:J`<template></template>`,styles:_t`${z1("none")}`})
17509
- Mi.getOrCreate().withPrefix("ok").register(e2())}()
17768
+ const o=`TsIconDynamic${i.charAt(0).toUpperCase()+i.slice(1)}`,r=`ts-icon-dynamic-${i}`,s={[o]:class extends r2{constructor(){super(e)}}}[o].compose({baseName:r,template:o2,styles:i2})
17769
+ Mi.getOrCreate().withPrefix("ok").register(s())}}const s2=r2.compose({baseName:"ts-icon-dynamic",template:J`<template></template>`,styles:_t`${z1("none")}`})
17770
+ Mi.getOrCreate().withPrefix("ok").register(s2())}()
17510
17771
  //# sourceMappingURL=all-components-bundle.min.js.map