@ni/nimble-components 20.16.2 → 20.16.4

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 (58) hide show
  1. package/dist/all-components-bundle.js +777 -226
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +3414 -3284
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/rich-text/base/index.d.ts +1 -4
  6. package/dist/esm/rich-text/base/index.js +2 -2
  7. package/dist/esm/rich-text/base/index.js.map +1 -1
  8. package/dist/esm/rich-text/editor/index.d.ts +50 -0
  9. package/dist/esm/rich-text/editor/index.js +110 -8
  10. package/dist/esm/rich-text/editor/index.js.map +1 -1
  11. package/dist/esm/rich-text/editor/models/create-tiptap-editor.d.ts +3 -1
  12. package/dist/esm/rich-text/editor/models/create-tiptap-editor.js +54 -6
  13. package/dist/esm/rich-text/editor/models/create-tiptap-editor.js.map +1 -1
  14. package/dist/esm/rich-text/editor/template.js +29 -2
  15. package/dist/esm/rich-text/editor/template.js.map +1 -1
  16. package/dist/esm/rich-text/editor/testing/rich-text-editor-utils.d.ts +6 -0
  17. package/dist/esm/rich-text/editor/testing/rich-text-editor-utils.js +52 -0
  18. package/dist/esm/rich-text/editor/testing/rich-text-editor-utils.js.map +1 -0
  19. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.d.ts +21 -3
  20. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js +121 -10
  21. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js.map +1 -1
  22. package/dist/esm/rich-text/editor/testing/types.d.ts +7 -0
  23. package/dist/esm/rich-text/editor/testing/types.js +7 -0
  24. package/dist/esm/rich-text/editor/testing/types.js.map +1 -1
  25. package/dist/esm/rich-text/editor/types.d.ts +13 -0
  26. package/dist/esm/rich-text/editor/types.js.map +1 -1
  27. package/dist/esm/rich-text/mention-listbox/index.d.ts +116 -0
  28. package/dist/esm/rich-text/mention-listbox/index.js +234 -0
  29. package/dist/esm/rich-text/mention-listbox/index.js.map +1 -0
  30. package/dist/esm/rich-text/mention-listbox/styles.d.ts +1 -0
  31. package/dist/esm/rich-text/mention-listbox/styles.js +22 -0
  32. package/dist/esm/rich-text/mention-listbox/styles.js.map +1 -0
  33. package/dist/esm/rich-text/mention-listbox/template.d.ts +2 -0
  34. package/dist/esm/rich-text/mention-listbox/template.js +33 -0
  35. package/dist/esm/rich-text/mention-listbox/template.js.map +1 -0
  36. package/dist/esm/rich-text/mention-listbox/types.d.ts +7 -0
  37. package/dist/esm/rich-text/mention-listbox/types.js +2 -0
  38. package/dist/esm/rich-text/mention-listbox/types.js.map +1 -0
  39. package/dist/esm/rich-text/models/markdown-parser.js +10 -2
  40. package/dist/esm/rich-text/models/markdown-parser.js.map +1 -1
  41. package/dist/esm/rich-text/models/mention-extension-configuration.d.ts +6 -1
  42. package/dist/esm/rich-text/models/mention-extension-configuration.js +6 -0
  43. package/dist/esm/rich-text/models/mention-extension-configuration.js.map +1 -1
  44. package/dist/esm/rich-text-mention/base/index.d.ts +6 -0
  45. package/dist/esm/rich-text-mention/base/index.js +9 -1
  46. package/dist/esm/rich-text-mention/base/index.js.map +1 -1
  47. package/dist/esm/rich-text-mention/base/models/mention-internals.d.ts +7 -2
  48. package/dist/esm/rich-text-mention/base/models/mention-internals.js +5 -2
  49. package/dist/esm/rich-text-mention/base/models/mention-internals.js.map +1 -1
  50. package/dist/esm/rich-text-mention/users/index.d.ts +1 -0
  51. package/dist/esm/rich-text-mention/users/index.js +3 -0
  52. package/dist/esm/rich-text-mention/users/index.js.map +1 -1
  53. package/dist/esm/rich-text-mention/users/view/styles.js +6 -2
  54. package/dist/esm/rich-text-mention/users/view/styles.js.map +1 -1
  55. package/dist/esm/utilities/models/string-normalizers.d.ts +5 -0
  56. package/dist/esm/utilities/models/string-normalizers.js +13 -0
  57. package/dist/esm/utilities/models/string-normalizers.js.map +1 -0
  58. package/package.json +1 -1
@@ -5372,7 +5372,7 @@
5372
5372
  const keyHome$1 = "Home";
5373
5373
  const keyEnd$1 = "End";
5374
5374
  const keySpace$1 = " ";
5375
- const keyTab = "Tab";
5375
+ const keyTab$1 = "Tab";
5376
5376
  const ArrowKeys = {
5377
5377
  ArrowDown: keyArrowDown$1,
5378
5378
  ArrowLeft: keyArrowLeft$1,
@@ -7849,7 +7849,7 @@
7849
7849
  *
7850
7850
  * @public
7851
7851
  */
7852
- class Listbox extends FoundationElement {
7852
+ let Listbox$1 = class Listbox extends FoundationElement {
7853
7853
  constructor() {
7854
7854
  super(...arguments);
7855
7855
  /**
@@ -8115,7 +8115,7 @@
8115
8115
  this.selectLastOption();
8116
8116
  break;
8117
8117
  }
8118
- case keyTab: {
8118
+ case keyTab$1: {
8119
8119
  this.focusAndScrollOptionIntoView();
8120
8120
  return true;
8121
8121
  }
@@ -8312,35 +8312,35 @@
8312
8312
  this.typeaheadExpired = false;
8313
8313
  }
8314
8314
  }
8315
- }
8315
+ };
8316
8316
  /**
8317
8317
  * A static filter to include only selectable options.
8318
8318
  *
8319
8319
  * @param n - element to filter
8320
8320
  * @public
8321
8321
  */
8322
- Listbox.slottedOptionFilter = (n) => isListboxOption(n) && !n.hidden;
8322
+ Listbox$1.slottedOptionFilter = (n) => isListboxOption(n) && !n.hidden;
8323
8323
  /**
8324
8324
  * Typeahead timeout in milliseconds.
8325
8325
  *
8326
8326
  * @internal
8327
8327
  */
8328
- Listbox.TYPE_AHEAD_TIMEOUT_MS = 1000;
8328
+ Listbox$1.TYPE_AHEAD_TIMEOUT_MS = 1000;
8329
8329
  __decorate([
8330
8330
  attr({ mode: "boolean" })
8331
- ], Listbox.prototype, "disabled", void 0);
8331
+ ], Listbox$1.prototype, "disabled", void 0);
8332
8332
  __decorate([
8333
8333
  observable
8334
- ], Listbox.prototype, "selectedIndex", void 0);
8334
+ ], Listbox$1.prototype, "selectedIndex", void 0);
8335
8335
  __decorate([
8336
8336
  observable
8337
- ], Listbox.prototype, "selectedOptions", void 0);
8337
+ ], Listbox$1.prototype, "selectedOptions", void 0);
8338
8338
  __decorate([
8339
8339
  observable
8340
- ], Listbox.prototype, "slottedOptions", void 0);
8340
+ ], Listbox$1.prototype, "slottedOptions", void 0);
8341
8341
  __decorate([
8342
8342
  observable
8343
- ], Listbox.prototype, "typeaheadBuffer", void 0);
8343
+ ], Listbox$1.prototype, "typeaheadBuffer", void 0);
8344
8344
  /**
8345
8345
  * Includes ARIA states and properties relating to the ARIA listbox role
8346
8346
  *
@@ -8361,7 +8361,7 @@
8361
8361
  observable
8362
8362
  ], DelegatesARIAListbox.prototype, "ariaMultiSelectable", void 0);
8363
8363
  applyMixins(DelegatesARIAListbox, ARIAGlobalStatesAndProperties);
8364
- applyMixins(Listbox, DelegatesARIAListbox);
8364
+ applyMixins(Listbox$1, DelegatesARIAListbox);
8365
8365
 
8366
8366
  /**
8367
8367
  * Positioning directions for the listbox when a select is open.
@@ -8372,7 +8372,7 @@
8372
8372
  below: "below",
8373
8373
  };
8374
8374
 
8375
- class _Combobox extends Listbox {
8375
+ class _Combobox extends Listbox$1 {
8376
8376
  }
8377
8377
  /**
8378
8378
  * A form-associated base class for the {@link (Combobox:class)} component.
@@ -10276,7 +10276,7 @@
10276
10276
  *
10277
10277
  * @public
10278
10278
  */
10279
- class ListboxElement extends Listbox {
10279
+ class ListboxElement extends Listbox$1 {
10280
10280
  constructor() {
10281
10281
  super(...arguments);
10282
10282
  /**
@@ -10571,7 +10571,7 @@
10571
10571
  this.checkLastOption(shiftKey);
10572
10572
  return;
10573
10573
  }
10574
- case keyTab: {
10574
+ case keyTab$1: {
10575
10575
  this.focusAndScrollOptionIntoView();
10576
10576
  return true;
10577
10577
  }
@@ -10715,6 +10715,32 @@
10715
10715
  attr({ converter: nullableNumberConverter })
10716
10716
  ], ListboxElement.prototype, "size", void 0);
10717
10717
 
10718
+ /**
10719
+ * The template for the {@link @microsoft/fast-foundation#(Listbox:class)} component.
10720
+ * @public
10721
+ */
10722
+ const listboxTemplate = (context, definition) => html `
10723
+ <template
10724
+ aria-activedescendant="${x => x.ariaActiveDescendant}"
10725
+ aria-multiselectable="${x => x.ariaMultiSelectable}"
10726
+ class="listbox"
10727
+ role="listbox"
10728
+ tabindex="${x => (!x.disabled ? "0" : null)}"
10729
+ @click="${(x, c) => x.clickHandler(c.event)}"
10730
+ @focusin="${(x, c) => x.focusinHandler(c.event)}"
10731
+ @keydown="${(x, c) => x.keydownHandler(c.event)}"
10732
+ @mousedown="${(x, c) => x.mousedownHandler(c.event)}"
10733
+ >
10734
+ <slot
10735
+ ${slotted({
10736
+ filter: ListboxElement.slottedOptionFilter,
10737
+ flatten: true,
10738
+ property: "slottedOptions",
10739
+ })}
10740
+ ></slot>
10741
+ </template>
10742
+ `;
10743
+
10718
10744
  /**
10719
10745
  * Menu items roles.
10720
10746
  * @public
@@ -12895,7 +12921,7 @@
12895
12921
  */
12896
12922
  setDefaultSelectedOption() {
12897
12923
  var _a;
12898
- const options = (_a = this.options) !== null && _a !== void 0 ? _a : Array.from(this.children).filter(Listbox.slottedOptionFilter);
12924
+ const options = (_a = this.options) !== null && _a !== void 0 ? _a : Array.from(this.children).filter(Listbox$1.slottedOptionFilter);
12899
12925
  const selectedIndex = options === null || options === void 0 ? void 0 : options.findIndex(el => el.hasAttribute("selected") || el.selected || el.value === this.value);
12900
12926
  if (selectedIndex !== -1) {
12901
12927
  this.selectedIndex = selectedIndex;
@@ -12954,7 +12980,7 @@
12954
12980
  }
12955
12981
  break;
12956
12982
  }
12957
- case keyTab: {
12983
+ case keyTab$1: {
12958
12984
  if (this.collapsible && this.open) {
12959
12985
  e.preventDefault();
12960
12986
  this.open = false;
@@ -16274,7 +16300,7 @@
16274
16300
 
16275
16301
  /**
16276
16302
  * Do not edit directly
16277
- * Generated on Wed, 13 Dec 2023 13:12:27 GMT
16303
+ * Generated on Fri, 15 Dec 2023 13:52:49 GMT
16278
16304
  */
16279
16305
 
16280
16306
  const Information100DarkUi = "#a46eff";
@@ -16658,6 +16684,7 @@
16658
16684
  const keyHome = "Home";
16659
16685
  const keyShift = "Shift";
16660
16686
  const keySpace = " ";
16687
+ const keyTab = "Tab";
16661
16688
 
16662
16689
  /**
16663
16690
  * Expose ltr and rtl strings
@@ -16676,9 +16703,9 @@
16676
16703
  return `${prefix}${uniqueIdCounter++}`;
16677
16704
  }
16678
16705
 
16679
- const template$D = html `<slot></slot>`;
16706
+ const template$E = html `<slot></slot>`;
16680
16707
 
16681
- const styles$W = css `
16708
+ const styles$Y = css `
16682
16709
  :host {
16683
16710
  display: contents;
16684
16711
  }
@@ -16795,8 +16822,8 @@
16795
16822
  ], ThemeProvider.prototype, "theme", void 0);
16796
16823
  const nimbleDesignSystemProvider = ThemeProvider.compose({
16797
16824
  baseName: 'theme-provider',
16798
- styles: styles$W,
16799
- template: template$D
16825
+ styles: styles$Y,
16826
+ template: template$E
16800
16827
  });
16801
16828
  DesignSystem.getOrCreate()
16802
16829
  .withPrefix('nimble')
@@ -17001,7 +17028,7 @@
17001
17028
  }
17002
17029
  }
17003
17030
 
17004
- const styles$V = css `
17031
+ const styles$X = css `
17005
17032
  ${display('inline')}
17006
17033
 
17007
17034
  :host {
@@ -17088,7 +17115,7 @@
17088
17115
  `;
17089
17116
 
17090
17117
  // prettier-ignore
17091
- const template$C = (_context, definition) => html `${
17118
+ const template$D = (_context, definition) => html `${
17092
17119
  /* top-container div is necessary because setting contenteditable directly on the native anchor instead
17093
17120
  leaves it focusable, unlike the behavior you get when the anchor is _within_ a contenteditable element.
17094
17121
  */ ''}<div
@@ -17187,8 +17214,8 @@
17187
17214
  const nimbleAnchor = Anchor.compose({
17188
17215
  baseName: 'anchor',
17189
17216
  baseClass: Anchor$1,
17190
- template: template$C,
17191
- styles: styles$V,
17217
+ template: template$D,
17218
+ styles: styles$X,
17192
17219
  shadowOptions: {
17193
17220
  delegatesFocus: true
17194
17221
  }
@@ -17291,7 +17318,7 @@
17291
17318
  padding: 0;
17292
17319
  `;
17293
17320
 
17294
- const styles$U = css `
17321
+ const styles$W = css `
17295
17322
  @layer base, hover, focusVisible, active, disabled, top;
17296
17323
 
17297
17324
  @layer base {
@@ -17568,8 +17595,8 @@
17568
17595
  }
17569
17596
  `));
17570
17597
 
17571
- const styles$T = css `
17572
- ${styles$U}
17598
+ const styles$V = css `
17599
+ ${styles$W}
17573
17600
  ${buttonAppearanceVariantStyles}
17574
17601
 
17575
17602
  .control {
@@ -17577,7 +17604,7 @@
17577
17604
  }
17578
17605
  `;
17579
17606
 
17580
- const template$B = (context, definition) => html `
17607
+ const template$C = (context, definition) => html `
17581
17608
  <a
17582
17609
  class="control"
17583
17610
  part="control"
@@ -17659,8 +17686,8 @@
17659
17686
  ], AnchorButton.prototype, "disabled", void 0);
17660
17687
  const nimbleAnchorButton = AnchorButton.compose({
17661
17688
  baseName: 'anchor-button',
17662
- template: template$B,
17663
- styles: styles$T,
17689
+ template: template$C,
17690
+ styles: styles$V,
17664
17691
  shadowOptions: {
17665
17692
  delegatesFocus: true
17666
17693
  }
@@ -17668,7 +17695,7 @@
17668
17695
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleAnchorButton());
17669
17696
  DesignSystem.tagFor(AnchorButton);
17670
17697
 
17671
- const styles$S = css `
17698
+ const styles$U = css `
17672
17699
  ${display('grid')}
17673
17700
 
17674
17701
  :host {
@@ -17745,7 +17772,7 @@
17745
17772
  }
17746
17773
  `;
17747
17774
 
17748
- const template$A = (context, definition) => html `
17775
+ const template$B = (context, definition) => html `
17749
17776
  <template
17750
17777
  role="menuitem"
17751
17778
  class="${x => (typeof x.startColumnCount === 'number'
@@ -17851,8 +17878,8 @@
17851
17878
  // FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
17852
17879
  const nimbleAnchorMenuItem = AnchorMenuItem.compose({
17853
17880
  baseName: 'anchor-menu-item',
17854
- template: template$A,
17855
- styles: styles$S,
17881
+ template: template$B,
17882
+ styles: styles$U,
17856
17883
  shadowOptions: {
17857
17884
  delegatesFocus: true
17858
17885
  }
@@ -17876,7 +17903,7 @@
17876
17903
  }
17877
17904
  });
17878
17905
 
17879
- const styles$R = css `
17906
+ const styles$T = css `
17880
17907
  ${display('inline-flex')}
17881
17908
 
17882
17909
  :host {
@@ -17992,7 +18019,7 @@
17992
18019
  }
17993
18020
  `;
17994
18021
 
17995
- const template$z = (context, definition) => html `
18022
+ const template$A = (context, definition) => html `
17996
18023
  <template slot="anchortab" role="tab" aria-disabled="${x => x.disabled}">
17997
18024
  <a
17998
18025
  download="${x => x.download}"
@@ -18044,8 +18071,8 @@
18044
18071
  // FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
18045
18072
  const nimbleAnchorTab = AnchorTab.compose({
18046
18073
  baseName: 'anchor-tab',
18047
- template: template$z,
18048
- styles: styles$R,
18074
+ template: template$A,
18075
+ styles: styles$T,
18049
18076
  shadowOptions: {
18050
18077
  delegatesFocus: true
18051
18078
  }
@@ -18053,7 +18080,7 @@
18053
18080
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleAnchorTab());
18054
18081
  DesignSystem.tagFor(AnchorTab);
18055
18082
 
18056
- const styles$Q = css `
18083
+ const styles$S = css `
18057
18084
  ${display('grid')}
18058
18085
 
18059
18086
  :host {
@@ -18075,7 +18102,7 @@
18075
18102
  }
18076
18103
  `;
18077
18104
 
18078
- const template$y = (context, definition) => html `
18105
+ const template$z = (context, definition) => html `
18079
18106
  ${startSlotTemplate(context, definition)}
18080
18107
  <div ${ref('tablist')} class="tablist" part="tablist" role="tablist">
18081
18108
  <slot name="anchortab" ${slotted('tabs')}></slot>
@@ -18281,8 +18308,8 @@
18281
18308
  applyMixins(AnchorTabs, StartEnd);
18282
18309
  const nimbleAnchorTabs = AnchorTabs.compose({
18283
18310
  baseName: 'anchor-tabs',
18284
- template: template$y,
18285
- styles: styles$Q,
18311
+ template: template$z,
18312
+ styles: styles$S,
18286
18313
  shadowOptions: {
18287
18314
  delegatesFocus: false
18288
18315
  }
@@ -18299,7 +18326,7 @@
18299
18326
  -webkit-user-select: none;
18300
18327
  `;
18301
18328
 
18302
- const styles$P = css `
18329
+ const styles$R = css `
18303
18330
  ${display('block')}
18304
18331
 
18305
18332
  :host {
@@ -18400,7 +18427,7 @@
18400
18427
  }
18401
18428
  `;
18402
18429
 
18403
- const template$x = (context, definition) => html `
18430
+ const template$y = (context, definition) => html `
18404
18431
  <template
18405
18432
  role="treeitem"
18406
18433
  slot="${x => (x.isNestedItem() ? 'item' : null)}"
@@ -18537,8 +18564,8 @@
18537
18564
  // FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
18538
18565
  const nimbleAnchorTreeItem = AnchorTreeItem.compose({
18539
18566
  baseName: 'anchor-tree-item',
18540
- template: template$x,
18541
- styles: styles$P,
18567
+ template: template$y,
18568
+ styles: styles$R,
18542
18569
  shadowOptions: {
18543
18570
  delegatesFocus: true
18544
18571
  }
@@ -18548,7 +18575,7 @@
18548
18575
  .register(nimbleAnchorTreeItem());
18549
18576
  DesignSystem.tagFor(AnchorTreeItem);
18550
18577
 
18551
- const styles$O = css `
18578
+ const styles$Q = css `
18552
18579
  :host {
18553
18580
  contain: layout;
18554
18581
  display: block;
@@ -18572,7 +18599,7 @@
18572
18599
  baseName: 'anchored-region',
18573
18600
  baseClass: AnchoredRegion$1,
18574
18601
  template: anchoredRegionTemplate,
18575
- styles: styles$O
18602
+ styles: styles$Q
18576
18603
  });
18577
18604
  DesignSystem.getOrCreate()
18578
18605
  .withPrefix('nimble')
@@ -18652,7 +18679,7 @@
18652
18679
  */
18653
18680
  const themeBehavior = (theme, styles) => new ThemeStyleSheetBehavior(theme, styles);
18654
18681
 
18655
- const styles$N = css `
18682
+ const styles$P = css `
18656
18683
  ${display('flex')}
18657
18684
 
18658
18685
  :host {
@@ -18795,8 +18822,8 @@
18795
18822
  }
18796
18823
  `));
18797
18824
 
18798
- const styles$M = css `
18799
- ${styles$U}
18825
+ const styles$O = css `
18826
+ ${styles$W}
18800
18827
  ${buttonAppearanceVariantStyles}
18801
18828
  `;
18802
18829
 
@@ -18842,7 +18869,7 @@
18842
18869
  baseName: 'button',
18843
18870
  baseClass: Button$1,
18844
18871
  template: buttonTemplate,
18845
- styles: styles$M,
18872
+ styles: styles$O,
18846
18873
  shadowOptions: {
18847
18874
  delegatesFocus: true
18848
18875
  }
@@ -19553,13 +19580,13 @@
19553
19580
  };
19554
19581
 
19555
19582
  // Avoiding any whitespace in the template because this is an inline element
19556
- const template$w = html `<div
19583
+ const template$x = html `<div
19557
19584
  class="icon"
19558
19585
  aria-hidden="true"
19559
19586
  :innerHTML=${x => x.icon.data}
19560
19587
  ></div>`;
19561
19588
 
19562
- const styles$L = css `
19589
+ const styles$N = css `
19563
19590
  ${display('inline-flex')}
19564
19591
 
19565
19592
  :host {
@@ -19612,8 +19639,8 @@
19612
19639
  const registerIcon = (baseName, iconClass) => {
19613
19640
  const composedIcon = iconClass.compose({
19614
19641
  baseName,
19615
- template: template$w,
19616
- styles: styles$L,
19642
+ template: template$x,
19643
+ styles: styles$N,
19617
19644
  baseClass: iconClass
19618
19645
  });
19619
19646
  DesignSystem.getOrCreate().withPrefix('nimble').register(composedIcon());
@@ -19717,7 +19744,7 @@
19717
19744
  }).withDefault(coreLabelDefaults.informationIconLabel);
19718
19745
 
19719
19746
  // prettier-ignore
19720
- const template$v = html `
19747
+ const template$w = html `
19721
19748
  <div class="container"
19722
19749
  role="status"
19723
19750
  aria-atomic="${x => x.ariaAtomic}"
@@ -19833,13 +19860,13 @@
19833
19860
  applyMixins(Banner, ARIAGlobalStatesAndProperties);
19834
19861
  const nimbleBanner = Banner.compose({
19835
19862
  baseName: 'banner',
19836
- template: template$v,
19837
- styles: styles$N
19863
+ template: template$w,
19864
+ styles: styles$P
19838
19865
  });
19839
19866
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleBanner());
19840
19867
  DesignSystem.tagFor(Banner);
19841
19868
 
19842
- const styles$K = css `
19869
+ const styles$M = css `
19843
19870
  ${display('inline-block')}
19844
19871
 
19845
19872
  :host {
@@ -19880,12 +19907,12 @@
19880
19907
  baseName: 'breadcrumb',
19881
19908
  baseClass: Breadcrumb$1,
19882
19909
  template: breadcrumbTemplate,
19883
- styles: styles$K
19910
+ styles: styles$M
19884
19911
  });
19885
19912
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleBreadcrumb());
19886
19913
  DesignSystem.tagFor(Breadcrumb);
19887
19914
 
19888
- const styles$J = css `
19915
+ const styles$L = css `
19889
19916
  ${display('inline-flex')}
19890
19917
 
19891
19918
  :host {
@@ -19959,7 +19986,7 @@
19959
19986
  baseName: 'breadcrumb-item',
19960
19987
  baseClass: BreadcrumbItem$1,
19961
19988
  template: breadcrumbItemTemplate,
19962
- styles: styles$J,
19989
+ styles: styles$L,
19963
19990
  separator: forwardSlash16X16.data
19964
19991
  });
19965
19992
  DesignSystem.getOrCreate()
@@ -19967,7 +19994,7 @@
19967
19994
  .register(nimbleBreadcrumbItem());
19968
19995
  DesignSystem.tagFor(BreadcrumbItem);
19969
19996
 
19970
- const styles$I = css `
19997
+ const styles$K = css `
19971
19998
  ${display('flex')}
19972
19999
 
19973
20000
  :host {
@@ -19991,7 +20018,7 @@
19991
20018
  }
19992
20019
  `;
19993
20020
 
19994
- const template$u = html `
20021
+ const template$v = html `
19995
20022
  ${'' /* Explicitly set role to work around Lighthouse error. See https://github.com/ni/nimble/issues/1650. */}
19996
20023
  <section role="region" aria-labelledby="title-slot">
19997
20024
  <slot name="title" id="title-slot"></slot>
@@ -20007,13 +20034,13 @@
20007
20034
  const nimbleCard = Card.compose({
20008
20035
  baseName: 'card',
20009
20036
  baseClass: Card$1,
20010
- template: template$u,
20011
- styles: styles$I
20037
+ template: template$v,
20038
+ styles: styles$K
20012
20039
  });
20013
20040
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleCard());
20014
20041
  DesignSystem.tagFor(Card);
20015
20042
 
20016
- const styles$H = css `
20043
+ const styles$J = css `
20017
20044
  ${display('inline-flex')}
20018
20045
 
20019
20046
  :host {
@@ -20172,7 +20199,7 @@
20172
20199
  const nimbleCardButton = CardButton.compose({
20173
20200
  baseName: 'card-button',
20174
20201
  template: buttonTemplate,
20175
- styles: styles$H,
20202
+ styles: styles$J,
20176
20203
  shadowOptions: {
20177
20204
  delegatesFocus: true
20178
20205
  }
@@ -20180,7 +20207,7 @@
20180
20207
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleCardButton());
20181
20208
  DesignSystem.tagFor(CardButton);
20182
20209
 
20183
- const styles$G = css `
20210
+ const styles$I = css `
20184
20211
  ${display('inline-flex')}
20185
20212
 
20186
20213
  :host {
@@ -20298,15 +20325,15 @@
20298
20325
  baseName: 'checkbox',
20299
20326
  baseClass: Checkbox$1,
20300
20327
  template: checkboxTemplate,
20301
- styles: styles$G,
20328
+ styles: styles$I,
20302
20329
  checkedIndicator: check16X16.data,
20303
20330
  indeterminateIndicator: minus16X16.data
20304
20331
  });
20305
20332
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleCheckbox());
20306
20333
  const checkboxTag = DesignSystem.tagFor(Checkbox);
20307
20334
 
20308
- const styles$F = css `
20309
- ${styles$U}
20335
+ const styles$H = css `
20336
+ ${styles$W}
20310
20337
 
20311
20338
  @layer base {
20312
20339
  .control[aria-pressed='true'] {
@@ -20385,7 +20412,7 @@
20385
20412
  }
20386
20413
  `;
20387
20414
 
20388
- const template$t = (context, definition) => html `
20415
+ const template$u = (context, definition) => html `
20389
20416
  <div
20390
20417
  role="button"
20391
20418
  part="control"
@@ -20460,8 +20487,8 @@
20460
20487
  applyMixins(ToggleButton, StartEnd, DelegatesARIAButton);
20461
20488
  const nimbleToggleButton = ToggleButton.compose({
20462
20489
  baseName: 'toggle-button',
20463
- template: template$t,
20464
- styles: styles$F,
20490
+ template: template$u,
20491
+ styles: styles$H,
20465
20492
  shadowOptions: {
20466
20493
  delegatesFocus: true
20467
20494
  }
@@ -20498,7 +20525,7 @@
20498
20525
  block: 'block'
20499
20526
  };
20500
20527
 
20501
- const styles$E = css `
20528
+ const styles$G = css `
20502
20529
  ${display('inline-flex')}
20503
20530
 
20504
20531
  :host {
@@ -20724,7 +20751,7 @@
20724
20751
  }
20725
20752
  `));
20726
20753
 
20727
- const styles$D = css `
20754
+ const styles$F = css `
20728
20755
  .error-icon {
20729
20756
  display: none;
20730
20757
  }
@@ -20758,9 +20785,9 @@
20758
20785
  }
20759
20786
  `;
20760
20787
 
20761
- const styles$C = css `
20762
- ${styles$E}
20763
- ${styles$D}
20788
+ const styles$E = css `
20789
+ ${styles$G}
20790
+ ${styles$F}
20764
20791
 
20765
20792
  :host {
20766
20793
  --ni-private-hover-bottom-border-width: 2px;
@@ -20896,7 +20923,7 @@
20896
20923
  }
20897
20924
 
20898
20925
  // prettier-ignore
20899
- const template$s = (context, definition) => html `
20926
+ const template$t = (context, definition) => html `
20900
20927
  <template
20901
20928
  aria-disabled="${x => x.ariaDisabled}"
20902
20929
  autocomplete="${x => x.autocomplete}"
@@ -20959,7 +20986,7 @@
20959
20986
  >
20960
20987
  <slot
20961
20988
  ${slotted({
20962
- filter: (n) => n instanceof HTMLElement && Listbox.slottedOptionFilter(n),
20989
+ filter: (n) => n instanceof HTMLElement && Listbox$1.slottedOptionFilter(n),
20963
20990
  flatten: true,
20964
20991
  property: 'slottedOptions',
20965
20992
  })}
@@ -21174,8 +21201,8 @@
21174
21201
  const nimbleCombobox = Combobox.compose({
21175
21202
  baseName: 'combobox',
21176
21203
  baseClass: Combobox$1,
21177
- template: template$s,
21178
- styles: styles$C,
21204
+ template: template$t,
21205
+ styles: styles$E,
21179
21206
  shadowOptions: {
21180
21207
  delegatesFocus: true
21181
21208
  },
@@ -21220,7 +21247,7 @@
21220
21247
  */
21221
21248
  const UserDismissed = Symbol('user dismissed');
21222
21249
 
21223
- const styles$B = css `
21250
+ const styles$D = css `
21224
21251
  ${display('grid')}
21225
21252
 
21226
21253
  dialog {
@@ -21322,7 +21349,7 @@
21322
21349
  }
21323
21350
  `));
21324
21351
 
21325
- const template$r = html `
21352
+ const template$s = html `
21326
21353
  <template>
21327
21354
  <dialog
21328
21355
  ${ref('dialogElement')}
@@ -21449,14 +21476,14 @@
21449
21476
  applyMixins(Dialog, ARIAGlobalStatesAndProperties);
21450
21477
  const nimbleDialog = Dialog.compose({
21451
21478
  baseName: 'dialog',
21452
- template: template$r,
21453
- styles: styles$B,
21479
+ template: template$s,
21480
+ styles: styles$D,
21454
21481
  baseClass: Dialog
21455
21482
  });
21456
21483
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDialog());
21457
21484
  DesignSystem.tagFor(Dialog);
21458
21485
 
21459
- const styles$A = css `
21486
+ const styles$C = css `
21460
21487
  ${display('block')}
21461
21488
 
21462
21489
  :host {
@@ -21609,7 +21636,7 @@
21609
21636
  }
21610
21637
  `));
21611
21638
 
21612
- const template$q = html `
21639
+ const template$r = html `
21613
21640
  <dialog
21614
21641
  ${ref('dialog')}
21615
21642
  aria-label="${x => x.ariaLabel}"
@@ -21723,8 +21750,8 @@
21723
21750
  applyMixins(Drawer, ARIAGlobalStatesAndProperties);
21724
21751
  const nimbleDrawer = Drawer.compose({
21725
21752
  baseName: 'drawer',
21726
- template: template$q,
21727
- styles: styles$A
21753
+ template: template$r,
21754
+ styles: styles$C
21728
21755
  });
21729
21756
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDrawer());
21730
21757
  DesignSystem.tagFor(Drawer);
@@ -24174,7 +24201,7 @@
24174
24201
  .register(nimbleLabelProviderTable());
24175
24202
  DesignSystem.tagFor(LabelProviderTable);
24176
24203
 
24177
- const styles$z = css `
24204
+ const styles$B = css `
24178
24205
  ${display('flex')}
24179
24206
 
24180
24207
  :host {
@@ -24247,7 +24274,7 @@
24247
24274
  * @public
24248
24275
  */
24249
24276
  // prettier-ignore
24250
- const template$p = (context, definition) => html `
24277
+ const template$q = (context, definition) => html `
24251
24278
  <template
24252
24279
  aria-checked="${x => x.ariaChecked}"
24253
24280
  aria-disabled="${x => x.ariaDisabled}"
@@ -24295,11 +24322,11 @@
24295
24322
  const nimbleListOption = ListOption.compose({
24296
24323
  baseName: 'list-option',
24297
24324
  baseClass: ListboxOption,
24298
- template: template$p,
24299
- styles: styles$z
24325
+ template: template$q,
24326
+ styles: styles$B
24300
24327
  });
24301
24328
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleListOption());
24302
- DesignSystem.tagFor(ListOption);
24329
+ const listOptionTag = DesignSystem.tagFor(ListOption);
24303
24330
 
24304
24331
  /**
24305
24332
  * Base class for mapping configuration elements
@@ -24310,7 +24337,7 @@
24310
24337
  attr()
24311
24338
  ], Mapping$1.prototype, "key", void 0);
24312
24339
 
24313
- const template$o = html `<template slot="mapping"></template>`;
24340
+ const template$p = html `<template slot="mapping"></template>`;
24314
24341
 
24315
24342
  /**
24316
24343
  * Defines a mapping from one data value ('key' property) to display text ('text' property).
@@ -24324,7 +24351,7 @@
24324
24351
  ], MappingText.prototype, "text", void 0);
24325
24352
  const textMapping = MappingText.compose({
24326
24353
  baseName: 'mapping-text',
24327
- template: template$o
24354
+ template: template$p
24328
24355
  });
24329
24356
  DesignSystem.getOrCreate().withPrefix('nimble').register(textMapping());
24330
24357
  DesignSystem.tagFor(MappingText);
@@ -24388,7 +24415,7 @@
24388
24415
  ], MappingIcon.prototype, "resolvedIcon", void 0);
24389
24416
  const iconMapping = MappingIcon.compose({
24390
24417
  baseName: 'mapping-icon',
24391
- template: template$o
24418
+ template: template$p
24392
24419
  });
24393
24420
  DesignSystem.getOrCreate().withPrefix('nimble').register(iconMapping());
24394
24421
  DesignSystem.tagFor(MappingIcon);
@@ -24405,12 +24432,12 @@
24405
24432
  ], MappingSpinner.prototype, "text", void 0);
24406
24433
  const spinnerMapping = MappingSpinner.compose({
24407
24434
  baseName: 'mapping-spinner',
24408
- template: template$o
24435
+ template: template$p
24409
24436
  });
24410
24437
  DesignSystem.getOrCreate().withPrefix('nimble').register(spinnerMapping());
24411
24438
  DesignSystem.tagFor(MappingSpinner);
24412
24439
 
24413
- const styles$y = css `
24440
+ const styles$A = css `
24414
24441
  ${display('grid')}
24415
24442
 
24416
24443
  :host {
@@ -24477,12 +24504,12 @@
24477
24504
  baseName: 'menu',
24478
24505
  baseClass: Menu$1,
24479
24506
  template: menuTemplate,
24480
- styles: styles$y
24507
+ styles: styles$A
24481
24508
  });
24482
24509
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleMenu());
24483
24510
  DesignSystem.tagFor(Menu);
24484
24511
 
24485
- const styles$x = css `
24512
+ const styles$z = css `
24486
24513
  ${display('inline-block')}
24487
24514
 
24488
24515
  :host {
@@ -24501,7 +24528,7 @@
24501
24528
  `;
24502
24529
 
24503
24530
  // prettier-ignore
24504
- const template$n = html `
24531
+ const template$o = html `
24505
24532
  <template
24506
24533
  ?open="${x => x.open}"
24507
24534
  @focusout="${(x, c) => x.focusoutHandler(c.event)}"
@@ -24756,8 +24783,8 @@
24756
24783
  ], MenuButton.prototype, "slottedMenus", void 0);
24757
24784
  const nimbleMenuButton = MenuButton.compose({
24758
24785
  baseName: 'menu-button',
24759
- template: template$n,
24760
- styles: styles$x,
24786
+ template: template$o,
24787
+ styles: styles$z,
24761
24788
  shadowOptions: {
24762
24789
  delegatesFocus: true
24763
24790
  }
@@ -24765,7 +24792,7 @@
24765
24792
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleMenuButton());
24766
24793
  const menuButtonTag = DesignSystem.tagFor(MenuButton);
24767
24794
 
24768
- const styles$w = css `
24795
+ const styles$y = css `
24769
24796
  ${display('grid')}
24770
24797
 
24771
24798
  :host {
@@ -24863,7 +24890,7 @@
24863
24890
  baseName: 'menu-item',
24864
24891
  baseClass: MenuItem$1,
24865
24892
  template: menuItemTemplate,
24866
- styles: styles$w,
24893
+ styles: styles$y,
24867
24894
  expandCollapseGlyph: arrowExpanderRight16X16.data
24868
24895
  });
24869
24896
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleMenuItem());
@@ -24878,9 +24905,9 @@
24878
24905
  block: 'block'
24879
24906
  };
24880
24907
 
24881
- const styles$v = css `
24908
+ const styles$x = css `
24882
24909
  ${display('inline-block')}
24883
- ${styles$D}
24910
+ ${styles$F}
24884
24911
 
24885
24912
  :host {
24886
24913
  font: ${bodyFont};
@@ -25094,7 +25121,7 @@
25094
25121
  baseName: 'number-field',
25095
25122
  baseClass: NumberField$1,
25096
25123
  template: numberFieldTemplate,
25097
- styles: styles$v,
25124
+ styles: styles$x,
25098
25125
  shadowOptions: {
25099
25126
  delegatesFocus: true
25100
25127
  },
@@ -25138,7 +25165,7 @@
25138
25165
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleNumberField());
25139
25166
  DesignSystem.tagFor(NumberField);
25140
25167
 
25141
- const styles$u = css `
25168
+ const styles$w = css `
25142
25169
  ${display('inline-flex')}
25143
25170
 
25144
25171
  :host {
@@ -25239,13 +25266,13 @@
25239
25266
  baseName: 'radio',
25240
25267
  baseClass: Radio$1,
25241
25268
  template: radioTemplate,
25242
- styles: styles$u,
25269
+ styles: styles$w,
25243
25270
  checkedIndicator: circleFilled16X16.data
25244
25271
  });
25245
25272
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleRadio());
25246
25273
  DesignSystem.tagFor(Radio);
25247
25274
 
25248
- const styles$t = css `
25275
+ const styles$v = css `
25249
25276
  ${display('inline-block')}
25250
25277
 
25251
25278
  .positioning-region {
@@ -25280,7 +25307,7 @@
25280
25307
  baseName: 'radio-group',
25281
25308
  baseClass: RadioGroup$1,
25282
25309
  template: radioGroupTemplate,
25283
- styles: styles$t,
25310
+ styles: styles$v,
25284
25311
  shadowOptions: {
25285
25312
  delegatesFocus: true
25286
25313
  }
@@ -42132,7 +42159,67 @@ img.ProseMirror-separator {
42132
42159
  return string.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
42133
42160
  }
42134
42161
 
42135
- const styles$s = css `
42162
+ const HardBreak = Node$1.create({
42163
+ name: 'hardBreak',
42164
+ addOptions() {
42165
+ return {
42166
+ keepMarks: true,
42167
+ HTMLAttributes: {},
42168
+ };
42169
+ },
42170
+ inline: true,
42171
+ group: 'inline',
42172
+ selectable: false,
42173
+ parseHTML() {
42174
+ return [
42175
+ { tag: 'br' },
42176
+ ];
42177
+ },
42178
+ renderHTML({ HTMLAttributes }) {
42179
+ return ['br', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
42180
+ },
42181
+ renderText() {
42182
+ return '\n';
42183
+ },
42184
+ addCommands() {
42185
+ return {
42186
+ setHardBreak: () => ({ commands, chain, state, editor, }) => {
42187
+ return commands.first([
42188
+ () => commands.exitCode(),
42189
+ () => commands.command(() => {
42190
+ const { selection, storedMarks } = state;
42191
+ if (selection.$from.parent.type.spec.isolating) {
42192
+ return false;
42193
+ }
42194
+ const { keepMarks } = this.options;
42195
+ const { splittableMarks } = editor.extensionManager;
42196
+ const marks = storedMarks
42197
+ || (selection.$to.parentOffset && selection.$from.marks());
42198
+ return chain()
42199
+ .insertContent({ type: this.name })
42200
+ .command(({ tr, dispatch }) => {
42201
+ if (dispatch && marks && keepMarks) {
42202
+ const filteredMarks = marks
42203
+ .filter(mark => splittableMarks.includes(mark.type.name));
42204
+ tr.ensureMarks(filteredMarks);
42205
+ }
42206
+ return true;
42207
+ })
42208
+ .run();
42209
+ }),
42210
+ ]);
42211
+ },
42212
+ };
42213
+ },
42214
+ addKeyboardShortcuts() {
42215
+ return {
42216
+ 'Mod-Enter': () => this.editor.commands.setHardBreak(),
42217
+ 'Shift-Enter': () => this.editor.commands.setHardBreak(),
42218
+ };
42219
+ },
42220
+ });
42221
+
42222
+ const styles$u = css `
42136
42223
  .positioning-region {
42137
42224
  display: flex;
42138
42225
  padding: ${smallPadding} ${standardPadding};
@@ -42167,7 +42254,7 @@ img.ProseMirror-separator {
42167
42254
  baseName: 'toolbar',
42168
42255
  baseClass: Toolbar$1,
42169
42256
  template: toolbarTemplate,
42170
- styles: styles$s,
42257
+ styles: styles$u,
42171
42258
  shadowOptions: {
42172
42259
  delegatesFocus: true
42173
42260
  }
@@ -42199,9 +42286,337 @@ img.ProseMirror-separator {
42199
42286
  cssCustomPropertyName: null
42200
42287
  }).withDefault(richTextLabelDefaults.richTextToggleNumberedListLabel);
42201
42288
 
42289
+ const styles$t = css `
42290
+ ${styles$G}
42291
+
42292
+ :host {
42293
+ height: auto;
42294
+ }
42295
+
42296
+ :host(:hover)::after,
42297
+ :host(${focusVisible})::after {
42298
+ width: auto;
42299
+ }
42300
+
42301
+ .listbox {
42302
+ min-width: ${menuMinWidth};
42303
+ max-height: calc(5.5 * ${controlHeight});
42304
+ }
42305
+ `;
42306
+
42307
+ const styles$s = css `
42308
+ ${display('inline-flex')}
42309
+
42310
+ :host {
42311
+ background: ${applicationBackgroundColor};
42312
+ border: ${borderWidth} solid ${popupBorderColor};
42313
+ flex-direction: column;
42314
+ margin: 0;
42315
+ min-width: ${menuMinWidth};
42316
+ box-shadow: ${elevation2BoxShadow};
42317
+ color: ${bodyFontColor};
42318
+ font: ${bodyFont};
42319
+ }
42320
+
42321
+ :host(:focus) {
42322
+ outline: 0px;
42323
+ }
42324
+
42325
+ slot {
42326
+ padding: ${smallPadding};
42327
+ display: block;
42328
+ }
42329
+ `;
42330
+
42331
+ /**
42332
+ * A nimble-styled HTML list box
42333
+ */
42334
+ class Listbox extends ListboxElement {
42335
+ }
42336
+ const nimbleListbox = Listbox.compose({
42337
+ baseName: 'listbox',
42338
+ template: listboxTemplate,
42339
+ styles: styles$s
42340
+ });
42341
+ DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleListbox());
42342
+ DesignSystem.tagFor(Listbox);
42343
+
42344
+ // prettier-ignore
42345
+ const template$n = html `
42346
+ <template>
42347
+ <${anchoredRegionTag}
42348
+ ${ref('region')}
42349
+ class="anchored-region"
42350
+ fixed-placement
42351
+ auto-update-mode="auto"
42352
+ vertical-default-position="bottom"
42353
+ vertical-positioning-mode="locktodefault"
42354
+ horizontal-default-position="center"
42355
+ horizontal-positioning-mode="locktodefault"
42356
+ horizontal-scaling="anchor"
42357
+ ?hidden="${x => !x.open}">
42358
+ <div
42359
+ class="listbox"
42360
+ part="listbox"
42361
+ role="listbox"
42362
+ @click="${(x, c) => x.clickHandler(c.event)}"
42363
+ ?disabled="${x => x.disabled}"
42364
+ >
42365
+ <slot
42366
+ ${slotted({ filter: (n) => n instanceof HTMLElement && Listbox.slottedOptionFilter(n), flatten: true, property: 'slottedOptions' })}
42367
+ >
42368
+ </slot>
42369
+ </div>
42370
+ </${anchoredRegionTag}>
42371
+ </template>
42372
+ `;
42373
+
42374
+ /**
42375
+ * Generic normalize method that removes the accents and special characters.
42376
+ * This method can be used to normalize the string before performing diacritic-insensitive string comparisons
42377
+ */
42378
+ const diacriticInsensitiveStringNormalizer = (value) => {
42379
+ // This implementation is based on the below reference.
42380
+ // https://claritydev.net/blog/diacritic-insensitive-string-comparison-javascript
42381
+ return value
42382
+ .normalize('NFD')
42383
+ .replace(/[\u0300-\u036f]/g, '')
42384
+ .toLowerCase();
42385
+ };
42386
+
42387
+ /**
42388
+ * A rich text mention listbox which acts as a popup for "@mention" support in editor
42389
+ */
42390
+ class RichTextMentionListbox extends ListboxElement {
42391
+ constructor() {
42392
+ super(...arguments);
42393
+ /**
42394
+ * @internal
42395
+ */
42396
+ this.filter = '';
42397
+ /**
42398
+ * The collection of currently filtered options.
42399
+ * The approach is defined based on the `Combobox.filteredOptions` implementation.
42400
+ *
42401
+ * @internal
42402
+ */
42403
+ this.filteredOptions = [];
42404
+ this.anchorElementIntersectionObserver = new IntersectionObserver(entries => {
42405
+ if (!entries[0]?.isIntersecting) {
42406
+ this.setOpen(false);
42407
+ }
42408
+ }, { threshold: 1.0, root: document });
42409
+ }
42410
+ /**
42411
+ * @public
42412
+ */
42413
+ close() {
42414
+ this.setOpen(false);
42415
+ }
42416
+ /**
42417
+ * The list of options.
42418
+ *
42419
+ * @public
42420
+ * @remarks
42421
+ * Overrides `Listbox.options`.
42422
+ */
42423
+ get options() {
42424
+ Observable.track(this, 'options');
42425
+ return this.filteredOptions?.length ? this.filteredOptions : [];
42426
+ }
42427
+ set options(value) {
42428
+ this._options = value;
42429
+ Observable.notify(this, 'options');
42430
+ }
42431
+ /**
42432
+ * Triggers when the mention plugin is activated upon pressing the `key`
42433
+ *
42434
+ * @public
42435
+ */
42436
+ show(options) {
42437
+ this.filter = options.filter;
42438
+ this.anchorElement = options.anchorNode;
42439
+ this.setOpen(true);
42440
+ this.filterOptions();
42441
+ }
42442
+ /**
42443
+ * Handle keydown actions for listbox navigation and selection.
42444
+ *
42445
+ * @param e - the keyboard event
42446
+ * @public
42447
+ */
42448
+ keydownHandler(event) {
42449
+ if (!this.open) {
42450
+ return false;
42451
+ }
42452
+ switch (event.key) {
42453
+ case keyTab:
42454
+ case keyEnter: {
42455
+ if (!this.hasSelectableOptions) {
42456
+ return false;
42457
+ }
42458
+ const mentionDetail = {
42459
+ href: this.firstSelectedOption.value,
42460
+ displayName: this.firstSelectedOption.text
42461
+ };
42462
+ this.emitMentionSelected(mentionDetail);
42463
+ return true;
42464
+ }
42465
+ case keyEscape: {
42466
+ this.setOpen(false);
42467
+ return false;
42468
+ }
42469
+ default: {
42470
+ super.keydownHandler(event);
42471
+ return false;
42472
+ }
42473
+ }
42474
+ }
42475
+ /**
42476
+ * Filter available options by filter value.
42477
+ * The method is defined based on the `Combobox.filterOptions` and `Combobox.inputHandler` implementation.
42478
+ *
42479
+ * @internal
42480
+ */
42481
+ filterOptions() {
42482
+ if (!this.filter) {
42483
+ this.filteredOptions = this._options;
42484
+ }
42485
+ else {
42486
+ const normalizedFilter = diacriticInsensitiveStringNormalizer(this.filter);
42487
+ this.filteredOptions = this._options.filter(o => diacriticInsensitiveStringNormalizer(o.text).includes(normalizedFilter));
42488
+ }
42489
+ this._options.forEach(o => {
42490
+ o.hidden = !this.filteredOptions.includes(o);
42491
+ });
42492
+ if (this.filteredOptions.length) {
42493
+ this.selectedOptions = [this.filteredOptions[0]];
42494
+ this.selectedIndex = this.options.indexOf(this.firstSelectedOption);
42495
+ }
42496
+ else {
42497
+ this.selectedOptions = [];
42498
+ this.selectedIndex = -1;
42499
+ }
42500
+ }
42501
+ /**
42502
+ * Synchronize the form-associated proxy and update the value property of the element.
42503
+ *
42504
+ * @param prev - the previous collection of slotted option elements
42505
+ * @param next - the next collection of slotted option elements
42506
+ *
42507
+ * @internal
42508
+ */
42509
+ slottedOptionsChanged(prev, next) {
42510
+ super.slottedOptionsChanged(prev, next);
42511
+ this.filterOptions();
42512
+ }
42513
+ /**
42514
+ * Triggers the `suggestionProps` command to notify the tiptap editor to select the option.
42515
+ * The method is defined based on the `Listbox.clickHandler` implementation.
42516
+ *
42517
+ * @internal
42518
+ */
42519
+ clickHandler(e) {
42520
+ const capturedElement = e.target.closest('option,[role=option]');
42521
+ const capturedListOption = capturedElement;
42522
+ if (!capturedListOption || capturedListOption.disabled) {
42523
+ return false;
42524
+ }
42525
+ const mentionDetail = {
42526
+ href: capturedListOption.value,
42527
+ displayName: capturedListOption.text
42528
+ };
42529
+ this.emitMentionSelected(mentionDetail);
42530
+ return true;
42531
+ }
42532
+ /**
42533
+ * Observes the anchor element using intersection observer.
42534
+ * Once the anchor element intersects, the anchor region will be closed.
42535
+ *
42536
+ * @internal
42537
+ */
42538
+ anchorElementChanged(prev, next) {
42539
+ if (prev) {
42540
+ this.anchorElementIntersectionObserver.unobserve(prev);
42541
+ }
42542
+ if (this.region && this.anchorElement) {
42543
+ this.region.anchorElement = this.anchorElement;
42544
+ this.region.update();
42545
+ this.anchorElementIntersectionObserver.observe(next);
42546
+ }
42547
+ }
42548
+ /**
42549
+ * Observes the anchor region.
42550
+ *
42551
+ * @internal
42552
+ */
42553
+ regionChanged() {
42554
+ if (this.regionNotifier) {
42555
+ this.regionNotifier.unsubscribe(this);
42556
+ }
42557
+ this.regionNotifier = Observable.getNotifier(this.region);
42558
+ this.regionNotifier.subscribe(this);
42559
+ }
42560
+ /**
42561
+ * Handles the events of the anchored region.
42562
+ * Repositions the listbox scroll bar when the `initialLayoutComplete` event is triggered.
42563
+ * Other events will be passed to the base class.
42564
+ *
42565
+ * @internal
42566
+ */
42567
+ handleChange(source, args) {
42568
+ super.handleChange(source, args);
42569
+ if (args === 'initialLayoutComplete') {
42570
+ this.focusAndScrollOptionIntoView();
42571
+ }
42572
+ }
42573
+ /**
42574
+ * Focus the control and scroll the first selected option into view.
42575
+ *
42576
+ * @internal
42577
+ * @remarks
42578
+ * Overrides: `Listbox.focusAndScrollOptionIntoView`
42579
+ */
42580
+ focusAndScrollOptionIntoView() {
42581
+ if (this.firstSelectedOption) {
42582
+ requestAnimationFrame(() => {
42583
+ this.firstSelectedOption?.scrollIntoView({ block: 'nearest' });
42584
+ });
42585
+ }
42586
+ }
42587
+ emitMentionSelected(mentionDetail) {
42588
+ this.$emit('mention-selected', mentionDetail);
42589
+ this.setOpen(false);
42590
+ }
42591
+ setOpen(value) {
42592
+ this.open = value;
42593
+ }
42594
+ }
42595
+ __decorate$1([
42596
+ observable
42597
+ ], RichTextMentionListbox.prototype, "open", void 0);
42598
+ __decorate$1([
42599
+ observable
42600
+ ], RichTextMentionListbox.prototype, "region", void 0);
42601
+ __decorate$1([
42602
+ observable
42603
+ ], RichTextMentionListbox.prototype, "anchorElement", void 0);
42604
+ const nimbleRichTextMentionListbox = RichTextMentionListbox.compose({
42605
+ baseName: 'rich-text-mention-listbox',
42606
+ template: template$n,
42607
+ styles: styles$t
42608
+ });
42609
+ DesignSystem.getOrCreate()
42610
+ .withPrefix('nimble')
42611
+ .register(nimbleRichTextMentionListbox());
42612
+ const richTextMentionListboxTag = DesignSystem.tagFor(RichTextMentionListbox);
42613
+
42202
42614
  // prettier-ignore
42203
42615
  const template$m = html `
42204
- <template ${children$1({ property: 'childItems', filter: elements() })}>
42616
+ <template
42617
+ ${children$1({ property: 'childItems', filter: elements() })}
42618
+ @focusout="${x => x.focusoutHandler()}"
42619
+ >
42205
42620
  <div class="container">
42206
42621
  <section ${ref('editorContainer')} class="editor-container">
42207
42622
  </section>
@@ -42268,6 +42683,19 @@ img.ProseMirror-separator {
42268
42683
  ${x => richTextToggleNumberedListLabel.getValueFor(x)}
42269
42684
  <${iconNumberListTag} slot="start"></${iconNumberListTag}>
42270
42685
  </${toggleButtonTag}>
42686
+ ${repeat(x => x.getMentionExtensionConfig(), html `
42687
+ <${buttonTag}
42688
+ appearance="ghost"
42689
+ content-hidden
42690
+ ?disabled="${(_x, c) => c.parent.disabled}"
42691
+ slot="start"
42692
+ title=${x => x.buttonLabel}
42693
+ @click=${(x, c) => c.parent.mentionButtonClick(x.character)}
42694
+ >
42695
+ ${x => x.buttonLabel}
42696
+ ${x => x.iconTemplate}
42697
+ </${buttonTag}>
42698
+ `)}
42271
42699
  </${toolbarTag}>
42272
42700
  <span class="footer-actions" part="footer-actions">
42273
42701
  <slot name="footer-actions"></slot>
@@ -42275,6 +42703,14 @@ img.ProseMirror-separator {
42275
42703
  </section>
42276
42704
  ${errorTextTemplate}
42277
42705
  </div>
42706
+ <${richTextMentionListboxTag}
42707
+ ${ref('mentionListbox')}
42708
+ @mention-selected=${(x, c) => x.onMentionSelect(c.event)}
42709
+ >
42710
+ ${repeat(x => Array.from(x.activeMappingConfigs?.values() ?? []), html `
42711
+ <${listOptionTag} value="${x => x.mentionHref}">${x => x.displayName}</${listOptionTag}>
42712
+ `, { recycle: false })}
42713
+ </${richTextMentionListboxTag}>
42278
42714
  </template>
42279
42715
  `;
42280
42716
 
@@ -42318,7 +42754,7 @@ img.ProseMirror-separator {
42318
42754
  box-sizing: border-box;
42319
42755
  font: ${bodyFont};
42320
42756
  color: ${bodyFontColor};
42321
- white-space: normal;
42757
+ white-space: pre-wrap;
42322
42758
  }
42323
42759
 
42324
42760
  .control {
@@ -42339,6 +42775,10 @@ img.ProseMirror-separator {
42339
42775
  color: ${bodyDisabledFontColor};
42340
42776
  }
42341
42777
 
42778
+ :host([disable-editing]) {
42779
+ font: ${mentionFont};
42780
+ }
42781
+
42342
42782
  :host([disable-editing]) slot {
42343
42783
  display: none;
42344
42784
  }
@@ -42361,7 +42801,7 @@ img.ProseMirror-separator {
42361
42801
 
42362
42802
  const styles$q = css `
42363
42803
  ${display('inline-flex')}
42364
- ${styles$D}
42804
+ ${styles$F}
42365
42805
 
42366
42806
  :host {
42367
42807
  font: ${bodyFont};
@@ -55872,7 +56312,11 @@ img.ProseMirror-separator {
55872
56312
  link: {
55873
56313
  attrs: {
55874
56314
  href: {},
55875
- rel: { default: 'noopener noreferrer' }
56315
+ rel: { default: 'noopener noreferrer' },
56316
+ // Adding `class` here is a workaround to render two mentions without a whitespace as display names
56317
+ // This attribute can be removed when the below issue is resolved
56318
+ // https://github.com/ni/nimble/issues/1707
56319
+ class: { default: '' }
55876
56320
  },
55877
56321
  // Inclusive can be updated when hyperlink support added
55878
56322
  // See: https://github.com/ni/nimble/issues/1527
@@ -55906,7 +56350,11 @@ img.ProseMirror-separator {
55906
56350
  * With this, the user can click the links only when the scheme is HTTP/HTTPS
55907
56351
  */
55908
56352
  href: /^https?:\/\//i.test(href) ? href : null,
55909
- rel: node.attrs.rel
56353
+ rel: node.attrs.rel,
56354
+ // Adding `class` here is a workaround to render two mentions without a whitespace as display names
56355
+ // This attribute can be removed when the below issue is resolved
56356
+ // https://github.com/ni/nimble/issues/1707
56357
+ class: href
55910
56358
  }
55911
56359
  ];
55912
56360
  }
@@ -56021,7 +56469,7 @@ img.ProseMirror-separator {
56021
56469
  * Whether this mention has a valid configuration.
56022
56470
  */
56023
56471
  this.validConfiguration = true;
56024
- this.icon = options.icon;
56472
+ this.iconTemplate = html `<${options.icon} slot="start"></${options.icon}>`;
56025
56473
  this.character = options.character;
56026
56474
  this.viewElement = options.viewElement;
56027
56475
  this.mentionUpdateEmitter = mentionUpdateEmitter;
@@ -56036,6 +56484,9 @@ img.ProseMirror-separator {
56036
56484
  __decorate$1([
56037
56485
  observable
56038
56486
  ], MentionInternals.prototype, "pattern", void 0);
56487
+ __decorate$1([
56488
+ observable
56489
+ ], MentionInternals.prototype, "buttonLabel", void 0);
56039
56490
 
56040
56491
  /**
56041
56492
  * The base class for Mention configuration
@@ -56081,7 +56532,9 @@ img.ProseMirror-separator {
56081
56532
  * @internal
56082
56533
  */
56083
56534
  handleChange(source, args) {
56084
- if (source instanceof Mapping$1 && typeof args === 'string') {
56535
+ if (source instanceof Mapping$1
56536
+ && typeof args === 'string'
56537
+ && this.getObservedMappingProperty().includes(args)) {
56085
56538
  this.updateMappingConfigs();
56086
56539
  }
56087
56540
  }
@@ -56111,6 +56564,9 @@ img.ProseMirror-separator {
56111
56564
  this.validator.validate(this.mappingElements, this.pattern);
56112
56565
  this.mentionInternals.pattern = this.pattern;
56113
56566
  }
56567
+ buttonLabelChanged() {
56568
+ this.mentionInternals.buttonLabel = this.buttonLabel;
56569
+ }
56114
56570
  removeMappingElementObservers() {
56115
56571
  this.mappingNotifiers.forEach(notifier => {
56116
56572
  notifier.unsubscribe(this);
@@ -56129,6 +56585,9 @@ img.ProseMirror-separator {
56129
56585
  __decorate$1([
56130
56586
  attr
56131
56587
  ], RichTextMention.prototype, "pattern", void 0);
56588
+ __decorate$1([
56589
+ attr({ attribute: 'button-label' })
56590
+ ], RichTextMention.prototype, "buttonLabel", void 0);
56132
56591
  __decorate$1([
56133
56592
  observable
56134
56593
  ], RichTextMention.prototype, "mappingElements", void 0);
@@ -56238,10 +56697,33 @@ img.ProseMirror-separator {
56238
56697
  ], RichText.prototype, "childItems", void 0);
56239
56698
  __decorate$1([
56240
56699
  observable
56241
- ], RichText.prototype, "configuration", void 0);
56700
+ ], RichText.prototype, "mentionElements", void 0);
56242
56701
  __decorate$1([
56243
56702
  observable
56244
- ], RichText.prototype, "mentionElements", void 0);
56703
+ ], RichText.prototype, "configuration", void 0);
56704
+
56705
+ /**
56706
+ * A configuration object for a Mention extension, to be used by the editor for loading mention plugins in tiptap.
56707
+ * This object maintains the necessary internal values for loading mention extension.
56708
+ */
56709
+ class MentionExtensionConfiguration {
56710
+ constructor(mentionInternals) {
56711
+ MentionExtensionConfiguration.instance += 1;
56712
+ const key = `${mentionPluginPrefix}${MentionExtensionConfiguration.instance}`;
56713
+ this.name = key;
56714
+ this.key = key;
56715
+ this.viewElement = mentionInternals.viewElement;
56716
+ this.character = mentionInternals.character;
56717
+ this.mappingConfigs = mentionInternals.mappingConfigs;
56718
+ this.iconTemplate = mentionInternals.iconTemplate;
56719
+ this.buttonLabel = mentionInternals.buttonLabel ?? '';
56720
+ this.mentionUpdateEmitter = mentionInternals.mentionUpdateEmitter;
56721
+ }
56722
+ static isObservedMentionInternalsProperty(arg) {
56723
+ return typeof arg === 'string' && ['buttonLabel'].includes(arg);
56724
+ }
56725
+ }
56726
+ MentionExtensionConfiguration.instance = 0;
56245
56727
 
56246
56728
  const starInputRegex$1 = /(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/;
56247
56729
  const starPasteRegex$1 = /(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g;
@@ -59816,70 +60298,10 @@ img.ProseMirror-separator {
59816
60298
  },
59817
60299
  });
59818
60300
 
59819
- const HardBreak = Node$1.create({
59820
- name: 'hardBreak',
59821
- addOptions() {
59822
- return {
59823
- keepMarks: true,
59824
- HTMLAttributes: {},
59825
- };
59826
- },
59827
- inline: true,
59828
- group: 'inline',
59829
- selectable: false,
59830
- parseHTML() {
59831
- return [
59832
- { tag: 'br' },
59833
- ];
59834
- },
59835
- renderHTML({ HTMLAttributes }) {
59836
- return ['br', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
59837
- },
59838
- renderText() {
59839
- return '\n';
59840
- },
59841
- addCommands() {
59842
- return {
59843
- setHardBreak: () => ({ commands, chain, state, editor, }) => {
59844
- return commands.first([
59845
- () => commands.exitCode(),
59846
- () => commands.command(() => {
59847
- const { selection, storedMarks } = state;
59848
- if (selection.$from.parent.type.spec.isolating) {
59849
- return false;
59850
- }
59851
- const { keepMarks } = this.options;
59852
- const { splittableMarks } = editor.extensionManager;
59853
- const marks = storedMarks
59854
- || (selection.$to.parentOffset && selection.$from.marks());
59855
- return chain()
59856
- .insertContent({ type: this.name })
59857
- .command(({ tr, dispatch }) => {
59858
- if (dispatch && marks && keepMarks) {
59859
- const filteredMarks = marks
59860
- .filter(mark => splittableMarks.includes(mark.type.name));
59861
- tr.ensureMarks(filteredMarks);
59862
- }
59863
- return true;
59864
- })
59865
- .run();
59866
- }),
59867
- ]);
59868
- },
59869
- };
59870
- },
59871
- addKeyboardShortcuts() {
59872
- return {
59873
- 'Mod-Enter': () => this.editor.commands.setHardBreak(),
59874
- 'Shift-Enter': () => this.editor.commands.setHardBreak(),
59875
- };
59876
- },
59877
- });
59878
-
59879
60301
  const validAbsoluteLinkRegex = /^https?:\/\//i;
59880
- function createTiptapEditor(editor, mentionExtensionConfig, placeholder) {
60302
+ function createTiptapEditor(activeMentionCharacterEmitter, activeMentionCommandEmitter, editor, mentionExtensionConfig, mentionListbox, placeholder) {
59881
60303
  const customLink = createCustomLinkExtension();
59882
- const mentionExtensions = mentionExtensionConfig.map(config => createCustomMentionExtension(config));
60304
+ const mentionExtensions = mentionExtensionConfig.map(config => createCustomMentionExtension(config, activeMentionCharacterEmitter, activeMentionCommandEmitter, mentionListbox));
59883
60305
  /**
59884
60306
  * For more information on the extensions for the supported formatting options, refer to the links below.
59885
60307
  * Tiptap marks: https://tiptap.dev/api/marks
@@ -59973,7 +60395,11 @@ img.ProseMirror-separator {
59973
60395
  // eslint-disable-next-line @typescript-eslint/naming-convention
59974
60396
  HTMLAttributes: {
59975
60397
  rel: 'noopener noreferrer',
59976
- target: null
60398
+ target: null,
60399
+ // Adding `class` here is a workaround to render two mentions without a whitespace as display names
60400
+ // This attribute can be removed when the below issue is resolved
60401
+ // https://github.com/ni/nimble/issues/1707
60402
+ class: ''
59977
60403
  },
59978
60404
  autolink: true,
59979
60405
  openOnClick: false,
@@ -59983,7 +60409,7 @@ img.ProseMirror-separator {
59983
60409
  validate: href => validAbsoluteLinkRegex.test(href)
59984
60410
  });
59985
60411
  }
59986
- function createCustomMentionExtension(config) {
60412
+ function createCustomMentionExtension(config, activeMentionCharacterEmitter, activeMentionCommandEmitter, mentionListbox) {
59987
60413
  return Mention.extend({
59988
60414
  name: config.name,
59989
60415
  parseHTML() {
@@ -60016,12 +60442,16 @@ img.ProseMirror-separator {
60016
60442
  };
60017
60443
  },
60018
60444
  // eslint-disable-next-line @typescript-eslint/naming-convention
60019
- renderHTML({ HTMLAttributes }) {
60445
+ renderHTML({ node, HTMLAttributes }) {
60020
60446
  return [
60021
60447
  config.viewElement,
60022
60448
  mergeAttributes(this.options.HTMLAttributes, HTMLAttributes,
60023
60449
  // disable-editing is a boolean attribute
60024
- { 'disable-editing': '' })
60450
+ { 'disable-editing': '' }),
60451
+ this.options.renderLabel({
60452
+ options: this.options,
60453
+ node
60454
+ })
60025
60455
  ];
60026
60456
  }
60027
60457
  }).configure({
@@ -60031,12 +60461,51 @@ img.ProseMirror-separator {
60031
60461
  pluginKey: new PluginKey(config.key),
60032
60462
  allowSpaces: true,
60033
60463
  render: () => {
60464
+ let inSuggestionMode = false;
60034
60465
  return {
60035
60466
  onStart: (props) => {
60467
+ /**
60468
+ * If the cursor position moves to outside of the mention and configuration element changes,
60469
+ * the setMarkdown() will trigger this `onStart` without a decoration node because the cursor
60470
+ * position is temporarily moved out of the suggestion decoration. Ignore `onStart` in that case
60471
+ * and don't show the mention list box since it doesn't have anything to anchor to.
60472
+ */
60473
+ if (props.decorationNode === null) {
60474
+ return;
60475
+ }
60476
+ inSuggestionMode = true;
60036
60477
  config.mentionUpdateEmitter(props.query);
60478
+ activeMentionCharacterEmitter(props.text.slice(0, 1));
60479
+ activeMentionCommandEmitter(props.command);
60480
+ mentionListbox?.show({
60481
+ filter: props.query,
60482
+ anchorNode: props.decorationNode
60483
+ });
60037
60484
  },
60038
60485
  onUpdate: (props) => {
60486
+ if (!inSuggestionMode) {
60487
+ return;
60488
+ }
60039
60489
  config.mentionUpdateEmitter(props.query);
60490
+ activeMentionCommandEmitter(props.command);
60491
+ mentionListbox?.show({
60492
+ filter: props.query,
60493
+ anchorNode: props.decorationNode
60494
+ });
60495
+ },
60496
+ onKeyDown: (props) => {
60497
+ if (!inSuggestionMode) {
60498
+ return false;
60499
+ }
60500
+ if (props.event.key === keyEscape) {
60501
+ inSuggestionMode = false;
60502
+ }
60503
+ return (mentionListbox?.keydownHandler(props.event) ?? false);
60504
+ },
60505
+ onExit: () => {
60506
+ activeMentionCharacterEmitter('');
60507
+ activeMentionCommandEmitter(undefined);
60508
+ mentionListbox?.close();
60040
60509
  }
60041
60510
  };
60042
60511
  }
@@ -60086,23 +60555,6 @@ img.ProseMirror-separator {
60086
60555
  return Fragment.fromArray(updatedNodes);
60087
60556
  }
60088
60557
 
60089
- /**
60090
- * A configuration object for a Mention extension, to be used by the editor for loading mention plugins in tiptap.
60091
- * This object maintains the necessary internal values for loading mention extension.
60092
- */
60093
- class MentionExtensionConfiguration {
60094
- constructor(mentionInternals) {
60095
- MentionExtensionConfiguration.instance += 1;
60096
- const key = `${mentionPluginPrefix}${MentionExtensionConfiguration.instance}`;
60097
- this.name = key;
60098
- this.key = key;
60099
- this.viewElement = mentionInternals.viewElement;
60100
- this.character = mentionInternals.character;
60101
- this.mentionUpdateEmitter = mentionInternals.mentionUpdateEmitter;
60102
- }
60103
- }
60104
- MentionExtensionConfiguration.instance = 0;
60105
-
60106
60558
  /**
60107
60559
  * EditorConfiguration which will hold mentionExtensionConfig for configuring editor's mention extension and RichTextMarkdownSerializer
60108
60560
  */
@@ -60128,7 +60580,7 @@ img.ProseMirror-separator {
60128
60580
  /**
60129
60581
  * @internal
60130
60582
  */
60131
- this.tiptapEditor = createTiptapEditor(this.editor, [], this.placeholder);
60583
+ this.tiptapEditor = createTiptapEditor(() => { }, () => { }, this.editor, [], this.mentionListbox, this.placeholder);
60132
60584
  /**
60133
60585
  * @internal
60134
60586
  */
@@ -60163,6 +60615,10 @@ img.ProseMirror-separator {
60163
60615
  * @internal
60164
60616
  */
60165
60617
  this.scrollbarWidth = -1;
60618
+ /**
60619
+ * @internal
60620
+ */
60621
+ this.activeMentionCharacter = '';
60166
60622
  this.updateScrollbarWidthQueued = false;
60167
60623
  }
60168
60624
  /**
@@ -60243,16 +60699,22 @@ img.ProseMirror-separator {
60243
60699
  */
60244
60700
  configurationChanged(prev, next) {
60245
60701
  if (this.isMentionExtensionConfigUnchanged(prev, next)) {
60246
- this.setMarkdown(this.getMarkdown());
60702
+ this.refreshMarkdownContent();
60247
60703
  }
60248
60704
  else {
60705
+ const mentionExtensionConfig = this.getMentionExtensionConfig();
60249
60706
  const currentStateMarkdown = this.getMarkdown();
60250
- this.richTextMarkdownSerializer = new RichTextMarkdownSerializer(this.configuration instanceof EditorConfiguration
60251
- ? this.configuration.mentionExtensionConfig.map(config => config.name)
60252
- : []);
60707
+ this.richTextMarkdownSerializer = new RichTextMarkdownSerializer(mentionExtensionConfig.map(config => config.name));
60253
60708
  this.initializeEditor();
60254
60709
  this.setMarkdown(currentStateMarkdown);
60255
60710
  }
60711
+ this.setActiveMappingConfigs();
60712
+ }
60713
+ /**
60714
+ * @internal
60715
+ */
60716
+ activeMentionCharacterChanged() {
60717
+ this.setActiveMappingConfigs();
60256
60718
  }
60257
60719
  /**
60258
60720
  * Toggle the bold mark and focus back to the editor
@@ -60326,6 +60788,17 @@ img.ProseMirror-separator {
60326
60788
  }
60327
60789
  return true;
60328
60790
  }
60791
+ /**
60792
+ * Inserts the mention character into the editor and focus back to the editor
60793
+ * @internal
60794
+ */
60795
+ mentionButtonClick(character) {
60796
+ this.tiptapEditor
60797
+ .chain()
60798
+ .insertContent(this.shouldInsertSpace() ? ` ${character}` : character)
60799
+ .focus()
60800
+ .run();
60801
+ }
60329
60802
  /**
60330
60803
  * This function load tip tap editor with provided markdown content by parsing into html
60331
60804
  * @public
@@ -60359,6 +60832,46 @@ img.ProseMirror-separator {
60359
60832
  });
60360
60833
  return Array.from(mentionedHrefs);
60361
60834
  }
60835
+ /**
60836
+ * @internal
60837
+ */
60838
+ getMentionExtensionConfig() {
60839
+ return this.configuration instanceof EditorConfiguration
60840
+ ? this.configuration.mentionExtensionConfig
60841
+ : [];
60842
+ }
60843
+ /**
60844
+ * @internal
60845
+ */
60846
+ onMentionSelect(event) {
60847
+ if (this.activeMentionCommand) {
60848
+ this.activeMentionCommand({
60849
+ href: event.detail.href,
60850
+ label: event.detail.displayName
60851
+ });
60852
+ }
60853
+ }
60854
+ /**
60855
+ * @internal
60856
+ */
60857
+ handleChange(source, args) {
60858
+ if (source instanceof MentionInternals
60859
+ && MentionExtensionConfiguration.isObservedMentionInternalsProperty(args)) {
60860
+ this.configuration = this.createConfig();
60861
+ }
60862
+ else {
60863
+ super.handleChange(source, args);
60864
+ }
60865
+ }
60866
+ /**
60867
+ * @internal
60868
+ */
60869
+ focusoutHandler() {
60870
+ if (!this.mentionListbox?.open) {
60871
+ return;
60872
+ }
60873
+ this.mentionListbox?.close();
60874
+ }
60362
60875
  createConfig() {
60363
60876
  return new EditorConfiguration(this.mentionElements);
60364
60877
  }
@@ -60386,9 +60899,13 @@ img.ProseMirror-separator {
60386
60899
  this.unbindEditorUpdateEvent();
60387
60900
  this.unbindNativeInputEvent();
60388
60901
  this.tiptapEditor?.destroy();
60389
- this.tiptapEditor = createTiptapEditor(this.editor, this.configuration instanceof EditorConfiguration
60902
+ this.tiptapEditor = createTiptapEditor(character => {
60903
+ this.activeMentionCharacter = character;
60904
+ }, command => {
60905
+ this.activeMentionCommand = command;
60906
+ }, this.editor, this.configuration instanceof EditorConfiguration
60390
60907
  ? this.configuration.mentionExtensionConfig
60391
- : [], this.placeholder);
60908
+ : [], this.mentionListbox, this.placeholder);
60392
60909
  this.disableEditor();
60393
60910
  this.bindEditorTransactionEvent();
60394
60911
  this.bindEditorUpdateEvent();
@@ -60454,6 +60971,7 @@ img.ProseMirror-separator {
60454
60971
  this.tiptapEditor.setEditable(!this.disabled);
60455
60972
  this.setEditorTabIndex();
60456
60973
  this.editor.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');
60974
+ this.mentionListbox?.close();
60457
60975
  }
60458
60976
  /**
60459
60977
  * Stopping the native input event propagation emitted by the contenteditable element in the Tiptap
@@ -60501,6 +61019,30 @@ img.ProseMirror-separator {
60501
61019
  }
60502
61020
  });
60503
61021
  }
61022
+ setActiveMappingConfigs() {
61023
+ this.activeMappingConfigs = this.activeMentionCharacter
61024
+ ? this.getMentionExtensionConfigFromCharacter(this.activeMentionCharacter)?.mappingConfigs
61025
+ : undefined;
61026
+ }
61027
+ shouldInsertSpace() {
61028
+ const { $anchor, $head } = this.tiptapEditor.view.state.selection;
61029
+ const isAtStartOfLine = $head.parentOffset === 0 || $anchor.parentOffset === 0;
61030
+ const nodeBeforeSelection = $anchor.pos < $head.pos ? $anchor.nodeBefore : $head.nodeBefore;
61031
+ const isHardBreakNode = nodeBeforeSelection?.type.name === HardBreak.name;
61032
+ const hasWhitespaceBeforeCurrentPosition = nodeBeforeSelection?.textContent.endsWith(' ');
61033
+ return (!isAtStartOfLine
61034
+ && !isHardBreakNode
61035
+ && !hasWhitespaceBeforeCurrentPosition);
61036
+ }
61037
+ getMentionExtensionConfigFromCharacter(character) {
61038
+ return this.getMentionExtensionConfig().find(config => config.character === character);
61039
+ }
61040
+ // This method restore the cursor selection after setting the editor content when the editor is focused
61041
+ refreshMarkdownContent() {
61042
+ const { from, to } = this.tiptapEditor.view.state.selection;
61043
+ this.setMarkdown(this.getMarkdown());
61044
+ this.tiptapEditor.commands.setTextSelection({ from, to });
61045
+ }
60504
61046
  }
60505
61047
  __decorate$1([
60506
61048
  attr({ mode: 'boolean' })
@@ -60532,11 +61074,20 @@ img.ProseMirror-separator {
60532
61074
  __decorate$1([
60533
61075
  observable
60534
61076
  ], RichTextEditor.prototype, "scrollbarWidth", void 0);
61077
+ __decorate$1([
61078
+ observable
61079
+ ], RichTextEditor.prototype, "activeMentionCharacter", void 0);
61080
+ __decorate$1([
61081
+ observable
61082
+ ], RichTextEditor.prototype, "activeMappingConfigs", void 0);
60535
61083
  applyMixins(RichTextEditor, ARIAGlobalStatesAndProperties);
60536
61084
  const nimbleRichTextEditor = RichTextEditor.compose({
60537
61085
  baseName: 'rich-text-editor',
60538
61086
  template: template$m,
60539
- styles: styles$q
61087
+ styles: styles$q,
61088
+ shadowOptions: {
61089
+ delegatesFocus: true
61090
+ }
60540
61091
  });
60541
61092
  DesignSystem.getOrCreate()
60542
61093
  .withPrefix('nimble')
@@ -60668,8 +61219,8 @@ img.ProseMirror-separator {
60668
61219
  DesignSystem.tagFor(RichTextViewer);
60669
61220
 
60670
61221
  const styles$o = css `
60671
- ${styles$E}
60672
- ${styles$D}
61222
+ ${styles$G}
61223
+ ${styles$F}
60673
61224
 
60674
61225
  ${
60675
61226
  /* We are using flex `order` to define the visual ordering of the selected value,
@@ -60764,7 +61315,7 @@ img.ProseMirror-separator {
60764
61315
  >
60765
61316
  <slot
60766
61317
  ${slotted({
60767
- filter: (n) => n instanceof HTMLElement && Listbox.slottedOptionFilter(n),
61318
+ filter: (n) => n instanceof HTMLElement && Listbox$1.slottedOptionFilter(n),
60768
61319
  flatten: true,
60769
61320
  property: 'slottedOptions',
60770
61321
  })}
@@ -70761,7 +71312,7 @@ img.ProseMirror-separator {
70761
71312
 
70762
71313
  const styles$5 = css `
70763
71314
  ${display('inline-flex')}
70764
- ${styles$D}
71315
+ ${styles$F}
70765
71316
 
70766
71317
  :host {
70767
71318
  font: ${bodyFont};
@@ -71107,7 +71658,7 @@ img.ProseMirror-separator {
71107
71658
 
71108
71659
  const styles$4 = css `
71109
71660
  ${display('inline-block')}
71110
- ${styles$D}
71661
+ ${styles$F}
71111
71662
 
71112
71663
  :host {
71113
71664
  font: ${bodyFont};