@neasg/design-system 0.4.29 → 0.4.30
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/alert-stack.d.ts +6 -0
- package/dist/alert-stack.js +31 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface AlertStackProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
declare const AlertStack: React.ForwardRefExoticComponent<AlertStackProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export { AlertStack };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { AnimatePresence, MotionConfig, motion } from "motion/react";
|
|
4
|
+
import { cn } from "./lib/utils";
|
|
5
|
+
const MAX_VISIBLE_ALERTS = 3;
|
|
6
|
+
const stackItemClasses = [
|
|
7
|
+
"z-50",
|
|
8
|
+
"pointer-events-none z-40 mx-1",
|
|
9
|
+
"pointer-events-none z-30 mx-2",
|
|
10
|
+
];
|
|
11
|
+
const stackPaddingClasses = ["", "", "pb-2", "pb-4"];
|
|
12
|
+
const AlertStack = React.forwardRef(({ children, className, ...props }, ref) => {
|
|
13
|
+
const alerts = React.Children.toArray(children);
|
|
14
|
+
const visibleAlerts = alerts.slice(0, MAX_VISIBLE_ALERTS);
|
|
15
|
+
return (_jsx(MotionConfig, { reducedMotion: "user", children: _jsx("div", { ref: ref, "data-slot": "alert-stack", className: cn("grid", stackPaddingClasses[visibleAlerts.length], className), ...props, children: _jsx(AnimatePresence, { initial: true, children: visibleAlerts.map((alert, index) => {
|
|
16
|
+
const isFront = index === 0;
|
|
17
|
+
return (_jsx(motion.div, { "data-slot": "alert-stack-item", "data-position": isFront ? "front" : "back", "data-depth": index, className: cn("col-start-1 row-start-1 origin-top overflow-hidden rounded-surface", stackItemClasses[index], isFront
|
|
18
|
+
? "cursor-pointer"
|
|
19
|
+
: "border border-border/80 bg-muted shadow-sm"), initial: { scale: 0.98, y: -12 }, animate: {
|
|
20
|
+
opacity: 1,
|
|
21
|
+
scale: 1,
|
|
22
|
+
y: index * 8,
|
|
23
|
+
}, whileHover: isFront ? { y: -2 } : undefined, exit: { opacity: 0, scale: 0.98, y: -16, zIndex: 60 }, transition: isFront
|
|
24
|
+
? { duration: 0.2, ease: "easeOut" }
|
|
25
|
+
: { type: "spring", stiffness: 420, damping: 34 }, "aria-hidden": isFront ? undefined : true, ...(isFront ? {} : { inert: "" }), children: _jsx("div", { className: cn("h-full", !isFront && "invisible"), children: alert }) }, React.isValidElement(alert) && alert.key !== null
|
|
26
|
+
? alert.key
|
|
27
|
+
: index));
|
|
28
|
+
}) }) }) }));
|
|
29
|
+
});
|
|
30
|
+
AlertStack.displayName = "AlertStack";
|
|
31
|
+
export { AlertStack };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ export type { AvatarProps, AvatarSize, AvatarProfileProps, AvatarRootProps, } fr
|
|
|
3
3
|
export { AvatarProfilePopover, AvatarProfilePopoverContent, AvatarProfilePopoverHeader, AvatarProfilePopoverSection, AvatarProfilePopoverFooter, AvatarProfilePopoverFooterAction, } from "./avatar-profile-popover";
|
|
4
4
|
export type { AvatarProfilePopoverProps, AvatarProfilePopoverContentProps, AvatarProfilePopoverHeaderProps, AvatarProfilePopoverSectionProps, AvatarProfilePopoverFooterProps, AvatarProfilePopoverFooterActionProps, } from "./avatar-profile-popover";
|
|
5
5
|
export * from "./animated-icons";
|
|
6
|
-
export { Alert, AlertAction, AlertConsent, alertVariants } from "./alert";
|
|
7
|
-
export type { AlertActionProps, AlertConsentProps, AlertProps } from "./alert";
|
|
6
|
+
export { Alert, AlertAction, AlertConsent, alertVariants, } from "./alert";
|
|
7
|
+
export type { AlertActionProps, AlertConsentProps, AlertProps, } from "./alert";
|
|
8
|
+
export { AlertStack } from "./alert-stack";
|
|
9
|
+
export type { AlertStackProps } from "./alert-stack";
|
|
8
10
|
export { Badge, badgeVariants } from "./badge";
|
|
9
11
|
export { Card, CardGrid, CardSplitGrid, CardList, CardListItem, } from "./card";
|
|
10
12
|
export type { CardGridProps, CardListItemProps, CardListProps, CardProps, CardSplitGridProps, } from "./card";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { Avatar, AvatarProfile, AvatarRoot, AvatarImage, } from "./avatar";
|
|
2
2
|
export { AvatarProfilePopover, AvatarProfilePopoverContent, AvatarProfilePopoverHeader, AvatarProfilePopoverSection, AvatarProfilePopoverFooter, AvatarProfilePopoverFooterAction, } from "./avatar-profile-popover";
|
|
3
3
|
export * from "./animated-icons";
|
|
4
|
-
export { Alert, AlertAction, AlertConsent, alertVariants } from "./alert";
|
|
4
|
+
export { Alert, AlertAction, AlertConsent, alertVariants, } from "./alert";
|
|
5
|
+
export { AlertStack } from "./alert-stack";
|
|
5
6
|
export { Badge, badgeVariants } from "./badge";
|
|
6
7
|
export { Card, CardGrid, CardSplitGrid, CardList, CardListItem, } from "./card";
|
|
7
8
|
export { MessageAttachmentRow, MessageItem, MessageNewDivider, MessageThread, formatMessageDate, } from "./message-item";
|