@ni/nimble-components 20.5.4 → 20.6.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.
Files changed (32) hide show
  1. package/dist/all-components-bundle.js +110 -36
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +2481 -2476
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/banner/template.js +4 -4
  6. package/dist/esm/banner/template.js.map +1 -1
  7. package/dist/esm/icon-base/index.d.ts +1 -6
  8. package/dist/esm/icon-base/index.js +1 -21
  9. package/dist/esm/icon-base/index.js.map +1 -1
  10. package/dist/esm/icon-base/template.js +6 -5
  11. package/dist/esm/icon-base/template.js.map +1 -1
  12. package/dist/esm/label-provider/core/index.d.ts +9 -0
  13. package/dist/esm/label-provider/core/index.js +14 -2
  14. package/dist/esm/label-provider/core/index.js.map +1 -1
  15. package/dist/esm/label-provider/core/label-token-defaults.js +4 -1
  16. package/dist/esm/label-provider/core/label-token-defaults.js.map +1 -1
  17. package/dist/esm/label-provider/core/label-tokens.d.ts +3 -0
  18. package/dist/esm/label-provider/core/label-tokens.js +12 -0
  19. package/dist/esm/label-provider/core/label-tokens.js.map +1 -1
  20. package/dist/esm/rich-text/editor/index.d.ts +10 -0
  21. package/dist/esm/rich-text/editor/index.js +70 -5
  22. package/dist/esm/rich-text/editor/index.js.map +1 -1
  23. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.d.ts +2 -0
  24. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js +14 -0
  25. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js.map +1 -1
  26. package/dist/esm/table/components/header/template.js +1 -0
  27. package/dist/esm/table/components/header/template.js.map +1 -1
  28. package/dist/esm/table/testing/table.pageobject.js +1 -1
  29. package/dist/esm/table/testing/table.pageobject.js.map +1 -1
  30. package/dist/esm/table-column/enum-base/models/mapping-icon-config.js +1 -0
  31. package/dist/esm/table-column/enum-base/models/mapping-icon-config.js.map +1 -1
  32. package/package.json +1 -1
@@ -16288,7 +16288,7 @@
16288
16288
 
16289
16289
  /**
16290
16290
  * Do not edit directly
16291
- * Generated on Tue, 26 Sep 2023 20:58:04 GMT
16291
+ * Generated on Thu, 28 Sep 2023 22:01:04 GMT
16292
16292
  */
16293
16293
 
16294
16294
  const Information100DarkUi = "#a46eff";
@@ -19482,11 +19482,12 @@
19482
19482
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path class="cls-1" d="M8.033 14.026 4.9 10.866 6.277 9.53l1.744 1.81 4.562-4.507 1.307 1.363Zm1.155-10.68-1.321-1.32-2.312 2.311-2.311-2.311-1.321 1.32 2.311 2.312L1.923 7.97l1.32 1.32 2.312-2.31 2.312 2.31 1.32-1.32-2.31-2.312Z"/></svg>`
19483
19483
  };
19484
19484
 
19485
- const template$t = html `
19486
- <template>
19487
- <div class="icon" :innerHTML=${x => x.icon.data}></div>
19488
- </template
19489
- `;
19485
+ // Avoiding any whitespace in the template because this is an inline element
19486
+ const template$t = html `<div
19487
+ class="icon"
19488
+ aria-hidden="true"
19489
+ :innerHTML=${x => x.icon.data}
19490
+ ></div>`;
19490
19491
 
19491
19492
  const styles$I = css `
19492
19493
  ${display('inline-flex')}
@@ -19534,30 +19535,10 @@
19534
19535
  super();
19535
19536
  this.icon = icon;
19536
19537
  }
19537
- connectedCallback() {
19538
- super.connectedCallback();
19539
- this.forwardAriaLabelToSvg();
19540
- }
19541
- ariaLabelChanged() {
19542
- this.forwardAriaLabelToSvg();
19543
- }
19544
- forwardAriaLabelToSvg() {
19545
- const svg = this.shadowRoot?.querySelector('svg');
19546
- if (!svg) {
19547
- return;
19548
- }
19549
- if (this.ariaLabel !== null && this.ariaLabel !== undefined) {
19550
- svg.setAttribute('aria-label', this.ariaLabel);
19551
- }
19552
- else {
19553
- svg.removeAttribute('aria-label');
19554
- }
19555
- }
19556
19538
  }
19557
19539
  __decorate$1([
19558
19540
  attr
19559
19541
  ], Icon.prototype, "severity", void 0);
19560
- applyMixins(Icon, ARIAGlobalStatesAndProperties);
19561
19542
  const registerIcon = (baseName, iconClass) => {
19562
19543
  const composedIcon = iconClass.compose({
19563
19544
  baseName,
@@ -19634,7 +19615,10 @@
19634
19615
  const coreLabelDefaults = {
19635
19616
  popupDismissLabel: 'Close',
19636
19617
  numericIncrementLabel: 'Increment',
19637
- numericDecrementLabel: 'Decrement'
19618
+ numericDecrementLabel: 'Decrement',
19619
+ errorIconLabel: 'Error',
19620
+ warningIconLabel: 'Warning',
19621
+ informationIconLabel: 'Information'
19638
19622
  };
19639
19623
 
19640
19624
  const popupDismissLabel = DesignToken.create({
@@ -19649,6 +19633,18 @@
19649
19633
  name: 'numeric-increment-label',
19650
19634
  cssCustomPropertyName: null
19651
19635
  }).withDefault(coreLabelDefaults.numericIncrementLabel);
19636
+ const errorIconLabel = DesignToken.create({
19637
+ name: 'error-icon-label',
19638
+ cssCustomPropertyName: null
19639
+ }).withDefault(coreLabelDefaults.errorIconLabel);
19640
+ const warningIconLabel = DesignToken.create({
19641
+ name: 'warning-icon-label',
19642
+ cssCustomPropertyName: null
19643
+ }).withDefault(coreLabelDefaults.warningIconLabel);
19644
+ const informationIconLabel = DesignToken.create({
19645
+ name: 'information-icon-label',
19646
+ cssCustomPropertyName: null
19647
+ }).withDefault(coreLabelDefaults.informationIconLabel);
19652
19648
 
19653
19649
  // prettier-ignore
19654
19650
  const template$s = html `
@@ -19677,13 +19673,13 @@
19677
19673
  >
19678
19674
  <div class="icon">
19679
19675
  ${when(x => x.severity === BannerSeverity.error, html `
19680
- <${iconExclamationMarkTag}></${iconExclamationMarkTag}>
19676
+ <${iconExclamationMarkTag} role="img" aria-label="${x => errorIconLabel.getValueFor(x)}"></${iconExclamationMarkTag}>
19681
19677
  `)}
19682
19678
  ${when(x => x.severity === BannerSeverity.warning, html `
19683
- <${iconTriangleFilledTag}></${iconTriangleFilledTag}>
19679
+ <${iconTriangleFilledTag} role="img" aria-label="${x => warningIconLabel.getValueFor(x)}"></${iconTriangleFilledTag}>
19684
19680
  `)}
19685
19681
  ${when(x => x.severity === BannerSeverity.information, html `
19686
- <${iconInfoTag}></${iconInfoTag}>
19682
+ <${iconInfoTag} role="img" aria-label="${x => informationIconLabel.getValueFor(x)}"></${iconInfoTag}>
19687
19683
  `)}
19688
19684
  </div>
19689
19685
  <div class="text">
@@ -23675,7 +23671,10 @@
23675
23671
  const supportedLabels$1 = {
23676
23672
  popupDismiss: popupDismissLabel,
23677
23673
  numericDecrement: numericDecrementLabel,
23678
- numericIncrement: numericIncrementLabel
23674
+ numericIncrement: numericIncrementLabel,
23675
+ errorIcon: errorIconLabel,
23676
+ warningIcon: warningIconLabel,
23677
+ informationIcon: informationIconLabel
23679
23678
  };
23680
23679
  /**
23681
23680
  * Core label provider for Nimble
@@ -23695,6 +23694,15 @@
23695
23694
  __decorate$1([
23696
23695
  attr({ attribute: 'numeric-increment' })
23697
23696
  ], LabelProviderCore.prototype, "numericIncrement", void 0);
23697
+ __decorate$1([
23698
+ attr({ attribute: 'error-icon' })
23699
+ ], LabelProviderCore.prototype, "errorIcon", void 0);
23700
+ __decorate$1([
23701
+ attr({ attribute: 'warning-icon' })
23702
+ ], LabelProviderCore.prototype, "warningIcon", void 0);
23703
+ __decorate$1([
23704
+ attr({ attribute: 'information-icon' })
23705
+ ], LabelProviderCore.prototype, "informationIcon", void 0);
23698
23706
  const nimbleLabelProviderCore = LabelProviderCore.compose({
23699
23707
  baseName: 'label-provider-core'
23700
23708
  });
@@ -58785,6 +58793,46 @@ img.ProseMirror-separator {
58785
58793
  this.scrollbarWidth = -1;
58786
58794
  this.updateScrollbarWidthQueued = false;
58787
58795
  this.xmlSerializer = new XMLSerializer();
58796
+ this.validAbsoluteLinkRegex = /^https?:\/\//i;
58797
+ /**
58798
+ * This method finds the Link mark in the pasted content and update its Text node.
58799
+ * If there is no text node, pass the node's fragment recursively and updates only node containing Link mark.
58800
+ * If the Text node does not contains Link mark, push the same node to `updatedNodes`.
58801
+ *
58802
+ * @param fragment Fragment containing the pasted content. [Fragment](https://prosemirror.net/docs/ref/#model.Fragment)
58803
+ * @returns modified fragment from the `updatedNode` after updating the valid link text with its href value.
58804
+ */
58805
+ this.updateLinkNodes = (fragment) => {
58806
+ const updatedNodes = [];
58807
+ fragment.forEach(node => {
58808
+ if (node.isText && node.marks.length > 0) {
58809
+ const linkMark = node.marks.find(mark => mark.type.name === 'link' && mark.attrs);
58810
+ if (linkMark) {
58811
+ // Checks if the link is valid link or not
58812
+ // Needing to separately validate the link on paste is a workaround for a tiptap issue
58813
+ // See: https://github.com/ni/nimble/issues/1527
58814
+ if (this.validAbsoluteLinkRegex.test(linkMark.attrs.href)) {
58815
+ // The below lines of code is responsible for updating the text content with its href value and creates a new updated text node.
58816
+ // This code needs an update when the hyperlink support is added.
58817
+ // See: https://github.com/ni/nimble/issues/1527
58818
+ updatedNodes.push(this.tiptapEditor.schema.text(linkMark.attrs.href, node.marks));
58819
+ }
58820
+ else {
58821
+ // If it is a invalid link, creates a new Text node with the same text content and without a Link mark.
58822
+ updatedNodes.push(this.tiptapEditor.schema.text(node.textContent, linkMark.removeFromSet(node.marks)));
58823
+ }
58824
+ }
58825
+ else {
58826
+ updatedNodes.push(node);
58827
+ }
58828
+ }
58829
+ else {
58830
+ const updatedContent = this.updateLinkNodes(node.content);
58831
+ updatedNodes.push(node.copy(updatedContent));
58832
+ }
58833
+ });
58834
+ return Fragment.fromArray(updatedNodes);
58835
+ };
58788
58836
  }
58789
58837
  /**
58790
58838
  * True if the editor is empty or contains only whitespace, false otherwise.
@@ -58956,6 +59004,14 @@ img.ProseMirror-separator {
58956
59004
  }
58957
59005
  createTiptapEditor() {
58958
59006
  const customLink = this.getCustomLinkExtension();
59007
+ /**
59008
+ * @param slice contains the Fragment of the copied content. If the content is a link, the slice contains Text node with Link mark.
59009
+ * ProseMirror reference for `transformPasted`: https://prosemirror.net/docs/ref/#view.EditorProps.transformPasted
59010
+ */
59011
+ const transformPasted = (slice) => {
59012
+ const modifiedFragment = this.updateLinkNodes(slice.content);
59013
+ return new Slice(modifiedFragment, slice.openStart, slice.openEnd);
59014
+ };
58959
59015
  /**
58960
59016
  * For more information on the extensions for the supported formatting options, refer to the links below.
58961
59017
  * Tiptap marks: https://tiptap.dev/api/marks
@@ -58970,6 +59026,14 @@ img.ProseMirror-separator {
58970
59026
  // Lists do not have any default paste rules, they have only input rules, so disabled paste rules
58971
59027
  // https://tiptap.dev/api/editor#enable-paste-rules
58972
59028
  enablePasteRules: false,
59029
+ editorProps: {
59030
+ // Validating whether the links in the pasted content belongs to the supported scheme (HTTPS/HTTP),
59031
+ // and rendering it as a link in the editor. If not, rendering it as a plain text.
59032
+ // Also, updating the link text content with its href as we support only the absolute link.
59033
+ // `transformPasted` can be updated/removed when hyperlink support added
59034
+ // See: https://github.com/ni/nimble/issues/1527
59035
+ transformPasted
59036
+ },
58973
59037
  extensions: [
58974
59038
  Document$1,
58975
59039
  Paragraph,
@@ -58997,7 +59061,7 @@ img.ProseMirror-separator {
58997
59061
  // linkOnPaste can be enabled when hyperlink support added
58998
59062
  // See: https://github.com/ni/nimble/issues/1527
58999
59063
  linkOnPaste: false,
59000
- validate: href => /^https?:\/\//i.test(href)
59064
+ validate: href => this.validAbsoluteLinkRegex.test(href)
59001
59065
  })
59002
59066
  ]
59003
59067
  });
@@ -59019,10 +59083,18 @@ img.ProseMirror-separator {
59019
59083
  // See: https://github.com/ni/nimble/issues/1527
59020
59084
  inclusive: false,
59021
59085
  parseHTML() {
59022
- // To load the `nimble-anchor` from the HTML parsed content by markdown-parser as links in the
59023
- // Tiptap editor, the `parseHTML` of Link extension should return `anchorTag`. This is because the
59024
- // link mark schema in `markdown-parser.ts` file uses `<nimble-anchor>` as anchor tag and not `<a>`.
59025
- return [{ tag: anchorTag }];
59086
+ return [
59087
+ // To load the `nimble-anchor` from the HTML parsed content by markdown-parser as links in the Tiptap editor, the `parseHTML`
59088
+ // of Link extension should return nimble `anchorTag`.
59089
+ // This is because the link mark schema in `markdown-parser.ts` file uses `<nimble-anchor>` as anchor tag and not `<a>`.
59090
+ {
59091
+ tag: anchorTag
59092
+ },
59093
+ // `<a>` tag is added here to support when pasting a link from external source.
59094
+ {
59095
+ tag: 'a'
59096
+ }
59097
+ ];
59026
59098
  },
59027
59099
  // HTMLAttribute cannot be in camelCase as we want to match it with the name in Tiptap
59028
59100
  // eslint-disable-next-line @typescript-eslint/naming-convention
@@ -63968,6 +64040,7 @@ img.ProseMirror-separator {
63968
64040
  <${iconTwoSquaresInBracketsTag}
63969
64041
  class="grouped-indicator"
63970
64042
  title="${x => tableColumnHeaderGroupedLabel.getValueFor(x)}"
64043
+ role="img"
63971
64044
  aria-label="${x => tableColumnHeaderGroupedLabel.getValueFor(x)}"
63972
64045
  ></${iconTwoSquaresInBracketsTag}>
63973
64046
  `)}
@@ -68664,6 +68737,7 @@ img.ProseMirror-separator {
68664
68737
  const createIconTemplate = (icon) => html `
68665
68738
  <${icon}
68666
68739
  title="${x => x.text}"
68740
+ role="img"
68667
68741
  aria-label="${x => x.text}"
68668
68742
  severity="${x => x.severity}"
68669
68743
  class="no-shrink"