@aurora-ds/components 0.18.2 → 0.19.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.
Files changed (49) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/components/data-display/avatar/Avatar.props.d.ts +1 -1
  3. package/dist/cjs/components/forms/date-picker/calendar/Calendar.props.d.ts +2 -2
  4. package/dist/cjs/components/index.d.ts +2 -0
  5. package/dist/cjs/components/overlay/alert/Alert.d.ts +32 -0
  6. package/dist/cjs/components/overlay/alert/Alert.props.d.ts +56 -0
  7. package/dist/cjs/components/overlay/alert/Alert.styles.d.ts +4 -0
  8. package/dist/cjs/components/overlay/alert/index.d.ts +2 -0
  9. package/dist/cjs/constants/globalConstants.d.ts +1 -0
  10. package/dist/cjs/hooks/index.d.ts +2 -0
  11. package/dist/cjs/hooks/useAlert.d.ts +23 -0
  12. package/dist/cjs/hooks/useAlert.types.d.ts +56 -0
  13. package/dist/cjs/index.js +336 -2
  14. package/dist/cjs/index.js.map +1 -1
  15. package/dist/cjs/interfaces/alert.types.d.ts +8 -0
  16. package/dist/cjs/interfaces/index.d.ts +1 -0
  17. package/dist/cjs/resources/Icons.d.ts +4 -1
  18. package/dist/cjs/resources/icons/AlertCircleIcon.d.ts +2 -0
  19. package/dist/cjs/resources/icons/AlertTriangleIcon.d.ts +2 -0
  20. package/dist/cjs/resources/icons/CheckCircleIcon.d.ts +2 -0
  21. package/dist/cjs/utils/ui/components/foundation/text/getTruncateTextStyles.utils.d.ts +5 -1
  22. package/dist/cjs/utils/ui/components/overlay/alert/getAlertIcon.utils.d.ts +8 -0
  23. package/dist/cjs/utils/ui/components/overlay/alert/getAlertPositionStyles.utils.d.ts +8 -0
  24. package/dist/cjs/utils/ui/components/overlay/alert/getAlertVariantColors.utils.d.ts +14 -0
  25. package/dist/esm/components/data-display/avatar/Avatar.props.d.ts +1 -1
  26. package/dist/esm/components/forms/date-picker/calendar/Calendar.props.d.ts +2 -2
  27. package/dist/esm/components/index.d.ts +2 -0
  28. package/dist/esm/components/overlay/alert/Alert.d.ts +32 -0
  29. package/dist/esm/components/overlay/alert/Alert.props.d.ts +56 -0
  30. package/dist/esm/components/overlay/alert/Alert.styles.d.ts +4 -0
  31. package/dist/esm/components/overlay/alert/index.d.ts +2 -0
  32. package/dist/esm/constants/globalConstants.d.ts +1 -0
  33. package/dist/esm/hooks/index.d.ts +2 -0
  34. package/dist/esm/hooks/useAlert.d.ts +23 -0
  35. package/dist/esm/hooks/useAlert.types.d.ts +56 -0
  36. package/dist/esm/index.js +335 -4
  37. package/dist/esm/index.js.map +1 -1
  38. package/dist/esm/interfaces/alert.types.d.ts +8 -0
  39. package/dist/esm/interfaces/index.d.ts +1 -0
  40. package/dist/esm/resources/Icons.d.ts +4 -1
  41. package/dist/esm/resources/icons/AlertCircleIcon.d.ts +2 -0
  42. package/dist/esm/resources/icons/AlertTriangleIcon.d.ts +2 -0
  43. package/dist/esm/resources/icons/CheckCircleIcon.d.ts +2 -0
  44. package/dist/esm/utils/ui/components/foundation/text/getTruncateTextStyles.utils.d.ts +5 -1
  45. package/dist/esm/utils/ui/components/overlay/alert/getAlertIcon.utils.d.ts +8 -0
  46. package/dist/esm/utils/ui/components/overlay/alert/getAlertPositionStyles.utils.d.ts +8 -0
  47. package/dist/esm/utils/ui/components/overlay/alert/getAlertVariantColors.utils.d.ts +14 -0
  48. package/dist/index.d.ts +153 -3
  49. package/package.json +1 -1
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Alert variant types
3
+ */
4
+ export type AlertVariant = 'default' | 'info' | 'warning' | 'error' | 'success';
5
+ /**
6
+ * Alert position types
7
+ */
8
+ export type AlertPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
@@ -1,3 +1,4 @@
1
+ export * from '@interfaces/alert.types';
1
2
  export * from '@interfaces/button.types';
2
3
  export * from '@interfaces/text.types';
3
4
  export * from '@interfaces/chip.types';
@@ -1,4 +1,7 @@
1
+ import { AlertCircleIcon } from '@resources/icons/AlertCircleIcon.tsx';
2
+ import { AlertTriangleIcon } from '@resources/icons/AlertTriangleIcon.tsx';
1
3
  import { CalendarIcon } from '@resources/icons/CalendarIcon.tsx';
4
+ import { CheckCircleIcon } from '@resources/icons/CheckCircleIcon.tsx';
2
5
  import { ChevronDownIcon } from '@resources/icons/ChevronDownIcon.tsx';
3
6
  import { ChevronLeftIcon } from '@resources/icons/ChevronLeftIcon.tsx';
4
7
  import { ChevronRightIcon } from '@resources/icons/ChevronRightIcon.tsx';
@@ -7,4 +10,4 @@ import { EyeIcon } from '@resources/icons/EyeIcon.tsx';
7
10
  import { EyeOffIcon } from '@resources/icons/EyeOffIcon.tsx';
8
11
  import { InfoIcon } from '@resources/icons/InfoIcon.tsx';
9
12
  import { MoreHorizontalIcon } from '@resources/icons/MoreHorizontalIcon.tsx';
10
- export { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, InfoIcon, MoreHorizontalIcon, EyeIcon, EyeOffIcon, CloseIcon };
13
+ export { AlertCircleIcon, AlertTriangleIcon, CalendarIcon, CheckCircleIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, InfoIcon, MoreHorizontalIcon, EyeIcon, EyeOffIcon, CloseIcon };
@@ -0,0 +1,2 @@
1
+ import { JSX } from 'react';
2
+ export declare const AlertCircleIcon: () => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { JSX } from 'react';
2
+ export declare const AlertTriangleIcon: () => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { JSX } from 'react';
2
+ export declare const CheckCircleIcon: () => JSX.Element;
@@ -5,6 +5,8 @@ export declare const getTruncateTextStyles: (maxLines: number) => {
5
5
  display?: undefined;
6
6
  WebkitLineClamp?: undefined;
7
7
  WebkitBoxOrient?: undefined;
8
+ overflowWrap?: undefined;
9
+ wordBreak?: undefined;
8
10
  lineClamp?: undefined;
9
11
  } | {
10
12
  overflow: string;
@@ -12,6 +14,8 @@ export declare const getTruncateTextStyles: (maxLines: number) => {
12
14
  display: string;
13
15
  WebkitLineClamp: number;
14
16
  WebkitBoxOrient: "vertical";
17
+ whiteSpace: "normal";
18
+ overflowWrap: "break-word";
19
+ wordBreak: "break-word";
15
20
  lineClamp: number;
16
- whiteSpace?: undefined;
17
21
  };
@@ -0,0 +1,8 @@
1
+ import { JSX } from 'react';
2
+ import { AlertVariant } from '@interfaces/alert.types';
3
+ /**
4
+ * Get icon component for alert variant
5
+ * @param variant - Alert variant
6
+ * @returns JSX Element for the icon
7
+ */
8
+ export declare const getAlertIcon: (variant: AlertVariant) => JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { AlertPosition } from '@interfaces/alert.types';
2
+ /**
3
+ * Get position styles for alert
4
+ * @param position - Alert position
5
+ * @param offsetY - Vertical offset for stacking (in pixels)
6
+ * @returns Object with CSS position styles (top/bottom + left/right)
7
+ */
8
+ export declare const getAlertPositionStyles: (position: AlertPosition, offsetY: number) => Record<string, string>;
@@ -0,0 +1,14 @@
1
+ import { Theme } from '@aurora-ds/theme';
2
+ import { AlertVariant } from '@interfaces/alert.types';
3
+ export interface AlertVariantColors {
4
+ background: string;
5
+ border: string;
6
+ iconColor: 'info' | 'warning' | 'error' | 'success' | 'text';
7
+ }
8
+ /**
9
+ * Get colors for alert variants
10
+ * @param theme - Aurora theme
11
+ * @param variant - Alert variant
12
+ * @returns Colors for the variant
13
+ */
14
+ export declare const getAlertVariantColors: (theme: Theme, variant: AlertVariant) => AlertVariantColors;
package/dist/index.d.ts CHANGED
@@ -171,7 +171,7 @@ type AvatarProps = {
171
171
  /** Fallback text to display when no image */
172
172
  label?: string;
173
173
  /** Click handler */
174
- onClick?: (e: MouseEvent<HTMLButtonElement>) => void;
174
+ onClick?: (e: MouseEvent<HTMLDivElement>) => void;
175
175
  /** Size of the avatar */
176
176
  size?: AvatarSize;
177
177
  /** Text color for the label */
@@ -196,6 +196,15 @@ declare const Avatar: FC<AvatarProps>;
196
196
  */
197
197
  declare const AvatarGroup: FC<AvatarGroupProps>;
198
198
 
199
+ /**
200
+ * Alert variant types
201
+ */
202
+ type AlertVariant = 'default' | 'info' | 'warning' | 'error' | 'success';
203
+ /**
204
+ * Alert position types
205
+ */
206
+ type AlertPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
207
+
199
208
  type ButtonVariants = 'contained' | 'outlined' | 'text' | 'destructive' | 'link';
200
209
  type IconButtonVariants = Exclude<ButtonVariants, 'link'>;
201
210
  type IconButtonSizes = 'small' | 'medium' | 'large';
@@ -736,6 +745,81 @@ type AccordionProps = {
736
745
  */
737
746
  declare const Accordion: FC<AccordionProps>;
738
747
 
748
+ /**
749
+ * Alert component props
750
+ */
751
+ interface AlertProps {
752
+ /**
753
+ * Text content of the alert
754
+ */
755
+ text: string;
756
+ /**
757
+ * Variant of the alert determining its color and icon
758
+ * @default 'default'
759
+ */
760
+ variant?: AlertVariant;
761
+ /**
762
+ * Position of the alert on screen
763
+ * @default 'top-right'
764
+ */
765
+ position?: AlertPosition;
766
+ /**
767
+ * Whether the alert is visible
768
+ * @default false
769
+ */
770
+ isVisible?: boolean;
771
+ /**
772
+ * Vertical offset for stacking alerts (in pixels)
773
+ * @default 0
774
+ */
775
+ offsetY?: number;
776
+ /**
777
+ * Maximum width of the alert in pixels
778
+ * @default 300
779
+ */
780
+ maxWidth?: number;
781
+ /**
782
+ * Unique identifier for the alert
783
+ * @internal
784
+ */
785
+ alertId?: string;
786
+ /**
787
+ * Callback when alert height changes
788
+ * @internal
789
+ */
790
+ onHeightChange?: (alertId: string, height: number) => void;
791
+ }
792
+
793
+ /**
794
+ * Alert component - Display notifications with different variants
795
+ *
796
+ * **Variants:**
797
+ * - `default`: Standard alert with neutral styling
798
+ * - `info`: Informational alert with blue styling
799
+ * - `warning`: Warning alert with yellow/orange styling
800
+ * - `error`: Error alert with red styling
801
+ * - `success`: Success alert with green styling
802
+ *
803
+ * **Features:**
804
+ * - Auto-dismisses after 3 seconds
805
+ * - Positioned at screen corners
806
+ * - Supports stacking with offsetY
807
+ * - Icon based on variant
808
+ * - Smooth animations
809
+ * - Dynamic height calculation for proper stacking
810
+ *
811
+ * @example
812
+ * ```tsx
813
+ * <Alert
814
+ * text="Operation completed successfully"
815
+ * variant="success"
816
+ * position="top-right"
817
+ * isVisible={true}
818
+ * />
819
+ * ```
820
+ */
821
+ declare const Alert: FC<AlertProps>;
822
+
739
823
  type AnchorPosition = {
740
824
  top: number;
741
825
  left: number;
@@ -958,6 +1042,72 @@ type PaginationProps = {
958
1042
  */
959
1043
  declare const Pagination: FC<PaginationProps>;
960
1044
 
1045
+ /**
1046
+ * Options for showing an alert
1047
+ */
1048
+ interface ShowAlertOptions {
1049
+ /**
1050
+ * Text content of the alert
1051
+ */
1052
+ text: string;
1053
+ /**
1054
+ * Variant of the alert
1055
+ * @default 'default'
1056
+ */
1057
+ variant?: AlertVariant;
1058
+ /**
1059
+ * Position of the alert on screen
1060
+ * @default 'top-right'
1061
+ */
1062
+ position?: AlertPosition;
1063
+ /**
1064
+ * Duration before auto-dismiss in milliseconds
1065
+ * @default 3000
1066
+ */
1067
+ duration?: number;
1068
+ /**
1069
+ * Maximum width of the alert in pixels
1070
+ * @default 300
1071
+ */
1072
+ maxWidth?: number;
1073
+ }
1074
+ /**
1075
+ * Alert context value
1076
+ */
1077
+ interface AlertContextValue {
1078
+ /**
1079
+ * Show an alert
1080
+ */
1081
+ showAlert: (options: ShowAlertOptions) => void;
1082
+ }
1083
+ /**
1084
+ * Alert provider props
1085
+ */
1086
+ interface AlertProviderProps {
1087
+ children: React.ReactNode;
1088
+ }
1089
+
1090
+ /**
1091
+ * Alert Provider Component
1092
+ * Manages alert queue and renders alerts in a portal
1093
+ */
1094
+ declare const AlertProvider: FC<AlertProviderProps>;
1095
+ /**
1096
+ * Hook to access alert functionality
1097
+ *
1098
+ * @example
1099
+ * ```tsx
1100
+ * const { showAlert } = useAlert()
1101
+ *
1102
+ * showAlert({
1103
+ * text: 'Operation completed',
1104
+ * variant: 'success',
1105
+ * position: 'top-right'
1106
+ * })
1107
+ * ```
1108
+ */
1109
+ declare const useAlert: () => AlertContextValue;
1110
+
961
1111
  type UseAnchorPositionParams = {
962
1112
  anchor: HTMLElement | null;
963
1113
  menuRef: RefObject<HTMLDivElement | null>;
@@ -993,5 +1143,5 @@ type UseTransitionRenderReturnType = {
993
1143
  */
994
1144
  declare const useTransitionRender: (isOpen: boolean, duration?: number) => UseTransitionRenderReturnType;
995
1145
 
996
- export { Accordion, Avatar, AvatarGroup, Breadcrumb, BreadcrumbEllipsis, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Chip, _default as DatePicker, DrawerItem, _default$3 as Form, Grid, Icon, IconButton, _default$2 as Input, Menu, MenuGroup, MenuItem, Modal, Page, PageSection, Pagination, Select, Separator, Skeleton, Stack, TabItem, Tabs, Text, _default$1 as TextArea, useAnchorPosition, useClickOutside, useTransitionRender };
997
- export type { AccordionProps, AnchorOrigin, AnchorPosition, AvatarGroupProps, AvatarProps, BreadcrumbEllipsisProps, BreadcrumbLinkProps, BreadcrumbPageProps, BreadcrumbProps, BreadcrumbSeparatorProps, ButtonProps, ButtonVariantStyle, ButtonVariants, CardProps, ChipColor, ChipProps, ChipSize, ChipVariant, DateFormat, DatePickerProps, DrawerItemProps, FormProps, GridProps, IconButtonProps, IconProps, InputProps, MenuGroupProps, MenuItemProps, MenuProps, ModalProps, PageProps, PageSectionProps, PaginationProps, SelectProps, SeparatorProps, SkeletonProps, StackProps, TabItemProps, TabsProps, TextAreaProps, TextProps, TextVariantStyle, TextVariants, UseTransitionRenderReturnType };
1146
+ export { Accordion, Alert, AlertProvider, Avatar, AvatarGroup, Breadcrumb, BreadcrumbEllipsis, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, Button, Card, Chip, _default as DatePicker, DrawerItem, _default$3 as Form, Grid, Icon, IconButton, _default$2 as Input, Menu, MenuGroup, MenuItem, Modal, Page, PageSection, Pagination, Select, Separator, Skeleton, Stack, TabItem, Tabs, Text, _default$1 as TextArea, useAlert, useAnchorPosition, useClickOutside, useTransitionRender };
1147
+ export type { AccordionProps, AlertContextValue, AlertPosition, AlertProps, AlertProviderProps, AlertVariant, AnchorOrigin, AnchorPosition, AvatarGroupProps, AvatarProps, BreadcrumbEllipsisProps, BreadcrumbLinkProps, BreadcrumbPageProps, BreadcrumbProps, BreadcrumbSeparatorProps, ButtonProps, ButtonVariantStyle, ButtonVariants, CardProps, ChipColor, ChipProps, ChipSize, ChipVariant, DateFormat, DatePickerProps, DrawerItemProps, FormProps, GridProps, IconButtonProps, IconProps, InputProps, MenuGroupProps, MenuItemProps, MenuProps, ModalProps, PageProps, PageSectionProps, PaginationProps, SelectProps, SeparatorProps, ShowAlertOptions, SkeletonProps, StackProps, TabItemProps, TabsProps, TextAreaProps, TextProps, TextVariantStyle, TextVariants, UseTransitionRenderReturnType };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurora-ds/components",
3
- "version": "0.18.2",
3
+ "version": "0.19.0",
4
4
  "type": "module",
5
5
  "description": "Aurora DS - React Components Library",
6
6
  "main": "dist/cjs/index.js",