@ni/spright-components 4.1.14 → 4.1.16

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.
@@ -12875,31 +12875,6 @@
12875
12875
  attr({ mode: "boolean" })
12876
12876
  ], Tab$1.prototype, "disabled", void 0);
12877
12877
 
12878
- /**
12879
- * The template for the {@link @microsoft/fast-foundation#(Tabs:class)} component.
12880
- * @public
12881
- */
12882
- const tabsTemplate = (context, definition) => html `
12883
- <template class="${x => x.orientation}">
12884
- ${startSlotTemplate(context, definition)}
12885
- <div class="tablist" part="tablist" role="tablist">
12886
- <slot class="tab" name="tab" part="tab" ${slotted("tabs")}></slot>
12887
-
12888
- ${when(x => x.showActiveIndicator, html `
12889
- <div
12890
- ${ref("activeIndicatorRef")}
12891
- class="activeIndicator"
12892
- part="activeIndicator"
12893
- ></div>
12894
- `)}
12895
- </div>
12896
- ${endSlotTemplate(context, definition)}
12897
- <div class="tabpanel" part="tabpanel">
12898
- <slot name="tabpanel" ${slotted("tabpanels")}></slot>
12899
- </div>
12900
- </template>
12901
- `;
12902
-
12903
12878
  /**
12904
12879
  * The orientation of the {@link @microsoft/fast-foundation#(Tabs:class)} component
12905
12880
  * @public
@@ -17714,6 +17689,7 @@
17714
17689
  align-items: center;
17715
17690
  justify-content: center;
17716
17691
  cursor: pointer;
17692
+ text-wrap: nowrap;
17717
17693
  --ni-private-active-indicator-width: 2px;
17718
17694
  --ni-private-focus-indicator-width: 1px;
17719
17695
  --ni-private-indicator-lines-gap: 1px;
@@ -17880,810 +17856,112 @@
17880
17856
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleAnchorTab());
17881
17857
 
17882
17858
  const styles$X = css `
17883
- ${display$1('grid')}
17884
-
17885
- :host {
17886
- grid-template-columns: auto 1fr;
17887
- grid-template-rows: auto 1fr;
17888
- }
17889
-
17890
- [part='start'] {
17891
- display: none;
17892
- }
17893
-
17894
- .tablist {
17895
- display: grid;
17896
- grid-template-rows: auto auto;
17897
- grid-template-columns: auto;
17898
- width: max-content;
17899
- align-self: end;
17900
- }
17901
- `;
17902
-
17903
- const template$I = (context, definition) => html `
17904
- ${startSlotTemplate(context, definition)}
17905
- <div ${ref('tablist')} class="tablist" part="tablist" role="tablist">
17906
- <slot name="anchortab" ${slotted('tabs')}></slot>
17907
- </div>
17908
- ${endSlotTemplate(context, definition)}
17909
- `;
17910
-
17911
- /**
17912
- * A nimble-styled set of anchor tabs
17913
- */
17914
- class AnchorTabs extends FoundationElement {
17915
- constructor() {
17916
- super(...arguments);
17917
- this.tabIds = [];
17918
- this.isDisabledElement = (el) => {
17919
- return el.getAttribute('aria-disabled') === 'true';
17920
- };
17921
- this.isHiddenElement = (el) => {
17922
- return el.hasAttribute('hidden');
17923
- };
17924
- this.isFocusableElement = (el) => {
17925
- return !this.isDisabledElement(el) && !this.isHiddenElement(el);
17926
- };
17927
- this.setTabs = () => {
17928
- const gridHorizontalProperty = 'gridColumn';
17929
- const gridVerticalProperty = 'gridRow';
17930
- this.activetab = undefined;
17931
- let firstFocusableTab;
17932
- this.tabs.forEach((tab, index) => {
17933
- const tabId = this.tabIds[index];
17934
- const isActiveTab = this.activeid === tabId;
17935
- if (!firstFocusableTab && this.isFocusableElement(tab)) {
17936
- firstFocusableTab = tab;
17937
- }
17938
- const isTabStop = this.activeid === tabId && this.isFocusableElement(tab);
17939
- tab.setAttribute('id', tabId);
17940
- if (isActiveTab) {
17941
- tab.setAttribute('aria-current', 'page');
17942
- }
17943
- else {
17944
- tab.removeAttribute('aria-current');
17945
- }
17946
- tab.removeEventListener('click', this.handleTabClick);
17947
- tab.addEventListener('click', this.handleTabClick);
17948
- tab.removeEventListener('keydown', this.handleTabKeyDown);
17949
- tab.addEventListener('keydown', this.handleTabKeyDown);
17950
- tab.setAttribute('tabindex', isTabStop ? '0' : '-1');
17951
- if (isActiveTab) {
17952
- this.activetab = tab;
17953
- }
17954
- tab.style[gridVerticalProperty] = '';
17955
- tab.style[gridHorizontalProperty] = `${index + 1}`;
17956
- });
17957
- if (firstFocusableTab
17958
- && (!this.activetab || !this.isFocusableElement(this.activetab))) {
17959
- firstFocusableTab.setAttribute('tabindex', '0');
17960
- }
17961
- };
17962
- this.handleTabClick = (event) => {
17963
- const selectedTab = event.currentTarget;
17964
- if (selectedTab.nodeType === 1
17965
- && this.isFocusableElement(selectedTab)) {
17966
- this.tabs.forEach((tab) => {
17967
- tab.setAttribute('tabindex', tab === selectedTab ? '0' : '-1');
17968
- });
17969
- }
17970
- };
17971
- this.handleTabKeyDown = (event) => {
17972
- let anchor;
17973
- switch (event.key) {
17974
- case keyArrowLeft:
17975
- event.preventDefault();
17976
- this.adjustBackward();
17977
- break;
17978
- case keyArrowRight:
17979
- event.preventDefault();
17980
- this.adjustForward();
17981
- break;
17982
- case keyHome:
17983
- event.preventDefault();
17984
- this.focusFirstOrLast(false);
17985
- break;
17986
- case keyEnd:
17987
- event.preventDefault();
17988
- this.focusFirstOrLast(true);
17989
- break;
17990
- case keySpace:
17991
- case keyEnter:
17992
- event.preventDefault();
17993
- this.getTabAnchor(event.target).click();
17994
- break;
17995
- case 'ContextMenu':
17996
- event.preventDefault();
17997
- anchor = this.getTabAnchor(event.target);
17998
- anchor.focus();
17999
- anchor.dispatchEvent(new KeyboardEvent('keydown', {
18000
- key: event.key,
18001
- bubbles: false
18002
- }));
18003
- break;
18004
- // do nothing
18005
- }
18006
- };
18007
- this.adjustForward = () => {
18008
- const group = this.tabs;
18009
- let index = 0;
18010
- const focusedTab = group.find(x => x === document.activeElement);
18011
- index = focusedTab ? group.indexOf(focusedTab) + 1 : 1;
18012
- if (index === group.length) {
18013
- index = 0;
18014
- }
18015
- while (index < group.length && group.length > 1) {
18016
- if (this.isFocusableElement(group[index])) {
18017
- this.focusTabByIndex(group, index);
18018
- break;
18019
- }
18020
- else if (focusedTab && index === group.indexOf(focusedTab)) {
18021
- break;
18022
- }
18023
- else if (index + 1 >= group.length) {
18024
- index = 0;
18025
- }
18026
- else {
18027
- index += 1;
18028
- }
18029
- }
18030
- };
18031
- this.adjustBackward = () => {
18032
- const group = this.tabs;
18033
- let index = 0;
18034
- const focusedTab = group.find(x => x === document.activeElement);
18035
- index = focusedTab ? group.indexOf(focusedTab) - 1 : 0;
18036
- index = index < 0 ? group.length - 1 : index;
18037
- while (index >= 0 && group.length > 1) {
18038
- if (this.isFocusableElement(group[index])) {
18039
- this.focusTabByIndex(group, index);
18040
- break;
18041
- }
18042
- else if (index - 1 < 0) {
18043
- index = group.length - 1;
18044
- }
18045
- else {
18046
- index -= 1;
18047
- }
18048
- }
18049
- };
18050
- this.focusTabByIndex = (group, index) => {
18051
- const focusedTab = group[index];
18052
- focusedTab.focus();
18053
- this.tabs.forEach((tab) => {
18054
- tab.setAttribute('tabindex', tab === focusedTab ? '0' : '-1');
18055
- tab.setAttribute('aria-selected', tab === focusedTab ? 'true' : 'false');
18056
- });
18057
- };
18058
- }
18059
- /**
18060
- * @internal
18061
- */
18062
- activeidChanged(_oldValue, _newValue) {
18063
- if (this.$fastController.isConnected) {
18064
- this.setTabs();
18065
- }
18066
- }
18067
- /**
18068
- * @internal
18069
- */
18070
- tabsChanged() {
18071
- if (this.$fastController.isConnected) {
18072
- this.tabIds = this.getTabIds();
18073
- this.setTabs();
18074
- }
18075
- }
18076
- /**
18077
- * @internal
18078
- */
18079
- connectedCallback() {
18080
- super.connectedCallback();
18081
- this.tabIds = this.getTabIds();
18082
- }
18083
- getTabIds() {
18084
- return this.tabs.map((tab) => {
18085
- return tab.getAttribute('id') ?? `tab-${uniqueId()}`;
18086
- });
18087
- }
18088
- focusFirstOrLast(focusLast) {
18089
- const focusableTabs = this.tabs.filter(t => this.isFocusableElement(t));
18090
- const focusableIndex = focusLast ? focusableTabs.length - 1 : 0;
18091
- const index = this.tabs.indexOf(focusableTabs[focusableIndex]);
18092
- if (index > -1) {
18093
- this.focusTabByIndex(this.tabs, index);
18094
- }
18095
- }
18096
- getTabAnchor(tab) {
18097
- return tab.shadowRoot.querySelector('a');
18098
- }
18099
- }
18100
- __decorate$1([
18101
- attr
18102
- ], AnchorTabs.prototype, "activeid", void 0);
18103
- __decorate$1([
18104
- observable
18105
- ], AnchorTabs.prototype, "tabs", void 0);
18106
- applyMixins(AnchorTabs, StartEnd);
18107
- const nimbleAnchorTabs = AnchorTabs.compose({
18108
- baseName: 'anchor-tabs',
18109
- template: template$I,
18110
- styles: styles$X,
18111
- shadowOptions: {
18112
- delegatesFocus: false
18113
- }
18114
- });
18115
- DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleAnchorTabs());
18116
-
18117
- /**
18118
- * Set user-select: none in a way that works across all supported browsers.
18119
- * https://developer.mozilla.org/en-US/docs/Web/CSS/user-select#browser_compatibility
18120
- */
18121
- const userSelectNone = cssPartial `
18122
- user-select: none;
18123
- -webkit-user-select: none;
18124
- `;
18125
-
18126
- const styles$W = css `
18127
- ${display$1('block')}
17859
+ ${display$1('flex')}
18128
17860
 
18129
17861
  :host {
18130
- ${
18131
- /* don't set font-size here or else it overrides what we set on .items */ ''}
18132
- font-family: ${bodyFontFamily};
18133
- font-weight: ${bodyFontWeight};
18134
- contain: content;
18135
- position: relative;
18136
- outline: none;
18137
- color: ${bodyFontColor};
18138
- cursor: pointer;
18139
- --ni-private-tree-item-nested-width: 0;
18140
- }
18141
-
18142
- :host([disabled]) {
18143
- color: ${bodyDisabledFontColor};
18144
- cursor: default;
18145
- }
18146
-
18147
- .control {
18148
- display: flex;
18149
- text-decoration: none;
18150
- color: inherit;
18151
- }
18152
-
18153
- .control${focusVisible} {
18154
- box-shadow: 0px 0px 0px ${borderWidth} ${borderHoverColor} inset;
18155
- outline: ${borderWidth} solid ${borderHoverColor};
18156
- outline-offset: -2px;
17862
+ flex-direction: column;
18157
17863
  }
18158
17864
 
18159
- .positioning-region {
17865
+ .tab-bar {
18160
17866
  display: flex;
18161
- position: relative;
18162
- height: calc(${iconSize} * 2);
18163
- width: 100%;
18164
- }
18165
-
18166
- .positioning-region:hover {
18167
- background: ${fillHoverColor};
18168
- }
18169
-
18170
- :host([disabled]) .positioning-region:hover {
18171
- background: transparent;
18172
- }
18173
-
18174
- :host([selected]) .positioning-region {
18175
- background: ${fillSelectedColor};
18176
- }
18177
-
18178
- :host([selected]) .positioning-region:hover {
18179
- background: ${fillHoverSelectedColor};
18180
- }
18181
-
18182
- .positioning-region::before {
18183
- content: '';
18184
- display: block;
18185
- width: var(--ni-private-tree-item-nested-width);
18186
- flex-shrink: 0;
18187
17867
  }
18188
17868
 
18189
- .content-region {
18190
- display: inline-flex;
18191
- align-items: center;
18192
- white-space: nowrap;
18193
- width: 100%;
18194
- padding-left: 10px;
18195
- font: inherit;
18196
- font-size: ${bodyFontSize};
18197
- ${userSelectNone}
18198
- position: relative;
18199
- margin-inline-start: ${iconSize};
17869
+ [part='start'] {
17870
+ display: none;
18200
17871
  }
18201
17872
 
18202
- ${
18203
- /* this rule keeps children without an icon text aligned with parents */ ''}
18204
- [part="start"] {
18205
- width: ${iconSize};
18206
- pointer-events: none;
17873
+ .scroll-button.left {
17874
+ margin-right: ${smallPadding};
18207
17875
  }
18208
17876
 
18209
- ${ /* the start class is applied when the corresponding slot is filled */''}
18210
- .start {
17877
+ .tablist {
18211
17878
  display: flex;
18212
- margin-inline-start: ${iconSize};
18213
- margin-inline-end: ${iconSize};
18214
- }
18215
-
18216
- slot[name='start']::slotted(*) {
18217
- ${iconColor.cssCustomProperty}: currentcolor;
18218
- width: ${iconSize};
18219
- height: ${iconSize};
17879
+ width: max-content;
17880
+ align-self: end;
17881
+ overflow-x: scroll;
17882
+ scrollbar-width: none;
18220
17883
  }
18221
17884
 
18222
- .content {
18223
- pointer-events: none;
17885
+ .scroll-button.right {
17886
+ margin-left: ${smallPadding};
18224
17887
  }
17888
+ `;
18225
17889
 
18226
- [part='end'] {
18227
- display: none;
18228
- }
17890
+ const styles$W = css `
17891
+ ${styles$$}
17892
+ ${buttonAppearanceVariantStyles}
18229
17893
  `;
18230
17894
 
18231
- const template$H = (context, definition) => html `
18232
- <template
18233
- role="treeitem"
18234
- slot="${x => (x.isNestedItem() ? 'item' : null)}"
18235
- tabindex="-1"
18236
- aria-disabled="${x => x.disabled}"
18237
- aria-selected="${x => x.selected}"
18238
- @focusin="${(x, c) => x.handleFocus(c.event)}"
18239
- @focusout="${(x, c) => x.handleBlur(c.event)}"
18240
- @keydown="${(x, c) => x.keydownHandler(c.event)}"
18241
- @click="${(x, c) => x.clickHandler(c.event)}"
17895
+ const template$I = (context, definition) => html `
17896
+ <button
17897
+ class="control"
17898
+ part="control"
17899
+ ?autofocus="${x => x.autofocus}"
17900
+ ?disabled="${x => x.disabled}"
17901
+ form="${x => x.formId}"
17902
+ formaction="${x => x.formaction}"
17903
+ formenctype="${x => x.formenctype}"
17904
+ formmethod="${x => x.formmethod}"
17905
+ formnovalidate="${x => x.formnovalidate}"
17906
+ formtarget="${x => x.formtarget}"
17907
+ name="${x => x.name}"
17908
+ type="${x => x.type}"
17909
+ value="${x => x.value}"
17910
+ tabindex="${x => x.tabIndex}"
17911
+ aria-atomic="${x => x.ariaAtomic}"
17912
+ aria-busy="${x => x.ariaBusy}"
17913
+ aria-controls="${x => x.ariaControls}"
17914
+ aria-current="${x => x.ariaCurrent}"
17915
+ aria-describedby="${x => x.ariaDescribedby}"
17916
+ aria-details="${x => x.ariaDetails}"
17917
+ aria-disabled="${x => x.ariaDisabled}"
17918
+ aria-errormessage="${x => x.ariaErrormessage}"
17919
+ aria-expanded="${x => x.ariaExpanded}"
17920
+ aria-flowto="${x => x.ariaFlowto}"
17921
+ aria-haspopup="${x => x.ariaHaspopup}"
17922
+ aria-hidden="${x => x.ariaHidden}"
17923
+ aria-invalid="${x => x.ariaInvalid}"
17924
+ aria-keyshortcuts="${x => x.ariaKeyshortcuts}"
17925
+ aria-label="${x => x.ariaLabel}"
17926
+ aria-labelledby="${x => x.ariaLabelledby}"
17927
+ aria-live="${x => x.ariaLive}"
17928
+ aria-owns="${x => x.ariaOwns}"
17929
+ aria-pressed="${x => x.ariaPressed}"
17930
+ aria-relevant="${x => x.ariaRelevant}"
17931
+ aria-roledescription="${x => x.ariaRoledescription}"
17932
+ ${ref('control')}
18242
17933
  >
18243
- <a
18244
- class="control"
18245
- part="control"
18246
- tabindex="0"
18247
- download="${x => x.download}"
18248
- href=${x => (x.disabled ? null : x.href)}
18249
- hreflang="${x => x.hreflang}"
18250
- ping="${x => x.ping}"
18251
- referrerpolicy="${x => x.referrerpolicy}"
18252
- rel="${x => x.rel}"
18253
- target="${x => x.target}"
18254
- type="${x => x.type}"
18255
- ${ref('control')}
18256
- >
18257
- <div class="positioning-region" part="positioning-region">
18258
- <div class="content-region" part="content-region">
18259
- ${startSlotTemplate(context, definition)}
18260
- <span class="content" part="content">
18261
- <slot></slot>
18262
- </span>
18263
- ${endSlotTemplate(context, definition)}
18264
- </div>
18265
- </div>
18266
- </a>
18267
- </template>
17934
+ ${startSlotTemplate(context, definition)}
17935
+ <span class="content" part="content">
17936
+ <slot ${slotted('defaultSlottedContent')}></slot>
17937
+ </span>
17938
+ ${endSlotTemplate(context, definition)}
17939
+ </button>
18268
17940
  `;
18269
17941
 
18270
17942
  /**
18271
- * A nimble-styled anchor tree item
17943
+ * A nimble-styled HTML button
18272
17944
  */
18273
- class AnchorTreeItem extends AnchorBase {
17945
+ class Button extends Button$1 {
18274
17946
  constructor() {
18275
17947
  super(...arguments);
18276
17948
  /**
18277
- * When true, the control will appear selected by user interaction.
18278
17949
  * @public
18279
17950
  * @remarks
18280
- * HTML Attribute: selected
17951
+ * HTML Attribute: appearance
18281
17952
  */
18282
- this.selected = false;
17953
+ this.appearance = ButtonAppearance.outline;
18283
17954
  /**
18284
- * When true, the control will be immutable by user interaction. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled | disabled HTML attribute} for more information.
18285
17955
  * @public
18286
17956
  * @remarks
18287
- * HTML Attribute: disabled
17957
+ * HTML Attribute: content-hidden
18288
17958
  */
18289
- this.disabled = false;
18290
- }
18291
- /**
18292
- * Whether the tree is nested
18293
- *
18294
- * @public
18295
- */
18296
- isNestedItem() {
18297
- return isTreeItemElement(this.parentElement);
18298
- }
18299
- /**
18300
- * Handle focus events
18301
- *
18302
- * @internal
18303
- */
18304
- handleFocus(_e) {
18305
- this.setAttribute('tabindex', '0');
18306
- }
18307
- /**
18308
- * Handle blur events
18309
- *
18310
- * @internal
18311
- */
18312
- handleBlur(_e) {
18313
- this.setAttribute('tabindex', '-1');
18314
- }
18315
- /**
18316
- * @internal
18317
- */
18318
- keydownHandler(e) {
18319
- if (e.defaultPrevented) {
18320
- return false;
18321
- }
18322
- switch (e.key) {
18323
- case keyEnter:
18324
- // Do not let the event bubble up to the FAST tree, or it will
18325
- // prevent the default action.
18326
- e.stopPropagation();
18327
- break;
18328
- case keyArrowLeft:
18329
- // For FAST tree items, the FAST tree view handles this navigation,
18330
- // but since our anchor tree item is not "instanceof FASTTreeItem",
18331
- // the FAST tree view won't do this for us. We do it ourselves.
18332
- if (this.parentElement && this.isNestedItem()) {
18333
- TreeItem$1.focusItem(this.parentElement);
18334
- }
18335
- break;
18336
- }
18337
- return true;
18338
- }
18339
- /**
18340
- * Activating the anchor by pressing the Enter key results in a click event.
18341
- * This bubbles up to the Nimble tree-view's click handler, causing the tree item
18342
- * to be selected. We don't want that for anchor tree items. We'll stop propagation
18343
- * of the event to prevent that.
18344
- * @internal
18345
- */
18346
- clickHandler(e) {
18347
- if (e.defaultPrevented) {
18348
- return false;
18349
- }
18350
- e.stopPropagation();
18351
- return true;
18352
- }
18353
- selectedChanged(_prev, _next) {
18354
- if (this.$fastController.isConnected) {
18355
- this.$emit('selected-change', this);
18356
- }
17959
+ this.contentHidden = false;
18357
17960
  }
18358
17961
  }
18359
17962
  __decorate$1([
18360
- attr({ mode: 'boolean' })
18361
- ], AnchorTreeItem.prototype, "selected", void 0);
18362
- __decorate$1([
18363
- attr({ mode: 'boolean' })
18364
- ], AnchorTreeItem.prototype, "disabled", void 0);
18365
- // FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
18366
- const nimbleAnchorTreeItem = AnchorTreeItem.compose({
18367
- baseName: 'anchor-tree-item',
18368
- template: template$H,
18369
- styles: styles$W,
18370
- shadowOptions: {
18371
- delegatesFocus: true
18372
- }
18373
- });
18374
- DesignSystem.getOrCreate()
18375
- .withPrefix('nimble')
18376
- .register(nimbleAnchorTreeItem());
18377
-
18378
- const ZIndexLevels = {
18379
- zIndex1: '1',
18380
- // Original usages of 1000 were to compete with jqx grid usage of z-index 200 for table headers
18381
- // See: https://github.com/ni/nimble/pull/530#discussion_r863076750
18382
- zIndex1000: '1000'
18383
- };
18384
-
18385
- const styles$V = css `
18386
- ${display$1('block')}
18387
-
18388
- :host {
18389
- contain: layout;
18390
- z-index: ${ZIndexLevels.zIndex1000};
18391
- }
18392
-
18393
- ${'' /* Override 'display' helper hidden behavior */}
18394
- :host([hidden]) {
18395
- display: block;
18396
- visibility: hidden;
18397
- }
18398
- `;
18399
-
18400
- // When the anchor element changes position on the page, it is the client's responsibility to update the position
18401
- // of the anchored region by calling update() on the anchored region.
18402
- //
18403
- // When the anchor element is recreated on the page, it is the client's responsibility to reset the reference the
18404
- // anchored region has to the anchor element. This can be done by either recreating the anchor element with a new
18405
- // ID that is also set as the \`anchor\` attribute on the anchored region or by explicitly setting the value of
18406
- // anchorElement on the anchored region to the new anchor element.
18407
- /**
18408
- * A nimble-styled anchored region control.
18409
- */
18410
- class AnchoredRegion extends AnchoredRegion$1 {
18411
- }
18412
- const nimbleAnchoredRegion = AnchoredRegion.compose({
18413
- baseName: 'anchored-region',
18414
- baseClass: AnchoredRegion$1,
18415
- template: anchoredRegionTemplate,
18416
- styles: styles$V
18417
- });
18418
- DesignSystem.getOrCreate()
18419
- .withPrefix('nimble')
18420
- .register(nimbleAnchoredRegion());
18421
- const anchoredRegionTag = 'nimble-anchored-region';
18422
-
18423
- /**
18424
- * Subscription for {@link ThemeStyleSheetBehavior}
18425
- */
18426
- class ThemeStyleSheetBehaviorSubscription {
18427
- constructor(value, styles, source) {
18428
- this.value = value;
18429
- this.styles = styles;
18430
- this.source = source;
18431
- }
18432
- handleChange() {
18433
- const theme$1 = theme.getValueFor(this.source);
18434
- if (Array.isArray(this.value)
18435
- ? this.value.includes(theme$1)
18436
- : this.value === theme$1) {
18437
- this.source.$fastController.addStyles(this.styles);
18438
- }
18439
- else {
18440
- this.source.$fastController.removeStyles(this.styles);
18441
- }
18442
- }
18443
- }
18444
- /**
18445
- * Behavior to conditionally apply theme-based stylesheets.
18446
- */
18447
- class ThemeStyleSheetBehavior {
18448
- constructor(theme, styles) {
18449
- this.theme = theme;
18450
- this.styles = styles;
18451
- this.cache = new WeakMap();
18452
- }
18453
- /**
18454
- * @internal
18455
- */
18456
- bind(source) {
18457
- const subscriber = this.cache.get(source)
18458
- || new ThemeStyleSheetBehaviorSubscription(this.theme, this.styles, source);
18459
- // Currently subscriber from cache may have gone through unbind
18460
- // but still be in cache so always resubscribe
18461
- // See: https://github.com/microsoft/fast/issues/3246#issuecomment-1030424876
18462
- theme.subscribe(subscriber, source);
18463
- subscriber.handleChange();
18464
- this.cache.set(source, subscriber);
18465
- }
18466
- /**
18467
- * @internal
18468
- */
18469
- unbind(source) {
18470
- const subscriber = this.cache.get(source);
18471
- if (subscriber) {
18472
- theme.unsubscribe(subscriber);
18473
- }
18474
- // Currently does not evict subscriber from cache
18475
- // See: https://github.com/microsoft/fast/issues/3246#issuecomment-1030424876
18476
- }
18477
- }
18478
- /**
18479
- * Behavior to conditionally apply theme-based stylesheets. To determine which to apply,
18480
- * the behavior will use the nearest ThemeProvider's 'theme' design system value.
18481
- *
18482
- * @public
18483
- * @example
18484
- * ```ts
18485
- * css`
18486
- * // ...
18487
- * `.withBehaviors(
18488
- * themeBehavior(Theme.light, css` ... `),
18489
- * // Apply style for both dark and color theme
18490
- * themeBehavior([Theme.dark, Theme.color], css` ... `)
18491
- * )
18492
- * ```
18493
- */
18494
- const themeBehavior = (theme, styles) => new ThemeStyleSheetBehavior(theme, styles);
18495
- /* eslint-enable max-classes-per-file */
18496
-
18497
- const styles$U = css `
18498
- ${display$1('flex')}
18499
-
18500
- :host {
18501
- font: ${bodyFont};
18502
- font-size: 12.8px;
18503
- align-items: top;
18504
- overflow: hidden;
18505
- overflow-wrap: anywhere;
18506
- }
18507
-
18508
- :host(:not([open])) {
18509
- display: none;
18510
- }
18511
-
18512
- .container {
18513
- color: ${bodyFontColor};
18514
- display: flex;
18515
- width: 100%;
18516
- }
18517
-
18518
- .icon {
18519
- width: 48px;
18520
- display: flex;
18521
- justify-content: center;
18522
- margin-top: 8px;
18523
- flex: 0 0 auto;
18524
- opacity: 0.6;
18525
- }
18526
-
18527
- .text {
18528
- display: inline;
18529
- margin-top: 7px;
18530
- margin-bottom: 7px;
18531
- }
18532
-
18533
- slot[name='title'] {
18534
- display: inline;
18535
- font-weight: bold;
18536
- padding-right: 8px;
18537
- }
18538
-
18539
- :host([title-hidden]) slot[name='title'] {
18540
- ${accessiblyHidden}
18541
- }
18542
-
18543
- .controls {
18544
- height: ${controlHeight};
18545
- margin-left: auto;
18546
- display: flex;
18547
- align-items: center;
18548
- justify-content: center;
18549
- align-self: flex-start;
18550
- margin-top: ${smallPadding};
18551
- ${controlHeight.cssCustomProperty}: ${controlSlimHeight};
18552
- }
18553
-
18554
- slot[name='action'] {
18555
- display: flex;
18556
- align-content: center;
18557
- margin-left: ${standardPadding};
18558
- white-space: nowrap;
18559
- }
18560
-
18561
- slot[name='action']::slotted(nimble-anchor) {
18562
- font-size: 12.8px;
18563
- }
18564
-
18565
- .dismiss {
18566
- width: 48px;
18567
- display: flex;
18568
- justify-content: center;
18569
- }
18570
- `.withBehaviors(themeBehavior(Theme.light, css `
18571
- :host {
18572
- background: ${Black75};
18573
- }
18574
-
18575
- :host([severity='error']) {
18576
- background: ${Fail100LightUi};
18577
- }
18578
-
18579
- :host([severity='warning']) {
18580
- background: ${Warning100LightUi};
18581
- }
18582
-
18583
- :host([severity='information']) {
18584
- background: ${Information100LightUi};
18585
- }
18586
- `), themeBehavior(Theme.dark, css `
18587
- :host {
18588
- background: ${Black75};
18589
- }
18590
-
18591
- :host([severity='error']) {
18592
- background: ${BannerFail100DarkUi};
18593
- }
18594
-
18595
- :host([severity='warning']) {
18596
- background: ${Warning100DarkUi};
18597
- }
18598
-
18599
- :host([severity='information']) {
18600
- background: ${Information100DarkUi};
18601
- }
18602
- `), themeBehavior(Theme.color, css `
18603
- :host {
18604
- background: ${applicationBackgroundColor};
18605
- }
18606
-
18607
- .container {
18608
- background: ${hexToRgbaCssColor(White, 0.3)};
18609
- }
18610
- `));
18611
-
18612
- const styles$T = css `
18613
- ${styles$$}
18614
- ${buttonAppearanceVariantStyles}
18615
- `;
18616
-
18617
- const template$G = (context, definition) => html `
18618
- <button
18619
- class="control"
18620
- part="control"
18621
- ?autofocus="${x => x.autofocus}"
18622
- ?disabled="${x => x.disabled}"
18623
- form="${x => x.formId}"
18624
- formaction="${x => x.formaction}"
18625
- formenctype="${x => x.formenctype}"
18626
- formmethod="${x => x.formmethod}"
18627
- formnovalidate="${x => x.formnovalidate}"
18628
- formtarget="${x => x.formtarget}"
18629
- name="${x => x.name}"
18630
- type="${x => x.type}"
18631
- value="${x => x.value}"
18632
- tabindex="${x => x.tabIndex}"
18633
- aria-atomic="${x => x.ariaAtomic}"
18634
- aria-busy="${x => x.ariaBusy}"
18635
- aria-controls="${x => x.ariaControls}"
18636
- aria-current="${x => x.ariaCurrent}"
18637
- aria-describedby="${x => x.ariaDescribedby}"
18638
- aria-details="${x => x.ariaDetails}"
18639
- aria-disabled="${x => x.ariaDisabled}"
18640
- aria-errormessage="${x => x.ariaErrormessage}"
18641
- aria-expanded="${x => x.ariaExpanded}"
18642
- aria-flowto="${x => x.ariaFlowto}"
18643
- aria-haspopup="${x => x.ariaHaspopup}"
18644
- aria-hidden="${x => x.ariaHidden}"
18645
- aria-invalid="${x => x.ariaInvalid}"
18646
- aria-keyshortcuts="${x => x.ariaKeyshortcuts}"
18647
- aria-label="${x => x.ariaLabel}"
18648
- aria-labelledby="${x => x.ariaLabelledby}"
18649
- aria-live="${x => x.ariaLive}"
18650
- aria-owns="${x => x.ariaOwns}"
18651
- aria-pressed="${x => x.ariaPressed}"
18652
- aria-relevant="${x => x.ariaRelevant}"
18653
- aria-roledescription="${x => x.ariaRoledescription}"
18654
- ${ref('control')}
18655
- >
18656
- ${startSlotTemplate(context, definition)}
18657
- <span class="content" part="content">
18658
- <slot ${slotted('defaultSlottedContent')}></slot>
18659
- </span>
18660
- ${endSlotTemplate(context, definition)}
18661
- </button>
18662
- `;
18663
-
18664
- /**
18665
- * A nimble-styled HTML button
18666
- */
18667
- class Button extends Button$1 {
18668
- constructor() {
18669
- super(...arguments);
18670
- /**
18671
- * @public
18672
- * @remarks
18673
- * HTML Attribute: appearance
18674
- */
18675
- this.appearance = ButtonAppearance.outline;
18676
- /**
18677
- * @public
18678
- * @remarks
18679
- * HTML Attribute: content-hidden
18680
- */
18681
- this.contentHidden = false;
18682
- }
18683
- }
18684
- __decorate$1([
18685
- attr
18686
- ], Button.prototype, "appearance", void 0);
17963
+ attr
17964
+ ], Button.prototype, "appearance", void 0);
18687
17965
  __decorate$1([
18688
17966
  attr({ attribute: 'appearance-variant' })
18689
17967
  ], Button.prototype, "appearanceVariant", void 0);
@@ -18705,8 +17983,8 @@
18705
17983
  const nimbleButton = Button.compose({
18706
17984
  baseName: 'button',
18707
17985
  baseClass: Button$1,
18708
- template: template$G,
18709
- styles: styles$T,
17986
+ template: template$I,
17987
+ styles: styles$W,
18710
17988
  shadowOptions: {
18711
17989
  delegatesFocus: true
18712
17990
  }
@@ -19512,71 +18790,959 @@
19512
18790
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path 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" class="cls-1"/></svg>`,
19513
18791
  };
19514
18792
 
19515
- // Avoiding any whitespace in the template because this is an inline element
19516
- const template$F = html `<div
19517
- class="icon"
19518
- aria-hidden="true"
19519
- :innerHTML=${x => x.icon.data}
19520
- ></div>`;
18793
+ // Avoiding any whitespace in the template because this is an inline element
18794
+ const template$H = html `<div
18795
+ class="icon"
18796
+ aria-hidden="true"
18797
+ :innerHTML=${x => x.icon.data}
18798
+ ></div>`;
18799
+
18800
+ /**
18801
+ * Set user-select: none in a way that works across all supported browsers.
18802
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/user-select#browser_compatibility
18803
+ */
18804
+ const userSelectNone = cssPartial `
18805
+ user-select: none;
18806
+ -webkit-user-select: none;
18807
+ `;
18808
+
18809
+ const styles$V = css `
18810
+ ${display$1('inline-flex')}
18811
+
18812
+ :host {
18813
+ align-items: center;
18814
+ ${userSelectNone}
18815
+ width: ${iconSize};
18816
+ height: ${iconSize};
18817
+ }
18818
+
18819
+ .icon {
18820
+ width: 100%;
18821
+ height: 100%;
18822
+ }
18823
+
18824
+ :host([severity='error']) {
18825
+ ${iconColor.cssCustomProperty}: ${failColor};
18826
+ }
18827
+
18828
+ :host([severity='warning']) {
18829
+ ${iconColor.cssCustomProperty}: ${warningColor};
18830
+ }
18831
+
18832
+ :host([severity='success']) {
18833
+ ${iconColor.cssCustomProperty}: ${passColor};
18834
+ }
18835
+
18836
+ :host([severity='information']) {
18837
+ ${iconColor.cssCustomProperty}: ${informationColor};
18838
+ }
18839
+
18840
+ .icon svg {
18841
+ fill: ${iconColor};
18842
+ width: 100%;
18843
+ height: 100%;
18844
+ }
18845
+ `;
18846
+
18847
+ /**
18848
+ * The base class for icon components
18849
+ */
18850
+ class Icon extends FoundationElement {
18851
+ constructor(/** @internal */ icon) {
18852
+ super();
18853
+ this.icon = icon;
18854
+ }
18855
+ }
18856
+ __decorate$1([
18857
+ attr
18858
+ ], Icon.prototype, "severity", void 0);
18859
+ const registerIcon = (baseName, iconClass) => {
18860
+ const composedIcon = iconClass.compose({
18861
+ baseName,
18862
+ template: template$H,
18863
+ styles: styles$V
18864
+ });
18865
+ DesignSystem.getOrCreate().withPrefix('nimble').register(composedIcon());
18866
+ };
18867
+
18868
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
18869
+ // See generation source in nimble-components/build/generate-icons
18870
+ /**
18871
+ * The icon component for the 'arrowExpanderLeft' icon
18872
+ */
18873
+ class IconArrowExpanderLeft extends Icon {
18874
+ constructor() {
18875
+ super(arrowExpanderLeft16X16);
18876
+ }
18877
+ }
18878
+ registerIcon('icon-arrow-expander-left', IconArrowExpanderLeft);
18879
+ const iconArrowExpanderLeftTag = 'nimble-icon-arrow-expander-left';
18880
+
18881
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
18882
+ // See generation source in nimble-components/build/generate-icons
18883
+ /**
18884
+ * The icon component for the 'arrowExpanderRight' icon
18885
+ */
18886
+ class IconArrowExpanderRight extends Icon {
18887
+ constructor() {
18888
+ super(arrowExpanderRight16X16);
18889
+ }
18890
+ }
18891
+ registerIcon('icon-arrow-expander-right', IconArrowExpanderRight);
18892
+ const iconArrowExpanderRightTag = 'nimble-icon-arrow-expander-right';
18893
+
18894
+ const coreLabelDefaults = {
18895
+ popupDismissLabel: 'Close',
18896
+ numericIncrementLabel: 'Increment',
18897
+ numericDecrementLabel: 'Decrement',
18898
+ popupIconErrorLabel: 'Error',
18899
+ popupIconWarningLabel: 'Warning',
18900
+ popupIconInformationLabel: 'Information',
18901
+ filterSearchLabel: 'Search',
18902
+ filterNoResultsLabel: 'No items found',
18903
+ loadingLabel: 'Loading…',
18904
+ scrollBackwardLabel: 'Scroll backward',
18905
+ scrollForwardLabel: 'Scroll forward'
18906
+ };
18907
+
18908
+ const popupDismissLabel = DesignToken.create({
18909
+ name: 'popup-dismiss-label',
18910
+ cssCustomPropertyName: null
18911
+ }).withDefault(coreLabelDefaults.popupDismissLabel);
18912
+ const numericDecrementLabel = DesignToken.create({
18913
+ name: 'numeric-decrement-label',
18914
+ cssCustomPropertyName: null
18915
+ }).withDefault(coreLabelDefaults.numericDecrementLabel);
18916
+ const numericIncrementLabel = DesignToken.create({
18917
+ name: 'numeric-increment-label',
18918
+ cssCustomPropertyName: null
18919
+ }).withDefault(coreLabelDefaults.numericIncrementLabel);
18920
+ const popupIconErrorLabel = DesignToken.create({
18921
+ name: 'popup-icon-error-label',
18922
+ cssCustomPropertyName: null
18923
+ }).withDefault(coreLabelDefaults.popupIconErrorLabel);
18924
+ const popupIconWarningLabel = DesignToken.create({
18925
+ name: 'popup-icon-warning-label',
18926
+ cssCustomPropertyName: null
18927
+ }).withDefault(coreLabelDefaults.popupIconWarningLabel);
18928
+ const popupIconInformationLabel = DesignToken.create({
18929
+ name: 'popup-icon-information-label',
18930
+ cssCustomPropertyName: null
18931
+ }).withDefault(coreLabelDefaults.popupIconInformationLabel);
18932
+ const filterSearchLabel = DesignToken.create({
18933
+ name: 'filter-search-label',
18934
+ cssCustomPropertyName: null
18935
+ }).withDefault(coreLabelDefaults.filterSearchLabel);
18936
+ const filterNoResultsLabel = DesignToken.create({
18937
+ name: 'filter-no-results-label',
18938
+ cssCustomPropertyName: null
18939
+ }).withDefault(coreLabelDefaults.filterNoResultsLabel);
18940
+ const loadingLabel = DesignToken.create({
18941
+ name: 'loading-label',
18942
+ cssCustomPropertyName: null
18943
+ }).withDefault(coreLabelDefaults.loadingLabel);
18944
+ const scrollBackwardLabel = DesignToken.create({
18945
+ name: 'scroll-backward-label',
18946
+ cssCustomPropertyName: null
18947
+ }).withDefault(coreLabelDefaults.scrollBackwardLabel);
18948
+ const scrollForwardLabel = DesignToken.create({
18949
+ name: 'scroll-forward-label',
18950
+ cssCustomPropertyName: null
18951
+ }).withDefault(coreLabelDefaults.scrollForwardLabel);
18952
+
18953
+ // prettier-ignore
18954
+ const template$G = (context, definition) => html `
18955
+ <div
18956
+ class="tab-bar"
18957
+ >
18958
+ ${startSlotTemplate(context, definition)}
18959
+ ${when(x => x.showScrollButtons, html `
18960
+ <${buttonTag}
18961
+ content-hidden
18962
+ class="scroll-button left"
18963
+ appearance="${ButtonAppearance.ghost}"
18964
+ tabindex="-1"
18965
+ @click="${x => x.onScrollLeftClick()}"
18966
+ ${ref('leftScrollButton')}
18967
+ >
18968
+ ${x => scrollForwardLabel.getValueFor(x)}
18969
+ <${iconArrowExpanderLeftTag} slot="start"></${iconArrowExpanderLeftTag}>
18970
+ </${buttonTag}>
18971
+ `)}
18972
+ <div
18973
+ class="tablist"
18974
+ part="tablist"
18975
+ role="tablist"
18976
+ ${ref('tablist')}
18977
+ >
18978
+ <slot class="tab" name="${x => x.tabSlotName}" part="tab" ${slotted('tabs')}>
18979
+ </slot>
18980
+ </div>
18981
+ ${when(x => x.showScrollButtons, html `
18982
+ <${buttonTag}
18983
+ content-hidden
18984
+ class="scroll-button right"
18985
+ appearance="${ButtonAppearance.ghost}"
18986
+ tabindex="-1"
18987
+ @click="${x => x.onScrollRightClick()}"
18988
+ >
18989
+ ${x => scrollBackwardLabel.getValueFor(x)}
18990
+ <${iconArrowExpanderRightTag} slot="start"></${iconArrowExpanderRightTag}>
18991
+ </${buttonTag}>
18992
+ `)}
18993
+ ${endSlotTemplate(context, definition)}
18994
+ </div>
18995
+ ${when(x => 'tabpanels' in x, html `
18996
+ <div class="tabpanel" part="tabpanel">
18997
+ <slot name="tabpanel" ${slotted('tabpanels')}></slot>
18998
+ </div>
18999
+ `)}
19000
+ `;
19001
+
19002
+ /**
19003
+ * A nimble-styled set of anchor tabs
19004
+ */
19005
+ class AnchorTabs extends FoundationElement {
19006
+ constructor() {
19007
+ super();
19008
+ /**
19009
+ * @internal
19010
+ */
19011
+ this.showScrollButtons = false;
19012
+ /**
19013
+ * @internal
19014
+ */
19015
+ this.tabSlotName = 'anchortab';
19016
+ this.tabIds = [];
19017
+ this.isDisabledElement = (el) => {
19018
+ return el.getAttribute('aria-disabled') === 'true';
19019
+ };
19020
+ this.isHiddenElement = (el) => {
19021
+ return el.hasAttribute('hidden');
19022
+ };
19023
+ this.isFocusableElement = (el) => {
19024
+ return !this.isDisabledElement(el) && !this.isHiddenElement(el);
19025
+ };
19026
+ this.setTabs = () => {
19027
+ const gridHorizontalProperty = 'gridColumn';
19028
+ const gridVerticalProperty = 'gridRow';
19029
+ this.activetab = undefined;
19030
+ let firstFocusableTab;
19031
+ this.tabs.forEach((tab, index) => {
19032
+ const tabId = this.tabIds[index];
19033
+ const isActiveTab = this.activeid === tabId;
19034
+ if (!firstFocusableTab && this.isFocusableElement(tab)) {
19035
+ firstFocusableTab = tab;
19036
+ }
19037
+ const isTabStop = this.activeid === tabId && this.isFocusableElement(tab);
19038
+ tab.setAttribute('id', tabId);
19039
+ if (isActiveTab) {
19040
+ tab.setAttribute('aria-current', 'page');
19041
+ }
19042
+ else {
19043
+ tab.removeAttribute('aria-current');
19044
+ }
19045
+ tab.removeEventListener('click', this.handleTabClick);
19046
+ tab.addEventListener('click', this.handleTabClick);
19047
+ tab.removeEventListener('keydown', this.handleTabKeyDown);
19048
+ tab.addEventListener('keydown', this.handleTabKeyDown);
19049
+ tab.setAttribute('tabindex', isTabStop ? '0' : '-1');
19050
+ if (isActiveTab) {
19051
+ this.activetab = tab;
19052
+ }
19053
+ tab.style[gridVerticalProperty] = '';
19054
+ tab.style[gridHorizontalProperty] = `${index + 1}`;
19055
+ });
19056
+ if (firstFocusableTab
19057
+ && (!this.activetab || !this.isFocusableElement(this.activetab))) {
19058
+ firstFocusableTab.setAttribute('tabindex', '0');
19059
+ }
19060
+ };
19061
+ this.handleTabClick = (event) => {
19062
+ const selectedTab = event.currentTarget;
19063
+ if (selectedTab.nodeType === 1
19064
+ && this.isFocusableElement(selectedTab)) {
19065
+ this.tabs.forEach((tab) => {
19066
+ tab.setAttribute('tabindex', tab === selectedTab ? '0' : '-1');
19067
+ });
19068
+ }
19069
+ };
19070
+ this.handleTabKeyDown = (event) => {
19071
+ let anchor;
19072
+ switch (event.key) {
19073
+ case keyArrowLeft:
19074
+ event.preventDefault();
19075
+ this.adjustBackward();
19076
+ break;
19077
+ case keyArrowRight:
19078
+ event.preventDefault();
19079
+ this.adjustForward();
19080
+ break;
19081
+ case keyHome:
19082
+ event.preventDefault();
19083
+ this.focusFirstOrLast(false);
19084
+ break;
19085
+ case keyEnd:
19086
+ event.preventDefault();
19087
+ this.focusFirstOrLast(true);
19088
+ break;
19089
+ case keySpace:
19090
+ case keyEnter:
19091
+ event.preventDefault();
19092
+ this.getTabAnchor(event.target).click();
19093
+ break;
19094
+ case 'ContextMenu':
19095
+ event.preventDefault();
19096
+ anchor = this.getTabAnchor(event.target);
19097
+ anchor.focus();
19098
+ anchor.dispatchEvent(new KeyboardEvent('keydown', {
19099
+ key: event.key,
19100
+ bubbles: false
19101
+ }));
19102
+ break;
19103
+ // do nothing
19104
+ }
19105
+ };
19106
+ this.adjustForward = () => {
19107
+ const group = this.tabs;
19108
+ let index = 0;
19109
+ const focusedTab = group.find(x => x === document.activeElement);
19110
+ index = focusedTab ? group.indexOf(focusedTab) + 1 : 1;
19111
+ if (index === group.length) {
19112
+ index = 0;
19113
+ }
19114
+ while (index < group.length && group.length > 1) {
19115
+ if (this.isFocusableElement(group[index])) {
19116
+ this.focusTabByIndex(group, index);
19117
+ break;
19118
+ }
19119
+ else if (focusedTab && index === group.indexOf(focusedTab)) {
19120
+ break;
19121
+ }
19122
+ else if (index + 1 >= group.length) {
19123
+ index = 0;
19124
+ }
19125
+ else {
19126
+ index += 1;
19127
+ }
19128
+ }
19129
+ };
19130
+ this.adjustBackward = () => {
19131
+ const group = this.tabs;
19132
+ let index = 0;
19133
+ const focusedTab = group.find(x => x === document.activeElement);
19134
+ index = focusedTab ? group.indexOf(focusedTab) - 1 : 0;
19135
+ index = index < 0 ? group.length - 1 : index;
19136
+ while (index >= 0 && group.length > 1) {
19137
+ if (this.isFocusableElement(group[index])) {
19138
+ this.focusTabByIndex(group, index);
19139
+ break;
19140
+ }
19141
+ else if (index - 1 < 0) {
19142
+ index = group.length - 1;
19143
+ }
19144
+ else {
19145
+ index -= 1;
19146
+ }
19147
+ }
19148
+ };
19149
+ this.focusTabByIndex = (group, index) => {
19150
+ const focusedTab = group[index];
19151
+ focusedTab.focus();
19152
+ this.tabs.forEach((tab) => {
19153
+ tab.setAttribute('tabindex', tab === focusedTab ? '0' : '-1');
19154
+ tab.setAttribute('aria-selected', tab === focusedTab ? 'true' : 'false');
19155
+ });
19156
+ focusedTab.scrollIntoView({ block: 'nearest', inline: 'start' });
19157
+ };
19158
+ this.tabListResizeObserver = new ResizeObserver(entries => {
19159
+ let tabListVisibleWidth = entries[0]?.contentRect.width;
19160
+ if (tabListVisibleWidth !== undefined) {
19161
+ const buttonWidth = this.leftScrollButton?.clientWidth ?? 0;
19162
+ tabListVisibleWidth = Math.ceil(tabListVisibleWidth);
19163
+ if (this.showScrollButtons) {
19164
+ tabListVisibleWidth += buttonWidth * 2;
19165
+ }
19166
+ this.showScrollButtons = tabListVisibleWidth < this.tablist.scrollWidth;
19167
+ }
19168
+ });
19169
+ }
19170
+ /**
19171
+ * @internal
19172
+ */
19173
+ activeidChanged(_oldValue, _newValue) {
19174
+ if (this.$fastController.isConnected) {
19175
+ this.setTabs();
19176
+ this.activetab?.scrollIntoView({
19177
+ block: 'nearest',
19178
+ inline: 'start'
19179
+ });
19180
+ }
19181
+ }
19182
+ /**
19183
+ * @internal
19184
+ */
19185
+ tabsChanged() {
19186
+ if (this.$fastController.isConnected) {
19187
+ this.tabIds = this.getTabIds();
19188
+ this.setTabs();
19189
+ }
19190
+ }
19191
+ /**
19192
+ * @internal
19193
+ */
19194
+ onScrollLeftClick() {
19195
+ this.tablist.scrollBy({
19196
+ left: -this.tablist.clientWidth,
19197
+ behavior: 'smooth'
19198
+ });
19199
+ }
19200
+ /**
19201
+ * @internal
19202
+ */
19203
+ onScrollRightClick() {
19204
+ this.tablist.scrollBy({
19205
+ left: this.tablist.clientWidth,
19206
+ behavior: 'smooth'
19207
+ });
19208
+ }
19209
+ /**
19210
+ * @internal
19211
+ */
19212
+ connectedCallback() {
19213
+ super.connectedCallback();
19214
+ this.tabListResizeObserver.observe(this.tablist);
19215
+ this.tabIds = this.getTabIds();
19216
+ }
19217
+ /**
19218
+ * @internal
19219
+ */
19220
+ disconnectedCallback() {
19221
+ super.disconnectedCallback();
19222
+ this.tabListResizeObserver.disconnect();
19223
+ }
19224
+ getTabIds() {
19225
+ return this.tabs.map((tab) => {
19226
+ return tab.getAttribute('id') ?? `tab-${uniqueId()}`;
19227
+ });
19228
+ }
19229
+ focusFirstOrLast(focusLast) {
19230
+ const focusableTabs = this.tabs.filter(t => this.isFocusableElement(t));
19231
+ const focusableIndex = focusLast ? focusableTabs.length - 1 : 0;
19232
+ const index = this.tabs.indexOf(focusableTabs[focusableIndex]);
19233
+ if (index > -1) {
19234
+ this.focusTabByIndex(this.tabs, index);
19235
+ }
19236
+ }
19237
+ getTabAnchor(tab) {
19238
+ return tab.shadowRoot.querySelector('a');
19239
+ }
19240
+ }
19241
+ __decorate$1([
19242
+ attr
19243
+ ], AnchorTabs.prototype, "activeid", void 0);
19244
+ __decorate$1([
19245
+ observable
19246
+ ], AnchorTabs.prototype, "tabs", void 0);
19247
+ __decorate$1([
19248
+ observable
19249
+ ], AnchorTabs.prototype, "showScrollButtons", void 0);
19250
+ applyMixins(AnchorTabs, StartEnd);
19251
+ const nimbleAnchorTabs = AnchorTabs.compose({
19252
+ baseName: 'anchor-tabs',
19253
+ template: template$G,
19254
+ styles: styles$X,
19255
+ shadowOptions: {
19256
+ delegatesFocus: false
19257
+ }
19258
+ });
19259
+ DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleAnchorTabs());
19260
+
19261
+ const styles$U = css `
19262
+ ${display$1('block')}
19263
+
19264
+ :host {
19265
+ ${
19266
+ /* don't set font-size here or else it overrides what we set on .items */ ''}
19267
+ font-family: ${bodyFontFamily};
19268
+ font-weight: ${bodyFontWeight};
19269
+ contain: content;
19270
+ position: relative;
19271
+ outline: none;
19272
+ color: ${bodyFontColor};
19273
+ cursor: pointer;
19274
+ --ni-private-tree-item-nested-width: 0;
19275
+ }
19276
+
19277
+ :host([disabled]) {
19278
+ color: ${bodyDisabledFontColor};
19279
+ cursor: default;
19280
+ }
19281
+
19282
+ .control {
19283
+ display: flex;
19284
+ text-decoration: none;
19285
+ color: inherit;
19286
+ }
19287
+
19288
+ .control${focusVisible} {
19289
+ box-shadow: 0px 0px 0px ${borderWidth} ${borderHoverColor} inset;
19290
+ outline: ${borderWidth} solid ${borderHoverColor};
19291
+ outline-offset: -2px;
19292
+ }
19293
+
19294
+ .positioning-region {
19295
+ display: flex;
19296
+ position: relative;
19297
+ height: calc(${iconSize} * 2);
19298
+ width: 100%;
19299
+ }
19300
+
19301
+ .positioning-region:hover {
19302
+ background: ${fillHoverColor};
19303
+ }
19304
+
19305
+ :host([disabled]) .positioning-region:hover {
19306
+ background: transparent;
19307
+ }
19308
+
19309
+ :host([selected]) .positioning-region {
19310
+ background: ${fillSelectedColor};
19311
+ }
19312
+
19313
+ :host([selected]) .positioning-region:hover {
19314
+ background: ${fillHoverSelectedColor};
19315
+ }
19316
+
19317
+ .positioning-region::before {
19318
+ content: '';
19319
+ display: block;
19320
+ width: var(--ni-private-tree-item-nested-width);
19321
+ flex-shrink: 0;
19322
+ }
19323
+
19324
+ .content-region {
19325
+ display: inline-flex;
19326
+ align-items: center;
19327
+ white-space: nowrap;
19328
+ width: 100%;
19329
+ padding-left: 10px;
19330
+ font: inherit;
19331
+ font-size: ${bodyFontSize};
19332
+ ${userSelectNone}
19333
+ position: relative;
19334
+ margin-inline-start: ${iconSize};
19335
+ }
19336
+
19337
+ ${
19338
+ /* this rule keeps children without an icon text aligned with parents */ ''}
19339
+ [part="start"] {
19340
+ width: ${iconSize};
19341
+ pointer-events: none;
19342
+ }
19343
+
19344
+ ${ /* the start class is applied when the corresponding slot is filled */''}
19345
+ .start {
19346
+ display: flex;
19347
+ margin-inline-start: ${iconSize};
19348
+ margin-inline-end: ${iconSize};
19349
+ }
19350
+
19351
+ slot[name='start']::slotted(*) {
19352
+ ${iconColor.cssCustomProperty}: currentcolor;
19353
+ width: ${iconSize};
19354
+ height: ${iconSize};
19355
+ }
19356
+
19357
+ .content {
19358
+ pointer-events: none;
19359
+ }
19360
+
19361
+ [part='end'] {
19362
+ display: none;
19363
+ }
19364
+ `;
19365
+
19366
+ const template$F = (context, definition) => html `
19367
+ <template
19368
+ role="treeitem"
19369
+ slot="${x => (x.isNestedItem() ? 'item' : null)}"
19370
+ tabindex="-1"
19371
+ aria-disabled="${x => x.disabled}"
19372
+ aria-selected="${x => x.selected}"
19373
+ @focusin="${(x, c) => x.handleFocus(c.event)}"
19374
+ @focusout="${(x, c) => x.handleBlur(c.event)}"
19375
+ @keydown="${(x, c) => x.keydownHandler(c.event)}"
19376
+ @click="${(x, c) => x.clickHandler(c.event)}"
19377
+ >
19378
+ <a
19379
+ class="control"
19380
+ part="control"
19381
+ tabindex="0"
19382
+ download="${x => x.download}"
19383
+ href=${x => (x.disabled ? null : x.href)}
19384
+ hreflang="${x => x.hreflang}"
19385
+ ping="${x => x.ping}"
19386
+ referrerpolicy="${x => x.referrerpolicy}"
19387
+ rel="${x => x.rel}"
19388
+ target="${x => x.target}"
19389
+ type="${x => x.type}"
19390
+ ${ref('control')}
19391
+ >
19392
+ <div class="positioning-region" part="positioning-region">
19393
+ <div class="content-region" part="content-region">
19394
+ ${startSlotTemplate(context, definition)}
19395
+ <span class="content" part="content">
19396
+ <slot></slot>
19397
+ </span>
19398
+ ${endSlotTemplate(context, definition)}
19399
+ </div>
19400
+ </div>
19401
+ </a>
19402
+ </template>
19403
+ `;
19404
+
19405
+ /**
19406
+ * A nimble-styled anchor tree item
19407
+ */
19408
+ class AnchorTreeItem extends AnchorBase {
19409
+ constructor() {
19410
+ super(...arguments);
19411
+ /**
19412
+ * When true, the control will appear selected by user interaction.
19413
+ * @public
19414
+ * @remarks
19415
+ * HTML Attribute: selected
19416
+ */
19417
+ this.selected = false;
19418
+ /**
19419
+ * When true, the control will be immutable by user interaction. See {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled | disabled HTML attribute} for more information.
19420
+ * @public
19421
+ * @remarks
19422
+ * HTML Attribute: disabled
19423
+ */
19424
+ this.disabled = false;
19425
+ }
19426
+ /**
19427
+ * Whether the tree is nested
19428
+ *
19429
+ * @public
19430
+ */
19431
+ isNestedItem() {
19432
+ return isTreeItemElement(this.parentElement);
19433
+ }
19434
+ /**
19435
+ * Handle focus events
19436
+ *
19437
+ * @internal
19438
+ */
19439
+ handleFocus(_e) {
19440
+ this.setAttribute('tabindex', '0');
19441
+ }
19442
+ /**
19443
+ * Handle blur events
19444
+ *
19445
+ * @internal
19446
+ */
19447
+ handleBlur(_e) {
19448
+ this.setAttribute('tabindex', '-1');
19449
+ }
19450
+ /**
19451
+ * @internal
19452
+ */
19453
+ keydownHandler(e) {
19454
+ if (e.defaultPrevented) {
19455
+ return false;
19456
+ }
19457
+ switch (e.key) {
19458
+ case keyEnter:
19459
+ // Do not let the event bubble up to the FAST tree, or it will
19460
+ // prevent the default action.
19461
+ e.stopPropagation();
19462
+ break;
19463
+ case keyArrowLeft:
19464
+ // For FAST tree items, the FAST tree view handles this navigation,
19465
+ // but since our anchor tree item is not "instanceof FASTTreeItem",
19466
+ // the FAST tree view won't do this for us. We do it ourselves.
19467
+ if (this.parentElement && this.isNestedItem()) {
19468
+ TreeItem$1.focusItem(this.parentElement);
19469
+ }
19470
+ break;
19471
+ }
19472
+ return true;
19473
+ }
19474
+ /**
19475
+ * Activating the anchor by pressing the Enter key results in a click event.
19476
+ * This bubbles up to the Nimble tree-view's click handler, causing the tree item
19477
+ * to be selected. We don't want that for anchor tree items. We'll stop propagation
19478
+ * of the event to prevent that.
19479
+ * @internal
19480
+ */
19481
+ clickHandler(e) {
19482
+ if (e.defaultPrevented) {
19483
+ return false;
19484
+ }
19485
+ e.stopPropagation();
19486
+ return true;
19487
+ }
19488
+ selectedChanged(_prev, _next) {
19489
+ if (this.$fastController.isConnected) {
19490
+ this.$emit('selected-change', this);
19491
+ }
19492
+ }
19493
+ }
19494
+ __decorate$1([
19495
+ attr({ mode: 'boolean' })
19496
+ ], AnchorTreeItem.prototype, "selected", void 0);
19497
+ __decorate$1([
19498
+ attr({ mode: 'boolean' })
19499
+ ], AnchorTreeItem.prototype, "disabled", void 0);
19500
+ // FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
19501
+ const nimbleAnchorTreeItem = AnchorTreeItem.compose({
19502
+ baseName: 'anchor-tree-item',
19503
+ template: template$F,
19504
+ styles: styles$U,
19505
+ shadowOptions: {
19506
+ delegatesFocus: true
19507
+ }
19508
+ });
19509
+ DesignSystem.getOrCreate()
19510
+ .withPrefix('nimble')
19511
+ .register(nimbleAnchorTreeItem());
19512
+
19513
+ const ZIndexLevels = {
19514
+ zIndex1: '1',
19515
+ // Original usages of 1000 were to compete with jqx grid usage of z-index 200 for table headers
19516
+ // See: https://github.com/ni/nimble/pull/530#discussion_r863076750
19517
+ zIndex1000: '1000'
19518
+ };
19519
+
19520
+ const styles$T = css `
19521
+ ${display$1('block')}
19522
+
19523
+ :host {
19524
+ contain: layout;
19525
+ z-index: ${ZIndexLevels.zIndex1000};
19526
+ }
19527
+
19528
+ ${'' /* Override 'display' helper hidden behavior */}
19529
+ :host([hidden]) {
19530
+ display: block;
19531
+ visibility: hidden;
19532
+ }
19533
+ `;
19534
+
19535
+ // When the anchor element changes position on the page, it is the client's responsibility to update the position
19536
+ // of the anchored region by calling update() on the anchored region.
19537
+ //
19538
+ // When the anchor element is recreated on the page, it is the client's responsibility to reset the reference the
19539
+ // anchored region has to the anchor element. This can be done by either recreating the anchor element with a new
19540
+ // ID that is also set as the \`anchor\` attribute on the anchored region or by explicitly setting the value of
19541
+ // anchorElement on the anchored region to the new anchor element.
19542
+ /**
19543
+ * A nimble-styled anchored region control.
19544
+ */
19545
+ class AnchoredRegion extends AnchoredRegion$1 {
19546
+ }
19547
+ const nimbleAnchoredRegion = AnchoredRegion.compose({
19548
+ baseName: 'anchored-region',
19549
+ baseClass: AnchoredRegion$1,
19550
+ template: anchoredRegionTemplate,
19551
+ styles: styles$T
19552
+ });
19553
+ DesignSystem.getOrCreate()
19554
+ .withPrefix('nimble')
19555
+ .register(nimbleAnchoredRegion());
19556
+ const anchoredRegionTag = 'nimble-anchored-region';
19557
+
19558
+ /**
19559
+ * Subscription for {@link ThemeStyleSheetBehavior}
19560
+ */
19561
+ class ThemeStyleSheetBehaviorSubscription {
19562
+ constructor(value, styles, source) {
19563
+ this.value = value;
19564
+ this.styles = styles;
19565
+ this.source = source;
19566
+ }
19567
+ handleChange() {
19568
+ const theme$1 = theme.getValueFor(this.source);
19569
+ if (Array.isArray(this.value)
19570
+ ? this.value.includes(theme$1)
19571
+ : this.value === theme$1) {
19572
+ this.source.$fastController.addStyles(this.styles);
19573
+ }
19574
+ else {
19575
+ this.source.$fastController.removeStyles(this.styles);
19576
+ }
19577
+ }
19578
+ }
19579
+ /**
19580
+ * Behavior to conditionally apply theme-based stylesheets.
19581
+ */
19582
+ class ThemeStyleSheetBehavior {
19583
+ constructor(theme, styles) {
19584
+ this.theme = theme;
19585
+ this.styles = styles;
19586
+ this.cache = new WeakMap();
19587
+ }
19588
+ /**
19589
+ * @internal
19590
+ */
19591
+ bind(source) {
19592
+ const subscriber = this.cache.get(source)
19593
+ || new ThemeStyleSheetBehaviorSubscription(this.theme, this.styles, source);
19594
+ // Currently subscriber from cache may have gone through unbind
19595
+ // but still be in cache so always resubscribe
19596
+ // See: https://github.com/microsoft/fast/issues/3246#issuecomment-1030424876
19597
+ theme.subscribe(subscriber, source);
19598
+ subscriber.handleChange();
19599
+ this.cache.set(source, subscriber);
19600
+ }
19601
+ /**
19602
+ * @internal
19603
+ */
19604
+ unbind(source) {
19605
+ const subscriber = this.cache.get(source);
19606
+ if (subscriber) {
19607
+ theme.unsubscribe(subscriber);
19608
+ }
19609
+ // Currently does not evict subscriber from cache
19610
+ // See: https://github.com/microsoft/fast/issues/3246#issuecomment-1030424876
19611
+ }
19612
+ }
19613
+ /**
19614
+ * Behavior to conditionally apply theme-based stylesheets. To determine which to apply,
19615
+ * the behavior will use the nearest ThemeProvider's 'theme' design system value.
19616
+ *
19617
+ * @public
19618
+ * @example
19619
+ * ```ts
19620
+ * css`
19621
+ * // ...
19622
+ * `.withBehaviors(
19623
+ * themeBehavior(Theme.light, css` ... `),
19624
+ * // Apply style for both dark and color theme
19625
+ * themeBehavior([Theme.dark, Theme.color], css` ... `)
19626
+ * )
19627
+ * ```
19628
+ */
19629
+ const themeBehavior = (theme, styles) => new ThemeStyleSheetBehavior(theme, styles);
19630
+ /* eslint-enable max-classes-per-file */
19521
19631
 
19522
19632
  const styles$S = css `
19523
- ${display$1('inline-flex')}
19633
+ ${display$1('flex')}
19524
19634
 
19525
19635
  :host {
19526
- align-items: center;
19527
- ${userSelectNone}
19528
- width: ${iconSize};
19529
- height: ${iconSize};
19636
+ font: ${bodyFont};
19637
+ font-size: 12.8px;
19638
+ align-items: top;
19639
+ overflow: hidden;
19640
+ overflow-wrap: anywhere;
19530
19641
  }
19531
19642
 
19532
- .icon {
19643
+ :host(:not([open])) {
19644
+ display: none;
19645
+ }
19646
+
19647
+ .container {
19648
+ color: ${bodyFontColor};
19649
+ display: flex;
19533
19650
  width: 100%;
19534
- height: 100%;
19535
19651
  }
19536
19652
 
19537
- :host([severity='error']) {
19538
- ${iconColor.cssCustomProperty}: ${failColor};
19653
+ .icon {
19654
+ width: 48px;
19655
+ display: flex;
19656
+ justify-content: center;
19657
+ margin-top: 8px;
19658
+ flex: 0 0 auto;
19659
+ opacity: 0.6;
19539
19660
  }
19540
19661
 
19541
- :host([severity='warning']) {
19542
- ${iconColor.cssCustomProperty}: ${warningColor};
19662
+ .text {
19663
+ display: inline;
19664
+ margin-top: 7px;
19665
+ margin-bottom: 7px;
19543
19666
  }
19544
19667
 
19545
- :host([severity='success']) {
19546
- ${iconColor.cssCustomProperty}: ${passColor};
19668
+ slot[name='title'] {
19669
+ display: inline;
19670
+ font-weight: bold;
19671
+ padding-right: 8px;
19547
19672
  }
19548
19673
 
19549
- :host([severity='information']) {
19550
- ${iconColor.cssCustomProperty}: ${informationColor};
19674
+ :host([title-hidden]) slot[name='title'] {
19675
+ ${accessiblyHidden}
19551
19676
  }
19552
19677
 
19553
- .icon svg {
19554
- fill: ${iconColor};
19555
- width: 100%;
19556
- height: 100%;
19678
+ .controls {
19679
+ height: ${controlHeight};
19680
+ margin-left: auto;
19681
+ display: flex;
19682
+ align-items: center;
19683
+ justify-content: center;
19684
+ align-self: flex-start;
19685
+ margin-top: ${smallPadding};
19686
+ ${controlHeight.cssCustomProperty}: ${controlSlimHeight};
19557
19687
  }
19558
- `;
19559
19688
 
19560
- /**
19561
- * The base class for icon components
19562
- */
19563
- class Icon extends FoundationElement {
19564
- constructor(/** @internal */ icon) {
19565
- super();
19566
- this.icon = icon;
19567
- }
19568
- }
19569
- __decorate$1([
19570
- attr
19571
- ], Icon.prototype, "severity", void 0);
19572
- const registerIcon = (baseName, iconClass) => {
19573
- const composedIcon = iconClass.compose({
19574
- baseName,
19575
- template: template$F,
19576
- styles: styles$S
19577
- });
19578
- DesignSystem.getOrCreate().withPrefix('nimble').register(composedIcon());
19579
- };
19689
+ slot[name='action'] {
19690
+ display: flex;
19691
+ align-content: center;
19692
+ margin-left: ${standardPadding};
19693
+ white-space: nowrap;
19694
+ }
19695
+
19696
+ slot[name='action']::slotted(nimble-anchor) {
19697
+ font-size: 12.8px;
19698
+ }
19699
+
19700
+ .dismiss {
19701
+ width: 48px;
19702
+ display: flex;
19703
+ justify-content: center;
19704
+ }
19705
+ `.withBehaviors(themeBehavior(Theme.light, css `
19706
+ :host {
19707
+ background: ${Black75};
19708
+ }
19709
+
19710
+ :host([severity='error']) {
19711
+ background: ${Fail100LightUi};
19712
+ }
19713
+
19714
+ :host([severity='warning']) {
19715
+ background: ${Warning100LightUi};
19716
+ }
19717
+
19718
+ :host([severity='information']) {
19719
+ background: ${Information100LightUi};
19720
+ }
19721
+ `), themeBehavior(Theme.dark, css `
19722
+ :host {
19723
+ background: ${Black75};
19724
+ }
19725
+
19726
+ :host([severity='error']) {
19727
+ background: ${BannerFail100DarkUi};
19728
+ }
19729
+
19730
+ :host([severity='warning']) {
19731
+ background: ${Warning100DarkUi};
19732
+ }
19733
+
19734
+ :host([severity='information']) {
19735
+ background: ${Information100DarkUi};
19736
+ }
19737
+ `), themeBehavior(Theme.color, css `
19738
+ :host {
19739
+ background: ${applicationBackgroundColor};
19740
+ }
19741
+
19742
+ .container {
19743
+ background: ${hexToRgbaCssColor(White, 0.3)};
19744
+ }
19745
+ `));
19580
19746
 
19581
19747
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
19582
19748
  // See generation source in nimble-components/build/generate-icons
@@ -19641,55 +19807,6 @@
19641
19807
  information: 'information'
19642
19808
  };
19643
19809
 
19644
- const coreLabelDefaults = {
19645
- popupDismissLabel: 'Close',
19646
- numericIncrementLabel: 'Increment',
19647
- numericDecrementLabel: 'Decrement',
19648
- popupIconErrorLabel: 'Error',
19649
- popupIconWarningLabel: 'Warning',
19650
- popupIconInformationLabel: 'Information',
19651
- filterSearchLabel: 'Search',
19652
- filterNoResultsLabel: 'No items found',
19653
- loadingLabel: 'Loading…'
19654
- };
19655
-
19656
- const popupDismissLabel = DesignToken.create({
19657
- name: 'popup-dismiss-label',
19658
- cssCustomPropertyName: null
19659
- }).withDefault(coreLabelDefaults.popupDismissLabel);
19660
- const numericDecrementLabel = DesignToken.create({
19661
- name: 'numeric-decrement-label',
19662
- cssCustomPropertyName: null
19663
- }).withDefault(coreLabelDefaults.numericDecrementLabel);
19664
- const numericIncrementLabel = DesignToken.create({
19665
- name: 'numeric-increment-label',
19666
- cssCustomPropertyName: null
19667
- }).withDefault(coreLabelDefaults.numericIncrementLabel);
19668
- const popupIconErrorLabel = DesignToken.create({
19669
- name: 'popup-icon-error-label',
19670
- cssCustomPropertyName: null
19671
- }).withDefault(coreLabelDefaults.popupIconErrorLabel);
19672
- const popupIconWarningLabel = DesignToken.create({
19673
- name: 'popup-icon-warning-label',
19674
- cssCustomPropertyName: null
19675
- }).withDefault(coreLabelDefaults.popupIconWarningLabel);
19676
- const popupIconInformationLabel = DesignToken.create({
19677
- name: 'popup-icon-information-label',
19678
- cssCustomPropertyName: null
19679
- }).withDefault(coreLabelDefaults.popupIconInformationLabel);
19680
- const filterSearchLabel = DesignToken.create({
19681
- name: 'filter-search-label',
19682
- cssCustomPropertyName: null
19683
- }).withDefault(coreLabelDefaults.filterSearchLabel);
19684
- const filterNoResultsLabel = DesignToken.create({
19685
- name: 'filter-no-results-label',
19686
- cssCustomPropertyName: null
19687
- }).withDefault(coreLabelDefaults.filterNoResultsLabel);
19688
- const loadingLabel = DesignToken.create({
19689
- name: 'loading-label',
19690
- cssCustomPropertyName: null
19691
- }).withDefault(coreLabelDefaults.loadingLabel);
19692
-
19693
19810
  // prettier-ignore
19694
19811
  const template$E = html `
19695
19812
  <${themeProviderTag} theme="${Theme.color}">
@@ -19810,7 +19927,7 @@
19810
19927
  const nimbleBanner = Banner.compose({
19811
19928
  baseName: 'banner',
19812
19929
  template: template$E,
19813
- styles: styles$U
19930
+ styles: styles$S
19814
19931
  });
19815
19932
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleBanner());
19816
19933
 
@@ -22363,31 +22480,6 @@ so this becomes the fallback color for the slot */ ''}
22363
22480
  }
22364
22481
  registerIcon('icon-arrow-down-right-and-arrow-up-left', IconArrowDownRightAndArrowUpLeft);
22365
22482
 
22366
- // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22367
- // See generation source in nimble-components/build/generate-icons
22368
- /**
22369
- * The icon component for the 'arrowExpanderLeft' icon
22370
- */
22371
- class IconArrowExpanderLeft extends Icon {
22372
- constructor() {
22373
- super(arrowExpanderLeft16X16);
22374
- }
22375
- }
22376
- registerIcon('icon-arrow-expander-left', IconArrowExpanderLeft);
22377
-
22378
- // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22379
- // See generation source in nimble-components/build/generate-icons
22380
- /**
22381
- * The icon component for the 'arrowExpanderRight' icon
22382
- */
22383
- class IconArrowExpanderRight extends Icon {
22384
- constructor() {
22385
- super(arrowExpanderRight16X16);
22386
- }
22387
- }
22388
- registerIcon('icon-arrow-expander-right', IconArrowExpanderRight);
22389
- const iconArrowExpanderRightTag = 'nimble-icon-arrow-expander-right';
22390
-
22391
22483
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22392
22484
  // See generation source in nimble-components/build/generate-icons
22393
22485
  /**
@@ -24708,7 +24800,9 @@ so this becomes the fallback color for the slot */ ''}
24708
24800
  popupIconInformation: popupIconInformationLabel,
24709
24801
  filterSearch: filterSearchLabel,
24710
24802
  filterNoResults: filterNoResultsLabel,
24711
- loading: loadingLabel
24803
+ loading: loadingLabel,
24804
+ scrollBackward: scrollBackwardLabel,
24805
+ scrollForward: scrollForwardLabel
24712
24806
  };
24713
24807
  /**
24714
24808
  * Core label provider for Nimble
@@ -24746,6 +24840,12 @@ so this becomes the fallback color for the slot */ ''}
24746
24840
  __decorate$1([
24747
24841
  attr({ attribute: 'loading' })
24748
24842
  ], LabelProviderCore.prototype, "loading", void 0);
24843
+ __decorate$1([
24844
+ attr({ attribute: 'scroll-backward' })
24845
+ ], LabelProviderCore.prototype, "scrollBackward", void 0);
24846
+ __decorate$1([
24847
+ attr({ attribute: 'scroll-forward' })
24848
+ ], LabelProviderCore.prototype, "scrollForward", void 0);
24749
24849
  const nimbleLabelProviderCore = LabelProviderCore.compose({
24750
24850
  baseName: 'label-provider-core',
24751
24851
  styles: styles$G
@@ -28724,7 +28824,7 @@ so this becomes the fallback color for the slot */ ''}
28724
28824
  let result = [];
28725
28825
  for (let typeName in types) {
28726
28826
  let type = types[typeName];
28727
- if (type.groups.indexOf(name) > -1)
28827
+ if (type.isInGroup(name))
28728
28828
  result.push(type);
28729
28829
  }
28730
28830
  if (result.length == 0)
@@ -29003,6 +29103,13 @@ so this becomes the fallback color for the slot */ ''}
29003
29103
  */
29004
29104
  get isAtom() { return this.isLeaf || !!this.spec.atom; }
29005
29105
  /**
29106
+ Return true when this node type is part of the given
29107
+ [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).
29108
+ */
29109
+ isInGroup(group) {
29110
+ return this.groups.indexOf(group) > -1;
29111
+ }
29112
+ /**
29006
29113
  The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.
29007
29114
  */
29008
29115
  get whitespace() {
@@ -29835,6 +29942,7 @@ so this becomes the fallback color for the slot */ ''}
29835
29942
  contentDOM = rule.contentElement;
29836
29943
  this.findAround(dom, contentDOM, true);
29837
29944
  this.addAll(contentDOM, marks);
29945
+ this.findAround(dom, contentDOM, false);
29838
29946
  }
29839
29947
  if (sync && this.sync(startIn))
29840
29948
  this.open--;
@@ -30013,7 +30121,7 @@ so this becomes the fallback color for the slot */ ''}
30013
30121
  let next = depth > 0 || (depth == 0 && useRoot) ? this.nodes[depth].type
30014
30122
  : option && depth >= minDepth ? option.node(depth - minDepth).type
30015
30123
  : null;
30016
- if (!next || (next.name != part && next.groups.indexOf(part) == -1))
30124
+ if (!next || (next.name != part && !next.isInGroup(part)))
30017
30125
  return false;
30018
30126
  depth--;
30019
30127
  }
@@ -41778,12 +41886,16 @@ so this becomes the fallback color for the slot */ ''}
41778
41886
  return;
41779
41887
  }
41780
41888
  let start = $pos.parent.childAfter($pos.parentOffset);
41781
- if ($pos.parentOffset === start.offset && start.offset !== 0) {
41889
+ // If the cursor is at the start of a text node that does not have the mark, look backward
41890
+ if (!start.node || !start.node.marks.some(mark => mark.type === type)) {
41782
41891
  start = $pos.parent.childBefore($pos.parentOffset);
41783
41892
  }
41784
- if (!start.node) {
41893
+ // If there is no text node with the mark even backward, return undefined
41894
+ if (!start.node || !start.node.marks.some(mark => mark.type === type)) {
41785
41895
  return;
41786
41896
  }
41897
+ // We now know that the cursor is either at the start, middle or end of a text node with the specified mark
41898
+ // so we can look it up on the targeted mark
41787
41899
  const mark = findMarkInSet([...start.node.marks], type, attributes);
41788
41900
  if (!mark) {
41789
41901
  return;
@@ -42073,7 +42185,7 @@ so this becomes the fallback color for the slot */ ''}
42073
42185
  var _a;
42074
42186
  if (dispatch) {
42075
42187
  options = {
42076
- parseOptions: {},
42188
+ parseOptions: editor.options.parseOptions,
42077
42189
  updateSelection: true,
42078
42190
  applyInputRules: false,
42079
42191
  applyPasteRules: false,
@@ -42094,7 +42206,9 @@ so this becomes the fallback color for the slot */ ''}
42094
42206
  editor,
42095
42207
  error: e,
42096
42208
  disableCollaboration: () => {
42097
- console.error('[tiptap error]: Unable to disable collaboration at this point in time');
42209
+ if (editor.storage.collaboration) {
42210
+ editor.storage.collaboration.isDisabled = true;
42211
+ }
42098
42212
  },
42099
42213
  });
42100
42214
  return false;
@@ -43868,7 +43982,8 @@ so this becomes the fallback color for the slot */ ''}
43868
43982
  const children = [];
43869
43983
  this.node.content.forEach((node, offset) => {
43870
43984
  const isBlock = node.isBlock && !node.isTextblock;
43871
- const targetPos = this.pos + offset + 1;
43985
+ const isNonTextAtom = node.isAtom && !node.isText;
43986
+ const targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);
43872
43987
  const $pos = this.resolvedPos.doc.resolve(targetPos);
43873
43988
  if (!isBlock && $pos.depth <= this.depth) {
43874
43989
  return;
@@ -43944,9 +44059,12 @@ so this becomes the fallback color for the slot */ ''}
43944
44059
  return nodes;
43945
44060
  }
43946
44061
  setAttribute(attributes) {
43947
- const oldSelection = this.editor.state.selection;
43948
- this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name, attributes).setTextSelection(oldSelection.from)
43949
- .run();
44062
+ const { tr } = this.editor.state;
44063
+ tr.setNodeMarkup(this.from, undefined, {
44064
+ ...this.node.attrs,
44065
+ ...attributes,
44066
+ });
44067
+ this.editor.view.dispatch(tr);
43950
44068
  }
43951
44069
  }
43952
44070
 
@@ -44198,18 +44316,27 @@ img.ProseMirror-separator {
44198
44316
  /**
44199
44317
  * Unregister a ProseMirror plugin.
44200
44318
  *
44201
- * @param nameOrPluginKey The plugins name
44319
+ * @param nameOrPluginKeyToRemove The plugins name
44202
44320
  * @returns The new editor state or undefined if the editor is destroyed
44203
44321
  */
44204
- unregisterPlugin(nameOrPluginKey) {
44322
+ unregisterPlugin(nameOrPluginKeyToRemove) {
44205
44323
  if (this.isDestroyed) {
44206
44324
  return undefined;
44207
44325
  }
44208
- // @ts-ignore
44209
- const name = typeof nameOrPluginKey === 'string' ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
44210
- const state = this.state.reconfigure({
44326
+ const prevPlugins = this.state.plugins;
44327
+ let plugins = prevPlugins;
44328
+ [].concat(nameOrPluginKeyToRemove).forEach(nameOrPluginKey => {
44329
+ // @ts-ignore
44330
+ const name = typeof nameOrPluginKey === 'string' ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
44211
44331
  // @ts-ignore
44212
- plugins: this.state.plugins.filter(plugin => !plugin.key.startsWith(name)),
44332
+ plugins = prevPlugins.filter(plugin => !plugin.key.startsWith(name));
44333
+ });
44334
+ if (prevPlugins.length === plugins.length) {
44335
+ // No plugin was removed, so we don’t need to update the state
44336
+ return undefined;
44337
+ }
44338
+ const state = this.state.reconfigure({
44339
+ plugins,
44213
44340
  });
44214
44341
  this.view.updateState(state);
44215
44342
  return state;
@@ -44272,6 +44399,9 @@ img.ProseMirror-separator {
44272
44399
  editor: this,
44273
44400
  error: e,
44274
44401
  disableCollaboration: () => {
44402
+ if (this.storage.collaboration) {
44403
+ this.storage.collaboration.isDisabled = true;
44404
+ }
44275
44405
  // To avoid syncing back invalid content, reinitialize the extensions without the collaboration extension
44276
44406
  this.options.extensions = this.options.extensions.filter(extension => extension.name !== 'collaboration');
44277
44407
  // Restart the initialization process by recreating the extension manager with the new set of extensions
@@ -44290,6 +44420,12 @@ img.ProseMirror-separator {
44290
44420
  selection: selection || undefined,
44291
44421
  }),
44292
44422
  });
44423
+ // add `role="textbox"` to the editor element
44424
+ this.view.dom.setAttribute('role', 'textbox');
44425
+ // add aria-label to the editor element
44426
+ if (!this.view.dom.getAttribute('aria-label')) {
44427
+ this.view.dom.setAttribute('aria-label', 'Rich-Text Editor');
44428
+ }
44293
44429
  // `editor.view` is not yet available at this time.
44294
44430
  // Therefore we will add all plugins and node views directly afterwards.
44295
44431
  const newState = this.state.reconfigure({
@@ -55422,6 +55558,10 @@ img.ProseMirror-separator {
55422
55558
  tag: 'b',
55423
55559
  getAttrs: node => node.style.fontWeight !== 'normal' && null,
55424
55560
  },
55561
+ {
55562
+ style: 'font-weight=400',
55563
+ clearMark: mark => mark.type.name === this.name,
55564
+ },
55425
55565
  {
55426
55566
  style: 'font-weight',
55427
55567
  getAttrs: value => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null,
@@ -56327,6 +56467,10 @@ img.ProseMirror-separator {
56327
56467
  tag: 'i',
56328
56468
  getAttrs: node => node.style.fontStyle !== 'normal' && null,
56329
56469
  },
56470
+ {
56471
+ style: 'font-style=normal',
56472
+ clearMark: mark => mark.type.name === this.name,
56473
+ },
56330
56474
  {
56331
56475
  style: 'font-style=italic',
56332
56476
  },
@@ -58712,6 +58856,7 @@ img.ProseMirror-separator {
58712
58856
  */
58713
58857
  const Mention = Node$1.create({
58714
58858
  name: 'mention',
58859
+ priority: 101,
58715
58860
  addOptions() {
58716
58861
  return {
58717
58862
  HTMLAttributes: {},
@@ -61891,6 +62036,7 @@ img.ProseMirror-separator {
61891
62036
  align-items: center;
61892
62037
  justify-content: center;
61893
62038
  cursor: pointer;
62039
+ text-wrap: nowrap;
61894
62040
  --ni-private-active-indicator-width: 2px;
61895
62041
  --ni-private-focus-indicator-width: 1px;
61896
62042
  --ni-private-indicator-lines-gap: 1px;
@@ -73749,29 +73895,9 @@ focus outline in that case.
73749
73895
  .register(nimbleTableColumnText());
73750
73896
 
73751
73897
  const styles$9 = css `
73752
- ${display$1('grid')}
73753
-
73754
- :host {
73755
- grid-template-columns: auto 1fr;
73756
- grid-template-rows: auto 1fr;
73757
- }
73758
-
73759
- [part='start'] {
73760
- display: none;
73761
- }
73762
-
73763
- .tablist {
73764
- display: grid;
73765
- grid-template-rows: auto auto;
73766
- grid-template-columns: auto;
73767
- width: max-content;
73768
- align-self: end;
73769
- }
73898
+ ${styles$X}
73770
73899
 
73771
73900
  .tabpanel {
73772
- grid-row: 2;
73773
- grid-column-start: 1;
73774
- grid-column-end: 4;
73775
73901
  overflow: auto;
73776
73902
  }
73777
73903
  `;
@@ -73782,14 +73908,75 @@ focus outline in that case.
73782
73908
  class Tabs extends Tabs$1 {
73783
73909
  constructor() {
73784
73910
  super();
73911
+ /**
73912
+ * @internal
73913
+ */
73914
+ this.showScrollButtons = false;
73915
+ /**
73916
+ * @internal
73917
+ */
73918
+ this.tabSlotName = 'tab';
73785
73919
  // We disable the built-in active indicator so that we can implement our own
73786
73920
  this.activeindicator = false;
73921
+ this.tabListResizeObserver = new ResizeObserver(entries => {
73922
+ let tabListVisibleWidth = entries[0]?.contentRect.width;
73923
+ if (tabListVisibleWidth !== undefined) {
73924
+ const buttonWidth = this.leftScrollButton?.clientWidth ?? 0;
73925
+ tabListVisibleWidth = Math.ceil(tabListVisibleWidth);
73926
+ if (this.showScrollButtons) {
73927
+ tabListVisibleWidth += buttonWidth * 2;
73928
+ }
73929
+ this.showScrollButtons = tabListVisibleWidth < this.tablist.scrollWidth;
73930
+ }
73931
+ });
73932
+ }
73933
+ /**
73934
+ * @internal
73935
+ */
73936
+ connectedCallback() {
73937
+ super.connectedCallback();
73938
+ this.tabListResizeObserver.observe(this.tablist);
73939
+ }
73940
+ /**
73941
+ * @internal
73942
+ */
73943
+ disconnectedCallback() {
73944
+ super.disconnectedCallback();
73945
+ this.tabListResizeObserver.disconnect();
73946
+ }
73947
+ /**
73948
+ * @internal
73949
+ */
73950
+ activeidChanged(oldValue, newValue) {
73951
+ super.activeidChanged(oldValue, newValue);
73952
+ this.activetab?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
73953
+ }
73954
+ /**
73955
+ * @internal
73956
+ */
73957
+ onScrollLeftClick() {
73958
+ this.tablist.scrollBy({
73959
+ left: -this.tablist.clientWidth,
73960
+ behavior: 'smooth'
73961
+ });
73962
+ }
73963
+ /**
73964
+ * @internal
73965
+ */
73966
+ onScrollRightClick() {
73967
+ this.tablist.scrollBy({
73968
+ left: this.tablist.clientWidth,
73969
+ behavior: 'smooth'
73970
+ });
73787
73971
  }
73788
73972
  }
73973
+ __decorate$1([
73974
+ observable
73975
+ ], Tabs.prototype, "showScrollButtons", void 0);
73789
73976
  const nimbleTabs = Tabs.compose({
73790
73977
  baseName: 'tabs',
73791
73978
  baseClass: Tabs$1,
73792
- template: tabsTemplate,
73979
+ template: template$G,
73793
73980
  styles: styles$9
73794
73981
  });
73795
73982
  DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTabs());