@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.
- package/CHANGELOG.md +934 -0
- package/README.md +11 -10
- package/dist/cjs-types/common/accordion/accordion.types.d.ts +17 -2
- package/dist/cjs-types/common/actionButtons/actionButtons.types.d.ts +7 -1
- package/dist/cjs-types/common/actionIcon/actionIcon.d.ts +1 -1
- package/dist/cjs-types/common/actionIcon/actionIcon.types.d.ts +7 -9
- package/dist/cjs-types/common/alert/alert.types.d.ts +6 -8
- package/dist/cjs-types/common/animatedLogo/animatedLogo.types.d.ts +3 -2
- package/dist/cjs-types/common/badge/badge.types.d.ts +10 -6
- package/dist/cjs-types/common/button/button.types.d.ts +14 -4
- package/dist/cjs-types/common/calendar/calendar.types.d.ts +25 -10
- package/dist/cjs-types/common/calendar/components/agendaList/agendaList.d.ts +1 -1
- package/dist/cjs-types/common/calendar/components/agendaList/agendaList.types.d.ts +3 -0
- package/dist/cjs-types/common/calendar/components/calendarHeader/calendarHeader.d.ts +1 -1
- package/dist/cjs-types/common/calendar/components/calendarHeader/calendarHeader.types.d.ts +2 -0
- package/dist/cjs-types/common/calendar/components/compactMonth/compactMonth.d.ts +1 -1
- package/dist/cjs-types/common/calendar/components/monthView/monthView.d.ts +1 -1
- package/dist/cjs-types/common/calendar/components/monthView/monthView.types.d.ts +3 -2
- package/dist/cjs-types/common/calendar/components/timeGrid/timeGrid.d.ts +1 -1
- package/dist/cjs-types/common/calendar/components/timeGrid/timeGrid.types.d.ts +9 -1
- package/dist/cjs-types/common/calendar/dates.d.ts +21 -5
- package/dist/cjs-types/common/calendar/format.d.ts +3 -2
- package/dist/cjs-types/common/calendar/layout.d.ts +5 -0
- package/dist/cjs-types/common/calendar/useNow.d.ts +4 -0
- package/dist/cjs-types/common/calendar/view.types.d.ts +9 -2
- package/dist/cjs-types/common/card/card.types.d.ts +16 -2
- package/dist/cjs-types/common/chip/chip.types.d.ts +10 -5
- package/dist/cjs-types/common/copyButton/copyButton.types.d.ts +5 -4
- package/dist/cjs-types/common/fab/components/fabBase/fabBase.d.ts +1 -1
- package/dist/cjs-types/common/fab/components/fabBase/fabBase.types.d.ts +2 -1
- package/dist/cjs-types/common/progressBar/progressBar.d.ts +0 -1
- package/dist/cjs-types/common/progressBar/progressBar.types.d.ts +3 -1
- package/dist/cjs-types/common/splitButton/splitButton.types.d.ts +4 -1
- package/dist/cjs-types/common/styles/tone.d.ts +11 -0
- package/dist/cjs-types/common/themeProvider/color.types.d.ts +20 -0
- package/dist/cjs-types/common/themeProvider/index.d.ts +2 -0
- package/dist/cjs-types/common/themeProvider/theme.types.d.ts +3 -6
- package/dist/cjs-types/common/timeline/timeline.types.d.ts +3 -10
- package/dist/cjs-types/common/toast/index.d.ts +1 -1
- package/dist/cjs-types/common/toast/toast.types.d.ts +7 -3
- package/dist/cjs-types/common/types/actions.types.d.ts +1 -1
- package/dist/cjs-types/common/utils/dismissClick.d.ts +4 -0
- package/dist/cjs-types/common/utils/isDev.d.ts +1 -0
- package/dist/esm/common/accordion/accordion.mjs +1 -1
- package/dist/esm/common/accordion/accordion.mjs.map +1 -1
- package/dist/esm/common/accordion/accordion.module.mjs +1 -1
- package/dist/esm/common/accordion/accordion.module.mjs.map +1 -1
- package/dist/esm/common/accordion/accordion.types.mjs +1 -1
- package/dist/esm/common/accordion/accordion.types.mjs.map +1 -1
- package/dist/esm/common/actionButtons/actionButtons.mjs +1 -1
- package/dist/esm/common/actionButtons/actionButtons.mjs.map +1 -1
- package/dist/esm/common/actionIcon/actionIcon.mjs +1 -1
- package/dist/esm/common/actionIcon/actionIcon.mjs.map +1 -1
- package/dist/esm/common/actionIcon/actionIcon.module.mjs +1 -1
- package/dist/esm/common/actionIcon/actionIcon.module.mjs.map +1 -1
- package/dist/esm/common/alert/alert.mjs +1 -1
- package/dist/esm/common/alert/alert.mjs.map +1 -1
- package/dist/esm/common/alert/alert.module.mjs +1 -1
- package/dist/esm/common/alert/alert.module.mjs.map +1 -1
- package/dist/esm/common/animatedLogo/animatedLogo.mjs +1 -1
- package/dist/esm/common/animatedLogo/animatedLogo.mjs.map +1 -1
- package/dist/esm/common/avatar/avatar.mjs +1 -1
- package/dist/esm/common/avatar/avatar.mjs.map +1 -1
- package/dist/esm/common/badge/badge.mjs +1 -1
- package/dist/esm/common/badge/badge.mjs.map +1 -1
- package/dist/esm/common/badge/badge.module.mjs +1 -1
- package/dist/esm/common/badge/badge.module.mjs.map +1 -1
- package/dist/esm/common/badge/badge.types.mjs +1 -1
- package/dist/esm/common/badge/badge.types.mjs.map +1 -1
- package/dist/esm/common/bodyEnd/bodyEnd.mjs +1 -1
- package/dist/esm/common/bodyEnd/bodyEnd.mjs.map +1 -1
- package/dist/esm/common/breadcrumb/breadcrumb.mjs +1 -1
- package/dist/esm/common/breadcrumb/breadcrumb.mjs.map +1 -1
- package/dist/esm/common/breadcrumb/breadcrumb.module.mjs.map +1 -1
- package/dist/esm/common/button/button.mjs +1 -1
- package/dist/esm/common/button/button.mjs.map +1 -1
- package/dist/esm/common/button/button.module.mjs +1 -1
- package/dist/esm/common/button/button.module.mjs.map +1 -1
- package/dist/esm/common/button/button.types.mjs +1 -1
- package/dist/esm/common/button/button.types.mjs.map +1 -1
- package/dist/esm/common/calendar/calendar.mjs +1 -1
- package/dist/esm/common/calendar/calendar.mjs.map +1 -1
- package/dist/esm/common/calendar/calendar.module.mjs.map +1 -1
- package/dist/esm/common/calendar/calendar.types.mjs.map +1 -1
- package/dist/esm/common/calendar/components/agendaList/agendaList.mjs +1 -1
- package/dist/esm/common/calendar/components/agendaList/agendaList.mjs.map +1 -1
- package/dist/esm/common/calendar/components/agendaList/agendaList.module.mjs.map +1 -1
- package/dist/esm/common/calendar/components/calendarHeader/calendarHeader.mjs +1 -1
- package/dist/esm/common/calendar/components/calendarHeader/calendarHeader.mjs.map +1 -1
- package/dist/esm/common/calendar/components/calendarHeader/calendarHeader.module.mjs +1 -1
- package/dist/esm/common/calendar/components/calendarHeader/calendarHeader.module.mjs.map +1 -1
- package/dist/esm/common/calendar/components/compactMonth/compactMonth.mjs +1 -1
- package/dist/esm/common/calendar/components/compactMonth/compactMonth.mjs.map +1 -1
- package/dist/esm/common/calendar/components/compactMonth/compactMonth.module.mjs +1 -1
- package/dist/esm/common/calendar/components/compactMonth/compactMonth.module.mjs.map +1 -1
- package/dist/esm/common/calendar/components/monthView/monthView.mjs +1 -1
- package/dist/esm/common/calendar/components/monthView/monthView.mjs.map +1 -1
- package/dist/esm/common/calendar/components/monthView/monthView.module.mjs +1 -1
- package/dist/esm/common/calendar/components/monthView/monthView.module.mjs.map +1 -1
- package/dist/esm/common/calendar/components/timeGrid/timeGrid.mjs +1 -1
- package/dist/esm/common/calendar/components/timeGrid/timeGrid.mjs.map +1 -1
- package/dist/esm/common/calendar/components/timeGrid/timeGrid.module.mjs +1 -1
- package/dist/esm/common/calendar/components/timeGrid/timeGrid.module.mjs.map +1 -1
- package/dist/esm/common/calendar/dates.mjs +1 -1
- package/dist/esm/common/calendar/dates.mjs.map +1 -1
- package/dist/esm/common/calendar/format.mjs +1 -1
- package/dist/esm/common/calendar/format.mjs.map +1 -1
- package/dist/esm/common/calendar/layout.mjs +1 -1
- package/dist/esm/common/calendar/layout.mjs.map +1 -1
- package/dist/esm/common/calendar/useNow.mjs +2 -0
- package/dist/esm/common/calendar/useNow.mjs.map +1 -0
- package/dist/esm/common/card/Card.mjs +1 -1
- package/dist/esm/common/card/Card.mjs.map +1 -1
- package/dist/esm/common/card/CardActions.mjs +1 -1
- package/dist/esm/common/card/CardActions.mjs.map +1 -1
- package/dist/esm/common/card/CardHeader.mjs.map +1 -1
- package/dist/esm/common/card/card.module.mjs +1 -1
- package/dist/esm/common/card/card.module.mjs.map +1 -1
- package/dist/esm/common/card/card.types.mjs +1 -1
- package/dist/esm/common/card/card.types.mjs.map +1 -1
- package/dist/esm/common/carousel/carousel.mjs +1 -1
- package/dist/esm/common/carousel/carousel.mjs.map +1 -1
- package/dist/esm/common/carousel/carousel.module.mjs.map +1 -1
- package/dist/esm/common/chip/chip.mjs +1 -1
- package/dist/esm/common/chip/chip.mjs.map +1 -1
- package/dist/esm/common/chip/chip.module.mjs +1 -1
- package/dist/esm/common/chip/chip.module.mjs.map +1 -1
- package/dist/esm/common/chip/chip.types.mjs +1 -1
- package/dist/esm/common/chip/chip.types.mjs.map +1 -1
- package/dist/esm/common/colorPicker/colorPicker.mjs +1 -1
- package/dist/esm/common/colorPicker/colorPicker.mjs.map +1 -1
- package/dist/esm/common/colorPicker/colorPicker.module.mjs.map +1 -1
- package/dist/esm/common/confirmModal/confirmModal.mjs +1 -1
- package/dist/esm/common/confirmModal/confirmModal.mjs.map +1 -1
- package/dist/esm/common/copyButton/copyButton.mjs +1 -1
- package/dist/esm/common/copyButton/copyButton.mjs.map +1 -1
- package/dist/esm/common/copyButton/copyButton.module.mjs +1 -1
- package/dist/esm/common/copyButton/copyButton.module.mjs.map +1 -1
- package/dist/esm/common/errorBoundary/errorBoundary.mjs +2 -2
- package/dist/esm/common/errorBoundary/errorBoundary.mjs.map +1 -1
- package/dist/esm/common/fab/components/fabBase/fabBase.mjs +1 -1
- package/dist/esm/common/fab/components/fabBase/fabBase.mjs.map +1 -1
- package/dist/esm/common/fab/fab.mjs +1 -1
- package/dist/esm/common/fab/fab.mjs.map +1 -1
- package/dist/esm/common/flip/flip.mjs +1 -1
- package/dist/esm/common/flip/flip.mjs.map +1 -1
- package/dist/esm/common/klipyPicker/klipyPicker.mjs +1 -1
- package/dist/esm/common/klipyPicker/klipyPicker.mjs.map +1 -1
- package/dist/esm/common/modal/modal.mjs +1 -1
- package/dist/esm/common/modal/modal.mjs.map +1 -1
- package/dist/esm/common/modal/modal.module.mjs.map +1 -1
- package/dist/esm/common/numberInput/numberInput.mjs +1 -1
- package/dist/esm/common/numberInput/numberInput.mjs.map +1 -1
- package/dist/esm/common/numberInput/numberInput.module.mjs.map +1 -1
- package/dist/esm/common/popover/popover.mjs +1 -1
- package/dist/esm/common/popover/popover.mjs.map +1 -1
- package/dist/esm/common/progressBar/progressBar.mjs +1 -1
- package/dist/esm/common/progressBar/progressBar.mjs.map +1 -1
- package/dist/esm/common/progressBar/progressBar.module.mjs +1 -1
- package/dist/esm/common/progressBar/progressBar.module.mjs.map +1 -1
- package/dist/esm/common/roomDrawer/roomDrawer.mjs +1 -1
- package/dist/esm/common/roomDrawer/roomDrawer.mjs.map +1 -1
- package/dist/esm/common/roomDrawer/roomDrawer.module.mjs.map +1 -1
- package/dist/esm/common/sectionHeader/sectionHeader.mjs.map +1 -1
- package/dist/esm/common/splitButton/splitButton.mjs +1 -1
- package/dist/esm/common/splitButton/splitButton.mjs.map +1 -1
- package/dist/esm/common/styles/tone.mjs +4 -0
- package/dist/esm/common/styles/tone.mjs.map +1 -0
- package/dist/esm/common/styles/tone.module.mjs +2 -0
- package/dist/esm/common/styles/tone.module.mjs.map +1 -0
- package/dist/esm/common/themeProvider/color.types.mjs +2 -0
- package/dist/esm/common/themeProvider/color.types.mjs.map +1 -0
- package/dist/esm/common/themeProvider/defaultTheme.mjs +1 -1
- package/dist/esm/common/themeProvider/defaultTheme.mjs.map +1 -1
- package/dist/esm/common/tilt/tilt.mjs +1 -1
- package/dist/esm/common/tilt/tilt.mjs.map +1 -1
- package/dist/esm/common/timeInput/timeInput.mjs +1 -1
- package/dist/esm/common/timeInput/timeInput.mjs.map +1 -1
- package/dist/esm/common/timeline/timeline.mjs +1 -1
- package/dist/esm/common/timeline/timeline.mjs.map +1 -1
- package/dist/esm/common/timeline/timeline.module.mjs +1 -1
- package/dist/esm/common/timeline/timeline.module.mjs.map +1 -1
- package/dist/esm/common/timeline/timeline.types.mjs +1 -1
- package/dist/esm/common/timeline/timeline.types.mjs.map +1 -1
- package/dist/esm/common/timer/timer.mjs +1 -1
- package/dist/esm/common/timer/timer.mjs.map +1 -1
- package/dist/esm/common/timer/timer.module.mjs +1 -1
- package/dist/esm/common/timer/timer.module.mjs.map +1 -1
- package/dist/esm/common/toast/toast.mjs +1 -1
- package/dist/esm/common/toast/toast.mjs.map +1 -1
- package/dist/esm/common/toast/toast.module.mjs +1 -1
- package/dist/esm/common/toast/toast.module.mjs.map +1 -1
- package/dist/esm/common/toast/toastHost.mjs +1 -1
- package/dist/esm/common/toast/toastHost.mjs.map +1 -1
- package/dist/esm/common/utils/dismissClick.mjs +2 -0
- package/dist/esm/common/utils/dismissClick.mjs.map +1 -0
- package/dist/esm/common/utils/isDev.mjs +2 -0
- package/dist/esm/common/utils/isDev.mjs.map +1 -0
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/services/formValidation/FormValidatorGroupWithForm.mjs +1 -1
- package/dist/esm/services/formValidation/FormValidatorGroupWithForm.mjs.map +1 -1
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/common/accordion/accordion.types.d.ts +17 -2
- package/dist/types/common/actionButtons/actionButtons.types.d.ts +7 -1
- package/dist/types/common/actionIcon/actionIcon.d.ts +1 -1
- package/dist/types/common/actionIcon/actionIcon.types.d.ts +7 -9
- package/dist/types/common/alert/alert.types.d.ts +6 -8
- package/dist/types/common/animatedLogo/animatedLogo.types.d.ts +3 -2
- package/dist/types/common/badge/badge.types.d.ts +10 -6
- package/dist/types/common/button/button.types.d.ts +14 -4
- package/dist/types/common/calendar/calendar.types.d.ts +25 -10
- package/dist/types/common/calendar/components/agendaList/agendaList.d.ts +1 -1
- package/dist/types/common/calendar/components/agendaList/agendaList.types.d.ts +3 -0
- package/dist/types/common/calendar/components/calendarHeader/calendarHeader.d.ts +1 -1
- package/dist/types/common/calendar/components/calendarHeader/calendarHeader.types.d.ts +2 -0
- package/dist/types/common/calendar/components/compactMonth/compactMonth.d.ts +1 -1
- package/dist/types/common/calendar/components/monthView/monthView.d.ts +1 -1
- package/dist/types/common/calendar/components/monthView/monthView.types.d.ts +3 -2
- package/dist/types/common/calendar/components/timeGrid/timeGrid.d.ts +1 -1
- package/dist/types/common/calendar/components/timeGrid/timeGrid.types.d.ts +9 -1
- package/dist/types/common/calendar/dates.d.ts +21 -5
- package/dist/types/common/calendar/format.d.ts +3 -2
- package/dist/types/common/calendar/layout.d.ts +5 -0
- package/dist/types/common/calendar/useNow.d.ts +4 -0
- package/dist/types/common/calendar/view.types.d.ts +9 -2
- package/dist/types/common/card/card.types.d.ts +16 -2
- package/dist/types/common/chip/chip.types.d.ts +10 -5
- package/dist/types/common/copyButton/copyButton.types.d.ts +5 -4
- package/dist/types/common/fab/components/fabBase/fabBase.d.ts +1 -1
- package/dist/types/common/fab/components/fabBase/fabBase.types.d.ts +2 -1
- package/dist/types/common/progressBar/progressBar.d.ts +0 -1
- package/dist/types/common/progressBar/progressBar.types.d.ts +3 -1
- package/dist/types/common/splitButton/splitButton.types.d.ts +4 -1
- package/dist/types/common/styles/tone.d.ts +11 -0
- package/dist/types/common/themeProvider/color.types.d.ts +20 -0
- package/dist/types/common/themeProvider/index.d.ts +2 -0
- package/dist/types/common/themeProvider/theme.types.d.ts +3 -6
- package/dist/types/common/timeline/timeline.types.d.ts +3 -10
- package/dist/types/common/toast/index.d.ts +1 -1
- package/dist/types/common/toast/toast.types.d.ts +7 -3
- package/dist/types/common/types/actions.types.d.ts +1 -1
- package/dist/types/common/utils/dismissClick.d.ts +4 -0
- package/dist/types/common/utils/isDev.d.ts +1 -0
- package/docs/Accordion.md +74 -5
- package/docs/ActionButtons.md +6 -3
- package/docs/ActionIcon.md +39 -14
- package/docs/Alert.md +27 -17
- package/docs/AnimatedLogo.md +1 -1
- package/docs/Badge.md +24 -7
- package/docs/Button.md +98 -40
- package/docs/ButtonGroup.md +18 -18
- package/docs/CLAUDE.md +21 -11
- package/docs/Calendar.md +35 -17
- package/docs/Card.md +53 -14
- package/docs/Chip.md +24 -9
- package/docs/ConfigProvider.md +3 -3
- package/docs/CopyButton.md +6 -5
- package/docs/ProgressBar.md +7 -4
- package/docs/SectionHeader.md +1 -1
- package/docs/SplitButton.md +6 -5
- package/docs/ThemeColor.md +103 -0
- package/docs/ThemeProvider.md +5 -5
- package/docs/Timeline.md +18 -9
- package/docs/Toast.md +25 -11
- package/package.json +3 -2
- package/dist/esm/common/accordion/accordion.plain.module.mjs +0 -2
- package/dist/esm/common/accordion/accordion.plain.module.mjs.map +0 -1
- package/dist/esm/common/accordion/accordion.primary.module.mjs +0 -2
- package/dist/esm/common/accordion/accordion.primary.module.mjs.map +0 -1
- package/dist/esm/common/alert/alert.types.mjs +0 -2
- 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
|
-
**
|
|
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
|
-
//
|
|
18
|
-
<Chip text="
|
|
19
|
-
<Chip text="
|
|
20
|
-
|
|
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`: `
|
|
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` |
|
|
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}` |
|
package/docs/ConfigProvider.md
CHANGED
|
@@ -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 `
|
|
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.
|
|
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 `
|
|
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:**.
|
package/docs/CopyButton.md
CHANGED
|
@@ -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', {
|
|
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
|
-
| `
|
|
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
|
|
package/docs/ProgressBar.md
CHANGED
|
@@ -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
|
|
15
|
+
// Single progress with label, in a theme colour
|
|
16
16
|
<ProgressBar
|
|
17
17
|
total={100}
|
|
18
|
-
progress={{ amount: 60, label: 'Used', color:
|
|
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?:
|
|
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 |
|
package/docs/SectionHeader.md
CHANGED
|
@@ -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<
|
|
80
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
81
81
|
}
|
|
82
82
|
```
|
|
83
83
|
|
package/docs/SplitButton.md
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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` |
|
|
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.
|
|
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
|
+
```
|
package/docs/ThemeProvider.md
CHANGED
|
@@ -148,16 +148,16 @@ Surfaces that honour it:
|
|
|
148
148
|
|
|
149
149
|
| Component | Surface |
|
|
150
150
|
|-----------|---------|
|
|
151
|
-
| `Button` |
|
|
152
|
-
| `Chip` |
|
|
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` |
|
|
159
|
-
| `Alert` |
|
|
160
|
-
| `Toast` |
|
|
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
|
|
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,
|
|
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,
|
|
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',
|
|
22
|
-
{ title: 'Invoice closed',
|
|
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,
|
|
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
|
-
| `
|
|
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
|
-
`
|
|
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,
|
|
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
|
-
//
|
|
31
|
-
showToast('Something went wrong.', {
|
|
32
|
-
showToast('3 items updated.', {
|
|
33
|
-
showToast('Your changes were saved.', {
|
|
34
|
-
showToast('Disk space is low.', {
|
|
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
|
-
|
|
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
|
-
**
|
|
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.
|
|
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 +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"}
|