@ni/nimble-components 32.9.0 → 32.9.1

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.
Files changed (37) hide show
  1. package/dist/all-components-bundle.js +96 -139
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +3565 -3560
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/checkbox/index.d.ts +12 -4
  6. package/dist/esm/checkbox/index.js +2 -11
  7. package/dist/esm/checkbox/index.js.map +1 -1
  8. package/dist/esm/combobox/index.d.ts +12 -7
  9. package/dist/esm/combobox/index.js +2 -8
  10. package/dist/esm/combobox/index.js.map +1 -1
  11. package/dist/esm/number-field/index.d.ts +12 -11
  12. package/dist/esm/number-field/index.js +2 -8
  13. package/dist/esm/number-field/index.js.map +1 -1
  14. package/dist/esm/patterns/error/template.js +7 -1
  15. package/dist/esm/patterns/error/template.js.map +1 -1
  16. package/dist/esm/patterns/error/testing/error-pattern.pageobject.d.ts +14 -0
  17. package/dist/esm/patterns/error/testing/error-pattern.pageobject.js +46 -0
  18. package/dist/esm/patterns/error/testing/error-pattern.pageobject.js.map +1 -0
  19. package/dist/esm/patterns/error/types.d.ts +16 -5
  20. package/dist/esm/patterns/error/types.js +27 -1
  21. package/dist/esm/patterns/error/types.js.map +1 -1
  22. package/dist/esm/radio-group/index.d.ts +11 -4
  23. package/dist/esm/radio-group/index.js +2 -13
  24. package/dist/esm/radio-group/index.js.map +1 -1
  25. package/dist/esm/rich-text/editor/index.d.ts +12 -16
  26. package/dist/esm/rich-text/editor/index.js +2 -14
  27. package/dist/esm/rich-text/editor/index.js.map +1 -1
  28. package/dist/esm/select/index.d.ts +11 -11
  29. package/dist/esm/select/index.js +2 -8
  30. package/dist/esm/select/index.js.map +1 -1
  31. package/dist/esm/text-area/index.d.ts +12 -18
  32. package/dist/esm/text-area/index.js +2 -15
  33. package/dist/esm/text-area/index.js.map +1 -1
  34. package/dist/esm/text-field/index.d.ts +12 -11
  35. package/dist/esm/text-field/index.js +2 -8
  36. package/dist/esm/text-field/index.js.map +1 -1
  37. package/package.json +1 -1
@@ -20504,8 +20504,68 @@ so this becomes the fallback color for the slot */ ''}
20504
20504
  }
20505
20505
  `;
20506
20506
 
20507
+ /**
20508
+ * The runtime behavior for template overflow detection.
20509
+ * @public
20510
+ */
20511
+ class OverflowBehavior {
20512
+ /**
20513
+ * Creates an instance of OverflowBehavior.
20514
+ * @param target - The element to check for overflow.
20515
+ * @param propertyName - The name of the property to assign the overflow state to.
20516
+ */
20517
+ constructor(target, propertyName) {
20518
+ this.target = target;
20519
+ this.propertyName = propertyName;
20520
+ }
20521
+ /**
20522
+ * Bind this behavior to the source.
20523
+ * @param source - The source to bind to.
20524
+ * @param context - The execution context that the binding is operating within.
20525
+ */
20526
+ bind(source) {
20527
+ this.source = source;
20528
+ this.setSourceValue(false);
20529
+ this.mouseOverHandler = () => {
20530
+ const hasOverflow = this.target.offsetWidth < this.target.scrollWidth;
20531
+ this.setSourceValue(hasOverflow);
20532
+ };
20533
+ this.mouseOutHandler = () => {
20534
+ this.setSourceValue(false);
20535
+ };
20536
+ this.target.addEventListener('mouseover', this.mouseOverHandler);
20537
+ this.target.addEventListener('mouseout', this.mouseOutHandler);
20538
+ }
20539
+ /**
20540
+ * Unbinds this behavior from the source.
20541
+ * @param source - The source to unbind from.
20542
+ */
20543
+ unbind() {
20544
+ this.source = undefined;
20545
+ this.target.removeEventListener('mouseover', this.mouseOverHandler);
20546
+ this.target.removeEventListener('mouseout', this.mouseOutHandler);
20547
+ }
20548
+ setSourceValue(value) {
20549
+ // @ts-expect-error set property on source
20550
+ this.source[this.propertyName] = value;
20551
+ }
20552
+ }
20553
+ /**
20554
+ * A directive that observes if an element has overflow and sets a flag.
20555
+ * @param propertyName - The name of the property to assign the overflow flag.
20556
+ * @public
20557
+ */
20558
+ function overflow(propertyName) {
20559
+ return new AttachedBehaviorHTMLDirective('nimble-overflow', OverflowBehavior, propertyName);
20560
+ }
20561
+
20507
20562
  const errorTextTemplate = html `
20508
- <div class="error-text" title="${x => x.errorText}" aria-live="polite">
20563
+ <div
20564
+ class="error-text"
20565
+ ${overflow('errorHasOverflow')}
20566
+ title="${x => (x.errorHasOverflow && x.errorText ? x.errorText : null)}"
20567
+ aria-live="polite"
20568
+ >
20509
20569
  ${x => x.errorText}
20510
20570
  </div>
20511
20571
  `;
@@ -20550,14 +20610,37 @@ so this becomes the fallback color for the slot */ ''}
20550
20610
  </template>
20551
20611
  `;
20552
20612
 
20613
+ // As the returned class is internal to the function, we can't write a signature that uses is directly, so rely on inference
20614
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/explicit-function-return-type
20615
+ function mixinErrorPattern(base) {
20616
+ /**
20617
+ * The Mixin that provides a concrete column with the API to support being resized
20618
+ * proportionally within a Table.
20619
+ */
20620
+ class ErrorPatternElement extends base {
20621
+ constructor() {
20622
+ super(...arguments);
20623
+ /*
20624
+ * Show the error appearance of the control
20625
+ */
20626
+ this.errorVisible = false;
20627
+ /* @internal
20628
+ * Indicates if the error text has overflowed its container. The value should not be
20629
+ * set directly. Instead, it is used with the `overflow` directive.
20630
+ */
20631
+ this.errorHasOverflow = false;
20632
+ }
20633
+ }
20634
+ attr({ attribute: 'error-text' })(ErrorPatternElement.prototype, 'errorText');
20635
+ attr({ attribute: 'error-visible', mode: 'boolean' })(ErrorPatternElement.prototype, 'errorVisible');
20636
+ observable(ErrorPatternElement.prototype, 'errorHasOverflow');
20637
+ return ErrorPatternElement;
20638
+ }
20639
+
20553
20640
  /**
20554
20641
  * A nimble-styled checkbox control.
20555
20642
  */
20556
- class Checkbox extends Checkbox$1 {
20557
- constructor() {
20558
- super(...arguments);
20559
- this.errorVisible = false;
20560
- }
20643
+ class Checkbox extends mixinErrorPattern(Checkbox$1) {
20561
20644
  /**
20562
20645
  * @internal
20563
20646
  */
@@ -20569,12 +20652,6 @@ so this becomes the fallback color for the slot */ ''}
20569
20652
  __decorate$1([
20570
20653
  attr({ attribute: 'tabindex', converter: nullableNumberConverter })
20571
20654
  ], Checkbox.prototype, "tabIndex", void 0);
20572
- __decorate$1([
20573
- attr({ attribute: 'error-text' })
20574
- ], Checkbox.prototype, "errorText", void 0);
20575
- __decorate$1([
20576
- attr({ attribute: 'error-visible', mode: 'boolean' })
20577
- ], Checkbox.prototype, "errorVisible", void 0);
20578
20655
  const nimbleCheckbox = Checkbox.compose({
20579
20656
  baseName: 'checkbox',
20580
20657
  baseClass: Checkbox$1,
@@ -21126,61 +21203,6 @@ so this becomes the fallback color for the slot */ ''}
21126
21203
  }
21127
21204
  `));
21128
21205
 
21129
- /**
21130
- * The runtime behavior for template overflow detection.
21131
- * @public
21132
- */
21133
- class OverflowBehavior {
21134
- /**
21135
- * Creates an instance of OverflowBehavior.
21136
- * @param target - The element to check for overflow.
21137
- * @param propertyName - The name of the property to assign the overflow state to.
21138
- */
21139
- constructor(target, propertyName) {
21140
- this.target = target;
21141
- this.propertyName = propertyName;
21142
- }
21143
- /**
21144
- * Bind this behavior to the source.
21145
- * @param source - The source to bind to.
21146
- * @param context - The execution context that the binding is operating within.
21147
- */
21148
- bind(source) {
21149
- this.source = source;
21150
- this.setSourceValue(false);
21151
- this.mouseOverHandler = () => {
21152
- const hasOverflow = this.target.offsetWidth < this.target.scrollWidth;
21153
- this.setSourceValue(hasOverflow);
21154
- };
21155
- this.mouseOutHandler = () => {
21156
- this.setSourceValue(false);
21157
- };
21158
- this.target.addEventListener('mouseover', this.mouseOverHandler);
21159
- this.target.addEventListener('mouseout', this.mouseOutHandler);
21160
- }
21161
- /**
21162
- * Unbinds this behavior from the source.
21163
- * @param source - The source to unbind from.
21164
- */
21165
- unbind() {
21166
- this.source = undefined;
21167
- this.target.removeEventListener('mouseover', this.mouseOverHandler);
21168
- this.target.removeEventListener('mouseout', this.mouseOutHandler);
21169
- }
21170
- setSourceValue(value) {
21171
- // @ts-expect-error set property on source
21172
- this.source[this.propertyName] = value;
21173
- }
21174
- }
21175
- /**
21176
- * A directive that observes if an element has overflow and sets a flag.
21177
- * @param propertyName - The name of the property to assign the overflow flag.
21178
- * @public
21179
- */
21180
- function overflow(propertyName) {
21181
- return new AttachedBehaviorHTMLDirective('nimble-overflow', OverflowBehavior, propertyName);
21182
- }
21183
-
21184
21206
  /* eslint-disable @typescript-eslint/indent */
21185
21207
  // prettier-ignore
21186
21208
  const template$z = (context, definition) => html `
@@ -21290,11 +21312,10 @@ so this becomes the fallback color for the slot */ ''}
21290
21312
  /**
21291
21313
  * A nimble-styed HTML combobox
21292
21314
  */
21293
- class Combobox extends FormAssociatedCombobox {
21315
+ class Combobox extends mixinErrorPattern(FormAssociatedCombobox) {
21294
21316
  constructor() {
21295
21317
  super(...arguments);
21296
21318
  this.appearance = DropdownAppearance.underline;
21297
- this.errorVisible = false;
21298
21319
  /**
21299
21320
  * The open attribute.
21300
21321
  */
@@ -21890,12 +21911,6 @@ so this becomes the fallback color for the slot */ ''}
21890
21911
  __decorate$1([
21891
21912
  attr
21892
21913
  ], Combobox.prototype, "appearance", void 0);
21893
- __decorate$1([
21894
- attr({ attribute: 'error-text' })
21895
- ], Combobox.prototype, "errorText", void 0);
21896
- __decorate$1([
21897
- attr({ attribute: 'error-visible', mode: 'boolean' })
21898
- ], Combobox.prototype, "errorVisible", void 0);
21899
21914
  __decorate$1([
21900
21915
  attr({ attribute: 'autocomplete', mode: 'fromView' })
21901
21916
  ], Combobox.prototype, "autocomplete", void 0);
@@ -26762,11 +26777,10 @@ so this becomes the fallback color for the slot */ ''}
26762
26777
  /**
26763
26778
  * A nimble-styled HTML number input
26764
26779
  */
26765
- class NumberField extends NumberField$1 {
26780
+ class NumberField extends mixinErrorPattern(NumberField$1) {
26766
26781
  constructor() {
26767
26782
  super(...arguments);
26768
26783
  this.appearance = NumberFieldAppearance.underline;
26769
- this.errorVisible = false;
26770
26784
  }
26771
26785
  connectedCallback() {
26772
26786
  super.connectedCallback();
@@ -26777,12 +26791,6 @@ so this becomes the fallback color for the slot */ ''}
26777
26791
  __decorate$1([
26778
26792
  attr
26779
26793
  ], NumberField.prototype, "appearance", void 0);
26780
- __decorate$1([
26781
- attr({ attribute: 'error-text' })
26782
- ], NumberField.prototype, "errorText", void 0);
26783
- __decorate$1([
26784
- attr({ attribute: 'error-visible', mode: 'boolean' })
26785
- ], NumberField.prototype, "errorVisible", void 0);
26786
26794
  /**
26787
26795
  * A function that returns a number-field registration for configuring the component with a DesignSystem.
26788
26796
  *
@@ -27018,18 +27026,8 @@ so this becomes the fallback color for the slot */ ''}
27018
27026
  /**
27019
27027
  * A nimble-styled grouping element for radio buttons
27020
27028
  */
27021
- class RadioGroup extends RadioGroup$1 {
27022
- constructor() {
27023
- super(...arguments);
27024
- this.errorVisible = false;
27025
- }
27029
+ class RadioGroup extends mixinErrorPattern(RadioGroup$1) {
27026
27030
  }
27027
- __decorate$1([
27028
- attr({ attribute: 'error-text' })
27029
- ], RadioGroup.prototype, "errorText", void 0);
27030
- __decorate$1([
27031
- attr({ attribute: 'error-visible', mode: 'boolean' })
27032
- ], RadioGroup.prototype, "errorVisible", void 0);
27033
27031
  const nimbleRadioGroup = RadioGroup.compose({
27034
27032
  baseName: 'radio-group',
27035
27033
  baseClass: RadioGroup$1,
@@ -59864,7 +59862,7 @@ img.ProseMirror-separator {
59864
59862
  /**
59865
59863
  * A nimble styled rich text editor
59866
59864
  */
59867
- class RichTextEditor extends RichText {
59865
+ class RichTextEditor extends mixinErrorPattern(RichText) {
59868
59866
  constructor() {
59869
59867
  super(...arguments);
59870
59868
  /**
@@ -59897,13 +59895,6 @@ img.ProseMirror-separator {
59897
59895
  * HTML Attribute: footer-hidden
59898
59896
  */
59899
59897
  this.footerHidden = false;
59900
- /**
59901
- * Whether to display the error state.
59902
- *
59903
- * @public
59904
- * HTML Attribute: error-visible
59905
- */
59906
- this.errorVisible = false;
59907
59898
  /**
59908
59899
  * The width of the vertical scrollbar, if displayed.
59909
59900
  * @internal
@@ -60374,12 +60365,6 @@ img.ProseMirror-separator {
60374
60365
  __decorate$1([
60375
60366
  attr({ attribute: 'footer-hidden', mode: 'boolean' })
60376
60367
  ], RichTextEditor.prototype, "footerHidden", void 0);
60377
- __decorate$1([
60378
- attr({ attribute: 'error-visible', mode: 'boolean' })
60379
- ], RichTextEditor.prototype, "errorVisible", void 0);
60380
- __decorate$1([
60381
- attr({ attribute: 'error-text' })
60382
- ], RichTextEditor.prototype, "errorText", void 0);
60383
60368
  __decorate$1([
60384
60369
  attr
60385
60370
  ], RichTextEditor.prototype, "placeholder", void 0);
@@ -61094,11 +61079,10 @@ img.ProseMirror-separator {
61094
61079
  /**
61095
61080
  * A nimble-styled HTML select.
61096
61081
  */
61097
- class Select extends FormAssociatedSelect {
61082
+ class Select extends mixinErrorPattern(FormAssociatedSelect) {
61098
61083
  constructor() {
61099
61084
  super(...arguments);
61100
61085
  this.appearance = DropdownAppearance.underline;
61101
- this.errorVisible = false;
61102
61086
  this.filterMode = FilterMode.none;
61103
61087
  this.clearable = false;
61104
61088
  this.loadingVisible = false;
@@ -62087,12 +62071,6 @@ img.ProseMirror-separator {
62087
62071
  __decorate$1([
62088
62072
  attr({ attribute: 'position' })
62089
62073
  ], Select.prototype, "positionAttribute", void 0);
62090
- __decorate$1([
62091
- attr({ attribute: 'error-text' })
62092
- ], Select.prototype, "errorText", void 0);
62093
- __decorate$1([
62094
- attr({ attribute: 'error-visible', mode: 'boolean' })
62095
- ], Select.prototype, "errorVisible", void 0);
62096
62074
  __decorate$1([
62097
62075
  attr({ attribute: 'filter-mode' })
62098
62076
  ], Select.prototype, "filterMode", void 0);
@@ -74605,7 +74583,7 @@ focus outline in that case.
74605
74583
  /**
74606
74584
  * A nimble-styed HTML text area
74607
74585
  */
74608
- class TextArea extends TextArea$1 {
74586
+ class TextArea extends mixinErrorPattern(TextArea$1) {
74609
74587
  constructor() {
74610
74588
  super(...arguments);
74611
74589
  /**
@@ -74616,14 +74594,6 @@ focus outline in that case.
74616
74594
  * HTML Attribute: appearance
74617
74595
  */
74618
74596
  this.appearance = TextAreaAppearance.outline;
74619
- /**
74620
- * Whether to display the error state.
74621
- *
74622
- * @public
74623
- * @remarks
74624
- * HTML Attribute: error-visible
74625
- */
74626
- this.errorVisible = false;
74627
74597
  /**
74628
74598
  * The width of the vertical scrollbar, if displayed.
74629
74599
  * @internal
@@ -74694,12 +74664,6 @@ focus outline in that case.
74694
74664
  __decorate$1([
74695
74665
  attr
74696
74666
  ], TextArea.prototype, "appearance", void 0);
74697
- __decorate$1([
74698
- attr({ attribute: 'error-text' })
74699
- ], TextArea.prototype, "errorText", void 0);
74700
- __decorate$1([
74701
- attr({ attribute: 'error-visible', mode: 'boolean' })
74702
- ], TextArea.prototype, "errorVisible", void 0);
74703
74667
  __decorate$1([
74704
74668
  observable
74705
74669
  ], TextArea.prototype, "scrollbarWidth", void 0);
@@ -74966,7 +74930,7 @@ focus outline in that case.
74966
74930
  /**
74967
74931
  * A nimble-styed HTML text input
74968
74932
  */
74969
- class TextField extends TextField$1 {
74933
+ class TextField extends mixinErrorPattern(TextField$1) {
74970
74934
  constructor() {
74971
74935
  super(...arguments);
74972
74936
  /**
@@ -74977,19 +74941,12 @@ focus outline in that case.
74977
74941
  * HTML Attribute: appearance
74978
74942
  */
74979
74943
  this.appearance = TextFieldAppearance.underline;
74980
- this.errorVisible = false;
74981
74944
  this.fullBleed = false;
74982
74945
  }
74983
74946
  }
74984
74947
  __decorate$1([
74985
74948
  attr
74986
74949
  ], TextField.prototype, "appearance", void 0);
74987
- __decorate$1([
74988
- attr({ attribute: 'error-text' })
74989
- ], TextField.prototype, "errorText", void 0);
74990
- __decorate$1([
74991
- attr({ attribute: 'error-visible', mode: 'boolean' })
74992
- ], TextField.prototype, "errorVisible", void 0);
74993
74950
  __decorate$1([
74994
74951
  attr({ attribute: 'full-bleed', mode: 'boolean' })
74995
74952
  ], TextField.prototype, "fullBleed", void 0);