@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.
Files changed (87) hide show
  1. package/CHANGELOG.md +350 -0
  2. package/README.md +12 -12
  3. package/ai/MANIFEST.index.json +74 -2
  4. package/ai/MANIFEST.json +3507 -1763
  5. package/ai/REFERENCE.index.json +189 -0
  6. package/ai/REFERENCE.json +1617 -139
  7. package/ai/UI_GUIDE.md +70 -20
  8. package/ai/components/app-frame.md +1 -1
  9. package/ai/components/badge.md +41 -1
  10. package/ai/components/chat-composer.md +357 -0
  11. package/ai/components/chat-message.md +251 -0
  12. package/ai/components/chat-thread.md +521 -0
  13. package/ai/components/checkbox.md +7 -0
  14. package/ai/components/combobox.md +12 -0
  15. package/ai/components/date-input.md +9 -0
  16. package/ai/components/datetime-input.md +2 -0
  17. package/ai/components/field.md +10 -0
  18. package/ai/components/file-input.md +498 -0
  19. package/ai/components/header.md +1 -1
  20. package/ai/components/image-input.md +368 -0
  21. package/ai/components/image-tile.md +452 -0
  22. package/ai/components/image-viewer.md +309 -0
  23. package/ai/components/media-card.md +478 -0
  24. package/ai/components/menu-button.md +67 -9
  25. package/ai/components/menu.md +10 -0
  26. package/ai/components/multi-combobox.md +7 -0
  27. package/ai/components/nav-group.md +10 -3
  28. package/ai/components/nav-item.md +11 -2
  29. package/ai/components/number-input.md +2 -7
  30. package/ai/components/pagination.md +59 -11
  31. package/ai/components/popover.md +13 -0
  32. package/ai/components/radio-group.md +6 -0
  33. package/ai/components/segmented.md +14 -2
  34. package/ai/components/select.md +100 -42
  35. package/ai/components/sidebar-toggle.md +16 -9
  36. package/ai/components/sidebar.md +41 -13
  37. package/ai/components/tab-group.md +18 -2
  38. package/ai/components/table.md +17 -2
  39. package/ai/components/theme-menu-button.md +1 -0
  40. package/ai/components/time-input.md +2 -0
  41. package/ai/components/toolbar.md +7 -18
  42. package/ai/reference/bf-chat-composer-harness.md +64 -0
  43. package/ai/reference/bf-chat-message-role.md +27 -0
  44. package/ai/reference/bf-chat-message-status.md +28 -0
  45. package/ai/reference/bf-fade-in-directive.md +18 -0
  46. package/ai/reference/bf-file-input-harness.md +67 -0
  47. package/ai/reference/bf-file-input-variant.md +27 -0
  48. package/ai/reference/bf-image-input-harness.md +67 -0
  49. package/ai/reference/bf-image-input-shape.md +27 -0
  50. package/ai/reference/bf-image-tile-aspect.md +28 -0
  51. package/ai/reference/bf-image-tile-caption-placement.md +27 -0
  52. package/ai/reference/bf-image-tile-harness.md +70 -0
  53. package/ai/reference/bf-image-viewer-actions-context.md +29 -0
  54. package/ai/reference/bf-image-viewer-harness.md +87 -0
  55. package/ai/reference/bf-image-viewer-image.md +25 -0
  56. package/ai/reference/bf-image-viewer-options.md +33 -0
  57. package/ai/reference/bf-image-viewer-origin.md +23 -0
  58. package/ai/reference/bf-image-viewer-ref.md +55 -0
  59. package/ai/reference/bf-image-viewer-service.md +32 -0
  60. package/ai/reference/bf-labels.md +107 -75
  61. package/ai/reference/bf-media-card-aspect.md +28 -0
  62. package/ai/reference/bf-media-card-harness.md +66 -0
  63. package/ai/reference/bf-motion-list-directive.md +22 -0
  64. package/ai/reference/bf-pagination-position-label.md +22 -0
  65. package/ai/reference/bf-prose-directive.md +16 -0
  66. package/ai/reference/bf-rejected-file-reason.md +28 -0
  67. package/ai/reference/bf-rejected-file.md +28 -0
  68. package/ai/reference/bf-select-harness.md +14 -5
  69. package/ai/reference/bf-select-option.md +2 -0
  70. package/ai/reference/bf-size.md +3 -0
  71. package/ai/reference/bf_table_sort_select.md +23 -0
  72. package/ai/reference/provide-bf-labels.md +11 -3
  73. package/ai/reference/provide-bf-select.md +20 -0
  74. package/bin/bf-ui.js +1 -0
  75. package/fesm2022/bitforgehq-ui-overlay.mjs +2660 -594
  76. package/fesm2022/bitforgehq-ui-overlay.mjs.map +1 -1
  77. package/fesm2022/bitforgehq-ui-testing.mjs +414 -10
  78. package/fesm2022/bitforgehq-ui-testing.mjs.map +1 -1
  79. package/fesm2022/bitforgehq-ui.mjs +8056 -3993
  80. package/fesm2022/bitforgehq-ui.mjs.map +1 -1
  81. package/llms-full.txt +4923 -132
  82. package/llms.txt +36 -1
  83. package/package.json +1 -1
  84. package/theme.css +60 -0
  85. package/types/bitforgehq-ui-overlay.d.ts +695 -7
  86. package/types/bitforgehq-ui-testing.d.ts +517 -6
  87. package/types/bitforgehq-ui.d.ts +1699 -181
@@ -90,8 +90,11 @@ interface BfHarnessFilters extends BaseHarnessFilters {
90
90
  label?: string | RegExp;
91
91
  }
92
92
  /**
93
- * Harness for `bf-select`. It works by option label, so a test never needs the native option
94
- * values (an object option's native value is its index).
93
+ * Harness for `bf-select`, in both modes: the styled list under a mouse (its options render in the
94
+ * CDK overlay container while open, found through the field's `aria-controls`) and the native
95
+ * `<select>` under a coarse pointer. It also drives the native select with `data-bf-select` that a
96
+ * stacked `bf-table` renders as its Sort by select without `provideBfSelect()`. It works by option
97
+ * label, so a test never needs the option values (an object option's native value is its index).
95
98
  *
96
99
  * @example
97
100
  * const select = await loader.getHarness(BfSelectHarness.with({ label: 'Project' }));
@@ -102,11 +105,13 @@ interface BfHarnessFilters extends BaseHarnessFilters {
102
105
  export declare class BfSelectHarness extends ComponentHarness {
103
106
  /** The host element's selector. */
104
107
  static hostSelector: string;
105
- private readonly select;
108
+ private readonly nativeSelect;
109
+ private readonly combobox;
106
110
  private readonly label;
107
111
  private readonly error;
108
112
  private readonly help;
109
113
  private readonly nativeOptions;
114
+ private readonly styledOptions;
110
115
  /**
111
116
  * A predicate for a select with the given label.
112
117
  * @param filters The label (text or pattern) and the CDK's selector and ancestor filters.
@@ -118,6 +123,13 @@ export declare class BfSelectHarness extends ComponentHarness {
118
123
  * @returns The label text.
119
124
  */
120
125
  getLabel(): Promise<string>;
126
+ /**
127
+ * Whether the styled option list is open (`aria-expanded`). Always false for the native select,
128
+ * whose list belongs to the platform.
129
+ * @returns True while the list is open.
130
+ * @since 0.5.0
131
+ */
132
+ isOpen(): Promise<boolean>;
121
133
  /**
122
134
  * The selected option's label, `''` while nothing is selected.
123
135
  * @returns The label text.
@@ -131,7 +143,8 @@ export declare class BfSelectHarness extends ComponentHarness {
131
143
  /**
132
144
  * Chooses the option with this label, as a user would: the select's `value` becomes that
133
145
  * option's value. Throws, leaving the value as it is, for an unknown or disabled option and
134
- * while the select itself is disabled.
146
+ * while the select itself is disabled. On a read-only select it changes nothing, in both modes:
147
+ * the styled list does not open, and the native select restores the shown option.
135
148
  * @param label The option's label.
136
149
  */
137
150
  selectOption(label: string): Promise<void>;
@@ -160,10 +173,25 @@ export declare class BfSelectHarness extends ComponentHarness {
160
173
  * @returns The help text, `''` when there is none.
161
174
  */
162
175
  getHelpText(): Promise<string>;
163
- /** Focuses the native select. */
176
+ /** Focuses the field, or the native select. */
164
177
  focus(): Promise<void>;
165
- /** Blurs the native select, which marks a bound form field touched. */
178
+ /** Blurs the field, or the native select, which marks a bound form field touched. */
166
179
  blur(): Promise<void>;
180
+ /** The element the user works with: the native select, else the styled field. */
181
+ private control;
182
+ /** Opens the styled list with a click into the field; does nothing while it is open. */
183
+ private open;
184
+ /** Closes the styled list with `Escape`, as a user would; does nothing while it is closed. */
185
+ private close;
186
+ /** The styled list's options with their labels, from the listbox the field controls. */
187
+ private listOptions;
188
+ /** The styled select's options with their labels, from its hidden copy, whether open or not. */
189
+ private styledChoices;
190
+ /**
191
+ * `selectOption()` for the styled list: checks the option, then opens the list and clicks it. A
192
+ * read-only select stops after the check, as its list never opens.
193
+ */
194
+ private selectStyled;
167
195
  /** Every native option; the placeholder or hidden empty option comes first, empty and disabled. */
168
196
  private options;
169
197
  }
@@ -1362,4 +1390,487 @@ export declare class BfToggleHarness extends ComponentHarness {
1362
1390
  */
1363
1391
  getErrorText(): Promise<string>;
1364
1392
  }
1393
+ /**
1394
+ * Harness for `bf-file-input`, in both looks. `addFiles()` drops files on the field, so they go
1395
+ * through the same `accept`, `maxSize` and `maxFiles` rules as a real drop; read the outcome with
1396
+ * `getFileNames()` and `getRejected()`. It works by file name, so a test never needs the rows.
1397
+ *
1398
+ * @example
1399
+ * const input = await loader.getHarness(BfFileInputHarness.with({ label: 'Documents' }));
1400
+ * await input.addFiles([new File(['x'], 'cv.pdf', { type: 'application/pdf' })]);
1401
+ * expect(await input.getFileNames()).toEqual(['cv.pdf']);
1402
+ * @summary Test harness for the file input: drops files and reads the list and rejections
1403
+ * @since 0.5.0
1404
+ */
1405
+ export declare class BfFileInputHarness extends ComponentHarness {
1406
+ /** The host element's selector. */
1407
+ static hostSelector: string;
1408
+ private readonly label;
1409
+ private readonly error;
1410
+ private readonly box;
1411
+ private readonly pick;
1412
+ private readonly ariaLabelText;
1413
+ private readonly dropzone;
1414
+ private readonly nativeInput;
1415
+ private readonly names;
1416
+ private readonly removeButtons;
1417
+ private readonly rejectedNames;
1418
+ private readonly rejectedMessages;
1419
+ /**
1420
+ * A predicate for a file input with the given label.
1421
+ * @param filters The label (text or pattern) and the CDK's selector and ancestor filters.
1422
+ * @returns The predicate for `getHarness()` and friends.
1423
+ */
1424
+ static with(filters?: BfHarnessFilters): HarnessPredicate<BfFileInputHarness>;
1425
+ /**
1426
+ * The visible label without the required mark, else `ariaLabel`.
1427
+ * @returns The label text.
1428
+ */
1429
+ getLabel(): Promise<string>;
1430
+ /**
1431
+ * The error text under the field (an explicit message, or the first form error once touched).
1432
+ * @returns The error text, `''` when there is none.
1433
+ */
1434
+ getErrorText(): Promise<string>;
1435
+ /**
1436
+ * The look of the field.
1437
+ * @returns `'dropzone'` or `'field'`.
1438
+ */
1439
+ getVariant(): Promise<'field' | 'dropzone'>;
1440
+ /**
1441
+ * Whether the field is disabled.
1442
+ * @returns True when disabled.
1443
+ */
1444
+ isDisabled(): Promise<boolean>;
1445
+ /**
1446
+ * Whether the field is read-only: it has no pick target.
1447
+ * @returns True when read-only.
1448
+ */
1449
+ isReadonly(): Promise<boolean>;
1450
+ /**
1451
+ * Drops files on the field, as a user would. On a disabled or read-only field it does nothing,
1452
+ * like the UI.
1453
+ * @param files The files to drop.
1454
+ */
1455
+ addFiles(files: File[]): Promise<void>;
1456
+ /**
1457
+ * The names of the chosen files, in order (rejected files are not included).
1458
+ * @returns The file names.
1459
+ */
1460
+ getFileNames(): Promise<string[]>;
1461
+ /**
1462
+ * The files the last pick or drop refused, each with its reason, until they are dismissed.
1463
+ * @returns The rejected files' names and messages.
1464
+ */
1465
+ getRejected(): Promise<{
1466
+ name: string;
1467
+ message: string;
1468
+ }[]>;
1469
+ /**
1470
+ * Removes the chosen file with this name, as the row's remove button does. Throws when no
1471
+ * chosen file has that name or the field cannot be edited.
1472
+ * @param name The file's name.
1473
+ */
1474
+ removeFile(name: string): Promise<void>;
1475
+ }
1476
+ /**
1477
+ * Harness for `bf-image-input`. `addFile()` drops the image on the tile, so it goes through the
1478
+ * same `accept` and `maxSize` rules as a real drop; read the outcome with `hasPreview()`,
1479
+ * `getPreviewSrc()` and `getRejectedMessage()`. jsdom has no `URL.createObjectURL`, so a picked
1480
+ * image shows no preview there: assert on the bound value, or stub `URL.createObjectURL` to read
1481
+ * the preview.
1482
+ *
1483
+ * @example
1484
+ * const avatar = await loader.getHarness(BfImageInputHarness.with({ label: 'Profile picture' }));
1485
+ * await avatar.addFile(new File(['x'], 'me.png', { type: 'image/png' }));
1486
+ * expect(fixture.componentInstance.avatar()?.name).toBe('me.png');
1487
+ * await avatar.addFile(new File(['x'], 'cv.pdf', { type: 'application/pdf' }));
1488
+ * expect(await avatar.getRejectedMessage()).toBe('Not an accepted type');
1489
+ * @summary Test harness for the image input: drops an image on it and reads the preview
1490
+ * @since 0.5.0
1491
+ */
1492
+ export declare class BfImageInputHarness extends ComponentHarness {
1493
+ /** The host element's selector. */
1494
+ static hostSelector: string;
1495
+ private readonly label;
1496
+ private readonly error;
1497
+ private readonly tile;
1498
+ private readonly preview;
1499
+ private readonly removeButton;
1500
+ private readonly rejection;
1501
+ private readonly nativeInput;
1502
+ /**
1503
+ * A predicate for an image input with the given label.
1504
+ * @param filters The label (text or pattern) and the CDK's selector and ancestor filters.
1505
+ * @returns The predicate for `getHarness()` and friends.
1506
+ */
1507
+ static with(filters?: BfHarnessFilters): HarnessPredicate<BfImageInputHarness>;
1508
+ /**
1509
+ * The visible label without the required mark, else the tile's `aria-label`.
1510
+ * @returns The label text.
1511
+ */
1512
+ getLabel(): Promise<string>;
1513
+ /**
1514
+ * The error text beside the tile (an explicit message, or the first form error once touched).
1515
+ * @returns The error text, `''` when there is none.
1516
+ */
1517
+ getErrorText(): Promise<string>;
1518
+ /**
1519
+ * Whether the control is disabled.
1520
+ * @returns True when disabled.
1521
+ */
1522
+ isDisabled(): Promise<boolean>;
1523
+ /**
1524
+ * Whether the control is read-only: its tile is not a button and there are no Upload or Remove
1525
+ * buttons.
1526
+ * @returns True when read-only.
1527
+ */
1528
+ isReadonly(): Promise<boolean>;
1529
+ /**
1530
+ * Whether the tile shows an image, picked or from `src`. A picked image needs
1531
+ * `URL.createObjectURL`, which jsdom lacks: stub it to see one.
1532
+ * @returns True while an image shows.
1533
+ */
1534
+ hasPreview(): Promise<boolean>;
1535
+ /**
1536
+ * The `src` of the shown image.
1537
+ * @returns The URL, or null while the tile is empty.
1538
+ */
1539
+ getPreviewSrc(): Promise<string | null>;
1540
+ /**
1541
+ * Drops an image on the tile, as a user would. On a disabled or read-only control it does
1542
+ * nothing, like the UI. It waits on no timer, so it works under fake timers and `fakeAsync`.
1543
+ * @param file The image to drop.
1544
+ */
1545
+ addFile(file: File): Promise<void>;
1546
+ /**
1547
+ * Presses Remove, which clears the picked and the existing image. Throws while there is no
1548
+ * image or the control cannot be edited.
1549
+ */
1550
+ remove(): Promise<void>;
1551
+ /**
1552
+ * The reason the last pick was refused, until the next pick or Remove.
1553
+ * @returns The message, `''` when the last pick was accepted.
1554
+ */
1555
+ getRejectedMessage(): Promise<string>;
1556
+ }
1557
+ /**
1558
+ * Harness for `bf-media-card`. jsdom never loads images, so `loadImage()` and `failImage()` fire
1559
+ * the image's `load` and `error` events the way a browser would; `getState()` then tells what the
1560
+ * image area shows.
1561
+ *
1562
+ * @example
1563
+ * const card = await loader.getHarness(BfMediaCardHarness.with({ label: 'Starfall' }));
1564
+ * await card.failImage();
1565
+ * expect(await card.getState()).toBe('failed');
1566
+ * @summary Test harness for a media card: its image state, its messages and its selection
1567
+ * @since 0.5.0
1568
+ */
1569
+ export declare class BfMediaCardHarness extends ComponentHarness {
1570
+ /** The host element's selector. */
1571
+ static hostSelector: string;
1572
+ private readonly media;
1573
+ private readonly image;
1574
+ private readonly heading;
1575
+ private readonly loadingLabel;
1576
+ private readonly failedLabel;
1577
+ private readonly selectButton;
1578
+ /**
1579
+ * A predicate for a card with the given title (its first heading).
1580
+ * @param filters The title (text or pattern) and the CDK's selector and ancestor filters.
1581
+ * @returns The predicate for `getHarness()` and friends.
1582
+ */
1583
+ static with(filters?: BfHarnessFilters): HarnessPredicate<BfMediaCardHarness>;
1584
+ /**
1585
+ * The card's title: the text of the first heading in its body.
1586
+ * @returns The title, `''` without a heading.
1587
+ */
1588
+ getTitle(): Promise<string>;
1589
+ /**
1590
+ * What the image area shows: `empty` (no `src`, not loading), `loading` (the skeleton),
1591
+ * `loaded` (the image) or `failed` (the failure message).
1592
+ * @returns The state.
1593
+ */
1594
+ getState(): Promise<'empty' | 'loading' | 'loaded' | 'failed'>;
1595
+ /**
1596
+ * The URL of the image.
1597
+ * @returns Its `src`, `''` while there is no image element.
1598
+ */
1599
+ getSrc(): Promise<string>;
1600
+ /**
1601
+ * The alternative text of the image.
1602
+ * @returns Its `alt`, `''` for a decorative image or no image.
1603
+ */
1604
+ getAlt(): Promise<string>;
1605
+ /**
1606
+ * The caption over the skeleton while loading (the `loading` label when none is set).
1607
+ * @returns The caption, `''` when the card is not loading.
1608
+ */
1609
+ getLoadingLabel(): Promise<string>;
1610
+ /**
1611
+ * The failure message.
1612
+ * @returns The message, `''` when the image has not failed.
1613
+ */
1614
+ getFailedMessage(): Promise<string>;
1615
+ /** Fires the image's `load` event, as a browser does when it arrives. Throws without one. */
1616
+ loadImage(): Promise<void>;
1617
+ /** Fires the image's `error` event, as a browser does when it fails. Throws without one. */
1618
+ failImage(): Promise<void>;
1619
+ /**
1620
+ * Whether the card has a select button (`selectable`).
1621
+ * @returns True for a selectable card.
1622
+ */
1623
+ isSelectable(): Promise<boolean>;
1624
+ /**
1625
+ * Whether the card is selected (its select button is pressed).
1626
+ * @returns True while selected; false for a card that is not selectable.
1627
+ */
1628
+ isSelected(): Promise<boolean>;
1629
+ /** Clicks the select button, toggling the selection. Throws for a card that is not selectable. */
1630
+ toggleSelected(): Promise<void>;
1631
+ private requireImage;
1632
+ }
1633
+ /**
1634
+ * Harness for `bf-image-tile`. jsdom never loads images, so `loadImage()` and `failImage()` fire
1635
+ * the picture's `load` and `error` events the way a browser would; `getState()` then tells what
1636
+ * the tile shows. `click()` clicks the tile's `bfAction` link or button.
1637
+ *
1638
+ * @example
1639
+ * const tile = await loader.getHarness(BfImageTileHarness.with({ label: 'Dragon' }));
1640
+ * await tile.loadImage();
1641
+ * expect(await tile.getState()).toBe('loaded');
1642
+ * @summary Test harness for an image tile: its picture state, title, meta, selection and action
1643
+ * @since 0.5.0
1644
+ */
1645
+ export declare class BfImageTileHarness extends ComponentHarness {
1646
+ /** The host element's selector. */
1647
+ static hostSelector: string;
1648
+ private readonly tile;
1649
+ private readonly media;
1650
+ private readonly image;
1651
+ private readonly title;
1652
+ private readonly meta;
1653
+ private readonly placeholder;
1654
+ private readonly failed;
1655
+ private readonly action;
1656
+ /**
1657
+ * A predicate for a tile with the given title.
1658
+ * @param filters The title (text or pattern) and the CDK's selector and ancestor filters.
1659
+ * @returns The predicate for `getHarness()` and friends.
1660
+ */
1661
+ static with(filters?: BfHarnessFilters): HarnessPredicate<BfImageTileHarness>;
1662
+ /**
1663
+ * The tile's title: the text of its default slot.
1664
+ * @returns The title, `''` without one.
1665
+ */
1666
+ getTitle(): Promise<string>;
1667
+ /**
1668
+ * The meta line under the title.
1669
+ * @returns Its text, `''` without one.
1670
+ */
1671
+ getMeta(): Promise<string>;
1672
+ /**
1673
+ * What the picture area shows: `empty` (the placeholder), `loading` (the skeleton), `loaded`
1674
+ * (the picture) or `failed` (the failure message).
1675
+ * @returns The state.
1676
+ */
1677
+ getState(): Promise<'empty' | 'loading' | 'loaded' | 'failed'>;
1678
+ /**
1679
+ * The URL of the picture.
1680
+ * @returns Its `src`, `''` while there is no image element.
1681
+ */
1682
+ getSrc(): Promise<string>;
1683
+ /**
1684
+ * The alternative text of the picture.
1685
+ * @returns Its `alt`, `''` for a decorative picture or no picture.
1686
+ */
1687
+ getAlt(): Promise<string>;
1688
+ /**
1689
+ * The placeholder text while there is no picture.
1690
+ * @returns The text, `''` when the tile is not empty.
1691
+ */
1692
+ getPlaceholderText(): Promise<string>;
1693
+ /**
1694
+ * The failure message.
1695
+ * @returns The message, `''` when the picture has not failed.
1696
+ */
1697
+ getFailedMessage(): Promise<string>;
1698
+ /**
1699
+ * Whether the tile is marked selected.
1700
+ * @returns True while `selected` is set.
1701
+ */
1702
+ isSelected(): Promise<boolean>;
1703
+ /**
1704
+ * Whether the tile is clickable (has a `bfAction` link or button).
1705
+ * @returns True with an action.
1706
+ */
1707
+ isClickable(): Promise<boolean>;
1708
+ /** Clicks the tile's `bfAction` link or button. Throws for a tile without one. */
1709
+ click(): Promise<void>;
1710
+ /** Fires the picture's `load` event, as a browser does when it arrives. Throws without one. */
1711
+ loadImage(): Promise<void>;
1712
+ /** Fires the picture's `error` event, as a browser does when it fails. Throws without one. */
1713
+ failImage(): Promise<void>;
1714
+ private requireImage;
1715
+ }
1716
+ /**
1717
+ * Harness for `bf-image-viewer`, the lightbox `BfImageViewerService.open()` renders. It renders
1718
+ * in the CDK overlay container outside the tested component, so get it through
1719
+ * `TestbedHarnessEnvironment.documentRootLoader(fixture)`. jsdom never loads images: call
1720
+ * `loadImage()` to fire the shown image's `load` event.
1721
+ *
1722
+ * @example
1723
+ * const viewer = await TestbedHarnessEnvironment.documentRootLoader(fixture).getHarness(
1724
+ * BfImageViewerHarness,
1725
+ * );
1726
+ * await viewer.next();
1727
+ * expect(await viewer.getIndex()).toBe(1);
1728
+ * @summary Test harness for an image viewer: its image, index, caption, steps and close
1729
+ * @since 0.5.0
1730
+ */
1731
+ export declare class BfImageViewerHarness extends ComponentHarness {
1732
+ /** The host element's selector. */
1733
+ static hostSelector: string;
1734
+ private readonly image;
1735
+ private readonly frame;
1736
+ private readonly caption;
1737
+ private readonly counter;
1738
+ private readonly closeButton;
1739
+ private readonly nextButton;
1740
+ private readonly previousButton;
1741
+ /**
1742
+ * A predicate for a viewer with the given accessible name.
1743
+ * @param filters The name (text or pattern) and the CDK's selector and ancestor filters.
1744
+ * @returns The predicate for `getHarness()` and friends.
1745
+ */
1746
+ static with(filters?: BfHarnessFilters): HarnessPredicate<BfImageViewerHarness>;
1747
+ /**
1748
+ * The viewer's accessible name (`ariaLabel`, else the `imageViewer` label).
1749
+ * @returns The name.
1750
+ */
1751
+ getLabel(): Promise<string>;
1752
+ /**
1753
+ * The 0-based index of the shown image.
1754
+ * @returns The index.
1755
+ */
1756
+ getIndex(): Promise<number>;
1757
+ /**
1758
+ * How many images the viewer steps through.
1759
+ * @returns The number of images.
1760
+ */
1761
+ getCount(): Promise<number>;
1762
+ /**
1763
+ * The counter's text ("2 of 5"); a viewer of one image shows none.
1764
+ * @returns The counter, `''` for a single image.
1765
+ */
1766
+ getCounterText(): Promise<string>;
1767
+ /**
1768
+ * The URL of the shown image.
1769
+ * @returns Its `src`, `''` while it shows the failure message.
1770
+ */
1771
+ getSrc(): Promise<string>;
1772
+ /**
1773
+ * The alternative text of the shown image.
1774
+ * @returns Its `alt`.
1775
+ */
1776
+ getAlt(): Promise<string>;
1777
+ /**
1778
+ * The caption under the shown image.
1779
+ * @returns The caption, `''` without one.
1780
+ */
1781
+ getCaption(): Promise<string>;
1782
+ /**
1783
+ * Whether the shown image has loaded (no spinner and no failure message).
1784
+ * @returns True once it has loaded.
1785
+ */
1786
+ isLoaded(): Promise<boolean>;
1787
+ /**
1788
+ * Whether the shown image failed to load (the failure message shows).
1789
+ * @returns True after its `error` event.
1790
+ */
1791
+ hasFailed(): Promise<boolean>;
1792
+ /** Fires the shown image's `load` event, as a browser does when it arrives. */
1793
+ loadImage(): Promise<void>;
1794
+ /** Fires the shown image's `error` event, as a browser does when it fails. */
1795
+ failImage(): Promise<void>;
1796
+ /** Clicks the next button. Throws for a viewer of one image (it has none). */
1797
+ next(): Promise<void>;
1798
+ /** Clicks the previous button. Throws for a viewer of one image (it has none). */
1799
+ previous(): Promise<void>;
1800
+ /**
1801
+ * Presses a key inside the viewer: ArrowLeft and ArrowRight step, Home and End jump, Escape
1802
+ * closes.
1803
+ * @param key The key to press.
1804
+ */
1805
+ pressKey(key: 'ArrowLeft' | 'ArrowRight' | 'Home' | 'End' | 'Escape'): Promise<void>;
1806
+ /** Clicks the close button. */
1807
+ close(): Promise<void>;
1808
+ private requireImage;
1809
+ }
1810
+ /**
1811
+ * Harness for `bf-chat-composer` (`@bitforgehq/ui/overlay`). Its `label` filter matches the text
1812
+ * field's name: the visible label, else its `aria-label` ("Message" by default).
1813
+ *
1814
+ * @example
1815
+ * const composer = await loader.getHarness(BfChatComposerHarness);
1816
+ * await composer.setValue('Three names for a cafe');
1817
+ * await composer.send();
1818
+ * expect(await composer.getValue()).toBe('');
1819
+ * @summary Test harness for the chat composer: types, sends, stops and reads its state
1820
+ * @since 0.5.0
1821
+ */
1822
+ export declare class BfChatComposerHarness extends ComponentHarness {
1823
+ /** The host element's selector. */
1824
+ static hostSelector: string;
1825
+ private readonly textarea;
1826
+ private readonly label;
1827
+ private readonly button;
1828
+ /**
1829
+ * A predicate for a composer with the given field name.
1830
+ * @param filters The name (text or pattern) and the CDK's selector and ancestor filters.
1831
+ * @returns The predicate for `getHarness()` and friends.
1832
+ */
1833
+ static with(filters?: BfHarnessFilters): HarnessPredicate<BfChatComposerHarness>;
1834
+ /**
1835
+ * The text field's name: the visible label, else its `aria-label`.
1836
+ * @returns The name, `''` without one.
1837
+ */
1838
+ getLabel(): Promise<string>;
1839
+ /**
1840
+ * The text in the field.
1841
+ * @returns The current text.
1842
+ */
1843
+ getValue(): Promise<string>;
1844
+ /**
1845
+ * Replaces the text as the user would type it (`changed` and the value update).
1846
+ * @param text The new text.
1847
+ */
1848
+ setValue(text: string): Promise<void>;
1849
+ /** Sends the text with the send button, as a click does. Does nothing while it cannot send. */
1850
+ send(): Promise<void>;
1851
+ /** Sends the text with `Enter` in the field, as the keyboard does. */
1852
+ pressEnter(): Promise<void>;
1853
+ /** Stops the running reply with the stop button. Does nothing unless a reply is running. */
1854
+ stop(): Promise<void>;
1855
+ /**
1856
+ * Whether a reply is running, so the button stops instead of sending.
1857
+ * @returns True while running.
1858
+ */
1859
+ isRunning(): Promise<boolean>;
1860
+ /**
1861
+ * Whether the composer is disabled (its text field is).
1862
+ * @returns True when disabled.
1863
+ */
1864
+ isDisabled(): Promise<boolean>;
1865
+ /**
1866
+ * Whether the button can send (or stop) now: not disabled and, to send, with text.
1867
+ * @returns True when a press acts.
1868
+ */
1869
+ canAct(): Promise<boolean>;
1870
+ /**
1871
+ * The button's name, "Send" or "Stop" by default.
1872
+ * @returns The button's text (also its accessible name beside an icon).
1873
+ */
1874
+ getButtonLabel(): Promise<string>;
1875
+ }
1365
1876
  export type { BfHarnessFilters, BfJsdomShimOptions, BfTestingOptions };