@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
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
- import { ButtonStyleType } from '../../../button/button.types.js';
2
+ import { ButtonProps, ButtonStyleType } from '../../../button/button.types.js';
3
3
  export type FabBaseSize = 'default' | 'mini';
4
4
  export interface FabBaseProps {
5
5
  children?: ReactNode;
@@ -8,5 +8,6 @@ export interface FabBaseProps {
8
8
  /** Forwarded from Fab's `button` slot. */
9
9
  style?: CSSProperties;
10
10
  styleType?: ButtonStyleType;
11
+ color?: ButtonProps['color'];
11
12
  onClick?: () => void;
12
13
  }
@@ -1,5 +1,4 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { ProgressBarProps } from './progressBar.types.js';
3
- export declare function getContrastColor(hexColor: string): string;
4
3
  declare function ProgressBar({ className, total, progress, style, classNames, styles: slotStyles, ...rest }: ProgressBarProps): ReactElement;
5
4
  export default ProgressBar;
@@ -1,8 +1,10 @@
1
1
  import { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types.js';
2
+ import { ColorValue } from '../themeProvider/color.types.js';
2
3
  export interface Progress {
3
4
  amount: number;
4
5
  label?: string;
5
- color?: string;
6
+ /** A `ThemeColor` or any CSS colour; its label is black or white, whichever reads. Default `--primary-color`. */
7
+ color?: ColorValue;
6
8
  class?: string;
7
9
  }
8
10
  export type ProgressBarSlots = 'root' | 'fill' | 'label';
@@ -1,7 +1,7 @@
1
1
  import { PopoverAlign } from '../popover/popover.types.js';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
3
  import { IconContent } from '../types/icon.types.js';
4
- import { ButtonStyleType, ButtonSize } from '../button/button.types.js';
4
+ import { ButtonProps, ButtonStyleType, ButtonSize } from '../button/button.types.js';
5
5
  import { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types.js';
6
6
  export interface SplitButtonAction {
7
7
  id: string;
@@ -20,7 +20,10 @@ export interface SplitButtonProps extends HtmlProps {
20
20
  children?: ReactNode;
21
21
  onClick?: (event: React.MouseEvent<HTMLButtonElement>) => Promise<void> | void;
22
22
  actions: SplitButtonAction[];
23
+ /** Default `Filled`. */
23
24
  styleType?: ButtonStyleType;
25
+ /** A `ThemeColor` or any CSS colour, shared by both buttons (default `Primary`). */
26
+ color?: ButtonProps['color'];
24
27
  size?: ButtonSize;
25
28
  disabled?: boolean;
26
29
  isLoading?: boolean;
@@ -0,0 +1,11 @@
1
+ import { CSSProperties } from 'react';
2
+ import { ColorValue } from '../themeProvider/color.types.js';
3
+ /** The class, and for a colour of the caller's own the inline style, that set the --tone properties. */
4
+ export declare function toneProps(color: ColorValue): {
5
+ className: string;
6
+ style?: CSSProperties;
7
+ };
8
+ /** A colour as a CSS value, for a component that paints it itself rather than through --tone. */
9
+ export declare function cssColor(color: ColorValue): string;
10
+ /** Warns in development about a value that can never be a colour. A var() passes: it only resolves on screen. */
11
+ export declare function useToneCheck(component: string, colors: (ColorValue | undefined)[]): void;
@@ -0,0 +1,20 @@
1
+ /** The theme's named colours, shared by every component that takes a `color`. */
2
+ export declare enum ThemeColor {
3
+ /** `--primary-color`. */
4
+ Primary = "primary",
5
+ /** The surrounding text colour, with `--border-color` for an outline. */
6
+ Neutral = "neutral",
7
+ /** `--success-color`. */
8
+ Success = "success",
9
+ /** `--info-color`. */
10
+ Info = "info",
11
+ /** `--warn-color`. */
12
+ Warn = "warn",
13
+ /** `--error-color`. */
14
+ Error = "error"
15
+ }
16
+ /**
17
+ * A `ThemeColor`, or any CSS colour such as `'var(--brand)'` or `'#7c3aed'`.
18
+ * `string & {}` rather than `string`, which would swallow the enum into one plain string type.
19
+ */
20
+ export type ColorValue = ThemeColor | (string & {});
@@ -1,4 +1,6 @@
1
1
  export { default } from './themeProvider.js';
2
2
  export { defaultTheme } from './defaultTheme.js';
3
3
  export { lightTheme } from './lightTheme.js';
4
+ export { ThemeColor } from './color.types.js';
5
+ export type { ColorValue } from './color.types.js';
4
6
  export type { Theme, ThemeProviderProps, ThemeVariables } from './theme.types.js';
@@ -106,15 +106,10 @@ export interface ThemeVariables {
106
106
  * the device's own safe-area inset where that is larger. Modal sets --modal-padding on its own
107
107
  * panel, so this does not reach a Modal sheet. */
108
108
  '--sheet-safe-padding'?: string;
109
- /** Default-style button background. Falls back to transparent when unset. */
110
- '--button-default-background'?: string;
111
- /** Default-style button text colour. Falls back to --text-color when unset. */
112
- '--button-default-color'?: string;
113
- /** Default-style button border (full `border` shorthand, e.g. `1px solid var(--border-color)`). Falls back to a transparent 1px border when unset. */
114
- '--button-default-border'?: string;
115
109
  '--card-shadow'?: string;
116
110
  '--background-card-elevated'?: string;
117
111
  '--background-card-outlined'?: string;
112
+ /** Surface of a Neutral Light card, named after the old Filled style. Unset, it is the text-colour tint every Light uses; defaultTheme sets --background-accent. */
118
113
  '--background-card-filled'?: string;
119
114
  /** Slider track (unfilled) colour. Falls back to --background-accent-light. */
120
115
  '--slider-track-color'?: string;
@@ -214,6 +209,8 @@ export interface ThemeVariables {
214
209
  '--calendar-now-color'?: string;
215
210
  /** Corner radius of an event. Falls back to 6px. */
216
211
  '--calendar-event-radius'?: string;
212
+ /** The hours outside `workingHours` in the week and day views. Falls back to --background-accent. */
213
+ '--calendar-off-hours-color'?: string;
217
214
  /** Page button size. Falls back to 36px. */
218
215
  '--pagination-size'?: string;
219
216
  /** Gap between page buttons. Falls back to 4px. */
@@ -1,6 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { IconContent } from '../types/icon.types.js';
3
3
  import { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types.js';
4
+ import { ColorValue } from '../themeProvider/color.types.js';
4
5
  /** Layout of entries relative to the connecting line. */
5
6
  export declare enum TimelineAlignment {
6
7
  /** Line and markers on the left, content to the right (the default). */
@@ -10,14 +11,6 @@ export declare enum TimelineAlignment {
10
11
  /** Line down the center, entries alternating left/right. */
11
12
  Alternate = "alternate"
12
13
  }
13
- /** Semantic colour for an entry's marker, matching the theme's status colours. */
14
- export declare enum TimelineItemStatus {
15
- Default = "default",
16
- Primary = "primary",
17
- Success = "success",
18
- Warn = "warn",
19
- Error = "error"
20
- }
21
14
  export type TimelineSlots = 'root' | 'item' | 'marker' | 'dot' | 'connector' | 'content' | 'title' | 'description' | 'timestamp';
22
15
  export interface TimelineItem {
23
16
  /** Stable identity for the entry, used as its React key. Falls back to its array index when omitted; pass one whenever `items` can be reordered or have entries prepended (e.g. a live "newest first" audit log), so React doesn't misattribute row state across the shift. */
@@ -30,8 +23,8 @@ export interface TimelineItem {
30
23
  timestamp?: React.ReactNode;
31
24
  /** Icon shown in the marker instead of a plain dot — a FontAwesome icon or any node. */
32
25
  icon?: IconContent;
33
- /** Semantic marker colour (default `Default`). */
34
- status?: TimelineItemStatus;
26
+ /** The marker's colour: a `ThemeColor` or any CSS colour. Unset, it is `--timeline-dot-color`. */
27
+ color?: ColorValue;
35
28
  /** Extra content rendered under the description, e.g. a diff, an attachment, an actor avatar. */
36
29
  content?: React.ReactNode;
37
30
  /** Makes the whole entry clickable (e.g. to open the full record), rendering it as an accessible button. */
@@ -1,2 +1,2 @@
1
1
  export { showToast } from './toastService.js';
2
- export type { ToastContextConfig, ToastLabels, ToastOptions, ToastType, ToastPosition, ToastSlots, } from './toast.types.js';
2
+ export type { ToastContextConfig, ToastLabels, ToastOptions, ToastPosition, ToastSlots } from './toast.types.js';
@@ -1,7 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SlotClassNames, SlotStyles } from '../types/slots.types.js';
3
+ import { ColorValue } from '../themeProvider/color.types.js';
3
4
  export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
4
- export type ToastType = 'default' | 'info' | 'success' | 'error' | 'warn';
5
5
  export type ToastSlots = 'root' | 'icon' | 'content' | 'closeButton' | 'progressBar';
6
6
  /** Text Toast renders of its own, for translating it. */
7
7
  export interface ToastLabels {
@@ -25,7 +25,11 @@ export interface ToastContextConfig {
25
25
  labels?: ToastLabels;
26
26
  }
27
27
  export interface ToastOptions extends Omit<ToastContextConfig, 'allowStacking'> {
28
- type?: ToastType;
28
+ /**
29
+ * A `ThemeColor` (default `Primary`) or any CSS colour. A ThemeColor also picks the icon; any
30
+ * other colour shows a bell.
31
+ */
32
+ color?: ColorValue;
29
33
  classNames?: SlotClassNames<ToastSlots>;
30
34
  styles?: SlotStyles<ToastSlots>;
31
35
  }
@@ -44,7 +48,7 @@ export interface ResolvedToastOptions {
44
48
  showRemainingTime: boolean;
45
49
  showCloseButton: boolean;
46
50
  pauseOnHover: boolean;
47
- type: ToastType;
51
+ color: ColorValue;
48
52
  classNames?: SlotClassNames<ToastSlots>;
49
53
  styles?: SlotStyles<ToastSlots>;
50
54
  }
@@ -2,6 +2,6 @@ import { IconContent } from './icon.types.js';
2
2
  /** A single icon-triggered action, rendered as an `ActionIcon` */
3
3
  export interface IconAction {
4
4
  title?: string;
5
- onClick?: (e: React.MouseEvent<HTMLDivElement>) => void;
5
+ onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
6
6
  icon: IconContent;
7
7
  }
@@ -0,0 +1,4 @@
1
+ /** Records that the release just dispatched closed an overlay, which marks the click it raises. */
2
+ export declare function markDismiss(): void;
3
+ /** Whether the click `event` ends a press that closed an overlay. */
4
+ export declare function isDismissClick(event: Event): boolean;
@@ -0,0 +1 @@
1
+ export declare function isDev(): boolean;
package/docs/Accordion.md CHANGED
@@ -4,25 +4,60 @@
4
4
 
5
5
  **Keywords:** collapse, dropdown panel
6
6
 
7
- **Import:** `import { Accordion } from '@ahrowe/ui'`
7
+ **Import:** `import { Accordion, AccordionStyleType, ThemeColor } from '@ahrowe/ui'`
8
8
 
9
- **Style variants:** `AccordionStyleType.Default` | `AccordionStyleType.Primary` | `AccordionStyleType.Plain`
9
+ **Styles:** the library's own, meaning what they mean on Button, Badge and Chip, applied to the
10
+ header; `color` is the colour they use (a `ThemeColor`, default `Neutral`, or any CSS colour, see
11
+ [ThemeColor.md](ThemeColor.md)). The body is ordinary text on the page in every style. There is no
12
+ `Filled`: an accordion structures content, and a solid header would compete with the page's main
13
+ action.
14
+
15
+ - `AccordionStyleType.Outlined` (default): a border in the colour, the header's text in the colour
16
+ - `AccordionStyleType.Light`: the header in a light tint of the colour, its text in the colour
17
+ - `AccordionStyleType.Plain`: the header's text in the colour, no chrome and no padding, for a disclosure inside other content
18
+
19
+ Each accordion is one section; render several directly next to each other for a list, without a
20
+ wrapper around each one, and the arrow keys move between their headers. **Neighbours** keep a
21
+ small gap by default. With `joined` they make one block instead: one line between each, in the
22
+ border colour for Outlined and in the page colour for Light, open or closed. Two neighbours join
23
+ only when both are joined.
10
24
 
11
25
  ```tsx
12
- import { Accordion, AccordionStyleType } from '@ahrowe/ui';
26
+ import { Accordion, AccordionStyleType, ThemeColor } from '@ahrowe/ui';
13
27
 
14
28
  // Uncontrolled — manages its own open state
15
29
  <Accordion title="Section title">
16
30
  <p>Content goes here</p>
17
31
  </Accordion>
18
32
 
33
+ // A list of separate sections
34
+ {faqs.map((faq) => (
35
+ <Accordion key={faq.id} title={faq.question}>
36
+ {faq.answer}
37
+ </Accordion>
38
+ ))}
39
+
40
+ // The same list as one bordered control
41
+ {faqs.map((faq) => (
42
+ <Accordion key={faq.id} title={faq.question} joined>
43
+ {faq.answer}
44
+ </Accordion>
45
+ ))}
46
+
47
+ // Headers tinted in the primary colour
48
+ {steps.map((step) => (
49
+ <Accordion key={step.id} title={step.title} styleType={AccordionStyleType.Light} color={ThemeColor.Primary}>
50
+ {step.body}
51
+ </Accordion>
52
+ ))}
53
+
19
54
  // Controlled
20
55
  <Accordion
21
56
  id="section-1"
22
57
  title="Controlled section"
23
58
  expanded={isOpen}
24
59
  onHeaderClicked={(id, isExpanded) => setIsOpen(isExpanded)}
25
- styleType={AccordionStyleType.Primary}
60
+ styleType={AccordionStyleType.Light}
26
61
  >
27
62
  Content
28
63
  </Accordion>
@@ -36,7 +71,9 @@ import { Accordion, AccordionStyleType } from '@ahrowe/ui';
36
71
  | `expanded` | `boolean \| null` | Controlled open state |
37
72
  | `startOpen` | `boolean` | Uncontrolled initial state |
38
73
  | `onHeaderClicked` | `(id, isExpanded) => void` | Toggle callback |
39
- | `styleType` | `AccordionStyleType` | Visual variant |
74
+ | `styleType` | `AccordionStyleType` | `Outlined` (default), `Light` or `Plain` |
75
+ | `color` | `ColorValue` | A `ThemeColor` (default `Neutral`) or any CSS colour |
76
+ | `joined` | `boolean` | Joins the section to joined neighbours into one block. Default `false`: a small gap |
40
77
  | `hideHeader` | `boolean` | Hide the clickable header |
41
78
  | `id` | `string` | Passed back in `onHeaderClicked` |
42
79
 
@@ -49,8 +86,40 @@ a `role="region"` labelled by the header, so a screen reader can move between th
49
86
  An activation key pressed inside the body does not reach the header, so a Space typed into a
50
87
  field in an open section types a space instead of collapsing the section.
51
88
 
89
+ **Arrow keys**, the optional keys of the
90
+ [WAI-ARIA accordion pattern](https://www.w3.org/WAI/ARIA/apg/patterns/accordion/): Down and Up
91
+ move the focus to the next and previous header and wrap at the ends, Home and End to the first and
92
+ last. They move among the accordions rendered beside each other under one parent, so a list nested
93
+ inside a section's body is a set of its own, and a key pressed inside a body stays there.
94
+
95
+ The pattern also wraps each header in a `role="heading"` with an `aria-level` that fits the page;
96
+ this header is not, because only the page knows that level.
97
+
52
98
  **Slots:** `root` `header` `title` `icon` `body` `bodyInner`
53
99
 
54
100
  ## Sizing
55
101
 
56
102
  The header's font, padding and chevron follow `--default-font-size`, as does the body's padding. There is no fixed height: the header is that padding plus one line of text, so a larger base font simply makes it taller.
103
+
104
+ **Theming:** every colour comes from `color`, through the variables listed in
105
+ [ThemeColor.md](ThemeColor.md); in `Neutral` that is the surrounding text colour and a
106
+ `--border-color` outline. The header tints on hover in its own text colour and shows a
107
+ `--focus-border-color` ring inside its edge on keyboard focus.
108
+
109
+ ## Migration from `Default`, `Primary` and `Plain`
110
+
111
+ Before 0.43 the styles were `Default` (bordered sections that moved apart when one opened),
112
+ `Primary` (borderless until open, then framed in `--primary-color`) and `Plain`. The styles are
113
+ now the library's shared ones, and `Default` and `Primary` are gone, so TypeScript points at each
114
+ use:
115
+
116
+ | Before | After |
117
+ |--------|-------|
118
+ | `styleType={AccordionStyleType.Default}` | `joined`: `Outlined` is the default style, and `joined` keeps neighbours in one box |
119
+ | `styleType={AccordionStyleType.Primary}` | `color={ThemeColor.Primary}`: Outlined, bordered in the primary colour |
120
+ | `styleType={AccordionStyleType.Plain}` | unchanged, with a small gap added above its body |
121
+
122
+ An Accordion without `styleType` compiles unchanged and looks different in a list: neighbours
123
+ used to join into one box and now keep a small gap. Add `joined` to every one in the list to keep
124
+ the box, now with square corners at each join; an open one stays in the box instead of moving
125
+ apart from the others.
@@ -7,7 +7,7 @@
7
7
  **Import:** `import { ActionButtons } from '@ahrowe/ui'`
8
8
 
9
9
  ```tsx
10
- import { ActionButtons, ButtonStyleType } from '@ahrowe/ui';
10
+ import { ActionButtons, ThemeColor } from '@ahrowe/ui';
11
11
 
12
12
  <ActionButtons
13
13
  labels={{ submit: 'Save', cancel: 'Discard' }}
@@ -19,7 +19,7 @@ import { ActionButtons, ButtonStyleType } from '@ahrowe/ui';
19
19
  // Destructive action
20
20
  <ActionButtons
21
21
  labels={{ submit: 'Delete' }}
22
- submitButtonStyle={ButtonStyleType.Delete}
22
+ submitButtonColor={ThemeColor.Error}
23
23
  onSubmit={handleDelete}
24
24
  onClose={onClose}
25
25
  />
@@ -41,7 +41,10 @@ import { ActionButtons, ButtonStyleType } from '@ahrowe/ui';
41
41
  | `onClose` | `() => void` | Secondary button click |
42
42
  | `labels.submit` | `ReactNode \| string` | Primary button label |
43
43
  | `labels.cancel` | `ReactNode \| string` | Secondary button label |
44
- | `submitButtonStyle` | `ButtonStyleType` | `Primary` (default), `Delete`, `Default` |
44
+ | `submitButtonStyle` | `ButtonStyleType` | Default `Filled` |
45
+ | `submitButtonColor` | `ColorValue` | Default `Primary`; `Error` for a destructive confirm; or any CSS colour |
46
+ | `cancelButtonStyle` | `ButtonStyleType` | Default `Outlined` |
47
+ | `cancelButtonColor` | `ColorValue` | Default `Primary`; or any CSS colour |
45
48
  | `isSubmitButtonLoading` | `boolean` | Shows spinner on primary button |
46
49
  | `isSubmitButtonDisabled` | `boolean` | |
47
50
  | `isCancelButtonLoading` | `boolean` | |
@@ -1,22 +1,28 @@
1
1
  # ActionIcon
2
2
 
3
- **When to use:** Clickable icon button without a label — toolbar actions, table row actions, icon-only controls.
3
+ **When to use:** Clickable icon button without a label — toolbar actions, table row actions, close buttons, icon-only controls.
4
4
 
5
- **Keywords:** toolbar button
5
+ **Keywords:** toolbar button, icon button, close, ghost
6
6
 
7
7
  **Import:** `import { ActionIcon } from '@ahrowe/ui'`
8
8
 
9
9
  **Requires:** `@fortawesome/free-solid-svg-icons` peer dependency.
10
10
 
11
+ An ActionIcon is a [Button](Button.md) holding only an icon and sized by it: a real `<button>`
12
+ with Button's hover, focus ring and ripple. It takes Button's `styleType` and `color`, plain and
13
+ in the surrounding text colour by default, so it fits whatever it sits on.
14
+
11
15
  ```tsx
12
- import { ActionIcon } from '@ahrowe/ui';
13
- import { faTrash } from '@fortawesome/free-solid-svg-icons';
14
-
15
- <ActionIcon
16
- icon={faTrash}
17
- title="Delete item"
18
- onClick={(e) => handleDelete(e)}
19
- />
16
+ import { ActionIcon, ButtonStyleType, ThemeColor } from '@ahrowe/ui';
17
+ import { faTrash, faXmark } from '@fortawesome/free-solid-svg-icons';
18
+
19
+ <ActionIcon icon={faXmark} aria-label="Close" onClick={onClose} />
20
+
21
+ // A destructive row action
22
+ <ActionIcon icon={faTrash} color={ThemeColor.Error} title="Delete item" onClick={handleDelete} />
23
+
24
+ // Filled, for an action that should stand out
25
+ <ActionIcon icon={faTrash} styleType={ButtonStyleType.Filled} color={ThemeColor.Error} aria-label="Delete" />
20
26
  ```
21
27
 
22
28
  **Key props:**
@@ -24,9 +30,28 @@ import { faTrash } from '@fortawesome/free-solid-svg-icons';
24
30
  | Prop | Type | Description |
25
31
  |------|------|-------------|
26
32
  | `icon` | `IconDefinition \| ReactElement` | FontAwesome icon or any React element (required) |
27
- | `title` | `string` | Tooltip / accessible label |
28
- | `onClick` | `(event: MouseEvent) => void` | Click handler |
29
- | `className` | `string` | Root element class |
30
- | `ref` | `Ref<HTMLDivElement>` | Ref to the root element |
33
+ | `styleType` | `ButtonStyleType` | Default `Plain`; any of Button's styles |
34
+ | `color` | `ColorValue` | A `ThemeColor` (default `Neutral`) or any CSS colour, see [ThemeColor.md](ThemeColor.md) |
35
+ | `title` | `string` | Tooltip. Give an icon-only button an `aria-label` as well |
36
+ | `onClick` | `(event: MouseEvent<HTMLButtonElement>) => void \| Promise<void>` | Click handler |
37
+ | `disabled` | `boolean` | Fades it and blocks clicks |
38
+ | `ref` | `Ref<HTMLButtonElement>` | Ref to the button |
39
+
40
+ Every other Button prop and native `<button>` attribute passes through, except `size`,
41
+ `children` and `isLoading`. The box is the icon plus `4px` on each side; set `width` and `height`
42
+ for a different one.
31
43
 
32
44
  **Slots:** `root` `icon`
45
+
46
+ ## Migration from the div
47
+
48
+ Before 0.43 an ActionIcon was a `div` with a button role and no colour of its own.
49
+
50
+ - **Types:** `ref` is `Ref<HTMLButtonElement>` and `onClick` receives a
51
+ `MouseEvent<HTMLButtonElement>`. A handler annotated with `HTMLDivElement` no longer compiles;
52
+ drop the annotation or change it. The same goes for the `onClick` of Card and SectionHeader
53
+ `actions`, which render ActionIcons.
54
+ - **Layout:** it is inline, like a button, where the div was a block of its own width. In a flex
55
+ row nothing changes; on its own in a block it now sits in the line.
56
+ - **Look:** it has Button's hover tint, focus ring and ripple, where the div only darkened on
57
+ hover. It takes the surrounding text colour as before; a colour of its own is now `color`.
package/docs/Alert.md CHANGED
@@ -4,24 +4,24 @@
4
4
 
5
5
  **Keywords:** warning box
6
6
 
7
- **Import:** `import { Alert, AlertStyleType } from '@ahrowe/ui'`
7
+ **Import:** `import { Alert, ThemeColor } from '@ahrowe/ui'`
8
8
 
9
- **Style variants:** `AlertStyleType.Default` | `AlertStyleType.Info` | `AlertStyleType.Success` | `AlertStyleType.Warn` | `AlertStyleType.Error`
9
+ **Colours:** any `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 `icon`, or the bell.
10
10
 
11
11
  ```tsx
12
- import { Alert, AlertStyleType } from '@ahrowe/ui';
12
+ import { Alert, ThemeColor } from '@ahrowe/ui';
13
13
 
14
- // Default, neutral message
15
- <Alert>A default, neutral message.</Alert>
14
+ // In the primary colour, the default
15
+ <Alert>Here is what changed since your last visit.</Alert>
16
16
 
17
- // Semantic variants
18
- <Alert styleType={AlertStyleType.Info}>Here's something worth knowing.</Alert>
19
- <Alert styleType={AlertStyleType.Success}>Your changes were saved.</Alert>
20
- <Alert styleType={AlertStyleType.Warn}>Your storage is almost full.</Alert>
21
- <Alert styleType={AlertStyleType.Error}>Something went wrong. Please try again.</Alert>
17
+ // Semantic colours
18
+ <Alert color={ThemeColor.Info}>Here's something worth knowing.</Alert>
19
+ <Alert color={ThemeColor.Success}>Your changes were saved.</Alert>
20
+ <Alert color={ThemeColor.Warn}>Your storage is almost full.</Alert>
21
+ <Alert color={ThemeColor.Error}>Something went wrong. Please try again.</Alert>
22
22
 
23
23
  // With a title
24
- <Alert styleType={AlertStyleType.Warn} title="Storage almost full">
24
+ <Alert color={ThemeColor.Warn} title="Storage almost full">
25
25
  You've used 92% of your available space. Free up room or upgrade your plan.
26
26
  </Alert>
27
27
 
@@ -30,7 +30,7 @@ import { Alert, AlertStyleType } from '@ahrowe/ui';
30
30
  const [visible, setVisible] = useState(true);
31
31
  {visible && (
32
32
  <Alert
33
- styleType={AlertStyleType.Info}
33
+ color={ThemeColor.Info}
34
34
  title="New feature available"
35
35
  onClose={() => setVisible(false)}
36
36
  >
@@ -39,13 +39,13 @@ const [visible, setVisible] = useState(true);
39
39
  )}
40
40
 
41
41
  // Without the leading icon
42
- <Alert styleType={AlertStyleType.Success} hideIcon>
42
+ <Alert color={ThemeColor.Success} hideIcon>
43
43
  A minimal message with no leading icon.
44
44
  </Alert>
45
45
 
46
- // Custom icon, overriding the styleType default
46
+ // Custom icon, overriding the colour's own
47
47
  import { faRocket } from '@fortawesome/free-solid-svg-icons';
48
- <Alert styleType={AlertStyleType.Info} icon={faRocket}>
48
+ <Alert color={ThemeColor.Info} icon={faRocket}>
49
49
  Shipping a new release tonight.
50
50
  </Alert>
51
51
  ```
@@ -56,8 +56,8 @@ import { faRocket } from '@fortawesome/free-solid-svg-icons';
56
56
  |------|------|-------------|
57
57
  | `title` | `ReactNode` | Optional bold heading above the description |
58
58
  | `children` | `ReactNode` | The message body |
59
- | `styleType` | `AlertStyleType` | Colour variant and default icon (default `Default`) |
60
- | `icon` | `IconDefinition \| ReactElement` | Overrides the default icon for `styleType` — FontAwesome icon or any React element |
59
+ | `color` | `ColorValue` | A `ThemeColor` (default `Primary`) or any CSS colour; a `ThemeColor` also picks the icon |
60
+ | `icon` | `IconDefinition \| ReactElement` | Overrides the colour's icon — FontAwesome icon or any React element |
61
61
  | `hideIcon` | `boolean` | Hide the leading icon entirely |
62
62
  | `onClose` | `() => void` | Shows a close button and is called when it's clicked. `Alert` doesn't hide itself, so stop rendering it (or update your own state) in the handler |
63
63
 
@@ -70,3 +70,13 @@ import { faRocket } from '@fortawesome/free-solid-svg-icons';
70
70
  ## Sizing
71
71
 
72
72
  Every length in an alert is `em`, so the padding, the icon, the close button and the accent bar keep their ratios to the body copy at any base font.
73
+
74
+ ## Migration from `AlertStyleType`
75
+
76
+ Before 0.43 an Alert's colour was `styleType`, typed `AlertStyleType`. It is now `color`, typed
77
+ `ColorValue`, and `AlertStyleType` is gone, so TypeScript points at every use:
78
+
79
+ | Before | After |
80
+ |--------|-------|
81
+ | `styleType={AlertStyleType.Default}` | nothing: `Primary` is the default, with the same bell |
82
+ | `styleType={AlertStyleType.Info}` (and `Success`, `Warn`, `Error`) | `color={ThemeColor.Info}` |
@@ -49,7 +49,7 @@ import { AnimatedLogo } from '@ahrowe/ui';
49
49
  | `path` | `string` | SVG path `d` data to draw and fill (default: the AhroweUI mark). Multiple subpaths (several `M` commands in one `d`) are supported. |
50
50
  | `viewBox` | `string` | `viewBox` matching `path`'s coordinate space (default: the AhroweUI mark's viewBox) |
51
51
  | `size` | `number \| string` | Width/height of the root `svg` (default `96`) |
52
- | `color` | `string` | Overrides stroke/fill colour (default `var(--primary-color)`) |
52
+ | `color` | `ColorValue` | The stroke and fill: a `ThemeColor` or any CSS colour (default `--primary-color`) |
53
53
  | `duration` | `number` | Length of one draw-fill cycle, in seconds (default `4.2`) |
54
54
  | `loop` | `boolean` | Repeats the draw-fill-retract cycle forever; `false` plays once and holds filled (default `true`) |
55
55
  | `fill` | `boolean` | Fills the interior once drawn; `false` keeps it an outline-only trace (default `true`) |
package/docs/Badge.md CHANGED
@@ -4,14 +4,14 @@
4
4
 
5
5
  **Keywords:** pill
6
6
 
7
- **Import:** `import { Badge, BadgeStyleType, BadgePosition } from '@ahrowe/ui'`
7
+ **Import:** `import { Badge, BadgeStyleType, BadgePosition, ThemeColor } from '@ahrowe/ui'`
8
8
 
9
- **Style variants:** `BadgeStyleType.Default` | `BadgeStyleType.Primary` (default) | `BadgeStyleType.Success` | `BadgeStyleType.Info` | `BadgeStyleType.Warn` | `BadgeStyleType.Error`
9
+ **Styles:** `BadgeStyleType.Filled` (default) | `BadgeStyleType.Light` | `BadgeStyleType.Outlined`, in any `color`: a `ThemeColor` (default `Primary`) or any CSS colour, see [ThemeColor.md](ThemeColor.md). A `dot` is always solid.
10
10
 
11
- **Position (when wrapping `children`):** `BadgePosition.TopRight` (default) | `BadgePosition.TopLeft` | `BadgePosition.BottomRight` | `BadgePosition.BottomLeft`
11
+ **Position (when wrapping `children`):** `BadgePosition.TopRight` (default) | `BadgePosition.TopLeft` | `BadgePosition.BottomRight` | `BadgePosition.BottomLeft`. A badge over its `children` sits on the page colour, so `Light`, `Outlined` and a `Neutral` `Filled` look as they do on the page instead of letting the avatar or icon show through.
12
12
 
13
13
  ```tsx
14
- import { Badge, BadgeStyleType } from '@ahrowe/ui';
14
+ import { Badge, BadgeStyleType, ThemeColor } from '@ahrowe/ui';
15
15
  import { faBell } from '@fortawesome/free-solid-svg-icons';
16
16
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
17
17
 
@@ -25,10 +25,13 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
25
25
  <Badge content="NEW" />
26
26
 
27
27
  // Plain dot, no text
28
- <Badge dot styleType={BadgeStyleType.Error} />
28
+ <Badge dot color={ThemeColor.Error} />
29
+
30
+ // A status label
31
+ <Badge content="Paid" styleType={BadgeStyleType.Light} color={ThemeColor.Success} />
29
32
 
30
33
  // Overlaying an icon
31
- <Badge count={12} styleType={BadgeStyleType.Error}>
34
+ <Badge count={12} color={ThemeColor.Error}>
32
35
  <FontAwesomeIcon icon={faBell} />
33
36
  </Badge>
34
37
 
@@ -47,8 +50,22 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
47
50
  | `content` | `ReactNode` | Custom content overriding the computed `count` text |
48
51
  | `dot` | `boolean` | Render as a plain dot with no text |
49
52
  | `showZero` | `boolean` | Show the badge when `count` is `0` |
50
- | `styleType` | `BadgeStyleType` | Colour variant (default `Primary`) |
53
+ | `styleType` | `BadgeStyleType` | `Filled` (default), `Light` or `Outlined`. Ignored by a `dot` |
54
+ | `color` | `ColorValue` | A `ThemeColor` (default `Primary`) or any CSS colour |
51
55
  | `position` | `BadgePosition` | Corner the badge attaches to when wrapping `children` (default `TopRight`) |
52
56
  | `children` | `ReactNode` | Element the badge overlays. Omit to render the badge inline on its own |
53
57
 
54
58
  **Slots:** `badge`
59
+
60
+ ## Migration from colour styles
61
+
62
+ Before 0.43, `BadgeStyleType` was a colour, and `Primary` was filled while the others were a light
63
+ tint. Style and colour are now separate props, so every colour comes in every style. The old
64
+ members are gone and TypeScript points at each:
65
+
66
+ | Before | After |
67
+ |--------|-------|
68
+ | `styleType={BadgeStyleType.Primary}` | nothing: `Filled` `Primary` is the default |
69
+ | `styleType={BadgeStyleType.Default}` | `styleType={BadgeStyleType.Light} color={ThemeColor.Neutral}` |
70
+ | `styleType={BadgeStyleType.Success}` (and `Info`, `Warn`, `Error`) | `styleType={BadgeStyleType.Light} color={ThemeColor.Success}` |
71
+ | `dot styleType={BadgeStyleType.Error}` | `dot color={ThemeColor.Error}` |