@ni/nimble-components 30.0.7 → 30.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-components-bundle.js +133 -97
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +1291 -1272
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/anchor-menu-item/index.js.map +1 -1
- package/dist/esm/anchor-tabs/index.js.map +1 -1
- package/dist/esm/anchor-tree-item/index.js.map +1 -1
- package/dist/esm/combobox/index.js +4 -4
- package/dist/esm/combobox/index.js.map +1 -1
- package/dist/esm/combobox/styles.js +0 -4
- package/dist/esm/combobox/styles.js.map +1 -1
- package/dist/esm/combobox/template.js +13 -2
- package/dist/esm/combobox/template.js.map +1 -1
- package/dist/esm/combobox/testing/combobox.pageobject.d.ts +8 -0
- package/dist/esm/combobox/testing/combobox.pageobject.js +15 -0
- package/dist/esm/combobox/testing/combobox.pageobject.js.map +1 -1
- package/dist/esm/dialog/index.js.map +1 -1
- package/dist/esm/drawer/index.js.map +1 -1
- package/dist/esm/label-provider/base/index.js.map +1 -1
- package/dist/esm/list-option/index.js.map +1 -1
- package/dist/esm/list-option-group/index.js.map +1 -1
- package/dist/esm/mapping/icon/index.js.map +1 -1
- package/dist/esm/menu-button/index.js.map +1 -1
- package/dist/esm/menu-button/testing/menu-button.pageobject.js.map +1 -1
- package/dist/esm/patterns/dropdown/styles.js +68 -51
- package/dist/esm/patterns/dropdown/styles.js.map +1 -1
- package/dist/esm/rich-text/base/index.js.map +1 -1
- package/dist/esm/rich-text/editor/index.js.map +1 -1
- package/dist/esm/rich-text/editor/models/create-tiptap-editor.js.map +1 -1
- package/dist/esm/rich-text/editor/testing/rich-text-editor.pageobject.js.map +1 -1
- package/dist/esm/rich-text/mention-listbox/index.js +3 -0
- package/dist/esm/rich-text/mention-listbox/index.js.map +1 -1
- package/dist/esm/rich-text/mention-listbox/template.js +18 -3
- package/dist/esm/rich-text/mention-listbox/template.js.map +1 -1
- package/dist/esm/rich-text/models/markdown-parser.js +12 -12
- package/dist/esm/rich-text/models/markdown-parser.js.map +1 -1
- package/dist/esm/rich-text/models/rich-text-tracker.js.map +1 -1
- package/dist/esm/rich-text/models/testing/markdown-parser-utils.js.map +1 -1
- package/dist/esm/rich-text/viewer/index.js.map +1 -1
- package/dist/esm/rich-text/viewer/testing/rich-text-viewer.pageobject.js.map +1 -1
- package/dist/esm/rich-text-mention/base/index.js.map +1 -1
- package/dist/esm/rich-text-mention/base/models/mention-validator.js.map +1 -1
- package/dist/esm/rich-text-mention/users/index.js.map +1 -1
- package/dist/esm/select/index.js.map +1 -1
- package/dist/esm/select/models/select-form-associated.js +1 -0
- package/dist/esm/select/models/select-form-associated.js.map +1 -1
- package/dist/esm/select/styles.js +0 -16
- package/dist/esm/select/styles.js.map +1 -1
- package/dist/esm/select/template.js +7 -6
- package/dist/esm/select/template.js.map +1 -1
- package/dist/esm/select/testing/select.pageobject.js.map +1 -1
- package/dist/esm/spinner/template.js +1 -0
- package/dist/esm/spinner/template.js.map +1 -1
- package/dist/esm/table/components/group-row/index.js.map +1 -1
- package/dist/esm/table/components/group-row/template.js +1 -0
- package/dist/esm/table/components/group-row/template.js.map +1 -1
- package/dist/esm/table/components/header/index.js.map +1 -1
- package/dist/esm/table/components/row/index.js.map +1 -1
- package/dist/esm/table/index.js.map +1 -1
- package/dist/esm/table/models/array-to-tree.js.map +1 -1
- package/dist/esm/table/models/data-hierarchy-manager.js.map +1 -1
- package/dist/esm/table/models/expansion-manager.js.map +1 -1
- package/dist/esm/table/models/interactive-selection-manager.js.map +1 -1
- package/dist/esm/table/models/keyboard-navigation-manager.js.map +1 -1
- package/dist/esm/table/models/selection-managers/multi-selection-manager.js.map +1 -1
- package/dist/esm/table/models/selection-managers/selection-manager-base.js.map +1 -1
- package/dist/esm/table/models/sort-operations.js.map +1 -1
- package/dist/esm/table/models/table-layout-manager.js.map +1 -1
- package/dist/esm/table/models/table-update-tracker.js.map +1 -1
- package/dist/esm/table/models/table-validator.js.map +1 -1
- package/dist/esm/table/models/virtualizer.js.map +1 -1
- package/dist/esm/table/testing/table.pageobject.js.map +1 -1
- package/dist/esm/table-column/anchor/cell-view/index.js.map +1 -1
- package/dist/esm/table-column/anchor/cell-view/template.js +1 -0
- package/dist/esm/table-column/anchor/cell-view/template.js.map +1 -1
- package/dist/esm/table-column/base/cell-view/index.js.map +1 -1
- package/dist/esm/table-column/base/cell-view/template.js.map +1 -1
- package/dist/esm/table-column/base/group-header-view/template.js.map +1 -1
- package/dist/esm/table-column/base/models/column-internals.js.map +1 -1
- package/dist/esm/table-column/base/models/column-validator.js.map +1 -1
- package/dist/esm/table-column/date-text/cell-view/index.js.map +1 -1
- package/dist/esm/table-column/date-text/group-header-view/index.js.map +1 -1
- package/dist/esm/table-column/date-text/index.js.map +1 -1
- package/dist/esm/table-column/date-text/models/format-helper.js.map +1 -1
- package/dist/esm/table-column/date-text/testing/table-column-date-text.pageobject.js.map +1 -1
- package/dist/esm/table-column/duration-text/group-header-view/index.js.map +1 -1
- package/dist/esm/table-column/duration-text/models/duration-formatter.js.map +1 -1
- package/dist/esm/table-column/duration-text/testing/table-column-duration-text.pageobject.js.map +1 -1
- package/dist/esm/table-column/enum-base/index.js.map +1 -1
- package/dist/esm/table-column/enum-base/models/mapping-key-resolver.js.map +1 -1
- package/dist/esm/table-column/mapping/cell-view/index.js.map +1 -1
- package/dist/esm/table-column/mapping/group-header-view/index.js.map +1 -1
- package/dist/esm/table-column/mapping/index.js.map +1 -1
- package/dist/esm/table-column/mapping/testing/table-column-mapping.pageobject.js.map +1 -1
- package/dist/esm/table-column/menu-button/cell-view/index.js.map +1 -1
- package/dist/esm/table-column/menu-button/index.js.map +1 -1
- package/dist/esm/table-column/mixins/custom-sort-order.js.map +1 -1
- package/dist/esm/table-column/mixins/sortable-column.js.map +1 -1
- package/dist/esm/table-column/number-text/index.js.map +1 -1
- package/dist/esm/table-column/number-text/models/number-text-unit-format.js.map +1 -1
- package/dist/esm/table-column/text-base/cell-view/index.js.map +1 -1
- package/dist/esm/table-column/text-base/group-header-view/index.js.map +1 -1
- package/dist/esm/text-area/index.js.map +1 -1
- package/dist/esm/theme-provider/design-tokens.js.map +1 -1
- package/dist/esm/theme-provider/index.js.map +1 -1
- package/dist/esm/tree-view/index.js.map +1 -1
- package/dist/esm/utilities/models/converter.js.map +1 -1
- package/dist/esm/utilities/models/document-element-lang.js.map +1 -1
- package/dist/esm/utilities/models/tracker.js.map +1 -1
- package/dist/esm/utilities/style/direction.js.map +1 -1
- package/dist/esm/utilities/style/multivalue-property-stylesheet-behavior.js.map +1 -1
- package/dist/esm/utilities/style/theme.js +1 -0
- package/dist/esm/utilities/style/theme.js.map +1 -1
- package/dist/esm/utilities/testing/component.js.map +1 -1
- package/dist/esm/utilities/unit-format/decimal-unit-format.js.map +1 -1
- package/dist/esm/utilities/unit-format/default-unit-format.js.map +1 -1
- package/dist/esm/utilities/unit-format/scaled-unit-format/manually-translated-scaled-unit-format.js +1 -0
- package/dist/esm/utilities/unit-format/scaled-unit-format/manually-translated-scaled-unit-format.js.map +1 -1
- package/dist/esm/utilities/unit-format/unit-format.js.map +1 -1
- package/dist/esm/utilities/unit-format/unit-scale/unit-scale.js.map +1 -1
- package/dist/esm/wafer-map/experimental/computations.js.map +1 -1
- package/dist/esm/wafer-map/experimental/hover-handler.js.map +1 -1
- package/dist/esm/wafer-map/experimental/worker-renderer.js.map +1 -1
- package/dist/esm/wafer-map/index.js.map +1 -1
- package/dist/esm/wafer-map/modules/computations.js.map +1 -1
- package/dist/esm/wafer-map/modules/create-matrix-renderer.js.map +1 -1
- package/dist/esm/wafer-map/modules/hover-handler.js.map +1 -1
- package/dist/esm/wafer-map/modules/prerendering.js.map +1 -1
- package/dist/esm/wafer-map/modules/rendering.js.map +1 -1
- package/dist/esm/wafer-map/modules/wafer-map-update-tracker.js.map +1 -1
- package/dist/esm/wafer-map/modules/wafer-map-validator.js.map +1 -1
- package/dist/esm/wafer-map/modules/zoom-handler.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dialog/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACH,WAAW,EACX,6BAA6B,EAC7B,YAAY,EACZ,iBAAiB,EACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,CAAC;AAQzB;;GAEG;AACH,mEAAmE;AACnE,MAAM,OAAO,MAA2B,SAAQ,iBAAiB;IAAjE;;QAKI;;;;WAIG;QAEI,mBAAc,GAAG,KAAK,CAAC;QAE9B;;;;WAIG;QAEI,iBAAY,GAAG,KAAK,CAAC;QAE5B;;;;WAIG;QAEI,iBAAY,GAAG,KAAK,CAAC;QAS5B,gBAAgB;QAET,kBAAa,GAAG,IAAI,CAAC;IAqFhC,CAAC;IA/EG;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC;IAC1C,CAAC;IAID;;;OAGG;IACI,KAAK,CAAC,IAAI;QACb,IAAI,IAAI,CAAC,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dialog/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACH,WAAW,EACX,6BAA6B,EAC7B,YAAY,EACZ,iBAAiB,EACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,MAA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ChC,QAAQ,EAAE,QAAQ;IAClB,QAAQ;IACR,MAAM;IACN,SAAS,EAAE,MAAM;CACpB,CAAC,CAAC;AAEH,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":["import { attr, observable } from '@microsoft/fast-element';\nimport {\n applyMixins,\n ARIAGlobalStatesAndProperties,\n DesignSystem,\n FoundationElement\n} from '@microsoft/fast-foundation';\nimport { UserDismissed } from '../patterns/dialog/types';\nimport { styles } from './styles';\nimport { template } from './template';\n\nexport { UserDismissed };\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-dialog': Dialog;\n }\n}\n\n/**\n * A nimble-styled dialog.\n */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport class Dialog<CloseReason = void> extends FoundationElement {\n // We want the member to match the name of the constant\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public static readonly UserDismissed = UserDismissed;\n\n /**\n * @public\n * @description\n * Prevents dismissing the dialog via the Escape key\n */\n @attr({ attribute: 'prevent-dismiss', mode: 'boolean' })\n public preventDismiss = false;\n\n /**\n * @public\n * @description\n * Hides the header of the dialog.\n */\n @attr({ attribute: 'header-hidden', mode: 'boolean' })\n public headerHidden = false;\n\n /**\n * @public\n * @description\n * Hides the footer of the dialog.\n */\n @attr({ attribute: 'footer-hidden', mode: 'boolean' })\n public footerHidden = false;\n\n /**\n * The ref to the internal dialog element.\n *\n * @internal\n */\n public readonly dialogElement!: HTMLDialogElement;\n\n /** @internal */\n @observable\n public footerIsEmpty = true;\n\n /** @internal */\n @observable\n public readonly slottedFooterElements?: HTMLElement[];\n\n /**\n * True if the dialog is open/showing, false otherwise\n */\n public get open(): boolean {\n return this.resolveShow !== undefined;\n }\n\n private resolveShow?: (reason: CloseReason | UserDismissed) => void;\n\n /**\n * Opens the dialog\n * @returns Promise that is resolved when the dialog is closed. The value of the resolved Promise is the reason value passed to the close() method, or UserDismissed if the dialog was closed via the ESC key.\n */\n public async show(): Promise<CloseReason | UserDismissed> {\n if (this.open) {\n throw new Error('Dialog is already open');\n }\n this.dialogElement.showModal();\n return new Promise((resolve, _reject) => {\n this.resolveShow = resolve;\n });\n }\n\n /**\n * Closes the dialog\n * @param reason An optional value indicating how/why the dialog was closed.\n */\n public close(reason: CloseReason): void {\n if (!this.open) {\n throw new Error('Dialog is not open');\n }\n this.dialogElement.close();\n this.doResolveShow(reason);\n }\n\n public slottedFooterElementsChanged(\n _prev: HTMLElement[] | undefined,\n next: HTMLElement[] | undefined\n ): void {\n this.footerIsEmpty = !next?.length;\n }\n\n /**\n * @internal\n */\n public cancelHandler(event: Event): boolean {\n if (this.preventDismiss) {\n event.preventDefault();\n } else {\n this.doResolveShow(UserDismissed);\n }\n return true;\n }\n\n /**\n * @internal\n */\n public closeHandler(event: Event): void {\n if (event.target !== this.dialogElement) {\n return;\n }\n if (this.resolveShow) {\n // If\n // - the browser implements dialogs with the CloseWatcher API, and\n // - the user presses ESC without first interacting with the dialog (e.g. clicking, scrolling),\n // the cancel event is not fired, but the close event still is, and the dialog just closes.\n this.doResolveShow(UserDismissed);\n }\n }\n\n private doResolveShow(reason: CloseReason | UserDismissed): void {\n if (!this.resolveShow) {\n throw new Error(\n 'Do not call doResolveShow unless there is a promise to resolve'\n );\n }\n this.resolveShow(reason);\n this.resolveShow = undefined;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Dialog extends ARIAGlobalStatesAndProperties {}\napplyMixins(Dialog, ARIAGlobalStatesAndProperties);\n\nconst nimbleDialog = Dialog.compose({\n baseName: 'dialog',\n template,\n styles,\n baseClass: Dialog\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDialog());\nexport const dialogTag = 'nimble-dialog';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drawer/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EACH,WAAW,EACX,6BAA6B,EAC7B,YAAY,EACZ,iBAAiB,EACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,aAAa,EAAE,CAAC;AAQzB;;;GAGG;AACH,mEAAmE;AACnE,MAAM,OAAO,MAA2B,SAAQ,iBAAiB;IAAjE;;QAMW,aAAQ,GAAmB,cAAc,CAAC,KAAK,CAAC;QAGhD,mBAAc,GAAG,KAAK,CAAC;QAGtB,YAAO,GAAG,KAAK,CAAC;QAkFP,gCAA2B,GAAG,GAAS,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;IA4C1F,CAAC;IAzHG;;OAEG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,IAAI;QACb,IAAI,IAAI,CAAC,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drawer/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EACH,WAAW,EACX,6BAA6B,EAC7B,YAAY,EACZ,iBAAiB,EACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACz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AAG,CAAC,SAAS,CAAC,CAAC;QACzC,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,gBAAgB,CACxB,iBAAiB,EACjB,IAAI,CAAC,2BAA2B,CACnC,CAAC;IACN,CAAC;IAEO,mBAAmB;QACvB,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAC3B,iBAAiB,EACjB,IAAI,CAAC,2BAA2B,CACnC,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC1C,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACxC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;YACrB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACzC,CAAC;IACL,CAAC;;AAxID,uDAAuD;AACvD,gEAAgE;AACzC,oBAAa,GAAG,aAAa,AAAhB,CAAiB;AAG9C;IADN,IAAI;wCACkD;AAGhD;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;8CAC1B;AAqIlC,WAAW,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC;IAChC,QAAQ,EAAE,QAAQ;IAClB,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AACH,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":["import { attr } from '@microsoft/fast-element';\nimport {\n applyMixins,\n ARIAGlobalStatesAndProperties,\n DesignSystem,\n FoundationElement\n} from '@microsoft/fast-foundation';\nimport { eventAnimationEnd } from '@microsoft/fast-web-utilities';\nimport { UserDismissed } from '../patterns/dialog/types';\nimport { styles } from './styles';\nimport { template } from './template';\nimport { DrawerLocation } from './types';\n\nexport { UserDismissed };\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-drawer': Drawer;\n }\n}\n\n/**\n * Drawer control. Shows content in a panel on the left / right side of the screen,\n * which animates to be visible with a slide-in / slide-out animation.\n */\n// eslint-disable-next-line @typescript-eslint/no-invalid-void-type\nexport class Drawer<CloseReason = void> extends FoundationElement {\n // We want the member to match the name of the constant\n // eslint-disable-next-line @typescript-eslint/naming-convention\n public static readonly UserDismissed = UserDismissed;\n\n @attr\n public location: DrawerLocation = DrawerLocation.right;\n\n @attr({ attribute: 'prevent-dismiss', mode: 'boolean' })\n public preventDismiss = false;\n\n public dialog!: HTMLDialogElement;\n private closing = false;\n\n private resolveShow?: (reason: CloseReason | UserDismissed) => void;\n private closeReason!: CloseReason | UserDismissed;\n\n /**\n * True if the drawer is open, opening, or closing. Otherwise, false.\n */\n public get open(): boolean {\n return this.resolveShow !== undefined;\n }\n\n /**\n * Opens the drawer\n * @returns Promise that is resolved when the drawer finishes closing. The value of the resolved\n * Promise is the reason value passed to the close() method, or UserDismissed if the drawer was\n * closed via the ESC key.\n */\n public async show(): Promise<CloseReason | UserDismissed> {\n if (this.open) {\n throw new Error('Drawer is already open');\n }\n this.openDialog();\n return new Promise((resolve, _reject) => {\n this.resolveShow = resolve;\n });\n }\n\n /**\n * Closes the drawer\n * @param reason An optional value indicating how/why the drawer was closed.\n */\n public close(reason: CloseReason): void {\n if (!this.open || this.closing) {\n throw new Error('Drawer is not open or already closing');\n }\n this.closeReason = reason;\n this.closeDialog();\n }\n\n /**\n * @internal\n */\n public cancelHandler(event: Event): boolean {\n // Allowing the dialog to close itself bypasses the drawer's animation logic, so we\n // should close the drawer ourselves when preventDismiss is false.\n event.preventDefault();\n\n if (!this.preventDismiss) {\n this.closeReason = UserDismissed;\n this.closeDialog();\n }\n return true;\n }\n\n /**\n * @internal\n */\n public closeHandler(event: Event): void {\n if (event.target !== this.dialog) {\n return;\n }\n if (this.resolveShow) {\n // If\n // - the browser implements dialogs with the CloseWatcher API, and\n // - the user presses ESC without first interacting with the drawer (e.g. clicking, scrolling),\n // the cancel event is not fired, but the close event still is, and the drawer just closes.\n // The animation is never started, so there is no animation end listener to clean up.\n this.doResolveShow(UserDismissed);\n }\n }\n\n private doResolveShow(reason: CloseReason | UserDismissed): void {\n if (!this.resolveShow) {\n throw new Error(\n 'Do not call doResolveShow unless there is a promise to resolve'\n );\n }\n this.resolveShow(reason);\n this.resolveShow = undefined;\n }\n\n private readonly animationEndHandlerFunction = (): void => this.animationEndHandler();\n\n private openDialog(): void {\n this.dialog.showModal();\n this.triggerAnimation();\n }\n\n private closeDialog(): void {\n this.closing = true;\n this.triggerAnimation();\n }\n\n private triggerAnimation(): void {\n // Read the offsetHeight of the dialog to trigger a reflow. This guarantees that the browser\n // has processed the 'animating' class being removed before trying to readd it, even if the previous\n // animation has just finished. Otherwise, problems can occur. For example, trying to close the\n // drawer immediately after the opening animation ends does not actually close the drawer.\n // https://github.com/ni/nimble/issues/1994\n void this.dialog.offsetHeight;\n\n this.dialog.classList.add('animating');\n if (this.closing) {\n this.dialog.classList.add('closing');\n }\n\n this.dialog.addEventListener(\n eventAnimationEnd,\n this.animationEndHandlerFunction\n );\n }\n\n private animationEndHandler(): void {\n this.dialog.removeEventListener(\n eventAnimationEnd,\n this.animationEndHandlerFunction\n );\n this.dialog.classList.remove('animating');\n if (this.closing) {\n this.dialog.classList.remove('closing');\n this.dialog.close();\n this.closing = false;\n this.doResolveShow(this.closeReason);\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Drawer extends ARIAGlobalStatesAndProperties {}\napplyMixins(Drawer, ARIAGlobalStatesAndProperties);\n\nconst nimbleDrawer = Drawer.compose({\n baseName: 'drawer',\n template,\n styles\n});\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDrawer());\nexport const drawerTag = 'nimble-drawer';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/label-provider/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAY,UAAU,EAAmB,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAMxD;;GAEG;AACH,MAAM,OAAgB,iBAGlB,SAAQ,iBAAiB;IAH7B;;QAOqB,qBAAgB,GAAa,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAoD/E,CAAC;IAjDmB,iBAAiB;QAC7B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC/B,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAEe,oBAAoB;QAChC,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,IAAI,CAAC,aAAa,EAAE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/label-provider/base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAY,UAAU,EAAmB,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAMxD;;GAEG;AACH,MAAM,OAAgB,iBAGlB,SAAQ,iBAAiB;IAH7B;;QAOqB,qBAAgB,GAAa,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAoD/E,CAAC;IAjDmB,iBAAiB;QAC7B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,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C,IAAI,MAAM,CAAC,OAAO,CAC1C,IAAI,CAAC,eAAe,CACvB,EAAE,CAAC;gBACA,MAAM,KAAK,GAAG,IAAI,CAAC,QAAoD,CAAC,CAAC;gBACzE,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;oBACxC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBAC7C,CAAC;qBAAM,CAAC;oBACJ,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,aAAa,EAAE,KAAe,CAAC,CAAC;gBAC3D,CAAC;YACL,CAAC;QACL,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { DesignToken, FoundationElement } from '@microsoft/fast-foundation';\nimport { Notifier, Observable, type Subscriber } from '@microsoft/fast-element';\nimport { themeProviderTag } from '../../theme-provider';\n\nexport type DesignTokensFor<ObjectT> = {\n [key in keyof ObjectT]: string | undefined;\n};\n\n/**\n * Base class for label providers\n */\nexport abstract class LabelProviderBase<\n SupportedLabels extends { [key: string]: DesignToken<string> }\n>\n extends FoundationElement\n implements Subscriber {\n protected abstract supportedLabels: SupportedLabels;\n\n private readonly propertyNotifier: Notifier = Observable.getNotifier(this);\n private themeProvider?: HTMLElement;\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.initializeThemeProvider();\n this.propertyNotifier.subscribe(this);\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.propertyNotifier.unsubscribe(this);\n if (this.themeProvider) {\n for (const token of Object.values(this.supportedLabels)) {\n token.deleteValueFor(this.themeProvider);\n }\n this.themeProvider = undefined;\n }\n }\n\n public handleChange(\n _element: LabelProviderBase<SupportedLabels>,\n property: keyof LabelProviderBase<SupportedLabels>\n ): void {\n if (this.supportedLabels[property]) {\n const token = this.supportedLabels[property]!;\n const value = this[property];\n if (this.themeProvider) {\n if (value === null || value === undefined) {\n token.deleteValueFor(this.themeProvider);\n } else {\n token.setValueFor(this.themeProvider, value as string);\n }\n }\n }\n }\n\n private initializeThemeProvider(): void {\n this.themeProvider = this.closest(themeProviderTag) ?? undefined;\n if (this.themeProvider) {\n for (const [property, token] of Object.entries(\n this.supportedLabels\n )) {\n const value = this[property as keyof LabelProviderBase<SupportedLabels>];\n if (value === null || value === undefined) {\n token.deleteValueFor(this.themeProvider);\n } else {\n token.setValueFor(this.themeProvider, value as string);\n }\n }\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/list-option/index.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,YAAY,EACZ,aAAa,IAAI,uBAAuB,EAC3C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAStC;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,uBAAuB;IAAvD;;QAII;;;;;;;WAOG;QAEa,WAAM,GAAG,KAAK,CAAC;QAE/B;;;;;;WAMG;QAEI,mBAAc,GAAG,KAAK,CAAC;QAE9B;;;;;;;WAOG;QAEI,iBAAY,GAAG,KAAK,CAAC;QAE5B,gBAAgB;QAET,gBAAW,GAAG,KAAK,CAAC;IAuC/B,CAAC;IArCG,gBAAgB;IAChB,IAAW,kBAAkB;QACzB,OAAO,IAAI,CAAC,WAAW;aAClB,aAAa,EAAE;aACf,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;aACrC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IAEe,iBAAiB;QAC7B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxC,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC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ACjC,OAAO,MAAM,CAAC;YAClB,CAAC;YAED,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC;QAClC,CAAC;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;IAEO,iBAAiB,CACrB,MAA0B;QAE1B,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,OAAQ,MAA0B,CAAC,cAAc,KAAK,UAAU,CAAC;IAC5E,CAAC;CACJ;AAhEmB;IADf,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;0CACK;AAUxB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;kDAC1B;AAWvB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;gDAC1B;AAIrB;IADN,UAAU;+CACgB;AAyC/B,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAC;IACxC,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,uBAAuB;IAClC,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC","sourcesContent":["import {\n DesignSystem,\n ListboxOption as FoundationListboxOption\n} from '@microsoft/fast-foundation';\nimport { observable, attr } from '@microsoft/fast-element';\nimport { styles } from './styles';\nimport { template } from './template';\nimport type { ListOptionOwner } from '../patterns/dropdown/types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-list-option': ListOption;\n }\n}\n\n/**\n * A nimble-styled HTML listbox option\n */\nexport class ListOption extends FoundationListboxOption {\n /** @internal */\n public contentSlot!: HTMLSlotElement;\n\n /**\n * The hidden state of the element.\n *\n * @public\n * @defaultValue - false\n * @remarks\n * HTML Attribute: hidden\n */\n @attr({ mode: 'boolean' })\n public override hidden = false;\n\n /**\n * @internal\n * This attribute is required to allow use-cases that offer dynamic filtering\n * (like the Select) to visually hide options that are filtered out, but still\n * allow users to use the native 'hidden' attribute without it being affected\n * by the filtering process.\n */\n @attr({ attribute: 'visually-hidden', mode: 'boolean' })\n public visuallyHidden = false;\n\n /**\n * @internal\n * This attribute is used to control the visual selected state of an option. This\n * is handled independently of the public 'selected' attribute, as 'selected' is\n * representative of the current value of the container control. However, while\n * a dropdown is open users can navigate through the options (requiring visual\n * updates) without changing the value of the container control.\n */\n @attr({ attribute: 'active-option', mode: 'boolean' })\n public activeOption = false;\n\n /** @internal */\n @observable\n public hasOverflow = false;\n\n /** @internal */\n public get elementTextContent(): string {\n return this.contentSlot\n .assignedNodes()\n .map(node => node.textContent?.trim())\n .join(' ');\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n const owner = this.getListOptionOwner();\n owner?.registerOption(this);\n }\n\n private getListOptionOwner(): ListOptionOwner | undefined {\n let parent = this.parentElement;\n\n while (parent) {\n if (this.isListOptionOwner(parent)) {\n return parent;\n }\n\n parent = parent.parentElement;\n }\n\n return undefined;\n }\n\n private isListOptionOwner(\n parent: HTMLElement | null\n ): parent is ListOptionOwner {\n if (!parent) {\n return false;\n }\n\n return typeof (parent as ListOptionOwner).registerOption === 'function';\n }\n}\n\nconst nimbleListOption = ListOption.compose({\n baseName: 'list-option',\n baseClass: FoundationListboxOption,\n template,\n styles\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleListOption());\nexport const listOptionTag = 'nimble-list-option';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/list-option-group/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EACH,UAAU,EACV,IAAI,EACJ,QAAQ,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SAAS,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;uDAC1B;AAMvB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;4DAC3B;AAM5B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,0BAA0B,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;+DAC3B;AAI/B;IADN,UAAU;oDACgB;AAOpB;IADN,UAAU;oDACuB;AAIlC;IADC,QAAQ;mDAeR;AAsDL,MAAM,qBAAqB,GAAG,eAAe,CAAC,OAAO,CAAC;IAClD,QAAQ,EAAE,mBAAmB;IAC7B,SAAS,EAAE,iBAAiB;IAC5B,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,QAAQ,CAAC;KACpB,QAAQ,CAAC,qBAAqB,EAAE,CAAC,CAAC;AACvC,MAAM,CAAC,MAAM,kBAAkB,GAAG,0BAA0B,CAAC","sourcesContent":["import { DesignSystem, FoundationElement } from '@microsoft/fast-foundation';\nimport {\n observable,\n attr,\n volatile,\n Observable\n} from '@microsoft/fast-element';\nimport { styles } from './styles';\nimport { template } from './template';\nimport { ListOption } from '../list-option';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-list-option-group': ListOptionGroup;\n }\n}\n\n/**\n * A nimble-styled HTML listbox option group\n */\nexport class ListOptionGroup extends FoundationElement {\n /**\n * The label for the group.\n *\n * @public\n * @remarks\n * If a label is also provided via slotted content, the label attribute\n * will have precedence.\n */\n @attr\n public label?: string;\n\n /**\n * The hidden state of the element.\n *\n * @public\n * @defaultValue - false\n * @remarks\n * HTML Attribute: hidden\n */\n @attr({ mode: 'boolean' })\n public override hidden = false;\n\n /**\n * @internal\n * This attribute is required to allow use-cases that offer dynamic filtering\n * (like the Select) to visually hide groups that are filtered out, but still\n * allow users to use the native 'hidden' attribute without it being affected\n * by the filtering process.\n */\n @attr({ attribute: 'visually-hidden', mode: 'boolean' })\n public visuallyHidden = false;\n\n /**\n * @internal\n */\n @attr({ attribute: 'top-separator-visible', mode: 'boolean' })\n public topSeparatorVisible = false;\n\n /**\n * @internal\n */\n @attr({ attribute: 'bottom-separator-visible', mode: 'boolean' })\n public bottomSeparatorVisible = false;\n\n /** @internal */\n @observable\n public hasOverflow = false;\n\n /** @internal */\n public labelSlot!: HTMLSlotElement;\n\n /** @internal */\n @observable\n public listOptions!: ListOption[];\n\n /** @internal */\n @volatile\n public get labelContent(): string {\n if (this.label) {\n return this.label;\n }\n\n if (!this.$fastController.isConnected) {\n return '';\n }\n\n const nodes = this.labelSlot.assignedNodes();\n return nodes\n .filter(node => node.textContent?.trim() !== '')\n .map(node => node.textContent?.trim())\n .join(' ');\n }\n\n private readonly hiddenOptions: Set<ListOption> = new Set();\n\n /**\n * @internal\n */\n public clickHandler(e: MouseEvent): void {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n /**\n * @internal\n */\n public handleChange(source: unknown, propertyName: string): void {\n if (\n source instanceof ListOption\n && (propertyName === 'hidden' || propertyName === 'visuallyHidden')\n ) {\n if (source.hidden || source.visuallyHidden) {\n this.hiddenOptions.add(source);\n } else {\n this.hiddenOptions.delete(source);\n }\n\n this.visuallyHidden = this.hiddenOptions.size === this.listOptions.length;\n }\n }\n\n private listOptionsChanged(\n prev: ListOption[] | undefined,\n next: ListOption[]\n ): void {\n this.hiddenOptions.clear();\n next.filter(o => o.hidden || o.visuallyHidden).forEach(o => this.hiddenOptions.add(o));\n prev?.forEach(o => {\n const notifier = Observable.getNotifier(o);\n notifier.unsubscribe(this, 'hidden');\n notifier.unsubscribe(this, 'visuallyHidden');\n });\n\n let allOptionsHidden = true;\n next?.forEach(o => {\n const notifier = Observable.getNotifier(o);\n notifier.subscribe(this, 'hidden');\n notifier.subscribe(this, 'visuallyHidden');\n allOptionsHidden = allOptionsHidden && (o.hidden || o.visuallyHidden);\n });\n\n this.visuallyHidden = next.length === 0 || allOptionsHidden;\n }\n}\n\nconst nimbleListOptionGroup = ListOptionGroup.compose({\n baseName: 'list-option-group',\n baseClass: FoundationElement,\n template,\n styles\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('nimble')\n .register(nimbleListOptionGroup());\nexport const listOptionGroupTag = 'nimble-list-option-group';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mapping/icon/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAQxC,SAAS,WAAW,CAAC,YAAsC;IACvD,OAAO,YAAY,CAAC,SAAS,YAAY,IAAI,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,OAAmB;IAApD;;QAWW,eAAU,GAAG,KAAK,CAAC;IA+C9B,CAAC;IArCG,gFAAgF;IACxE,KAAK,CAAC,gBAAgB,CAAC,IAAY;QACvC,IAAI;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/mapping/icon/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,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CAAC;QACD,KAAK,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACJ;AAxDU;IADN,IAAI,EAAE;yCACc;AAGd;IADN,IAAI,EAAE;6CACuB;AAGvB;IADN,IAAI,EAAE;yCACc;AAGd;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;+CAC1B;AAQnB;IADN,UAAU;iDACkB;AAyCjC,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC;IACpC,QAAQ,EAAE,cAAc;IACxB,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AACH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;AACxE,MAAM,CAAC,MAAM,cAAc,GAAG,qBAAqB,CAAC","sourcesContent":["import { attr, observable } from '@microsoft/fast-element';\nimport { DesignSystem } from '@microsoft/fast-foundation';\nimport { Mapping } from '../base';\nimport { template } from '../base/template';\nimport type { IconSeverity } from '../../icon-base/types';\nimport { Icon } from '../../icon-base';\nimport type { MappingKey } from '../base/types';\nimport { styles } from '../base/styles';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-mapping-icon': MappingIcon;\n }\n}\n\nfunction isIconClass(elementClass: CustomElementConstructor): boolean {\n return elementClass.prototype instanceof Icon;\n}\n\n/**\n * Maps a data value to an icon.\n * One or more may be added as children of a nimble-table-column-mapping element to define\n * how specific data values should be displayed as icons in that column's cells.\n */\nexport class MappingIcon extends Mapping<MappingKey> {\n @attr()\n public icon?: string;\n\n @attr()\n public severity: IconSeverity;\n\n @attr()\n public text?: string;\n\n @attr({ attribute: 'text-hidden', mode: 'boolean' })\n public textHidden = false;\n\n /**\n * @internal\n * Calculated asynchronously by the icon mapping based on the configured icon value.\n * When assigned, it corresponds to an element name that is resolved to type of Nimble Icon.\n */\n @observable\n public resolvedIcon?: string;\n\n // Allow icons to be defined asynchronously from when the property is configured\n private async resolveIconAsync(icon: string): Promise<void> {\n try {\n // Clear the current resolution while waiting for async resolution\n this.resolvedIcon = undefined;\n await customElements.whenDefined(icon);\n } catch (ex) {\n // If any error (i.e. invalid custom element name) don't continue\n // Don't update the resolvedIcon as it was already set to undefined before async resolution\n // (in case other async resolutions were started)\n return;\n }\n\n if (icon !== this.icon) {\n // Possible the icon has changed while waiting for async resolution\n // Don't update the resolvedIcon as it was already set to undefined before async resolution\n // (in case other async resolutions were started)\n return;\n }\n\n const elementClass = customElements.get(icon)!;\n this.resolvedIcon = isIconClass(elementClass) ? icon : undefined;\n }\n\n private iconChanged(): void {\n const icon = this.icon;\n if (!icon) {\n this.resolvedIcon = undefined;\n return;\n }\n const elementClass = customElements.get(icon);\n if (elementClass) {\n this.resolvedIcon = isIconClass(elementClass) ? icon : undefined;\n return;\n }\n void this.resolveIconAsync(icon);\n }\n}\n\nconst iconMapping = MappingIcon.compose({\n baseName: 'mapping-icon',\n template,\n styles\n});\nDesignSystem.getOrCreate().withPrefix('nimble').register(iconMapping());\nexport const mappingIconTag = 'nimble-mapping-icon';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/menu-button/index.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,IAAI,EACJ,uBAAuB,EACvB,UAAU,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EACH,WAAW,EACX,YAAY,EACZ,UAAU,EACV,SAAS,EACZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,gBAAgB,EAGhB,kBAAkB,EACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAUtC;;GAEG;AACH,MAAM,OAAO,UAA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AAE,CAAC;4CAClC;AAM3B;IADN,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;wCACN;AAMb;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;4CAC8B;AAI9C;IADf,UAAU;gDACiC;AAI5B;IADf,UAAU;0CAC6B;AAIxB;IADf,UAAU;gDACkC;AAiMjD,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAC;IACxC,QAAQ,EAAE,aAAa;IACvB,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC","sourcesContent":["import {\n attr,\n nullableNumberConverter,\n observable\n} from '@microsoft/fast-element';\nimport { DesignSystem, FoundationElement } from '@microsoft/fast-foundation';\nimport {\n eventChange,\n keyArrowDown,\n keyArrowUp,\n keyEscape\n} from '@microsoft/fast-web-utilities';\nimport {\n ButtonAppearance,\n ButtonAppearanceVariant,\n MenuButtonToggleEventDetail,\n MenuButtonPosition\n} from './types';\nimport type { ToggleButton } from '../toggle-button';\nimport { styles } from './styles';\nimport { template } from './template';\nimport type { ButtonPattern } from '../patterns/button/types';\nimport type { AnchoredRegion } from '../anchored-region';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-menu-button': MenuButton;\n }\n}\n\n/**\n * A nimble-styled menu button control.\n */\nexport class MenuButton extends FoundationElement implements ButtonPattern {\n @attr\n public appearance: ButtonAppearance = ButtonAppearance.outline;\n\n @attr({ attribute: 'appearance-variant' })\n public appearanceVariant: ButtonAppearanceVariant;\n\n @attr({ mode: 'boolean' })\n public disabled = false;\n\n @attr({ attribute: 'content-hidden', mode: 'boolean' })\n public contentHidden = false;\n\n @attr({ attribute: 'tabindex', converter: nullableNumberConverter })\n public override tabIndex!: number;\n\n /**\n * Specifies whether or not the menu is open.\n */\n @attr({ mode: 'boolean' })\n public open = false;\n\n /**\n * Configures where the menu should be placed relative to the button that opens the menu.\n */\n @attr({ attribute: 'position' })\n public position: MenuButtonPosition = MenuButtonPosition.auto;\n\n /** @internal */\n @observable\n public readonly toggleButton?: ToggleButton;\n\n /** @internal */\n @observable\n public readonly region?: AnchoredRegion;\n\n /** @internal */\n @observable\n public readonly slottedMenus?: HTMLElement[];\n\n /**\n * Used to maintain the internal state of whether the last menu item should be focused instead\n * of the first menu item the next time the menu is opened.\n */\n private focusLastItemWhenOpened = false;\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.region) {\n this.region.removeEventListener(\n eventChange,\n this.menuChangeHandler\n );\n }\n }\n\n public toggleButtonChanged(\n _prev: ToggleButton | undefined,\n _next: ToggleButton | undefined\n ): void {\n if (this.region && this.toggleButton) {\n this.region.anchorElement = this.toggleButton;\n }\n }\n\n public regionChanged(\n prev: AnchoredRegion | undefined,\n _next: AnchoredRegion | undefined\n ): void {\n if (prev) {\n prev.removeEventListener(eventChange, this.menuChangeHandler);\n }\n\n if (this.region) {\n if (this.toggleButton) {\n this.region.anchorElement = this.toggleButton;\n }\n this.region.addEventListener(eventChange, this.menuChangeHandler, {\n capture: true\n });\n }\n }\n\n public openChanged(_prev: boolean | undefined, _next: boolean): void {\n if (this.toggleButton) {\n this.toggleButton.checked = this.open;\n }\n\n if (!this.open) {\n // Only fire an event here if the menu is changing to being closed. Otherwise,\n // wait until the menu is actually opened before firing the event.\n const eventDetail: MenuButtonToggleEventDetail = {\n oldState: true,\n newState: false\n };\n this.$emit('toggle', eventDetail);\n }\n }\n\n public regionLoadedHandler(): void {\n if (this.focusLastItemWhenOpened) {\n this.focusLastMenuItem();\n this.focusLastItemWhenOpened = false;\n } else {\n this.focusMenu();\n }\n\n const eventDetail: MenuButtonToggleEventDetail = {\n oldState: false,\n newState: true\n };\n this.$emit('toggle', eventDetail);\n }\n\n public focusoutHandler(e: FocusEvent): boolean {\n if (!this.open) {\n return true;\n }\n\n const focusTarget = e.relatedTarget as HTMLElement;\n if (\n !this.contains(focusTarget)\n && !this.getMenu()?.contains(focusTarget)\n ) {\n this.setOpen(false);\n return false;\n }\n\n return true;\n }\n\n public toggleButtonCheckedChangeHandler(e: Event): boolean {\n this.setOpen(this.toggleButton!.checked);\n // Don't bubble the 'change' event from the toggle button because\n // the menu button has its own 'toggle' event.\n e.stopPropagation();\n return false;\n }\n\n public toggleButtonKeyDownHandler(e: KeyboardEvent): boolean {\n switch (e.key) {\n case keyArrowUp:\n this.focusLastItemWhenOpened = true;\n this.setOpen(true);\n return false;\n case keyArrowDown:\n this.setOpen(true);\n return false;\n default:\n return true;\n }\n }\n\n public menuKeyDownHandler(e: KeyboardEvent): boolean {\n switch (e.key) {\n case keyEscape:\n this.setOpen(false);\n this.toggleButton!.focus();\n return false;\n default:\n return true;\n }\n }\n\n private setOpen(newValue: boolean): void {\n if (this.open === newValue) {\n return;\n }\n\n const eventDetail: MenuButtonToggleEventDetail = {\n oldState: this.open,\n newState: newValue\n };\n this.$emit('beforetoggle', eventDetail);\n\n this.open = newValue;\n }\n\n private getMenu(): HTMLElement | undefined {\n // Get the menu that is slotted within the menu-button, taking into account\n // that it may be nested within multiple 'slot' elements, such as when used\n // within a table.\n if (!this.slottedMenus?.length) {\n return undefined;\n }\n\n let currentItem: HTMLElement | undefined = this.slottedMenus[0];\n while (currentItem) {\n if (currentItem.getAttribute('role') === 'menu') {\n return currentItem;\n }\n\n if (this.isSlotElement(currentItem)) {\n const firstNode = currentItem.assignedNodes()[0];\n if (firstNode instanceof HTMLElement) {\n currentItem = firstNode;\n } else {\n currentItem = undefined;\n }\n } else {\n return undefined;\n }\n }\n\n return undefined;\n }\n\n private isSlotElement(\n element: HTMLElement | undefined\n ): element is HTMLSlotElement {\n return element?.nodeName === 'SLOT';\n }\n\n private focusMenu(): void {\n this.getMenu()?.focus();\n }\n\n private focusLastMenuItem(): void {\n const menuItems = this.getMenu()?.querySelectorAll('[role=menuitem]');\n if (menuItems?.length) {\n const lastMenuItem = menuItems[menuItems.length - 1] as HTMLElement;\n lastMenuItem.focus();\n }\n }\n\n private readonly menuChangeHandler = (): void => {\n this.setOpen(false);\n this.toggleButton!.focus();\n };\n}\n\nconst nimbleMenuButton = MenuButton.compose({\n baseName: 'menu-button',\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n }\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleMenuButton());\nexport const menuButtonTag = 'nimble-menu-button';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/menu-button/index.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,IAAI,EACJ,uBAAuB,EACvB,UAAU,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EACH,WAAW,EACX,YAAY,EACZ,UAAU,EACV,SAAS,EACZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,gBAAgB,EAGhB,kBAAkB,EACrB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAUtC;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAAjD;;QAEW,eAAU,GAAqB,gBAAgB,CAAC,OAAO,CAAC;QAMxD,aAAQ,GAAG,KAAK,CAAC;QAGjB,kBAAa,GAAG,KAAK,CAAC;QAK7B;;WAEG;QAEI,SAAI,GAAG,KAAK,CAAC;QAEpB;;WAEG;QAEI,aAAQ,GAAuB,kBAAkB,CAAC,IAAI,CAAC;QAc9D;;;WAGG;QACK,4BAAuB,GAAG,KAAK,CAAC;QAqLvB,sBAAiB,GAAG,GAAS,EAAE;YAC5C,IAAI,CAA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AAC;wCACN;AAMb;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;4CAC8B;AAI9C;IADf,UAAU;gDACiC;AAI5B;IADf,UAAU;0CAC6B;AAIxB;IADf,UAAU;gDACkC;AAiMjD,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAC;IACxC,QAAQ,EAAE,aAAa;IACvB,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC","sourcesContent":["import {\n attr,\n nullableNumberConverter,\n observable\n} from '@microsoft/fast-element';\nimport { DesignSystem, FoundationElement } from '@microsoft/fast-foundation';\nimport {\n eventChange,\n keyArrowDown,\n keyArrowUp,\n keyEscape\n} from '@microsoft/fast-web-utilities';\nimport {\n ButtonAppearance,\n ButtonAppearanceVariant,\n MenuButtonToggleEventDetail,\n MenuButtonPosition\n} from './types';\nimport type { ToggleButton } from '../toggle-button';\nimport { styles } from './styles';\nimport { template } from './template';\nimport type { ButtonPattern } from '../patterns/button/types';\nimport type { AnchoredRegion } from '../anchored-region';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-menu-button': MenuButton;\n }\n}\n\n/**\n * A nimble-styled menu button control.\n */\nexport class MenuButton extends FoundationElement implements ButtonPattern {\n @attr\n public appearance: ButtonAppearance = ButtonAppearance.outline;\n\n @attr({ attribute: 'appearance-variant' })\n public appearanceVariant: ButtonAppearanceVariant;\n\n @attr({ mode: 'boolean' })\n public disabled = false;\n\n @attr({ attribute: 'content-hidden', mode: 'boolean' })\n public contentHidden = false;\n\n @attr({ attribute: 'tabindex', converter: nullableNumberConverter })\n public override tabIndex!: number;\n\n /**\n * Specifies whether or not the menu is open.\n */\n @attr({ mode: 'boolean' })\n public open = false;\n\n /**\n * Configures where the menu should be placed relative to the button that opens the menu.\n */\n @attr({ attribute: 'position' })\n public position: MenuButtonPosition = MenuButtonPosition.auto;\n\n /** @internal */\n @observable\n public readonly toggleButton?: ToggleButton;\n\n /** @internal */\n @observable\n public readonly region?: AnchoredRegion;\n\n /** @internal */\n @observable\n public readonly slottedMenus?: HTMLElement[];\n\n /**\n * Used to maintain the internal state of whether the last menu item should be focused instead\n * of the first menu item the next time the menu is opened.\n */\n private focusLastItemWhenOpened = false;\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n if (this.region) {\n this.region.removeEventListener(\n eventChange,\n this.menuChangeHandler\n );\n }\n }\n\n public toggleButtonChanged(\n _prev: ToggleButton | undefined,\n _next: ToggleButton | undefined\n ): void {\n if (this.region && this.toggleButton) {\n this.region.anchorElement = this.toggleButton;\n }\n }\n\n public regionChanged(\n prev: AnchoredRegion | undefined,\n _next: AnchoredRegion | undefined\n ): void {\n if (prev) {\n prev.removeEventListener(eventChange, this.menuChangeHandler);\n }\n\n if (this.region) {\n if (this.toggleButton) {\n this.region.anchorElement = this.toggleButton;\n }\n this.region.addEventListener(eventChange, this.menuChangeHandler, {\n capture: true\n });\n }\n }\n\n public openChanged(_prev: boolean | undefined, _next: boolean): void {\n if (this.toggleButton) {\n this.toggleButton.checked = this.open;\n }\n\n if (!this.open) {\n // Only fire an event here if the menu is changing to being closed. Otherwise,\n // wait until the menu is actually opened before firing the event.\n const eventDetail: MenuButtonToggleEventDetail = {\n oldState: true,\n newState: false\n };\n this.$emit('toggle', eventDetail);\n }\n }\n\n public regionLoadedHandler(): void {\n if (this.focusLastItemWhenOpened) {\n this.focusLastMenuItem();\n this.focusLastItemWhenOpened = false;\n } else {\n this.focusMenu();\n }\n\n const eventDetail: MenuButtonToggleEventDetail = {\n oldState: false,\n newState: true\n };\n this.$emit('toggle', eventDetail);\n }\n\n public focusoutHandler(e: FocusEvent): boolean {\n if (!this.open) {\n return true;\n }\n\n const focusTarget = e.relatedTarget as HTMLElement;\n if (\n !this.contains(focusTarget)\n && !this.getMenu()?.contains(focusTarget)\n ) {\n this.setOpen(false);\n return false;\n }\n\n return true;\n }\n\n public toggleButtonCheckedChangeHandler(e: Event): boolean {\n this.setOpen(this.toggleButton!.checked);\n // Don't bubble the 'change' event from the toggle button because\n // the menu button has its own 'toggle' event.\n e.stopPropagation();\n return false;\n }\n\n public toggleButtonKeyDownHandler(e: KeyboardEvent): boolean {\n switch (e.key) {\n case keyArrowUp:\n this.focusLastItemWhenOpened = true;\n this.setOpen(true);\n return false;\n case keyArrowDown:\n this.setOpen(true);\n return false;\n default:\n return true;\n }\n }\n\n public menuKeyDownHandler(e: KeyboardEvent): boolean {\n switch (e.key) {\n case keyEscape:\n this.setOpen(false);\n this.toggleButton!.focus();\n return false;\n default:\n return true;\n }\n }\n\n private setOpen(newValue: boolean): void {\n if (this.open === newValue) {\n return;\n }\n\n const eventDetail: MenuButtonToggleEventDetail = {\n oldState: this.open,\n newState: newValue\n };\n this.$emit('beforetoggle', eventDetail);\n\n this.open = newValue;\n }\n\n private getMenu(): HTMLElement | undefined {\n // Get the menu that is slotted within the menu-button, taking into account\n // that it may be nested within multiple 'slot' elements, such as when used\n // within a table.\n if (!this.slottedMenus?.length) {\n return undefined;\n }\n\n let currentItem: HTMLElement | undefined = this.slottedMenus[0];\n while (currentItem) {\n if (currentItem.getAttribute('role') === 'menu') {\n return currentItem;\n }\n\n if (this.isSlotElement(currentItem)) {\n const firstNode = currentItem.assignedNodes()[0];\n if (firstNode instanceof HTMLElement) {\n currentItem = firstNode;\n } else {\n currentItem = undefined;\n }\n } else {\n return undefined;\n }\n }\n\n return undefined;\n }\n\n private isSlotElement(\n element: HTMLElement | undefined\n ): element is HTMLSlotElement {\n return element?.nodeName === 'SLOT';\n }\n\n private focusMenu(): void {\n this.getMenu()?.focus();\n }\n\n private focusLastMenuItem(): void {\n const menuItems = this.getMenu()?.querySelectorAll('[role=menuitem]');\n if (menuItems?.length) {\n const lastMenuItem = menuItems[menuItems.length - 1] as HTMLElement;\n lastMenuItem.focus();\n }\n }\n\n private readonly menuChangeHandler = (): void => {\n this.setOpen(false);\n this.toggleButton!.focus();\n };\n}\n\nconst nimbleMenuButton = MenuButton.compose({\n baseName: 'menu-button',\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n }\n});\n\nDesignSystem.getOrCreate().withPrefix('nimble').register(nimbleMenuButton());\nexport const menuButtonTag = 'nimble-menu-button';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-button.pageobject.js","sourceRoot":"","sources":["../../../../src/menu-button/testing/menu-button.pageobject.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACX,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,OAAO,oBAAoB;IAC7B,YAAsC,iBAA6B;QAA7B,sBAAiB,GAAjB,iBAAiB,CAAY;IAAG,CAAC;IAEvE;;OAEG;IACI,MAAM;QACT,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC;IACvC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,QAAQ;QACjB,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"menu-button.pageobject.js","sourceRoot":"","sources":["../../../../src/menu-button/testing/menu-button.pageobject.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACX,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE;;;;;;GAMG;AACH,MAAM,OAAO,oBAAoB;IAC7B,YAAsC,iBAA6B;QAA7B,sBAAiB,GAAjB,iBAAiB,CAAY;IAA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n keyEnter,\n keyEscape,\n keySpace\n} from '@microsoft/fast-web-utilities';\nimport type { MenuButton } from '..';\nimport { waitForEventAsync } from '../../utilities/testing/component';\n\n/**\n * Page object for `nimble-menu-button` component to provide consistent ways\n * of querying and interacting with the component during tests.\n *\n * This page object is intended to be used to interact with a `nimble-menu-button`,\n * not the menu slotted into the button or the menu items.\n */\nexport class MenuButtonPageObject {\n public constructor(protected readonly menuButtonElement: MenuButton) {}\n\n /**\n * @returns Whether or not the menu is open.\n */\n public isOpen(): boolean {\n return this.menuButtonElement.open;\n }\n\n /**\n * Opens the menu.\n * @returns A promise that resolves when the menu opens.\n */\n public async openMenu(): Promise<void> {\n if (this.isOpen()) {\n return;\n }\n\n const toggleEventPromise = waitForEventAsync(\n this.menuButtonElement,\n 'toggle'\n );\n this.clickMenuButton();\n await toggleEventPromise;\n }\n\n /**\n * Closes the menu by pressing Escape.\n * Throws an error if the menu is not open.\n */\n public closeMenuWithEscape(): void {\n if (!this.isOpen()) {\n throw new Error('Cannot close menu when it is not open');\n }\n\n const event = new KeyboardEvent('keydown', {\n key: keyEscape\n });\n this.menuButtonElement.region!.dispatchEvent(event);\n }\n\n /**\n * Gets the text in the menu button.\n * @returns The trimmed text that is slotted into the menu button.\n */\n public getLabelText(): string {\n return this.menuButtonElement.textContent?.trim() ?? '';\n }\n\n /**\n * @returns Whether or not the menu button is focused.\n */\n public isFocused(): boolean {\n return this.menuButtonElement.shadowRoot?.activeElement !== null;\n }\n\n /**\n * @internal\n * Focuses and clicks the menu button.\n */\n public clickMenuButton(): void {\n // Focus the menu button before calling click() because ordinarily a mouse click\n // would bring focus to the button, but calling click() directly does not.\n this.menuButtonElement.focus();\n this.menuButtonElement.toggleButton!.control.click();\n }\n\n /**\n * @internal\n * Presses the Enter key on the menu button.\n */\n public pressEnterKey(): void {\n // Focus the menu button before dispatching the event because a key event only makes sense on a focused element.\n this.menuButtonElement.focus();\n const event = new KeyboardEvent('keypress', {\n key: keyEnter\n });\n this.menuButtonElement.toggleButton!.control.dispatchEvent(event);\n }\n\n /**\n * @internal\n * Presses the Space key on the menu button.\n */\n public pressSpaceKey(): void {\n // Focus the menu button before dispatching the event because a key event only makes sense on a focused element.\n this.menuButtonElement.focus();\n const event = new KeyboardEvent('keypress', {\n key: keySpace\n });\n this.menuButtonElement.toggleButton!.control.dispatchEvent(event);\n }\n\n /**\n * @internal\n * Presses the Arrow Up key on the menu button.\n */\n public pressArrowUpKey(): void {\n // Focus the menu button before dispatching the event because a key event only makes sense on a focused element.\n this.menuButtonElement.focus();\n const event = new KeyboardEvent('keydown', {\n key: keyArrowUp\n });\n this.menuButtonElement.toggleButton!.dispatchEvent(event);\n }\n\n /**\n * @internal\n * Presses the Arrow Down key on the menu button.\n */\n public pressArrowDownKey(): void {\n // Focus the menu button before dispatching the event because a key event only makes sense on a focused element.\n this.menuButtonElement.focus();\n const event = new KeyboardEvent('keydown', {\n key: keyArrowDown\n });\n this.menuButtonElement.toggleButton!.dispatchEvent(event);\n }\n\n /**\n * @internal\n */\n public getTitle(): string {\n return this.menuButtonElement.title;\n }\n\n /**\n * @internal\n */\n public dispatchEvent(event: Event): void {\n this.menuButtonElement.dispatchEvent(event);\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { White } from '@ni/nimble-tokens/dist/styledictionary/js/tokens';
|
|
3
3
|
import { display } from '../../utilities/style/display';
|
|
4
|
-
import { applicationBackgroundColor, bodyFont, bodyFontColor, bodyDisabledFontColor, borderHoverColor, borderWidth, controlHeight, iconSize, menuMinWidth, popupBorderColor, smallDelay, smallPadding, borderRgbPartialColor, mediumPadding, failColor, elevation2BoxShadow } from '../../theme-provider/design-tokens';
|
|
4
|
+
import { applicationBackgroundColor, bodyFont, bodyFontColor, bodyDisabledFontColor, borderHoverColor, borderWidth, controlHeight, iconSize, menuMinWidth, popupBorderColor, smallDelay, smallPadding, borderRgbPartialColor, mediumPadding, failColor, elevation2BoxShadow, placeholderFontColor } from '../../theme-provider/design-tokens';
|
|
5
5
|
import { Theme } from '../../theme-provider/types';
|
|
6
6
|
import { appearanceBehavior } from '../../utilities/style/appearance';
|
|
7
7
|
import { hexToRgbaCssColor } from '../../utilities/style/colors';
|
|
@@ -85,10 +85,6 @@ export const styles = css `
|
|
|
85
85
|
width: 0px;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
[part='start'] {
|
|
89
|
-
display: none;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
88
|
.control {
|
|
93
89
|
align-items: center;
|
|
94
90
|
cursor: pointer;
|
|
@@ -116,10 +112,59 @@ export const styles = css `
|
|
|
116
112
|
border-bottom-color: ${failColor};
|
|
117
113
|
}
|
|
118
114
|
|
|
115
|
+
[part='start'] {
|
|
116
|
+
display: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.selected-value {
|
|
120
|
+
flex: auto;
|
|
121
|
+
font-family: inherit;
|
|
122
|
+
text-align: start;
|
|
123
|
+
white-space: nowrap;
|
|
124
|
+
text-overflow: ellipsis;
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
padding: 0px;
|
|
127
|
+
padding-left: ${mediumPadding};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.selected-value[disabled]::placeholder {
|
|
131
|
+
color: ${bodyDisabledFontColor};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.indicator {
|
|
135
|
+
flex: none;
|
|
136
|
+
margin-left: ${smallPadding};
|
|
137
|
+
padding-right: 8px;
|
|
138
|
+
display: flex;
|
|
139
|
+
justify-content: center;
|
|
140
|
+
align-items: center;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.indicator slot[name='indicator'] svg {
|
|
144
|
+
width: ${iconSize};
|
|
145
|
+
height: ${iconSize};
|
|
146
|
+
fill: ${bodyFontColor};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:host([disabled]) .indicator slot[name='indicator'] svg {
|
|
150
|
+
fill: ${bodyDisabledFontColor};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
[part='end'] {
|
|
154
|
+
margin-inline-start: auto;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
:host([open][position='above']) .anchored-region {
|
|
158
|
+
padding-bottom: ${smallPadding};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:host([open][position='below']) .anchored-region {
|
|
162
|
+
padding-top: ${smallPadding};
|
|
163
|
+
}
|
|
164
|
+
|
|
119
165
|
.listbox {
|
|
120
166
|
display: inline-flex;
|
|
121
167
|
flex-direction: column;
|
|
122
|
-
overflow-y: auto;
|
|
123
168
|
width: 100%;
|
|
124
169
|
--ni-private-listbox-visible-option-count: 10.5;
|
|
125
170
|
--ni-private-listbox-anchor-element-gap: ${smallPadding};
|
|
@@ -153,12 +198,6 @@ export const styles = css `
|
|
|
153
198
|
--ni-private-listbox-loading-indicator-height: ${controlHeight};
|
|
154
199
|
}
|
|
155
200
|
|
|
156
|
-
.listbox slot {
|
|
157
|
-
display: block;
|
|
158
|
-
background: transparent;
|
|
159
|
-
padding: var(--ni-private-listbox-padding);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
201
|
:host([open][position='above']) .listbox {
|
|
163
202
|
border-bottom-left-radius: 0;
|
|
164
203
|
border-bottom-right-radius: 0;
|
|
@@ -169,55 +208,33 @@ export const styles = css `
|
|
|
169
208
|
border-top-right-radius: 0;
|
|
170
209
|
}
|
|
171
210
|
|
|
172
|
-
|
|
173
|
-
|
|
211
|
+
.scrollable-region {
|
|
212
|
+
overflow-y: auto;
|
|
174
213
|
}
|
|
175
214
|
|
|
176
|
-
|
|
177
|
-
|
|
215
|
+
.listbox slot {
|
|
216
|
+
display: block;
|
|
217
|
+
background: transparent;
|
|
218
|
+
padding: var(--ni-private-listbox-padding);
|
|
178
219
|
}
|
|
179
220
|
|
|
180
|
-
.
|
|
181
|
-
|
|
182
|
-
font-family: inherit;
|
|
183
|
-
text-align: start;
|
|
184
|
-
white-space: nowrap;
|
|
185
|
-
text-overflow: ellipsis;
|
|
186
|
-
overflow: hidden;
|
|
187
|
-
padding: 0px;
|
|
188
|
-
padding-left: ${mediumPadding};
|
|
221
|
+
.listbox.empty slot {
|
|
222
|
+
display: none;
|
|
189
223
|
}
|
|
190
224
|
|
|
191
|
-
|
|
192
|
-
|
|
225
|
+
::slotted([role='option']),
|
|
226
|
+
::slotted(option) {
|
|
227
|
+
flex: none;
|
|
193
228
|
}
|
|
194
229
|
|
|
195
|
-
.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
230
|
+
.no-results-label {
|
|
231
|
+
color: ${placeholderFontColor};
|
|
232
|
+
height: ${controlHeight};
|
|
233
|
+
display: inline-flex;
|
|
199
234
|
display: flex;
|
|
200
|
-
|
|
235
|
+
flex: 1 0 auto;
|
|
201
236
|
align-items: center;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
.indicator slot[name='indicator'] svg {
|
|
205
|
-
width: ${iconSize};
|
|
206
|
-
height: ${iconSize};
|
|
207
|
-
fill: ${bodyFontColor};
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
:host([disabled]) .indicator slot[name='indicator'] svg {
|
|
211
|
-
fill: ${bodyDisabledFontColor};
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
[part='end'] {
|
|
215
|
-
margin-inline-start: auto;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
::slotted([role='option']),
|
|
219
|
-
::slotted(option) {
|
|
220
|
-
flex: none;
|
|
237
|
+
padding: ${smallPadding} ${mediumPadding};
|
|
221
238
|
}
|
|
222
239
|
`.withBehaviors(appearanceBehavior(DropdownAppearance.underline, css `
|
|
223
240
|
.control {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/patterns/dropdown/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE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B,WAAW;;kBAEf,aAAa;;;;;;;;;sBAST,mBAAmB;kBACvB,WAAW,UAAU,gBAAgB;4BAC3B,0BAA0B;;;;8CAIR,aAAa;;;;yDAIF,aAAa;;;;;;;;;;;;;;;;;;;;0BAoB5C,YAAY;;;;uBAIf,YAAY;;;;;;;;;;;wBAWX,aAAa;;;;iBAIpB,qBAAqB;;;;;uBAKf,YAAY;;;;;;;;iBAQlB,QAAQ;kBACP,QAAQ;gBACV,aAAa;;;;gBAIb,qBAAqB;;;;;;;;;;;CAWpC,CAAC,aAAa,CACX,kBAAkB,CACd,kBAAkB,CAAC,SAAS,EAC5B,GAAG,CAAA;;uCAE4B,WAAW;;;;;qCAKb,qBAAqB;;SAEjD,CACJ,EACD,kBAAkB,CACd,kBAAkB,CAAC,OAAO,EAC1B,GAAG,CAAA;;gCAEqB,WAAW;;;SAGlC,CACJ,EACD,kBAAkB,CACd,kBAAkB,CAAC,KAAK,EACxB,GAAG,CAAA;;yCAE8B,qBAAqB;;;;uCAIvB,WAAW;;;;;yCAKT,qBAAqB;;SAErD,CACJ,EACD,aAAa,CACT,KAAK,CAAC,KAAK,EACX,GAAG,CAAA;;8BAEmB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC;;SAEnD,CACJ,CACJ,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { White } from '@ni/nimble-tokens/dist/styledictionary/js/tokens';\nimport { display } from '../../utilities/style/display';\nimport {\n applicationBackgroundColor,\n bodyFont,\n bodyFontColor,\n bodyDisabledFontColor,\n borderHoverColor,\n borderWidth,\n controlHeight,\n iconSize,\n menuMinWidth,\n popupBorderColor,\n smallDelay,\n smallPadding,\n borderRgbPartialColor,\n mediumPadding,\n failColor,\n elevation2BoxShadow\n} from '../../theme-provider/design-tokens';\nimport { Theme } from '../../theme-provider/types';\nimport { appearanceBehavior } from '../../utilities/style/appearance';\nimport { hexToRgbaCssColor } from '../../utilities/style/colors';\nimport { focusVisible } from '../../utilities/style/focus';\nimport { themeBehavior } from '../../utilities/style/theme';\nimport { DropdownAppearance } from './types';\nimport { userSelectNone } from '../../utilities/style/user-select';\n\n// prettier-ignore\nexport const styles = css`\n ${display('inline-flex')}\n\n :host {\n color: ${bodyFontColor};\n font: ${bodyFont};\n height: ${controlHeight};\n position: relative;\n justify-content: center;\n ${userSelectNone}\n min-width: ${menuMinWidth};\n outline: none;\n vertical-align: top;\n --ni-private-hover-indicator-width: calc(${borderWidth} + 1px);\n --ni-private-focus-indicator-width: 1px;\n --ni-private-indicator-lines-gap: 1px;\n }\n\n :host::before {\n content: '';\n position: absolute;\n bottom: calc(${borderWidth} + var(--ni-private-indicator-lines-gap));\n width: 0px;\n height: 0px;\n justify-self: center;\n border-bottom: ${borderHoverColor}\n var(--ni-private-focus-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n @media (prefers-reduced-motion) {\n :host::before {\n transition-duration: 0s;\n }\n }\n\n :host(${focusVisible})::before {\n width: calc(100% - 8px);\n }\n\n :host([error-visible]):before {\n border-bottom-color: ${failColor};\n }\n\n :host::after {\n content: '';\n position: absolute;\n bottom: calc(-1 * ${borderWidth});\n width: 0px;\n height: 0px;\n justify-self: center;\n border-bottom: ${borderHoverColor}\n var(--ni-private-hover-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n @media (prefers-reduced-motion) {\n :host::after {\n transition-duration: 0s;\n }\n }\n\n :host(:hover)::after,\n :host(${focusVisible})::after {\n width: 100%;\n }\n\n :host([error-visible]):after {\n border-bottom-color: ${failColor};\n }\n\n :host([disabled]:hover)::after {\n width: 0px;\n }\n\n [part='start'] {\n display: none;\n }\n\n .control {\n align-items: center;\n cursor: pointer;\n display: flex;\n min-height: 100%;\n width: 100%;\n border: 0px solid rgba(${borderRgbPartialColor}, 0.3);\n background-color: transparent;\n padding: ${borderWidth};\n }\n\n :host([open]:not(:hover)) .control {\n border-bottom-color: ${borderHoverColor};\n }\n\n :host([disabled]) .control {\n cursor: default;\n color: ${bodyDisabledFontColor};\n border-color: rgba(${borderRgbPartialColor}, 0.1);\n }\n\n :host([error-visible]) .control,\n :host([error-visible][open]) .control,\n :host([error-visible][disabled]) .control {\n border-bottom-color: ${failColor};\n }\n\n .listbox {\n display: inline-flex;\n flex-direction: column;\n overflow-y: auto;\n width: 100%;\n --ni-private-listbox-visible-option-count: 10.5;\n --ni-private-listbox-anchor-element-gap: ${smallPadding};\n --ni-private-listbox-padding: ${smallPadding};\n --ni-private-listbox-filter-height: 0px;\n --ni-private-listbox-loading-indicator-height: 0px;\n max-height: min(\n calc(\n var(--ni-private-listbox-anchor-element-gap) + \n 2 * ${borderWidth} + \n var(--ni-private-listbox-padding) +\n ${controlHeight} * var(--ni-private-listbox-visible-option-count) +\n var(--ni-private-listbox-filter-height) +\n var(--ni-private-listbox-loading-indicator-height)\n ),\n calc(\n var(--ni-private-listbox-available-viewport-height) - \n var(--ni-private-listbox-anchor-element-gap)\n )\n );\n box-shadow: ${elevation2BoxShadow};\n border: ${borderWidth} solid ${popupBorderColor};\n background-color: ${applicationBackgroundColor};\n }\n\n .listbox:has(.filter-field) {\n --ni-private-listbox-filter-height: ${controlHeight};\n }\n\n .listbox:has(.loading-container) {\n --ni-private-listbox-loading-indicator-height: ${controlHeight};\n }\n\n .listbox slot {\n display: block;\n background: transparent;\n padding: var(--ni-private-listbox-padding);\n }\n\n :host([open][position='above']) .listbox {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n :host([open][position='below']) .listbox {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n :host([open][position='above']) .anchored-region {\n padding-bottom: ${smallPadding};\n }\n\n :host([open][position='below']) .anchored-region {\n padding-top: ${smallPadding};\n }\n\n .selected-value {\n flex: auto;\n font-family: inherit;\n text-align: start;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n padding: 0px;\n padding-left: ${mediumPadding};\n }\n\n .selected-value[disabled]::placeholder {\n color: ${bodyDisabledFontColor};\n }\n\n .indicator {\n flex: none;\n margin-left: ${smallPadding};\n padding-right: 8px;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .indicator slot[name='indicator'] svg {\n width: ${iconSize};\n height: ${iconSize};\n fill: ${bodyFontColor};\n }\n\n :host([disabled]) .indicator slot[name='indicator'] svg {\n fill: ${bodyDisabledFontColor};\n }\n\n [part='end'] {\n margin-inline-start: auto;\n }\n\n ::slotted([role='option']),\n ::slotted(option) {\n flex: none;\n }\n`.withBehaviors(\n appearanceBehavior(\n DropdownAppearance.underline,\n css`\n .control {\n border-bottom-width: ${borderWidth};\n padding-bottom: 0;\n }\n\n :host([disabled]) .control {\n border-color: rgba(${borderRgbPartialColor}, 0.1);\n }\n `\n ),\n appearanceBehavior(\n DropdownAppearance.outline,\n css`\n .control {\n border-width: ${borderWidth};\n padding: 0;\n }\n `\n ),\n appearanceBehavior(\n DropdownAppearance.block,\n css`\n .control {\n background-color: rgba(${borderRgbPartialColor}, 0.1);\n }\n\n .control:focus-within {\n border-bottom-width: ${borderWidth};\n padding-bottom: 0;\n }\n\n :host([disabled]) .control {\n background-color: rgba(${borderRgbPartialColor}, 0.07);\n }\n `\n ),\n themeBehavior(\n Theme.color,\n css`\n .listbox slot {\n background: ${hexToRgbaCssColor(White, 0.15)};\n }\n `\n )\n);\n"]}
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/patterns/dropdown/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,kDAAkD,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EACH,0BAA0B,EAC1B,QAAQ,EACR,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,aAAa,EAC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B;;;;8CAIR,aAAa;;;;yDAIF,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiCrD,oBAAoB;kBACnB,aAAa;;;;;mBAKZ,YAAY,IAAI,aAAa;;CAE/C,CAAC,aAAa,CACX,kBAAkB,CACd,kBAAkB,CAAC,SAAS,EAC5B,GAAG,CAAA;;uCAE4B,WAAW;;;;;qCAKb,qBAAqB;;SAEjD,CACJ,EACD,kBAAkB,CACd,kBAAkB,CAAC,OAAO,EAC1B,GAAG,CAAA;;gCAEqB,WAAW;;;SAGlC,CACJ,EACD,kBAAkB,CACd,kBAAkB,CAAC,KAAK,EACxB,GAAG,CAAA;;yCAE8B,qBAAqB;;;;uCAIvB,WAAW;;;;;yCAKT,qBAAqB;;SAErD,CACJ,EACD,aAAa,CACT,KAAK,CAAC,KAAK,EACX,GAAG,CAAA;;8BAEmB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC;;SAEnD,CACJ,CACJ,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { White } from '@ni/nimble-tokens/dist/styledictionary/js/tokens';\nimport { display } from '../../utilities/style/display';\nimport {\n applicationBackgroundColor,\n bodyFont,\n bodyFontColor,\n bodyDisabledFontColor,\n borderHoverColor,\n borderWidth,\n controlHeight,\n iconSize,\n menuMinWidth,\n popupBorderColor,\n smallDelay,\n smallPadding,\n borderRgbPartialColor,\n mediumPadding,\n failColor,\n elevation2BoxShadow,\n placeholderFontColor\n} from '../../theme-provider/design-tokens';\nimport { Theme } from '../../theme-provider/types';\nimport { appearanceBehavior } from '../../utilities/style/appearance';\nimport { hexToRgbaCssColor } from '../../utilities/style/colors';\nimport { focusVisible } from '../../utilities/style/focus';\nimport { themeBehavior } from '../../utilities/style/theme';\nimport { DropdownAppearance } from './types';\nimport { userSelectNone } from '../../utilities/style/user-select';\n\n// prettier-ignore\nexport const styles = css`\n ${display('inline-flex')}\n\n :host {\n color: ${bodyFontColor};\n font: ${bodyFont};\n height: ${controlHeight};\n position: relative;\n justify-content: center;\n ${userSelectNone}\n min-width: ${menuMinWidth};\n outline: none;\n vertical-align: top;\n --ni-private-hover-indicator-width: calc(${borderWidth} + 1px);\n --ni-private-focus-indicator-width: 1px;\n --ni-private-indicator-lines-gap: 1px;\n }\n\n :host::before {\n content: '';\n position: absolute;\n bottom: calc(${borderWidth} + var(--ni-private-indicator-lines-gap));\n width: 0px;\n height: 0px;\n justify-self: center;\n border-bottom: ${borderHoverColor}\n var(--ni-private-focus-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n @media (prefers-reduced-motion) {\n :host::before {\n transition-duration: 0s;\n }\n }\n\n :host(${focusVisible})::before {\n width: calc(100% - 8px);\n }\n\n :host([error-visible]):before {\n border-bottom-color: ${failColor};\n }\n\n :host::after {\n content: '';\n position: absolute;\n bottom: calc(-1 * ${borderWidth});\n width: 0px;\n height: 0px;\n justify-self: center;\n border-bottom: ${borderHoverColor}\n var(--ni-private-hover-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n @media (prefers-reduced-motion) {\n :host::after {\n transition-duration: 0s;\n }\n }\n\n :host(:hover)::after,\n :host(${focusVisible})::after {\n width: 100%;\n }\n\n :host([error-visible]):after {\n border-bottom-color: ${failColor};\n }\n\n :host([disabled]:hover)::after {\n width: 0px;\n }\n\n .control {\n align-items: center;\n cursor: pointer;\n display: flex;\n min-height: 100%;\n width: 100%;\n border: 0px solid rgba(${borderRgbPartialColor}, 0.3);\n background-color: transparent;\n padding: ${borderWidth};\n }\n\n :host([open]:not(:hover)) .control {\n border-bottom-color: ${borderHoverColor};\n }\n\n :host([disabled]) .control {\n cursor: default;\n color: ${bodyDisabledFontColor};\n border-color: rgba(${borderRgbPartialColor}, 0.1);\n }\n\n :host([error-visible]) .control,\n :host([error-visible][open]) .control,\n :host([error-visible][disabled]) .control {\n border-bottom-color: ${failColor};\n }\n\n [part='start'] {\n display: none;\n }\n\n .selected-value {\n flex: auto;\n font-family: inherit;\n text-align: start;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n padding: 0px;\n padding-left: ${mediumPadding};\n }\n\n .selected-value[disabled]::placeholder {\n color: ${bodyDisabledFontColor};\n }\n\n .indicator {\n flex: none;\n margin-left: ${smallPadding};\n padding-right: 8px;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .indicator slot[name='indicator'] svg {\n width: ${iconSize};\n height: ${iconSize};\n fill: ${bodyFontColor};\n }\n\n :host([disabled]) .indicator slot[name='indicator'] svg {\n fill: ${bodyDisabledFontColor};\n }\n\n [part='end'] {\n margin-inline-start: auto;\n }\n\n :host([open][position='above']) .anchored-region {\n padding-bottom: ${smallPadding};\n }\n\n :host([open][position='below']) .anchored-region {\n padding-top: ${smallPadding};\n }\n\n .listbox {\n display: inline-flex;\n flex-direction: column;\n width: 100%;\n --ni-private-listbox-visible-option-count: 10.5;\n --ni-private-listbox-anchor-element-gap: ${smallPadding};\n --ni-private-listbox-padding: ${smallPadding};\n --ni-private-listbox-filter-height: 0px;\n --ni-private-listbox-loading-indicator-height: 0px;\n max-height: min(\n calc(\n var(--ni-private-listbox-anchor-element-gap) + \n 2 * ${borderWidth} + \n var(--ni-private-listbox-padding) +\n ${controlHeight} * var(--ni-private-listbox-visible-option-count) +\n var(--ni-private-listbox-filter-height) +\n var(--ni-private-listbox-loading-indicator-height)\n ),\n calc(\n var(--ni-private-listbox-available-viewport-height) - \n var(--ni-private-listbox-anchor-element-gap)\n )\n );\n box-shadow: ${elevation2BoxShadow};\n border: ${borderWidth} solid ${popupBorderColor};\n background-color: ${applicationBackgroundColor};\n }\n\n .listbox:has(.filter-field) {\n --ni-private-listbox-filter-height: ${controlHeight};\n }\n\n .listbox:has(.loading-container) {\n --ni-private-listbox-loading-indicator-height: ${controlHeight};\n }\n\n :host([open][position='above']) .listbox {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n :host([open][position='below']) .listbox {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n .scrollable-region {\n overflow-y: auto;\n }\n\n .listbox slot {\n display: block;\n background: transparent;\n padding: var(--ni-private-listbox-padding);\n }\n\n .listbox.empty slot {\n display: none;\n }\n\n ::slotted([role='option']),\n ::slotted(option) {\n flex: none;\n }\n\n .no-results-label {\n color: ${placeholderFontColor};\n height: ${controlHeight};\n display: inline-flex;\n display: flex;\n flex: 1 0 auto;\n align-items: center;\n padding: ${smallPadding} ${mediumPadding};\n }\n`.withBehaviors(\n appearanceBehavior(\n DropdownAppearance.underline,\n css`\n .control {\n border-bottom-width: ${borderWidth};\n padding-bottom: 0;\n }\n\n :host([disabled]) .control {\n border-color: rgba(${borderRgbPartialColor}, 0.1);\n }\n `\n ),\n appearanceBehavior(\n DropdownAppearance.outline,\n css`\n .control {\n border-width: ${borderWidth};\n padding: 0;\n }\n `\n ),\n appearanceBehavior(\n DropdownAppearance.block,\n css`\n .control {\n background-color: rgba(${borderRgbPartialColor}, 0.1);\n }\n\n .control:focus-within {\n border-bottom-width: ${borderWidth};\n padding-bottom: 0;\n }\n\n :host([disabled]) .control {\n background-color: rgba(${borderRgbPartialColor}, 0.07);\n }\n `\n ),\n themeBehavior(\n Theme.color,\n css`\n .listbox slot {\n background: ${hexToRgbaCssColor(White, 0.15)};\n }\n `\n )\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rich-text/base/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAiB,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uDAAuD,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,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AK,IAAI,CAAC,mCAAmC,EAAE,CAAC;QACpD,CAAC;IACL,CAAC;IAEO,KAAK,CAAC,mCAAmC;QAC7C,MAAM,mCAAmC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CACzC,CAAC,CAAC,EAAwB,EAAE,CAAC,CAAC,YAAY,eAAe,CAC5D,CAAC;QACF,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC/B,IAAI,CAAC,qBAAqB,CAAC,oCAAoC,EAAE,CAAC;IACtE,CAAC;IAEO,uBAAuB;QAC3B,IAAI,CAAC,+BAA+B,EAAE,CAAC;QAEvC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzC,MAAM,iBAAiB,GAAG,UAAU,CAAC,WAAW,CAC5C,OAAO,CAAC,gBAAgB,CAC3B,CAAC;YACF,iBAAiB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAClC,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC3D,CAAC;IACL,CAAC;IAEO,+BAA+B;QACnC,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC9C,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,yBAAyB,GAAG,EAAE,CAAC;IACxC,CAAC;CACJ;AAlGmB;IADf,UAAU;4CACgC;AAGjC;IADT,UAAU;+CAC6B","sourcesContent":["import { Observable, observable, type Notifier } from '@microsoft/fast-element';\nimport { FoundationElement } from '@microsoft/fast-foundation';\nimport { RichTextMention } from '../../rich-text-mention/base';\nimport { MentionInternals } from '../../rich-text-mention/base/models/mention-internals';\nimport { Configuration } from '../models/configuration';\nimport { RichTextUpdateTracker } from '../models/rich-text-tracker';\nimport { RichTextValidator } from '../models/rich-text-validator';\nimport type { RichTextValidity } from './types';\nimport { waitUntilCustomElementsDefinedAsync } from '../../utilities/wait-until-custom-elements-defined-async';\n\n/**\n * Base class for rich text components\n */\nexport abstract class RichText extends FoundationElement {\n /**\n * @internal\n */\n public mentionInternalsNotifiers: Notifier[] = [];\n\n /**\n * @internal\n */\n @observable\n public readonly childItems: Element[] = [];\n\n @observable\n protected configuration?: Configuration;\n\n protected mentionElements!: RichTextMention[];\n\n protected readonly richTextUpdateTracker = new RichTextUpdateTracker(this);\n\n protected readonly richTextValidator = new RichTextValidator();\n\n /**\n * @public\n */\n public get validity(): RichTextValidity {\n return this.richTextValidator.getValidity();\n }\n\n /**\n * @public\n */\n public checkValidity(): boolean {\n return this.richTextValidator.isValid();\n }\n\n /**\n * @internal\n */\n public abstract getMentionedHrefs(): string[];\n\n /**\n * @internal\n */\n public handleChange(source: unknown, args: unknown): void {\n if (source instanceof MentionInternals && typeof args === 'string') {\n this.richTextUpdateTracker.trackMentionInternalsPropertyChanged(\n args\n );\n }\n }\n\n /**\n * @internal\n */\n public createConfig(): void {\n this.validate();\n if (this.richTextValidator.isValid()) {\n if (\n this.richTextUpdateTracker.updateMappingConfigs\n || this.richTextUpdateTracker.updatePattern\n ) {\n this.configuration = new Configuration(this.mentionElements);\n }\n } else {\n this.configuration = undefined;\n }\n }\n\n protected validate(): void {\n this.richTextValidator.validate(this.mentionElements);\n }\n\n private childItemsChanged(\n prev: Element[] | undefined,\n _next: Element[]\n ): void {\n if (prev !== undefined) {\n void this.updateMentionElementsFromChildItems();\n }\n }\n\n private async updateMentionElementsFromChildItems(): Promise<void> {\n await waitUntilCustomElementsDefinedAsync(this.childItems);\n this.mentionElements = this.childItems.filter(\n (x): x is RichTextMention => x instanceof RichTextMention\n );\n this.observeMentionInternals();\n this.richTextUpdateTracker.trackMentionElementsInstancesChanged();\n }\n\n private observeMentionInternals(): void {\n this.removeMentionInternalsObservers();\n\n for (const mention of this.mentionElements) {\n const notifierInternals = Observable.getNotifier(\n mention.mentionInternals\n );\n notifierInternals.subscribe(this);\n this.mentionInternalsNotifiers.push(notifierInternals);\n }\n }\n\n private removeMentionInternalsObservers(): void {\n this.mentionInternalsNotifiers.forEach(notifier => {\n notifier.unsubscribe(this);\n });\n this.mentionInternalsNotifiers = [];\n }\n}\n"]}
|