tycho-components 0.2.6-SNAPSHOT → 0.2.6-SNAPSHOT-2
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/AppClipboard/AppClipboard.d.ts +8 -0
- package/dist/AppClipboard/AppClipboard.js +16 -0
- package/dist/AppClipboard/index.d.ts +2 -0
- package/dist/AppClipboard/index.js +2 -0
- package/dist/AppClipboard/style.scss +29 -0
- package/dist/Header/HeaderUser/HeaderUser.js +1 -1
- package/dist/functions/UsabilityUtils.d.ts +1 -0
- package/dist/functions/UsabilityUtils.js +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ButtonDSSizes } from 'tycho-storybook/dist/Button/Button';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
type Props = {
|
|
4
|
+
text: string;
|
|
5
|
+
size?: ButtonDSSizes;
|
|
6
|
+
};
|
|
7
|
+
export default function AppClipboard({ text, size }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { IconButton } from 'tycho-storybook';
|
|
4
|
+
import { useMessageUtils } from '../configs/useMessageUtils';
|
|
5
|
+
import UsabilityUtils from '../functions/UsabilityUtils';
|
|
6
|
+
import './style.scss';
|
|
7
|
+
export default function AppClipboard({ text, size = 'x-small' }) {
|
|
8
|
+
const { t } = useTranslation('home');
|
|
9
|
+
const { dispatchMessage } = useMessageUtils();
|
|
10
|
+
const handleCopy = () => {
|
|
11
|
+
UsabilityUtils.copy(text, () => {
|
|
12
|
+
dispatchMessage({ key: 'message.copy.clipboard', t });
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
return (_jsx(IconButton, { name: "content_copy", title: t('tooltip.copy.clipboard'), onClick: handleCopy, size: size }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
.editable-container-readonly {
|
|
2
|
+
.editable-line {
|
|
3
|
+
margin-top: var(--spacing-small);
|
|
4
|
+
|
|
5
|
+
.title {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
margin-bottom: var(--spacing-xsmall);
|
|
9
|
+
|
|
10
|
+
h6 {
|
|
11
|
+
margin-bottom: 0px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.info {
|
|
15
|
+
width: 16px;
|
|
16
|
+
height: 16px;
|
|
17
|
+
margin-left: var(--spacing-xsmall);
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.color-display {
|
|
23
|
+
width: 36px;
|
|
24
|
+
height: 36px;
|
|
25
|
+
border-radius: var(--border-radius);
|
|
26
|
+
border: var(--border-default);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -10,7 +10,7 @@ export default function HeaderUser({ navigateLogout }) {
|
|
|
10
10
|
const [open, setOpen] = useState(false);
|
|
11
11
|
const handleProfile = () => {
|
|
12
12
|
setOpen(false);
|
|
13
|
-
window.open(import.meta.env.
|
|
13
|
+
window.open(import.meta.env.VITE_APP_RESERVED_URL, '_blank');
|
|
14
14
|
};
|
|
15
15
|
return (_jsxs("div", { className: "header-user-container", children: [isLogged() ? (_jsx(ProfileDropdown, { src: getLogged()?.picture, title: getLogged()?.name || getLogged()?.sub, onClick: (b) => setOpen(b) })) : (_jsx(Avatar, { size: "small", onClick: () => (location.href = '/auth') })), open && isLogged() && (_jsxs("div", { className: "ds-dropdown-list", children: [_jsx("div", { className: "ds-dropdown-itemlist", children: _jsx("span", { className: "label", children: `${t('profile.label.hello')} ${getLogged()?.name || getLogged()?.sub}` }) }), _jsxs("div", { className: "ds-dropdown-itemlist d-none", children: [_jsx(Icon, { name: "colors", size: "x-small" }), _jsx("span", { className: "label", children: t('profile.label.theme') })] }), _jsxs("div", { className: "ds-dropdown-itemlist", onClick: handleProfile, children: [_jsx(Icon, { name: "person", size: "x-small" }), _jsx("span", { className: "label", children: t('profile.label.home') })] }), _jsxs("div", { className: "ds-dropdown-itemlist", children: [_jsx(Icon, { name: "live_help", size: "x-small" }), _jsx("span", { className: "label", children: t('profile.label.help') })] }), _jsxs("div", { className: "ds-dropdown-itemlist", onClick: () => {
|
|
16
16
|
setOpen(false);
|
|
@@ -5,5 +5,6 @@ declare const UsabilityUtils: {
|
|
|
5
5
|
goToAnchor: (anchorId: string, e?: any) => void;
|
|
6
6
|
isDesktop: () => boolean;
|
|
7
7
|
attachEnter: (event: React.KeyboardEvent<HTMLInputElement>, handleEnter: () => void) => void;
|
|
8
|
+
copy: (text: string, callback?: () => void) => void;
|
|
8
9
|
};
|
|
9
10
|
export default UsabilityUtils;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
const isDesktop = () => import.meta.env.VITE_APP_ENV === 'desktop';
|
|
2
|
+
const copy = (text, callback) => {
|
|
3
|
+
navigator.clipboard.writeText(text).then(() => {
|
|
4
|
+
callback && callback();
|
|
5
|
+
});
|
|
6
|
+
};
|
|
2
7
|
const attachEnter = (event, handleEnter) => {
|
|
3
8
|
// 'keypress' event misbehaves on mobile so we track 'Enter' key via 'keydown' event
|
|
4
9
|
if (event.key === 'Enter') {
|
|
@@ -37,5 +42,6 @@ const UsabilityUtils = {
|
|
|
37
42
|
goToAnchor,
|
|
38
43
|
isDesktop,
|
|
39
44
|
attachEnter,
|
|
45
|
+
copy,
|
|
40
46
|
};
|
|
41
47
|
export default UsabilityUtils;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as AppAnalytics } from './AppAnalytics';
|
|
2
|
+
export { default as AppClipboard } from './AppClipboard';
|
|
2
3
|
export { default as AppColorpicker } from './AppColorpicker';
|
|
3
4
|
export { default as AppDropzone } from './AppDropzone';
|
|
4
5
|
export type { UploadedFile } from './AppDropzone/UploadedFile';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as AppAnalytics } from './AppAnalytics';
|
|
2
|
+
export { default as AppClipboard } from './AppClipboard';
|
|
2
3
|
export { default as AppColorpicker } from './AppColorpicker';
|
|
3
4
|
export { default as AppDropzone } from './AppDropzone';
|
|
4
5
|
export { default as AppEditable } from './AppEditable';
|