@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.
- package/README.md +1 -0
- package/dist/cjs/components/data-display/avatar/Avatar.props.d.ts +1 -1
- package/dist/cjs/components/forms/date-picker/calendar/Calendar.props.d.ts +2 -2
- package/dist/cjs/components/index.d.ts +2 -0
- package/dist/cjs/components/overlay/alert/Alert.d.ts +32 -0
- package/dist/cjs/components/overlay/alert/Alert.props.d.ts +56 -0
- package/dist/cjs/components/overlay/alert/Alert.styles.d.ts +4 -0
- package/dist/cjs/components/overlay/alert/index.d.ts +2 -0
- package/dist/cjs/constants/globalConstants.d.ts +1 -0
- package/dist/cjs/hooks/index.d.ts +2 -0
- package/dist/cjs/hooks/useAlert.d.ts +23 -0
- package/dist/cjs/hooks/useAlert.types.d.ts +56 -0
- package/dist/cjs/index.js +336 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/alert.types.d.ts +8 -0
- package/dist/cjs/interfaces/index.d.ts +1 -0
- package/dist/cjs/resources/Icons.d.ts +4 -1
- package/dist/cjs/resources/icons/AlertCircleIcon.d.ts +2 -0
- package/dist/cjs/resources/icons/AlertTriangleIcon.d.ts +2 -0
- package/dist/cjs/resources/icons/CheckCircleIcon.d.ts +2 -0
- package/dist/cjs/utils/ui/components/foundation/text/getTruncateTextStyles.utils.d.ts +5 -1
- package/dist/cjs/utils/ui/components/overlay/alert/getAlertIcon.utils.d.ts +8 -0
- package/dist/cjs/utils/ui/components/overlay/alert/getAlertPositionStyles.utils.d.ts +8 -0
- package/dist/cjs/utils/ui/components/overlay/alert/getAlertVariantColors.utils.d.ts +14 -0
- package/dist/esm/components/data-display/avatar/Avatar.props.d.ts +1 -1
- package/dist/esm/components/forms/date-picker/calendar/Calendar.props.d.ts +2 -2
- package/dist/esm/components/index.d.ts +2 -0
- package/dist/esm/components/overlay/alert/Alert.d.ts +32 -0
- package/dist/esm/components/overlay/alert/Alert.props.d.ts +56 -0
- package/dist/esm/components/overlay/alert/Alert.styles.d.ts +4 -0
- package/dist/esm/components/overlay/alert/index.d.ts +2 -0
- package/dist/esm/constants/globalConstants.d.ts +1 -0
- package/dist/esm/hooks/index.d.ts +2 -0
- package/dist/esm/hooks/useAlert.d.ts +23 -0
- package/dist/esm/hooks/useAlert.types.d.ts +56 -0
- package/dist/esm/index.js +335 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/alert.types.d.ts +8 -0
- package/dist/esm/interfaces/index.d.ts +1 -0
- package/dist/esm/resources/Icons.d.ts +4 -1
- package/dist/esm/resources/icons/AlertCircleIcon.d.ts +2 -0
- package/dist/esm/resources/icons/AlertTriangleIcon.d.ts +2 -0
- package/dist/esm/resources/icons/CheckCircleIcon.d.ts +2 -0
- package/dist/esm/utils/ui/components/foundation/text/getTruncateTextStyles.utils.d.ts +5 -1
- package/dist/esm/utils/ui/components/overlay/alert/getAlertIcon.utils.d.ts +8 -0
- package/dist/esm/utils/ui/components/overlay/alert/getAlertPositionStyles.utils.d.ts +8 -0
- package/dist/esm/utils/ui/components/overlay/alert/getAlertVariantColors.utils.d.ts +14 -0
- package/dist/index.d.ts +153 -3
- package/package.json +1 -1
|
@@ -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 };
|
|
@@ -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;
|
|
@@ -6,7 +6,7 @@ export type AvatarProps = {
|
|
|
6
6
|
/** Fallback text to display when no image */
|
|
7
7
|
label?: string;
|
|
8
8
|
/** Click handler */
|
|
9
|
-
onClick?: (e: MouseEvent<
|
|
9
|
+
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
10
10
|
/** Size of the avatar */
|
|
11
11
|
size?: AvatarSize;
|
|
12
12
|
/** Text color for the label */
|
|
@@ -5,9 +5,9 @@ export type CalendarProps = {
|
|
|
5
5
|
/** Callback when a date is selected */
|
|
6
6
|
onDateSelect: (date: Date) => void;
|
|
7
7
|
/** Minimum selectable date */
|
|
8
|
-
minDate?: Date;
|
|
8
|
+
minDate?: Date | null;
|
|
9
9
|
/** Maximum selectable date */
|
|
10
|
-
maxDate?: Date;
|
|
10
|
+
maxDate?: Date | null;
|
|
11
11
|
/** Locale for month/year display */
|
|
12
12
|
locale?: string;
|
|
13
13
|
};
|
|
@@ -17,12 +17,14 @@ export * from '@components/layout/separator';
|
|
|
17
17
|
export * from '@components/layout/page-construction/page-section';
|
|
18
18
|
export * from '@components/layout/page-construction/page';
|
|
19
19
|
export * from '@components/overlay/accordion';
|
|
20
|
+
export * from '@components/overlay/alert';
|
|
20
21
|
export * from '@components/overlay/menu';
|
|
21
22
|
export * from '@components/overlay/modal';
|
|
22
23
|
export * from '@components/navigation/drawer-item';
|
|
23
24
|
export * from '@components/navigation/breadcrumb';
|
|
24
25
|
export * from '@components/navigation/tabs';
|
|
25
26
|
export * from '@components/navigation/pagination';
|
|
27
|
+
export type { AlertVariant, AlertPosition } from '@interfaces/alert.types';
|
|
26
28
|
export type { ButtonVariants, ButtonVariantStyle } from '@interfaces/button.types';
|
|
27
29
|
export type { TextVariants, TextVariantStyle } from '@interfaces/text.types';
|
|
28
30
|
export type { ChipVariant, ChipColor, ChipSize } from '@interfaces/chip.types';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { AlertProps } from '@components/overlay/alert/Alert.props';
|
|
3
|
+
/**
|
|
4
|
+
* Alert component - Display notifications with different variants
|
|
5
|
+
*
|
|
6
|
+
* **Variants:**
|
|
7
|
+
* - `default`: Standard alert with neutral styling
|
|
8
|
+
* - `info`: Informational alert with blue styling
|
|
9
|
+
* - `warning`: Warning alert with yellow/orange styling
|
|
10
|
+
* - `error`: Error alert with red styling
|
|
11
|
+
* - `success`: Success alert with green styling
|
|
12
|
+
*
|
|
13
|
+
* **Features:**
|
|
14
|
+
* - Auto-dismisses after 3 seconds
|
|
15
|
+
* - Positioned at screen corners
|
|
16
|
+
* - Supports stacking with offsetY
|
|
17
|
+
* - Icon based on variant
|
|
18
|
+
* - Smooth animations
|
|
19
|
+
* - Dynamic height calculation for proper stacking
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Alert
|
|
24
|
+
* text="Operation completed successfully"
|
|
25
|
+
* variant="success"
|
|
26
|
+
* position="top-right"
|
|
27
|
+
* isVisible={true}
|
|
28
|
+
* />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
declare const Alert: FC<AlertProps>;
|
|
32
|
+
export { Alert };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AlertPosition, AlertVariant } from '@interfaces/alert.types';
|
|
2
|
+
/**
|
|
3
|
+
* Alert component props
|
|
4
|
+
*/
|
|
5
|
+
export interface AlertProps {
|
|
6
|
+
/**
|
|
7
|
+
* Text content of the alert
|
|
8
|
+
*/
|
|
9
|
+
text: string;
|
|
10
|
+
/**
|
|
11
|
+
* Variant of the alert determining its color and icon
|
|
12
|
+
* @default 'default'
|
|
13
|
+
*/
|
|
14
|
+
variant?: AlertVariant;
|
|
15
|
+
/**
|
|
16
|
+
* Position of the alert on screen
|
|
17
|
+
* @default 'top-right'
|
|
18
|
+
*/
|
|
19
|
+
position?: AlertPosition;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the alert is visible
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
isVisible?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Vertical offset for stacking alerts (in pixels)
|
|
27
|
+
* @default 0
|
|
28
|
+
*/
|
|
29
|
+
offsetY?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Maximum width of the alert in pixels
|
|
32
|
+
* @default 300
|
|
33
|
+
*/
|
|
34
|
+
maxWidth?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Unique identifier for the alert
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
alertId?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Callback when alert height changes
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
onHeightChange?: (alertId: string, height: number) => void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Internal style parameters for Alert component
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export interface AlertStyleParams {
|
|
51
|
+
variant: AlertVariant;
|
|
52
|
+
position: AlertPosition;
|
|
53
|
+
isVisible: boolean;
|
|
54
|
+
offsetY: number;
|
|
55
|
+
maxWidth: number;
|
|
56
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { useAlert, AlertProvider } from '@hooks/useAlert.tsx';
|
|
2
|
+
export type { ShowAlertOptions, AlertContextValue, AlertProviderProps } from '@hooks/useAlert.types';
|
|
1
3
|
export { useAnchorPosition } from '@hooks/useAnchorPosition';
|
|
2
4
|
export type { AnchorOrigin, AnchorPosition } from '@hooks/useAnchorPosition.types';
|
|
3
5
|
export { useClickOutside } from '@hooks/useClickOutside';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { AlertContextValue, AlertProviderProps } from '@hooks/useAlert.types';
|
|
3
|
+
/**
|
|
4
|
+
* Alert Provider Component
|
|
5
|
+
* Manages alert queue and renders alerts in a portal
|
|
6
|
+
*/
|
|
7
|
+
declare const AlertProvider: FC<AlertProviderProps>;
|
|
8
|
+
/**
|
|
9
|
+
* Hook to access alert functionality
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const { showAlert } = useAlert()
|
|
14
|
+
*
|
|
15
|
+
* showAlert({
|
|
16
|
+
* text: 'Operation completed',
|
|
17
|
+
* variant: 'success',
|
|
18
|
+
* position: 'top-right'
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare const useAlert: () => AlertContextValue;
|
|
23
|
+
export { AlertProvider, useAlert };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AlertPosition, AlertVariant } from '@interfaces/alert.types';
|
|
2
|
+
/**
|
|
3
|
+
* Alert item in the queue
|
|
4
|
+
*/
|
|
5
|
+
export interface AlertItem {
|
|
6
|
+
id: string;
|
|
7
|
+
text: string;
|
|
8
|
+
variant: AlertVariant;
|
|
9
|
+
position: AlertPosition;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
maxWidth: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Options for showing an alert
|
|
15
|
+
*/
|
|
16
|
+
export interface ShowAlertOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Text content of the alert
|
|
19
|
+
*/
|
|
20
|
+
text: string;
|
|
21
|
+
/**
|
|
22
|
+
* Variant of the alert
|
|
23
|
+
* @default 'default'
|
|
24
|
+
*/
|
|
25
|
+
variant?: AlertVariant;
|
|
26
|
+
/**
|
|
27
|
+
* Position of the alert on screen
|
|
28
|
+
* @default 'top-right'
|
|
29
|
+
*/
|
|
30
|
+
position?: AlertPosition;
|
|
31
|
+
/**
|
|
32
|
+
* Duration before auto-dismiss in milliseconds
|
|
33
|
+
* @default 3000
|
|
34
|
+
*/
|
|
35
|
+
duration?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum width of the alert in pixels
|
|
38
|
+
* @default 300
|
|
39
|
+
*/
|
|
40
|
+
maxWidth?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Alert context value
|
|
44
|
+
*/
|
|
45
|
+
export interface AlertContextValue {
|
|
46
|
+
/**
|
|
47
|
+
* Show an alert
|
|
48
|
+
*/
|
|
49
|
+
showAlert: (options: ShowAlertOptions) => void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Alert provider props
|
|
53
|
+
*/
|
|
54
|
+
export interface AlertProviderProps {
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
}
|