@ni/nimble-components 11.1.1 → 11.2.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.
@@ -19628,6 +19628,15 @@
19628
19628
  });
19629
19629
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleMenuItem());
19630
19630
 
19631
+ /**
19632
+ * Values for the 'appearance' property of the number field
19633
+ */
19634
+ const NumberFieldAppearance = {
19635
+ underline: 'underline',
19636
+ outline: 'outline',
19637
+ block: 'block'
19638
+ };
19639
+
19631
19640
  const styles$b = css `
19632
19641
  ${display('inline-block')}
19633
19642
 
@@ -19651,6 +19660,10 @@
19651
19660
  font: ${controlLabelFont};
19652
19661
  }
19653
19662
 
19663
+ :host([disabled]) .label {
19664
+ color: ${controlLabelDisabledFontColor};
19665
+ }
19666
+
19654
19667
  .root {
19655
19668
  box-sizing: border-box;
19656
19669
  position: relative;
@@ -19658,7 +19671,7 @@
19658
19671
  flex-direction: row;
19659
19672
  justify-content: center;
19660
19673
  border-radius: 0px;
19661
- border-bottom: ${borderWidth} solid rgba(${borderRgbPartialColor}, 0.3);
19674
+ border: 0px solid rgba(${borderRgbPartialColor}, 0.3);
19662
19675
  gap: calc(${standardPadding} / 2);
19663
19676
  }
19664
19677
 
@@ -19666,9 +19679,8 @@
19666
19679
  border-bottom-color: ${borderHoverColor};
19667
19680
  }
19668
19681
 
19669
- :host([disabled]) .root,
19670
- :host([disabled]) .root:hover {
19671
- border-bottom: ${borderWidth} solid ${bodyDisabledFontColor};
19682
+ :host([disabled]) .root {
19683
+ border-color: rgba(${borderRgbPartialColor}, 0.1);
19672
19684
  }
19673
19685
 
19674
19686
  .root::before {
@@ -19717,7 +19729,7 @@
19717
19729
  font: inherit;
19718
19730
  background: transparent;
19719
19731
  color: inherit;
19720
- height: calc(${controlHeight} - ${borderWidth});
19732
+ height: ${controlHeight};
19721
19733
  width: 100%;
19722
19734
  border: none;
19723
19735
  padding: 0px;
@@ -19749,32 +19761,67 @@
19749
19761
 
19750
19762
  .controls {
19751
19763
  display: flex;
19752
- flex-direction: column;
19753
- }
19754
-
19755
- .step-up,
19756
- .step-down {
19757
- display: inline-flex;
19758
- height: 15px;
19759
- width: 15px;
19760
- cursor: pointer;
19764
+ flex-direction: row-reverse;
19761
19765
  justify-content: center;
19762
19766
  align-items: center;
19763
19767
  }
19764
19768
 
19765
- .step-up svg,
19766
- .step-down svg {
19767
- height: ${iconSize};
19768
- width: ${iconSize};
19769
- fill: ${borderColor};
19769
+ .step-up-down-button {
19770
+ ${controlHeight.cssCustomProperty}: 24px;
19770
19771
  }
19771
- `;
19772
+ `.withBehaviors(appearanceBehavior(NumberFieldAppearance.underline, css `
19773
+ .root {
19774
+ border-bottom-width: ${borderWidth};
19775
+ padding-top: ${borderWidth};
19776
+ padding-left: ${borderWidth};
19777
+ padding-right: ${borderWidth};
19778
+ }
19779
+
19780
+ .control {
19781
+ height: calc(${controlHeight} - 2 * ${borderWidth});
19782
+ }
19783
+ `), appearanceBehavior(NumberFieldAppearance.block, css `
19784
+ .root {
19785
+ background-color: rgba(${borderRgbPartialColor}, 0.1);
19786
+ padding-left: ${borderWidth};
19787
+ padding-right: ${borderWidth};
19788
+ }
19789
+
19790
+ .root:focus-within,
19791
+ :host(.invalid) .root {
19792
+ border-bottom-width: ${borderWidth};
19793
+ }
19794
+
19795
+ :host([disabled]) .root {
19796
+ background-color: rgba(${borderRgbPartialColor}, 0.07);
19797
+ }
19798
+ `), appearanceBehavior(NumberFieldAppearance.outline, css `
19799
+ .root {
19800
+ border-width: ${borderWidth};
19801
+ }
19802
+
19803
+ .control {
19804
+ height: calc(${controlHeight} - 2 * ${borderWidth});
19805
+ }
19806
+ `));
19772
19807
 
19773
19808
  /**
19774
19809
  * A nimble-styled HTML number input
19775
19810
  */
19776
19811
  class NumberField extends NumberField$1 {
19812
+ constructor() {
19813
+ super(...arguments);
19814
+ this.appearance = NumberFieldAppearance.underline;
19815
+ }
19816
+ connectedCallback() {
19817
+ super.connectedCallback();
19818
+ // This is a workaround for FAST issue: https://github.com/microsoft/fast/issues/6148
19819
+ this.control.setAttribute('role', 'spinbutton');
19820
+ }
19777
19821
  }
19822
+ __decorate([
19823
+ attr
19824
+ ], NumberField.prototype, "appearance", void 0);
19778
19825
  /**
19779
19826
  * A function that returns a number-field registration for configuring the component with a DesignSystem.
19780
19827
  *
@@ -19791,8 +19838,28 @@
19791
19838
  shadowOptions: {
19792
19839
  delegatesFocus: true
19793
19840
  },
19794
- stepDownGlyph: arrowExpanderDown16X16.data,
19795
- stepUpGlyph: arrowExpanderUp16X16.data
19841
+ stepDownGlyph: html `
19842
+ <nimble-button
19843
+ class="step-up-down-button"
19844
+ appearance="ghost"
19845
+ content-hidden
19846
+ tabindex="-1"
19847
+ >
19848
+ "Decrement"
19849
+ <nimble-icon-minus-wide slot="start"></nimble-icon-minus-wide>
19850
+ </nimble-button>
19851
+ `,
19852
+ stepUpGlyph: html `
19853
+ <nimble-button
19854
+ class="step-up-down-button"
19855
+ appearance="ghost"
19856
+ content-hidden
19857
+ tabindex="-1"
19858
+ >
19859
+ "Increment"
19860
+ <nimble-icon-add slot="start"></nimble-icon-add>
19861
+ </nimble-button>
19862
+ `
19796
19863
  });
19797
19864
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleNumberField());
19798
19865