@elliemae/ds-chat-card 3.70.0-next.7 → 3.70.0-next.8
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/cjs/ChatCard.js +71 -14
- package/dist/cjs/ChatCard.js.map +2 -2
- package/dist/cjs/ChatCardDataTestIds.js +6 -5
- package/dist/cjs/ChatCardDataTestIds.js.map +2 -2
- package/dist/cjs/TruncatedTooltipText.js +27 -5
- package/dist/cjs/TruncatedTooltipText.js.map +2 -2
- package/dist/cjs/constants/index.js +66 -0
- package/dist/cjs/constants/index.js.map +7 -0
- package/dist/cjs/index.js +9 -1
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +10 -4
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/styled.js +35 -6
- package/dist/cjs/styled.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-chat-card-valid.js +4 -2
- package/dist/cjs/typescript-testing/typescript-chat-card-valid.js.map +2 -2
- package/dist/esm/ChatCard.js +77 -13
- package/dist/esm/ChatCard.js.map +2 -2
- package/dist/esm/ChatCardDataTestIds.js +6 -5
- package/dist/esm/ChatCardDataTestIds.js.map +2 -2
- package/dist/esm/TruncatedTooltipText.js +27 -5
- package/dist/esm/TruncatedTooltipText.js.map +2 -2
- package/dist/esm/constants/index.js +36 -0
- package/dist/esm/constants/index.js.map +7 -0
- package/dist/esm/index.js +10 -2
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +16 -5
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/styled.js +35 -6
- package/dist/esm/styled.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-chat-card-valid.js +4 -2
- package/dist/esm/typescript-testing/typescript-chat-card-valid.js.map +2 -2
- package/dist/types/ChatCard.d.ts +3 -1
- package/dist/types/TruncatedTooltipText.d.ts +3 -1
- package/dist/types/constants/index.d.ts +21 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/react-desc-prop-types.d.ts +18 -9
- package/dist/types/tests/DSChatCard.a11y.test.d.ts +1 -0
- package/dist/types/tests/DSChatCard.api.test.d.ts +1 -0
- package/dist/types/tests/DSChatCard.axe.test.d.ts +1 -0
- package/dist/types/tests/DSChatCard.data-testId.test.d.ts +1 -0
- package/dist/types/tests/DSChatCard.events.test.d.ts +1 -0
- package/dist/types/tests/DSChatCard.exports.test.d.ts +1 -0
- package/dist/types/tests/DSChatCard.get-owner-props-arguments.test.d.ts +1 -0
- package/dist/types/tests/DSChatCard.keyboard.test.d.ts +1 -0
- package/package.json +8 -6
package/dist/cjs/ChatCard.js
CHANGED
|
@@ -29,7 +29,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var ChatCard_exports = {};
|
|
30
30
|
__export(ChatCard_exports, {
|
|
31
31
|
ChatCard: () => ChatCard,
|
|
32
|
-
ChatCardWithSchema: () => ChatCardWithSchema
|
|
32
|
+
ChatCardWithSchema: () => ChatCardWithSchema,
|
|
33
|
+
DSChatCard: () => DSChatCard,
|
|
34
|
+
DSChatCardWithSchema: () => DSChatCardWithSchema
|
|
33
35
|
});
|
|
34
36
|
module.exports = __toCommonJS(ChatCard_exports);
|
|
35
37
|
var React = __toESM(require("react"));
|
|
@@ -38,22 +40,77 @@ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
|
38
40
|
var import_TruncatedTooltipText = require("./TruncatedTooltipText.js");
|
|
39
41
|
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
40
42
|
var import_styled = require("./styled.js");
|
|
41
|
-
var
|
|
42
|
-
var import_DSChatCardDefinitions = require("./DSChatCardDefinitions.js");
|
|
43
|
+
var import_constants = require("./constants/index.js");
|
|
43
44
|
const ChatCard = (props) => {
|
|
44
45
|
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
|
|
45
|
-
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefault, import_react_desc_prop_types.propTypes,
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefault, import_react_desc_prop_types.propTypes, import_constants.DSChatCardName);
|
|
47
|
+
const globalAttrs = (0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefault);
|
|
48
|
+
const { wrap: wrapStripped, ...globalProps } = globalAttrs;
|
|
49
|
+
const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(propsWithDefault);
|
|
50
|
+
const { getOwnerProps, getOwnerPropsArguments } = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefault);
|
|
51
|
+
const { title, content, time, rightAddon, wrapText } = propsWithDefault;
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
53
|
+
import_styled.Wrapper,
|
|
54
|
+
{
|
|
55
|
+
...globalProps,
|
|
56
|
+
...xstyledProps,
|
|
57
|
+
cols: ["1fr", "auto"],
|
|
58
|
+
"data-testid": import_constants.CHAT_CARD_DATA_TESTID.ROOT,
|
|
59
|
+
getOwnerProps,
|
|
60
|
+
getOwnerPropsArguments,
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styled.MainContent, { getOwnerProps, getOwnerPropsArguments, children: [
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
import_styled.Title,
|
|
65
|
+
{
|
|
66
|
+
"data-testid": import_constants.CHAT_CARD_DATA_TESTID.TITLE,
|
|
67
|
+
getOwnerProps,
|
|
68
|
+
getOwnerPropsArguments,
|
|
69
|
+
children: title
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
|
+
import_styled.Content,
|
|
74
|
+
{
|
|
75
|
+
"data-testid": import_constants.CHAT_CARD_DATA_TESTID.CONTENT,
|
|
76
|
+
getOwnerProps,
|
|
77
|
+
getOwnerPropsArguments,
|
|
78
|
+
children: wrapText ? content : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
79
|
+
import_TruncatedTooltipText.TruncatedTooltipText,
|
|
80
|
+
{
|
|
81
|
+
value: content,
|
|
82
|
+
getOwnerProps,
|
|
83
|
+
getOwnerPropsArguments
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
time && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
89
|
+
import_styled.Time,
|
|
90
|
+
{
|
|
91
|
+
"data-testid": import_constants.CHAT_CARD_DATA_TESTID.TIME,
|
|
92
|
+
getOwnerProps,
|
|
93
|
+
getOwnerPropsArguments,
|
|
94
|
+
children: time
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] }),
|
|
98
|
+
rightAddon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
+
import_styled.RightAddon,
|
|
100
|
+
{
|
|
101
|
+
"data-testid": import_constants.CHAT_CARD_DATA_TESTID.RIGHT_ADDON,
|
|
102
|
+
getOwnerProps,
|
|
103
|
+
getOwnerPropsArguments,
|
|
104
|
+
children: rightAddon
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
);
|
|
55
110
|
};
|
|
56
|
-
ChatCard.displayName =
|
|
111
|
+
ChatCard.displayName = import_constants.DSChatCardName;
|
|
57
112
|
const ChatCardWithSchema = (0, import_ds_props_helpers.describe)(ChatCard);
|
|
58
113
|
ChatCardWithSchema.propTypes = import_react_desc_prop_types.propTypes;
|
|
114
|
+
const DSChatCard = ChatCard;
|
|
115
|
+
const DSChatCardWithSchema = ChatCardWithSchema;
|
|
59
116
|
//# sourceMappingURL=ChatCard.js.map
|
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 {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport {\n describe,\n useValidateTypescriptPropTypes,\n useMemoMergePropsWithDefault,\n useOwnerProps,\n useGetGlobalAttributes,\n useGetXstyledProps,\n} from '@elliemae/ds-props-helpers';\nimport { TruncatedTooltipText } from './TruncatedTooltipText.js';\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 { CHAT_CARD_DATA_TESTID, DSChatCardName } from './constants/index.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 globalAttrs = useGetGlobalAttributes(propsWithDefault);\n // strip `wrap` \u2014 Grid uses a strict literal type (`Wrap`) that collides with the generic string from globalAttributes.\n // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars\n const { wrap: wrapStripped, ...globalProps } = globalAttrs as typeof globalAttrs & { wrap?: unknown };\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n const { getOwnerProps, getOwnerPropsArguments } = useOwnerProps<DSChatCardT.Props>(propsWithDefault);\n\n const { title, content, time, rightAddon, wrapText } = propsWithDefault;\n return (\n <Wrapper\n {...globalProps}\n {...xstyledProps}\n cols={['1fr', 'auto']}\n // legacy data-testid \u2014 preserved for QA/consumer compatibility, breaking change if removed\n data-testid={CHAT_CARD_DATA_TESTID.ROOT}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <MainContent getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n <Title\n // legacy data-testid \u2014 preserved for QA/consumer compatibility, breaking change if removed\n data-testid={CHAT_CARD_DATA_TESTID.TITLE}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {title}\n </Title>\n <Content\n // legacy data-testid \u2014 preserved for QA/consumer compatibility, breaking change if removed\n data-testid={CHAT_CARD_DATA_TESTID.CONTENT}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {wrapText ? (\n content\n ) : (\n <TruncatedTooltipText\n value={content}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n )}\n </Content>\n {time && (\n <Time\n // legacy data-testid \u2014 preserved for QA/consumer compatibility, breaking change if removed\n data-testid={CHAT_CARD_DATA_TESTID.TIME}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {time}\n </Time>\n )}\n </MainContent>\n {rightAddon && (\n <RightAddon\n // legacy data-testid \u2014 preserved for QA/consumer compatibility, breaking change if removed\n data-testid={CHAT_CARD_DATA_TESTID.RIGHT_ADDON}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {rightAddon}\n </RightAddon>\n )}\n </Wrapper>\n );\n};\n\nChatCard.displayName = DSChatCardName;\nconst ChatCardWithSchema = describe(ChatCard);\nChatCardWithSchema.propTypes = propTypes as WeakValidationMap<unknown>;\n\n// DS-prefixed canonical names (modern Dimsum convention) \u2014 ChatCard kept as alias for backwards compat\nconst DSChatCard = ChatCard;\nconst DSChatCardWithSchema = ChatCardWithSchema;\n\nexport { ChatCard, ChatCardWithSchema, DSChatCard, DSChatCardWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADsCjB;AApCN,8BAOO;AACP,kCAAqC;AAErC,mCAAwC;AACxC,oBAAuE;AACvE,uBAAsD;AAEtD,MAAM,WAAmD,CAAC,UAAU;AAClE,QAAM,uBAAmB,sDAAwD,OAAO,yCAAY;AACpG,8DAA+B,kBAAkB,wCAAW,+BAAc;AAE1E,QAAM,kBAAc,gDAAuB,gBAAgB;AAG3D,QAAM,EAAE,MAAM,cAAc,GAAG,YAAY,IAAI;AAC/C,QAAM,mBAAe,4CAAmB,gBAAgB;AACxD,QAAM,EAAE,eAAe,uBAAuB,QAAI,uCAAiC,gBAAgB;AAEnG,QAAM,EAAE,OAAO,SAAS,MAAM,YAAY,SAAS,IAAI;AACvD,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACH,GAAG;AAAA,MACJ,MAAM,CAAC,OAAO,MAAM;AAAA,MAEpB,eAAa,uCAAsB;AAAA,MACnC;AAAA,MACA;AAAA,MAEA;AAAA,qDAAC,6BAAY,eAA8B,wBACzC;AAAA;AAAA,YAAC;AAAA;AAAA,cAEC,eAAa,uCAAsB;AAAA,cACnC;AAAA,cACA;AAAA,cAEC;AAAA;AAAA,UACH;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cAEC,eAAa,uCAAsB;AAAA,cACnC;AAAA,cACA;AAAA,cAEC,qBACC,UAEA;AAAA,gBAAC;AAAA;AAAA,kBACC,OAAO;AAAA,kBACP;AAAA,kBACA;AAAA;AAAA,cACF;AAAA;AAAA,UAEJ;AAAA,UACC,QACC;AAAA,YAAC;AAAA;AAAA,cAEC,eAAa,uCAAsB;AAAA,cACnC;AAAA,cACA;AAAA,cAEC;AAAA;AAAA,UACH;AAAA,WAEJ;AAAA,QACC,cACC;AAAA,UAAC;AAAA;AAAA,YAEC,eAAa,uCAAsB;AAAA,YACnC;AAAA,YACA;AAAA,YAEC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,SAAS,cAAc;AACvB,MAAM,yBAAqB,kCAAS,QAAQ;AAC5C,mBAAmB,YAAY;AAG/B,MAAM,aAAa;AACnB,MAAM,uBAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -32,11 +32,12 @@ __export(ChatCardDataTestIds_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(ChatCardDataTestIds_exports);
|
|
34
34
|
var React = __toESM(require("react"));
|
|
35
|
+
var import_constants = require("./constants/index.js");
|
|
35
36
|
const ChatCardDataTestIds = {
|
|
36
|
-
CARD_TITLE:
|
|
37
|
-
CARD_WRAPPER:
|
|
38
|
-
CARD_TIME:
|
|
39
|
-
CARD_RIGHT_ADDON:
|
|
40
|
-
CARD_CONTENT:
|
|
37
|
+
CARD_TITLE: import_constants.CHAT_CARD_DATA_TESTID.TITLE,
|
|
38
|
+
CARD_WRAPPER: import_constants.CHAT_CARD_DATA_TESTID.ROOT,
|
|
39
|
+
CARD_TIME: import_constants.CHAT_CARD_DATA_TESTID.TIME,
|
|
40
|
+
CARD_RIGHT_ADDON: import_constants.CHAT_CARD_DATA_TESTID.RIGHT_ADDON,
|
|
41
|
+
CARD_CONTENT: import_constants.CHAT_CARD_DATA_TESTID.CONTENT
|
|
41
42
|
};
|
|
42
43
|
//# sourceMappingURL=ChatCardDataTestIds.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/ChatCardDataTestIds.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["export const ChatCardDataTestIds = {\n CARD_TITLE:
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import { CHAT_CARD_DATA_TESTID } from './constants/index.js';\n\n// Legacy export \u2014 preserved for backwards compatibility with consumers importing { ChatCardDataTestIds }.\n// New consumers should import { CHAT_CARD_DATA_TESTID } from '@elliemae/ds-chat-card' instead.\nexport const ChatCardDataTestIds = {\n CARD_TITLE: CHAT_CARD_DATA_TESTID.TITLE,\n CARD_WRAPPER: CHAT_CARD_DATA_TESTID.ROOT,\n CARD_TIME: CHAT_CARD_DATA_TESTID.TIME,\n CARD_RIGHT_ADDON: CHAT_CARD_DATA_TESTID.RIGHT_ADDON,\n CARD_CONTENT: CHAT_CARD_DATA_TESTID.CONTENT,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAsC;AAI/B,MAAM,sBAAsB;AAAA,EACjC,YAAY,uCAAsB;AAAA,EAClC,cAAc,uCAAsB;AAAA,EACpC,WAAW,uCAAsB;AAAA,EACjC,kBAAkB,uCAAsB;AAAA,EACxC,cAAc,uCAAsB;AACtC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -37,14 +37,21 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
37
37
|
var import_react = require("react");
|
|
38
38
|
var import_ds_system = require("@elliemae/ds-system");
|
|
39
39
|
var import_ds_floating_context = require("@elliemae/ds-floating-context");
|
|
40
|
-
|
|
40
|
+
var import_constants = require("./constants/index.js");
|
|
41
|
+
const TruncatedSpan = (0, import_ds_system.styled)("span", {
|
|
42
|
+
name: import_constants.DSChatCardName,
|
|
43
|
+
slot: import_constants.CHAT_CARD_SLOTS.TRUNCATED_SPAN
|
|
44
|
+
})`
|
|
41
45
|
text-overflow: ellipsis;
|
|
42
46
|
white-space: nowrap;
|
|
43
47
|
overflow: hidden;
|
|
44
48
|
display: inline-block;
|
|
45
49
|
max-width: 100%;
|
|
46
50
|
`;
|
|
47
|
-
const TooltipContainer = import_ds_system.styled
|
|
51
|
+
const TooltipContainer = (0, import_ds_system.styled)("div", {
|
|
52
|
+
name: import_constants.DSChatCardName,
|
|
53
|
+
slot: import_constants.CHAT_CARD_SLOTS.TOOLTIP_CONTAINER
|
|
54
|
+
})`
|
|
48
55
|
text-align: center;
|
|
49
56
|
min-width: ${({ theme }) => theme.space.l};
|
|
50
57
|
max-width: 250px;
|
|
@@ -61,7 +68,12 @@ const TooltipContainer = import_ds_system.styled.div`
|
|
|
61
68
|
color: ${({ theme }) => theme.colors.neutral[600]};
|
|
62
69
|
pointer-events: none;
|
|
63
70
|
`;
|
|
64
|
-
const TruncatedTooltipText = ({
|
|
71
|
+
const TruncatedTooltipText = ({
|
|
72
|
+
value = "",
|
|
73
|
+
placement = "top",
|
|
74
|
+
getOwnerProps,
|
|
75
|
+
getOwnerPropsArguments
|
|
76
|
+
}) => {
|
|
65
77
|
const [showTooltip, setShowTooltip] = (0, import_react.useState)(false);
|
|
66
78
|
const { refs, floatingStyles, arrowStyles, context } = (0, import_ds_floating_context.useFloatingContext)({
|
|
67
79
|
placement,
|
|
@@ -76,7 +88,17 @@ const TruncatedTooltipText = ({ value = "", placement = "top" }) => {
|
|
|
76
88
|
setShowTooltip(false);
|
|
77
89
|
}, []);
|
|
78
90
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
79
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
92
|
+
TruncatedSpan,
|
|
93
|
+
{
|
|
94
|
+
innerRef: refs.setReference,
|
|
95
|
+
onMouseEnter: handleMouseEnter,
|
|
96
|
+
onMouseLeave: handleMouseLeave,
|
|
97
|
+
getOwnerProps,
|
|
98
|
+
getOwnerPropsArguments,
|
|
99
|
+
children: value
|
|
100
|
+
}
|
|
101
|
+
),
|
|
80
102
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
81
103
|
import_ds_floating_context.FloatingWrapper,
|
|
82
104
|
{
|
|
@@ -84,7 +106,7 @@ const TruncatedTooltipText = ({ value = "", placement = "top" }) => {
|
|
|
84
106
|
isOpen: showTooltip,
|
|
85
107
|
floatingStyles,
|
|
86
108
|
context,
|
|
87
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TooltipContainer, { children: [
|
|
109
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TooltipContainer, { getOwnerProps, getOwnerPropsArguments, children: [
|
|
88
110
|
value,
|
|
89
111
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_floating_context.PopoverArrow, { ...arrowStyles })
|
|
90
112
|
] })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/TruncatedTooltipText.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback, useState } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport {\n useFloatingContext,\n FloatingWrapper,\n PopoverArrow,\n type DSHookFloatingContextT,\n} from '@elliemae/ds-floating-context';\n\nconst TruncatedSpan = styled.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useState } from 'react';\nimport { styled } from '@elliemae/ds-system';\nimport {\n useFloatingContext,\n FloatingWrapper,\n PopoverArrow,\n type DSHookFloatingContextT,\n} from '@elliemae/ds-floating-context';\nimport { CHAT_CARD_SLOTS, DSChatCardName } from './constants/index.js';\n\nconst TruncatedSpan = styled('span', {\n name: DSChatCardName,\n slot: CHAT_CARD_SLOTS.TRUNCATED_SPAN,\n})`\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n display: inline-block;\n max-width: 100%;\n`;\n\n// Matches DSTooltipV3's StyledTooltipContainer styles for visual consistency\nconst TooltipContainer = styled('div', {\n name: DSChatCardName,\n slot: CHAT_CARD_SLOTS.TOOLTIP_CONTAINER,\n})`\n text-align: center;\n min-width: ${({ theme }) => theme.space.l};\n max-width: 250px;\n overflow-wrap: break-word;\n word-break: break-word;\n min-height: 30px;\n display: grid;\n align-items: center;\n padding: ${({ theme }) => `${theme.space.xxs} ${theme.space.xs}`};\n position: relative;\n background-color: white;\n border-radius: 2px;\n font-size: 13px;\n color: ${({ theme }) => theme.colors.neutral[600]};\n pointer-events: none;\n`;\n\ninterface TruncatedTooltipTextProps {\n value?: string;\n placement?: DSHookFloatingContextT.PopperPlacementsT;\n // received from the parent ChatCard so the internal styled elements participate in the slot system\n getOwnerProps?: () => object;\n getOwnerPropsArguments?: () => object;\n}\n\nconst TruncatedTooltipText = ({\n value = '',\n placement = 'top',\n getOwnerProps,\n getOwnerPropsArguments,\n}: TruncatedTooltipTextProps) => {\n const [showTooltip, setShowTooltip] = useState(false);\n\n const { refs, floatingStyles, arrowStyles, context } = useFloatingContext({\n placement,\n externallyControlledIsOpen: showTooltip,\n withoutAnimation: true,\n });\n\n const handleMouseEnter = useCallback((e: React.MouseEvent<HTMLSpanElement>) => {\n const el = e.currentTarget;\n setShowTooltip(el.offsetWidth < el.scrollWidth);\n }, []);\n\n const handleMouseLeave = useCallback(() => {\n setShowTooltip(false);\n }, []);\n\n return (\n <>\n <TruncatedSpan\n innerRef={refs.setReference}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {value}\n </TruncatedSpan>\n <FloatingWrapper\n innerRef={refs.setFloating}\n isOpen={showTooltip}\n floatingStyles={floatingStyles}\n context={context}\n >\n <TooltipContainer getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n {value}\n <PopoverArrow {...arrowStyles} />\n </TooltipContainer>\n </FloatingWrapper>\n </>\n );\n};\n\nexport { TruncatedTooltipText };\nexport default TruncatedTooltipText;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2EnB;AA3EJ,mBAA6C;AAC7C,uBAAuB;AACvB,iCAKO;AACP,uBAAgD;AAEhD,MAAM,oBAAgB,yBAAO,QAAQ;AAAA,EACnC,MAAM;AAAA,EACN,MAAM,iCAAgB;AACxB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASD,MAAM,uBAAmB,yBAAO,OAAO;AAAA,EACrC,MAAM;AAAA,EACN,MAAM,iCAAgB;AACxB,CAAC;AAAA;AAAA,eAEc,CAAC,EAAE,MAAM,MAAM,MAAM,MAAM,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAO9B,CAAC,EAAE,MAAM,MAAM,GAAG,MAAM,MAAM,GAAG,IAAI,MAAM,MAAM,EAAE,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,WAKvD,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG,CAAC;AAAA;AAAA;AAYnD,MAAM,uBAAuB,CAAC;AAAA,EAC5B,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ;AAAA,EACA;AACF,MAAiC;AAC/B,QAAM,CAAC,aAAa,cAAc,QAAI,uBAAS,KAAK;AAEpD,QAAM,EAAE,MAAM,gBAAgB,aAAa,QAAQ,QAAI,+CAAmB;AAAA,IACxE;AAAA,IACA,4BAA4B;AAAA,IAC5B,kBAAkB;AAAA,EACpB,CAAC;AAED,QAAM,uBAAmB,0BAAY,CAAC,MAAyC;AAC7E,UAAM,KAAK,EAAE;AACb,mBAAe,GAAG,cAAc,GAAG,WAAW;AAAA,EAChD,GAAG,CAAC,CAAC;AAEL,QAAM,uBAAmB,0BAAY,MAAM;AACzC,mBAAe,KAAK;AAAA,EACtB,GAAG,CAAC,CAAC;AAEL,SACE,4EACE;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,KAAK;AAAA,QACf,cAAc;AAAA,QACd,cAAc;AAAA,QACd;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,UAAU,KAAK;AAAA,QACf,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,QAEA,uDAAC,oBAAiB,eAA8B,wBAC7C;AAAA;AAAA,UACD,4CAAC,2CAAc,GAAG,aAAa;AAAA,WACjC;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAGA,IAAO,+BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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
|
+
var constants_exports = {};
|
|
30
|
+
__export(constants_exports, {
|
|
31
|
+
CHAT_CARD_DATA_TESTID: () => CHAT_CARD_DATA_TESTID,
|
|
32
|
+
CHAT_CARD_SLOTS: () => CHAT_CARD_SLOTS,
|
|
33
|
+
DSChatCardName: () => DSChatCardName
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(constants_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
38
|
+
const DSChatCardName = "DSChatcard";
|
|
39
|
+
const CHAT_CARD_SLOTS = {
|
|
40
|
+
ROOT: "root",
|
|
41
|
+
MAIN_CONTENT: "main-content",
|
|
42
|
+
TITLE: "title",
|
|
43
|
+
// legacy ones...
|
|
44
|
+
CONTENT: "content",
|
|
45
|
+
// legacy ones...
|
|
46
|
+
TIME: "time",
|
|
47
|
+
// legacy ones...
|
|
48
|
+
RIGHT_ADDON: "right-addon",
|
|
49
|
+
// legacy ones...
|
|
50
|
+
TRUNCATED_SPAN: "truncated-span",
|
|
51
|
+
TOOLTIP_CONTAINER: "tooltip-container"
|
|
52
|
+
};
|
|
53
|
+
const CHAT_CARD_DATA_TESTID = {
|
|
54
|
+
...(0, import_ds_system.slotObjectToDataTestIds)(DSChatCardName, CHAT_CARD_SLOTS),
|
|
55
|
+
ROOT: "chat-card-wrapper",
|
|
56
|
+
// legacy value — breaking change if removed
|
|
57
|
+
TITLE: "chat-card-title",
|
|
58
|
+
// legacy value — breaking change if removed
|
|
59
|
+
CONTENT: "chat-card-content",
|
|
60
|
+
// legacy value — breaking change if removed
|
|
61
|
+
TIME: "chat-card-time",
|
|
62
|
+
// legacy value — breaking change if removed
|
|
63
|
+
RIGHT_ADDON: "chat-right-addon"
|
|
64
|
+
// legacy value (missing `-card-` segment) — breaking change if removed
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/constants/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSChatCardName = 'DSChatcard';\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const CHAT_CARD_SLOTS = {\n ROOT: 'root',\n MAIN_CONTENT: 'main-content',\n TITLE: 'title', // legacy ones...\n CONTENT: 'content', // legacy ones...\n TIME: 'time', // legacy ones...\n RIGHT_ADDON: 'right-addon', // legacy ones...\n TRUNCATED_SPAN: 'truncated-span',\n TOOLTIP_CONTAINER: 'tooltip-container',\n} as const;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\n// legacy data-testid values predate the slot naming convention; preserved at three layers (constants + preserveLegacyDataTestId + inline JSX) \u2014 breaking change if removed.\n// Note: RIGHT_ADDON legacy value is `chat-right-addon` (missing the `-card-` middle segment) \u2014 historical quirk, preserved as-is.\nexport const CHAT_CARD_DATA_TESTID = {\n ...slotObjectToDataTestIds(DSChatCardName, CHAT_CARD_SLOTS),\n ROOT: 'chat-card-wrapper', // legacy value \u2014 breaking change if removed\n TITLE: 'chat-card-title', // legacy value \u2014 breaking change if removed\n CONTENT: 'chat-card-content', // legacy value \u2014 breaking change if removed\n TIME: 'chat-card-time', // legacy value \u2014 breaking change if removed\n RIGHT_ADDON: 'chat-right-addon', // legacy value (missing `-card-` segment) \u2014 breaking change if removed\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,iBAAiB;AAGvB,MAAM,kBAAkB;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAAA,EACd,OAAO;AAAA;AAAA,EACP,SAAS;AAAA;AAAA,EACT,MAAM;AAAA;AAAA,EACN,aAAa;AAAA;AAAA,EACb,gBAAgB;AAAA,EAChB,mBAAmB;AACrB;AAKO,MAAM,wBAAwB;AAAA,EACnC,OAAG,0CAAwB,gBAAgB,eAAe;AAAA,EAC1D,MAAM;AAAA;AAAA,EACN,OAAO;AAAA;AAAA,EACP,SAAS;AAAA;AAAA,EACT,MAAM;AAAA;AAAA,EACN,aAAa;AAAA;AACf;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -28,12 +28,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var index_exports = {};
|
|
30
30
|
__export(index_exports, {
|
|
31
|
+
CHAT_CARD_DATA_TESTID: () => import_constants.CHAT_CARD_DATA_TESTID,
|
|
32
|
+
CHAT_CARD_SLOTS: () => import_constants.CHAT_CARD_SLOTS,
|
|
31
33
|
ChatCard: () => import_ChatCard.ChatCard,
|
|
32
34
|
ChatCardDataTestIds: () => import_ChatCardDataTestIds.ChatCardDataTestIds,
|
|
33
|
-
ChatCardWithSchema: () => import_ChatCard.ChatCardWithSchema
|
|
35
|
+
ChatCardWithSchema: () => import_ChatCard.ChatCardWithSchema,
|
|
36
|
+
DSChatCard: () => import_ChatCard.DSChatCard,
|
|
37
|
+
DSChatCardName: () => import_constants.DSChatCardName,
|
|
38
|
+
DSChatCardWithSchema: () => import_ChatCard.DSChatCardWithSchema,
|
|
39
|
+
propTypes: () => import_react_desc_prop_types.propTypes
|
|
34
40
|
});
|
|
35
41
|
module.exports = __toCommonJS(index_exports);
|
|
36
42
|
var React = __toESM(require("react"));
|
|
37
43
|
var import_ChatCard = require("./ChatCard.js");
|
|
38
44
|
var import_ChatCardDataTestIds = require("./ChatCardDataTestIds.js");
|
|
45
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
46
|
+
var import_constants = require("./constants/index.js");
|
|
39
47
|
//# sourceMappingURL=index.js.map
|
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';\nexport type { DSChatCardT } from './react-desc-prop-types.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,
|
|
4
|
+
"sourcesContent": ["export { ChatCard, ChatCardWithSchema, DSChatCard, DSChatCardWithSchema } from './ChatCard.js';\nexport { ChatCardDataTestIds } from './ChatCardDataTestIds.js'; // LEGACY EXPORT\nexport { propTypes } from './react-desc-prop-types.js';\nexport type { DSChatCardT } from './react-desc-prop-types.js';\nexport { CHAT_CARD_DATA_TESTID, CHAT_CARD_SLOTS, DSChatCardName } from './constants/index.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,sBAA+E;AAC/E,iCAAoC;AACpC,mCAA0B;AAE1B,uBAAuE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -34,14 +34,20 @@ __export(react_desc_prop_types_exports, {
|
|
|
34
34
|
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
|
+
var import_constants = require("./constants/index.js");
|
|
37
38
|
const defaultProps = {
|
|
38
39
|
content: "",
|
|
39
|
-
time: ""
|
|
40
|
+
time: "",
|
|
41
|
+
wrapText: false
|
|
40
42
|
};
|
|
41
43
|
const propTypes = {
|
|
44
|
+
...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_constants.DSChatCardName, import_constants.CHAT_CARD_SLOTS),
|
|
45
|
+
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
46
|
+
...import_ds_props_helpers.xstyledPropTypes,
|
|
42
47
|
title: import_ds_props_helpers.PropTypes.string.isRequired.description(`Card's title`),
|
|
43
|
-
content: import_ds_props_helpers.PropTypes.string.description(`Card's content`),
|
|
44
|
-
time: import_ds_props_helpers.PropTypes.string.description("Time"),
|
|
45
|
-
rightAddon: import_ds_props_helpers.PropTypes.element.description("Right addon, badge or icon")
|
|
48
|
+
content: import_ds_props_helpers.PropTypes.string.description(`Card's content`).defaultValue(defaultProps.content),
|
|
49
|
+
time: import_ds_props_helpers.PropTypes.string.description("Time").defaultValue(defaultProps.time),
|
|
50
|
+
rightAddon: import_ds_props_helpers.PropTypes.element.description("Right addon, badge or icon"),
|
|
51
|
+
wrapText: import_ds_props_helpers.PropTypes.bool.description("When true, content wraps instead of being truncated with an ellipsis + tooltip.").defaultValue(defaultProps.wrapText)
|
|
46
52
|
};
|
|
47
53
|
//# 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": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { DSPropTypesSchema, GlobalAttributesT, XstyledProps } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { CHAT_CARD_SLOTS, DSChatCardName } from './constants/index.js';\n\nexport declare namespace DSChatCardT {\n // hand-written per-slot function argument map \u2014 one entry per slot in CHAT_CARD_SLOTS\n export type SlotFunctionArguments = {\n dsChatcardRoot: () => object;\n dsChatcardMainContent: () => object;\n dsChatcardTitle: () => object;\n dsChatcardContent: () => object;\n dsChatcardTime: () => object;\n dsChatcardRightAddon: () => object;\n dsChatcardTruncatedSpan: () => object;\n dsChatcardTooltipContainer: () => object;\n };\n\n export interface RequiredProps {\n title: string;\n }\n\n export interface DefaultProps {\n content: string;\n time: string;\n wrapText: boolean;\n }\n\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSChatCardName, typeof CHAT_CARD_SLOTS> {\n rightAddon?: JSX.Element;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps>,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSChatCardT.DefaultProps = {\n content: '',\n time: '',\n wrapText: false,\n};\n\nexport const propTypes: DSPropTypesSchema<DSChatCardT.Props> = {\n ...getPropsPerSlotPropTypes(DSChatCardName, CHAT_CARD_SLOTS),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n title: PropTypes.string.isRequired.description(`Card's title`),\n content: PropTypes.string.description(`Card's content`).defaultValue(defaultProps.content),\n time: PropTypes.string.description('Time').defaultValue(defaultProps.time),\n rightAddon: PropTypes.element.description('Right addon, badge or icon'),\n wrapText: PropTypes.bool\n .description('When true, content wraps instead of being truncated with an ellipsis + tooltip.')\n .defaultValue(defaultProps.wrapText),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAKO;AAEP,uBAAgD;AA6CzC,MAAM,eAAyC;AAAA,EACpD,SAAS;AAAA,EACT,MAAM;AAAA,EACN,UAAU;AACZ;AAEO,MAAM,YAAkD;AAAA,EAC7D,OAAG,kDAAyB,iCAAgB,gCAAe;AAAA,EAC3D,GAAG;AAAA,EACH,GAAG;AAAA,EACH,OAAO,kCAAU,OAAO,WAAW,YAAY,cAAc;AAAA,EAC7D,SAAS,kCAAU,OAAO,YAAY,gBAAgB,EAAE,aAAa,aAAa,OAAO;AAAA,EACzF,MAAM,kCAAU,OAAO,YAAY,MAAM,EAAE,aAAa,aAAa,IAAI;AAAA,EACzE,YAAY,kCAAU,QAAQ,YAAY,4BAA4B;AAAA,EACtE,UAAU,kCAAU,KACjB,YAAY,iFAAiF,EAC7F,aAAa,aAAa,QAAQ;AACvC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/styled.js
CHANGED
|
@@ -39,25 +39,49 @@ module.exports = __toCommonJS(styled_exports);
|
|
|
39
39
|
var React = __toESM(require("react"));
|
|
40
40
|
var import_ds_system = require("@elliemae/ds-system");
|
|
41
41
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
42
|
-
|
|
42
|
+
var import_constants = require("./constants/index.js");
|
|
43
|
+
const Wrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, {
|
|
44
|
+
name: import_constants.DSChatCardName,
|
|
45
|
+
slot: import_constants.CHAT_CARD_SLOTS.ROOT,
|
|
46
|
+
// legacy data-testid `chat-card-wrapper` is preserved via inline JSX data-testid
|
|
47
|
+
preserveLegacyDataTestId: true
|
|
48
|
+
})`
|
|
43
49
|
min-width: 248px;
|
|
44
50
|
border: 1px;
|
|
45
51
|
border-bottom: 1px solid #ccc;
|
|
46
52
|
padding: 12px 12px;
|
|
47
53
|
`;
|
|
48
|
-
const MainContent = import_ds_system.styled
|
|
49
|
-
|
|
54
|
+
const MainContent = (0, import_ds_system.styled)("div", {
|
|
55
|
+
name: import_constants.DSChatCardName,
|
|
56
|
+
slot: import_constants.CHAT_CARD_SLOTS.MAIN_CONTENT
|
|
57
|
+
})``;
|
|
58
|
+
const Title = (0, import_ds_system.styled)("p", {
|
|
59
|
+
name: import_constants.DSChatCardName,
|
|
60
|
+
slot: import_constants.CHAT_CARD_SLOTS.TITLE,
|
|
61
|
+
// legacy data-testid `chat-card-title` is preserved via inline JSX data-testid
|
|
62
|
+
preserveLegacyDataTestId: true
|
|
63
|
+
})`
|
|
50
64
|
font-size: 16px;
|
|
51
65
|
font-weight: 600;
|
|
52
66
|
margin: 0;
|
|
53
67
|
`;
|
|
54
|
-
const Content = import_ds_system.styled
|
|
68
|
+
const Content = (0, import_ds_system.styled)("p", {
|
|
69
|
+
name: import_constants.DSChatCardName,
|
|
70
|
+
slot: import_constants.CHAT_CARD_SLOTS.CONTENT,
|
|
71
|
+
// legacy data-testid `chat-card-content` is preserved via inline JSX data-testid
|
|
72
|
+
preserveLegacyDataTestId: true
|
|
73
|
+
})`
|
|
55
74
|
font-size: 12px;
|
|
56
75
|
font-weight: 400;
|
|
57
76
|
line-height: 1;
|
|
58
77
|
margin: 0;
|
|
59
78
|
`;
|
|
60
|
-
const Time = import_ds_system.styled
|
|
79
|
+
const Time = (0, import_ds_system.styled)("p", {
|
|
80
|
+
name: import_constants.DSChatCardName,
|
|
81
|
+
slot: import_constants.CHAT_CARD_SLOTS.TIME,
|
|
82
|
+
// legacy data-testid `chat-card-time` is preserved via inline JSX data-testid
|
|
83
|
+
preserveLegacyDataTestId: true
|
|
84
|
+
})`
|
|
61
85
|
font-size: 12px;
|
|
62
86
|
font-weight: 100;
|
|
63
87
|
margin: 0;
|
|
@@ -65,7 +89,12 @@ const Time = import_ds_system.styled.p`
|
|
|
65
89
|
font-weight: ${(props) => props.theme.fontWeights.regular};
|
|
66
90
|
color: ${(props) => props.theme.colors.neutral["500"]};
|
|
67
91
|
`;
|
|
68
|
-
const RightAddon = import_ds_system.styled
|
|
92
|
+
const RightAddon = (0, import_ds_system.styled)("div", {
|
|
93
|
+
name: import_constants.DSChatCardName,
|
|
94
|
+
slot: import_constants.CHAT_CARD_SLOTS.RIGHT_ADDON,
|
|
95
|
+
// legacy data-testid `chat-right-addon` (missing `-card-` segment) is preserved via inline JSX data-testid
|
|
96
|
+
preserveLegacyDataTestId: true
|
|
97
|
+
})`
|
|
69
98
|
height: fit-content;
|
|
70
99
|
margin-left: 12px;
|
|
71
100
|
`;
|
package/dist/cjs/styled.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/styled.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\n\nexport const Wrapper = styled(Grid)`\n min-width: 248px;\n border: 1px;\n border-bottom: 1px solid #ccc;\n padding: 12px 12px;\n`;\n\nexport const MainContent = styled.
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,qBAAqB;
|
|
4
|
+
"sourcesContent": ["import { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { CHAT_CARD_SLOTS, DSChatCardName } from './constants/index.js';\n\nexport const Wrapper = styled(Grid, {\n name: DSChatCardName,\n slot: CHAT_CARD_SLOTS.ROOT,\n // legacy data-testid `chat-card-wrapper` is preserved via inline JSX data-testid\n preserveLegacyDataTestId: true,\n})`\n min-width: 248px;\n border: 1px;\n border-bottom: 1px solid #ccc;\n padding: 12px 12px;\n`;\n\nexport const MainContent = styled('div', {\n name: DSChatCardName,\n slot: CHAT_CARD_SLOTS.MAIN_CONTENT,\n})``;\n\nexport const Title = styled('p', {\n name: DSChatCardName,\n slot: CHAT_CARD_SLOTS.TITLE,\n // legacy data-testid `chat-card-title` is preserved via inline JSX data-testid\n preserveLegacyDataTestId: true,\n})`\n font-size: 16px;\n font-weight: 600;\n margin: 0;\n`;\n\nexport const Content = styled('p', {\n name: DSChatCardName,\n slot: CHAT_CARD_SLOTS.CONTENT,\n // legacy data-testid `chat-card-content` is preserved via inline JSX data-testid\n preserveLegacyDataTestId: true,\n})`\n font-size: 12px;\n font-weight: 400;\n line-height: 1;\n margin: 0;\n`;\n\nexport const Time = styled('p', {\n name: DSChatCardName,\n slot: CHAT_CARD_SLOTS.TIME,\n // legacy data-testid `chat-card-time` is preserved via inline JSX data-testid\n preserveLegacyDataTestId: true,\n})`\n font-size: 12px;\n font-weight: 100;\n margin: 0;\n margin-top: 8px;\n font-weight: ${(props) => props.theme.fontWeights.regular};\n color: ${(props) => props.theme.colors.neutral['500']};\n`;\n\nexport const RightAddon = styled('div', {\n name: DSChatCardName,\n slot: CHAT_CARD_SLOTS.RIGHT_ADDON,\n // legacy data-testid `chat-right-addon` (missing `-card-` segment) is preserved via inline JSX data-testid\n preserveLegacyDataTestId: true,\n})`\n height: fit-content;\n margin-left: 12px;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAuB;AACvB,qBAAqB;AACrB,uBAAgD;AAEzC,MAAM,cAAU,yBAAO,qBAAM;AAAA,EAClC,MAAM;AAAA,EACN,MAAM,iCAAgB;AAAA;AAAA,EAEtB,0BAA0B;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAOM,MAAM,kBAAc,yBAAO,OAAO;AAAA,EACvC,MAAM;AAAA,EACN,MAAM,iCAAgB;AACxB,CAAC;AAEM,MAAM,YAAQ,yBAAO,KAAK;AAAA,EAC/B,MAAM;AAAA,EACN,MAAM,iCAAgB;AAAA;AAAA,EAEtB,0BAA0B;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAMM,MAAM,cAAU,yBAAO,KAAK;AAAA,EACjC,MAAM;AAAA,EACN,MAAM,iCAAgB;AAAA;AAAA,EAEtB,0BAA0B;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAOM,MAAM,WAAO,yBAAO,KAAK;AAAA,EAC9B,MAAM;AAAA,EACN,MAAM,iCAAgB;AAAA;AAAA,EAEtB,0BAA0B;AAC5B,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,iBAKgB,CAAC,UAAU,MAAM,MAAM,YAAY,OAAO;AAAA,WAChD,CAAC,UAAU,MAAM,MAAM,OAAO,QAAQ,KAAK,CAAC;AAAA;AAGhD,MAAM,iBAAa,yBAAO,OAAO;AAAA,EACtC,MAAM;AAAA,EACN,MAAM,iCAAgB;AAAA;AAAA,EAEtB,0BAA0B;AAC5B,CAAC;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -46,7 +46,8 @@ const testPropsAsSyntax = {
|
|
|
46
46
|
};
|
|
47
47
|
const testCompleteDefaults = {
|
|
48
48
|
content: "",
|
|
49
|
-
time: ""
|
|
49
|
+
time: "",
|
|
50
|
+
wrapText: false
|
|
50
51
|
};
|
|
51
52
|
const testInternalProps = {
|
|
52
53
|
...testRequiredProps,
|
|
@@ -62,7 +63,8 @@ const testExplicitDefinition = {
|
|
|
62
63
|
title: "",
|
|
63
64
|
content: "",
|
|
64
65
|
time: "",
|
|
65
|
-
rightAddon: MockAddon()
|
|
66
|
+
rightAddon: MockAddon(),
|
|
67
|
+
wrapText: true
|
|
66
68
|
};
|
|
67
69
|
const testInferedTypeCompatibility = {
|
|
68
70
|
title: "",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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;
|
|
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 wrapText: false,\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 wrapText: true,\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;AAAA,EACN,UAAU;AACZ;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;AAAA,EACtB,UAAU;AACZ;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
6
|
"names": []
|
|
7
7
|
}
|