@elliemae/ds-chat-card 3.28.1-rc.2 → 3.29.0-next.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/ChatCard.js.map +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-chat-card-valid.js +85 -0
- package/dist/cjs/typescript-testing/typescript-chat-card-valid.js.map +7 -0
- package/dist/esm/ChatCard.js.map +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-chat-card-valid.js +62 -0
- package/dist/esm/typescript-testing/typescript-chat-card-valid.js.map +7 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/react-desc-prop-types.d.ts +3 -1
- package/dist/types/typescript-testing/typescript-chat-card-valid.d.ts +1 -0
- package/package.json +7 -7
package/dist/cjs/ChatCard.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/ChatCard.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 { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSChatCardT } from './react-desc-prop-types.js';\nimport { propTypes, defaultProps } from './react-desc-prop-types.js';\nimport { Wrapper, MainContent, Title, Content, Time, RightAddon } from './styled.js';\nimport { ChatCardDataTestIds } from './ChatCardDataTestIds.js';\nimport { DSChatCardName } from './DSChatCardDefinitions.js';\n\nconst ChatCard: React.ComponentType<DSChatCardT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, propTypes, DSChatCardName);\n\n const { title, content, time, rightAddon } = props;\n return (\n <Wrapper cols={['1fr', 'auto']} data-testid={ChatCardDataTestIds.CARD_WRAPPER}>\n <MainContent>\n <Title data-testid={ChatCardDataTestIds.CARD_TITLE}>{title}</Title>\n <Content data-testid={ChatCardDataTestIds.CARD_CONTENT}>\n <SimpleTruncatedTooltipText value={content} />\n </Content>\n {time && <Time data-testid={ChatCardDataTestIds.CARD_TIME}>{time}</Time>}\n </MainContent>\n {rightAddon && <RightAddon data-testid={ChatCardDataTestIds.CARD_RIGHT_ADDON}>{rightAddon}</RightAddon>}\n </Wrapper>\n );\n};\n\nChatCard.propTypes = propTypes as WeakValidationMap<unknown>;\nChatCard.displayName = DSChatCardName;\nconst ChatCardWithSchema = describe(ChatCard);\nChatCardWithSchema.propTypes = propTypes as WeakValidationMap<unknown>;\n\nexport { ChatCard, ChatCardWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiBjB;AAfN,8BAAuF;AACvF,uCAA2C;AAE3C,mCAAwC;AACxC,oBAAuE;AACvE,iCAAoC;AACpC,mCAA+B;AAE/B,MAAM,WAAmD,CAAC,UAAU;AAClE,QAAM,uBAAmB,
|
4
|
+
"sourcesContent": ["import type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe, useValidateTypescriptPropTypes, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSChatCardT } from './react-desc-prop-types.js';\nimport { propTypes, defaultProps } from './react-desc-prop-types.js';\nimport { Wrapper, MainContent, Title, Content, Time, RightAddon } from './styled.js';\nimport { ChatCardDataTestIds } from './ChatCardDataTestIds.js';\nimport { DSChatCardName } from './DSChatCardDefinitions.js';\n\nconst ChatCard: React.ComponentType<DSChatCardT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSChatCardT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, propTypes, DSChatCardName);\n\n const { title, content, time, rightAddon } = props;\n return (\n <Wrapper cols={['1fr', 'auto']} data-testid={ChatCardDataTestIds.CARD_WRAPPER}>\n <MainContent>\n <Title data-testid={ChatCardDataTestIds.CARD_TITLE}>{title}</Title>\n <Content data-testid={ChatCardDataTestIds.CARD_CONTENT}>\n <SimpleTruncatedTooltipText value={content} />\n </Content>\n {time && <Time data-testid={ChatCardDataTestIds.CARD_TIME}>{time}</Time>}\n </MainContent>\n {rightAddon && <RightAddon data-testid={ChatCardDataTestIds.CARD_RIGHT_ADDON}>{rightAddon}</RightAddon>}\n </Wrapper>\n );\n};\n\nChatCard.propTypes = propTypes as WeakValidationMap<unknown>;\nChatCard.displayName = DSChatCardName;\nconst ChatCardWithSchema = describe(ChatCard);\nChatCardWithSchema.propTypes = propTypes as WeakValidationMap<unknown>;\n\nexport { ChatCard, ChatCardWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADiBjB;AAfN,8BAAuF;AACvF,uCAA2C;AAE3C,mCAAwC;AACxC,oBAAuE;AACvE,iCAAoC;AACpC,mCAA+B;AAE/B,MAAM,WAAmD,CAAC,UAAU;AAClE,QAAM,uBAAmB,sDAAwD,OAAO,yCAAY;AACpG,8DAA+B,kBAAkB,wCAAW,2CAAc;AAE1E,QAAM,EAAE,OAAO,SAAS,MAAM,WAAW,IAAI;AAC7C,SACE,6CAAC,yBAAQ,MAAM,CAAC,OAAO,MAAM,GAAG,eAAa,+CAAoB,cAC/D;AAAA,iDAAC,6BACC;AAAA,kDAAC,uBAAM,eAAa,+CAAoB,YAAa,iBAAM;AAAA,MAC3D,4CAAC,yBAAQ,eAAa,+CAAoB,cACxC,sDAAC,+DAA2B,OAAO,SAAS,GAC9C;AAAA,MACC,QAAQ,4CAAC,sBAAK,eAAa,+CAAoB,WAAY,gBAAK;AAAA,OACnE;AAAA,IACC,cAAc,4CAAC,4BAAW,eAAa,+CAAoB,kBAAmB,sBAAW;AAAA,KAC5F;AAEJ;AAEA,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,MAAM,yBAAqB,kCAAS,QAAQ;AAC5C,mBAAmB,YAAY;",
|
6
6
|
"names": []
|
7
7
|
}
|
package/dist/cjs/index.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../src/index.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
4
|
-
"sourcesContent": ["export { ChatCard, ChatCardWithSchema } from './ChatCard.js';\nexport { ChatCardDataTestIds } from './ChatCardDataTestIds.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
4
|
+
"sourcesContent": ["export { ChatCard, ChatCardWithSchema } from './ChatCard.js';\nexport { ChatCardDataTestIds } from './ChatCardDataTestIds.js';\nexport type { DSChatCardT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,sBAA6C;AAC7C,iCAAoC;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -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 DSChatCardT {\n export interface RequiredProps {\n title: string;\n }\n\n export interface DefaultProps {\n content: string;\n time: string;\n }\n\n export interface OptionalProps {\n rightAddon?: JSX.Element;\n }\n\n export interface Props extends DefaultProps, RequiredProps, OptionalProps {}\n}\n\nexport const defaultProps: DSChatCardT.DefaultProps = {\n content: '',\n time: '',\n};\n\nexport const propTypes = {\n title: PropTypes.string.isRequired.description(`Card's title`),\n content: PropTypes.string.description(`Card's content`),\n time: PropTypes.string.description('Time'),\n rightAddon: PropTypes.element.description('Right addon, badge or icon'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA0B;
|
4
|
+
"sourcesContent": ["import { PropTypes } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSChatCardT {\n export interface RequiredProps {\n title: string;\n }\n\n export interface DefaultProps {\n content: string;\n time: string;\n }\n\n export interface OptionalProps {\n rightAddon?: JSX.Element;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps, RequiredProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps, RequiredProps {}\n}\n\nexport const defaultProps: DSChatCardT.DefaultProps = {\n content: '',\n time: '',\n};\n\nexport const propTypes = {\n title: PropTypes.string.isRequired.description(`Card's title`),\n content: PropTypes.string.description(`Card's content`),\n time: PropTypes.string.description('Time'),\n rightAddon: PropTypes.element.description('Right addon, badge or icon'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAA0B;AAqBnB,MAAM,eAAyC;AAAA,EACpD,SAAS;AAAA,EACT,MAAM;AACR;AAEO,MAAM,YAAY;AAAA,EACvB,OAAO,kCAAU,OAAO,WAAW,YAAY,cAAc;AAAA,EAC7D,SAAS,kCAAU,OAAO,YAAY,gBAAgB;AAAA,EACtD,MAAM,kCAAU,OAAO,YAAY,MAAM;AAAA,EACzC,YAAY,kCAAU,QAAQ,YAAY,4BAA4B;AACxE;",
|
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 MockAddon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {});
|
28
|
+
const testRequiredProps = {
|
29
|
+
title: ""
|
30
|
+
};
|
31
|
+
const testOptionalProps = {
|
32
|
+
rightAddon: MockAddon()
|
33
|
+
};
|
34
|
+
const testPartialDefaults = {
|
35
|
+
content: ""
|
36
|
+
};
|
37
|
+
const testProps = {
|
38
|
+
...testRequiredProps,
|
39
|
+
...testOptionalProps,
|
40
|
+
...testPartialDefaults
|
41
|
+
};
|
42
|
+
const testPropsAsSyntax = {
|
43
|
+
...testRequiredProps,
|
44
|
+
...testOptionalProps,
|
45
|
+
...testPartialDefaults
|
46
|
+
};
|
47
|
+
const testCompleteDefaults = {
|
48
|
+
content: "",
|
49
|
+
time: ""
|
50
|
+
};
|
51
|
+
const testInternalProps = {
|
52
|
+
...testRequiredProps,
|
53
|
+
...testOptionalProps,
|
54
|
+
...testCompleteDefaults
|
55
|
+
};
|
56
|
+
const testInternalPropsAsSyntax = {
|
57
|
+
...testRequiredProps,
|
58
|
+
...testOptionalProps,
|
59
|
+
...testCompleteDefaults
|
60
|
+
};
|
61
|
+
const testExplicitDefinition = {
|
62
|
+
title: "",
|
63
|
+
content: "",
|
64
|
+
time: "",
|
65
|
+
rightAddon: MockAddon()
|
66
|
+
};
|
67
|
+
const testInferedTypeCompatibility = {
|
68
|
+
title: "",
|
69
|
+
content: "",
|
70
|
+
time: "",
|
71
|
+
rightAddon: MockAddon()
|
72
|
+
};
|
73
|
+
const testDefinitionAsConst = {
|
74
|
+
title: "",
|
75
|
+
content: "",
|
76
|
+
time: "",
|
77
|
+
rightAddon: MockAddon()
|
78
|
+
};
|
79
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ChatCard, { ...testExplicitDefinition }),
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ChatCard, { ...testInferedTypeCompatibility }),
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ChatCard, { ...testDefinitionAsConst }),
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import__.ChatCard, { title: "Card Title", content: "Card Content", time: "00:00 am", rightAddon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MockAddon, {}) })
|
84
|
+
] });
|
85
|
+
//# sourceMappingURL=typescript-chat-card-valid.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-chat-card-valid.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { ChatCard } from '../index.js';\nimport type { DSChatCardT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSChatCardT.Props;\ntype ComponentPropsInternals = DSChatCardT.InternalProps;\ntype ComponentPropsDefaultProps = DSChatCardT.DefaultProps;\ntype ComponentPropsOptionalProps = DSChatCardT.OptionalProps;\ntype ComponentPropsRequiredProps = DSChatCardT.RequiredProps;\n\nconst MockAddon = () => <div></div>;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n title: '',\n};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n rightAddon: MockAddon(),\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> = {\n content: '',\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n content: '',\n time: '',\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\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: '',\n content: '',\n time: '',\n rightAddon: MockAddon(),\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: '',\n content: '',\n time: '',\n rightAddon: MockAddon(),\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n title: '',\n content: '',\n time: '',\n rightAddon: MockAddon(),\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <ChatCard {...testExplicitDefinition} />\n <ChatCard {...testInferedTypeCompatibility} />\n <ChatCard {...testDefinitionAsConst} />\n {/* works with inline values */}\n <ChatCard title=\"Card Title\" content=\"Card Content\" time=\"00:00 am\" rightAddon={<MockAddon />} />\n </>\n);\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACWC;AAVxB,eAAyB;AAUzB,MAAM,YAAY,MAAM,4CAAC,SAAI;AAE7B,MAAM,oBAAiD;AAAA,EACrD,OAAO;AACT;AAEA,MAAM,oBAAiD;AAAA,EACrD,YAAY,UAAU;AACxB;AAIA,MAAM,sBAA2D;AAAA,EAC/D,SAAS;AACX;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,SAAS;AAAA,EACT,MAAM;AACR;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,YAAY,UAAU;AACxB;AAGA,MAAM,+BAA+B;AAAA,EACnC,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,YAAY,UAAU;AACxB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,YAAY,UAAU;AACxB;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,qBAAU,GAAG,wBAAwB;AAAA,EACtC,4CAAC,qBAAU,GAAG,8BAA8B;AAAA,EAC5C,4CAAC,qBAAU,GAAG,uBAAuB;AAAA,EAErC,4CAAC,qBAAS,OAAM,cAAa,SAAQ,gBAAe,MAAK,YAAW,YAAY,4CAAC,aAAU,GAAI;AAAA,GACjG;",
|
6
|
+
"names": []
|
7
|
+
}
|
package/dist/esm/ChatCard.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/ChatCard.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 { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSChatCardT } from './react-desc-prop-types.js';\nimport { propTypes, defaultProps } from './react-desc-prop-types.js';\nimport { Wrapper, MainContent, Title, Content, Time, RightAddon } from './styled.js';\nimport { ChatCardDataTestIds } from './ChatCardDataTestIds.js';\nimport { DSChatCardName } from './DSChatCardDefinitions.js';\n\nconst ChatCard: React.ComponentType<DSChatCardT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, propTypes, DSChatCardName);\n\n const { title, content, time, rightAddon } = props;\n return (\n <Wrapper cols={['1fr', 'auto']} data-testid={ChatCardDataTestIds.CARD_WRAPPER}>\n <MainContent>\n <Title data-testid={ChatCardDataTestIds.CARD_TITLE}>{title}</Title>\n <Content data-testid={ChatCardDataTestIds.CARD_CONTENT}>\n <SimpleTruncatedTooltipText value={content} />\n </Content>\n {time && <Time data-testid={ChatCardDataTestIds.CARD_TIME}>{time}</Time>}\n </MainContent>\n {rightAddon && <RightAddon data-testid={ChatCardDataTestIds.CARD_RIGHT_ADDON}>{rightAddon}</RightAddon>}\n </Wrapper>\n );\n};\n\nChatCard.propTypes = propTypes as WeakValidationMap<unknown>;\nChatCard.displayName = DSChatCardName;\nconst ChatCardWithSchema = describe(ChatCard);\nChatCardWithSchema.propTypes = propTypes as WeakValidationMap<unknown>;\n\nexport { ChatCard, ChatCardWithSchema };\n"],
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACiBjB,SACE,KADF;AAfN,SAAS,UAAU,gCAAgC,oCAAoC;AACvF,SAAS,kCAAkC;AAE3C,SAAS,WAAW,oBAAoB;AACxC,SAAS,SAAS,aAAa,OAAO,SAAS,MAAM,kBAAkB;AACvE,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAE/B,MAAM,WAAmD,CAAC,UAAU;AAClE,QAAM,mBAAmB,
|
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 { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport type { DSChatCardT } from './react-desc-prop-types.js';\nimport { propTypes, defaultProps } from './react-desc-prop-types.js';\nimport { Wrapper, MainContent, Title, Content, Time, RightAddon } from './styled.js';\nimport { ChatCardDataTestIds } from './ChatCardDataTestIds.js';\nimport { DSChatCardName } from './DSChatCardDefinitions.js';\n\nconst ChatCard: React.ComponentType<DSChatCardT.Props> = (props) => {\n const propsWithDefault = useMemoMergePropsWithDefault<DSChatCardT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, propTypes, DSChatCardName);\n\n const { title, content, time, rightAddon } = props;\n return (\n <Wrapper cols={['1fr', 'auto']} data-testid={ChatCardDataTestIds.CARD_WRAPPER}>\n <MainContent>\n <Title data-testid={ChatCardDataTestIds.CARD_TITLE}>{title}</Title>\n <Content data-testid={ChatCardDataTestIds.CARD_CONTENT}>\n <SimpleTruncatedTooltipText value={content} />\n </Content>\n {time && <Time data-testid={ChatCardDataTestIds.CARD_TIME}>{time}</Time>}\n </MainContent>\n {rightAddon && <RightAddon data-testid={ChatCardDataTestIds.CARD_RIGHT_ADDON}>{rightAddon}</RightAddon>}\n </Wrapper>\n );\n};\n\nChatCard.propTypes = propTypes as WeakValidationMap<unknown>;\nChatCard.displayName = DSChatCardName;\nconst ChatCardWithSchema = describe(ChatCard);\nChatCardWithSchema.propTypes = propTypes as WeakValidationMap<unknown>;\n\nexport { ChatCard, ChatCardWithSchema };\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACiBjB,SACE,KADF;AAfN,SAAS,UAAU,gCAAgC,oCAAoC;AACvF,SAAS,kCAAkC;AAE3C,SAAS,WAAW,oBAAoB;AACxC,SAAS,SAAS,aAAa,OAAO,SAAS,MAAM,kBAAkB;AACvE,SAAS,2BAA2B;AACpC,SAAS,sBAAsB;AAE/B,MAAM,WAAmD,CAAC,UAAU;AAClE,QAAM,mBAAmB,6BAAwD,OAAO,YAAY;AACpG,iCAA+B,kBAAkB,WAAW,cAAc;AAE1E,QAAM,EAAE,OAAO,SAAS,MAAM,WAAW,IAAI;AAC7C,SACE,qBAAC,WAAQ,MAAM,CAAC,OAAO,MAAM,GAAG,eAAa,oBAAoB,cAC/D;AAAA,yBAAC,eACC;AAAA,0BAAC,SAAM,eAAa,oBAAoB,YAAa,iBAAM;AAAA,MAC3D,oBAAC,WAAQ,eAAa,oBAAoB,cACxC,8BAAC,8BAA2B,OAAO,SAAS,GAC9C;AAAA,MACC,QAAQ,oBAAC,QAAK,eAAa,oBAAoB,WAAY,gBAAK;AAAA,OACnE;AAAA,IACC,cAAc,oBAAC,cAAW,eAAa,oBAAoB,kBAAmB,sBAAW;AAAA,KAC5F;AAEJ;AAEA,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,MAAM,qBAAqB,SAAS,QAAQ;AAC5C,mBAAmB,YAAY;",
|
6
6
|
"names": []
|
7
7
|
}
|
package/dist/esm/index.js.map
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"version": 3,
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { ChatCard, ChatCardWithSchema } from './ChatCard.js';\nexport { ChatCardDataTestIds } from './ChatCardDataTestIds.js';\n"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { ChatCard, ChatCardWithSchema } from './ChatCard.js';\nexport { ChatCardDataTestIds } from './ChatCardDataTestIds.js';\nexport type { DSChatCardT } from './react-desc-prop-types.js';\n"],
|
5
5
|
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,UAAU,0BAA0B;AAC7C,SAAS,2BAA2B;",
|
6
6
|
"names": []
|
7
7
|
}
|
@@ -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 DSChatCardT {\n export interface RequiredProps {\n title: string;\n }\n\n export interface DefaultProps {\n content: string;\n time: string;\n }\n\n export interface OptionalProps {\n rightAddon?: JSX.Element;\n }\n\n export interface Props extends DefaultProps, RequiredProps, OptionalProps {}\n}\n\nexport const defaultProps: DSChatCardT.DefaultProps = {\n content: '',\n time: '',\n};\n\nexport const propTypes = {\n title: PropTypes.string.isRequired.description(`Card's title`),\n content: PropTypes.string.description(`Card's content`),\n time: PropTypes.string.description('Time'),\n rightAddon: PropTypes.element.description('Right addon, badge or icon'),\n};\n"],
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,iBAAiB;
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSChatCardT {\n export interface RequiredProps {\n title: string;\n }\n\n export interface DefaultProps {\n content: string;\n time: string;\n }\n\n export interface OptionalProps {\n rightAddon?: JSX.Element;\n }\n\n export interface Props extends Partial<DefaultProps>, OptionalProps, RequiredProps {}\n\n export interface InternalProps extends DefaultProps, OptionalProps, RequiredProps {}\n}\n\nexport const defaultProps: DSChatCardT.DefaultProps = {\n content: '',\n time: '',\n};\n\nexport const propTypes = {\n title: PropTypes.string.isRequired.description(`Card's title`),\n content: PropTypes.string.description(`Card's content`),\n time: PropTypes.string.description('Time'),\n rightAddon: PropTypes.element.description('Right addon, badge or icon'),\n};\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,iBAAiB;AAqBnB,MAAM,eAAyC;AAAA,EACpD,SAAS;AAAA,EACT,MAAM;AACR;AAEO,MAAM,YAAY;AAAA,EACvB,OAAO,UAAU,OAAO,WAAW,YAAY,cAAc;AAAA,EAC7D,SAAS,UAAU,OAAO,YAAY,gBAAgB;AAAA,EACtD,MAAM,UAAU,OAAO,YAAY,MAAM;AAAA,EACzC,YAAY,UAAU,QAAQ,YAAY,4BAA4B;AACxE;",
|
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 { ChatCard } from "../index.js";
|
4
|
+
const MockAddon = () => /* @__PURE__ */ jsx("div", {});
|
5
|
+
const testRequiredProps = {
|
6
|
+
title: ""
|
7
|
+
};
|
8
|
+
const testOptionalProps = {
|
9
|
+
rightAddon: MockAddon()
|
10
|
+
};
|
11
|
+
const testPartialDefaults = {
|
12
|
+
content: ""
|
13
|
+
};
|
14
|
+
const testProps = {
|
15
|
+
...testRequiredProps,
|
16
|
+
...testOptionalProps,
|
17
|
+
...testPartialDefaults
|
18
|
+
};
|
19
|
+
const testPropsAsSyntax = {
|
20
|
+
...testRequiredProps,
|
21
|
+
...testOptionalProps,
|
22
|
+
...testPartialDefaults
|
23
|
+
};
|
24
|
+
const testCompleteDefaults = {
|
25
|
+
content: "",
|
26
|
+
time: ""
|
27
|
+
};
|
28
|
+
const testInternalProps = {
|
29
|
+
...testRequiredProps,
|
30
|
+
...testOptionalProps,
|
31
|
+
...testCompleteDefaults
|
32
|
+
};
|
33
|
+
const testInternalPropsAsSyntax = {
|
34
|
+
...testRequiredProps,
|
35
|
+
...testOptionalProps,
|
36
|
+
...testCompleteDefaults
|
37
|
+
};
|
38
|
+
const testExplicitDefinition = {
|
39
|
+
title: "",
|
40
|
+
content: "",
|
41
|
+
time: "",
|
42
|
+
rightAddon: MockAddon()
|
43
|
+
};
|
44
|
+
const testInferedTypeCompatibility = {
|
45
|
+
title: "",
|
46
|
+
content: "",
|
47
|
+
time: "",
|
48
|
+
rightAddon: MockAddon()
|
49
|
+
};
|
50
|
+
const testDefinitionAsConst = {
|
51
|
+
title: "",
|
52
|
+
content: "",
|
53
|
+
time: "",
|
54
|
+
rightAddon: MockAddon()
|
55
|
+
};
|
56
|
+
const ExampleUsageComponent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
57
|
+
/* @__PURE__ */ jsx(ChatCard, { ...testExplicitDefinition }),
|
58
|
+
/* @__PURE__ */ jsx(ChatCard, { ...testInferedTypeCompatibility }),
|
59
|
+
/* @__PURE__ */ jsx(ChatCard, { ...testDefinitionAsConst }),
|
60
|
+
/* @__PURE__ */ jsx(ChatCard, { title: "Card Title", content: "Card Content", time: "00:00 am", rightAddon: /* @__PURE__ */ jsx(MockAddon, {}) })
|
61
|
+
] });
|
62
|
+
//# sourceMappingURL=typescript-chat-card-valid.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-chat-card-valid.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { ChatCard } from '../index.js';\nimport type { DSChatCardT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSChatCardT.Props;\ntype ComponentPropsInternals = DSChatCardT.InternalProps;\ntype ComponentPropsDefaultProps = DSChatCardT.DefaultProps;\ntype ComponentPropsOptionalProps = DSChatCardT.OptionalProps;\ntype ComponentPropsRequiredProps = DSChatCardT.RequiredProps;\n\nconst MockAddon = () => <div></div>;\n\nconst testRequiredProps: ComponentPropsRequiredProps = {\n title: '',\n};\n\nconst testOptionalProps: ComponentPropsOptionalProps = {\n rightAddon: MockAddon(),\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> = {\n content: '',\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n};\n\nconst testPropsAsSyntax = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n content: '',\n time: '',\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testRequiredProps,\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\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: '',\n content: '',\n time: '',\n rightAddon: MockAddon(),\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: '',\n content: '',\n time: '',\n rightAddon: MockAddon(),\n} as ComponentPropsForApp;\n\nconst testDefinitionAsConst = {\n title: '',\n content: '',\n time: '',\n rightAddon: MockAddon(),\n} as const;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <ChatCard {...testExplicitDefinition} />\n <ChatCard {...testInferedTypeCompatibility} />\n <ChatCard {...testDefinitionAsConst} />\n {/* works with inline values */}\n <ChatCard title=\"Card Title\" content=\"Card Content\" time=\"00:00 am\" rightAddon={<MockAddon />} />\n </>\n);\n"],
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACWC,SAsEtB,UAtEsB,KAsEtB,YAtEsB;AAVxB,SAAS,gBAAgB;AAUzB,MAAM,YAAY,MAAM,oBAAC,SAAI;AAE7B,MAAM,oBAAiD;AAAA,EACrD,OAAO;AACT;AAEA,MAAM,oBAAiD;AAAA,EACrD,YAAY,UAAU;AACxB;AAIA,MAAM,sBAA2D;AAAA,EAC/D,SAAS;AACX;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,uBAA6D;AAAA,EACjE,SAAS;AAAA,EACT,MAAM;AACR;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,YAAY,UAAU;AACxB;AAGA,MAAM,+BAA+B;AAAA,EACnC,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,YAAY,UAAU;AACxB;AAEA,MAAM,wBAAwB;AAAA,EAC5B,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AAAA,EACN,YAAY,UAAU;AACxB;AAEA,MAAM,wBAAwB,MAC5B,iCAEE;AAAA,sBAAC,YAAU,GAAG,wBAAwB;AAAA,EACtC,oBAAC,YAAU,GAAG,8BAA8B;AAAA,EAC5C,oBAAC,YAAU,GAAG,uBAAuB;AAAA,EAErC,oBAAC,YAAS,OAAM,cAAa,SAAQ,gBAAe,MAAK,YAAW,YAAY,oBAAC,aAAU,GAAI;AAAA,GACjG;",
|
6
|
+
"names": []
|
7
|
+
}
|
package/dist/types/index.d.ts
CHANGED
@@ -10,7 +10,9 @@ export declare namespace DSChatCardT {
|
|
10
10
|
interface OptionalProps {
|
11
11
|
rightAddon?: JSX.Element;
|
12
12
|
}
|
13
|
-
interface Props extends DefaultProps, RequiredProps
|
13
|
+
interface Props extends Partial<DefaultProps>, OptionalProps, RequiredProps {
|
14
|
+
}
|
15
|
+
interface InternalProps extends DefaultProps, OptionalProps, RequiredProps {
|
14
16
|
}
|
15
17
|
}
|
16
18
|
export declare const defaultProps: DSChatCardT.DefaultProps;
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@elliemae/ds-chat-card",
|
3
|
-
"version": "3.
|
3
|
+
"version": "3.29.0-next.2",
|
4
4
|
"license": "MIT",
|
5
5
|
"description": "ICE MT - Dimsum - Chat Card",
|
6
6
|
"files": [
|
@@ -44,18 +44,18 @@
|
|
44
44
|
},
|
45
45
|
"publishConfig": {
|
46
46
|
"access": "public",
|
47
|
-
"typeSafety":
|
47
|
+
"typeSafety": true
|
48
48
|
},
|
49
49
|
"dependencies": {
|
50
|
-
"@elliemae/ds-grid": "3.
|
51
|
-
"@elliemae/ds-props-helpers": "3.
|
52
|
-
"@elliemae/ds-
|
53
|
-
"@elliemae/ds-
|
50
|
+
"@elliemae/ds-grid": "3.29.0-next.2",
|
51
|
+
"@elliemae/ds-props-helpers": "3.29.0-next.2",
|
52
|
+
"@elliemae/ds-system": "3.29.0-next.2",
|
53
|
+
"@elliemae/ds-truncated-tooltip-text": "3.29.0-next.2"
|
54
54
|
},
|
55
55
|
"devDependencies": {
|
56
56
|
"@elliemae/pui-cli": "~9.0.0-next.31",
|
57
57
|
"styled-components": "~5.3.9",
|
58
|
-
"@elliemae/ds-monorepo-devops": "3.
|
58
|
+
"@elliemae/ds-monorepo-devops": "3.29.0-next.2"
|
59
59
|
},
|
60
60
|
"peerDependencies": {
|
61
61
|
"lodash": "^4.17.21",
|