@ni/spright-components 5.5.1 → 5.5.3

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.
@@ -8,5 +8,10 @@ declare global {
8
8
  * A Spright component for displaying a series of chat messages
9
9
  */
10
10
  export declare class ChatConversation extends FoundationElement {
11
+ /** @internal */
12
+ inputEmpty: boolean;
13
+ /** @internal */
14
+ readonly slottedInputElements?: HTMLElement[];
15
+ slottedInputElementsChanged(_prev: HTMLElement[] | undefined, next: HTMLElement[] | undefined): void;
11
16
  }
12
17
  export declare const chatConversationTag = "spright-chat-conversation";
@@ -1,11 +1,27 @@
1
+ import { __decorate } from "tslib";
1
2
  import { DesignSystem, FoundationElement } from '@ni/fast-foundation';
3
+ import { observable } from '@ni/fast-element';
2
4
  import { styles } from './styles';
3
5
  import { template } from './template';
4
6
  /**
5
7
  * A Spright component for displaying a series of chat messages
6
8
  */
7
9
  export class ChatConversation extends FoundationElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ /** @internal */
13
+ this.inputEmpty = true;
14
+ }
15
+ slottedInputElementsChanged(_prev, next) {
16
+ this.inputEmpty = !next?.length;
17
+ }
8
18
  }
19
+ __decorate([
20
+ observable
21
+ ], ChatConversation.prototype, "inputEmpty", void 0);
22
+ __decorate([
23
+ observable
24
+ ], ChatConversation.prototype, "slottedInputElements", void 0);
9
25
  const sprightChatConversation = ChatConversation.compose({
10
26
  baseName: 'chat-conversation',
11
27
  template,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/chat/conversation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;CAAG;AAE1D,MAAM,uBAAuB,GAAG,gBAAgB,CAAC,OAAO,CAAC;IACrD,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,SAAS,CAAC;KACrB,QAAQ,CAAC,uBAAuB,EAAE,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,2BAA2B,CAAC","sourcesContent":["import { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport { styles } from './styles';\nimport { template } from './template';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'spright-chat-conversation': ChatConversation;\n }\n}\n\n/**\n * A Spright component for displaying a series of chat messages\n */\nexport class ChatConversation extends FoundationElement {}\n\nconst sprightChatConversation = ChatConversation.compose({\n baseName: 'chat-conversation',\n template,\n styles\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('spright')\n .register(sprightChatConversation());\nexport const chatConversationTag = 'spright-chat-conversation';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/chat/conversation/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAQtC;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IAAvD;;QACI,gBAAgB;QAET,eAAU,GAAG,IAAI,CAAC;IAY7B,CAAC;IANU,2BAA2B,CAC9B,KAAgC,EAChC,IAA+B;QAE/B,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC;IACpC,CAAC;CACJ;AAZU;IADN,UAAU;oDACc;AAIT;IADf,UAAU;8DAC0C;AAUzD,MAAM,uBAAuB,GAAG,gBAAgB,CAAC,OAAO,CAAC;IACrD,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,SAAS,CAAC;KACrB,QAAQ,CAAC,uBAAuB,EAAE,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,2BAA2B,CAAC","sourcesContent":["import { DesignSystem, FoundationElement } from '@ni/fast-foundation';\nimport { observable } from '@ni/fast-element';\nimport { styles } from './styles';\nimport { template } from './template';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'spright-chat-conversation': ChatConversation;\n }\n}\n\n/**\n * A Spright component for displaying a series of chat messages\n */\nexport class ChatConversation extends FoundationElement {\n /** @internal */\n @observable\n public inputEmpty = true;\n\n /** @internal */\n @observable\n public readonly slottedInputElements?: HTMLElement[];\n\n public slottedInputElementsChanged(\n _prev: HTMLElement[] | undefined,\n next: HTMLElement[] | undefined\n ): void {\n this.inputEmpty = !next?.length;\n }\n}\n\nconst sprightChatConversation = ChatConversation.compose({\n baseName: 'chat-conversation',\n template,\n styles\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('spright')\n .register(sprightChatConversation());\nexport const chatConversationTag = 'spright-chat-conversation';\n"]}
@@ -1,11 +1,13 @@
1
1
  import { css } from '@ni/fast-element';
2
- import { applicationBackgroundColor, mediumPadding } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
2
+ import { applicationBackgroundColor, borderWidth, sectionBackgroundImage, mediumPadding, standardPadding } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
3
3
  import { display } from '../../utilities/style/display';
4
4
  export const styles = css `
5
5
  ${display('flex')}
6
6
 
7
7
  :host {
8
8
  flex-direction: column;
9
+ background: ${applicationBackgroundColor};
10
+ border: ${borderWidth} solid ${applicationBackgroundColor};
9
11
  }
10
12
 
11
13
  .messages {
@@ -14,9 +16,19 @@ export const styles = css `
14
16
  flex-direction: column;
15
17
  justify-content: flex-start;
16
18
  row-gap: 32px;
17
- padding: ${mediumPadding};
18
- background: ${applicationBackgroundColor};
19
+ padding: ${mediumPadding} ${standardPadding} ${mediumPadding}
20
+ ${standardPadding};
21
+ background: ${sectionBackgroundImage};
19
22
  overflow-y: auto;
20
23
  }
24
+
25
+ .input {
26
+ padding: ${borderWidth} ${standardPadding} ${standardPadding}
27
+ ${standardPadding};
28
+ }
29
+
30
+ .input.input-empty {
31
+ padding: 0px ${standardPadding} 0px ${standardPadding};
32
+ }
21
33
  `;
22
34
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/chat/conversation/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,0BAA0B,EAC1B,aAAa,EAChB,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;;;;;;;;;;;;mBAYF,aAAa;sBACV,0BAA0B;;;CAG/C,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n applicationBackgroundColor,\n mediumPadding\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 flex-direction: column;\n }\n\n .messages {\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n row-gap: 32px;\n padding: ${mediumPadding};\n background: ${applicationBackgroundColor};\n overflow-y: auto;\n }\n`;\n"]}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/chat/conversation/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EACH,0BAA0B,EAC1B,WAAW,EACX,sBAAsB,EACtB,aAAa,EACb,eAAe,EAClB,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;;;;sBAIC,0BAA0B;kBAC9B,WAAW,UAAU,0BAA0B;;;;;;;;;mBAS9C,aAAa,IAAI,eAAe,IAAI,aAAa;cACtD,eAAe;sBACP,sBAAsB;;;;;mBAKzB,WAAW,IAAI,eAAe,IAAI,eAAe;cACtD,eAAe;;;;uBAIN,eAAe,QAAQ,eAAe;;CAE5D,CAAC","sourcesContent":["import { css } from '@ni/fast-element';\nimport {\n applicationBackgroundColor,\n borderWidth,\n sectionBackgroundImage,\n mediumPadding,\n standardPadding\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 flex-direction: column;\n background: ${applicationBackgroundColor};\n border: ${borderWidth} solid ${applicationBackgroundColor};\n }\n\n .messages {\n flex: 1;\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n row-gap: 32px;\n padding: ${mediumPadding} ${standardPadding} ${mediumPadding}\n ${standardPadding};\n background: ${sectionBackgroundImage};\n overflow-y: auto;\n }\n\n .input {\n padding: ${borderWidth} ${standardPadding} ${standardPadding}\n ${standardPadding};\n }\n\n .input.input-empty {\n padding: 0px ${standardPadding} 0px ${standardPadding};\n }\n`;\n"]}
@@ -1,8 +1,12 @@
1
- import { html } from '@ni/fast-element';
1
+ import { html, slotted } from '@ni/fast-element';
2
2
  /* eslint-disable @typescript-eslint/indent */
3
3
  // prettier-ignore
4
4
  export const template = html `
5
5
  <div class="messages"><slot></slot></div>
6
- <div class="input"><slot name="input"></slot></div>`;
6
+ <div class="input ${x => (x.inputEmpty ? 'input-empty' : '')}">
7
+ <slot name="input" ${slotted({ property: 'slottedInputElements' })}>
8
+ </slot>
9
+ </div>
10
+ `;
7
11
  /* eslint-enable @typescript-eslint/indent */
8
12
  //# sourceMappingURL=template.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/chat/conversation/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,8CAA8C;AAC9C,kBAAkB;AAClB,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAkB;;oDAEM,CAAC;AACrD,6CAA6C","sourcesContent":["import { html } from '@ni/fast-element';\nimport type { ChatConversation } from '.';\n\n/* eslint-disable @typescript-eslint/indent */\n// prettier-ignore\nexport const template = html<ChatConversation>`\n<div class=\"messages\"><slot></slot></div>\n<div class=\"input\"><slot name=\"input\"></slot></div>`;\n/* eslint-enable @typescript-eslint/indent */\n"]}
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/chat/conversation/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGjD,8CAA8C;AAC9C,kBAAkB;AAClB,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAkB;;oBAE1B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;yBACnC,OAAO,CAAC,EAAE,QAAQ,EAAE,sBAAsB,EAAE,CAAC;;;CAGrE,CAAC;AACF,6CAA6C","sourcesContent":["import { html, slotted } from '@ni/fast-element';\nimport type { ChatConversation } from '.';\n\n/* eslint-disable @typescript-eslint/indent */\n// prettier-ignore\nexport const template = html<ChatConversation>`\n<div class=\"messages\"><slot></slot></div>\n<div class=\"input ${x => (x.inputEmpty ? 'input-empty' : '')}\">\n <slot name=\"input\" ${slotted({ property: 'slottedInputElements' })}>\n </slot>\n</div>\n`;\n/* eslint-enable @typescript-eslint/indent */\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ni/spright-components",
3
- "version": "5.5.1",
3
+ "version": "5.5.3",
4
4
  "description": "NI Spright Components",
5
5
  "scripts": {
6
6
  "build": "npm run build-components && npm run bundle-components",
@@ -51,7 +51,7 @@
51
51
  "@ni/fast-element": "^10.0.0",
52
52
  "@ni/fast-foundation": "^10.0.0",
53
53
  "@ni/fast-web-utilities": "^10.0.0",
54
- "@ni/nimble-components": "^33.11.1",
54
+ "@ni/nimble-components": "^33.12.1",
55
55
  "tslib": "^2.2.0"
56
56
  },
57
57
  "devDependencies": {