@ni/nimble-components 29.0.0 → 29.1.1

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 (164) hide show
  1. package/dist/all-components-bundle.js +267 -198
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +3032 -2995
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/anchor/styles.js +1 -1
  6. package/dist/esm/anchor/styles.js.map +1 -1
  7. package/dist/esm/anchor-menu-item/styles.js +1 -1
  8. package/dist/esm/anchor-menu-item/styles.js.map +1 -1
  9. package/dist/esm/anchor-tab/styles.js +1 -1
  10. package/dist/esm/anchor-tab/styles.js.map +1 -1
  11. package/dist/esm/anchor-tabs/styles.js +1 -1
  12. package/dist/esm/anchor-tabs/styles.js.map +1 -1
  13. package/dist/esm/anchor-tree-item/styles.js +1 -1
  14. package/dist/esm/anchor-tree-item/styles.js.map +1 -1
  15. package/dist/esm/anchored-region/styles.js +5 -2
  16. package/dist/esm/anchored-region/styles.js.map +1 -1
  17. package/dist/esm/banner/styles.js +1 -1
  18. package/dist/esm/banner/styles.js.map +1 -1
  19. package/dist/esm/breadcrumb/styles.js +1 -1
  20. package/dist/esm/breadcrumb/styles.js.map +1 -1
  21. package/dist/esm/breadcrumb-item/styles.js +1 -1
  22. package/dist/esm/breadcrumb-item/styles.js.map +1 -1
  23. package/dist/esm/card/styles.js +1 -1
  24. package/dist/esm/card/styles.js.map +1 -1
  25. package/dist/esm/card-button/styles.js +1 -1
  26. package/dist/esm/card-button/styles.js.map +1 -1
  27. package/dist/esm/checkbox/styles.js +1 -1
  28. package/dist/esm/checkbox/styles.js.map +1 -1
  29. package/dist/esm/dialog/styles.js +1 -1
  30. package/dist/esm/dialog/styles.js.map +1 -1
  31. package/dist/esm/drawer/styles.js +1 -1
  32. package/dist/esm/drawer/styles.js.map +1 -1
  33. package/dist/esm/icon-base/index.js +1 -2
  34. package/dist/esm/icon-base/index.js.map +1 -1
  35. package/dist/esm/icon-base/styles.js +1 -1
  36. package/dist/esm/icon-base/styles.js.map +1 -1
  37. package/dist/esm/label-provider/base/styles.d.ts +1 -0
  38. package/dist/esm/label-provider/base/styles.js +6 -0
  39. package/dist/esm/label-provider/base/styles.js.map +1 -0
  40. package/dist/esm/label-provider/core/index.js +3 -1
  41. package/dist/esm/label-provider/core/index.js.map +1 -1
  42. package/dist/esm/label-provider/rich-text/index.js +3 -1
  43. package/dist/esm/label-provider/rich-text/index.js.map +1 -1
  44. package/dist/esm/label-provider/table/index.js +3 -1
  45. package/dist/esm/label-provider/table/index.js.map +1 -1
  46. package/dist/esm/list-option/styles.js +1 -1
  47. package/dist/esm/list-option/styles.js.map +1 -1
  48. package/dist/esm/listbox/styles.js +1 -1
  49. package/dist/esm/listbox/styles.js.map +1 -1
  50. package/dist/esm/mapping/base/styles.d.ts +1 -0
  51. package/dist/esm/mapping/base/styles.js +6 -0
  52. package/dist/esm/mapping/base/styles.js.map +1 -0
  53. package/dist/esm/mapping/empty/index.js +3 -1
  54. package/dist/esm/mapping/empty/index.js.map +1 -1
  55. package/dist/esm/mapping/icon/index.js +3 -1
  56. package/dist/esm/mapping/icon/index.js.map +1 -1
  57. package/dist/esm/mapping/spinner/index.js +3 -1
  58. package/dist/esm/mapping/spinner/index.js.map +1 -1
  59. package/dist/esm/mapping/text/index.js +3 -1
  60. package/dist/esm/mapping/text/index.js.map +1 -1
  61. package/dist/esm/mapping/user/index.js +3 -1
  62. package/dist/esm/mapping/user/index.js.map +1 -1
  63. package/dist/esm/menu/styles.js +1 -1
  64. package/dist/esm/menu/styles.js.map +1 -1
  65. package/dist/esm/menu-button/styles.js +1 -1
  66. package/dist/esm/menu-button/styles.js.map +1 -1
  67. package/dist/esm/menu-item/styles.js +1 -1
  68. package/dist/esm/menu-item/styles.js.map +1 -1
  69. package/dist/esm/number-field/styles.js +1 -1
  70. package/dist/esm/number-field/styles.js.map +1 -1
  71. package/dist/esm/patterns/button/styles.js +1 -1
  72. package/dist/esm/patterns/button/styles.js.map +1 -1
  73. package/dist/esm/patterns/dropdown/styles.js +2 -2
  74. package/dist/esm/patterns/dropdown/styles.js.map +1 -1
  75. package/dist/esm/radio/styles.js +1 -1
  76. package/dist/esm/radio/styles.js.map +1 -1
  77. package/dist/esm/radio-group/styles.js +1 -1
  78. package/dist/esm/radio-group/styles.js.map +1 -1
  79. package/dist/esm/rich-text/editor/styles.js +1 -1
  80. package/dist/esm/rich-text/editor/styles.js.map +1 -1
  81. package/dist/esm/rich-text/viewer/styles.js +1 -1
  82. package/dist/esm/rich-text/viewer/styles.js.map +1 -1
  83. package/dist/esm/rich-text-mention/base/styles.d.ts +1 -0
  84. package/dist/esm/rich-text-mention/base/styles.js +6 -0
  85. package/dist/esm/rich-text-mention/base/styles.js.map +1 -0
  86. package/dist/esm/rich-text-mention/users/index.js +3 -1
  87. package/dist/esm/rich-text-mention/users/index.js.map +1 -1
  88. package/dist/esm/rich-text-mention/users/view/styles.js +1 -1
  89. package/dist/esm/rich-text-mention/users/view/styles.js.map +1 -1
  90. package/dist/esm/select/index.d.ts +4 -6
  91. package/dist/esm/select/index.js +49 -31
  92. package/dist/esm/select/index.js.map +1 -1
  93. package/dist/esm/select/styles.js +8 -1
  94. package/dist/esm/select/styles.js.map +1 -1
  95. package/dist/esm/select/template.js +13 -1
  96. package/dist/esm/select/template.js.map +1 -1
  97. package/dist/esm/select/testing/select.pageobject.d.ts +3 -1
  98. package/dist/esm/select/testing/select.pageobject.js +17 -9
  99. package/dist/esm/select/testing/select.pageobject.js.map +1 -1
  100. package/dist/esm/spinner/styles.js +1 -1
  101. package/dist/esm/spinner/styles.js.map +1 -1
  102. package/dist/esm/switch/styles.js +1 -1
  103. package/dist/esm/switch/styles.js.map +1 -1
  104. package/dist/esm/tab/styles.js +1 -1
  105. package/dist/esm/tab/styles.js.map +1 -1
  106. package/dist/esm/tab-panel/styles.js +1 -1
  107. package/dist/esm/tab-panel/styles.js.map +1 -1
  108. package/dist/esm/table/components/cell/styles.js +1 -3
  109. package/dist/esm/table/components/cell/styles.js.map +1 -1
  110. package/dist/esm/table/components/group-row/styles.js +1 -2
  111. package/dist/esm/table/components/group-row/styles.js.map +1 -1
  112. package/dist/esm/table/components/header/styles.js +1 -1
  113. package/dist/esm/table/components/header/styles.js.map +1 -1
  114. package/dist/esm/table/components/row/styles.js +2 -2
  115. package/dist/esm/table/components/row/styles.js.map +1 -1
  116. package/dist/esm/table/styles.js +1 -1
  117. package/dist/esm/table/styles.js.map +1 -1
  118. package/dist/esm/table-column/anchor/cell-view/styles.js +4 -0
  119. package/dist/esm/table-column/anchor/cell-view/styles.js.map +1 -1
  120. package/dist/esm/table-column/base/styles.js +2 -3
  121. package/dist/esm/table-column/base/styles.js.map +1 -1
  122. package/dist/esm/table-column/mapping/cell-view/styles.js +1 -1
  123. package/dist/esm/table-column/mapping/cell-view/styles.js.map +1 -1
  124. package/dist/esm/table-column/mapping/group-header-view/styles.js +1 -1
  125. package/dist/esm/table-column/mapping/group-header-view/styles.js.map +1 -1
  126. package/dist/esm/table-column/text-base/cell-view/styles.js +7 -0
  127. package/dist/esm/table-column/text-base/cell-view/styles.js.map +1 -1
  128. package/dist/esm/table-column/text-base/group-header-view/styles.js +3 -0
  129. package/dist/esm/table-column/text-base/group-header-view/styles.js.map +1 -1
  130. package/dist/esm/tabs/styles.js +1 -1
  131. package/dist/esm/tabs/styles.js.map +1 -1
  132. package/dist/esm/tabs-toolbar/styles.js +1 -1
  133. package/dist/esm/tabs-toolbar/styles.js.map +1 -1
  134. package/dist/esm/text-area/styles.js +1 -1
  135. package/dist/esm/text-area/styles.js.map +1 -1
  136. package/dist/esm/text-field/styles.js +1 -1
  137. package/dist/esm/text-field/styles.js.map +1 -1
  138. package/dist/esm/theme-provider/styles.js +2 -3
  139. package/dist/esm/theme-provider/styles.js.map +1 -1
  140. package/dist/esm/toolbar/styles.js +3 -0
  141. package/dist/esm/toolbar/styles.js.map +1 -1
  142. package/dist/esm/tooltip/styles.js +1 -1
  143. package/dist/esm/tooltip/styles.js.map +1 -1
  144. package/dist/esm/tree-item/styles.js +1 -1
  145. package/dist/esm/tree-item/styles.js.map +1 -1
  146. package/dist/esm/tree-view/styles.js +1 -1
  147. package/dist/esm/tree-view/styles.js.map +1 -1
  148. package/dist/esm/unit/base/styles.d.ts +1 -0
  149. package/dist/esm/unit/base/styles.js +6 -0
  150. package/dist/esm/unit/base/styles.js.map +1 -0
  151. package/dist/esm/unit/byte/index.js +3 -1
  152. package/dist/esm/unit/byte/index.js.map +1 -1
  153. package/dist/esm/unit/celsius/index.js +3 -1
  154. package/dist/esm/unit/celsius/index.js.map +1 -1
  155. package/dist/esm/unit/fahrenheit/index.js +3 -1
  156. package/dist/esm/unit/fahrenheit/index.js.map +1 -1
  157. package/dist/esm/unit/volt/index.js +3 -1
  158. package/dist/esm/unit/volt/index.js.map +1 -1
  159. package/dist/esm/utilities/style/display.d.ts +6 -0
  160. package/dist/esm/utilities/style/display.js +9 -0
  161. package/dist/esm/utilities/style/display.js.map +1 -0
  162. package/dist/esm/wafer-map/styles.js +3 -1
  163. package/dist/esm/wafer-map/styles.js.map +1 -1
  164. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { css } from '@microsoft/fast-element';
2
- import { display } from '@microsoft/fast-foundation';
2
+ import { display } from '../../utilities/style/display';
3
3
  import { bodyDisabledFontColor, bodyFont, bodyFontColor, borderHoverColor, borderRgbPartialColor, borderWidth, controlLabelFontColor, controlLabelDisabledFontColor, failColor, iconSize, smallDelay, mediumPadding, standardPadding, linkFontColor, controlSlimHeight } from '../../theme-provider/design-tokens';
4
4
  import { styles as errorStyles } from '../../patterns/error/styles';
5
5
  import { toolbarTag } from '../../toolbar';
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/rich-text/editor/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,E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,CAAC,EACR;;iBAEa,qBAAqB;;;;;;;;;iBASrB,6BAA6B;;;MAGxC;AACE;;;GAGG,CAAC,EACR;;iBAEa,aAAa;;UAEpB;AACE;;;;;;;;GAQG,CAAC,EACR;;;;;iBAKS,qBAAqB;;;;;MAKhC,CAAA,2BAA4B,EAAE;;MAE9B,CAAA,uDAAwD,EAAE;;iBAE/C,aAAa;;;;iBAIb,qBAAqB;;;;;;;;;;;yBAWb,qBAAqB;;;;;;;;;MASxC,UAAU;;;;;;;;MAQV,UAAU;;;;MAIV,SAAS;MACT,eAAe;kBACH,iBAAiB;;;;;;6BAMN,eAAe;eAC7B,eAAe;;;;gBAId,SAAS;gBACT,eAAe;gBACf,eAAe;gBACf,aAAa;kBACX,iBAAiB;;;;;;;;;;eAUpB,aAAa;;;CAG3B,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '@microsoft/fast-foundation';\nimport {\n bodyDisabledFontColor,\n bodyFont,\n bodyFontColor,\n borderHoverColor,\n borderRgbPartialColor,\n borderWidth,\n controlLabelFontColor,\n controlLabelDisabledFontColor,\n failColor,\n iconSize,\n smallDelay,\n mediumPadding,\n standardPadding,\n linkFontColor,\n controlSlimHeight\n} from '../../theme-provider/design-tokens';\nimport { styles as errorStyles } from '../../patterns/error/styles';\nimport { toolbarTag } from '../../toolbar';\nimport { toggleButtonTag } from '../../toggle-button';\nimport { buttonTag } from '../../button';\nimport { anchorButtonTag } from '../../anchor-button';\nimport { menuButtonTag } from '../../menu-button';\n\nexport const styles = css`\n ${display('inline-flex')}\n ${errorStyles}\n\n :host {\n font: ${bodyFont};\n outline: none;\n color: ${bodyFontColor};\n flex-direction: column;\n --ni-private-rich-text-editor-hover-indicator-width: calc(\n ${borderWidth} + 1px\n );\n\n ${\n /** Initial height of rich text editor with one line space when the footer is visible. */ ''\n }\n height: 82px;\n --ni-private-rich-text-editor-footer-section-height: 40px;\n --ni-private-rich-text-editor-footer-section-border-top-width: 2px;\n ${\n /** Minimum width is added to accommodate all the possible buttons in the toolbar and to support the mobile width. */ ''\n }\n min-width: 360px;\n }\n\n .container {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n position: relative;\n height: 100%;\n border: ${borderWidth} solid rgba(${borderRgbPartialColor}, 0.3);\n }\n\n .container::after {\n display: block;\n content: ' ';\n position: absolute;\n bottom: calc(-1 * ${borderWidth});\n width: 0px;\n height: 0px;\n left: 50%;\n transform: translate(-50%, 50%);\n border-bottom: ${borderHoverColor}\n var(--ni-private-rich-text-editor-hover-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n .container:focus-within {\n border-bottom-color: ${borderHoverColor};\n }\n\n @media (prefers-reduced-motion) {\n .container::after {\n transition-duration: 0s;\n }\n }\n\n :host([disabled]) .container {\n color: ${bodyDisabledFontColor};\n border: ${borderWidth} solid rgba(${borderRgbPartialColor}, 0.1);\n }\n\n :host([error-visible]) .container {\n border-bottom-color: ${failColor};\n }\n\n :host(:hover) .container::after {\n width: calc(100% + 2 * ${borderWidth});\n }\n\n :host([disabled]:hover) .container::after {\n width: 0px;\n }\n\n :host([error-visible]) .container::after {\n border-bottom-color: ${failColor};\n }\n\n .editor-container {\n display: contents;\n }\n\n .editor {\n display: flex;\n flex-direction: column;\n border: ${borderWidth} solid transparent;\n border-radius: 0px;\n flex: 1;\n overflow: hidden;\n }\n\n :host([footer-hidden]) .editor {\n height: 100%;\n }\n\n .ProseMirror {\n overflow: auto;\n height: 100%;\n border: 0px;\n border-radius: 0px;\n background-color: transparent;\n font: inherit;\n padding: 8px;\n ${\n /* This padding ensures that showing/hiding the error icon doesn't affect text layout */ ''\n }\n padding-right: calc(${iconSize});\n box-sizing: border-box;\n position: relative;\n color: inherit;\n }\n\n ${\n /**\n * Below are the styles from prosemirror-view as the Prose mirror expects the \"white-space\" to be set. The recommendation is to load the style from the below package.\n * However, the other classes used in the below file like \".ProseMirror-selectednode\", \".ProseMirror-hideselection\" were not used anywhere in the \".Prosemirror\" content editable div in the DOM. So added only the necessary styles below.\n *\n * https://github.com/ProseMirror/prosemirror-view/blob/db2223a88b540a8f381fc2720198342e29a60566/style/prosemirror.css#L5C1-L12C2\n */ ''\n }\n .ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: 'liga' 0;\n }\n\n .ProseMirror pre {\n white-space: pre-wrap;\n }\n\n .ProseMirror li {\n position: relative;\n }\n\n ${/** End of Prose Mirror defined styles from prosemirror-view */ ''}\n\n .ProseMirror-focused {\n outline: none;\n }\n\n .ProseMirror > :first-child {\n margin-block-start: 0;\n }\n\n .ProseMirror > :last-child {\n margin-block-end: 0;\n }\n\n .ProseMirror li > p {\n margin-block: 0;\n }\n\n ${\n /**\n * Styles provided by Tiptap are necessary to display the placeholder value when the editor is empty.\n * Tiptap doc reference: https://tiptap.dev/api/extensions/placeholder#additional-setup\n */ ''\n }\n .ProseMirror p.is-editor-empty:first-child::before {\n color: ${controlLabelFontColor};\n content: attr(data-placeholder);\n float: left;\n height: 0;\n pointer-events: none;\n word-break: break-word;\n }\n\n :host([disabled]) .ProseMirror p.is-editor-empty:first-child::before {\n color: ${controlLabelDisabledFontColor};\n }\n\n ${\n /**\n * Custom anchor stylings can be removed once leveraging 'nimble-anchor' is supported.\n * See: https://github.com/ni/nimble/issues/1516\n */ ''\n }\n .ProseMirror a {\n color: ${linkFontColor};\n white-space: normal;\n ${\n /**\n * Setting 'pointer-events: none;' to restrict the user from opening a link using the right-click context menu: If the user manually edits\n * the link's text content, the 'href' attribute of the anchor tag will not be updated. If they attempt to open it using\n * the right-click context menu with 'Open in new tab/window,' it will still navigate to the link specified\n * in the 'href' attribute, which may create unnecessary confusion while trying to open the link.\n *\n * Using pointer-events: none to disable link interactions can be removed when hyperlink support is added.\n * see: https://github.com/ni/nimble/issues/1527\n */ ''\n }\n pointer-events: none;\n }\n\n :host([disabled]) .ProseMirror a {\n color: ${bodyDisabledFontColor};\n fill: currentcolor;\n cursor: default;\n }\n\n ${/** End of anchor styles */ ''}\n\n ${/* Shared styles for all mention views at edit time. */ ''}\n .ProseMirror .nimble-mention-view-edit {\n color: ${bodyFontColor};\n }\n\n :host([disabled]) .ProseMirror .nimble-mention-view-edit {\n color: ${bodyDisabledFontColor};\n }\n\n .footer-section {\n display: flex;\n justify-content: space-between;\n flex-shrink: 0;\n border: 0px;\n border-top: var(\n --ni-private-rich-text-editor-footer-section-border-top-width\n )\n solid rgba(${borderRgbPartialColor}, 0.1);\n height: var(--ni-private-rich-text-editor-footer-section-height);\n overflow: hidden;\n }\n\n :host([footer-hidden]) .footer-section {\n display: none;\n }\n\n ${toolbarTag}::part(positioning-region) {\n background: transparent;\n padding-right: 8px;\n box-sizing: border-box;\n gap: 0px;\n height: var(--ni-private-rich-text-editor-footer-section-height);\n }\n\n ${toolbarTag}::part(start) {\n gap: 8px;\n }\n\n ${buttonTag},\n ${toggleButtonTag} {\n height: ${controlSlimHeight};\n }\n\n .footer-actions {\n display: flex;\n justify-content: flex-end;\n margin-inline-end: ${standardPadding};\n gap: ${standardPadding};\n place-items: center;\n }\n\n ::slotted(${buttonTag}),\n ::slotted(${toggleButtonTag}),\n ::slotted(${anchorButtonTag}),\n ::slotted(${menuButtonTag}) {\n height: ${controlSlimHeight};\n }\n\n :host([error-visible]) .error-icon {\n display: none;\n }\n\n :host([error-visible]) .error-icon.scrollbar-width-calculated {\n display: inline-flex;\n position: absolute;\n top: ${mediumPadding};\n right: var(--ni-private-rich-text-editor-scrollbar-width);\n }\n`;\n"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/rich-text/editor/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EACH,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,qBAAq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ACR;;;;;iBAKS,qBAAqB;;;;;MAKhC,CAAA,2BAA4B,EAAE;;MAE9B,CAAA,uDAAwD,EAAE;;iBAE/C,aAAa;;;;iBAIb,qBAAqB;;;;;;;;;;;yBAWb,qBAAqB;;;;;;;;;MASxC,UAAU;;;;;;;;MAQV,UAAU;;;;MAIV,SAAS;MACT,eAAe;kBACH,iBAAiB;;;;;;6BAMN,eAAe;eAC7B,eAAe;;;;gBAId,SAAS;gBACT,eAAe;gBACf,eAAe;gBACf,aAAa;kBACX,iBAAiB;;;;;;;;;;eAUpB,aAAa;;;CAG3B,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '../../utilities/style/display';\nimport {\n bodyDisabledFontColor,\n bodyFont,\n bodyFontColor,\n borderHoverColor,\n borderRgbPartialColor,\n borderWidth,\n controlLabelFontColor,\n controlLabelDisabledFontColor,\n failColor,\n iconSize,\n smallDelay,\n mediumPadding,\n standardPadding,\n linkFontColor,\n controlSlimHeight\n} from '../../theme-provider/design-tokens';\nimport { styles as errorStyles } from '../../patterns/error/styles';\nimport { toolbarTag } from '../../toolbar';\nimport { toggleButtonTag } from '../../toggle-button';\nimport { buttonTag } from '../../button';\nimport { anchorButtonTag } from '../../anchor-button';\nimport { menuButtonTag } from '../../menu-button';\n\nexport const styles = css`\n ${display('inline-flex')}\n ${errorStyles}\n\n :host {\n font: ${bodyFont};\n outline: none;\n color: ${bodyFontColor};\n flex-direction: column;\n --ni-private-rich-text-editor-hover-indicator-width: calc(\n ${borderWidth} + 1px\n );\n\n ${\n /** Initial height of rich text editor with one line space when the footer is visible. */ ''\n }\n height: 82px;\n --ni-private-rich-text-editor-footer-section-height: 40px;\n --ni-private-rich-text-editor-footer-section-border-top-width: 2px;\n ${\n /** Minimum width is added to accommodate all the possible buttons in the toolbar and to support the mobile width. */ ''\n }\n min-width: 360px;\n }\n\n .container {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n position: relative;\n height: 100%;\n border: ${borderWidth} solid rgba(${borderRgbPartialColor}, 0.3);\n }\n\n .container::after {\n display: block;\n content: ' ';\n position: absolute;\n bottom: calc(-1 * ${borderWidth});\n width: 0px;\n height: 0px;\n left: 50%;\n transform: translate(-50%, 50%);\n border-bottom: ${borderHoverColor}\n var(--ni-private-rich-text-editor-hover-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n .container:focus-within {\n border-bottom-color: ${borderHoverColor};\n }\n\n @media (prefers-reduced-motion) {\n .container::after {\n transition-duration: 0s;\n }\n }\n\n :host([disabled]) .container {\n color: ${bodyDisabledFontColor};\n border: ${borderWidth} solid rgba(${borderRgbPartialColor}, 0.1);\n }\n\n :host([error-visible]) .container {\n border-bottom-color: ${failColor};\n }\n\n :host(:hover) .container::after {\n width: calc(100% + 2 * ${borderWidth});\n }\n\n :host([disabled]:hover) .container::after {\n width: 0px;\n }\n\n :host([error-visible]) .container::after {\n border-bottom-color: ${failColor};\n }\n\n .editor-container {\n display: contents;\n }\n\n .editor {\n display: flex;\n flex-direction: column;\n border: ${borderWidth} solid transparent;\n border-radius: 0px;\n flex: 1;\n overflow: hidden;\n }\n\n :host([footer-hidden]) .editor {\n height: 100%;\n }\n\n .ProseMirror {\n overflow: auto;\n height: 100%;\n border: 0px;\n border-radius: 0px;\n background-color: transparent;\n font: inherit;\n padding: 8px;\n ${\n /* This padding ensures that showing/hiding the error icon doesn't affect text layout */ ''\n }\n padding-right: calc(${iconSize});\n box-sizing: border-box;\n position: relative;\n color: inherit;\n }\n\n ${\n /**\n * Below are the styles from prosemirror-view as the Prose mirror expects the \"white-space\" to be set. The recommendation is to load the style from the below package.\n * However, the other classes used in the below file like \".ProseMirror-selectednode\", \".ProseMirror-hideselection\" were not used anywhere in the \".Prosemirror\" content editable div in the DOM. So added only the necessary styles below.\n *\n * https://github.com/ProseMirror/prosemirror-view/blob/db2223a88b540a8f381fc2720198342e29a60566/style/prosemirror.css#L5C1-L12C2\n */ ''\n }\n .ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: 'liga' 0;\n }\n\n .ProseMirror pre {\n white-space: pre-wrap;\n }\n\n .ProseMirror li {\n position: relative;\n }\n\n ${/** End of Prose Mirror defined styles from prosemirror-view */ ''}\n\n .ProseMirror-focused {\n outline: none;\n }\n\n .ProseMirror > :first-child {\n margin-block-start: 0;\n }\n\n .ProseMirror > :last-child {\n margin-block-end: 0;\n }\n\n .ProseMirror li > p {\n margin-block: 0;\n }\n\n ${\n /**\n * Styles provided by Tiptap are necessary to display the placeholder value when the editor is empty.\n * Tiptap doc reference: https://tiptap.dev/api/extensions/placeholder#additional-setup\n */ ''\n }\n .ProseMirror p.is-editor-empty:first-child::before {\n color: ${controlLabelFontColor};\n content: attr(data-placeholder);\n float: left;\n height: 0;\n pointer-events: none;\n word-break: break-word;\n }\n\n :host([disabled]) .ProseMirror p.is-editor-empty:first-child::before {\n color: ${controlLabelDisabledFontColor};\n }\n\n ${\n /**\n * Custom anchor stylings can be removed once leveraging 'nimble-anchor' is supported.\n * See: https://github.com/ni/nimble/issues/1516\n */ ''\n }\n .ProseMirror a {\n color: ${linkFontColor};\n white-space: normal;\n ${\n /**\n * Setting 'pointer-events: none;' to restrict the user from opening a link using the right-click context menu: If the user manually edits\n * the link's text content, the 'href' attribute of the anchor tag will not be updated. If they attempt to open it using\n * the right-click context menu with 'Open in new tab/window,' it will still navigate to the link specified\n * in the 'href' attribute, which may create unnecessary confusion while trying to open the link.\n *\n * Using pointer-events: none to disable link interactions can be removed when hyperlink support is added.\n * see: https://github.com/ni/nimble/issues/1527\n */ ''\n }\n pointer-events: none;\n }\n\n :host([disabled]) .ProseMirror a {\n color: ${bodyDisabledFontColor};\n fill: currentcolor;\n cursor: default;\n }\n\n ${/** End of anchor styles */ ''}\n\n ${/* Shared styles for all mention views at edit time. */ ''}\n .ProseMirror .nimble-mention-view-edit {\n color: ${bodyFontColor};\n }\n\n :host([disabled]) .ProseMirror .nimble-mention-view-edit {\n color: ${bodyDisabledFontColor};\n }\n\n .footer-section {\n display: flex;\n justify-content: space-between;\n flex-shrink: 0;\n border: 0px;\n border-top: var(\n --ni-private-rich-text-editor-footer-section-border-top-width\n )\n solid rgba(${borderRgbPartialColor}, 0.1);\n height: var(--ni-private-rich-text-editor-footer-section-height);\n overflow: hidden;\n }\n\n :host([footer-hidden]) .footer-section {\n display: none;\n }\n\n ${toolbarTag}::part(positioning-region) {\n background: transparent;\n padding-right: 8px;\n box-sizing: border-box;\n gap: 0px;\n height: var(--ni-private-rich-text-editor-footer-section-height);\n }\n\n ${toolbarTag}::part(start) {\n gap: 8px;\n }\n\n ${buttonTag},\n ${toggleButtonTag} {\n height: ${controlSlimHeight};\n }\n\n .footer-actions {\n display: flex;\n justify-content: flex-end;\n margin-inline-end: ${standardPadding};\n gap: ${standardPadding};\n place-items: center;\n }\n\n ::slotted(${buttonTag}),\n ::slotted(${toggleButtonTag}),\n ::slotted(${anchorButtonTag}),\n ::slotted(${menuButtonTag}) {\n height: ${controlSlimHeight};\n }\n\n :host([error-visible]) .error-icon {\n display: none;\n }\n\n :host([error-visible]) .error-icon.scrollbar-width-calculated {\n display: inline-flex;\n position: absolute;\n top: ${mediumPadding};\n right: var(--ni-private-rich-text-editor-scrollbar-width);\n }\n`;\n"]}
@@ -1,5 +1,5 @@
1
1
  import { css } from '@microsoft/fast-element';
2
- import { display } from '@microsoft/fast-foundation';
2
+ import { display } from '../../utilities/style/display';
3
3
  import { bodyFont, bodyFontColor, linkFontColor } from '../../theme-provider/design-tokens';
4
4
  export const styles = css `
5
5
  ${display('flex')}
@@ -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;;;;;;;;;;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"]}
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,+BAA+B,CAAC;AACxD,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 '../../utilities/style/display';\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"]}
@@ -0,0 +1 @@
1
+ export declare const styles: import("@microsoft/fast-element").ElementStyles;
@@ -0,0 +1,6 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ import { display } from '../../utilities/style/display';
3
+ export const styles = css `
4
+ ${display('none')}
5
+ `;
6
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/rich-text-mention/base/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;CACpB,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '../../utilities/style/display';\n\nexport const styles = css`\n ${display('none')}\n`;\n"]}
@@ -6,6 +6,7 @@ import { iconAtTag } from '../../icons/at';
6
6
  import { MappingUser } from '../../mapping/user';
7
7
  import { RichTextMentionUsersValidator } from './models/rich-text-mention-users-validator';
8
8
  import { richTextMentionUsersViewTag } from './view';
9
+ import { styles } from '../base/styles';
9
10
  /**
10
11
  * Rich Text user mention configuration element which will have MappingMentionUser elements as children
11
12
  */
@@ -32,7 +33,8 @@ export class RichTextMentionUsers extends RichTextMention {
32
33
  }
33
34
  const nimbleRichTextMentionUsers = RichTextMentionUsers.compose({
34
35
  baseName: 'rich-text-mention-users',
35
- template
36
+ template,
37
+ styles
36
38
  });
37
39
  DesignSystem.getOrCreate()
38
40
  .withPrefix('nimble')
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rich-text-mention/users/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GAAG,gCAAgC,CAAC","sourcesContent":["import { DesignSystem } from '@microsoft/fast-foundation';\nimport type { MentionInternalsOptions } from '../base/models/mention-internals';\nimport { RichTextMention } from '../base';\nimport type { MappingConfig } from '../base/models/mapping-config';\nimport { MappingUserConfig } from './models/mapping-user-config';\nimport { template } from '../base/template';\nimport { iconAtTag } from '../../icons/at';\nimport { MappingUser } from '../../mapping/user';\nimport type { Mapping } from '../../mapping/base';\nimport type { MappingUserKey } from '../../mapping/base/types';\nimport { RichTextMentionUsersValidator } from './models/rich-text-mention-users-validator';\nimport { richTextMentionUsersViewTag } from './view';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-rich-text-mention-users': RichTextMentionUsers;\n }\n}\n\n/**\n * Rich Text user mention configuration element which will have MappingMentionUser elements as children\n */\nexport class RichTextMentionUsers extends RichTextMention<RichTextMentionUsersValidator> {\n protected override getMentionInternalsOptions(): MentionInternalsOptions<RichTextMentionUsersValidator> {\n return {\n icon: iconAtTag,\n character: '@',\n viewElement: richTextMentionUsersViewTag,\n validator: new RichTextMentionUsersValidator()\n };\n }\n\n protected override getObservedMappingProperty(): string[] {\n return ['key', 'displayName'];\n }\n\n protected createMappingConfig(\n mapping: Mapping<MappingUserKey>\n ): MappingConfig {\n if (mapping instanceof MappingUser) {\n return new MappingUserConfig(mapping.key, mapping.displayName);\n }\n // Getting here would indicate a programming error, b/c validation will prevent\n // this function from running when there is an unsupported mapping.\n throw new Error('Unsupported mapping');\n }\n}\nconst nimbleRichTextMentionUsers = RichTextMentionUsers.compose({\n baseName: 'rich-text-mention-users',\n template\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('nimble')\n .register(nimbleRichTextMentionUsers());\nexport const richTextMentionUsersTag = 'nimble-rich-text-mention-users';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rich-text-mention/users/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OA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","sourcesContent":["import { DesignSystem } from '@microsoft/fast-foundation';\nimport type { MentionInternalsOptions } from '../base/models/mention-internals';\nimport { RichTextMention } from '../base';\nimport type { MappingConfig } from '../base/models/mapping-config';\nimport { MappingUserConfig } from './models/mapping-user-config';\nimport { template } from '../base/template';\nimport { iconAtTag } from '../../icons/at';\nimport { MappingUser } from '../../mapping/user';\nimport type { Mapping } from '../../mapping/base';\nimport type { MappingUserKey } from '../../mapping/base/types';\nimport { RichTextMentionUsersValidator } from './models/rich-text-mention-users-validator';\nimport { richTextMentionUsersViewTag } from './view';\nimport { styles } from '../base/styles';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-rich-text-mention-users': RichTextMentionUsers;\n }\n}\n\n/**\n * Rich Text user mention configuration element which will have MappingMentionUser elements as children\n */\nexport class RichTextMentionUsers extends RichTextMention<RichTextMentionUsersValidator> {\n protected override getMentionInternalsOptions(): MentionInternalsOptions<RichTextMentionUsersValidator> {\n return {\n icon: iconAtTag,\n character: '@',\n viewElement: richTextMentionUsersViewTag,\n validator: new RichTextMentionUsersValidator()\n };\n }\n\n protected override getObservedMappingProperty(): string[] {\n return ['key', 'displayName'];\n }\n\n protected createMappingConfig(\n mapping: Mapping<MappingUserKey>\n ): MappingConfig {\n if (mapping instanceof MappingUser) {\n return new MappingUserConfig(mapping.key, mapping.displayName);\n }\n // Getting here would indicate a programming error, b/c validation will prevent\n // this function from running when there is an unsupported mapping.\n throw new Error('Unsupported mapping');\n }\n}\nconst nimbleRichTextMentionUsers = RichTextMentionUsers.compose({\n baseName: 'rich-text-mention-users',\n template,\n styles\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('nimble')\n .register(nimbleRichTextMentionUsers());\nexport const richTextMentionUsersTag = 'nimble-rich-text-mention-users';\n"]}
@@ -1,5 +1,5 @@
1
1
  import { css } from '@microsoft/fast-element';
2
- import { display } from '@microsoft/fast-foundation';
2
+ import { display } from '../../../utilities/style/display';
3
3
  import { mentionFont, mentionFontColor, mentionDisabledFontColor } from '../../../theme-provider/design-tokens';
4
4
  export const styles = css `
5
5
  ${display('inline-block')}
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../src/rich-text-mention/users/view/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EAC3B,MAAM,uCAAuC,CAAC;AAE/C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,cAAc,CAAC;;;;gBAIb,WAAW;;;;iBAIV,gBAAgB;;;;iBAIhB,wBAAwB;;CAExC,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '@microsoft/fast-foundation';\nimport {\n mentionFont,\n mentionFontColor,\n mentionDisabledFontColor\n} from '../../../theme-provider/design-tokens';\n\nexport const styles = css`\n ${display('inline-block')}\n\n :host {\n box-sizing: border-box;\n font: ${mentionFont};\n }\n\n .control {\n color: ${mentionFontColor};\n }\n\n :host([disabled]) .control {\n color: ${mentionDisabledFontColor};\n }\n`;\n"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../src/rich-text-mention/users/view/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,wBAAwB,EAC3B,MAAM,uCAAuC,CAAC;AAE/C,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,cAAc,CAAC;;;;gBAIb,WAAW;;;;iBAIV,gBAAgB;;;;iBAIhB,wBAAwB;;CAExC,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { display } from '../../../utilities/style/display';\nimport {\n mentionFont,\n mentionFontColor,\n mentionDisabledFontColor\n} from '../../../theme-provider/design-tokens';\n\nexport const styles = css`\n ${display('inline-block')}\n\n :host {\n box-sizing: border-box;\n font: ${mentionFont};\n }\n\n .control {\n color: ${mentionFontColor};\n }\n\n :host([disabled]) .control {\n color: ${mentionDisabledFontColor};\n }\n`;\n"]}
@@ -31,6 +31,7 @@ export declare class Select extends FormAssociatedSelect implements ErrorPattern
31
31
  errorText: string | undefined;
32
32
  errorVisible: boolean;
33
33
  filterMode: FilterMode;
34
+ clearable: boolean;
34
35
  /**
35
36
  * @internal
36
37
  */
@@ -85,10 +86,6 @@ export declare class Select extends FormAssociatedSelect implements ErrorPattern
85
86
  * @internal
86
87
  */
87
88
  filter: string;
88
- /**
89
- * @internal
90
- */
91
- committedSelectedOption?: ListboxOption;
92
89
  /**
93
90
  * The max height for the listbox when opened.
94
91
  *
@@ -167,7 +164,7 @@ export declare class Select extends FormAssociatedSelect implements ErrorPattern
167
164
  /**
168
165
  * @internal
169
166
  */
170
- changeValueHandler(): void;
167
+ clearClickHandler(e: MouseEvent): void;
171
168
  /**
172
169
  * @internal
173
170
  */
@@ -272,7 +269,7 @@ export declare class Select extends FormAssociatedSelect implements ErrorPattern
272
269
  protected setDefaultSelectedOption(): void;
273
270
  private setActiveOption;
274
271
  private focusAndScrollActiveOptionIntoView;
275
- private committedSelectedOptionChanged;
272
+ private getPlaceholderOption;
276
273
  private setPositioning;
277
274
  /**
278
275
  * Filter available options by text value.
@@ -288,6 +285,7 @@ export declare class Select extends FormAssociatedSelect implements ErrorPattern
288
285
  * @internal
289
286
  */
290
287
  private updateValue;
288
+ private clearSelect;
291
289
  /**
292
290
  * Resets and fills the proxy to match the component's options.
293
291
  *
@@ -19,6 +19,9 @@ const isNimbleListOption = (el) => {
19
19
  const isOptionSelectable = (el) => {
20
20
  return !el.visuallyHidden && !el.disabled && !el.hidden;
21
21
  };
22
+ const isOptionPlaceholder = (el) => {
23
+ return el.disabled && el.hidden;
24
+ };
22
25
  /**
23
26
  * A nimble-styled HTML select.
24
27
  */
@@ -28,6 +31,7 @@ export class Select extends FormAssociatedSelect {
28
31
  this.appearance = DropdownAppearance.underline;
29
32
  this.errorVisible = false;
30
33
  this.filterMode = FilterMode.none;
34
+ this.clearable = false;
31
35
  /**
32
36
  * @internal
33
37
  */
@@ -100,13 +104,8 @@ export class Select extends FormAssociatedSelect {
100
104
  if (prev !== newValue && !(this.open && this.selectedIndex < 0)) {
101
105
  this._value = newValue;
102
106
  super.valueChanged(prev, newValue);
103
- if (!this.open) {
104
- this.committedSelectedOption = this.options.find(o => o.value === newValue);
105
- }
106
107
  Observable.notify(this, 'value');
107
- if (this.collapsible) {
108
- Observable.notify(this, 'displayValue');
109
- }
108
+ this.updateDisplayValue();
110
109
  }
111
110
  }
112
111
  /**
@@ -114,7 +113,7 @@ export class Select extends FormAssociatedSelect {
114
113
  */
115
114
  get displayValue() {
116
115
  Observable.track(this, 'displayValue');
117
- return this.committedSelectedOption?.text ?? '';
116
+ return this.firstSelectedOption?.text ?? '';
118
117
  }
119
118
  /**
120
119
  * @internal
@@ -158,7 +157,6 @@ export class Select extends FormAssociatedSelect {
158
157
  if (value) {
159
158
  this.value = value;
160
159
  }
161
- this.committedSelectedOption = this.options[this.selectedIndex];
162
160
  }
163
161
  /**
164
162
  * @internal
@@ -203,11 +201,13 @@ export class Select extends FormAssociatedSelect {
203
201
  break;
204
202
  }
205
203
  case 'selected': {
206
- if (isNimbleListOption(sourceElement)) {
204
+ if (isNimbleListOption(sourceElement)
205
+ && sourceElement.selected) {
207
206
  this.selectedIndex = this.options.indexOf(sourceElement);
208
207
  }
209
- this.setSelectedOptions();
210
- this.updateDisplayValue();
208
+ else {
209
+ this.clearSelect();
210
+ }
211
211
  break;
212
212
  }
213
213
  case 'hidden': {
@@ -266,24 +266,25 @@ export class Select extends FormAssociatedSelect {
266
266
  /**
267
267
  * @internal
268
268
  */
269
- changeValueHandler() {
270
- this.committedSelectedOption = this.options.find(option => option.selected);
269
+ clearClickHandler(e) {
270
+ this.open = false;
271
+ this.clearSelect();
272
+ this.updateValue(true);
273
+ e.stopPropagation();
271
274
  }
272
275
  /**
273
276
  * @internal
274
277
  */
275
278
  updateDisplayValue() {
276
- if (this.committedSelectedOption?.disabled
277
- && this.committedSelectedOption?.hidden
278
- && this.committedSelectedOption?.selected) {
279
+ const placeholderOption = this.getPlaceholderOption();
280
+ if (placeholderOption
281
+ && this.firstSelectedOption === placeholderOption) {
279
282
  this.displayPlaceholder = true;
280
283
  }
281
284
  else {
282
285
  this.displayPlaceholder = false;
283
286
  }
284
- if (this.collapsible) {
285
- Observable.notify(this, 'displayValue');
286
- }
287
+ Observable.notify(this, 'displayValue');
287
288
  }
288
289
  /**
289
290
  * Handle content changes on the control input.
@@ -373,6 +374,11 @@ export class Select extends FormAssociatedSelect {
373
374
  }
374
375
  case keyEscape: {
375
376
  if (!this.open) {
377
+ if (this.clearable) {
378
+ this.clearSelect();
379
+ this.updateValue(true);
380
+ return true;
381
+ }
376
382
  break;
377
383
  }
378
384
  if (this.collapsible && this.open) {
@@ -520,10 +526,10 @@ export class Select extends FormAssociatedSelect {
520
526
  // for more info.
521
527
  this.options.push(option);
522
528
  }
523
- // Prevents parent classes from resetting selectedIndex to a positive
524
- // value while filtering, which can result in a disabled option being
525
- // selected.
526
529
  setSelectedOptions() {
530
+ // Prevents parent classes from resetting selectedIndex to a positive
531
+ // value while filtering, which can result in a disabled option being
532
+ // selected.
527
533
  if (this.open && this.selectedIndex === -1) {
528
534
  return;
529
535
  }
@@ -619,12 +625,17 @@ export class Select extends FormAssociatedSelect {
619
625
  };
620
626
  let selectedIndex = -1;
621
627
  let firstValidOptionIndex = -1;
628
+ let placeholderIndex = -1;
622
629
  for (let i = 0; i < options?.length; i++) {
623
630
  const option = options[i];
624
- if (optionIsSelected(option) || option?.value === this.value) {
631
+ if (optionIsSelected(option) || option.value === this.value) {
625
632
  selectedIndex = i;
633
+ break;
626
634
  }
627
- if (firstValidOptionIndex === -1
635
+ else if (placeholderIndex === -1 && isOptionPlaceholder(option)) {
636
+ placeholderIndex = i;
637
+ }
638
+ else if (firstValidOptionIndex === -1
628
639
  && isOptionSelectable(option)) {
629
640
  firstValidOptionIndex = i;
630
641
  }
@@ -632,13 +643,15 @@ export class Select extends FormAssociatedSelect {
632
643
  if (selectedIndex !== -1) {
633
644
  this.selectedIndex = selectedIndex;
634
645
  }
646
+ else if (placeholderIndex !== -1) {
647
+ this.selectedIndex = placeholderIndex;
648
+ }
635
649
  else if (firstValidOptionIndex !== -1) {
636
650
  this.selectedIndex = firstValidOptionIndex;
637
651
  }
638
652
  else {
639
653
  this.selectedIndex = 0;
640
654
  }
641
- this.committedSelectedOption = options[this.selectedIndex];
642
655
  }
643
656
  setActiveOption(newActiveIndex) {
644
657
  const activeOption = this.options[newActiveIndex];
@@ -674,8 +687,8 @@ export class Select extends FormAssociatedSelect {
674
687
  });
675
688
  }
676
689
  }
677
- committedSelectedOptionChanged() {
678
- this.updateDisplayValue();
690
+ getPlaceholderOption() {
691
+ return this.options.find(o => o.hidden && o.disabled);
679
692
  }
680
693
  setPositioning() {
681
694
  if (!this.$fastController.isConnected) {
@@ -750,6 +763,12 @@ export class Select extends FormAssociatedSelect {
750
763
  });
751
764
  }
752
765
  }
766
+ clearSelect() {
767
+ const placeholder = this.getPlaceholderOption();
768
+ this.selectedIndex = placeholder
769
+ ? this.options.indexOf(placeholder)
770
+ : -1;
771
+ }
753
772
  /**
754
773
  * Resets and fills the proxy to match the component's options.
755
774
  *
@@ -776,7 +795,6 @@ export class Select extends FormAssociatedSelect {
776
795
  this.updateListboxMaxHeightCssVariable();
777
796
  }
778
797
  initializeOpenState() {
779
- this.committedSelectedOption = this.options[this.selectedIndex];
780
798
  this.setActiveOption(this.selectedIndex);
781
799
  this.ariaControls = this.listboxId;
782
800
  this.ariaExpanded = 'true';
@@ -804,6 +822,9 @@ __decorate([
804
822
  __decorate([
805
823
  attr({ attribute: 'filter-mode' })
806
824
  ], Select.prototype, "filterMode", void 0);
825
+ __decorate([
826
+ attr({ attribute: 'clearable', mode: 'boolean' })
827
+ ], Select.prototype, "clearable", void 0);
807
828
  __decorate([
808
829
  observable
809
830
  ], Select.prototype, "displayPlaceholder", void 0);
@@ -834,9 +855,6 @@ __decorate([
834
855
  __decorate([
835
856
  observable
836
857
  ], Select.prototype, "filter", void 0);
837
- __decorate([
838
- observable
839
- ], Select.prototype, "committedSelectedOption", void 0);
840
858
  __decorate([
841
859
  observable
842
860
  ], Select.prototype, "maxHeight", void 0);