@sproutsocial/seeds-react-chat-bubble 0.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.
@@ -0,0 +1,61 @@
1
+ // src/styles.ts
2
+ import styled from "styled-components";
3
+ import { COMMON } from "@sproutsocial/seeds-react-system-props";
4
+ var StyledChatBubble = styled.div`
5
+ font-family: ${(p) => p.theme.fontFamily};
6
+ ${(p) => p.size === "small" ? p.theme.typography[200] : p.theme.typography[300]};
7
+ border-radius: ${(p) => {
8
+ const radius = p.size === "small" ? "12px" : "16px";
9
+ return p.type === "sent" ? `${radius} ${radius} 0px ${radius}` : `${radius} ${radius} ${radius} 0px`;
10
+ }};
11
+ display: inline-flex;
12
+ align-items: center;
13
+ align-self: ${(p) => p.type === "sent" ? "flex-end" : "flex-start"};
14
+ max-width: 80%;
15
+ word-break: break-word;
16
+ color: ${(p) => p.type === "sent" ? p.theme.colors.text.inverse : p.theme.colors.text.body};
17
+ background: ${(p) => p.type === "sent" ? p.theme.colors.button.primary.background.base : p.theme.colors.container.background.decorative.blue};
18
+ padding: ${(p) => p.size === "small" ? `${p.theme.space[200]} ${p.theme.space[300]}` : `${p.theme.space[300]} ${p.theme.space[400]}`};
19
+ ${COMMON};
20
+ `;
21
+
22
+ // src/ChatBubble.tsx
23
+ import { jsx } from "react/jsx-runtime";
24
+ var ChatBubble = ({
25
+ children,
26
+ type = "received",
27
+ size = "default",
28
+ ...rest
29
+ }) => {
30
+ return /* @__PURE__ */ jsx(
31
+ StyledChatBubble,
32
+ {
33
+ type,
34
+ size,
35
+ "data-qa-chat-bubble": true,
36
+ ...rest,
37
+ children
38
+ }
39
+ );
40
+ };
41
+ var ChatBubble_default = ChatBubble;
42
+
43
+ // src/constants.ts
44
+ var chatBubbleTypes = {
45
+ received: "received",
46
+ sent: "sent"
47
+ };
48
+ var chatBubbleSizes = {
49
+ default: "default",
50
+ small: "small"
51
+ };
52
+
53
+ // src/index.ts
54
+ var index_default = ChatBubble_default;
55
+ export {
56
+ ChatBubble_default as ChatBubble,
57
+ chatBubbleSizes,
58
+ chatBubbleTypes,
59
+ index_default as default
60
+ };
61
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/styles.ts","../../src/ChatBubble.tsx","../../src/constants.ts","../../src/index.ts"],"sourcesContent":["import styled from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeChatBubbleType, TypeChatBubbleSize } from \"./ChatBubbleTypes\";\n\nexport const StyledChatBubble = styled.div<{\n type: TypeChatBubbleType;\n size: TypeChatBubbleSize;\n}>`\n font-family: ${(p) => p.theme.fontFamily};\n ${(p) =>\n p.size === \"small\" ? p.theme.typography[200] : p.theme.typography[300]};\n border-radius: ${(p) => {\n const radius = p.size === \"small\" ? \"12px\" : \"16px\";\n return p.type === \"sent\"\n ? `${radius} ${radius} 0px ${radius}`\n : `${radius} ${radius} ${radius} 0px`;\n }};\n display: inline-flex;\n align-items: center;\n align-self: ${(p) => (p.type === \"sent\" ? \"flex-end\" : \"flex-start\")};\n max-width: 80%;\n word-break: break-word;\n color: ${(p) =>\n p.type === \"sent\"\n ? p.theme.colors.text.inverse\n : p.theme.colors.text.body};\n background: ${(p) =>\n p.type === \"sent\"\n ? p.theme.colors.button.primary.background.base\n : p.theme.colors.container.background.decorative.blue};\n padding: ${(p) =>\n p.size === \"small\"\n ? `${p.theme.space[200]} ${p.theme.space[300]}`\n : `${p.theme.space[300]} ${p.theme.space[400]}`};\n ${COMMON};\n`;\n","import { StyledChatBubble } from \"./styles\";\nimport type { TypeChatBubbleProps } from \"./ChatBubbleTypes\";\n\nconst ChatBubble = ({\n children,\n type = \"received\",\n size = \"default\",\n ...rest\n}: TypeChatBubbleProps) => {\n return (\n <StyledChatBubble\n type={type}\n size={size}\n data-qa-chat-bubble\n {...rest}\n >\n {children}\n </StyledChatBubble>\n );\n};\n\nexport default ChatBubble;\n","export const chatBubbleTypes = {\n received: \"received\",\n sent: \"sent\",\n} as const;\n\nexport const chatBubbleSizes = {\n default: \"default\",\n small: \"small\",\n} as const;\n","import ChatBubble from \"./ChatBubble\";\n\nexport default ChatBubble;\nexport { ChatBubble };\nexport * from \"./ChatBubbleTypes\";\nexport * from \"./constants\";\n"],"mappings":";AAAA,OAAO,YAAY;AACnB,SAAS,cAAc;AAGhB,IAAM,mBAAmB,OAAO;AAAA,iBAItB,CAAC,MAAM,EAAE,MAAM,UAAU;AAAA,IACtC,CAAC,MACD,EAAE,SAAS,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,EAAE,MAAM,WAAW,GAAG,CAAC;AAAA,mBACvD,CAAC,MAAM;AACtB,QAAM,SAAS,EAAE,SAAS,UAAU,SAAS;AAC7C,SAAO,EAAE,SAAS,SACd,GAAG,MAAM,IAAI,MAAM,QAAQ,MAAM,KACjC,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM;AACnC,CAAC;AAAA;AAAA;AAAA,gBAGa,CAAC,MAAO,EAAE,SAAS,SAAS,aAAa,YAAa;AAAA;AAAA;AAAA,WAG3D,CAAC,MACR,EAAE,SAAS,SACP,EAAE,MAAM,OAAO,KAAK,UACpB,EAAE,MAAM,OAAO,KAAK,IAAI;AAAA,gBAChB,CAAC,MACb,EAAE,SAAS,SACP,EAAE,MAAM,OAAO,OAAO,QAAQ,WAAW,OACzC,EAAE,MAAM,OAAO,UAAU,WAAW,WAAW,IAAI;AAAA,aAC9C,CAAC,MACV,EAAE,SAAS,UACP,GAAG,EAAE,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,MAAM,GAAG,CAAC,KAC3C,GAAG,EAAE,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,MAAM,GAAG,CAAC,EAAE;AAAA,IACjD,MAAM;AAAA;;;ACxBN;AAPJ,IAAM,aAAa,CAAC;AAAA,EAClB;AAAA,EACA,OAAO;AAAA,EACP,OAAO;AAAA,EACP,GAAG;AACL,MAA2B;AACzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,uBAAmB;AAAA,MAClB,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;AAEA,IAAO,qBAAQ;;;ACrBR,IAAM,kBAAkB;AAAA,EAC7B,UAAU;AAAA,EACV,MAAM;AACR;AAEO,IAAM,kBAAkB;AAAA,EAC7B,SAAS;AAAA,EACT,OAAO;AACT;;;ACNA,IAAO,gBAAQ;","names":[]}
@@ -0,0 +1,25 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { TypeSystemCommonProps, TypeStyledComponentsCommonProps } from '@sproutsocial/seeds-react-system-props';
3
+
4
+ declare const chatBubbleTypes: {
5
+ readonly received: "received";
6
+ readonly sent: "sent";
7
+ };
8
+ declare const chatBubbleSizes: {
9
+ readonly default: "default";
10
+ readonly small: "small";
11
+ };
12
+
13
+ type TypeChatBubbleType = keyof typeof chatBubbleTypes;
14
+ type TypeChatBubbleSize = keyof typeof chatBubbleSizes;
15
+ interface TypeBaseChatBubbleProps extends Omit<React.ComponentPropsWithoutRef<"div">, keyof TypeSystemCommonProps>, TypeSystemCommonProps, TypeStyledComponentsCommonProps {
16
+ }
17
+ interface TypeChatBubbleProps extends TypeBaseChatBubbleProps {
18
+ children?: React.ReactNode;
19
+ type?: TypeChatBubbleType;
20
+ size?: TypeChatBubbleSize;
21
+ }
22
+
23
+ declare const ChatBubble: ({ children, type, size, ...rest }: TypeChatBubbleProps) => react_jsx_runtime.JSX.Element;
24
+
25
+ export { ChatBubble, type TypeBaseChatBubbleProps, type TypeChatBubbleProps, type TypeChatBubbleSize, type TypeChatBubbleType, chatBubbleSizes, chatBubbleTypes, ChatBubble as default };
@@ -0,0 +1,25 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { TypeSystemCommonProps, TypeStyledComponentsCommonProps } from '@sproutsocial/seeds-react-system-props';
3
+
4
+ declare const chatBubbleTypes: {
5
+ readonly received: "received";
6
+ readonly sent: "sent";
7
+ };
8
+ declare const chatBubbleSizes: {
9
+ readonly default: "default";
10
+ readonly small: "small";
11
+ };
12
+
13
+ type TypeChatBubbleType = keyof typeof chatBubbleTypes;
14
+ type TypeChatBubbleSize = keyof typeof chatBubbleSizes;
15
+ interface TypeBaseChatBubbleProps extends Omit<React.ComponentPropsWithoutRef<"div">, keyof TypeSystemCommonProps>, TypeSystemCommonProps, TypeStyledComponentsCommonProps {
16
+ }
17
+ interface TypeChatBubbleProps extends TypeBaseChatBubbleProps {
18
+ children?: React.ReactNode;
19
+ type?: TypeChatBubbleType;
20
+ size?: TypeChatBubbleSize;
21
+ }
22
+
23
+ declare const ChatBubble: ({ children, type, size, ...rest }: TypeChatBubbleProps) => react_jsx_runtime.JSX.Element;
24
+
25
+ export { ChatBubble, type TypeBaseChatBubbleProps, type TypeChatBubbleProps, type TypeChatBubbleSize, type TypeChatBubbleType, chatBubbleSizes, chatBubbleTypes, ChatBubble as default };
package/dist/index.js ADDED
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ ChatBubble: () => ChatBubble_default,
34
+ chatBubbleSizes: () => chatBubbleSizes,
35
+ chatBubbleTypes: () => chatBubbleTypes,
36
+ default: () => index_default
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+
40
+ // src/styles.ts
41
+ var import_styled_components = __toESM(require("styled-components"));
42
+ var import_seeds_react_system_props = require("@sproutsocial/seeds-react-system-props");
43
+ var StyledChatBubble = import_styled_components.default.div`
44
+ font-family: ${(p) => p.theme.fontFamily};
45
+ ${(p) => p.size === "small" ? p.theme.typography[200] : p.theme.typography[300]};
46
+ border-radius: ${(p) => {
47
+ const radius = p.size === "small" ? "12px" : "16px";
48
+ return p.type === "sent" ? `${radius} ${radius} 0px ${radius}` : `${radius} ${radius} ${radius} 0px`;
49
+ }};
50
+ display: inline-flex;
51
+ align-items: center;
52
+ align-self: ${(p) => p.type === "sent" ? "flex-end" : "flex-start"};
53
+ max-width: 80%;
54
+ word-break: break-word;
55
+ color: ${(p) => p.type === "sent" ? p.theme.colors.text.inverse : p.theme.colors.text.body};
56
+ background: ${(p) => p.type === "sent" ? p.theme.colors.button.primary.background.base : p.theme.colors.container.background.decorative.blue};
57
+ padding: ${(p) => p.size === "small" ? `${p.theme.space[200]} ${p.theme.space[300]}` : `${p.theme.space[300]} ${p.theme.space[400]}`};
58
+ ${import_seeds_react_system_props.COMMON};
59
+ `;
60
+
61
+ // src/ChatBubble.tsx
62
+ var import_jsx_runtime = require("react/jsx-runtime");
63
+ var ChatBubble = ({
64
+ children,
65
+ type = "received",
66
+ size = "default",
67
+ ...rest
68
+ }) => {
69
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
70
+ StyledChatBubble,
71
+ {
72
+ type,
73
+ size,
74
+ "data-qa-chat-bubble": true,
75
+ ...rest,
76
+ children
77
+ }
78
+ );
79
+ };
80
+ var ChatBubble_default = ChatBubble;
81
+
82
+ // src/constants.ts
83
+ var chatBubbleTypes = {
84
+ received: "received",
85
+ sent: "sent"
86
+ };
87
+ var chatBubbleSizes = {
88
+ default: "default",
89
+ small: "small"
90
+ };
91
+
92
+ // src/index.ts
93
+ var index_default = ChatBubble_default;
94
+ // Annotate the CommonJS export names for ESM import in node:
95
+ 0 && (module.exports = {
96
+ ChatBubble,
97
+ chatBubbleSizes,
98
+ chatBubbleTypes
99
+ });
100
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/styles.ts","../src/ChatBubble.tsx","../src/constants.ts"],"sourcesContent":["import ChatBubble from \"./ChatBubble\";\n\nexport default ChatBubble;\nexport { ChatBubble };\nexport * from \"./ChatBubbleTypes\";\nexport * from \"./constants\";\n","import styled from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeChatBubbleType, TypeChatBubbleSize } from \"./ChatBubbleTypes\";\n\nexport const StyledChatBubble = styled.div<{\n type: TypeChatBubbleType;\n size: TypeChatBubbleSize;\n}>`\n font-family: ${(p) => p.theme.fontFamily};\n ${(p) =>\n p.size === \"small\" ? p.theme.typography[200] : p.theme.typography[300]};\n border-radius: ${(p) => {\n const radius = p.size === \"small\" ? \"12px\" : \"16px\";\n return p.type === \"sent\"\n ? `${radius} ${radius} 0px ${radius}`\n : `${radius} ${radius} ${radius} 0px`;\n }};\n display: inline-flex;\n align-items: center;\n align-self: ${(p) => (p.type === \"sent\" ? \"flex-end\" : \"flex-start\")};\n max-width: 80%;\n word-break: break-word;\n color: ${(p) =>\n p.type === \"sent\"\n ? p.theme.colors.text.inverse\n : p.theme.colors.text.body};\n background: ${(p) =>\n p.type === \"sent\"\n ? p.theme.colors.button.primary.background.base\n : p.theme.colors.container.background.decorative.blue};\n padding: ${(p) =>\n p.size === \"small\"\n ? `${p.theme.space[200]} ${p.theme.space[300]}`\n : `${p.theme.space[300]} ${p.theme.space[400]}`};\n ${COMMON};\n`;\n","import { StyledChatBubble } from \"./styles\";\nimport type { TypeChatBubbleProps } from \"./ChatBubbleTypes\";\n\nconst ChatBubble = ({\n children,\n type = \"received\",\n size = \"default\",\n ...rest\n}: TypeChatBubbleProps) => {\n return (\n <StyledChatBubble\n type={type}\n size={size}\n data-qa-chat-bubble\n {...rest}\n >\n {children}\n </StyledChatBubble>\n );\n};\n\nexport default ChatBubble;\n","export const chatBubbleTypes = {\n received: \"received\",\n sent: \"sent\",\n} as const;\n\nexport const chatBubbleSizes = {\n default: \"default\",\n small: \"small\",\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,+BAAmB;AACnB,sCAAuB;AAGhB,IAAM,mBAAmB,yBAAAA,QAAO;AAAA,iBAItB,CAAC,MAAM,EAAE,MAAM,UAAU;AAAA,IACtC,CAAC,MACD,EAAE,SAAS,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,EAAE,MAAM,WAAW,GAAG,CAAC;AAAA,mBACvD,CAAC,MAAM;AACtB,QAAM,SAAS,EAAE,SAAS,UAAU,SAAS;AAC7C,SAAO,EAAE,SAAS,SACd,GAAG,MAAM,IAAI,MAAM,QAAQ,MAAM,KACjC,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM;AACnC,CAAC;AAAA;AAAA;AAAA,gBAGa,CAAC,MAAO,EAAE,SAAS,SAAS,aAAa,YAAa;AAAA;AAAA;AAAA,WAG3D,CAAC,MACR,EAAE,SAAS,SACP,EAAE,MAAM,OAAO,KAAK,UACpB,EAAE,MAAM,OAAO,KAAK,IAAI;AAAA,gBAChB,CAAC,MACb,EAAE,SAAS,SACP,EAAE,MAAM,OAAO,OAAO,QAAQ,WAAW,OACzC,EAAE,MAAM,OAAO,UAAU,WAAW,WAAW,IAAI;AAAA,aAC9C,CAAC,MACV,EAAE,SAAS,UACP,GAAG,EAAE,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,MAAM,GAAG,CAAC,KAC3C,GAAG,EAAE,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,MAAM,GAAG,CAAC,EAAE;AAAA,IACjD,sCAAM;AAAA;;;ACxBN;AAPJ,IAAM,aAAa,CAAC;AAAA,EAClB;AAAA,EACA,OAAO;AAAA,EACP,OAAO;AAAA,EACP,GAAG;AACL,MAA2B;AACzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,uBAAmB;AAAA,MAClB,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;AAEA,IAAO,qBAAQ;;;ACrBR,IAAM,kBAAkB;AAAA,EAC7B,UAAU;AAAA,EACV,MAAM;AACR;AAEO,IAAM,kBAAkB;AAAA,EAC7B,SAAS;AAAA,EACT,OAAO;AACT;;;AHNA,IAAO,gBAAQ;","names":["styled"]}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@sproutsocial/seeds-react-chat-bubble",
3
+ "version": "0.2.0",
4
+ "description": "Seeds React Chat Bubble",
5
+ "author": "Sprout Social, Inc.",
6
+ "license": "MIT",
7
+ "main": "dist/index.js",
8
+ "module": "dist/esm/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/esm/index.js",
14
+ "require": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsup --dts",
22
+ "build:debug": "tsup --dts --metafile",
23
+ "dev": "tsup --watch --dts",
24
+ "clean": "rm -rf .turbo dist",
25
+ "clean:modules": "rm -rf node_modules",
26
+ "typecheck": "tsc --noEmit",
27
+ "test": "jest",
28
+ "test:watch": "jest --watch --coverage=false"
29
+ },
30
+ "dependencies": {
31
+ "@sproutsocial/seeds-react-system-props": "^3.0.2"
32
+ },
33
+ "devDependencies": {
34
+ "tsup": "^8.3.4",
35
+ "typescript": "^5.6.2",
36
+ "@types/react": "^18.0.0",
37
+ "@types/styled-components": "^5.1.26",
38
+ "@sproutsocial/eslint-config-seeds": "*",
39
+ "react": "^18.0.0",
40
+ "styled-components": "^5.2.3",
41
+ "@sproutsocial/seeds-tsconfig": "*",
42
+ "@sproutsocial/seeds-testing": "*",
43
+ "@sproutsocial/seeds-react-testing-library": "*"
44
+ },
45
+ "peerDependencies": {
46
+ "styled-components": "^5.2.3"
47
+ },
48
+ "engines": {
49
+ "node": ">=18"
50
+ }
51
+ }