@paul-portfolio/react 0.1.13 → 0.1.14
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/package.json +6 -1
- package/dist/Avatar.d.ts +0 -8
- package/dist/Avatar.js +0 -5
- package/dist/Badge.d.ts +0 -8
- package/dist/Badge.js +0 -5
- package/dist/Button.d.ts +0 -19
- package/dist/Button.js +0 -11
- package/dist/Card.d.ts +0 -14
- package/dist/Card.js +0 -16
- package/dist/Chip.d.ts +0 -10
- package/dist/Chip.js +0 -8
- package/dist/Input.d.ts +0 -8
- package/dist/Input.js +0 -9
- package/dist/Modal.d.ts +0 -23
- package/dist/Modal.js +0 -31
- package/dist/Skeleton.d.ts +0 -7
- package/dist/Skeleton.js +0 -11
- package/dist/Tooltip.d.ts +0 -8
- package/dist/Tooltip.js +0 -8
- package/dist/VisuallyHidden.d.ts +0 -6
- package/dist/VisuallyHidden.js +0 -4
- package/dist/cx.d.ts +0 -1
- package/dist/cx.js +0 -3
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -11
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paul-portfolio/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "React components for the Paul Design System",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/gpbsumido/paul-design-system.git",
|
|
9
|
+
"directory": "packages/react"
|
|
10
|
+
},
|
|
6
11
|
"main": "./dist/index.js",
|
|
7
12
|
"module": "./dist/index.js",
|
|
8
13
|
"types": "./dist/index.d.ts",
|
package/dist/Avatar.d.ts
DELETED
package/dist/Avatar.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cx } from './cx';
|
|
3
|
-
export function Avatar({ src, alt, size, fallback }) {
|
|
4
|
-
return (_jsx("div", { className: cx('avatar', size && `avatar--${size}`), children: src ? (_jsx("img", { src: src, alt: alt })) : (_jsx("span", { className: "avatar--fallback", children: fallback })) }));
|
|
5
|
-
}
|
package/dist/Badge.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
type BadgeProps = {
|
|
3
|
-
variant?: 'success' | 'warning' | 'error' | 'info';
|
|
4
|
-
dot?: boolean;
|
|
5
|
-
children?: ReactNode;
|
|
6
|
-
};
|
|
7
|
-
export declare function Badge({ variant, dot, children }: BadgeProps): import("react").JSX.Element;
|
|
8
|
-
export {};
|
package/dist/Badge.js
DELETED
package/dist/Button.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type ButtonHTMLAttributes, type AnchorHTMLAttributes, type ReactNode } from 'react';
|
|
2
|
-
type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';
|
|
3
|
-
type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
4
|
-
type BaseProps = {
|
|
5
|
-
variant?: ButtonVariant;
|
|
6
|
-
size?: ButtonSize;
|
|
7
|
-
loading?: boolean;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
};
|
|
11
|
-
type ButtonAsButton = BaseProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof BaseProps> & {
|
|
12
|
-
href?: never;
|
|
13
|
-
};
|
|
14
|
-
type ButtonAsAnchor = BaseProps & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof BaseProps> & {
|
|
15
|
-
href: string;
|
|
16
|
-
};
|
|
17
|
-
type ButtonProps = ButtonAsButton | ButtonAsAnchor;
|
|
18
|
-
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
|
|
19
|
-
export {};
|
package/dist/Button.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, } from 'react';
|
|
3
|
-
import { cx } from './cx';
|
|
4
|
-
export const Button = forwardRef(function Button({ variant, size, loading, disabled, className, children, ...props }, ref) {
|
|
5
|
-
const classes = cx('btn', variant && `btn--${variant}`, size && size !== 'md' && `btn--${size}`, className);
|
|
6
|
-
if ('href' in props && props.href) {
|
|
7
|
-
return (_jsx("a", { ref: ref, className: classes, "aria-disabled": disabled || loading || undefined, ...props, children: children }));
|
|
8
|
-
}
|
|
9
|
-
const { href: _, ...buttonProps } = props;
|
|
10
|
-
return (_jsx("button", { ref: ref, className: classes, disabled: disabled || loading, "aria-disabled": disabled || loading || undefined, "aria-busy": loading || undefined, ...buttonProps, onClick: disabled || loading ? undefined : buttonProps.onClick, children: children }));
|
|
11
|
-
});
|
package/dist/Card.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type ReactNode, type HTMLAttributes } from 'react';
|
|
2
|
-
type CardVariant = 'elevated' | 'interactive';
|
|
3
|
-
declare function Header({ className, children, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
4
|
-
declare function Body({ className, children, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
5
|
-
declare function Footer({ className, children, ...props }: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
|
|
6
|
-
export declare const Card: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
7
|
-
variant?: CardVariant;
|
|
8
|
-
children: ReactNode;
|
|
9
|
-
} & import("react").RefAttributes<HTMLDivElement>> & {
|
|
10
|
-
Header: typeof Header;
|
|
11
|
-
Body: typeof Body;
|
|
12
|
-
Footer: typeof Footer;
|
|
13
|
-
};
|
|
14
|
-
export {};
|
package/dist/Card.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import { cx } from './cx';
|
|
4
|
-
const CardRoot = forwardRef(function Card({ variant, className, children, ...props }, ref) {
|
|
5
|
-
return (_jsx("div", { ref: ref, className: cx('card', variant && `card--${variant}`, className), ...props, children: children }));
|
|
6
|
-
});
|
|
7
|
-
function Header({ className, children, ...props }) {
|
|
8
|
-
return _jsx("div", { className: cx('card__header', className), ...props, children: children });
|
|
9
|
-
}
|
|
10
|
-
function Body({ className, children, ...props }) {
|
|
11
|
-
return _jsx("div", { className: cx('card__body', className), ...props, children: children });
|
|
12
|
-
}
|
|
13
|
-
function Footer({ className, children, ...props }) {
|
|
14
|
-
return _jsx("div", { className: cx('card__footer', className), ...props, children: children });
|
|
15
|
-
}
|
|
16
|
-
export const Card = Object.assign(CardRoot, { Header, Body, Footer });
|
package/dist/Chip.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react';
|
|
2
|
-
type ChipProps = HTMLAttributes<HTMLSpanElement> & {
|
|
3
|
-
label: string;
|
|
4
|
-
size?: 'sm' | 'md';
|
|
5
|
-
clickable?: boolean;
|
|
6
|
-
removable?: boolean;
|
|
7
|
-
onRemove?: () => void;
|
|
8
|
-
};
|
|
9
|
-
export declare function Chip({ label, size, clickable, removable, onClick, onRemove, className, ...props }: ChipProps): import("react").JSX.Element;
|
|
10
|
-
export {};
|
package/dist/Chip.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cx } from './cx';
|
|
3
|
-
export function Chip({ label, size, clickable, removable, onClick, onRemove, className, ...props }) {
|
|
4
|
-
return (_jsxs("span", { className: cx('chip', size && size !== 'md' && `chip--${size}`, clickable && 'chip--clickable', removable && 'chip--removable', className), onClick: onClick, ...props, children: [label, removable && (_jsx("button", { type: "button", className: "chip__remove", "aria-label": "Remove", onClick: (e) => {
|
|
5
|
-
e.stopPropagation();
|
|
6
|
-
onRemove?.();
|
|
7
|
-
} }))] }));
|
|
8
|
-
}
|
package/dist/Input.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type InputHTMLAttributes } from 'react';
|
|
2
|
-
export declare const Input: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "size"> & {
|
|
3
|
-
label?: string;
|
|
4
|
-
error?: string;
|
|
5
|
-
helper?: string;
|
|
6
|
-
size?: 'sm' | 'md';
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
} & import("react").RefAttributes<HTMLInputElement>>;
|
package/dist/Input.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useId } from 'react';
|
|
3
|
-
import { cx } from './cx';
|
|
4
|
-
export const Input = forwardRef(function Input({ label, error, helper, size, disabled, className, ...props }, ref) {
|
|
5
|
-
const id = useId();
|
|
6
|
-
const helperId = `${id}-helper`;
|
|
7
|
-
const helperText = error || helper;
|
|
8
|
-
return (_jsxs("div", { className: "input__wrapper", children: [label && _jsx("label", { className: "input__label", htmlFor: id, children: label }), _jsx("input", { ref: ref, id: id, className: cx('input', size && size !== 'md' && `input--${size}`, error && 'input--error', className), disabled: disabled, "aria-invalid": error ? true : undefined, "aria-describedby": helperText ? helperId : undefined, ...props }), helperText && (_jsx("span", { id: helperId, className: cx('input__helper', error && 'input__helper--error'), children: helperText }))] }));
|
|
9
|
-
});
|
package/dist/Modal.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
type ModalProps = {
|
|
3
|
-
open: boolean;
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
title?: string;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
};
|
|
8
|
-
declare function Header({ children }: {
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
}): import("react").JSX.Element;
|
|
11
|
-
declare function Body({ children }: {
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
}): import("react").JSX.Element;
|
|
14
|
-
declare function Footer({ children }: {
|
|
15
|
-
children: ReactNode;
|
|
16
|
-
}): import("react").JSX.Element;
|
|
17
|
-
export declare function Modal({ open, onClose, title, children }: ModalProps): import("react").ReactPortal | null;
|
|
18
|
-
export declare namespace Modal {
|
|
19
|
-
export { Header };
|
|
20
|
-
export { Body };
|
|
21
|
-
export { Footer };
|
|
22
|
-
}
|
|
23
|
-
export {};
|
package/dist/Modal.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useId } from 'react';
|
|
3
|
-
import { createPortal } from 'react-dom';
|
|
4
|
-
function Header({ children }) {
|
|
5
|
-
return _jsx("div", { className: "modal__header", children: children });
|
|
6
|
-
}
|
|
7
|
-
function Body({ children }) {
|
|
8
|
-
return _jsx("div", { className: "modal__body", children: children });
|
|
9
|
-
}
|
|
10
|
-
function Footer({ children }) {
|
|
11
|
-
return _jsx("div", { className: "modal__footer", children: children });
|
|
12
|
-
}
|
|
13
|
-
export function Modal({ open, onClose, title, children }) {
|
|
14
|
-
const titleId = useId();
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
if (!open)
|
|
17
|
-
return;
|
|
18
|
-
function handleKey(e) {
|
|
19
|
-
if (e.key === 'Escape')
|
|
20
|
-
onClose();
|
|
21
|
-
}
|
|
22
|
-
document.addEventListener('keydown', handleKey);
|
|
23
|
-
return () => document.removeEventListener('keydown', handleKey);
|
|
24
|
-
}, [open, onClose]);
|
|
25
|
-
if (!open)
|
|
26
|
-
return null;
|
|
27
|
-
return createPortal(_jsx("div", { className: "modal__backdrop", onClick: onClose, children: _jsxs("div", { role: "dialog", "aria-modal": "true", "aria-labelledby": title ? titleId : undefined, className: "modal", onClick: (e) => e.stopPropagation(), children: [title && (_jsx("div", { id: titleId, className: "modal__title", children: title })), children] }) }), document.body);
|
|
28
|
-
}
|
|
29
|
-
Modal.Header = Header;
|
|
30
|
-
Modal.Body = Body;
|
|
31
|
-
Modal.Footer = Footer;
|
package/dist/Skeleton.d.ts
DELETED
package/dist/Skeleton.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cx } from './cx';
|
|
3
|
-
export function Skeleton({ variant, width, height }) {
|
|
4
|
-
const style = variant === 'rect'
|
|
5
|
-
? {
|
|
6
|
-
'--skeleton-w': width,
|
|
7
|
-
'--skeleton-h': height,
|
|
8
|
-
}
|
|
9
|
-
: undefined;
|
|
10
|
-
return (_jsx("div", { className: cx('skeleton', variant && `skeleton--${variant}`), style: style }));
|
|
11
|
-
}
|
package/dist/Tooltip.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
type TooltipProps = {
|
|
3
|
-
content: string;
|
|
4
|
-
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
};
|
|
7
|
-
export declare function Tooltip({ content, side, children }: TooltipProps): import("react").JSX.Element;
|
|
8
|
-
export {};
|
package/dist/Tooltip.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useId } from 'react';
|
|
3
|
-
import { cx } from './cx';
|
|
4
|
-
export function Tooltip({ content, side = 'top', children }) {
|
|
5
|
-
const [visible, setVisible] = useState(false);
|
|
6
|
-
const id = useId();
|
|
7
|
-
return (_jsxs("span", { onMouseEnter: () => setVisible(true), onMouseLeave: () => setVisible(false), "aria-describedby": id, style: { position: 'relative', display: 'inline-block' }, children: [children, _jsx("span", { id: id, role: "tooltip", className: cx('tooltip', `tooltip--${side}`, visible && 'tooltip--visible'), children: content })] }));
|
|
8
|
-
}
|
package/dist/VisuallyHidden.d.ts
DELETED
package/dist/VisuallyHidden.js
DELETED
package/dist/cx.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function cx(...classes: (string | false | null | undefined)[]): string;
|
package/dist/cx.js
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { Button } from './Button';
|
|
2
|
-
export { Card } from './Card';
|
|
3
|
-
export { Chip } from './Chip';
|
|
4
|
-
export { Input } from './Input';
|
|
5
|
-
export { Modal } from './Modal';
|
|
6
|
-
export { Tooltip } from './Tooltip';
|
|
7
|
-
export { Avatar } from './Avatar';
|
|
8
|
-
export { Badge } from './Badge';
|
|
9
|
-
export { Skeleton } from './Skeleton';
|
|
10
|
-
export { VisuallyHidden } from './VisuallyHidden';
|
|
11
|
-
export { cx } from './cx';
|
package/dist/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { Button } from './Button';
|
|
2
|
-
export { Card } from './Card';
|
|
3
|
-
export { Chip } from './Chip';
|
|
4
|
-
export { Input } from './Input';
|
|
5
|
-
export { Modal } from './Modal';
|
|
6
|
-
export { Tooltip } from './Tooltip';
|
|
7
|
-
export { Avatar } from './Avatar';
|
|
8
|
-
export { Badge } from './Badge';
|
|
9
|
-
export { Skeleton } from './Skeleton';
|
|
10
|
-
export { VisuallyHidden } from './VisuallyHidden';
|
|
11
|
-
export { cx } from './cx';
|