@bitforgehq/ui 0.3.2 → 0.4.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 +132 -0
- package/README.md +4 -4
- package/ai/MANIFEST.index.json +36 -0
- package/ai/MANIFEST.json +436 -24
- package/ai/REFERENCE.index.json +35 -0
- package/ai/REFERENCE.json +202 -10
- package/ai/UI_GUIDE.md +25 -4
- package/ai/components/app-frame.md +14 -7
- package/ai/components/badge.md +39 -2
- package/ai/components/header.md +9 -0
- package/ai/components/list-item.md +105 -9
- package/ai/components/step.md +112 -0
- package/ai/components/steps.md +124 -0
- package/ai/components/table.md +119 -5
- package/ai/components/timeline-event.md +144 -0
- package/ai/components/timeline.md +201 -0
- package/ai/components/toggle.md +11 -1
- package/ai/reference/bf-action-directive.md +3 -1
- package/ai/reference/bf-badge-emphasis.md +27 -0
- package/ai/reference/bf-labels.md +2 -0
- package/ai/reference/bf-select-harness.md +4 -0
- package/ai/reference/bf-step-heading-level.md +28 -0
- package/ai/reference/bf-table-align.md +1 -1
- package/ai/reference/bf-table-column-align.md +33 -0
- package/ai/reference/bf-table-column.md +7 -7
- package/ai/reference/bf-table-harness.md +18 -0
- package/ai/reference/bf-timeline-tone.md +31 -0
- package/ai/reference/bf-toggle-harness.md +55 -0
- package/ai/reference/provide-bf-labels.md +2 -2
- package/dark-ink.css +124 -0
- package/fesm2022/bitforgehq-ui-mobile.mjs +13 -3
- package/fesm2022/bitforgehq-ui-mobile.mjs.map +1 -1
- package/fesm2022/bitforgehq-ui-testing.mjs +55 -2
- package/fesm2022/bitforgehq-ui-testing.mjs.map +1 -1
- package/fesm2022/bitforgehq-ui.mjs +714 -46
- package/fesm2022/bitforgehq-ui.mjs.map +1 -1
- package/llms-full.txt +1128 -26
- package/llms.txt +9 -0
- package/package.json +2 -1
- package/theme.css +37 -0
- package/types/bitforgehq-ui-testing.d.ts +90 -1
- package/types/bitforgehq-ui.d.ts +306 -18
|
@@ -403,7 +403,8 @@ var BfTableHarness = class BfTableHarness extends ComponentHarness {
|
|
|
403
403
|
headers = this.locatorForAll("thead th[data-bf-column]");
|
|
404
404
|
rows = this.locatorForAll("tbody tr[data-bf-table-row]");
|
|
405
405
|
selectAllBox = this.locatorForOptional("thead input[type=\"checkbox\"]");
|
|
406
|
-
rowBoxes = this.locatorForAll("tbody tr[data-bf-table-row] input[type=\"checkbox\"]");
|
|
406
|
+
rowBoxes = this.locatorForAll("tbody tr[data-bf-table-row] > td:not([data-bf-cell]) input[type=\"checkbox\"]");
|
|
407
|
+
sortSelect = this.locatorForOptional(BfSelectHarness.with({ ancestor: "[data-bf-table-stack-bar]" }));
|
|
407
408
|
static with(filters = {}) {
|
|
408
409
|
return new HarnessPredicate(BfTableHarness, filters).addOption("label", filters.label, async (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label));
|
|
409
410
|
}
|
|
@@ -421,6 +422,13 @@ var BfTableHarness = class BfTableHarness extends ComponentHarness {
|
|
|
421
422
|
if (row < 0 || row >= await this.getRowCount()) throw new Error(`BfTableHarness: no row ${row}`);
|
|
422
423
|
return (await (await this.locatorForAll(`tbody tr[data-bf-table-row]:nth-of-type(${row + 1}) [data-bf-cell]`)())[index]?.text())?.trim() ?? "";
|
|
423
424
|
}
|
|
425
|
+
async getCellHarness(row, column, query) {
|
|
426
|
+
const index = await this.columnIndex(column);
|
|
427
|
+
if (row < 0 || row >= await this.getRowCount()) throw new Error(`BfTableHarness: no row ${row}`);
|
|
428
|
+
const offset = await this.locatorForOptional("tbody tr[data-bf-table-row] > td:not([data-bf-cell])")() ? 1 : 0;
|
|
429
|
+
const cell = `tbody tr[data-bf-table-row]:nth-of-type(${row + 1}) > td:nth-child(${index + offset + 1})`;
|
|
430
|
+
return (await this.locatorFactory.harnessLoaderFor(cell)).getHarness(query);
|
|
431
|
+
}
|
|
424
432
|
async sortBy(column) {
|
|
425
433
|
const key = await (await this.headers())[await this.columnIndex(column)]?.getAttribute("data-bf-column");
|
|
426
434
|
const button = key ? await this.locatorForOptional(`thead th[data-bf-column="${key}"] button`)() : null;
|
|
@@ -438,6 +446,9 @@ var BfTableHarness = class BfTableHarness extends ComponentHarness {
|
|
|
438
446
|
}
|
|
439
447
|
return null;
|
|
440
448
|
}
|
|
449
|
+
async getSortSelect() {
|
|
450
|
+
return this.sortSelect();
|
|
451
|
+
}
|
|
441
452
|
async selectRow(index) {
|
|
442
453
|
const box = (await this.rowBoxes())[index];
|
|
443
454
|
if (!box) throw new Error(`BfTableHarness: no selectable row ${index}`);
|
|
@@ -1030,6 +1041,48 @@ var BfSidebarToggleHarness = class BfSidebarToggleHarness extends ComponentHarne
|
|
|
1030
1041
|
await (await this.button()).click();
|
|
1031
1042
|
}
|
|
1032
1043
|
};
|
|
1033
|
-
|
|
1044
|
+
var BfToggleHarness = class BfToggleHarness extends ComponentHarness {
|
|
1045
|
+
static hostSelector = "bf-toggle";
|
|
1046
|
+
input = this.locatorFor("input[role=\"switch\"]");
|
|
1047
|
+
label = this.locatorFor("label");
|
|
1048
|
+
error = this.locatorForOptional("p[id$=\"-error\"]");
|
|
1049
|
+
static with(filters = {}) {
|
|
1050
|
+
return new HarnessPredicate(BfToggleHarness, filters).addOption("label", filters.label, async (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label));
|
|
1051
|
+
}
|
|
1052
|
+
async getLabel() {
|
|
1053
|
+
const input = await this.input();
|
|
1054
|
+
const ids = (await input.getAttribute("aria-labelledby"))?.split(/\s+/).filter(Boolean) ?? [];
|
|
1055
|
+
if (ids.length > 0) {
|
|
1056
|
+
const root = this.documentRootLocatorFactory();
|
|
1057
|
+
return (await Promise.all(ids.map(async (id) => await (await root.locatorForOptional(`[id="${id}"]`)())?.text() ?? ""))).map((text) => text.trim()).filter(Boolean).join(" ");
|
|
1058
|
+
}
|
|
1059
|
+
const ariaLabel = await input.getAttribute("aria-label");
|
|
1060
|
+
if (ariaLabel) return ariaLabel;
|
|
1061
|
+
return (await (await this.label()).text()).trim();
|
|
1062
|
+
}
|
|
1063
|
+
async isChecked() {
|
|
1064
|
+
return (await this.input()).getProperty("checked");
|
|
1065
|
+
}
|
|
1066
|
+
async isDisabled() {
|
|
1067
|
+
return (await this.input()).getProperty("disabled");
|
|
1068
|
+
}
|
|
1069
|
+
async isReadonly() {
|
|
1070
|
+
return await (await this.input()).getAttribute("aria-readonly") === "true";
|
|
1071
|
+
}
|
|
1072
|
+
async toggle() {
|
|
1073
|
+
if (await this.isDisabled()) throw new Error(`BfToggleHarness: the toggle "${await this.getLabel()}" is disabled`);
|
|
1074
|
+
await (await this.input()).click();
|
|
1075
|
+
}
|
|
1076
|
+
async check() {
|
|
1077
|
+
if (!await this.isChecked()) await this.toggle();
|
|
1078
|
+
}
|
|
1079
|
+
async uncheck() {
|
|
1080
|
+
if (await this.isChecked()) await this.toggle();
|
|
1081
|
+
}
|
|
1082
|
+
async getErrorText() {
|
|
1083
|
+
return (await (await this.error())?.text())?.trim() ?? "";
|
|
1084
|
+
}
|
|
1085
|
+
};
|
|
1086
|
+
export { BfCalendarHarness, BfChartHarness, BfComboboxHarness, BfDateInputHarness, BfDateTimeInputHarness, BfDesktopToastHarness, BfDialogHarness, BfMenuButtonHarness, BfMenuHarness, BfMenuItemHarness, BfPaginationHarness, BfPopoverHarness, BfRadioGroupHarness, BfSegmentedHarness, BfSelectHarness, BfSidePanelHarness, BfSidebarToggleHarness, BfTabGroupHarness, BfTableHarness, BfTimeInputHarness, BfToggleHarness, BfTooltipHarness, installBfJsdomShims, provideBfTesting };
|
|
1034
1087
|
|
|
1035
1088
|
//# sourceMappingURL=bitforgehq-ui-testing.mjs.map
|