@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,41 @@
|
|
|
1
|
+
# BfHapticsService
|
|
2
|
+
|
|
3
|
+
Haptic feedback on native devices that silently does nothing on the web
|
|
4
|
+
|
|
5
|
+
Service from `@bitforgehq/ui/mobile` · since 0.2.0
|
|
6
|
+
|
|
7
|
+
Haptic feedback: `impact`, `selection` and `notification` forward to `@capacitor/haptics` on
|
|
8
|
+
native (loaded lazily on first use, the import cached like `BfKeyboardService`'s plugin); on
|
|
9
|
+
the web, and when the plugin fails to load (an app that didn't add the optional dependency),
|
|
10
|
+
every method resolves as a silent no-op.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { BfHapticsService } from '@bitforgehq/ui/mobile';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Methods
|
|
17
|
+
|
|
18
|
+
### `impact(style: BfHapticsImpactStyle): Promise<void>`
|
|
19
|
+
|
|
20
|
+
Impact feedback: a collision between UI elements of the given weight.
|
|
21
|
+
|
|
22
|
+
| Parameter | Type | Description |
|
|
23
|
+
| --------- | ---------------------- | ------------------------- |
|
|
24
|
+
| `style` | `BfHapticsImpactStyle` | The weight of the impact. |
|
|
25
|
+
|
|
26
|
+
### `selection(): Promise<void>`
|
|
27
|
+
|
|
28
|
+
A light tick for a discrete selection change (scrubbing a picker, crossing a threshold).
|
|
29
|
+
|
|
30
|
+
### `notification(type: BfHapticsNotificationType): Promise<void>`
|
|
31
|
+
|
|
32
|
+
Feedback for the outcome of a task.
|
|
33
|
+
|
|
34
|
+
| Parameter | Type | Description |
|
|
35
|
+
| --------- | --------------------------- | ------------------------ |
|
|
36
|
+
| `type` | `BfHapticsNotificationType` | The outcome of the task. |
|
|
37
|
+
|
|
38
|
+
## Uses
|
|
39
|
+
|
|
40
|
+
- [BfHapticsImpactStyle](bf-haptics-impact-style.md)
|
|
41
|
+
- [BfHapticsNotificationType](bf-haptics-notification-type.md)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# BfHarnessFilters
|
|
2
|
+
|
|
3
|
+
Filters a library harness query by selector, ancestor and the widget label
|
|
4
|
+
|
|
5
|
+
Interface from `@bitforgehq/ui/testing` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
Filters of every `@bitforgehq/ui/testing` harness's `with()`: the CDK's `selector` and
|
|
8
|
+
`ancestor`, plus the widget's label (a select's label, a dialog's title, a toast's message, a
|
|
9
|
+
menu item's text).
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { type BfHarnessFilters } from '@bitforgehq/ui/testing';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Signature
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
interface BfHarnessFilters extends BaseHarnessFilters
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Properties
|
|
22
|
+
|
|
23
|
+
| Name | Type | Default | Description |
|
|
24
|
+
| ------- | ------------------ | ------- | -------------------------------------------------------------------------------------- |
|
|
25
|
+
| `label` | `string \| RegExp` | | The label the harness's `getLabel()` (or equivalent) returns: exact text or a pattern. |
|
|
26
|
+
|
|
27
|
+
## Used by
|
|
28
|
+
|
|
29
|
+
- [BfMenuHarness](bf-menu-harness.md)
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# BfHorizontalScrollDirective
|
|
2
|
+
|
|
3
|
+
Deprecated touch-action opt-in for horizontal scrollers in stack pages, not needed
|
|
4
|
+
|
|
5
|
+
Directive from `@bitforgehq/ui/mobile` · since 0.2.0
|
|
6
|
+
|
|
7
|
+
**Deprecated** 0.3.0 use a plain overflow-x-auto scroller, which pans on its own; removed in 0.4.0
|
|
8
|
+
|
|
9
|
+
Sets `touch-action: pan-x pan-y` (and a `data-bf-horizontal-scroll` marker) on a horizontally
|
|
10
|
+
scrolling element inside a `bf-stack-outlet` page. Not needed: `touch-action` is not inherited,
|
|
11
|
+
and a touch's effective value is the intersection of the values from the touched element up to
|
|
12
|
+
its nearest scroll container only, so an `overflow-x-auto` row (a chips row, a carousel) pans
|
|
13
|
+
on its own under the outlet's `touch-action: pan-y`, on iOS and on Android. Only the 50 px
|
|
14
|
+
left-edge zone belongs to the swipe-back, with or without the directive.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { BfHorizontalScrollDirective } from '@bitforgehq/ui/mobile';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Selector: `[bfHorizontalScroll]`
|
|
21
|
+
|
|
22
|
+
**Deprecated in 0.3.0, removed in 0.4.0: not needed.** `bfHorizontalScroll` sets
|
|
23
|
+
`touch-action: pan-x pan-y` and a `data-bf-horizontal-scroll` marker on a horizontally scrolling
|
|
24
|
+
element inside a `bf-stack-outlet` page. A horizontal scroller pans on its own there, so drop the
|
|
25
|
+
attribute: it changes nothing a finger can feel.
|
|
26
|
+
|
|
27
|
+
## When to use
|
|
28
|
+
|
|
29
|
+
Do not use it in new code. Use a plain `overflow-x-auto` row instead: a chips row or a carousel inside a [bf-stack-outlet](https://bitforge-ui.web.app/components/stack-outlet) page scrolls sideways with it alone. Remove `bfHorizontalScroll` (and its import) where it is used; it keeps working until 0.4.0.
|
|
30
|
+
|
|
31
|
+
## Basic usage
|
|
32
|
+
|
|
33
|
+
The directive on a chips row; without it the row scrolls the same way.
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { Component } from '@angular/core';
|
|
37
|
+
import { BfChipComponent } from '@bitforgehq/ui';
|
|
38
|
+
import { BfHorizontalScrollDirective } from '@bitforgehq/ui/mobile';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A chip row with the deprecated directive.
|
|
42
|
+
*
|
|
43
|
+
* The row scrolls sideways the same way without `bfHorizontalScroll`; remove it.
|
|
44
|
+
*
|
|
45
|
+
* @preview none
|
|
46
|
+
*/
|
|
47
|
+
@Component({
|
|
48
|
+
selector: 'app-example-horizontal-scroll-basic',
|
|
49
|
+
imports: [BfChipComponent, BfHorizontalScrollDirective],
|
|
50
|
+
template: `
|
|
51
|
+
<div bfHorizontalScroll class="flex gap-2 overflow-x-auto">
|
|
52
|
+
<bf-chip>All</bf-chip>
|
|
53
|
+
<bf-chip>Open</bf-chip>
|
|
54
|
+
<bf-chip>Done</bf-chip>
|
|
55
|
+
</div>
|
|
56
|
+
`,
|
|
57
|
+
})
|
|
58
|
+
export class HorizontalScrollBasicExampleComponent {}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Why it is not needed
|
|
62
|
+
|
|
63
|
+
`touch-action` is not inherited. For a touch, the browser intersects the `touch-action` values
|
|
64
|
+
from the touched element up to its nearest scroll container, and stops there (the Pointer Events
|
|
65
|
+
model). An `overflow-x-auto` row is a scroll container itself, so the outlet host's
|
|
66
|
+
`touch-action: pan-y` above it never reaches a touch inside the row: the row pans horizontally by
|
|
67
|
+
itself. The outlet's value only constrains touches whose nearest scroll container is the outlet
|
|
68
|
+
host (outside every scroller of the page, such as the header), so the edge swipe-back keeps
|
|
69
|
+
receiving its pointer events there.
|
|
70
|
+
|
|
71
|
+
Verified on the iOS Simulator (WKWebView) and the Android emulator (WebView 134): a row without
|
|
72
|
+
the directive scrolled under a finger drag that started outside the 50 px edge zone.
|
|
73
|
+
|
|
74
|
+
The swipe-back owns only the 50 px left-edge zone. A drag that starts there is the swipe-back,
|
|
75
|
+
with or without the directive; anywhere else a horizontal scroller keeps its own scrolling.
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import { Component } from '@angular/core';
|
|
79
|
+
import { BfCardComponent } from '@bitforgehq/ui';
|
|
80
|
+
import { BfHorizontalScrollDirective } from '@bitforgehq/ui/mobile';
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* A snapping carousel.
|
|
84
|
+
*
|
|
85
|
+
* Anywhere outside the 50 px edge a carousel scrolls horizontally on its own, with or without the
|
|
86
|
+
* deprecated directive; the edge zone belongs to the swipe-back either way.
|
|
87
|
+
*
|
|
88
|
+
* @preview none
|
|
89
|
+
*/
|
|
90
|
+
@Component({
|
|
91
|
+
selector: 'app-example-horizontal-scroll-carousel',
|
|
92
|
+
imports: [BfCardComponent, BfHorizontalScrollDirective],
|
|
93
|
+
template: `
|
|
94
|
+
<div bfHorizontalScroll class="flex snap-x gap-3 overflow-x-auto">
|
|
95
|
+
@for (slide of slides; track slide) {
|
|
96
|
+
<bf-card variant="tint" class="w-64 shrink-0 snap-center">{{ slide }}</bf-card>
|
|
97
|
+
}
|
|
98
|
+
</div>
|
|
99
|
+
`,
|
|
100
|
+
})
|
|
101
|
+
export class HorizontalScrollCarouselExampleComponent {
|
|
102
|
+
protected readonly slides = ['Moodboard', 'Deck', 'Brand book'];
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Desktop
|
|
107
|
+
|
|
108
|
+
It only sets `touch-action`, so it changes nothing for a mouse, a trackpad or the keyboard.
|
|
109
|
+
|
|
110
|
+
## Theming
|
|
111
|
+
|
|
112
|
+
None: the directive only sets `touch-action` and a data attribute; it draws nothing itself.
|
|
113
|
+
|
|
114
|
+
## Accessibility
|
|
115
|
+
|
|
116
|
+
A touch-behaviour directive only; it changes no ARIA state and adds no role. Give the scroller
|
|
117
|
+
itself the role and labelling its content needs (a `role="list"` of `bf-chip` toggles already
|
|
118
|
+
carries its own state).
|
|
119
|
+
|
|
120
|
+
## Notes
|
|
121
|
+
|
|
122
|
+
### Do
|
|
123
|
+
|
|
124
|
+
- Remove `bfHorizontalScroll` from your templates; `overflow-x-auto` is enough.
|
|
125
|
+
|
|
126
|
+
### Don't
|
|
127
|
+
|
|
128
|
+
- Don't add it to new code; it is removed in 0.4.0.
|
|
129
|
+
- Don't expect it to win inside the 50 px left edge; the edge zone always belongs to the swipe-back.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# BfIconButtonVariant
|
|
2
|
+
|
|
3
|
+
The four visual styles of an icon button, from tonal to plain text
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui` · since 0.1.0
|
|
6
|
+
|
|
7
|
+
The visual style of a `bf-icon-button`: tonal, primary, outline or text.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfIconButtonVariant } from '@bitforgehq/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Signature
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type BfIconButtonVariant = 'tonal' | 'primary' | 'outline' | 'text'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Values
|
|
20
|
+
|
|
21
|
+
- `tonal`
|
|
22
|
+
- `primary`
|
|
23
|
+
- `outline`
|
|
24
|
+
- `text`
|
|
25
|
+
|
|
26
|
+
## Used by
|
|
27
|
+
|
|
28
|
+
- [bf-icon-button](../components/icon-button.md)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# BfIconSize
|
|
2
|
+
|
|
3
|
+
The three icon sizes, 16, 20 and 24 pixels, matching the text sizes
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui/icons` · since 0.1.0
|
|
6
|
+
|
|
7
|
+
The size of a `bf-icon`: sm 16, md 20 or lg 24 px.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfIconSize } from '@bitforgehq/ui/icons';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Signature
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type BfIconSize = 'sm' | 'md' | 'lg'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Values
|
|
20
|
+
|
|
21
|
+
- `sm`
|
|
22
|
+
- `md`
|
|
23
|
+
- `lg`
|
|
24
|
+
|
|
25
|
+
## Used by
|
|
26
|
+
|
|
27
|
+
- [bf-icon](../components/icon.md)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# BfInputAutocapitalize
|
|
2
|
+
|
|
3
|
+
A text field's capitalisation setting, a mode or empty to leave it off
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
The `autocapitalize` of a `bf-input`: a `BfAutocapitalize`, or `''` (the default) to leave the
|
|
8
|
+
native `autocapitalize` off.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { type BfInputAutocapitalize } from '@bitforgehq/ui';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Signature
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
type BfInputAutocapitalize = BfAutocapitalize | ''
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Values
|
|
21
|
+
|
|
22
|
+
- `off`
|
|
23
|
+
- `none`
|
|
24
|
+
- `on`
|
|
25
|
+
- `sentences`
|
|
26
|
+
- `words`
|
|
27
|
+
- `characters`
|
|
28
|
+
- ``
|
|
29
|
+
|
|
30
|
+
## Uses
|
|
31
|
+
|
|
32
|
+
- [BfAutocapitalize](bf-autocapitalize.md)
|
|
33
|
+
|
|
34
|
+
## Used by
|
|
35
|
+
|
|
36
|
+
- [bf-input](../components/input.md)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# BfInputEnterKeyHint
|
|
2
|
+
|
|
3
|
+
A field's Enter key label setting, a label or empty to leave it off
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
The `enterKeyHint` of a `bf-input` or `bf-number-input`: a `BfEnterKeyHint`, or `''` (the
|
|
8
|
+
default) to leave the native `enterkeyhint` off.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { type BfInputEnterKeyHint } from '@bitforgehq/ui';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Signature
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
type BfInputEnterKeyHint = BfEnterKeyHint | ''
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Values
|
|
21
|
+
|
|
22
|
+
- `enter`
|
|
23
|
+
- `done`
|
|
24
|
+
- `go`
|
|
25
|
+
- `next`
|
|
26
|
+
- `previous`
|
|
27
|
+
- `search`
|
|
28
|
+
- `send`
|
|
29
|
+
- ``
|
|
30
|
+
|
|
31
|
+
## Uses
|
|
32
|
+
|
|
33
|
+
- [BfEnterKeyHint](bf-enter-key-hint.md)
|
|
34
|
+
|
|
35
|
+
## Used by
|
|
36
|
+
|
|
37
|
+
- [bf-input](../components/input.md)
|
|
38
|
+
- [bf-number-input](../components/number-input.md)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# BfInputInputMode
|
|
2
|
+
|
|
3
|
+
A text field's virtual keyboard setting, a keyboard or empty to leave it off
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
The `inputMode` of a `bf-input`: a `BfInputMode`, or `''` (the default) to leave the native
|
|
8
|
+
`inputmode` off.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { type BfInputInputMode } from '@bitforgehq/ui';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Signature
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
type BfInputInputMode = BfInputMode | ''
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Values
|
|
21
|
+
|
|
22
|
+
- `none`
|
|
23
|
+
- `text`
|
|
24
|
+
- `decimal`
|
|
25
|
+
- `numeric`
|
|
26
|
+
- `tel`
|
|
27
|
+
- `search`
|
|
28
|
+
- `email`
|
|
29
|
+
- `url`
|
|
30
|
+
- ``
|
|
31
|
+
|
|
32
|
+
## Uses
|
|
33
|
+
|
|
34
|
+
- [BfInputMode](bf-input-mode.md)
|
|
35
|
+
|
|
36
|
+
## Used by
|
|
37
|
+
|
|
38
|
+
- [bf-input](../components/input.md)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# BfInputMode
|
|
2
|
+
|
|
3
|
+
The virtual keyboards a phone can show for a text field
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui` · since 0.2.0
|
|
6
|
+
|
|
7
|
+
Native `inputmode`: the virtual keyboard a phone shows.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfInputMode } from '@bitforgehq/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Signature
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type BfInputMode = 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Values
|
|
20
|
+
|
|
21
|
+
- `none`
|
|
22
|
+
- `text`
|
|
23
|
+
- `decimal`
|
|
24
|
+
- `numeric`
|
|
25
|
+
- `tel`
|
|
26
|
+
- `search`
|
|
27
|
+
- `email`
|
|
28
|
+
- `url`
|
|
29
|
+
|
|
30
|
+
## Used by
|
|
31
|
+
|
|
32
|
+
- [BfInputInputMode](bf-input-input-mode.md)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# BfInputType
|
|
2
|
+
|
|
3
|
+
The native input types a text field supports, all bound as strings
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui` · since 0.1.0
|
|
6
|
+
|
|
7
|
+
The native `type` of a `bf-input`; the value stays a string (for numbers, use `bf-number-input`).
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfInputType } from '@bitforgehq/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Signature
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type BfInputType = | 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search' | 'date' | 'time' | 'datetime-local' | 'month'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Values
|
|
20
|
+
|
|
21
|
+
- `text`
|
|
22
|
+
- `email`
|
|
23
|
+
- `password`
|
|
24
|
+
- `number`
|
|
25
|
+
- `tel`
|
|
26
|
+
- `url`
|
|
27
|
+
- `search`
|
|
28
|
+
- `date`
|
|
29
|
+
- `time`
|
|
30
|
+
- `datetime-local`
|
|
31
|
+
- `month`
|
|
32
|
+
|
|
33
|
+
## Used by
|
|
34
|
+
|
|
35
|
+
- [bf-input](../components/input.md)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# BfJsdomShimOptions
|
|
2
|
+
|
|
3
|
+
Options of the jsdom shims: the matchMedia stub and its reduced-motion answer
|
|
4
|
+
|
|
5
|
+
Interface from `@bitforgehq/ui/testing` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
Options of `installBfJsdomShims()`.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfJsdomShimOptions } from '@bitforgehq/ui/testing';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
| Name | Type | Default | Description |
|
|
16
|
+
| --------------- | --------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `matchMedia` | `boolean` | `true` | Install a `matchMedia` stub where missing (all queries false). |
|
|
18
|
+
| `reducedMotion` | `boolean` | `false` | With the stub: report `(prefers-reduced-motion: reduce)` as matching, so overlays use their short fade. Has no effect where the environment already has `matchMedia`. |
|
|
19
|
+
|
|
20
|
+
## Used by
|
|
21
|
+
|
|
22
|
+
- [installBfJsdomShims](install-bf-jsdom-shims.md)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# BfKeyboardAssistBehavior
|
|
2
|
+
|
|
3
|
+
Whether the keyboard assist scrolls a focused field into view smoothly or at once
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui/mobile` · since 0.3.0
|
|
6
|
+
|
|
7
|
+
How `bfKeyboardAssist` scrolls the focused control into view: `smooth` or `instant`.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfKeyboardAssistBehavior } from '@bitforgehq/ui/mobile';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Signature
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type BfKeyboardAssistBehavior = 'smooth' | 'instant'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Values
|
|
20
|
+
|
|
21
|
+
- `smooth`
|
|
22
|
+
- `instant`
|
|
23
|
+
|
|
24
|
+
## Used by
|
|
25
|
+
|
|
26
|
+
- [BfKeyboardAssistDirective](bf-keyboard-assist-directive.md)
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# BfKeyboardAssistDirective
|
|
2
|
+
|
|
3
|
+
Keeps the focused text field of a scroll container clear of the soft keyboard
|
|
4
|
+
|
|
5
|
+
Directive from `@bitforgehq/ui/mobile` · since 0.2.0
|
|
6
|
+
|
|
7
|
+
Keeps the focused text control of a scroll container clear of the soft keyboard. On keyboard
|
|
8
|
+
will-show it pads the scroller by the part below the keyboard's top edge
|
|
9
|
+
(`BfKeyboardService.keyboardTop()`: `padding-bottom`, plus `scroll-padding-bottom` with the
|
|
10
|
+
margin for engine scrolls), then scrolls the focused `input`, `textarea` or `[contenteditable]`
|
|
11
|
+
up until it sits `bfKeyboardAssistMargin` px above the keyboard (or down until it sits the margin
|
|
12
|
+
below the scroller's top edge; in a scroller too short for the control and both margins, the gap
|
|
13
|
+
above the control shrinks first, then the one above the keyboard, so a control shorter than the
|
|
14
|
+
scroller stays whole; a taller one keeps its bottom at the keyboard top). The covered part is
|
|
15
|
+
measured again at did-show and on every window or `visualViewport` resize, so a WebView that
|
|
16
|
+
resizes for the keyboard (Android) gets no padding and a padding never outlives the keyboard,
|
|
17
|
+
even on a detached page. A hidden host (a parked page, `visibility: hidden`) is never padded or
|
|
18
|
+
scrolled. The reveal waits for the engine's own focus scroll to settle (100 ms without a `scroll`
|
|
19
|
+
event, 120 ms if none arrives, at most 400 ms), then scrolls once; one correction follows at
|
|
20
|
+
did-show once the scroller is quiet (skipped while a reveal is pending). Focus moving to another
|
|
21
|
+
field while the keyboard is open re-arms the reveal, and both paddings go away on hide.
|
|
22
|
+
`refresh()` measures and corrects again for a container that moved on its own. `bf-content`
|
|
23
|
+
applies it to its own scroller; use it directly only on a custom scroll container.
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { BfKeyboardAssistDirective } from '@bitforgehq/ui/mobile';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Selector: `[bfKeyboardAssist]`
|
|
30
|
+
|
|
31
|
+
Keeps the focused text control of a scroll container clear of the soft keyboard. `bf-content`
|
|
32
|
+
applies it to its own scroller, so most pages never use it directly; put it on a custom scroll
|
|
33
|
+
container only when that container is not a `bf-content`. It reads `BfKeyboardService`: plugin
|
|
34
|
+
events on native (`@capacitor/keyboard`), a `visualViewport` fallback on the web.
|
|
35
|
+
|
|
36
|
+
## When to use
|
|
37
|
+
|
|
38
|
+
Use `bfKeyboardAssist` on a custom scroll container with text fields in a Capacitor app, so the soft keyboard never covers the focused field. Use [bf-content](https://bitforge-ui.web.app/components/content) instead for a normal page, which applies it already.
|
|
39
|
+
|
|
40
|
+
## Basic usage
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { Component, signal } from '@angular/core';
|
|
44
|
+
import { BfInputComponent, BfTextareaComponent } from '@bitforgehq/ui';
|
|
45
|
+
import { BfKeyboardAssistDirective } from '@bitforgehq/ui/mobile';
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* A scroll container that keeps the focused field above the keyboard.
|
|
49
|
+
*
|
|
50
|
+
* `bf-content` applies the directive itself; put it on any other scroller.
|
|
51
|
+
*
|
|
52
|
+
* @preview none
|
|
53
|
+
*/
|
|
54
|
+
@Component({
|
|
55
|
+
selector: 'app-example-keyboard-assist-basic',
|
|
56
|
+
imports: [BfInputComponent, BfKeyboardAssistDirective, BfTextareaComponent],
|
|
57
|
+
template: `
|
|
58
|
+
<div class="h-full overflow-y-auto" bfKeyboardAssist>
|
|
59
|
+
<bf-input label="Name" [(value)]="name" />
|
|
60
|
+
<bf-textarea label="Notes" [(value)]="notes" />
|
|
61
|
+
</div>
|
|
62
|
+
`,
|
|
63
|
+
})
|
|
64
|
+
export class KeyboardAssistBasicExampleComponent {
|
|
65
|
+
protected readonly name = signal('');
|
|
66
|
+
protected readonly notes = signal('');
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## How it works
|
|
71
|
+
|
|
72
|
+
- **On keyboard will-show** it sets `padding-bottom` to the part of the scroller below the
|
|
73
|
+
keyboard's top edge (`BfKeyboardService.keyboardTop()`) and `scroll-padding-bottom` to that plus
|
|
74
|
+
the margin. On iOS, where the keyboard overlays the WebView, the top edge is the `100lvh` rest
|
|
75
|
+
height minus the keyboard height, so the padding is the keyboard height (minus anything below
|
|
76
|
+
the scroller). On Android and the web, where the viewport shrinks for the keyboard, it is the
|
|
77
|
+
bottom of the visual viewport: the scroller already ends there, so nothing is padded.
|
|
78
|
+
- **At did-show and on every resize** (window `resize` and `visualViewport` `resize`, keyboard up
|
|
79
|
+
or not) it measures the covered part again, so a padding never outlives the keyboard — even on a
|
|
80
|
+
parked page whose view is detached.
|
|
81
|
+
- **A hidden host** (a parked page, `visibility: hidden`) gets no padding and no reveal, and loses
|
|
82
|
+
any padding it had at its next measurement.
|
|
83
|
+
- **Then it reveals** the focused `input`, `textarea` or `[contenteditable]`: it scrolls the
|
|
84
|
+
container once until the control's bottom sits `bfKeyboardAssistMargin` px above the keyboard
|
|
85
|
+
(a control hidden above the container's top edge scrolls down until its top sits the margin
|
|
86
|
+
below it). In a container too short for the control and both margins — a sheet or modal capped
|
|
87
|
+
by the keyboard in phone landscape — the gap above the control shrinks first, then the one above
|
|
88
|
+
the keyboard, so a control shorter than the container stays whole (a taller one, such as a
|
|
89
|
+
multi-line textarea, keeps its bottom at the keyboard's top edge).
|
|
90
|
+
It first waits for the engine's own focus scroll to settle — 100 ms without a `scroll` event on
|
|
91
|
+
the container, 120 ms if none arrives, at most 400 ms — and then measures, so its scroll is
|
|
92
|
+
never added on top of one still running.
|
|
93
|
+
- **At did-show** it corrects the reveal once (instantly), after any scroll in progress has been
|
|
94
|
+
quiet for 100 ms; it skips the correction while the reveal is still pending.
|
|
95
|
+
- **Field to field** while the keyboard is open (no new will-show), a `focusin` re-arms the
|
|
96
|
+
settled reveal.
|
|
97
|
+
- **On hide** it removes both paddings and cancels any pending reveal.
|
|
98
|
+
- `select`, buttons, checkboxes and other non-text controls open no keyboard and are ignored.
|
|
99
|
+
- **`refresh()`** measures the covered part again and, while the keyboard is up, corrects the
|
|
100
|
+
reveal once. Call it on a container that moves with the keyboard on its own — `bf-sheet` calls
|
|
101
|
+
it when its lift above the keyboard has finished sliding.
|
|
102
|
+
|
|
103
|
+
## Margin and behaviour
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
import { Component, signal } from '@angular/core';
|
|
107
|
+
import { BfTextareaComponent } from '@bitforgehq/ui';
|
|
108
|
+
import { BfKeyboardAssistDirective } from '@bitforgehq/ui/mobile';
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* A larger margin above the keyboard and an instant scroll.
|
|
112
|
+
*
|
|
113
|
+
* @preview none
|
|
114
|
+
*/
|
|
115
|
+
@Component({
|
|
116
|
+
selector: 'app-example-keyboard-assist-options',
|
|
117
|
+
imports: [BfKeyboardAssistDirective, BfTextareaComponent],
|
|
118
|
+
template: `
|
|
119
|
+
<div
|
|
120
|
+
class="h-full overflow-y-auto"
|
|
121
|
+
bfKeyboardAssist
|
|
122
|
+
[bfKeyboardAssistMargin]="32"
|
|
123
|
+
bfKeyboardAssistBehavior="instant"
|
|
124
|
+
>
|
|
125
|
+
<bf-textarea label="Reply" [(value)]="reply" />
|
|
126
|
+
</div>
|
|
127
|
+
`,
|
|
128
|
+
})
|
|
129
|
+
export class KeyboardAssistOptionsExampleComponent {
|
|
130
|
+
protected readonly reply = signal('');
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
`bfKeyboardAssistMargin` (default `24`) is the gap above the keyboard;
|
|
135
|
+
`bfKeyboardAssistBehavior` (`'smooth'` default, or `'instant'`) is the scroll behaviour of the
|
|
136
|
+
delayed reveal. Set `[bfKeyboardAssist]="false"` to turn it off.
|
|
137
|
+
|
|
138
|
+
## Desktop
|
|
139
|
+
|
|
140
|
+
A desktop browser has no soft keyboard, so the directive adds no padding and never scrolls there; leave it out of desktop layouts.
|
|
141
|
+
|
|
142
|
+
## Theming
|
|
143
|
+
|
|
144
|
+
None — it writes only inline `padding-bottom` and `scroll-padding-bottom` on its host while the
|
|
145
|
+
keyboard is open, and removes them again on hide. Do not rely on your own inline bottom padding on
|
|
146
|
+
the same element.
|
|
147
|
+
|
|
148
|
+
## Accessibility
|
|
149
|
+
|
|
150
|
+
It keeps the focused control and the text being typed visible above the soft keyboard and never
|
|
151
|
+
moves focus itself. `scroll-padding-bottom` also keeps engine-driven scrolls (moving to the next
|
|
152
|
+
field with the keyboard's arrows or `Tab`) clear of the keyboard.
|
|
153
|
+
|
|
154
|
+
## Notes
|
|
155
|
+
|
|
156
|
+
### Do
|
|
157
|
+
|
|
158
|
+
- Rely on `bf-content`'s built-in assist; add the directive only to a custom scroll container.
|
|
159
|
+
- Turn it off (`[bfKeyboardAssist]="false"`) for screens that pin their own composer above the
|
|
160
|
+
keyboard.
|
|
161
|
+
|
|
162
|
+
### Don't
|
|
163
|
+
|
|
164
|
+
- Don't put it on an element that does not scroll; it scrolls its own host.
|
|
165
|
+
- Don't combine it with your own keyboard padding on the same scroller.
|
|
166
|
+
|
|
167
|
+
## Inputs
|
|
168
|
+
|
|
169
|
+
| Name | Type | Default | Description |
|
|
170
|
+
| -------------------------- | ---------------------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------- |
|
|
171
|
+
| `bfKeyboardAssist` | `boolean` | `true` | Enables the assist; set it false for screens that manage the keyboard themselves (a chat composer). |
|
|
172
|
+
| `bfKeyboardAssistMargin` | `number` | `24` | Gap kept between the focused control and the top of the keyboard, in px. |
|
|
173
|
+
| `bfKeyboardAssistBehavior` | `BfKeyboardAssistBehavior` (`'smooth' \| 'instant'`) | `'smooth'` | Scroll behaviour of the reveal. |
|
|
174
|
+
|
|
175
|
+
## Methods
|
|
176
|
+
|
|
177
|
+
### `refresh(): void`
|
|
178
|
+
|
|
179
|
+
Measures the covered part again and, while the keyboard is up, corrects the reveal once
|
|
180
|
+
(instantly, after any scroll in progress). For a container that moves with the keyboard
|
|
181
|
+
outside the keyboard events — `bf-sheet` calls it once its lift above the keyboard has ended.
|
|
182
|
+
|
|
183
|
+
## Uses
|
|
184
|
+
|
|
185
|
+
- [BfKeyboardAssistBehavior](bf-keyboard-assist-behavior.md)
|