@ni/ok-components 1.14.0 → 1.15.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.
@@ -20502,9 +20502,32 @@ const l7=It`
20502
20502
  }
20503
20503
 
20504
20504
  .split-button-primary {
20505
+ display: inline-flex;
20506
+ align-items: center;
20507
+ justify-content: center;
20505
20508
  padding: 0 ${Nc};
20506
20509
  padding-inline-end: ${Pc};
20507
20510
  white-space: nowrap;
20511
+ text-decoration: none;
20512
+ }
20513
+
20514
+ slot[name='start']::slotted(*),
20515
+ slot[name='end']::slotted(*) {
20516
+ flex-shrink: 0;
20517
+ color: currentColor;
20518
+ ${vc.cssCustomProperty}: currentColor;
20519
+ }
20520
+
20521
+ slot[name='start']::slotted(*) {
20522
+ margin-inline-end: ${Bc};
20523
+ }
20524
+
20525
+ slot[name='end']::slotted(*) {
20526
+ margin-inline-start: ${Bc};
20527
+ }
20528
+
20529
+ .split-button-primary-disabled {
20530
+ cursor: default;
20508
20531
  }
20509
20532
 
20510
20533
  .split-button-toggle {
@@ -20538,21 +20561,21 @@ const l7=It`
20538
20561
  }
20539
20562
 
20540
20563
  @layer hover {
20541
- .split-button-primary:enabled:hover,
20564
+ .split-button-primary:is(:enabled, [href]):hover,
20542
20565
  .split-button-toggle:enabled:hover {
20543
20566
  border-color: ${gc};
20544
20567
  box-shadow: 0 0 0 ${Hc} ${gc} inset;
20545
20568
  z-index: 1;
20546
20569
  }
20547
20570
 
20548
- .split-button-primary:enabled:hover + .split-button-toggle::after,
20571
+ .split-button-primary:is(:enabled, [href]):hover + .split-button-toggle::after,
20549
20572
  .split-button-toggle:enabled:hover::after {
20550
20573
  visibility: hidden;
20551
20574
  }
20552
20575
  }
20553
20576
 
20554
20577
  @layer focusVisible {
20555
- .split-button-primary:enabled:focus-visible,
20578
+ .split-button-primary:is(:enabled, [href]):focus-visible,
20556
20579
  .split-button-toggle:enabled:focus-visible {
20557
20580
  border-color: ${gc};
20558
20581
  box-shadow: 0 0 0 ${Hc} ${gc} inset;
@@ -20571,7 +20594,7 @@ const l7=It`
20571
20594
  }
20572
20595
 
20573
20596
  @layer active {
20574
- .split-button-primary:enabled:active,
20597
+ .split-button-primary:is(:enabled, [href]):active,
20575
20598
  .split-button-toggle:enabled:active,
20576
20599
  :host([open]) .split-button-toggle {
20577
20600
  border-color: ${gc};
@@ -20589,7 +20612,7 @@ const l7=It`
20589
20612
  visibility: hidden;
20590
20613
  }
20591
20614
 
20592
- :host([appearance='block']) .split-button-primary:enabled:active,
20615
+ :host([appearance='block']) .split-button-primary:is(:enabled, [href]):active,
20593
20616
  :host([appearance='block']) .split-button-toggle:enabled:active,
20594
20617
  :host([appearance='block'][open]) .split-button-toggle {
20595
20618
  background-color: ${Ql};
@@ -20607,6 +20630,14 @@ const l7=It`
20607
20630
  --ni-private-ok-fv-split-button-color: ${Ud};
20608
20631
  }
20609
20632
 
20633
+ :host([disabled][appearance='block']) {
20634
+ --ni-private-ok-fv-split-button-background-image: linear-gradient(
20635
+ rgba(${dc}, 0.1),
20636
+ rgba(${dc}, 0.1)
20637
+ );
20638
+ --ni-private-ok-fv-split-button-border: rgba(${dc}, 0.1);
20639
+ }
20640
+
20610
20641
  :host([disabled][appearance='outline']) {
20611
20642
  --ni-private-ok-fv-split-button-border: rgba(${dc}, 0.3);
20612
20643
  }
@@ -20615,6 +20646,15 @@ const l7=It`
20615
20646
  :host([disabled]) .split-button-toggle {
20616
20647
  cursor: default;
20617
20648
  box-shadow: none;
20649
+ background-image: none;
20650
+ background-size: 100% 100%;
20651
+ }
20652
+
20653
+ :host([disabled]) slot[name='start']::slotted(*),
20654
+ :host([disabled]) slot[name='end']::slotted(*),
20655
+ :host([disabled]) .split-button-toggle > * {
20656
+ opacity: 0.3;
20657
+ ${vc.cssCustomProperty}: ${Hd};
20618
20658
  }
20619
20659
 
20620
20660
  :host([disabled][appearance='ghost']) .split-button-primary,
@@ -20634,7 +20674,9 @@ const l7=It`
20634
20674
  ?disabled="${t=>t.disabled}"
20635
20675
  @click="${t=>(t.handlePrimaryClick(),!0)}"
20636
20676
  >
20637
- ${t=>t.label}
20677
+ <slot name="start"></slot>
20678
+ <span>${t=>t.label}</span>
20679
+ <slot name="end"></slot>
20638
20680
  </button>
20639
20681
  <button
20640
20682
  class="split-button-toggle"
@@ -20669,233 +20711,13 @@ const l7=It`
20669
20711
  class u7 extends qe{constructor(){super(...arguments),this.label="Primary function",this.disabled=!1,this.open=!1,this.appearance=d7,this.appearanceVariant=h7,this.documentClickHandler=t=>{this.open&&(t.composedPath().includes(this)||this.setOpen(!1))},this.keydownHandler=t=>{"Escape"===t.key&&this.setOpen(!1)},this.menuChangeHandler=()=>{this.handleMenuChange()}}disabledChanged(){this.disabled&&this.setOpen(!1)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.documentClickHandler),document.addEventListener("keydown",this.keydownHandler)}disconnectedCallback(){document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("keydown",this.keydownHandler),super.disconnectedCallback()}handlePrimaryClick(){this.disabled||this.dispatchEvent(new CustomEvent("trigger",{bubbles:!0,composed:!0}))}handleToggleClick(){this.disabled||this.setOpen(!this.open)}handleMenuChange(){this.setOpen(!1)}regionChanged(t,e){t&&t.removeEventListener("change",this.menuChangeHandler),this.region&&(this.region.anchorElement=this.toggleButton??this,this.region.addEventListener("change",this.menuChangeHandler,{capture:!0}))}toggleButtonChanged(){this.region&&(this.region.anchorElement=this.toggleButton??this)}setOpen(t){this.open!==t&&(this.open=t,this.dispatchEvent(new CustomEvent("toggle",{bubbles:!0,composed:!0,detail:{open:this.open}})))}}t([ft],u7.prototype,"label",void 0),t([ft({mode:"boolean"})],u7.prototype,"disabled",void 0),t([ft({mode:"boolean"})],u7.prototype,"open",void 0),t([ft()],u7.prototype,"appearance",void 0),t([ft({attribute:"appearance-variant"})],u7.prototype,"appearanceVariant",void 0),t([k],u7.prototype,"toggleButton",void 0),t([k],u7.prototype,"region",void 0)
20670
20712
  const p7=u7.compose({baseName:"fv-split-button",template:c7,styles:l7})
20671
20713
  Ei.getOrCreate().withPrefix("ok").register(p7())
20672
- const f7=It`
20673
- @layer base, hover, focusVisible, active, disabled, top;
20674
-
20675
- @layer base {
20676
- ${l8("inline-block")}
20677
-
20678
- :host {
20679
- --ni-private-ok-fv-split-button-anchor-background-image: none;
20680
- --ni-private-ok-fv-split-button-anchor-background-size: 100% 100%;
20681
- --ni-private-ok-fv-split-button-anchor-background-size-emphasis: 100% 100%;
20682
- --ni-private-ok-fv-split-button-anchor-border: rgba(${Jl}, 0.3);
20683
- --ni-private-ok-fv-split-button-anchor-color: ${Hd};
20684
- position: relative;
20685
- height: ${Fc};
20686
- vertical-align: middle;
20687
- }
20688
-
20689
- :host([appearance='ghost']) {
20690
- --ni-private-ok-fv-split-button-anchor-border: transparent;
20691
- }
20692
-
20693
- :host([appearance='block']) {
20694
- --ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(
20695
- rgba(${dc}, 0.1),
20696
- rgba(${dc}, 0.1)
20697
- );
20698
- --ni-private-ok-fv-split-button-anchor-border: rgba(${dc}, 0.1);
20699
- --ni-private-ok-fv-split-button-anchor-background-size-emphasis: calc(100% - 4px) calc(100% - 4px);
20700
- }
20701
-
20702
- :host([appearance='outline'][appearance-variant='primary']) {
20703
- --ni-private-ok-fv-split-button-anchor-border: rgb(${Jl});
20704
- }
20705
-
20706
- :host([appearance='outline'][appearance-variant='accent']) {
20707
- --ni-private-ok-fv-split-button-anchor-border: ${Ic};
20708
- --ni-private-ok-fv-split-button-anchor-color: ${_c};
20709
- }
20710
-
20711
- :host([appearance='block'][appearance-variant='primary']) {
20712
- --ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(
20713
- ${Cc},
20714
- ${Cc}
20715
- );
20716
- --ni-private-ok-fv-split-button-anchor-border: ${Cc};
20717
- --ni-private-ok-fv-split-button-anchor-color: ${kc};
20718
- }
20719
-
20720
- :host([appearance='block'][appearance-variant='accent']) {
20721
- --ni-private-ok-fv-split-button-anchor-background-image: linear-gradient(
20722
- ${Sc},
20723
- ${Sc}
20724
- );
20725
- --ni-private-ok-fv-split-button-anchor-border: ${Sc};
20726
- --ni-private-ok-fv-split-button-anchor-color: ${$c};
20727
- }
20728
-
20729
- .split-button-container {
20730
- position: relative;
20731
- display: inline-flex;
20732
- align-items: stretch;
20733
- height: 100%;
20734
- }
20735
-
20736
- .split-button-primary,
20737
- .split-button-toggle {
20738
- appearance: none;
20739
- position: relative;
20740
- z-index: 0;
20741
- height: 100%;
20742
- box-sizing: border-box;
20743
- margin: 0;
20744
- border: ${Hc} solid var(--ni-private-ok-fv-split-button-anchor-border);
20745
- background-color: transparent;
20746
- background-image: var(--ni-private-ok-fv-split-button-anchor-background-image);
20747
- background-position: center;
20748
- background-repeat: no-repeat;
20749
- background-size: var(--ni-private-ok-fv-split-button-anchor-background-size);
20750
- color: var(--ni-private-ok-fv-split-button-anchor-color);
20751
- fill: currentcolor;
20752
- font: ${Vd};
20753
- cursor: pointer;
20754
- outline: none;
20755
- transition:
20756
- box-shadow ${nh} ease-in-out,
20757
- border-color ${nh} ease-in-out,
20758
- background-size ${nh} ease-in-out;
20759
- }
20760
-
20761
- .split-button-primary {
20762
- display: inline-flex;
20763
- align-items: center;
20764
- justify-content: center;
20765
- padding: 0 ${Nc};
20766
- border-inline-end-color: transparent;
20767
- white-space: nowrap;
20768
- text-decoration: none;
20769
- }
20770
-
20771
- .split-button-primary::before,
20772
- .split-button-toggle::before {
20773
- content: '';
20774
- position: absolute;
20775
- inset: 0;
20776
- pointer-events: none;
20777
- outline: 0px solid transparent;
20778
- outline-offset: -3px;
20779
- transition: outline ${nh} ease-in-out;
20780
- }
20781
-
20782
- .split-button-toggle {
20783
- width: ${Fc};
20784
- min-width: ${Fc};
20785
- display: inline-flex;
20786
- align-items: center;
20787
- justify-content: center;
20788
- border-inline-start-color: var(--ni-private-ok-fv-split-button-anchor-border);
20789
- margin-inline-start: calc(-1 * ${Hc});
20790
- }
20791
-
20792
- .split-button-toggle > * {
20793
- color: currentColor;
20794
- ${vc.cssCustomProperty}: currentColor;
20795
- }
20796
-
20797
- .split-button-primary-disabled {
20798
- cursor: default;
20799
- }
20800
-
20801
- :host([appearance='ghost']) .split-button-primary,
20802
- :host([appearance='ghost']) .split-button-toggle {
20803
- border-color: transparent;
20804
- box-shadow: none;
20805
- }
20806
-
20807
- slot[name='menu']::slotted(*) {
20808
- min-width: 100%;
20809
- margin: 4px 0 0;
20810
- }
20811
- }
20812
-
20813
- @layer hover {
20814
- .split-button-primary:hover,
20815
- .split-button-toggle:hover {
20816
- border-color: ${gc};
20817
- box-shadow: 0 0 0 ${Hc} ${gc} inset;
20818
- background-size: var(--ni-private-ok-fv-split-button-anchor-background-size-emphasis);
20819
- z-index: 1;
20820
- }
20821
-
20822
- :host([appearance='ghost']) .split-button-primary:hover,
20823
- :host([appearance='ghost']) .split-button-toggle:hover {
20824
- border-color: ${gc};
20825
- box-shadow: 0 0 0 ${Hc} ${gc} inset;
20826
- }
20827
- }
20828
-
20829
- @layer focusVisible {
20830
- .split-button-primary:focus-visible,
20831
- .split-button-toggle:focus-visible {
20832
- border-color: ${gc};
20833
- box-shadow: 0 0 0 ${Hc} ${gc} inset;
20834
- background-size: var(--ni-private-ok-fv-split-button-anchor-background-size-emphasis);
20835
- z-index: 1;
20836
- }
20837
-
20838
- .split-button-primary:focus-visible::before,
20839
- .split-button-toggle:focus-visible::before {
20840
- outline: ${Hc} solid ${gc};
20841
- }
20842
-
20843
- :host([appearance='ghost']) .split-button-primary:focus-visible,
20844
- :host([appearance='ghost']) .split-button-toggle:focus-visible {
20845
- border-color: ${gc};
20846
- box-shadow: 0 0 0 ${Hc} ${gc} inset;
20847
- }
20848
- }
20849
-
20850
- @layer active {
20851
- .split-button-primary:active,
20852
- .split-button-toggle:active,
20853
- :host([open]) .split-button-toggle {
20854
- border-color: ${gc};
20855
- box-shadow: none;
20856
- background-image: linear-gradient(${sc}, ${sc});
20857
- background-size: calc(100% - 2px) calc(100% - 2px);
20858
- }
20859
-
20860
- :host([appearance='block']) .split-button-primary:active,
20861
- :host([appearance='block']) .split-button-toggle:active,
20862
- :host([appearance='block'][open]) .split-button-toggle {
20863
- background-size: calc(100% - 4px) calc(100% - 4px);
20864
- }
20865
-
20866
- :host([appearance='outline'][appearance-variant='accent']) .split-button-primary:active,
20867
- :host([appearance='outline'][appearance-variant='accent']) .split-button-toggle:active,
20868
- :host([appearance='outline'][appearance-variant='accent'][open]) .split-button-toggle {
20869
- color: ${_c};
20870
- }
20871
- }
20872
-
20873
- @layer disabled {
20874
- :host([disabled]) {
20875
- --ni-private-ok-fv-split-button-anchor-color: ${Ud};
20876
- }
20877
-
20878
- :host([disabled][appearance='outline']) {
20879
- --ni-private-ok-fv-split-button-anchor-border: rgba(${dc}, 0.3);
20880
- }
20881
-
20882
- :host([disabled]) .split-button-primary,
20883
- :host([disabled]) .split-button-toggle {
20884
- cursor: default;
20885
- box-shadow: none;
20886
- }
20887
-
20888
- :host([disabled][appearance='ghost']) .split-button-primary,
20889
- :host([disabled][appearance='ghost']) .split-button-toggle {
20890
- border-color: transparent;
20891
- }
20892
- }
20893
-
20894
- @layer top {}
20714
+ const f7=Q`
20715
+ <slot name="start"></slot>
20716
+ <span>${t=>t.label}</span>
20717
+ <slot name="end"></slot>
20895
20718
  `,m7=Q`
20896
20719
  <div
20897
20720
  class="split-button-container"
20898
- ${zt("splitButtonContainer")}
20899
20721
  >
20900
20722
  ${qt(t=>!t.disabled&&t.href.length>0,Q`
20901
20723
  <a
@@ -20906,7 +20728,7 @@ const f7=It`
20906
20728
  download="${t=>t.download||void 0}"
20907
20729
  @click="${t=>(t.handlePrimaryClick(),!0)}"
20908
20730
  >
20909
- ${t=>t.label}
20731
+ ${f7}
20910
20732
  </a>
20911
20733
  `)}
20912
20734
  ${qt(t=>t.disabled||0===t.href.length,Q`
@@ -20914,11 +20736,12 @@ const f7=It`
20914
20736
  class="split-button-primary split-button-primary-disabled"
20915
20737
  aria-disabled="${t=>t.disabled}"
20916
20738
  >
20917
- ${t=>t.label}
20739
+ ${f7}
20918
20740
  </span>
20919
20741
  `)}
20920
20742
  <button
20921
20743
  class="split-button-toggle"
20744
+ ${zt("toggleButton")}
20922
20745
  type="button"
20923
20746
  ?disabled="${t=>t.disabled}"
20924
20747
  aria-label="${t=>`More actions for ${t.label}`}"
@@ -20935,9 +20758,9 @@ const f7=It`
20935
20758
  auto-update-mode="auto"
20936
20759
  horizontal-inset
20937
20760
  horizontal-positioning-mode="dynamic"
20761
+ horizontal-default-position="end"
20938
20762
  vertical-positioning-mode="locktodefault"
20939
20763
  vertical-default-position="bottom"
20940
- horizontal-scaling="anchor"
20941
20764
  ${zt("region")}
20942
20765
  >
20943
20766
  <span part="menu">
@@ -20946,8 +20769,8 @@ const f7=It`
20946
20769
  </${Iv}>
20947
20770
  `)}
20948
20771
  `,g7="outline",v7="default"
20949
- class b7 extends qe{constructor(){super(...arguments),this.label="Primary function",this.href="",this.target="",this.rel="",this.download="",this.disabled=!1,this.open=!1,this.appearance=g7,this.appearanceVariant=v7,this.documentClickHandler=t=>{this.open&&(t.composedPath().includes(this)||this.setOpen(!1))},this.keydownHandler=t=>{"Escape"===t.key&&this.setOpen(!1)},this.menuChangeHandler=()=>{this.handleMenuChange()}}disabledChanged(){this.disabled&&this.setOpen(!1)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.documentClickHandler),document.addEventListener("keydown",this.keydownHandler)}disconnectedCallback(){document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("keydown",this.keydownHandler),super.disconnectedCallback()}handlePrimaryClick(){this.disabled||this.dispatchEvent(new CustomEvent("trigger",{bubbles:!0,composed:!0}))}handleToggleClick(){this.disabled||this.setOpen(!this.open)}handleMenuChange(){this.setOpen(!1)}regionChanged(t,e){t&&t.removeEventListener("change",this.menuChangeHandler),this.region&&(this.region.anchorElement=this.splitButtonContainer??this,this.region.addEventListener("change",this.menuChangeHandler,{capture:!0}))}splitButtonContainerChanged(){this.region&&(this.region.anchorElement=this.splitButtonContainer??this)}setOpen(t){this.open!==t&&(this.open=t,this.dispatchEvent(new CustomEvent("toggle",{bubbles:!0,composed:!0,detail:{open:this.open}})))}}t([ft],b7.prototype,"label",void 0),t([ft],b7.prototype,"href",void 0),t([ft],b7.prototype,"target",void 0),t([ft],b7.prototype,"rel",void 0),t([ft],b7.prototype,"download",void 0),t([ft({mode:"boolean"})],b7.prototype,"disabled",void 0),t([ft({mode:"boolean"})],b7.prototype,"open",void 0),t([ft()],b7.prototype,"appearance",void 0),t([ft({attribute:"appearance-variant"})],b7.prototype,"appearanceVariant",void 0),t([k],b7.prototype,"splitButtonContainer",void 0),t([k],b7.prototype,"region",void 0)
20950
- const y7=b7.compose({baseName:"fv-split-button-anchor",template:m7,styles:f7})
20772
+ class b7 extends qe{constructor(){super(...arguments),this.label="Primary function",this.href="",this.target="",this.rel="",this.download="",this.disabled=!1,this.open=!1,this.appearance=g7,this.appearanceVariant=v7,this.documentClickHandler=t=>{this.open&&(t.composedPath().includes(this)||this.setOpen(!1))},this.keydownHandler=t=>{"Escape"===t.key&&this.setOpen(!1)},this.menuChangeHandler=()=>{this.handleMenuChange()}}disabledChanged(){this.disabled&&this.setOpen(!1)}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this.documentClickHandler),document.addEventListener("keydown",this.keydownHandler)}disconnectedCallback(){document.removeEventListener("click",this.documentClickHandler),document.removeEventListener("keydown",this.keydownHandler),super.disconnectedCallback()}handlePrimaryClick(){this.disabled||this.dispatchEvent(new CustomEvent("trigger",{bubbles:!0,composed:!0}))}handleToggleClick(){this.disabled||this.setOpen(!this.open)}handleMenuChange(){this.setOpen(!1)}regionChanged(t,e){t&&t.removeEventListener("change",this.menuChangeHandler),this.region&&(this.region.anchorElement=this.toggleButton??this,this.region.addEventListener("change",this.menuChangeHandler,{capture:!0}))}toggleButtonChanged(){this.region&&(this.region.anchorElement=this.toggleButton??this)}setOpen(t){this.open!==t&&(this.open=t,this.dispatchEvent(new CustomEvent("toggle",{bubbles:!0,composed:!0,detail:{open:this.open}})))}}t([ft],b7.prototype,"label",void 0),t([ft],b7.prototype,"href",void 0),t([ft],b7.prototype,"target",void 0),t([ft],b7.prototype,"rel",void 0),t([ft],b7.prototype,"download",void 0),t([ft({mode:"boolean"})],b7.prototype,"disabled",void 0),t([ft({mode:"boolean"})],b7.prototype,"open",void 0),t([ft()],b7.prototype,"appearance",void 0),t([ft({attribute:"appearance-variant"})],b7.prototype,"appearanceVariant",void 0),t([k],b7.prototype,"toggleButton",void 0),t([k],b7.prototype,"region",void 0)
20773
+ const y7=b7.compose({baseName:"fv-split-button-anchor",template:m7,styles:l7})
20951
20774
  Ei.getOrCreate().withPrefix("ok").register(y7())
20952
20775
  const w7=It`
20953
20776
  ${l8("block")}