@aurora-ds/components 0.18.2 → 0.19.1

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 (51) 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/forms/select/Select.props.d.ts +11 -3
  5. package/dist/cjs/components/index.d.ts +3 -0
  6. package/dist/cjs/components/overlay/alert/Alert.d.ts +32 -0
  7. package/dist/cjs/components/overlay/alert/Alert.props.d.ts +56 -0
  8. package/dist/cjs/components/overlay/alert/Alert.styles.d.ts +4 -0
  9. package/dist/cjs/components/overlay/alert/index.d.ts +2 -0
  10. package/dist/cjs/constants/globalConstants.d.ts +1 -0
  11. package/dist/cjs/hooks/index.d.ts +2 -0
  12. package/dist/cjs/hooks/useAlert.d.ts +23 -0
  13. package/dist/cjs/hooks/useAlert.types.d.ts +56 -0
  14. package/dist/cjs/index.js +340 -5
  15. package/dist/cjs/index.js.map +1 -1
  16. package/dist/cjs/interfaces/alert.types.d.ts +8 -0
  17. package/dist/cjs/interfaces/index.d.ts +1 -0
  18. package/dist/cjs/resources/Icons.d.ts +4 -1
  19. package/dist/cjs/resources/icons/AlertCircleIcon.d.ts +2 -0
  20. package/dist/cjs/resources/icons/AlertTriangleIcon.d.ts +2 -0
  21. package/dist/cjs/resources/icons/CheckCircleIcon.d.ts +2 -0
  22. package/dist/cjs/utils/ui/components/foundation/text/getTruncateTextStyles.utils.d.ts +5 -1
  23. package/dist/cjs/utils/ui/components/overlay/alert/getAlertIcon.utils.d.ts +8 -0
  24. package/dist/cjs/utils/ui/components/overlay/alert/getAlertPositionStyles.utils.d.ts +8 -0
  25. package/dist/cjs/utils/ui/components/overlay/alert/getAlertVariantColors.utils.d.ts +14 -0
  26. package/dist/esm/components/data-display/avatar/Avatar.props.d.ts +1 -1
  27. package/dist/esm/components/forms/date-picker/calendar/Calendar.props.d.ts +2 -2
  28. package/dist/esm/components/forms/select/Select.props.d.ts +11 -3
  29. package/dist/esm/components/index.d.ts +3 -0
  30. package/dist/esm/components/overlay/alert/Alert.d.ts +32 -0
  31. package/dist/esm/components/overlay/alert/Alert.props.d.ts +56 -0
  32. package/dist/esm/components/overlay/alert/Alert.styles.d.ts +4 -0
  33. package/dist/esm/components/overlay/alert/index.d.ts +2 -0
  34. package/dist/esm/constants/globalConstants.d.ts +1 -0
  35. package/dist/esm/hooks/index.d.ts +2 -0
  36. package/dist/esm/hooks/useAlert.d.ts +23 -0
  37. package/dist/esm/hooks/useAlert.types.d.ts +56 -0
  38. package/dist/esm/index.js +339 -7
  39. package/dist/esm/index.js.map +1 -1
  40. package/dist/esm/interfaces/alert.types.d.ts +8 -0
  41. package/dist/esm/interfaces/index.d.ts +1 -0
  42. package/dist/esm/resources/Icons.d.ts +4 -1
  43. package/dist/esm/resources/icons/AlertCircleIcon.d.ts +2 -0
  44. package/dist/esm/resources/icons/AlertTriangleIcon.d.ts +2 -0
  45. package/dist/esm/resources/icons/CheckCircleIcon.d.ts +2 -0
  46. package/dist/esm/utils/ui/components/foundation/text/getTruncateTextStyles.utils.d.ts +5 -1
  47. package/dist/esm/utils/ui/components/overlay/alert/getAlertIcon.utils.d.ts +8 -0
  48. package/dist/esm/utils/ui/components/overlay/alert/getAlertPositionStyles.utils.d.ts +8 -0
  49. package/dist/esm/utils/ui/components/overlay/alert/getAlertVariantColors.utils.d.ts +14 -0
  50. package/dist/index.d.ts +164 -6
  51. package/package.json +1 -1
package/README.md CHANGED
@@ -47,6 +47,7 @@ function App() {
47
47
  | Component | Description |
48
48
  |-----------|-------------|
49
49
  | **Accordion** | Collapsible container to show/hide content |
50
+ | **Alert** | Notification component with variants (default, info, warning, error, success) and auto-dismiss |
50
51
  | **Avatar** | User avatar display component with image or initials |
51
52
  | **AvatarGroup** | Group of avatars with overlapping display |
52
53
  | **Breadcrumb** | Navigation component for hierarchical page structures |
@@ -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<HTMLButtonElement>) => void;
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
  };
@@ -5,13 +5,21 @@ export type SelectProps = {
5
5
  */
6
6
  options: SelectOption[];
7
7
  /**
8
- * The currently selected value
8
+ * The currently selected value (null to show placeholder)
9
9
  */
10
- value?: string | number;
10
+ value: string | number | null;
11
11
  /**
12
12
  * Callback when selection changes
13
13
  */
14
- onChange?: (value: string | number) => void;
14
+ onChange: (value: string | number) => void;
15
+ /**
16
+ * Label displayed above the select
17
+ */
18
+ label?: string;
19
+ /**
20
+ * Whether the field is mandatory (displays an asterisk next to the label)
21
+ */
22
+ mandatory?: boolean;
15
23
  /**
16
24
  * Placeholder text when no option is selected
17
25
  */
@@ -17,12 +17,15 @@ 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';
31
+ export type { SelectOption } from '@interfaces/select.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
+ }
@@ -0,0 +1,4 @@
1
+ import { AlertStyleParams } from '@components/overlay/alert/Alert.props';
2
+ export declare const ALERT_STYLES: {
3
+ root: (args_0: AlertStyleParams) => string;
4
+ };
@@ -0,0 +1,2 @@
1
+ export * from '@components/overlay/alert/Alert';
2
+ export type { AlertProps } from '@components/overlay/alert/Alert.props';
@@ -1,4 +1,5 @@
1
1
  export declare const BUTTON_SIZE = 36;
2
+ export declare const ALERT_MAX_WIDTH = 320;
2
3
  export declare const MENU_ITEM_SIZE = 32;
3
4
  export declare const DRAWER_ITEM_HEIGHT = 32;
4
5
  export declare const DEFAULT_TRANSITION_DURATION_MS = 150;
@@ -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
+ }