Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: fix
fix:
description: Correct "View source on GitHub" links for example components whose names start with an acronym (e.g. `HTMLSelectExample` → `htmlSelectExample.tsx`) (#6296).
links:
- https://github.com/palantir/blueprint/issues/6296
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type: improvement
improvement:
description: Add unit test coverage for `isReactNodeEmpty(false)`.
1 change: 1 addition & 0 deletions packages/core/src/common/utils.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe("Utils", () => {
expect(Utils.isReactNodeEmpty(""), '""').toBe(true);
expect(Utils.isReactNodeEmpty([]), "[]").toBe(true);
expect(Utils.isReactNodeEmpty([undefined, null, false, ""]), "array").toBe(true);
expect(Utils.isReactNodeEmpty(false), "false").toBe(true);
// not empty nodes
expect(Utils.isReactNodeEmpty(0), "0").toBe(false);
expect(Utils.isReactNodeEmpty("text"), "text").toBe(false);
Expand Down
3 changes: 2 additions & 1 deletion packages/docs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"lint:scss": "sass-lint",
"lint:es": "es-lint",
"lint-fix": "es-lint --fix && sass-lint --fix",
"test": "exit 0",
"test": "vitest run",
"verify": "run-p dist lint"
},
"dependencies": {
Expand Down Expand Up @@ -43,6 +43,7 @@
"tslib": "catalog:"
},
"devDependencies": {
"vitest": "catalog:",
"@blueprintjs/node-build-scripts": "workspace:^",
"@blueprintjs/stylelint-plugin": "workspace:^",
"@blueprintjs/webpack-build-scripts": "workspace:^",
Expand Down
30 changes: 30 additions & 0 deletions packages/docs-app/src/tags/exampleSourceFileName.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { describe, expect, it } from "vitest";

import { exampleExportNameToSourceFileName } from "./exampleSourceFileName";

describe("exampleExportNameToSourceFileName", () => {
it("maps HTMLSelectExample to htmlSelectExample.tsx (leading acronym)", () => {
expect(exampleExportNameToSourceFileName("HTMLSelectExample")).toBe("htmlSelectExample.tsx");
});

it("maps typical PascalCase example exports", () => {
expect(exampleExportNameToSourceFileName("ButtonExample")).toBe("buttonExample.tsx");
expect(exampleExportNameToSourceFileName("CardListPlaygroundExample")).toBe("cardListPlaygroundExample.tsx");
});
});
25 changes: 25 additions & 0 deletions packages/docs-app/src/tags/exampleSourceFileName.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import camelCase from "lodash/camelCase";

/**
* Maps a docs example component export name (PascalCase) to its `.tsx` source file name on disk.
* Uses lodash `camelCase` so leading acronyms like `HTMLSelect` become `htmlSelect`, not `hTMLSelect`.
*/
export function exampleExportNameToSourceFileName(exportName: string): string {
return `${camelCase(exportName)}.tsx`;
}
3 changes: 2 additions & 1 deletion packages/docs-app/src/tags/reactExamples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import * as SelectExamples from "../examples/select-examples";
import * as TableExamples from "../examples/table-examples";

import type { BlueprintExampleData } from "./types";
import { exampleExportNameToSourceFileName } from "./exampleSourceFileName";

const SRC_HREF_BASE = "https://github.com/palantir/blueprint/blob/develop/packages/docs-app/src/examples";

Expand All @@ -36,7 +37,7 @@ function getPackageExamples(
const ret: ExampleMap = {};
for (const exampleName of Object.keys(packageExamples)) {
const example = packageExamples[exampleName];
const fileName = exampleName.charAt(0).toLowerCase() + exampleName.slice(1) + ".tsx";
const fileName = exampleExportNameToSourceFileName(exampleName);
ret[exampleName] = {
render: props => createElement(example, { ...props, data: { themeName: getTheme() } }),
sourceUrl: [SRC_HREF_BASE, `${packageName}-examples`, fileName].join("/"),
Expand Down
13 changes: 13 additions & 0 deletions packages/docs-app/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* !
* (c) Copyright 2026 Palantir Technologies Inc. All rights reserved.
*/

import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
name: "docs-app",
environment: "node",
include: ["src/**/*.test.ts"],
},
});
9 changes: 6 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.