@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/Button.md
CHANGED
|
@@ -1,37 +1,57 @@
|
|
|
1
1
|
# Button
|
|
2
2
|
|
|
3
|
-
**When to use:** Primary interactive action trigger. Supports loading state, icon,
|
|
3
|
+
**When to use:** Primary interactive action trigger. Supports loading state, icon, four styles in any colour, and sizes.
|
|
4
4
|
|
|
5
|
-
**Keywords:** cta, action button
|
|
5
|
+
**Keywords:** cta, action button, ghost, text button, borderless, subtle, variant, danger, destructive, secondary
|
|
6
6
|
|
|
7
|
-
**Import:** `import { Button, ButtonStyleType, ButtonSize, ButtonType } from '@ahrowe/ui'`
|
|
7
|
+
**Import:** `import { Button, ButtonStyleType, ButtonSize, ButtonType, ThemeColor } from '@ahrowe/ui'`
|
|
8
|
+
|
|
9
|
+
A button has a **style** (how much it stands out) and a **color**, set independently: any style
|
|
10
|
+
works with any colour. The colours are the library-wide `ThemeColor`s or any CSS colour, see
|
|
11
|
+
[ThemeColor.md](ThemeColor.md).
|
|
8
12
|
|
|
9
13
|
```tsx
|
|
10
|
-
import { Button, ButtonStyleType, ButtonSize } from '@ahrowe/ui';
|
|
11
|
-
import { faSave } from '@fortawesome/free-solid-svg-icons';
|
|
14
|
+
import { Button, ButtonStyleType, ButtonSize, ButtonType, ThemeColor } from '@ahrowe/ui';
|
|
15
|
+
import { faPlus, faSave, faTrash, faXmark } from '@fortawesome/free-solid-svg-icons';
|
|
12
16
|
|
|
13
|
-
//
|
|
14
|
-
<Button styleType={ButtonStyleType.
|
|
17
|
+
// The main action
|
|
18
|
+
<Button styleType={ButtonStyleType.Filled} onClick={handleSave}>Save</Button>
|
|
15
19
|
|
|
16
|
-
//
|
|
20
|
+
// Secondary: Outlined is the default style, Primary the default colour
|
|
21
|
+
<Button onClick={handleCancel}>Cancel</Button>
|
|
22
|
+
<Button color={ThemeColor.Neutral} onClick={handleCancel}>Cancel</Button>
|
|
23
|
+
|
|
24
|
+
// Destructive
|
|
25
|
+
<Button styleType={ButtonStyleType.Filled} color={ThemeColor.Error} onClick={handleDelete}>Delete</Button>
|
|
26
|
+
|
|
27
|
+
// A trash icon in a table row
|
|
17
28
|
<Button
|
|
18
|
-
styleType={ButtonStyleType.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
styleType={ButtonStyleType.Plain}
|
|
30
|
+
color={ThemeColor.Error}
|
|
31
|
+
size={ButtonSize.Icon}
|
|
32
|
+
icon={faTrash}
|
|
33
|
+
aria-label="Delete row"
|
|
34
|
+
style={{ width: 32, height: 32 }}
|
|
35
|
+
/>
|
|
36
|
+
|
|
37
|
+
// A close button: Neutral takes the text colour of whatever it sits on
|
|
38
|
+
<Button
|
|
39
|
+
styleType={ButtonStyleType.Plain}
|
|
40
|
+
color={ThemeColor.Neutral}
|
|
41
|
+
size={ButtonSize.Icon}
|
|
42
|
+
icon={faXmark}
|
|
43
|
+
aria-label="Close"
|
|
44
|
+
style={{ width: 32, height: 32 }}
|
|
45
|
+
/>
|
|
46
|
+
|
|
47
|
+
// With icon + loading state
|
|
48
|
+
<Button styleType={ButtonStyleType.Filled} icon={faSave} isLoading={isSaving} onClick={handleSave}>
|
|
23
49
|
Save
|
|
24
50
|
</Button>
|
|
25
51
|
|
|
26
|
-
// Delete / danger
|
|
27
|
-
<Button styleType={ButtonStyleType.Delete} onClick={handleDelete}>Delete</Button>
|
|
28
|
-
|
|
29
52
|
// Small
|
|
30
53
|
<Button size={ButtonSize.Small}>Cancel</Button>
|
|
31
54
|
|
|
32
|
-
// Icon-only — padding-free and square; give it the box size you want
|
|
33
|
-
<Button size={ButtonSize.Icon} icon={faPlus} aria-label="Add" style={{ width: 44, height: 44 }} />
|
|
34
|
-
|
|
35
55
|
// Press-and-hold: act on press rather than release
|
|
36
56
|
<Button
|
|
37
57
|
icon={faPlus}
|
|
@@ -42,12 +62,13 @@ import { faSave } from '@fortawesome/free-solid-svg-icons';
|
|
|
42
62
|
/>
|
|
43
63
|
|
|
44
64
|
// Submit button in a form
|
|
45
|
-
<Button type={ButtonType.Submit} styleType={ButtonStyleType.
|
|
65
|
+
<Button type={ButtonType.Submit} styleType={ButtonStyleType.Filled}>Submit</Button>
|
|
46
66
|
```
|
|
47
67
|
|
|
48
68
|
**Enums:**
|
|
49
69
|
|
|
50
|
-
- `ButtonStyleType`: `
|
|
70
|
+
- `ButtonStyleType`: `Filled` | `Light` | `Outlined` (default) | `Plain`
|
|
71
|
+
- `ThemeColor`: `Primary` (default) | `Neutral` | `Success` | `Info` | `Warn` | `Error`
|
|
51
72
|
- `ButtonSize`: `Default` | `Small` | `Medium` | `Large` | `Icon`
|
|
52
73
|
- `ButtonType`: `Button` | `Reset` | `Submit`
|
|
53
74
|
|
|
@@ -55,41 +76,42 @@ import { faSave } from '@fortawesome/free-solid-svg-icons';
|
|
|
55
76
|
|
|
56
77
|
| Prop | Type | Description |
|
|
57
78
|
|------|------|-------------|
|
|
58
|
-
| `styleType` | `ButtonStyleType` |
|
|
79
|
+
| `styleType` | `ButtonStyleType` | `Filled`: solid fill, for the one main action. `Light`: a tint of the colour behind text in the colour. `Outlined` (default): border and text in the colour. `Plain`: text in the colour, no fill or border, for toolbar, icon and close buttons |
|
|
80
|
+
| `color` | `ColorValue` | A `ThemeColor` (default `Primary`) or any CSS colour. `Neutral` takes the surrounding text colour, with a `--border-color` outline; `Error` is for destructive actions. See [ThemeColor.md](ThemeColor.md) |
|
|
59
81
|
| `size` | `ButtonSize` | Size variant. `Icon` strips all padding, inherits the surrounding text size, and centres a lone icon — set the width/height yourself |
|
|
60
82
|
| `type` | `ButtonType` | HTML button type |
|
|
61
83
|
| `icon` | `IconDefinition \| ReactElement` | FontAwesome icon or any React element, shown before label |
|
|
62
|
-
| `isLoading` | `boolean` | Replaces content with a spinner |
|
|
63
|
-
| `disabled` | `boolean` | |
|
|
84
|
+
| `isLoading` | `boolean` | Replaces content with a spinner. Blocks clicks like `disabled` but keeps full colour |
|
|
85
|
+
| `disabled` | `boolean` | Fades the button to half opacity |
|
|
64
86
|
| `onClick` | `(e: MouseEvent) => void \| Promise<void>` | |
|
|
65
87
|
|
|
66
88
|
`ButtonProps` extends `React.ButtonHTMLAttributes<HTMLButtonElement>`, so every native `<button>`
|
|
67
89
|
attribute is accepted and forwarded — pointer handlers (`onPointerDown` and friends, for
|
|
68
90
|
press-and-hold controls that act on press rather than release), `onContextMenu`, `tabIndex`,
|
|
69
91
|
`name`, `value`, `form`, `autoFocus`, and the rest. `type` and `onClick` are narrowed: `type`
|
|
70
|
-
takes the `ButtonType` enum, and `onClick` may return a promise.
|
|
92
|
+
takes the `ButtonType` enum, and `onClick` may return a promise. `color` is Button's own prop, not
|
|
93
|
+
the obsolete HTML attribute.
|
|
71
94
|
|
|
72
|
-
**Theming
|
|
95
|
+
**Theming:** each colour reads the theme variables listed in [ThemeColor.md](ThemeColor.md). The
|
|
96
|
+
`Filled` `Primary` button also paints `--primary-gradient` when the theme sets one. See
|
|
97
|
+
[ThemeProvider.md](ThemeProvider.md).
|
|
73
98
|
|
|
74
|
-
|
|
75
|
-
- `--button-default-color` — text colour (default `var(--text-color)`)
|
|
76
|
-
- `--button-default-border` — full `border` shorthand, e.g. `1px solid var(--border-color)` (default a transparent `1px` border)
|
|
99
|
+
## Custom colours and presets
|
|
77
100
|
|
|
78
|
-
|
|
101
|
+
`color` takes any CSS colour as well as a `ThemeColor`; the text on a `Filled` button is picked
|
|
102
|
+
for contrast. Presets are a component in your app, and a section or the whole app takes a default
|
|
103
|
+
through `ConfigProvider`. All three are in [ThemeColor.md](ThemeColor.md).
|
|
79
104
|
|
|
80
105
|
```tsx
|
|
81
|
-
|
|
82
|
-
const theme: Theme = {
|
|
83
|
-
id: 'brand',
|
|
84
|
-
variables: { '--button-default-border': '1px solid var(--border-color)' },
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// Or one-off via style
|
|
88
|
-
<Button style={{ '--button-default-border': '1px solid var(--border-color)' } as React.CSSProperties}>
|
|
89
|
-
Cancel
|
|
90
|
-
</Button>
|
|
106
|
+
<Button styleType={ButtonStyleType.Filled} color="var(--brand)">Upgrade</Button>
|
|
91
107
|
```
|
|
92
108
|
|
|
109
|
+
**States:** hover and press lay a tint of the button's own text colour over the whole button, so
|
|
110
|
+
every style, colour and theme gets them with no variables of their own. The keyboard focus ring
|
|
111
|
+
sits inside the edge, in `--focus-border-color`, or in the text colour on a `Filled` button. The
|
|
112
|
+
ripple is in the text colour too. Every button reserves a `1px` border, so switching style never
|
|
113
|
+
shifts layout or changes its height.
|
|
114
|
+
|
|
93
115
|
**Slots:** `background` `content` `loadingContainer` `label`
|
|
94
116
|
|
|
95
117
|
**Sizing in a flex row:** a Button never shrinks below its own content (`min-width: min-content`),
|
|
@@ -100,3 +122,39 @@ so an icon is never cut off by a flexible sibling. A multi-word label still wrap
|
|
|
100
122
|
A Button is sized by its font. `--default-font-size` is the base, and `Small` and `Large` are multiples of it (0.75x and 1.25x), so a theme with a smaller base font gets proportionally smaller controls everywhere. Padding and the icon gap are in `em`, so the whole box grows with the label rather than a large button wearing a default button's padding.
|
|
101
123
|
|
|
102
124
|
`ButtonSize.Icon` is the exception: it inherits the surrounding text size and has no padding at all, because the caller sets the box.
|
|
125
|
+
|
|
126
|
+
## Migration from `Primary`, `Default` and `Delete`
|
|
127
|
+
|
|
128
|
+
Before 0.43, `styleType` set emphasis and colour in one value. `Primary`, `Default` and `Delete` no
|
|
129
|
+
longer exist, so TypeScript points at every place that names them:
|
|
130
|
+
|
|
131
|
+
| Before | After |
|
|
132
|
+
|--------|-------|
|
|
133
|
+
| `styleType={ButtonStyleType.Primary}` | `styleType={ButtonStyleType.Filled}` |
|
|
134
|
+
| `styleType={ButtonStyleType.Default}` | nothing: `Outlined` is the default |
|
|
135
|
+
| `styleType={ButtonStyleType.Delete}` | `styleType={ButtonStyleType.Filled} color={ThemeColor.Error}` |
|
|
136
|
+
| ActionButtons `submitButtonStyle={ButtonStyleType.Delete}` | `submitButtonColor={ThemeColor.Error}` |
|
|
137
|
+
| SplitButton `styleType={ButtonStyleType.Delete}` | `color={ThemeColor.Error}` (`Filled` is its default) |
|
|
138
|
+
| Card action `styleType: ButtonStyleType.Delete` | `styleType: ButtonStyleType.Filled, color: ThemeColor.Error` |
|
|
139
|
+
| `defaultProps={{ Button: { styleType: ButtonStyleType.Primary } }}` | `defaultProps={{ Button: { styleType: ButtonStyleType.Filled } }}` |
|
|
140
|
+
|
|
141
|
+
Two things compile unchanged and need a look of their own:
|
|
142
|
+
|
|
143
|
+
**A Button with no `styleType`.** It was transparent text in `--text-color` unless the theme set
|
|
144
|
+
`--button-default-*`; the built-in `defaultTheme` made it an outline in `--primary-color`, which
|
|
145
|
+
is now the default everywhere. To keep the old look where you want it, use
|
|
146
|
+
`styleType={ButtonStyleType.Plain} color={ThemeColor.Neutral}`.
|
|
147
|
+
|
|
148
|
+
**`--button-default-background`, `--button-default-color` and `--button-default-border` in a
|
|
149
|
+
theme.** They are gone, and since a theme accepts any variable they still compile and do nothing.
|
|
150
|
+
What they styled is now the default `color`, set once on `AhroweProvider`:
|
|
151
|
+
|
|
152
|
+
| Theme set | Instead |
|
|
153
|
+
|-----------|---------|
|
|
154
|
+
| `--button-default-color: var(--text-color)` and a `--border-color` border | `defaultProps={{ Button: { color: ThemeColor.Neutral } }}` |
|
|
155
|
+
| another colour | `defaultProps={{ Button: { color: 'var(--your-colour)' } }}` |
|
|
156
|
+
| a fill in `--button-default-background` | also `styleType: ButtonStyleType.Filled`; `ThemeColor.Neutral` fills with a mix of the text colour |
|
|
157
|
+
|
|
158
|
+
A default prop does not change with the theme. Where each theme had its own default button, give
|
|
159
|
+
each theme a variable of your own, `'--app-button': '…'`, and set
|
|
160
|
+
`defaultProps={{ Button: { color: 'var(--app-button)' } }}` once: the variable follows the theme.
|
package/docs/ButtonGroup.md
CHANGED
|
@@ -13,23 +13,23 @@ import { ButtonGroup, ButtonGroupOrientation, Button, ButtonStyleType } from '@a
|
|
|
13
13
|
|
|
14
14
|
// Segmented toggle
|
|
15
15
|
<ButtonGroup>
|
|
16
|
-
<Button styleType={ButtonStyleType.
|
|
17
|
-
<Button styleType={ButtonStyleType.
|
|
18
|
-
<Button styleType={ButtonStyleType.
|
|
16
|
+
<Button styleType={ButtonStyleType.Outlined}>Day</Button>
|
|
17
|
+
<Button styleType={ButtonStyleType.Outlined}>Week</Button>
|
|
18
|
+
<Button styleType={ButtonStyleType.Outlined}>Month</Button>
|
|
19
19
|
</ButtonGroup>
|
|
20
20
|
|
|
21
21
|
// Icon toolbar
|
|
22
22
|
<ButtonGroup>
|
|
23
|
-
<Button styleType={ButtonStyleType.
|
|
24
|
-
<Button styleType={ButtonStyleType.
|
|
25
|
-
<Button styleType={ButtonStyleType.
|
|
23
|
+
<Button styleType={ButtonStyleType.Outlined} icon={faBold} aria-label="Bold" />
|
|
24
|
+
<Button styleType={ButtonStyleType.Outlined} icon={faItalic} aria-label="Italic" />
|
|
25
|
+
<Button styleType={ButtonStyleType.Outlined} icon={faUnderline} aria-label="Underline" />
|
|
26
26
|
</ButtonGroup>
|
|
27
27
|
|
|
28
28
|
// Vertical
|
|
29
29
|
<ButtonGroup orientation={ButtonGroupOrientation.Vertical}>
|
|
30
|
-
<Button styleType={ButtonStyleType.
|
|
31
|
-
<Button styleType={ButtonStyleType.
|
|
32
|
-
<Button styleType={ButtonStyleType.
|
|
30
|
+
<Button styleType={ButtonStyleType.Outlined}>Bold</Button>
|
|
31
|
+
<Button styleType={ButtonStyleType.Outlined}>Italic</Button>
|
|
32
|
+
<Button styleType={ButtonStyleType.Outlined}>Underline</Button>
|
|
33
33
|
</ButtonGroup>
|
|
34
34
|
|
|
35
35
|
// With a separator — filled styles (Primary/Delete) have no border of their own to merge,
|
|
@@ -37,23 +37,23 @@ import { ButtonGroup, ButtonGroupOrientation, Button, ButtonStyleType } from '@a
|
|
|
37
37
|
import { Divider, DividerOrientation } from '@ahrowe/ui';
|
|
38
38
|
|
|
39
39
|
<ButtonGroup>
|
|
40
|
-
<Button styleType={ButtonStyleType.
|
|
40
|
+
<Button styleType={ButtonStyleType.Filled}>Save</Button>
|
|
41
41
|
<Divider orientation={DividerOrientation.Vertical} />
|
|
42
|
-
<Button styleType={ButtonStyleType.
|
|
42
|
+
<Button styleType={ButtonStyleType.Filled}>Save & new</Button>
|
|
43
43
|
</ButtonGroup>
|
|
44
44
|
|
|
45
45
|
// Nested groups — a toolbar made of two self-contained sub-groups, spaced apart rather
|
|
46
46
|
// than merged into one continuous strip
|
|
47
47
|
<ButtonGroup>
|
|
48
48
|
<ButtonGroup>
|
|
49
|
-
<Button styleType={ButtonStyleType.
|
|
50
|
-
<Button styleType={ButtonStyleType.
|
|
51
|
-
<Button styleType={ButtonStyleType.
|
|
49
|
+
<Button styleType={ButtonStyleType.Outlined} icon={faBold} aria-label="Bold" />
|
|
50
|
+
<Button styleType={ButtonStyleType.Outlined} icon={faItalic} aria-label="Italic" />
|
|
51
|
+
<Button styleType={ButtonStyleType.Outlined} icon={faUnderline} aria-label="Underline" />
|
|
52
52
|
</ButtonGroup>
|
|
53
53
|
<ButtonGroup>
|
|
54
|
-
<Button styleType={ButtonStyleType.
|
|
55
|
-
<Button styleType={ButtonStyleType.
|
|
56
|
-
<Button styleType={ButtonStyleType.
|
|
54
|
+
<Button styleType={ButtonStyleType.Outlined} icon={faAlignLeft} aria-label="Align left" />
|
|
55
|
+
<Button styleType={ButtonStyleType.Outlined} icon={faAlignCenter} aria-label="Align center" />
|
|
56
|
+
<Button styleType={ButtonStyleType.Outlined} icon={faAlignRight} aria-label="Align right" />
|
|
57
57
|
</ButtonGroup>
|
|
58
58
|
</ButtonGroup>
|
|
59
59
|
|
|
@@ -64,7 +64,7 @@ import { Input } from '@ahrowe/ui';
|
|
|
64
64
|
|
|
65
65
|
<ButtonGroup>
|
|
66
66
|
<Input placeholder="Search…" value={search} onChange={setSearch} />
|
|
67
|
-
<Button styleType={ButtonStyleType.
|
|
67
|
+
<Button styleType={ButtonStyleType.Filled} icon={faMagnifyingGlass} aria-label="Search" />
|
|
68
68
|
</ButtonGroup>
|
|
69
69
|
```
|
|
70
70
|
|
package/docs/CLAUDE.md
CHANGED
|
@@ -32,8 +32,13 @@ enums and slot names. Do not infer props from a component's name.
|
|
|
32
32
|
- **Text a component renders itself** (close buttons, empty messages, page labels) is set with its
|
|
33
33
|
`labels` prop. App-wide defaults for any prop go through `AhroweProvider`'s `defaultProps`
|
|
34
34
|
(ConfigProvider.md).
|
|
35
|
-
- **Variants are enums**, not strings: `ButtonStyleType.
|
|
35
|
+
- **Variants are enums**, not strings: `ButtonStyleType.Filled`, `ButtonSize.Small`. Each doc lists
|
|
36
36
|
them under **Enums**.
|
|
37
|
+
- **Colours are one vocabulary.** Every `color` prop takes a `ThemeColor` (`Primary`, `Neutral`,
|
|
38
|
+
`Success`, `Info`, `Warn`, `Error`) or any CSS colour, and a separate `styleType` sets how much
|
|
39
|
+
the component stands out, so any style works in any colour (ThemeColor.md). Pick the style by
|
|
40
|
+
emphasis, the same way everywhere: `Filled` for the one main action of a region (at most one),
|
|
41
|
+
`Light` for status and selection, `Outlined` for secondary actions, `Plain` for tertiary ones.
|
|
37
42
|
- **`icon` props** take a FontAwesome `IconDefinition` or any React element.
|
|
38
43
|
- **`ref`** is a plain prop, there is no `forwardRef`. It lands on the element you would reach for:
|
|
39
44
|
Input, Textarea, NumberInput and SearchInput hand out their inner `<input>`. Timer, Flip, Tilt,
|
|
@@ -44,6 +49,10 @@ enums and slot names. Do not infer props from a component's name.
|
|
|
44
49
|
or validates a plan. No right-to-left support.
|
|
45
50
|
`prefers-reduced-motion` is honoured. Built for Chrome and Edge 111, Firefox 114, Safari 16.4
|
|
46
51
|
and newer, with no polyfills. The package is 0.x: a minor can break, a patch cannot.
|
|
52
|
+
- **Upgrading.** Every breaking change has a `## Migration from …` section, an old-to-new table,
|
|
53
|
+
in the doc of the component it changed. When TypeScript reports a name as missing after an
|
|
54
|
+
update, search the docs for that name. `CHANGELOG.md` beside `docs/` lists every change by
|
|
55
|
+
version and names the section to read.
|
|
47
56
|
|
|
48
57
|
## Components
|
|
49
58
|
|
|
@@ -51,24 +60,24 @@ enums and slot names. Do not infer props from a component's name.
|
|
|
51
60
|
|
|
52
61
|
| Doc | Exports | When to use |
|
|
53
62
|
|-----|---------|-------------|
|
|
54
|
-
| Accordion.md | Accordion | Collapsible sections for progressive disclosure — FAQs, settings panels, long-form content that users expand on demand |
|
|
63
|
+
| Accordion.md | Accordion, AccordionStyleType, ThemeColor | Collapsible sections for progressive disclosure — FAQs, settings panels, long-form content that users expand on demand |
|
|
55
64
|
| ActionButtons.md | ActionButtons | Standardised Submit / Cancel button pair for forms, dialogs, and drawer footers |
|
|
56
|
-
| ActionIcon.md | ActionIcon | Clickable icon button without a label — toolbar actions, table row actions, icon-only controls |
|
|
65
|
+
| ActionIcon.md | ActionIcon | Clickable icon button without a label — toolbar actions, table row actions, close buttons, icon-only controls |
|
|
57
66
|
| AhroweProvider.md | AhroweProvider | The one wrapper an app needs, at its root: it applies the theme, sets default props for every component, shows toasts and renders the element that Modal, Tooltip, Popover, Menu and Toast portal into |
|
|
58
|
-
| Alert.md | Alert,
|
|
67
|
+
| Alert.md | Alert, ThemeColor | A persistent inline status message, used for form-level errors, page/section banners, empty-config warnings, and "here's what changed" notices |
|
|
59
68
|
| AnimatedLogo.md | AnimatedLogo | A self-drawing SVG mark for splash/loading screens, empty states, or anywhere a brand or icon mark should feel alive rather than static |
|
|
60
69
|
| AnimatedText.md | AnimatedText, AnimatedTextVariant, AnimatedTextUnit | Decorative text entrance or emphasis effect, for hero headlines, empty-state messages, "premium"/"new" callouts, loading/decoding states |
|
|
61
70
|
| Avatar.md | Avatar, AvatarGroup | User or entity image — profile pictures, comment authors, member lists |
|
|
62
|
-
| Badge.md | Badge, BadgeStyleType, BadgePosition | Small count or status indicator — unread counts, notification dots, "new" markers |
|
|
71
|
+
| Badge.md | Badge, BadgeStyleType, BadgePosition, ThemeColor | Small count or status indicator — unread counts, notification dots, "new" markers |
|
|
63
72
|
| BodyEnd.md | BodyEnd | Renders children through a React portal, to the end of the app |
|
|
64
73
|
| Breadcrumb.md | Breadcrumb | A trail showing the current page's position within a hierarchy, with links back to each ancestor, such as a file browser path, a category/subcategory drill-down, or a multi-level settings page |
|
|
65
|
-
| Button.md | Button, ButtonStyleType, ButtonSize, ButtonType | Primary interactive action trigger |
|
|
74
|
+
| Button.md | Button, ButtonStyleType, ButtonSize, ButtonType, ThemeColor | Primary interactive action trigger |
|
|
66
75
|
| ButtonGroup.md | ButtonGroup, ButtonGroupOrientation | Joins a row (or column) of buttons into a single seamless control, merging their borders and rounding only the outer corners |
|
|
67
|
-
| Calendar.md | Calendar, CalendarView | Showing and editing your own events over time, in month, week, day and agenda views: bookings, shifts, appointments
|
|
68
|
-
| Card.md | Card, CardStyleType, CardHeader, CardMedia, CardContent, CardActions | Surface container for grouping related content — list items, profile cards, dashboard tiles, product listings |
|
|
76
|
+
| Calendar.md | Calendar, CalendarView | Showing and editing your own events over time, in month, week, day and agenda views: bookings, shifts, appointments |
|
|
77
|
+
| Card.md | Card, CardStyleType, CardHeader, CardMedia, CardContent, CardActions, ThemeColor | Surface container for grouping related content — list items, profile cards, dashboard tiles, product listings |
|
|
69
78
|
| Carousel.md | Carousel | A slide track for stepping through a set of items one at a time, with arrows, dots, and drag/swipe support, plus optional autoplay |
|
|
70
79
|
| Checkbox.md | Checkbox | Boolean toggle input — settings, multi-select lists, accept terms, feature flags |
|
|
71
|
-
| Chip.md | Chip, ChipContainer, ChipStyleType | Compact tag, label, or filter token — selected items, applied filters, category badges, user avatars with remove |
|
|
80
|
+
| Chip.md | Chip, ChipContainer, ChipStyleType, ThemeColor | Compact tag, label, or filter token — selected items, applied filters, category badges, user avatars with remove |
|
|
72
81
|
| ColorPicker.md | ColorPicker | Hex colour selection — theme editors, annotation tools, customisation panels |
|
|
73
82
|
| CommandPalette.md | CommandPalette | A search-first dialog for running any command or jumping anywhere in the app from the keyboard, usually opened with ⌘K / Ctrl+K |
|
|
74
83
|
| ConfigProvider.md | ConfigProvider | Set global **default props** for library components once, near the root of your app, instead of repeating the same prop on every instance |
|
|
@@ -123,12 +132,13 @@ enums and slot names. Do not infer props from a component's name.
|
|
|
123
132
|
| Switch.md | Switch | Sliding boolean toggle — settings panels, feature flags, preference lists |
|
|
124
133
|
| TabHeader.md | TabHeader | A horizontal row of tabs to switch between sibling views or sections — settings panels, dashboards, detail pages |
|
|
125
134
|
| Textarea.md | Textarea | Multiline text input — comments, descriptions, notes, code snippets, long-form content |
|
|
135
|
+
| ThemeColor.md | ThemeColor | The `color` prop of every component that takes one: the theme's named colours, or any CSS colour of your own |
|
|
126
136
|
| ThemeProvider.md | ThemeProvider | Applies a theme to its subtree, injecting its CSS custom properties as inline styles so every component inside can use them |
|
|
127
137
|
| Tilt.md | Tilt, TiltGroup | Wrap content that should tilt toward the cursor in 3D |
|
|
128
138
|
| TimeInput.md | TimeInput | Time-of-day selection — appointment times, opening hours, shift starts, reminders |
|
|
129
|
-
| Timeline.md | Timeline, TimelineAlignment,
|
|
139
|
+
| Timeline.md | Timeline, TimelineAlignment, ThemeColor | A vertical list of dated events, connected by a line, for audit logs, activity feeds, order status history, and deploy logs |
|
|
130
140
|
| Timer.md | Timer | A countdown timer with a depleting ring, add/remove-time and pause/cancel controls, and an imperative ref API |
|
|
131
|
-
| Toast.md | showToast | Non-blocking notifications — save confirmations, error alerts, info messages, warnings |
|
|
141
|
+
| Toast.md | showToast, ThemeColor | Non-blocking notifications — save confirmations, error alerts, info messages, warnings |
|
|
132
142
|
| Tooltip.md | Tooltip | Contextual help, info icons, field explanations, error pointers |
|
|
133
143
|
| Tree.md | Tree, flattenTree | A hierarchical list the user can expand, collapse and pick from: categories, nested locations, folder structures, org charts |
|
|
134
144
|
| VirtualList.md | VirtualList | Efficiently render large lists or tables — thousands of rows rendered with a virtualised scroll window so only visible rows are in the DOM |
|
package/docs/Calendar.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Calendar
|
|
2
2
|
|
|
3
|
-
**When to use:** Showing and editing your own events over time, in month, week, day and agenda views: bookings, shifts, appointments
|
|
3
|
+
**When to use:** Showing and editing your own events over time, in month, week, day and agenda views: bookings, shifts, appointments. To let a user pick one date, use [DatePicker](DatePicker.md); for a sequence of past steps, use [Timeline](Timeline.md).
|
|
4
4
|
|
|
5
|
-
**Keywords:** schedule, scheduler, planner, appointments, booking, meetings, week view, month view, drag and drop, events
|
|
5
|
+
**Keywords:** schedule, scheduler, planner, appointments, booking, meetings, week view, month view, drag and drop, events, business hours, opening hours, calendar week, KW
|
|
6
6
|
|
|
7
7
|
**Import:** `import { Calendar, CalendarView } from '@ahrowe/ui'`
|
|
8
8
|
**Types:** `import type { CalendarProps, CalendarEvent, CalendarRange, CalendarEventChange, CalendarEventContext, CalendarSlot, CalendarLabels, CalendarWeekday, CalendarWeekStart, CalendarSlots, CalendarDefaults } from '@ahrowe/ui'`
|
|
@@ -49,8 +49,8 @@ const [editing, setEditing] = useState<{ booking: Booking | CalendarSlot; anchor
|
|
|
49
49
|
// Read-only month and agenda
|
|
50
50
|
<Calendar events={events} views={[CalendarView.Month, CalendarView.Agenda]} />
|
|
51
51
|
|
|
52
|
-
// A working week
|
|
53
|
-
<Calendar events={events} defaultView={CalendarView.Week} hiddenDays={[0, 6]}
|
|
52
|
+
// A working week, 08:00 to 17:00, with the rest of the day shaded
|
|
53
|
+
<Calendar events={events} defaultView={CalendarView.Week} hiddenDays={[0, 6]} workingHours={[8, 17]} />
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
**Enums:** `CalendarView`: `Month`, `Week`, `Day`, `Agenda`
|
|
@@ -59,28 +59,38 @@ const [editing, setEditing] = useState<{ booking: Booking | CalendarSlot; anchor
|
|
|
59
59
|
|
|
60
60
|
**Events** are plain objects: `{ id, title, start, end, allDay?, color?, readOnly? }`.
|
|
61
61
|
|
|
62
|
+
- `id` is **unique among `events`**. Each occurrence of a recurring series needs its own, such as `` `${seriesId}-${day}` ``: two events with one id are drawn with one React key, and a drag picks up the first of them.
|
|
62
63
|
- `end` is **exclusive**, for timed and all-day events alike. A one-day all-day event on the 26th runs from midnight on the 26th to midnight on the 27th. A timed event ending at midnight does not show on the next day.
|
|
63
64
|
- Timed events of 24 hours or more are drawn in the all-day row, not stretched down the time grid.
|
|
64
65
|
- A timed event is drawn exactly as long as it lasts. One under 15 minutes has no room for its title, so it is a bar of its real length with the title on a line beneath it, and the next event in its column leaves that line free. Zoomed in far enough, the bar holds its title like any other event.
|
|
65
|
-
- `color` is any CSS colour,
|
|
66
|
+
- `color` is a `ThemeColor` (`color: ThemeColor.Success`) or any CSS colour, see [ThemeColor.md](ThemeColor.md). The event is tinted from it against the page background, so any colour reads in both light and dark themes.
|
|
66
67
|
- `readOnly` events can still be clicked, but not moved or resized.
|
|
67
68
|
|
|
68
69
|
**Loading events and recurring series.** `onRangeChange` fires on mount and whenever the shown period changes, with that period **and one either side of it**, because swiping reveals the neighbours before it pages. Fetch events for that range, and expand recurring series into it yourself: the calendar has no recurrence rules of its own.
|
|
69
70
|
|
|
70
71
|
```tsx
|
|
71
72
|
const [events, setEvents] = useState<CalendarEvent[]>([]);
|
|
73
|
+
const latest = useRef<CalendarRange | null>(null);
|
|
72
74
|
|
|
73
75
|
<Calendar
|
|
74
76
|
events={events}
|
|
75
|
-
onRangeChange={async (
|
|
77
|
+
onRangeChange={async (range) => {
|
|
78
|
+
latest.current = range;
|
|
79
|
+
const loaded = await api.events(range.start, range.end);
|
|
80
|
+
// Paged on while this loaded: a later range's answer is the one to show.
|
|
81
|
+
if (latest.current === range) setEvents(loaded);
|
|
82
|
+
}}
|
|
76
83
|
/>
|
|
77
84
|
```
|
|
78
85
|
|
|
79
86
|
**Editing:**
|
|
80
87
|
|
|
81
|
-
- With a **mouse**, drag on empty time to create, drag an event to move it, and drag its bottom edge to resize it. A plain click on empty time creates an hour (or `slotMinutes`, if longer)
|
|
88
|
+
- With a **mouse**, drag on empty time to create, drag an event to move it, and drag its bottom edge to resize it. A plain click on empty time creates an hour (or `slotMinutes`, if longer).
|
|
89
|
+
- **Whole days** are created and moved the same way in the month view and in the all-day row of the week and day views: a click creates an all-day slot on that day, a drag across days creates one over all of them, and dragging an event moves it by days.
|
|
82
90
|
- With **touch**, press and hold for 400ms to pick up, then drag. A tap does what a click does. On a coarse pointer the resize grip is always visible.
|
|
83
91
|
- Moving and resizing snap to `slotMinutes`. A live time label follows the drag, and `Escape` cancels it.
|
|
92
|
+
- The header's **New event** button (shown when `onSlotCreate` is set) creates on the selected day: in the week and day views the hour from the next full hour of the clock (23:00 at the latest, so it stays on that day), elsewhere the whole day. It is the keyboard's way to create.
|
|
93
|
+
- A click on empty time that closes a `Popover` of this library, such as your editor, only closes it; the next click creates. A click on another event still opens that one.
|
|
84
94
|
- Update `events` in the same render as `onEventChange`, or **return a promise**: the event then stays where it was dropped until the promise settles, and is drawn from `events` again after that. So update `events` before it resolves, and reject to put the event back:
|
|
85
95
|
|
|
86
96
|
```tsx
|
|
@@ -123,7 +133,11 @@ The example also:
|
|
|
123
133
|
|
|
124
134
|
**Navigating:** the header's arrows, **Today** and the view switcher. In the month, week and day views a horizontal swipe on touch pages to the next or previous period, with its events already in view while you swipe; the agenda is a list and pages with the arrows only. Pinch the week or day view, or hold Ctrl and use the wheel or trackpad, to zoom the hours; the zoom is kept when switching views. Clicking a day number, or a weekday in the week view, opens that day.
|
|
125
135
|
|
|
126
|
-
**On a narrow calendar** (under 600px of its own width, not the viewport's) the month view becomes a grid with coloured dots above the selected day's events. Tapping a day selects it rather than opening it
|
|
136
|
+
**On a narrow calendar** (under 600px of its own width, not the viewport's) the month view becomes a grid with coloured dots above the selected day's events. Tapping a day selects it rather than opening it; the header's **New event** button creates an all-day slot on it. Scrolling the list folds the month up into the selected week; swiping then pages by week instead of by month. Under `prefers-reduced-motion: reduce` the month folds in one step, once the list has scrolled the whole way, instead of following the scroll.
|
|
137
|
+
|
|
138
|
+
The week view of a narrow calendar shows **three days** from the selected one and pages by three, as seven columns at phone width leave no room for a title. The switcher still calls it Week, and `onRangeChange` reports those three days and their neighbours.
|
|
139
|
+
|
|
140
|
+
**Working hours and week numbers:** `workingHours={[8, 17]}` shades the hours before 08:00 and from 17:00 in the week and day views, and makes 08:00 the hour they open at when today is not shown. `[22, 6]` is an overnight shift, shaded from 06:00 to 22:00. `showWeekNumbers` labels each row of the month view and the corner of the week and day views with its **ISO 8601** week, the numbering used across most of Europe; a week that starts on another day than Monday shows the ISO week holding most of its days. The month of a narrow calendar has no room for them and leaves them out. `labels.weekNumber` words it: ``(week) => `KW ${week}` `` in German.
|
|
127
141
|
|
|
128
142
|
**Key props:**
|
|
129
143
|
|
|
@@ -131,30 +145,33 @@ The example also:
|
|
|
131
145
|
|------|------|-------------|
|
|
132
146
|
| `events` | `E[]` | The events to show, `E extends CalendarEvent` |
|
|
133
147
|
| `date` / `defaultDate` / `onDateChange` | `string` | Selected day, `'YYYY-MM-DD'`, controlled or uncontrolled: the same value a [DatePicker](DatePicker.md) holds, so the two can share state |
|
|
134
|
-
| `view` / `defaultView` / `onViewChange` | `CalendarView` | Shown view, controlled or uncontrolled (default `
|
|
148
|
+
| `view` / `defaultView` / `onViewChange` | `CalendarView` | Shown view, controlled or uncontrolled (default the first of `views`) |
|
|
135
149
|
| `views` | `CalendarView[]` | Views in the switcher, in order; hidden when there is one (default all four) |
|
|
136
150
|
| `locale` | `string` | BCP 47 tag for dates, times and the week start (default the browser's) |
|
|
137
151
|
| `weekStartsOn` | `0` to `6` | First day of the week, `0` being Sunday (default the locale's, else Monday) |
|
|
138
152
|
| `slotMinutes` | `number` | What creating, moving and resizing snap to (default `15`) |
|
|
139
153
|
| `hiddenDays` | `CalendarWeekday[]` | Weekdays left out of every view, `0` being Sunday: `[0, 6]` hides the weekend |
|
|
140
|
-
| `scrollToHour` | `number` | Hour the week and day views open at, such as `6` (default an hour before now while today is shown, otherwise `7`) |
|
|
154
|
+
| `scrollToHour` | `number` | Hour the week and day views open at, such as `6` (default an hour before now while today is shown, otherwise the start of `workingHours`, or `7`) |
|
|
155
|
+
| `workingHours` | `[start, end]` | Hours of working time in the week and day views, `[8, 17]`, or `[22, 6]` overnight; the rest is shaded |
|
|
156
|
+
| `showWeekNumbers` | `boolean` | ISO 8601 week numbers on the month's rows and in the week and day views' corner (default `false`) |
|
|
141
157
|
| `onRangeChange` | `(range: CalendarRange) => void` | The shown period plus one on either side |
|
|
142
158
|
| `onEventClick` | `(event: E, anchor: HTMLElement) => void` | An event was clicked; `anchor` is its element, ready for `Popover`'s `anchor` |
|
|
143
159
|
| `onEventChange` | `(change: CalendarEventChange<E>) => void \| Promise<unknown>` | Moved or resized. Setting it makes events draggable. A returned promise keeps the event in place until it settles |
|
|
144
|
-
| `onSlotCreate` | `(slot: CalendarSlot, anchor: HTMLElement) => void` | Empty time clicked or dragged over. Setting it enables creating. `anchor` is the day's cell in the month view
|
|
160
|
+
| `onSlotCreate` | `(slot: CalendarSlot, anchor: HTMLElement) => void` | Empty time clicked or dragged over, or the header's **New event** pressed. Setting it enables creating. `anchor` is ready for `Popover`'s `anchor`: the first day's cell in the month view, the first day's header for the all-day row, an invisible box over the new slot in the time grid, and the button itself from the header |
|
|
145
161
|
| `renderEvent` | `(event: E, context: CalendarEventContext) => ReactNode` | Content of an event in place of its title. No interactive elements. `context.singleLine` is set where it has one line: an event under 45 minutes, an all-day bar, a month row. Keep to the title there |
|
|
162
|
+
| `eventClassName` | `(event: E) => string \| undefined` | A class for one event's element in every view, next to `classNames.event`: a tentative, cancelled or selected event |
|
|
146
163
|
| `ref` | `Ref<HTMLDivElement>` | The root element |
|
|
147
164
|
|
|
148
165
|
Give the calendar a height. It is `40em` tall by default and scrolls inside itself; `style={{ height: '100dvh' }}` or a class sets another.
|
|
149
166
|
|
|
150
|
-
**Keyboard:** in the month view the days are a grid with one tab stop on the selected day: `←`/`→` move a day, `↑`/`↓` a week, `Home`/`End` go to the start and end of the week, `PageUp`/`PageDown` a month. `Enter` or `Space` opens a list of that day's events, with a **New event** button when `onSlotCreate` is set. In the week and day views every event is a button, in time order.
|
|
167
|
+
**Keyboard:** in the month view the days are a grid with one tab stop on the selected day: `←`/`→` move a day, `↑`/`↓` a week, `Home`/`End` go to the start and end of the week, `PageUp`/`PageDown` a month. `Enter` or `Space` opens a list of that day's events, with a **New event** button when `onSlotCreate` is set. In the week and day views every event is a button, in time order. The header's **New event** button creates in every view; opened from it with the keyboard, a `Popover` editor takes the focus.
|
|
151
168
|
|
|
152
169
|
**Accessibility:**
|
|
153
170
|
|
|
154
171
|
- The period title is a polite live region, so paging is announced.
|
|
155
172
|
- Days carry their full date and event count as their name, and today has `aria-current="date"`.
|
|
156
173
|
- Each day column of the time grid is a group named by its date.
|
|
157
|
-
- **Dragging needs a single-pointer alternative (WCAG 2.5.7).** Creating has one, a click. For moving and resizing it has to be your `onEventClick` dialog, so let it edit the start and end.
|
|
174
|
+
- **Dragging needs a single-pointer alternative (WCAG 2.5.7).** Creating has one, a click, and the header's button. For moving and resizing it has to be your `onEventClick` dialog, so let it edit the start and end.
|
|
158
175
|
|
|
159
176
|
**Theming:** these are theme variables (typed on `ThemeVariables`). Set them theme-wide via `ThemeProvider`'s `variables`, or per instance via `style`:
|
|
160
177
|
|
|
@@ -164,21 +181,22 @@ Give the calendar a height. It is `40em` tall by default and scrolls inside itse
|
|
|
164
181
|
| `--calendar-today-color` | `var(--primary-color)` |
|
|
165
182
|
| `--calendar-now-color` | `var(--error-color)` |
|
|
166
183
|
| `--calendar-event-radius` | `6px` |
|
|
184
|
+
| `--calendar-off-hours-color` | `var(--background-accent)` (the hours outside `workingHours`) |
|
|
167
185
|
|
|
168
|
-
**Global defaults:** `ConfigProvider` sets `labels`, `locale`, `weekStartsOn`, `slotMinutes`, `views`, `hiddenDays` and `
|
|
186
|
+
**Global defaults:** `ConfigProvider` sets `labels`, `locale`, `weekStartsOn`, `slotMinutes`, `views`, `hiddenDays`, `scrollToHour`, `workingHours` and `showWeekNumbers` for every calendar, e.g. `defaultProps={{ Calendar: { locale: 'de-AT', weekStartsOn: 1 } }}`. The other props depend on your event type, so they are set per instance. See [ConfigProvider.md](ConfigProvider.md).
|
|
169
187
|
|
|
170
188
|
**Slots:** `root` `header` `dayHeader` `cell` `event`
|
|
171
189
|
|
|
172
|
-
**Labels:** `previous` `next` `today` `viewSwitcher` `month` `week` `day` `agenda` `allDay` `more` `eventCount` `noEvents` `newEvent`: the text this component renders of its own. `more` and `eventCount` are functions of a count. Dates and times come from `locale`, not from here. Pass `labels` to override any of them, on the component or app-wide through `ConfigProvider`; keys merge individually. Type: `CalendarLabels`.
|
|
190
|
+
**Labels:** `previous` `next` `today` `viewSwitcher` `month` `week` `day` `agenda` `allDay` `more` `eventCount` `noEvents` `newEvent` `weekNumber`: the text this component renders of its own. `more` and `eventCount` are functions of a count, `weekNumber` of the week's number. Dates and times come from `locale`, not from here. Pass `labels` to override any of them, on the component or app-wide through `ConfigProvider`; keys merge individually. Type: `CalendarLabels`.
|
|
173
191
|
|
|
174
192
|
**Limits:**
|
|
175
193
|
|
|
176
|
-
- **One time zone, the browser's.**
|
|
194
|
+
- **One time zone, the browser's.** Every day boundary and clock time is worked out from the local `Date` fields. Showing another zone would mean routing each of them through `Intl` offset lookups, which the calendar does not do.
|
|
177
195
|
- **No recurrence rules.** Expand series for the range `onRangeChange` reports.
|
|
178
196
|
- **Moving stays within the shown period**, and between days or times of the same kind: an event cannot be dragged from the time grid into the all-day row.
|
|
197
|
+
- **No resource columns.** A column per person or room, as a team schedule has, is not a view of its own.
|
|
179
198
|
- **No right-to-left layout.**
|
|
180
199
|
- **Safari on macOS** sends a trackpad pinch as a gesture event rather than a Ctrl+wheel, so there it zooms the page as usual; pinching on a touch screen zooms the hours in every browser.
|
|
181
200
|
- **A controlled `date` must update in the same render as `onDateChange`.** After a swipe, the calendar shows the new period's panes straight away; a parent that updates later makes it jump back and forth.
|
|
182
|
-
- **A tap outside your own popover also reaches the calendar.** `Popover` closes on pointer release and lets the click through, so a tap on empty time closes it and creates a slot: an editor opened from `onSlotCreate` moves to the new slot.
|
|
183
201
|
|
|
184
202
|
HTML attributes such as `id`, `aria-label` and `data-*` are passed to the root element.
|
package/docs/Card.md
CHANGED
|
@@ -4,26 +4,46 @@
|
|
|
4
4
|
|
|
5
5
|
**Keywords:** panel, box
|
|
6
6
|
|
|
7
|
-
**Import:** `import { Card, CardStyleType, CardHeader, CardMedia, CardContent, CardActions } from '@ahrowe/ui'`
|
|
7
|
+
**Import:** `import { Card, CardStyleType, CardHeader, CardMedia, CardContent, CardActions, ThemeColor } from '@ahrowe/ui'`
|
|
8
8
|
|
|
9
|
-
**
|
|
9
|
+
**Styles:** `Outlined` and `Light` mean what they mean on Button, Badge and Chip; `color` is the
|
|
10
|
+
colour they use (a `ThemeColor`, default `Neutral`, or any CSS colour, see
|
|
11
|
+
[ThemeColor.md](ThemeColor.md)). Text inside stays the page's text colour in every style. There
|
|
12
|
+
is no `Filled`: body text on a solid colour reads badly.
|
|
13
|
+
|
|
14
|
+
- `CardStyleType.Elevated` (default): a raised surface with a shadow, always neutral
|
|
15
|
+
- `CardStyleType.Outlined`: a border in the colour, no fill. In a colour it marks one card among its neighbours, such as the current plan. Say what the mark means in text as well (a subtitle or a Badge): the colour alone is not read out
|
|
16
|
+
- `CardStyleType.Light`: a flat tint of the colour, no border. In a colour it sets one card apart by a colour of its own, such as the recommended plan or a category
|
|
17
|
+
|
|
18
|
+
A message about something that happened (saved, failed, almost full) is not a coloured card but an
|
|
19
|
+
[Alert](Alert.md), which brings the icon, the screen-reader role and the dismiss button.
|
|
10
20
|
|
|
11
21
|
```tsx
|
|
12
|
-
import { Card, CardStyleType, CardHeader, CardMedia, CardContent, CardActions } from '@ahrowe/ui';
|
|
22
|
+
import { Card, CardStyleType, CardHeader, CardMedia, CardContent, CardActions, ThemeColor } from '@ahrowe/ui';
|
|
13
23
|
|
|
14
|
-
// Elevated (default)
|
|
24
|
+
// Elevated (default): fill and shadow
|
|
15
25
|
<Card>
|
|
16
|
-
<CardHeader title="Elevated" subTitle="Fill
|
|
26
|
+
<CardHeader title="Elevated" subTitle="Fill and shadow" />
|
|
17
27
|
</Card>
|
|
18
28
|
|
|
19
|
-
// Outlined
|
|
29
|
+
// Outlined: transparent, defined by a border, no shadow
|
|
20
30
|
<Card styleType={CardStyleType.Outlined}>
|
|
21
31
|
<CardHeader title="Outlined" />
|
|
22
32
|
</Card>
|
|
23
33
|
|
|
24
|
-
//
|
|
25
|
-
<Card styleType={CardStyleType.
|
|
26
|
-
<CardHeader title="
|
|
34
|
+
// Light: flat fill, no shadow
|
|
35
|
+
<Card styleType={CardStyleType.Light}>
|
|
36
|
+
<CardHeader title="Light" />
|
|
37
|
+
</Card>
|
|
38
|
+
|
|
39
|
+
// The selected plan, bordered in the primary colour
|
|
40
|
+
<Card styleType={CardStyleType.Outlined} color={ThemeColor.Primary}>
|
|
41
|
+
<CardHeader title="Pro" subTitle="Your current plan" />
|
|
42
|
+
</Card>
|
|
43
|
+
|
|
44
|
+
// The recommended plan, tinted
|
|
45
|
+
<Card styleType={CardStyleType.Light} color={ThemeColor.Primary}>
|
|
46
|
+
<CardHeader title="Team" subTitle="Recommended for 5 people or more" />
|
|
27
47
|
</Card>
|
|
28
48
|
|
|
29
49
|
<Card hoverEffect onClick={handleClick}>
|
|
@@ -39,7 +59,7 @@ import { Card, CardStyleType, CardHeader, CardMedia, CardContent, CardActions }
|
|
|
39
59
|
<CardActions
|
|
40
60
|
actions={[
|
|
41
61
|
{ id: 'edit', label: 'Edit', onClick: handleEdit },
|
|
42
|
-
{ id: 'delete', label: 'Delete',
|
|
62
|
+
{ id: 'delete', label: 'Delete', color: ThemeColor.Error, onClick: handleDelete },
|
|
43
63
|
]}
|
|
44
64
|
/>
|
|
45
65
|
</Card>
|
|
@@ -49,15 +69,16 @@ All sub-components are optional — use only what you need. Stacked sub-componen
|
|
|
49
69
|
|
|
50
70
|
**Enums:**
|
|
51
71
|
|
|
52
|
-
- `CardStyleType`: `Elevated` (default) | `Outlined` | `
|
|
72
|
+
- `CardStyleType`: `Elevated` (default) | `Outlined` | `Light`
|
|
53
73
|
|
|
54
74
|
**CardProps:**
|
|
55
75
|
|
|
56
76
|
| Prop | Type | Description |
|
|
57
77
|
|------|------|-------------|
|
|
58
|
-
| `styleType` | `CardStyleType` |
|
|
78
|
+
| `styleType` | `CardStyleType` | `Elevated` (default, fill and shadow), `Outlined` (a border) or `Light` (a flat fill) |
|
|
79
|
+
| `color` | `ColorValue` | The border of `Outlined` and the tint of `Light`: a `ThemeColor` (default `Neutral`, the theme's card surfaces) or any CSS colour. `Elevated` ignores it |
|
|
59
80
|
| `onClick` | `() => void` | Makes the card clickable, by pointer and by Enter/Space. A click or key on a control inside the card (a field, a link, a button, anything with an interactive `role`) is that control's, and neither fires this nor ripples |
|
|
60
|
-
| `hoverEffect` | `boolean` |
|
|
81
|
+
| `hoverEffect` | `boolean` | Lifts the card on hover and tints it in its text colour, over whatever its style and colour paint |
|
|
61
82
|
| `tabIndex` | `number \| null` | For keyboard navigation |
|
|
62
83
|
| `autoGap` | `boolean` | Space stacked sub-components apart with a shared gap (default `true`); set `false` to space them yourself |
|
|
63
84
|
| `clip` | `boolean` | Clip content to the rounded corners (`overflow: hidden`, default `false`). Set `true` for full-bleed `CardMedia` or a clipped hover/ripple effect. Safe to enable even when the card holds a `Dropdown`/`Popover`/`Tooltip` — those popovers are portaled and always escape the card regardless of this setting |
|
|
@@ -75,7 +96,7 @@ All sub-components are optional — use only what you need. Stacked sub-componen
|
|
|
75
96
|
|
|
76
97
|
| Prop | Type | Description |
|
|
77
98
|
|------|------|-------------|
|
|
78
|
-
| `actions` | `CardAction[]` | Array of `{ id, label, styleType, onClick }` renders Buttons |
|
|
99
|
+
| `actions` | `CardAction[]` | Array of `{ id, label, styleType, color, onClick }` renders Buttons (`Outlined` `Primary` unless set) |
|
|
79
100
|
| `children` | `ReactNode` | Custom content instead of `actions` |
|
|
80
101
|
|
|
81
102
|
## Sizing
|
|
@@ -85,3 +106,21 @@ Card is spaced by its font: the padding, the header's gap and thumbnail, the gap
|
|
|
85
106
|
`CardMedia` bleeds to the card's edges with a negative margin that has to stay equal to the padding, so change the two together.
|
|
86
107
|
|
|
87
108
|
**Slots:** `root` `content`
|
|
109
|
+
|
|
110
|
+
## Migration from `Filled`
|
|
111
|
+
|
|
112
|
+
Before 0.43 the flat style was called `Filled`. It is `Light` now, the name the library's other
|
|
113
|
+
components use for the same look. TypeScript points at each use:
|
|
114
|
+
|
|
115
|
+
| Before | After |
|
|
116
|
+
|--------|-------|
|
|
117
|
+
| `styleType={CardStyleType.Filled}` | `styleType={CardStyleType.Light}` |
|
|
118
|
+
|
|
119
|
+
`defaultTheme` and `lightTheme` still draw it in `Neutral` in `--background-accent`, through
|
|
120
|
+
`--background-card-filled`. A theme that does not set that variable now gets the see-through tint
|
|
121
|
+
of the text colour that every other `Light` uses, where it used to get `--background-accent`. On a
|
|
122
|
+
dark theme that tint is about as light as `Elevated`, so set the variable there to keep the two
|
|
123
|
+
apart.
|
|
124
|
+
|
|
125
|
+
A card with `hoverEffect` no longer turns `--background-accent` on hover: it keeps its own surface
|
|
126
|
+
and gets a light tint in its text colour over it, so a coloured card keeps its colour.
|