@ni/nimble-components 18.7.0 → 18.8.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 +224 -16
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +1166 -1057
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/all-components.d.ts +1 -0
- package/dist/esm/all-components.js +1 -0
- package/dist/esm/all-components.js.map +1 -1
- package/dist/esm/anchor-menu-item/index.d.ts +38 -0
- package/dist/esm/anchor-menu-item/index.js +109 -0
- package/dist/esm/anchor-menu-item/index.js.map +1 -0
- package/dist/esm/anchor-menu-item/styles.d.ts +1 -0
- package/dist/esm/anchor-menu-item/styles.js +80 -0
- package/dist/esm/anchor-menu-item/styles.js.map +1 -0
- package/dist/esm/anchor-menu-item/template.d.ts +4 -0
- package/dist/esm/anchor-menu-item/template.js +32 -0
- package/dist/esm/anchor-menu-item/template.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all-components.js","sourceRoot":"","sources":["../../src/all-components.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,UAAU,CAAC;AAClB,OAAO,iBAAiB,CAAC;AACzB,OAAO,cAAc,CAAC;AACtB,OAAO,eAAe,CAAC;AACvB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,CAAC;AAClB,OAAO,cAAc,CAAC;AACtB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,CAAC;AAClB,OAAO,eAAe,CAAC;AACvB,OAAO,YAAY,CAAC;AACpB,OAAO,YAAY,CAAC;AACpB,OAAO,UAAU,CAAC;AAClB,OAAO,UAAU,CAAC;AAClB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,eAAe,CAAC;AACvB,OAAO,QAAQ,CAAC;AAChB,OAAO,eAAe,CAAC;AACvB,OAAO,aAAa,CAAC;AACrB,OAAO,gBAAgB,CAAC;AACxB,OAAO,SAAS,CAAC;AACjB,OAAO,eAAe,CAAC;AACvB,OAAO,UAAU,CAAC;AAClB,OAAO,WAAW,CAAC;AACnB,OAAO,UAAU,CAAC;AAClB,OAAO,OAAO,CAAC;AACf,OAAO,aAAa,CAAC;AACrB,OAAO,SAAS,CAAC;AACjB,OAAO,qBAAqB,CAAC;AAC7B,OAAO,QAAQ,CAAC;AAChB,OAAO,gBAAgB,CAAC;AACxB,OAAO,aAAa,CAAC;AACrB,OAAO,cAAc,CAAC;AACtB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,iBAAiB,CAAC;AACzB,OAAO,WAAW,CAAC;AACnB,OAAO,WAAW,CAAC;AACnB,OAAO,aAAa,CAAC;AACrB,OAAO,aAAa,CAAC;AACrB,OAAO,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"all-components.js","sourceRoot":"","sources":["../../src/all-components.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,UAAU,CAAC;AAClB,OAAO,iBAAiB,CAAC;AACzB,OAAO,oBAAoB,CAAC;AAC5B,OAAO,cAAc,CAAC;AACtB,OAAO,eAAe,CAAC;AACvB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,CAAC;AAClB,OAAO,cAAc,CAAC;AACtB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,CAAC;AAClB,OAAO,eAAe,CAAC;AACvB,OAAO,YAAY,CAAC;AACpB,OAAO,YAAY,CAAC;AACpB,OAAO,UAAU,CAAC;AAClB,OAAO,UAAU,CAAC;AAClB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,eAAe,CAAC;AACvB,OAAO,QAAQ,CAAC;AAChB,OAAO,eAAe,CAAC;AACvB,OAAO,aAAa,CAAC;AACrB,OAAO,gBAAgB,CAAC;AACxB,OAAO,SAAS,CAAC;AACjB,OAAO,eAAe,CAAC;AACvB,OAAO,UAAU,CAAC;AAClB,OAAO,WAAW,CAAC;AACnB,OAAO,UAAU,CAAC;AAClB,OAAO,OAAO,CAAC;AACf,OAAO,aAAa,CAAC;AACrB,OAAO,SAAS,CAAC;AACjB,OAAO,qBAAqB,CAAC;AAC7B,OAAO,QAAQ,CAAC;AAChB,OAAO,gBAAgB,CAAC;AACxB,OAAO,aAAa,CAAC;AACrB,OAAO,cAAc,CAAC;AACtB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,iBAAiB,CAAC;AACzB,OAAO,WAAW,CAAC;AACnB,OAAO,WAAW,CAAC;AACnB,OAAO,aAAa,CAAC;AACrB,OAAO,aAAa,CAAC;AACrB,OAAO,aAAa,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { MenuItemColumnCount, StartEnd } from '@microsoft/fast-foundation';
|
|
2
|
+
import { AnchorBase } from '../anchor-base';
|
|
3
|
+
declare global {
|
|
4
|
+
interface HTMLElementTagNameMap {
|
|
5
|
+
'nimble-anchor-menu-item': AnchorMenuItem;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A nimble-styled anchor menu-item
|
|
10
|
+
*/
|
|
11
|
+
export declare class AnchorMenuItem extends AnchorBase {
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
anchor: HTMLAnchorElement;
|
|
17
|
+
/**
|
|
18
|
+
* There is an assumption that this component is styled using a grid display, and this property
|
|
19
|
+
* controls which grid column contains the menu item text (i.e. the indentation of the text).
|
|
20
|
+
* The parent menu sets this value on all its child menu items so their indentations align.
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
startColumnCount: MenuItemColumnCount;
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
clickHandler(e: MouseEvent): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
keydownHandler(e: KeyboardEvent): boolean;
|
|
32
|
+
setAttribute(qualifiedName: string, value: string): void;
|
|
33
|
+
get tabIndex(): number;
|
|
34
|
+
set tabIndex(value: number);
|
|
35
|
+
}
|
|
36
|
+
export interface AnchorMenuItem extends StartEnd {
|
|
37
|
+
}
|
|
38
|
+
export declare const anchorMenuItemTag: string;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, observable } from '@microsoft/fast-element';
|
|
3
|
+
import { DesignSystem, MenuItem as FoundationMenuItem, StartEnd, applyMixins } from '@microsoft/fast-foundation';
|
|
4
|
+
import { keyEnter } from '@microsoft/fast-web-utilities';
|
|
5
|
+
import { AnchorBase } from '../anchor-base';
|
|
6
|
+
import { styles } from './styles';
|
|
7
|
+
import { template } from './template';
|
|
8
|
+
/**
|
|
9
|
+
* A nimble-styled anchor menu-item
|
|
10
|
+
*/
|
|
11
|
+
export class AnchorMenuItem extends AnchorBase {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.disabled = false;
|
|
15
|
+
/**
|
|
16
|
+
* There is an assumption that this component is styled using a grid display, and this property
|
|
17
|
+
* controls which grid column contains the menu item text (i.e. the indentation of the text).
|
|
18
|
+
* The parent menu sets this value on all its child menu items so their indentations align.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
this.startColumnCount = 0;
|
|
22
|
+
}
|
|
23
|
+
// The following two handlers are workarounds for issues with anchor menu items in submenus.
|
|
24
|
+
// Events can bubble up the DOM and get handled by the menu item in the parent menu. When that happens,
|
|
25
|
+
// the menu item's handlers (FAST) return false and prevent the default action, i.e. navigation.
|
|
26
|
+
// FAST has this issue about supporting links in menus: https://github.com/microsoft/fast/issues/5415
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
clickHandler(e) {
|
|
31
|
+
e.stopImmediatePropagation();
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
keydownHandler(e) {
|
|
38
|
+
if (e.defaultPrevented) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
switch (e.key) {
|
|
42
|
+
case keyEnter:
|
|
43
|
+
e.stopImmediatePropagation();
|
|
44
|
+
break;
|
|
45
|
+
default:
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
// The FAST Menu manages the `tabindex` of its menu items. Because of a bug in Chromium
|
|
50
|
+
// (https://bugs.chromium.org/p/chromium/issues/detail?id=1346606), setting the tabindex on an element
|
|
51
|
+
// with `delegatesFocus=true` causes the element to lose focus. This causes the menu to close, preventing
|
|
52
|
+
// arrowing through the items or navigating to the url. As a workaround, we intercept attempts to
|
|
53
|
+
// set the tabindex on the host and instead set it on the inner anchor.
|
|
54
|
+
// The referenced Chromium bug is actually fixed, but it hasn't been pulled into Edge yet (it is in
|
|
55
|
+
// Chrome). Issue https://github.com/ni/nimble/issues/1118 tracks removal of this workaround.
|
|
56
|
+
setAttribute(qualifiedName, value) {
|
|
57
|
+
if (qualifiedName === 'tabindex') {
|
|
58
|
+
this.anchor.setAttribute(qualifiedName, value);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
super.setAttribute(qualifiedName, value);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// This is part of the bug workaround described above (in setAttribute)
|
|
65
|
+
get tabIndex() {
|
|
66
|
+
return this.anchor.tabIndex;
|
|
67
|
+
}
|
|
68
|
+
// This is part of the bug workaround described above (in setAttribute)
|
|
69
|
+
set tabIndex(value) {
|
|
70
|
+
this.anchor.tabIndex = value;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
__decorate([
|
|
74
|
+
attr({ mode: 'boolean' })
|
|
75
|
+
], AnchorMenuItem.prototype, "disabled", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
observable
|
|
78
|
+
], AnchorMenuItem.prototype, "anchor", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
observable
|
|
81
|
+
], AnchorMenuItem.prototype, "startColumnCount", void 0);
|
|
82
|
+
const nimbleAnchorMenuItem = AnchorMenuItem.compose({
|
|
83
|
+
baseName: 'anchor-menu-item',
|
|
84
|
+
template,
|
|
85
|
+
styles,
|
|
86
|
+
shadowOptions: {
|
|
87
|
+
delegatesFocus: true
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
applyMixins(AnchorMenuItem, StartEnd);
|
|
91
|
+
DesignSystem.getOrCreate()
|
|
92
|
+
.withPrefix('nimble')
|
|
93
|
+
.register(nimbleAnchorMenuItem());
|
|
94
|
+
export const anchorMenuItemTag = DesignSystem.tagFor(AnchorMenuItem);
|
|
95
|
+
// This is a workaround for the fact that FAST's menu uses `instanceof MenuItem`
|
|
96
|
+
// in their logic for indenting menu items. Since our AnchorMenuItem derives from
|
|
97
|
+
// AnchorBase and not FAST's MenuItem, we need to change their MenuItem's definition
|
|
98
|
+
// of `hasInstance` so that it includes our AnchorMenuItem, too.
|
|
99
|
+
//
|
|
100
|
+
// If/when we change FAST to test for the presence of `startColumnCount` instead
|
|
101
|
+
// of using `instanceof MenuItem`, we can remove this workaround. Here is the
|
|
102
|
+
// PR into FAST: https://github.com/microsoft/fast/pull/6667
|
|
103
|
+
const originalInstanceOf = FoundationMenuItem[Symbol.hasInstance].bind(FoundationMenuItem);
|
|
104
|
+
Object.defineProperty(FoundationMenuItem, Symbol.hasInstance, {
|
|
105
|
+
value(instance) {
|
|
106
|
+
return (originalInstanceOf(instance) || instance instanceof AnchorMenuItem);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/anchor-menu-item/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACH,YAAY,EAEZ,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|
|
|
1
|
+
import { css } from '@microsoft/fast-element';
|
|
2
|
+
import { display } from '@microsoft/fast-foundation';
|
|
3
|
+
import { bodyDisabledFontColor, bodyFont, bodyFontColor, borderHoverColor, controlHeight, fillHoverColor, fillSelectedColor, iconSize } from '../theme-provider/design-tokens';
|
|
4
|
+
export const styles = css `
|
|
5
|
+
${display('grid')}
|
|
6
|
+
|
|
7
|
+
:host {
|
|
8
|
+
font: ${bodyFont};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host(:focus-within:not(:active)) {
|
|
12
|
+
outline: 2px solid ${borderHoverColor};
|
|
13
|
+
outline-offset: -2px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:host(:hover) {
|
|
17
|
+
background: ${fillHoverColor};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host(:active) {
|
|
21
|
+
background: ${fillSelectedColor};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host([disabled]) {
|
|
25
|
+
background: transparent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
a {
|
|
29
|
+
display: grid;
|
|
30
|
+
contain: layout;
|
|
31
|
+
overflow: visible;
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
height: ${controlHeight};
|
|
34
|
+
grid-template-columns: 1fr;
|
|
35
|
+
column-gap: 8px;
|
|
36
|
+
grid-template-rows: 1fr;
|
|
37
|
+
justify-items: start;
|
|
38
|
+
align-items: center;
|
|
39
|
+
margin: 0 0;
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
color: ${bodyFontColor};
|
|
42
|
+
fill: currentcolor;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
text-decoration: none;
|
|
45
|
+
outline: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:host([disabled]) a {
|
|
49
|
+
color: ${bodyDisabledFontColor};
|
|
50
|
+
fill: currentcolor;
|
|
51
|
+
cursor: default;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:host(.indent-1) a {
|
|
55
|
+
grid-template-columns: ${iconSize} 1fr;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[part='start'] {
|
|
59
|
+
display: contents;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
slot[name='start']::slotted(*) {
|
|
63
|
+
fill: currentcolor;
|
|
64
|
+
width: ${iconSize};
|
|
65
|
+
height: ${iconSize};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:host(.indent-1) .start {
|
|
69
|
+
grid-column: 1;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:host(.indent-1) .content {
|
|
73
|
+
grid-column: 2;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
[part='end'] {
|
|
77
|
+
display: none;
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/anchor-menu-item/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,OAAO,EACH,qBAAqB,EACrB,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACX,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;gBAGL,QAAQ;;;;6BAIK,gBAAgB;;;;;sBAKvB,cAAc;;;;sBAId,iBAAiB;;;;;;;;;;;;kBAYrB,aAAa;;;;;;;;iBAQd,aAAa;;;;;;;;iBAQb,qBAAqB;;;;;;iCAML,QAAQ;;;;;;;;;iBASxB,QAAQ;kBACP,QAAQ;;;;;;;;;;;;;;CAczB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ViewTemplate } from '@microsoft/fast-element';
|
|
2
|
+
import { AnchorOptions, FoundationElementTemplate } from '@microsoft/fast-foundation';
|
|
3
|
+
import type { AnchorMenuItem } from '.';
|
|
4
|
+
export declare const template: FoundationElementTemplate<ViewTemplate<AnchorMenuItem>, AnchorOptions>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { html, ref } from '@microsoft/fast-element';
|
|
2
|
+
import { endSlotTemplate, startSlotTemplate } from '@microsoft/fast-foundation';
|
|
3
|
+
export const template = (context, definition) => html `
|
|
4
|
+
<template
|
|
5
|
+
role="menuitem"
|
|
6
|
+
class="${x => (typeof x.startColumnCount === 'number'
|
|
7
|
+
? `indent-${x.startColumnCount}`
|
|
8
|
+
: '')}"
|
|
9
|
+
aria-disabled="${x => x.disabled}"
|
|
10
|
+
>
|
|
11
|
+
<a
|
|
12
|
+
${ref('anchor')}
|
|
13
|
+
download="${x => x.download}"
|
|
14
|
+
href=${x => (x.disabled ? null : x.href)}
|
|
15
|
+
hreflang="${x => x.hreflang}"
|
|
16
|
+
ping="${x => x.ping}"
|
|
17
|
+
referrerpolicy="${x => x.referrerpolicy}"
|
|
18
|
+
rel="${x => x.rel}"
|
|
19
|
+
target="${x => x.target}"
|
|
20
|
+
type="${x => x.type}"
|
|
21
|
+
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
22
|
+
@keydown="${(x, c) => x.keydownHandler(c.event)}"
|
|
23
|
+
>
|
|
24
|
+
${startSlotTemplate(context, definition)}
|
|
25
|
+
<span class="content" part="content">
|
|
26
|
+
<slot></slot>
|
|
27
|
+
</span>
|
|
28
|
+
${endSlotTemplate(context, definition)}
|
|
29
|
+
</a>
|
|
30
|
+
</template>
|
|
31
|
+
`;
|
|
32
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/anchor-menu-item/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI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HANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ni/nimble-components",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.8.0",
|
|
4
4
|
"description": "Styled web components for the NI Nimble Design System",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run generate-icons && npm run build-components && npm run bundle-components && npm run generate-scss && npm run build-storybook",
|