@pecb-ui/components 1.1.2
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 +556 -0
- package/esm2022/lib/components/button/button.component.mjs +171 -0
- package/esm2022/lib/components/card/card.component.mjs +182 -0
- package/esm2022/lib/components/checkbox/checkbox.component.mjs +126 -0
- package/esm2022/lib/components/datepicker/datepicker.component.mjs +349 -0
- package/esm2022/lib/components/dropdown/dropdown.component.mjs +329 -0
- package/esm2022/lib/components/input/input.component.mjs +321 -0
- package/esm2022/lib/components/pagination/pagination.component.mjs +197 -0
- package/esm2022/lib/components/radio/radio.component.mjs +147 -0
- package/esm2022/lib/components/right-modal/right-modal.component.mjs +234 -0
- package/esm2022/lib/components/sidebar/sidebar.component.mjs +155 -0
- package/esm2022/lib/components/status/status.component.mjs +50 -0
- package/esm2022/lib/components/tab/tab.component.mjs +151 -0
- package/esm2022/lib/components/table/table.component.mjs +503 -0
- package/esm2022/lib/components/toggle/toggle.component.mjs +126 -0
- package/esm2022/lib/pecb-components.module.mjs +118 -0
- package/esm2022/lib/services/loading.service.mjs +182 -0
- package/esm2022/lib/services/notification.service.mjs +144 -0
- package/esm2022/lib/services/theme.service.mjs +232 -0
- package/esm2022/lib/shared/interfaces/component.interfaces.mjs +2 -0
- package/esm2022/lib/shared/types/common.types.mjs +6 -0
- package/esm2022/lib/shared/utils/accessibility.utils.mjs +223 -0
- package/esm2022/lib/shared/utils/dom.utils.mjs +240 -0
- package/esm2022/lib/shared/utils/error.utils.mjs +277 -0
- package/esm2022/lib/shared/utils/string.utils.mjs +204 -0
- package/esm2022/pecb-ui-components.mjs +5 -0
- package/esm2022/public-api.mjs +53 -0
- package/fesm2022/pecb-ui-components.mjs +4587 -0
- package/fesm2022/pecb-ui-components.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/button/button.component.d.ts +130 -0
- package/lib/components/card/card.component.d.ts +140 -0
- package/lib/components/checkbox/checkbox.component.d.ts +74 -0
- package/lib/components/datepicker/datepicker.component.d.ts +155 -0
- package/lib/components/dropdown/dropdown.component.d.ts +144 -0
- package/lib/components/input/input.component.d.ts +215 -0
- package/lib/components/pagination/pagination.component.d.ts +53 -0
- package/lib/components/radio/radio.component.d.ts +93 -0
- package/lib/components/right-modal/right-modal.component.d.ts +137 -0
- package/lib/components/sidebar/sidebar.component.d.ts +97 -0
- package/lib/components/status/status.component.d.ts +19 -0
- package/lib/components/tab/tab.component.d.ts +102 -0
- package/lib/components/table/table.component.d.ts +403 -0
- package/lib/components/toggle/toggle.component.d.ts +74 -0
- package/lib/pecb-components.module.d.ts +37 -0
- package/lib/services/loading.service.d.ts +129 -0
- package/lib/services/notification.service.d.ts +136 -0
- package/lib/services/theme.service.d.ts +142 -0
- package/lib/shared/interfaces/component.interfaces.d.ts +283 -0
- package/lib/shared/types/common.types.d.ts +86 -0
- package/lib/shared/utils/accessibility.utils.d.ts +167 -0
- package/lib/shared/utils/dom.utils.d.ts +108 -0
- package/lib/shared/utils/error.utils.d.ts +191 -0
- package/lib/shared/utils/string.utils.d.ts +144 -0
- package/package.json +61 -0
- package/public-api.d.ts +24 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export type ButtonVariant = 'primary' | 'primary-outline' | 'primary-2' | 'primary-2-outline' | 'neutral' | 'neutral-outline' | 'secondary' | 'text' | 'destructive' | 'destructive-outline';
|
|
4
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
export type ButtonIconStyle = 'none' | 'leading' | 'trailing' | 'icon-only';
|
|
6
|
+
/**
|
|
7
|
+
* A professional button component with multiple variants and sizes.
|
|
8
|
+
* Fully accessible with WCAG 2.1 AA compliance.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```html
|
|
12
|
+
* <pecb-button variant="primary" size="md" (clicked)="handleClick()">
|
|
13
|
+
* Click me
|
|
14
|
+
* </pecb-button>
|
|
15
|
+
*
|
|
16
|
+
* <!-- With leading icon -->
|
|
17
|
+
* <pecb-button variant="primary" iconStyle="leading" icon="+">
|
|
18
|
+
* Add Item
|
|
19
|
+
* </pecb-button>
|
|
20
|
+
*
|
|
21
|
+
* <!-- Icon only button -->
|
|
22
|
+
* <pecb-button variant="secondary" iconStyle="icon-only" icon="+" ariaLabel="Add item"></pecb-button>
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @publicApi
|
|
26
|
+
*/
|
|
27
|
+
export declare class ButtonComponent {
|
|
28
|
+
/**
|
|
29
|
+
* Unique ID for the button element
|
|
30
|
+
*/
|
|
31
|
+
id: string;
|
|
32
|
+
/**
|
|
33
|
+
* The visual style variant of the button
|
|
34
|
+
*/
|
|
35
|
+
variant: ButtonVariant;
|
|
36
|
+
/**
|
|
37
|
+
* The size of the button
|
|
38
|
+
*/
|
|
39
|
+
size: ButtonSize;
|
|
40
|
+
/**
|
|
41
|
+
* Icon placement style
|
|
42
|
+
*/
|
|
43
|
+
iconStyle: ButtonIconStyle;
|
|
44
|
+
/**
|
|
45
|
+
* Icon to display (used with iconStyle)
|
|
46
|
+
*/
|
|
47
|
+
icon?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the button is disabled
|
|
50
|
+
*/
|
|
51
|
+
disabled: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the button should take full width
|
|
54
|
+
*/
|
|
55
|
+
fullWidth: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the button is in loading state
|
|
58
|
+
*/
|
|
59
|
+
loading: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Button type attribute
|
|
62
|
+
*/
|
|
63
|
+
type: 'button' | 'submit' | 'reset';
|
|
64
|
+
/**
|
|
65
|
+
* Accessible label for the button (required for icon-only buttons)
|
|
66
|
+
*/
|
|
67
|
+
ariaLabel?: string;
|
|
68
|
+
/**
|
|
69
|
+
* ID of element that labels this button
|
|
70
|
+
*/
|
|
71
|
+
ariaLabelledBy?: string;
|
|
72
|
+
/**
|
|
73
|
+
* ID of element that describes this button
|
|
74
|
+
*/
|
|
75
|
+
ariaDescribedBy?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Indicates the button controls an expandable element
|
|
78
|
+
*/
|
|
79
|
+
ariaExpanded?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Indicates the pressed state for toggle buttons
|
|
82
|
+
*/
|
|
83
|
+
ariaPressed?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Indicates the button opens a popup (menu, listbox, dialog, etc.)
|
|
86
|
+
*/
|
|
87
|
+
ariaHasPopup?: boolean | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
|
|
88
|
+
/**
|
|
89
|
+
* ID of the element controlled by this button
|
|
90
|
+
*/
|
|
91
|
+
ariaControls?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Event emitted when the button is clicked
|
|
94
|
+
*/
|
|
95
|
+
clicked: EventEmitter<MouseEvent>;
|
|
96
|
+
/**
|
|
97
|
+
* Host binding for the component's ID
|
|
98
|
+
*/
|
|
99
|
+
get hostId(): null;
|
|
100
|
+
/**
|
|
101
|
+
* Get CSS classes for the button
|
|
102
|
+
*/
|
|
103
|
+
get buttonClasses(): string[];
|
|
104
|
+
/**
|
|
105
|
+
* Check if we should show leading icon
|
|
106
|
+
*/
|
|
107
|
+
get showLeadingIcon(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Check if we should show trailing icon
|
|
110
|
+
*/
|
|
111
|
+
get showTrailingIcon(): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Check if this is icon-only button
|
|
114
|
+
*/
|
|
115
|
+
get isIconOnly(): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Get the loading announcement text for screen readers
|
|
118
|
+
*/
|
|
119
|
+
get loadingText(): string;
|
|
120
|
+
/**
|
|
121
|
+
* Handle button click
|
|
122
|
+
*/
|
|
123
|
+
onClick(event: MouseEvent): void;
|
|
124
|
+
/**
|
|
125
|
+
* Handle keyboard events for accessibility
|
|
126
|
+
*/
|
|
127
|
+
onKeyDown(event: KeyboardEvent): void;
|
|
128
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ButtonComponent, never>;
|
|
129
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ButtonComponent, "pecb-button", never, { "id": { "alias": "id"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; "size": { "alias": "size"; "required": false; }; "iconStyle": { "alias": "iconStyle"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "type": { "alias": "type"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; }; "ariaDescribedBy": { "alias": "ariaDescribedBy"; "required": false; }; "ariaExpanded": { "alias": "ariaExpanded"; "required": false; }; "ariaPressed": { "alias": "ariaPressed"; "required": false; }; "ariaHasPopup": { "alias": "ariaHasPopup"; "required": false; }; "ariaControls": { "alias": "ariaControls"; "required": false; }; }, { "clicked": "clicked"; }, never, ["*"], true, never>;
|
|
130
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export type CardElevation = 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
/**
|
|
4
|
+
* Semantic role for the card component
|
|
5
|
+
*/
|
|
6
|
+
export type CardRole = 'article' | 'region' | 'group' | 'listitem' | 'none';
|
|
7
|
+
/**
|
|
8
|
+
* A professional card component for displaying content in a contained format.
|
|
9
|
+
* Fully accessible with WCAG 2.1 AA compliance.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```html
|
|
13
|
+
* <!-- Basic card -->
|
|
14
|
+
* <pecb-card elevation="md">
|
|
15
|
+
* <pecb-card-header>
|
|
16
|
+
* <h3>Card Title</h3>
|
|
17
|
+
* </pecb-card-header>
|
|
18
|
+
* <pecb-card-body>
|
|
19
|
+
* <p>Card content goes here</p>
|
|
20
|
+
* </pecb-card-body>
|
|
21
|
+
* </pecb-card>
|
|
22
|
+
*
|
|
23
|
+
* <!-- Accessible card with region role -->
|
|
24
|
+
* <pecb-card role="region" ariaLabel="Product Information">
|
|
25
|
+
* <pecb-card-body>
|
|
26
|
+
* <p>Product details...</p>
|
|
27
|
+
* </pecb-card-body>
|
|
28
|
+
* </pecb-card>
|
|
29
|
+
*
|
|
30
|
+
* <!-- Card as article -->
|
|
31
|
+
* <pecb-card role="article" ariaLabelledBy="article-title">
|
|
32
|
+
* <pecb-card-header>
|
|
33
|
+
* <h2 id="article-title">Article Headline</h2>
|
|
34
|
+
* </pecb-card-header>
|
|
35
|
+
* <pecb-card-body>
|
|
36
|
+
* <p>Article content...</p>
|
|
37
|
+
* </pecb-card-body>
|
|
38
|
+
* </pecb-card>
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @publicApi
|
|
42
|
+
*/
|
|
43
|
+
export declare class CardComponent {
|
|
44
|
+
/**
|
|
45
|
+
* Unique ID for the card element
|
|
46
|
+
*/
|
|
47
|
+
id: string;
|
|
48
|
+
/**
|
|
49
|
+
* The elevation level (shadow depth) of the card
|
|
50
|
+
*/
|
|
51
|
+
elevation: CardElevation;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the card should be hoverable with elevation change
|
|
54
|
+
*/
|
|
55
|
+
hoverable: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether to add padding to the card
|
|
58
|
+
*/
|
|
59
|
+
noPadding: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Semantic role for the card (article, region, group, listitem, or none)
|
|
62
|
+
* Use 'article' for self-contained content, 'region' for significant sections
|
|
63
|
+
*/
|
|
64
|
+
role: CardRole;
|
|
65
|
+
/**
|
|
66
|
+
* Accessible label for the card
|
|
67
|
+
*/
|
|
68
|
+
ariaLabel?: string;
|
|
69
|
+
/**
|
|
70
|
+
* ID of element that labels this card
|
|
71
|
+
*/
|
|
72
|
+
ariaLabelledBy?: string;
|
|
73
|
+
/**
|
|
74
|
+
* ID of element that describes this card
|
|
75
|
+
*/
|
|
76
|
+
ariaDescribedBy?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Get CSS classes for the card
|
|
79
|
+
*/
|
|
80
|
+
get cardClasses(): string[];
|
|
81
|
+
/**
|
|
82
|
+
* Get the role attribute value
|
|
83
|
+
*/
|
|
84
|
+
get roleAttribute(): string | null;
|
|
85
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CardComponent, never>;
|
|
86
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CardComponent, "pecb-card", never, { "id": { "alias": "id"; "required": false; }; "elevation": { "alias": "elevation"; "required": false; }; "hoverable": { "alias": "hoverable"; "required": false; }; "noPadding": { "alias": "noPadding"; "required": false; }; "role": { "alias": "role"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "ariaLabelledBy": { "alias": "ariaLabelledBy"; "required": false; }; "ariaDescribedBy": { "alias": "ariaDescribedBy"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Card header component for displaying title and actions.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```html
|
|
93
|
+
* <pecb-card-header>
|
|
94
|
+
* <h3>Card Title</h3>
|
|
95
|
+
* </pecb-card-header>
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @publicApi
|
|
99
|
+
*/
|
|
100
|
+
export declare class CardHeaderComponent {
|
|
101
|
+
/**
|
|
102
|
+
* Heading level for accessibility (1-6)
|
|
103
|
+
* Only used if the header content doesn't contain a heading element
|
|
104
|
+
*/
|
|
105
|
+
headingLevel: number | null;
|
|
106
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CardHeaderComponent, never>;
|
|
107
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CardHeaderComponent, "pecb-card-header", never, { "headingLevel": { "alias": "headingLevel"; "required": false; }; }, {}, never, ["*"], true, never>;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Card body component for main content.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```html
|
|
114
|
+
* <pecb-card-body>
|
|
115
|
+
* <p>Card content goes here</p>
|
|
116
|
+
* </pecb-card-body>
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* @publicApi
|
|
120
|
+
*/
|
|
121
|
+
export declare class CardBodyComponent {
|
|
122
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CardBodyComponent, never>;
|
|
123
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CardBodyComponent, "pecb-card-body", never, {}, {}, never, ["*"], true, never>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Card footer component for actions and additional information.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```html
|
|
130
|
+
* <pecb-card-footer>
|
|
131
|
+
* <button>Action</button>
|
|
132
|
+
* </pecb-card-footer>
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @publicApi
|
|
136
|
+
*/
|
|
137
|
+
export declare class CardFooterComponent {
|
|
138
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CardFooterComponent, never>;
|
|
139
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CardFooterComponent, "pecb-card-footer", never, {}, {}, never, ["*"], true, never>;
|
|
140
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { EventEmitter, ChangeDetectorRef } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export type CheckboxLabelPosition = 'right' | 'left';
|
|
5
|
+
/**
|
|
6
|
+
* A professional checkbox component with label and description support.
|
|
7
|
+
* Fully accessible with WCAG 2.1 AA compliance and reactive forms support.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```html
|
|
11
|
+
* <pecb-checkbox
|
|
12
|
+
* label="Accept terms"
|
|
13
|
+
* description="I agree to the terms and conditions"
|
|
14
|
+
* [(ngModel)]="accepted"
|
|
15
|
+
* ></pecb-checkbox>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @publicApi
|
|
19
|
+
*/
|
|
20
|
+
export declare class CheckboxComponent implements ControlValueAccessor {
|
|
21
|
+
private cdr;
|
|
22
|
+
/**
|
|
23
|
+
* Unique ID for the checkbox element
|
|
24
|
+
*/
|
|
25
|
+
id: string;
|
|
26
|
+
/**
|
|
27
|
+
* Name attribute for the checkbox
|
|
28
|
+
*/
|
|
29
|
+
name?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Label text to display
|
|
32
|
+
*/
|
|
33
|
+
label?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Description text to display below label
|
|
36
|
+
*/
|
|
37
|
+
description?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Position of the label relative to the checkbox control.
|
|
40
|
+
* 'right' (default): [checkbox] Title Description
|
|
41
|
+
* 'left': Title Description [checkbox]
|
|
42
|
+
*/
|
|
43
|
+
labelPosition: CheckboxLabelPosition;
|
|
44
|
+
/**
|
|
45
|
+
* Whether the checkbox is disabled
|
|
46
|
+
*/
|
|
47
|
+
disabled: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Event emitted when checked state changes
|
|
50
|
+
*/
|
|
51
|
+
checkedChange: EventEmitter<boolean>;
|
|
52
|
+
checked: boolean;
|
|
53
|
+
private onChange;
|
|
54
|
+
private onTouched;
|
|
55
|
+
constructor(cdr: ChangeDetectorRef);
|
|
56
|
+
/**
|
|
57
|
+
* Get CSS classes for the checkbox wrapper
|
|
58
|
+
*/
|
|
59
|
+
get wrapperClasses(): string[];
|
|
60
|
+
/**
|
|
61
|
+
* Handle checkbox change
|
|
62
|
+
*/
|
|
63
|
+
onCheckboxChange(event: Event): void;
|
|
64
|
+
/**
|
|
65
|
+
* Handle blur event
|
|
66
|
+
*/
|
|
67
|
+
onBlur(): void;
|
|
68
|
+
writeValue(value: boolean): void;
|
|
69
|
+
registerOnChange(fn: (value: boolean) => void): void;
|
|
70
|
+
registerOnTouched(fn: () => void): void;
|
|
71
|
+
setDisabledState(isDisabled: boolean): void;
|
|
72
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CheckboxComponent, never>;
|
|
73
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CheckboxComponent, "pecb-checkbox", never, { "id": { "alias": "id"; "required": false; }; "name": { "alias": "name"; "required": false; }; "label": { "alias": "label"; "required": false; }; "description": { "alias": "description"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "checkedChange": "checkedChange"; }, never, never, true, never>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { EventEmitter, ElementRef, ChangeDetectorRef } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export type DatepickerSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
interface CalendarDay {
|
|
6
|
+
date: Date;
|
|
7
|
+
day: number;
|
|
8
|
+
isCurrentMonth: boolean;
|
|
9
|
+
isSelected: boolean;
|
|
10
|
+
isToday: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A professional datepicker component with calendar dropdown.
|
|
14
|
+
* Fully accessible with WCAG 2.1 AA compliance and reactive forms support.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```html
|
|
18
|
+
* <pecb-datepicker
|
|
19
|
+
* label="Date"
|
|
20
|
+
* placeholder="Choose Date"
|
|
21
|
+
* [(ngModel)]="selectedDate"
|
|
22
|
+
* ></pecb-datepicker>
|
|
23
|
+
*
|
|
24
|
+
* <!-- With custom configuration -->
|
|
25
|
+
* <pecb-datepicker
|
|
26
|
+
* label="Birth Date"
|
|
27
|
+
* [required]="true"
|
|
28
|
+
* size="lg"
|
|
29
|
+
* (dateChange)="handleDateChange($event)"
|
|
30
|
+
* ></pecb-datepicker>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @publicApi
|
|
34
|
+
*/
|
|
35
|
+
export declare class DatepickerComponent implements ControlValueAccessor {
|
|
36
|
+
private elementRef;
|
|
37
|
+
private cdr;
|
|
38
|
+
inputElement?: ElementRef<HTMLInputElement>;
|
|
39
|
+
/**
|
|
40
|
+
* Unique ID for the datepicker element
|
|
41
|
+
*/
|
|
42
|
+
id: string;
|
|
43
|
+
/**
|
|
44
|
+
* Label text to display above the input
|
|
45
|
+
*/
|
|
46
|
+
label?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Placeholder text for the input
|
|
49
|
+
*/
|
|
50
|
+
placeholder: string;
|
|
51
|
+
/**
|
|
52
|
+
* The size of the datepicker
|
|
53
|
+
*/
|
|
54
|
+
size: DatepickerSize;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the field is required
|
|
57
|
+
*/
|
|
58
|
+
required: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Whether the datepicker is disabled
|
|
61
|
+
*/
|
|
62
|
+
disabled: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Date format for display (default: MM/DD/YYYY)
|
|
65
|
+
*/
|
|
66
|
+
dateFormat: string;
|
|
67
|
+
/**
|
|
68
|
+
* Minimum selectable date
|
|
69
|
+
*/
|
|
70
|
+
minDate?: Date;
|
|
71
|
+
/**
|
|
72
|
+
* Maximum selectable date
|
|
73
|
+
*/
|
|
74
|
+
maxDate?: Date;
|
|
75
|
+
/**
|
|
76
|
+
* Event emitted when date is selected
|
|
77
|
+
*/
|
|
78
|
+
dateChange: EventEmitter<Date | null>;
|
|
79
|
+
/**
|
|
80
|
+
* Event emitted when calendar is opened
|
|
81
|
+
*/
|
|
82
|
+
opened: EventEmitter<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Event emitted when calendar is closed
|
|
85
|
+
*/
|
|
86
|
+
closed: EventEmitter<void>;
|
|
87
|
+
selectedDate: Date | null;
|
|
88
|
+
isCalendarOpen: boolean;
|
|
89
|
+
currentMonth: Date;
|
|
90
|
+
calendarDays: CalendarDay[];
|
|
91
|
+
weekDays: string[];
|
|
92
|
+
monthNames: string[];
|
|
93
|
+
private onChange;
|
|
94
|
+
private onTouched;
|
|
95
|
+
constructor(elementRef: ElementRef, cdr: ChangeDetectorRef);
|
|
96
|
+
/**
|
|
97
|
+
* Get CSS classes for the datepicker wrapper
|
|
98
|
+
*/
|
|
99
|
+
get wrapperClasses(): string[];
|
|
100
|
+
/**
|
|
101
|
+
* Get formatted display value
|
|
102
|
+
*/
|
|
103
|
+
get displayValue(): string;
|
|
104
|
+
/**
|
|
105
|
+
* Get current month and year display
|
|
106
|
+
*/
|
|
107
|
+
get monthYearDisplay(): string;
|
|
108
|
+
/**
|
|
109
|
+
* Toggle calendar dropdown
|
|
110
|
+
*/
|
|
111
|
+
toggleCalendar(): void;
|
|
112
|
+
/**
|
|
113
|
+
* Close calendar
|
|
114
|
+
*/
|
|
115
|
+
closeCalendar(): void;
|
|
116
|
+
/**
|
|
117
|
+
* Navigate to previous month
|
|
118
|
+
*/
|
|
119
|
+
previousMonth(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Navigate to next month
|
|
122
|
+
*/
|
|
123
|
+
nextMonth(): void;
|
|
124
|
+
/**
|
|
125
|
+
* Select a date
|
|
126
|
+
*/
|
|
127
|
+
selectDate(day: CalendarDay): void;
|
|
128
|
+
/**
|
|
129
|
+
* Generate calendar days
|
|
130
|
+
*/
|
|
131
|
+
private generateCalendar;
|
|
132
|
+
/**
|
|
133
|
+
* Format date for display
|
|
134
|
+
*/
|
|
135
|
+
private formatDate;
|
|
136
|
+
/**
|
|
137
|
+
* Listen for clicks outside to close calendar
|
|
138
|
+
*/
|
|
139
|
+
onDocumentClick(event: MouseEvent): void;
|
|
140
|
+
/**
|
|
141
|
+
* Handle keyboard navigation
|
|
142
|
+
*/
|
|
143
|
+
onKeyDown(event: KeyboardEvent): void;
|
|
144
|
+
/**
|
|
145
|
+
* Clear selected date
|
|
146
|
+
*/
|
|
147
|
+
clearDate(event: MouseEvent): void;
|
|
148
|
+
writeValue(value: Date | null): void;
|
|
149
|
+
registerOnChange(fn: (value: Date | null) => void): void;
|
|
150
|
+
registerOnTouched(fn: () => void): void;
|
|
151
|
+
setDisabledState(isDisabled: boolean): void;
|
|
152
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DatepickerComponent, never>;
|
|
153
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DatepickerComponent, "pecb-datepicker", never, { "id": { "alias": "id"; "required": false; }; "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "size": { "alias": "size"; "required": false; }; "required": { "alias": "required"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "dateFormat": { "alias": "dateFormat"; "required": false; }; "minDate": { "alias": "minDate"; "required": false; }; "maxDate": { "alias": "maxDate"; "required": false; }; }, { "dateChange": "dateChange"; "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
|
|
154
|
+
}
|
|
155
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { EventEmitter, ChangeDetectorRef, ElementRef } from '@angular/core';
|
|
2
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export interface DropdownOption {
|
|
5
|
+
label: string;
|
|
6
|
+
value: unknown;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type DropdownSize = 'sm' | 'md' | 'lg';
|
|
10
|
+
/**
|
|
11
|
+
* A professional dropdown/select component with multi-select and search support.
|
|
12
|
+
* Fully accessible with WCAG 2.1 AA compliance and reactive forms support.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```html
|
|
16
|
+
* <!-- Single select -->
|
|
17
|
+
* <pecb-dropdown
|
|
18
|
+
* label="Select option"
|
|
19
|
+
* [options]="options"
|
|
20
|
+
* [(ngModel)]="selectedValue"
|
|
21
|
+
* ></pecb-dropdown>
|
|
22
|
+
*
|
|
23
|
+
* <!-- Multi-select with search -->
|
|
24
|
+
* <pecb-dropdown
|
|
25
|
+
* label="Select multiple"
|
|
26
|
+
* [options]="options"
|
|
27
|
+
* [multiple]="true"
|
|
28
|
+
* [searchable]="true"
|
|
29
|
+
* [(ngModel)]="selectedValues"
|
|
30
|
+
* ></pecb-dropdown>
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @publicApi
|
|
34
|
+
*/
|
|
35
|
+
export declare class DropdownComponent implements ControlValueAccessor {
|
|
36
|
+
private cdr;
|
|
37
|
+
private elementRef;
|
|
38
|
+
searchInput?: ElementRef<HTMLInputElement>;
|
|
39
|
+
/**
|
|
40
|
+
* Unique ID for the dropdown element
|
|
41
|
+
*/
|
|
42
|
+
id: string;
|
|
43
|
+
/**
|
|
44
|
+
* Label text to display
|
|
45
|
+
*/
|
|
46
|
+
label?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The size of the dropdown
|
|
49
|
+
*/
|
|
50
|
+
size: DropdownSize;
|
|
51
|
+
/**
|
|
52
|
+
* List of options
|
|
53
|
+
*/
|
|
54
|
+
options: DropdownOption[];
|
|
55
|
+
/**
|
|
56
|
+
* Whether multiple selection is enabled
|
|
57
|
+
*/
|
|
58
|
+
multiple: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Whether search is enabled
|
|
61
|
+
*/
|
|
62
|
+
searchable: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Maximum height for dropdown panel (in pixels)
|
|
65
|
+
*/
|
|
66
|
+
maxHeight: number;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the dropdown is disabled
|
|
69
|
+
*/
|
|
70
|
+
disabled: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the field is required
|
|
73
|
+
*/
|
|
74
|
+
required: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Whether to show error state
|
|
77
|
+
*/
|
|
78
|
+
error: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Error message to display
|
|
81
|
+
*/
|
|
82
|
+
errorMessage?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Helper text to display below dropdown
|
|
85
|
+
*/
|
|
86
|
+
helperText?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Event emitted when selection changes
|
|
89
|
+
*/
|
|
90
|
+
selectionChange: EventEmitter<unknown>;
|
|
91
|
+
isOpen: boolean;
|
|
92
|
+
searchQuery: string;
|
|
93
|
+
selectedValues: unknown[];
|
|
94
|
+
focusedIndex: number;
|
|
95
|
+
private onChange;
|
|
96
|
+
private onTouched;
|
|
97
|
+
constructor(cdr: ChangeDetectorRef, elementRef: ElementRef);
|
|
98
|
+
/**
|
|
99
|
+
* Get CSS classes for the dropdown wrapper
|
|
100
|
+
*/
|
|
101
|
+
get wrapperClasses(): string[];
|
|
102
|
+
/**
|
|
103
|
+
* Check if dropdown has value
|
|
104
|
+
*/
|
|
105
|
+
get hasValue(): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Get filtered options based on search query
|
|
108
|
+
*/
|
|
109
|
+
get filteredOptions(): DropdownOption[];
|
|
110
|
+
/**
|
|
111
|
+
* Get display text for selected value(s)
|
|
112
|
+
*/
|
|
113
|
+
get displayText(): string;
|
|
114
|
+
/**
|
|
115
|
+
* Toggle dropdown open/close
|
|
116
|
+
*/
|
|
117
|
+
toggleDropdown(): void;
|
|
118
|
+
/**
|
|
119
|
+
* Select an option
|
|
120
|
+
*/
|
|
121
|
+
selectOption(option: DropdownOption): void;
|
|
122
|
+
/**
|
|
123
|
+
* Check if option is selected
|
|
124
|
+
*/
|
|
125
|
+
isSelected(option: DropdownOption): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Handle search input
|
|
128
|
+
*/
|
|
129
|
+
onSearchInput(event: Event): void;
|
|
130
|
+
/**
|
|
131
|
+
* Handle keyboard navigation
|
|
132
|
+
*/
|
|
133
|
+
onKeyDown(event: KeyboardEvent): void;
|
|
134
|
+
/**
|
|
135
|
+
* Close dropdown when clicking outside
|
|
136
|
+
*/
|
|
137
|
+
onDocumentClick(event: MouseEvent): void;
|
|
138
|
+
writeValue(value: unknown): void;
|
|
139
|
+
registerOnChange(fn: (value: unknown) => void): void;
|
|
140
|
+
registerOnTouched(fn: () => void): void;
|
|
141
|
+
setDisabledState(isDisabled: boolean): void;
|
|
142
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DropdownComponent, never>;
|
|
143
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DropdownComponent, "pecb-dropdown", never, { "id": { "alias": "id"; "required": false; }; "label": { "alias": "label"; "required": false; }; "size": { "alias": "size"; "required": false; }; "options": { "alias": "options"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "searchable": { "alias": "searchable"; "required": false; }; "maxHeight": { "alias": "maxHeight"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "required": { "alias": "required"; "required": false; }; "error": { "alias": "error"; "required": false; }; "errorMessage": { "alias": "errorMessage"; "required": false; }; "helperText": { "alias": "helperText"; "required": false; }; }, { "selectionChange": "selectionChange"; }, never, never, true, never>;
|
|
144
|
+
}
|