@bitforgehq/ui 0.4.0 → 0.5.0-next.4
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 +350 -0
- package/README.md +12 -12
- package/ai/MANIFEST.index.json +74 -2
- package/ai/MANIFEST.json +3507 -1763
- package/ai/REFERENCE.index.json +189 -0
- package/ai/REFERENCE.json +1617 -139
- package/ai/UI_GUIDE.md +70 -20
- package/ai/components/app-frame.md +1 -1
- package/ai/components/badge.md +41 -1
- package/ai/components/chat-composer.md +357 -0
- package/ai/components/chat-message.md +251 -0
- package/ai/components/chat-thread.md +521 -0
- package/ai/components/checkbox.md +7 -0
- package/ai/components/combobox.md +12 -0
- package/ai/components/date-input.md +9 -0
- package/ai/components/datetime-input.md +2 -0
- package/ai/components/field.md +10 -0
- package/ai/components/file-input.md +498 -0
- package/ai/components/header.md +1 -1
- package/ai/components/image-input.md +368 -0
- package/ai/components/image-tile.md +452 -0
- package/ai/components/image-viewer.md +309 -0
- package/ai/components/media-card.md +478 -0
- package/ai/components/menu-button.md +67 -9
- package/ai/components/menu.md +10 -0
- package/ai/components/multi-combobox.md +7 -0
- package/ai/components/nav-group.md +10 -3
- package/ai/components/nav-item.md +11 -2
- package/ai/components/number-input.md +2 -7
- package/ai/components/pagination.md +59 -11
- package/ai/components/popover.md +13 -0
- package/ai/components/radio-group.md +6 -0
- package/ai/components/segmented.md +14 -2
- package/ai/components/select.md +100 -42
- package/ai/components/sidebar-toggle.md +16 -9
- package/ai/components/sidebar.md +41 -13
- package/ai/components/tab-group.md +18 -2
- package/ai/components/table.md +17 -2
- package/ai/components/theme-menu-button.md +1 -0
- package/ai/components/time-input.md +2 -0
- package/ai/components/toolbar.md +7 -18
- package/ai/reference/bf-chat-composer-harness.md +64 -0
- package/ai/reference/bf-chat-message-role.md +27 -0
- package/ai/reference/bf-chat-message-status.md +28 -0
- package/ai/reference/bf-fade-in-directive.md +18 -0
- package/ai/reference/bf-file-input-harness.md +67 -0
- package/ai/reference/bf-file-input-variant.md +27 -0
- package/ai/reference/bf-image-input-harness.md +67 -0
- package/ai/reference/bf-image-input-shape.md +27 -0
- package/ai/reference/bf-image-tile-aspect.md +28 -0
- package/ai/reference/bf-image-tile-caption-placement.md +27 -0
- package/ai/reference/bf-image-tile-harness.md +70 -0
- package/ai/reference/bf-image-viewer-actions-context.md +29 -0
- package/ai/reference/bf-image-viewer-harness.md +87 -0
- package/ai/reference/bf-image-viewer-image.md +25 -0
- package/ai/reference/bf-image-viewer-options.md +33 -0
- package/ai/reference/bf-image-viewer-origin.md +23 -0
- package/ai/reference/bf-image-viewer-ref.md +55 -0
- package/ai/reference/bf-image-viewer-service.md +32 -0
- package/ai/reference/bf-labels.md +107 -75
- package/ai/reference/bf-media-card-aspect.md +28 -0
- package/ai/reference/bf-media-card-harness.md +66 -0
- package/ai/reference/bf-motion-list-directive.md +22 -0
- package/ai/reference/bf-pagination-position-label.md +22 -0
- package/ai/reference/bf-prose-directive.md +16 -0
- package/ai/reference/bf-rejected-file-reason.md +28 -0
- package/ai/reference/bf-rejected-file.md +28 -0
- package/ai/reference/bf-select-harness.md +14 -5
- package/ai/reference/bf-select-option.md +2 -0
- package/ai/reference/bf-size.md +3 -0
- package/ai/reference/bf_table_sort_select.md +23 -0
- package/ai/reference/provide-bf-labels.md +11 -3
- package/ai/reference/provide-bf-select.md +20 -0
- package/bin/bf-ui.js +1 -0
- package/fesm2022/bitforgehq-ui-overlay.mjs +2660 -594
- package/fesm2022/bitforgehq-ui-overlay.mjs.map +1 -1
- package/fesm2022/bitforgehq-ui-testing.mjs +414 -10
- package/fesm2022/bitforgehq-ui-testing.mjs.map +1 -1
- package/fesm2022/bitforgehq-ui.mjs +8056 -3993
- package/fesm2022/bitforgehq-ui.mjs.map +1 -1
- package/llms-full.txt +4923 -132
- package/llms.txt +36 -1
- package/package.json +1 -1
- package/theme.css +60 -0
- package/types/bitforgehq-ui-overlay.d.ts +695 -7
- package/types/bitforgehq-ui-testing.d.ts +517 -6
- package/types/bitforgehq-ui.d.ts +1699 -181
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# BfImageInputHarness
|
|
2
|
+
|
|
3
|
+
Test harness for the image input: drops an image on it and reads the preview
|
|
4
|
+
|
|
5
|
+
Class from `@bitforgehq/ui/testing` · since 0.5.0
|
|
6
|
+
|
|
7
|
+
Harness for `bf-image-input`. `addFile()` drops the image on the tile, so it goes through the
|
|
8
|
+
same `accept` and `maxSize` rules as a real drop; read the outcome with `hasPreview()`,
|
|
9
|
+
`getPreviewSrc()` and `getRejectedMessage()`. jsdom has no `URL.createObjectURL`, so a picked
|
|
10
|
+
image shows no preview there: assert on the bound value, or stub `URL.createObjectURL` to read
|
|
11
|
+
the preview.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { BfImageInputHarness } from '@bitforgehq/ui/testing';
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Signature
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
class BfImageInputHarness extends ComponentHarness
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Methods
|
|
24
|
+
|
|
25
|
+
### `getLabel(): Promise<string>`
|
|
26
|
+
|
|
27
|
+
The visible label without the required mark, else the tile's `aria-label`.
|
|
28
|
+
|
|
29
|
+
### `getErrorText(): Promise<string>`
|
|
30
|
+
|
|
31
|
+
The error text beside the tile (an explicit message, or the first form error once touched).
|
|
32
|
+
|
|
33
|
+
### `isDisabled(): Promise<boolean>`
|
|
34
|
+
|
|
35
|
+
Whether the control is disabled.
|
|
36
|
+
|
|
37
|
+
### `isReadonly(): Promise<boolean>`
|
|
38
|
+
|
|
39
|
+
Whether the control is read-only: its tile is not a button and there are no Upload or Remove
|
|
40
|
+
buttons.
|
|
41
|
+
|
|
42
|
+
### `hasPreview(): Promise<boolean>`
|
|
43
|
+
|
|
44
|
+
Whether the tile shows an image, picked or from `src`. A picked image needs
|
|
45
|
+
`URL.createObjectURL`, which jsdom lacks: stub it to see one.
|
|
46
|
+
|
|
47
|
+
### `getPreviewSrc(): Promise<string | null>`
|
|
48
|
+
|
|
49
|
+
The `src` of the shown image.
|
|
50
|
+
|
|
51
|
+
### `addFile(file: File): Promise<void>`
|
|
52
|
+
|
|
53
|
+
Drops an image on the tile, as a user would. On a disabled or read-only control it does
|
|
54
|
+
nothing, like the UI. It waits on no timer, so it works under fake timers and `fakeAsync`.
|
|
55
|
+
|
|
56
|
+
| Parameter | Type | Description |
|
|
57
|
+
| --------- | ------ | ------------------ |
|
|
58
|
+
| `file` | `File` | The image to drop. |
|
|
59
|
+
|
|
60
|
+
### `remove(): Promise<void>`
|
|
61
|
+
|
|
62
|
+
Presses Remove, which clears the picked and the existing image. Throws while there is no
|
|
63
|
+
image or the control cannot be edited.
|
|
64
|
+
|
|
65
|
+
### `getRejectedMessage(): Promise<string>`
|
|
66
|
+
|
|
67
|
+
The reason the last pick was refused, until the next pick or Remove.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# BfImageInputShape
|
|
2
|
+
|
|
3
|
+
The two tile shapes of an image picker, a circle or a rounded square
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui` · since 0.5.0
|
|
6
|
+
|
|
7
|
+
The shape of a `bf-image-input` tile: a circle (`round`, for avatars) or a rounded square
|
|
8
|
+
(`square`, for logos and covers).
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { type BfImageInputShape } from '@bitforgehq/ui';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Signature
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
type BfImageInputShape = 'round' | 'square'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Values
|
|
21
|
+
|
|
22
|
+
- `round`
|
|
23
|
+
- `square`
|
|
24
|
+
|
|
25
|
+
## Used by
|
|
26
|
+
|
|
27
|
+
- [bf-image-input](../components/image-input.md)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# BfImageTileAspect
|
|
2
|
+
|
|
3
|
+
The four aspect ratios of an image tile's picture, square by default
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui` · since 0.5.0
|
|
6
|
+
|
|
7
|
+
The aspect ratio of a `bf-image-tile`'s picture: square (default), 4:3, 16:9 or 3:4.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfImageTileAspect } from '@bitforgehq/ui';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Signature
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
type BfImageTileAspect = '1/1' | '4/3' | '16/9' | '3/4'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Values
|
|
20
|
+
|
|
21
|
+
- `1/1`
|
|
22
|
+
- `4/3`
|
|
23
|
+
- `16/9`
|
|
24
|
+
- `3/4`
|
|
25
|
+
|
|
26
|
+
## Used by
|
|
27
|
+
|
|
28
|
+
- [bf-image-tile](../components/image-tile.md)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# BfImageTileCaptionPlacement
|
|
2
|
+
|
|
3
|
+
Where an image tile's caption sits, below the picture or over it
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui` · since 0.5.0
|
|
6
|
+
|
|
7
|
+
Where a `bf-image-tile`'s title and meta line sit: `below` the picture (default), or `overlay`,
|
|
8
|
+
on a soft gradient over the bottom of the picture.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { type BfImageTileCaptionPlacement } from '@bitforgehq/ui';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Signature
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
type BfImageTileCaptionPlacement = 'below' | 'overlay'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Values
|
|
21
|
+
|
|
22
|
+
- `below`
|
|
23
|
+
- `overlay`
|
|
24
|
+
|
|
25
|
+
## Used by
|
|
26
|
+
|
|
27
|
+
- [bf-image-tile](../components/image-tile.md)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# BfImageTileHarness
|
|
2
|
+
|
|
3
|
+
Test harness for an image tile: its picture state, title, meta, selection and action
|
|
4
|
+
|
|
5
|
+
Class from `@bitforgehq/ui/testing` · since 0.5.0
|
|
6
|
+
|
|
7
|
+
Harness for `bf-image-tile`. jsdom never loads images, so `loadImage()` and `failImage()` fire
|
|
8
|
+
the picture's `load` and `error` events the way a browser would; `getState()` then tells what
|
|
9
|
+
the tile shows. `click()` clicks the tile's `bfAction` link or button.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { BfImageTileHarness } from '@bitforgehq/ui/testing';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Signature
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
class BfImageTileHarness extends ComponentHarness
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Methods
|
|
22
|
+
|
|
23
|
+
### `getTitle(): Promise<string>`
|
|
24
|
+
|
|
25
|
+
The tile's title: the text of its default slot.
|
|
26
|
+
|
|
27
|
+
### `getMeta(): Promise<string>`
|
|
28
|
+
|
|
29
|
+
The meta line under the title.
|
|
30
|
+
|
|
31
|
+
### `getState(): Promise<'empty' | 'loading' | 'loaded' | 'failed'>`
|
|
32
|
+
|
|
33
|
+
What the picture area shows: `empty` (the placeholder), `loading` (the skeleton), `loaded`
|
|
34
|
+
(the picture) or `failed` (the failure message).
|
|
35
|
+
|
|
36
|
+
### `getSrc(): Promise<string>`
|
|
37
|
+
|
|
38
|
+
The URL of the picture.
|
|
39
|
+
|
|
40
|
+
### `getAlt(): Promise<string>`
|
|
41
|
+
|
|
42
|
+
The alternative text of the picture.
|
|
43
|
+
|
|
44
|
+
### `getPlaceholderText(): Promise<string>`
|
|
45
|
+
|
|
46
|
+
The placeholder text while there is no picture.
|
|
47
|
+
|
|
48
|
+
### `getFailedMessage(): Promise<string>`
|
|
49
|
+
|
|
50
|
+
The failure message.
|
|
51
|
+
|
|
52
|
+
### `isSelected(): Promise<boolean>`
|
|
53
|
+
|
|
54
|
+
Whether the tile is marked selected.
|
|
55
|
+
|
|
56
|
+
### `isClickable(): Promise<boolean>`
|
|
57
|
+
|
|
58
|
+
Whether the tile is clickable (has a `bfAction` link or button).
|
|
59
|
+
|
|
60
|
+
### `click(): Promise<void>`
|
|
61
|
+
|
|
62
|
+
Clicks the tile's `bfAction` link or button. Throws for a tile without one.
|
|
63
|
+
|
|
64
|
+
### `loadImage(): Promise<void>`
|
|
65
|
+
|
|
66
|
+
Fires the picture's `load` event, as a browser does when it arrives. Throws without one.
|
|
67
|
+
|
|
68
|
+
### `failImage(): Promise<void>`
|
|
69
|
+
|
|
70
|
+
Fires the picture's `error` event, as a browser does when it fails. Throws without one.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# BfImageViewerActionsContext
|
|
2
|
+
|
|
3
|
+
What the viewer's actions template receives: the shown image, its index and the ref
|
|
4
|
+
|
|
5
|
+
Interface from `@bitforgehq/ui/overlay` · since 0.5.0
|
|
6
|
+
|
|
7
|
+
Context of the `actions` template of `BfImageViewerService.open()`: `let-image`,
|
|
8
|
+
`let-index="index"` and `let-ref="ref"`.
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import { type BfImageViewerActionsContext } from '@bitforgehq/ui/overlay';
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Properties
|
|
15
|
+
|
|
16
|
+
| Name | Type | Default | Description |
|
|
17
|
+
| ----------- | -------------------- | -------- | -------------------------------------------------------- |
|
|
18
|
+
| `$implicit` | `BfImageViewerImage` | required | The image the viewer shows (`let-image`). |
|
|
19
|
+
| `index` | `number` | required | Its 0-based index in the set (`let-index="index"`). |
|
|
20
|
+
| `ref` | `BfImageViewerRef` | required | The viewer's ref (`let-ref="ref"`), to close it or step. |
|
|
21
|
+
|
|
22
|
+
## Uses
|
|
23
|
+
|
|
24
|
+
- [BfImageViewerImage](bf-image-viewer-image.md)
|
|
25
|
+
- [BfImageViewerRef](bf-image-viewer-ref.md)
|
|
26
|
+
|
|
27
|
+
## Used by
|
|
28
|
+
|
|
29
|
+
- [BfImageViewerOptions](bf-image-viewer-options.md)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# BfImageViewerHarness
|
|
2
|
+
|
|
3
|
+
Test harness for an image viewer: its image, index, caption, steps and close
|
|
4
|
+
|
|
5
|
+
Class from `@bitforgehq/ui/testing` · since 0.5.0
|
|
6
|
+
|
|
7
|
+
Harness for `bf-image-viewer`, the lightbox `BfImageViewerService.open()` renders. It renders
|
|
8
|
+
in the CDK overlay container outside the tested component, so get it through
|
|
9
|
+
`TestbedHarnessEnvironment.documentRootLoader(fixture)`. jsdom never loads images: call
|
|
10
|
+
`loadImage()` to fire the shown image's `load` event.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { BfImageViewerHarness } from '@bitforgehq/ui/testing';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Signature
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
class BfImageViewerHarness extends ComponentHarness
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Methods
|
|
23
|
+
|
|
24
|
+
### `getLabel(): Promise<string>`
|
|
25
|
+
|
|
26
|
+
The viewer's accessible name (`ariaLabel`, else the `imageViewer` label).
|
|
27
|
+
|
|
28
|
+
### `getIndex(): Promise<number>`
|
|
29
|
+
|
|
30
|
+
The 0-based index of the shown image.
|
|
31
|
+
|
|
32
|
+
### `getCount(): Promise<number>`
|
|
33
|
+
|
|
34
|
+
How many images the viewer steps through.
|
|
35
|
+
|
|
36
|
+
### `getCounterText(): Promise<string>`
|
|
37
|
+
|
|
38
|
+
The counter's text ("2 of 5"); a viewer of one image shows none.
|
|
39
|
+
|
|
40
|
+
### `getSrc(): Promise<string>`
|
|
41
|
+
|
|
42
|
+
The URL of the shown image.
|
|
43
|
+
|
|
44
|
+
### `getAlt(): Promise<string>`
|
|
45
|
+
|
|
46
|
+
The alternative text of the shown image.
|
|
47
|
+
|
|
48
|
+
### `getCaption(): Promise<string>`
|
|
49
|
+
|
|
50
|
+
The caption under the shown image.
|
|
51
|
+
|
|
52
|
+
### `isLoaded(): Promise<boolean>`
|
|
53
|
+
|
|
54
|
+
Whether the shown image has loaded (no spinner and no failure message).
|
|
55
|
+
|
|
56
|
+
### `hasFailed(): Promise<boolean>`
|
|
57
|
+
|
|
58
|
+
Whether the shown image failed to load (the failure message shows).
|
|
59
|
+
|
|
60
|
+
### `loadImage(): Promise<void>`
|
|
61
|
+
|
|
62
|
+
Fires the shown image's `load` event, as a browser does when it arrives.
|
|
63
|
+
|
|
64
|
+
### `failImage(): Promise<void>`
|
|
65
|
+
|
|
66
|
+
Fires the shown image's `error` event, as a browser does when it fails.
|
|
67
|
+
|
|
68
|
+
### `next(): Promise<void>`
|
|
69
|
+
|
|
70
|
+
Clicks the next button. Throws for a viewer of one image (it has none).
|
|
71
|
+
|
|
72
|
+
### `previous(): Promise<void>`
|
|
73
|
+
|
|
74
|
+
Clicks the previous button. Throws for a viewer of one image (it has none).
|
|
75
|
+
|
|
76
|
+
### `pressKey(key: 'ArrowLeft' | 'ArrowRight' | 'Home' | 'End' | 'Escape'): Promise<void>`
|
|
77
|
+
|
|
78
|
+
Presses a key inside the viewer: ArrowLeft and ArrowRight step, Home and End jump, Escape
|
|
79
|
+
closes.
|
|
80
|
+
|
|
81
|
+
| Parameter | Type | Description |
|
|
82
|
+
| --------- | ------------------------------------------------------------ | ----------------- |
|
|
83
|
+
| `key` | `'ArrowLeft' \| 'ArrowRight' \| 'Home' \| 'End' \| 'Escape'` | The key to press. |
|
|
84
|
+
|
|
85
|
+
### `close(): Promise<void>`
|
|
86
|
+
|
|
87
|
+
Clicks the close button.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# BfImageViewerImage
|
|
2
|
+
|
|
3
|
+
One image the viewer shows: its URL, its name as alternative text and a caption
|
|
4
|
+
|
|
5
|
+
Interface from `@bitforgehq/ui/overlay` · since 0.5.0
|
|
6
|
+
|
|
7
|
+
One image of a `BfImageViewerService.open()` set.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfImageViewerImage } from '@bitforgehq/ui/overlay';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
| Name | Type | Default | Description |
|
|
16
|
+
| --------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
17
|
+
| `src` | `string` | required | URL of the full-size image. |
|
|
18
|
+
| `label` | `string` | required | The image's name: its alternative text (`alt`), read when it shows and announced after a step (required: the viewer shows nothing else that names it). |
|
|
19
|
+
| `caption` | `string` | | Text shown under the image; none shows no caption. |
|
|
20
|
+
|
|
21
|
+
## Used by
|
|
22
|
+
|
|
23
|
+
- [BfImageViewerActionsContext](bf-image-viewer-actions-context.md)
|
|
24
|
+
- [BfImageViewerOptions](bf-image-viewer-options.md)
|
|
25
|
+
- [BfImageViewerRef](bf-image-viewer-ref.md)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# BfImageViewerOptions
|
|
2
|
+
|
|
3
|
+
Options of an image viewer: its images, the first one, its thumbnail and actions
|
|
4
|
+
|
|
5
|
+
Interface from `@bitforgehq/ui/overlay` · since 0.5.0
|
|
6
|
+
|
|
7
|
+
Options of `BfImageViewerService.open()`.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { type BfImageViewerOptions } from '@bitforgehq/ui/overlay';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
| Name | Type | Default | Description |
|
|
16
|
+
| ------------------- | -------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| `images` | `readonly BfImageViewerImage[]` | required | The images to step through, in order; at least one. |
|
|
18
|
+
| `index` | `number` | `0` | Index of the image shown first, wrapped into the set. |
|
|
19
|
+
| `origin` | `BfImageViewerOrigin` (`HTMLElement \| (index: number) => HTMLElement \| null \| undefined`) | | The thumbnail the viewer zooms out of and back into (or a function returning the thumbnail of an image by index); none fades the viewer in and out. |
|
|
20
|
+
| `actions` | `TemplateRef<BfImageViewerActionsContext>` | | Actions under the image, beside its caption (a download link, a "Use this one" button); its context is `{ $implicit: image, index, ref }`. |
|
|
21
|
+
| `ariaLabel` | `string` | | Accessible name of the viewer; empty uses `provideBfLabels()`'s `imageViewer`. |
|
|
22
|
+
| `closeOnNavigation` | `boolean` | `true` | A navigation to another URL path closes the viewer (default true). |
|
|
23
|
+
| `injector` | `Injector` | | Parent of the viewer's injector and source of its labels (default the root injector). Pass the opener's `inject(Injector)` so a feature-level `provideBfLabels()` reaches the viewer. |
|
|
24
|
+
|
|
25
|
+
## Uses
|
|
26
|
+
|
|
27
|
+
- [BfImageViewerActionsContext](bf-image-viewer-actions-context.md)
|
|
28
|
+
- [BfImageViewerImage](bf-image-viewer-image.md)
|
|
29
|
+
- [BfImageViewerOrigin](bf-image-viewer-origin.md)
|
|
30
|
+
|
|
31
|
+
## Used by
|
|
32
|
+
|
|
33
|
+
- [BfImageViewerService](bf-image-viewer-service.md)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# BfImageViewerOrigin
|
|
2
|
+
|
|
3
|
+
The thumbnail an image viewer zooms from and back into, or a lookup per image
|
|
4
|
+
|
|
5
|
+
Type from `@bitforgehq/ui/overlay` · since 0.5.0
|
|
6
|
+
|
|
7
|
+
Where the viewer zooms from and back to: the thumbnail that was clicked, or a function that
|
|
8
|
+
returns the thumbnail of any image of the set (so closing after stepping zooms into the right
|
|
9
|
+
one), `null` for none.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { type BfImageViewerOrigin } from '@bitforgehq/ui/overlay';
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Signature
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
type BfImageViewerOrigin = HTMLElement | ((index: number) => HTMLElement | null | undefined) | null
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Used by
|
|
22
|
+
|
|
23
|
+
- [BfImageViewerOptions](bf-image-viewer-options.md)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# BfImageViewerRef
|
|
2
|
+
|
|
3
|
+
Handle on an open image viewer that steps through its images and closes it
|
|
4
|
+
|
|
5
|
+
Class from `@bitforgehq/ui/overlay` · since 0.5.0
|
|
6
|
+
|
|
7
|
+
Handle to an open image viewer, returned by `BfImageViewerService.open()` and injectable in
|
|
8
|
+
its actions template (`inject(BfImageViewerRef)`). `index` is the shown image; `next()`,
|
|
9
|
+
`previous()` and `goTo()` step through the set (wrapping at both ends), `close()` plays the
|
|
10
|
+
exit motion and resolves `afterClosed`.
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { BfImageViewerRef } from '@bitforgehq/ui/overlay';
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Properties
|
|
17
|
+
|
|
18
|
+
| Name | Type | Default | Description |
|
|
19
|
+
| ------------- | ------------------------------- | ------- | ------------------------------------------------------- |
|
|
20
|
+
| `id` | `string` | | Unique id of the viewer (its overlay's `bf-overlay-N`). |
|
|
21
|
+
| `images` | `readonly BfImageViewerImage[]` | | The images of the set, in order. |
|
|
22
|
+
| `afterClosed` | `Promise<void>` | | Resolves once the viewer has closed and left the page. |
|
|
23
|
+
| `closed` | `Signal<boolean>` | | True once the viewer has been detached. |
|
|
24
|
+
| `index` | `Signal<number>` | | Index (0-based) of the image the viewer shows. |
|
|
25
|
+
|
|
26
|
+
## Methods
|
|
27
|
+
|
|
28
|
+
### `next(): void`
|
|
29
|
+
|
|
30
|
+
Shows the next image; after the last one, the first.
|
|
31
|
+
|
|
32
|
+
### `previous(): void`
|
|
33
|
+
|
|
34
|
+
Shows the previous image; before the first one, the last.
|
|
35
|
+
|
|
36
|
+
### `goTo(index: number): void`
|
|
37
|
+
|
|
38
|
+
Shows the image at `index`, wrapped into the set (`-1` is the last one).
|
|
39
|
+
|
|
40
|
+
| Parameter | Type | Description |
|
|
41
|
+
| --------- | -------- | --------------------------------------- |
|
|
42
|
+
| `index` | `number` | The 0-based index of the image to show. |
|
|
43
|
+
|
|
44
|
+
### `close(): void`
|
|
45
|
+
|
|
46
|
+
Closes the viewer: it zooms back into its thumbnail, or fades out. Ignored once closing.
|
|
47
|
+
|
|
48
|
+
## Uses
|
|
49
|
+
|
|
50
|
+
- [BfImageViewerImage](bf-image-viewer-image.md)
|
|
51
|
+
|
|
52
|
+
## Used by
|
|
53
|
+
|
|
54
|
+
- [BfImageViewerActionsContext](bf-image-viewer-actions-context.md)
|
|
55
|
+
- [BfImageViewerService](bf-image-viewer-service.md)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# BfImageViewerService
|
|
2
|
+
|
|
3
|
+
Opens a full-screen image viewer that zooms from a thumbnail and steps through a set
|
|
4
|
+
|
|
5
|
+
Service from `@bitforgehq/ui/overlay` · since 0.5.0
|
|
6
|
+
|
|
7
|
+
Opens a full-screen image viewer (a lightbox) on the overlay core: one image large over a dark
|
|
8
|
+
scrim, previous and next buttons, the arrow keys, Home and End to step through the set
|
|
9
|
+
(wrapping at both ends), a counter, the caption and optional actions. It zooms out of the
|
|
10
|
+
clicked thumbnail (`origin`) and back into it, cross-fades between images, and fades when there
|
|
11
|
+
is no thumbnail on screen; reduced motion only fades. It is a modal dialog: focus moves to its
|
|
12
|
+
close button and is trapped, `Escape`, the close button and a click on the scrim close it, the
|
|
13
|
+
page behind it is `inert` and does not scroll, and focus returns to the opener.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { BfImageViewerService } from '@bitforgehq/ui/overlay';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Methods
|
|
20
|
+
|
|
21
|
+
### `open(options: BfImageViewerOptions): BfImageViewerRef`
|
|
22
|
+
|
|
23
|
+
Opens the viewer on `options.images`, showing `options.index` first.
|
|
24
|
+
|
|
25
|
+
| Parameter | Type | Description |
|
|
26
|
+
| --------- | ---------------------- | ------------------------------------------------------------------------- |
|
|
27
|
+
| `options` | `BfImageViewerOptions` | The images, the first index, the thumbnail, the actions and the injector. |
|
|
28
|
+
|
|
29
|
+
## Uses
|
|
30
|
+
|
|
31
|
+
- [BfImageViewerOptions](bf-image-viewer-options.md)
|
|
32
|
+
- [BfImageViewerRef](bf-image-viewer-ref.md)
|