@ahrowe/ui 0.42.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/CHANGELOG.md +934 -0
  2. package/README.md +11 -10
  3. package/dist/cjs-types/common/accordion/accordion.types.d.ts +17 -2
  4. package/dist/cjs-types/common/actionButtons/actionButtons.types.d.ts +7 -1
  5. package/dist/cjs-types/common/actionIcon/actionIcon.d.ts +1 -1
  6. package/dist/cjs-types/common/actionIcon/actionIcon.types.d.ts +7 -9
  7. package/dist/cjs-types/common/alert/alert.types.d.ts +6 -8
  8. package/dist/cjs-types/common/animatedLogo/animatedLogo.types.d.ts +3 -2
  9. package/dist/cjs-types/common/badge/badge.types.d.ts +10 -6
  10. package/dist/cjs-types/common/button/button.types.d.ts +14 -4
  11. package/dist/cjs-types/common/calendar/calendar.types.d.ts +25 -10
  12. package/dist/cjs-types/common/calendar/components/agendaList/agendaList.d.ts +1 -1
  13. package/dist/cjs-types/common/calendar/components/agendaList/agendaList.types.d.ts +3 -0
  14. package/dist/cjs-types/common/calendar/components/calendarHeader/calendarHeader.d.ts +1 -1
  15. package/dist/cjs-types/common/calendar/components/calendarHeader/calendarHeader.types.d.ts +2 -0
  16. package/dist/cjs-types/common/calendar/components/compactMonth/compactMonth.d.ts +1 -1
  17. package/dist/cjs-types/common/calendar/components/monthView/monthView.d.ts +1 -1
  18. package/dist/cjs-types/common/calendar/components/monthView/monthView.types.d.ts +3 -2
  19. package/dist/cjs-types/common/calendar/components/timeGrid/timeGrid.d.ts +1 -1
  20. package/dist/cjs-types/common/calendar/components/timeGrid/timeGrid.types.d.ts +9 -1
  21. package/dist/cjs-types/common/calendar/dates.d.ts +21 -5
  22. package/dist/cjs-types/common/calendar/format.d.ts +3 -2
  23. package/dist/cjs-types/common/calendar/layout.d.ts +5 -0
  24. package/dist/cjs-types/common/calendar/useNow.d.ts +4 -0
  25. package/dist/cjs-types/common/calendar/view.types.d.ts +9 -2
  26. package/dist/cjs-types/common/card/card.types.d.ts +16 -2
  27. package/dist/cjs-types/common/chip/chip.types.d.ts +10 -5
  28. package/dist/cjs-types/common/copyButton/copyButton.types.d.ts +5 -4
  29. package/dist/cjs-types/common/fab/components/fabBase/fabBase.d.ts +1 -1
  30. package/dist/cjs-types/common/fab/components/fabBase/fabBase.types.d.ts +2 -1
  31. package/dist/cjs-types/common/progressBar/progressBar.d.ts +0 -1
  32. package/dist/cjs-types/common/progressBar/progressBar.types.d.ts +3 -1
  33. package/dist/cjs-types/common/splitButton/splitButton.types.d.ts +4 -1
  34. package/dist/cjs-types/common/styles/tone.d.ts +11 -0
  35. package/dist/cjs-types/common/themeProvider/color.types.d.ts +20 -0
  36. package/dist/cjs-types/common/themeProvider/index.d.ts +2 -0
  37. package/dist/cjs-types/common/themeProvider/theme.types.d.ts +3 -6
  38. package/dist/cjs-types/common/timeline/timeline.types.d.ts +3 -10
  39. package/dist/cjs-types/common/toast/index.d.ts +1 -1
  40. package/dist/cjs-types/common/toast/toast.types.d.ts +7 -3
  41. package/dist/cjs-types/common/types/actions.types.d.ts +1 -1
  42. package/dist/cjs-types/common/utils/dismissClick.d.ts +4 -0
  43. package/dist/cjs-types/common/utils/isDev.d.ts +1 -0
  44. package/dist/esm/common/accordion/accordion.mjs +1 -1
  45. package/dist/esm/common/accordion/accordion.mjs.map +1 -1
  46. package/dist/esm/common/accordion/accordion.module.mjs +1 -1
  47. package/dist/esm/common/accordion/accordion.module.mjs.map +1 -1
  48. package/dist/esm/common/accordion/accordion.types.mjs +1 -1
  49. package/dist/esm/common/accordion/accordion.types.mjs.map +1 -1
  50. package/dist/esm/common/actionButtons/actionButtons.mjs +1 -1
  51. package/dist/esm/common/actionButtons/actionButtons.mjs.map +1 -1
  52. package/dist/esm/common/actionIcon/actionIcon.mjs +1 -1
  53. package/dist/esm/common/actionIcon/actionIcon.mjs.map +1 -1
  54. package/dist/esm/common/actionIcon/actionIcon.module.mjs +1 -1
  55. package/dist/esm/common/actionIcon/actionIcon.module.mjs.map +1 -1
  56. package/dist/esm/common/alert/alert.mjs +1 -1
  57. package/dist/esm/common/alert/alert.mjs.map +1 -1
  58. package/dist/esm/common/alert/alert.module.mjs +1 -1
  59. package/dist/esm/common/alert/alert.module.mjs.map +1 -1
  60. package/dist/esm/common/animatedLogo/animatedLogo.mjs +1 -1
  61. package/dist/esm/common/animatedLogo/animatedLogo.mjs.map +1 -1
  62. package/dist/esm/common/avatar/avatar.mjs +1 -1
  63. package/dist/esm/common/avatar/avatar.mjs.map +1 -1
  64. package/dist/esm/common/badge/badge.mjs +1 -1
  65. package/dist/esm/common/badge/badge.mjs.map +1 -1
  66. package/dist/esm/common/badge/badge.module.mjs +1 -1
  67. package/dist/esm/common/badge/badge.module.mjs.map +1 -1
  68. package/dist/esm/common/badge/badge.types.mjs +1 -1
  69. package/dist/esm/common/badge/badge.types.mjs.map +1 -1
  70. package/dist/esm/common/bodyEnd/bodyEnd.mjs +1 -1
  71. package/dist/esm/common/bodyEnd/bodyEnd.mjs.map +1 -1
  72. package/dist/esm/common/breadcrumb/breadcrumb.mjs +1 -1
  73. package/dist/esm/common/breadcrumb/breadcrumb.mjs.map +1 -1
  74. package/dist/esm/common/breadcrumb/breadcrumb.module.mjs.map +1 -1
  75. package/dist/esm/common/button/button.mjs +1 -1
  76. package/dist/esm/common/button/button.mjs.map +1 -1
  77. package/dist/esm/common/button/button.module.mjs +1 -1
  78. package/dist/esm/common/button/button.module.mjs.map +1 -1
  79. package/dist/esm/common/button/button.types.mjs +1 -1
  80. package/dist/esm/common/button/button.types.mjs.map +1 -1
  81. package/dist/esm/common/calendar/calendar.mjs +1 -1
  82. package/dist/esm/common/calendar/calendar.mjs.map +1 -1
  83. package/dist/esm/common/calendar/calendar.module.mjs.map +1 -1
  84. package/dist/esm/common/calendar/calendar.types.mjs.map +1 -1
  85. package/dist/esm/common/calendar/components/agendaList/agendaList.mjs +1 -1
  86. package/dist/esm/common/calendar/components/agendaList/agendaList.mjs.map +1 -1
  87. package/dist/esm/common/calendar/components/agendaList/agendaList.module.mjs.map +1 -1
  88. package/dist/esm/common/calendar/components/calendarHeader/calendarHeader.mjs +1 -1
  89. package/dist/esm/common/calendar/components/calendarHeader/calendarHeader.mjs.map +1 -1
  90. package/dist/esm/common/calendar/components/calendarHeader/calendarHeader.module.mjs +1 -1
  91. package/dist/esm/common/calendar/components/calendarHeader/calendarHeader.module.mjs.map +1 -1
  92. package/dist/esm/common/calendar/components/compactMonth/compactMonth.mjs +1 -1
  93. package/dist/esm/common/calendar/components/compactMonth/compactMonth.mjs.map +1 -1
  94. package/dist/esm/common/calendar/components/compactMonth/compactMonth.module.mjs +1 -1
  95. package/dist/esm/common/calendar/components/compactMonth/compactMonth.module.mjs.map +1 -1
  96. package/dist/esm/common/calendar/components/monthView/monthView.mjs +1 -1
  97. package/dist/esm/common/calendar/components/monthView/monthView.mjs.map +1 -1
  98. package/dist/esm/common/calendar/components/monthView/monthView.module.mjs +1 -1
  99. package/dist/esm/common/calendar/components/monthView/monthView.module.mjs.map +1 -1
  100. package/dist/esm/common/calendar/components/timeGrid/timeGrid.mjs +1 -1
  101. package/dist/esm/common/calendar/components/timeGrid/timeGrid.mjs.map +1 -1
  102. package/dist/esm/common/calendar/components/timeGrid/timeGrid.module.mjs +1 -1
  103. package/dist/esm/common/calendar/components/timeGrid/timeGrid.module.mjs.map +1 -1
  104. package/dist/esm/common/calendar/dates.mjs +1 -1
  105. package/dist/esm/common/calendar/dates.mjs.map +1 -1
  106. package/dist/esm/common/calendar/format.mjs +1 -1
  107. package/dist/esm/common/calendar/format.mjs.map +1 -1
  108. package/dist/esm/common/calendar/layout.mjs +1 -1
  109. package/dist/esm/common/calendar/layout.mjs.map +1 -1
  110. package/dist/esm/common/calendar/useNow.mjs +2 -0
  111. package/dist/esm/common/calendar/useNow.mjs.map +1 -0
  112. package/dist/esm/common/card/Card.mjs +1 -1
  113. package/dist/esm/common/card/Card.mjs.map +1 -1
  114. package/dist/esm/common/card/CardActions.mjs +1 -1
  115. package/dist/esm/common/card/CardActions.mjs.map +1 -1
  116. package/dist/esm/common/card/CardHeader.mjs.map +1 -1
  117. package/dist/esm/common/card/card.module.mjs +1 -1
  118. package/dist/esm/common/card/card.module.mjs.map +1 -1
  119. package/dist/esm/common/card/card.types.mjs +1 -1
  120. package/dist/esm/common/card/card.types.mjs.map +1 -1
  121. package/dist/esm/common/carousel/carousel.mjs +1 -1
  122. package/dist/esm/common/carousel/carousel.mjs.map +1 -1
  123. package/dist/esm/common/carousel/carousel.module.mjs.map +1 -1
  124. package/dist/esm/common/chip/chip.mjs +1 -1
  125. package/dist/esm/common/chip/chip.mjs.map +1 -1
  126. package/dist/esm/common/chip/chip.module.mjs +1 -1
  127. package/dist/esm/common/chip/chip.module.mjs.map +1 -1
  128. package/dist/esm/common/chip/chip.types.mjs +1 -1
  129. package/dist/esm/common/chip/chip.types.mjs.map +1 -1
  130. package/dist/esm/common/colorPicker/colorPicker.mjs +1 -1
  131. package/dist/esm/common/colorPicker/colorPicker.mjs.map +1 -1
  132. package/dist/esm/common/colorPicker/colorPicker.module.mjs.map +1 -1
  133. package/dist/esm/common/confirmModal/confirmModal.mjs +1 -1
  134. package/dist/esm/common/confirmModal/confirmModal.mjs.map +1 -1
  135. package/dist/esm/common/copyButton/copyButton.mjs +1 -1
  136. package/dist/esm/common/copyButton/copyButton.mjs.map +1 -1
  137. package/dist/esm/common/copyButton/copyButton.module.mjs +1 -1
  138. package/dist/esm/common/copyButton/copyButton.module.mjs.map +1 -1
  139. package/dist/esm/common/errorBoundary/errorBoundary.mjs +2 -2
  140. package/dist/esm/common/errorBoundary/errorBoundary.mjs.map +1 -1
  141. package/dist/esm/common/fab/components/fabBase/fabBase.mjs +1 -1
  142. package/dist/esm/common/fab/components/fabBase/fabBase.mjs.map +1 -1
  143. package/dist/esm/common/fab/fab.mjs +1 -1
  144. package/dist/esm/common/fab/fab.mjs.map +1 -1
  145. package/dist/esm/common/flip/flip.mjs +1 -1
  146. package/dist/esm/common/flip/flip.mjs.map +1 -1
  147. package/dist/esm/common/klipyPicker/klipyPicker.mjs +1 -1
  148. package/dist/esm/common/klipyPicker/klipyPicker.mjs.map +1 -1
  149. package/dist/esm/common/modal/modal.mjs +1 -1
  150. package/dist/esm/common/modal/modal.mjs.map +1 -1
  151. package/dist/esm/common/modal/modal.module.mjs.map +1 -1
  152. package/dist/esm/common/numberInput/numberInput.mjs +1 -1
  153. package/dist/esm/common/numberInput/numberInput.mjs.map +1 -1
  154. package/dist/esm/common/numberInput/numberInput.module.mjs.map +1 -1
  155. package/dist/esm/common/popover/popover.mjs +1 -1
  156. package/dist/esm/common/popover/popover.mjs.map +1 -1
  157. package/dist/esm/common/progressBar/progressBar.mjs +1 -1
  158. package/dist/esm/common/progressBar/progressBar.mjs.map +1 -1
  159. package/dist/esm/common/progressBar/progressBar.module.mjs +1 -1
  160. package/dist/esm/common/progressBar/progressBar.module.mjs.map +1 -1
  161. package/dist/esm/common/roomDrawer/roomDrawer.mjs +1 -1
  162. package/dist/esm/common/roomDrawer/roomDrawer.mjs.map +1 -1
  163. package/dist/esm/common/roomDrawer/roomDrawer.module.mjs.map +1 -1
  164. package/dist/esm/common/sectionHeader/sectionHeader.mjs.map +1 -1
  165. package/dist/esm/common/splitButton/splitButton.mjs +1 -1
  166. package/dist/esm/common/splitButton/splitButton.mjs.map +1 -1
  167. package/dist/esm/common/styles/tone.mjs +4 -0
  168. package/dist/esm/common/styles/tone.mjs.map +1 -0
  169. package/dist/esm/common/styles/tone.module.mjs +2 -0
  170. package/dist/esm/common/styles/tone.module.mjs.map +1 -0
  171. package/dist/esm/common/themeProvider/color.types.mjs +2 -0
  172. package/dist/esm/common/themeProvider/color.types.mjs.map +1 -0
  173. package/dist/esm/common/themeProvider/defaultTheme.mjs +1 -1
  174. package/dist/esm/common/themeProvider/defaultTheme.mjs.map +1 -1
  175. package/dist/esm/common/tilt/tilt.mjs +1 -1
  176. package/dist/esm/common/tilt/tilt.mjs.map +1 -1
  177. package/dist/esm/common/timeInput/timeInput.mjs +1 -1
  178. package/dist/esm/common/timeInput/timeInput.mjs.map +1 -1
  179. package/dist/esm/common/timeline/timeline.mjs +1 -1
  180. package/dist/esm/common/timeline/timeline.mjs.map +1 -1
  181. package/dist/esm/common/timeline/timeline.module.mjs +1 -1
  182. package/dist/esm/common/timeline/timeline.module.mjs.map +1 -1
  183. package/dist/esm/common/timeline/timeline.types.mjs +1 -1
  184. package/dist/esm/common/timeline/timeline.types.mjs.map +1 -1
  185. package/dist/esm/common/timer/timer.mjs +1 -1
  186. package/dist/esm/common/timer/timer.mjs.map +1 -1
  187. package/dist/esm/common/timer/timer.module.mjs +1 -1
  188. package/dist/esm/common/timer/timer.module.mjs.map +1 -1
  189. package/dist/esm/common/toast/toast.mjs +1 -1
  190. package/dist/esm/common/toast/toast.mjs.map +1 -1
  191. package/dist/esm/common/toast/toast.module.mjs +1 -1
  192. package/dist/esm/common/toast/toast.module.mjs.map +1 -1
  193. package/dist/esm/common/toast/toastHost.mjs +1 -1
  194. package/dist/esm/common/toast/toastHost.mjs.map +1 -1
  195. package/dist/esm/common/utils/dismissClick.mjs +2 -0
  196. package/dist/esm/common/utils/dismissClick.mjs.map +1 -0
  197. package/dist/esm/common/utils/isDev.mjs +2 -0
  198. package/dist/esm/common/utils/isDev.mjs.map +1 -0
  199. package/dist/esm/index.mjs +1 -1
  200. package/dist/esm/services/formValidation/FormValidatorGroupWithForm.mjs +1 -1
  201. package/dist/esm/services/formValidation/FormValidatorGroupWithForm.mjs.map +1 -1
  202. package/dist/index.cjs +5 -3
  203. package/dist/index.cjs.map +1 -1
  204. package/dist/style.css +1 -1
  205. package/dist/types/common/accordion/accordion.types.d.ts +17 -2
  206. package/dist/types/common/actionButtons/actionButtons.types.d.ts +7 -1
  207. package/dist/types/common/actionIcon/actionIcon.d.ts +1 -1
  208. package/dist/types/common/actionIcon/actionIcon.types.d.ts +7 -9
  209. package/dist/types/common/alert/alert.types.d.ts +6 -8
  210. package/dist/types/common/animatedLogo/animatedLogo.types.d.ts +3 -2
  211. package/dist/types/common/badge/badge.types.d.ts +10 -6
  212. package/dist/types/common/button/button.types.d.ts +14 -4
  213. package/dist/types/common/calendar/calendar.types.d.ts +25 -10
  214. package/dist/types/common/calendar/components/agendaList/agendaList.d.ts +1 -1
  215. package/dist/types/common/calendar/components/agendaList/agendaList.types.d.ts +3 -0
  216. package/dist/types/common/calendar/components/calendarHeader/calendarHeader.d.ts +1 -1
  217. package/dist/types/common/calendar/components/calendarHeader/calendarHeader.types.d.ts +2 -0
  218. package/dist/types/common/calendar/components/compactMonth/compactMonth.d.ts +1 -1
  219. package/dist/types/common/calendar/components/monthView/monthView.d.ts +1 -1
  220. package/dist/types/common/calendar/components/monthView/monthView.types.d.ts +3 -2
  221. package/dist/types/common/calendar/components/timeGrid/timeGrid.d.ts +1 -1
  222. package/dist/types/common/calendar/components/timeGrid/timeGrid.types.d.ts +9 -1
  223. package/dist/types/common/calendar/dates.d.ts +21 -5
  224. package/dist/types/common/calendar/format.d.ts +3 -2
  225. package/dist/types/common/calendar/layout.d.ts +5 -0
  226. package/dist/types/common/calendar/useNow.d.ts +4 -0
  227. package/dist/types/common/calendar/view.types.d.ts +9 -2
  228. package/dist/types/common/card/card.types.d.ts +16 -2
  229. package/dist/types/common/chip/chip.types.d.ts +10 -5
  230. package/dist/types/common/copyButton/copyButton.types.d.ts +5 -4
  231. package/dist/types/common/fab/components/fabBase/fabBase.d.ts +1 -1
  232. package/dist/types/common/fab/components/fabBase/fabBase.types.d.ts +2 -1
  233. package/dist/types/common/progressBar/progressBar.d.ts +0 -1
  234. package/dist/types/common/progressBar/progressBar.types.d.ts +3 -1
  235. package/dist/types/common/splitButton/splitButton.types.d.ts +4 -1
  236. package/dist/types/common/styles/tone.d.ts +11 -0
  237. package/dist/types/common/themeProvider/color.types.d.ts +20 -0
  238. package/dist/types/common/themeProvider/index.d.ts +2 -0
  239. package/dist/types/common/themeProvider/theme.types.d.ts +3 -6
  240. package/dist/types/common/timeline/timeline.types.d.ts +3 -10
  241. package/dist/types/common/toast/index.d.ts +1 -1
  242. package/dist/types/common/toast/toast.types.d.ts +7 -3
  243. package/dist/types/common/types/actions.types.d.ts +1 -1
  244. package/dist/types/common/utils/dismissClick.d.ts +4 -0
  245. package/dist/types/common/utils/isDev.d.ts +1 -0
  246. package/docs/Accordion.md +74 -5
  247. package/docs/ActionButtons.md +6 -3
  248. package/docs/ActionIcon.md +39 -14
  249. package/docs/Alert.md +27 -17
  250. package/docs/AnimatedLogo.md +1 -1
  251. package/docs/Badge.md +24 -7
  252. package/docs/Button.md +98 -40
  253. package/docs/ButtonGroup.md +18 -18
  254. package/docs/CLAUDE.md +21 -11
  255. package/docs/Calendar.md +35 -17
  256. package/docs/Card.md +53 -14
  257. package/docs/Chip.md +24 -9
  258. package/docs/ConfigProvider.md +3 -3
  259. package/docs/CopyButton.md +6 -5
  260. package/docs/ProgressBar.md +7 -4
  261. package/docs/SectionHeader.md +1 -1
  262. package/docs/SplitButton.md +6 -5
  263. package/docs/ThemeColor.md +103 -0
  264. package/docs/ThemeProvider.md +5 -5
  265. package/docs/Timeline.md +18 -9
  266. package/docs/Toast.md +25 -11
  267. package/package.json +3 -2
  268. package/dist/esm/common/accordion/accordion.plain.module.mjs +0 -2
  269. package/dist/esm/common/accordion/accordion.plain.module.mjs.map +0 -1
  270. package/dist/esm/common/accordion/accordion.primary.module.mjs +0 -2
  271. package/dist/esm/common/accordion/accordion.primary.module.mjs.map +0 -1
  272. package/dist/esm/common/alert/alert.types.mjs +0 -2
  273. package/dist/esm/common/alert/alert.types.mjs.map +0 -1
package/docs/Chip.md CHANGED
@@ -4,20 +4,22 @@
4
4
 
5
5
  **Keywords:** pill
6
6
 
7
- **Import:** `import { Chip, ChipContainer, ChipStyleType } from '@ahrowe/ui'`
7
+ **Import:** `import { Chip, ChipContainer, ChipStyleType, ThemeColor } from '@ahrowe/ui'`
8
8
 
9
- **Style variants:** `ChipStyleType.Default` (default) | `ChipStyleType.Primary` | `ChipStyleType.Info` | `ChipStyleType.Warn` | `ChipStyleType.Error`
9
+ **Styles:** `ChipStyleType.Light` (default) | `ChipStyleType.Filled` | `ChipStyleType.Outlined`, in any `color`: a `ThemeColor` (default `Neutral`) or any CSS colour, see [ThemeColor.md](ThemeColor.md).
10
10
 
11
11
  ```tsx
12
- import { Chip, ChipContainer, ChipStyleType } from '@ahrowe/ui';
12
+ import { Chip, ChipContainer, ChipStyleType, ThemeColor } from '@ahrowe/ui';
13
13
 
14
14
  // Basic chip
15
15
  <Chip text="React" />
16
16
 
17
- // Coloured variants
18
- <Chip text="Primary" styleType={ChipStyleType.Primary} />
19
- <Chip text="Warning" styleType={ChipStyleType.Warn} />
20
- <Chip text="Error" styleType={ChipStyleType.Error} />
17
+ // Colours: a light tint by default
18
+ <Chip text="Warning" color={ThemeColor.Warn} />
19
+ <Chip text="Error" color={ThemeColor.Error} />
20
+
21
+ // A selected filter: filled in the primary colour
22
+ <Chip text="Active" styleType={ChipStyleType.Filled} color={ThemeColor.Primary} onClick={toggle} />
21
23
 
22
24
  // Removable chip
23
25
  <Chip
@@ -47,14 +49,15 @@ import { Chip, ChipContainer, ChipStyleType } from '@ahrowe/ui';
47
49
 
48
50
  **Enums:**
49
51
 
50
- - `ChipStyleType`: `Default` (default) | `Primary` | `Info` | `Warn` | `Error`
52
+ - `ChipStyleType`: `Light` (default) | `Filled` | `Outlined`
51
53
 
52
54
  **ChipProps:**
53
55
 
54
56
  | Prop | Type | Description |
55
57
  |------|------|-------------|
56
58
  | `text` | `string` | Chip label |
57
- | `styleType` | `ChipStyleType` | Colour variant (default `Default`) |
59
+ | `styleType` | `ChipStyleType` | `Light` (default), `Filled` or `Outlined` |
60
+ | `color` | `ColorValue` | A `ThemeColor` (default `Neutral`) or any CSS colour |
58
61
  | `thumbnail` | `string` | Avatar image URL |
59
62
  | `labels.remove` | `string` | Accessible name for the remove button. Default: `'Remove'` |
60
63
  | `showRemoveIcon` | `boolean` | Show × icon |
@@ -70,3 +73,15 @@ import { Chip, ChipContainer, ChipStyleType } from '@ahrowe/ui';
70
73
  **Labels:** `remove` — the text this component renders of its own. Pass `labels` to override any of them, on the component or app-wide through `ConfigProvider`; keys merge individually. Type: `ChipLabels`.
71
74
 
72
75
  **Slots:** `root` `inner` `thumbnail` `text` `removeIcon`
76
+
77
+ ## Migration from colour styles
78
+
79
+ Before 0.43, `ChipStyleType` was a colour, and `Primary` was filled while the others were a light
80
+ tint. Style and colour are now separate props. The old members are gone and TypeScript points at
81
+ each:
82
+
83
+ | Before | After |
84
+ |--------|-------|
85
+ | `styleType={ChipStyleType.Default}` | nothing: `Light` `Neutral` is the default |
86
+ | `styleType={ChipStyleType.Primary}` | `styleType={ChipStyleType.Filled} color={ThemeColor.Primary}` |
87
+ | `styleType={ChipStyleType.Info}` (and `Warn`, `Error`) | `color={ThemeColor.Info}` |
@@ -98,7 +98,7 @@ Each entry is a `Partial<...Props>`, so any of that component's props can be def
98
98
  - **Display:** `Button` · `CopyButton` · `ActionButtons` · `Badge` · `Chip` · `Card` · `SectionHeader` · `Skeleton` · `Accordion` · `Divider` · `Timer` · `WeatherIcon`
99
99
  - **Overlays:** `ConfirmModal` · `Modal` · `CommandPalette` · `Popover`
100
100
  - **Editors:** `RoomDrawer`, `RoomViewer`
101
- - **Scheduling:** `Calendar`, for `labels`, `locale`, `weekStartsOn`, `slotMinutes`, `views`, `hiddenDays` and `scrollToHour` only (see below)
101
+ - **Scheduling:** `Calendar`, for `labels`, `locale`, `weekStartsOn`, `slotMinutes`, `views`, `hiddenDays`, `scrollToHour`, `workingHours` and `showWeekNumbers` only (see below)
102
102
 
103
103
  ```tsx
104
104
  <ConfigProvider
@@ -106,7 +106,7 @@ Each entry is a `Partial<...Props>`, so any of that component's props can be def
106
106
  Input: { alwaysFloatLabel: true },
107
107
  Dropdown: { useMatLabelStyle: true },
108
108
  NumberInput: { decimalScale: 2, thousandSeparator: '.' },
109
- Button: { styleType: ButtonStyleType.Primary },
109
+ Button: { styleType: ButtonStyleType.Filled },
110
110
  Card: { styleType: CardStyleType.Outlined },
111
111
  Skeleton: { animation: SkeletonAnimation.Pulse },
112
112
  }}
@@ -138,6 +138,6 @@ Every string a component renders of its own is set through its `labels` prop, an
138
138
 
139
139
  **Labels merge per key**, unlike every other default here. An instance that overrides one string keeps the provider's translations for the rest, so `<Alert labels={{ dismiss: 'Weg damit' }} />` under the provider above does not lose anything else Alert might have been given. Anything the component does not produce itself, a `title`, a column `label`, a button's children, is already yours and never appears in `labels`.
140
140
 
141
- `ColorPicker` and `VirtualList` appear in `ComponentDefaults` with their labels only: the first is configured elsewhere, the second has generic props that a per-key default map cannot express. `Calendar` is generic too, so its entry is the props that do not depend on the event type: `labels`, `locale`, `weekStartsOn`, `slotMinutes`, `views`, `hiddenDays` and `scrollToHour`. `Toast` is not there at all, because `AhroweProvider`'s `toast` prop is already its app-wide configuration and carries `labels` itself.
141
+ `ColorPicker` and `VirtualList` appear in `ComponentDefaults` with their labels only: the first is configured elsewhere, the second has generic props that a per-key default map cannot express. `Calendar` is generic too, so its entry is the props that do not depend on the event type: `labels`, `locale`, `weekStartsOn`, `slotMinutes`, `views`, `hiddenDays`, `scrollToHour`, `workingHours` and `showWeekNumbers`. `Toast` is not there at all, because `AhroweProvider`'s `toast` prop is already its app-wide configuration and carries `labels` itself.
142
142
 
143
143
  Each component's doc lists its own keys under **Labels:**.
@@ -8,7 +8,7 @@
8
8
  **Types:** `import type { CopyButtonProps, CopyButtonLabels } from '@ahrowe/ui'`
9
9
 
10
10
  ```tsx
11
- import { CopyButton, Input } from '@ahrowe/ui';
11
+ import { CopyButton, Input, ThemeColor, showToast } from '@ahrowe/ui';
12
12
 
13
13
  <span>
14
14
  {invoice.number} <CopyButton value={invoice.number} />
@@ -18,10 +18,10 @@ import { CopyButton, Input } from '@ahrowe/ui';
18
18
  <Input label='API key' value={apiKey} readOnly suffix={<CopyButton value={apiKey} />} />
19
19
 
20
20
  // a toast on success, where the button is not where the user is looking
21
- <CopyButton value={url} onCopy={() => showToast('Link copied', { type: 'success' })} />
21
+ <CopyButton value={url} onCopy={() => showToast('Link copied', { color: ThemeColor.Success })} />
22
22
  ```
23
23
 
24
- After a click the icon rotates into a check (through `AnimatedIcon`, held still under `prefers-reduced-motion`) for `timeout` ms, the accessible name and tooltip read "Copied", and a polite live region announces it, because a swapped icon or a changed `aria-label` alone is not read out. A refused write (an insecure context, a blocked iframe) announces "Could not copy" and calls `onError`; the icon stays as it was. `CopyButton` shows no toast of its own: pass one through `onCopy` / `onError` if you want it.
24
+ It is an [ActionIcon](ActionIcon.md), so it takes the same `styleType` and `color`, and turns `Success` while copied. After a click the icon rotates into a check (through `AnimatedIcon`, held still under `prefers-reduced-motion`) for `timeout` ms, the accessible name and tooltip read "Copied", and a polite live region announces it, because a swapped icon or a changed `aria-label` alone is not read out. A refused write (an insecure context, a blocked iframe) announces "Could not copy" and calls `onError`; the icon stays as it was. `CopyButton` shows no toast of its own: pass one through `onCopy` / `onError` if you want it.
25
25
 
26
26
  The live region is rendered as a sibling of the button, so `CopyButton` returns two elements. It is visually hidden and takes no space.
27
27
 
@@ -35,8 +35,9 @@ The live region is rendered as a sibling of the button, so `CopyButton` returns
35
35
  | `copiedIcon` | `IconDefinition \| ReactElement` | Icon while copied (default `faCheck`) |
36
36
  | `onCopy` | `(value: string) => void` | Called after a successful copy |
37
37
  | `onError` | `() => void` | Called when the clipboard refuses the write. `useClipboard` returns the reason |
38
- | `onClick` | `(event: MouseEvent) => void` | Called on every click, before the copy |
39
- | `ref` | `Ref<HTMLDivElement>` | Ref to the button |
38
+ | `onClick` | `(event: MouseEvent<HTMLButtonElement>) => void` | Called on every click, before the copy |
39
+ | `color` | `ColorValue` | Its colour at rest (default `Neutral`); `Success` while copied |
40
+ | `ref` | `Ref<HTMLButtonElement>` | Ref to the button |
40
41
 
41
42
  **Global defaults:** adopts `ConfigProvider`, e.g. `defaultProps={{ CopyButton: { timeout: 1500 } }}`. See [ConfigProvider.md](ConfigProvider.md).
42
43
 
@@ -7,15 +7,15 @@
7
7
  **Import:** `import { ProgressBar } from '@ahrowe/ui'`
8
8
 
9
9
  ```tsx
10
- import { ProgressBar } from '@ahrowe/ui';
10
+ import { ProgressBar, ThemeColor } from '@ahrowe/ui';
11
11
 
12
12
  // Simple percentage
13
13
  <ProgressBar progress={75} total={100} />
14
14
 
15
- // Single progress with label and custom colour
15
+ // Single progress with label, in a theme colour
16
16
  <ProgressBar
17
17
  total={100}
18
- progress={{ amount: 60, label: 'Used', color: '#6200ea' }}
18
+ progress={{ amount: 60, label: 'Used', color: ThemeColor.Warn }}
19
19
  />
20
20
 
21
21
  // Stacked / segmented bar
@@ -39,9 +39,12 @@ import { ProgressBar } from '@ahrowe/ui';
39
39
  **Progress object:**
40
40
 
41
41
  ```ts
42
- { amount: number; label?: string; color?: string; class?: string }
42
+ { amount: number; label?: string; color?: ColorValue; class?: string }
43
43
  ```
44
44
 
45
+ `color` is a `ThemeColor` or any CSS colour (see [ThemeColor.md](ThemeColor.md)), `--primary-color`
46
+ when unset. A label on a coloured segment is black or white, whichever reads on it.
47
+
45
48
  **Theming:** override theme-wide via `ThemeProvider`'s `variables`, or per instance via `style`; falls back to a built-in default when unset:
46
49
 
47
50
  | Variable | Falls back to |
@@ -77,7 +77,7 @@ import { faFolder, faPen, faTrash } from '@fortawesome/free-solid-svg-icons';
77
77
  interface SectionHeaderAction {
78
78
  title?: string;
79
79
  icon: IconDefinition | ReactElement;
80
- onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
80
+ onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
81
81
  }
82
82
  ```
83
83
 
@@ -9,7 +9,7 @@
9
9
  **Enums:** `import { PopoverAlign } from '@ahrowe/ui'` for `align`.
10
10
 
11
11
  ```tsx
12
- import { SplitButton } from '@ahrowe/ui';
12
+ import { SplitButton, ThemeColor } from '@ahrowe/ui';
13
13
  import type { SplitButtonAction } from '@ahrowe/ui';
14
14
 
15
15
  const actions: SplitButtonAction[] = [
@@ -21,12 +21,12 @@ const actions: SplitButtonAction[] = [
21
21
  Save
22
22
  </SplitButton>
23
23
 
24
- // Destructive style, matching Button's own style variants
24
+ // Destructive, with Button's own style and colour
25
25
  import { ButtonStyleType } from '@ahrowe/ui';
26
26
 
27
27
  <SplitButton
28
28
  actions={[{ id: 'archive', label: 'Archive instead', onClick: () => archive() }]}
29
- styleType={ButtonStyleType.Delete}
29
+ color={ThemeColor.Error}
30
30
  onClick={() => deleteItem()}
31
31
  >
32
32
  Delete
@@ -68,7 +68,8 @@ import { ButtonStyleType } from '@ahrowe/ui';
68
68
  | `children` | `ReactNode` | The primary button's label |
69
69
  | `onClick` | `(event) => void \| Promise<void>` | The primary button's click handler |
70
70
  | `actions` | `SplitButtonAction[]` | Secondary actions shown in the dropdown |
71
- | `styleType` | `ButtonStyleType` | Visual variant, shared by both the primary and trigger button (default `Primary`) |
71
+ | `styleType` | `ButtonStyleType` | Shared by both the primary and trigger button (default `Filled`) |
72
+ | `color` | `ColorValue` | Shared by both buttons (default `Primary`); or any CSS colour, as on Button |
72
73
  | `size` | `ButtonSize` | Size variant, shared by both buttons |
73
74
  | `disabled` | `boolean` | Disables both the primary and trigger button |
74
75
  | `isLoading` | `boolean` | Shows a spinner on the primary button (same as `Button`'s own `isLoading`) |
@@ -76,7 +77,7 @@ import { ButtonStyleType } from '@ahrowe/ui';
76
77
 
77
78
  **`isLoading` vs. `disabled`:** `isLoading` only affects the primary button — the trigger and its menu stay usable while the primary action is in flight, e.g. to cancel via a menu action. To lock the whole control during the async action instead, pass both: `isLoading={isSaving} disabled={isSaving}`. Setting `disabled` also closes the menu if it happened to be open already, and blocks any in-flight click on a menu action.
78
79
 
79
- **Global defaults:** adopts `ConfigProvider`, e.g. `defaultProps={{ SplitButton: { styleType: ButtonStyleType.Default } }}`. See [ConfigProvider.md](ConfigProvider.md).
80
+ **Global defaults:** adopts `ConfigProvider`, e.g. `defaultProps={{ SplitButton: { styleType: ButtonStyleType.Outlined } }}`. See [ConfigProvider.md](ConfigProvider.md).
80
81
 
81
82
  **Keyboard:** the list is a [Menu](Menu.md), so it behaves like one: `↓` `↑` move between actions and skip disabled ones, `Home` and `End` jump to either end, typing a letter jumps to the action that starts with it, `Enter` and `Space` run the focused action, and `Escape` closes and hands the focus back. A click opens the menu without taking the focus, so nothing is marked until you point at an action or press an arrow key; opening with the keyboard focuses the first action straight away. The trigger announces itself as a menu button.
82
83
 
@@ -0,0 +1,103 @@
1
+ # ThemeColor
2
+
3
+ **When to use:** The `color` prop of every component that takes one: the theme's named colours, or any CSS colour of your own.
4
+
5
+ **Keywords:** colour, palette, tone, variant, status, semantic, danger, destructive, brand, custom
6
+
7
+ **Import:** `import { ThemeColor } from '@ahrowe/ui'`
8
+ **Types:** `import type { ColorValue } from '@ahrowe/ui'`
9
+
10
+ Every `color` prop in the library takes the same `ColorValue`: one of the six `ThemeColor`s, or
11
+ any CSS colour. A component's **style** (how much it stands out) is a separate prop, `styleType`,
12
+ so any style works in any colour.
13
+
14
+ ```tsx
15
+ import { Badge, Button, ButtonStyleType, ThemeColor, showToast } from '@ahrowe/ui';
16
+
17
+ <Button styleType={ButtonStyleType.Filled} color={ThemeColor.Error}>Delete</Button>
18
+ <Badge count={3} color={ThemeColor.Success} />
19
+ showToast('Saved', { color: ThemeColor.Success });
20
+
21
+ // Any CSS colour, a theme variable included
22
+ <Button color="var(--brand)">Upgrade</Button>
23
+ <Badge content="Beta" color="#7c3aed" />
24
+ ```
25
+
26
+ **Enums:**
27
+
28
+ - `ThemeColor`: `Primary` | `Neutral` | `Success` | `Info` | `Warn` | `Error`
29
+
30
+ | Colour | Reads | Notes |
31
+ |--------|-------|-------|
32
+ | `Primary` | `--primary-color`, `--text-on-primary`, `--primary-gradient` | The fill paints the gradient when the theme sets one |
33
+ | `Neutral` | the surrounding text colour, `--border-color` | Takes the colour of what it sits on: a close button on an Alert, a toolbar on a primary header. Its fill and tint are see-through mixes of that colour |
34
+ | `Success` | `--success-color` | |
35
+ | `Info` | `--info-color` | |
36
+ | `Warn` | `--warn-color` | |
37
+ | `Error` | `--error-color`, `--text-on-delete` | For destructive actions |
38
+
39
+ **Where it applies:** Button, ActionIcon, CopyButton, SplitButton, ActionButtons (`submitButtonColor`,
40
+ `cancelButtonColor`), Card and its actions, Badge, Chip, Accordion, Alert, Toast, Timeline items, Calendar
41
+ events, ProgressBar segments and AnimatedLogo.
42
+
43
+ **Styles share their names:** where two components offer the same look, it has the same name in
44
+ each one's own `styleType` enum. Each component offers only the ones it can draw.
45
+
46
+ | Style | Looks like | Offered by |
47
+ |-------|------------|------------|
48
+ | `Filled` | a solid fill, text in a contrasting colour | Button, Badge, Chip |
49
+ | `Light` | a light tint of the colour, text in the colour | Button, Badge, Chip, Accordion (its header), Card (its surface, text unchanged) |
50
+ | `Outlined` | a border and text in the colour | Button, Badge, Chip, Accordion, Card (its border, text unchanged) |
51
+ | `Plain` | text in the colour only | Button, ActionIcon, Accordion |
52
+
53
+ Alert, Toast and Timeline have a single look, so they take a `color` and no style.
54
+
55
+ **Which style to use.** Every component offers the same few, so the choice is about emphasis,
56
+ and a page stays consistent when each one means the same everywhere:
57
+
58
+ - `Filled`: the one main action of a region, and counts. At most one `Filled` per region.
59
+ - `Light`: status labels, a selected filter, secondary emphasis.
60
+ - `Outlined`: secondary actions and grouped content. The default for Button and Accordion.
61
+ - `Plain`: tertiary and toolbar actions, close buttons, a disclosure inside text.
62
+
63
+ **How each is drawn.** `Light` is a 22% see-through tint of the colour (8% of the text colour for
64
+ `Neutral`), the same for every colour. Text in the colour (`Light`, `Outlined`, `Plain`) is the
65
+ colour moved a third of the way toward the page's text colour in lightness, keeping its
66
+ saturation: the pure colour is often too faint to read as text, dark red on a dark theme most of
67
+ all. Borders, bars, dots and icons keep the pure colour. Text on a fill is black or white, see
68
+ below.
69
+
70
+ ## A colour of your own
71
+
72
+ Pass any CSS colour. It replaces the theme's colour everywhere the component uses one, including
73
+ the hover tint and the gradient, which a colour of your own does not get:
74
+
75
+ ```tsx
76
+ <Button styleType={ButtonStyleType.Filled} color="var(--brand)">Upgrade</Button>
77
+ ```
78
+
79
+ **Text on a fill** is white wherever it reaches a contrast of 3:1 on the colour, otherwise black,
80
+ which then has at least 7:1: `color="#fde047"` gets black text and `color="#7c3aed"` white. On a
81
+ mid-tone blue that keeps white, which reads better there than black, though it can fall short of
82
+ WCAG's 4.5:1 for small text. It is worked out in CSS from the colour's relative luminance with
83
+ relative colour syntax, so a `var()` that changes with the theme changes its text with it.
84
+ A browser older than Chrome 119 or Firefox 128 gets `--text-on-primary` instead. To choose the
85
+ text yourself, set `color` in the component's `style` or a class. A built-in colour keeps the theme's own `--text-on-primary` or
86
+ `--text-on-delete`; a theme without them gets the same automatic choice.
87
+
88
+ **A value that can never be a colour** (`color="eror"`) logs a warning in development. A `var()`
89
+ cannot be checked until it renders.
90
+
91
+ **For a whole section or the app**, set the default rather than repeating it:
92
+ `defaultProps={{ Button: { color: 'var(--brand)' } }}` on `AhroweProvider`, or on a
93
+ `ConfigProvider` around the section ([ConfigProvider.md](ConfigProvider.md)). A default prop does
94
+ not change with the theme; for a colour that does, give each theme a variable of your own and
95
+ pass that: `color: 'var(--app-button)'`.
96
+
97
+ **A preset**, a fixed mix of props you use repeatedly, is a component in your app:
98
+
99
+ ```tsx
100
+ export function DeleteIconButton(props: ActionIconProps) {
101
+ return <ActionIcon color={ThemeColor.Error} icon={faTrash} {...props} />;
102
+ }
103
+ ```
@@ -148,16 +148,16 @@ Surfaces that honour it:
148
148
 
149
149
  | Component | Surface |
150
150
  |-----------|---------|
151
- | `Button` | primary style |
152
- | `Chip` | primary style |
151
+ | `Button` | `Filled` `Primary` |
152
+ | `Chip` | `Filled` `Primary` |
153
153
  | `ProgressBar` | fill |
154
154
  | `Switch` | checked track |
155
155
  | `Slider` | filled range |
156
156
  | `Pagination` | active page |
157
157
  | `OptionPicker` | selected option |
158
- | `Badge` | primary style, except the `dot` variant |
159
- | `Alert` | default-style accent border |
160
- | `Toast` | default-style accent border |
158
+ | `Badge` | `Filled` `Primary`, except a `dot` |
159
+ | `Alert` | `Primary` accent border |
160
+ | `Toast` | `Primary` accent border |
161
161
  | `TabHeader` | active tab indicator |
162
162
 
163
163
  Everything else stays flat: focus rings, outlines, icons, primary-coloured text, and small marks
package/docs/Timeline.md CHANGED
@@ -1,25 +1,24 @@
1
1
  # Timeline
2
2
 
3
- **When to use:** A vertical list of dated events, connected by a line, for audit logs, activity feeds, order status history, and deploy logs. Each entry can carry a title, timestamp, description, an icon or status colour, and arbitrary extra content.
3
+ **When to use:** A vertical list of dated events, connected by a line, for audit logs, activity feeds, order status history, and deploy logs. Each entry can carry a title, timestamp, description, an icon or a colour, and arbitrary extra content.
4
4
 
5
5
  **Keywords:** history log
6
6
 
7
- **Import:** `import { Timeline, TimelineAlignment, TimelineItemStatus } from '@ahrowe/ui'`
7
+ **Import:** `import { Timeline, TimelineAlignment, ThemeColor } from '@ahrowe/ui'`
8
8
  **Types:** `import type { TimelineItem, TimelineProps } from '@ahrowe/ui'`
9
9
 
10
10
  **Enums:**
11
11
  - `TimelineAlignment`: `Left` (default) | `Right` | `Alternate`
12
- - `TimelineItemStatus`: `Default` (default) | `Primary` | `Success` | `Warn` | `Error`
13
12
 
14
13
  ```tsx
15
- import { Timeline, TimelineItemStatus } from '@ahrowe/ui';
14
+ import { Timeline, ThemeColor } from '@ahrowe/ui';
16
15
  import type { TimelineItem } from '@ahrowe/ui';
17
16
 
18
17
  const items: TimelineItem[] = [
19
18
  { title: 'Invoice created', description: 'by Jane Doe', timestamp: '09:12' },
20
19
  { title: 'Invoice sent to client', description: 'via email', timestamp: '09:15' },
21
- { title: 'Payment received', status: TimelineItemStatus.Success, timestamp: '2 days later' },
22
- { title: 'Invoice closed', status: TimelineItemStatus.Success, timestamp: 'Today' },
20
+ { title: 'Payment received', color: ThemeColor.Success, timestamp: '2 days later' },
21
+ { title: 'Invoice closed', color: ThemeColor.Success, timestamp: 'Today' },
23
22
  ];
24
23
 
25
24
  // Default: left-aligned line and markers, content to the right
@@ -30,7 +29,7 @@ import { faUserPlus, faCheck } from '@fortawesome/free-solid-svg-icons';
30
29
  <Timeline
31
30
  items={[
32
31
  { title: 'Account created', icon: faUserPlus, timestamp: 'Mon' },
33
- { title: 'Email verified', icon: faCheck, status: TimelineItemStatus.Success, timestamp: 'Wed' },
32
+ { title: 'Email verified', icon: faCheck, color: ThemeColor.Success, timestamp: 'Wed' },
34
33
  ]}
35
34
  />
36
35
 
@@ -88,7 +87,7 @@ function AuditLog() {
88
87
  | `description` | `ReactNode` | Secondary line under the title |
89
88
  | `timestamp` | `ReactNode` | Rendered next to the title, e.g. a date or relative time ("2 hours ago") |
90
89
  | `icon` | `IconDefinition \| ReactElement` | Icon shown in the marker instead of a plain dot — FontAwesome icon or any React element |
91
- | `status` | `TimelineItemStatus` | Semantic marker colour (default `Default`) |
90
+ | `color` | `ColorValue` | The marker's colour: a `ThemeColor` or any CSS colour, see [ThemeColor.md](ThemeColor.md). Unset, it is `--timeline-dot-color` |
92
91
  | `content` | `ReactNode` | Extra content rendered under the description, e.g. a diff, an attachment, an actor avatar |
93
92
  | `onClick` | `(event: MouseEvent<HTMLDivElement>) => void` | Makes the whole entry clickable, rendering it as an accessible button (`role="button"`, focusable, click and Enter both fire it). Omit to render a plain, non-interactive row |
94
93
  | `disabled` | `boolean` | Disables the entry: never clickable, dimmed. Only relevant alongside `onClick` |
@@ -113,7 +112,7 @@ function AuditLog() {
113
112
  | `--timeline-item-gap` | `20px` (vertical gap between entries) |
114
113
  | `--timeline-icon-dot-size` | `28px` (marker size when an entry has `icon`) |
115
114
 
116
- `TimelineItemStatus` values other than `Default` resolve directly to the matching theme colour (`--primary-color`, `--success-color`, `--warn-color`, `--error-color`) rather than a dedicated `--timeline-*` variable, so they always match the rest of the app's semantic colours.
115
+ An entry's `color` replaces `--timeline-dot-color` for that marker, and an icon in it is black or white, whichever reads on the colour. A `ThemeColor` reads the theme's own colour, so it always matches the rest of the app.
117
116
 
118
117
  ```tsx
119
118
  // Theme-wide, via ThemeProvider: thicker line, larger dots
@@ -127,3 +126,13 @@ const theme: Theme = {
127
126
  ```
128
127
 
129
128
  **Slots:** `root` `item` `marker` `dot` `connector` `content` `title` `description` `timestamp`
129
+
130
+ ## Migration from `status`
131
+
132
+ Before 0.43 an entry's marker colour was `status`, typed `TimelineItemStatus`. It is now `color`,
133
+ typed `ColorValue`, and `TimelineItemStatus` is gone:
134
+
135
+ | Before | After |
136
+ |--------|-------|
137
+ | `status: TimelineItemStatus.Default` | nothing: an unset `color` is `--timeline-dot-color` |
138
+ | `status: TimelineItemStatus.Success` (and `Primary`, `Warn`, `Error`) | `color: ThemeColor.Success` |
package/docs/Toast.md CHANGED
@@ -4,8 +4,8 @@
4
4
 
5
5
  **Keywords:** snackbar, notification popup
6
6
 
7
- **Import:** `import { showToast } from '@ahrowe/ui'`
8
- **Types:** `import type { ToastOptions, ToastContextConfig, ToastLabels, ToastType, ToastPosition } from '@ahrowe/ui'`
7
+ **Import:** `import { showToast, ThemeColor } from '@ahrowe/ui'`
8
+ **Types:** `import type { ToastOptions, ToastContextConfig, ToastLabels, ToastPosition, ColorValue } from '@ahrowe/ui'`
9
9
 
10
10
  **Setup:** [AhroweProvider](AhroweProvider.md) shows the toasts. Its `toast` prop sets the defaults for all of them:
11
11
 
@@ -22,16 +22,16 @@ import { AhroweProvider } from '@ahrowe/ui';
22
22
  **Usage:** Call `showToast` anywhere — no component hierarchy required:
23
23
 
24
24
  ```tsx
25
- import { showToast } from '@ahrowe/ui';
25
+ import { showToast, ThemeColor } from '@ahrowe/ui';
26
26
 
27
- // Simple message
27
+ // Simple message, in the primary colour
28
28
  showToast('Profile saved!');
29
29
 
30
- // With type
31
- showToast('Something went wrong.', { type: 'error' });
32
- showToast('3 items updated.', { type: 'info' });
33
- showToast('Your changes were saved.', { type: 'success' });
34
- showToast('Disk space is low.', { type: 'warn' });
30
+ // Semantic colours, each with its own icon
31
+ showToast('Something went wrong.', { color: ThemeColor.Error });
32
+ showToast('3 items updated.', { color: ThemeColor.Info });
33
+ showToast('Your changes were saved.', { color: ThemeColor.Success });
34
+ showToast('Disk space is low.', { color: ThemeColor.Warn });
35
35
 
36
36
  // Persistent (no auto-dismiss)
37
37
  showToast('Processing…', { duration: 0, showCloseButton: true });
@@ -50,7 +50,7 @@ showToast('Copied!', { position: 'top-center', duration: 1500 });
50
50
 
51
51
  // With slot overrides
52
52
  showToast('Done', {
53
- type: 'info',
53
+ color: ThemeColor.Info,
54
54
  classNames: { root: 'my-toast' },
55
55
  styles: { progressBar: { backgroundColor: '#6200ea' } },
56
56
  });
@@ -72,7 +72,7 @@ showToast('Done', {
72
72
 
73
73
  **ToastPosition:** `'top-left'` `'top-center'` `'top-right'` `'bottom-left'` `'bottom-center'` `'bottom-right'`
74
74
 
75
- **ToastType:** `'default'` `'info'` `'success'` `'error'` `'warn'`
75
+ **color:** a `ThemeColor` (default `Primary`) or any CSS colour, see [ThemeColor.md](ThemeColor.md). A `ThemeColor` also picks the icon: a bell for `Primary` and `Neutral`, then info, check, warning and cross; any other colour shows the bell.
76
76
 
77
77
  **Slots:** `root` `icon` `content` `closeButton` `progressBar`
78
78
 
@@ -83,3 +83,17 @@ showToast('Done', {
83
83
  A toast is sized and spaced by its font: the padding, the gap, the body copy, the icon, the close button, the variant accent bar and the progress bar all scale with the theme's text, as does the gap between stacked toasts.
84
84
 
85
85
  Its `min-width` and `max-width` are `em` rather than pixels, so they bound the *measure* — roughly how many characters fit on a line — instead of a fixed width that would grow cramped as the text got larger.
86
+
87
+ ## Migration from `type`
88
+
89
+ Before 0.43 a toast's colour was `type`, a string: `showToast('Saved', { type: 'success' })`. It
90
+ is now `color`, and `ToastType` is gone:
91
+
92
+ | Before | After |
93
+ |--------|-------|
94
+ | `{ type: 'default' }` | nothing: `Primary` is the default, with the same bell |
95
+ | `{ type: 'success' }` (and `'info'`, `'warn'`, `'error'`) | `{ color: ThemeColor.Success }` |
96
+
97
+ The string still works as a value, `{ color: 'success' }`, since a `ThemeColor` is that string.
98
+ `type` itself does not: TypeScript reports it, and in plain JavaScript the toast falls back to the
99
+ primary colour.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahrowe/ui",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "description": "A React UI component library with theming, CSS Modules, and TypeScript support",
5
5
  "keywords": [
6
6
  "agent",
@@ -32,7 +32,8 @@
32
32
  },
33
33
  "files": [
34
34
  "dist",
35
- "docs"
35
+ "docs",
36
+ "CHANGELOG.md"
36
37
  ],
37
38
  "type": "module",
38
39
  "sideEffects": false,
@@ -1,2 +0,0 @@
1
- "use client";var e=`accordion_wkZJf`,t=`accordion-title_-qwNy`,n=`accordion-active_t9-a2`,r=`accordion-header_-oST6`,i=`accordion-header-active_UvKis`,a=`accordion-body_ZagrJ`,o=`accordion-body-inner_HE7PL`,s=`accordion-icon_kHxym`,c=`accordion-icon-active_-L8BH`,l={accordion:e,"accordion-title":`accordion-title_-qwNy`,accordionTitle:t,"accordion-active":`accordion-active_t9-a2`,accordionActive:n,"accordion-header":`accordion-header_-oST6`,accordionHeader:r,"accordion-header-active":`accordion-header-active_UvKis`,accordionHeaderActive:i,"accordion-body":`accordion-body_ZagrJ`,accordionBody:a,"accordion-body-inner":`accordion-body-inner_HE7PL`,accordionBodyInner:o,"accordion-icon":`accordion-icon_kHxym`,accordionIcon:s,"accordion-icon-active":`accordion-icon-active_-L8BH`,accordionIconActive:c};export{e as accordion,n as accordionActive,a as accordionBody,o as accordionBodyInner,r as accordionHeader,i as accordionHeaderActive,s as accordionIcon,c as accordionIconActive,t as accordionTitle,l as default};
2
- //# sourceMappingURL=accordion.plain.module.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"accordion.plain.module.mjs","names":[],"sources":["../../../../package/common/accordion/accordion.plain.module.pcss"],"sourcesContent":[".accordion {\n transition: margin 0.2s;\n margin: -1px;\n\n &-title {\n width: 100%;\n }\n\n &-active {\n margin: 0.625em 0;\n }\n\n &-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n border-radius: var(--default-border-radius);\n font-size: var(--default-font-size);\n font-weight: 400;\n transition: all 0.2s;\n\n &-active {\n border-radius: var(--default-border-radius) var(--default-border-radius) 0 0;\n }\n }\n\n &-body {\n overflow: hidden;\n transition: all 0.2s ease;\n position: relative;\n border-radius: 0 0 var(--default-border-radius) var(--default-border-radius);\n\n &-inner {\n padding: 0;\n }\n }\n\n &-icon {\n transition: transform 0.2s;\n transform: rotate(0deg);\n flex-shrink: 0;\n width: 1em;\n height: 1em;\n color: var(--primary-color);\n\n &-active {\n transform: rotate(180deg);\n }\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .accordion,\n .accordion-header,\n .accordion-body,\n .accordion-icon {\n transition: none;\n }\n}\n"],"mappings":""}
@@ -1,2 +0,0 @@
1
- "use client";var e=`accordion_X64Nz`,t=`accordion-title_2q-FF`,n=`accordion-active_72VwY`,r=`accordion-header_XuGF6`,i=`accordion-header-active_xf8Ch`,a=`accordion-body_0Jsco`,o=`accordion-body-inner_0UBPf`,s=`accordion-body-active_XFSy1`,c=`accordion-icon_W1mz5`,l=`accordion-icon-active_LI98q`,u={accordion:e,"accordion-title":`accordion-title_2q-FF`,accordionTitle:t,"accordion-active":`accordion-active_72VwY`,accordionActive:n,"accordion-header":`accordion-header_XuGF6`,accordionHeader:r,"accordion-header-active":`accordion-header-active_xf8Ch`,accordionHeaderActive:i,"accordion-body":`accordion-body_0Jsco`,accordionBody:a,"accordion-body-inner":`accordion-body-inner_0UBPf`,accordionBodyInner:o,"accordion-body-active":`accordion-body-active_XFSy1`,accordionBodyActive:s,"accordion-icon":`accordion-icon_W1mz5`,accordionIcon:c,"accordion-icon-active":`accordion-icon-active_LI98q`,accordionIconActive:l};export{e as accordion,n as accordionActive,a as accordionBody,s as accordionBodyActive,o as accordionBodyInner,r as accordionHeader,i as accordionHeaderActive,c as accordionIcon,l as accordionIconActive,t as accordionTitle,u as default};
2
- //# sourceMappingURL=accordion.primary.module.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"accordion.primary.module.mjs","names":[],"sources":["../../../../package/common/accordion/accordion.primary.module.pcss"],"sourcesContent":[".accordion {\n transition: margin 0.2s;\n margin: -1px;\n\n &-title {\n width: 100%;\n }\n\n &-active {\n margin: 0.625em 0;\n border: 2px solid var(--primary-color);\n border-radius: var(--default-border-radius);\n }\n\n &-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n /* There is no fixed height any more: the header is this padding plus the title's line. */\n padding: 0.75em 1em;\n cursor: pointer;\n -webkit-tap-highlight-color: transparent;\n background: var(--background);\n border-radius: var(--default-border-radius);\n font-size: var(--default-font-size);\n font-weight: 400;\n transition: all 0.2s;\n\n &-active {\n background: var(--background-accent);\n border-radius: var(--default-border-radius) var(--default-border-radius) 0 0;\n }\n }\n\n &-body {\n overflow: hidden;\n transition: all 0.2s ease;\n position: relative;\n border-radius: 0 0 var(--default-border-radius) var(--default-border-radius);\n border-top: none;\n border-bottom: none;\n\n &-inner {\n padding: 1em;\n }\n\n &-active {\n border-top: none;\n }\n }\n\n &-icon {\n transition: transform 0.2s;\n transform: rotate(0deg);\n flex-shrink: 0;\n width: 1em;\n height: 1em;\n color: var(--primary-color);\n\n &-active {\n transform: rotate(180deg);\n }\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .accordion,\n .accordion-header,\n .accordion-body,\n .accordion-icon {\n transition: none;\n }\n}\n"],"mappings":""}
@@ -1,2 +0,0 @@
1
- "use client";var e=function(e){return e.Default=`default`,e.Info=`info`,e.Success=`success`,e.Warn=`warn`,e.Error=`error`,e}({});export{e as AlertStyleType};
2
- //# sourceMappingURL=alert.types.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alert.types.mjs","names":[],"sources":["../../../../package/common/alert/alert.types.ts"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\nimport type { IconContent } from '../types/icon.types';\nimport type { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types';\n\nexport enum AlertStyleType {\n Default = 'default',\n Info = 'info',\n Success = 'success',\n Warn = 'warn',\n Error = 'error',\n}\n\nexport type AlertSlots = 'root' | 'icon' | 'content' | 'title' | 'description' | 'closeButton';\n\n/** Text Alert renders of its own, for translating it. */\nexport interface AlertLabels {\n /** Close button, read out by screen readers. */\n dismiss?: string;\n}\n\nexport interface AlertProps extends Omit<HtmlProps, 'title'> {\n title?: ReactNode;\n children?: ReactNode;\n styleType?: AlertStyleType;\n icon?: IconContent;\n hideIcon?: boolean;\n onClose?: () => void;\n className?: string;\n style?: CSSProperties;\n classNames?: SlotClassNames<AlertSlots>;\n styles?: SlotStyles<AlertSlots>;\n /** Overrides the text Alert renders of its own. Merged per key. */\n labels?: AlertLabels;\n}\n"],"mappings":"aAIA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,QAAA,UACA,EAAA,KAAA,OACA,EAAA,QAAA,UACA,EAAA,KAAA,OACA,EAAA,MAAA,SACF,EAAA,CAAA,CAAA"}