@ni/ok-components 0.3.8 → 0.3.10

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.
@@ -17817,6 +17817,7 @@ Defines an interaction area clip-path that leaves out the severity text so it is
17817
17817
  :host([selected]) .control {
17818
17818
  --ni-private-step-icon-color: ${borderHoverColor};
17819
17819
  --ni-private-step-icon-border-color: ${borderHoverColor};
17820
+ --ni-private-step-icon-border-width: 2px;
17820
17821
  --ni-private-step-icon-background-color: rgb(from ${borderHoverColor} r g b / 30%);
17821
17822
  --ni-private-step-icon-background-size: var(--ni-private-step-icon-background-none-size);
17822
17823
  --ni-private-step-line-color: ${borderHoverColor};
@@ -17856,10 +17857,6 @@ Defines an interaction area clip-path that leaves out the severity text so it is
17856
17857
  box-shadow ${smallDelay} ease-in-out;
17857
17858
  }
17858
17859
 
17859
- :host([selected]) .icon {
17860
- --ni-private-step-icon-border-width: 2px;
17861
- }
17862
-
17863
17860
  .icon::before {
17864
17861
  content: '';
17865
17862
  position: absolute;
@@ -17869,7 +17866,8 @@ Defines an interaction area clip-path that leaves out the severity text so it is
17869
17866
  outline-color: var(--ni-private-step-icon-outline-inset-color);
17870
17867
  outline-style: solid;
17871
17868
  outline-width: 0px;
17872
- outline-offset: 0px;
17869
+ ${'' /* outline-offset should always be <=-1 to always render inset */}
17870
+ outline-offset: -1px;
17873
17871
  border: none;
17874
17872
  border-radius: 100%;
17875
17873
  color: transparent;
@@ -17947,9 +17945,9 @@ Defines an interaction area clip-path that leaves out the severity text so it is
17947
17945
  min-width: ${standardPadding};
17948
17946
  height: 1px;
17949
17947
  min-height: 1px;
17948
+ transform: scale(1, 1);
17950
17949
  background: var(--ni-private-step-line-color);
17951
17950
  background-clip: content-box;
17952
- transform: scale(1, 1);
17953
17951
  transition:
17954
17952
  background-color ${smallDelay} ease-in-out,
17955
17953
  transform ${smallDelay} ease-in-out;
@@ -17963,8 +17961,8 @@ Defines an interaction area clip-path that leaves out the severity text so it is
17963
17961
  width: 1px;
17964
17962
  min-width: 1px;
17965
17963
  height: 100%;
17966
- padding-top: ${smallPadding};
17967
17964
  min-height: ${standardPadding};
17965
+ padding-top: ${smallPadding};
17968
17966
  }
17969
17967
 
17970
17968
  .subtitle {
@@ -17993,6 +17991,7 @@ Defines an interaction area clip-path that leaves out the severity text so it is
17993
17991
  @layer hover {
17994
17992
  .control:hover {
17995
17993
  --ni-private-step-icon-border-color: ${borderHoverColor};
17994
+ --ni-private-step-icon-border-width: 2px;
17996
17995
  --ni-private-step-icon-background-size: var(--ni-private-step-icon-background-inset-size);
17997
17996
  --ni-private-step-line-color: ${borderHoverColor};
17998
17997
  }
@@ -18023,8 +18022,12 @@ Defines an interaction area clip-path that leaves out the severity text so it is
18023
18022
  --ni-private-step-line-color: ${borderHoverColor};
18024
18023
  }
18025
18024
 
18026
- .control:hover .icon {
18027
- --ni-private-step-icon-border-width: 2px;
18025
+ :host([readonly]) .control:hover {
18026
+ --ni-private-step-icon-color: revert-layer;
18027
+ --ni-private-step-icon-border-color: revert-layer;
18028
+ --ni-private-step-icon-border-width: revert-layer;
18029
+ --ni-private-step-icon-background-size: revert-layer;
18030
+ --ni-private-step-line-color: revert-layer;
18028
18031
  }
18029
18032
 
18030
18033
  .control:hover .line {
@@ -18034,11 +18037,16 @@ Defines an interaction area clip-path that leaves out the severity text so it is
18034
18037
  .container.vertical .control:hover .line {
18035
18038
  transform: scale(2, 1);
18036
18039
  }
18040
+
18041
+ :host([readonly]) .container .control:hover .line {
18042
+ transform: revert-layer;
18043
+ }
18037
18044
  }
18038
18045
 
18039
18046
  @layer focusVisible {
18040
18047
  .control${focusVisible} {
18041
18048
  --ni-private-step-icon-border-color: ${borderHoverColor};
18049
+ --ni-private-step-icon-border-width: 2px;
18042
18050
  --ni-private-step-icon-outline-inset-color: ${borderHoverColor};
18043
18051
  --ni-private-step-icon-background-size: var(--ni-private-step-icon-background-inset-size);
18044
18052
  --ni-private-step-line-color: ${borderHoverColor};
@@ -18074,10 +18082,6 @@ Defines an interaction area clip-path that leaves out the severity text so it is
18074
18082
  --ni-private-step-line-color: ${borderHoverColor};
18075
18083
  }
18076
18084
 
18077
- .control${focusVisible} .icon {
18078
- --ni-private-step-icon-border-width: 2px;
18079
- }
18080
-
18081
18085
  .control${focusVisible} .icon::before {
18082
18086
  outline-width: ${borderWidth};
18083
18087
  ${'' /* -1px control to outline edge -2px focus border -1px inset gap */}
@@ -18096,6 +18100,7 @@ Defines an interaction area clip-path that leaves out the severity text so it is
18096
18100
  @layer active {
18097
18101
  .control:active {
18098
18102
  --ni-private-step-icon-border-color: ${borderHoverColor};
18103
+ --ni-private-step-icon-border-width: 2px;
18099
18104
  --ni-private-step-icon-background-color: ${fillSelectedColor};
18100
18105
  --ni-private-step-icon-background-size: var(--ni-private-step-icon-background-full-size);
18101
18106
  --ni-private-step-line-color: ${borderHoverColor};
@@ -18127,26 +18132,45 @@ Defines an interaction area clip-path that leaves out the severity text so it is
18127
18132
  --ni-private-step-line-color: ${borderHoverColor};
18128
18133
  }
18129
18134
 
18130
- .control:active .icon {
18131
- --ni-private-step-icon-border-width: 2px;
18135
+ :host([readonly]) .control:active {
18136
+ --ni-private-step-icon-color: revert-layer;
18137
+ --ni-private-step-icon-border-color: revert-layer;
18138
+ --ni-private-step-icon-border-width: revert-layer;
18139
+ --ni-private-step-icon-background-color: revert-layer;
18140
+ --ni-private-step-icon-background-size: revert-layer;
18141
+ --ni-private-step-line-color: revert-layer;
18132
18142
  }
18133
18143
 
18134
18144
  .control:active .icon::before {
18135
18145
  outline-width: 0px;
18136
- outline-offset: 0px;
18146
+ outline-offset: -1px;
18147
+ }
18148
+
18149
+ :host([readonly]) .control:active .icon::before {
18150
+ outline-width: revert-layer;
18151
+ outline-offset: revert-layer;
18137
18152
  }
18138
18153
 
18139
18154
  .control:active .line {
18140
18155
  transform: scale(1, 1);
18141
18156
  }
18157
+
18158
+ :host([readonly]) .control:active .line {
18159
+ transform: revert-layer;
18160
+ }
18142
18161
  }
18143
18162
 
18144
18163
  @layer disabled {
18164
+ :host([readonly]) .control {
18165
+ cursor: default;
18166
+ }
18167
+
18145
18168
  :host([disabled]) .control {
18146
18169
  cursor: default;
18147
18170
  color: ${buttonLabelDisabledFontColor};
18148
18171
  --ni-private-step-icon-color: rgb(from ${buttonLabelFontColor} r g b / 30%);
18149
18172
  --ni-private-step-icon-border-color: transparent;
18173
+ --ni-private-step-icon-border-width: 1px;
18150
18174
  --ni-private-step-icon-background-color: rgba(${borderRgbPartialColor}, 0.1);
18151
18175
  --ni-private-step-icon-background-size: var(--ni-private-step-icon-background-full-size);
18152
18176
  --ni-private-step-icon-outline-inset-color: transparent;
@@ -19421,11 +19445,17 @@ Defines an interaction area clip-path that leaves out the severity text so it is
19421
19445
  cssCustomPropertyName: null
19422
19446
  }).withDefault(coreLabelDefaults.itemRemoveLabel);
19423
19447
 
19448
+ /**
19449
+ * Orientation of steppers.
19450
+ * @public
19451
+ */
19452
+ const StepperOrientation = Orientation;
19453
+
19424
19454
  const template$V = (context, definition) => html `
19425
19455
  <template slot="step">
19426
19456
  <li class="
19427
19457
  container
19428
- ${x => (x.stepInternals.orientation === 'vertical' ? 'vertical' : '')}
19458
+ ${x => (x.stepInternals.orientation === StepperOrientation.vertical ? 'vertical' : '')}
19429
19459
  ${x => (x.stepInternals.last ? 'last' : '')}
19430
19460
  ">
19431
19461
  <a
@@ -19460,6 +19490,7 @@ Defines an interaction area clip-path that leaves out the severity text so it is
19460
19490
  aria-owns="${x => x.ariaOwns}"
19461
19491
  aria-relevant="${x => x.ariaRelevant}"
19462
19492
  aria-roledescription="${x => x.ariaRoledescription}"
19493
+ @click="${(x, c) => x.onClick(c.event)}"
19463
19494
  ${ref('control')}
19464
19495
  >
19465
19496
  <div class="icon-background"></div>
@@ -19482,12 +19513,6 @@ Defines an interaction area clip-path that leaves out the severity text so it is
19482
19513
  </template>
19483
19514
  `;
19484
19515
 
19485
- /**
19486
- * Orientation of steppers.
19487
- * @public
19488
- */
19489
- const StepperOrientation = Orientation;
19490
-
19491
19516
  /**
19492
19517
  * Internal properties configurable for a step
19493
19518
  */
@@ -19545,6 +19570,15 @@ Defines an interaction area clip-path that leaves out the severity text so it is
19545
19570
  */
19546
19571
  this.stepInternals = new StepInternals();
19547
19572
  }
19573
+ /**
19574
+ * @internal
19575
+ */
19576
+ onClick(e) {
19577
+ if (this.disabled || this.readOnly) {
19578
+ e.preventDefault();
19579
+ e.stopImmediatePropagation();
19580
+ }
19581
+ }
19548
19582
  }
19549
19583
  __decorate([
19550
19584
  attr()
@@ -23583,6 +23617,7 @@ so this becomes the fallback color for the slot */ ''}
23583
23617
  }
23584
23618
  }
23585
23619
  registerIconSvg('icon-arrow-expander-up', IconArrowExpanderUp);
23620
+ const iconArrowExpanderUpTag = 'nimble-icon-arrow-expander-up';
23586
23621
 
23587
23622
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
23588
23623
  // See generation source in nimble-components/build/generate-icons
@@ -66488,7 +66523,7 @@ ${nextLine.slice(indentLevel + 2)}`;
66488
66523
  <template slot="step">
66489
66524
  <li class="
66490
66525
  container
66491
- ${x => (x.stepInternals.orientation === 'vertical' ? 'vertical' : '')}
66526
+ ${x => (x.stepInternals.orientation === StepperOrientation.vertical ? 'vertical' : '')}
66492
66527
  ${x => (x.stepInternals.last ? 'last' : '')}
66493
66528
  ">
66494
66529
  <button
@@ -66527,6 +66562,7 @@ ${nextLine.slice(indentLevel + 2)}`;
66527
66562
  aria-pressed="${x => x.ariaPressed}"
66528
66563
  aria-relevant="${x => x.ariaRelevant}"
66529
66564
  aria-roledescription="${x => x.ariaRoledescription}"
66565
+ @click="${(x, c) => x.onClick(c.event)}"
66530
66566
  ${ref('control')}
66531
66567
  >
66532
66568
  <div class="icon-background"></div>
@@ -66580,6 +66616,15 @@ ${nextLine.slice(indentLevel + 2)}`;
66580
66616
  */
66581
66617
  this.stepInternals = new StepInternals();
66582
66618
  }
66619
+ /**
66620
+ * @internal
66621
+ */
66622
+ onClick(e) {
66623
+ if (this.disabled || this.readOnly) {
66624
+ e.preventDefault();
66625
+ e.stopImmediatePropagation();
66626
+ }
66627
+ }
66583
66628
  }
66584
66629
  __decorate([
66585
66630
  attr()
@@ -66608,15 +66653,61 @@ ${nextLine.slice(indentLevel + 2)}`;
66608
66653
 
66609
66654
  :host {
66610
66655
  border: none;
66611
- gap: ${smallPadding};
66612
66656
  }
66613
66657
 
66614
66658
  :host([orientation="vertical"]) {
66615
66659
  flex-direction: column;
66616
66660
  }
66617
66661
 
66618
- ol {
66619
- display: contents;
66662
+ .scroll-button.start {
66663
+ width: ${controlHeight};
66664
+ height: ${controlHeight};
66665
+ margin-right: ${smallPadding};
66666
+ margin-bottom: 0px;
66667
+ }
66668
+
66669
+ :host([orientation="vertical"]) .scroll-button.start {
66670
+ margin-right: 0px;
66671
+ margin-bottom: ${smallPadding};
66672
+ }
66673
+
66674
+ .list {
66675
+ flex-grow: 1;
66676
+ display: inline-flex;
66677
+ gap: ${smallPadding};
66678
+ scrollbar-width: none;
66679
+ padding: 0;
66680
+ margin: 0;
66681
+
66682
+ flex-direction: row;
66683
+ overflow-x: scroll;
66684
+ overflow-y: hidden;
66685
+ width: max-content;
66686
+ max-width: 100%;
66687
+ height: auto;
66688
+ max-height: none;
66689
+ }
66690
+
66691
+ :host([orientation="vertical"]) .list {
66692
+ flex-direction: column;
66693
+ overflow-x: hidden;
66694
+ overflow-y: scroll;
66695
+ width: auto;
66696
+ max-width: none;
66697
+ height: max-content;
66698
+ max-height: 100%;
66699
+ }
66700
+
66701
+ .scroll-button.end {
66702
+ width: ${controlHeight};
66703
+ height: ${controlHeight};
66704
+ margin-left: ${smallPadding};
66705
+ margin-top: 0px;
66706
+ }
66707
+
66708
+ :host([orientation="vertical"]) .scroll-button.end {
66709
+ margin-left: 0px;
66710
+ margin-top: ${smallPadding};
66620
66711
  }
66621
66712
 
66622
66713
  slot[name="step"]::slotted(*) {
@@ -66628,10 +66719,35 @@ ${nextLine.slice(indentLevel + 2)}`;
66628
66719
  }
66629
66720
  `;
66630
66721
 
66631
- const template$w = html `<ol><slot
66632
- name="step"
66633
- ${slotted('steps')}
66634
- ></slot></ol>`;
66722
+ const template$w = html `
66723
+ ${when(x => x.showScrollButtons, html `
66724
+ <${buttonTag}
66725
+ content-hidden
66726
+ class="scroll-button start"
66727
+ appearance="${ButtonAppearance.ghost}"
66728
+ @click="${x => x.onScrollStartClick()}"
66729
+ ${ref('startScrollButton')}
66730
+ >
66731
+ ${x => scrollForwardLabel.getValueFor(x)}
66732
+ ${when(x => x.isHorizontal(), html `<${iconArrowExpanderLeftTag} slot="start"></${iconArrowExpanderLeftTag}>`, html `<${iconArrowExpanderUpTag} slot="start"></${iconArrowExpanderUpTag}>`)}
66733
+ </${buttonTag}>
66734
+ `)}
66735
+ <ol ${ref('list')} class="list"><slot
66736
+ name="step"
66737
+ ${slotted('steps')}
66738
+ ></slot></ol>
66739
+ ${when(x => x.showScrollButtons, html `
66740
+ <${buttonTag}
66741
+ content-hidden
66742
+ class="scroll-button end"
66743
+ appearance="${ButtonAppearance.ghost}"
66744
+ @click="${x => x.onScrollEndClick()}"
66745
+ >
66746
+ ${x => scrollBackwardLabel.getValueFor(x)}
66747
+ ${when(x => x.isHorizontal(), html `<${iconArrowExpanderRightTag} slot="start"></${iconArrowExpanderRightTag}>`, html `<${iconArrowExpanderDownTag} slot="start"></${iconArrowExpanderDownTag}>`)}
66748
+ </${buttonTag}>
66749
+ `)}
66750
+ `;
66635
66751
 
66636
66752
  /**
66637
66753
  * A nimble-styled stepper
@@ -66640,12 +66756,70 @@ ${nextLine.slice(indentLevel + 2)}`;
66640
66756
  constructor() {
66641
66757
  super(...arguments);
66642
66758
  this.orientation = StepperOrientation.horizontal;
66759
+ /** @internal */
66760
+ this.showScrollButtons = false;
66761
+ }
66762
+ /** @internal */
66763
+ onScrollStartClick() {
66764
+ if (this.isHorizontal()) {
66765
+ this.list.scrollBy({
66766
+ left: -this.list.clientWidth,
66767
+ behavior: 'smooth'
66768
+ });
66769
+ }
66770
+ else {
66771
+ this.list.scrollBy({
66772
+ top: -this.list.clientHeight,
66773
+ behavior: 'smooth'
66774
+ });
66775
+ }
66776
+ }
66777
+ /** @internal */
66778
+ onScrollEndClick() {
66779
+ if (this.isHorizontal()) {
66780
+ this.list.scrollBy({
66781
+ left: this.list.clientWidth,
66782
+ behavior: 'smooth'
66783
+ });
66784
+ }
66785
+ else {
66786
+ this.list.scrollBy({
66787
+ top: this.list.clientHeight,
66788
+ behavior: 'smooth'
66789
+ });
66790
+ }
66791
+ }
66792
+ /** @internal */
66793
+ connectedCallback() {
66794
+ super.connectedCallback();
66795
+ // Steps fill parent container so can't rely on a resize observer to track their space usage.
66796
+ // Instead directly track each step's occlusion with intersection observer which is more compute intensive.
66797
+ // When available can switch to container scroll state queries, see: https://github.com/ni/nimble/issues/2922
66798
+ this.listIntersectionObserver = new IntersectionObserver(_ => {
66799
+ this.handleListOverflow();
66800
+ }, {
66801
+ root: this.list,
66802
+ threshold: 1.0
66803
+ });
66804
+ }
66805
+ /** @internal */
66806
+ disconnectedCallback() {
66807
+ super.disconnectedCallback();
66808
+ this.listIntersectionObserver?.disconnect();
66809
+ }
66810
+ /** @internal */
66811
+ isHorizontal() {
66812
+ return this.orientation !== StepperOrientation.vertical;
66643
66813
  }
66644
66814
  orientationChanged() {
66645
66815
  this.updateStepInternals();
66646
66816
  }
66647
66817
  stepsChanged() {
66648
66818
  this.updateStepInternals();
66819
+ this.listIntersectionObserver?.disconnect();
66820
+ if (this.steps) {
66821
+ this.steps.forEach(step => this.listIntersectionObserver?.observe(step));
66822
+ }
66649
66823
  }
66650
66824
  updateStepInternals() {
66651
66825
  if (!this.steps) {
@@ -66653,15 +66827,38 @@ ${nextLine.slice(indentLevel + 2)}`;
66653
66827
  }
66654
66828
  const lastIndex = this.steps.length - 1;
66655
66829
  this.steps.forEach((step, index) => {
66656
- step.stepInternals.orientation = this.orientation;
66830
+ step.stepInternals.orientation = this.isHorizontal()
66831
+ ? StepperOrientation.horizontal
66832
+ : StepperOrientation.vertical;
66657
66833
  step.stepInternals.last = index === lastIndex;
66658
66834
  step.stepInternals.position = index + 1;
66659
66835
  });
66660
66836
  }
66837
+ handleListOverflow() {
66838
+ let listVisibleSize = this.isHorizontal()
66839
+ ? this.list.clientWidth
66840
+ : this.list.clientHeight;
66841
+ if (listVisibleSize !== undefined) {
66842
+ const buttonSize = this.isHorizontal()
66843
+ ? this.startScrollButton?.clientWidth ?? 0
66844
+ : this.startScrollButton?.clientHeight ?? 0;
66845
+ listVisibleSize = Math.ceil(listVisibleSize);
66846
+ if (this.showScrollButtons) {
66847
+ listVisibleSize += buttonSize * 2;
66848
+ }
66849
+ const listScrollSize = this.isHorizontal()
66850
+ ? this.list.scrollWidth
66851
+ : this.list.scrollHeight;
66852
+ this.showScrollButtons = listVisibleSize < listScrollSize;
66853
+ }
66854
+ }
66661
66855
  }
66662
66856
  __decorate([
66663
66857
  attr
66664
66858
  ], Stepper.prototype, "orientation", void 0);
66859
+ __decorate([
66860
+ observable
66861
+ ], Stepper.prototype, "showScrollButtons", void 0);
66665
66862
  __decorate([
66666
66863
  observable
66667
66864
  ], Stepper.prototype, "steps", void 0);