aeico-components 0.1.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 (174) hide show
  1. package/README.md +0 -0
  2. package/dist/index.cjs +4226 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.js +4226 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/types/aeico-component.d.ts +8 -0
  7. package/dist/types/aeico-field.d.ts +132 -0
  8. package/dist/types/alert/alert.d.ts +49 -0
  9. package/dist/types/alert/defines.d.ts +3 -0
  10. package/dist/types/alert/index.d.ts +3 -0
  11. package/dist/types/badge/badge.d.ts +34 -0
  12. package/dist/types/badge/defines.d.ts +3 -0
  13. package/dist/types/badge/index.d.ts +3 -0
  14. package/dist/types/breadcrumb/breadcrumb-item.d.ts +31 -0
  15. package/dist/types/breadcrumb/breadcrumb.d.ts +60 -0
  16. package/dist/types/breadcrumb/defines.d.ts +1 -0
  17. package/dist/types/breadcrumb/index.d.ts +5 -0
  18. package/dist/types/button/button.d.ts +60 -0
  19. package/dist/types/button/defines.d.ts +3 -0
  20. package/dist/types/button/index.d.ts +3 -0
  21. package/dist/types/button-group/button-group.d.ts +56 -0
  22. package/dist/types/button-group/index.d.ts +2 -0
  23. package/dist/types/card/card.d.ts +19 -0
  24. package/dist/types/card/defines.d.ts +2 -0
  25. package/dist/types/card/index.d.ts +3 -0
  26. package/dist/types/checkbox/checkbox.d.ts +37 -0
  27. package/dist/types/checkbox/defines.d.ts +1 -0
  28. package/dist/types/checkbox/index.d.ts +3 -0
  29. package/dist/types/detail/defines.d.ts +2 -0
  30. package/dist/types/detail/detail.d.ts +40 -0
  31. package/dist/types/detail/index.d.ts +3 -0
  32. package/dist/types/dialog/dialog.d.ts +29 -0
  33. package/dist/types/dialog/index.d.ts +2 -0
  34. package/dist/types/divider/divider.d.ts +34 -0
  35. package/dist/types/divider/index.d.ts +2 -0
  36. package/dist/types/dropdown/defines.d.ts +1 -0
  37. package/dist/types/dropdown/dropdown-button.d.ts +60 -0
  38. package/dist/types/dropdown/dropdown-item.d.ts +56 -0
  39. package/dist/types/dropdown/dropdown.d.ts +84 -0
  40. package/dist/types/dropdown/index.d.ts +7 -0
  41. package/dist/types/icon/defines.d.ts +10 -0
  42. package/dist/types/icon/icon.d.ts +21 -0
  43. package/dist/types/icon/index.d.ts +4 -0
  44. package/dist/types/icon/registry.d.ts +8 -0
  45. package/dist/types/icon-button/icon-button.d.ts +32 -0
  46. package/dist/types/icon-button/index.d.ts +2 -0
  47. package/dist/types/index.d.ts +74 -0
  48. package/dist/types/navbar/defines.d.ts +2 -0
  49. package/dist/types/navbar/index.d.ts +3 -0
  50. package/dist/types/navbar/navbar.d.ts +73 -0
  51. package/dist/types/radio-group/defines.d.ts +6 -0
  52. package/dist/types/radio-group/index.d.ts +5 -0
  53. package/dist/types/radio-group/radio-group.d.ts +41 -0
  54. package/dist/types/radio-group/radio.d.ts +47 -0
  55. package/dist/types/select/defines.d.ts +8 -0
  56. package/dist/types/select/index.d.ts +5 -0
  57. package/dist/types/select/select-option.d.ts +20 -0
  58. package/dist/types/select/select.d.ts +60 -0
  59. package/dist/types/slider/defines.d.ts +31 -0
  60. package/dist/types/slider/index.d.ts +3 -0
  61. package/dist/types/slider/slider.d.ts +45 -0
  62. package/dist/types/switch/index.d.ts +2 -0
  63. package/dist/types/switch/switch.d.ts +35 -0
  64. package/dist/types/tabs/defines.d.ts +1 -0
  65. package/dist/types/tabs/index.d.ts +3 -0
  66. package/dist/types/tabs/tab-panel.d.ts +11 -0
  67. package/dist/types/tabs/tab.d.ts +18 -0
  68. package/dist/types/tabs/tabs.d.ts +24 -0
  69. package/dist/types/tag/defines.d.ts +3 -0
  70. package/dist/types/tag/index.d.ts +3 -0
  71. package/dist/types/tag/tag.d.ts +36 -0
  72. package/dist/types/text-input/index.d.ts +2 -0
  73. package/dist/types/text-input/text-input.d.ts +26 -0
  74. package/dist/types/utils.d.ts +2 -0
  75. package/package.json +63 -0
  76. package/src/aeico-component.ts +17 -0
  77. package/src/aeico-field.ts +228 -0
  78. package/src/alert/alert.ts +107 -0
  79. package/src/alert/defines.ts +11 -0
  80. package/src/alert/index.ts +3 -0
  81. package/src/badge/badge.ts +62 -0
  82. package/src/badge/defines.ts +12 -0
  83. package/src/badge/index.ts +3 -0
  84. package/src/breadcrumb/breadcrumb-item.ts +61 -0
  85. package/src/breadcrumb/breadcrumb.ts +138 -0
  86. package/src/breadcrumb/defines.ts +10 -0
  87. package/src/breadcrumb/index.ts +5 -0
  88. package/src/button/button.ts +147 -0
  89. package/src/button/defines.ts +12 -0
  90. package/src/button/index.ts +3 -0
  91. package/src/button-group/button-group.ts +140 -0
  92. package/src/button-group/index.ts +2 -0
  93. package/src/card/card.ts +57 -0
  94. package/src/card/defines.ts +11 -0
  95. package/src/card/index.ts +3 -0
  96. package/src/checkbox/checkbox.ts +90 -0
  97. package/src/checkbox/defines.ts +1 -0
  98. package/src/checkbox/index.ts +3 -0
  99. package/src/detail/defines.ts +11 -0
  100. package/src/detail/detail.ts +122 -0
  101. package/src/detail/index.ts +3 -0
  102. package/src/dialog/dialog.ts +149 -0
  103. package/src/dialog/index.ts +2 -0
  104. package/src/divider/divider.ts +56 -0
  105. package/src/divider/index.ts +2 -0
  106. package/src/dropdown/defines.ts +13 -0
  107. package/src/dropdown/dropdown-button.ts +130 -0
  108. package/src/dropdown/dropdown-item.ts +136 -0
  109. package/src/dropdown/dropdown.ts +211 -0
  110. package/src/dropdown/index.ts +7 -0
  111. package/src/icon/defines.ts +21 -0
  112. package/src/icon/icon.ts +84 -0
  113. package/src/icon/index.ts +4 -0
  114. package/src/icon/registry.ts +25 -0
  115. package/src/icon-button/icon-button.ts +64 -0
  116. package/src/icon-button/index.ts +2 -0
  117. package/src/index.ts +85 -0
  118. package/src/navbar/defines.ts +11 -0
  119. package/src/navbar/index.ts +3 -0
  120. package/src/navbar/navbar.ts +162 -0
  121. package/src/radio-group/defines.ts +5 -0
  122. package/src/radio-group/index.ts +5 -0
  123. package/src/radio-group/radio-group.ts +227 -0
  124. package/src/radio-group/radio.ts +58 -0
  125. package/src/select/defines.ts +12 -0
  126. package/src/select/index.ts +5 -0
  127. package/src/select/select-option.ts +59 -0
  128. package/src/select/select.ts +387 -0
  129. package/src/slider/defines.ts +33 -0
  130. package/src/slider/index.ts +3 -0
  131. package/src/slider/slider.ts +364 -0
  132. package/src/styles/color.css +117 -0
  133. package/src/styles/components/alert.css +104 -0
  134. package/src/styles/components/badge.css +67 -0
  135. package/src/styles/components/breadcrumb-item.css +59 -0
  136. package/src/styles/components/breadcrumb.css +19 -0
  137. package/src/styles/components/button-group.css +25 -0
  138. package/src/styles/components/button.css +213 -0
  139. package/src/styles/components/card.css +64 -0
  140. package/src/styles/components/checkbox.css +78 -0
  141. package/src/styles/components/detail.css +127 -0
  142. package/src/styles/components/dialog.css +103 -0
  143. package/src/styles/components/divider.css +18 -0
  144. package/src/styles/components/dropdown-item.css +91 -0
  145. package/src/styles/components/dropdown.css +179 -0
  146. package/src/styles/components/icon-button.css +116 -0
  147. package/src/styles/components/icon.css +29 -0
  148. package/src/styles/components/navbar.css +250 -0
  149. package/src/styles/components/radio-group.css +360 -0
  150. package/src/styles/components/select-option.css +43 -0
  151. package/src/styles/components/select.css +222 -0
  152. package/src/styles/components/slider.css +326 -0
  153. package/src/styles/components/switch.css +117 -0
  154. package/src/styles/components/tab-panel.css +8 -0
  155. package/src/styles/components/tab.css +44 -0
  156. package/src/styles/components/tabs.css +16 -0
  157. package/src/styles/components/tag.css +107 -0
  158. package/src/styles/components/text-input.css +110 -0
  159. package/src/styles/layout.css +43 -0
  160. package/src/styles/size.css +7 -0
  161. package/src/styles/variables.css +368 -0
  162. package/src/switch/index.ts +2 -0
  163. package/src/switch/switch.ts +88 -0
  164. package/src/tabs/defines.ts +1 -0
  165. package/src/tabs/index.ts +3 -0
  166. package/src/tabs/tab-panel.ts +23 -0
  167. package/src/tabs/tab.ts +62 -0
  168. package/src/tabs/tabs.ts +134 -0
  169. package/src/tag/defines.ts +12 -0
  170. package/src/tag/index.ts +3 -0
  171. package/src/tag/tag.ts +85 -0
  172. package/src/text-input/index.ts +2 -0
  173. package/src/text-input/text-input.ts +75 -0
  174. package/src/utils.ts +6 -0
@@ -0,0 +1,3 @@
1
+ export { default, default as Tabs } from './tabs';
2
+ export { default as Tab } from './tab';
3
+ export { default as TabPanel } from './tab-panel';
@@ -0,0 +1,11 @@
1
+ import AeicoComponent from '../aeico-component';
2
+ declare class TabPanel extends AeicoComponent {
3
+ protected static styles: string[];
4
+ protected render(): import("aeico-view").RenderResult;
5
+ }
6
+ declare global {
7
+ interface HTMLElementTagNameMap {
8
+ 'ae-tab-panel': TabPanel;
9
+ }
10
+ }
11
+ export default TabPanel;
@@ -0,0 +1,18 @@
1
+ import type { Props } from 'aeico';
2
+ import AeicoComponent from '../aeico-component';
3
+ declare class Tab extends AeicoComponent {
4
+ static props: Props;
5
+ active?: boolean;
6
+ disabled?: boolean;
7
+ panel?: string;
8
+ protected static styles: string[];
9
+ connectedCallback(): void;
10
+ private _handleClick;
11
+ protected render(): import("aeico-view").RenderResult;
12
+ }
13
+ declare global {
14
+ interface HTMLElementTagNameMap {
15
+ 'ae-tab': Tab;
16
+ }
17
+ }
18
+ export default Tab;
@@ -0,0 +1,24 @@
1
+ import type { Props } from 'aeico';
2
+ import AeicoComponent from '../aeico-component';
3
+ declare class Tabs extends AeicoComponent {
4
+ static props: Props;
5
+ activeIndex?: number;
6
+ protected static styles: string[];
7
+ private _observer;
8
+ private get _tabs();
9
+ private get _panels();
10
+ private _getPairs;
11
+ connectedCallback(): void;
12
+ disconnectedCallback(): void;
13
+ protected onUpdated(): void;
14
+ private _handleTabClick;
15
+ private _syncActive;
16
+ selectTab(index: number): void;
17
+ protected render(): import("aeico-view").RenderResult;
18
+ }
19
+ declare global {
20
+ interface HTMLElementTagNameMap {
21
+ 'ae-tabs': Tabs;
22
+ }
23
+ }
24
+ export default Tabs;
@@ -0,0 +1,3 @@
1
+ export type TagColor = 'default' | 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark';
2
+ export type TagVariant = 'filled' | 'outlined' | 'faint' | 'subtle' | 'text';
3
+ export type TagSize = '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg';
@@ -0,0 +1,3 @@
1
+ export { default } from './tag';
2
+ export type { TagProps } from './tag';
3
+ export type { TagColor, TagVariant, TagSize } from './defines';
@@ -0,0 +1,36 @@
1
+ import type { InferProps } from 'aeico';
2
+ import AeicoComponent from '../aeico-component';
3
+ import type { TagColor, TagSize, TagVariant } from './defines';
4
+ /**
5
+ * Tag Component
6
+ *
7
+ * An inline label component with optional dismiss button.
8
+ * Supports the same color, variant, and size options as Button.
9
+ *
10
+ * @example
11
+ * ```html
12
+ * <ae-tag color="primary" variant="faint">Label</ae-tag>
13
+ * <ae-tag color="success" variant="outlined" dismissible>Removable</ae-tag>
14
+ * <ae-tag color="danger" size="sm">
15
+ * <ae-icon slot="start" name="warning"></ae-icon>
16
+ * Error
17
+ * </ae-tag>
18
+ * ```
19
+ */
20
+ declare class Tag extends AeicoComponent {
21
+ protected static styles: string[];
22
+ accessor color: TagColor | undefined;
23
+ accessor variant: TagVariant | undefined;
24
+ accessor size: TagSize | undefined;
25
+ accessor dismissible: boolean;
26
+ accessor disabled: boolean;
27
+ accessor pill: boolean;
28
+ protected render(): import("aeico-view").RenderResult;
29
+ }
30
+ declare global {
31
+ interface HTMLElementTagNameMap {
32
+ 'ae-tag': Tag;
33
+ }
34
+ }
35
+ export default Tag;
36
+ export type TagProps = InferProps<typeof Tag>;
@@ -0,0 +1,2 @@
1
+ export { default, default as TextInput } from './text-input';
2
+ export type { TextInputProps } from './text-input';
@@ -0,0 +1,26 @@
1
+ import AeicoField from '../aeico-field';
2
+ import type { InferProps, Props } from 'aeico';
3
+ declare class TextInput extends AeicoField {
4
+ protected fieldElement: HTMLInputElement | null;
5
+ static tagName: string;
6
+ static props: Props;
7
+ placeholder?: string;
8
+ type?: string;
9
+ protected static styles: string[];
10
+ render(): import("aeico-view").RenderResult;
11
+ /**
12
+ * Update clear button visibility based on input value
13
+ */
14
+ private updateClearButtonVisibility;
15
+ /**
16
+ * Write value to the input element (DOM only)
17
+ */
18
+ protected writeValue(value: string): void;
19
+ }
20
+ declare global {
21
+ interface HTMLElementTagNameMap {
22
+ 'ae-text-input': TextInput;
23
+ }
24
+ }
25
+ export default TextInput;
26
+ export type TextInputProps = InferProps<typeof TextInput>;
@@ -0,0 +1,2 @@
1
+ export declare const SVG_NS = "http://www.w3.org/2000/svg";
2
+ export declare function toKebab(str: string): string;
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "aeico-components",
3
+ "version": "0.1.1",
4
+ "description": "Built-in UI components for the Aeico Web Components framework",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "!dist/*.tsbuildinfo",
19
+ "src"
20
+ ],
21
+ "sideEffects": false,
22
+ "scripts": {
23
+ "build": "vite build && tsc --declaration --emitDeclarationOnly --outDir dist/types -p tsconfig.json",
24
+ "dev": "vite build --watch",
25
+ "dev:example": "vite --config vite.example.config.ts",
26
+ "type-check": "tsc --noEmit",
27
+ "lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
28
+ "lint:fix": "eslint \"src/**/*.ts\" \"test/**/*.ts\" --fix",
29
+ "format": "prettier --write \"src/**/*.ts\"",
30
+ "format:check": "prettier --check \"src/**/*.ts\"",
31
+ "test": "web-test-runner --config web-test-runner.config.mjs",
32
+ "test:watch": "web-test-runner --config web-test-runner.config.mjs --watch",
33
+ "prepublishOnly": "npm run build"
34
+ },
35
+ "keywords": [
36
+ "web-components",
37
+ "custom-elements",
38
+ "ui",
39
+ "components",
40
+ "aeico"
41
+ ],
42
+ "author": "",
43
+ "license": "ISC",
44
+ "dependencies": {
45
+ "aeico": "^0.1.2",
46
+ "aeico-localize": "^0.1.1"
47
+ },
48
+ "devDependencies": {
49
+ "@eslint/js": "^10.0.1",
50
+ "@esm-bundle/chai": "^4.3.4-fix.0",
51
+ "@types/mocha": "^10.0.10",
52
+ "@web/dev-server-esbuild": "^1.0.5",
53
+ "@web/test-runner": "^0.20.2",
54
+ "@web/test-runner-playwright": "^0.11.1",
55
+ "eslint": "^10.1.0",
56
+ "eslint-config-prettier": "^10.1.8",
57
+ "globals": "^16.0.0",
58
+ "prettier": "^3.8.1",
59
+ "typescript": "^5.7.3",
60
+ "typescript-eslint": "^8.57.1",
61
+ "vite": "^6.2.0"
62
+ }
63
+ }
@@ -0,0 +1,17 @@
1
+ import { AeicoElement } from 'aeico';
2
+ import { toKebab } from './utils';
3
+
4
+ const TAG_NAME_PREFIX = 'ae';
5
+
6
+ /**
7
+ * AeicoComponent is the base class for all built-in Aeico components.
8
+ */
9
+ class AeicoComponent extends AeicoElement {
10
+ static register(name?: string) {
11
+ const tagName = name || `${TAG_NAME_PREFIX}-${this.tagName || toKebab(this.name)}`;
12
+
13
+ super.register(tagName);
14
+ }
15
+ }
16
+
17
+ export default AeicoComponent;
@@ -0,0 +1,228 @@
1
+ import type { InferProps, Props, Watchers } from 'aeico';
2
+ import { tags } from 'aeico';
3
+ import AeicoComponent from './aeico-component';
4
+ import { t } from 'aeico-localize';
5
+
6
+ export type FieldAction = 'clear' | 'reset' | 'change';
7
+ export type FieldElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
8
+
9
+ /**
10
+ * Base class for form field components
11
+ *
12
+ * Provides common functionality for field components including:
13
+ * - Theme support
14
+ * - i18n integration (via Localizable mixin)
15
+ * - Reset button management
16
+ * - Value management
17
+ * - Common configuration handling
18
+ */
19
+ class AeicoField<TValue = string> extends AeicoComponent {
20
+ /**
21
+ * Define base field properties (extends AeicoElement properties)
22
+ */
23
+ static props: Props = {
24
+ value: { type: String },
25
+ defaultValue: { type: String },
26
+ resettable: { type: Boolean },
27
+ resetText: { type: String },
28
+ clearable: { type: Boolean },
29
+ clearText: { type: String },
30
+ size: { type: String },
31
+ disabled: { type: Boolean },
32
+ };
33
+
34
+ /**
35
+ * Property watchers
36
+ */
37
+ static watchers: Watchers = {
38
+ disabled: 'onDisabledChanged',
39
+ };
40
+
41
+ /**
42
+ * The underlying form control element (input, select, etc.)
43
+ * Subclasses should set this to their specific element
44
+ */
45
+ protected fieldElement: FieldElement | null = null;
46
+
47
+ protected resetBtn: HTMLButtonElement | null = null;
48
+ protected clearBtn: HTMLButtonElement | null = null;
49
+
50
+ protected readonly boundOnChange = () =>
51
+ this.setValue(this.getValue(), { silent: false, action: 'change' });
52
+
53
+ protected readonly boundOnReset = () => this.onReset();
54
+ protected readonly boundOnClear = () => this.onClear();
55
+
56
+ // Declare reactive properties for TypeScript
57
+ declare value?: TValue;
58
+ declare defaultValue?: TValue | string;
59
+ declare resettable?: boolean;
60
+ declare resetText?: string;
61
+ declare clearable?: boolean;
62
+ declare clearText?: string;
63
+ declare size?: string;
64
+ declare disabled?: boolean;
65
+
66
+ /**
67
+ * Lifecycle: Component connected to DOM
68
+ */
69
+ connectedCallback() {
70
+ super.connectedCallback();
71
+ }
72
+
73
+ /**
74
+ * Lifecycle: Component disconnected from DOM
75
+ */
76
+ disconnectedCallback() {
77
+ super.disconnectedCallback();
78
+ }
79
+
80
+ /**
81
+ * Render action buttons (clear/reset) using this.builder.
82
+ * Must be called from within a build() callback.
83
+ */
84
+ protected renderActionButtons(force: boolean = false) {
85
+ this.renderClearButton(force);
86
+ this.renderResetButton(force);
87
+ }
88
+
89
+ protected renderResetButton(force: boolean = false) {
90
+ const { button } = tags;
91
+
92
+ if (force || this.resettable) {
93
+ this.resetBtn = button({
94
+ className: 'reset-btn',
95
+ textContent: this.resetText || '↺',
96
+ title: t('buttons.reset', '↺'),
97
+ '@click': this.boundOnReset,
98
+ });
99
+ }
100
+ }
101
+
102
+ protected renderClearButton(force: boolean = false) {
103
+ const { button } = tags;
104
+
105
+ if (force || this.clearable) {
106
+ this.clearBtn = button({
107
+ className: 'clear-btn',
108
+ textContent: this.clearText || '✕',
109
+ title: t('buttons.clear', '✕'),
110
+ '@click': this.boundOnClear,
111
+ });
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Watcher for disabled property
117
+ */
118
+ protected onDisabledChanged(newValue: boolean) {
119
+ if (this.fieldElement) {
120
+ (this.fieldElement as HTMLInputElement | HTMLSelectElement).disabled = Boolean(newValue);
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Render the field component
126
+ * Override in subclass to provide custom rendering
127
+ */
128
+ render(): void {
129
+ // Default implementation - subclasses can override
130
+ }
131
+
132
+ /**
133
+ * Get current value from the field element
134
+ * Default implementation returns the value property of fieldElement
135
+ * Override in subclasses if needed (e.g., checkbox uses checked instead of value)
136
+ *
137
+ * @returns Current field value
138
+ */
139
+ protected getValue(): any {
140
+ return this.fieldElement?.value || '';
141
+ }
142
+
143
+ /**
144
+ * Write value to the underlying UI element and sync props
145
+ * Subclasses must override this to update their specific UI element
146
+ *
147
+ * @param _value New value to write to the element
148
+ */
149
+ protected writeValue(_value: any): void {
150
+ // Base implementation - subclasses override
151
+ }
152
+
153
+ /**
154
+ * Get event payload for change events
155
+ * Override in subclasses to customize event data (e.g., { checked, oldChecked } for checkbox)
156
+ *
157
+ * @param value New value
158
+ * @param oldValue Previous value
159
+ * @param action Action type
160
+ * @returns Event payload object
161
+ */
162
+ protected getEventPayload(value: any, oldValue: any, action: FieldAction): Record<string, any> {
163
+ return { value, oldValue, action };
164
+ }
165
+
166
+ /**
167
+ * Update field value programmatically (internal method)
168
+ * Subclasses should provide type-safe public wrappers (e.g., change() method)
169
+ *
170
+ * @param value New value
171
+ * @param options.silent If true, won't emit change event (default: true)
172
+ * @param options.action Action type for the event (default: 'change')
173
+ */
174
+ protected setValue(value: any, options?: { silent?: boolean; action?: FieldAction }): void {
175
+ const oldValue = this.getValue();
176
+
177
+ // Update property value
178
+ this.value = value;
179
+
180
+ // Write to UI element (DOM only)
181
+ this.writeValue(value);
182
+
183
+ // Emit event if not silent
184
+ if (options?.silent === false) {
185
+ const payload = this.getEventPayload(value, oldValue, options.action || 'change');
186
+ this.emit('change', { detail: payload });
187
+ }
188
+ }
189
+
190
+ /**
191
+ * Reset field to specified value or default value
192
+ *
193
+ * @param value Value to reset to, defaults to defaultValue prop
194
+ * @param options.silent If false, will emit reset event (default: true)
195
+ */
196
+ public reset(value?: any, options?: { silent?: boolean }): void {
197
+ const resetValue = value !== undefined ? value : this.defaultValue;
198
+ this.setValue(resetValue, { ...options, action: 'reset' });
199
+ }
200
+
201
+ /**
202
+ * Clear the field value
203
+ *
204
+ * @param options.silent If false, will emit clear event (default: true)
205
+ */
206
+ public clear(options?: { silent?: boolean }): void {
207
+ this.setValue('', { ...options, action: 'clear' });
208
+ }
209
+
210
+ /**
211
+ * Handle clear button click
212
+ * Clears the field and dispatches event
213
+ */
214
+ protected onClear(): void {
215
+ this.clear({ silent: false });
216
+ }
217
+
218
+ /**
219
+ * Handle reset button click
220
+ * Resets to default value and dispatches event
221
+ */
222
+ protected onReset(): void {
223
+ this.reset(undefined, { silent: false });
224
+ }
225
+ }
226
+
227
+ export default AeicoField;
228
+ export type AeicoFieldProps = InferProps<typeof AeicoField>;
@@ -0,0 +1,107 @@
1
+ import type { InferProps, Props } from 'aeico';
2
+ import styleVariables from '../styles/variables.css?inline';
3
+ import colorCSS from '../styles/color.css?inline';
4
+ import alertStyle from '../styles/components/alert.css?inline';
5
+ import AeicoComponent from '../aeico-component';
6
+ import { html } from 'aeico';
7
+ import { t } from 'aeico-localize';
8
+ import type { AlertColor, AlertSize, AlertVariant } from './defines';
9
+
10
+ /**
11
+ * Alert Component
12
+ *
13
+ * A customizable alert/notification component with multiple variants and sizes.
14
+ * Supports dismissible alerts and icon display.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // Using the static create method
19
+ * const alert = Alert.create({
20
+ * variant: 'info',
21
+ * dismissible: true
22
+ * })
23
+ * alert.textContent = 'This is an informational message'
24
+ * document.body.appendChild(alert)
25
+ * ```
26
+ *
27
+ * @example
28
+ * ```html
29
+ * <!-- Using as Web Component -->
30
+ * <ae-alert variant="info">Information message</ae-alert>
31
+ * <ae-alert variant="success" dismissible>Operation successful!</ae-alert>
32
+ * <ae-alert variant="warning" size="sm">Small warning</ae-alert>
33
+ * ```
34
+ */
35
+ class Alert extends AeicoComponent {
36
+ static props: Props = {
37
+ color: { type: String },
38
+ variant: { type: String },
39
+ size: { type: String },
40
+ dismissible: { type: Boolean },
41
+ invisible: { type: Boolean },
42
+ };
43
+
44
+ protected static useStyles = ['alert'];
45
+ protected static styles = [styleVariables, colorCSS, alertStyle];
46
+
47
+ declare color?: AlertColor;
48
+ declare variant?: AlertVariant;
49
+ declare size?: AlertSize;
50
+ declare dismissible?: boolean;
51
+ declare invisible?: boolean;
52
+
53
+ protected render() {
54
+ return html(({ div, slot, button, span }) => {
55
+ div(
56
+ {
57
+ className: 'alert',
58
+ role: 'alert',
59
+ part: 'alert',
60
+ style: { display: this.invisible ? 'none' : '' },
61
+ },
62
+ () => {
63
+ slot();
64
+
65
+ if (this.dismissible) {
66
+ button(
67
+ {
68
+ className: 'alert-close',
69
+ '@click': () => this._handleClose(),
70
+ title: t('alert.close', 'Close alert'),
71
+ },
72
+ () => {
73
+ span({ 'aria-hidden': 'true', textContent: '\u00d7' });
74
+ },
75
+ );
76
+ }
77
+ },
78
+ );
79
+ });
80
+ }
81
+
82
+ show() {
83
+ if (this.invisible) {
84
+ this.invisible = false;
85
+ }
86
+ }
87
+
88
+ hide() {
89
+ this.invisible = true;
90
+ }
91
+
92
+ private _handleClose = () => {
93
+ this.emit('alert-close', { detail: { target: this } });
94
+ this.remove();
95
+ };
96
+ }
97
+
98
+ Alert.register();
99
+
100
+ declare global {
101
+ interface HTMLElementTagNameMap {
102
+ 'ae-alert': Alert;
103
+ }
104
+ }
105
+
106
+ export default Alert;
107
+ export type AlertProps = InferProps<typeof Alert>;
@@ -0,0 +1,11 @@
1
+ export type AlertVariant = 'subtle' | 'faint' | 'filled' | 'outlined';
2
+ export type AlertSize = 'sm' | 'md' | 'lg';
3
+ export type AlertColor =
4
+ | 'primary'
5
+ | 'secondary'
6
+ | 'success'
7
+ | 'danger'
8
+ | 'warning'
9
+ | 'info'
10
+ | 'light'
11
+ | 'dark';
@@ -0,0 +1,3 @@
1
+ export { default, default as Alert } from './alert';
2
+ export type { AlertProps } from './alert';
3
+ export type { AlertColor, AlertSize, AlertVariant } from './defines';
@@ -0,0 +1,62 @@
1
+ import type { InferProps } from 'aeico';
2
+ import styleVariables from '../styles/variables.css?inline';
3
+ import sizeCSS from '../styles/size.css?inline';
4
+ import colorCSS from '../styles/color.css?inline';
5
+ import badgeStyle from '../styles/components/badge.css?inline';
6
+ import AeicoComponent from '../aeico-component';
7
+ import { html } from 'aeico';
8
+ import type { BadgeColor, BadgeSize, BadgeVariant } from './defines';
9
+ import { prop } from 'aeico';
10
+
11
+ /**
12
+ * Badge Component
13
+ *
14
+ * A small inline label for status, category, or count indicators.
15
+ * Supports color, variant, size, and an optional leading/trailing ae-icon slot.
16
+ *
17
+ * @example
18
+ * ```html
19
+ * <ae-badge color="primary">New</ae-badge>
20
+ * <ae-badge variant="outlined" color="success">Active</ae-badge>
21
+ * <ae-badge variant="subtle" color="danger" size="sm">
22
+ * <ae-icon slot="start" name="warning"></ae-icon>
23
+ * Error
24
+ * </ae-badge>
25
+ * ```
26
+ */
27
+ class Badge extends AeicoComponent {
28
+ protected static styles = [styleVariables, sizeCSS, colorCSS, badgeStyle];
29
+
30
+ @prop({ type: String })
31
+ accessor color: BadgeColor = 'default';
32
+
33
+ @prop({ type: String })
34
+ accessor variant: BadgeVariant = 'filled';
35
+
36
+ @prop({ type: String })
37
+ accessor size: BadgeSize = 'md';
38
+
39
+ @prop({ type: Boolean })
40
+ accessor pill: boolean = false;
41
+
42
+ protected render() {
43
+ return html(({ span, slot }) => {
44
+ span({ part: 'badge', className: 'badge' }, () => {
45
+ slot({ name: 'start' });
46
+ slot();
47
+ slot({ name: 'end' });
48
+ });
49
+ });
50
+ }
51
+ }
52
+
53
+ Badge.register();
54
+
55
+ declare global {
56
+ interface HTMLElementTagNameMap {
57
+ 'ae-badge': Badge;
58
+ }
59
+ }
60
+
61
+ export default Badge;
62
+ export type BadgeProps = InferProps<typeof Badge>;
@@ -0,0 +1,12 @@
1
+ export type BadgeColor =
2
+ | 'default'
3
+ | 'primary'
4
+ | 'secondary'
5
+ | 'success'
6
+ | 'danger'
7
+ | 'warning'
8
+ | 'info'
9
+ | 'light'
10
+ | 'dark';
11
+ export type BadgeVariant = 'filled' | 'outlined' | 'faint' | 'subtle' | 'text';
12
+ export type BadgeSize = '3xs' | '2xs' | 'xs' | 'sm' | 'md' | 'lg';
@@ -0,0 +1,3 @@
1
+ export { default, default as Badge } from './badge';
2
+ export type { BadgeProps } from './badge';
3
+ export type { BadgeColor, BadgeSize, BadgeVariant } from './defines';