@nuralyui/alert 0.0.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.
- package/alert.component.d.ts +104 -0
- package/alert.component.js +227 -0
- package/alert.component.js.map +1 -0
- package/alert.style.d.ts +14 -0
- package/alert.style.js +191 -0
- package/alert.style.js.map +1 -0
- package/alert.types.d.ts +46 -0
- package/alert.types.js +7 -0
- package/alert.types.js.map +1 -0
- package/bundle.js +593 -0
- package/index.d.ts +8 -0
- package/index.js +8 -0
- package/index.js.map +1 -0
- package/package.json +49 -0
- package/react.d.ts +5 -0
- package/react.js +17 -0
- package/react.js.map +1 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { LitElement, nothing } from 'lit';
|
|
7
|
+
import { AlertType } from './alert.types.js';
|
|
8
|
+
import '../icon/icon.component.js';
|
|
9
|
+
declare const NrAlertElement_base: (new (...args: any[]) => import("../../shared/dependency-mixin.js").DependencyAware) & (new (...args: any[]) => import("../../shared/theme-mixin.js").ThemeAware) & (new (...args: any[]) => import("../../shared/event-handler-mixin.js").EventHandlerCapable) & typeof LitElement;
|
|
10
|
+
/**
|
|
11
|
+
* Alert component for displaying important messages.
|
|
12
|
+
*
|
|
13
|
+
/**
|
|
14
|
+
* Provides a flexible alert/banner system with multiple types.
|
|
15
|
+
* The alert component is used to display important messages, warnings, and notifications
|
|
16
|
+
* Supports different severity levels, optional icons, descriptions, and closable functionality.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```html
|
|
20
|
+
* <!-- Basic alert -->
|
|
21
|
+
* <nr-alert message="Success message" type="success"></nr-alert>
|
|
22
|
+
*
|
|
23
|
+
* <!-- Alert with description -->
|
|
24
|
+
* <nr-alert
|
|
25
|
+
* message="Warning title"
|
|
26
|
+
* description="This is a detailed warning description"
|
|
27
|
+
* type="warning"
|
|
28
|
+
* show-icon
|
|
29
|
+
* ></nr-alert>
|
|
30
|
+
*
|
|
31
|
+
* <!-- Closable alert -->
|
|
32
|
+
* <nr-alert
|
|
33
|
+
* message="Dismissible message"
|
|
34
|
+
* type="info"
|
|
35
|
+
* closable
|
|
36
|
+
* show-icon
|
|
37
|
+
* ></nr-alert>
|
|
38
|
+
*
|
|
39
|
+
* <!-- Banner mode -->
|
|
40
|
+
* <nr-alert
|
|
41
|
+
* message="Banner alert"
|
|
42
|
+
* type="error"
|
|
43
|
+
* banner
|
|
44
|
+
* show-icon
|
|
45
|
+
* ></nr-alert>
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @fires nr-alert-close - Fired when alert is closed
|
|
49
|
+
*
|
|
50
|
+
* @slot - Default slot for custom content (overrides message/description)
|
|
51
|
+
* @slot icon - Custom icon slot
|
|
52
|
+
* @slot action - Custom action buttons or links
|
|
53
|
+
*
|
|
54
|
+
* @cssproperty --nuraly-color-success - Success color
|
|
55
|
+
* @cssproperty --nuraly-color-info - Info color
|
|
56
|
+
* @cssproperty --nuraly-color-warning - Warning color
|
|
57
|
+
* @cssproperty --nuraly-color-error - Error color
|
|
58
|
+
*/
|
|
59
|
+
export declare class NrAlertElement extends NrAlertElement_base {
|
|
60
|
+
static styles: import("lit").CSSResult;
|
|
61
|
+
requiredComponents: string[];
|
|
62
|
+
/** Alert message text */
|
|
63
|
+
message: string;
|
|
64
|
+
/** Alert type/variant */
|
|
65
|
+
type: AlertType;
|
|
66
|
+
/** Optional description text */
|
|
67
|
+
description: string;
|
|
68
|
+
/** Whether the alert can be closed */
|
|
69
|
+
closable: boolean;
|
|
70
|
+
/** Whether to show icon */
|
|
71
|
+
showIcon: boolean;
|
|
72
|
+
/** Custom icon name */
|
|
73
|
+
icon: string;
|
|
74
|
+
/** Banner mode - full width with no border radius */
|
|
75
|
+
banner: boolean;
|
|
76
|
+
/** Internal state: whether alert is visible */
|
|
77
|
+
private visible;
|
|
78
|
+
/** Internal state: whether alert is closing */
|
|
79
|
+
private closing;
|
|
80
|
+
/**
|
|
81
|
+
* Close the alert
|
|
82
|
+
*/
|
|
83
|
+
close(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Handle close button click
|
|
86
|
+
*/
|
|
87
|
+
private handleCloseClick;
|
|
88
|
+
/**
|
|
89
|
+
* Get default icon for alert type
|
|
90
|
+
*/
|
|
91
|
+
private getDefaultIcon;
|
|
92
|
+
/**
|
|
93
|
+
* Check if alert has description
|
|
94
|
+
*/
|
|
95
|
+
private hasDescription;
|
|
96
|
+
render(): import("lit").TemplateResult<1> | typeof nothing;
|
|
97
|
+
}
|
|
98
|
+
declare global {
|
|
99
|
+
interface HTMLElementTagNameMap {
|
|
100
|
+
'nr-alert': NrAlertElement;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export {};
|
|
104
|
+
//# sourceMappingURL=alert.component.d.ts.map
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
import { LitElement, html, nothing } from 'lit';
|
|
13
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
14
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
15
|
+
import { styles } from './alert.style.js';
|
|
16
|
+
import { NuralyUIBaseMixin } from '../../shared/base-mixin.js';
|
|
17
|
+
import { EMPTY_STRING } from './alert.types.js';
|
|
18
|
+
// Import required components
|
|
19
|
+
import '../icon/icon.component.js';
|
|
20
|
+
/**
|
|
21
|
+
* Alert component for displaying important messages.
|
|
22
|
+
*
|
|
23
|
+
/**
|
|
24
|
+
* Provides a flexible alert/banner system with multiple types.
|
|
25
|
+
* The alert component is used to display important messages, warnings, and notifications
|
|
26
|
+
* Supports different severity levels, optional icons, descriptions, and closable functionality.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```html
|
|
30
|
+
* <!-- Basic alert -->
|
|
31
|
+
* <nr-alert message="Success message" type="success"></nr-alert>
|
|
32
|
+
*
|
|
33
|
+
* <!-- Alert with description -->
|
|
34
|
+
* <nr-alert
|
|
35
|
+
* message="Warning title"
|
|
36
|
+
* description="This is a detailed warning description"
|
|
37
|
+
* type="warning"
|
|
38
|
+
* show-icon
|
|
39
|
+
* ></nr-alert>
|
|
40
|
+
*
|
|
41
|
+
* <!-- Closable alert -->
|
|
42
|
+
* <nr-alert
|
|
43
|
+
* message="Dismissible message"
|
|
44
|
+
* type="info"
|
|
45
|
+
* closable
|
|
46
|
+
* show-icon
|
|
47
|
+
* ></nr-alert>
|
|
48
|
+
*
|
|
49
|
+
* <!-- Banner mode -->
|
|
50
|
+
* <nr-alert
|
|
51
|
+
* message="Banner alert"
|
|
52
|
+
* type="error"
|
|
53
|
+
* banner
|
|
54
|
+
* show-icon
|
|
55
|
+
* ></nr-alert>
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @fires nr-alert-close - Fired when alert is closed
|
|
59
|
+
*
|
|
60
|
+
* @slot - Default slot for custom content (overrides message/description)
|
|
61
|
+
* @slot icon - Custom icon slot
|
|
62
|
+
* @slot action - Custom action buttons or links
|
|
63
|
+
*
|
|
64
|
+
* @cssproperty --nuraly-color-success - Success color
|
|
65
|
+
* @cssproperty --nuraly-color-info - Info color
|
|
66
|
+
* @cssproperty --nuraly-color-warning - Warning color
|
|
67
|
+
* @cssproperty --nuraly-color-error - Error color
|
|
68
|
+
*/
|
|
69
|
+
let NrAlertElement = class NrAlertElement extends NuralyUIBaseMixin(LitElement) {
|
|
70
|
+
constructor() {
|
|
71
|
+
super(...arguments);
|
|
72
|
+
this.requiredComponents = ['nr-icon'];
|
|
73
|
+
/** Alert message text */
|
|
74
|
+
this.message = EMPTY_STRING;
|
|
75
|
+
/** Alert type/variant */
|
|
76
|
+
this.type = "info" /* AlertType.Info */;
|
|
77
|
+
/** Optional description text */
|
|
78
|
+
this.description = EMPTY_STRING;
|
|
79
|
+
/** Whether the alert can be closed */
|
|
80
|
+
this.closable = false;
|
|
81
|
+
/** Whether to show icon */
|
|
82
|
+
this.showIcon = false;
|
|
83
|
+
/** Custom icon name */
|
|
84
|
+
this.icon = EMPTY_STRING;
|
|
85
|
+
/** Banner mode - full width with no border radius */
|
|
86
|
+
this.banner = false;
|
|
87
|
+
/** Internal state: whether alert is visible */
|
|
88
|
+
this.visible = true;
|
|
89
|
+
/** Internal state: whether alert is closing */
|
|
90
|
+
this.closing = false;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Close the alert
|
|
94
|
+
*/
|
|
95
|
+
close() {
|
|
96
|
+
if (!this.visible || this.closing)
|
|
97
|
+
return;
|
|
98
|
+
this.closing = true;
|
|
99
|
+
// Wait for animation to complete before hiding
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
this.visible = false;
|
|
102
|
+
this.closing = false;
|
|
103
|
+
// Emit close event
|
|
104
|
+
this.dispatchEvent(new CustomEvent('nr-alert-close', {
|
|
105
|
+
detail: { message: this.message, type: this.type },
|
|
106
|
+
bubbles: true,
|
|
107
|
+
composed: true
|
|
108
|
+
}));
|
|
109
|
+
}, 300); // Match animation duration
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Handle close button click
|
|
113
|
+
*/
|
|
114
|
+
handleCloseClick(event) {
|
|
115
|
+
event.stopPropagation();
|
|
116
|
+
this.close();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get default icon for alert type
|
|
120
|
+
*/
|
|
121
|
+
getDefaultIcon() {
|
|
122
|
+
if (this.icon)
|
|
123
|
+
return this.icon;
|
|
124
|
+
switch (this.type) {
|
|
125
|
+
case "success" /* AlertType.Success */:
|
|
126
|
+
return 'check-circle';
|
|
127
|
+
case "info" /* AlertType.Info */:
|
|
128
|
+
return 'info';
|
|
129
|
+
case "warning" /* AlertType.Warning */:
|
|
130
|
+
return 'alert-triangle';
|
|
131
|
+
case "error" /* AlertType.Error */:
|
|
132
|
+
return 'x-circle';
|
|
133
|
+
default:
|
|
134
|
+
return EMPTY_STRING;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check if alert has description
|
|
139
|
+
*/
|
|
140
|
+
hasDescription() {
|
|
141
|
+
return !!this.description;
|
|
142
|
+
}
|
|
143
|
+
render() {
|
|
144
|
+
if (!this.visible) {
|
|
145
|
+
return nothing;
|
|
146
|
+
}
|
|
147
|
+
const classes = {
|
|
148
|
+
'alert': true,
|
|
149
|
+
[`alert--${this.type}`]: true,
|
|
150
|
+
'alert--with-description': this.hasDescription(),
|
|
151
|
+
'alert--banner': this.banner,
|
|
152
|
+
'alert--closing': this.closing,
|
|
153
|
+
};
|
|
154
|
+
return html `
|
|
155
|
+
<div class=${classMap(classes)} role="alert">
|
|
156
|
+
${this.showIcon ? html `
|
|
157
|
+
<div class="alert__icon">
|
|
158
|
+
<slot name="icon">
|
|
159
|
+
<nr-icon
|
|
160
|
+
name=${this.getDefaultIcon()}
|
|
161
|
+
size=${this.hasDescription() ? 'large' : 'small'}
|
|
162
|
+
></nr-icon>
|
|
163
|
+
</slot>
|
|
164
|
+
</div>
|
|
165
|
+
` : nothing}
|
|
166
|
+
|
|
167
|
+
<div class="alert__content">
|
|
168
|
+
${this.message ? html `
|
|
169
|
+
<div class="alert__message">${this.message}</div>
|
|
170
|
+
` : nothing}
|
|
171
|
+
|
|
172
|
+
${this.description ? html `
|
|
173
|
+
<div class="alert__description">${this.description}</div>
|
|
174
|
+
` : nothing}
|
|
175
|
+
|
|
176
|
+
<slot></slot>
|
|
177
|
+
|
|
178
|
+
<slot name="action"></slot>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
${this.closable ? html `
|
|
182
|
+
<button
|
|
183
|
+
class="alert__close"
|
|
184
|
+
@click=${this.handleCloseClick}
|
|
185
|
+
aria-label="Close alert"
|
|
186
|
+
type="button"
|
|
187
|
+
>
|
|
188
|
+
<nr-icon name="x" size="small"></nr-icon>
|
|
189
|
+
</button>
|
|
190
|
+
` : nothing}
|
|
191
|
+
</div>
|
|
192
|
+
`;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
NrAlertElement.styles = styles;
|
|
196
|
+
__decorate([
|
|
197
|
+
property({ type: String })
|
|
198
|
+
], NrAlertElement.prototype, "message", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
property({ type: String, reflect: true })
|
|
201
|
+
], NrAlertElement.prototype, "type", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
property({ type: String })
|
|
204
|
+
], NrAlertElement.prototype, "description", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
property({ type: Boolean })
|
|
207
|
+
], NrAlertElement.prototype, "closable", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
property({ type: Boolean, attribute: 'show-icon' })
|
|
210
|
+
], NrAlertElement.prototype, "showIcon", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
property({ type: String })
|
|
213
|
+
], NrAlertElement.prototype, "icon", void 0);
|
|
214
|
+
__decorate([
|
|
215
|
+
property({ type: Boolean })
|
|
216
|
+
], NrAlertElement.prototype, "banner", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
state()
|
|
219
|
+
], NrAlertElement.prototype, "visible", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
state()
|
|
222
|
+
], NrAlertElement.prototype, "closing", void 0);
|
|
223
|
+
NrAlertElement = __decorate([
|
|
224
|
+
customElement('nr-alert')
|
|
225
|
+
], NrAlertElement);
|
|
226
|
+
export { NrAlertElement };
|
|
227
|
+
//# sourceMappingURL=alert.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.component.js","sourceRoot":"","sources":["../../../src/components/alert/alert.component.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { LitElement, html, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './alert.style.js';\nimport { NuralyUIBaseMixin } from '../../shared/base-mixin.js';\nimport {\n AlertType,\n AlertEventDetail,\n EMPTY_STRING\n} from './alert.types.js';\n\n// Import required components\nimport '../icon/icon.component.js';\n\n/**\n * Alert component for displaying important messages.\n * \n /**\n * Provides a flexible alert/banner system with multiple types.\n * The alert component is used to display important messages, warnings, and notifications\n * Supports different severity levels, optional icons, descriptions, and closable functionality.\n * \n * @example\n * ```html\n * <!-- Basic alert -->\n * <nr-alert message=\"Success message\" type=\"success\"></nr-alert>\n * \n * <!-- Alert with description -->\n * <nr-alert \n * message=\"Warning title\" \n * description=\"This is a detailed warning description\"\n * type=\"warning\"\n * show-icon\n * ></nr-alert>\n * \n * <!-- Closable alert -->\n * <nr-alert \n * message=\"Dismissible message\" \n * type=\"info\"\n * closable\n * show-icon\n * ></nr-alert>\n * \n * <!-- Banner mode -->\n * <nr-alert \n * message=\"Banner alert\" \n * type=\"error\"\n * banner\n * show-icon\n * ></nr-alert>\n * ```\n * \n * @fires nr-alert-close - Fired when alert is closed\n * \n * @slot - Default slot for custom content (overrides message/description)\n * @slot icon - Custom icon slot\n * @slot action - Custom action buttons or links\n * \n * @cssproperty --nuraly-color-success - Success color\n * @cssproperty --nuraly-color-info - Info color\n * @cssproperty --nuraly-color-warning - Warning color\n * @cssproperty --nuraly-color-error - Error color\n */\n@customElement('nr-alert')\nexport class NrAlertElement extends NuralyUIBaseMixin(LitElement) {\n static override styles = styles;\n\n override requiredComponents = ['nr-icon'];\n\n /** Alert message text */\n @property({ type: String })\n message = EMPTY_STRING;\n\n /** Alert type/variant */\n @property({ type: String, reflect: true })\n type: AlertType = AlertType.Info;\n\n /** Optional description text */\n @property({ type: String })\n description = EMPTY_STRING;\n\n /** Whether the alert can be closed */\n @property({ type: Boolean })\n closable = false;\n\n /** Whether to show icon */\n @property({ type: Boolean, attribute: 'show-icon' })\n showIcon = false;\n\n /** Custom icon name */\n @property({ type: String })\n icon = EMPTY_STRING;\n\n /** Banner mode - full width with no border radius */\n @property({ type: Boolean })\n banner = false;\n\n /** Internal state: whether alert is visible */\n @state()\n private visible = true;\n\n /** Internal state: whether alert is closing */\n @state()\n private closing = false;\n\n /**\n * Close the alert\n */\n close(): void {\n if (!this.visible || this.closing) return;\n\n this.closing = true;\n \n // Wait for animation to complete before hiding\n setTimeout(() => {\n this.visible = false;\n this.closing = false;\n \n // Emit close event\n this.dispatchEvent(new CustomEvent<AlertEventDetail>('nr-alert-close', {\n detail: { message: this.message, type: this.type },\n bubbles: true,\n composed: true\n }));\n }, 300); // Match animation duration\n }\n\n /**\n * Handle close button click\n */\n private handleCloseClick(event: Event): void {\n event.stopPropagation();\n this.close();\n }\n\n /**\n * Get default icon for alert type\n */\n private getDefaultIcon(): string {\n if (this.icon) return this.icon;\n \n switch (this.type) {\n case AlertType.Success:\n return 'check-circle';\n case AlertType.Info:\n return 'info';\n case AlertType.Warning:\n return 'alert-triangle';\n case AlertType.Error:\n return 'x-circle';\n default:\n return EMPTY_STRING;\n }\n }\n\n /**\n * Check if alert has description\n */\n private hasDescription(): boolean {\n return !!this.description;\n }\n\n override render() {\n if (!this.visible) {\n return nothing;\n }\n\n const classes = {\n 'alert': true,\n [`alert--${this.type}`]: true,\n 'alert--with-description': this.hasDescription(),\n 'alert--banner': this.banner,\n 'alert--closing': this.closing,\n };\n\n return html`\n <div class=${classMap(classes)} role=\"alert\">\n ${this.showIcon ? html`\n <div class=\"alert__icon\">\n <slot name=\"icon\">\n <nr-icon \n name=${this.getDefaultIcon()} \n size=${this.hasDescription() ? 'large' : 'small'}\n ></nr-icon>\n </slot>\n </div>\n ` : nothing}\n \n <div class=\"alert__content\">\n ${this.message ? html`\n <div class=\"alert__message\">${this.message}</div>\n ` : nothing}\n \n ${this.description ? html`\n <div class=\"alert__description\">${this.description}</div>\n ` : nothing}\n \n <slot></slot>\n \n <slot name=\"action\"></slot>\n </div>\n \n ${this.closable ? html`\n <button\n class=\"alert__close\"\n @click=${this.handleCloseClick}\n aria-label=\"Close alert\"\n type=\"button\"\n >\n <nr-icon name=\"x\" size=\"small\"></nr-icon>\n </button>\n ` : nothing}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nr-alert': NrAlertElement;\n }\n}\n"]}
|
package/alert.style.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Alert component styles for the Hybrid UI Library
|
|
8
|
+
* Using shared CSS variables from /src/shared/themes/
|
|
9
|
+
*
|
|
10
|
+
* This file contains all the styling for the nr-alert component with
|
|
11
|
+
* clean CSS variable usage without local fallbacks and proper theme switching support.
|
|
12
|
+
*/
|
|
13
|
+
export declare const styles: import("lit").CSSResult;
|
|
14
|
+
//# sourceMappingURL=alert.style.d.ts.map
|
package/alert.style.js
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
/**
|
|
8
|
+
* Alert component styles for the Hybrid UI Library
|
|
9
|
+
* Using shared CSS variables from /src/shared/themes/
|
|
10
|
+
*
|
|
11
|
+
* This file contains all the styling for the nr-alert component with
|
|
12
|
+
* clean CSS variable usage without local fallbacks and proper theme switching support.
|
|
13
|
+
*/
|
|
14
|
+
export const styles = css `
|
|
15
|
+
:host {
|
|
16
|
+
display: block;
|
|
17
|
+
font-family: var(--nuraly-font-family);
|
|
18
|
+
font-size: var(--nuraly-font-size-base);
|
|
19
|
+
line-height: var(--nuraly-line-height-base);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host([hidden]) {
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.alert {
|
|
27
|
+
position: relative;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: flex-start;
|
|
30
|
+
gap: var(--nuraly-alert-gap);
|
|
31
|
+
padding: var(--nuraly-alert-padding);
|
|
32
|
+
border: 1px solid transparent;
|
|
33
|
+
border-radius: var(--nuraly-alert-border-radius);
|
|
34
|
+
transition: var(--nuraly-alert-transition);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.alert--banner {
|
|
38
|
+
border-radius: 0;
|
|
39
|
+
border-left: none;
|
|
40
|
+
border-right: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Alert type variants - Success */
|
|
44
|
+
.alert--success {
|
|
45
|
+
background-color: var(--nuraly-color-success-light, #f6ffed);
|
|
46
|
+
border-color: var(--nuraly-color-success, #52c41a);
|
|
47
|
+
color: var(--nuraly-color-success-dark, #389e0d);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.alert--success .alert__icon {
|
|
51
|
+
color: var(--nuraly-color-success, #52c41a);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Alert type variants - Info */
|
|
55
|
+
.alert--info {
|
|
56
|
+
background-color: var(--nuraly-color-info-light, #e6f7ff);
|
|
57
|
+
border-color: var(--nuraly-color-info, #1890ff);
|
|
58
|
+
color: var(--nuraly-color-info-dark, #096dd9);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.alert--info .alert__icon {
|
|
62
|
+
color: var(--nuraly-color-info, #1890ff);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Alert type variants - Warning */
|
|
66
|
+
.alert--warning {
|
|
67
|
+
background-color: var(--nuraly-color-warning-light, #fffbe6);
|
|
68
|
+
border-color: var(--nuraly-color-warning, #faad14);
|
|
69
|
+
color: var(--nuraly-color-warning-dark, #d48806);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.alert--warning .alert__icon {
|
|
73
|
+
color: var(--nuraly-color-warning, #faad14);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* Alert type variants - Error */
|
|
77
|
+
.alert--error {
|
|
78
|
+
background-color: var(--nuraly-color-error-light, #fff2f0);
|
|
79
|
+
border-color: var(--nuraly-color-error, #ff4d4f);
|
|
80
|
+
color: var(--nuraly-color-error-dark, #cf1322);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.alert--error .alert__icon {
|
|
84
|
+
color: var(--nuraly-color-error, #ff4d4f);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Alert with description */
|
|
88
|
+
.alert--with-description {
|
|
89
|
+
padding: var(--nuraly-alert-padding-with-description);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.alert--with-description .alert__icon {
|
|
93
|
+
font-size: 1.5rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.alert__icon {
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
font-size: 1rem;
|
|
102
|
+
line-height: 1;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.alert__content {
|
|
106
|
+
flex: 1;
|
|
107
|
+
min-width: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.alert__message {
|
|
111
|
+
font-weight: var(--nuraly-font-weight-medium, 500);
|
|
112
|
+
margin: 0;
|
|
113
|
+
line-height: var(--nuraly-line-height-base);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.alert--with-description .alert__message {
|
|
117
|
+
font-size: var(--nuraly-font-size-lg, 1.125rem);
|
|
118
|
+
margin-bottom: var(--nuraly-spacing-1);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.alert__description {
|
|
122
|
+
margin: var(--nuraly-spacing-1) 0 0;
|
|
123
|
+
font-size: var(--nuraly-font-size-sm, 0.875rem);
|
|
124
|
+
line-height: var(--nuraly-line-height-relaxed, 1.6);
|
|
125
|
+
opacity: 0.85;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.alert__close {
|
|
129
|
+
flex-shrink: 0;
|
|
130
|
+
background: none;
|
|
131
|
+
border: none;
|
|
132
|
+
padding: 0;
|
|
133
|
+
margin: 0;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
color: currentColor;
|
|
139
|
+
opacity: 0.6;
|
|
140
|
+
transition: opacity var(--nuraly-transition-fast) ease;
|
|
141
|
+
line-height: 1;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.alert__close:hover {
|
|
145
|
+
opacity: 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.alert__close:focus {
|
|
149
|
+
outline: none;
|
|
150
|
+
opacity: 1;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.alert__close:focus-visible {
|
|
154
|
+
outline: 2px solid currentColor;
|
|
155
|
+
outline-offset: 2px;
|
|
156
|
+
border-radius: var(--nuraly-border-radius-sm, 2px);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* Animation for closing */
|
|
160
|
+
@keyframes alertFadeOut {
|
|
161
|
+
from {
|
|
162
|
+
opacity: 1;
|
|
163
|
+
max-height: 200px;
|
|
164
|
+
}
|
|
165
|
+
to {
|
|
166
|
+
opacity: 0;
|
|
167
|
+
max-height: 0;
|
|
168
|
+
padding-top: 0;
|
|
169
|
+
padding-bottom: 0;
|
|
170
|
+
margin-top: 0;
|
|
171
|
+
margin-bottom: 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.alert--closing {
|
|
176
|
+
animation: alertFadeOut 0.3s ease forwards;
|
|
177
|
+
overflow: hidden;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* Responsive adjustments */
|
|
181
|
+
@media (max-width: 768px) {
|
|
182
|
+
.alert {
|
|
183
|
+
padding: var(--nuraly-spacing-2) var(--nuraly-spacing-3);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.alert--with-description {
|
|
187
|
+
padding: var(--nuraly-spacing-3) var(--nuraly-spacing-4);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
`;
|
|
191
|
+
//# sourceMappingURL=alert.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.style.js","sourceRoot":"","sources":["../../../src/components/alert/alert.style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgLxB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { css } from 'lit';\n\n/**\n * Alert component styles for the Hybrid UI Library\n * Using shared CSS variables from /src/shared/themes/\n * \n * This file contains all the styling for the nr-alert component with\n * clean CSS variable usage without local fallbacks and proper theme switching support.\n */\nexport const styles = css`\n :host {\n display: block;\n font-family: var(--nuraly-font-family);\n font-size: var(--nuraly-font-size-base);\n line-height: var(--nuraly-line-height-base);\n }\n\n :host([hidden]) {\n display: none;\n }\n\n .alert {\n position: relative;\n display: flex;\n align-items: flex-start;\n gap: var(--nuraly-alert-gap);\n padding: var(--nuraly-alert-padding);\n border: 1px solid transparent;\n border-radius: var(--nuraly-alert-border-radius);\n transition: var(--nuraly-alert-transition);\n }\n\n .alert--banner {\n border-radius: 0;\n border-left: none;\n border-right: none;\n }\n\n /* Alert type variants - Success */\n .alert--success {\n background-color: var(--nuraly-color-success-light, #f6ffed);\n border-color: var(--nuraly-color-success, #52c41a);\n color: var(--nuraly-color-success-dark, #389e0d);\n }\n\n .alert--success .alert__icon {\n color: var(--nuraly-color-success, #52c41a);\n }\n\n /* Alert type variants - Info */\n .alert--info {\n background-color: var(--nuraly-color-info-light, #e6f7ff);\n border-color: var(--nuraly-color-info, #1890ff);\n color: var(--nuraly-color-info-dark, #096dd9);\n }\n\n .alert--info .alert__icon {\n color: var(--nuraly-color-info, #1890ff);\n }\n\n /* Alert type variants - Warning */\n .alert--warning {\n background-color: var(--nuraly-color-warning-light, #fffbe6);\n border-color: var(--nuraly-color-warning, #faad14);\n color: var(--nuraly-color-warning-dark, #d48806);\n }\n\n .alert--warning .alert__icon {\n color: var(--nuraly-color-warning, #faad14);\n }\n\n /* Alert type variants - Error */\n .alert--error {\n background-color: var(--nuraly-color-error-light, #fff2f0);\n border-color: var(--nuraly-color-error, #ff4d4f);\n color: var(--nuraly-color-error-dark, #cf1322);\n }\n\n .alert--error .alert__icon {\n color: var(--nuraly-color-error, #ff4d4f);\n }\n\n /* Alert with description */\n .alert--with-description {\n padding: var(--nuraly-alert-padding-with-description);\n }\n\n .alert--with-description .alert__icon {\n font-size: 1.5rem;\n }\n\n .alert__icon {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 1rem;\n line-height: 1;\n }\n\n .alert__content {\n flex: 1;\n min-width: 0;\n }\n\n .alert__message {\n font-weight: var(--nuraly-font-weight-medium, 500);\n margin: 0;\n line-height: var(--nuraly-line-height-base);\n }\n\n .alert--with-description .alert__message {\n font-size: var(--nuraly-font-size-lg, 1.125rem);\n margin-bottom: var(--nuraly-spacing-1);\n }\n\n .alert__description {\n margin: var(--nuraly-spacing-1) 0 0;\n font-size: var(--nuraly-font-size-sm, 0.875rem);\n line-height: var(--nuraly-line-height-relaxed, 1.6);\n opacity: 0.85;\n }\n\n .alert__close {\n flex-shrink: 0;\n background: none;\n border: none;\n padding: 0;\n margin: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: currentColor;\n opacity: 0.6;\n transition: opacity var(--nuraly-transition-fast) ease;\n line-height: 1;\n }\n\n .alert__close:hover {\n opacity: 1;\n }\n\n .alert__close:focus {\n outline: none;\n opacity: 1;\n }\n\n .alert__close:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: 2px;\n border-radius: var(--nuraly-border-radius-sm, 2px);\n }\n\n /* Animation for closing */\n @keyframes alertFadeOut {\n from {\n opacity: 1;\n max-height: 200px;\n }\n to {\n opacity: 0;\n max-height: 0;\n padding-top: 0;\n padding-bottom: 0;\n margin-top: 0;\n margin-bottom: 0;\n }\n }\n\n .alert--closing {\n animation: alertFadeOut 0.3s ease forwards;\n overflow: hidden;\n }\n\n /* Responsive adjustments */\n @media (max-width: 768px) {\n .alert {\n padding: var(--nuraly-spacing-2) var(--nuraly-spacing-3);\n }\n\n .alert--with-description {\n padding: var(--nuraly-spacing-3) var(--nuraly-spacing-4);\n }\n }\n`;\n"]}
|
package/alert.types.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Alert type variants
|
|
8
|
+
*/
|
|
9
|
+
export declare const enum AlertType {
|
|
10
|
+
Success = "success",
|
|
11
|
+
Info = "info",
|
|
12
|
+
Warning = "warning",
|
|
13
|
+
Error = "error"
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Alert configuration interface
|
|
17
|
+
*/
|
|
18
|
+
export interface AlertConfig {
|
|
19
|
+
/** Alert message text */
|
|
20
|
+
message: string;
|
|
21
|
+
/** Alert type/variant */
|
|
22
|
+
type?: AlertType;
|
|
23
|
+
/** Optional description text */
|
|
24
|
+
description?: string;
|
|
25
|
+
/** Whether the alert can be closed */
|
|
26
|
+
closable?: boolean;
|
|
27
|
+
/** Custom icon name */
|
|
28
|
+
icon?: string;
|
|
29
|
+
/** Whether to show icon */
|
|
30
|
+
showIcon?: boolean;
|
|
31
|
+
/** Custom CSS class */
|
|
32
|
+
customClass?: string;
|
|
33
|
+
/** Callback when alert is closed */
|
|
34
|
+
onClose?: () => void;
|
|
35
|
+
/** Banner mode - full width with no border radius */
|
|
36
|
+
banner?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Alert event detail
|
|
40
|
+
*/
|
|
41
|
+
export interface AlertEventDetail {
|
|
42
|
+
message: string;
|
|
43
|
+
type: AlertType;
|
|
44
|
+
}
|
|
45
|
+
export declare const EMPTY_STRING = "";
|
|
46
|
+
//# sourceMappingURL=alert.types.d.ts.map
|
package/alert.types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.types.js","sourceRoot":"","sources":["../../../src/components/alert/alert.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoDH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\n/**\n * Alert type variants\n */\nexport const enum AlertType {\n Success = 'success',\n Info = 'info',\n Warning = 'warning',\n Error = 'error',\n}\n\n/**\n * Alert configuration interface\n */\nexport interface AlertConfig {\n /** Alert message text */\n message: string;\n \n /** Alert type/variant */\n type?: AlertType;\n \n /** Optional description text */\n description?: string;\n \n /** Whether the alert can be closed */\n closable?: boolean;\n \n /** Custom icon name */\n icon?: string;\n \n /** Whether to show icon */\n showIcon?: boolean;\n \n /** Custom CSS class */\n customClass?: string;\n \n /** Callback when alert is closed */\n onClose?: () => void;\n \n /** Banner mode - full width with no border radius */\n banner?: boolean;\n}\n\n/**\n * Alert event detail\n */\nexport interface AlertEventDetail {\n message: string;\n type: AlertType;\n}\n\nexport const EMPTY_STRING = '';\n"]}
|