@ni/nimble-components 35.5.5 → 35.5.7

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.
@@ -1412,9 +1412,6 @@
1412
1412
  };
1413
1413
  }
1414
1414
 
1415
- // A singleton Range instance used to efficiently remove ranges of DOM nodes.
1416
- // See the implementation of HTMLView below for further details.
1417
- const range$1 = document.createRange();
1418
1415
  /**
1419
1416
  * The standard View implementation, which also implements ElementView and SyntheticView.
1420
1417
  * @public
@@ -1549,23 +1546,16 @@
1549
1546
  this.source = null;
1550
1547
  }
1551
1548
  /**
1552
- * Efficiently disposes of a contiguous range of synthetic view instances.
1549
+ * Disposes of a contiguous range of synthetic view instances.
1553
1550
  * @param views - A contiguous range of views to be disposed.
1554
1551
  */
1555
1552
  static disposeContiguousBatch(views) {
1556
1553
  if (views.length === 0) {
1557
1554
  return;
1558
1555
  }
1559
- range$1.setStartBefore(views[0].firstChild);
1560
- range$1.setEndAfter(views[views.length - 1].lastChild);
1561
- range$1.deleteContents();
1562
1556
  for (let i = 0, ii = views.length; i < ii; ++i) {
1563
1557
  const view = views[i];
1564
- const behaviors = view.behaviors;
1565
- const oldSource = view.source;
1566
- for (let j = 0, jj = behaviors.length; j < jj; ++j) {
1567
- behaviors[j].unbind(oldSource);
1568
- }
1558
+ view.dispose();
1569
1559
  }
1570
1560
  }
1571
1561
  }
@@ -19445,11 +19435,17 @@ Defines an interaction area clip-path that leaves out the severity text so it is
19445
19435
  cssCustomPropertyName: null
19446
19436
  }).withDefault(coreLabelDefaults.itemRemoveLabel);
19447
19437
 
19438
+ /**
19439
+ * Orientation of steppers.
19440
+ * @public
19441
+ */
19442
+ const StepperOrientation = Orientation;
19443
+
19448
19444
  const template$M = (context, definition) => html `
19449
19445
  <template slot="step">
19450
19446
  <li class="
19451
19447
  container
19452
- ${x => (x.stepInternals.orientation === 'vertical' ? 'vertical' : '')}
19448
+ ${x => (x.stepInternals.orientation === StepperOrientation.vertical ? 'vertical' : '')}
19453
19449
  ${x => (x.stepInternals.last ? 'last' : '')}
19454
19450
  ">
19455
19451
  <a
@@ -19507,12 +19503,6 @@ Defines an interaction area clip-path that leaves out the severity text so it is
19507
19503
  </template>
19508
19504
  `;
19509
19505
 
19510
- /**
19511
- * Orientation of steppers.
19512
- * @public
19513
- */
19514
- const StepperOrientation = Orientation;
19515
-
19516
19506
  /**
19517
19507
  * Internal properties configurable for a step
19518
19508
  */
@@ -23617,6 +23607,7 @@ so this becomes the fallback color for the slot */ ''}
23617
23607
  }
23618
23608
  }
23619
23609
  registerIconSvg('icon-arrow-expander-up', IconArrowExpanderUp);
23610
+ const iconArrowExpanderUpTag = 'nimble-icon-arrow-expander-up';
23620
23611
 
23621
23612
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
23622
23613
  // See generation source in nimble-components/build/generate-icons
@@ -66520,7 +66511,7 @@ ${nextLine.slice(indentLevel + 2)}`;
66520
66511
  <template slot="step">
66521
66512
  <li class="
66522
66513
  container
66523
- ${x => (x.stepInternals.orientation === 'vertical' ? 'vertical' : '')}
66514
+ ${x => (x.stepInternals.orientation === StepperOrientation.vertical ? 'vertical' : '')}
66524
66515
  ${x => (x.stepInternals.last ? 'last' : '')}
66525
66516
  ">
66526
66517
  <button
@@ -66650,15 +66641,61 @@ ${nextLine.slice(indentLevel + 2)}`;
66650
66641
 
66651
66642
  :host {
66652
66643
  border: none;
66653
- gap: ${smallPadding};
66654
66644
  }
66655
66645
 
66656
66646
  :host([orientation="vertical"]) {
66657
66647
  flex-direction: column;
66658
66648
  }
66659
66649
 
66660
- ol {
66661
- display: contents;
66650
+ .scroll-button.start {
66651
+ width: ${controlHeight};
66652
+ height: ${controlHeight};
66653
+ margin-right: ${smallPadding};
66654
+ margin-bottom: 0px;
66655
+ }
66656
+
66657
+ :host([orientation="vertical"]) .scroll-button.start {
66658
+ margin-right: 0px;
66659
+ margin-bottom: ${smallPadding};
66660
+ }
66661
+
66662
+ .list {
66663
+ flex-grow: 1;
66664
+ display: inline-flex;
66665
+ gap: ${smallPadding};
66666
+ scrollbar-width: none;
66667
+ padding: 0;
66668
+ margin: 0;
66669
+
66670
+ flex-direction: row;
66671
+ overflow-x: scroll;
66672
+ overflow-y: hidden;
66673
+ width: max-content;
66674
+ max-width: 100%;
66675
+ height: auto;
66676
+ max-height: none;
66677
+ }
66678
+
66679
+ :host([orientation="vertical"]) .list {
66680
+ flex-direction: column;
66681
+ overflow-x: hidden;
66682
+ overflow-y: scroll;
66683
+ width: auto;
66684
+ max-width: none;
66685
+ height: max-content;
66686
+ max-height: 100%;
66687
+ }
66688
+
66689
+ .scroll-button.end {
66690
+ width: ${controlHeight};
66691
+ height: ${controlHeight};
66692
+ margin-left: ${smallPadding};
66693
+ margin-top: 0px;
66694
+ }
66695
+
66696
+ :host([orientation="vertical"]) .scroll-button.end {
66697
+ margin-left: 0px;
66698
+ margin-top: ${smallPadding};
66662
66699
  }
66663
66700
 
66664
66701
  slot[name="step"]::slotted(*) {
@@ -66670,10 +66707,35 @@ ${nextLine.slice(indentLevel + 2)}`;
66670
66707
  }
66671
66708
  `;
66672
66709
 
66673
- const template$n = html `<ol><slot
66674
- name="step"
66675
- ${slotted('steps')}
66676
- ></slot></ol>`;
66710
+ const template$n = html `
66711
+ ${when(x => x.showScrollButtons, html `
66712
+ <${buttonTag}
66713
+ content-hidden
66714
+ class="scroll-button start"
66715
+ appearance="${ButtonAppearance.ghost}"
66716
+ @click="${x => x.onScrollStartClick()}"
66717
+ ${ref('startScrollButton')}
66718
+ >
66719
+ ${x => scrollForwardLabel.getValueFor(x)}
66720
+ ${when(x => x.isHorizontal(), html `<${iconArrowExpanderLeftTag} slot="start"></${iconArrowExpanderLeftTag}>`, html `<${iconArrowExpanderUpTag} slot="start"></${iconArrowExpanderUpTag}>`)}
66721
+ </${buttonTag}>
66722
+ `)}
66723
+ <ol ${ref('list')} class="list"><slot
66724
+ name="step"
66725
+ ${slotted('steps')}
66726
+ ></slot></ol>
66727
+ ${when(x => x.showScrollButtons, html `
66728
+ <${buttonTag}
66729
+ content-hidden
66730
+ class="scroll-button end"
66731
+ appearance="${ButtonAppearance.ghost}"
66732
+ @click="${x => x.onScrollEndClick()}"
66733
+ >
66734
+ ${x => scrollBackwardLabel.getValueFor(x)}
66735
+ ${when(x => x.isHorizontal(), html `<${iconArrowExpanderRightTag} slot="start"></${iconArrowExpanderRightTag}>`, html `<${iconArrowExpanderDownTag} slot="start"></${iconArrowExpanderDownTag}>`)}
66736
+ </${buttonTag}>
66737
+ `)}
66738
+ `;
66677
66739
 
66678
66740
  /**
66679
66741
  * A nimble-styled stepper
@@ -66682,12 +66744,70 @@ ${nextLine.slice(indentLevel + 2)}`;
66682
66744
  constructor() {
66683
66745
  super(...arguments);
66684
66746
  this.orientation = StepperOrientation.horizontal;
66747
+ /** @internal */
66748
+ this.showScrollButtons = false;
66749
+ }
66750
+ /** @internal */
66751
+ onScrollStartClick() {
66752
+ if (this.isHorizontal()) {
66753
+ this.list.scrollBy({
66754
+ left: -this.list.clientWidth,
66755
+ behavior: 'smooth'
66756
+ });
66757
+ }
66758
+ else {
66759
+ this.list.scrollBy({
66760
+ top: -this.list.clientHeight,
66761
+ behavior: 'smooth'
66762
+ });
66763
+ }
66764
+ }
66765
+ /** @internal */
66766
+ onScrollEndClick() {
66767
+ if (this.isHorizontal()) {
66768
+ this.list.scrollBy({
66769
+ left: this.list.clientWidth,
66770
+ behavior: 'smooth'
66771
+ });
66772
+ }
66773
+ else {
66774
+ this.list.scrollBy({
66775
+ top: this.list.clientHeight,
66776
+ behavior: 'smooth'
66777
+ });
66778
+ }
66779
+ }
66780
+ /** @internal */
66781
+ connectedCallback() {
66782
+ super.connectedCallback();
66783
+ // Steps fill parent container so can't rely on a resize observer to track their space usage.
66784
+ // Instead directly track each step's occlusion with intersection observer which is more compute intensive.
66785
+ // When available can switch to container scroll state queries, see: https://github.com/ni/nimble/issues/2922
66786
+ this.listIntersectionObserver = new IntersectionObserver(_ => {
66787
+ this.handleListOverflow();
66788
+ }, {
66789
+ root: this.list,
66790
+ threshold: 1.0
66791
+ });
66792
+ }
66793
+ /** @internal */
66794
+ disconnectedCallback() {
66795
+ super.disconnectedCallback();
66796
+ this.listIntersectionObserver?.disconnect();
66797
+ }
66798
+ /** @internal */
66799
+ isHorizontal() {
66800
+ return this.orientation !== StepperOrientation.vertical;
66685
66801
  }
66686
66802
  orientationChanged() {
66687
66803
  this.updateStepInternals();
66688
66804
  }
66689
66805
  stepsChanged() {
66690
66806
  this.updateStepInternals();
66807
+ this.listIntersectionObserver?.disconnect();
66808
+ if (this.steps) {
66809
+ this.steps.forEach(step => this.listIntersectionObserver?.observe(step));
66810
+ }
66691
66811
  }
66692
66812
  updateStepInternals() {
66693
66813
  if (!this.steps) {
@@ -66695,15 +66815,38 @@ ${nextLine.slice(indentLevel + 2)}`;
66695
66815
  }
66696
66816
  const lastIndex = this.steps.length - 1;
66697
66817
  this.steps.forEach((step, index) => {
66698
- step.stepInternals.orientation = this.orientation;
66818
+ step.stepInternals.orientation = this.isHorizontal()
66819
+ ? StepperOrientation.horizontal
66820
+ : StepperOrientation.vertical;
66699
66821
  step.stepInternals.last = index === lastIndex;
66700
66822
  step.stepInternals.position = index + 1;
66701
66823
  });
66702
66824
  }
66825
+ handleListOverflow() {
66826
+ let listVisibleSize = this.isHorizontal()
66827
+ ? this.list.clientWidth
66828
+ : this.list.clientHeight;
66829
+ if (listVisibleSize !== undefined) {
66830
+ const buttonSize = this.isHorizontal()
66831
+ ? this.startScrollButton?.clientWidth ?? 0
66832
+ : this.startScrollButton?.clientHeight ?? 0;
66833
+ listVisibleSize = Math.ceil(listVisibleSize);
66834
+ if (this.showScrollButtons) {
66835
+ listVisibleSize += buttonSize * 2;
66836
+ }
66837
+ const listScrollSize = this.isHorizontal()
66838
+ ? this.list.scrollWidth
66839
+ : this.list.scrollHeight;
66840
+ this.showScrollButtons = listVisibleSize < listScrollSize;
66841
+ }
66842
+ }
66703
66843
  }
66704
66844
  __decorate([
66705
66845
  attr
66706
66846
  ], Stepper.prototype, "orientation", void 0);
66847
+ __decorate([
66848
+ observable
66849
+ ], Stepper.prototype, "showScrollButtons", void 0);
66707
66850
  __decorate([
66708
66851
  observable
66709
66852
  ], Stepper.prototype, "steps", void 0);
@@ -71729,11 +71872,6 @@ focus outline in that case.
71729
71872
  /** @internal */
71730
71873
  onCellActionMenuToggle(event, column) {
71731
71874
  this.menuOpen = event.detail.newState;
71732
- // Workaround for Firefox issue when action menus opened on different rows
71733
- // See: https://github.com/ni/nimble/issues/2744
71734
- if (!event.detail.newState) {
71735
- this.currentActionMenuColumn = undefined;
71736
- }
71737
71875
  this.emitActionMenuToggleEvent('row-action-menu-toggle', event.detail, column);
71738
71876
  }
71739
71877
  /** @internal */