@ni/nimble-components 32.4.0 → 32.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/all-components-bundle.js +1142 -955
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +3731 -3707
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/anchor-tab/styles.js +1 -0
  6. package/dist/esm/anchor-tab/styles.js.map +1 -1
  7. package/dist/esm/anchor-tabs/index.d.ts +28 -1
  8. package/dist/esm/anchor-tabs/index.js +56 -3
  9. package/dist/esm/anchor-tabs/index.js.map +1 -1
  10. package/dist/esm/anchor-tabs/testing/anchor-tabs.pageobject.d.ts +9 -0
  11. package/dist/esm/anchor-tabs/testing/anchor-tabs.pageobject.js +12 -0
  12. package/dist/esm/anchor-tabs/testing/anchor-tabs.pageobject.js.map +1 -0
  13. package/dist/esm/label-provider/core/index.d.ts +6 -0
  14. package/dist/esm/label-provider/core/index.js +10 -2
  15. package/dist/esm/label-provider/core/index.js.map +1 -1
  16. package/dist/esm/label-provider/core/label-token-defaults.js +3 -1
  17. package/dist/esm/label-provider/core/label-token-defaults.js.map +1 -1
  18. package/dist/esm/label-provider/core/label-tokens.d.ts +2 -0
  19. package/dist/esm/label-provider/core/label-tokens.js +8 -0
  20. package/dist/esm/label-provider/core/label-tokens.js.map +1 -1
  21. package/dist/esm/patterns/tabs/styles.js +35 -0
  22. package/dist/esm/patterns/tabs/styles.js.map +1 -0
  23. package/dist/esm/patterns/tabs/template.d.ts +4 -0
  24. package/dist/esm/patterns/tabs/template.js +56 -0
  25. package/dist/esm/patterns/tabs/template.js.map +1 -0
  26. package/dist/esm/patterns/tabs/testing/tabs-base.pageobject.d.ts +21 -0
  27. package/dist/esm/patterns/tabs/testing/tabs-base.pageobject.js +92 -0
  28. package/dist/esm/patterns/tabs/testing/tabs-base.pageobject.js.map +1 -0
  29. package/dist/esm/patterns/tabs/types.d.ts +9 -0
  30. package/dist/esm/patterns/tabs/types.js +2 -0
  31. package/dist/esm/patterns/tabs/types.js.map +1 -0
  32. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js +2 -1
  33. package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js.map +1 -1
  34. package/dist/esm/tab/styles.js +1 -0
  35. package/dist/esm/tab/styles.js.map +1 -1
  36. package/dist/esm/table/testing/table.pageobject.d.ts +4 -4
  37. package/dist/esm/table/testing/table.pageobject.js +24 -17
  38. package/dist/esm/table/testing/table.pageobject.js.map +1 -1
  39. package/dist/esm/tabs/index.d.ts +39 -1
  40. package/dist/esm/tabs/index.js +65 -1
  41. package/dist/esm/tabs/index.js.map +1 -1
  42. package/dist/esm/tabs/styles.js +2 -22
  43. package/dist/esm/tabs/styles.js.map +1 -1
  44. package/dist/esm/tabs/testing/tabs.pageobject.d.ts +9 -0
  45. package/dist/esm/tabs/testing/tabs.pageobject.js +13 -0
  46. package/dist/esm/tabs/testing/tabs.pageobject.js.map +1 -0
  47. package/dist/esm/utilities/testing/component.d.ts +4 -0
  48. package/dist/esm/utilities/testing/component.js +8 -0
  49. package/dist/esm/utilities/testing/component.js.map +1 -1
  50. package/package.json +1 -1
  51. package/dist/esm/anchor-tabs/styles.js +0 -23
  52. package/dist/esm/anchor-tabs/styles.js.map +0 -1
  53. package/dist/esm/anchor-tabs/template.d.ts +0 -4
  54. package/dist/esm/anchor-tabs/template.js +0 -10
  55. package/dist/esm/anchor-tabs/template.js.map +0 -1
  56. /package/dist/esm/{anchor-tabs → patterns/tabs}/styles.d.ts +0 -0
@@ -13,6 +13,7 @@ export const styles = css `
13
13
  align-items: center;
14
14
  justify-content: center;
15
15
  cursor: pointer;
16
+ text-wrap: nowrap;
16
17
  --ni-private-active-indicator-width: 2px;
17
18
  --ni-private-focus-indicator-width: 1px;
18
19
  --ni-private-indicator-lines-gap: 1px;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/anchor-tab/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACH,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,eAAe,EAClB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,aAAa,CAAC;;;;gBAIZ,eAAe;kBACb,aAAa;iBACd,aAAa;;;;;;;;;;;4BAWF,cAAc;;;;4BAId,sBAAsB;;;;;;;;;iBASjC,qBAAqB;;;;;;;mBAOnB,aAAa,IAAI,eAAe;mBAChC,aAAa,MAAM,WAAW;;;;;;;;;;;;yBAYxB,gBAAgB;;4BAEb,UAAU;;;;;;;;;OAS/B,YAAY;;;;;;;;;;;;;;;;;;;;yBAoBM,gBAAgB;;4BAEb,UAAU;;;;;;;;;OAS/B,YAAY;;;;;;;;;;;oCAWiB,gBAAgB;;;;;;;;;;CAUnD,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '../utilities/style/display';\nimport { focusVisible } from '../utilities/style/focus';\nimport {\n bodyDisabledFontColor,\n bodyFontColor,\n borderHoverColor,\n borderWidth,\n buttonLabelFont,\n controlHeight,\n fillHoverColor,\n fillHoverSelectedColor,\n smallDelay,\n mediumPadding,\n standardPadding\n} from '../theme-provider/design-tokens';\n\nexport const styles = css`\n ${display('inline-flex')}\n\n :host {\n position: relative;\n font: ${buttonLabelFont};\n height: ${controlHeight};\n color: ${bodyFontColor};\n align-items: center;\n justify-content: center;\n cursor: pointer;\n --ni-private-active-indicator-width: 2px;\n --ni-private-focus-indicator-width: 1px;\n --ni-private-indicator-lines-gap: 1px;\n --ni-private-focus-indicator-inset-width: 3px;\n }\n\n :host(:hover) {\n background-color: ${fillHoverColor};\n }\n\n :host(:hover[aria-current]) {\n background-color: ${fillHoverSelectedColor};\n }\n\n :host(:active) {\n background: none;\n }\n\n :host([disabled]) {\n cursor: default;\n color: ${bodyDisabledFontColor};\n background: none;\n }\n\n slot:not([name]) {\n pointer-events: none;\n display: block;\n padding: ${mediumPadding} ${standardPadding}\n calc(${mediumPadding} - ${borderWidth});\n }\n\n a::before {\n content: '';\n position: absolute;\n bottom: calc(\n var(--ni-private-active-indicator-width) +\n var(--ni-private-indicator-lines-gap)\n );\n width: 0px;\n height: 0px;\n border-bottom: ${borderHoverColor}\n var(--ni-private-focus-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n @media (prefers-reduced-motion) {\n a::before {\n transition-duration: 0s;\n }\n }\n\n a${focusVisible}::before {\n width: calc(100% - 2 * var(--ni-private-focus-indicator-inset-width));\n }\n\n a {\n display: inline-flex;\n text-decoration: none;\n color: inherit;\n cursor: inherit;\n outline: none;\n align-items: center;\n justify-content: center;\n }\n\n a::after {\n content: '';\n position: absolute;\n bottom: 0px;\n width: 0px;\n height: 0px;\n border-bottom: ${borderHoverColor}\n var(--ni-private-active-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n @media (prefers-reduced-motion) {\n a::after {\n transition-duration: 0s;\n }\n }\n\n a${focusVisible}::after {\n width: 100%;\n border-bottom-width: var(--ni-private-focus-indicator-width);\n }\n\n :host([aria-current]) a::after {\n width: 100%;\n border-bottom-width: var(--ni-private-active-indicator-width);\n }\n\n :host([disabled][aria-current]) a::after {\n border-bottom-color: rgba(${borderHoverColor}, 0.3);\n }\n\n [part='start'] {\n display: none;\n }\n\n [part='end'] {\n display: none;\n }\n`;\n"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/anchor-tab/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EACH,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,eAAe,EAClB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,aAAa,CAAC;;;;gBAIZ,eAAe;kBACb,aAAa;iBACd,aAAa;;;;;;;;;;;;4BAYF,cAAc;;;;4BAId,sBAAsB;;;;;;;;;iBASjC,qBAAqB;;;;;;;mBAOnB,aAAa,IAAI,eAAe;mBAChC,aAAa,MAAM,WAAW;;;;;;;;;;;;yBAYxB,gBAAgB;;4BAEb,UAAU;;;;;;;;;OAS/B,YAAY;;;;;;;;;;;;;;;;;;;;yBAoBM,gBAAgB;;4BAEb,UAAU;;;;;;;;;OAS/B,YAAY;;;;;;;;;;;oCAWiB,gBAAgB;;;;;;;;;;CAUnD,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '../utilities/style/display';\nimport { focusVisible } from '../utilities/style/focus';\nimport {\n bodyDisabledFontColor,\n bodyFontColor,\n borderHoverColor,\n borderWidth,\n buttonLabelFont,\n controlHeight,\n fillHoverColor,\n fillHoverSelectedColor,\n smallDelay,\n mediumPadding,\n standardPadding\n} from '../theme-provider/design-tokens';\n\nexport const styles = css`\n ${display('inline-flex')}\n\n :host {\n position: relative;\n font: ${buttonLabelFont};\n height: ${controlHeight};\n color: ${bodyFontColor};\n align-items: center;\n justify-content: center;\n cursor: pointer;\n text-wrap: nowrap;\n --ni-private-active-indicator-width: 2px;\n --ni-private-focus-indicator-width: 1px;\n --ni-private-indicator-lines-gap: 1px;\n --ni-private-focus-indicator-inset-width: 3px;\n }\n\n :host(:hover) {\n background-color: ${fillHoverColor};\n }\n\n :host(:hover[aria-current]) {\n background-color: ${fillHoverSelectedColor};\n }\n\n :host(:active) {\n background: none;\n }\n\n :host([disabled]) {\n cursor: default;\n color: ${bodyDisabledFontColor};\n background: none;\n }\n\n slot:not([name]) {\n pointer-events: none;\n display: block;\n padding: ${mediumPadding} ${standardPadding}\n calc(${mediumPadding} - ${borderWidth});\n }\n\n a::before {\n content: '';\n position: absolute;\n bottom: calc(\n var(--ni-private-active-indicator-width) +\n var(--ni-private-indicator-lines-gap)\n );\n width: 0px;\n height: 0px;\n border-bottom: ${borderHoverColor}\n var(--ni-private-focus-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n @media (prefers-reduced-motion) {\n a::before {\n transition-duration: 0s;\n }\n }\n\n a${focusVisible}::before {\n width: calc(100% - 2 * var(--ni-private-focus-indicator-inset-width));\n }\n\n a {\n display: inline-flex;\n text-decoration: none;\n color: inherit;\n cursor: inherit;\n outline: none;\n align-items: center;\n justify-content: center;\n }\n\n a::after {\n content: '';\n position: absolute;\n bottom: 0px;\n width: 0px;\n height: 0px;\n border-bottom: ${borderHoverColor}\n var(--ni-private-active-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n @media (prefers-reduced-motion) {\n a::after {\n transition-duration: 0s;\n }\n }\n\n a${focusVisible}::after {\n width: 100%;\n border-bottom-width: var(--ni-private-focus-indicator-width);\n }\n\n :host([aria-current]) a::after {\n width: 100%;\n border-bottom-width: var(--ni-private-active-indicator-width);\n }\n\n :host([disabled][aria-current]) a::after {\n border-bottom-color: rgba(${borderHoverColor}, 0.3);\n }\n\n [part='start'] {\n display: none;\n }\n\n [part='end'] {\n display: none;\n }\n`;\n"]}
@@ -1,4 +1,5 @@
1
1
  import { StartEndOptions, FoundationElementDefinition, FoundationElement } from '@microsoft/fast-foundation';
2
+ import type { TabsOwner } from '../patterns/tabs/types';
2
3
  declare global {
3
4
  interface HTMLElementTagNameMap {
4
5
  'nimble-anchor-tabs': AnchorTabs;
@@ -8,7 +9,7 @@ export type TabsOptions = FoundationElementDefinition & StartEndOptions;
8
9
  /**
9
10
  * A nimble-styled set of anchor tabs
10
11
  */
11
- export declare class AnchorTabs extends FoundationElement {
12
+ export declare class AnchorTabs extends FoundationElement implements TabsOwner {
12
13
  /**
13
14
  * The id of the active tab
14
15
  *
@@ -21,6 +22,10 @@ export declare class AnchorTabs extends FoundationElement {
21
22
  * @internal
22
23
  */
23
24
  tabs: HTMLElement[];
25
+ /**
26
+ * @internal
27
+ */
28
+ showScrollButtons: boolean;
24
29
  /**
25
30
  * A reference to the active tab
26
31
  * @public
@@ -31,7 +36,17 @@ export declare class AnchorTabs extends FoundationElement {
31
36
  * @internal
32
37
  */
33
38
  tablist: HTMLElement;
39
+ /**
40
+ * @internal
41
+ */
42
+ readonly leftScrollButton?: HTMLElement;
43
+ /**
44
+ * @internal
45
+ */
46
+ readonly tabSlotName = "anchortab";
47
+ private readonly tabListResizeObserver;
34
48
  private tabIds;
49
+ constructor();
35
50
  /**
36
51
  * @internal
37
52
  */
@@ -40,10 +55,22 @@ export declare class AnchorTabs extends FoundationElement {
40
55
  * @internal
41
56
  */
42
57
  tabsChanged(): void;
58
+ /**
59
+ * @internal
60
+ */
61
+ onScrollLeftClick(): void;
62
+ /**
63
+ * @internal
64
+ */
65
+ onScrollRightClick(): void;
43
66
  /**
44
67
  * @internal
45
68
  */
46
69
  connectedCallback(): void;
70
+ /**
71
+ * @internal
72
+ */
73
+ disconnectedCallback(): void;
47
74
  private readonly isDisabledElement;
48
75
  private readonly isHiddenElement;
49
76
  private readonly isFocusableElement;
@@ -12,14 +12,22 @@ import { __decorate } from "tslib";
12
12
  import { attr, observable } from '@microsoft/fast-element';
13
13
  import { keyArrowLeft, keyArrowRight, keyEnd, keyEnter, keyHome, keySpace, uniqueId } from '@microsoft/fast-web-utilities';
14
14
  import { DesignSystem, StartEnd, applyMixins, FoundationElement } from '@microsoft/fast-foundation';
15
- import { styles } from './styles';
16
- import { template } from './template';
15
+ import { styles } from '../patterns/tabs/styles';
16
+ import { template } from '../patterns/tabs/template';
17
17
  /**
18
18
  * A nimble-styled set of anchor tabs
19
19
  */
20
20
  export class AnchorTabs extends FoundationElement {
21
21
  constructor() {
22
- super(...arguments);
22
+ super();
23
+ /**
24
+ * @internal
25
+ */
26
+ this.showScrollButtons = false;
27
+ /**
28
+ * @internal
29
+ */
30
+ this.tabSlotName = 'anchortab';
23
31
  this.tabIds = [];
24
32
  this.isDisabledElement = (el) => {
25
33
  return el.getAttribute('aria-disabled') === 'true';
@@ -161,7 +169,19 @@ export class AnchorTabs extends FoundationElement {
161
169
  tab.setAttribute('tabindex', tab === focusedTab ? '0' : '-1');
162
170
  tab.setAttribute('aria-selected', tab === focusedTab ? 'true' : 'false');
163
171
  });
172
+ focusedTab.scrollIntoView({ block: 'nearest', inline: 'start' });
164
173
  };
174
+ this.tabListResizeObserver = new ResizeObserver(entries => {
175
+ let tabListVisibleWidth = entries[0]?.contentRect.width;
176
+ if (tabListVisibleWidth !== undefined) {
177
+ const buttonWidth = this.leftScrollButton?.clientWidth ?? 0;
178
+ tabListVisibleWidth = Math.ceil(tabListVisibleWidth);
179
+ if (this.showScrollButtons) {
180
+ tabListVisibleWidth += buttonWidth * 2;
181
+ }
182
+ this.showScrollButtons = tabListVisibleWidth < this.tablist.scrollWidth;
183
+ }
184
+ });
165
185
  }
166
186
  /**
167
187
  * @internal
@@ -169,6 +189,10 @@ export class AnchorTabs extends FoundationElement {
169
189
  activeidChanged(_oldValue, _newValue) {
170
190
  if (this.$fastController.isConnected) {
171
191
  this.setTabs();
192
+ this.activetab?.scrollIntoView({
193
+ block: 'nearest',
194
+ inline: 'start'
195
+ });
172
196
  }
173
197
  }
174
198
  /**
@@ -180,13 +204,39 @@ export class AnchorTabs extends FoundationElement {
180
204
  this.setTabs();
181
205
  }
182
206
  }
207
+ /**
208
+ * @internal
209
+ */
210
+ onScrollLeftClick() {
211
+ this.tablist.scrollBy({
212
+ left: -this.tablist.clientWidth,
213
+ behavior: 'smooth'
214
+ });
215
+ }
216
+ /**
217
+ * @internal
218
+ */
219
+ onScrollRightClick() {
220
+ this.tablist.scrollBy({
221
+ left: this.tablist.clientWidth,
222
+ behavior: 'smooth'
223
+ });
224
+ }
183
225
  /**
184
226
  * @internal
185
227
  */
186
228
  connectedCallback() {
187
229
  super.connectedCallback();
230
+ this.tabListResizeObserver.observe(this.tablist);
188
231
  this.tabIds = this.getTabIds();
189
232
  }
233
+ /**
234
+ * @internal
235
+ */
236
+ disconnectedCallback() {
237
+ super.disconnectedCallback();
238
+ this.tabListResizeObserver.disconnect();
239
+ }
190
240
  getTabIds() {
191
241
  return this.tabs.map((tab) => {
192
242
  return tab.getAttribute('id') ?? `tab-${uniqueId()}`;
@@ -210,6 +260,9 @@ __decorate([
210
260
  __decorate([
211
261
  observable
212
262
  ], AnchorTabs.prototype, "tabs", void 0);
263
+ __decorate([
264
+ observable
265
+ ], AnchorTabs.prototype, "showScrollButtons", void 0);
213
266
  applyMixins(AnchorTabs, StartEnd);
214
267
  const nimbleAnchorTabs = AnchorTabs.compose({
215
268
  baseName: 'anchor-tabs',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/anchor-tabs/index.ts"],"names":[],"mappings":";AAAA,YAAY;AACZ,2IAA2I;AAC3I,iFAAiF;AACjF,2BAA2B;AAC3B,2EAA2E;AAC3E,gGAAgG;AAChG,6CAA6C;AAC7C,iDAAiD;AACjD,yBAAyB;AACzB,iCAAiC;AACjC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACH,YAAY,EACZ,aAAa,EACb,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,EACX,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,YAAY,EACZ,QAAQ,EACR,WAAW,EAGX,iBAAiB,EACpB,MAAM,4BAA4B,CAAC;A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AK,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,cAAc,CAAE,CAAC,CAAC;QAChE,IAAI,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;YACb,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3C,CAAC;IACL,CAAC;IA8DO,YAAY,CAAC,GAAc;QAC/B,OAAO,GAAG,CAAC,UAAW,CAAC,aAAa,CAAC,GAAG,CAAE,CAAC;IAC/C,CAAC;CACJ;AAxOU;IADN,IAAI;4CACoB;AAMlB;IADN,UAAU;wCACiB;AAmOhC,WAAW,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AAElC,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAc;IACrD,QAAQ,EAAE,aAAa;IACvB,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,KAAK;KACxB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC","sourcesContent":["// Based on:\n// https://github.com/microsoft/fast/blob/6bce27d0b2d654650b8751bf055f5e3b5a4f9250/packages/web-components/fast-foundation/src/tabs/tabs.ts\n// The code is heavily modified such that a diff against the original is useless.\n// Primary differences are:\n// - Reimplemented active tab indicator and removed attribute to disable it\n// - Separated tab focus and tab selection, i.e. can focus a different tab than the selected one\n// - Removed everything related to tab panels\n// - Removed support for vertical tab orientation\n// - Removed change event\n// - Conforms to our linter rules\nimport { attr, observable } from '@microsoft/fast-element';\nimport {\n keyArrowLeft,\n keyArrowRight,\n keyEnd,\n keyEnter,\n keyHome,\n keySpace,\n uniqueId\n} from '@microsoft/fast-web-utilities';\nimport {\n DesignSystem,\n StartEnd,\n applyMixins,\n StartEndOptions,\n FoundationElementDefinition,\n FoundationElement\n} from '@microsoft/fast-foundation';\nimport { styles } from './styles';\nimport { template } from './template';\nimport type { AnchorTab } from '../anchor-tab';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-anchor-tabs': AnchorTabs;\n }\n}\n\nexport type TabsOptions = FoundationElementDefinition & StartEndOptions;\n\n/**\n * A nimble-styled set of anchor tabs\n */\nexport class AnchorTabs extends FoundationElement {\n /**\n * The id of the active tab\n *\n * @public\n * @remarks\n * HTML Attribute: activeid\n */\n @attr\n public activeid?: string;\n\n /**\n * @internal\n */\n @observable\n public tabs!: HTMLElement[];\n\n /**\n * A reference to the active tab\n * @public\n */\n public activetab?: HTMLElement;\n\n /**\n * A reference to the tablist div\n * @internal\n */\n public tablist!: HTMLElement;\n\n private tabIds: string[] = [];\n\n /**\n * @internal\n */\n public activeidChanged(_oldValue: string, _newValue: string): void {\n if (this.$fastController.isConnected) {\n this.setTabs();\n }\n }\n\n /**\n * @internal\n */\n public tabsChanged(): void {\n if (this.$fastController.isConnected) {\n this.tabIds = this.getTabIds();\n this.setTabs();\n }\n }\n\n /**\n * @internal\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n\n this.tabIds = this.getTabIds();\n }\n\n private readonly isDisabledElement = (el: Element): el is HTMLElement => {\n return el.getAttribute('aria-disabled') === 'true';\n };\n\n private readonly isHiddenElement = (el: Element): el is HTMLElement => {\n return el.hasAttribute('hidden');\n };\n\n private readonly isFocusableElement = (el: Element): el is HTMLElement => {\n return !this.isDisabledElement(el) && !this.isHiddenElement(el);\n };\n\n private readonly setTabs = (): void => {\n const gridHorizontalProperty = 'gridColumn';\n const gridVerticalProperty = 'gridRow';\n\n this.activetab = undefined;\n let firstFocusableTab: HTMLElement | undefined;\n this.tabs.forEach((tab: HTMLElement, index: number) => {\n const tabId: string = this.tabIds[index]!;\n const isActiveTab = this.activeid === tabId;\n if (!firstFocusableTab && this.isFocusableElement(tab)) {\n firstFocusableTab = tab;\n }\n const isTabStop = this.activeid === tabId && this.isFocusableElement(tab);\n tab.setAttribute('id', tabId);\n if (isActiveTab) {\n tab.setAttribute('aria-current', 'page');\n } else {\n tab.removeAttribute('aria-current');\n }\n tab.removeEventListener('click', this.handleTabClick);\n tab.addEventListener('click', this.handleTabClick);\n tab.removeEventListener('keydown', this.handleTabKeyDown);\n tab.addEventListener('keydown', this.handleTabKeyDown);\n tab.setAttribute('tabindex', isTabStop ? '0' : '-1');\n if (isActiveTab) {\n this.activetab = tab;\n }\n\n tab.style[gridVerticalProperty] = '';\n tab.style[gridHorizontalProperty] = `${index + 1}`;\n });\n\n if (\n firstFocusableTab\n && (!this.activetab || !this.isFocusableElement(this.activetab))\n ) {\n firstFocusableTab.setAttribute('tabindex', '0');\n }\n };\n\n private getTabIds(): string[] {\n return this.tabs.map((tab: HTMLElement) => {\n return tab.getAttribute('id') ?? `tab-${uniqueId()}`;\n });\n }\n\n private readonly handleTabClick = (event: MouseEvent): void => {\n const selectedTab = event.currentTarget as HTMLElement;\n if (\n selectedTab.nodeType === 1\n && this.isFocusableElement(selectedTab)\n ) {\n this.tabs.forEach((tab: HTMLElement) => {\n tab.setAttribute('tabindex', tab === selectedTab ? '0' : '-1');\n });\n }\n };\n\n private readonly handleTabKeyDown = (event: KeyboardEvent): void => {\n let anchor;\n switch (event.key) {\n case keyArrowLeft:\n event.preventDefault();\n this.adjustBackward();\n break;\n case keyArrowRight:\n event.preventDefault();\n this.adjustForward();\n break;\n case keyHome:\n event.preventDefault();\n this.focusFirstOrLast(false);\n break;\n case keyEnd:\n event.preventDefault();\n this.focusFirstOrLast(true);\n break;\n case keySpace:\n case keyEnter:\n event.preventDefault();\n this.getTabAnchor(event.target as AnchorTab).click();\n break;\n case 'ContextMenu':\n event.preventDefault();\n anchor = this.getTabAnchor(event.target as AnchorTab);\n anchor.focus();\n anchor.dispatchEvent(\n new KeyboardEvent('keydown', {\n key: event.key,\n bubbles: false\n })\n );\n break;\n default:\n // do nothing\n }\n };\n\n private focusFirstOrLast(focusLast: boolean): void {\n const focusableTabs = this.tabs.filter(t => this.isFocusableElement(t));\n const focusableIndex = focusLast ? focusableTabs.length - 1 : 0;\n const index = this.tabs.indexOf(focusableTabs[focusableIndex]!);\n if (index > -1) {\n this.focusTabByIndex(this.tabs, index);\n }\n }\n\n private readonly adjustForward = (): void => {\n const group: HTMLElement[] = this.tabs;\n let index = 0;\n const focusedTab = group.find(x => x === document.activeElement);\n\n index = focusedTab ? group.indexOf(focusedTab) + 1 : 1;\n if (index === group.length) {\n index = 0;\n }\n\n while (index < group.length && group.length > 1) {\n if (this.isFocusableElement(group[index]!)) {\n this.focusTabByIndex(group, index);\n break;\n } else if (focusedTab && index === group.indexOf(focusedTab)) {\n break;\n } else if (index + 1 >= group.length) {\n index = 0;\n } else {\n index += 1;\n }\n }\n };\n\n private readonly adjustBackward = (): void => {\n const group: HTMLElement[] = this.tabs;\n let index = 0;\n const focusedTab = group.find(x => x === document.activeElement);\n\n index = focusedTab ? group.indexOf(focusedTab) - 1 : 0;\n index = index < 0 ? group.length - 1 : index;\n\n while (index >= 0 && group.length > 1) {\n if (this.isFocusableElement(group[index]!)) {\n this.focusTabByIndex(group, index);\n break;\n } else if (index - 1 < 0) {\n index = group.length - 1;\n } else {\n index -= 1;\n }\n }\n };\n\n private readonly focusTabByIndex = (\n group: HTMLElement[],\n index: number\n ): void => {\n const focusedTab: HTMLElement = group[index]!;\n focusedTab.focus();\n\n this.tabs.forEach((tab: HTMLElement) => {\n tab.setAttribute('tabindex', tab === focusedTab ? '0' : '-1');\n tab.setAttribute(\n 'aria-selected',\n tab === focusedTab ? 'true' : 'false'\n );\n });\n };\n\n private getTabAnchor(tab: AnchorTab): HTMLAnchorElement {\n return tab.shadowRoot!.querySelector('a')!;\n }\n}\napplyMixins(AnchorTabs, StartEnd);\n\nconst nimbleAnchorTabs = AnchorTabs.compose<TabsOptions>({\n baseName: 'anchor-tabs',\n template,\n styles,\n shadowOptions: {\n delegatesFocus: false\n }\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleAnchorTabs());\nexport const anchorTabsTag = 'nimble-anchor-tabs';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/anchor-tabs/index.ts"],"names":[],"mappings":";AAAA,YAAY;AACZ,2IAA2I;AAC3I,iFAAiF;AACjF,2BAA2B;AAC3B,2EAA2E;AAC3E,gGAAgG;AAChG,6CAA6C;AAC7C,iDAAiD;AACjD,yBAAyB;AACzB,iCAAiC;AACjC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACH,YAAY,EACZ,aAAa,EACb,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,EACX,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,YAAY,EACZ,QAAQ,EACR,WAAW,EAGX,iBAAiB,EACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAYrD;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAgD7C;QACI,KAAK,EAAE,CAAC;QAhCZ;;WAEG;QAEI,sBAAiB,GAAG,KAAK,CAAC;QAmBjC;;WAEG;QACa,gBAAW,GAAG,WAAW,CAAC;QAGlC,WAAM,GAAa,EAAE,CAAC;QA6Eb,sBAAiB,GAAG,CAAC,EAAW,EAAqB,EAAE;YACpE,OAAO,EAAE,CAAC,YAAY,CAAC,eAAe,CAAC,KAAK,MAAM,CAAC;QACvD,CAAC,CAAC;QAEe,oBAAe,GAAG,CAAC,EAAW,EAAqB,EAAE;YAClE,OAAO,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QACrC,CAAC,CAAC;QAEe,uBAAkB,GAAG,CAAC,EAAW,EAAqB,EAAE;YACrE,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC,IAAI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C,CAAC;AAElC,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAc;IACrD,QAAQ,EAAE,aAAa;IACvB,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,KAAK;KACxB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC","sourcesContent":["// Based on:\n// https://github.com/microsoft/fast/blob/6bce27d0b2d654650b8751bf055f5e3b5a4f9250/packages/web-components/fast-foundation/src/tabs/tabs.ts\n// The code is heavily modified such that a diff against the original is useless.\n// Primary differences are:\n// - Reimplemented active tab indicator and removed attribute to disable it\n// - Separated tab focus and tab selection, i.e. can focus a different tab than the selected one\n// - Removed everything related to tab panels\n// - Removed support for vertical tab orientation\n// - Removed change event\n// - Conforms to our linter rules\nimport { attr, observable } from '@microsoft/fast-element';\nimport {\n keyArrowLeft,\n keyArrowRight,\n keyEnd,\n keyEnter,\n keyHome,\n keySpace,\n uniqueId\n} from '@microsoft/fast-web-utilities';\nimport {\n DesignSystem,\n StartEnd,\n applyMixins,\n StartEndOptions,\n FoundationElementDefinition,\n FoundationElement\n} from '@microsoft/fast-foundation';\nimport { styles } from '../patterns/tabs/styles';\nimport { template } from '../patterns/tabs/template';\nimport type { AnchorTab } from '../anchor-tab';\nimport type { TabsOwner } from '../patterns/tabs/types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-anchor-tabs': AnchorTabs;\n }\n}\n\nexport type TabsOptions = FoundationElementDefinition & StartEndOptions;\n\n/**\n * A nimble-styled set of anchor tabs\n */\nexport class AnchorTabs extends FoundationElement implements TabsOwner {\n /**\n * The id of the active tab\n *\n * @public\n * @remarks\n * HTML Attribute: activeid\n */\n @attr\n public activeid?: string;\n\n /**\n * @internal\n */\n @observable\n public tabs!: HTMLElement[];\n\n /**\n * @internal\n */\n @observable\n public showScrollButtons = false;\n\n /**\n * A reference to the active tab\n * @public\n */\n public activetab?: HTMLElement;\n\n /**\n * A reference to the tablist div\n * @internal\n */\n public tablist!: HTMLElement;\n\n /**\n * @internal\n */\n public readonly leftScrollButton?: HTMLElement;\n\n /**\n * @internal\n */\n public readonly tabSlotName = 'anchortab';\n\n private readonly tabListResizeObserver: ResizeObserver;\n private tabIds: string[] = [];\n\n public constructor() {\n super();\n this.tabListResizeObserver = new ResizeObserver(entries => {\n let tabListVisibleWidth = entries[0]?.contentRect.width;\n if (tabListVisibleWidth !== undefined) {\n const buttonWidth = this.leftScrollButton?.clientWidth ?? 0;\n tabListVisibleWidth = Math.ceil(tabListVisibleWidth);\n if (this.showScrollButtons) {\n tabListVisibleWidth += buttonWidth * 2;\n }\n this.showScrollButtons = tabListVisibleWidth < this.tablist.scrollWidth;\n }\n });\n }\n\n /**\n * @internal\n */\n public activeidChanged(_oldValue: string, _newValue: string): void {\n if (this.$fastController.isConnected) {\n this.setTabs();\n this.activetab?.scrollIntoView({\n block: 'nearest',\n inline: 'start'\n });\n }\n }\n\n /**\n * @internal\n */\n public tabsChanged(): void {\n if (this.$fastController.isConnected) {\n this.tabIds = this.getTabIds();\n this.setTabs();\n }\n }\n\n /**\n * @internal\n */\n public onScrollLeftClick(): void {\n this.tablist.scrollBy({\n left: -this.tablist.clientWidth,\n behavior: 'smooth'\n });\n }\n\n /**\n * @internal\n */\n public onScrollRightClick(): void {\n this.tablist.scrollBy({\n left: this.tablist.clientWidth,\n behavior: 'smooth'\n });\n }\n\n /**\n * @internal\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.tabListResizeObserver.observe(this.tablist);\n this.tabIds = this.getTabIds();\n }\n\n /**\n * @internal\n */\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.tabListResizeObserver.disconnect();\n }\n\n private readonly isDisabledElement = (el: Element): el is HTMLElement => {\n return el.getAttribute('aria-disabled') === 'true';\n };\n\n private readonly isHiddenElement = (el: Element): el is HTMLElement => {\n return el.hasAttribute('hidden');\n };\n\n private readonly isFocusableElement = (el: Element): el is HTMLElement => {\n return !this.isDisabledElement(el) && !this.isHiddenElement(el);\n };\n\n private readonly setTabs = (): void => {\n const gridHorizontalProperty = 'gridColumn';\n const gridVerticalProperty = 'gridRow';\n\n this.activetab = undefined;\n let firstFocusableTab: HTMLElement | undefined;\n this.tabs.forEach((tab: HTMLElement, index: number) => {\n const tabId: string = this.tabIds[index]!;\n const isActiveTab = this.activeid === tabId;\n if (!firstFocusableTab && this.isFocusableElement(tab)) {\n firstFocusableTab = tab;\n }\n const isTabStop = this.activeid === tabId && this.isFocusableElement(tab);\n tab.setAttribute('id', tabId);\n if (isActiveTab) {\n tab.setAttribute('aria-current', 'page');\n } else {\n tab.removeAttribute('aria-current');\n }\n tab.removeEventListener('click', this.handleTabClick);\n tab.addEventListener('click', this.handleTabClick);\n tab.removeEventListener('keydown', this.handleTabKeyDown);\n tab.addEventListener('keydown', this.handleTabKeyDown);\n tab.setAttribute('tabindex', isTabStop ? '0' : '-1');\n if (isActiveTab) {\n this.activetab = tab;\n }\n\n tab.style[gridVerticalProperty] = '';\n tab.style[gridHorizontalProperty] = `${index + 1}`;\n });\n\n if (\n firstFocusableTab\n && (!this.activetab || !this.isFocusableElement(this.activetab))\n ) {\n firstFocusableTab.setAttribute('tabindex', '0');\n }\n };\n\n private getTabIds(): string[] {\n return this.tabs.map((tab: HTMLElement) => {\n return tab.getAttribute('id') ?? `tab-${uniqueId()}`;\n });\n }\n\n private readonly handleTabClick = (event: MouseEvent): void => {\n const selectedTab = event.currentTarget as HTMLElement;\n if (\n selectedTab.nodeType === 1\n && this.isFocusableElement(selectedTab)\n ) {\n this.tabs.forEach((tab: HTMLElement) => {\n tab.setAttribute('tabindex', tab === selectedTab ? '0' : '-1');\n });\n }\n };\n\n private readonly handleTabKeyDown = (event: KeyboardEvent): void => {\n let anchor;\n switch (event.key) {\n case keyArrowLeft:\n event.preventDefault();\n this.adjustBackward();\n break;\n case keyArrowRight:\n event.preventDefault();\n this.adjustForward();\n break;\n case keyHome:\n event.preventDefault();\n this.focusFirstOrLast(false);\n break;\n case keyEnd:\n event.preventDefault();\n this.focusFirstOrLast(true);\n break;\n case keySpace:\n case keyEnter:\n event.preventDefault();\n this.getTabAnchor(event.target as AnchorTab).click();\n break;\n case 'ContextMenu':\n event.preventDefault();\n anchor = this.getTabAnchor(event.target as AnchorTab);\n anchor.focus();\n anchor.dispatchEvent(\n new KeyboardEvent('keydown', {\n key: event.key,\n bubbles: false\n })\n );\n break;\n default:\n // do nothing\n }\n };\n\n private focusFirstOrLast(focusLast: boolean): void {\n const focusableTabs = this.tabs.filter(t => this.isFocusableElement(t));\n const focusableIndex = focusLast ? focusableTabs.length - 1 : 0;\n const index = this.tabs.indexOf(focusableTabs[focusableIndex]!);\n if (index > -1) {\n this.focusTabByIndex(this.tabs, index);\n }\n }\n\n private readonly adjustForward = (): void => {\n const group: HTMLElement[] = this.tabs;\n let index = 0;\n const focusedTab = group.find(x => x === document.activeElement);\n\n index = focusedTab ? group.indexOf(focusedTab) + 1 : 1;\n if (index === group.length) {\n index = 0;\n }\n\n while (index < group.length && group.length > 1) {\n if (this.isFocusableElement(group[index]!)) {\n this.focusTabByIndex(group, index);\n break;\n } else if (focusedTab && index === group.indexOf(focusedTab)) {\n break;\n } else if (index + 1 >= group.length) {\n index = 0;\n } else {\n index += 1;\n }\n }\n };\n\n private readonly adjustBackward = (): void => {\n const group: HTMLElement[] = this.tabs;\n let index = 0;\n const focusedTab = group.find(x => x === document.activeElement);\n\n index = focusedTab ? group.indexOf(focusedTab) - 1 : 0;\n index = index < 0 ? group.length - 1 : index;\n\n while (index >= 0 && group.length > 1) {\n if (this.isFocusableElement(group[index]!)) {\n this.focusTabByIndex(group, index);\n break;\n } else if (index - 1 < 0) {\n index = group.length - 1;\n } else {\n index -= 1;\n }\n }\n };\n\n private readonly focusTabByIndex = (\n group: HTMLElement[],\n index: number\n ): void => {\n const focusedTab: HTMLElement = group[index]!;\n focusedTab.focus();\n\n this.tabs.forEach((tab: HTMLElement) => {\n tab.setAttribute('tabindex', tab === focusedTab ? '0' : '-1');\n tab.setAttribute(\n 'aria-selected',\n tab === focusedTab ? 'true' : 'false'\n );\n });\n\n focusedTab.scrollIntoView({ block: 'nearest', inline: 'start' });\n };\n\n private getTabAnchor(tab: AnchorTab): HTMLAnchorElement {\n return tab.shadowRoot!.querySelector('a')!;\n }\n}\napplyMixins(AnchorTabs, StartEnd);\n\nconst nimbleAnchorTabs = AnchorTabs.compose<TabsOptions>({\n baseName: 'anchor-tabs',\n template,\n styles,\n shadowOptions: {\n delegatesFocus: false\n }\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleAnchorTabs());\nexport const anchorTabsTag = 'nimble-anchor-tabs';\n"]}
@@ -0,0 +1,9 @@
1
+ import type { AnchorTabs } from '..';
2
+ import { TabsBasePageObject } from '../../patterns/tabs/testing/tabs-base.pageobject';
3
+ /**
4
+ * Page object for the `nimble-anchor-tabs` component to provide consistent ways
5
+ * of querying and interacting with the component during tests.
6
+ */
7
+ export declare class AnchorTabsPageObject extends TabsBasePageObject<AnchorTabs> {
8
+ constructor(tabsElement: AnchorTabs);
9
+ }
@@ -0,0 +1,12 @@
1
+ import { anchorTabTag } from '../../anchor-tab';
2
+ import { TabsBasePageObject } from '../../patterns/tabs/testing/tabs-base.pageobject';
3
+ /**
4
+ * Page object for the `nimble-anchor-tabs` component to provide consistent ways
5
+ * of querying and interacting with the component during tests.
6
+ */
7
+ export class AnchorTabsPageObject extends TabsBasePageObject {
8
+ constructor(tabsElement) {
9
+ super(tabsElement, anchorTabTag);
10
+ }
11
+ }
12
+ //# sourceMappingURL=anchor-tabs.pageobject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchor-tabs.pageobject.js","sourceRoot":"","sources":["../../../../src/anchor-tabs/testing/anchor-tabs.pageobject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAEtF;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,kBAA8B;IACpE,YAAmB,WAAuB;QACtC,KAAK,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IACrC,CAAC;CACJ","sourcesContent":["import type { AnchorTabs } from '..';\nimport { anchorTabTag } from '../../anchor-tab';\nimport { TabsBasePageObject } from '../../patterns/tabs/testing/tabs-base.pageobject';\n\n/**\n * Page object for the `nimble-anchor-tabs` component to provide consistent ways\n * of querying and interacting with the component during tests.\n */\nexport class AnchorTabsPageObject extends TabsBasePageObject<AnchorTabs> {\n public constructor(tabsElement: AnchorTabs) {\n super(tabsElement, anchorTabTag);\n }\n}\n"]}
@@ -14,6 +14,8 @@ declare const supportedLabels: {
14
14
  readonly filterSearch: import("@microsoft/fast-foundation").DesignToken<string>;
15
15
  readonly filterNoResults: import("@microsoft/fast-foundation").DesignToken<string>;
16
16
  readonly loading: import("@microsoft/fast-foundation").DesignToken<string>;
17
+ readonly scrollBackward: import("@microsoft/fast-foundation").DesignToken<string>;
18
+ readonly scrollForward: import("@microsoft/fast-foundation").DesignToken<string>;
17
19
  };
18
20
  /**
19
21
  * Core label provider for Nimble
@@ -28,6 +30,8 @@ export declare class LabelProviderCore extends LabelProviderBase<typeof supporte
28
30
  filterSearch: string | undefined;
29
31
  filterNoResults: string | undefined;
30
32
  loading: string | undefined;
33
+ scrollBackward: string | undefined;
34
+ scrollForward: string | undefined;
31
35
  protected readonly supportedLabels: {
32
36
  readonly popupDismiss: import("@microsoft/fast-foundation").DesignToken<string>;
33
37
  readonly numericDecrement: import("@microsoft/fast-foundation").DesignToken<string>;
@@ -38,6 +42,8 @@ export declare class LabelProviderCore extends LabelProviderBase<typeof supporte
38
42
  readonly filterSearch: import("@microsoft/fast-foundation").DesignToken<string>;
39
43
  readonly filterNoResults: import("@microsoft/fast-foundation").DesignToken<string>;
40
44
  readonly loading: import("@microsoft/fast-foundation").DesignToken<string>;
45
+ readonly scrollBackward: import("@microsoft/fast-foundation").DesignToken<string>;
46
+ readonly scrollForward: import("@microsoft/fast-foundation").DesignToken<string>;
41
47
  };
42
48
  }
43
49
  export declare const labelProviderCoreTag = "nimble-label-provider-core";
@@ -2,7 +2,7 @@ import { __decorate } from "tslib";
2
2
  import { attr } from '@microsoft/fast-element';
3
3
  import { DesignSystem } from '@microsoft/fast-foundation';
4
4
  import { LabelProviderBase } from '../base';
5
- import { popupDismissLabel, numericDecrementLabel, numericIncrementLabel, popupIconErrorLabel, popupIconWarningLabel, popupIconInformationLabel, filterSearchLabel, filterNoResultsLabel, loadingLabel } from './label-tokens';
5
+ import { popupDismissLabel, numericDecrementLabel, numericIncrementLabel, popupIconErrorLabel, popupIconWarningLabel, popupIconInformationLabel, filterSearchLabel, filterNoResultsLabel, loadingLabel, scrollBackwardLabel, scrollForwardLabel } from './label-tokens';
6
6
  import { styles } from '../base/styles';
7
7
  const supportedLabels = {
8
8
  popupDismiss: popupDismissLabel,
@@ -13,7 +13,9 @@ const supportedLabels = {
13
13
  popupIconInformation: popupIconInformationLabel,
14
14
  filterSearch: filterSearchLabel,
15
15
  filterNoResults: filterNoResultsLabel,
16
- loading: loadingLabel
16
+ loading: loadingLabel,
17
+ scrollBackward: scrollBackwardLabel,
18
+ scrollForward: scrollForwardLabel
17
19
  };
18
20
  /**
19
21
  * Core label provider for Nimble
@@ -51,6 +53,12 @@ __decorate([
51
53
  __decorate([
52
54
  attr({ attribute: 'loading' })
53
55
  ], LabelProviderCore.prototype, "loading", void 0);
56
+ __decorate([
57
+ attr({ attribute: 'scroll-backward' })
58
+ ], LabelProviderCore.prototype, "scrollBackward", void 0);
59
+ __decorate([
60
+ attr({ attribute: 'scroll-forward' })
61
+ ], LabelProviderCore.prototype, "scrollForward", void 0);
54
62
  const nimbleLabelProviderCore = LabelProviderCore.compose({
55
63
  baseName: 'label-provider-core',
56
64
  styles
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/label-provider/core/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAmB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EACH,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAQxC,MAAM,eAAe,GAAG;IACpB,YAAY,EAAE,iBAAiB;IAC/B,gBAAgB,EAAE,qBAAqB;IACvC,gBAAgB,EAAE,qBAAqB;IACvC,cAAc,EAAE,mBAAmB;IACnC,gBAAgB,EAAE,qBAAqB;IACvC,oBAAoB,EAAE,yBAAyB;IAC/C,YAAY,EAAE,iBAAiB;IAC/B,eAAe,EAAE,oBAAoB;IACrC,OAAO,EAAE,YAAY;CACf,CAAC;AAEX;;GAEG;AACH,MAAM,OAAO,iBACT,SAAQ,iBAAyC;IADrD;;QA8BgC,oBAAe,GAAG,eAAe,CAAC;IAClE,CAAC;CAAA;AA3BU;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;uDACG;AAGjC;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;2DACG;AAGrC;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;2DACG;AAGrC;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;yDACE;AAGnC;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;2DACE;AAGrC;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAAC;+DACE;AAGzC;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;uDACG;AAGjC;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;0DACE;AAGpC;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;kDACI;AAKvC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,OAAO,CAAC;IACtD,QAAQ,EAAE,qBAAqB;IAC/B,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,QAAQ,CAAC;KACpB,QAAQ,CAAC,uBAAuB,EAAE,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,oBAAoB,GAAG,4BAA4B,CAAC","sourcesContent":["import { attr } from '@microsoft/fast-element';\nimport { DesignSystem } from '@microsoft/fast-foundation';\nimport { DesignTokensFor, LabelProviderBase } from '../base';\nimport {\n popupDismissLabel,\n numericDecrementLabel,\n numericIncrementLabel,\n popupIconErrorLabel,\n popupIconWarningLabel,\n popupIconInformationLabel,\n filterSearchLabel,\n filterNoResultsLabel,\n loadingLabel\n} from './label-tokens';\nimport { styles } from '../base/styles';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-label-provider-core': LabelProviderCore;\n }\n}\n\nconst supportedLabels = {\n popupDismiss: popupDismissLabel,\n numericDecrement: numericDecrementLabel,\n numericIncrement: numericIncrementLabel,\n popupIconError: popupIconErrorLabel,\n popupIconWarning: popupIconWarningLabel,\n popupIconInformation: popupIconInformationLabel,\n filterSearch: filterSearchLabel,\n filterNoResults: filterNoResultsLabel,\n loading: loadingLabel\n} as const;\n\n/**\n * Core label provider for Nimble\n */\nexport class LabelProviderCore\n extends LabelProviderBase<typeof supportedLabels>\n implements DesignTokensFor<typeof supportedLabels> {\n @attr({ attribute: 'popup-dismiss' })\n public popupDismiss: string | undefined;\n\n @attr({ attribute: 'numeric-decrement' })\n public numericDecrement: string | undefined;\n\n @attr({ attribute: 'numeric-increment' })\n public numericIncrement: string | undefined;\n\n @attr({ attribute: 'popup-icon-error' })\n public popupIconError: string | undefined;\n\n @attr({ attribute: 'popup-icon-warning' })\n public popupIconWarning: string | undefined;\n\n @attr({ attribute: 'popup-icon-information' })\n public popupIconInformation: string | undefined;\n\n @attr({ attribute: 'filter-search' })\n public filterSearch: string | undefined;\n\n @attr({ attribute: 'filter-no-results' })\n public filterNoResults: string | undefined;\n\n @attr({ attribute: 'loading' })\n public loading: string | undefined;\n\n protected override readonly supportedLabels = supportedLabels;\n}\n\nconst nimbleLabelProviderCore = LabelProviderCore.compose({\n baseName: 'label-provider-core',\n styles\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('nimble')\n .register(nimbleLabelProviderCore());\nexport const labelProviderCoreTag = 'nimble-label-provider-core';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/label-provider/core/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAmB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EACH,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAQxC,MAAM,eAAe,GAAG;IACpB,YAAY,EAAE,iBAAiB;IAC/B,gBAAgB,EAAE,qBAAqB;IACvC,gBAAgB,EAAE,qBAAqB;IACvC,cAAc,EAAE,mBAAmB;IACnC,gBAAgB,EAAE,qBAAqB;IACvC,oBAAoB,EAAE,yBAAyB;IAC/C,YAA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AM,oBAAoB,GAAG,4BAA4B,CAAC","sourcesContent":["import { attr } from '@microsoft/fast-element';\nimport { DesignSystem } from '@microsoft/fast-foundation';\nimport { DesignTokensFor, LabelProviderBase } from '../base';\nimport {\n popupDismissLabel,\n numericDecrementLabel,\n numericIncrementLabel,\n popupIconErrorLabel,\n popupIconWarningLabel,\n popupIconInformationLabel,\n filterSearchLabel,\n filterNoResultsLabel,\n loadingLabel,\n scrollBackwardLabel,\n scrollForwardLabel\n} from './label-tokens';\nimport { styles } from '../base/styles';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-label-provider-core': LabelProviderCore;\n }\n}\n\nconst supportedLabels = {\n popupDismiss: popupDismissLabel,\n numericDecrement: numericDecrementLabel,\n numericIncrement: numericIncrementLabel,\n popupIconError: popupIconErrorLabel,\n popupIconWarning: popupIconWarningLabel,\n popupIconInformation: popupIconInformationLabel,\n filterSearch: filterSearchLabel,\n filterNoResults: filterNoResultsLabel,\n loading: loadingLabel,\n scrollBackward: scrollBackwardLabel,\n scrollForward: scrollForwardLabel\n} as const;\n\n/**\n * Core label provider for Nimble\n */\nexport class LabelProviderCore\n extends LabelProviderBase<typeof supportedLabels>\n implements DesignTokensFor<typeof supportedLabels> {\n @attr({ attribute: 'popup-dismiss' })\n public popupDismiss: string | undefined;\n\n @attr({ attribute: 'numeric-decrement' })\n public numericDecrement: string | undefined;\n\n @attr({ attribute: 'numeric-increment' })\n public numericIncrement: string | undefined;\n\n @attr({ attribute: 'popup-icon-error' })\n public popupIconError: string | undefined;\n\n @attr({ attribute: 'popup-icon-warning' })\n public popupIconWarning: string | undefined;\n\n @attr({ attribute: 'popup-icon-information' })\n public popupIconInformation: string | undefined;\n\n @attr({ attribute: 'filter-search' })\n public filterSearch: string | undefined;\n\n @attr({ attribute: 'filter-no-results' })\n public filterNoResults: string | undefined;\n\n @attr({ attribute: 'loading' })\n public loading: string | undefined;\n\n @attr({ attribute: 'scroll-backward' })\n public scrollBackward: string | undefined;\n\n @attr({ attribute: 'scroll-forward' })\n public scrollForward: string | undefined;\n\n protected override readonly supportedLabels = supportedLabels;\n}\n\nconst nimbleLabelProviderCore = LabelProviderCore.compose({\n baseName: 'label-provider-core',\n styles\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('nimble')\n .register(nimbleLabelProviderCore());\nexport const labelProviderCoreTag = 'nimble-label-provider-core';\n"]}
@@ -7,6 +7,8 @@ export const coreLabelDefaults = {
7
7
  popupIconInformationLabel: 'Information',
8
8
  filterSearchLabel: 'Search',
9
9
  filterNoResultsLabel: 'No items found',
10
- loadingLabel: 'Loading…'
10
+ loadingLabel: 'Loading…',
11
+ scrollBackwardLabel: 'Scroll backward',
12
+ scrollForwardLabel: 'Scroll forward'
11
13
  };
12
14
  //# sourceMappingURL=label-token-defaults.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"label-token-defaults.js","sourceRoot":"","sources":["../../../../src/label-provider/core/label-token-defaults.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAA4C;IACtE,iBAAiB,EAAE,OAAO;IAC1B,qBAAqB,EAAE,WAAW;IAClC,qBAAqB,EAAE,WAAW;IAClC,mBAAmB,EAAE,OAAO;IAC5B,qBAAqB,EAAE,SAAS;IAChC,yBAAyB,EAAE,aAAa;IACxC,iBAAiB,EAAE,QAAQ;IAC3B,oBAAoB,EAAE,gBAAgB;IACtC,YAAY,EAAE,UAAU;CAC3B,CAAC","sourcesContent":["import type * as TokensNamespace from './label-tokens';\n\ntype TokenName = keyof typeof TokensNamespace;\n\nexport const coreLabelDefaults: { readonly [key in TokenName]: string } = {\n popupDismissLabel: 'Close',\n numericIncrementLabel: 'Increment',\n numericDecrementLabel: 'Decrement',\n popupIconErrorLabel: 'Error',\n popupIconWarningLabel: 'Warning',\n popupIconInformationLabel: 'Information',\n filterSearchLabel: 'Search',\n filterNoResultsLabel: 'No items found',\n loadingLabel: 'Loading…'\n};\n"]}
1
+ {"version":3,"file":"label-token-defaults.js","sourceRoot":"","sources":["../../../../src/label-provider/core/label-token-defaults.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAA4C;IACtE,iBAAiB,EAAE,OAAO;IAC1B,qBAAqB,EAAE,WAAW;IAClC,qBAAqB,EAAE,WAAW;IAClC,mBAAmB,EAAE,OAAO;IAC5B,qBAAqB,EAAE,SAAS;IAChC,yBAAyB,EAAE,aAAa;IACxC,iBAAiB,EAAE,QAAQ;IAC3B,oBAAoB,EAAE,gBAAgB;IACtC,YAAY,EAAE,UAAU;IACxB,mBAAmB,EAAE,iBAAiB;IACtC,kBAAkB,EAAE,gBAAgB;CACvC,CAAC","sourcesContent":["import type * as TokensNamespace from './label-tokens';\n\ntype TokenName = keyof typeof TokensNamespace;\n\nexport const coreLabelDefaults: { readonly [key in TokenName]: string } = {\n popupDismissLabel: 'Close',\n numericIncrementLabel: 'Increment',\n numericDecrementLabel: 'Decrement',\n popupIconErrorLabel: 'Error',\n popupIconWarningLabel: 'Warning',\n popupIconInformationLabel: 'Information',\n filterSearchLabel: 'Search',\n filterNoResultsLabel: 'No items found',\n loadingLabel: 'Loading…',\n scrollBackwardLabel: 'Scroll backward',\n scrollForwardLabel: 'Scroll forward'\n};\n"]}
@@ -8,3 +8,5 @@ export declare const popupIconInformationLabel: DesignToken<string>;
8
8
  export declare const filterSearchLabel: DesignToken<string>;
9
9
  export declare const filterNoResultsLabel: DesignToken<string>;
10
10
  export declare const loadingLabel: DesignToken<string>;
11
+ export declare const scrollBackwardLabel: DesignToken<string>;
12
+ export declare const scrollForwardLabel: DesignToken<string>;
@@ -36,4 +36,12 @@ export const loadingLabel = DesignToken.create({
36
36
  name: 'loading-label',
37
37
  cssCustomPropertyName: null
38
38
  }).withDefault(coreLabelDefaults.loadingLabel);
39
+ export const scrollBackwardLabel = DesignToken.create({
40
+ name: 'scroll-backward-label',
41
+ cssCustomPropertyName: null
42
+ }).withDefault(coreLabelDefaults.scrollBackwardLabel);
43
+ export const scrollForwardLabel = DesignToken.create({
44
+ name: 'scroll-forward-label',
45
+ cssCustomPropertyName: null
46
+ }).withDefault(coreLabelDefaults.scrollForwardLabel);
39
47
  //# sourceMappingURL=label-tokens.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"label-tokens.js","sourceRoot":"","sources":["../../../../src/label-provider/core/label-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAM,CAAS;IACxD,IAAI,EAAE,qBAAqB;IAC3B,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;AAEpD,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC,MAAM,CAAS;IAC5D,IAAI,EAAE,yBAAyB;IAC/B,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC,MAAM,CAAS;IAC5D,IAAI,EAAE,yBAAyB;IAC/B,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC,MAAM,CAAS;IAC1D,IAAI,EAAE,wBAAwB;IAC9B,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC,MAAM,CAAS;IAC5D,IAAI,EAAE,0BAA0B;IAChC,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAC,MAAM,CAAS;IAChE,IAAI,EAAE,8BAA8B;IACpC,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;AAE5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAM,CAAS;IACxD,IAAI,EAAE,qBAAqB;IAC3B,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;AAEpD,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC,MAAM,CAAS;IAC3D,IAAI,EAAE,yBAAyB;IAC/B,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CAAS;IACnD,IAAI,EAAE,eAAe;IACrB,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC","sourcesContent":["import { DesignToken } from '@microsoft/fast-foundation';\nimport { coreLabelDefaults } from './label-token-defaults';\n\nexport const popupDismissLabel = DesignToken.create<string>({\n name: 'popup-dismiss-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.popupDismissLabel);\n\nexport const numericDecrementLabel = DesignToken.create<string>({\n name: 'numeric-decrement-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.numericDecrementLabel);\n\nexport const numericIncrementLabel = DesignToken.create<string>({\n name: 'numeric-increment-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.numericIncrementLabel);\n\nexport const popupIconErrorLabel = DesignToken.create<string>({\n name: 'popup-icon-error-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.popupIconErrorLabel);\n\nexport const popupIconWarningLabel = DesignToken.create<string>({\n name: 'popup-icon-warning-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.popupIconWarningLabel);\n\nexport const popupIconInformationLabel = DesignToken.create<string>({\n name: 'popup-icon-information-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.popupIconInformationLabel);\n\nexport const filterSearchLabel = DesignToken.create<string>({\n name: 'filter-search-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.filterSearchLabel);\n\nexport const filterNoResultsLabel = DesignToken.create<string>({\n name: 'filter-no-results-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.filterNoResultsLabel);\n\nexport const loadingLabel = DesignToken.create<string>({\n name: 'loading-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.loadingLabel);\n"]}
1
+ {"version":3,"file":"label-tokens.js","sourceRoot":"","sources":["../../../../src/label-provider/core/label-tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC,MAAM,CAAS;IACxD,IAAI,EAAE,qBAAqB;IAC3B,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;AAEpD,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC,MAAM,CAAS;IAC5D,IAAI,EAAE,yBAAyB;IAC/B,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC,MAAM,CAAS;IAC5D,IAAI,EAAE,yBAAyB;IAC/B,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,qBA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AC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAM,CAAS;IACzD,IAAI,EAAE,sBAAsB;IAC5B,qBAAqB,EAAE,IAAI;CAC9B,CAAC,CAAC,WAAW,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAAC","sourcesContent":["import { DesignToken } from '@microsoft/fast-foundation';\nimport { coreLabelDefaults } from './label-token-defaults';\n\nexport const popupDismissLabel = DesignToken.create<string>({\n name: 'popup-dismiss-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.popupDismissLabel);\n\nexport const numericDecrementLabel = DesignToken.create<string>({\n name: 'numeric-decrement-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.numericDecrementLabel);\n\nexport const numericIncrementLabel = DesignToken.create<string>({\n name: 'numeric-increment-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.numericIncrementLabel);\n\nexport const popupIconErrorLabel = DesignToken.create<string>({\n name: 'popup-icon-error-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.popupIconErrorLabel);\n\nexport const popupIconWarningLabel = DesignToken.create<string>({\n name: 'popup-icon-warning-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.popupIconWarningLabel);\n\nexport const popupIconInformationLabel = DesignToken.create<string>({\n name: 'popup-icon-information-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.popupIconInformationLabel);\n\nexport const filterSearchLabel = DesignToken.create<string>({\n name: 'filter-search-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.filterSearchLabel);\n\nexport const filterNoResultsLabel = DesignToken.create<string>({\n name: 'filter-no-results-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.filterNoResultsLabel);\n\nexport const loadingLabel = DesignToken.create<string>({\n name: 'loading-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.loadingLabel);\n\nexport const scrollBackwardLabel = DesignToken.create<string>({\n name: 'scroll-backward-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.scrollBackwardLabel);\n\nexport const scrollForwardLabel = DesignToken.create<string>({\n name: 'scroll-forward-label',\n cssCustomPropertyName: null\n}).withDefault(coreLabelDefaults.scrollForwardLabel);\n"]}
@@ -0,0 +1,35 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ import { display } from '../../utilities/style/display';
3
+ import { smallPadding } from '../../theme-provider/design-tokens';
4
+ export const styles = css `
5
+ ${display('flex')}
6
+
7
+ :host {
8
+ flex-direction: column;
9
+ }
10
+
11
+ .tab-bar {
12
+ display: flex;
13
+ }
14
+
15
+ [part='start'] {
16
+ display: none;
17
+ }
18
+
19
+ .scroll-button.left {
20
+ margin-right: ${smallPadding};
21
+ }
22
+
23
+ .tablist {
24
+ display: flex;
25
+ width: max-content;
26
+ align-self: end;
27
+ overflow-x: scroll;
28
+ scrollbar-width: none;
29
+ }
30
+
31
+ .scroll-button.right {
32
+ margin-left: ${smallPadding};
33
+ }
34
+ `;
35
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/patterns/tabs/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;wBAeG,YAAY;;;;;;;;;;;;uBAYb,YAAY;;CAElC,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '../../utilities/style/display';\nimport { smallPadding } from '../../theme-provider/design-tokens';\n\nexport const styles = css`\n ${display('flex')}\n\n :host {\n flex-direction: column;\n }\n\n .tab-bar {\n display: flex;\n }\n\n [part='start'] {\n display: none;\n }\n\n .scroll-button.left {\n margin-right: ${smallPadding};\n }\n\n .tablist {\n display: flex;\n width: max-content;\n align-self: end;\n overflow-x: scroll;\n scrollbar-width: none;\n }\n\n .scroll-button.right {\n margin-left: ${smallPadding};\n }\n`;\n"]}
@@ -0,0 +1,4 @@
1
+ import type { ViewTemplate } from '@microsoft/fast-element';
2
+ import { FoundationElementTemplate, TabsOptions } from '@microsoft/fast-foundation';
3
+ import type { TabsOwner } from './types';
4
+ export declare const template: FoundationElementTemplate<ViewTemplate<TabsOwner>, TabsOptions>;
@@ -0,0 +1,56 @@
1
+ import { html, ref, slotted, when } from '@microsoft/fast-element';
2
+ import { endSlotTemplate, startSlotTemplate } from '@microsoft/fast-foundation';
3
+ import { buttonTag } from '../../button';
4
+ import { iconArrowExpanderLeftTag } from '../../icons/arrow-expander-left';
5
+ import { iconArrowExpanderRightTag } from '../../icons/arrow-expander-right';
6
+ import { ButtonAppearance } from '../button/types';
7
+ import { scrollForwardLabel, scrollBackwardLabel } from '../../label-provider/core/label-tokens';
8
+ // prettier-ignore
9
+ export const template = (context, definition) => html `
10
+ <div
11
+ class="tab-bar"
12
+ >
13
+ ${startSlotTemplate(context, definition)}
14
+ ${when(x => x.showScrollButtons, html `
15
+ <${buttonTag}
16
+ content-hidden
17
+ class="scroll-button left"
18
+ appearance="${ButtonAppearance.ghost}"
19
+ tabindex="-1"
20
+ @click="${x => x.onScrollLeftClick()}"
21
+ ${ref('leftScrollButton')}
22
+ >
23
+ ${x => scrollForwardLabel.getValueFor(x)}
24
+ <${iconArrowExpanderLeftTag} slot="start"></${iconArrowExpanderLeftTag}>
25
+ </${buttonTag}>
26
+ `)}
27
+ <div
28
+ class="tablist"
29
+ part="tablist"
30
+ role="tablist"
31
+ ${ref('tablist')}
32
+ >
33
+ <slot class="tab" name="${x => x.tabSlotName}" part="tab" ${slotted('tabs')}>
34
+ </slot>
35
+ </div>
36
+ ${when(x => x.showScrollButtons, html `
37
+ <${buttonTag}
38
+ content-hidden
39
+ class="scroll-button right"
40
+ appearance="${ButtonAppearance.ghost}"
41
+ tabindex="-1"
42
+ @click="${x => x.onScrollRightClick()}"
43
+ >
44
+ ${x => scrollBackwardLabel.getValueFor(x)}
45
+ <${iconArrowExpanderRightTag} slot="start"></${iconArrowExpanderRightTag}>
46
+ </${buttonTag}>
47
+ `)}
48
+ ${endSlotTemplate(context, definition)}
49
+ </div>
50
+ ${when(x => 'tabpanels' in x, html `
51
+ <div class="tabpanel" part="tabpanel">
52
+ <slot name="tabpanel" ${slotted('tabpanels')}></slot>
53
+ </div>
54
+ `)}
55
+ `;
56
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/patterns/tabs/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEnE,OAAO,EACH,eAAe,EACf,iBAAiB,EAGpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EACH,kBAAkB,EAClB,mBAAmB,EACtB,MAAM,wCAAwC,CAAC;AAEhD,kBAAkB;AAClB,MAAM,CAAC,MAAM,QAAQ,GAGjB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC,IAAI,CAAA;;;;UAIvB,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC;UACtC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,EAAE,IAAI,CAAW;eACzC,SAAS;;;8BAGM,gBAAgB,CAAC,KAAK;;0BAE1B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,EAAE;kBAClC,GAAG,CAAC,kBAAkB,CAAC;;kBAEvB,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC,CAAC;mBACrC,wBAAwB,mBAAmB,wBAAwB;gBACtE,SAAS;SAChB,CAAC;;;;;cAKI,GAAG,CAAC,SAAS,CAAC;;sCAEU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,gBAAgB,OAAO,CAAC,MAAM,CAAC;;;UAG7E,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,EAAE,IAAI,CAAW;eACzC,SAAS;;;8BAGM,gBAAgB,CAAC,KAAK;;0BAE1B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,kBAAkB,EAAE;;kBAEnC,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC;mBACtC,yBAAyB,mBAAmB,yBAAyB;gBACxE,SAAS;SAChB,CAAC;UACA,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC;;MAExC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,IAAI,CAAC,EAAE,IAAI,CAAM;;oCAER,OAAO,CAAC,WAAW,CAAC;;KAEnD,CAAC;CACL,CAAC","sourcesContent":["import { html, ref, slotted, when } from '@microsoft/fast-element';\nimport type { ViewTemplate } from '@microsoft/fast-element';\nimport {\n endSlotTemplate,\n startSlotTemplate,\n FoundationElementTemplate,\n TabsOptions\n} from '@microsoft/fast-foundation';\nimport type { Tabs } from '../../tabs';\nimport { buttonTag } from '../../button';\nimport { iconArrowExpanderLeftTag } from '../../icons/arrow-expander-left';\nimport { iconArrowExpanderRightTag } from '../../icons/arrow-expander-right';\nimport type { TabsOwner } from './types';\nimport { ButtonAppearance } from '../button/types';\nimport {\n scrollForwardLabel,\n scrollBackwardLabel\n} from '../../label-provider/core/label-tokens';\n\n// prettier-ignore\nexport const template: FoundationElementTemplate<\nViewTemplate<TabsOwner>,\nTabsOptions\n> = (context, definition) => html`\n <div\n class=\"tab-bar\"\n >\n ${startSlotTemplate(context, definition)}\n ${when(x => x.showScrollButtons, html<TabsOwner>`\n <${buttonTag} \n content-hidden\n class=\"scroll-button left\"\n appearance=\"${ButtonAppearance.ghost}\"\n tabindex=\"-1\"\n @click=\"${x => x.onScrollLeftClick()}\"\n ${ref('leftScrollButton')}\n >\n ${x => scrollForwardLabel.getValueFor(x)}\n <${iconArrowExpanderLeftTag} slot=\"start\"></${iconArrowExpanderLeftTag}>\n </${buttonTag}>\n `)}\n <div\n class=\"tablist\"\n part=\"tablist\"\n role=\"tablist\"\n ${ref('tablist')}\n >\n <slot class=\"tab\" name=\"${x => x.tabSlotName}\" part=\"tab\" ${slotted('tabs')}>\n </slot>\n </div>\n ${when(x => x.showScrollButtons, html<TabsOwner>`\n <${buttonTag}\n content-hidden\n class=\"scroll-button right\"\n appearance=\"${ButtonAppearance.ghost}\"\n tabindex=\"-1\"\n @click=\"${x => x.onScrollRightClick()}\"\n >\n ${x => scrollBackwardLabel.getValueFor(x)}\n <${iconArrowExpanderRightTag} slot=\"start\"></${iconArrowExpanderRightTag}>\n </${buttonTag}>\n `)}\n ${endSlotTemplate(context, definition)}\n </div>\n ${when(x => 'tabpanels' in x, html<Tabs>`\n <div class=\"tabpanel\" part=\"tabpanel\">\n <slot name=\"tabpanel\" ${slotted('tabpanels')}></slot>\n </div>\n `)}\n`;\n"]}
@@ -0,0 +1,21 @@
1
+ import type { TabsOwner } from '../types';
2
+ /**
3
+ * Page object for the `nimble-tabs` and `nimble-anchor-tabs` components to provide
4
+ * consistent ways of querying and interacting with the component during tests.
5
+ */
6
+ export declare abstract class TabsBasePageObject<T extends TabsOwner> {
7
+ protected readonly tabsElement: T;
8
+ protected readonly tabElementName: string;
9
+ protected readonly tabPanelElementName?: string | undefined;
10
+ constructor(tabsElement: T, tabElementName: string, tabPanelElementName?: string | undefined);
11
+ clickTab(index: number): Promise<void>;
12
+ pressKeyOnTab(index: number, key: string): Promise<void>;
13
+ setTabsWidth(width: number): Promise<void>;
14
+ clickScrollLeftButton(): Promise<void>;
15
+ clickScrollRightButton(): Promise<void>;
16
+ areScrollButtonsVisible(): boolean;
17
+ addTab(label: string): Promise<void>;
18
+ removeTab(index: number): Promise<void>;
19
+ updateTabLabel(index: number, label: string): Promise<void>;
20
+ getTabsViewScrollOffset(): number;
21
+ }