@bitforgehq/ui 0.5.0-next.3 → 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.
@@ -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.
@@ -111,7 +111,9 @@ import { type BfLabels } from '@bitforgehq/ui';
111
111
  | `chatSend` | `string` | `'Send'` | bf-chat-composer's send button. |
112
112
  | `chatStop` | `string` | `'Stop'` | bf-chat-composer's stop button, shown in place of send while a reply runs. |
113
113
  | `mediaCardSelect` | `string` | `'Select'` | bf-media-card's select button, read before the card's name ("Select Starfall"). |
114
- | `imageLoadFailed` | `string` | `'The image could not be loaded'` | bf-media-card's and bf-image-viewer's message for an image that failed to load. |
114
+ | `imageLoadFailed` | `string` | `'The image could not be loaded'` | bf-media-card's, bf-image-tile's and bf-image-viewer's message for an image that failed to load. |
115
+ | `imageTileEmpty` | `string` | `'No image yet'` | bf-image-tile's placeholder text while it has no image yet. |
116
+ | `imageTileSelected` | `string` | `'Selected'` | bf-image-tile's selected state, read before the tile's title ("Selected, Dragon"). |
115
117
  | `imageViewer` | `string` | `'Image viewer'` | bf-image-viewer's name. |
116
118
  | `imageViewerPrevious` | `string` | `'Previous image'` | bf-image-viewer's button that shows the previous image. |
117
119
  | `imageViewerNext` | `string` | `'Next image'` | bf-image-viewer's button that shows the next image. |
@@ -0,0 +1,22 @@
1
+ # BfPaginationPositionLabel
2
+
3
+ Function that writes a compact pager's position text, such as "v3 of 7"
4
+
5
+ Type from `@bitforgehq/ui` · since 0.5.0
6
+
7
+ Writes a compact `bf-pagination`'s position text from the current page and the page count, such
8
+ as "v3 of 7" for page 3 of 7.
9
+
10
+ ```ts
11
+ import { type BfPaginationPositionLabel } from '@bitforgehq/ui';
12
+ ```
13
+
14
+ ## Signature
15
+
16
+ ```ts
17
+ type BfPaginationPositionLabel = (page: number, count: number) => string
18
+ ```
19
+
20
+ ## Used by
21
+
22
+ - [bf-pagination](../components/pagination.md)
@@ -23,7 +23,8 @@ every string. In a component's `providers` it covers that sub-tree's widgets and
23
23
  `fileRejectedType`, `fileRejectedSize`, `fileRejectedCount`,
24
24
  `imageInputChoose`, `imageInputUpload`, `imageInputReplace`, `imageInputRemove`,
25
25
  `chatThread`, `chatJumpToLatest`, `chatMessageStopped`, `chatMessageFailed`, `chatComposer`,
26
- `chatSend`, `chatStop`, `mediaCardSelect`, `imageLoadFailed`, `validation`); the overlay
26
+ `chatSend`, `chatStop`, `mediaCardSelect`, `imageLoadFailed`, `imageTileEmpty`,
27
+ `imageTileSelected`, `validation`); the overlay
27
28
  services (`ok`, `cancel`, `actions`, `sheet`, `modal`, `close`, `expand`, `collapse`,
28
29
  `sheetPosition`, `dialog`, `notifications`, `imageViewer`, `imageViewerPrevious`,
29
30
  `imageViewerNext`, `imageViewerPosition`) are root singletons and pick it up only when the caller passes its injector:
@@ -2624,6 +2624,10 @@ var BfMenuButtonComponent = class BfMenuButtonComponent {
2624
2624
  ...ngDevMode ? { debugName: "iconOnly" } : /* istanbul ignore next */ {},
2625
2625
  transform: booleanAttribute
2626
2626
  });
2627
+ fullWidth = input(false, {
2628
+ ...ngDevMode ? { debugName: "fullWidth" } : /* istanbul ignore next */ {},
2629
+ transform: booleanAttribute
2630
+ });
2627
2631
  disabled = input(false, {
2628
2632
  ...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
2629
2633
  transform: booleanAttribute
@@ -2631,6 +2635,8 @@ var BfMenuButtonComponent = class BfMenuButtonComponent {
2631
2635
  opened = output();
2632
2636
  closed = output();
2633
2637
  resolvedSize = computed(() => this.size() ?? this.defaults.controlSize, ...ngDevMode ? [{ debugName: "resolvedSize" }] : /* istanbul ignore next */ []);
2638
+ stretched = computed(() => this.fullWidth() && !this.iconOnly(), ...ngDevMode ? [{ debugName: "stretched" }] : /* istanbul ignore next */ []);
2639
+ hostClasses = computed(() => this.stretched() ? "inline-flex max-w-full w-full" : "inline-flex max-w-full", ...ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []);
2634
2640
  labelClasses = computed(() => this.iconOnly() ? "contents" : "max-w-full min-w-0 truncate", ...ngDevMode ? [{ debugName: "labelClasses" }] : /* istanbul ignore next */ []);
2635
2641
  classes = computed(() => {
2636
2642
  const size = this.resolvedSize();
@@ -2655,7 +2661,8 @@ var BfMenuButtonComponent = class BfMenuButtonComponent {
2655
2661
  pressed,
2656
2662
  BUTTON$1.size[size],
2657
2663
  padding,
2658
- hit
2664
+ hit,
2665
+ this.stretched() ? "w-full" : ""
2659
2666
  ].filter(Boolean).join(" ");
2660
2667
  }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
2661
2668
  static ɵfac = i0.ɵɵngDeclareFactory({
@@ -2715,6 +2722,13 @@ var BfMenuButtonComponent = class BfMenuButtonComponent {
2715
2722
  isRequired: false,
2716
2723
  transformFunction: null
2717
2724
  },
2725
+ fullWidth: {
2726
+ classPropertyName: "fullWidth",
2727
+ publicName: "fullWidth",
2728
+ isSignal: true,
2729
+ isRequired: false,
2730
+ transformFunction: null
2731
+ },
2718
2732
  disabled: {
2719
2733
  classPropertyName: "disabled",
2720
2734
  publicName: "disabled",
@@ -2727,7 +2741,7 @@ var BfMenuButtonComponent = class BfMenuButtonComponent {
2727
2741
  opened: "opened",
2728
2742
  closed: "closed"
2729
2743
  },
2730
- host: { classAttribute: "inline-flex max-w-full" },
2744
+ host: { properties: { "class": "hostClasses()" } },
2731
2745
  ngImport: i0,
2732
2746
  template: `
2733
2747
  <button
@@ -2770,7 +2784,7 @@ i0.ɵɵngDeclareClassMetadata({
2770
2784
  args: [{
2771
2785
  selector: "bf-menu-button",
2772
2786
  imports: [BfMenuTriggerDirective],
2773
- host: { class: "inline-flex max-w-full" },
2787
+ host: { "[class]": "hostClasses()" },
2774
2788
  template: `
2775
2789
  <button
2776
2790
  type="button"
@@ -2844,6 +2858,14 @@ i0.ɵɵngDeclareClassMetadata({
2844
2858
  required: false
2845
2859
  }]
2846
2860
  }],
2861
+ fullWidth: [{
2862
+ type: i0.Input,
2863
+ args: [{
2864
+ isSignal: true,
2865
+ alias: "fullWidth",
2866
+ required: false
2867
+ }]
2868
+ }],
2847
2869
  disabled: [{
2848
2870
  type: i0.Input,
2849
2871
  args: [{
@@ -3000,6 +3022,7 @@ var BfThemeMenuButtonComponent = class BfThemeMenuButtonComponent {
3000
3022
  "placement",
3001
3023
  "label",
3002
3024
  "iconOnly",
3025
+ "fullWidth",
3003
3026
  "disabled"
3004
3027
  ],
3005
3028
  outputs: ["opened", "closed"]