@pallasoft/ps-core-components 2.38.0 → 2.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ps-avatar-button.d.ts +9 -0
- package/dist/components/ps-avatar-button.js +8 -0
- package/dist/components/ps-avatar.d.ts +9 -0
- package/dist/components/ps-avatar.js +13 -0
- package/dist/components/ps-text-link.d.ts +3 -2
- package/dist/constants/ps-avatar-config.d.ts +5 -0
- package/dist/constants/ps-avatar-config.js +8 -0
- package/dist/esm/components/ps-avatar-button.js +4 -0
- package/dist/esm/components/ps-avatar.js +9 -0
- package/dist/esm/constants/ps-avatar-config.js +5 -0
- package/dist/esm/index.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MouseEventHandler } from 'react';
|
|
2
|
+
import { type PsAvatarProps } from './ps-avatar';
|
|
3
|
+
export interface PsAvatarButtonProps extends Omit<PsAvatarProps, 'alt' | 'className'> {
|
|
4
|
+
className?: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
label: string;
|
|
7
|
+
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
8
|
+
}
|
|
9
|
+
export declare const PsAvatarButton: ({ className, id, label, onClick, ...avatar }: PsAvatarButtonProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsAvatarButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
6
|
+
const ps_avatar_1 = require("./ps-avatar");
|
|
7
|
+
const PsAvatarButton = ({ className, id, label, onClick, ...avatar }) => ((0, jsx_runtime_1.jsx)("button", { "aria-label": label, className: ps_design_system_1.PallasoftClassNameService.merge('ps-focus-ring inline-flex shrink-0 rounded-full transition-shadow hover:ring-2 hover:ring-primary/35', className), id: id, onClick: onClick, title: label, type: 'button', children: (0, jsx_runtime_1.jsx)(ps_avatar_1.PsAvatar, { ...avatar }) }));
|
|
8
|
+
exports.PsAvatarButton = PsAvatarButton;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PsAvatarSizeClassNames } from '../constants/ps-avatar-config';
|
|
2
|
+
export interface PsAvatarProps {
|
|
3
|
+
alt?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
initials: string;
|
|
6
|
+
size?: keyof typeof PsAvatarSizeClassNames;
|
|
7
|
+
src?: string | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const PsAvatar: ({ alt, className, initials, size, src }: PsAvatarProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsAvatar = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const ps_design_system_1 = require("@pallasoft/ps-design-system");
|
|
7
|
+
const ps_avatar_config_1 = require("../constants/ps-avatar-config");
|
|
8
|
+
const PsAvatar = ({ alt = '', className, initials, size = 'small', src }) => {
|
|
9
|
+
const [hasFailed, setHasFailed] = (0, react_1.useState)(false);
|
|
10
|
+
const sizeClassName = ps_avatar_config_1.PsAvatarSizeClassNames[size];
|
|
11
|
+
return src === null || src === undefined || src === '' || hasFailed ? ((0, jsx_runtime_1.jsx)("span", { "aria-hidden": alt === '' ? 'true' : undefined, "aria-label": alt === '' ? undefined : alt, className: ps_design_system_1.PallasoftClassNameService.merge('flex shrink-0 items-center justify-center rounded-full bg-primary/15 font-bold text-primary', sizeClassName, className), children: initials })) : ((0, jsx_runtime_1.jsx)("img", { alt: alt, className: ps_design_system_1.PallasoftClassNameService.merge('shrink-0 rounded-full object-cover', sizeClassName, className), decoding: 'async', loading: 'lazy', onError: () => setHasFailed(true), src: src }));
|
|
12
|
+
};
|
|
13
|
+
exports.PsAvatar = PsAvatar;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ElementType, ReactNode } from 'react';
|
|
1
|
+
import type { ElementType, KeyboardEventHandler, MouseEventHandler, ReactNode } from 'react';
|
|
2
2
|
export interface PsTextLinkProps {
|
|
3
3
|
'aria-label'?: string;
|
|
4
4
|
'children': ReactNode;
|
|
@@ -6,7 +6,8 @@ export interface PsTextLinkProps {
|
|
|
6
6
|
'href'?: string;
|
|
7
7
|
'id'?: string;
|
|
8
8
|
'LinkComponent'?: ElementType;
|
|
9
|
-
'onClick'?:
|
|
9
|
+
'onClick'?: MouseEventHandler<HTMLElement>;
|
|
10
|
+
'onKeyDown'?: KeyboardEventHandler<HTMLElement>;
|
|
10
11
|
'size'?: 'compact' | 'default';
|
|
11
12
|
}
|
|
12
13
|
export declare const PsTextLink: ({ children, className, href, LinkComponent, onClick, size, ...props }: PsTextLinkProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
|
|
3
|
+
import { PsAvatar } from './ps-avatar.js';
|
|
4
|
+
export const PsAvatarButton = ({ className, id, label, onClick, ...avatar }) => (_jsx("button", { "aria-label": label, className: PallasoftClassNameService.merge('ps-focus-ring inline-flex shrink-0 rounded-full transition-shadow hover:ring-2 hover:ring-primary/35', className), id: id, onClick: onClick, title: label, type: 'button', children: _jsx(PsAvatar, { ...avatar }) }));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { PallasoftClassNameService } from '@pallasoft/ps-design-system';
|
|
4
|
+
import { PsAvatarSizeClassNames } from '../constants/ps-avatar-config.js';
|
|
5
|
+
export const PsAvatar = ({ alt = '', className, initials, size = 'small', src }) => {
|
|
6
|
+
const [hasFailed, setHasFailed] = useState(false);
|
|
7
|
+
const sizeClassName = PsAvatarSizeClassNames[size];
|
|
8
|
+
return src === null || src === undefined || src === '' || hasFailed ? (_jsx("span", { "aria-hidden": alt === '' ? 'true' : undefined, "aria-label": alt === '' ? undefined : alt, className: PallasoftClassNameService.merge('flex shrink-0 items-center justify-center rounded-full bg-primary/15 font-bold text-primary', sizeClassName, className), children: initials })) : (_jsx("img", { alt: alt, className: PallasoftClassNameService.merge('shrink-0 rounded-full object-cover', sizeClassName, className), decoding: 'async', loading: 'lazy', onError: () => setHasFailed(true), src: src }));
|
|
9
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './components/ps-layer.js';
|
|
2
2
|
export * from './components/ps-accordion.js';
|
|
3
3
|
export * from './components/ps-action-tile.js';
|
|
4
|
+
export * from './components/ps-avatar.js';
|
|
5
|
+
export * from './components/ps-avatar-button.js';
|
|
4
6
|
export * from './components/ps-action-tile-link.js';
|
|
5
7
|
export * from './components/ps-audio-spectrum.js';
|
|
6
8
|
export * from './constants/ps-audio-spectrum-config.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './components/ps-layer';
|
|
2
2
|
export * from './components/ps-accordion';
|
|
3
3
|
export * from './components/ps-action-tile';
|
|
4
|
+
export * from './components/ps-avatar';
|
|
5
|
+
export * from './components/ps-avatar-button';
|
|
4
6
|
export * from './components/ps-action-tile-link';
|
|
5
7
|
export * from './components/ps-audio-spectrum';
|
|
6
8
|
export * from './constants/ps-audio-spectrum-config';
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./components/ps-layer"), exports);
|
|
18
18
|
__exportStar(require("./components/ps-accordion"), exports);
|
|
19
19
|
__exportStar(require("./components/ps-action-tile"), exports);
|
|
20
|
+
__exportStar(require("./components/ps-avatar"), exports);
|
|
21
|
+
__exportStar(require("./components/ps-avatar-button"), exports);
|
|
20
22
|
__exportStar(require("./components/ps-action-tile-link"), exports);
|
|
21
23
|
__exportStar(require("./components/ps-audio-spectrum"), exports);
|
|
22
24
|
__exportStar(require("./constants/ps-audio-spectrum-config"), exports);
|