@ni/spright-components 6.2.0 → 6.3.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 +53 -8
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +66 -32
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/chat/conversation/index.d.ts +1 -0
- package/dist/esm/chat/conversation/index.js +6 -1
- package/dist/esm/chat/conversation/index.js.map +1 -1
- package/dist/esm/chat/conversation/styles.js +9 -0
- package/dist/esm/chat/conversation/styles.js.map +1 -1
- package/dist/esm/chat/conversation/types.d.ts +9 -0
- package/dist/esm/chat/conversation/types.js +9 -0
- package/dist/esm/chat/conversation/types.js.map +1 -0
- package/dist/esm/chat/input/styles.js +34 -9
- package/dist/esm/chat/input/styles.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { DesignSystem, FoundationElement } from '@ni/fast-foundation';
|
|
3
|
-
import { observable } from '@ni/fast-element';
|
|
3
|
+
import { attr, observable } from '@ni/fast-element';
|
|
4
4
|
import { styles } from './styles';
|
|
5
5
|
import { template } from './template';
|
|
6
|
+
import { ChatConversationAppearance } from './types';
|
|
6
7
|
/**
|
|
7
8
|
* A Spright component for displaying a series of chat messages
|
|
8
9
|
*/
|
|
9
10
|
export class ChatConversation extends FoundationElement {
|
|
10
11
|
constructor() {
|
|
11
12
|
super(...arguments);
|
|
13
|
+
this.appearance = ChatConversationAppearance.default;
|
|
12
14
|
/** @internal */
|
|
13
15
|
this.inputEmpty = true;
|
|
14
16
|
}
|
|
@@ -16,6 +18,9 @@ export class ChatConversation extends FoundationElement {
|
|
|
16
18
|
this.inputEmpty = !next?.length;
|
|
17
19
|
}
|
|
18
20
|
}
|
|
21
|
+
__decorate([
|
|
22
|
+
attr
|
|
23
|
+
], ChatConversation.prototype, "appearance", void 0);
|
|
19
24
|
__decorate([
|
|
20
25
|
observable
|
|
21
26
|
], ChatConversation.prototype, "inputEmpty", void 0);
|
|
@@ -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,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
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,IAAI,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAQrD;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IAAvD;;QAEW,eAAU,GAAG,0BAA0B,CAAC,OAAO,CAAC;QAEvD,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;AAhBU;IADN,IAAI;oDACkD;AAIhD;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 { attr, observable } from '@ni/fast-element';\nimport { styles } from './styles';\nimport { template } from './template';\nimport { ChatConversationAppearance } from './types';\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 @attr\n public appearance = ChatConversationAppearance.default;\n\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"]}
|
|
@@ -10,6 +10,11 @@ export const styles = css `
|
|
|
10
10
|
border: ${borderWidth} solid ${applicationBackgroundColor};
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
:host([appearance='overlay']) {
|
|
14
|
+
background: none;
|
|
15
|
+
border-color: transparent;
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
.messages {
|
|
14
19
|
flex: 1;
|
|
15
20
|
display: flex;
|
|
@@ -22,6 +27,10 @@ export const styles = css `
|
|
|
22
27
|
overflow-y: auto;
|
|
23
28
|
}
|
|
24
29
|
|
|
30
|
+
:host([appearance='overlay']) .messages {
|
|
31
|
+
background: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
25
34
|
.input {
|
|
26
35
|
padding: ${borderWidth} ${standardPadding} ${standardPadding}
|
|
27
36
|
${standardPadding};
|
|
@@ -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,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
|
|
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;;;;;;;;;;;;;;mBAc9C,aAAa,IAAI,eAAe,IAAI,aAAa;cACtD,eAAe;sBACP,sBAAsB;;;;;;;;;mBASzB,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 :host([appearance='overlay']) {\n background: none;\n border-color: transparent;\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 :host([appearance='overlay']) .messages {\n background: none;\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"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Appearances of chat conversation.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
export declare const ChatConversationAppearance: {
|
|
6
|
+
readonly default: undefined;
|
|
7
|
+
readonly overlay: "overlay";
|
|
8
|
+
};
|
|
9
|
+
export type ChatConversationAppearance = (typeof ChatConversationAppearance)[keyof typeof ChatConversationAppearance];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/chat/conversation/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACtC,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACZ,CAAC","sourcesContent":["/**\n * Appearances of chat conversation.\n * @public\n */\nexport const ChatConversationAppearance = {\n default: undefined,\n overlay: 'overlay'\n} as const;\n\nexport type ChatConversationAppearance =\n (typeof ChatConversationAppearance)[keyof typeof ChatConversationAppearance];\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { css } from '@ni/fast-element';
|
|
2
|
-
import { applicationBackgroundColor, bodyFont, bodyFontColor, borderWidth, controlLabelFontColor, elevation2BoxShadow, mediumPadding, popupBorderColor } from '@ni/nimble-components/dist/esm/theme-provider/design-tokens';
|
|
2
|
+
import { applicationBackgroundColor, bodyFont, bodyFontColor, borderWidth, controlLabelFontColor, elevation2BoxShadow, mediumPadding, popupBorderColor, borderHoverColor, smallDelay } 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')}
|
|
@@ -7,12 +7,14 @@ export const styles = css `
|
|
|
7
7
|
:host {
|
|
8
8
|
width: 100%;
|
|
9
9
|
height: auto;
|
|
10
|
+
outline: none;
|
|
11
|
+
--ni-private-hover-indicator-width: calc(${borderWidth} + 1px);
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
.container {
|
|
13
|
-
display:
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
position: relative;
|
|
16
18
|
width: 100%;
|
|
17
19
|
height: 100%;
|
|
18
20
|
|
|
@@ -21,10 +23,34 @@ export const styles = css `
|
|
|
21
23
|
box-shadow: ${elevation2BoxShadow};
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
.container::after {
|
|
27
|
+
content: '';
|
|
28
|
+
position: absolute;
|
|
29
|
+
bottom: calc(-1 * ${borderWidth});
|
|
30
|
+
width: 0px;
|
|
31
|
+
height: 0px;
|
|
32
|
+
align-self: center;
|
|
33
|
+
border-bottom: ${borderHoverColor}
|
|
34
|
+
var(--ni-private-hover-indicator-width) solid;
|
|
35
|
+
transition: width ${smallDelay} ease-in;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host(:hover) .container::after {
|
|
39
|
+
width: 100%;
|
|
40
|
+
transition: width ${smallDelay} ease-in;
|
|
41
|
+
}
|
|
27
42
|
|
|
43
|
+
:host(:focus-within) .container {
|
|
44
|
+
border-bottom-color: ${borderHoverColor};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@media (prefers-reduced-motion) {
|
|
48
|
+
.container::after {
|
|
49
|
+
transition-duration: 0s;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
textarea {
|
|
28
54
|
font: ${bodyFont};
|
|
29
55
|
color: ${bodyFontColor};
|
|
30
56
|
background-color: transparent;
|
|
@@ -45,8 +71,7 @@ export const styles = css `
|
|
|
45
71
|
}
|
|
46
72
|
|
|
47
73
|
.send-button {
|
|
48
|
-
|
|
49
|
-
grid-column: 2;
|
|
74
|
+
align-self: flex-end;
|
|
50
75
|
width: 80px;
|
|
51
76
|
margin: ${mediumPadding};
|
|
52
77
|
}
|
|
@@ -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,
|
|
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 .send-button {\n align-self: flex-end;\n width: 80px;\n margin: ${mediumPadding};\n }\n`;\n"]}
|