@ni/spright-components 6.9.0 → 6.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.
@@ -4,10 +4,20 @@ declare global {
4
4
  'spright-chat-input': ChatInput;
5
5
  }
6
6
  }
7
+ declare const ChatInput_base: (abstract new (...args: any[]) => {
8
+ errorText?: string;
9
+ errorVisible: boolean;
10
+ errorHasOverflow: boolean;
11
+ readonly $fastController: import("@ni/fast-element").Controller;
12
+ $emit(type: string, detail?: any, options?: Omit<CustomEventInit, "detail">): boolean | void;
13
+ connectedCallback(): void;
14
+ disconnectedCallback(): void;
15
+ attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
16
+ }) & typeof FoundationElement;
7
17
  /**
8
18
  * A Spright component for composing and sending a chat message
9
19
  */
10
- export declare class ChatInput extends FoundationElement {
20
+ export declare class ChatInput extends ChatInput_base {
11
21
  placeholder?: string;
12
22
  sendButtonLabel?: string;
13
23
  stopButtonLabel?: string;
@@ -23,6 +33,13 @@ export declare class ChatInput extends FoundationElement {
23
33
  * @internal
24
34
  */
25
35
  disableSendButton: boolean;
36
+ /**
37
+ * The width of the vertical scrollbar, if displayed.
38
+ * @internal
39
+ */
40
+ scrollbarWidth: number;
41
+ private resizeObserver?;
42
+ private updateScrollbarWidthQueued;
26
43
  /**
27
44
  * @internal
28
45
  */
@@ -31,6 +48,10 @@ export declare class ChatInput extends FoundationElement {
31
48
  * @internal
32
49
  */
33
50
  textAreaInputHandler(): void;
51
+ /**
52
+ * @internal
53
+ */
54
+ placeholderChanged(): void;
34
55
  /**
35
56
  * @internal
36
57
  */
@@ -39,6 +60,10 @@ export declare class ChatInput extends FoundationElement {
39
60
  * @internal
40
61
  */
41
62
  connectedCallback(): void;
63
+ /**
64
+ * @internal
65
+ */
66
+ disconnectedCallback(): void;
42
67
  /**
43
68
  * @internal
44
69
  */
@@ -49,5 +74,9 @@ export declare class ChatInput extends FoundationElement {
49
74
  stopButtonClickHandler(): void;
50
75
  private shouldDisableSendButton;
51
76
  private resetInput;
77
+ private onResize;
78
+ private queueUpdateScrollbarWidth;
79
+ private updateScrollbarWidth;
52
80
  }
53
81
  export declare const chatInputTag = "spright-chat-input";
82
+ export {};
@@ -1,13 +1,14 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { DesignSystem, FoundationElement } from '@ni/fast-foundation';
3
3
  import { keyEnter } from '@ni/fast-web-utilities';
4
- import { attr, nullableNumberConverter, observable } from '@ni/fast-element';
4
+ import { attr, nullableNumberConverter, observable, DOM } from '@ni/fast-element';
5
+ import { mixinErrorPattern } from '@ni/nimble-components/dist/esm/patterns/error/types';
5
6
  import { styles } from './styles';
6
7
  import { template } from './template';
7
8
  /**
8
9
  * A Spright component for composing and sending a chat message
9
10
  */
10
- export class ChatInput extends FoundationElement {
11
+ export class ChatInput extends mixinErrorPattern(FoundationElement) {
11
12
  constructor() {
12
13
  super(...arguments);
13
14
  this.value = '';
@@ -17,6 +18,12 @@ export class ChatInput extends FoundationElement {
17
18
  * @internal
18
19
  */
19
20
  this.disableSendButton = true;
21
+ /**
22
+ * The width of the vertical scrollbar, if displayed.
23
+ * @internal
24
+ */
25
+ this.scrollbarWidth = -1;
26
+ this.updateScrollbarWidthQueued = false;
20
27
  }
21
28
  /**
22
29
  * @internal
@@ -37,6 +44,19 @@ export class ChatInput extends FoundationElement {
37
44
  textAreaInputHandler() {
38
45
  this.value = this.textArea.value;
39
46
  this.disableSendButton = this.shouldDisableSendButton();
47
+ this.queueUpdateScrollbarWidth();
48
+ }
49
+ // If a property can affect whether a scrollbar is visible, we need to
50
+ // call queueUpdateScrollbarWidth() when it changes. The exceptions are
51
+ // properties that affect size (e.g. height, width, cols, rows), because
52
+ // we already have a ResizeObserver handling those changes. Also,
53
+ // a change to errorVisible cannot cause scrollbar visibility to change,
54
+ // because we always reserve space for the error icon.
55
+ /**
56
+ * @internal
57
+ */
58
+ placeholderChanged() {
59
+ this.queueUpdateScrollbarWidth();
40
60
  }
41
61
  /**
42
62
  * @internal
@@ -45,6 +65,7 @@ export class ChatInput extends FoundationElement {
45
65
  if (this.textArea) {
46
66
  this.textArea.value = this.value;
47
67
  this.disableSendButton = this.shouldDisableSendButton();
68
+ this.queueUpdateScrollbarWidth();
48
69
  }
49
70
  }
50
71
  /**
@@ -54,6 +75,15 @@ export class ChatInput extends FoundationElement {
54
75
  super.connectedCallback();
55
76
  this.textArea.value = this.value;
56
77
  this.disableSendButton = this.shouldDisableSendButton();
78
+ this.resizeObserver = new ResizeObserver(() => this.onResize());
79
+ this.resizeObserver.observe(this);
80
+ }
81
+ /**
82
+ * @internal
83
+ */
84
+ disconnectedCallback() {
85
+ super.disconnectedCallback();
86
+ this.resizeObserver?.disconnect();
57
87
  }
58
88
  /**
59
89
  * @internal
@@ -89,6 +119,22 @@ export class ChatInput extends FoundationElement {
89
119
  this.textArea.focus();
90
120
  }
91
121
  }
122
+ onResize() {
123
+ this.scrollbarWidth = this.textArea.offsetWidth - this.textArea.clientWidth;
124
+ }
125
+ queueUpdateScrollbarWidth() {
126
+ if (!this.$fastController.isConnected) {
127
+ return;
128
+ }
129
+ if (!this.updateScrollbarWidthQueued) {
130
+ this.updateScrollbarWidthQueued = true;
131
+ DOM.queueUpdate(() => this.updateScrollbarWidth());
132
+ }
133
+ }
134
+ updateScrollbarWidth() {
135
+ this.updateScrollbarWidthQueued = false;
136
+ this.scrollbarWidth = this.textArea.offsetWidth - this.textArea.clientWidth;
137
+ }
92
138
  }
93
139
  __decorate([
94
140
  attr
@@ -117,6 +163,9 @@ __decorate([
117
163
  __decorate([
118
164
  observable
119
165
  ], ChatInput.prototype, "disableSendButton", void 0);
166
+ __decorate([
167
+ observable
168
+ ], ChatInput.prototype, "scrollbarWidth", void 0);
120
169
  const sprightChatInput = ChatInput.compose({
121
170
  baseName: 'chat-input',
122
171
  template,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/chat/input/index.ts"],"names":[],"mappings":";AAAA,OAA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zB;IADN,IAAI;wCACa;AAGF;IADf,IAAI,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;2CAClC;AAG3B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;4CACtC;AAGxB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;6CACzB;AAMnB;IADN,UAAU;2CAC2B;AAM/B;IADN,UAAU;oDACqB;AAkFpC,MAAM,gBAAgB,GAAG,SAAS,CAAC,OAAO,CAAC;IACvC,QAAQ,EAAE,YAAY;IACtB,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC","sourcesContent":["import { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport { keyEnter } from '@ni/fast-web-utilities';\nimport { attr, nullableNumberConverter, observable } from '@ni/fast-element';\nimport { styles } from './styles';\nimport { template } from './template';\nimport type { ChatInputSendEventDetail } from './types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'spright-chat-input': ChatInput;\n }\n}\n\n/**\n * A Spright component for composing and sending a chat message\n */\nexport class ChatInput extends FoundationElement {\n @attr\n public placeholder?: string;\n\n @attr({ attribute: 'send-button-label' })\n public sendButtonLabel?: string;\n\n @attr({ attribute: 'stop-button-label' })\n public stopButtonLabel?: string;\n\n @attr\n public value = '';\n\n @attr({ attribute: 'tabindex', converter: nullableNumberConverter })\n public override tabIndex!: number;\n\n @attr({ attribute: 'maxlength', converter: nullableNumberConverter })\n public maxLength?: number = -1;\n\n @attr({ attribute: 'processing', mode: 'boolean' })\n public processing = false;\n\n /**\n * @internal\n */\n @observable\n public textArea?: HTMLTextAreaElement;\n\n /**\n * @internal\n */\n @observable\n public disableSendButton = true;\n\n /**\n * @internal\n */\n public textAreaKeydownHandler(e: KeyboardEvent): boolean {\n if (e.key === keyEnter && !e.shiftKey) {\n if (this.processing) {\n return false;\n }\n this.sendButtonClickHandler();\n return false;\n }\n return true;\n }\n\n /**\n * @internal\n */\n public textAreaInputHandler(): void {\n this.value = this.textArea!.value;\n this.disableSendButton = this.shouldDisableSendButton();\n }\n\n /**\n * @internal\n */\n public valueChanged(): void {\n if (this.textArea) {\n this.textArea.value = this.value;\n this.disableSendButton = this.shouldDisableSendButton();\n }\n }\n\n /**\n * @internal\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.textArea!.value = this.value;\n this.disableSendButton = this.shouldDisableSendButton();\n }\n\n /**\n * @internal\n */\n public sendButtonClickHandler(): void {\n if (this.shouldDisableSendButton()) {\n return;\n }\n const eventDetail: ChatInputSendEventDetail = {\n text: this.textArea!.value\n };\n this.resetInput();\n this.$emit('send', eventDetail);\n }\n\n /**\n * @internal\n */\n public stopButtonClickHandler(): void {\n if (!this.processing) {\n return;\n }\n this.$emit('stop');\n this.textArea?.blur();\n }\n\n private shouldDisableSendButton(): boolean {\n return this.textArea!.value.length === 0;\n }\n\n private resetInput(): void {\n this.value = '';\n this.disableSendButton = true;\n if (this.textArea) {\n this.textArea.value = '';\n this.textArea.focus();\n }\n }\n}\n\nconst sprightChatInput = ChatInput.compose({\n baseName: 'chat-input',\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n }\n});\n\nDesignSystem.getOrCreate().withPrefix('spright').register(sprightChatInput());\nexport const chatInputTag = 'spright-chat-input';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/chat/input/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,QAAQ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;wCACa;AAGF;IADf,IAAI,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;2CAClC;AAG3B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;4CACtC;AAGxB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;6CACzB;AAMnB;IADN,UAAU;2CAC2B;AAM/B;IADN,UAAU;oDACqB;AAOzB;IADN,UAAU;iDACgB;AAkI/B,MAAM,gBAAgB,GAAG,SAAS,CAAC,OAAO,CAAC;IACvC,QAAQ,EAAE,YAAY;IACtB,QAAQ;IACR,MAAM;IACN,aAAa,EAAE;QACX,cAAc,EAAE,IAAI;KACvB;CACJ,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAC","sourcesContent":["import { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport { keyEnter } from '@ni/fast-web-utilities';\nimport { attr, nullableNumberConverter, observable, DOM } from '@ni/fast-element';\nimport { mixinErrorPattern } from '@ni/nimble-components/dist/esm/patterns/error/types';\nimport { styles } from './styles';\nimport { template } from './template';\nimport type { ChatInputSendEventDetail } from './types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'spright-chat-input': ChatInput;\n }\n}\n\n/**\n * A Spright component for composing and sending a chat message\n */\nexport class ChatInput extends mixinErrorPattern(FoundationElement) {\n @attr\n public placeholder?: string;\n\n @attr({ attribute: 'send-button-label' })\n public sendButtonLabel?: string;\n\n @attr({ attribute: 'stop-button-label' })\n public stopButtonLabel?: string;\n\n @attr\n public value = '';\n\n @attr({ attribute: 'tabindex', converter: nullableNumberConverter })\n public override tabIndex!: number;\n\n @attr({ attribute: 'maxlength', converter: nullableNumberConverter })\n public maxLength?: number = -1;\n\n @attr({ attribute: 'processing', mode: 'boolean' })\n public processing = false;\n\n /**\n * @internal\n */\n @observable\n public textArea?: HTMLTextAreaElement;\n\n /**\n * @internal\n */\n @observable\n public disableSendButton = true;\n\n /**\n * The width of the vertical scrollbar, if displayed.\n * @internal\n */\n @observable\n public scrollbarWidth = -1;\n\n private resizeObserver?: ResizeObserver;\n private updateScrollbarWidthQueued = false;\n\n /**\n * @internal\n */\n public textAreaKeydownHandler(e: KeyboardEvent): boolean {\n if (e.key === keyEnter && !e.shiftKey) {\n if (this.processing) {\n return false;\n }\n this.sendButtonClickHandler();\n return false;\n }\n return true;\n }\n\n /**\n * @internal\n */\n public textAreaInputHandler(): void {\n this.value = this.textArea!.value;\n this.disableSendButton = this.shouldDisableSendButton();\n this.queueUpdateScrollbarWidth();\n }\n\n // If a property can affect whether a scrollbar is visible, we need to\n // call queueUpdateScrollbarWidth() when it changes. The exceptions are\n // properties that affect size (e.g. height, width, cols, rows), because\n // we already have a ResizeObserver handling those changes. Also,\n // a change to errorVisible cannot cause scrollbar visibility to change,\n // because we always reserve space for the error icon.\n\n /**\n * @internal\n */\n public placeholderChanged(): void {\n this.queueUpdateScrollbarWidth();\n }\n\n /**\n * @internal\n */\n public valueChanged(): void {\n if (this.textArea) {\n this.textArea.value = this.value;\n this.disableSendButton = this.shouldDisableSendButton();\n this.queueUpdateScrollbarWidth();\n }\n }\n\n /**\n * @internal\n */\n public override connectedCallback(): void {\n super.connectedCallback();\n this.textArea!.value = this.value;\n this.disableSendButton = this.shouldDisableSendButton();\n this.resizeObserver = new ResizeObserver(() => this.onResize());\n this.resizeObserver.observe(this);\n }\n\n /**\n * @internal\n */\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.resizeObserver?.disconnect();\n }\n\n /**\n * @internal\n */\n public sendButtonClickHandler(): void {\n if (this.shouldDisableSendButton()) {\n return;\n }\n const eventDetail: ChatInputSendEventDetail = {\n text: this.textArea!.value\n };\n this.resetInput();\n this.$emit('send', eventDetail);\n }\n\n /**\n * @internal\n */\n public stopButtonClickHandler(): void {\n if (!this.processing) {\n return;\n }\n this.$emit('stop');\n this.textArea?.blur();\n }\n\n private shouldDisableSendButton(): boolean {\n return this.textArea!.value.length === 0;\n }\n\n private resetInput(): void {\n this.value = '';\n this.disableSendButton = true;\n if (this.textArea) {\n this.textArea.value = '';\n this.textArea.focus();\n }\n }\n\n private onResize(): void {\n this.scrollbarWidth = this.textArea!.offsetWidth - this.textArea!.clientWidth;\n }\n\n private queueUpdateScrollbarWidth(): void {\n if (!this.$fastController.isConnected) {\n return;\n }\n if (!this.updateScrollbarWidthQueued) {\n this.updateScrollbarWidthQueued = true;\n DOM.queueUpdate(() => this.updateScrollbarWidth());\n }\n }\n\n private updateScrollbarWidth(): void {\n this.updateScrollbarWidthQueued = false;\n this.scrollbarWidth = this.textArea!.offsetWidth - this.textArea!.clientWidth;\n }\n}\n\nconst sprightChatInput = ChatInput.compose({\n baseName: 'chat-input',\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true\n }\n});\n\nDesignSystem.getOrCreate().withPrefix('spright').register(sprightChatInput());\nexport const chatInputTag = 'spright-chat-input';\n"]}
@@ -1,8 +1,10 @@
1
1
  import { css } from '@ni/fast-element';
2
- import { applicationBackgroundColor, bodyFont, bodyFontColor, borderWidth, controlLabelFontColor, elevation2BoxShadow, mediumPadding, popupBorderColor, borderHoverColor, smallDelay } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
2
+ import { applicationBackgroundColor, bodyFont, bodyFontColor, borderWidth, controlLabelFontColor, elevation2BoxShadow, mediumPadding, popupBorderColor, borderHoverColor, smallDelay, failColor } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
3
+ import { styles as errorStyles } from '@ni/nimble-components/dist/esm/patterns/error/styles';
3
4
  import { display } from '../../utilities/style/display';
4
5
  export const styles = css `
5
6
  ${display('flex')}
7
+ ${errorStyles}
6
8
 
7
9
  :host {
8
10
  width: 100%;
@@ -44,6 +46,22 @@ export const styles = css `
44
46
  border-bottom-color: ${borderHoverColor};
45
47
  }
46
48
 
49
+ :host([error-visible]) .container::after {
50
+ border-bottom-color: ${failColor};
51
+ }
52
+
53
+ :host([error-visible]) .container {
54
+ border-bottom-color: ${failColor};
55
+ }
56
+
57
+ :host([error-visible]:hover) .container::after {
58
+ border-bottom-color: ${failColor};
59
+ }
60
+
61
+ :host([error-visible]:focus-within) .container {
62
+ border-bottom-color: ${failColor};
63
+ }
64
+
47
65
  @media (prefers-reduced-motion) {
48
66
  .container::after {
49
67
  transition-duration: 0s;
@@ -70,6 +88,17 @@ export const styles = css `
70
88
  color: ${controlLabelFontColor};
71
89
  }
72
90
 
91
+ :host([error-visible]) .error-icon {
92
+ display: none;
93
+ }
94
+
95
+ :host([error-visible]) .error-icon.scrollbar-width-calculated {
96
+ display: inline-flex;
97
+ position: absolute;
98
+ top: ${mediumPadding};
99
+ right: var(--ni-private-scrollbar-width);
100
+ }
101
+
73
102
  .action-button {
74
103
  align-self: flex-end;
75
104
  width: 80px;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/chat/input/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,0BAA0B,EAC1B,QAAQ,EACR,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACb,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;;;;;;mDAM8B,WAAW;;;;;;;;;;4BAUlC,0BAA0B;kBACpC,WAAW,UAAU,gBAAgB;sBACjC,mBAAmB;;;;;;4BAMb,WAAW;;;;yBAId,gBAAgB;;4BAEb,UAAU;;;;;4BAKV,UAAU;;;;+BAIP,gBAAgB;;;;;;;;;;gBAU/B,QAAQ;iBACP,aAAa;;;;;;qCAMO,aAAa;;;;;mBAK/B,aAAa;;;;iBAIf,qBAAqB;;;;;;kBAMpB,aAAa;;CAE9B,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n applicationBackgroundColor,\n bodyFont,\n bodyFontColor,\n borderWidth,\n controlLabelFontColor,\n elevation2BoxShadow,\n mediumPadding,\n popupBorderColor,\n borderHoverColor,\n smallDelay\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { display } from '../../utilities/style/display';\n\nexport const styles = css`\n ${display('flex')}\n\n :host {\n width: 100%;\n height: auto;\n outline: none;\n --ni-private-hover-indicator-width: calc(${borderWidth} + 1px);\n }\n\n .container {\n display: flex;\n flex-direction: column;\n position: relative;\n width: 100%;\n height: 100%;\n\n background-color: ${applicationBackgroundColor};\n border: ${borderWidth} solid ${popupBorderColor};\n box-shadow: ${elevation2BoxShadow};\n }\n\n .container::after {\n content: '';\n position: absolute;\n bottom: calc(-1 * ${borderWidth});\n width: 0px;\n height: 0px;\n align-self: center;\n border-bottom: ${borderHoverColor}\n var(--ni-private-hover-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n :host(:hover) .container::after {\n width: 100%;\n transition: width ${smallDelay} ease-in;\n }\n\n :host(:focus-within) .container {\n border-bottom-color: ${borderHoverColor};\n }\n\n @media (prefers-reduced-motion) {\n .container::after {\n transition-duration: 0s;\n }\n }\n\n textarea {\n font: ${bodyFont};\n color: ${bodyFontColor};\n background-color: transparent;\n\n width: 100%;\n resize: none;\n height: auto;\n max-height: calc(6lh + 2 * ${mediumPadding});\n field-sizing: content;\n\n border-width: 0px;\n outline: none;\n padding: ${mediumPadding};\n }\n\n textarea::placeholder {\n color: ${controlLabelFontColor};\n }\n\n .action-button {\n align-self: flex-end;\n width: 80px;\n margin: ${mediumPadding};\n }\n`;\n"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/chat/input/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,0BAA0B,EAC1B,QAAQ,EACR,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,SAAS,EACZ,MAAM,6DAA6D,CAAC;AACrE,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,sDAAsD,CAAC;AAC7F,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAExD,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;MACnB,OAAO,CAAC,MAAM,CAAC;MACf,WAAW;;;;;;mDAMkC,WAAW;;;;;;;;;;4BAUlC,0BAA0B;kBACpC,WAAW,UAAU,gBAAgB;sBACjC,mBAAmB;;;;;;4BAMb,WAAW;;;;yBAId,gBAAgB;;4BAEb,UAAU;;;;;4BAKV,UAAU;;;;+BAIP,gBAAgB;;;;+BAIhB,SAAS;;;;+BAIT,SAAS;;;;+BAIT,SAAS;;;;+BAIT,SAAS;;;;;;;;;;gBAUxB,QAAQ;iBACP,aAAa;;;;;;qCAMO,aAAa;;;;;mBAK/B,aAAa;;;;iBAIf,qBAAqB;;;;;;;;;;eAUvB,aAAa;;;;;;;kBAOV,aAAa;;CAE9B,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n applicationBackgroundColor,\n bodyFont,\n bodyFontColor,\n borderWidth,\n controlLabelFontColor,\n elevation2BoxShadow,\n mediumPadding,\n popupBorderColor,\n borderHoverColor,\n smallDelay,\n failColor\n} from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';\nimport { styles as errorStyles } from '@ni/nimble-components/dist/esm/patterns/error/styles';\nimport { display } from '../../utilities/style/display';\n\nexport const styles = css`\n ${display('flex')}\n ${errorStyles}\n\n :host {\n width: 100%;\n height: auto;\n outline: none;\n --ni-private-hover-indicator-width: calc(${borderWidth} + 1px);\n }\n\n .container {\n display: flex;\n flex-direction: column;\n position: relative;\n width: 100%;\n height: 100%;\n\n background-color: ${applicationBackgroundColor};\n border: ${borderWidth} solid ${popupBorderColor};\n box-shadow: ${elevation2BoxShadow};\n }\n\n .container::after {\n content: '';\n position: absolute;\n bottom: calc(-1 * ${borderWidth});\n width: 0px;\n height: 0px;\n align-self: center;\n border-bottom: ${borderHoverColor}\n var(--ni-private-hover-indicator-width) solid;\n transition: width ${smallDelay} ease-in;\n }\n\n :host(:hover) .container::after {\n width: 100%;\n transition: width ${smallDelay} ease-in;\n }\n\n :host(:focus-within) .container {\n border-bottom-color: ${borderHoverColor};\n }\n\n :host([error-visible]) .container::after {\n border-bottom-color: ${failColor};\n }\n \n :host([error-visible]) .container {\n border-bottom-color: ${failColor};\n }\n\n :host([error-visible]:hover) .container::after {\n border-bottom-color: ${failColor};\n }\n\n :host([error-visible]:focus-within) .container {\n border-bottom-color: ${failColor};\n }\n\n @media (prefers-reduced-motion) {\n .container::after {\n transition-duration: 0s;\n }\n }\n\n textarea {\n font: ${bodyFont};\n color: ${bodyFontColor};\n background-color: transparent;\n\n width: 100%;\n resize: none;\n height: auto;\n max-height: calc(6lh + 2 * ${mediumPadding});\n field-sizing: content;\n\n border-width: 0px;\n outline: none;\n padding: ${mediumPadding};\n }\n\n textarea::placeholder {\n color: ${controlLabelFontColor};\n }\n\n :host([error-visible]) .error-icon {\n display: none;\n }\n\n :host([error-visible]) .error-icon.scrollbar-width-calculated {\n display: inline-flex;\n position: absolute;\n top: ${mediumPadding};\n right: var(--ni-private-scrollbar-width);\n }\n\n .action-button {\n align-self: flex-end;\n width: 80px;\n margin: ${mediumPadding};\n }\n`;\n"]}
@@ -2,6 +2,8 @@ import { html, ref, when } from '@ni/fast-element';
2
2
  import { buttonTag } from '@ni/nimble-components/dist/esm/button';
3
3
  import { iconPaperPlaneTag } from '@ni/nimble-components/dist/esm/icons/paper-plane';
4
4
  import { iconStopSquareTag } from '@ni/nimble-components/dist/esm/icons/stop-square';
5
+ import { iconExclamationMarkTag } from '@ni/nimble-components/dist/esm/icons/exclamation-mark';
6
+ import { errorTextTemplate } from '@ni/nimble-components/dist/esm/patterns/error/template';
5
7
  export const template = html `
6
8
  <div class="container">
7
9
  <textarea
@@ -26,5 +28,11 @@ export const template = html `
26
28
  ${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}
27
29
  ${when(x => x.processing, html `<${iconStopSquareTag} slot="start"></${iconStopSquareTag}>`, html `<${iconPaperPlaneTag} slot="start"></${iconPaperPlaneTag}>`)}
28
30
  </${buttonTag}>
31
+ <${iconExclamationMarkTag}
32
+ severity="error"
33
+ class="error-icon ${x => (x.scrollbarWidth >= 0 ? 'scrollbar-width-calculated' : '')}"
34
+ style="--ni-private-scrollbar-width: ${x => x.scrollbarWidth}px;"
35
+ ></${iconExclamationMarkTag}>
36
+ ${errorTextTemplate}
29
37
  </div>`;
30
38
  //# sourceMappingURL=template.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/chat/input/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AAGrF,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAW;;;UAG7B,GAAG,CAAC,UAAU,CAAC;uBACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW;;oBAErB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;qBACd,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;oBACjB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,KAAsB,CAAC;kBAC9D,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAoB,EAAE;;OAExC,SAAS;;;8BAGc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;oBACpD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC;iBACpD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB,EAAE,CAAC;oBAC1E,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;gBACnB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;;;UAGjE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC;UAC3D,IAAI,CACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,EACjB,IAAI,CAAA,IAAI,iBAAiB,mBAAmB,iBAAiB,GAAG,EAChE,IAAI,CAAA,IAAI,iBAAiB,mBAAmB,iBAAiB,GAAG,CACnE;QACD,SAAS;OACV,CAAC","sourcesContent":["import { html, ref, when } from '@ni/fast-element';\nimport { buttonTag } from '@ni/nimble-components/dist/esm/button';\nimport { iconPaperPlaneTag } from '@ni/nimble-components/dist/esm/icons/paper-plane';\nimport { iconStopSquareTag } from '@ni/nimble-components/dist/esm/icons/stop-square';\nimport type { ChatInput } from '.';\n\nexport const template = html<ChatInput>`\n<div class=\"container\">\n <textarea\n ${ref('textArea')}\n placeholder=\"${x => x.placeholder}\"\n rows=\"1\"\n tabindex=\"${x => x.tabIndex}\"\n maxlength=\"${x => x.maxLength}\"\n @keydown=\"${(x, c) => x.textAreaKeydownHandler(c.event as KeyboardEvent)}\"\n @input=\"${x => x.textAreaInputHandler()}\"\n ></textarea>\n <${buttonTag}\n class=\"action-button\"\n appearance=\"block\"\n appearance-variant=\"${x => (x.processing ? 'primary' : 'accent')}\"\n ?disabled=${x => (x.processing ? false : x.disableSendButton)}\n @click=${x => (x.processing ? x.stopButtonClickHandler() : x.sendButtonClickHandler())}\n tabindex=\"${x => x.tabIndex}\"\n title=${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}\n content-hidden\n >\n ${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}\n ${when(\n x => x.processing,\n html`<${iconStopSquareTag} slot=\"start\"></${iconStopSquareTag}>`,\n html`<${iconPaperPlaneTag} slot=\"start\"></${iconPaperPlaneTag}>`\n )}\n </${buttonTag}>\n</div>`;\n"]}
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/chat/input/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAG3F,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAW;;;UAG7B,GAAG,CAAC,UAAU,CAAC;uBACF,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAA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C,cAAc,IAAI,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,CAAC;+CAC7C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc;SAC3D,sBAAsB;MACzB,iBAAiB;OAChB,CAAC","sourcesContent":["import { html, ref, when } from '@ni/fast-element';\nimport { buttonTag } from '@ni/nimble-components/dist/esm/button';\nimport { iconPaperPlaneTag } from '@ni/nimble-components/dist/esm/icons/paper-plane';\nimport { iconStopSquareTag } from '@ni/nimble-components/dist/esm/icons/stop-square';\nimport { iconExclamationMarkTag } from '@ni/nimble-components/dist/esm/icons/exclamation-mark';\nimport { errorTextTemplate } from '@ni/nimble-components/dist/esm/patterns/error/template';\nimport type { ChatInput } from '.';\n\nexport const template = html<ChatInput>`\n<div class=\"container\">\n <textarea\n ${ref('textArea')}\n placeholder=\"${x => x.placeholder}\"\n rows=\"1\"\n tabindex=\"${x => x.tabIndex}\"\n maxlength=\"${x => x.maxLength}\"\n @keydown=\"${(x, c) => x.textAreaKeydownHandler(c.event as KeyboardEvent)}\"\n @input=\"${x => x.textAreaInputHandler()}\"\n ></textarea>\n <${buttonTag}\n class=\"action-button\"\n appearance=\"block\"\n appearance-variant=\"${x => (x.processing ? 'primary' : 'accent')}\"\n ?disabled=${x => (x.processing ? false : x.disableSendButton)}\n @click=${x => (x.processing ? x.stopButtonClickHandler() : x.sendButtonClickHandler())}\n tabindex=\"${x => x.tabIndex}\"\n title=${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}\n content-hidden\n >\n ${x => (x.processing ? x.stopButtonLabel : x.sendButtonLabel)}\n ${when(\n x => x.processing,\n html`<${iconStopSquareTag} slot=\"start\"></${iconStopSquareTag}>`,\n html`<${iconPaperPlaneTag} slot=\"start\"></${iconPaperPlaneTag}>`\n )}\n </${buttonTag}>\n <${iconExclamationMarkTag}\n severity=\"error\"\n class=\"error-icon ${x => (x.scrollbarWidth >= 0 ? 'scrollbar-width-calculated' : '')}\"\n style=\"--ni-private-scrollbar-width: ${x => x.scrollbarWidth}px;\"\n ></${iconExclamationMarkTag}>\n ${errorTextTemplate}\n</div>`;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ni/spright-components",
3
- "version": "6.9.0",
3
+ "version": "6.10.0",
4
4
  "description": "NI Spright Components",
5
5
  "scripts": {
6
6
  "build": "tsc -p ./tsconfig.json",
@@ -37,7 +37,7 @@
37
37
  "@ni/fast-element": "^10.1.0",
38
38
  "@ni/fast-foundation": "^10.1.5",
39
39
  "@ni/fast-web-utilities": "^10.0.0",
40
- "@ni/nimble-components": "^35.2.3",
40
+ "@ni/nimble-components": "^35.3.0",
41
41
  "tslib": "^2.2.0"
42
42
  },
43
43
  "devDependencies": {