@neasg/design-system 0.4.8 → 0.4.9
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/README.md +4 -4
- package/dist/alert.d.ts +21 -2
- package/dist/alert.js +10 -3
- package/dist/avatar.d.ts +5 -2
- package/dist/avatar.js +76 -8
- package/dist/back-button.d.ts +2 -0
- package/dist/back-button.js +1 -1
- package/dist/badge.d.ts +3 -2
- package/dist/badge.js +9 -3
- package/dist/breadcrumb.js +2 -1
- package/dist/button.d.ts +1 -1
- package/dist/button.js +12 -9
- package/dist/calendar.js +10 -9
- package/dist/card.d.ts +29 -1
- package/dist/card.js +61 -7
- package/dist/checkbox.d.ts +2 -0
- package/dist/checkbox.js +2 -2
- package/dist/close-button.d.ts +6 -0
- package/dist/close-button.js +8 -0
- package/dist/collapsible.d.ts +7 -1
- package/dist/collapsible.js +2 -2
- package/dist/command-search.d.ts +16 -1
- package/dist/command-search.js +42 -16
- package/dist/command.js +3 -3
- package/dist/copy-button.d.ts +3 -1
- package/dist/copy-button.js +4 -2
- package/dist/count-badge.d.ts +3 -1
- package/dist/count-badge.js +10 -5
- package/dist/date-input.d.ts +18 -3
- package/dist/date-input.js +94 -21
- package/dist/dialog-primitive.js +4 -3
- package/dist/draggable-tabs.d.ts +7 -0
- package/dist/draggable-tabs.js +6 -5
- package/dist/drawer.js +2 -2
- package/dist/dropdown-button.d.ts +18 -0
- package/dist/dropdown-button.js +31 -0
- package/dist/edit-button.d.ts +10 -0
- package/dist/edit-button.js +7 -0
- package/dist/editable-table.d.ts +3 -1
- package/dist/editable-table.js +25 -12
- package/dist/field.d.ts +2 -2
- package/dist/field.js +4 -3
- package/dist/file-upload-status-toast.d.ts +28 -0
- package/dist/file-upload-status-toast.js +136 -0
- package/dist/file-upload.js +8 -7
- package/dist/filter-popover.d.ts +37 -0
- package/dist/filter-popover.js +73 -0
- package/dist/filter-toggle.js +2 -2
- package/dist/index.d.ts +45 -14
- package/dist/index.js +19 -4
- package/dist/input-control.d.ts +3 -2
- package/dist/input-control.js +3 -2
- package/dist/label-value-grid.d.ts +4 -2
- package/dist/label-value-grid.js +7 -6
- package/dist/label-value.js +3 -1
- package/dist/layout-right-panel-edge.d.ts +6 -0
- package/dist/layout-right-panel-edge.js +6 -0
- package/dist/layout.d.ts +77 -5
- package/dist/layout.js +439 -35
- package/dist/lib/date-utils.d.ts +10 -2
- package/dist/lib/date-utils.js +91 -11
- package/dist/lib/utils.js +8 -1
- package/dist/link.js +2 -2
- package/dist/message-item.d.ts +62 -0
- package/dist/message-item.js +148 -0
- package/dist/multi-select.js +31 -5
- package/dist/notification.d.ts +82 -0
- package/dist/notification.js +121 -0
- package/dist/otp-input.js +1 -1
- package/dist/page-header.js +1 -1
- package/dist/page-section.d.ts +2 -1
- package/dist/page-section.js +4 -3
- package/dist/pagination.js +2 -2
- package/dist/popover-menu.d.ts +23 -1
- package/dist/popover-menu.js +75 -5
- package/dist/popover-primitive.js +1 -1
- package/dist/progress.d.ts +5 -2
- package/dist/progress.js +6 -3
- package/dist/radio-group.d.ts +21 -0
- package/dist/radio-group.js +41 -0
- package/dist/rich-text-editor.d.ts +56 -0
- package/dist/rich-text-editor.js +394 -0
- package/dist/routing-timeline.d.ts +22 -0
- package/dist/routing-timeline.js +58 -0
- package/dist/scroll-hint.d.ts +8 -0
- package/dist/scroll-hint.js +7 -0
- package/dist/search-input-shell.js +1 -1
- package/dist/search-input.js +2 -2
- package/dist/section-nav.js +4 -4
- package/dist/select-primitive.js +3 -3
- package/dist/select.js +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/styles.css +235 -57
- package/dist/table-column-visibility.d.ts +21 -0
- package/dist/table-column-visibility.js +74 -0
- package/dist/table-toolbar.js +1 -1
- package/dist/table.d.ts +12 -1
- package/dist/table.js +67 -33
- package/dist/tabs.d.ts +14 -3
- package/dist/tabs.js +60 -6
- package/dist/tailwind-preset.js +46 -0
- package/dist/task-mode-shell.d.ts +24 -0
- package/dist/task-mode-shell.js +110 -0
- package/dist/textarea.js +2 -1
- package/dist/theme-switcher.d.ts +28 -0
- package/dist/theme-switcher.js +27 -0
- package/dist/theme.d.ts +167 -0
- package/dist/theme.js +112 -0
- package/dist/toaster.js +5 -4
- package/dist/tooltip.js +1 -1
- package/dist/typography.d.ts +1 -1
- package/dist/typography.js +5 -5
- package/dist/workspace-header.d.ts +13 -0
- package/dist/workspace-header.js +11 -0
- package/package.json +15 -1
package/README.md
CHANGED
|
@@ -62,13 +62,13 @@ const config: Config = {
|
|
|
62
62
|
export default config;
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
-
Theme tokens are provided through the exported stylesheet.
|
|
66
|
-
change the package base font size, override
|
|
67
|
-
the stylesheet:
|
|
65
|
+
Theme tokens are provided through the exported stylesheet. The default root font
|
|
66
|
+
size is 12.5px. If you want to change the package base font size, override
|
|
67
|
+
`--font-size-root` after importing the stylesheet:
|
|
68
68
|
|
|
69
69
|
```css
|
|
70
70
|
:root {
|
|
71
|
-
--font-size-root:
|
|
71
|
+
--font-size-root: 14px;
|
|
72
72
|
}
|
|
73
73
|
```
|
|
74
74
|
|
package/dist/alert.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { type ButtonProps } from "./button";
|
|
4
|
+
import { type CheckboxProps } from "./checkbox";
|
|
3
5
|
declare const alertVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
6
|
+
variant?: "destructive" | "info" | "success" | "warning" | null | undefined;
|
|
5
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
8
|
export interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">, VariantProps<typeof alertVariants> {
|
|
7
9
|
title?: React.ReactNode;
|
|
@@ -11,5 +13,22 @@ export interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "
|
|
|
11
13
|
}>;
|
|
12
14
|
action?: React.ReactNode;
|
|
13
15
|
}
|
|
16
|
+
export interface AlertActionProps extends Omit<ButtonProps, "variant" | "size"> {
|
|
17
|
+
}
|
|
18
|
+
export interface AlertConsentProps extends Omit<AlertProps, "children" | "description" | "icon"> {
|
|
19
|
+
checked?: CheckboxProps["checked"];
|
|
20
|
+
defaultChecked?: CheckboxProps["defaultChecked"];
|
|
21
|
+
disabled?: CheckboxProps["disabled"];
|
|
22
|
+
required?: CheckboxProps["required"];
|
|
23
|
+
name?: CheckboxProps["name"];
|
|
24
|
+
value?: CheckboxProps["value"];
|
|
25
|
+
checkboxId?: CheckboxProps["id"];
|
|
26
|
+
checkboxClassName?: string;
|
|
27
|
+
label: React.ReactNode;
|
|
28
|
+
description?: React.ReactNode;
|
|
29
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
30
|
+
}
|
|
31
|
+
declare const AlertAction: React.ForwardRefExoticComponent<AlertActionProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
32
|
declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
-
|
|
33
|
+
declare const AlertConsent: React.ForwardRefExoticComponent<AlertConsentProps & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
export { Alert, AlertAction, AlertConsent, alertVariants };
|
package/dist/alert.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
|
+
import { Button } from "./button";
|
|
5
|
+
import { Checkbox } from "./checkbox";
|
|
4
6
|
import { cn } from "./lib/utils";
|
|
5
7
|
import { Typography } from "./typography";
|
|
6
|
-
const alertVariants = cva("relative flex w-full items-start gap-
|
|
8
|
+
const alertVariants = cva("relative flex w-full items-start gap-2 rounded-surface border px-4 py-3", {
|
|
7
9
|
variants: {
|
|
8
10
|
variant: {
|
|
9
11
|
info: "border-[hsl(var(--status-info-foreground))]/20 bg-[hsl(var(--status-info))] text-[hsl(var(--status-info-foreground))]",
|
|
@@ -16,9 +18,14 @@ const alertVariants = cva("relative flex w-full items-start gap-3 rounded-md bor
|
|
|
16
18
|
variant: "info",
|
|
17
19
|
},
|
|
18
20
|
});
|
|
21
|
+
const AlertAction = React.forwardRef(({ className, type = "button", ...props }, ref) => (_jsx(Button, { ref: ref, type: type, variant: "link", size: "compact", className: cn("h-auto min-h-6 px-0 text-inherit hover:text-inherit", className), ...props })));
|
|
22
|
+
AlertAction.displayName = "AlertAction";
|
|
19
23
|
const Alert = React.forwardRef(({ variant, title, description, icon: Icon, action, className, children, role = "alert", ...props }, ref) => {
|
|
20
24
|
const body = description !== null && description !== void 0 ? description : children;
|
|
21
|
-
|
|
25
|
+
const hasStackedContent = Boolean(title);
|
|
26
|
+
return (_jsxs("div", { ref: ref, role: role, className: cn(alertVariants({ variant }), !hasStackedContent && "items-center", className), ...props, children: [Icon ? (_jsx(Icon, { className: cn("h-4 w-4 shrink-0", hasStackedContent && "mt-0.5") })) : null, _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [title ? (_jsx(Typography, { as: "p", variant: "bodySm", color: "inherit", className: "font-bold", children: title })) : null, body ? (_jsx(Typography, { as: "div", variant: "caption", color: "inherit", className: "opacity-95", children: body })) : null] }), action ? (_jsx("div", { className: cn("shrink-0 text-inherit [&_a]:text-inherit [&_button]:text-inherit [&_button:hover]:text-inherit", hasStackedContent ? "self-start" : "self-center"), children: action })) : null] }));
|
|
22
27
|
});
|
|
23
28
|
Alert.displayName = "Alert";
|
|
24
|
-
|
|
29
|
+
const AlertConsent = React.forwardRef(({ variant = "success", checked, defaultChecked, disabled, required, name, value, checkboxId, checkboxClassName, label, description, onCheckedChange, role = "status", className, ...props }, ref) => (_jsx(Alert, { ref: ref, variant: variant, role: role, className: cn("items-start", className), description: _jsx(Checkbox, { id: checkboxId, name: name, value: value, checked: checked, defaultChecked: defaultChecked, disabled: disabled, required: required, onChange: (event) => onCheckedChange === null || onCheckedChange === void 0 ? void 0 : onCheckedChange(event.target.checked), className: cn("[&>span:first-child]:mt-0.5", checkboxClassName), labelAlign: "start", label: label, description: description }), ...props })));
|
|
30
|
+
AlertConsent.displayName = "AlertConsent";
|
|
31
|
+
export { Alert, AlertAction, AlertConsent, alertVariants };
|
package/dist/avatar.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
|
3
3
|
declare const AvatarRoot: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
4
4
|
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
5
5
|
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
-
export type AvatarSize = "sm" | "md";
|
|
6
|
+
export type AvatarSize = "xs" | "sm" | "md";
|
|
7
7
|
interface AvatarProps extends Omit<React.ComponentPropsWithoutRef<typeof AvatarRoot>, "children"> {
|
|
8
8
|
src?: string | null;
|
|
9
9
|
alt?: string;
|
|
@@ -20,6 +20,8 @@ interface AvatarProfileProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
20
20
|
size?: AvatarSize;
|
|
21
21
|
loading?: boolean;
|
|
22
22
|
name?: React.ReactNode;
|
|
23
|
+
nameAs?: React.ElementType;
|
|
24
|
+
nameTrailing?: React.ReactNode;
|
|
23
25
|
role?: React.ReactNode;
|
|
24
26
|
rolePlacement?: "above" | "below";
|
|
25
27
|
topInfo?: React.ReactNode;
|
|
@@ -28,6 +30,7 @@ interface AvatarProfileProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
28
30
|
imageClassName?: string;
|
|
29
31
|
fallbackClassName?: string;
|
|
30
32
|
contentClassName?: string;
|
|
33
|
+
nameRowClassName?: string;
|
|
31
34
|
nameClassName?: string;
|
|
32
35
|
roleClassName?: string;
|
|
33
36
|
topInfoClassName?: string;
|
|
@@ -35,7 +38,7 @@ interface AvatarProfileProps extends Omit<React.HTMLAttributes<HTMLDivElement>,
|
|
|
35
38
|
avatarOverlay?: React.ReactNode;
|
|
36
39
|
}
|
|
37
40
|
declare function Avatar({ src, alt, fallback, size, loading, className, imageClassName, fallbackClassName, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
-
declare function AvatarProfile({ src, alt, fallback, size, loading, name, role, rolePlacement, topInfo, bottomInfo, className, avatarClassName, imageClassName, fallbackClassName, contentClassName, nameClassName, roleClassName, topInfoClassName, bottomInfoClassName, avatarOverlay, ...props }: AvatarProfileProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
declare function AvatarProfile({ src, alt, fallback, size, loading, name, nameAs: NameElement, nameTrailing, role, rolePlacement, topInfo, bottomInfo, className, avatarClassName, imageClassName, fallbackClassName, contentClassName, nameRowClassName, nameClassName, roleClassName, topInfoClassName, bottomInfoClassName, avatarOverlay, ...props }: AvatarProfileProps): import("react/jsx-runtime").JSX.Element;
|
|
39
42
|
export { Avatar, AvatarProfile, AvatarRoot, AvatarImage, AvatarFallback };
|
|
40
43
|
export type AvatarRootProps = React.ComponentPropsWithoutRef<typeof AvatarRoot>;
|
|
41
44
|
export type { AvatarProps, AvatarProfileProps };
|
package/dist/avatar.js
CHANGED
|
@@ -11,28 +11,96 @@ AvatarImage.displayName = "AvatarImage";
|
|
|
11
11
|
const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => (_jsx(AvatarPrimitive.Fallback, { ref: ref, className: cn("flex size-full items-center justify-center rounded-full bg-muted", className), ...props })));
|
|
12
12
|
AvatarFallback.displayName = "AvatarFallback";
|
|
13
13
|
const avatarSizeClasses = {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
xs: "h-[24px] w-[24px] text-[11px]",
|
|
15
|
+
sm: "h-[32px] w-[32px] text-xs",
|
|
16
|
+
md: "h-[40px] w-[40px] text-sm",
|
|
16
17
|
};
|
|
18
|
+
const avatarProfileGapClasses = {
|
|
19
|
+
xs: "gap-2",
|
|
20
|
+
sm: "gap-2.5",
|
|
21
|
+
md: "gap-2.5",
|
|
22
|
+
};
|
|
23
|
+
const avatarProfileNameClasses = {
|
|
24
|
+
xs: "text-xs leading-4",
|
|
25
|
+
sm: "text-sm leading-5",
|
|
26
|
+
md: "text-sm leading-5",
|
|
27
|
+
};
|
|
28
|
+
const avatarProfileInfoClasses = {
|
|
29
|
+
xs: "text-[11px] leading-3",
|
|
30
|
+
sm: "text-xs leading-4",
|
|
31
|
+
md: "text-xs leading-4",
|
|
32
|
+
};
|
|
33
|
+
const avatarProfileContentGapClass = "gap-[2px]";
|
|
34
|
+
const avatarFallbackPalette = [
|
|
35
|
+
{
|
|
36
|
+
background: "var(--nea-green-100)",
|
|
37
|
+
foreground: "var(--nea-green-800)",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
background: "var(--nea-blue-100)",
|
|
41
|
+
foreground: "var(--nea-blue-800)",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
background: "var(--nea-amber-100)",
|
|
45
|
+
foreground: "var(--nea-amber-800)",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
background: "var(--nea-violet-100)",
|
|
49
|
+
foreground: "var(--nea-violet-800)",
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
function getAvatarFallbackSeed(value) {
|
|
53
|
+
if (value === null || value === undefined || typeof value === "boolean") {
|
|
54
|
+
return "";
|
|
55
|
+
}
|
|
56
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
57
|
+
return String(value);
|
|
58
|
+
}
|
|
59
|
+
if (Array.isArray(value)) {
|
|
60
|
+
return value.map(getAvatarFallbackSeed).join("");
|
|
61
|
+
}
|
|
62
|
+
if (React.isValidElement(value)) {
|
|
63
|
+
return getAvatarFallbackSeed(value.props.children);
|
|
64
|
+
}
|
|
65
|
+
return "";
|
|
66
|
+
}
|
|
67
|
+
function getAvatarFallbackTone(seed) {
|
|
68
|
+
let hash = 0;
|
|
69
|
+
for (let index = 0; index < seed.length; index += 1) {
|
|
70
|
+
hash = (hash * 31 + seed.charCodeAt(index)) >>> 0;
|
|
71
|
+
}
|
|
72
|
+
return avatarFallbackPalette[hash % avatarFallbackPalette.length];
|
|
73
|
+
}
|
|
17
74
|
function Avatar({ src, alt = "", fallback, size = "sm", loading = false, className, imageClassName, fallbackClassName, ...props }) {
|
|
18
75
|
if (loading) {
|
|
19
76
|
return (_jsx(Skeleton, { className: cn("shrink-0 rounded-full", avatarSizeClasses[size], className), ...props }));
|
|
20
77
|
}
|
|
21
|
-
|
|
78
|
+
const fallbackTone = getAvatarFallbackTone(getAvatarFallbackSeed(fallback) || alt || "avatar");
|
|
79
|
+
const fallbackStyle = {
|
|
80
|
+
"--avatar-fallback-background": fallbackTone.background,
|
|
81
|
+
"--avatar-fallback-foreground": fallbackTone.foreground,
|
|
82
|
+
};
|
|
83
|
+
return (_jsxs(AvatarRoot, { className: cn(avatarSizeClasses[size], className), ...props, children: [src ? (_jsx(AvatarImage, { src: src, alt: alt, className: imageClassName })) : null, _jsx(AvatarFallback, { style: fallbackStyle, className: cn("bg-[hsl(var(--avatar-fallback-background))] font-medium text-[hsl(var(--avatar-fallback-foreground))]", fallbackClassName), children: fallback })] }));
|
|
22
84
|
}
|
|
23
|
-
function AvatarProfile({ src, alt = "", fallback, size = "sm", loading = false, name, role, rolePlacement = "
|
|
85
|
+
function AvatarProfile({ src, alt = "", fallback, size = "sm", loading = false, name, nameAs: NameElement = "span", nameTrailing, role, rolePlacement = "below", topInfo, bottomInfo, className, avatarClassName, imageClassName, fallbackClassName, contentClassName, nameRowClassName, nameClassName, roleClassName, topInfoClassName, bottomInfoClassName, avatarOverlay, ...props }) {
|
|
24
86
|
const resolvedTop = topInfo !== null && topInfo !== void 0 ? topInfo : (rolePlacement === "above" ? role : undefined);
|
|
25
87
|
const resolvedBottom = bottomInfo !== null && bottomInfo !== void 0 ? bottomInfo : (rolePlacement === "below" ? role : undefined);
|
|
88
|
+
const hasSupportingInfo = (resolvedTop !== undefined && resolvedTop !== null) ||
|
|
89
|
+
(resolvedBottom !== undefined && resolvedBottom !== null);
|
|
90
|
+
const alignmentClassName = hasSupportingInfo ? "items-start" : "items-center";
|
|
91
|
+
const avatarOffsetClassName = hasSupportingInfo ? "mt-0.5" : undefined;
|
|
26
92
|
if (loading) {
|
|
27
|
-
return (_jsxs("div", { className: cn("flex
|
|
93
|
+
return (_jsxs("div", { className: cn("flex min-w-0 max-w-full", alignmentClassName, avatarProfileGapClasses[size], className), "aria-busy": "true", ...props, children: [_jsx(Skeleton, { className: cn("shrink-0 rounded-full", avatarSizeClasses[size], avatarOffsetClassName, avatarClassName) }), _jsxs("div", { className: cn("flex min-w-0 flex-1 flex-col", avatarProfileContentGapClass, contentClassName), children: [resolvedTop !== undefined ? (_jsx(Skeleton, { className: "h-3 w-20" })) : null, _jsx(Skeleton, { className: "h-4 w-32" }), resolvedBottom !== undefined ? (_jsx(Skeleton, { className: "h-3 w-20" })) : null] })] }));
|
|
28
94
|
}
|
|
29
95
|
const hasMeta = name !== undefined ||
|
|
96
|
+
nameTrailing !== undefined ||
|
|
30
97
|
resolvedTop !== undefined ||
|
|
31
98
|
resolvedBottom !== undefined;
|
|
32
|
-
const infoBaseClass = "
|
|
99
|
+
const infoBaseClass = cn("min-w-0 truncate text-muted-foreground", avatarProfileInfoClasses[size]);
|
|
33
100
|
const topNode = resolvedTop !== undefined && resolvedTop !== null ? (_jsx("span", { className: cn(infoBaseClass, topInfo !== undefined ? topInfoClassName : roleClassName), children: resolvedTop })) : null;
|
|
34
101
|
const bottomNode = resolvedBottom !== undefined && resolvedBottom !== null ? (_jsx("span", { className: cn(infoBaseClass, bottomInfo !== undefined ? bottomInfoClassName : roleClassName), children: resolvedBottom })) : null;
|
|
35
|
-
const
|
|
36
|
-
|
|
102
|
+
const nameTextNode = name !== undefined && name !== null ? (_jsx(NameElement, { className: cn("min-w-0 truncate font-medium text-foreground", avatarProfileNameClasses[size], nameClassName), children: name })) : null;
|
|
103
|
+
const nameNode = nameTrailing !== undefined && nameTrailing !== null ? (_jsxs("div", { className: cn("flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1", nameRowClassName), children: [nameTextNode, nameTrailing] })) : (nameTextNode);
|
|
104
|
+
return (_jsxs("div", { className: cn("flex min-w-0 max-w-full", alignmentClassName, avatarProfileGapClasses[size], className), ...props, children: [_jsxs("div", { className: "relative shrink-0", children: [_jsx(Avatar, { src: src, alt: alt, fallback: fallback, size: size, className: cn(avatarOffsetClassName, avatarClassName), imageClassName: imageClassName, fallbackClassName: fallbackClassName }), avatarOverlay] }), hasMeta ? (_jsxs("div", { className: cn("flex min-w-0 flex-1 flex-col", avatarProfileContentGapClass, contentClassName), children: [topNode, nameNode, bottomNode] })) : null] }));
|
|
37
105
|
}
|
|
38
106
|
export { Avatar, AvatarProfile, AvatarRoot, AvatarImage, AvatarFallback };
|
package/dist/back-button.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type ButtonProps } from "./button";
|
|
3
3
|
export interface BackButtonProps extends Omit<ButtonProps, "asChild" | "size" | "variant"> {
|
|
4
|
+
/** Use `muted` for nested panel backs; keep `default` for leaving a page or task workspace. */
|
|
5
|
+
tone?: "default" | "muted";
|
|
4
6
|
}
|
|
5
7
|
declare const BackButton: React.ForwardRefExoticComponent<BackButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
8
|
export { BackButton };
|
package/dist/back-button.js
CHANGED
|
@@ -3,6 +3,6 @@ import * as React from "react";
|
|
|
3
3
|
import { ChevronLeftIcon } from "./animated-icons/chevron-left";
|
|
4
4
|
import { Button } from "./button";
|
|
5
5
|
import { cn } from "./lib/utils";
|
|
6
|
-
const BackButton = React.forwardRef(({ children = "Back", className, type, ...props }, ref) => (_jsxs(Button, { ref: ref, type: type !== null && type !== void 0 ? type : "button", variant: "link", className: cn("h-auto gap-1 px-0", className), ...props, children: [_jsx(ChevronLeftIcon, { "aria-hidden": "true", className: "shrink-0", size: 16 }), _jsx("span", { children: children })] })));
|
|
6
|
+
const BackButton = React.forwardRef(({ children = "Back", className, tone = "default", type, ...props }, ref) => (_jsxs(Button, { ref: ref, type: type !== null && type !== void 0 ? type : "button", variant: "link", className: cn("h-auto gap-1 px-0", tone === "muted" && "text-muted-foreground hover:text-foreground", className), ...props, children: [_jsx(ChevronLeftIcon, { "aria-hidden": "true", className: "shrink-0", size: 16 }), _jsx("span", { children: children })] })));
|
|
7
7
|
BackButton.displayName = "BackButton";
|
|
8
8
|
export { BackButton };
|
package/dist/badge.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "accent" | "muted" | "outline" | "destructive" | "secondary" | "info" | "success" | "warning" | null | undefined;
|
|
5
|
+
size?: "default" | "icon" | null | undefined;
|
|
5
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
7
|
/**
|
|
7
8
|
* Visual status label used for short categorical values like case state,
|
|
@@ -12,5 +13,5 @@ export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, Varian
|
|
|
12
13
|
/** Show a visible border matching the badge colour. */
|
|
13
14
|
bordered?: boolean;
|
|
14
15
|
}
|
|
15
|
-
declare function Badge({ className, variant, bordered, children, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare function Badge({ className, variant, size, bordered, children, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export { Badge, badgeVariants };
|
package/dist/badge.js
CHANGED
|
@@ -2,7 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { cn } from "./lib/utils";
|
|
5
|
-
|
|
5
|
+
import { Typography } from "./typography";
|
|
6
|
+
const badgeVariants = cva("inline-flex items-center justify-center text-center rounded-md border transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 truncate", {
|
|
6
7
|
variants: {
|
|
7
8
|
variant: {
|
|
8
9
|
secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
@@ -14,12 +15,17 @@ const badgeVariants = cva("inline-flex max-w-[200px] items-center justify-center
|
|
|
14
15
|
info: "border-transparent bg-[hsl(var(--status-info))] text-[hsl(var(--status-info-foreground))]",
|
|
15
16
|
accent: "border-transparent bg-[hsl(var(--status-accent))] text-[hsl(var(--status-accent-foreground))]",
|
|
16
17
|
},
|
|
18
|
+
size: {
|
|
19
|
+
default: "max-w-[200px] px-2 py-0.5",
|
|
20
|
+
icon: "h-5 w-5 min-w-5 max-w-5 shrink-0 px-0 py-0",
|
|
21
|
+
},
|
|
17
22
|
},
|
|
18
23
|
defaultVariants: {
|
|
19
24
|
variant: "secondary",
|
|
25
|
+
size: "default",
|
|
20
26
|
},
|
|
21
27
|
});
|
|
22
|
-
function Badge({ className, variant, bordered = false, children, ...props }) {
|
|
28
|
+
function Badge({ className, variant, size, bordered = false, children, ...props }) {
|
|
23
29
|
const textContent = typeof children === "string"
|
|
24
30
|
? children
|
|
25
31
|
: React.Children.toArray(children)
|
|
@@ -36,6 +42,6 @@ function Badge({ className, variant, bordered = false, children, ...props }) {
|
|
|
36
42
|
info: "border-[hsl(var(--status-info-foreground))]/30",
|
|
37
43
|
accent: "border-[hsl(var(--status-accent-foreground))]/30",
|
|
38
44
|
};
|
|
39
|
-
return (_jsx("div", { className: cn(badgeVariants({ variant }), bordered && borderedClasses[resolvedVariant], className), title: textContent || undefined, ...props, children: children }));
|
|
45
|
+
return (_jsx("div", { className: cn(badgeVariants({ variant, size }), bordered && borderedClasses[resolvedVariant], className), title: textContent || undefined, ...props, children: _jsx(Typography, { as: "span", variant: "eyebrow", color: "inherit", className: "inline-flex min-w-0 max-w-full items-center gap-1 truncate", children: children }) }));
|
|
40
46
|
}
|
|
41
47
|
export { Badge, badgeVariants };
|
package/dist/breadcrumb.js
CHANGED
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { Slot } from "@radix-ui/react-slot";
|
|
5
5
|
import { cn } from "./lib/utils";
|
|
6
|
+
import { Typography } from "./typography";
|
|
6
7
|
const BreadcrumbNav = React.forwardRef(({ ...props }, ref) => _jsx("nav", { ref: ref, "aria-label": "breadcrumb", ...props }));
|
|
7
8
|
BreadcrumbNav.displayName = "BreadcrumbNav";
|
|
8
9
|
const BreadcrumbList = React.forwardRef(({ className, ...props }, ref) => (_jsx("ol", { ref: ref, className: cn("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5", className), ...props })));
|
|
@@ -18,7 +19,7 @@ const BreadcrumbPage = React.forwardRef(({ className, ...props }, ref) => (_jsx(
|
|
|
18
19
|
BreadcrumbPage.displayName = "BreadcrumbPage";
|
|
19
20
|
const BreadcrumbSeparator = ({ children, className, ...props }) => (_jsx("li", { role: "presentation", "aria-hidden": "true", className: cn("[&>svg]:h-3.5 [&>svg]:w-3.5", className), ...props, children: children !== null && children !== void 0 ? children : (_jsx("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.75", children: _jsx("path", { d: "M6 3.5 10.5 8 6 12.5" }) })) }));
|
|
20
21
|
BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
|
|
21
|
-
const BreadcrumbEllipsis = ({ className, ...props }) => (_jsxs("span", { role: "presentation", "aria-hidden": "true", className: cn("flex h-control w-control items-center justify-center", className), ...props, children: [_jsx("span",
|
|
22
|
+
const BreadcrumbEllipsis = ({ className, ...props }) => (_jsxs("span", { role: "presentation", "aria-hidden": "true", className: cn("flex h-control w-control items-center justify-center", className), ...props, children: [_jsx(Typography, { as: "span", variant: "subheading", color: "inherit", children: "\u2026" }), _jsx("span", { className: "sr-only", children: "More" })] }));
|
|
22
23
|
BreadcrumbEllipsis.displayName = "BreadcrumbEllipsis";
|
|
23
24
|
function Breadcrumb({ items, separator, className, listClassName, itemClassName, linkClassName, currentClassName, ...props }) {
|
|
24
25
|
if (!items.length) {
|
package/dist/button.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from "react";
|
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
4
|
variant?: "link" | "default" | "outline" | "destructive" | "secondary" | "ghost" | null | undefined;
|
|
5
|
-
size?: "default" | "sm" | "icon" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "compact" | "icon" | "compactIcon" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
8
8
|
/**
|
package/dist/button.js
CHANGED
|
@@ -3,20 +3,22 @@ import * as React from "react";
|
|
|
3
3
|
import { Slot } from "@radix-ui/react-slot";
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
import { cn } from "./lib/utils";
|
|
6
|
-
const buttonVariants = cva("inline-flex cursor-pointer items-center justify-center gap-
|
|
6
|
+
const buttonVariants = cva("inline-flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap rounded-control text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 disabled:pointer-events-none [&_svg]:h-4 [&_svg]:min-h-4 [&_svg]:w-4 [&_svg]:min-w-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
|
|
7
7
|
variants: {
|
|
8
8
|
variant: {
|
|
9
9
|
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
10
10
|
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
11
|
-
outline: "border border-
|
|
11
|
+
outline: "border border-[hsl(var(--button-outline-border))] bg-[hsl(var(--button-outline-background))] text-foreground hover:bg-[hsl(var(--button-outline-hover-background))] hover:text-accent-foreground",
|
|
12
12
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
13
13
|
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
14
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
14
|
+
link: "text-primary underline-offset-4 hover:text-primary/85 hover:underline",
|
|
15
15
|
},
|
|
16
16
|
size: {
|
|
17
|
-
sm: "h-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
sm: "h-8 px-2.5 text-sm",
|
|
18
|
+
compact: "h-8 gap-1 px-2 text-sm",
|
|
19
|
+
default: "h-control px-3 py-1.5",
|
|
20
|
+
icon: "h-control w-control",
|
|
21
|
+
compactIcon: "h-8 w-8",
|
|
20
22
|
},
|
|
21
23
|
},
|
|
22
24
|
defaultVariants: {
|
|
@@ -25,7 +27,7 @@ const buttonVariants = cva("inline-flex cursor-pointer items-center justify-cent
|
|
|
25
27
|
},
|
|
26
28
|
});
|
|
27
29
|
function DefaultLoadingIndicator() {
|
|
28
|
-
return (_jsx("span", { "aria-hidden": "true", className: "h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }));
|
|
30
|
+
return (_jsx("span", { "aria-hidden": "true", className: "h-4 min-h-4 w-4 min-w-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" }));
|
|
29
31
|
}
|
|
30
32
|
function hasTextLikeContent(node) {
|
|
31
33
|
if (typeof node === "string") {
|
|
@@ -104,8 +106,9 @@ const Button = React.forwardRef(({ className, variant, size, asChild = false, lo
|
|
|
104
106
|
const loadingLabel = loadingText !== null && loadingText !== void 0 ? loadingText : children;
|
|
105
107
|
const animatedIconRefs = React.useRef([]);
|
|
106
108
|
animatedIconRefs.current = [];
|
|
107
|
-
if (size === "icon"
|
|
108
|
-
|
|
109
|
+
if ((size === "icon" || size === "compactIcon") &&
|
|
110
|
+
hasTextLikeContent(children)) {
|
|
111
|
+
throw new Error('NEA Button `size="icon"` and `size="compactIcon"` only accepts icon components or SVG content. Do not pass text or emoji.');
|
|
109
112
|
}
|
|
110
113
|
const content = loading ? (loadingLabel ? (_jsxs("span", { className: "inline-flex items-center gap-2", children: [loadingIndicator !== null && loadingIndicator !== void 0 ? loadingIndicator : _jsx(DefaultLoadingIndicator, {}), _jsx("span", { children: attachAnimatedIconRefs(loadingLabel, animatedIconRefs) })] })) : (loadingIndicator !== null && loadingIndicator !== void 0 ? loadingIndicator : _jsx(DefaultLoadingIndicator, {}))) : (attachAnimatedIconRefs(children, animatedIconRefs));
|
|
111
114
|
const startAnimatedIcons = () => {
|
package/dist/calendar.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { DayPicker, getDefaultClassNames } from "react-day-picker";
|
|
5
5
|
import { buttonVariants } from "./button";
|
|
6
6
|
import { cn } from "./lib/utils";
|
|
7
|
+
import { Typography } from "./typography";
|
|
7
8
|
function CalendarDayButton({ className, day, modifiers, children, disabled, onClick, onFocus, onBlur, onKeyDown, onMouseEnter, onMouseLeave, tabIndex, type, "aria-label": ariaLabel, "aria-pressed": ariaPressed, "aria-selected": ariaSelected, }) {
|
|
8
9
|
const defaultClassNames = getDefaultClassNames();
|
|
9
10
|
const ref = React.useRef(null);
|
|
@@ -15,7 +16,7 @@ function CalendarDayButton({ className, day, modifiers, children, disabled, onCl
|
|
|
15
16
|
return (_jsx("button", { ref: ref, type: type, disabled: disabled, onClick: onClick, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, tabIndex: tabIndex, "aria-label": ariaLabel, "aria-pressed": ariaPressed, "aria-selected": ariaSelected, "data-day": day.date.toLocaleDateString(), "data-selected-single": modifiers.selected &&
|
|
16
17
|
!modifiers.range_start &&
|
|
17
18
|
!modifiers.range_end &&
|
|
18
|
-
!modifiers.range_middle, "data-range-start": modifiers.range_start, "data-range-end": modifiers.range_end, "data-range-middle": modifiers.range_middle, className: cn("inline-flex cursor-pointer items-center justify-center rounded-
|
|
19
|
+
!modifiers.range_middle, "data-range-start": modifiers.range_start, "data-range-end": modifiers.range_end, "data-range-middle": modifiers.range_middle, className: cn("inline-flex cursor-pointer items-center justify-center rounded-control outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", "data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-primary/10 data-[range-middle=true]:text-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 aspect-square w-full min-w-[--cell-size] data-[range-end=true]:rounded-control data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-control group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px]", defaultClassNames.day, className), children: _jsx(Typography, { as: "span", variant: "bodySm", color: "inherit", children: children }) }));
|
|
19
20
|
}
|
|
20
21
|
function Calendar({ className, classNames, showOutsideDays = true, captionLayout = "label", buttonVariant = "ghost", formatters, components, ...props }) {
|
|
21
22
|
const defaultClassNames = getDefaultClassNames();
|
|
@@ -31,22 +32,22 @@ function Calendar({ className, classNames, showOutsideDays = true, captionLayout
|
|
|
31
32
|
button_next: cn(buttonVariants({ variant: buttonVariant }), "h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50", defaultClassNames.button_next),
|
|
32
33
|
month_caption: cn("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]", defaultClassNames.month_caption),
|
|
33
34
|
dropdowns: cn("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium", defaultClassNames.dropdowns),
|
|
34
|
-
dropdown_root: cn("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-
|
|
35
|
+
dropdown_root: cn("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-control border", defaultClassNames.dropdown_root),
|
|
35
36
|
dropdown: cn("bg-popover absolute inset-0 opacity-0", defaultClassNames.dropdown),
|
|
36
37
|
caption_label: cn("select-none font-medium", captionLayout === "label"
|
|
37
38
|
? "text-sm"
|
|
38
|
-
: "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-
|
|
39
|
+
: "[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-control pl-2 pr-1 text-sm [&>svg]:size-3.5", defaultClassNames.caption_label),
|
|
39
40
|
table: "w-full border-collapse",
|
|
40
41
|
weekdays: cn("flex", defaultClassNames.weekdays),
|
|
41
|
-
weekday: cn("text-muted-foreground flex-1 select-none rounded-
|
|
42
|
+
weekday: cn("text-muted-foreground flex-1 select-none rounded-control text-[0.8rem] font-normal", defaultClassNames.weekday),
|
|
42
43
|
week: cn("mt-2 flex w-full", defaultClassNames.week),
|
|
43
44
|
week_number_header: cn("w-[--cell-size] select-none", defaultClassNames.week_number_header),
|
|
44
45
|
week_number: cn("text-muted-foreground select-none text-[0.8rem]", defaultClassNames.week_number),
|
|
45
|
-
day: cn("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-
|
|
46
|
-
range_start: cn("bg-
|
|
47
|
-
range_middle: cn("rounded-none", defaultClassNames.range_middle),
|
|
48
|
-
range_end: cn("bg-
|
|
49
|
-
today: cn("bg-accent text-accent-foreground rounded-
|
|
46
|
+
day: cn("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-[var(--radius-control)] [&:last-child[data-selected=true]_button]:rounded-r-[var(--radius-control)]", defaultClassNames.day),
|
|
47
|
+
range_start: cn("bg-primary/10 rounded-l-[var(--radius-control)]", defaultClassNames.range_start),
|
|
48
|
+
range_middle: cn("bg-primary/10 rounded-none", defaultClassNames.range_middle),
|
|
49
|
+
range_end: cn("bg-primary/10 rounded-r-[var(--radius-control)]", defaultClassNames.range_end),
|
|
50
|
+
today: cn("bg-accent text-accent-foreground rounded-control data-[selected=true]:rounded-none", defaultClassNames.today),
|
|
50
51
|
outside: cn("text-muted-foreground aria-selected:text-muted-foreground", defaultClassNames.outside),
|
|
51
52
|
disabled: cn("text-muted-foreground opacity-50", defaultClassNames.disabled),
|
|
52
53
|
hidden: cn("invisible", defaultClassNames.hidden),
|
package/dist/card.d.ts
CHANGED
|
@@ -10,8 +10,36 @@ export interface CardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "t
|
|
|
10
10
|
subMetric?: React.ReactNode;
|
|
11
11
|
footer?: React.ReactNode;
|
|
12
12
|
active?: boolean;
|
|
13
|
+
accent?: "primary";
|
|
13
14
|
/** Replaces title/stat/subMetric with skeleton placeholders while data is loading. */
|
|
14
15
|
loading?: boolean;
|
|
15
16
|
}
|
|
17
|
+
export interface CardGridProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
18
|
+
columns?: 1 | 2 | 3 | 4;
|
|
19
|
+
align?: "stretch" | "start";
|
|
20
|
+
}
|
|
21
|
+
export interface CardSplitGridProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
22
|
+
asideWidth?: "sm" | "md" | "lg";
|
|
23
|
+
breakpoint?: "lg" | "xl";
|
|
24
|
+
align?: "stretch" | "start";
|
|
25
|
+
}
|
|
26
|
+
export interface CardListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
27
|
+
density?: "default" | "compact";
|
|
28
|
+
variant?: "cards" | "divided";
|
|
29
|
+
}
|
|
30
|
+
export interface CardListItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
31
|
+
label: React.ReactNode;
|
|
32
|
+
description?: React.ReactNode;
|
|
33
|
+
leading?: React.ReactNode;
|
|
34
|
+
leadingVariant?: "badge" | "plain";
|
|
35
|
+
trailing?: React.ReactNode;
|
|
36
|
+
meta?: React.ReactNode;
|
|
37
|
+
labelLines?: 1 | 2;
|
|
38
|
+
descriptionLines?: 1 | 2;
|
|
39
|
+
}
|
|
16
40
|
declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
-
|
|
41
|
+
declare function CardGrid({ columns, align, className, ...props }: CardGridProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
declare function CardSplitGrid({ asideWidth, breakpoint, align, className, ...props }: CardSplitGridProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
declare function CardList({ density, variant, className, ...props }: CardListProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
declare function CardListItem({ label, description, leading, leadingVariant, trailing, meta, labelLines, descriptionLines, className, onClick, ...props }: CardListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export { Card, CardGrid, CardSplitGrid, CardList, CardListItem };
|
package/dist/card.js
CHANGED
|
@@ -1,16 +1,70 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cn } from "./lib/utils";
|
|
5
5
|
import { Skeleton } from "./skeleton";
|
|
6
6
|
import { Typography } from "./typography";
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const cardGridColumns = {
|
|
8
|
+
1: "grid-cols-1",
|
|
9
|
+
2: "sm:grid-cols-2",
|
|
10
|
+
3: "md:grid-cols-2 lg:grid-cols-3",
|
|
11
|
+
4: "sm:grid-cols-2 xl:grid-cols-4",
|
|
12
|
+
};
|
|
13
|
+
const cardSplitGridColumns = {
|
|
14
|
+
lg: {
|
|
15
|
+
sm: "lg:grid-cols-[minmax(0,1fr)_18rem]",
|
|
16
|
+
md: "lg:grid-cols-[minmax(0,1fr)_20rem]",
|
|
17
|
+
lg: "lg:grid-cols-[minmax(0,1fr)_22rem]",
|
|
18
|
+
},
|
|
19
|
+
xl: {
|
|
20
|
+
sm: "xl:grid-cols-[minmax(0,1fr)_18rem]",
|
|
21
|
+
md: "xl:grid-cols-[minmax(0,1fr)_20rem]",
|
|
22
|
+
lg: "xl:grid-cols-[minmax(0,1fr)_22rem]",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const Card = React.forwardRef(({ title, description, variant = "default", size = "default", stat, subMetric, footer, active, accent, loading = false, children, className, onClick, onKeyDown, role, tabIndex, ...props }, ref) => {
|
|
26
|
+
const interactive = Boolean(onClick);
|
|
27
|
+
const hasStat = stat !== undefined;
|
|
28
|
+
const handleKeyDown = (event) => {
|
|
29
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
30
|
+
if (event.defaultPrevented ||
|
|
31
|
+
!interactive ||
|
|
32
|
+
!onClick ||
|
|
33
|
+
(event.key !== "Enter" && event.key !== " ")) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
onClick(event);
|
|
38
|
+
};
|
|
39
|
+
const renderedTitle = React.isValidElement(title) ? (title) : (_jsx(Typography, { as: "p", variant: hasStat ? "caption" : "body", color: variant === "gradient" ? "inherit" : hasStat ? "muted" : "foreground", className: cn(hasStat && "font-medium", !hasStat && "font-semibold", variant === "gradient" && "opacity-80"), children: title }));
|
|
9
40
|
const renderedDescription = description == null ? null : React.isValidElement(description) ? (description) : (_jsx(Typography, { as: "p", variant: "caption", color: variant === "gradient" ? "inherit" : undefined, className: variant === "gradient" ? "opacity-70" : undefined, children: description }));
|
|
10
|
-
return (_jsxs("div", { ref: ref, onClick: onClick, className: cn("rounded-
|
|
11
|
-
"border-
|
|
41
|
+
return (_jsxs("div", { ref: ref, onClick: onClick, onKeyDown: handleKeyDown, role: role !== null && role !== void 0 ? role : (interactive ? "button" : undefined), tabIndex: tabIndex !== null && tabIndex !== void 0 ? tabIndex : (interactive ? 0 : undefined), className: cn("rounded-surface border border-[hsl(var(--card-border))] text-card-foreground", variant === "default" && "bg-card", variant === "elevated" && "bg-card shadow-sm", variant === "gradient" &&
|
|
42
|
+
"border-[hsl(var(--card-gradient-border))]/30 bg-gradient-to-br from-[hsl(var(--card-gradient-from))] to-[hsl(var(--card-gradient-to))] text-[hsl(var(--card-gradient-foreground))]", active && "border-primary bg-primary/[0.04] ring-1 ring-primary/20", accent === "primary" &&
|
|
43
|
+
"border-[hsl(var(--card-border))] shadow-[inset_4px_0_0_0_hsl(var(--primary))]", interactive &&
|
|
44
|
+
"cursor-pointer transition-[border-color,background-color,box-shadow] hover:border-primary/50 hover:bg-primary/5 hover:shadow-md focus-visible:border-primary/50 focus-visible:bg-primary/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", className), ...props, children: [_jsxs("div", { className: cn("flex flex-col gap-2", size === "default" && "p-4", size === "compact" && "p-3"), children: [loading ? (_jsx(Skeleton, { className: "h-3.5 w-24" })) : (renderedTitle), loading
|
|
12
45
|
? description != null && _jsx(Skeleton, { className: "h-5 w-40" })
|
|
13
|
-
: renderedDescription, loading ? (stat !== undefined && _jsx(Skeleton, { className: "h-8 w-20" })) : stat ? (_jsx(Typography, { as: "p", variant: "title", color: variant === "gradient" ? "inherit" : undefined, children: stat })) : null, loading ? (subMetric !== undefined && _jsx(Skeleton, { className: "h-5 w-28" })) : subMetric ? (_jsx(Typography, { as: "p", variant: "caption", color: variant === "gradient" ? "inherit" : undefined, className: variant === "gradient" ? "opacity-80" : undefined, children: subMetric })) : null] }), children ? (_jsx("div", { className: cn(size === "default" && "p-
|
|
46
|
+
: renderedDescription, loading ? (stat !== undefined && _jsx(Skeleton, { className: "h-8 w-20" })) : stat ? (_jsx(Typography, { as: "p", variant: "title", color: variant === "gradient" ? "inherit" : undefined, children: stat })) : null, loading ? (subMetric !== undefined && _jsx(Skeleton, { className: "h-5 w-28" })) : subMetric ? (_jsx(Typography, { as: "p", variant: "caption", color: variant === "gradient" ? "inherit" : undefined, className: variant === "gradient" ? "opacity-80" : undefined, children: subMetric })) : null] }), children ? (_jsx("div", { className: cn(size === "default" && "p-4 pt-0", size === "compact" && "p-3 pt-0"), children: children })) : null, footer ? (_jsx("div", { className: cn("flex items-center", size === "default" && "p-4 pt-0", size === "compact" && "p-3 pt-0"), children: footer })) : null] }));
|
|
14
47
|
});
|
|
15
48
|
Card.displayName = "Card";
|
|
16
|
-
|
|
49
|
+
function CardGrid({ columns = 3, align = "stretch", className, ...props }) {
|
|
50
|
+
return (_jsx("div", { className: cn("grid gap-3", cardGridColumns[columns], align === "start" && "auto-rows-max items-start", className), ...props }));
|
|
51
|
+
}
|
|
52
|
+
function CardSplitGrid({ asideWidth = "md", breakpoint = "xl", align = "start", className, ...props }) {
|
|
53
|
+
return (_jsx("div", { className: cn("grid gap-3", cardSplitGridColumns[breakpoint][asideWidth], align === "start" && "auto-rows-max items-start", className), ...props }));
|
|
54
|
+
}
|
|
55
|
+
function CardList({ density = "default", variant = "cards", className, ...props }) {
|
|
56
|
+
return (_jsx("div", { className: cn("grid", variant === "cards" && density === "default" && "gap-2", variant === "cards" && density === "compact" && "gap-1.5", variant === "divided" &&
|
|
57
|
+
"overflow-hidden rounded-surface border border-[hsl(var(--card-border))] bg-background", variant === "divided" &&
|
|
58
|
+
"[&>[data-slot=card-list-item]]:rounded-none [&>[data-slot=card-list-item]]:border-0 [&>[data-slot=card-list-item]+[data-slot=card-list-item]]:border-t [&>[data-slot=card-list-item]+[data-slot=card-list-item]]:border-[hsl(var(--card-border))]", className), ...props }));
|
|
59
|
+
}
|
|
60
|
+
function CardListItem({ label, description, leading, leadingVariant = "badge", trailing, meta, labelLines = 1, descriptionLines = 1, className, onClick, ...props }) {
|
|
61
|
+
const interactive = Boolean(onClick);
|
|
62
|
+
const trailingNode = trailing == null || React.isValidElement(trailing) ? (trailing) : (_jsx(Typography, { as: "span", variant: "bodySm", className: "block truncate font-medium", children: trailing }));
|
|
63
|
+
const content = (_jsxs(_Fragment, { children: [leading !== undefined ? (leadingVariant === "badge" ? (_jsx("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-surface bg-muted text-sm font-semibold text-foreground", children: leading })) : (_jsx("div", { className: "shrink-0 text-muted-foreground", children: leading }))) : null, _jsxs("div", { className: "min-w-0 flex-1 overflow-hidden", children: [_jsxs("div", { className: "flex min-w-0 items-start justify-between gap-2", children: [_jsx(Typography, { as: "p", variant: "bodySm", className: cn("min-w-0 font-medium text-foreground", labelLines === 1 && "truncate", labelLines === 2 && "line-clamp-2"), children: label }), meta !== undefined ? (_jsx(Typography, { as: "span", variant: "caption", className: "min-w-0 max-w-[50%] shrink truncate text-right text-muted-foreground", children: meta })) : null] }), description !== undefined ? (_jsx(Typography, { as: "p", variant: "caption", className: cn("mt-0.5 text-muted-foreground", descriptionLines === 1 && "truncate", descriptionLines === 2 && "line-clamp-2"), children: description })) : null] }), trailingNode !== undefined ? (_jsx("div", { className: "min-w-0 max-w-[45%] shrink-0 overflow-hidden truncate text-right [&>*]:max-w-full", children: trailingNode })) : null] }));
|
|
64
|
+
const itemClassName = cn("flex w-full min-w-0 items-center gap-3 rounded-surface border border-[hsl(var(--card-border))] bg-background py-2 pl-3 pr-4 text-left", interactive && "cursor-pointer transition-colors hover:border-primary", className);
|
|
65
|
+
if (interactive) {
|
|
66
|
+
return (_jsx("button", { type: "button", "data-slot": "card-list-item", className: itemClassName, onClick: onClick, ...props, children: content }));
|
|
67
|
+
}
|
|
68
|
+
return (_jsx("div", { "data-slot": "card-list-item", className: itemClassName, ...props, children: content }));
|
|
69
|
+
}
|
|
70
|
+
export { Card, CardGrid, CardSplitGrid, CardList, CardListItem };
|
package/dist/checkbox.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputE
|
|
|
8
8
|
label?: React.ReactNode;
|
|
9
9
|
/** Description shown below the label in smaller muted text. */
|
|
10
10
|
description?: React.ReactNode;
|
|
11
|
+
/** Aligns the checkbox control against the label content. */
|
|
12
|
+
labelAlign?: "center" | "start";
|
|
11
13
|
}
|
|
12
14
|
declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
13
15
|
export { Checkbox };
|