@ni/nimble-components 24.1.10 → 24.1.12

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.
@@ -1,94 +1,82 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display } from '@microsoft/fast-foundation';
3
3
  import { focusVisible } from '../utilities/style/focus';
4
- import { linkActiveDisabledFontColor, linkActiveFontColor, linkActiveProminentFontColor, linkDisabledFontColor, linkFont, linkFontColor, linkProminentDisabledFontColor, linkProminentFontColor } from '../theme-provider/design-tokens';
4
+ import { linkActiveFontColor, linkActiveProminentFontColor, linkDisabledFontColor, linkFont, linkFontColor, linkProminentFontColor } from '../theme-provider/design-tokens';
5
5
  export const styles = css `
6
- ${display('inline')}
6
+ @layer base, hover, focusVisible, active, disabled;
7
7
 
8
- :host {
9
- box-sizing: border-box;
10
- font: ${linkFont};
11
- }
12
-
13
- .top-container {
14
- display: contents;
15
- }
16
-
17
- [part='start'] {
18
- display: none;
19
- }
20
-
21
- .control {
22
- color: ${linkFontColor};
23
- text-decoration: underline;
24
- }
25
-
26
- .control${focusVisible} {
27
- display: inline;
28
- outline: none;
29
- box-shadow: inset 0px -1px ${linkFontColor};
30
- }
31
-
32
- .control:active {
33
- color: ${linkActiveFontColor};
34
- text-decoration: underline;
35
- }
8
+ @layer base {
9
+ ${display('inline')}
36
10
 
37
- .control${focusVisible}:active {
38
- box-shadow: inset 0px -1px ${linkActiveFontColor};
39
- }
11
+ :host {
12
+ box-sizing: border-box;
13
+ font: ${linkFont};
14
+ }
40
15
 
41
- .control:not(:any-link) {
42
- color: ${linkDisabledFontColor};
43
- text-decoration: none;
44
- }
16
+ .top-container {
17
+ display: contents;
18
+ }
45
19
 
46
- .control:not(:any-link):active {
47
- color: ${linkActiveDisabledFontColor};
48
- }
20
+ .control {
21
+ color: ${linkFontColor};
22
+ text-decoration: underline;
23
+ }
49
24
 
50
- :host([underline-hidden]) .control {
51
- text-decoration: none;
52
- }
25
+ :host([underline-hidden]) .control {
26
+ text-decoration: none;
27
+ }
53
28
 
54
- :host([underline-hidden]) .control:hover {
55
- text-decoration: underline;
56
- }
29
+ :host([appearance='prominent']) .control {
30
+ color: ${linkProminentFontColor};
31
+ }
57
32
 
58
- :host([underline-hidden]) .control${focusVisible} {
59
- text-decoration: underline;
60
- }
33
+ [part='start'] {
34
+ display: none;
35
+ }
61
36
 
62
- :host([underline-hidden]) .control:not(:any-link) {
63
- text-decoration: none;
64
- }
37
+ .content {
38
+ pointer-events: none;
39
+ }
65
40
 
66
- :host([appearance='prominent']) .control {
67
- color: ${linkProminentFontColor};
41
+ [part='end'] {
42
+ display: none;
43
+ }
68
44
  }
69
45
 
70
- :host([appearance='prominent']) .control:active {
71
- color: ${linkActiveProminentFontColor};
46
+ @layer hover {
47
+ .control:any-link:hover {
48
+ text-decoration: underline;
49
+ }
72
50
  }
73
51
 
74
- :host([appearance='prominent']) .control${focusVisible} {
75
- box-shadow: inset 0px -1px ${linkProminentFontColor};
52
+ @layer focusVisible {
53
+ .control${focusVisible} {
54
+ outline: none;
55
+ box-shadow: inset 0px -1px;
56
+ text-decoration: underline;
57
+ }
76
58
  }
77
59
 
78
- :host([appearance='prominent']) .control${focusVisible}:active {
79
- box-shadow: inset 0px -1px ${linkActiveProminentFontColor};
80
- }
60
+ @layer active {
61
+ .control:active {
62
+ color: ${linkActiveFontColor};
63
+ text-decoration: underline;
64
+ box-shadow: none;
65
+ }
81
66
 
82
- :host([appearance='prominent']) .control:not(:any-link) {
83
- color: ${linkProminentDisabledFontColor};
84
- }
67
+ :host([appearance='prominent']) .control:active {
68
+ color: ${linkActiveProminentFontColor};
69
+ }
85
70
 
86
- .content {
87
- pointer-events: none;
71
+ :host([underline-hidden]) .control:active {
72
+ text-decoration: none;
73
+ }
88
74
  }
89
75
 
90
- [part='end'] {
91
- display: none;
76
+ @layer disabled {
77
+ .control:not(:any-link) {
78
+ color: ${linkDisabledFontColor};
79
+ }
92
80
  }
93
81
  `;
94
82
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/anchor/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,2BAA2B,EAC3B,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,8BAA8B,EAC9B,sBAAsB,EACzB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,QAAQ,CAAC;;;;gBAIP,QAAQ;;;;;;;;;;;;iBAYP,aAAa;;;;cAIhB,YAAY;;;qCAGW,aAAa;;;;iBAIjC,mBAAmB;;;;cAItB,YAAY;qCACW,mBAAmB;;;;iBAIvC,qBAAqB;;;;;iBAKrB,2BAA2B;;;;;;;;;;;wCAWJ,YAAY;;;;;;;;;iBASnC,sBAAsB;;;;iBAItB,4BAA4B;;;8CAGC,YAAY;qCACrB,sBAAsB;;;8CAGb,YAAY;qCACrB,4BAA4B;;;;iBAIhD,8BAA8B;;;;;;;;;;CAU9C,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '@microsoft/fast-foundation';\nimport { focusVisible } from '../utilities/style/focus';\nimport {\n linkActiveDisabledFontColor,\n linkActiveFontColor,\n linkActiveProminentFontColor,\n linkDisabledFontColor,\n linkFont,\n linkFontColor,\n linkProminentDisabledFontColor,\n linkProminentFontColor\n} from '../theme-provider/design-tokens';\n\nexport const styles = css`\n ${display('inline')}\n\n :host {\n box-sizing: border-box;\n font: ${linkFont};\n }\n\n .top-container {\n display: contents;\n }\n\n [part='start'] {\n display: none;\n }\n\n .control {\n color: ${linkFontColor};\n text-decoration: underline;\n }\n\n .control${focusVisible} {\n display: inline;\n outline: none;\n box-shadow: inset 0px -1px ${linkFontColor};\n }\n\n .control:active {\n color: ${linkActiveFontColor};\n text-decoration: underline;\n }\n\n .control${focusVisible}:active {\n box-shadow: inset 0px -1px ${linkActiveFontColor};\n }\n\n .control:not(:any-link) {\n color: ${linkDisabledFontColor};\n text-decoration: none;\n }\n\n .control:not(:any-link):active {\n color: ${linkActiveDisabledFontColor};\n }\n\n :host([underline-hidden]) .control {\n text-decoration: none;\n }\n\n :host([underline-hidden]) .control:hover {\n text-decoration: underline;\n }\n\n :host([underline-hidden]) .control${focusVisible} {\n text-decoration: underline;\n }\n\n :host([underline-hidden]) .control:not(:any-link) {\n text-decoration: none;\n }\n\n :host([appearance='prominent']) .control {\n color: ${linkProminentFontColor};\n }\n\n :host([appearance='prominent']) .control:active {\n color: ${linkActiveProminentFontColor};\n }\n\n :host([appearance='prominent']) .control${focusVisible} {\n box-shadow: inset 0px -1px ${linkProminentFontColor};\n }\n\n :host([appearance='prominent']) .control${focusVisible}:active {\n box-shadow: inset 0px -1px ${linkActiveProminentFontColor};\n }\n\n :host([appearance='prominent']) .control:not(:any-link) {\n color: ${linkProminentDisabledFontColor};\n }\n\n .content {\n pointer-events: none;\n }\n\n [part='end'] {\n display: none;\n }\n`;\n"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/anchor/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,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,sBAAsB,EACzB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;UAIf,OAAO,CAAC,QAAQ,CAAC;;;;oBAIP,QAAQ;;;;;;;;qBAQP,aAAa;;;;;;;;;qBASb,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;kBAuBzB,YAAY;;;;;;;;;qBAST,mBAAmB;;;;;;qBAMnB,4BAA4B;;;;;;;;;;qBAU5B,qBAAqB;;;CAGzC,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '@microsoft/fast-foundation';\nimport { focusVisible } from '../utilities/style/focus';\nimport {\n linkActiveFontColor,\n linkActiveProminentFontColor,\n linkDisabledFontColor,\n linkFont,\n linkFontColor,\n linkProminentFontColor\n} from '../theme-provider/design-tokens';\n\nexport const styles = css`\n @layer base, hover, focusVisible, active, disabled;\n\n @layer base {\n ${display('inline')}\n\n :host {\n box-sizing: border-box;\n font: ${linkFont};\n }\n\n .top-container {\n display: contents;\n }\n\n .control {\n color: ${linkFontColor};\n text-decoration: underline;\n }\n\n :host([underline-hidden]) .control {\n text-decoration: none;\n }\n\n :host([appearance='prominent']) .control {\n color: ${linkProminentFontColor};\n }\n\n [part='start'] {\n display: none;\n }\n\n .content {\n pointer-events: none;\n }\n\n [part='end'] {\n display: none;\n }\n }\n\n @layer hover {\n .control:any-link:hover {\n text-decoration: underline;\n }\n }\n\n @layer focusVisible {\n .control${focusVisible} {\n outline: none;\n box-shadow: inset 0px -1px;\n text-decoration: underline;\n }\n }\n\n @layer active {\n .control:active {\n color: ${linkActiveFontColor};\n text-decoration: underline;\n box-shadow: none;\n }\n\n :host([appearance='prominent']) .control:active {\n color: ${linkActiveProminentFontColor};\n }\n\n :host([underline-hidden]) .control:active {\n text-decoration: none;\n }\n }\n\n @layer disabled {\n .control:not(:any-link) {\n color: ${linkDisabledFontColor};\n }\n }\n`;\n"]}
@@ -44,7 +44,7 @@ export const styles = css `
44
44
 
45
45
  .control:active {
46
46
  color: var(--ni-private-breadcrumb-link-active-font-color);
47
- text-decoration: underline;
47
+ text-decoration: none;
48
48
  }
49
49
 
50
50
  [part='start'] {
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/breadcrumb-item/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,oBAAoB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,aAAa,CAAC;;;kBAGV,aAAa;;mCAEI,WAAW;;UAEpC;AACE;mDACmD,CAAC,EACxD;iBACS,aAAa;gBACd,QAAQ;;;;;;;;;;;;;kBAaN,WAAW;oCACO,WAAW;;;;;;;;cAQjC,YAAY;kBACR,WAAW,UAAU,gBAAgB;6BAC1B,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2B5B,QAAQ;kBACP,QAAQ;gBACV,oBAAoB;;CAEnC,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '@microsoft/fast-foundation';\nimport {\n bodyFontColor,\n borderHoverColor,\n borderWidth,\n controlHeight,\n iconSize,\n linkFont,\n placeholderFontColor\n} from '../theme-provider/design-tokens';\nimport { focusVisible } from '../utilities/style/focus';\n\nexport const styles = css`\n ${display('inline-flex')}\n\n :host {\n height: ${controlHeight};\n box-sizing: border-box;\n padding-left: calc(4px - ${borderWidth});\n\n ${\n /* When href removed the .control element is also removed\n so this becomes the fallback color for the slot */ ''\n }\n color: ${bodyFontColor};\n font: ${linkFont};\n }\n\n .listitem {\n display: flex;\n align-items: center;\n }\n\n .control {\n color: var(--ni-private-breadcrumb-link-font-color);\n display: flex;\n align-items: center;\n justify-content: center;\n border: ${borderWidth} solid transparent;\n padding-right: calc(4px - ${borderWidth});\n text-decoration: none;\n }\n\n .control:hover {\n text-decoration: underline;\n }\n\n .control${focusVisible} {\n border: ${borderWidth} solid ${borderHoverColor};\n outline: 2px solid ${borderHoverColor};\n outline-offset: 1px;\n }\n\n .control:active {\n color: var(--ni-private-breadcrumb-link-active-font-color);\n text-decoration: underline;\n }\n\n [part='start'] {\n display: none;\n }\n\n .content {\n pointer-events: none;\n }\n\n [part='end'] {\n display: none;\n }\n\n slot[name='separator'] {\n display: flex;\n align-items: center;\n }\n\n slot[name='separator'] svg {\n width: ${iconSize};\n height: ${iconSize};\n fill: ${placeholderFontColor};\n }\n`;\n"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/breadcrumb-item/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,oBAAoB,EACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,aAAa,CAAC;;;kBAGV,aAAa;;mCAEI,WAAW;;UAEpC;AACE;mDACmD,CAAC,EACxD;iBACS,aAAa;gBACd,QAAQ;;;;;;;;;;;;;kBAaN,WAAW;oCACO,WAAW;;;;;;;;cAQjC,YAAY;kBACR,WAAW,UAAU,gBAAgB;6BAC1B,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2B5B,QAAQ;kBACP,QAAQ;gBACV,oBAAoB;;CAEnC,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '@microsoft/fast-foundation';\nimport {\n bodyFontColor,\n borderHoverColor,\n borderWidth,\n controlHeight,\n iconSize,\n linkFont,\n placeholderFontColor\n} from '../theme-provider/design-tokens';\nimport { focusVisible } from '../utilities/style/focus';\n\nexport const styles = css`\n ${display('inline-flex')}\n\n :host {\n height: ${controlHeight};\n box-sizing: border-box;\n padding-left: calc(4px - ${borderWidth});\n\n ${\n /* When href removed the .control element is also removed\n so this becomes the fallback color for the slot */ ''\n }\n color: ${bodyFontColor};\n font: ${linkFont};\n }\n\n .listitem {\n display: flex;\n align-items: center;\n }\n\n .control {\n color: var(--ni-private-breadcrumb-link-font-color);\n display: flex;\n align-items: center;\n justify-content: center;\n border: ${borderWidth} solid transparent;\n padding-right: calc(4px - ${borderWidth});\n text-decoration: none;\n }\n\n .control:hover {\n text-decoration: underline;\n }\n\n .control${focusVisible} {\n border: ${borderWidth} solid ${borderHoverColor};\n outline: 2px solid ${borderHoverColor};\n outline-offset: 1px;\n }\n\n .control:active {\n color: var(--ni-private-breadcrumb-link-active-font-color);\n text-decoration: none;\n }\n\n [part='start'] {\n display: none;\n }\n\n .content {\n pointer-events: none;\n }\n\n [part='end'] {\n display: none;\n }\n\n slot[name='separator'] {\n display: flex;\n align-items: center;\n }\n\n slot[name='separator'] svg {\n width: ${iconSize};\n height: ${iconSize};\n fill: ${placeholderFontColor};\n }\n`;\n"]}
@@ -27,4 +27,5 @@ export declare class RichTextMarkdownParser {
27
27
  private static getCustomSchemaConfiguration;
28
28
  private static setup;
29
29
  private static cleanup;
30
+ private static startsWithHttpOrHttps;
30
31
  }
@@ -101,12 +101,17 @@ export class RichTextMarkdownParser {
101
101
  * scheme and no matching mention pattern will be rendered as plain text (anchor with no href).
102
102
  * With this, the user can click the links only when the scheme is HTTP/HTTPS
103
103
  */
104
- href: /^https?:\/\//i.test(href) ? href : null,
104
+ href: RichTextMarkdownParser.startsWithHttpOrHttps(href)
105
+ ? href
106
+ : null,
105
107
  rel: node.attrs.rel,
106
108
  // Adding `class` here is a workaround to render two mentions without a whitespace as display names
107
109
  // This attribute can be removed when the below issue is resolved
108
110
  // https://github.com/ni/nimble/issues/1707
109
- class: href
111
+ class: href,
112
+ 'underline-hidden': RichTextMarkdownParser.startsWithHttpOrHttps(href)
113
+ ? null
114
+ : true
110
115
  }
111
116
  ];
112
117
  }
@@ -124,6 +129,9 @@ export class RichTextMarkdownParser {
124
129
  RichTextMarkdownParser.mentionConfigs = undefined;
125
130
  RichTextMarkdownParser.mentionedHrefs.clear();
126
131
  }
132
+ static startsWithHttpOrHttps(href) {
133
+ return /^https?:\/\//i.test(href);
134
+ }
127
135
  }
128
136
  _a = RichTextMarkdownParser;
129
137
  RichTextMarkdownParser.mentionedHrefs = new Set();
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-parser.js","sourceRoot":"","sources":["../../../../src/rich-text/models/markdown-parser.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,MAAM,EACN,qBAAqB,EACrB,cAAc,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQzC;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAgB/B;;;;OAIG;IACI,MAAM,CAAC,kBAAkB,CAC5B,KAAa,EACb,2BAAkE;QAElE,IAAI;YACA,sBAAsB,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAC1D,MAAM,qBAAqB,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC/D,IAAI,qBAAqB,KAAK,IAAI,EAAE;gBAChC,OAAO;oBACH,QAAQ,EAAE,QAAQ,CAAC,sBAAsB,EAAE;oBAC3C,cAAc,EAAE,KAAK,CAAC,IAAI,CACtB,sBAAsB,CAAC,cAAc,CACxC;iBACJ,CAAC;aACL;YACD,OAAO;gBACH,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAC1C,qBAAqB,CAAC,OAAO,CAChC;gBACD,cAAc,EAAE,KAAK,CAAC,IAAI,CACtB,sBAAsB,CAAC,cAA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wBAAwB,EAAE,CAAC;AACjD,oCAAa,GAAG,aAAa,CAAC,UAAU,CAC5D,EAAI,CAAC,aAAa,CACrB,CAAC","sourcesContent":["import {\n schema,\n defaultMarkdownParser,\n MarkdownParser\n} from 'prosemirror-markdown';\nimport { DOMSerializer, Schema } from 'prosemirror-model';\nimport { anchorTag } from '../../anchor';\nimport type { MarkdownParserMentionConfiguration } from './markdown-parser-mention-configuration';\n\nexport interface ParseResult {\n fragment: HTMLElement | DocumentFragment;\n mentionedHrefs: string[];\n}\n\n/**\n * Provides markdown parser for rich text components\n */\nexport class RichTextMarkdownParser {\n private static readonly mentionedHrefs: Set<string> = new Set();\n private static readonly updatedSchema = this.getCustomSchemaConfiguration();\n\n private static readonly markdownParser = this.initializeMarkdownParser();\n private static readonly domSerializer = DOMSerializer.fromSchema(\n this.updatedSchema\n );\n\n /**\n * The markdown parser is static (shared across all rich text components) because it is expensive to create.\n * To configure parse calls with the mention configurations which can be unique per component instance\n * we store static configuration in this member and access it from Prosemirror callbacks.\n */\n private static mentionConfigs?: MarkdownParserMentionConfiguration[];\n\n /**\n * This function takes a markdown string, parses it using the ProseMirror MarkdownParser, serializes the parsed content into a\n * DOM structure using a DOMSerializer, and returns the serialized result.\n * If the markdown parser returns null, it will clear the viewer component by creating an empty document fragment.\n */\n public static parseMarkdownToDOM(\n value: string,\n markdownParserMentionConfig?: MarkdownParserMentionConfiguration[]\n ): ParseResult {\n try {\n RichTextMarkdownParser.setup(markdownParserMentionConfig);\n const parsedMarkdownContent = this.markdownParser.parse(value);\n if (parsedMarkdownContent === null) {\n return {\n fragment: document.createDocumentFragment(),\n mentionedHrefs: Array.from(\n RichTextMarkdownParser.mentionedHrefs\n )\n };\n }\n return {\n fragment: this.domSerializer.serializeFragment(\n parsedMarkdownContent.content\n ),\n mentionedHrefs: Array.from(\n RichTextMarkdownParser.mentionedHrefs\n )\n };\n } finally {\n RichTextMarkdownParser.cleanup();\n }\n }\n\n private static initializeMarkdownParser(): MarkdownParser {\n /**\n * It configures the tokenizer of the default Markdown parser with the 'zero' preset.\n * The 'zero' preset is a configuration with no rules enabled by default to selectively enable specific rules.\n * https://github.com/markdown-it/markdown-it/blob/2b6cac25823af011ff3bc7628bc9b06e483c5a08/lib/presets/zero.js#L1\n *\n */\n const zeroTokenizerConfiguration = defaultMarkdownParser.tokenizer.configure('zero');\n\n // The detailed information of the supported rules were provided in the below CommonMark spec document.\n // https://spec.commonmark.org/0.30/\n const supportedTokenizerRules = zeroTokenizerConfiguration.enable([\n 'emphasis',\n 'list',\n 'escape',\n 'autolink',\n 'newline'\n ]);\n\n /**\n * In order to display encoded characters, non-ASCII characters, emojis, and other special characters in their original form,\n * we bypass the default normalization of link text in markdown-it. This is done because we support only \"AutoLink\" feature in CommonMark flavor.\n * \"normalizeLinkText\" method reference in markdown-it: https://github.com/markdown-it/markdown-it/blob/2b6cac25823af011ff3bc7628bc9b06e483c5a08/lib/index.js#L67C1-L86C2\n *\n * We can use the default normalization once hyperlink support is added.\n * See: https://github.com/ni/nimble/issues/1527\n */\n supportedTokenizerRules.normalizeLinkText = url => url;\n\n return new MarkdownParser(\n this.updatedSchema,\n supportedTokenizerRules,\n defaultMarkdownParser.tokens\n );\n }\n\n private static getCustomSchemaConfiguration(): Schema {\n return new Schema({\n nodes: schema.spec.nodes,\n marks: {\n link: {\n attrs: {\n href: {},\n rel: { default: 'noopener noreferrer' },\n // Adding `class` here is a workaround to render two mentions without a whitespace as display names\n // This attribute can be removed when the below issue is resolved\n // https://github.com/ni/nimble/issues/1707\n class: { default: '' }\n },\n // Inclusive can be updated when hyperlink support added\n // See: https://github.com/ni/nimble/issues/1527\n inclusive: false,\n // Excludes can be removed/enabled when hyperlink support added\n // See: https://github.com/ni/nimble/issues/1527\n excludes: '_',\n toDOM(node) {\n const href = node.attrs.href as string;\n const currentMention = RichTextMarkdownParser.mentionConfigs?.find(\n mention => mention.isValidMentionHref(href)\n );\n const displayName = currentMention?.getDisplayName(href);\n\n if (currentMention && displayName) {\n RichTextMarkdownParser.mentionedHrefs.add(href);\n\n return [\n currentMention.viewElement,\n {\n 'mention-href': href,\n 'mention-label': displayName\n }\n ];\n }\n\n return [\n anchorTag,\n {\n /**\n * Both mention and absolute link markdown share the autolink format in CommonMark flavor.\n * Absolute links with HTTP/HTTPS will be rendered as links. Absolute links that match the\n * mention pattern will be rendered as mention view element. Absolute links without HTTP/HTTPS\n * scheme and no matching mention pattern will be rendered as plain text (anchor with no href).\n * With this, the user can click the links only when the scheme is HTTP/HTTPS\n */\n href: /^https?:\\/\\//i.test(href) ? href : null,\n rel: node.attrs.rel as Attr,\n // Adding `class` here is a workaround to render two mentions without a whitespace as display names\n // This attribute can be removed when the below issue is resolved\n // https://github.com/ni/nimble/issues/1707\n class: href\n }\n ];\n }\n },\n em: schema.spec.marks.get('em')!,\n strong: schema.spec.marks.get('strong')!\n }\n });\n }\n\n private static setup(\n markdownParserMentionConfig:\n | MarkdownParserMentionConfiguration[]\n | undefined\n ): void {\n RichTextMarkdownParser.mentionConfigs = markdownParserMentionConfig;\n RichTextMarkdownParser.mentionedHrefs.clear();\n }\n\n private static cleanup(): void {\n RichTextMarkdownParser.mentionConfigs = undefined;\n RichTextMarkdownParser.mentionedHrefs.clear();\n }\n}\n"]}
1
+ {"version":3,"file":"markdown-parser.js","sourceRoot":"","sources":["../../../../src/rich-text/models/markdown-parser.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,MAAM,EACN,qBAAqB,EACrB,cAAc,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQzC;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAgB/B;;;;OAIG;IACI,MAAM,CAAC,kBAAkB,CAC5B,KAAa,EACb,2BAAkE;QAElE,IAAI;YACA,sBAAsB,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAC1D,MAA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BAChC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAE;aAC3C;SACJ,CAAC,CAAC;IACP,CAAC;IAEO,MAAM,CAAC,KAAK,CAChB,2BAEW;QAEX,sBAAsB,CAAC,cAAc,GAAG,2BAA2B,CAAC;QACpE,sBAAsB,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;IAClD,CAAC;IAEO,MAAM,CAAC,OAAO;QAClB,sBAAsB,CAAC,cAAc,GAAG,SAAS,CAAC;QAClD,sBAAsB,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;IAClD,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,IAAY;QAC7C,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;;;AA9KuB,qCAAc,GAAgB,IAAI,GAAG,EAAE,CAAC;AACxC,oCAAa,GAAG,EAAI,CAAC,4BAA4B,EAAE,CAAC;AAEpD,qCAAc,GAAG,EAAI,CAAC,wBAAwB,EAAE,CAAC;AACjD,oCAAa,GAAG,aAAa,CAAC,UAAU,CAC5D,EAAI,CAAC,aAAa,CACrB,CAAC","sourcesContent":["import {\n schema,\n defaultMarkdownParser,\n MarkdownParser\n} from 'prosemirror-markdown';\nimport { DOMSerializer, Schema } from 'prosemirror-model';\nimport { anchorTag } from '../../anchor';\nimport type { MarkdownParserMentionConfiguration } from './markdown-parser-mention-configuration';\n\nexport interface ParseResult {\n fragment: HTMLElement | DocumentFragment;\n mentionedHrefs: string[];\n}\n\n/**\n * Provides markdown parser for rich text components\n */\nexport class RichTextMarkdownParser {\n private static readonly mentionedHrefs: Set<string> = new Set();\n private static readonly updatedSchema = this.getCustomSchemaConfiguration();\n\n private static readonly markdownParser = this.initializeMarkdownParser();\n private static readonly domSerializer = DOMSerializer.fromSchema(\n this.updatedSchema\n );\n\n /**\n * The markdown parser is static (shared across all rich text components) because it is expensive to create.\n * To configure parse calls with the mention configurations which can be unique per component instance\n * we store static configuration in this member and access it from Prosemirror callbacks.\n */\n private static mentionConfigs?: MarkdownParserMentionConfiguration[];\n\n /**\n * This function takes a markdown string, parses it using the ProseMirror MarkdownParser, serializes the parsed content into a\n * DOM structure using a DOMSerializer, and returns the serialized result.\n * If the markdown parser returns null, it will clear the viewer component by creating an empty document fragment.\n */\n public static parseMarkdownToDOM(\n value: string,\n markdownParserMentionConfig?: MarkdownParserMentionConfiguration[]\n ): ParseResult {\n try {\n RichTextMarkdownParser.setup(markdownParserMentionConfig);\n const parsedMarkdownContent = this.markdownParser.parse(value);\n if (parsedMarkdownContent === null) {\n return {\n fragment: document.createDocumentFragment(),\n mentionedHrefs: Array.from(\n RichTextMarkdownParser.mentionedHrefs\n )\n };\n }\n return {\n fragment: this.domSerializer.serializeFragment(\n parsedMarkdownContent.content\n ),\n mentionedHrefs: Array.from(\n RichTextMarkdownParser.mentionedHrefs\n )\n };\n } finally {\n RichTextMarkdownParser.cleanup();\n }\n }\n\n private static initializeMarkdownParser(): MarkdownParser {\n /**\n * It configures the tokenizer of the default Markdown parser with the 'zero' preset.\n * The 'zero' preset is a configuration with no rules enabled by default to selectively enable specific rules.\n * https://github.com/markdown-it/markdown-it/blob/2b6cac25823af011ff3bc7628bc9b06e483c5a08/lib/presets/zero.js#L1\n *\n */\n const zeroTokenizerConfiguration = defaultMarkdownParser.tokenizer.configure('zero');\n\n // The detailed information of the supported rules were provided in the below CommonMark spec document.\n // https://spec.commonmark.org/0.30/\n const supportedTokenizerRules = zeroTokenizerConfiguration.enable([\n 'emphasis',\n 'list',\n 'escape',\n 'autolink',\n 'newline'\n ]);\n\n /**\n * In order to display encoded characters, non-ASCII characters, emojis, and other special characters in their original form,\n * we bypass the default normalization of link text in markdown-it. This is done because we support only \"AutoLink\" feature in CommonMark flavor.\n * \"normalizeLinkText\" method reference in markdown-it: https://github.com/markdown-it/markdown-it/blob/2b6cac25823af011ff3bc7628bc9b06e483c5a08/lib/index.js#L67C1-L86C2\n *\n * We can use the default normalization once hyperlink support is added.\n * See: https://github.com/ni/nimble/issues/1527\n */\n supportedTokenizerRules.normalizeLinkText = url => url;\n\n return new MarkdownParser(\n this.updatedSchema,\n supportedTokenizerRules,\n defaultMarkdownParser.tokens\n );\n }\n\n private static getCustomSchemaConfiguration(): Schema {\n return new Schema({\n nodes: schema.spec.nodes,\n marks: {\n link: {\n attrs: {\n href: {},\n rel: { default: 'noopener noreferrer' },\n // Adding `class` here is a workaround to render two mentions without a whitespace as display names\n // This attribute can be removed when the below issue is resolved\n // https://github.com/ni/nimble/issues/1707\n class: { default: '' }\n },\n // Inclusive can be updated when hyperlink support added\n // See: https://github.com/ni/nimble/issues/1527\n inclusive: false,\n // Excludes can be removed/enabled when hyperlink support added\n // See: https://github.com/ni/nimble/issues/1527\n excludes: '_',\n toDOM(node) {\n const href = node.attrs.href as string;\n const currentMention = RichTextMarkdownParser.mentionConfigs?.find(\n mention => mention.isValidMentionHref(href)\n );\n const displayName = currentMention?.getDisplayName(href);\n\n if (currentMention && displayName) {\n RichTextMarkdownParser.mentionedHrefs.add(href);\n\n return [\n currentMention.viewElement,\n {\n 'mention-href': href,\n 'mention-label': displayName\n }\n ];\n }\n\n return [\n anchorTag,\n {\n /**\n * Both mention and absolute link markdown share the autolink format in CommonMark flavor.\n * Absolute links with HTTP/HTTPS will be rendered as links. Absolute links that match the\n * mention pattern will be rendered as mention view element. Absolute links without HTTP/HTTPS\n * scheme and no matching mention pattern will be rendered as plain text (anchor with no href).\n * With this, the user can click the links only when the scheme is HTTP/HTTPS\n */\n href: RichTextMarkdownParser.startsWithHttpOrHttps(\n href\n )\n ? href\n : null,\n rel: node.attrs.rel as Attr,\n // Adding `class` here is a workaround to render two mentions without a whitespace as display names\n // This attribute can be removed when the below issue is resolved\n // https://github.com/ni/nimble/issues/1707\n class: href,\n 'underline-hidden':\n RichTextMarkdownParser.startsWithHttpOrHttps(\n href\n )\n ? null\n : true\n }\n ];\n }\n },\n em: schema.spec.marks.get('em')!,\n strong: schema.spec.marks.get('strong')!\n }\n });\n }\n\n private static setup(\n markdownParserMentionConfig:\n | MarkdownParserMentionConfiguration[]\n | undefined\n ): void {\n RichTextMarkdownParser.mentionConfigs = markdownParserMentionConfig;\n RichTextMarkdownParser.mentionedHrefs.clear();\n }\n\n private static cleanup(): void {\n RichTextMarkdownParser.mentionConfigs = undefined;\n RichTextMarkdownParser.mentionedHrefs.clear();\n }\n\n private static startsWithHttpOrHttps(href: string): boolean {\n return /^https?:\\/\\//i.test(href);\n }\n}\n"]}
@@ -42,10 +42,13 @@ export const styles = css `
42
42
 
43
43
  ${
44
44
  /**
45
- * When an absolute link is not HTTPS/HTTP, the anchor tag renders without an `href`, appearing as plain text.
46
- * However, the `nimble-anchor` displays differently in color when the `href` attribute is absent.
47
- * To ensure a consistent appearance, the font color is forced to the default link color regardless of the `href`
48
- * attribute's presence.
45
+ * In the rich-text editor, an absolute link renders as a native anchor, not a `nimble-anchor`. When such a link
46
+ * is not HTTPS/HTTP, the anchor renders without an `href`, appearing as plain text.
47
+ * However, in the rich-text viewer, absolute links are rendered as `nimble-anchor`s, and they do not look like
48
+ * plain text when the `href` attribute is absent. They have a "disabled" color and may have an underline.
49
+ * To ensure a consistent appearance between the editor and viewer, we force the font color to the default link/
50
+ * plain text color regardless of the `href` attribute's presence. To remove the underline, the markdown parser
51
+ * emits an `underline-hidden` attribute when the `href` attribute is absent.
49
52
  *
50
53
  * See models/markdown-parser.ts where link elements are emitted for more info.
51
54
  */ ''}
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/rich-text/viewer/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,QAAQ,EACR,aAAa,EACb,aAAa,EAChB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;gBAGL,QAAQ;;iBAEP,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2BxB;AACE,gLAAgL,CAAC,EACrL;;;;;MAKE;AACE;;;;;;;GAOG,CAAC,EACR;;iBAEa,aAAa;;CAE7B,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '@microsoft/fast-foundation';\nimport {\n bodyFont,\n bodyFontColor,\n linkFontColor\n} from '../../theme-provider/design-tokens';\n\nexport const styles = css`\n ${display('flex')}\n\n :host {\n font: ${bodyFont};\n outline: none;\n color: ${bodyFontColor};\n width: auto;\n overflow: auto;\n height: 100%;\n }\n\n .viewer {\n font: inherit;\n outline: none;\n box-sizing: border-box;\n position: relative;\n color: inherit;\n overflow-wrap: anywhere;\n }\n\n .viewer > :first-child {\n margin-block-start: 0;\n }\n\n .viewer > :last-child {\n margin-block-end: 0;\n }\n\n li > p {\n margin-block: 0;\n }\n\n ${\n /* In Firefox, if the paragraph within the list is empty, the ordered lists overlap. Therefore, hiding the paragraph element allows for the proper rendering of empty lists. */ ''\n }\n li > p:empty {\n display: none;\n }\n\n ${\n /**\n * When an absolute link is not HTTPS/HTTP, the anchor tag renders without an `href`, appearing as plain text.\n * However, the `nimble-anchor` displays differently in color when the `href` attribute is absent.\n * To ensure a consistent appearance, the font color is forced to the default link color regardless of the `href`\n * attribute's presence.\n *\n * See models/markdown-parser.ts where link elements are emitted for more info.\n */ ''\n }\n nimble-anchor::part(control) {\n color: ${linkFontColor};\n }\n`;\n"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/rich-text/viewer/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,QAAQ,EACR,aAAa,EACb,aAAa,EAChB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;gBAGL,QAAQ;;iBAEP,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;MA2BxB;AACE,gLAAgL,CAAC,EACrL;;;;;MAKE;AACE;;;;;;;;;;GAUG,CAAC,EACR;;iBAEa,aAAa;;CAE7B,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '@microsoft/fast-foundation';\nimport {\n bodyFont,\n bodyFontColor,\n linkFontColor\n} from '../../theme-provider/design-tokens';\n\nexport const styles = css`\n ${display('flex')}\n\n :host {\n font: ${bodyFont};\n outline: none;\n color: ${bodyFontColor};\n width: auto;\n overflow: auto;\n height: 100%;\n }\n\n .viewer {\n font: inherit;\n outline: none;\n box-sizing: border-box;\n position: relative;\n color: inherit;\n overflow-wrap: anywhere;\n }\n\n .viewer > :first-child {\n margin-block-start: 0;\n }\n\n .viewer > :last-child {\n margin-block-end: 0;\n }\n\n li > p {\n margin-block: 0;\n }\n\n ${\n /* In Firefox, if the paragraph within the list is empty, the ordered lists overlap. Therefore, hiding the paragraph element allows for the proper rendering of empty lists. */ ''\n }\n li > p:empty {\n display: none;\n }\n\n ${\n /**\n * In the rich-text editor, an absolute link renders as a native anchor, not a `nimble-anchor`. When such a link\n * is not HTTPS/HTTP, the anchor renders without an `href`, appearing as plain text.\n * However, in the rich-text viewer, absolute links are rendered as `nimble-anchor`s, and they do not look like\n * plain text when the `href` attribute is absent. They have a \"disabled\" color and may have an underline.\n * To ensure a consistent appearance between the editor and viewer, we force the font color to the default link/\n * plain text color regardless of the `href` attribute's presence. To remove the underline, the markdown parser\n * emits an `underline-hidden` attribute when the `href` attribute is absent.\n *\n * See models/markdown-parser.ts where link elements are emitted for more info.\n */ ''\n }\n nimble-anchor::part(control) {\n color: ${linkFontColor};\n }\n`;\n"]}
@@ -16,6 +16,9 @@ import { FormAssociatedSelect } from './models/select-form-associated';
16
16
  const isNimbleListOption = (el) => {
17
17
  return el instanceof ListOption;
18
18
  };
19
+ const isOptionSelectable = (el) => {
20
+ return !el.visuallyHidden && !el.disabled && !el.hidden;
21
+ };
19
22
  /**
20
23
  * A nimble-styled HTML select.
21
24
  */
@@ -450,7 +453,9 @@ export class Select extends FormAssociatedSelect {
450
453
  // don't call super.selectNextOption as that relies on side-effecty
451
454
  // behavior to not select disabled option (which no longer works)
452
455
  for (let i = this.selectedIndex + 1; i < this.options.length; i++) {
453
- if (!this.options[i]?.disabled) {
456
+ const listOption = this.options[i];
457
+ if (isNimbleListOption(listOption)
458
+ && isOptionSelectable(listOption)) {
454
459
  this.selectedIndex = i;
455
460
  break;
456
461
  }
@@ -460,7 +465,9 @@ export class Select extends FormAssociatedSelect {
460
465
  // don't call super.selectPreviousOption as that relies on side-effecty
461
466
  // behavior to not select disabled option (which no longer works)
462
467
  for (let i = this.selectedIndex - 1; i >= 0; i--) {
463
- if (!this.options[i]?.disabled) {
468
+ const listOption = this.options[i];
469
+ if (isNimbleListOption(listOption)
470
+ && isOptionSelectable(listOption)) {
464
471
  this.selectedIndex = i;
465
472
  break;
466
473
  }
@@ -569,9 +576,6 @@ export class Select extends FormAssociatedSelect {
569
576
  const optionIsSelected = (option) => {
570
577
  return option.hasAttribute('selected') || option.selected;
571
578
  };
572
- const optionIsDisabled = (option) => {
573
- return option.hasAttribute('disabled') || option.disabled;
574
- };
575
579
  let selectedIndex = -1;
576
580
  let firstValidOptionIndex = -1;
577
581
  for (let i = 0; i < options?.length; i++) {
@@ -579,7 +583,8 @@ export class Select extends FormAssociatedSelect {
579
583
  if (optionIsSelected(option) || option?.value === this.value) {
580
584
  selectedIndex = i;
581
585
  }
582
- if (firstValidOptionIndex === -1 && !optionIsDisabled(option)) {
586
+ if (firstValidOptionIndex === -1
587
+ && isOptionSelectable(option)) {
583
588
  firstValidOptionIndex = i;
584
589
  }
585
590
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/select/index.ts"],"names":[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B,QAAQ;IACR,MAAM;IACN,SAAS,EAAE,sBAAsB,CAAC,IAAI;IACtC,GAAG,EAAE,IAAI,CAAQ;WACV,sBAAsB;;;aAGpB,sBAAsB;UACzB,iBAAiB;KACtB;CACJ,CAAC,CAAC;AAEH,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AACnD,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC","sourcesContent":["// Based on: https://github.com/microsoft/fast/blob/%40microsoft/fast-foundation_v2.49.5/packages/web-components/fast-foundation/src/select/select.ts\nimport {\n attr,\n html,\n observable,\n Observable,\n volatile\n} from '@microsoft/fast-element';\nimport {\n AnchoredRegion,\n DesignSystem,\n Select as FoundationSelect,\n ListboxOption,\n SelectOptions,\n SelectPosition,\n applyMixins,\n StartEnd,\n DelegatesARIASelect\n} from '@microsoft/fast-foundation';\nimport {\n keyArrowDown,\n keyArrowUp,\n keyEnd,\n keyEnter,\n keyEscape,\n keyHome,\n keySpace,\n keyTab,\n uniqueId\n} from '@microsoft/fast-web-utilities';\nimport { arrowExpanderDown16X16 } from '@ni/nimble-tokens/dist/icons/js';\nimport { styles } from './styles';\nimport {\n DropdownAppearance,\n ListOptionOwner\n} from '../patterns/dropdown/types';\nimport { errorTextTemplate } from '../patterns/error/template';\nimport type { ErrorPattern } from '../patterns/error/types';\nimport { iconExclamationMarkTag } from '../icons/exclamation-mark';\nimport { template } from './template';\nimport { ListOption } from '../list-option';\nimport { FilterMode } from './types';\nimport { diacriticInsensitiveStringNormalizer } from '../utilities/models/string-normalizers';\nimport { FormAssociatedSelect } from './models/select-form-associated';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-select': Select;\n }\n}\n\n// Used in overrides of base class methods\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\ntype BooleanOrVoid = boolean | void;\n\nconst isNimbleListOption = (el: Element): el is ListOption => {\n return el instanceof ListOption;\n};\n\n/**\n * A nimble-styled HTML select.\n */\nexport class Select\n extends FormAssociatedSelect\n implements ErrorPattern, ListOptionOwner {\n @attr\n public appearance: DropdownAppearance = DropdownAppearance.underline;\n\n /**\n * Reflects the placement for the listbox when the select is open.\n *\n * @public\n */\n @attr({ attribute: 'position' })\n public positionAttribute?: SelectPosition;\n\n /**\n * A message explaining why the value is invalid.\n *\n * @public\n * @remarks\n * HTML Attribute: error-text\n */\n @attr({ attribute: 'error-text' })\n public errorText: string | undefined;\n\n @attr({ attribute: 'error-visible', mode: 'boolean' })\n public errorVisible = false;\n\n @attr({ attribute: 'filter-mode' })\n public filterMode: FilterMode = FilterMode.none;\n\n /**\n * @internal\n */\n @observable\n public displayPlaceholder = false;\n\n /**\n * @internal\n */\n @attr({ attribute: 'open', mode: 'boolean' })\n public open = false;\n\n /**\n * Holds the current state for the calculated position of the listbox.\n *\n * @public\n */\n @observable\n public position?: SelectPosition;\n\n /**\n * The ref to the internal `.control` element.\n *\n * @internal\n */\n @observable\n public control!: HTMLElement;\n\n /**\n * Reference to the internal listbox element.\n *\n * @internal\n */\n public listbox!: HTMLDivElement;\n\n /**\n * The unique id for the internal listbox element.\n *\n * @internal\n */\n public listboxId: string = uniqueId('listbox-');\n\n /**\n * @internal\n */\n @observable\n public scrollableRegion!: HTMLElement;\n\n /**\n * @internal\n */\n @observable\n public filterInput?: HTMLInputElement;\n\n /**\n * @internal\n */\n @observable\n public anchoredRegion!: AnchoredRegion;\n\n /** @internal */\n @observable\n public hasOverflow = false;\n\n /**\n * @internal\n */\n @observable\n public filteredOptions: ListboxOption[] = [];\n\n /**\n * @internal\n */\n @observable\n public filter = '';\n\n /**\n * @internal\n */\n @observable\n public committedSelectedOption?: ListboxOption;\n\n /**\n * The max height for the listbox when opened.\n *\n * @internal\n */\n @observable\n public maxHeight = 0;\n\n /**\n * The component is collapsible when in single-selection mode with no size attribute.\n *\n * @internal\n */\n @volatile\n public get collapsible(): boolean {\n return !(this.multiple || typeof this.size === 'number');\n }\n\n private _value = '';\n private forcedPosition = false;\n private indexWhenOpened?: number;\n\n /**\n * @internal\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.forcedPosition = !!this.positionAttribute;\n this.initializeOpenState();\n }\n\n public override get value(): string {\n Observable.track(this, 'value');\n return this._value;\n }\n\n public override set value(next: string) {\n const prev = this._value;\n let newValue = next;\n\n if (this.options?.length) {\n const newValueIndex = this.options.findIndex(\n el => el.value === newValue\n );\n const prevSelectedValue = this.options[this.selectedIndex]?.value ?? null;\n const nextSelectedValue = this.options[newValueIndex]?.value ?? null;\n\n if (\n newValueIndex === -1\n || prevSelectedValue !== nextSelectedValue\n ) {\n newValue = '';\n this.selectedIndex = newValueIndex;\n }\n\n newValue = this.firstSelectedOption?.value ?? newValue;\n }\n\n if (prev !== newValue && !(this.open && this.selectedIndex < 0)) {\n this._value = newValue;\n super.valueChanged(prev, newValue);\n if (!this.open) {\n this.committedSelectedOption = this.options.find(\n o => o.value === newValue\n );\n }\n Observable.notify(this, 'value');\n if (this.collapsible) {\n Observable.notify(this, 'displayValue');\n }\n }\n }\n\n /**\n * @internal\n */\n @volatile\n public get displayValue(): string {\n Observable.track(this, 'displayValue');\n return this.committedSelectedOption?.text ?? '';\n }\n\n /**\n * @internal\n */\n public anchoredRegionChanged(\n _prev: AnchoredRegion | undefined,\n _next: AnchoredRegion | undefined\n ): void {\n if (this.anchoredRegion && this.control) {\n this.anchoredRegion.anchorElement = this.control;\n }\n }\n\n /**\n * @internal\n */\n public controlChanged(\n _prev: HTMLElement | undefined,\n _next: HTMLElement | undefined\n ): void {\n if (this.anchoredRegion && this.control) {\n this.anchoredRegion.anchorElement = this.control;\n }\n }\n\n /**\n * @internal\n */\n public override slottedOptionsChanged(\n prev: Element[],\n next: Element[]\n ): void {\n const value = this.value;\n this.options.forEach(o => {\n const notifier = Observable.getNotifier(o);\n notifier.unsubscribe(this, 'value');\n notifier.unsubscribe(this, 'hidden');\n notifier.unsubscribe(this, 'disabled');\n });\n\n super.slottedOptionsChanged(prev, next);\n\n this.options.forEach(o => {\n const notifier = Observable.getNotifier(o);\n notifier.subscribe(this, 'value');\n notifier.subscribe(this, 'hidden');\n notifier.subscribe(this, 'disabled');\n });\n this.setProxyOptions();\n this.updateValue();\n // We need to force an update to the filteredOptions observable\n // (by calling 'filterOptions()) so that the template correctly updates.\n this.filterOptions();\n if (value) {\n this.value = value;\n }\n this.committedSelectedOption = this.options[this.selectedIndex];\n }\n\n /**\n * @internal\n */\n public override clickHandler(e: MouseEvent): BooleanOrVoid {\n // do nothing if the select is disabled\n if (this.disabled) {\n return;\n }\n\n if (this.open) {\n const captured = (e.target as HTMLElement).closest<ListOption>(\n 'option,[role=option]'\n );\n\n if (captured?.disabled) {\n return;\n }\n }\n\n super.clickHandler(e);\n\n this.open = this.collapsible && !this.open;\n\n if (!this.open && this.indexWhenOpened !== this.selectedIndex) {\n this.updateValue(true);\n }\n }\n\n /**\n * Updates the value when an option's value changes.\n *\n * @param source - the source object\n * @param propertyName - the property to evaluate\n *\n * @internal\n * @override\n */\n public override handleChange(source: unknown, propertyName: string): void {\n // don't call super.handleChange so hidden options can be selected programmatically\n const sourceElement = source as Element;\n switch (propertyName) {\n case 'value': {\n this.updateValue();\n break;\n }\n case 'selected': {\n if (isNimbleListOption(sourceElement)) {\n this.selectedIndex = this.options.indexOf(sourceElement);\n }\n this.setSelectedOptions();\n this.updateDisplayValue();\n break;\n }\n case 'hidden': {\n if (isNimbleListOption(sourceElement)) {\n sourceElement.visuallyHidden = sourceElement.hidden;\n }\n this.updateDisplayValue();\n break;\n }\n case 'disabled': {\n this.updateDisplayValue();\n break;\n }\n default:\n break;\n }\n }\n\n /**\n * Prevents focus when size is set and a scrollbar is clicked.\n *\n * @param e - the mouse event object\n *\n * @override\n * @internal\n */\n public override mousedownHandler(e: MouseEvent): BooleanOrVoid {\n if (e.offsetX >= 0 && e.offsetX <= this.listbox?.scrollWidth) {\n return super.mousedownHandler(e);\n }\n\n return this.collapsible;\n }\n\n /**\n * @internal\n */\n public regionLoadedHandler(): void {\n this.focusAndScrollOptionIntoView();\n }\n\n /**\n * Sets the multiple property on the proxy element.\n *\n * @param prev - the previous multiple value\n * @param next - the current multiple value\n */\n public override multipleChanged(\n prev: boolean | undefined,\n next: boolean\n ): void {\n super.multipleChanged(prev, next);\n\n if (this.proxy) {\n this.proxy.multiple = next;\n }\n }\n\n /**\n * @internal\n */\n public inputClickHandler(e: MouseEvent): void {\n e.stopPropagation(); // clicking in filter input shouldn't close dropdown\n }\n\n /**\n * @internal\n */\n public changeValueHandler(): void {\n this.committedSelectedOption = this.options.find(\n option => option.selected\n );\n }\n\n /**\n * @internal\n */\n public updateDisplayValue(): void {\n if (\n this.committedSelectedOption?.disabled\n && this.committedSelectedOption?.hidden\n && this.committedSelectedOption?.selected\n ) {\n this.displayPlaceholder = true;\n } else {\n this.displayPlaceholder = false;\n }\n\n if (this.collapsible) {\n Observable.notify(this, 'displayValue');\n }\n }\n\n /**\n * Handle content changes on the control input.\n *\n * @param e - the input event\n * @internal\n */\n public inputHandler(e: InputEvent): boolean {\n this.filter = this.filterInput?.value ?? '';\n this.clearSelection();\n this.filterOptions();\n\n if (this.filteredOptions.length > 0) {\n const enabledOptions = this.filteredOptions.filter(\n o => !o.disabled\n );\n if (enabledOptions.length > 0) {\n enabledOptions[0]!.selected = true;\n } else {\n // only filtered option is disabled\n this.selectedOptions = [];\n this.selectedIndex = -1;\n }\n } else if (this.committedSelectedOption) {\n this.committedSelectedOption.selected = true;\n }\n\n if (e.inputType.includes('deleteContent') || !this.filter.length) {\n return true;\n }\n\n e.stopPropagation();\n return true;\n }\n\n /**\n * @internal\n */\n public override focusoutHandler(e: FocusEvent): BooleanOrVoid {\n super.focusoutHandler(e);\n if (!this.open) {\n return true;\n }\n\n const focusTarget = e.relatedTarget as HTMLElement;\n if (this.isSameNode(focusTarget)) {\n this.focus();\n return true;\n }\n\n if (!this.options?.includes(focusTarget as ListboxOption)) {\n this.open = false;\n if (this.selectedIndex === -1) {\n this.selectedIndex = this.indexWhenOpened!;\n }\n\n if (this.indexWhenOpened !== this.selectedIndex) {\n this.updateValue(true);\n }\n }\n return true;\n }\n\n /**\n * @internal\n */\n public override keydownHandler(e: KeyboardEvent): BooleanOrVoid {\n super.keydownHandler(e);\n const key = e.key;\n if (e.ctrlKey || e.shiftKey) {\n return true;\n }\n\n switch (key) {\n case keySpace: {\n // when dropdown is open allow user to enter a space for filter text\n if (this.open && this.filterMode !== FilterMode.none) {\n break;\n }\n\n e.preventDefault();\n if (this.collapsible && this.typeAheadExpired) {\n this.open = !this.open;\n }\n if (!this.open) {\n this.focus();\n }\n break;\n }\n case keyHome:\n case keyEnd: {\n e.preventDefault();\n break;\n }\n case keyEnter: {\n e.preventDefault();\n if (\n this.filteredOptions.length === 0\n || this.filteredOptions.every(o => o.disabled)\n ) {\n return false;\n }\n this.open = !this.open;\n if (!this.open) {\n this.focus();\n }\n break;\n }\n case keyEscape: {\n if (!this.open) {\n break;\n }\n if (this.collapsible && this.open) {\n e.preventDefault();\n this.open = false;\n }\n\n if (this.selectedIndex !== this.indexWhenOpened!) {\n this.options[this.selectedIndex]!.selected = false;\n this.selectedIndex = this.indexWhenOpened!;\n }\n this.focus();\n break;\n }\n case keyTab: {\n if (this.collapsible && this.open) {\n e.preventDefault();\n this.open = false;\n }\n\n return true;\n }\n\n default: {\n break;\n }\n }\n\n if (!this.open && this.indexWhenOpened !== this.selectedIndex) {\n this.updateValue(true);\n this.indexWhenOpened = this.selectedIndex;\n }\n\n return !(key === keyArrowDown || key === keyArrowUp);\n }\n\n /**\n * Updates the proxy value when the selected index changes.\n *\n * @param prev - the previous selected index\n * @param next - the next selected index\n *\n * @internal\n */\n public override selectedIndexChanged(\n _: number | undefined,\n __: number\n ): void {\n // Don't call super.selectedIndexChanged as this will disallow disabled options\n // from being valid initial selected values. Our setDefaultSelectedOption\n // implementation handles skipping non-selected disabled options for the initial\n // selected value.\n this.setSelectedOptions();\n this.updateValue();\n }\n\n /**\n * Synchronize the `aria-disabled` property when the `disabled` property changes.\n *\n * @param prev - The previous disabled value\n * @param next - The next disabled value\n *\n * @internal\n */\n public override disabledChanged(prev: boolean, next: boolean): void {\n if (super.disabledChanged) {\n super.disabledChanged(prev, next);\n }\n this.ariaDisabled = this.disabled ? 'true' : 'false';\n }\n\n /**\n * Reset the element to its first selectable option when its parent form is reset.\n *\n * @internal\n */\n public override formResetCallback(): void {\n this.setProxyOptions();\n // Call the base class's implementation setDefaultSelectedOption instead of the select's\n // override, in order to reset the selectedIndex without using the value property.\n super.setDefaultSelectedOption();\n if (this.selectedIndex === -1) {\n this.selectedIndex = 0;\n }\n }\n\n public override selectNextOption(): void {\n // don't call super.selectNextOption as that relies on side-effecty\n // behavior to not select disabled option (which no longer works)\n for (let i = this.selectedIndex + 1; i < this.options.length; i++) {\n if (!this.options[i]?.disabled) {\n this.selectedIndex = i;\n break;\n }\n }\n }\n\n public override selectPreviousOption(): void {\n // don't call super.selectPreviousOption as that relies on side-effecty\n // behavior to not select disabled option (which no longer works)\n for (let i = this.selectedIndex - 1; i >= 0; i--) {\n if (!this.options[i]?.disabled) {\n this.selectedIndex = i;\n break;\n }\n }\n }\n\n /**\n * @internal\n */\n public registerOption(option: ListOption): void {\n if (this.options.includes(option)) {\n return;\n }\n\n // Adding an option to the end, ultimately, isn't the correct\n // thing to do, as this will mean the option's index in the options,\n // at least temporarily, does not match the DOM order. However, it\n // is expected that a successive run of `slottedOptionsChanged` will\n // correct this order issue. See 'https://github.com/ni/nimble/issues/1915'\n // for more info.\n this.options.push(option);\n }\n\n // Prevents parent classes from resetting selectedIndex to a positive\n // value while filtering, which can result in a disabled option being\n // selected.\n protected override setSelectedOptions(): void {\n if (this.open && this.selectedIndex === -1) {\n return;\n }\n\n super.setSelectedOptions();\n }\n\n protected override focusAndScrollOptionIntoView(): void {\n if (this.open) {\n super.focusAndScrollOptionIntoView();\n window.requestAnimationFrame(() => {\n this.filterInput?.focus();\n });\n }\n }\n\n protected positionChanged(\n _: SelectPosition | undefined,\n next: SelectPosition | undefined\n ): void {\n this.positionAttribute = next;\n this.setPositioning();\n }\n\n /**\n * Updates the proxy's size property when the size attribute changes.\n *\n * @param prev - the previous size\n * @param next - the current size\n *\n * @override\n * @internal\n */\n protected override sizeChanged(\n prev: number | undefined,\n next: number\n ): void {\n super.sizeChanged(prev, next);\n\n if (this.proxy) {\n this.proxy.size = next;\n }\n }\n\n protected openChanged(): void {\n if (!this.collapsible) {\n return;\n }\n\n if (this.open) {\n this.initializeOpenState();\n this.indexWhenOpened = this.selectedIndex;\n\n return;\n }\n\n this.filter = '';\n if (this.filterInput) {\n this.filterInput.value = '';\n }\n\n this.ariaControls = '';\n this.ariaExpanded = 'false';\n }\n\n /**\n * Updates the selectedness of each option when the list of selected options changes.\n *\n * @param prev - the previous list of selected options\n * @param next - the current list of selected options\n *\n * @override\n * @internal\n */\n protected override selectedOptionsChanged(\n _prev: ListboxOption[] | undefined,\n next: ListboxOption[]\n ): void {\n // don't call super.selectedOptionsChanged so we don't filter out hidden elements\n // when updating 'selected' state (copied relevant super implementation)\n this.options?.forEach((o, i) => {\n const notifier = Observable.getNotifier(o);\n notifier.unsubscribe(this, 'selected');\n o.selected = next.includes(o);\n notifier.subscribe(this, 'selected');\n const proxyOption = this.proxy?.options.item(i);\n if (proxyOption) {\n proxyOption.selected = o.selected;\n }\n });\n }\n\n /**\n * Sets the selected index to match the first option with the selected attribute, or\n * the first selectable option.\n *\n * @override\n * @internal\n */\n protected override setDefaultSelectedOption(): void {\n const options: ListboxOption[] = this.options\n ?? Array.from(this.children).filter(o => isNimbleListOption(o));\n\n const optionIsSelected = (option: ListboxOption): boolean => {\n return option.hasAttribute('selected') || option.selected;\n };\n const optionIsDisabled = (option: ListboxOption): boolean => {\n return option.hasAttribute('disabled') || option.disabled;\n };\n let selectedIndex = -1;\n let firstValidOptionIndex = -1;\n for (let i = 0; i < options?.length; i++) {\n const option = options[i];\n if (optionIsSelected(option!) || option?.value === this.value) {\n selectedIndex = i;\n }\n if (firstValidOptionIndex === -1 && !optionIsDisabled(option!)) {\n firstValidOptionIndex = i;\n }\n }\n\n if (selectedIndex !== -1) {\n this.selectedIndex = selectedIndex;\n } else if (firstValidOptionIndex !== -1) {\n this.selectedIndex = firstValidOptionIndex;\n } else {\n this.selectedIndex = 0;\n }\n this.committedSelectedOption = options[this.selectedIndex];\n }\n\n private committedSelectedOptionChanged(): void {\n this.updateDisplayValue();\n }\n\n private setPositioning(): void {\n if (!this.$fastController.isConnected) {\n // Don't call setPositioning() until we're connected,\n // since this.forcedPosition isn't initialized yet.\n return;\n }\n const currentBox = this.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const availableBottom = viewportHeight - currentBox.bottom;\n\n if (this.forcedPosition) {\n this.position = this.positionAttribute;\n } else if (currentBox.top > availableBottom) {\n this.position = SelectPosition.above;\n } else {\n this.position = SelectPosition.below;\n }\n\n this.positionAttribute = this.forcedPosition\n ? this.positionAttribute\n : this.position;\n\n this.maxHeight = this.position === SelectPosition.above\n ? Math.trunc(currentBox.top)\n : Math.trunc(availableBottom);\n this.updateListboxMaxHeightCssVariable();\n }\n\n /**\n * Filter available options by text value.\n *\n * @public\n */\n private filterOptions(): void {\n const filter = this.filter.toLowerCase();\n\n if (filter) {\n this.filteredOptions = this.options.filter(option => {\n const normalizedFilter = diacriticInsensitiveStringNormalizer(filter);\n return (\n !option.hidden\n && diacriticInsensitiveStringNormalizer(option.text).includes(\n normalizedFilter\n )\n );\n });\n } else {\n this.filteredOptions = this.options.filter(\n option => !option.hidden\n );\n }\n\n this.options.forEach(o => {\n if (isNimbleListOption(o)) {\n if (!this.filteredOptions.includes(o)) {\n o.visuallyHidden = true;\n } else {\n o.visuallyHidden = false;\n }\n }\n });\n }\n\n /**\n * Sets the value and display value to match the first selected option.\n *\n * @param shouldEmit - if true, the input and change events will be emitted\n *\n * @internal\n */\n private updateValue(shouldEmit?: boolean): void {\n if (this.$fastController.isConnected) {\n this.value = this.firstSelectedOption?.value ?? '';\n }\n\n if (shouldEmit) {\n this.$emit('input');\n this.$emit('change', this, {\n bubbles: true,\n composed: undefined\n });\n }\n }\n\n /**\n * Resets and fills the proxy to match the component's options.\n *\n * @internal\n */\n private setProxyOptions(): void {\n if (this.proxy instanceof HTMLSelectElement && this.options) {\n this.proxy.options.length = 0;\n this.options.forEach(option => {\n const proxyOption = option.proxy\n || (option instanceof HTMLOptionElement\n ? option.cloneNode()\n : null);\n\n if (proxyOption) {\n this.proxy.options.add(proxyOption);\n }\n });\n }\n }\n\n private clearSelection(): void {\n this.options.forEach(option => {\n option.selected = false;\n });\n }\n\n private filterChanged(): void {\n this.filterOptions();\n }\n\n private maxHeightChanged(): void {\n this.updateListboxMaxHeightCssVariable();\n }\n\n private initializeOpenState(): void {\n if (!this.open) {\n this.ariaExpanded = 'false';\n this.ariaControls = '';\n return;\n }\n\n this.committedSelectedOption = this.options[this.selectedIndex];\n this.ariaControls = this.listboxId;\n this.ariaExpanded = 'true';\n\n this.setPositioning();\n this.focusAndScrollOptionIntoView();\n }\n\n private updateListboxMaxHeightCssVariable(): void {\n if (this.listbox) {\n this.listbox.style.setProperty(\n '--ni-private-select-max-height',\n `${this.maxHeight}px`\n );\n }\n }\n}\n\nconst nimbleSelect = Select.compose<SelectOptions>({\n baseName: 'select',\n baseClass: FoundationSelect,\n template,\n styles,\n indicator: arrowExpanderDown16X16.data,\n end: html<Select>`\n <${iconExclamationMarkTag}\n severity=\"error\"\n class=\"error-icon\"\n ></${iconExclamationMarkTag}>\n ${errorTextTemplate}\n `\n});\n\napplyMixins(Select, StartEnd, DelegatesARIASelect);\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleSelect());\nexport const selectTag = 'nimble-select';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/select/index.ts"],"names":[],"mappings":";AAAA,qJAAqJ;AACrJ,OAAO,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;0CAIR;AAytBL,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAgB;IAC/C,QAAQ,EAAE,QAAQ;IAClB,SAAS,EAAE,gBAAgB;IAC3B,QAAQ;IACR,MAAM;IACN,SAAS,EAAE,sBAAsB,CAAC,IAAI;IACtC,GAAG,EAAE,IAAI,CAAQ;WACV,sBAAsB;;;aAGpB,sBAAsB;UACzB,iBAAiB;KACtB;CACJ,CAAC,CAAC;AAEH,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AACnD,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC","sourcesContent":["// Based on: https://github.com/microsoft/fast/blob/%40microsoft/fast-foundation_v2.49.5/packages/web-components/fast-foundation/src/select/select.ts\nimport {\n attr,\n html,\n observable,\n Observable,\n volatile\n} from '@microsoft/fast-element';\nimport {\n AnchoredRegion,\n DesignSystem,\n Select as FoundationSelect,\n ListboxOption,\n SelectOptions,\n SelectPosition,\n applyMixins,\n StartEnd,\n DelegatesARIASelect\n} from '@microsoft/fast-foundation';\nimport {\n keyArrowDown,\n keyArrowUp,\n keyEnd,\n keyEnter,\n keyEscape,\n keyHome,\n keySpace,\n keyTab,\n uniqueId\n} from '@microsoft/fast-web-utilities';\nimport { arrowExpanderDown16X16 } from '@ni/nimble-tokens/dist/icons/js';\nimport { styles } from './styles';\nimport {\n DropdownAppearance,\n ListOptionOwner\n} from '../patterns/dropdown/types';\nimport { errorTextTemplate } from '../patterns/error/template';\nimport type { ErrorPattern } from '../patterns/error/types';\nimport { iconExclamationMarkTag } from '../icons/exclamation-mark';\nimport { template } from './template';\nimport { ListOption } from '../list-option';\nimport { FilterMode } from './types';\nimport { diacriticInsensitiveStringNormalizer } from '../utilities/models/string-normalizers';\nimport { FormAssociatedSelect } from './models/select-form-associated';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-select': Select;\n }\n}\n\n// Used in overrides of base class methods\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\ntype BooleanOrVoid = boolean | void;\n\nconst isNimbleListOption = (el: Element): el is ListOption => {\n return el instanceof ListOption;\n};\n\nconst isOptionSelectable = (el: ListOption): boolean => {\n return !el.visuallyHidden && !el.disabled && !el.hidden;\n};\n\n/**\n * A nimble-styled HTML select.\n */\nexport class Select\n extends FormAssociatedSelect\n implements ErrorPattern, ListOptionOwner {\n @attr\n public appearance: DropdownAppearance = DropdownAppearance.underline;\n\n /**\n * Reflects the placement for the listbox when the select is open.\n *\n * @public\n */\n @attr({ attribute: 'position' })\n public positionAttribute?: SelectPosition;\n\n /**\n * A message explaining why the value is invalid.\n *\n * @public\n * @remarks\n * HTML Attribute: error-text\n */\n @attr({ attribute: 'error-text' })\n public errorText: string | undefined;\n\n @attr({ attribute: 'error-visible', mode: 'boolean' })\n public errorVisible = false;\n\n @attr({ attribute: 'filter-mode' })\n public filterMode: FilterMode = FilterMode.none;\n\n /**\n * @internal\n */\n @observable\n public displayPlaceholder = false;\n\n /**\n * @internal\n */\n @attr({ attribute: 'open', mode: 'boolean' })\n public open = false;\n\n /**\n * Holds the current state for the calculated position of the listbox.\n *\n * @public\n */\n @observable\n public position?: SelectPosition;\n\n /**\n * The ref to the internal `.control` element.\n *\n * @internal\n */\n @observable\n public control!: HTMLElement;\n\n /**\n * Reference to the internal listbox element.\n *\n * @internal\n */\n public listbox!: HTMLDivElement;\n\n /**\n * The unique id for the internal listbox element.\n *\n * @internal\n */\n public listboxId: string = uniqueId('listbox-');\n\n /**\n * @internal\n */\n @observable\n public scrollableRegion!: HTMLElement;\n\n /**\n * @internal\n */\n @observable\n public filterInput?: HTMLInputElement;\n\n /**\n * @internal\n */\n @observable\n public anchoredRegion!: AnchoredRegion;\n\n /** @internal */\n @observable\n public hasOverflow = false;\n\n /**\n * @internal\n */\n @observable\n public filteredOptions: ListboxOption[] = [];\n\n /**\n * @internal\n */\n @observable\n public filter = '';\n\n /**\n * @internal\n */\n @observable\n public committedSelectedOption?: ListboxOption;\n\n /**\n * The max height for the listbox when opened.\n *\n * @internal\n */\n @observable\n public maxHeight = 0;\n\n /**\n * The component is collapsible when in single-selection mode with no size attribute.\n *\n * @internal\n */\n @volatile\n public get collapsible(): boolean {\n return !(this.multiple || typeof this.size === 'number');\n }\n\n private _value = '';\n private forcedPosition = false;\n private indexWhenOpened?: number;\n\n /**\n * @internal\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.forcedPosition = !!this.positionAttribute;\n this.initializeOpenState();\n }\n\n public override get value(): string {\n Observable.track(this, 'value');\n return this._value;\n }\n\n public override set value(next: string) {\n const prev = this._value;\n let newValue = next;\n\n if (this.options?.length) {\n const newValueIndex = this.options.findIndex(\n el => el.value === newValue\n );\n const prevSelectedValue = this.options[this.selectedIndex]?.value ?? null;\n const nextSelectedValue = this.options[newValueIndex]?.value ?? null;\n\n if (\n newValueIndex === -1\n || prevSelectedValue !== nextSelectedValue\n ) {\n newValue = '';\n this.selectedIndex = newValueIndex;\n }\n\n newValue = this.firstSelectedOption?.value ?? newValue;\n }\n\n if (prev !== newValue && !(this.open && this.selectedIndex < 0)) {\n this._value = newValue;\n super.valueChanged(prev, newValue);\n if (!this.open) {\n this.committedSelectedOption = this.options.find(\n o => o.value === newValue\n );\n }\n Observable.notify(this, 'value');\n if (this.collapsible) {\n Observable.notify(this, 'displayValue');\n }\n }\n }\n\n /**\n * @internal\n */\n @volatile\n public get displayValue(): string {\n Observable.track(this, 'displayValue');\n return this.committedSelectedOption?.text ?? '';\n }\n\n /**\n * @internal\n */\n public anchoredRegionChanged(\n _prev: AnchoredRegion | undefined,\n _next: AnchoredRegion | undefined\n ): void {\n if (this.anchoredRegion && this.control) {\n this.anchoredRegion.anchorElement = this.control;\n }\n }\n\n /**\n * @internal\n */\n public controlChanged(\n _prev: HTMLElement | undefined,\n _next: HTMLElement | undefined\n ): void {\n if (this.anchoredRegion && this.control) {\n this.anchoredRegion.anchorElement = this.control;\n }\n }\n\n /**\n * @internal\n */\n public override slottedOptionsChanged(\n prev: Element[],\n next: Element[]\n ): void {\n const value = this.value;\n this.options.forEach(o => {\n const notifier = Observable.getNotifier(o);\n notifier.unsubscribe(this, 'value');\n notifier.unsubscribe(this, 'hidden');\n notifier.unsubscribe(this, 'disabled');\n });\n\n super.slottedOptionsChanged(prev, next);\n\n this.options.forEach(o => {\n const notifier = Observable.getNotifier(o);\n notifier.subscribe(this, 'value');\n notifier.subscribe(this, 'hidden');\n notifier.subscribe(this, 'disabled');\n });\n this.setProxyOptions();\n this.updateValue();\n // We need to force an update to the filteredOptions observable\n // (by calling 'filterOptions()) so that the template correctly updates.\n this.filterOptions();\n if (value) {\n this.value = value;\n }\n this.committedSelectedOption = this.options[this.selectedIndex];\n }\n\n /**\n * @internal\n */\n public override clickHandler(e: MouseEvent): BooleanOrVoid {\n // do nothing if the select is disabled\n if (this.disabled) {\n return;\n }\n\n if (this.open) {\n const captured = (e.target as HTMLElement).closest<ListOption>(\n 'option,[role=option]'\n );\n\n if (captured?.disabled) {\n return;\n }\n }\n\n super.clickHandler(e);\n\n this.open = this.collapsible && !this.open;\n\n if (!this.open && this.indexWhenOpened !== this.selectedIndex) {\n this.updateValue(true);\n }\n }\n\n /**\n * Updates the value when an option's value changes.\n *\n * @param source - the source object\n * @param propertyName - the property to evaluate\n *\n * @internal\n * @override\n */\n public override handleChange(source: unknown, propertyName: string): void {\n // don't call super.handleChange so hidden options can be selected programmatically\n const sourceElement = source as Element;\n switch (propertyName) {\n case 'value': {\n this.updateValue();\n break;\n }\n case 'selected': {\n if (isNimbleListOption(sourceElement)) {\n this.selectedIndex = this.options.indexOf(sourceElement);\n }\n this.setSelectedOptions();\n this.updateDisplayValue();\n break;\n }\n case 'hidden': {\n if (isNimbleListOption(sourceElement)) {\n sourceElement.visuallyHidden = sourceElement.hidden;\n }\n this.updateDisplayValue();\n break;\n }\n case 'disabled': {\n this.updateDisplayValue();\n break;\n }\n default:\n break;\n }\n }\n\n /**\n * Prevents focus when size is set and a scrollbar is clicked.\n *\n * @param e - the mouse event object\n *\n * @override\n * @internal\n */\n public override mousedownHandler(e: MouseEvent): BooleanOrVoid {\n if (e.offsetX >= 0 && e.offsetX <= this.listbox?.scrollWidth) {\n return super.mousedownHandler(e);\n }\n\n return this.collapsible;\n }\n\n /**\n * @internal\n */\n public regionLoadedHandler(): void {\n this.focusAndScrollOptionIntoView();\n }\n\n /**\n * Sets the multiple property on the proxy element.\n *\n * @param prev - the previous multiple value\n * @param next - the current multiple value\n */\n public override multipleChanged(\n prev: boolean | undefined,\n next: boolean\n ): void {\n super.multipleChanged(prev, next);\n\n if (this.proxy) {\n this.proxy.multiple = next;\n }\n }\n\n /**\n * @internal\n */\n public inputClickHandler(e: MouseEvent): void {\n e.stopPropagation(); // clicking in filter input shouldn't close dropdown\n }\n\n /**\n * @internal\n */\n public changeValueHandler(): void {\n this.committedSelectedOption = this.options.find(\n option => option.selected\n );\n }\n\n /**\n * @internal\n */\n public updateDisplayValue(): void {\n if (\n this.committedSelectedOption?.disabled\n && this.committedSelectedOption?.hidden\n && this.committedSelectedOption?.selected\n ) {\n this.displayPlaceholder = true;\n } else {\n this.displayPlaceholder = false;\n }\n\n if (this.collapsible) {\n Observable.notify(this, 'displayValue');\n }\n }\n\n /**\n * Handle content changes on the control input.\n *\n * @param e - the input event\n * @internal\n */\n public inputHandler(e: InputEvent): boolean {\n this.filter = this.filterInput?.value ?? '';\n this.clearSelection();\n this.filterOptions();\n\n if (this.filteredOptions.length > 0) {\n const enabledOptions = this.filteredOptions.filter(\n o => !o.disabled\n );\n if (enabledOptions.length > 0) {\n enabledOptions[0]!.selected = true;\n } else {\n // only filtered option is disabled\n this.selectedOptions = [];\n this.selectedIndex = -1;\n }\n } else if (this.committedSelectedOption) {\n this.committedSelectedOption.selected = true;\n }\n\n if (e.inputType.includes('deleteContent') || !this.filter.length) {\n return true;\n }\n\n e.stopPropagation();\n return true;\n }\n\n /**\n * @internal\n */\n public override focusoutHandler(e: FocusEvent): BooleanOrVoid {\n super.focusoutHandler(e);\n if (!this.open) {\n return true;\n }\n\n const focusTarget = e.relatedTarget as HTMLElement;\n if (this.isSameNode(focusTarget)) {\n this.focus();\n return true;\n }\n\n if (!this.options?.includes(focusTarget as ListboxOption)) {\n this.open = false;\n if (this.selectedIndex === -1) {\n this.selectedIndex = this.indexWhenOpened!;\n }\n\n if (this.indexWhenOpened !== this.selectedIndex) {\n this.updateValue(true);\n }\n }\n return true;\n }\n\n /**\n * @internal\n */\n public override keydownHandler(e: KeyboardEvent): BooleanOrVoid {\n super.keydownHandler(e);\n const key = e.key;\n if (e.ctrlKey || e.shiftKey) {\n return true;\n }\n\n switch (key) {\n case keySpace: {\n // when dropdown is open allow user to enter a space for filter text\n if (this.open && this.filterMode !== FilterMode.none) {\n break;\n }\n\n e.preventDefault();\n if (this.collapsible && this.typeAheadExpired) {\n this.open = !this.open;\n }\n if (!this.open) {\n this.focus();\n }\n break;\n }\n case keyHome:\n case keyEnd: {\n e.preventDefault();\n break;\n }\n case keyEnter: {\n e.preventDefault();\n if (\n this.filteredOptions.length === 0\n || this.filteredOptions.every(o => o.disabled)\n ) {\n return false;\n }\n this.open = !this.open;\n if (!this.open) {\n this.focus();\n }\n break;\n }\n case keyEscape: {\n if (!this.open) {\n break;\n }\n if (this.collapsible && this.open) {\n e.preventDefault();\n this.open = false;\n }\n\n if (this.selectedIndex !== this.indexWhenOpened!) {\n this.options[this.selectedIndex]!.selected = false;\n this.selectedIndex = this.indexWhenOpened!;\n }\n this.focus();\n break;\n }\n case keyTab: {\n if (this.collapsible && this.open) {\n e.preventDefault();\n this.open = false;\n }\n\n return true;\n }\n\n default: {\n break;\n }\n }\n\n if (!this.open && this.indexWhenOpened !== this.selectedIndex) {\n this.updateValue(true);\n this.indexWhenOpened = this.selectedIndex;\n }\n\n return !(key === keyArrowDown || key === keyArrowUp);\n }\n\n /**\n * Updates the proxy value when the selected index changes.\n *\n * @param prev - the previous selected index\n * @param next - the next selected index\n *\n * @internal\n */\n public override selectedIndexChanged(\n _: number | undefined,\n __: number\n ): void {\n // Don't call super.selectedIndexChanged as this will disallow disabled options\n // from being valid initial selected values. Our setDefaultSelectedOption\n // implementation handles skipping non-selected disabled options for the initial\n // selected value.\n this.setSelectedOptions();\n this.updateValue();\n }\n\n /**\n * Synchronize the `aria-disabled` property when the `disabled` property changes.\n *\n * @param prev - The previous disabled value\n * @param next - The next disabled value\n *\n * @internal\n */\n public override disabledChanged(prev: boolean, next: boolean): void {\n if (super.disabledChanged) {\n super.disabledChanged(prev, next);\n }\n this.ariaDisabled = this.disabled ? 'true' : 'false';\n }\n\n /**\n * Reset the element to its first selectable option when its parent form is reset.\n *\n * @internal\n */\n public override formResetCallback(): void {\n this.setProxyOptions();\n // Call the base class's implementation setDefaultSelectedOption instead of the select's\n // override, in order to reset the selectedIndex without using the value property.\n super.setDefaultSelectedOption();\n if (this.selectedIndex === -1) {\n this.selectedIndex = 0;\n }\n }\n\n public override selectNextOption(): void {\n // don't call super.selectNextOption as that relies on side-effecty\n // behavior to not select disabled option (which no longer works)\n for (let i = this.selectedIndex + 1; i < this.options.length; i++) {\n const listOption = this.options[i]!;\n if (\n isNimbleListOption(listOption)\n && isOptionSelectable(listOption)\n ) {\n this.selectedIndex = i;\n break;\n }\n }\n }\n\n public override selectPreviousOption(): void {\n // don't call super.selectPreviousOption as that relies on side-effecty\n // behavior to not select disabled option (which no longer works)\n for (let i = this.selectedIndex - 1; i >= 0; i--) {\n const listOption = this.options[i]!;\n if (\n isNimbleListOption(listOption)\n && isOptionSelectable(listOption)\n ) {\n this.selectedIndex = i;\n break;\n }\n }\n }\n\n /**\n * @internal\n */\n public registerOption(option: ListOption): void {\n if (this.options.includes(option)) {\n return;\n }\n\n // Adding an option to the end, ultimately, isn't the correct\n // thing to do, as this will mean the option's index in the options,\n // at least temporarily, does not match the DOM order. However, it\n // is expected that a successive run of `slottedOptionsChanged` will\n // correct this order issue. See 'https://github.com/ni/nimble/issues/1915'\n // for more info.\n this.options.push(option);\n }\n\n // Prevents parent classes from resetting selectedIndex to a positive\n // value while filtering, which can result in a disabled option being\n // selected.\n protected override setSelectedOptions(): void {\n if (this.open && this.selectedIndex === -1) {\n return;\n }\n\n super.setSelectedOptions();\n }\n\n protected override focusAndScrollOptionIntoView(): void {\n if (this.open) {\n super.focusAndScrollOptionIntoView();\n window.requestAnimationFrame(() => {\n this.filterInput?.focus();\n });\n }\n }\n\n protected positionChanged(\n _: SelectPosition | undefined,\n next: SelectPosition | undefined\n ): void {\n this.positionAttribute = next;\n this.setPositioning();\n }\n\n /**\n * Updates the proxy's size property when the size attribute changes.\n *\n * @param prev - the previous size\n * @param next - the current size\n *\n * @override\n * @internal\n */\n protected override sizeChanged(\n prev: number | undefined,\n next: number\n ): void {\n super.sizeChanged(prev, next);\n\n if (this.proxy) {\n this.proxy.size = next;\n }\n }\n\n protected openChanged(): void {\n if (!this.collapsible) {\n return;\n }\n\n if (this.open) {\n this.initializeOpenState();\n this.indexWhenOpened = this.selectedIndex;\n\n return;\n }\n\n this.filter = '';\n if (this.filterInput) {\n this.filterInput.value = '';\n }\n\n this.ariaControls = '';\n this.ariaExpanded = 'false';\n }\n\n /**\n * Updates the selectedness of each option when the list of selected options changes.\n *\n * @param prev - the previous list of selected options\n * @param next - the current list of selected options\n *\n * @override\n * @internal\n */\n protected override selectedOptionsChanged(\n _prev: ListboxOption[] | undefined,\n next: ListboxOption[]\n ): void {\n // don't call super.selectedOptionsChanged so we don't filter out hidden elements\n // when updating 'selected' state (copied relevant super implementation)\n this.options?.forEach((o, i) => {\n const notifier = Observable.getNotifier(o);\n notifier.unsubscribe(this, 'selected');\n o.selected = next.includes(o);\n notifier.subscribe(this, 'selected');\n const proxyOption = this.proxy?.options.item(i);\n if (proxyOption) {\n proxyOption.selected = o.selected;\n }\n });\n }\n\n /**\n * Sets the selected index to match the first option with the selected attribute, or\n * the first selectable option.\n *\n * @override\n * @internal\n */\n protected override setDefaultSelectedOption(): void {\n const options: ListboxOption[] = this.options\n ?? Array.from(this.children).filter(o => isNimbleListOption(o));\n\n const optionIsSelected = (option: ListboxOption): boolean => {\n return option.hasAttribute('selected') || option.selected;\n };\n let selectedIndex = -1;\n let firstValidOptionIndex = -1;\n for (let i = 0; i < options?.length; i++) {\n const option = options[i];\n if (optionIsSelected(option!) || option?.value === this.value) {\n selectedIndex = i;\n }\n if (\n firstValidOptionIndex === -1\n && isOptionSelectable(option! as ListOption)\n ) {\n firstValidOptionIndex = i;\n }\n }\n\n if (selectedIndex !== -1) {\n this.selectedIndex = selectedIndex;\n } else if (firstValidOptionIndex !== -1) {\n this.selectedIndex = firstValidOptionIndex;\n } else {\n this.selectedIndex = 0;\n }\n this.committedSelectedOption = options[this.selectedIndex];\n }\n\n private committedSelectedOptionChanged(): void {\n this.updateDisplayValue();\n }\n\n private setPositioning(): void {\n if (!this.$fastController.isConnected) {\n // Don't call setPositioning() until we're connected,\n // since this.forcedPosition isn't initialized yet.\n return;\n }\n const currentBox = this.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const availableBottom = viewportHeight - currentBox.bottom;\n\n if (this.forcedPosition) {\n this.position = this.positionAttribute;\n } else if (currentBox.top > availableBottom) {\n this.position = SelectPosition.above;\n } else {\n this.position = SelectPosition.below;\n }\n\n this.positionAttribute = this.forcedPosition\n ? this.positionAttribute\n : this.position;\n\n this.maxHeight = this.position === SelectPosition.above\n ? Math.trunc(currentBox.top)\n : Math.trunc(availableBottom);\n this.updateListboxMaxHeightCssVariable();\n }\n\n /**\n * Filter available options by text value.\n *\n * @public\n */\n private filterOptions(): void {\n const filter = this.filter.toLowerCase();\n\n if (filter) {\n this.filteredOptions = this.options.filter(option => {\n const normalizedFilter = diacriticInsensitiveStringNormalizer(filter);\n return (\n !option.hidden\n && diacriticInsensitiveStringNormalizer(option.text).includes(\n normalizedFilter\n )\n );\n });\n } else {\n this.filteredOptions = this.options.filter(\n option => !option.hidden\n );\n }\n\n this.options.forEach(o => {\n if (isNimbleListOption(o)) {\n if (!this.filteredOptions.includes(o)) {\n o.visuallyHidden = true;\n } else {\n o.visuallyHidden = false;\n }\n }\n });\n }\n\n /**\n * Sets the value and display value to match the first selected option.\n *\n * @param shouldEmit - if true, the input and change events will be emitted\n *\n * @internal\n */\n private updateValue(shouldEmit?: boolean): void {\n if (this.$fastController.isConnected) {\n this.value = this.firstSelectedOption?.value ?? '';\n }\n\n if (shouldEmit) {\n this.$emit('input');\n this.$emit('change', this, {\n bubbles: true,\n composed: undefined\n });\n }\n }\n\n /**\n * Resets and fills the proxy to match the component's options.\n *\n * @internal\n */\n private setProxyOptions(): void {\n if (this.proxy instanceof HTMLSelectElement && this.options) {\n this.proxy.options.length = 0;\n this.options.forEach(option => {\n const proxyOption = option.proxy\n || (option instanceof HTMLOptionElement\n ? option.cloneNode()\n : null);\n\n if (proxyOption) {\n this.proxy.options.add(proxyOption);\n }\n });\n }\n }\n\n private clearSelection(): void {\n this.options.forEach(option => {\n option.selected = false;\n });\n }\n\n private filterChanged(): void {\n this.filterOptions();\n }\n\n private maxHeightChanged(): void {\n this.updateListboxMaxHeightCssVariable();\n }\n\n private initializeOpenState(): void {\n if (!this.open) {\n this.ariaExpanded = 'false';\n this.ariaControls = '';\n return;\n }\n\n this.committedSelectedOption = this.options[this.selectedIndex];\n this.ariaControls = this.listboxId;\n this.ariaExpanded = 'true';\n\n this.setPositioning();\n this.focusAndScrollOptionIntoView();\n }\n\n private updateListboxMaxHeightCssVariable(): void {\n if (this.listbox) {\n this.listbox.style.setProperty(\n '--ni-private-select-max-height',\n `${this.maxHeight}px`\n );\n }\n }\n}\n\nconst nimbleSelect = Select.compose<SelectOptions>({\n baseName: 'select',\n baseClass: FoundationSelect,\n template,\n styles,\n indicator: arrowExpanderDown16X16.data,\n end: html<Select>`\n <${iconExclamationMarkTag}\n severity=\"error\"\n class=\"error-icon\"\n ></${iconExclamationMarkTag}>\n ${errorTextTemplate}\n `\n});\n\napplyMixins(Select, StartEnd, DelegatesARIASelect);\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleSelect());\nexport const selectTag = 'nimble-select';\n"]}