@ni/nimble-components 11.0.4 → 11.2.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 +2727 -1823
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +1473 -1234
- 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/combobox/index.d.ts +41 -0
- package/dist/esm/combobox/index.js +136 -0
- package/dist/esm/combobox/index.js.map +1 -0
- package/dist/esm/combobox/styles.d.ts +1 -0
- package/dist/esm/combobox/styles.js +87 -0
- package/dist/esm/combobox/styles.js.map +1 -0
- package/dist/esm/combobox/types.d.ts +2 -0
- package/dist/esm/combobox/types.js +3 -0
- package/dist/esm/combobox/types.js.map +1 -0
- package/dist/esm/number-field/index.d.ts +3 -0
- package/dist/esm/number-field/index.js +37 -3
- package/dist/esm/number-field/index.js.map +1 -1
- package/dist/esm/number-field/styles.js +50 -22
- package/dist/esm/number-field/styles.js.map +1 -1
- package/dist/esm/number-field/types.d.ts +9 -0
- package/dist/esm/number-field/types.js +9 -0
- package/dist/esm/number-field/types.js.map +1 -0
- package/dist/esm/patterns/dropdown/styles.d.ts +1 -0
- package/dist/esm/patterns/dropdown/styles.js +193 -0
- package/dist/esm/patterns/dropdown/styles.js.map +1 -0
- package/dist/esm/patterns/dropdown/types.d.ts +5 -0
- package/dist/esm/patterns/dropdown/types.js +6 -0
- package/dist/esm/patterns/dropdown/types.js.map +1 -0
- package/dist/esm/patterns/error/styles.d.ts +1 -0
- package/dist/esm/patterns/error/styles.js +40 -0
- package/dist/esm/patterns/error/styles.js.map +1 -0
- package/dist/esm/patterns/error/template.d.ts +2 -0
- package/dist/esm/patterns/error/template.js +7 -0
- package/dist/esm/patterns/error/template.js.map +1 -0
- package/dist/esm/patterns/error/types.d.ts +9 -0
- package/dist/esm/patterns/error/types.js +2 -0
- package/dist/esm/patterns/error/types.js.map +1 -0
- package/dist/esm/select/styles.js +2 -189
- package/dist/esm/select/styles.js.map +1 -1
- package/dist/esm/text-field/index.d.ts +4 -2
- package/dist/esm/text-field/index.js +6 -10
- package/dist/esm/text-field/index.js.map +1 -1
- package/dist/esm/text-field/styles.js +7 -55
- package/dist/esm/text-field/styles.js.map +1 -1
- 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,mBAAmB,CAAC;AAC3B,OAAO,cAAc,CAAC;AACtB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,CAAC;AAClB,OAAO,YAAY,CAAC;AACpB,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,UAAU,CAAC;AAClB,OAAO,UAAU,CAAC;AAClB,OAAO,OAAO,CAAC;AACf,OAAO,aAAa,CAAC;AACrB,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,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,mBAAmB,CAAC;AAC3B,OAAO,cAAc,CAAC;AACtB,OAAO,mBAAmB,CAAC;AAC3B,OAAO,UAAU,CAAC;AAClB,OAAO,YAAY,CAAC;AACpB,OAAO,YAAY,CAAC;AACpB,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,UAAU,CAAC;AAClB,OAAO,UAAU,CAAC;AAClB,OAAO,OAAO,CAAC;AACf,OAAO,aAAa,CAAC;AACrB,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,aAAa,CAAC;AACrB,OAAO,aAAa,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Combobox as FoundationCombobox } from '@microsoft/fast-foundation';
|
|
2
|
+
import type { ToggleButton } from '../toggle-button';
|
|
3
|
+
import '../icons/exclamation-mark';
|
|
4
|
+
import '../icons/arrow-expander-down';
|
|
5
|
+
import type { IHasErrorText } from '../patterns/error/types';
|
|
6
|
+
declare global {
|
|
7
|
+
interface HTMLElementTagNameMap {
|
|
8
|
+
'nimble-combobox': Combobox;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A nimble-styed HTML combobox
|
|
13
|
+
*/
|
|
14
|
+
export declare class Combobox extends FoundationCombobox implements IHasErrorText {
|
|
15
|
+
/**
|
|
16
|
+
* The ref to the internal dropdown button element.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
readonly dropdownButton: ToggleButton | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* A message explaining why the value is invalid.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
* @remarks
|
|
26
|
+
* HTML Attribute: error-text
|
|
27
|
+
*/
|
|
28
|
+
errorText: string | undefined;
|
|
29
|
+
setPositioning(): void;
|
|
30
|
+
slottedOptionsChanged(prev: HTMLElement[], next: HTMLElement[]): void;
|
|
31
|
+
connectedCallback(): void;
|
|
32
|
+
disconnectedCallback(): void;
|
|
33
|
+
toggleButtonClickHandler(e: Event): void;
|
|
34
|
+
toggleButtonChangeHandler(e: Event): void;
|
|
35
|
+
toggleButtonKeyDownHandler(e: KeyboardEvent): boolean;
|
|
36
|
+
filterOptions(): void;
|
|
37
|
+
protected openChanged(): void;
|
|
38
|
+
private ariaLabelChanged;
|
|
39
|
+
private updateInputAriaLabel;
|
|
40
|
+
private readonly focusOutHandler;
|
|
41
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, html, observable, ref } from '@microsoft/fast-element';
|
|
3
|
+
import { DesignSystem, Combobox as FoundationCombobox, comboboxTemplate as template } from '@microsoft/fast-foundation';
|
|
4
|
+
import { keyArrowDown, keyArrowUp, keyEnter, keySpace } from '@microsoft/fast-web-utilities';
|
|
5
|
+
import { errorTextTemplate } from '../patterns/error/template';
|
|
6
|
+
import '../icons/exclamation-mark';
|
|
7
|
+
import '../icons/arrow-expander-down';
|
|
8
|
+
import { styles } from './styles';
|
|
9
|
+
/**
|
|
10
|
+
* A nimble-styed HTML combobox
|
|
11
|
+
*/
|
|
12
|
+
export class Combobox extends FoundationCombobox {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.focusOutHandler = () => {
|
|
16
|
+
this.open = false;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
// Workaround for https://github.com/microsoft/fast/issues/5123
|
|
20
|
+
setPositioning() {
|
|
21
|
+
if (!this.$fastController.isConnected) {
|
|
22
|
+
// Don't call setPositioning() until we're connected,
|
|
23
|
+
// since this.forcedPosition isn't initialized yet.
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
super.setPositioning();
|
|
27
|
+
}
|
|
28
|
+
// Workaround for https://github.com/microsoft/fast/issues/5773
|
|
29
|
+
slottedOptionsChanged(prev, next) {
|
|
30
|
+
const value = this.value;
|
|
31
|
+
super.slottedOptionsChanged(prev, next);
|
|
32
|
+
if (value) {
|
|
33
|
+
this.value = value;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
super.connectedCallback();
|
|
38
|
+
// Call setPositioning() after this.forcedPosition is initialized.
|
|
39
|
+
this.setPositioning();
|
|
40
|
+
this.updateInputAriaLabel();
|
|
41
|
+
this.addEventListener('focusout', this.focusOutHandler);
|
|
42
|
+
}
|
|
43
|
+
disconnectedCallback() {
|
|
44
|
+
this.removeEventListener('focusout', this.focusOutHandler);
|
|
45
|
+
}
|
|
46
|
+
toggleButtonClickHandler(e) {
|
|
47
|
+
e.stopImmediatePropagation();
|
|
48
|
+
}
|
|
49
|
+
toggleButtonChangeHandler(e) {
|
|
50
|
+
this.open = this.dropdownButton.checked;
|
|
51
|
+
e.stopImmediatePropagation();
|
|
52
|
+
}
|
|
53
|
+
toggleButtonKeyDownHandler(e) {
|
|
54
|
+
switch (e.key) {
|
|
55
|
+
case keyArrowUp:
|
|
56
|
+
case keyArrowDown:
|
|
57
|
+
case keySpace:
|
|
58
|
+
case keyEnter:
|
|
59
|
+
this.open = true;
|
|
60
|
+
this.stopPropagation(e);
|
|
61
|
+
return false;
|
|
62
|
+
default:
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
filterOptions() {
|
|
67
|
+
super.filterOptions();
|
|
68
|
+
const enabledOptions = this.filteredOptions.filter(o => !o.disabled);
|
|
69
|
+
this.filteredOptions = enabledOptions;
|
|
70
|
+
}
|
|
71
|
+
openChanged() {
|
|
72
|
+
super.openChanged();
|
|
73
|
+
if (this.dropdownButton) {
|
|
74
|
+
this.dropdownButton.checked = this.open;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Workaround for https://github.com/microsoft/fast/issues/6041.
|
|
78
|
+
ariaLabelChanged(_oldValue, _newValue) {
|
|
79
|
+
this.updateInputAriaLabel();
|
|
80
|
+
}
|
|
81
|
+
updateInputAriaLabel() {
|
|
82
|
+
const inputElement = this.shadowRoot?.querySelector('.selected-value');
|
|
83
|
+
if (this.ariaLabel) {
|
|
84
|
+
inputElement?.setAttribute('aria-label', this.ariaLabel);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
inputElement?.removeAttribute('aria-label');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
__decorate([
|
|
92
|
+
observable
|
|
93
|
+
], Combobox.prototype, "dropdownButton", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
attr({ attribute: 'error-text' })
|
|
96
|
+
], Combobox.prototype, "errorText", void 0);
|
|
97
|
+
const nimbleCombobox = Combobox.compose({
|
|
98
|
+
baseName: 'combobox',
|
|
99
|
+
baseClass: FoundationCombobox,
|
|
100
|
+
template,
|
|
101
|
+
styles,
|
|
102
|
+
shadowOptions: {
|
|
103
|
+
delegatesFocus: true
|
|
104
|
+
},
|
|
105
|
+
end: html `
|
|
106
|
+
<div class="end-slot-container">
|
|
107
|
+
<nimble-icon-exclamation-mark
|
|
108
|
+
class="error-icon fail"
|
|
109
|
+
></nimble-icon-exclamation-mark>
|
|
110
|
+
<div class="separator"></div>
|
|
111
|
+
<nimble-toggle-button
|
|
112
|
+
${ref('dropdownButton')}
|
|
113
|
+
appearance="ghost"
|
|
114
|
+
?checked="${x => x.open}"
|
|
115
|
+
?disabled="${x => x.disabled}"
|
|
116
|
+
content-hidden="true"
|
|
117
|
+
@click="${(x, c) => x.toggleButtonClickHandler(c.event)}"
|
|
118
|
+
@change="${(x, c) => x.toggleButtonChangeHandler(c.event)}"
|
|
119
|
+
@keydown="${(x, c) => x.toggleButtonKeyDownHandler(c.event)}"
|
|
120
|
+
class="dropdown-button"
|
|
121
|
+
part="button"
|
|
122
|
+
aria-haspopup="true"
|
|
123
|
+
aria-expanded="${x => x.open}"
|
|
124
|
+
>
|
|
125
|
+
<nimble-icon-arrow-expander-down
|
|
126
|
+
slot="start"
|
|
127
|
+
class="dropdown-icon"
|
|
128
|
+
>
|
|
129
|
+
</nimble-icon-arrow-expander-down>
|
|
130
|
+
</nimble-toggle-button>
|
|
131
|
+
</div>
|
|
132
|
+
${errorTextTemplate}
|
|
133
|
+
`
|
|
134
|
+
});
|
|
135
|
+
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleCombobox());
|
|
136
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/combobox/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EACH,YAAY,EACZ,QAAQ,IAAI,kBAAkB,EAE9B,gBAAgB,IAAI,QAAQ,EAC/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,QAAQ,EACX,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,2BAA2B,CAAC;AACnC,OAAO,8BAA8B,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AASlC;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,kBAAkB;IAAhD;;QAwGqB,oBAAe,GAAG,GAAS,EAAE;YAC1C,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QACtB,CAAC,CAAC;IACN,CAAC;IAxFG,+DAA+D;IAC/C,cAAc;QAC1B,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE;YACnC,qDAAqD;YACrD,mDAAmD;YACnD,OAAO;SACV;QACD,KAAK,CAAC,cAAc,EAAE,CAAC;IAC3B,CAAC;I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AC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,KAAK,CAAC;4BAC7C,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,KAAsB,CAAC;;;;iCAI3D,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;;;;;;;;;UASlC,iBAAiB;KACtB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("@microsoft/fast-element").ElementStyles;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { css } from '@microsoft/fast-element';
|
|
2
|
+
import { controlHeight, failColor, bodyDisabledFontColor, borderRgbPartialColor, smallPadding } from '../theme-provider/design-tokens';
|
|
3
|
+
import { styles as dropdownStyles } from '../patterns/dropdown/styles';
|
|
4
|
+
import { styles as errorStyles } from '../patterns/error/styles';
|
|
5
|
+
import { focusVisible } from '../utilities/style/focus';
|
|
6
|
+
export const styles = css `
|
|
7
|
+
${dropdownStyles}
|
|
8
|
+
${errorStyles}
|
|
9
|
+
|
|
10
|
+
:host {
|
|
11
|
+
--ni-private-hover-bottom-border-width: 2px;
|
|
12
|
+
--ni-private-bottom-border-width: 1px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host([disabled]) *,
|
|
16
|
+
:host([disabled]) {
|
|
17
|
+
user-select: none;
|
|
18
|
+
color: ${bodyDisabledFontColor};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.control {
|
|
22
|
+
bottom-border-width: var(--ni-private-bottom-border-width);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host(.invalid) .control {
|
|
26
|
+
border-bottom: var(--ni-private-bottom-border-width) solid ${failColor};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:host([disabled]) .control {
|
|
30
|
+
border-color: rgba(${borderRgbPartialColor}, 0.1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host(.invalid[disabled]) .control {
|
|
34
|
+
border-color: ${failColor};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.selected-value {
|
|
38
|
+
-webkit-appearance: none;
|
|
39
|
+
background: transparent;
|
|
40
|
+
border: none;
|
|
41
|
+
color: inherit;
|
|
42
|
+
margin: auto 0;
|
|
43
|
+
width: 100%;
|
|
44
|
+
font-size: inherit;
|
|
45
|
+
padding-left: 0px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.selected-value:hover,
|
|
49
|
+
.selected-value:disabled,
|
|
50
|
+
.selected-value:active,
|
|
51
|
+
.selected-value${focusVisible} {
|
|
52
|
+
outline: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
[part='indicator'] {
|
|
56
|
+
display: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.end-slot-container {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: baseline;
|
|
62
|
+
padding-right: ${smallPadding};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.separator {
|
|
66
|
+
display: inline;
|
|
67
|
+
width: 2px;
|
|
68
|
+
border-right: 2px solid rgba(${borderRgbPartialColor}, 0.15);
|
|
69
|
+
height: calc(${controlHeight} - 12px);
|
|
70
|
+
align-self: center;
|
|
71
|
+
padding-left: 4px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.dropdown-button {
|
|
75
|
+
${controlHeight.cssCustomProperty}: 24px;
|
|
76
|
+
margin-left: ${smallPadding};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:host([disabled]) .dropdown-icon {
|
|
80
|
+
fill: ${bodyDisabledFontColor};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:host(:empty) .listbox {
|
|
84
|
+
display: none;
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/combobox/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EACH,aAAa,EACb,SAAS,EACT,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,EACf,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,cAAc;MACd,WAAW;;;;;;;;;;iBAUA,qBAAqB;;;;;;;;qEAQ+B,SAAS;;;;6BAIjD,qBAAqB;;;;wBAI1B,SAAS;;;;;;;;;;;;;;;;;qBAiBZ,YAAY;;;;;;;;;;;yBAWR,YAAY;;;;;;uCAME,qBAAqB;uBACrC,aAAa;;;;;;UAM1B,aAAa,CAAC,iBAAiB;uBAClB,YAAY;;;;gBAInB,qBAAqB;;;;;;CAMpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/combobox/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NumberField as FoundationNumberField } from '@microsoft/fast-foundation';
|
|
2
|
+
import { NumberFieldAppearance } from './types';
|
|
2
3
|
declare global {
|
|
3
4
|
interface HTMLElementTagNameMap {
|
|
4
5
|
'nimble-number-field': NumberField;
|
|
@@ -8,4 +9,6 @@ declare global {
|
|
|
8
9
|
* A nimble-styled HTML number input
|
|
9
10
|
*/
|
|
10
11
|
export declare class NumberField extends FoundationNumberField {
|
|
12
|
+
appearance: NumberFieldAppearance;
|
|
13
|
+
connectedCallback(): void;
|
|
11
14
|
}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { attr, html } from '@microsoft/fast-element';
|
|
1
3
|
import { DesignSystem, NumberField as FoundationNumberField, numberFieldTemplate as template } from '@microsoft/fast-foundation';
|
|
2
|
-
import { arrowExpanderDown16X16, arrowExpanderUp16X16 } from '@ni/nimble-tokens/dist/icons/js';
|
|
3
4
|
import { styles } from './styles';
|
|
5
|
+
import { NumberFieldAppearance } from './types';
|
|
4
6
|
/**
|
|
5
7
|
* A nimble-styled HTML number input
|
|
6
8
|
*/
|
|
7
9
|
export class NumberField extends FoundationNumberField {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.appearance = NumberFieldAppearance.underline;
|
|
13
|
+
}
|
|
14
|
+
connectedCallback() {
|
|
15
|
+
super.connectedCallback();
|
|
16
|
+
// This is a workaround for FAST issue: https://github.com/microsoft/fast/issues/6148
|
|
17
|
+
this.control.setAttribute('role', 'spinbutton');
|
|
18
|
+
}
|
|
8
19
|
}
|
|
20
|
+
__decorate([
|
|
21
|
+
attr
|
|
22
|
+
], NumberField.prototype, "appearance", void 0);
|
|
9
23
|
/**
|
|
10
24
|
* A function that returns a number-field registration for configuring the component with a DesignSystem.
|
|
11
25
|
*
|
|
@@ -22,8 +36,28 @@ const nimbleNumberField = NumberField.compose({
|
|
|
22
36
|
shadowOptions: {
|
|
23
37
|
delegatesFocus: true
|
|
24
38
|
},
|
|
25
|
-
stepDownGlyph:
|
|
26
|
-
|
|
39
|
+
stepDownGlyph: html `
|
|
40
|
+
<nimble-button
|
|
41
|
+
class="step-up-down-button"
|
|
42
|
+
appearance="ghost"
|
|
43
|
+
content-hidden
|
|
44
|
+
tabindex="-1"
|
|
45
|
+
>
|
|
46
|
+
"Decrement"
|
|
47
|
+
<nimble-icon-minus-wide slot="start"></nimble-icon-minus-wide>
|
|
48
|
+
</nimble-button>
|
|
49
|
+
`,
|
|
50
|
+
stepUpGlyph: html `
|
|
51
|
+
<nimble-button
|
|
52
|
+
class="step-up-down-button"
|
|
53
|
+
appearance="ghost"
|
|
54
|
+
content-hidden
|
|
55
|
+
tabindex="-1"
|
|
56
|
+
>
|
|
57
|
+
"Increment"
|
|
58
|
+
<nimble-icon-add slot="start"></nimble-icon-add>
|
|
59
|
+
</nimble-button>
|
|
60
|
+
`
|
|
27
61
|
});
|
|
28
62
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleNumberField());
|
|
29
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/number-field/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,YAAY,EACZ,WAAW,IAAI,qBAAqB,EAEpC,mBAAmB,IAAI,QAAQ,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/number-field/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EACH,YAAY,EACZ,WAAW,IAAI,qBAAqB,EAEpC,mBAAmB,IAAI,QAAQ,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAQhD;;GAEG;AACH,MAAM,OAAO,WAAY,SAAQ,qBAAqB;IAAtD;;QAEW,eAAU,GAA0B,qBAAqB,CAAC,SAAS,CAAC;IAQ/E,CAAC;IANmB,iBAAiB;QAC7B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAE1B,qFAAqF;QACrF,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACpD,CAAC;CACJ;AARG;IADC,IAAI;+CACsE;AAU/E;;;;;;;GAOG;AACH,MAAM,iBAAiB,GAAG,WAAW,CAAC,OAAO,CAAqB;IAC9D,QAAQ,EAAE,cAAc;IACxB,SAAS,EAAE,qBAAqB;IAChC,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;IACD,aAAa,EAAE,IAAI,CAAA;;;;;;;;;;KAUlB;IACD,WAAW,EAAE,IAAI,CAAA;;;;;;;;;;KAUhB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { css } from '@microsoft/fast-element';
|
|
2
2
|
import { display } from '@microsoft/fast-foundation';
|
|
3
|
-
import {
|
|
3
|
+
import { borderRgbPartialColor, borderHoverColor, borderWidth, bodyFontColor, bodyDisabledFontColor, controlHeight, fillSelectedRgbPartialColor, controlLabelFont, controlLabelFontColor, labelHeight, smallDelay, bodyFont, failColor, standardPadding, controlLabelDisabledFontColor } from '../theme-provider/design-tokens';
|
|
4
|
+
import { appearanceBehavior } from '../utilities/style/appearance';
|
|
5
|
+
import { NumberFieldAppearance } from './types';
|
|
4
6
|
export const styles = css `
|
|
5
7
|
${display('inline-block')}
|
|
6
8
|
|
|
@@ -24,6 +26,10 @@ export const styles = css `
|
|
|
24
26
|
font: ${controlLabelFont};
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
:host([disabled]) .label {
|
|
30
|
+
color: ${controlLabelDisabledFontColor};
|
|
31
|
+
}
|
|
32
|
+
|
|
27
33
|
.root {
|
|
28
34
|
box-sizing: border-box;
|
|
29
35
|
position: relative;
|
|
@@ -31,7 +37,7 @@ export const styles = css `
|
|
|
31
37
|
flex-direction: row;
|
|
32
38
|
justify-content: center;
|
|
33
39
|
border-radius: 0px;
|
|
34
|
-
border
|
|
40
|
+
border: 0px solid rgba(${borderRgbPartialColor}, 0.3);
|
|
35
41
|
gap: calc(${standardPadding} / 2);
|
|
36
42
|
}
|
|
37
43
|
|
|
@@ -39,9 +45,8 @@ export const styles = css `
|
|
|
39
45
|
border-bottom-color: ${borderHoverColor};
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
:host([disabled]) .root
|
|
43
|
-
|
|
44
|
-
border-bottom: ${borderWidth} solid ${bodyDisabledFontColor};
|
|
48
|
+
:host([disabled]) .root {
|
|
49
|
+
border-color: rgba(${borderRgbPartialColor}, 0.1);
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
.root::before {
|
|
@@ -90,7 +95,7 @@ export const styles = css `
|
|
|
90
95
|
font: inherit;
|
|
91
96
|
background: transparent;
|
|
92
97
|
color: inherit;
|
|
93
|
-
height:
|
|
98
|
+
height: ${controlHeight};
|
|
94
99
|
width: 100%;
|
|
95
100
|
border: none;
|
|
96
101
|
padding: 0px;
|
|
@@ -122,24 +127,47 @@ export const styles = css `
|
|
|
122
127
|
|
|
123
128
|
.controls {
|
|
124
129
|
display: flex;
|
|
125
|
-
flex-direction:
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.step-up,
|
|
129
|
-
.step-down {
|
|
130
|
-
display: inline-flex;
|
|
131
|
-
height: 15px;
|
|
132
|
-
width: 15px;
|
|
133
|
-
cursor: pointer;
|
|
130
|
+
flex-direction: row-reverse;
|
|
134
131
|
justify-content: center;
|
|
135
132
|
align-items: center;
|
|
136
133
|
}
|
|
137
134
|
|
|
138
|
-
.step-up
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
135
|
+
.step-up-down-button {
|
|
136
|
+
${controlHeight.cssCustomProperty}: 24px;
|
|
137
|
+
}
|
|
138
|
+
`.withBehaviors(appearanceBehavior(NumberFieldAppearance.underline, css `
|
|
139
|
+
.root {
|
|
140
|
+
border-bottom-width: ${borderWidth};
|
|
141
|
+
padding-top: ${borderWidth};
|
|
142
|
+
padding-left: ${borderWidth};
|
|
143
|
+
padding-right: ${borderWidth};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.control {
|
|
147
|
+
height: calc(${controlHeight} - 2 * ${borderWidth});
|
|
148
|
+
}
|
|
149
|
+
`), appearanceBehavior(NumberFieldAppearance.block, css `
|
|
150
|
+
.root {
|
|
151
|
+
background-color: rgba(${borderRgbPartialColor}, 0.1);
|
|
152
|
+
padding-left: ${borderWidth};
|
|
153
|
+
padding-right: ${borderWidth};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.root:focus-within,
|
|
157
|
+
:host(.invalid) .root {
|
|
158
|
+
border-bottom-width: ${borderWidth};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:host([disabled]) .root {
|
|
162
|
+
background-color: rgba(${borderRgbPartialColor}, 0.07);
|
|
163
|
+
}
|
|
164
|
+
`), appearanceBehavior(NumberFieldAppearance.outline, css `
|
|
165
|
+
.root {
|
|
166
|
+
border-width: ${borderWidth};
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.control {
|
|
170
|
+
height: calc(${controlHeight} - 2 * ${borderWidth});
|
|
171
|
+
}
|
|
172
|
+
`));
|
|
145
173
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/number-field/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/number-field/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAA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,qBAAqB;gCAC9B,WAAW;iCACV,WAAW;;;;;uCAKL,WAAW;;;;yCAIT,qBAAqB;;SAErD,CACA,EACD,kBAAkB,CACd,qBAAqB,CAAC,OAAO,EAC7B,GAAG,CAAA;;gCAEiB,WAAW;;;;+BAIZ,aAAa,UAAU,WAAW;;SAExD,CACA,CACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Values for the 'appearance' property of the number field
|
|
3
|
+
*/
|
|
4
|
+
export declare const NumberFieldAppearance: {
|
|
5
|
+
readonly underline: "underline";
|
|
6
|
+
readonly outline: "outline";
|
|
7
|
+
readonly block: "block";
|
|
8
|
+
};
|
|
9
|
+
export declare type NumberFieldAppearance = typeof NumberFieldAppearance[keyof typeof NumberFieldAppearance];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/number-field/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,SAAS,EAAE,WAAW;IACtB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;CACR,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("@microsoft/fast-element").ElementStyles;
|