@bitforgehq/ui 0.3.3 → 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 +91 -0
- package/README.md +4 -4
- package/ai/MANIFEST.index.json +36 -0
- package/ai/MANIFEST.json +414 -14
- package/ai/REFERENCE.index.json +35 -0
- package/ai/REFERENCE.json +184 -8
- package/ai/UI_GUIDE.md +25 -4
- package/ai/components/badge.md +39 -2
- 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 +98 -2
- 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 +1 -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 +12 -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 +1 -1
- package/dark-ink.css +124 -0
- package/fesm2022/bitforgehq-ui-mobile.mjs +2 -1
- package/fesm2022/bitforgehq-ui-mobile.mjs.map +1 -1
- package/fesm2022/bitforgehq-ui-testing.mjs +51 -2
- package/fesm2022/bitforgehq-ui-testing.mjs.map +1 -1
- package/fesm2022/bitforgehq-ui.mjs +682 -32
- package/fesm2022/bitforgehq-ui.mjs.map +1 -1
- package/llms-full.txt +1072 -15
- package/llms.txt +9 -0
- package/package.json +2 -1
- package/theme.css +24 -0
- package/types/bitforgehq-ui-testing.d.ts +76 -1
- package/types/bitforgehq-ui.d.ts +288 -8
|
@@ -403,7 +403,7 @@ 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
407
|
sortSelect = this.locatorForOptional(BfSelectHarness.with({ ancestor: "[data-bf-table-stack-bar]" }));
|
|
408
408
|
static with(filters = {}) {
|
|
409
409
|
return new HarnessPredicate(BfTableHarness, filters).addOption("label", filters.label, async (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label));
|
|
@@ -422,6 +422,13 @@ var BfTableHarness = class BfTableHarness extends ComponentHarness {
|
|
|
422
422
|
if (row < 0 || row >= await this.getRowCount()) throw new Error(`BfTableHarness: no row ${row}`);
|
|
423
423
|
return (await (await this.locatorForAll(`tbody tr[data-bf-table-row]:nth-of-type(${row + 1}) [data-bf-cell]`)())[index]?.text())?.trim() ?? "";
|
|
424
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
|
+
}
|
|
425
432
|
async sortBy(column) {
|
|
426
433
|
const key = await (await this.headers())[await this.columnIndex(column)]?.getAttribute("data-bf-column");
|
|
427
434
|
const button = key ? await this.locatorForOptional(`thead th[data-bf-column="${key}"] button`)() : null;
|
|
@@ -1034,6 +1041,48 @@ var BfSidebarToggleHarness = class BfSidebarToggleHarness extends ComponentHarne
|
|
|
1034
1041
|
await (await this.button()).click();
|
|
1035
1042
|
}
|
|
1036
1043
|
};
|
|
1037
|
-
|
|
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 };
|
|
1038
1087
|
|
|
1039
1088
|
//# sourceMappingURL=bitforgehq-ui-testing.mjs.map
|