@ni/nimble-components 11.8.4 → 11.10.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.
@@ -10,6 +10,7 @@ import './button';
10
10
  import './card-button';
11
11
  import './checkbox';
12
12
  import './combobox';
13
+ import './dialog';
13
14
  import './drawer';
14
15
  import './icons/all-icons';
15
16
  import './list-option';
@@ -10,6 +10,7 @@ import './button';
10
10
  import './card-button';
11
11
  import './checkbox';
12
12
  import './combobox';
13
+ import './dialog';
13
14
  import './drawer';
14
15
  import './icons/all-icons';
15
16
  import './list-option';
@@ -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,eAAe,CAAC;AACvB,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,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,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,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,WAAW,CAAC;AACnB,OAAO,aAAa,CAAC;AACrB,OAAO,aAAa,CAAC"}
@@ -3,6 +3,7 @@ import type { ToggleButton } from '../toggle-button';
3
3
  import '../icons/exclamation-mark';
4
4
  import '../icons/arrow-expander-down';
5
5
  import type { IHasErrorText } from '../patterns/error/types';
6
+ import { DropdownAppearance } from '../patterns/dropdown/types';
6
7
  declare global {
7
8
  interface HTMLElementTagNameMap {
8
9
  'nimble-combobox': Combobox;
@@ -12,12 +13,13 @@ declare global {
12
13
  * A nimble-styed HTML combobox
13
14
  */
14
15
  export declare class Combobox extends FoundationCombobox implements IHasErrorText {
16
+ appearance: DropdownAppearance;
15
17
  /**
16
18
  * The ref to the internal dropdown button element.
17
19
  *
18
20
  * @internal
19
21
  */
20
- readonly dropdownButton: ToggleButton | undefined;
22
+ readonly dropdownButton?: ToggleButton;
21
23
  /**
22
24
  * A message explaining why the value is invalid.
23
25
  *
@@ -26,16 +28,36 @@ export declare class Combobox extends FoundationCombobox implements IHasErrorTex
26
28
  * HTML Attribute: error-text
27
29
  */
28
30
  errorText: string | undefined;
31
+ private valueUpdatedByInput;
32
+ private valueBeforeTextUpdate?;
29
33
  setPositioning(): void;
30
34
  slottedOptionsChanged(prev: HTMLElement[], next: HTMLElement[]): void;
31
35
  connectedCallback(): void;
32
- disconnectedCallback(): void;
33
36
  toggleButtonClickHandler(e: Event): void;
34
37
  toggleButtonChangeHandler(e: Event): void;
35
38
  toggleButtonKeyDownHandler(e: KeyboardEvent): boolean;
36
39
  filterOptions(): void;
40
+ /**
41
+ * This is a workaround for the issue described here: https://github.com/microsoft/fast/issues/6267
42
+ * For now, we will update the value ourselves while a user types in text. Note that there is other
43
+ * implementation related to this (like the 'keydownEventHandler') needed to create the complete set
44
+ * of desired behavior described in the issue noted above.
45
+ */
46
+ inputHandler(e: InputEvent): boolean | void;
47
+ keydownHandler(e: KeyboardEvent): boolean | void;
48
+ focusoutHandler(e: FocusEvent): boolean | void;
37
49
  protected openChanged(): void;
38
50
  private ariaLabelChanged;
39
51
  private updateInputAriaLabel;
40
- private readonly focusOutHandler;
52
+ /**
53
+ * This will only emit a `change` event after text entry where the text in the input prior to
54
+ * typing is different than the text present upon an attempt to commit (e.g. pressing <Enter>).
55
+ * So, for a concrete example:
56
+ * 1) User types 'Sue' (when Combobox input was blank).
57
+ * 2) User presses <Enter> -> 'change' event fires
58
+ * 3) User deletes 'Sue'
59
+ * 4) User re-types 'Sue'
60
+ * 5) User presses <Enter> -> NO 'change' event is fired
61
+ */
62
+ private emitChangeIfValueUpdated;
41
63
  }
@@ -6,15 +6,15 @@ import { errorTextTemplate } from '../patterns/error/template';
6
6
  import '../icons/exclamation-mark';
7
7
  import '../icons/arrow-expander-down';
8
8
  import { styles } from './styles';
9
+ import { DropdownAppearance } from '../patterns/dropdown/types';
9
10
  /**
10
11
  * A nimble-styed HTML combobox
11
12
  */
12
13
  export class Combobox extends FoundationCombobox {
13
14
  constructor() {
14
15
  super(...arguments);
15
- this.focusOutHandler = () => {
16
- this.open = false;
17
- };
16
+ this.appearance = DropdownAppearance.underline;
17
+ this.valueUpdatedByInput = false;
18
18
  }
19
19
  // Workaround for https://github.com/microsoft/fast/issues/5123
20
20
  setPositioning() {
@@ -38,10 +38,6 @@ export class Combobox extends FoundationCombobox {
38
38
  // Call setPositioning() after this.forcedPosition is initialized.
39
39
  this.setPositioning();
40
40
  this.updateInputAriaLabel();
41
- this.addEventListener('focusout', this.focusOutHandler);
42
- }
43
- disconnectedCallback() {
44
- this.removeEventListener('focusout', this.focusOutHandler);
45
41
  }
46
42
  toggleButtonClickHandler(e) {
47
43
  e.stopImmediatePropagation();
@@ -68,6 +64,50 @@ export class Combobox extends FoundationCombobox {
68
64
  const enabledOptions = this.filteredOptions.filter(o => !o.disabled);
69
65
  this.filteredOptions = enabledOptions;
70
66
  }
67
+ /**
68
+ * This is a workaround for the issue described here: https://github.com/microsoft/fast/issues/6267
69
+ * For now, we will update the value ourselves while a user types in text. Note that there is other
70
+ * implementation related to this (like the 'keydownEventHandler') needed to create the complete set
71
+ * of desired behavior described in the issue noted above.
72
+ */
73
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
74
+ inputHandler(e) {
75
+ const returnValue = super.inputHandler(e);
76
+ if (!this.valueUpdatedByInput) {
77
+ this.valueBeforeTextUpdate = this.value;
78
+ }
79
+ this.value = this.control.value;
80
+ this.valueUpdatedByInput = true;
81
+ return returnValue;
82
+ }
83
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
84
+ keydownHandler(e) {
85
+ const returnValue = super.keydownHandler(e);
86
+ if (e.ctrlKey || e.altKey) {
87
+ return returnValue;
88
+ }
89
+ switch (e.key) {
90
+ case keyEnter:
91
+ this.emitChangeIfValueUpdated();
92
+ break;
93
+ case keyArrowDown:
94
+ case keyArrowUp:
95
+ if (this.open && this.valueUpdatedByInput) {
96
+ this.valueUpdatedByInput = false;
97
+ }
98
+ break;
99
+ default:
100
+ return returnValue;
101
+ }
102
+ return returnValue;
103
+ }
104
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
105
+ focusoutHandler(e) {
106
+ const returnValue = super.focusoutHandler(e);
107
+ this.open = false;
108
+ this.emitChangeIfValueUpdated();
109
+ return returnValue;
110
+ }
71
111
  openChanged() {
72
112
  super.openChanged();
73
113
  if (this.dropdownButton) {
@@ -87,7 +127,28 @@ export class Combobox extends FoundationCombobox {
87
127
  inputElement?.removeAttribute('aria-label');
88
128
  }
89
129
  }
130
+ /**
131
+ * This will only emit a `change` event after text entry where the text in the input prior to
132
+ * typing is different than the text present upon an attempt to commit (e.g. pressing <Enter>).
133
+ * So, for a concrete example:
134
+ * 1) User types 'Sue' (when Combobox input was blank).
135
+ * 2) User presses <Enter> -> 'change' event fires
136
+ * 3) User deletes 'Sue'
137
+ * 4) User re-types 'Sue'
138
+ * 5) User presses <Enter> -> NO 'change' event is fired
139
+ */
140
+ emitChangeIfValueUpdated() {
141
+ if (this.valueUpdatedByInput) {
142
+ if (this.value !== this.valueBeforeTextUpdate) {
143
+ this.$emit('change');
144
+ }
145
+ this.valueUpdatedByInput = false;
146
+ }
147
+ }
90
148
  }
149
+ __decorate([
150
+ attr
151
+ ], Combobox.prototype, "appearance", void 0);
91
152
  __decorate([
92
153
  observable
93
154
  ], Combobox.prototype, "dropdownButton", void 0);
@@ -1 +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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;AAzKG;IADC,IAAI;4CACgE;AAQrE;IADC,UAAU;gDACmC;AAU9C;IADC,IAAI,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;2CACG;AAyJzC,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAkB;IACrD,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,kBAAkB;IAC7B,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;IACD,GAAG,EAAE,IAAI,CAAU;;;;;;;kBAOL,GAAG,CAAC,gBAAgB,CAAC;;4BAEX,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI;6BACV,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;;0BAElB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,KAAK,CAAC;2BAC5C,CAAC,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;;;;;;;;;;UAUlC,iBAAiB;KACtB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC"}
@@ -1,8 +1,10 @@
1
1
  import { css } from '@microsoft/fast-element';
2
- import { controlHeight, failColor, bodyDisabledFontColor, borderRgbPartialColor, smallPadding, borderHoverColor } from '../theme-provider/design-tokens';
2
+ import { controlHeight, failColor, bodyDisabledFontColor, borderRgbPartialColor, smallPadding, borderHoverColor, borderWidth } from '../theme-provider/design-tokens';
3
3
  import { styles as dropdownStyles } from '../patterns/dropdown/styles';
4
4
  import { styles as errorStyles } from '../patterns/error/styles';
5
5
  import { focusVisible } from '../utilities/style/focus';
6
+ import { appearanceBehavior } from '../utilities/style/appearance';
7
+ import { DropdownAppearance } from '../select/types';
6
8
  export const styles = css `
7
9
  ${dropdownStyles}
8
10
  ${errorStyles}
@@ -10,6 +12,9 @@ export const styles = css `
10
12
  :host {
11
13
  --ni-private-hover-bottom-border-width: 2px;
12
14
  --ni-private-bottom-border-width: 1px;
15
+ --ni-private-height-within-border: calc(
16
+ ${controlHeight} - 2 * ${borderWidth}
17
+ );
13
18
  }
14
19
 
15
20
  :host([disabled]) *,
@@ -18,6 +23,10 @@ export const styles = css `
18
23
  color: ${bodyDisabledFontColor};
19
24
  }
20
25
 
26
+ :host(.invalid)::after {
27
+ border-bottom-color: ${failColor};
28
+ }
29
+
21
30
  .control {
22
31
  bottom-border-width: var(--ni-private-bottom-border-width);
23
32
  }
@@ -34,8 +43,9 @@ export const styles = css `
34
43
  border-color: rgba(${borderRgbPartialColor}, 0.1);
35
44
  }
36
45
 
37
- :host(.invalid[disabled]) .control {
38
- border-color: ${failColor};
46
+ :host(.invalid[disabled]) .control,
47
+ :host(.open.invalid) .control {
48
+ border-bottom-color: ${failColor};
39
49
  }
40
50
 
41
51
  .selected-value {
@@ -46,7 +56,7 @@ export const styles = css `
46
56
  margin: auto 0;
47
57
  width: 100%;
48
58
  font-size: inherit;
49
- padding-left: 0px;
59
+ height: var(--ni-private-height-within-border);
50
60
  }
51
61
 
52
62
  .selected-value:hover,
@@ -87,5 +97,10 @@ export const styles = css `
87
97
  :host(:empty) .listbox {
88
98
  display: none;
89
99
  }
90
- `;
100
+ `.withBehaviors(appearanceBehavior(DropdownAppearance.block, css `
101
+ :host(.invalid) .control {
102
+ border-bottom-width: ${borderWidth};
103
+ padding-bottom: 0;
104
+ }
105
+ `));
91
106
  //# sourceMappingURL=styles.js.map
@@ -1 +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,EACZ,gBAAgB,EACnB,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;;;;;;;;+BAQP,gBAAgB;;;;qEAIsB,SAAS;;;;6BAIjD,qBAAqB;;;;wBAI1B,SAAS;;;;;;;;;;;;;;;;;qBAiBZ,YAAY;;;;;;;;;;;yBAWR,YAAY;;;;;;uCAME,qBAAqB;uBACrC,aAAa;;;;;;UAM1B,aAAa,CAAC,iBAAiB;uBAClB,YAAY;;;;gBAInB,qBAAqB;;;;;;CAMpC,CAAC"}
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,EACZ,gBAAgB,EAChB,WAAW,EACd,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;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,cAAc;MACd,WAAW;;;;;;cAMH,aAAa,UAAU,WAAW;;;;;;;iBAO/B,qBAAqB;;;;+BAIP,SAAS;;;;;;;;+BAQT,gBAAgB;;;;qEAIsB,SAAS;;;;6BAIjD,qBAAqB;;;;;+BAKnB,SAAS;;;;;;;;;;;;;;;;;qBAiBnB,YAAY;;;;;;;;;;;yBAWR,YAAY;;;;;;uCAME,qBAAqB;uBACrC,aAAa;;;;;;UAM1B,aAAa,CAAC,iBAAiB;uBAClB,YAAY;;;;gBAInB,qBAAqB;;;;;;CAMpC,CAAC,aAAa,CACP,kBAAkB,CACd,kBAAkB,CAAC,KAAK,EACxB,GAAG,CAAA;;uCAEwB,WAAW;;;SAGzC,CACA,CACJ,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { ARIAGlobalStatesAndProperties, FoundationElement } from '@microsoft/fast-foundation';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'nimble-dialog': Dialog;
5
+ }
6
+ }
7
+ /**
8
+ * Symbol that is returned as the dialog close reason (from the Promise returned by show()) when
9
+ * the dialog was closed by pressing the ESC key (vs. calling the close() function).
10
+ */
11
+ export declare const USER_DISMISSED: unique symbol;
12
+ export declare type UserDismissed = typeof USER_DISMISSED;
13
+ /**
14
+ * This is a workaround for an incomplete definition of the native dialog element:
15
+ * https://github.com/microsoft/TypeScript/issues/48267
16
+ * @internal
17
+ */
18
+ export interface ExtendedDialog extends HTMLDialogElement {
19
+ showModal(): void;
20
+ close(): void;
21
+ }
22
+ /**
23
+ * A nimble-styled dialog.
24
+ */
25
+ export declare class Dialog<CloseReason = void> extends FoundationElement {
26
+ /**
27
+ * @public
28
+ * @description
29
+ * Prevents dismissing the dialog via the Escape key
30
+ */
31
+ preventDismiss: boolean;
32
+ /**
33
+ * The ref to the internal dialog element.
34
+ *
35
+ * @internal
36
+ */
37
+ readonly dialogElement: ExtendedDialog;
38
+ /**
39
+ * True if the dialog is open/showing, false otherwise
40
+ */
41
+ get open(): boolean;
42
+ private resolveShow?;
43
+ private closeReason;
44
+ /**
45
+ * Opens the dialog
46
+ * @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 USER_DISMISSED if the dialog was closed via the ESC key.
47
+ */
48
+ show(): Promise<CloseReason | UserDismissed>;
49
+ /**
50
+ * Closes the dialog
51
+ * @param reason An optional value indicating how/why the dialog was closed.
52
+ */
53
+ close(reason: CloseReason): void;
54
+ /**
55
+ * @internal
56
+ */
57
+ closeHandler(): boolean;
58
+ /**
59
+ * @internal
60
+ */
61
+ cancelHandler(event: Event): boolean;
62
+ }
63
+ export interface Dialog extends ARIAGlobalStatesAndProperties {
64
+ }
@@ -0,0 +1,90 @@
1
+ import { __decorate } from "tslib";
2
+ import { attr } from '@microsoft/fast-element';
3
+ import { applyMixins, ARIAGlobalStatesAndProperties, DesignSystem, FoundationElement } from '@microsoft/fast-foundation';
4
+ import { styles } from './styles';
5
+ import { template } from './template';
6
+ /**
7
+ * Symbol that is returned as the dialog close reason (from the Promise returned by show()) when
8
+ * the dialog was closed by pressing the ESC key (vs. calling the close() function).
9
+ */
10
+ export const USER_DISMISSED = Symbol('user dismissed');
11
+ /**
12
+ * A nimble-styled dialog.
13
+ */
14
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
15
+ export class Dialog extends FoundationElement {
16
+ constructor() {
17
+ super(...arguments);
18
+ /**
19
+ * @public
20
+ * @description
21
+ * Prevents dismissing the dialog via the Escape key
22
+ */
23
+ this.preventDismiss = false;
24
+ }
25
+ /**
26
+ * True if the dialog is open/showing, false otherwise
27
+ */
28
+ get open() {
29
+ return this.resolveShow !== undefined;
30
+ }
31
+ /**
32
+ * Opens the dialog
33
+ * @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 USER_DISMISSED if the dialog was closed via the ESC key.
34
+ */
35
+ async show() {
36
+ if (this.open) {
37
+ throw new Error('Dialog is already open');
38
+ }
39
+ this.dialogElement.showModal();
40
+ return new Promise((resolve, _reject) => {
41
+ this.resolveShow = resolve;
42
+ });
43
+ }
44
+ /**
45
+ * Closes the dialog
46
+ * @param reason An optional value indicating how/why the dialog was closed.
47
+ */
48
+ close(reason) {
49
+ if (!this.open) {
50
+ throw new Error('Dialog is not open');
51
+ }
52
+ this.closeReason = reason;
53
+ this.dialogElement.close();
54
+ }
55
+ /**
56
+ * @internal
57
+ */
58
+ closeHandler() {
59
+ this.resolveShow(this.closeReason);
60
+ this.resolveShow = undefined;
61
+ return true;
62
+ }
63
+ /**
64
+ * @internal
65
+ */
66
+ cancelHandler(event) {
67
+ if (this.preventDismiss) {
68
+ event.preventDefault();
69
+ }
70
+ else {
71
+ this.closeReason = USER_DISMISSED;
72
+ }
73
+ return true;
74
+ }
75
+ }
76
+ __decorate([
77
+ attr({ attribute: 'prevent-dismiss', mode: 'boolean' })
78
+ ], Dialog.prototype, "preventDismiss", void 0);
79
+ applyMixins(Dialog, ARIAGlobalStatesAndProperties);
80
+ const nimbleDialog = Dialog.compose({
81
+ baseName: 'dialog',
82
+ template,
83
+ styles,
84
+ baseClass: Dialog,
85
+ shadowOptions: {
86
+ delegatesFocus: true
87
+ }
88
+ });
89
+ DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleDialog());
90
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dialog/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,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC;;;GAGG;AACH,MAAM,CAAC,MAAM,c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,SAAS,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;8CAC1B;AAqElC,WAAW,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;AAEnD,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC;IAChC,QAAQ,EAAE,QAAQ;IAClB,QAAQ;IACR,MAAM;IACN,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const styles: import("@microsoft/fast-element").ElementStyles;
@@ -0,0 +1,14 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ import { display } from '@microsoft/fast-foundation';
3
+ import { applicationBackgroundColor, borderWidth, popupBoxShadowColor, popupBorderColor } from '../theme-provider/design-tokens';
4
+ export const styles = css `
5
+ ${display('grid')}
6
+
7
+ dialog {
8
+ background-color: ${applicationBackgroundColor};
9
+ border: ${borderWidth} solid ${popupBorderColor};
10
+ box-shadow: 0px 2px 3px ${popupBoxShadowColor};
11
+ max-width: 50%;
12
+ }
13
+ `;
14
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/dialog/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAErD,OAAO,EACH,0BAA0B,EAC1B,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EACnB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;4BAGO,0BAA0B;kBACpC,WAAW,UAAU,gBAAgB;kCACrB,mBAAmB;;;CAGpD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Dialog } from '.';
2
+ export declare const template: import("@microsoft/fast-element").ViewTemplate<Dialog<void>, any>;
@@ -0,0 +1,15 @@
1
+ import { html, ref } from '@microsoft/fast-element';
2
+ export const template = html `
3
+ <template>
4
+ <dialog
5
+ ${ref('dialogElement')}
6
+ role="alertdialog"
7
+ aria-label="${x => x.ariaLabel}"
8
+ @cancel="${(x, c) => x.cancelHandler(c.event)}"
9
+ @close="${x => x.closeHandler()}"
10
+ >
11
+ <slot></slot>
12
+ </dialog>
13
+ </template>
14
+ `;
15
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/dialog/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAGpD,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAQ;;;cAGtB,GAAG,CAAC,eAAe,CAAC;;0BAER,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;uBACnB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC;sBACnC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE;;;;;CAK1C,CAAC"}
@@ -1,7 +1,9 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { display } from '@microsoft/fast-foundation';
3
- import { applicationBackgroundColor, bodyFont, bodyFontColor, bodyDisabledFontColor, borderHoverColor, borderWidth, controlHeight, iconSize, popupBorderColor, popupBoxShadowColor, smallDelay, smallPadding, failColor, borderRgbPartialColor } from '../../theme-provider/design-tokens';
3
+ import { applicationBackgroundColor, bodyFont, bodyFontColor, bodyDisabledFontColor, borderHoverColor, borderWidth, controlHeight, iconSize, popupBorderColor, popupBoxShadowColor, smallDelay, smallPadding, borderRgbPartialColor, standardPadding } from '../../theme-provider/design-tokens';
4
+ import { appearanceBehavior } from '../../utilities/style/appearance';
4
5
  import { focusVisible } from '../../utilities/style/focus';
6
+ import { DropdownAppearance } from './types';
5
7
  export const styles = css `
6
8
  ${display('inline-flex')}
7
9
 
@@ -55,10 +57,6 @@ export const styles = css `
55
57
  transition: width ${smallDelay} ease-in;
56
58
  }
57
59
 
58
- :host(.invalid)::after {
59
- border-bottom-color: ${failColor};
60
- }
61
-
62
60
  @media (prefers-reduced-motion) {
63
61
  :host::after {
64
62
  transition-duration: 0s;
@@ -81,10 +79,9 @@ export const styles = css `
81
79
  display: flex;
82
80
  min-height: 100%;
83
81
  width: 100%;
84
- border-bottom: ${borderWidth} solid ${bodyDisabledFontColor};
82
+ border: 0px solid rgba(${borderRgbPartialColor}, 0.3);
85
83
  background-color: transparent;
86
- padding-left: 8px;
87
- padding-bottom: 1px;
84
+ padding: ${borderWidth};
88
85
  }
89
86
 
90
87
  :host(.open:not(:hover)) .control {
@@ -147,6 +144,12 @@ export const styles = css `
147
144
  white-space: nowrap;
148
145
  text-overflow: ellipsis;
149
146
  overflow: hidden;
147
+ padding: 0px;
148
+ padding-left: calc(${standardPadding} / 2);
149
+ }
150
+
151
+ .selected-value[disabled]::placeholder {
152
+ color: ${bodyDisabledFontColor};
150
153
  }
151
154
 
152
155
  .indicator {
@@ -186,5 +189,32 @@ export const styles = css `
186
189
  ::slotted(option) {
187
190
  flex: none;
188
191
  }
189
- `;
192
+ `.withBehaviors(appearanceBehavior(DropdownAppearance.underline, css `
193
+ .control {
194
+ border-bottom-width: ${borderWidth};
195
+ padding-bottom: 0;
196
+ }
197
+
198
+ :host([disabled]) .control {
199
+ border-color: rgba(${borderRgbPartialColor}, 0.1);
200
+ }
201
+ `), appearanceBehavior(DropdownAppearance.outline, css `
202
+ .control {
203
+ border-width: ${borderWidth};
204
+ padding: 0;
205
+ }
206
+ `), appearanceBehavior(DropdownAppearance.block, css `
207
+ .control {
208
+ background-color: rgba(${borderRgbPartialColor}, 0.1);
209
+ }
210
+
211
+ .control:focus-within {
212
+ border-bottom-width: ${borderWidth};
213
+ padding-bottom: 0;
214
+ }
215
+
216
+ :host([disabled]) .control {
217
+ background-color: rgba(${borderRgbPartialColor}, 0.07);
218
+ }
219
+ `));
190
220
  //# sourceMappingURL=styles.js.map
@@ -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,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACH,0BAA0B,EAC1B,QAAQ,EACR,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,SAAS,EACT,qBAAqB,EACxB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,aAAa,CAAC;;;;iBAIX,aAAa;gBACd,QAAQ;kBACN,aAAa;;;;;;;mDAOoB,WAAW;;;;;;;;uBAQvC,WAAW;;;;yBAIT,gBAAgB;;4BAEb,UAAU;;;;;;;;;YAS1B,YAAY;;;;;;;4BAOI,WAAW;;;;yBAId,gBAAgB;;4BAEb,UAAU;;;;+BAIP,SAAS;;;;;;;;;;YAU5B,YAAY;;;;;;;;;;;;;;;yBAeC,WAAW,UAAU,qBAAqB;;;;;;;+BAOpC,gBAAgB;;;;;iBAK9B,qBAAqB;6BACT,qBAAqB;;;;;;;;;;;wCAWV,YAAY;;;;;;;kCAOlB,mBAAmB;4BACzB,gBAAgB;4BAChB,0BAA0B;;;;;;;;;;;;;;;;;;;kBAmBpC,aAAa;;;;oBAIX,aAAa,MAAM,YAAY;;;;;;;;;;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6BAWtB,eAAe;;;;iBAI3B,qBAAqB;;;;;;;;;;;;;iBAarB,QAAQ;kBACP,QAAQ;gBACV,aAAa;;;;gBAIb,qBAAqB;;;;;;;;;;;;;;;;;;;;;CAqBpC,CAAC,aAAa,CACP,kBAAkB,CACd,kBAAkB,CAAC,SAAS,EAC5B,GAAG,CAAA;;uCAEwB,WAAW;;;;;qCAKb,qBAAqB;;SAEjD,CACA,EACD,kBAAkB,CACd,kBAAkB,CAAC,OAAO,EAC1B,GAAG,CAAA;;gCAEiB,WAAW;;;SAGlC,CACA,EACD,kBAAkB,CACd,kBAAkB,CAAC,KAAK,EACxB,GAAG,CAAA;;yCAE0B,qBAAqB;;;;uCAIvB,WAAW;;;;;yCAKT,qBAAqB;;SAErD,CACA,CACJ,CAAC"}
@@ -1,40 +1,6 @@
1
1
  import { css } from '@microsoft/fast-element';
2
2
  import { styles as dropdownStyles } from '../patterns/dropdown/styles';
3
- import { appearanceBehavior } from '../utilities/style/appearance';
4
- import { DropdownAppearance } from '../patterns/dropdown/types';
5
- import { borderWidth, controlHeight, borderRgbPartialColor, standardPadding } from '../theme-provider/design-tokens';
6
3
  export const styles = css `
7
4
  ${dropdownStyles}
8
- `.withBehaviors(appearanceBehavior(DropdownAppearance.underline, css `
9
- .control {
10
- padding-top: ${borderWidth};
11
- padding-left: calc(${borderWidth} + ${standardPadding} / 2);
12
- padding-right: ${borderWidth};
13
- }
14
-
15
- :host([disabled]) .control {
16
- border-color: rgba(${borderRgbPartialColor}, 0.1);
17
- }
18
- `), appearanceBehavior(DropdownAppearance.outline, css `
19
- .control {
20
- border: ${borderWidth} solid rgba(${borderRgbPartialColor}, 0.3);
21
- }
22
-
23
- :host(.invalid) .errortext {
24
- top: calc(${controlHeight} - ${borderWidth});
25
- }
26
- `), appearanceBehavior(DropdownAppearance.block, css `
27
- .control {
28
- background-color: rgba(${borderRgbPartialColor}, 0.1);
29
- padding-left: calc(${borderWidth} + ${standardPadding} / 2);
30
- padding-right: ${borderWidth};
31
- padding-bottom: calc(${borderWidth});
32
- border-bottom: ${borderWidth}
33
- rgba(${borderRgbPartialColor}, 0.07);
34
- }
35
-
36
- :host([disabled]) .control {
37
- background-color: rgba(${borderRgbPartialColor}, 0.07);
38
- }
39
- `));
5
+ `;
40
6
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/select/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACH,WAAW,EACX,aAAa,EACb,qBAAqB,EACrB,eAAe,EAClB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,cAAc;CACnB,CAAC,aAAa,CACP,kBAAkB,CACd,kBAAkB,CAAC,SAAS,EAC5B,GAAG,CAAA;;+BAEgB,WAAW;qCACL,WAAW,MAAM,eAAe;iCACpC,WAAW;;;;qCAIP,qBAAqB;;SAEjD,CACA,EACD,kBAAkB,CACd,kBAAkB,CAAC,OAAO,EAC1B,GAAG,CAAA;;0BAEW,WAAW,eAAe,qBAAqB;;;;4BAI7C,aAAa,MAAM,WAAW;;SAEjD,CACA,EACD,kBAAkB,CACd,kBAAkB,CAAC,KAAK,EACxB,GAAG,CAAA;;yCAE0B,qBAAqB;qCACzB,WAAW,MAAM,eAAe;iCACpC,WAAW;uCACL,WAAW;iCACjB,WAAW;2BACjB,qBAAqB;;;;yCAIP,qBAAqB;;SAErD,CACA,CACJ,CAAC"}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/select/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,MAAM,IAAI,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEvE,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,cAAc;CACnB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ni/nimble-components",
3
- "version": "11.8.4",
3
+ "version": "11.10.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",