@elliemae/ds-chat-system-message 3.21.2 → 3.22.0-next.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.
@@ -42,7 +42,12 @@ var import_DSChatSystemMessageDefinitions = require("./DSChatSystemMessageDefini
42
42
  const SystemMessage = (props) => {
43
43
  const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
44
44
  (0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefault, import_react_desc_prop_types.systemMessageProps, import_DSChatSystemMessageDefinitions.DSChatSystemMessageName);
45
- const { title, time, body } = propsWithDefault;
45
+ const {
46
+ title,
47
+ time = null,
48
+ // undefined is technically not a valid React node, it should be null instead
49
+ body
50
+ } = propsWithDefault;
46
51
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_style.Wrapper, { rows: ["auto", "auto"], cols: [1], children: [
47
52
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_style.Header, { cols: ["1fr", "auto", "1fr"], children: [
48
53
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {}),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/SystemMessage.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe, useValidateTypescriptPropTypes, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { Wrapper, Header, Title, Time, Message } from './style.js';\nimport type { DSChatSystemMessageT } from './react-desc-prop-types.js';\nimport { systemMessageProps, defaultProps } from './react-desc-prop-types.js';\nimport { ChatSystemMessageDataTestIds } from './ChatSystemMessageDataTestIds.js';\nimport { DSChatSystemMessageName } from './DSChatSystemMessageDefinitions.js';\n\nconst SystemMessage: React.ComponentType<DSChatSystemMessageT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, systemMessageProps, DSChatSystemMessageName);\n\n const { title, time, body } = propsWithDefault;\n return (\n <Wrapper rows={['auto', 'auto']} cols={[1]}>\n <Header cols={['1fr', 'auto', '1fr']}>\n <span />\n <Title data-testid={ChatSystemMessageDataTestIds.SYSTEM_MSG_TITLE}>{title}</Title>\n <Time data-testid={ChatSystemMessageDataTestIds.SYSTEM_MSG_TIME}>{time}</Time>\n </Header>\n <Message data-testid={ChatSystemMessageDataTestIds.SYSTEM_MSG_BODY}>{body}</Message>\n </Wrapper>\n );\n};\n\nSystemMessage.propTypes = systemMessageProps as WeakValidationMap<unknown>;\nSystemMessage.displayName = DSChatSystemMessageName;\nconst SystemMessageWithSchema = describe(SystemMessage);\nSystemMessageWithSchema.propTypes = systemMessageProps as WeakValidationMap<unknown>;\n\nexport { SystemMessage, SystemMessageWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgBjB;AAdN,8BAAuF;AACvF,mBAAsD;AAEtD,mCAAiD;AACjD,0CAA6C;AAC7C,4CAAwC;AAExC,MAAM,gBAAiE,CAAC,UAAU;AAChF,QAAM,uBAAmB,sDAA6B,OAAO,yCAAY;AACzE,8DAA+B,kBAAkB,iDAAoB,6DAAuB;AAE5F,QAAM,EAAE,OAAO,MAAM,KAAK,IAAI;AAC9B,SACE,6CAAC,wBAAQ,MAAM,CAAC,QAAQ,MAAM,GAAG,MAAM,CAAC,CAAC,GACvC;AAAA,iDAAC,uBAAO,MAAM,CAAC,OAAO,QAAQ,KAAK,GACjC;AAAA,kDAAC,UAAK;AAAA,MACN,4CAAC,sBAAM,eAAa,iEAA6B,kBAAmB,iBAAM;AAAA,MAC1E,4CAAC,qBAAK,eAAa,iEAA6B,iBAAkB,gBAAK;AAAA,OACzE;AAAA,IACA,4CAAC,wBAAQ,eAAa,iEAA6B,iBAAkB,gBAAK;AAAA,KAC5E;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,cAAc;AAC5B,MAAM,8BAA0B,kCAAS,aAAa;AACtD,wBAAwB,YAAY;",
4
+ "sourcesContent": ["import type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe, useValidateTypescriptPropTypes, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { Wrapper, Header, Title, Time, Message } from './style.js';\nimport type { DSChatSystemMessageT } from './react-desc-prop-types.js';\nimport { systemMessageProps, defaultProps } from './react-desc-prop-types.js';\nimport { ChatSystemMessageDataTestIds } from './ChatSystemMessageDataTestIds.js';\nimport { DSChatSystemMessageName } from './DSChatSystemMessageDefinitions.js';\n\nconst SystemMessage: React.ComponentType<DSChatSystemMessageT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSChatSystemMessageT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, systemMessageProps, DSChatSystemMessageName);\n\n const {\n title,\n time = null, // undefined is technically not a valid React node, it should be null instead\n body,\n } = propsWithDefault;\n return (\n <Wrapper rows={['auto', 'auto']} cols={[1]}>\n <Header cols={['1fr', 'auto', '1fr']}>\n <span />\n <Title data-testid={ChatSystemMessageDataTestIds.SYSTEM_MSG_TITLE}>{title}</Title>\n <Time data-testid={ChatSystemMessageDataTestIds.SYSTEM_MSG_TIME}>{time}</Time>\n </Header>\n <Message data-testid={ChatSystemMessageDataTestIds.SYSTEM_MSG_BODY}>{body}</Message>\n </Wrapper>\n );\n};\n\nSystemMessage.propTypes = systemMessageProps as WeakValidationMap<unknown>;\nSystemMessage.displayName = DSChatSystemMessageName;\nconst SystemMessageWithSchema = describe(SystemMessage);\nSystemMessageWithSchema.propTypes = systemMessageProps as WeakValidationMap<unknown>;\n\nexport { SystemMessage, SystemMessageWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADoBjB;AAlBN,8BAAuF;AACvF,mBAAsD;AAEtD,mCAAiD;AACjD,0CAA6C;AAC7C,4CAAwC;AAExC,MAAM,gBAAiE,CAAC,UAAU;AAChF,QAAM,uBAAmB,sDAAiE,OAAO,yCAAY;AAC7G,8DAA+B,kBAAkB,iDAAoB,6DAAuB;AAE5F,QAAM;AAAA,IACJ;AAAA,IACA,OAAO;AAAA;AAAA,IACP;AAAA,EACF,IAAI;AACJ,SACE,6CAAC,wBAAQ,MAAM,CAAC,QAAQ,MAAM,GAAG,MAAM,CAAC,CAAC,GACvC;AAAA,iDAAC,uBAAO,MAAM,CAAC,OAAO,QAAQ,KAAK,GACjC;AAAA,kDAAC,UAAK;AAAA,MACN,4CAAC,sBAAM,eAAa,iEAA6B,kBAAmB,iBAAM;AAAA,MAC1E,4CAAC,qBAAK,eAAa,iEAA6B,iBAAkB,gBAAK;AAAA,OACzE;AAAA,IACA,4CAAC,wBAAQ,eAAa,iEAA6B,iBAAkB,gBAAK;AAAA,KAC5E;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,cAAc;AAC5B,MAAM,8BAA0B,kCAAS,aAAa;AACtD,wBAAwB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -35,13 +35,11 @@ module.exports = __toCommonJS(react_desc_prop_types_exports);
35
35
  var React = __toESM(require("react"));
36
36
  var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
37
37
  const defaultProps = {
38
- title: "System Message",
39
- time: "",
40
- body: ""
38
+ title: "System Message"
41
39
  };
42
40
  const systemMessageProps = {
41
+ body: import_ds_props_helpers.PropTypes.string.isRequired.description("message"),
43
42
  title: import_ds_props_helpers.PropTypes.string.description("Message title").defaultValue("System Message"),
44
- time: import_ds_props_helpers.PropTypes.string.description("data of the message, ie: hour"),
45
- body: import_ds_props_helpers.PropTypes.string.isRequired.description("message")
43
+ time: import_ds_props_helpers.PropTypes.string.description("data of the message, ie: hour")
46
44
  };
47
45
  //# sourceMappingURL=react-desc-prop-types.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/react-desc-prop-types.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import { PropTypes } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSChatSystemMessageT {\n export interface Props {\n title: string;\n body: string;\n time: string;\n }\n}\n\nexport const defaultProps: DSChatSystemMessageT.Props = {\n title: 'System Message',\n time: '',\n body: '',\n};\n\nexport const systemMessageProps = {\n title: PropTypes.string.description('Message title').defaultValue('System Message'),\n time: PropTypes.string.description('data of the message, ie: hour'),\n body: PropTypes.string.isRequired.description('message'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA0B;AAUnB,MAAM,eAA2C;AAAA,EACtD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AACR;AAEO,MAAM,qBAAqB;AAAA,EAChC,OAAO,kCAAU,OAAO,YAAY,eAAe,EAAE,aAAa,gBAAgB;AAAA,EAClF,MAAM,kCAAU,OAAO,YAAY,+BAA+B;AAAA,EAClE,MAAM,kCAAU,OAAO,WAAW,YAAY,SAAS;AACzD;",
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport { PropTypes } from '@elliemae/ds-props-helpers';\n// import type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSChatSystemMessageT {\n export interface DefaultProps {\n title: string;\n }\n export interface OptionalProps {\n time?: string;\n }\n export interface RequiredProps {\n body: string;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n // currently the component doesn't accept global attributes...\n // Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n // XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n // currently the component doesn't accept global attributes...\n // Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n // XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSChatSystemMessageT.DefaultProps = {\n title: 'System Message',\n};\n\nexport const systemMessageProps = {\n body: PropTypes.string.isRequired.description('message'),\n title: PropTypes.string.description('Message title').defaultValue('System Message'),\n time: PropTypes.string.description('data of the message, ie: hour'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,8BAA0B;AA+BnB,MAAM,eAAkD;AAAA,EAC7D,OAAO;AACT;AAEO,MAAM,qBAAqB;AAAA,EAChC,MAAM,kCAAU,OAAO,WAAW,YAAY,SAAS;AAAA,EACvD,OAAO,kCAAU,OAAO,YAAY,eAAe,EAAE,aAAa,gBAAgB;AAAA,EAClF,MAAM,kCAAU,OAAO,YAAY,+BAA+B;AACpE;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,85 @@
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 __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var React = __toESM(require("react"));
25
+ var import_jsx_runtime = require("react/jsx-runtime");
26
+ var import__ = require("../index.js");
27
+ const testRequiredProps = {
28
+ body: "This is defined as just as string so this is fine for testing"
29
+ };
30
+ const testOptionalProps = {
31
+ time: "This is defined as just as string so this is fine for testing"
32
+ };
33
+ const testPartialDefaults = {};
34
+ const testProps = {
35
+ ...testRequiredProps,
36
+ ...testOptionalProps,
37
+ ...testPartialDefaults
38
+ };
39
+ const testPropsAsSyntax = {
40
+ ...testRequiredProps,
41
+ ...testOptionalProps,
42
+ ...testPartialDefaults
43
+ };
44
+ const testCompleteDefaults = {
45
+ title: "System Message"
46
+ };
47
+ const testInternalProps = {
48
+ ...testRequiredProps,
49
+ ...testOptionalProps,
50
+ ...testCompleteDefaults
51
+ };
52
+ const testInternalPropsAsSyntax = {
53
+ ...testRequiredProps,
54
+ ...testOptionalProps,
55
+ ...testCompleteDefaults
56
+ };
57
+ const testExplicitDefinition = {
58
+ title: "System Message",
59
+ body: "This is defined as just as string so this is fine for testing",
60
+ time: "This is defined as just as string so this is fine for testing"
61
+ };
62
+ const testInferedTypeCompatibility = {
63
+ title: "test for lossless 'as' syntax",
64
+ body: "when declaring this variable, this definition is expected to be compatible with the ComponentProps type",
65
+ time: "abc"
66
+ };
67
+ const testDefinitionAsConst = {
68
+ title: "System Message",
69
+ body: "This is defined as just as string so this is fine for testing",
70
+ time: "This is defined as just as string so this is fine for testing"
71
+ };
72
+ const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
73
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.SystemMessage, { ...testExplicitDefinition }),
74
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.SystemMessage, { ...testInferedTypeCompatibility }),
75
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.SystemMessage, { ...testDefinitionAsConst }),
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
77
+ import__.SystemMessage,
78
+ {
79
+ title: "System Message",
80
+ body: "This is defined as just as string so this is fine for testing",
81
+ time: "This is defined as just as string so this is fine for testing"
82
+ }
83
+ )
84
+ ] });
85
+ //# sourceMappingURL=typescript-system-message-valid.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-system-message-valid.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { SystemMessage } from '../index.js';\nimport type { DSChatSystemMessageT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSChatSystemMessageT.Props;\ntype ComponentPropsInternals = DSChatSystemMessageT.InternalProps;\ntype ComponentPropsDefaultProps = DSChatSystemMessageT.DefaultProps;\ntype ComponentPropsOptionalProps = DSChatSystemMessageT.OptionalProps;\ntype ComponentPropsRequiredProps = DSChatSystemMessageT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n body: 'This is defined as just as string so this is fine for testing',\n};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n time: 'This is defined as just as string so this is fine for testing',\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n title: 'System Message',\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n title: 'System Message',\n body: 'This is defined as just as string so this is fine for testing',\n time: 'This is defined as just as string so this is fine for testing',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n title: \"test for lossless 'as' syntax\",\n body: 'when declaring this variable, this definition is expected to be compatible with the ComponentProps type',\n time: 'abc',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n title: 'System Message',\n body: 'This is defined as just as string so this is fine for testing',\n time: 'This is defined as just as string so this is fine for testing',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <SystemMessage {...testExplicitDefinition} />\n <SystemMessage {...testInferedTypeCompatibility} />\n <SystemMessage {...testDefinitionAsConst} />\n {/* works with inline values */}\n <SystemMessage\n title=\"System Message\"\n body=\"This is defined as just as string so this is fine for testing\"\n time=\"This is defined as just as string so this is fine for testing\"\n />\n </>\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACmErB;AAlEF,eAA8B;AAU9B,MAAM,oBAAiD;AAAA,EACrD,MAAM;AACR;AACA,MAAM,oBAAiD;AAAA,EACrD,MAAM;AACR;AAIA,MAAM,sBAA2D,CAAC;AAClE,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,OAAO;AACT;AACA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AACR;AAGA,MAAM,+BAA+B;AAAA,EACnC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,wBAAwB;AAAA,EAC5B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,0BAAe,GAAG,wBAAwB;AAAA,EAC3C,4CAAC,0BAAe,GAAG,8BAA8B;AAAA,EACjD,4CAAC,0BAAe,GAAG,uBAAuB;AAAA,EAE1C;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,MAAK;AAAA,MACL,MAAK;AAAA;AAAA,EACP;AAAA,GACF;",
6
+ "names": []
7
+ }
@@ -8,7 +8,12 @@ import { DSChatSystemMessageName } from "./DSChatSystemMessageDefinitions.js";
8
8
  const SystemMessage = (props) => {
9
9
  const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
10
10
  useValidateTypescriptPropTypes(propsWithDefault, systemMessageProps, DSChatSystemMessageName);
11
- const { title, time, body } = propsWithDefault;
11
+ const {
12
+ title,
13
+ time = null,
14
+ // undefined is technically not a valid React node, it should be null instead
15
+ body
16
+ } = propsWithDefault;
12
17
  return /* @__PURE__ */ jsxs(Wrapper, { rows: ["auto", "auto"], cols: [1], children: [
13
18
  /* @__PURE__ */ jsxs(Header, { cols: ["1fr", "auto", "1fr"], children: [
14
19
  /* @__PURE__ */ jsx("span", {}),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/SystemMessage.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe, useValidateTypescriptPropTypes, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { Wrapper, Header, Title, Time, Message } from './style.js';\nimport type { DSChatSystemMessageT } from './react-desc-prop-types.js';\nimport { systemMessageProps, defaultProps } from './react-desc-prop-types.js';\nimport { ChatSystemMessageDataTestIds } from './ChatSystemMessageDataTestIds.js';\nimport { DSChatSystemMessageName } from './DSChatSystemMessageDefinitions.js';\n\nconst SystemMessage: React.ComponentType<DSChatSystemMessageT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, systemMessageProps, DSChatSystemMessageName);\n\n const { title, time, body } = propsWithDefault;\n return (\n <Wrapper rows={['auto', 'auto']} cols={[1]}>\n <Header cols={['1fr', 'auto', '1fr']}>\n <span />\n <Title data-testid={ChatSystemMessageDataTestIds.SYSTEM_MSG_TITLE}>{title}</Title>\n <Time data-testid={ChatSystemMessageDataTestIds.SYSTEM_MSG_TIME}>{time}</Time>\n </Header>\n <Message data-testid={ChatSystemMessageDataTestIds.SYSTEM_MSG_BODY}>{body}</Message>\n </Wrapper>\n );\n};\n\nSystemMessage.propTypes = systemMessageProps as WeakValidationMap<unknown>;\nSystemMessage.displayName = DSChatSystemMessageName;\nconst SystemMessageWithSchema = describe(SystemMessage);\nSystemMessageWithSchema.propTypes = systemMessageProps as WeakValidationMap<unknown>;\n\nexport { SystemMessage, SystemMessageWithSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACgBjB,SACE,KADF;AAdN,SAAS,UAAU,gCAAgC,oCAAoC;AACvF,SAAS,SAAS,QAAQ,OAAO,MAAM,eAAe;AAEtD,SAAS,oBAAoB,oBAAoB;AACjD,SAAS,oCAAoC;AAC7C,SAAS,+BAA+B;AAExC,MAAM,gBAAiE,CAAC,UAAU;AAChF,QAAM,mBAAmB,6BAA6B,OAAO,YAAY;AACzE,iCAA+B,kBAAkB,oBAAoB,uBAAuB;AAE5F,QAAM,EAAE,OAAO,MAAM,KAAK,IAAI;AAC9B,SACE,qBAAC,WAAQ,MAAM,CAAC,QAAQ,MAAM,GAAG,MAAM,CAAC,CAAC,GACvC;AAAA,yBAAC,UAAO,MAAM,CAAC,OAAO,QAAQ,KAAK,GACjC;AAAA,0BAAC,UAAK;AAAA,MACN,oBAAC,SAAM,eAAa,6BAA6B,kBAAmB,iBAAM;AAAA,MAC1E,oBAAC,QAAK,eAAa,6BAA6B,iBAAkB,gBAAK;AAAA,OACzE;AAAA,IACA,oBAAC,WAAQ,eAAa,6BAA6B,iBAAkB,gBAAK;AAAA,KAC5E;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,cAAc;AAC5B,MAAM,0BAA0B,SAAS,aAAa;AACtD,wBAAwB,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe, useValidateTypescriptPropTypes, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { Wrapper, Header, Title, Time, Message } from './style.js';\nimport type { DSChatSystemMessageT } from './react-desc-prop-types.js';\nimport { systemMessageProps, defaultProps } from './react-desc-prop-types.js';\nimport { ChatSystemMessageDataTestIds } from './ChatSystemMessageDataTestIds.js';\nimport { DSChatSystemMessageName } from './DSChatSystemMessageDefinitions.js';\n\nconst SystemMessage: React.ComponentType<DSChatSystemMessageT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSChatSystemMessageT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, systemMessageProps, DSChatSystemMessageName);\n\n const {\n title,\n time = null, // undefined is technically not a valid React node, it should be null instead\n body,\n } = propsWithDefault;\n return (\n <Wrapper rows={['auto', 'auto']} cols={[1]}>\n <Header cols={['1fr', 'auto', '1fr']}>\n <span />\n <Title data-testid={ChatSystemMessageDataTestIds.SYSTEM_MSG_TITLE}>{title}</Title>\n <Time data-testid={ChatSystemMessageDataTestIds.SYSTEM_MSG_TIME}>{time}</Time>\n </Header>\n <Message data-testid={ChatSystemMessageDataTestIds.SYSTEM_MSG_BODY}>{body}</Message>\n </Wrapper>\n );\n};\n\nSystemMessage.propTypes = systemMessageProps as WeakValidationMap<unknown>;\nSystemMessage.displayName = DSChatSystemMessageName;\nconst SystemMessageWithSchema = describe(SystemMessage);\nSystemMessageWithSchema.propTypes = systemMessageProps as WeakValidationMap<unknown>;\n\nexport { SystemMessage, SystemMessageWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACoBjB,SACE,KADF;AAlBN,SAAS,UAAU,gCAAgC,oCAAoC;AACvF,SAAS,SAAS,QAAQ,OAAO,MAAM,eAAe;AAEtD,SAAS,oBAAoB,oBAAoB;AACjD,SAAS,oCAAoC;AAC7C,SAAS,+BAA+B;AAExC,MAAM,gBAAiE,CAAC,UAAU;AAChF,QAAM,mBAAmB,6BAAiE,OAAO,YAAY;AAC7G,iCAA+B,kBAAkB,oBAAoB,uBAAuB;AAE5F,QAAM;AAAA,IACJ;AAAA,IACA,OAAO;AAAA;AAAA,IACP;AAAA,EACF,IAAI;AACJ,SACE,qBAAC,WAAQ,MAAM,CAAC,QAAQ,MAAM,GAAG,MAAM,CAAC,CAAC,GACvC;AAAA,yBAAC,UAAO,MAAM,CAAC,OAAO,QAAQ,KAAK,GACjC;AAAA,0BAAC,UAAK;AAAA,MACN,oBAAC,SAAM,eAAa,6BAA6B,kBAAmB,iBAAM;AAAA,MAC1E,oBAAC,QAAK,eAAa,6BAA6B,iBAAkB,gBAAK;AAAA,OACzE;AAAA,IACA,oBAAC,WAAQ,eAAa,6BAA6B,iBAAkB,gBAAK;AAAA,KAC5E;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,cAAc;AAC5B,MAAM,0BAA0B,SAAS,aAAa;AACtD,wBAAwB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -1,14 +1,12 @@
1
1
  import * as React from "react";
2
2
  import { PropTypes } from "@elliemae/ds-props-helpers";
3
3
  const defaultProps = {
4
- title: "System Message",
5
- time: "",
6
- body: ""
4
+ title: "System Message"
7
5
  };
8
6
  const systemMessageProps = {
7
+ body: PropTypes.string.isRequired.description("message"),
9
8
  title: PropTypes.string.description("Message title").defaultValue("System Message"),
10
- time: PropTypes.string.description("data of the message, ie: hour"),
11
- body: PropTypes.string.isRequired.description("message")
9
+ time: PropTypes.string.description("data of the message, ie: hour")
12
10
  };
13
11
  export {
14
12
  defaultProps,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSChatSystemMessageT {\n export interface Props {\n title: string;\n body: string;\n time: string;\n }\n}\n\nexport const defaultProps: DSChatSystemMessageT.Props = {\n title: 'System Message',\n time: '',\n body: '',\n};\n\nexport const systemMessageProps = {\n title: PropTypes.string.description('Message title').defaultValue('System Message'),\n time: PropTypes.string.description('data of the message, ie: hour'),\n body: PropTypes.string.isRequired.description('message'),\n};\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,iBAAiB;AAUnB,MAAM,eAA2C;AAAA,EACtD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AACR;AAEO,MAAM,qBAAqB;AAAA,EAChC,OAAO,UAAU,OAAO,YAAY,eAAe,EAAE,aAAa,gBAAgB;AAAA,EAClF,MAAM,UAAU,OAAO,YAAY,+BAA+B;AAAA,EAClE,MAAM,UAAU,OAAO,WAAW,YAAY,SAAS;AACzD;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\nimport { PropTypes } from '@elliemae/ds-props-helpers';\n// import type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSChatSystemMessageT {\n export interface DefaultProps {\n title: string;\n }\n export interface OptionalProps {\n time?: string;\n }\n export interface RequiredProps {\n body: string;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n // currently the component doesn't accept global attributes...\n // Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n // XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n // currently the component doesn't accept global attributes...\n // Omit<GlobalAttributesT<HTMLButtonElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n // XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSChatSystemMessageT.DefaultProps = {\n title: 'System Message',\n};\n\nexport const systemMessageProps = {\n body: PropTypes.string.isRequired.description('message'),\n title: PropTypes.string.description('Message title').defaultValue('System Message'),\n time: PropTypes.string.description('data of the message, ie: hour'),\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,iBAAiB;AA+BnB,MAAM,eAAkD;AAAA,EAC7D,OAAO;AACT;AAEO,MAAM,qBAAqB;AAAA,EAChC,MAAM,UAAU,OAAO,WAAW,YAAY,SAAS;AAAA,EACvD,OAAO,UAAU,OAAO,YAAY,eAAe,EAAE,aAAa,gBAAgB;AAAA,EAClF,MAAM,UAAU,OAAO,YAAY,+BAA+B;AACpE;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,62 @@
1
+ import * as React from "react";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { SystemMessage } from "../index.js";
4
+ const testRequiredProps = {
5
+ body: "This is defined as just as string so this is fine for testing"
6
+ };
7
+ const testOptionalProps = {
8
+ time: "This is defined as just as string so this is fine for testing"
9
+ };
10
+ const testPartialDefaults = {};
11
+ const testProps = {
12
+ ...testRequiredProps,
13
+ ...testOptionalProps,
14
+ ...testPartialDefaults
15
+ };
16
+ const testPropsAsSyntax = {
17
+ ...testRequiredProps,
18
+ ...testOptionalProps,
19
+ ...testPartialDefaults
20
+ };
21
+ const testCompleteDefaults = {
22
+ title: "System Message"
23
+ };
24
+ const testInternalProps = {
25
+ ...testRequiredProps,
26
+ ...testOptionalProps,
27
+ ...testCompleteDefaults
28
+ };
29
+ const testInternalPropsAsSyntax = {
30
+ ...testRequiredProps,
31
+ ...testOptionalProps,
32
+ ...testCompleteDefaults
33
+ };
34
+ const testExplicitDefinition = {
35
+ title: "System Message",
36
+ body: "This is defined as just as string so this is fine for testing",
37
+ time: "This is defined as just as string so this is fine for testing"
38
+ };
39
+ const testInferedTypeCompatibility = {
40
+ title: "test for lossless 'as' syntax",
41
+ body: "when declaring this variable, this definition is expected to be compatible with the ComponentProps type",
42
+ time: "abc"
43
+ };
44
+ const testDefinitionAsConst = {
45
+ title: "System Message",
46
+ body: "This is defined as just as string so this is fine for testing",
47
+ time: "This is defined as just as string so this is fine for testing"
48
+ };
49
+ const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
50
+ /* @__PURE__ */ jsx(SystemMessage, { ...testExplicitDefinition }),
51
+ /* @__PURE__ */ jsx(SystemMessage, { ...testInferedTypeCompatibility }),
52
+ /* @__PURE__ */ jsx(SystemMessage, { ...testDefinitionAsConst }),
53
+ /* @__PURE__ */ jsx(
54
+ SystemMessage,
55
+ {
56
+ title: "System Message",
57
+ body: "This is defined as just as string so this is fine for testing",
58
+ time: "This is defined as just as string so this is fine for testing"
59
+ }
60
+ )
61
+ ] });
62
+ //# sourceMappingURL=typescript-system-message-valid.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-system-message-valid.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { SystemMessage } from '../index.js';\nimport type { DSChatSystemMessageT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSChatSystemMessageT.Props;\ntype ComponentPropsInternals = DSChatSystemMessageT.InternalProps;\ntype ComponentPropsDefaultProps = DSChatSystemMessageT.DefaultProps;\ntype ComponentPropsOptionalProps = DSChatSystemMessageT.OptionalProps;\ntype ComponentPropsRequiredProps = DSChatSystemMessageT.RequiredProps;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n body: 'This is defined as just as string so this is fine for testing',\n};\nconst testOptionalProps: ComponentPropsOptionalProps = {\n time: 'This is defined as just as string so this is fine for testing',\n};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {};\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n title: 'System Message',\n};\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n title: 'System Message',\n body: 'This is defined as just as string so this is fine for testing',\n time: 'This is defined as just as string so this is fine for testing',\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n title: \"test for lossless 'as' syntax\",\n body: 'when declaring this variable, this definition is expected to be compatible with the ComponentProps type',\n time: 'abc',\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n title: 'System Message',\n body: 'This is defined as just as string so this is fine for testing',\n time: 'This is defined as just as string so this is fine for testing',\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <SystemMessage {...testExplicitDefinition} />\n <SystemMessage {...testInferedTypeCompatibility} />\n <SystemMessage {...testDefinitionAsConst} />\n {/* works with inline values */}\n <SystemMessage\n title=\"System Message\"\n body=\"This is defined as just as string so this is fine for testing\"\n time=\"This is defined as just as string so this is fine for testing\"\n />\n </>\n);\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACmErB,mBAEE,KAFF;AAlEF,SAAS,qBAAqB;AAU9B,MAAM,oBAAiD;AAAA,EACrD,MAAM;AACR;AACA,MAAM,oBAAiD;AAAA,EACrD,MAAM;AACR;AAIA,MAAM,sBAA2D,CAAC;AAClE,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,OAAO;AACT;AACA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AACR;AAGA,MAAM,+BAA+B;AAAA,EACnC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,wBAAwB;AAAA,EAC5B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,MAAM;AACR;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,iBAAe,GAAG,wBAAwB;AAAA,EAC3C,oBAAC,iBAAe,GAAG,8BAA8B;AAAA,EACjD,oBAAC,iBAAe,GAAG,uBAAuB;AAAA,EAE1C;AAAA,IAAC;AAAA;AAAA,MACC,OAAM;AAAA,MACN,MAAK;AAAA,MACL,MAAK;AAAA;AAAA,EACP;AAAA,GACF;",
6
+ "names": []
7
+ }
@@ -1,13 +1,21 @@
1
1
  export declare namespace DSChatSystemMessageT {
2
- interface Props {
2
+ interface DefaultProps {
3
3
  title: string;
4
+ }
5
+ interface OptionalProps {
6
+ time?: string;
7
+ }
8
+ interface RequiredProps {
4
9
  body: string;
5
- time: string;
10
+ }
11
+ interface Props extends Partial<DefaultProps>, OptionalProps, RequiredProps {
12
+ }
13
+ interface InternalProps extends DefaultProps, OptionalProps, RequiredProps {
6
14
  }
7
15
  }
8
- export declare const defaultProps: DSChatSystemMessageT.Props;
16
+ export declare const defaultProps: DSChatSystemMessageT.DefaultProps;
9
17
  export declare const systemMessageProps: {
18
+ body: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
10
19
  title: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
11
20
  time: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
12
- body: import("@elliemae/ds-props-helpers/dist/types/propTypes/types").ReactDescT;
13
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-chat-system-message",
3
- "version": "3.21.2",
3
+ "version": "3.22.0-next.0",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Chat System Message",
6
6
  "files": [
@@ -47,9 +47,9 @@
47
47
  "typeSafety": true
48
48
  },
49
49
  "dependencies": {
50
- "@elliemae/ds-grid": "3.21.2",
51
- "@elliemae/ds-props-helpers": "3.21.2",
52
- "@elliemae/ds-system": "3.21.2"
50
+ "@elliemae/ds-grid": "3.22.0-next.0",
51
+ "@elliemae/ds-props-helpers": "3.22.0-next.0",
52
+ "@elliemae/ds-system": "3.22.0-next.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "styled-components": "~5.3.9"