@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,30 @@
|
|
|
1
|
+
# BfKeyboardPhase
|
|
2
|
+
|
|
3
|
+
The soft keyboard phase, hidden, showing or shown, for animations only
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui/mobile` · since 0.2.0
|
|
6
|
+
|
|
7
|
+
Keyboard lifecycle phase, for animations only; never gate logic on the order of the phases.
|
|
8
|
+
`showing` starts at `keyboardWillShow`, `shown` at `keyboardDidShow`. Either hide event
|
|
9
|
+
(`keyboardWillHide` or `keyboardDidHide`, whichever arrives first — iOS does not guarantee
|
|
10
|
+
the order) moves straight to `hidden`, so there is no `hiding` phase.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { type BfKeyboardPhase } from '@bitforgehq/ui/mobile';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Signature
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
type BfKeyboardPhase = 'hidden' | 'showing' | 'shown'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Values
|
|
23
|
+
|
|
24
|
+
- `hidden`
|
|
25
|
+
- `showing`
|
|
26
|
+
- `shown`
|
|
27
|
+
|
|
28
|
+
## Used by
|
|
29
|
+
|
|
30
|
+
- [BfKeyboardService](bf-keyboard-service.md)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# BfKeyboardService
|
|
2
|
+
|
|
3
|
+
The soft keyboard state as signals: visible, its height and its phase
|
|
4
|
+
|
|
5
|
+
Service from `@bitforgehq/ui/mobile` · since 0.2.0
|
|
6
|
+
|
|
7
|
+
The soft keyboard as signals. On native it listens to the Capacitor Keyboard plugin
|
|
8
|
+
(`@capacitor/keyboard`, loaded lazily, height known at `keyboardWillShow`); on the web it falls
|
|
9
|
+
back to `visualViewport` resizes with an 80 px threshold (height known only once the viewport has
|
|
10
|
+
shrunk; ignored while the page is pinch-zoomed, `visualViewport.scale` ≠ 1); in Jest and SSR it
|
|
11
|
+
stays inert (height 0, never visible). The rest height (viewport with the keyboard hidden) comes
|
|
12
|
+
from a fixed `100lvh` probe element, never `innerHeight`, which sticks at a wrong value after a
|
|
13
|
+
field-to-field focus jump on iOS; it is measured at construction and on window resizes while the
|
|
14
|
+
keyboard is hidden and no text control is focused, never at will-show. `imminent` flags a focused
|
|
15
|
+
text control before any keyboard event, and `keyboardTop()` gives the keyboard's top edge in
|
|
16
|
+
viewport px. It also writes the height as `--bf-keyboard-height` on `<html>` (`0px` while hidden)
|
|
17
|
+
for CSS that follows the keyboard.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { BfKeyboardService } from '@bitforgehq/ui/mobile';
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Properties
|
|
24
|
+
|
|
25
|
+
| Name | Type | Default | Description |
|
|
26
|
+
| ----------------- | ------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
27
|
+
| `height` | `Signal<number>` | | Keyboard height in CSS px (iOS: includes the home-indicator strip); 0 when hidden. |
|
|
28
|
+
| `phase` | `Signal<BfKeyboardPhase>` | | Lifecycle phase for animations; see `BfKeyboardPhase`. |
|
|
29
|
+
| `visible` | `Signal<boolean>` | | True from will-show until either hide event: the moment to hide chrome such as the tab bar. |
|
|
30
|
+
| `overlaysContent` | `Signal<boolean>` | | True when the keyboard overlays the WebView (native iOS, `resize: 'none'`); false when the WebView resizes. |
|
|
31
|
+
| `restHeight` | `Signal<number>` | | Viewport height with the keyboard hidden, in CSS px, from a fixed `100lvh` probe. |
|
|
32
|
+
| `willShow` | `Signal<number>` | | Increments once per keyboard show (at will-show), for one-off reactions such as closing popovers. |
|
|
33
|
+
| `imminent` | `Signal<boolean>` | | True from `focusin` on a text-entry control (see `isTextEntry`) until that control's `focusout` or either keyboard hide event; never cleared by will-show. Hide chrome such as the tab bar on `visible() \|\| imminent()`: on Android the WebView shrinks before the plugin's will-show, which lifts `position: fixed` elements above the keyboard; `focusin` is the only earlier signal. When it turns true without the keyboard up, it also clears itself after `IMMINENT_TIMEOUT_MS` (2500 ms) unless will-show or a visible keyboard arrives first, so a hardware keyboard, which fires no keyboard event, does not keep the tab bar hidden. |
|
|
34
|
+
|
|
35
|
+
## Methods
|
|
36
|
+
|
|
37
|
+
### `hide(): Promise<void>`
|
|
38
|
+
|
|
39
|
+
Hides the keyboard: `Keyboard.hide()` on native, blurs the focused element on the web.
|
|
40
|
+
|
|
41
|
+
### `keyboardTop(): number`
|
|
42
|
+
|
|
43
|
+
The keyboard's top edge in viewport CSS px, read on demand. While the keyboard overlays the
|
|
44
|
+
WebView (native iOS) it is `restHeight() - height()`; where the viewport shrinks for it
|
|
45
|
+
(Android, the web) it is the bottom of `visualViewport` (else `innerHeight`). With the
|
|
46
|
+
keyboard hidden it is `restHeight()`.
|
|
47
|
+
|
|
48
|
+
## Uses
|
|
49
|
+
|
|
50
|
+
- [BfKeyboardPhase](bf-keyboard-phase.md)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# BfLabelsOverrides
|
|
2
|
+
|
|
3
|
+
The strings provideBfLabels replaces, each one falling back to the parent
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
Options of `provideBfLabels()`: any key left out keeps the parent injector's string.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfLabelsOverrides } from '@bitforgehq/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Signature
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type BfLabelsOverrides = Partial<Omit<BfLabels, 'validation'>> & { readonly validation?: Partial<BfValidationMessages>; }
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Uses
|
|
20
|
+
|
|
21
|
+
- [BfLabels](bf-labels.md)
|
|
22
|
+
- [BfValidationMessages](bf-validation-messages.md)
|
|
23
|
+
|
|
24
|
+
## Used by
|
|
25
|
+
|
|
26
|
+
- [provideBfLabels](provide-bf-labels.md)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# BfLabels
|
|
2
|
+
|
|
3
|
+
Every built-in user-facing string of the library, one key per string
|
|
4
|
+
|
|
5
|
+
Interface from `@bitforgehq/ui` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
Every built-in user-facing string of the library; replace any of them with `provideBfLabels()`.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfLabels } from '@bitforgehq/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
| Name | Type | Default | Description |
|
|
16
|
+
| --------------- | --------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `loading` | `string` | `'Loading'` | bf-spinner's accessible name (a loading bf-button's spinner is decorative and has none). |
|
|
18
|
+
| `dismiss` | `string` | `'Dismiss'` | bf-alert's dismiss button. |
|
|
19
|
+
| `tabBar` | `string` | `'Main'` | bf-tab-bar's navigation name. |
|
|
20
|
+
| `tabBadge` | `(count: number) => string` | `` (count) => `${count} new` `` | bf-tab's announcement of a numeric badge. |
|
|
21
|
+
| `back` | `string` | `'Back'` | bf-back-button's label. |
|
|
22
|
+
| `ok` | `string` | `'OK'` | BfAlertDialogService's default button. |
|
|
23
|
+
| `cancel` | `string` | `'Cancel'` | BfActionSheetService's cancel row. |
|
|
24
|
+
| `actions` | `string` | `'Actions'` | An action sheet's name when it has no title. |
|
|
25
|
+
| `sheet` | `string` | `'Sheet'` | bf-sheet's name without an ariaLabel or heading. |
|
|
26
|
+
| `modal` | `string` | `'Modal'` | bf-modal's name without an ariaLabel or heading. |
|
|
27
|
+
| `refreshing` | `string` | `'Refreshing'` | bf-refresher's status while refreshing. |
|
|
28
|
+
| `close` | `string` | `'Close'` | bf-dialog's close button, and bf-sheet's screen-reader Close. |
|
|
29
|
+
| `expand` | `string` | `'Expand'` | bf-sheet's grabber button below the top snap point: the next press expands the sheet. |
|
|
30
|
+
| `collapse` | `string` | `'Collapse'` | bf-sheet's grabber button at the top snap point: the next press collapses the sheet. |
|
|
31
|
+
| `sheetPosition` | `(position: number, count: number) => string` | `` (position, count) => `Sheet at ${position} of ${count}` `` | bf-sheet's snap position (1-based), announced politely when it changes and part of the grabber button's name. |
|
|
32
|
+
| `dialog` | `string` | `'Dialog'` | A dialog's name without an ariaLabel, a bf-dialog title or a heading. |
|
|
33
|
+
| `notifications` | `string` | `'Notifications'` | The desktop toast stack's region name. |
|
|
34
|
+
| `validation` | `BfValidationMessages` | required | Default error text per validator kind (see `BfValidationMessages`). |
|
|
35
|
+
|
|
36
|
+
## Uses
|
|
37
|
+
|
|
38
|
+
- [BfValidationMessages](bf-validation-messages.md)
|
|
39
|
+
|
|
40
|
+
## Used by
|
|
41
|
+
|
|
42
|
+
- [BfLabelsOverrides](bf-labels-overrides.md)
|
|
43
|
+
- [BF_DEFAULT_LABELS](bf_default_labels.md)
|
|
44
|
+
- [BF_LABELS](bf_labels.md)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# BfMenuButtonHarness
|
|
2
|
+
|
|
3
|
+
Test harness for a menu button: opens it and hands out the menu it opened
|
|
4
|
+
|
|
5
|
+
Class from `@bitforgehq/ui/testing` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
Harness for `bf-menu-button`, a button that opens a `bf-menu`. Its `label` filter matches the
|
|
8
|
+
button's accessible name (its `label`, else its text).
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { BfMenuButtonHarness } from '@bitforgehq/ui/testing';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Signature
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
class BfMenuButtonHarness extends ComponentHarness
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Methods
|
|
21
|
+
|
|
22
|
+
### `getLabel(): Promise<string>`
|
|
23
|
+
|
|
24
|
+
The button's accessible name: its `aria-label` (the `label` input), else its text.
|
|
25
|
+
|
|
26
|
+
### `open(): Promise<void>`
|
|
27
|
+
|
|
28
|
+
Opens the menu with a click; does nothing while it is open.
|
|
29
|
+
|
|
30
|
+
### `isOpen(): Promise<boolean>`
|
|
31
|
+
|
|
32
|
+
Whether the menu is open (`aria-expanded`).
|
|
33
|
+
|
|
34
|
+
### `getMenu(): Promise<BfMenuHarness>`
|
|
35
|
+
|
|
36
|
+
The open menu, opening it first when it is closed.
|
|
37
|
+
|
|
38
|
+
## Uses
|
|
39
|
+
|
|
40
|
+
- [BfMenuHarness](bf-menu-harness.md)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# BfMenuButtonVariant
|
|
2
|
+
|
|
3
|
+
The three visual styles of a menu button, matching the button styles
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui/overlay` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
The visual style of a `bf-menu-button`: outline, text or tonal, as `bf-button`'s.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfMenuButtonVariant } from '@bitforgehq/ui/overlay';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Signature
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type BfMenuButtonVariant = 'outline' | 'text' | 'tonal'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Values
|
|
20
|
+
|
|
21
|
+
- `outline`
|
|
22
|
+
- `text`
|
|
23
|
+
- `tonal`
|
|
24
|
+
|
|
25
|
+
## Used by
|
|
26
|
+
|
|
27
|
+
- [bf-menu-button](../components/menu-button.md)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# BfMenuDividerDirective
|
|
2
|
+
|
|
3
|
+
A line between groups of menu items that keyboard focus never lands on
|
|
4
|
+
|
|
5
|
+
Directive from `@bitforgehq/ui/overlay` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
A line between groups of menu items (role `separator`, not focusable).
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { BfMenuDividerDirective } from '@bitforgehq/ui/overlay';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Selector: `[bfMenuDivider]`
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# BfMenuGroupDirective
|
|
2
|
+
|
|
3
|
+
Groups related menu items; radio items in one group exclude each other
|
|
4
|
+
|
|
5
|
+
Directive from `@bitforgehq/ui/overlay` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
A group of menu items (role `group`); radio items in one group are exclusive. Name it with
|
|
8
|
+
`aria-label` when its items share a topic ("Density").
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { BfMenuGroupDirective } from '@bitforgehq/ui/overlay';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Selector: `[bfMenuGroup]`
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# BfMenuHarness
|
|
2
|
+
|
|
3
|
+
Test harness for a menu: lists its items and clicks one, through submenus
|
|
4
|
+
|
|
5
|
+
Class from `@bitforgehq/ui/testing` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
Harness for `bf-menu`, the card a `bfMenuTriggerFor` trigger or `bf-menu-button` opens. It
|
|
8
|
+
renders in the CDK overlay container, so get it from `BfMenuButtonHarness.getMenu()` or through
|
|
9
|
+
`TestbedHarnessEnvironment.documentRootLoader(fixture)`. Its `label` filter matches the menu's
|
|
10
|
+
accessible name (its `ariaLabel`, else its trigger's text).
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { BfMenuHarness } from '@bitforgehq/ui/testing';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Signature
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
class BfMenuHarness extends ComponentHarness
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Methods
|
|
23
|
+
|
|
24
|
+
### `getLabel(): Promise<string>`
|
|
25
|
+
|
|
26
|
+
The menu's accessible name: its `aria-label`, else the text of the element it is labelled
|
|
27
|
+
by (its trigger).
|
|
28
|
+
|
|
29
|
+
### `getItems(filter?: BfHarnessFilters): Promise<BfMenuItemHarness[]>`
|
|
30
|
+
|
|
31
|
+
The menu's rows, in order (a submenu's rows belong to the submenu).
|
|
32
|
+
|
|
33
|
+
| Parameter | Type | Description |
|
|
34
|
+
| --------- | ------------------ | ------------------------------------------------------- |
|
|
35
|
+
| `filter?` | `BfHarnessFilters` | Only the rows matching it, e.g. `{ label: 'Archive' }`. |
|
|
36
|
+
|
|
37
|
+
### `clickItem(label: string, submenuPath?: string[]): Promise<void>`
|
|
38
|
+
|
|
39
|
+
Clicks the row with this text; with a `submenuPath`, the row opens a submenu and the path's
|
|
40
|
+
labels are clicked in the submenus that open, in order. Throws for an unknown label.
|
|
41
|
+
|
|
42
|
+
| Parameter | Type | Description |
|
|
43
|
+
| -------------- | ---------- | -------------------------------------------------------- |
|
|
44
|
+
| `label` | `string` | The row's text. |
|
|
45
|
+
| `submenuPath?` | `string[]` | The labels to click in the submenus that open, in order. |
|
|
46
|
+
|
|
47
|
+
## Uses
|
|
48
|
+
|
|
49
|
+
- [BfHarnessFilters](bf-harness-filters.md)
|
|
50
|
+
- [BfMenuItemHarness](bf-menu-item-harness.md)
|
|
51
|
+
|
|
52
|
+
## Used by
|
|
53
|
+
|
|
54
|
+
- [BfMenuButtonHarness](bf-menu-button-harness.md)
|
|
55
|
+
- [BfMenuItemHarness](bf-menu-item-harness.md)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# BfMenuItemCheckboxDirective
|
|
2
|
+
|
|
3
|
+
A menu row that toggles an option on and off with a check mark
|
|
4
|
+
|
|
5
|
+
Directive from `@bitforgehq/ui/overlay` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
A toggle row of a `bf-menu` (role `menuitemcheckbox`) with a check mark while `checked`.
|
|
8
|
+
Activating it (click, `Enter`, `Space`) flips its own `checked` (`aria-checked`), emits
|
|
9
|
+
`triggered`, then `changed` (and `checkedChange`) with the new state, and closes the menu. Bind
|
|
10
|
+
it two-way, `[(checked)]`, so your state always follows the item.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { BfMenuItemCheckboxDirective } from '@bitforgehq/ui/overlay';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Selector: `button[bfMenuItemCheckbox]`
|
|
17
|
+
|
|
18
|
+
## Inputs
|
|
19
|
+
|
|
20
|
+
| Name | Type | Default | Description |
|
|
21
|
+
| --------------------- | ---------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
22
|
+
| `checked` | `boolean` | `false` | Whether the item is checked. The item flips it itself on activation (and emits `checkedChange`), so bind it two-way: `[(checked)]`. |
|
|
23
|
+
| `bfMenuItemDisabled` | `boolean` | | Whether the item is disabled: it stays focusable and announced, but does not activate. |
|
|
24
|
+
| `bfMenuItemTypeahead` | `string \| null` | | The text typeahead matches the item by (default: its text content). |
|
|
25
|
+
|
|
26
|
+
## Outputs
|
|
27
|
+
|
|
28
|
+
| Name | Payload | Description |
|
|
29
|
+
| ----------- | --------- | ------------------------------------------------------------------------------------- |
|
|
30
|
+
| `changed` | `boolean` | Emitted with the new state right after the user toggles the item. |
|
|
31
|
+
| `triggered` | `void` | Emits when the item is activated (click, `Enter` or `Space`), before `checked` flips. |
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# BfMenuItemDirective
|
|
2
|
+
|
|
3
|
+
An action row of a menu on a native button or link, with keyboard rules
|
|
4
|
+
|
|
5
|
+
Directive from `@bitforgehq/ui/overlay` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
An action row of a `bf-menu` (role `menuitem`), on a native `<button>` or a link (`<a>` with
|
|
8
|
+
`href` or `routerLink`). Activating it (click, `Enter`, `Space`) emits `triggered`, closes every
|
|
9
|
+
open menu and returns focus to the trigger. With `[bfMenuTriggerFor]` on the same element it
|
|
10
|
+
opens a submenu instead (and shows a chevron). A disabled item stays focusable and announces
|
|
11
|
+
itself as disabled, but does not activate; a disabled link does not navigate either, also with
|
|
12
|
+
`routerLink`.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { BfMenuItemDirective } from '@bitforgehq/ui/overlay';
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Selector: `button[bfMenuItem], a[bfMenuItem]`
|
|
19
|
+
|
|
20
|
+
## Inputs
|
|
21
|
+
|
|
22
|
+
| Name | Type | Default | Description |
|
|
23
|
+
| --------------------- | ---------------- | ------- | -------------------------------------------------------------------------------------- |
|
|
24
|
+
| `bfMenuItemDisabled` | `boolean` | | Whether the item is disabled: it stays focusable and announced, but does not activate. |
|
|
25
|
+
| `bfMenuItemTypeahead` | `string \| null` | | The text typeahead matches the item by (default: its text content). |
|
|
26
|
+
|
|
27
|
+
## Outputs
|
|
28
|
+
|
|
29
|
+
| Name | Payload | Description |
|
|
30
|
+
| ----------- | ------- | ---------------------------------------------------------------------------------------- |
|
|
31
|
+
| `triggered` | `void` | Emits when the item is activated (click, `Enter` or `Space`), unless it opens a submenu. |
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# BfMenuItemHarness
|
|
2
|
+
|
|
3
|
+
Test harness for a menu row: its text, disabled, checked and submenu state
|
|
4
|
+
|
|
5
|
+
Class from `@bitforgehq/ui/testing` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
Harness for one row of a `bf-menu`: a `bfMenuItem`, `bfMenuItemCheckbox` or `bfMenuItemRadio`
|
|
8
|
+
button (or `a[bfMenuItem]` link). Its `label` filter matches the row's text.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { BfMenuItemHarness } from '@bitforgehq/ui/testing';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Signature
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
class BfMenuItemHarness extends ComponentHarness
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Methods
|
|
21
|
+
|
|
22
|
+
### `getText(): Promise<string>`
|
|
23
|
+
|
|
24
|
+
The row's text.
|
|
25
|
+
|
|
26
|
+
### `isDisabled(): Promise<boolean>`
|
|
27
|
+
|
|
28
|
+
Whether the row is disabled (`aria-disabled`; a disabled row stays focusable).
|
|
29
|
+
|
|
30
|
+
### `isChecked(): Promise<boolean>`
|
|
31
|
+
|
|
32
|
+
Whether a checkbox or radio row is checked.
|
|
33
|
+
|
|
34
|
+
### `hasSubmenu(): Promise<boolean>`
|
|
35
|
+
|
|
36
|
+
Whether the row opens a submenu.
|
|
37
|
+
|
|
38
|
+
### `click(): Promise<void>`
|
|
39
|
+
|
|
40
|
+
Clicks the row: runs its action (closing the menu), toggles it, or opens its submenu.
|
|
41
|
+
|
|
42
|
+
### `getSubmenu(): Promise<BfMenuHarness | null>`
|
|
43
|
+
|
|
44
|
+
The submenu this row opened, or `null` while it is closed or when it has none.
|
|
45
|
+
|
|
46
|
+
## Uses
|
|
47
|
+
|
|
48
|
+
- [BfMenuHarness](bf-menu-harness.md)
|
|
49
|
+
|
|
50
|
+
## Used by
|
|
51
|
+
|
|
52
|
+
- [BfMenuHarness](bf-menu-harness.md)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# BfMenuItemRadioDirective
|
|
2
|
+
|
|
3
|
+
One choice of a set of exclusive options in a menu, marked with a dot
|
|
4
|
+
|
|
5
|
+
Directive from `@bitforgehq/ui/overlay` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
One choice of a set (role `menuitemradio`) with a dot while `checked`. Put the choices of one
|
|
8
|
+
set in a `bfMenuGroup`: choosing one (click, `Enter`, `Space`) unchecks the others, emits
|
|
9
|
+
`triggered` and closes the menu.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { BfMenuItemRadioDirective } from '@bitforgehq/ui/overlay';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Selector: `button[bfMenuItemRadio]`
|
|
16
|
+
|
|
17
|
+
## Inputs
|
|
18
|
+
|
|
19
|
+
| Name | Type | Default | Description |
|
|
20
|
+
| --------------------- | ---------------- | ------- | -------------------------------------------------------------------------------------- |
|
|
21
|
+
| `checked` | `boolean` | | Whether this choice is the selected one of its group (shown with a dot). |
|
|
22
|
+
| `bfMenuItemDisabled` | `boolean` | | Whether the item is disabled: it stays focusable and announced, but does not activate. |
|
|
23
|
+
| `bfMenuItemTypeahead` | `string \| null` | | The text typeahead matches the item by (default: its text content). |
|
|
24
|
+
|
|
25
|
+
## Outputs
|
|
26
|
+
|
|
27
|
+
| Name | Payload | Description |
|
|
28
|
+
| ----------- | ------- | ------------------------------------------------------------------------------------ |
|
|
29
|
+
| `triggered` | `void` | Emits when the choice is activated (click, `Enter` or `Space`); set your state here. |
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# BfMenuPlacement
|
|
2
|
+
|
|
3
|
+
Where a menu opens against its trigger, above or below, at either end
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui/overlay` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
Where a menu opens against its trigger; `start`/`end` follow the text direction.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfMenuPlacement } from '@bitforgehq/ui/overlay';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Signature
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type BfMenuPlacement = 'below-start' | 'below-end' | 'above-start' | 'above-end'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Values
|
|
20
|
+
|
|
21
|
+
- `below-start`
|
|
22
|
+
- `below-end`
|
|
23
|
+
- `above-start`
|
|
24
|
+
- `above-end`
|
|
25
|
+
|
|
26
|
+
## Used by
|
|
27
|
+
|
|
28
|
+
- [bf-menu-button](../components/menu-button.md)
|
|
29
|
+
- [BfMenuTriggerDirective](bf-menu-trigger-directive.md)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# BfMenuTriggerDirective
|
|
2
|
+
|
|
3
|
+
Opens a menu from any element with the keyboard and focus rules of menus
|
|
4
|
+
|
|
5
|
+
Directive from `@bitforgehq/ui/overlay` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
Opens a `bf-menu` template from any element on the Angular CDK menu trigger: it sets
|
|
8
|
+
`aria-haspopup="menu"` and `aria-expanded`, opens on click, `Enter`, `Space` and `ArrowDown`
|
|
9
|
+
(first item focused) or `ArrowUp` (last item), and takes focus back when the menu closes. A
|
|
10
|
+
navigation to another URL path closes the open menu (with its submenus); the URL is watched
|
|
11
|
+
only while the menu is open. On a
|
|
12
|
+
`bfMenuItem` it opens a submenu beside the item instead (`ArrowRight`, `ArrowLeft` in RTL).
|
|
13
|
+
`bf-menu-button` wraps it in a styled button.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { BfMenuTriggerDirective } from '@bitforgehq/ui/overlay';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Selector: `[bfMenuTriggerFor]`
|
|
20
|
+
|
|
21
|
+
## Inputs
|
|
22
|
+
|
|
23
|
+
| Name | Type | Default | Description |
|
|
24
|
+
| ------------------- | ---------------------------------------------------------------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| `bfMenuPlacement` | `BfMenuPlacement` (`'below-start' \| 'below-end' \| 'above-start' \| 'above-end'`) | `'below-start'` | Where the menu opens (flipping when it would overflow). A submenu always opens beside its item, at the inline end, and ignores it. |
|
|
26
|
+
| `bfMenuTriggerFor` | `TemplateRef<unknown> \| null` | | The `ng-template` holding the `bf-menu` this element opens. |
|
|
27
|
+
| `bfMenuTriggerData` | `unknown` | | The context the menu template receives, for a menu shared by many triggers. |
|
|
28
|
+
|
|
29
|
+
## Outputs
|
|
30
|
+
|
|
31
|
+
| Name | Payload | Description |
|
|
32
|
+
| -------------- | ------- | -------------------------------------------------------------------------------- |
|
|
33
|
+
| `bfMenuOpened` | `void` | Emits when the menu opens. |
|
|
34
|
+
| `bfMenuClosed` | `void` | Emits when the menu closes (an item, `Escape`, a click outside or a navigation). |
|
|
35
|
+
|
|
36
|
+
## Methods
|
|
37
|
+
|
|
38
|
+
### `labelId(): string`
|
|
39
|
+
|
|
40
|
+
The trigger element's id (assigned when it has none), which names the menu it opens. It is
|
|
41
|
+
read when the menu opens: an `[id]` bound on the trigger that changes while the menu is open
|
|
42
|
+
names the menu from its next opening.
|
|
43
|
+
|
|
44
|
+
## Uses
|
|
45
|
+
|
|
46
|
+
- [BfMenuPlacement](bf-menu-placement.md)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# BfModalOptions
|
|
2
|
+
|
|
3
|
+
Options of a modal: its data, presentation, dismissal and accessible name
|
|
4
|
+
|
|
5
|
+
Interface from `@bitforgehq/ui/mobile` · since 0.2.0
|
|
6
|
+
|
|
7
|
+
Options of `BfModalService.open()`.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfModalOptions } from '@bitforgehq/ui/mobile';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
| Name | Type | Default | Description |
|
|
16
|
+
| ------------------- | ------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `data` | `unknown` | | Injected into the content as `BF_OVERLAY_DATA`. |
|
|
18
|
+
| `presentation` | `BfModalPresentation` (`'sheet' \| 'fullscreen'`) | `'sheet'` | A page-sheet card over the parked page stack (default), or a fullscreen frame. |
|
|
19
|
+
| `dismissible` | `boolean` | `true` | `Escape` and the hardware back button close the modal (default true); with false only the content's own close control does, or a navigation (see `closeOnNavigation`), and back is swallowed while the modal is open instead of falling through to the page behind. There is no backdrop dismiss or drag-to-dismiss. |
|
|
20
|
+
| `closeOnNavigation` | `boolean` | `true` | A navigation to another URL path closes the modal with no result (default true). |
|
|
21
|
+
| `ariaLabel` | `string` | | Accessible name of the modal panel. Without it the modal is named by the first heading in its content (`aria-labelledby`, e.g. the `bf-header` title), else by `provideBfLabels()`'s `modal` ("Modal"). |
|
|
22
|
+
| `injector` | `Injector` | | Injector the modal resolves its labels (`BF_LABELS`) from and the parent of its content's injector (default the root injector). Pass the opening component's `inject(Injector)` so a feature-level `provideBfLabels()` and other feature providers reach it. |
|
|
23
|
+
|
|
24
|
+
## Uses
|
|
25
|
+
|
|
26
|
+
- [BfModalPresentation](bf-modal-presentation.md)
|
|
27
|
+
|
|
28
|
+
## Used by
|
|
29
|
+
|
|
30
|
+
- [BfModalService](bf-modal-service.md)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# BfModalPresentation
|
|
2
|
+
|
|
3
|
+
How a modal is presented: a page-sheet card over the stack, or fullscreen
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui/mobile` · since 0.2.0
|
|
6
|
+
|
|
7
|
+
Where `bf-modal` sits: a page-sheet card, or edge to edge.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfModalPresentation } from '@bitforgehq/ui/mobile';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Signature
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type BfModalPresentation = 'sheet' | 'fullscreen'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Values
|
|
20
|
+
|
|
21
|
+
- `sheet`
|
|
22
|
+
- `fullscreen`
|
|
23
|
+
|
|
24
|
+
## Used by
|
|
25
|
+
|
|
26
|
+
- [BfModalOptions](bf-modal-options.md)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# BfModalService
|
|
2
|
+
|
|
3
|
+
Opens a component as a modal page sheet over the stack, or fullscreen
|
|
4
|
+
|
|
5
|
+
Service from `@bitforgehq/ui/mobile` · since 0.2.0
|
|
6
|
+
|
|
7
|
+
Opens modals: a component in a `bf-modal` frame on the overlay core (`position: 'fullscreen'`,
|
|
8
|
+
no backdrop dismiss). `presentation: 'sheet'` (default) is a page-sheet card 10 px below the
|
|
9
|
+
top safe area over the parked page stack, which in iOS mode scales down and grows rounded corners
|
|
10
|
+
behind it (`countsAsModal: true`, driving `--bf-modal-depth` on the registered
|
|
11
|
+
`bf-stack-outlet` roots; Material mode leaves the page unscaled); `'fullscreen'` covers the
|
|
12
|
+
viewport edge to edge and does not count towards that depth. iOS mode
|
|
13
|
+
slides the card up and down; Material mode fades it up (and down) 16 px. The content supplies
|
|
14
|
+
its own `bf-header` (`largeTitle="false"`, typically a close `bf-icon-button` in `start`) and
|
|
15
|
+
`bf-content` — `bf-modal` provides a `BfPageContext` for them, like `bf-page`. It injects the
|
|
16
|
+
caller's `data` as `BF_OVERLAY_DATA` and closes itself with a result through the injected
|
|
17
|
+
`BfOverlayRef`, which `open()` also returns. A navigation to another URL path closes it with no
|
|
18
|
+
result (`closeOnNavigation`).
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { BfModalService } from '@bitforgehq/ui/mobile';
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Methods
|
|
25
|
+
|
|
26
|
+
### `open<C, T = unknown>(component: Type<C>, options?: BfModalOptions): BfOverlayRef<T>`
|
|
27
|
+
|
|
28
|
+
Opens `component` as a modal.
|
|
29
|
+
|
|
30
|
+
| Parameter | Type | Description |
|
|
31
|
+
| ----------- | ---------------- | ------------------------------------------------------------------------- |
|
|
32
|
+
| `component` | `Type<C>` | The component to render; it injects `BfOverlayRef` and `BF_OVERLAY_DATA`. |
|
|
33
|
+
| `options?` | `BfModalOptions` | The modal's data, presentation, dismissal and name. |
|
|
34
|
+
|
|
35
|
+
## Uses
|
|
36
|
+
|
|
37
|
+
- [BfModalOptions](bf-modal-options.md)
|
|
38
|
+
- [BfOverlayRef](bf-overlay-ref.md)
|