@pecb-ui/components 1.1.2 → 2.0.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 (56) hide show
  1. package/README.md +556 -556
  2. package/fesm2022/pecb-ui-components.mjs +998 -1907
  3. package/fesm2022/pecb-ui-components.mjs.map +1 -1
  4. package/index.d.ts +2439 -3
  5. package/package.json +6 -8
  6. package/esm2022/lib/components/button/button.component.mjs +0 -171
  7. package/esm2022/lib/components/card/card.component.mjs +0 -182
  8. package/esm2022/lib/components/checkbox/checkbox.component.mjs +0 -126
  9. package/esm2022/lib/components/datepicker/datepicker.component.mjs +0 -349
  10. package/esm2022/lib/components/dropdown/dropdown.component.mjs +0 -329
  11. package/esm2022/lib/components/input/input.component.mjs +0 -321
  12. package/esm2022/lib/components/pagination/pagination.component.mjs +0 -197
  13. package/esm2022/lib/components/radio/radio.component.mjs +0 -147
  14. package/esm2022/lib/components/right-modal/right-modal.component.mjs +0 -234
  15. package/esm2022/lib/components/sidebar/sidebar.component.mjs +0 -155
  16. package/esm2022/lib/components/status/status.component.mjs +0 -50
  17. package/esm2022/lib/components/tab/tab.component.mjs +0 -151
  18. package/esm2022/lib/components/table/table.component.mjs +0 -503
  19. package/esm2022/lib/components/toggle/toggle.component.mjs +0 -126
  20. package/esm2022/lib/pecb-components.module.mjs +0 -118
  21. package/esm2022/lib/services/loading.service.mjs +0 -182
  22. package/esm2022/lib/services/notification.service.mjs +0 -144
  23. package/esm2022/lib/services/theme.service.mjs +0 -232
  24. package/esm2022/lib/shared/interfaces/component.interfaces.mjs +0 -2
  25. package/esm2022/lib/shared/types/common.types.mjs +0 -6
  26. package/esm2022/lib/shared/utils/accessibility.utils.mjs +0 -223
  27. package/esm2022/lib/shared/utils/dom.utils.mjs +0 -240
  28. package/esm2022/lib/shared/utils/error.utils.mjs +0 -277
  29. package/esm2022/lib/shared/utils/string.utils.mjs +0 -204
  30. package/esm2022/pecb-ui-components.mjs +0 -5
  31. package/esm2022/public-api.mjs +0 -53
  32. package/lib/components/button/button.component.d.ts +0 -130
  33. package/lib/components/card/card.component.d.ts +0 -140
  34. package/lib/components/checkbox/checkbox.component.d.ts +0 -74
  35. package/lib/components/datepicker/datepicker.component.d.ts +0 -155
  36. package/lib/components/dropdown/dropdown.component.d.ts +0 -144
  37. package/lib/components/input/input.component.d.ts +0 -215
  38. package/lib/components/pagination/pagination.component.d.ts +0 -53
  39. package/lib/components/radio/radio.component.d.ts +0 -93
  40. package/lib/components/right-modal/right-modal.component.d.ts +0 -137
  41. package/lib/components/sidebar/sidebar.component.d.ts +0 -97
  42. package/lib/components/status/status.component.d.ts +0 -19
  43. package/lib/components/tab/tab.component.d.ts +0 -102
  44. package/lib/components/table/table.component.d.ts +0 -403
  45. package/lib/components/toggle/toggle.component.d.ts +0 -74
  46. package/lib/pecb-components.module.d.ts +0 -37
  47. package/lib/services/loading.service.d.ts +0 -129
  48. package/lib/services/notification.service.d.ts +0 -136
  49. package/lib/services/theme.service.d.ts +0 -142
  50. package/lib/shared/interfaces/component.interfaces.d.ts +0 -283
  51. package/lib/shared/types/common.types.d.ts +0 -86
  52. package/lib/shared/utils/accessibility.utils.d.ts +0 -167
  53. package/lib/shared/utils/dom.utils.d.ts +0 -108
  54. package/lib/shared/utils/error.utils.d.ts +0 -191
  55. package/lib/shared/utils/string.utils.d.ts +0 -144
  56. package/public-api.d.ts +0 -24
@@ -1,136 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import * as i0 from "@angular/core";
3
- /**
4
- * Notification types supported by the service
5
- */
6
- export type NotificationType = 'success' | 'error' | 'warning' | 'info';
7
- /**
8
- * Notification position on screen
9
- */
10
- export type NotificationPosition = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
11
- /**
12
- * Notification configuration options
13
- */
14
- export interface NotificationConfig {
15
- /** Notification message */
16
- message: string;
17
- /** Notification title (optional) */
18
- title?: string;
19
- /** Type of notification */
20
- type: NotificationType;
21
- /** Duration in milliseconds (0 for persistent) */
22
- duration?: number;
23
- /** Whether the notification can be dismissed */
24
- dismissible?: boolean;
25
- /** Position on screen */
26
- position?: NotificationPosition;
27
- /** Custom CSS class */
28
- customClass?: string;
29
- /** Unique identifier */
30
- id?: string;
31
- }
32
- /**
33
- * Notification object with all properties
34
- */
35
- export interface Notification extends Required<Omit<NotificationConfig, 'title' | 'customClass'>> {
36
- title?: string;
37
- customClass?: string;
38
- timestamp: Date;
39
- }
40
- /**
41
- * A stateless, injectable notification service for displaying toast notifications.
42
- *
43
- * This service provides a reactive way to manage notifications across the application.
44
- * It uses RxJS Subjects to emit notification events that can be consumed by notification
45
- * display components.
46
- *
47
- * @example
48
- * ```typescript
49
- * import { NotificationService } from '@pecb-ui/components';
50
- *
51
- * @Component({...})
52
- * export class MyComponent {
53
- * constructor(private notificationService: NotificationService) {}
54
- *
55
- * showSuccess(): void {
56
- * this.notificationService.success('Operation completed successfully!');
57
- * }
58
- *
59
- * showError(): void {
60
- * this.notificationService.error('An error occurred', 'Error Title');
61
- * }
62
- * }
63
- * ```
64
- *
65
- * @publicApi
66
- */
67
- export declare class NotificationService {
68
- private readonly notificationSubject;
69
- private readonly dismissSubject;
70
- private readonly clearSubject;
71
- /** Default duration for notifications in milliseconds */
72
- private readonly defaultDuration;
73
- /** Default position for notifications */
74
- private readonly defaultPosition;
75
- /**
76
- * Observable stream of notifications
77
- */
78
- get notifications$(): Observable<Notification>;
79
- /**
80
- * Observable stream of dismissed notification IDs
81
- */
82
- get dismiss$(): Observable<string>;
83
- /**
84
- * Observable stream for clear all events
85
- */
86
- get clear$(): Observable<void>;
87
- /**
88
- * Show a success notification
89
- * @param message - The notification message
90
- * @param title - Optional title
91
- * @param config - Optional additional configuration
92
- */
93
- success(message: string, title?: string, config?: Partial<NotificationConfig>): string;
94
- /**
95
- * Show an error notification
96
- * @param message - The notification message
97
- * @param title - Optional title
98
- * @param config - Optional additional configuration
99
- */
100
- error(message: string, title?: string, config?: Partial<NotificationConfig>): string;
101
- /**
102
- * Show a warning notification
103
- * @param message - The notification message
104
- * @param title - Optional title
105
- * @param config - Optional additional configuration
106
- */
107
- warning(message: string, title?: string, config?: Partial<NotificationConfig>): string;
108
- /**
109
- * Show an info notification
110
- * @param message - The notification message
111
- * @param title - Optional title
112
- * @param config - Optional additional configuration
113
- */
114
- info(message: string, title?: string, config?: Partial<NotificationConfig>): string;
115
- /**
116
- * Show a notification with custom configuration
117
- * @param config - Full notification configuration
118
- * @returns The notification ID
119
- */
120
- show(config: NotificationConfig): string;
121
- /**
122
- * Dismiss a specific notification by ID
123
- * @param id - The notification ID to dismiss
124
- */
125
- dismiss(id: string): void;
126
- /**
127
- * Clear all notifications
128
- */
129
- clearAll(): void;
130
- /**
131
- * Generate a unique notification ID
132
- */
133
- private generateId;
134
- static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>;
135
- static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>;
136
- }
@@ -1,142 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import * as i0 from "@angular/core";
3
- /**
4
- * Available theme modes
5
- */
6
- export type ThemeMode = 'light' | 'dark' | 'system';
7
- /**
8
- * Theme configuration interface
9
- */
10
- export interface ThemeConfig {
11
- /** Current theme mode */
12
- mode: ThemeMode;
13
- /** Resolved theme (light or dark, never system) */
14
- resolvedTheme: 'light' | 'dark';
15
- /** CSS class to apply to the document */
16
- cssClass: string;
17
- }
18
- /**
19
- * Custom theme variables that can be overridden
20
- */
21
- export interface ThemeVariables {
22
- /** Primary color */
23
- primaryColor?: string;
24
- /** Secondary color */
25
- secondaryColor?: string;
26
- /** Background color */
27
- backgroundColor?: string;
28
- /** Text color */
29
- textColor?: string;
30
- /** Border radius */
31
- borderRadius?: string;
32
- /** Font family */
33
- fontFamily?: string;
34
- /** Custom CSS variables */
35
- [key: string]: string | undefined;
36
- }
37
- /**
38
- * A stateless, injectable theme service for managing application themes.
39
- *
40
- * This service provides reactive theme management with support for light/dark modes,
41
- * system preference detection, and custom CSS variable overrides.
42
- *
43
- * @example
44
- * ```typescript
45
- * import { ThemeService } from '@pecb-ui/components';
46
- *
47
- * @Component({...})
48
- * export class MyComponent {
49
- * constructor(private themeService: ThemeService) {}
50
- *
51
- * toggleTheme(): void {
52
- * this.themeService.toggleTheme();
53
- * }
54
- *
55
- * setDarkMode(): void {
56
- * this.themeService.setTheme('dark');
57
- * }
58
- * }
59
- * ```
60
- *
61
- * @publicApi
62
- */
63
- export declare class ThemeService {
64
- private readonly themeSubject;
65
- private readonly isBrowser;
66
- private mediaQuery;
67
- constructor(platformId: object);
68
- /**
69
- * Observable stream of theme configuration changes
70
- */
71
- get theme$(): Observable<ThemeConfig>;
72
- /**
73
- * Get the current theme configuration
74
- */
75
- get currentTheme(): ThemeConfig;
76
- /**
77
- * Get the current theme mode
78
- */
79
- get currentMode(): ThemeMode;
80
- /**
81
- * Check if the current resolved theme is dark
82
- */
83
- get isDarkMode(): boolean;
84
- /**
85
- * Set the theme mode
86
- * @param mode - The theme mode to set (light, dark, or system)
87
- */
88
- setTheme(mode: ThemeMode): void;
89
- /**
90
- * Toggle between light and dark themes
91
- * If currently using system preference, switches to the opposite of the resolved theme
92
- */
93
- toggleTheme(): void;
94
- /**
95
- * Reset to system preference
96
- */
97
- useSystemTheme(): void;
98
- /**
99
- * Apply custom CSS variables to the document
100
- * @param variables - Object containing CSS variable overrides
101
- */
102
- setCustomVariables(variables: ThemeVariables): void;
103
- /**
104
- * Remove custom CSS variables from the document
105
- * @param variableNames - Array of variable names to remove
106
- */
107
- removeCustomVariables(variableNames: string[]): void;
108
- /**
109
- * Get the initial theme from storage or system preference
110
- */
111
- private getInitialTheme;
112
- /**
113
- * Create a theme configuration object
114
- */
115
- private createThemeConfig;
116
- /**
117
- * Resolve the actual theme from mode (handles 'system' mode)
118
- */
119
- private resolveTheme;
120
- /**
121
- * Get the system color scheme preference
122
- */
123
- private getSystemPreference;
124
- /**
125
- * Setup listener for system theme changes
126
- */
127
- private setupSystemThemeListener;
128
- /**
129
- * Apply the theme to the document
130
- */
131
- private applyTheme;
132
- /**
133
- * Persist theme preference to storage
134
- */
135
- private persistTheme;
136
- /**
137
- * Convert camelCase property name to CSS variable name
138
- */
139
- private toCssVariableName;
140
- static ɵfac: i0.ɵɵFactoryDeclaration<ThemeService, never>;
141
- static ɵprov: i0.ɵɵInjectableDeclaration<ThemeService>;
142
- }
@@ -1,283 +0,0 @@
1
- import { TemplateRef } from '@angular/core';
2
- import { ColorVariant, ComponentSize, ValidationState } from '../types/common.types';
3
- /**
4
- * Common interface for components that can be disabled
5
- */
6
- export interface Disableable {
7
- /** Whether the component is disabled */
8
- disabled: boolean;
9
- }
10
- /**
11
- * Common interface for components with loading state
12
- */
13
- export interface Loadable {
14
- /** Whether the component is in a loading state */
15
- loading: boolean;
16
- }
17
- /**
18
- * Common interface for components with size variants
19
- */
20
- export interface Sizeable {
21
- /** The size of the component */
22
- size: ComponentSize;
23
- }
24
- /**
25
- * Common interface for components with color variants
26
- */
27
- export interface Colorable {
28
- /** The color variant of the component */
29
- variant: ColorVariant;
30
- }
31
- /**
32
- * Common interface for focusable components
33
- */
34
- export interface Focusable {
35
- /** Focus the component programmatically */
36
- focus(): void;
37
- /** Blur the component programmatically */
38
- blur(): void;
39
- }
40
- /**
41
- * Base interface for form control components
42
- */
43
- export interface FormControlBase extends Disableable {
44
- /** Unique identifier for the control */
45
- id: string;
46
- /** Name attribute for form submission */
47
- name: string;
48
- /** Whether the field is required */
49
- required: boolean;
50
- /** Whether the field is readonly */
51
- readonly: boolean;
52
- /** Placeholder text */
53
- placeholder?: string;
54
- /** Accessible label */
55
- ariaLabel?: string;
56
- /** ID of element that labels this control */
57
- ariaLabelledBy?: string;
58
- /** ID of element that describes this control */
59
- ariaDescribedBy?: string;
60
- }
61
- /**
62
- * Interface for components with validation
63
- */
64
- export interface Validatable {
65
- /** Current validation state */
66
- validationState: ValidationState;
67
- /** Error message to display */
68
- errorMessage?: string;
69
- /** Success message to display */
70
- successMessage?: string;
71
- /** Helper text to display */
72
- helperText?: string;
73
- }
74
- /**
75
- * Interface for selectable items (dropdown, list, etc.)
76
- */
77
- export interface SelectableItem<T = unknown> {
78
- /** Unique value for the item */
79
- value: T;
80
- /** Display label */
81
- label: string;
82
- /** Whether the item is disabled */
83
- disabled?: boolean;
84
- /** Optional icon name */
85
- icon?: string;
86
- /** Optional description */
87
- description?: string;
88
- /** Optional group name for categorization */
89
- group?: string;
90
- /** Additional metadata */
91
- metadata?: Record<string, unknown>;
92
- }
93
- /**
94
- * Interface for components that support custom templates
95
- */
96
- export interface Templatable {
97
- /** Custom template for rendering */
98
- template?: TemplateRef<unknown>;
99
- }
100
- /**
101
- * Interface for overlay components (modal, popover, tooltip)
102
- */
103
- export interface OverlayComponent {
104
- /** Whether the overlay is currently visible */
105
- isOpen: boolean;
106
- /** Open the overlay */
107
- open(): void;
108
- /** Close the overlay */
109
- close(): void;
110
- /** Toggle the overlay state */
111
- toggle(): void;
112
- }
113
- /**
114
- * Interface for components with before/after close hooks
115
- */
116
- export interface ClosableWithHooks {
117
- /** Called before the component closes. Return false to prevent closing */
118
- beforeClose?: () => boolean | Promise<boolean>;
119
- /** Called after the component closes */
120
- afterClose?: () => void;
121
- }
122
- /**
123
- * Interface for table column definition
124
- */
125
- export interface TableColumn<T = unknown> {
126
- /** Unique column key */
127
- key: string;
128
- /** Column header label */
129
- label: string;
130
- /** Property path to access data (supports dot notation) */
131
- field?: keyof T | string;
132
- /** Whether the column is sortable */
133
- sortable?: boolean;
134
- /** Whether the column is filterable */
135
- filterable?: boolean;
136
- /** Column width (CSS value) */
137
- width?: string;
138
- /** Minimum column width */
139
- minWidth?: string;
140
- /** Maximum column width */
141
- maxWidth?: string;
142
- /** Text alignment */
143
- align?: 'left' | 'center' | 'right';
144
- /** Whether the column is visible */
145
- visible?: boolean;
146
- /** Whether the column is sticky */
147
- sticky?: 'start' | 'end';
148
- /** Custom cell template */
149
- cellTemplate?: TemplateRef<unknown>;
150
- /** Custom header template */
151
- headerTemplate?: TemplateRef<unknown>;
152
- /** Value formatter function */
153
- formatter?: (value: unknown, row: T) => string;
154
- }
155
- /**
156
- * Interface for pagination state
157
- */
158
- export interface PaginationState {
159
- /** Current page (1-indexed) */
160
- currentPage: number;
161
- /** Number of items per page */
162
- pageSize: number;
163
- /** Total number of items */
164
- totalItems: number;
165
- /** Total number of pages (calculated) */
166
- totalPages: number;
167
- }
168
- /**
169
- * Interface for sort state
170
- */
171
- export interface SortState {
172
- /** Column key to sort by */
173
- column: string;
174
- /** Sort direction */
175
- direction: 'asc' | 'desc' | null;
176
- }
177
- /**
178
- * Interface for filter state
179
- */
180
- export interface FilterState {
181
- /** Column key to filter */
182
- column: string;
183
- /** Filter operator */
184
- operator: 'equals' | 'contains' | 'startsWith' | 'endsWith' | 'gt' | 'lt' | 'gte' | 'lte' | 'between' | 'in';
185
- /** Filter value(s) */
186
- value: unknown;
187
- }
188
- /**
189
- * Interface for tree node structure
190
- */
191
- export interface TreeNode<T = unknown> {
192
- /** Unique node identifier */
193
- id: string | number;
194
- /** Node data */
195
- data: T;
196
- /** Child nodes */
197
- children?: TreeNode<T>[];
198
- /** Whether the node is expanded */
199
- expanded?: boolean;
200
- /** Whether the node is selected */
201
- selected?: boolean;
202
- /** Whether the node is disabled */
203
- disabled?: boolean;
204
- /** Whether the node is a leaf (no children) */
205
- leaf?: boolean;
206
- /** Parent node ID */
207
- parentId?: string | number;
208
- /** Node level in the tree (0-indexed) */
209
- level?: number;
210
- }
211
- /**
212
- * Interface for breadcrumb item
213
- */
214
- export interface BreadcrumbItem {
215
- /** Display label */
216
- label: string;
217
- /** Navigation URL or route */
218
- url?: string;
219
- /** Route path array for routerLink */
220
- routerLink?: string | string[];
221
- /** Query parameters */
222
- queryParams?: Record<string, string>;
223
- /** Icon name */
224
- icon?: string;
225
- /** Whether this is the active/current item */
226
- active?: boolean;
227
- /** Whether the item is disabled */
228
- disabled?: boolean;
229
- }
230
- /**
231
- * Interface for tab item
232
- */
233
- export interface TabItem {
234
- /** Unique tab identifier */
235
- id: string;
236
- /** Tab label */
237
- label: string;
238
- /** Tab icon */
239
- icon?: string;
240
- /** Whether the tab is disabled */
241
- disabled?: boolean;
242
- /** Whether the tab is closable */
243
- closable?: boolean;
244
- /** Badge content */
245
- badge?: string | number;
246
- /** Content template */
247
- content?: TemplateRef<unknown>;
248
- }
249
- /**
250
- * Interface for menu item
251
- */
252
- export interface MenuItem {
253
- /** Unique item identifier */
254
- id?: string;
255
- /** Display label */
256
- label: string;
257
- /** Icon name */
258
- icon?: string;
259
- /** Command to execute on click */
260
- command?: () => void;
261
- /** URL for navigation */
262
- url?: string;
263
- /** Router link */
264
- routerLink?: string | string[];
265
- /** Query parameters */
266
- queryParams?: Record<string, string>;
267
- /** Whether the item is disabled */
268
- disabled?: boolean;
269
- /** Whether the item is visible */
270
- visible?: boolean;
271
- /** Child items for submenu */
272
- items?: MenuItem[];
273
- /** Whether this is a separator */
274
- separator?: boolean;
275
- /** Additional CSS class */
276
- styleClass?: string;
277
- /** Tooltip text */
278
- tooltip?: string;
279
- /** Badge content */
280
- badge?: string | number;
281
- /** Badge color variant */
282
- badgeVariant?: ColorVariant;
283
- }
@@ -1,86 +0,0 @@
1
- /**
2
- * Common type definitions for PECB UI Components
3
- * @module types
4
- */
5
- /**
6
- * Standard size variants used across components
7
- */
8
- export type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
9
- /**
10
- * Standard component size mapping
11
- */
12
- export type ComponentSize = 'small' | 'medium' | 'large';
13
- /**
14
- * Semantic color variants
15
- */
16
- export type ColorVariant = 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info';
17
- /**
18
- * Extended color variants including neutral options
19
- */
20
- export type ExtendedColorVariant = ColorVariant | 'neutral' | 'muted';
21
- /**
22
- * Component state variants
23
- */
24
- export type StateVariant = 'default' | 'hover' | 'active' | 'focus' | 'disabled';
25
- /**
26
- * Position options for overlays and popups
27
- */
28
- export type Position = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
29
- /**
30
- * Alignment options
31
- */
32
- export type Alignment = 'start' | 'center' | 'end' | 'stretch';
33
- /**
34
- * Direction options for layouts
35
- */
36
- export type Direction = 'horizontal' | 'vertical';
37
- /**
38
- * Orientation alias for direction
39
- */
40
- export type Orientation = 'horizontal' | 'vertical';
41
- /**
42
- * Spacing scale values
43
- */
44
- export type SpacingScale = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
45
- /**
46
- * Border radius scale values
47
- */
48
- export type RadiusScale = 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
49
- /**
50
- * Shadow elevation levels
51
- */
52
- export type ElevationLevel = 'none' | 'sm' | 'md' | 'lg' | 'xl';
53
- /**
54
- * Animation timing presets
55
- */
56
- export type AnimationTiming = 'instant' | 'fast' | 'normal' | 'slow';
57
- /**
58
- * Breakpoint names
59
- */
60
- export type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
61
- /**
62
- * Form validation state
63
- */
64
- export type ValidationState = 'valid' | 'invalid' | 'pending' | 'pristine';
65
- /**
66
- * Generic callback function type
67
- */
68
- export type Callback<T = void> = () => T;
69
- /**
70
- * Generic event handler type
71
- */
72
- export type EventHandler<T = Event> = (event: T) => void;
73
- /**
74
- * Make specific properties required
75
- */
76
- export type RequireProps<T, K extends keyof T> = T & Required<Pick<T, K>>;
77
- /**
78
- * Make specific properties optional
79
- */
80
- export type OptionalProps<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
81
- /**
82
- * Extract non-nullable type
83
- */
84
- export type NonNullableProps<T> = {
85
- [K in keyof T]: NonNullable<T[K]>;
86
- };