@topconsultnpm/sdkui-react-beta 6.12.70 → 6.12.72
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.
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import TMTooltip from './TMTooltip';
|
3
3
|
const TMUserAvatar = (props) => {
|
4
|
-
const {
|
4
|
+
const { displayName, nameForColorCalculation, tooltipName, returnType } = props;
|
5
5
|
// Helper function to generate dark color from name
|
6
6
|
const generateDarkColorFromName = (str) => {
|
7
7
|
let hash = 0;
|
@@ -34,8 +34,8 @@ const TMUserAvatar = (props) => {
|
|
34
34
|
}
|
35
35
|
return name[0].toUpperCase();
|
36
36
|
};
|
37
|
-
const initials = extractInitialsFromName(
|
38
|
-
const bgColor = generateDarkColorFromName(
|
37
|
+
const initials = extractInitialsFromName(displayName ?? '-');
|
38
|
+
const bgColor = generateDarkColorFromName(nameForColorCalculation ?? '-');
|
39
39
|
if (returnType === 'svg') {
|
40
40
|
return `
|
41
41
|
<svg width="30" height="30" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
|
@@ -46,7 +46,7 @@ const TMUserAvatar = (props) => {
|
|
46
46
|
</svg>
|
47
47
|
`.trim();
|
48
48
|
}
|
49
|
-
return (_jsx(TMTooltip, { content: tooltipName ??
|
49
|
+
return (_jsx(TMTooltip, { content: tooltipName ?? displayName, children: _jsx("div", { style: {
|
50
50
|
width: "40px",
|
51
51
|
height: "40px",
|
52
52
|
borderRadius: "50%",
|
@@ -31,6 +31,8 @@ export { default as TMCheckBox } from './editors/TMCheckBox';
|
|
31
31
|
export { default as TMRadioButton } from './editors/TMRadioButton';
|
32
32
|
export { default as TMDateBox } from './editors/TMDateBox';
|
33
33
|
export { default as TMMetadataEditor } from './editors/TMMetadataEditor';
|
34
|
+
export { default as TMHtmlContentDisplay } from './editors/TMHtmlContentDisplay';
|
35
|
+
export { default as TMHtmlEditor } from './editors/TMHtmlEditor';
|
34
36
|
export * from './editors/TMFormulaEditor';
|
35
37
|
export * from './editors/TMMetadataValues';
|
36
38
|
export { editorColorManager } from './editors/TMEditorStyled';
|
package/lib/components/index.js
CHANGED
@@ -33,6 +33,8 @@ export { default as TMCheckBox } from './editors/TMCheckBox';
|
|
33
33
|
export { default as TMRadioButton } from './editors/TMRadioButton';
|
34
34
|
export { default as TMDateBox } from './editors/TMDateBox';
|
35
35
|
export { default as TMMetadataEditor } from './editors/TMMetadataEditor';
|
36
|
+
export { default as TMHtmlContentDisplay } from './editors/TMHtmlContentDisplay';
|
37
|
+
export { default as TMHtmlEditor } from './editors/TMHtmlEditor';
|
36
38
|
export * from './editors/TMFormulaEditor';
|
37
39
|
export * from './editors/TMMetadataValues';
|
38
40
|
export { editorColorManager } from './editors/TMEditorStyled';
|
@@ -7,13 +7,14 @@ const meta = {
|
|
7
7
|
decorators: [(Story) => (_jsxs(TMDeviceProvider, { children: [" ", _jsx(Story, {}), " "] })),],
|
8
8
|
tags: ['autodocs'],
|
9
9
|
args: {
|
10
|
-
|
10
|
+
displayName: 'Test User',
|
11
|
+
nameForColorCalculation: 'Test User',
|
11
12
|
},
|
12
13
|
};
|
13
14
|
export default meta;
|
14
15
|
export const MultipleAvatars = {
|
15
16
|
render: () => {
|
16
17
|
const names = ['Luca', 'Claudio', 'Marco', 'Alessia', 'Giorgio', 'Ashkan', 'Joele', 'Alessandro'];
|
17
|
-
return (_jsx("div", { style: { display: 'flex', gap: '10px', flexWrap: 'wrap' }, children: names.map((name, index) => (_jsx(TMUserAvatar, { name: name }, index))) }));
|
18
|
+
return (_jsx("div", { style: { display: 'flex', gap: '10px', flexWrap: 'wrap' }, children: names.map((name, index) => (_jsx(TMUserAvatar, { displayName: name, nameForColorCalculation: name }, index))) }));
|
18
19
|
},
|
19
20
|
};
|