aeico-components 0.1.4 → 0.1.6

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 (299) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +0 -0
  3. package/dist/chunks/action-button.cjs +296 -0
  4. package/dist/chunks/action-button.cjs.map +1 -0
  5. package/dist/chunks/action-button.js +297 -0
  6. package/dist/chunks/action-button.js.map +1 -0
  7. package/dist/chunks/alert.cjs +4 -4
  8. package/dist/chunks/alert.cjs.map +1 -1
  9. package/dist/chunks/alert.js +5 -5
  10. package/dist/chunks/alert.js.map +1 -1
  11. package/dist/chunks/badge.cjs +1 -1
  12. package/dist/chunks/badge.cjs.map +1 -1
  13. package/dist/chunks/badge.js +2 -2
  14. package/dist/chunks/badge.js.map +1 -1
  15. package/dist/chunks/breadcrumb-item.cjs +2 -2
  16. package/dist/chunks/breadcrumb-item.cjs.map +1 -1
  17. package/dist/chunks/breadcrumb-item.js +3 -3
  18. package/dist/chunks/breadcrumb-item.js.map +1 -1
  19. package/dist/chunks/button-group.cjs +1 -1
  20. package/dist/chunks/button-group.cjs.map +1 -1
  21. package/dist/chunks/button-group.js +2 -2
  22. package/dist/chunks/button-group.js.map +1 -1
  23. package/dist/chunks/button.cjs +12 -15
  24. package/dist/chunks/button.cjs.map +1 -1
  25. package/dist/chunks/button.js +13 -16
  26. package/dist/chunks/button.js.map +1 -1
  27. package/dist/chunks/card.cjs +1 -1
  28. package/dist/chunks/card.cjs.map +1 -1
  29. package/dist/chunks/card.js +2 -2
  30. package/dist/chunks/card.js.map +1 -1
  31. package/dist/chunks/checkbox.cjs +18 -5
  32. package/dist/chunks/checkbox.cjs.map +1 -1
  33. package/dist/chunks/checkbox.js +18 -5
  34. package/dist/chunks/checkbox.js.map +1 -1
  35. package/dist/chunks/copy-button.cjs +168 -0
  36. package/dist/chunks/copy-button.cjs.map +1 -0
  37. package/dist/chunks/copy-button.js +169 -0
  38. package/dist/chunks/copy-button.js.map +1 -0
  39. package/dist/chunks/detail.cjs +7 -4
  40. package/dist/chunks/detail.cjs.map +1 -1
  41. package/dist/chunks/detail.js +8 -5
  42. package/dist/chunks/detail.js.map +1 -1
  43. package/dist/chunks/dialog.cjs +1 -1
  44. package/dist/chunks/dialog.cjs.map +1 -1
  45. package/dist/chunks/dialog.js +2 -2
  46. package/dist/chunks/dialog.js.map +1 -1
  47. package/dist/chunks/divider.cjs +1 -1
  48. package/dist/chunks/divider.cjs.map +1 -1
  49. package/dist/chunks/divider.js +2 -2
  50. package/dist/chunks/divider.js.map +1 -1
  51. package/dist/chunks/drawer.cjs +180 -0
  52. package/dist/chunks/drawer.cjs.map +1 -0
  53. package/dist/chunks/drawer.js +181 -0
  54. package/dist/chunks/drawer.js.map +1 -0
  55. package/dist/chunks/dropdown-button.cjs +2 -2
  56. package/dist/chunks/dropdown-button.cjs.map +1 -1
  57. package/dist/chunks/dropdown-button.js +6 -6
  58. package/dist/chunks/dropdown-button.js.map +1 -1
  59. package/dist/chunks/icon.cjs +31 -1
  60. package/dist/chunks/icon.cjs.map +1 -1
  61. package/dist/chunks/icon.js +32 -2
  62. package/dist/chunks/icon.js.map +1 -1
  63. package/dist/chunks/menu.cjs +396 -0
  64. package/dist/chunks/menu.cjs.map +1 -0
  65. package/dist/chunks/menu.js +397 -0
  66. package/dist/chunks/menu.js.map +1 -0
  67. package/dist/chunks/navbar.cjs +2 -3
  68. package/dist/chunks/navbar.cjs.map +1 -1
  69. package/dist/chunks/navbar.js +3 -4
  70. package/dist/chunks/navbar.js.map +1 -1
  71. package/dist/chunks/pagination.cjs +475 -0
  72. package/dist/chunks/pagination.cjs.map +1 -0
  73. package/dist/chunks/pagination.js +476 -0
  74. package/dist/chunks/pagination.js.map +1 -0
  75. package/dist/chunks/progress-bar.cjs +101 -0
  76. package/dist/chunks/progress-bar.cjs.map +1 -0
  77. package/dist/chunks/progress-bar.js +102 -0
  78. package/dist/chunks/progress-bar.js.map +1 -0
  79. package/dist/chunks/radio.cjs +11 -7
  80. package/dist/chunks/radio.cjs.map +1 -1
  81. package/dist/chunks/radio.js +11 -7
  82. package/dist/chunks/radio.js.map +1 -1
  83. package/dist/chunks/select.cjs +97 -66
  84. package/dist/chunks/select.cjs.map +1 -1
  85. package/dist/chunks/select.js +97 -66
  86. package/dist/chunks/select.js.map +1 -1
  87. package/dist/chunks/slider.cjs +9 -46
  88. package/dist/chunks/slider.cjs.map +1 -1
  89. package/dist/chunks/slider.js +9 -46
  90. package/dist/chunks/slider.js.map +1 -1
  91. package/dist/chunks/spinner.cjs +102 -0
  92. package/dist/chunks/spinner.cjs.map +1 -0
  93. package/dist/chunks/spinner.js +103 -0
  94. package/dist/chunks/spinner.js.map +1 -0
  95. package/dist/chunks/switch.cjs +110 -16
  96. package/dist/chunks/switch.cjs.map +1 -1
  97. package/dist/chunks/switch.js +111 -17
  98. package/dist/chunks/switch.js.map +1 -1
  99. package/dist/chunks/tab-panel.cjs +6 -7
  100. package/dist/chunks/tab-panel.cjs.map +1 -1
  101. package/dist/chunks/tab-panel.js +7 -8
  102. package/dist/chunks/tab-panel.js.map +1 -1
  103. package/dist/chunks/tag.cjs +1 -1
  104. package/dist/chunks/tag.cjs.map +1 -1
  105. package/dist/chunks/tag.js +2 -2
  106. package/dist/chunks/tag.js.map +1 -1
  107. package/dist/chunks/text-input.cjs +11 -16
  108. package/dist/chunks/text-input.cjs.map +1 -1
  109. package/dist/chunks/text-input.js +11 -16
  110. package/dist/chunks/text-input.js.map +1 -1
  111. package/dist/chunks/textarea.cjs +137 -0
  112. package/dist/chunks/textarea.cjs.map +1 -0
  113. package/dist/chunks/textarea.js +138 -0
  114. package/dist/chunks/textarea.js.map +1 -0
  115. package/dist/chunks/tooltip.cjs +293 -0
  116. package/dist/chunks/tooltip.cjs.map +1 -0
  117. package/dist/chunks/tooltip.js +294 -0
  118. package/dist/chunks/tooltip.js.map +1 -0
  119. package/dist/chunks/tree.cjs +468 -0
  120. package/dist/chunks/tree.cjs.map +1 -0
  121. package/dist/chunks/tree.js +469 -0
  122. package/dist/chunks/tree.js.map +1 -0
  123. package/dist/chunks/variables.cjs +2 -2
  124. package/dist/chunks/variables.js +2 -2
  125. package/dist/copy-button.cjs +6 -0
  126. package/dist/copy-button.cjs.map +1 -0
  127. package/dist/copy-button.js +6 -0
  128. package/dist/copy-button.js.map +1 -0
  129. package/dist/drawer.cjs +6 -0
  130. package/dist/drawer.cjs.map +1 -0
  131. package/dist/drawer.js +6 -0
  132. package/dist/drawer.js.map +1 -0
  133. package/dist/dropdown.js +4 -4
  134. package/dist/index.cjs +186 -0
  135. package/dist/index.cjs.map +1 -1
  136. package/dist/index.js +201 -15
  137. package/dist/index.js.map +1 -1
  138. package/dist/menu.cjs +6 -0
  139. package/dist/menu.cjs.map +1 -0
  140. package/dist/menu.js +6 -0
  141. package/dist/menu.js.map +1 -0
  142. package/dist/pagination.cjs +6 -0
  143. package/dist/pagination.cjs.map +1 -0
  144. package/dist/pagination.js +6 -0
  145. package/dist/pagination.js.map +1 -0
  146. package/dist/progress-bar.cjs +6 -0
  147. package/dist/progress-bar.cjs.map +1 -0
  148. package/dist/progress-bar.js +6 -0
  149. package/dist/progress-bar.js.map +1 -0
  150. package/dist/select.cjs +1 -1
  151. package/dist/select.cjs.map +1 -1
  152. package/dist/select.js +2 -2
  153. package/dist/select.js.map +1 -1
  154. package/dist/spinner.cjs +6 -0
  155. package/dist/spinner.cjs.map +1 -0
  156. package/dist/spinner.js +6 -0
  157. package/dist/spinner.js.map +1 -0
  158. package/dist/textarea.cjs +5 -0
  159. package/dist/textarea.cjs.map +1 -0
  160. package/dist/textarea.js +5 -0
  161. package/dist/textarea.js.map +1 -0
  162. package/dist/tooltip.cjs +6 -0
  163. package/dist/tooltip.cjs.map +1 -0
  164. package/dist/tooltip.js +6 -0
  165. package/dist/tooltip.js.map +1 -0
  166. package/dist/tree.cjs +6 -0
  167. package/dist/tree.cjs.map +1 -0
  168. package/dist/tree.js +6 -0
  169. package/dist/tree.js.map +1 -0
  170. package/dist/types/aeico-field.d.ts +57 -5
  171. package/dist/types/alert/alert.d.ts +1 -0
  172. package/dist/types/button/button.d.ts +2 -1
  173. package/dist/types/checkbox/checkbox.d.ts +5 -5
  174. package/dist/types/copy-button/copy-button.d.ts +32 -0
  175. package/dist/types/copy-button/defines.d.ts +1 -0
  176. package/dist/types/copy-button/index.d.ts +3 -0
  177. package/dist/types/detail/defines.d.ts +1 -0
  178. package/dist/types/detail/detail.d.ts +3 -1
  179. package/dist/types/detail/index.d.ts +1 -1
  180. package/dist/types/detail-group/detail-group.d.ts +39 -0
  181. package/dist/types/detail-group/index.d.ts +2 -0
  182. package/dist/types/drawer/defines.d.ts +1 -0
  183. package/dist/types/drawer/drawer.d.ts +31 -0
  184. package/dist/types/drawer/index.d.ts +3 -0
  185. package/dist/types/icon/built-in-icons.d.ts +1 -0
  186. package/dist/types/icon/icon.d.ts +1 -0
  187. package/dist/types/icon/registry.d.ts +8 -0
  188. package/dist/types/index.d.ts +19 -0
  189. package/dist/types/menu/defines.d.ts +15 -0
  190. package/dist/types/menu/index.d.ts +5 -0
  191. package/dist/types/menu/menu-item.d.ts +63 -0
  192. package/dist/types/menu/menu.d.ts +34 -0
  193. package/dist/types/number-input/index.d.ts +2 -0
  194. package/dist/types/number-input/number-input.d.ts +35 -0
  195. package/dist/types/pagination/defines.d.ts +2 -0
  196. package/dist/types/pagination/index.d.ts +3 -0
  197. package/dist/types/pagination/pagination.d.ts +77 -0
  198. package/dist/types/progress-bar/defines.d.ts +1 -0
  199. package/dist/types/progress-bar/index.d.ts +3 -0
  200. package/dist/types/progress-bar/progress-bar.d.ts +37 -0
  201. package/dist/types/radio-group/radio-group.d.ts +1 -1
  202. package/dist/types/select/select.d.ts +3 -3
  203. package/dist/types/spinner/defines.d.ts +3 -0
  204. package/dist/types/spinner/index.d.ts +3 -0
  205. package/dist/types/spinner/spinner.d.ts +35 -0
  206. package/dist/types/switch/defines.d.ts +1 -0
  207. package/dist/types/switch/switch.d.ts +13 -9
  208. package/dist/types/text-input/text-input.d.ts +0 -4
  209. package/dist/types/textarea/index.d.ts +1 -0
  210. package/dist/types/textarea/textarea.d.ts +26 -0
  211. package/dist/types/tooltip/defines.d.ts +2 -0
  212. package/dist/types/tooltip/index.d.ts +4 -0
  213. package/dist/types/tooltip/tooltip.d.ts +48 -0
  214. package/dist/types/tree/defines.d.ts +23 -0
  215. package/dist/types/tree/index.d.ts +5 -0
  216. package/dist/types/tree/tree-item.d.ts +54 -0
  217. package/dist/types/tree/tree.d.ts +64 -0
  218. package/package.json +6 -6
  219. package/src/aeico-field.ts +154 -15
  220. package/src/alert/alert.ts +3 -2
  221. package/src/button/button.ts +11 -13
  222. package/src/checkbox/checkbox.ts +21 -6
  223. package/src/copy-button/copy-button.ts +146 -0
  224. package/src/copy-button/defines.ts +5 -0
  225. package/src/copy-button/index.ts +3 -0
  226. package/src/detail/defines.ts +1 -0
  227. package/src/detail/detail.ts +5 -1
  228. package/src/detail/index.ts +1 -1
  229. package/src/detail-group/detail-group.ts +104 -0
  230. package/src/detail-group/index.ts +2 -0
  231. package/src/drawer/defines.ts +1 -0
  232. package/src/drawer/drawer.ts +157 -0
  233. package/src/drawer/index.ts +3 -0
  234. package/src/icon/built-in-icons.ts +21 -0
  235. package/src/icon/icon.ts +1 -0
  236. package/src/icon/registry.ts +22 -0
  237. package/src/index.ts +32 -0
  238. package/src/menu/defines.ts +17 -0
  239. package/src/menu/index.ts +5 -0
  240. package/src/menu/menu-item.ts +315 -0
  241. package/src/menu/menu.ts +81 -0
  242. package/src/navbar/navbar.ts +1 -3
  243. package/src/number-input/index.ts +2 -0
  244. package/src/number-input/number-input.ts +137 -0
  245. package/src/pagination/defines.ts +2 -0
  246. package/src/pagination/index.ts +3 -0
  247. package/src/pagination/pagination.ts +310 -0
  248. package/src/progress-bar/defines.ts +8 -0
  249. package/src/progress-bar/index.ts +3 -0
  250. package/src/progress-bar/progress-bar.ts +80 -0
  251. package/src/radio-group/radio-group.ts +12 -5
  252. package/src/select/select.ts +112 -71
  253. package/src/slider/slider.ts +9 -2
  254. package/src/spinner/defines.ts +12 -0
  255. package/src/spinner/index.ts +3 -0
  256. package/src/spinner/spinner.ts +81 -0
  257. package/src/styles/components/action-button.css +37 -0
  258. package/src/styles/components/checkbox.css +4 -26
  259. package/src/styles/components/copy-button.css +119 -0
  260. package/src/styles/components/detail-group.css +10 -0
  261. package/src/styles/components/detail.css +10 -1
  262. package/src/styles/components/drawer.css +161 -0
  263. package/src/styles/components/field-label.css +120 -0
  264. package/src/styles/components/menu-item.css +168 -0
  265. package/src/styles/components/menu.css +17 -0
  266. package/src/styles/components/number-input.css +167 -0
  267. package/src/styles/components/pagination.css +205 -0
  268. package/src/styles/components/progress-bar.css +44 -0
  269. package/src/styles/components/radio-group.css +0 -23
  270. package/src/styles/components/select.css +12 -39
  271. package/src/styles/components/slider.css +0 -42
  272. package/src/styles/components/spinner.css +80 -0
  273. package/src/styles/components/switch.css +68 -19
  274. package/src/styles/components/tab-panel.css +1 -1
  275. package/src/styles/components/tabs.css +1 -0
  276. package/src/styles/components/text-input.css +7 -45
  277. package/src/styles/components/textarea.css +75 -0
  278. package/src/styles/components/tooltip.css +103 -0
  279. package/src/styles/components/tree-item.css +152 -0
  280. package/src/styles/components/tree.css +10 -0
  281. package/src/styles/layout.css +457 -25
  282. package/src/switch/defines.ts +1 -0
  283. package/src/switch/switch.ts +65 -16
  284. package/src/tabs/tab.ts +1 -1
  285. package/src/tabs/tabs.ts +1 -2
  286. package/src/text-input/text-input.ts +10 -15
  287. package/src/textarea/index.ts +1 -0
  288. package/src/textarea/textarea.ts +107 -0
  289. package/src/tooltip/defines.ts +11 -0
  290. package/src/tooltip/index.ts +4 -0
  291. package/src/tooltip/tooltip.ts +183 -0
  292. package/src/tree/defines.ts +26 -0
  293. package/src/tree/index.ts +5 -0
  294. package/src/tree/tree-item.ts +258 -0
  295. package/src/tree/tree.ts +237 -0
  296. package/dist/chunks/aeico-field.cjs +0 -179
  297. package/dist/chunks/aeico-field.cjs.map +0 -1
  298. package/dist/chunks/aeico-field.js +0 -180
  299. package/dist/chunks/aeico-field.js.map +0 -1
@@ -0,0 +1,310 @@
1
+ import { html, prop, tags } from 'aeico';
2
+ import type { InferProps } from 'aeico';
3
+ import AeicoComponent from '../aeico-component';
4
+ import styleVariables from '../styles/variables.css?inline';
5
+ import sizeCSS from '../styles/size.css?inline';
6
+ import paginationStyle from '../styles/components/pagination.css?inline';
7
+ import type { PaginationSize, PaginationVariant } from './defines';
8
+ import '../icon/icon';
9
+
10
+ type PageItem = number | 'ellipsis-start' | 'ellipsis-end';
11
+
12
+ /**
13
+ * Pagination component for navigating between pages of content.
14
+ *
15
+ * @prop {number} page - Current page number (1-indexed). Default: 1.
16
+ * @prop {number} pageSize - Number of items per page. Default: 10.
17
+ * @prop {number} total - Total number of items. Used to compute pageCount when pageCount is not set.
18
+ * @prop {number} pageCount - Total number of pages. Overrides total/pageSize calculation when set.
19
+ * @prop {number} siblingCount - Number of page buttons to show on each side of the current page. Default: 1.
20
+ * @prop {'xs'|'sm'|'md'|'lg'} size - Size variant.
21
+ * @prop {boolean} disabled - Disables all interactive controls.
22
+ * @prop {boolean} simple - Simple mode: shows only prev/next buttons and a page number input.
23
+ * @prop {boolean} showFirstLast - Show dedicated first-page and last-page jump buttons.
24
+ * @prop {'borderless'|'link'} variant - Visual variant. `borderless` removes borders; `link` renders page numbers as plain text links with no borders or backgrounds.
25
+ *
26
+ * @event {CustomEvent<{page: number}>} change - Fired when the page changes.
27
+ *
28
+ * @slot prev - Custom content for the previous-page button (default: chevron-left icon).
29
+ * @slot next - Custom content for the next-page button (default: chevron-right icon).
30
+ * @slot first - Custom content for the first-page button (default: chevrons-left icon). Requires showFirstLast.
31
+ * @slot last - Custom content for the last-page button (default: chevrons-right icon). Requires showFirstLast.
32
+ *
33
+ * @csspart root - The outer <nav> element.
34
+ * @csspart prev - The previous-page button.
35
+ * @csspart next - The next-page button.
36
+ * @csspart first - The first-page button (visible when showFirstLast).
37
+ * @csspart last - The last-page button (visible when showFirstLast).
38
+ * @csspart item - A page number button.
39
+ * @csspart ellipsis - An ellipsis span between page groups.
40
+ * @csspart page-input - The page number input in simple mode.
41
+ * @csspart page-total - The "/ N" label in simple mode.
42
+ *
43
+ * @example
44
+ * ```html
45
+ * <ae-pagination total="100" page-size="10" page="1"></ae-pagination>
46
+ * ```
47
+ */
48
+ class Pagination extends AeicoComponent {
49
+ static tagName = 'pagination';
50
+
51
+ protected static styles = [styleVariables, sizeCSS, paginationStyle];
52
+
53
+ @prop({ type: Number })
54
+ accessor page: number = 1;
55
+
56
+ @prop({ type: Number })
57
+ accessor pageSize: number = 10;
58
+
59
+ @prop({ type: Number })
60
+ accessor total: number = 0;
61
+
62
+ @prop({ type: Number })
63
+ accessor pageCount: number | undefined;
64
+
65
+ @prop({ type: Number })
66
+ accessor siblingCount: number = 1;
67
+
68
+ @prop({ type: String })
69
+ accessor size: PaginationSize | undefined;
70
+
71
+ @prop({ type: Boolean })
72
+ accessor disabled: boolean = false;
73
+
74
+ @prop({ type: Boolean })
75
+ accessor simple: boolean = false;
76
+
77
+ @prop({ type: Boolean })
78
+ accessor showFirstLast: boolean = false;
79
+
80
+ @prop({ type: String })
81
+ accessor variant: PaginationVariant | undefined;
82
+
83
+ private _simpleInput: HTMLInputElement | null = null;
84
+
85
+ private get _computedPageCount(): number {
86
+ if (this.pageCount != null) return Math.max(1, this.pageCount);
87
+ const ps = this.pageSize > 0 ? this.pageSize : 10;
88
+ return Math.max(1, Math.ceil(this.total / ps));
89
+ }
90
+
91
+ private get _currentPage(): number {
92
+ const count = this._computedPageCount;
93
+ return Math.max(1, Math.min(this.page ?? 1, count));
94
+ }
95
+
96
+ private _getPageItems(): PageItem[] {
97
+ const count = this._computedPageCount;
98
+ const page = this._currentPage;
99
+ const sc = Math.max(0, this.siblingCount ?? 1);
100
+
101
+ const rangeStart = Math.max(2, page - sc);
102
+ const rangeEnd = Math.min(count - 1, page + sc);
103
+
104
+ const showLeftEllipsis = rangeStart > 2;
105
+ const showRightEllipsis = rangeEnd < count - 1;
106
+
107
+ const items: PageItem[] = [];
108
+
109
+ // First page always shown
110
+ items.push(1);
111
+
112
+ if (count <= 1) return items;
113
+
114
+ // Left side
115
+ if (showLeftEllipsis) {
116
+ items.push('ellipsis-start');
117
+ } else {
118
+ for (let i = 2; i < rangeStart; i++) items.push(i);
119
+ }
120
+
121
+ // Sibling range (bounded to 2..count-1)
122
+ for (let i = rangeStart; i <= rangeEnd; i++) items.push(i);
123
+
124
+ // Right side
125
+ if (showRightEllipsis) {
126
+ items.push('ellipsis-end');
127
+ } else {
128
+ for (let i = rangeEnd + 1; i < count; i++) items.push(i);
129
+ }
130
+
131
+ // Last page always shown
132
+ items.push(count);
133
+
134
+ return items;
135
+ }
136
+
137
+ private _goToPage(page: number): void {
138
+ const count = this._computedPageCount;
139
+ const next = Math.max(1, Math.min(count, page));
140
+ if (next === this._currentPage) return;
141
+ this.page = next;
142
+ this.emit('change', { detail: { page: this.page } });
143
+ }
144
+
145
+ private _handleItemClick = (e: Event): void => {
146
+ const btn = e.currentTarget as HTMLElement;
147
+ const p = Number(btn.dataset.page);
148
+ if (!isNaN(p)) this._goToPage(p);
149
+ };
150
+
151
+ private _handlePrevClick = (): void => {
152
+ this._goToPage(this._currentPage - 1);
153
+ };
154
+ private _handleNextClick = (): void => {
155
+ this._goToPage(this._currentPage + 1);
156
+ };
157
+ private _handleFirstClick = (): void => {
158
+ this._goToPage(1);
159
+ };
160
+ private _handleLastClick = (): void => {
161
+ this._goToPage(this._computedPageCount);
162
+ };
163
+
164
+ private _handleSimpleInputChange = (e: Event): void => {
165
+ const input = e.target as HTMLInputElement;
166
+ const val = parseInt(input.value, 10);
167
+ if (!isNaN(val)) {
168
+ this._goToPage(val);
169
+ }
170
+
171
+ input.value = String(this._currentPage);
172
+ };
173
+
174
+ protected onUpdated(): void {
175
+ if (this._simpleInput) {
176
+ this._simpleInput.value = String(this._currentPage);
177
+ }
178
+ }
179
+
180
+ private _renderNavBtn(
181
+ name: 'first' | 'prev' | 'next' | 'last',
182
+ iconName: string,
183
+ label: string,
184
+ disabled: boolean,
185
+ onClick: () => void,
186
+ ): void {
187
+ const { button, slot, aeIcon } = tags;
188
+
189
+ button(
190
+ {
191
+ key: name,
192
+ part: name,
193
+ className: 'nav-btn',
194
+ disabled,
195
+ 'aria-label': label,
196
+ '@click': onClick,
197
+ },
198
+ () => {
199
+ slot({ name }, () => {
200
+ aeIcon({ name: iconName });
201
+ });
202
+ },
203
+ );
204
+ }
205
+
206
+ private _renderSimpleMode(page: number, count: number, disabled: boolean): void {
207
+ this._simpleInput = tags.input({
208
+ key: 'page-input',
209
+ part: 'page-input',
210
+ type: 'number',
211
+ min: '1',
212
+ max: String(count),
213
+ value: String(page),
214
+ disabled,
215
+ 'aria-label': 'Page number',
216
+ '@change': this._handleSimpleInputChange,
217
+ });
218
+ tags.span({ key: 'page-total', part: 'page-total', textContent: `/ ${count}` });
219
+ }
220
+
221
+ private _renderPageItems(page: number, disabled: boolean): void {
222
+ for (const item of this._getPageItems()) {
223
+ if (item === 'ellipsis-start' || item === 'ellipsis-end') {
224
+ tags.span({
225
+ key: item,
226
+ part: 'ellipsis',
227
+ className: 'ellipsis',
228
+ 'aria-hidden': 'true',
229
+ textContent: '…',
230
+ });
231
+ } else {
232
+ const isActive = item === page;
233
+ tags.button({
234
+ key: `item-${item}`,
235
+ part: isActive ? 'item item-active' : 'item',
236
+ className: isActive ? 'item active' : 'item',
237
+ disabled,
238
+ 'aria-current': isActive ? 'page' : undefined,
239
+ 'aria-label': `Page ${item}`,
240
+ 'data-page': String(item),
241
+ textContent: String(item),
242
+ '@click': this._handleItemClick,
243
+ });
244
+ }
245
+ }
246
+ }
247
+
248
+ protected render() {
249
+ const count = this._computedPageCount;
250
+ const page = this._currentPage;
251
+ const disabled = this.disabled;
252
+ const isFirst = page <= 1;
253
+ const isLast = page >= count;
254
+
255
+ return html(({ nav }) => {
256
+ nav({ part: 'root', role: 'navigation', 'aria-label': 'Pagination' }, () => {
257
+ if (this.showFirstLast)
258
+ this._renderNavBtn(
259
+ 'first',
260
+ 'chevrons-left',
261
+ 'First page',
262
+ disabled || isFirst,
263
+ this._handleFirstClick,
264
+ );
265
+
266
+ this._renderNavBtn(
267
+ 'prev',
268
+ 'chevron-left',
269
+ 'Previous page',
270
+ disabled || isFirst,
271
+ this._handlePrevClick,
272
+ );
273
+
274
+ if (this.simple) {
275
+ this._renderSimpleMode(page, count, disabled);
276
+ } else {
277
+ this._renderPageItems(page, disabled);
278
+ }
279
+
280
+ this._renderNavBtn(
281
+ 'next',
282
+ 'chevron-right',
283
+ 'Next page',
284
+ disabled || isLast,
285
+ this._handleNextClick,
286
+ );
287
+
288
+ if (this.showFirstLast)
289
+ this._renderNavBtn(
290
+ 'last',
291
+ 'chevrons-right',
292
+ 'Last page',
293
+ disabled || isLast,
294
+ this._handleLastClick,
295
+ );
296
+ });
297
+ });
298
+ }
299
+ }
300
+
301
+ Pagination.register();
302
+
303
+ declare global {
304
+ interface HTMLElementTagNameMap {
305
+ 'ae-pagination': Pagination;
306
+ }
307
+ }
308
+
309
+ export default Pagination;
310
+ export type PaginationProps = InferProps<typeof Pagination>;
@@ -0,0 +1,8 @@
1
+ export type ProgressBarColor =
2
+ | 'default'
3
+ | 'primary'
4
+ | 'secondary'
5
+ | 'success'
6
+ | 'danger'
7
+ | 'warning'
8
+ | 'info';
@@ -0,0 +1,3 @@
1
+ export { default, default as ProgressBar } from './progress-bar';
2
+ export type { ProgressBarProps } from './progress-bar';
3
+ export type { ProgressBarColor } from './defines';
@@ -0,0 +1,80 @@
1
+ import type { InferProps } from 'aeico';
2
+ import { html, prop } from 'aeico';
3
+ import AeicoComponent from '../aeico-component';
4
+ import styleVariables from '../styles/variables.css?inline';
5
+ import colorCSS from '../styles/color.css?inline';
6
+ import style from '../styles/components/progress-bar.css?inline';
7
+ import type { ProgressBarColor } from './defines';
8
+
9
+ /**
10
+ * Progress bars show how far along an ongoing operation is as a horizontal fill.
11
+ * Use them for file uploads, multi-step flows, or any task with measurable progress.
12
+ *
13
+ * @prop {number} value - Completion percentage, automatically clamped to 0–100.
14
+ * @prop {string} label - Accessible label applied as `aria-label` on the track.
15
+ * @prop {'default'|'primary'|'secondary'|'success'|'danger'|'warning'|'info'} color
16
+ * - Preset color variant driven by the shared color system.
17
+ * @prop {boolean} animated - When set, overlays a shimmer sweep animation on the bar.
18
+ *
19
+ * @csspart base - The outermost wrapper `<div>`.
20
+ * @csspart track - The background track `<div>`.
21
+ * @csspart bar - The filled progress `<span>`.
22
+ *
23
+ * @cssproperty [--progress-height=8px] - Height of both the track and the bar.
24
+ * @cssproperty [--progress-bar-color=var(--color-solid)] - Fill color of the bar.
25
+ * When set, takes precedence over the `color` prop entirely.
26
+ */
27
+ class ProgressBar extends AeicoComponent {
28
+ static tagName = 'progress-bar';
29
+ protected static styles = [styleVariables, colorCSS, style];
30
+
31
+ @prop({ type: Number })
32
+ accessor value: number = 0;
33
+
34
+ @prop({ type: String })
35
+ accessor label: string = '';
36
+
37
+ @prop({ type: String })
38
+ accessor color: ProgressBarColor = 'primary';
39
+
40
+ @prop({ type: Boolean })
41
+ accessor animated: boolean = false;
42
+
43
+ protected render() {
44
+ const clamped = Math.min(100, Math.max(0, this.value));
45
+
46
+ return html(({ div, span }) => {
47
+ div({ part: 'base' }, () => {
48
+ div(
49
+ {
50
+ part: 'track',
51
+ className: 'progress-track',
52
+ role: 'progressbar',
53
+ 'aria-valuenow': String(clamped),
54
+ 'aria-valuemin': '0',
55
+ 'aria-valuemax': '100',
56
+ ...(this.label ? { 'aria-label': this.label } : {}),
57
+ },
58
+ () => {
59
+ span({
60
+ part: 'bar',
61
+ className: 'progress-bar',
62
+ style: { width: `${clamped}%` },
63
+ });
64
+ },
65
+ );
66
+ });
67
+ });
68
+ }
69
+ }
70
+
71
+ ProgressBar.register();
72
+
73
+ declare global {
74
+ interface HTMLElementTagNameMap {
75
+ 'ae-progress-bar': ProgressBar;
76
+ }
77
+ }
78
+
79
+ export default ProgressBar;
80
+ export type ProgressBarProps = InferProps<typeof ProgressBar>;
@@ -2,13 +2,14 @@
2
2
  import type { InferProps, Props } from 'aeico';
3
3
  import { html, tags } from 'aeico';
4
4
  import type { ButtonColor, ButtonVariant, ButtonSize } from '../button';
5
- import { t } from 'aeico-localize';
6
5
  import type { RadioGroupMode, RadioGroupOption, RadioGroupOptions } from './defines';
7
6
  import Radio from './radio';
8
7
  import style from '../styles/components/radio-group.css?inline';
9
8
  import variables from '../styles/variables.css?inline';
10
9
  import sizeCSS from '../styles/size.css?inline';
11
10
  import colorCSS from '../styles/color.css?inline';
11
+ import fieldLabelCSS from '../styles/components/field-label.css?inline';
12
+ import actionButtonCSS from '../styles/components/action-button.css?inline';
12
13
 
13
14
  class RadioGroup extends AeicoField {
14
15
  protected fieldElement: HTMLInputElement | null = null;
@@ -37,7 +38,7 @@ class RadioGroup extends AeicoField {
37
38
  declare size?: ButtonSize;
38
39
  declare allowEmpty?: boolean;
39
40
 
40
- protected static styles = [variables, sizeCSS, colorCSS, style];
41
+ protected static styles = [variables, sizeCSS, colorCSS, fieldLabelCSS, actionButtonCSS, style];
41
42
 
42
43
  constructor() {
43
44
  super();
@@ -46,7 +47,7 @@ class RadioGroup extends AeicoField {
46
47
 
47
48
  private _optLabel(opt: RadioGroupOption): string {
48
49
  if (opt !== null && typeof opt === 'object') {
49
- return t(String(opt.label), String(opt.label));
50
+ return String(opt.label);
50
51
  }
51
52
  return String(opt);
52
53
  }
@@ -117,7 +118,7 @@ class RadioGroup extends AeicoField {
117
118
  return this.value ?? '';
118
119
  }
119
120
 
120
- protected writeValue(_value: any): void {
121
+ protected writeValue(_value: string): void {
121
122
  // All visual state is driven by builder diff on next render;
122
123
  // for native radio inputs we need to sync checked immediately.
123
124
  // The render() reads this.value, so update handles the rest.
@@ -137,7 +138,9 @@ class RadioGroup extends AeicoField {
137
138
  const current = this.value ?? '';
138
139
 
139
140
  return html(({ div, slot }) => {
140
- div({ className: 'rg-container' }, () => {
141
+ const id = this.getFieldId();
142
+ this.renderLabel(id);
143
+ div({ id, role: 'group', className: 'rg-container field-body' }, () => {
141
144
  if (mode === 'default') {
142
145
  this._renderRadio(opts, current);
143
146
  } else {
@@ -153,6 +156,9 @@ class RadioGroup extends AeicoField {
153
156
  style: { display: 'none' },
154
157
  '@slotchange': () => this._onSlotChange(),
155
158
  });
159
+
160
+ this.renderHelperText();
161
+ this.renderError();
156
162
  });
157
163
  }
158
164
 
@@ -171,6 +177,7 @@ class RadioGroup extends AeicoField {
171
177
  name: this._groupName,
172
178
  value: opt.value,
173
179
  disabled: Boolean(this.disabled) || Boolean(opt.disabled),
180
+ required: Boolean(this.required),
174
181
  '@click': this._boundOnRadioClick,
175
182
  });
176
183
  // Sync DOM property directly — setAttribute('checked') doesn't work