@bitforgehq/ui 0.3.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 +3665 -0
- package/LICENSE +21 -0
- package/README.md +175 -0
- package/ai/MANIFEST.index.json +383 -0
- package/ai/MANIFEST.json +7528 -0
- package/ai/REFERENCE.index.json +1461 -0
- package/ai/REFERENCE.json +7213 -0
- package/ai/UI_GUIDE.md +1159 -0
- package/ai/components/action-bar.md +209 -0
- package/ai/components/action-sheet.md +526 -0
- package/ai/components/alert-dialog.md +509 -0
- package/ai/components/alert.md +376 -0
- package/ai/components/avatar.md +146 -0
- package/ai/components/back-button.md +286 -0
- package/ai/components/badge.md +171 -0
- package/ai/components/button.md +431 -0
- package/ai/components/card.md +303 -0
- package/ai/components/checkbox.md +418 -0
- package/ai/components/chip-group.md +205 -0
- package/ai/components/chip.md +300 -0
- package/ai/components/content.md +474 -0
- package/ai/components/desktop-toast.md +420 -0
- package/ai/components/dialog.md +962 -0
- package/ai/components/empty-state.md +146 -0
- package/ai/components/field.md +319 -0
- package/ai/components/header.md +809 -0
- package/ai/components/icon-button.md +221 -0
- package/ai/components/icon.md +176 -0
- package/ai/components/input.md +455 -0
- package/ai/components/list-item.md +326 -0
- package/ai/components/list.md +178 -0
- package/ai/components/menu-button.md +377 -0
- package/ai/components/menu.md +661 -0
- package/ai/components/modal.md +613 -0
- package/ai/components/number-input.md +423 -0
- package/ai/components/page.md +299 -0
- package/ai/components/progress.md +215 -0
- package/ai/components/radio-group.md +432 -0
- package/ai/components/refresher.md +377 -0
- package/ai/components/segmented.md +517 -0
- package/ai/components/select.md +510 -0
- package/ai/components/sheet.md +845 -0
- package/ai/components/spinner.md +171 -0
- package/ai/components/stack-outlet.md +661 -0
- package/ai/components/tab-bar.md +427 -0
- package/ai/components/tab.md +295 -0
- package/ai/components/tabs.md +408 -0
- package/ai/components/textarea.md +371 -0
- package/ai/components/toast.md +522 -0
- package/ai/components/toggle.md +387 -0
- package/ai/reference/bf-action-directive.md +21 -0
- package/ai/reference/bf-action-sheet-action-role.md +27 -0
- package/ai/reference/bf-action-sheet-action.md +28 -0
- package/ai/reference/bf-action-sheet-options.md +28 -0
- package/ai/reference/bf-action-sheet-service.md +33 -0
- package/ai/reference/bf-alert-dialog-button-role.md +27 -0
- package/ai/reference/bf-alert-dialog-button.md +27 -0
- package/ai/reference/bf-alert-dialog-options.md +29 -0
- package/ai/reference/bf-alert-dialog-service.md +34 -0
- package/ai/reference/bf-alert-variant.md +28 -0
- package/ai/reference/bf-autocapitalize.md +30 -0
- package/ai/reference/bf-avatar-size.md +27 -0
- package/ai/reference/bf-avatar-variant.md +28 -0
- package/ai/reference/bf-back-at-root.md +28 -0
- package/ai/reference/bf-back-button-service.md +40 -0
- package/ai/reference/bf-badge-variant.md +29 -0
- package/ai/reference/bf-button-size.md +29 -0
- package/ai/reference/bf-button-type.md +28 -0
- package/ai/reference/bf-button-variant.md +29 -0
- package/ai/reference/bf-card-padding.md +26 -0
- package/ai/reference/bf-card-variant.md +28 -0
- package/ai/reference/bf-chip-group-mode.md +27 -0
- package/ai/reference/bf-chip-variant.md +26 -0
- package/ai/reference/bf-compare-with.md +24 -0
- package/ai/reference/bf-component-overlay-ref.md +33 -0
- package/ai/reference/bf-confirm-button-role.md +26 -0
- package/ai/reference/bf-confirm-button.md +27 -0
- package/ai/reference/bf-confirm-options.md +31 -0
- package/ai/reference/bf-confirm-size.md +26 -0
- package/ai/reference/bf-content-scroll-event.md +21 -0
- package/ai/reference/bf-defaults-options.md +32 -0
- package/ai/reference/bf-defaults.md +28 -0
- package/ai/reference/bf-desktop-toast-config.md +28 -0
- package/ai/reference/bf-desktop-toast-harness.md +33 -0
- package/ai/reference/bf-desktop-toast-options.md +28 -0
- package/ai/reference/bf-desktop-toast-position.md +28 -0
- package/ai/reference/bf-desktop-toast-service.md +42 -0
- package/ai/reference/bf-dialog-config.md +44 -0
- package/ai/reference/bf-dialog-harness.md +52 -0
- package/ai/reference/bf-dialog-ref.md +44 -0
- package/ai/reference/bf-dialog-role.md +26 -0
- package/ai/reference/bf-dialog-service.md +55 -0
- package/ai/reference/bf-dialog-size.md +31 -0
- package/ai/reference/bf-dialog-template-context.md +32 -0
- package/ai/reference/bf-empty-state-heading-level.md +26 -0
- package/ai/reference/bf-enter-key-hint.md +31 -0
- package/ai/reference/bf-field-control-class.md +32 -0
- package/ai/reference/bf-field-control-state.md +28 -0
- package/ai/reference/bf-field-size.md +29 -0
- package/ai/reference/bf-haptics-impact-style.md +27 -0
- package/ai/reference/bf-haptics-notification-type.md +27 -0
- package/ai/reference/bf-haptics-service.md +41 -0
- package/ai/reference/bf-harness-filters.md +29 -0
- package/ai/reference/bf-horizontal-scroll-directive.md +129 -0
- package/ai/reference/bf-icon-button-variant.md +28 -0
- package/ai/reference/bf-icon-size.md +27 -0
- package/ai/reference/bf-input-autocapitalize.md +36 -0
- package/ai/reference/bf-input-enter-key-hint.md +38 -0
- package/ai/reference/bf-input-input-mode.md +38 -0
- package/ai/reference/bf-input-mode.md +32 -0
- package/ai/reference/bf-input-type.md +35 -0
- package/ai/reference/bf-jsdom-shim-options.md +22 -0
- package/ai/reference/bf-keyboard-assist-behavior.md +26 -0
- package/ai/reference/bf-keyboard-assist-directive.md +185 -0
- package/ai/reference/bf-keyboard-phase.md +30 -0
- package/ai/reference/bf-keyboard-service.md +50 -0
- package/ai/reference/bf-labels-overrides.md +26 -0
- package/ai/reference/bf-labels.md +44 -0
- package/ai/reference/bf-menu-button-harness.md +40 -0
- package/ai/reference/bf-menu-button-variant.md +27 -0
- package/ai/reference/bf-menu-divider-directive.md +13 -0
- package/ai/reference/bf-menu-group-directive.md +14 -0
- package/ai/reference/bf-menu-harness.md +55 -0
- package/ai/reference/bf-menu-item-checkbox-directive.md +31 -0
- package/ai/reference/bf-menu-item-directive.md +31 -0
- package/ai/reference/bf-menu-item-harness.md +52 -0
- package/ai/reference/bf-menu-item-radio-directive.md +29 -0
- package/ai/reference/bf-menu-placement.md +29 -0
- package/ai/reference/bf-menu-trigger-directive.md +46 -0
- package/ai/reference/bf-modal-options.md +30 -0
- package/ai/reference/bf-modal-presentation.md +26 -0
- package/ai/reference/bf-modal-service.md +38 -0
- package/ai/reference/bf-nav-controller.md +59 -0
- package/ai/reference/bf-nav-direction.md +23 -0
- package/ai/reference/bf-nav-target.md +21 -0
- package/ai/reference/bf-number-input-mode.md +28 -0
- package/ai/reference/bf-number-input-step.md +25 -0
- package/ai/reference/bf-overlay-auto-focus.md +29 -0
- package/ai/reference/bf-overlay-controller.md +22 -0
- package/ai/reference/bf-overlay-host.md +36 -0
- package/ai/reference/bf-overlay-options.md +53 -0
- package/ai/reference/bf-overlay-position.md +30 -0
- package/ai/reference/bf-overlay-ref.md +53 -0
- package/ai/reference/bf-overlay-role.md +27 -0
- package/ai/reference/bf-overlay-service.md +53 -0
- package/ai/reference/bf-overlay-stack-options.md +24 -0
- package/ai/reference/bf-overlay-stack.md +81 -0
- package/ai/reference/bf-overlay-template-context.md +24 -0
- package/ai/reference/bf-overscroll-stretch-directive.md +163 -0
- package/ai/reference/bf-page-context.md +24 -0
- package/ai/reference/bf-platform-service.md +53 -0
- package/ai/reference/bf-platform.md +28 -0
- package/ai/reference/bf-progress-size.md +26 -0
- package/ai/reference/bf-progress-tone.md +28 -0
- package/ai/reference/bf-radio-group-harness.md +49 -0
- package/ai/reference/bf-radio-group-orientation.md +26 -0
- package/ai/reference/bf-radio-option.md +30 -0
- package/ai/reference/bf-refresher-refresh-event.md +22 -0
- package/ai/reference/bf-segment-option.md +29 -0
- package/ai/reference/bf-segmented-harness.md +48 -0
- package/ai/reference/bf-segmented-size.md +29 -0
- package/ai/reference/bf-select-harness.md +70 -0
- package/ai/reference/bf-select-option.md +29 -0
- package/ai/reference/bf-sheet-auto-focus.md +29 -0
- package/ai/reference/bf-sheet-options.md +32 -0
- package/ai/reference/bf-sheet-ref.md +45 -0
- package/ai/reference/bf-sheet-service.md +34 -0
- package/ai/reference/bf-shell-config-mode.md +28 -0
- package/ai/reference/bf-shell-config.md +38 -0
- package/ai/reference/bf-shell-dynamic-type-limit.md +21 -0
- package/ai/reference/bf-shell-dynamic-type.md +25 -0
- package/ai/reference/bf-shell-mode.md +28 -0
- package/ai/reference/bf-shell-testing-options.md +26 -0
- package/ai/reference/bf-size.md +45 -0
- package/ai/reference/bf-spinner-size.md +27 -0
- package/ai/reference/bf-stack-change.md +22 -0
- package/ai/reference/bf-stack-reuse-strategy.md +32 -0
- package/ai/reference/bf-stack-transition-event.md +26 -0
- package/ai/reference/bf-stack-transition.md +26 -0
- package/ai/reference/bf-stacked-overlay.md +23 -0
- package/ai/reference/bf-system-bars-style.md +38 -0
- package/ai/reference/bf-tab-bar-controller.md +51 -0
- package/ai/reference/bf-tab-bar-host.md +52 -0
- package/ai/reference/bf-tab-context.md +32 -0
- package/ai/reference/bf-tab-links.md +37 -0
- package/ai/reference/bf-testing-options.md +27 -0
- package/ai/reference/bf-text-scale-service.md +35 -0
- package/ai/reference/bf-theme.md +27 -0
- package/ai/reference/bf-toast-action.md +25 -0
- package/ai/reference/bf-toast-controller.md +17 -0
- package/ai/reference/bf-toast-dismiss-reason.md +29 -0
- package/ai/reference/bf-toast-options.md +29 -0
- package/ai/reference/bf-toast-position.md +26 -0
- package/ai/reference/bf-toast-ref.md +41 -0
- package/ai/reference/bf-toast-service.md +39 -0
- package/ai/reference/bf-toggle-label-position.md +26 -0
- package/ai/reference/bf-transition-kind.md +28 -0
- package/ai/reference/bf-validation-message.md +31 -0
- package/ai/reference/bf-validation-messages.md +33 -0
- package/ai/reference/bf-view-event.md +28 -0
- package/ai/reference/bf-view-lifecycle.md +41 -0
- package/ai/reference/bf-view-state.md +28 -0
- package/ai/reference/bf_default_labels.md +21 -0
- package/ai/reference/bf_default_values.md +21 -0
- package/ai/reference/bf_defaults.md +21 -0
- package/ai/reference/bf_desktop_toast_defaults.md +21 -0
- package/ai/reference/bf_dialog_data.md +17 -0
- package/ai/reference/bf_labels.md +21 -0
- package/ai/reference/bf_overlay_data.md +19 -0
- package/ai/reference/bf_overlay_host.md +21 -0
- package/ai/reference/bf_sheet_default_snap_points.md +17 -0
- package/ai/reference/bf_shell_config.md +21 -0
- package/ai/reference/bf_shell_defaults.md +21 -0
- package/ai/reference/bf_tab_bar.md +21 -0
- package/ai/reference/bf_tab_bar_controller.md +21 -0
- package/ai/reference/bf_tab_context.md +21 -0
- package/ai/reference/bf_tab_links.md +21 -0
- package/ai/reference/bf_theme_storage.md +19 -0
- package/ai/reference/create-transition.md +36 -0
- package/ai/reference/duration_fast.md +17 -0
- package/ai/reference/duration_md.md +17 -0
- package/ai/reference/duration_overlay.md +17 -0
- package/ai/reference/duration_push.md +17 -0
- package/ai/reference/fade-down.md +26 -0
- package/ai/reference/fade-in.md +25 -0
- package/ai/reference/fade-out.md +25 -0
- package/ai/reference/fade-up.md +26 -0
- package/ai/reference/inject-shell-mode.md +23 -0
- package/ai/reference/install-bf-jsdom-shims.md +31 -0
- package/ai/reference/ios_duration.md +17 -0
- package/ai/reference/ios_easing.md +17 -0
- package/ai/reference/is-text-entry.md +25 -0
- package/ai/reference/max_complete_ms.md +17 -0
- package/ai/reference/md-transition.md +31 -0
- package/ai/reference/md_duration.md +17 -0
- package/ai/reference/md_easing.md +17 -0
- package/ai/reference/overlay_duration.md +21 -0
- package/ai/reference/overlay_easing.md +19 -0
- package/ai/reference/overlay_reduced_duration.md +17 -0
- package/ai/reference/pop-frames-at.md +25 -0
- package/ai/reference/prefers-reduced-motion.md +25 -0
- package/ai/reference/provide-bf-defaults.md +33 -0
- package/ai/reference/provide-bf-desktop-toast.md +28 -0
- package/ai/reference/provide-bf-labels.md +38 -0
- package/ai/reference/provide-bf-shell-testing.md +34 -0
- package/ai/reference/provide-bf-shell.md +41 -0
- package/ai/reference/provide-bf-testing.md +33 -0
- package/ai/reference/reduced-transition.md +28 -0
- package/ai/reference/reduced_duration.md +17 -0
- package/ai/reference/resolve-shell-mode.md +33 -0
- package/ai/reference/scale-in.md +25 -0
- package/ai/reference/settle-duration.md +25 -0
- package/ai/reference/settle-pop.md +33 -0
- package/ai/reference/settle_easing.md +17 -0
- package/ai/reference/should-complete-pop.md +26 -0
- package/ai/reference/slide-down.md +26 -0
- package/ai/reference/slide-up.md +26 -0
- package/ai/reference/with-bf-shell-routing.md +19 -0
- package/bin/bf-ui.js +81 -0
- package/fesm2022/bitforgehq-ui-icons.mjs +230 -0
- package/fesm2022/bitforgehq-ui-icons.mjs.map +1 -0
- package/fesm2022/bitforgehq-ui-mobile.mjs +5530 -0
- package/fesm2022/bitforgehq-ui-mobile.mjs.map +1 -0
- package/fesm2022/bitforgehq-ui-number-input.mjs +680 -0
- package/fesm2022/bitforgehq-ui-number-input.mjs.map +1 -0
- package/fesm2022/bitforgehq-ui-overlay.mjs +2675 -0
- package/fesm2022/bitforgehq-ui-overlay.mjs.map +1 -0
- package/fesm2022/bitforgehq-ui-testing.mjs +402 -0
- package/fesm2022/bitforgehq-ui-testing.mjs.map +1 -0
- package/fesm2022/bitforgehq-ui.mjs +7765 -0
- package/fesm2022/bitforgehq-ui.mjs.map +1 -0
- package/llms-full.txt +25394 -0
- package/llms.txt +329 -0
- package/package.json +94 -0
- package/theme.css +253 -0
- package/types/bitforgehq-ui-icons.d.ts +50 -0
- package/types/bitforgehq-ui-mobile.d.ts +2914 -0
- package/types/bitforgehq-ui-number-input.d.ts +282 -0
- package/types/bitforgehq-ui-overlay.d.ts +1514 -0
- package/types/bitforgehq-ui-testing.d.ts +495 -0
- package/types/bitforgehq-ui.d.ts +3499 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
# bf-card
|
|
2
|
+
|
|
3
|
+
Content surface with an optional header slot, in four visual styles from raised to flat
|
|
4
|
+
|
|
5
|
+
`BfCardComponent` from `@bitforgehq/ui` · Data display · since 0.1.0
|
|
6
|
+
|
|
7
|
+
## Example
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Component, signal } from '@angular/core';
|
|
11
|
+
import { RouterLink } from '@angular/router';
|
|
12
|
+
import {
|
|
13
|
+
BfBadgeComponent,
|
|
14
|
+
BfButtonComponent,
|
|
15
|
+
BfCardComponent,
|
|
16
|
+
BfActionDirective,
|
|
17
|
+
BfProgressComponent,
|
|
18
|
+
} from '@bitforgehq/ui';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The bf-card overview.
|
|
22
|
+
*
|
|
23
|
+
* Live demo of `bf-card`: a raised project card whose heading is a stretched `bfAction` link (to this page's "Clickable card" section) with a raised Share button, a tint stat card whose heading is a stretched `bfAction` button, and an ink focus card whose actions respond.
|
|
24
|
+
*/
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'app-example-card-overview',
|
|
27
|
+
imports: [
|
|
28
|
+
RouterLink,
|
|
29
|
+
BfActionDirective,
|
|
30
|
+
BfCardComponent,
|
|
31
|
+
BfBadgeComponent,
|
|
32
|
+
BfProgressComponent,
|
|
33
|
+
BfButtonComponent,
|
|
34
|
+
],
|
|
35
|
+
template: `
|
|
36
|
+
<div class="flex flex-col gap-3">
|
|
37
|
+
<div class="grid grid-cols-1 gap-4 @sm:grid-cols-3">
|
|
38
|
+
<bf-card>
|
|
39
|
+
<span bfSlot="header" class="flex items-center justify-between">
|
|
40
|
+
<span class="text-caption text-text-muted">Project</span>
|
|
41
|
+
<bf-badge variant="success">On track</bf-badge>
|
|
42
|
+
</span>
|
|
43
|
+
<!-- The heading's link is the card's one action; its ::after covers the card. -->
|
|
44
|
+
<h2 class="text-heading">
|
|
45
|
+
<a bfAction routerLink="/components/card" fragment="clickable-card">Atlas rebrand</a>
|
|
46
|
+
</h2>
|
|
47
|
+
<bf-progress [value]="68" label="Atlas rebrand progress" />
|
|
48
|
+
<!-- Raised above the stretched link, so it keeps its own click. -->
|
|
49
|
+
<bf-button
|
|
50
|
+
class="relative z-1 self-start"
|
|
51
|
+
variant="tonal"
|
|
52
|
+
size="sm"
|
|
53
|
+
(clicked)="status.set('Shared Atlas rebrand.')"
|
|
54
|
+
>
|
|
55
|
+
Share
|
|
56
|
+
</bf-button>
|
|
57
|
+
</bf-card>
|
|
58
|
+
<bf-card variant="tint">
|
|
59
|
+
<h2 class="text-caption text-primary-strong font-semibold">
|
|
60
|
+
<button bfAction type="button" (click)="openStats()">Completed this week</button>
|
|
61
|
+
</h2>
|
|
62
|
+
<span class="text-heading">18 · +4 vs last week</span>
|
|
63
|
+
</bf-card>
|
|
64
|
+
<bf-card variant="ink" padding="lg">
|
|
65
|
+
<span class="text-caption font-semibold">Focus session</span>
|
|
66
|
+
<span class="text-heading">Block 45 minutes for the Atlas deck</span>
|
|
67
|
+
<div class="flex gap-2">
|
|
68
|
+
<bf-button size="sm" (clicked)="status.set('Focus session started.')">Start</bf-button>
|
|
69
|
+
<bf-button variant="tonal" size="sm" (clicked)="status.set('Snoozed for an hour.')">
|
|
70
|
+
Later
|
|
71
|
+
</bf-button>
|
|
72
|
+
</div>
|
|
73
|
+
</bf-card>
|
|
74
|
+
</div>
|
|
75
|
+
<p data-status aria-live="polite" class="text-caption text-text-muted">{{ status() }}</p>
|
|
76
|
+
</div>
|
|
77
|
+
`,
|
|
78
|
+
})
|
|
79
|
+
export class CardOverviewExampleComponent {
|
|
80
|
+
readonly opened = signal(0);
|
|
81
|
+
readonly status = signal('Click a card, or one of its buttons.');
|
|
82
|
+
|
|
83
|
+
openStats(): void {
|
|
84
|
+
this.opened.update((count) => count + 1);
|
|
85
|
+
this.status.set(
|
|
86
|
+
`Opened the weekly stats ${this.opened()} ${this.opened() === 1 ? 'time' : 'times'}.`,
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Overview
|
|
93
|
+
|
|
94
|
+
Surface for a piece of content: a project summary, a stat, a focus prompt. Four variants from
|
|
95
|
+
the design: raised (default), tint, ink and flat. To make the whole card clickable, put a
|
|
96
|
+
`bfAction` link or button in its heading (the stretched-link pattern).
|
|
97
|
+
|
|
98
|
+
Cards group a piece of content on the canvas. The raised card is the workhorse; tint highlights a stat or a callout; ink is the dark focus card; flat sits inside another surface.
|
|
99
|
+
|
|
100
|
+
## When to use
|
|
101
|
+
|
|
102
|
+
Use `bf-card` to group one piece of content on the canvas: a stat, a project summary, a callout. Make it clickable with a `bfAction` link when the whole card opens one thing. Use [bf-list](https://bitforge-ui.web.app/components/list) instead for repeated rows of the same kind, and [bf-alert](https://bitforge-ui.web.app/components/alert) for a status message.
|
|
103
|
+
|
|
104
|
+
## Basic usage
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import { Component } from '@angular/core';
|
|
108
|
+
import { BfCardComponent, BfProgressComponent } from '@bitforgehq/ui';
|
|
109
|
+
|
|
110
|
+
/** A project card with header, body and footer. */
|
|
111
|
+
@Component({
|
|
112
|
+
selector: 'app-example-card-basic',
|
|
113
|
+
imports: [BfCardComponent, BfProgressComponent],
|
|
114
|
+
template: `
|
|
115
|
+
<bf-card>
|
|
116
|
+
<span bfSlot="header" class="text-caption text-text-muted">Project</span>
|
|
117
|
+
<h3 class="text-heading">Atlas rebrand</h3>
|
|
118
|
+
<bf-progress [value]="68" label="Progress" />
|
|
119
|
+
<span bfSlot="footer" class="text-caption text-text-muted">12 of 18 tasks</span>
|
|
120
|
+
</bf-card>
|
|
121
|
+
`,
|
|
122
|
+
})
|
|
123
|
+
export class CardBasicExampleComponent {}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Variants
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
import { Component } from '@angular/core';
|
|
130
|
+
import { BfCardComponent } from '@bitforgehq/ui';
|
|
131
|
+
|
|
132
|
+
/** The tint and ink cards, and a flat card inside a raised one. */
|
|
133
|
+
@Component({
|
|
134
|
+
selector: 'app-example-card-variants',
|
|
135
|
+
imports: [BfCardComponent],
|
|
136
|
+
template: `
|
|
137
|
+
<div class="grid gap-3 @sm:grid-cols-2">
|
|
138
|
+
<bf-card variant="tint"><span class="text-display">18</span></bf-card>
|
|
139
|
+
<bf-card variant="ink"
|
|
140
|
+
><span class="text-heading">Block 45 minutes for the Atlas deck</span></bf-card
|
|
141
|
+
>
|
|
142
|
+
<bf-card class="@sm:col-span-2">
|
|
143
|
+
<bf-card variant="flat">Inside a raised card</bf-card>
|
|
144
|
+
</bf-card>
|
|
145
|
+
</div>
|
|
146
|
+
`,
|
|
147
|
+
})
|
|
148
|
+
export class CardVariantsExampleComponent {}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Clickable card
|
|
152
|
+
|
|
153
|
+
A card that opens something is a stretched link: its heading holds the one interactive element, an `<a bfAction>` (navigation, with `href` or `routerLink`) or a `<button bfAction>` (an action on the page), and `bfAction` stretches that element's hit area over the whole card with an `::after`. The heading stays a heading, the link's name is the title alone, and the card shows the pointer, the `shadow-floating` hover and the focus ring (drawn on the card while the link has keyboard focus). Import `BfActionDirective` from `@bitforgehq/ui`.
|
|
154
|
+
|
|
155
|
+
Other controls inside the card (a secondary button, a menu) sit above the stretched area with `class="relative z-1"`, so they stay independently clickable; everything else (text, a progress bar, a badge) clicks through to the link. Text under the stretched area cannot be selected or copied, because a press there lands on the link; give text that must stay copyable (an ID, an address) `class="relative z-1"` too, and it then no longer clicks through. The card lights up only for its own action: a card that holds navigation rows (`bf-list-item` with a `bfAction` title) is not itself clickable, and only the rows show the pointer, hover and ring.
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
import { Component, signal } from '@angular/core';
|
|
159
|
+
import { RouterLink } from '@angular/router';
|
|
160
|
+
import {
|
|
161
|
+
BfActionDirective,
|
|
162
|
+
BfButtonComponent,
|
|
163
|
+
BfCardComponent,
|
|
164
|
+
BfProgressComponent,
|
|
165
|
+
} from '@bitforgehq/ui';
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Clickable cards.
|
|
169
|
+
*
|
|
170
|
+
* The first card's heading is a stretched `<a bfAction>` link, with a Share button above it;
|
|
171
|
+
* the second's is a stretched `<button bfAction>` that acts on the page.
|
|
172
|
+
*/
|
|
173
|
+
@Component({
|
|
174
|
+
selector: 'app-example-card-clickable',
|
|
175
|
+
imports: [RouterLink, BfActionDirective, BfButtonComponent, BfCardComponent, BfProgressComponent],
|
|
176
|
+
template: `
|
|
177
|
+
<div class="grid gap-3 @sm:grid-cols-2">
|
|
178
|
+
<bf-card>
|
|
179
|
+
<span bfSlot="header" class="text-caption text-text-muted">Project</span>
|
|
180
|
+
<h3 class="text-heading"><a bfAction routerLink="/components/card">Atlas rebrand</a></h3>
|
|
181
|
+
<bf-progress [value]="68" label="Atlas rebrand progress" />
|
|
182
|
+
<bf-button class="relative z-1" variant="tonal" size="sm" (clicked)="status.set('Shared.')"
|
|
183
|
+
>Share</bf-button
|
|
184
|
+
>
|
|
185
|
+
</bf-card>
|
|
186
|
+
|
|
187
|
+
<bf-card variant="tint">
|
|
188
|
+
<h3 class="text-heading">
|
|
189
|
+
<button bfAction type="button" (click)="status.set('Stats opened.')">
|
|
190
|
+
Completed this week
|
|
191
|
+
</button>
|
|
192
|
+
</h3>
|
|
193
|
+
<span class="text-caption">18 · +4 vs last week</span>
|
|
194
|
+
</bf-card>
|
|
195
|
+
<p aria-live="polite" class="text-caption text-text-muted">{{ status() }}</p>
|
|
196
|
+
</div>
|
|
197
|
+
`,
|
|
198
|
+
})
|
|
199
|
+
export class CardClickableExampleComponent {
|
|
200
|
+
protected readonly status = signal('');
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
`interactive` and `clicked`, which made the whole card one `<button>`, are deprecated since 0.3.0 and removed in 1.0.0: a button cannot hold a heading or another control, so screen readers heard one run-on name and lost the heading. Replace `<bf-card [interactive]="true" (clicked)="open()">` with a `bfAction` link or button in the card's heading.
|
|
205
|
+
|
|
206
|
+
## Desktop
|
|
207
|
+
|
|
208
|
+
A card holding a `bfAction` shows the pointer and lifts to `shadow-floating` while the pointer is anywhere over it; hover styles apply only on devices that can hover, so a tap never leaves one stuck. The ring is drawn around the whole card while its link or button has keyboard focus, not after a click. A link card keeps the browser's link behaviour: Ctrl/Cmd-click and a middle click open it in a new tab, and the status bar shows its URL on hover. Text under the stretched link cannot be selected with the mouse; give text that must stay copyable `class="relative z-1"`.
|
|
209
|
+
|
|
210
|
+
## Theming
|
|
211
|
+
|
|
212
|
+
Consumes tokens by variant, background then text, plus elevation:
|
|
213
|
+
|
|
214
|
+
- `raised` (default): `surface` / `text`, `shadow-raised`
|
|
215
|
+
- `tint`: `primary-soft` / `text`
|
|
216
|
+
- `ink`: `text` / `bg`
|
|
217
|
+
- `flat`: `surface` / `text`, `border-strong` (≥ 3:1, so the edge reads without a shadow)
|
|
218
|
+
|
|
219
|
+
Padding comes from the spacing tokens: `md` is `--spacing-card` (18 px, `p-card`) and `lg` is `--spacing-card-lg` (24 px, `p-card-lg`), so an app can retune both in its `@theme`.
|
|
220
|
+
|
|
221
|
+
A card holding its own `bfAction` element (or the deprecated `interactive` card) shows a pointer cursor, lifts to `shadow-floating` on hover, drops back to `shadow-raised` while its action is pressed and draws a focus ring on the `ring` token while its action has keyboard focus.
|
|
222
|
+
|
|
223
|
+
Content is aligned to the inline start (`text-start`), so it follows `dir="rtl"`.
|
|
224
|
+
|
|
225
|
+
## Accessibility
|
|
226
|
+
|
|
227
|
+
The card renders a plain `<div>` with no role. A clickable card follows the stretched-link pattern: the only interactive element is the `bfAction` link or button in its heading, so the heading stays in the screen reader's heading list, the element's accessible name is the title alone, a link keeps link semantics ([WAI-ARIA APG link pattern](https://www.w3.org/WAI/ARIA/apg/patterns/link/): Enter, a new tab on Ctrl/Cmd-click) and a button keeps button semantics ([APG button pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button/): Enter and Space). Tab reaches the action once per card, then any raised secondary control (a link action: in Safari and iOS WKWebView, Tab reaches links only when the user turns on "Press Tab to highlight each item" (Option+Tab otherwise); VoiceOver and Full Keyboard Access are unaffected). Under forced colours (Windows High Contrast), where the card's ring is dropped, a system-coloured outline around the whole card marks the focused action. The `::after` extension is invisible and adds nothing to the accessibility tree. The deprecated `interactive` card renders a native `<button>` around all content instead, which hides headings and must not hold other controls.
|
|
228
|
+
|
|
229
|
+
### Keyboard
|
|
230
|
+
|
|
231
|
+
| Key | Action |
|
|
232
|
+
| ---------------- | ------------------------------------------------------------------------------------ |
|
|
233
|
+
| <kbd>Tab</kbd> | Moves to the card's `bfAction` link or button, then to each raised secondary control |
|
|
234
|
+
| <kbd>Enter</kbd> | Follows a `bfAction` link, or activates a `bfAction` button |
|
|
235
|
+
| <kbd>Space</kbd> | Activates a `bfAction` button; a link ignores it |
|
|
236
|
+
|
|
237
|
+
## Inputs
|
|
238
|
+
|
|
239
|
+
| Name | Type | Default | Description |
|
|
240
|
+
| ------------- | --------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
241
|
+
| `variant` | `BfCardVariant` (`'raised' \| 'tint' \| 'ink' \| 'flat'`) | `'raised'` | Surface treatment: raised (default), tint, ink, flat. |
|
|
242
|
+
| `interactive` | `boolean` | `false` | Whole card is a button that emits `clicked`. **Deprecated** (0.3.0 use a bfAction link or button in the card's heading; removed in 1.0.0) |
|
|
243
|
+
| `padding` | `BfCardPadding` (`'md' \| 'lg'`) | `'md'` | Inner padding: md 18 px (`--spacing-card`), lg 24 px (`--spacing-card-lg`). |
|
|
244
|
+
|
|
245
|
+
## Outputs
|
|
246
|
+
|
|
247
|
+
| Name | Payload | Description |
|
|
248
|
+
| --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
249
|
+
| `clicked` | `Event` | Emitted when an interactive card is activated. **Deprecated** (0.3.0 use a bfAction link or button in the card's heading; removed in 1.0.0) |
|
|
250
|
+
|
|
251
|
+
## Slots
|
|
252
|
+
|
|
253
|
+
- `header`: Content above the body, such as a title row.
|
|
254
|
+
- `default`: The card body.
|
|
255
|
+
- `footer`: Content below the body, such as its actions.
|
|
256
|
+
|
|
257
|
+
## Notes
|
|
258
|
+
|
|
259
|
+
### Do
|
|
260
|
+
|
|
261
|
+
- One idea per card; use `bf-list` for repeated rows.
|
|
262
|
+
- Use `lg` padding for cards that hold a heading and several blocks.
|
|
263
|
+
- Make a card clickable with one `bfAction` link or button in its heading; give other controls in it `class="relative z-1"`.
|
|
264
|
+
|
|
265
|
+
### Don't
|
|
266
|
+
|
|
267
|
+
- Don't nest raised cards; use `flat` inside.
|
|
268
|
+
- Don't use `interactive` (deprecated) or wrap a card in an `<a>`; both hide the heading and nest interactive content.
|
|
269
|
+
- Don't put more than one `bfAction` in a card.
|
|
270
|
+
- Don't put a `text` button on an ink card — its primary colour fails contrast on ink; use `tonal` or `outline`.
|
|
271
|
+
|
|
272
|
+
## Migration notes
|
|
273
|
+
|
|
274
|
+
### 0.3.0
|
|
275
|
+
|
|
276
|
+
**Behaviour:** logical properties: content aligns to the inline start (`text-start`).
|
|
277
|
+
|
|
278
|
+
**Deprecated:** `interactive` and `clicked` (removed in 1.0.0): a card-sized `<button>` hid the
|
|
279
|
+
heading and could not hold other controls. Use the new stretched-link pattern instead: a
|
|
280
|
+
`bfAction` link or button (`BfActionDirective`, new in `@bitforgehq/ui`) in the card's heading
|
|
281
|
+
stretches its hit area over the card, which is now always `relative` and shows the pointer, the
|
|
282
|
+
`shadow-floating` hover and the focus ring (on keyboard focus) while it holds its own `bfAction`
|
|
283
|
+
(it registers with the nearest card or row, so a card holding navigation rows is not lit by them);
|
|
284
|
+
secondary controls take `class="relative z-1"`. Text under the stretched area is not selectable.
|
|
285
|
+
See Migration 12.
|
|
286
|
+
|
|
287
|
+
JSDoc of `card.component.ts` for the API reference: `@summary`/`@since` on the exported symbols;
|
|
288
|
+
`@slot` docs for `header`, `default`, `footer`. No behaviour change.
|
|
289
|
+
|
|
290
|
+
**Behaviour:** a pressed state (F-045): a card holding a `bfAction` drops from `shadow-floating` back to `shadow-raised` while its action is held down (`has-[[data-bf-action]:active]`), the deprecated `interactive` card while it is. None while disabled; under forced colours the system colours win.
|
|
291
|
+
|
|
292
|
+
`padding="lg"` is `p-card-lg` (the new `--spacing-card-lg` token, 24 px) instead of `p-6`
|
|
293
|
+
(F-063); the rendered padding is unchanged, and an app can now retune it in its `@theme`.
|
|
294
|
+
|
|
295
|
+
### 0.2.0
|
|
296
|
+
|
|
297
|
+
The `flat` border is `border-strong` (was `border`, 1.32:1).
|
|
298
|
+
|
|
299
|
+
### 0.1.0
|
|
300
|
+
|
|
301
|
+
The card surface now fills its host (`h-full`), so cards in a stretched grid row end at the same height instead of ragged bottoms; block hosts of auto height are unaffected.
|
|
302
|
+
|
|
303
|
+
New `bf-card`: a content surface with `header`/default/`footer` slots and four variants — `raised` (default, `shadow-raised`), `tint`, `ink` and `flat`. `padding` is `md` (18 px, default) or `lg` (24 px). `interactive` renders the card as a `<button>` that emits `clicked` and adds a hover shadow and focus ring.
|