Skip to content

Commit 4c6e4ed

Browse files
authored
Merge branch 'master' into feat/colors-tokens
2 parents f8e51b2 + 05716f9 commit 4c6e4ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+575
-476
lines changed

.github/actions/install-dependencies/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ runs:
2020
# ensure dev dependencies are installed
2121
run: npm ci --include=dev
2222
shell: bash
23+
env:
24+
HUSKY: 0

.github/assets/uikit-logo-dark.svg

Lines changed: 8 additions & 0 deletions
Loading

.github/assets/uikit-logo-light.svg

Lines changed: 8 additions & 0 deletions
Loading

.storybook/test-runner.ts

Lines changed: 10 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,7 @@
1-
import fs from "node:fs";
21
import { getStoryContext, type TestRunnerConfig } from "@storybook/test-runner";
3-
import { NodeResult, Result } from "axe-core";
4-
import { configureAxe, getAxeResults, injectAxe } from "axe-playwright";
2+
import { checkA11y, configureAxe, injectAxe } from "axe-playwright";
53

6-
const excludeStories = [
7-
"Visualizations/Bar Chart",
8-
"Visualizations/Line Chart",
9-
"Visualizations/Donut Chart",
10-
"Visualizations/Confusion Matrix",
11-
"Visualizations/Scatter Plot",
12-
"Visualizations/Treemap",
13-
"Visualizations/Heatmap",
14-
"Components/Code Editor",
15-
"Tests/Visualizations",
16-
];
17-
18-
function getNodesIds(nodes: NodeResult[]) {
19-
return nodes.map((n) => `\n\t\t${n.target}`).join();
20-
}
21-
22-
function getResultSummary(type: string, results: Result[]) {
23-
return results
24-
.map((r) => `\n\t${type}: ${r.help} - ${r.impact} ${getNodesIds(r.nodes)}`)
25-
.join("");
26-
}
27-
28-
function writeAxeResults(
29-
storyTitle: string,
30-
storyName: string,
31-
type: string,
32-
results: Result[],
33-
) {
34-
if (results.length > 0) {
35-
const fileName = `a11y_${type}_Results.txt`;
36-
fs.appendFileSync(fileName, `\n${storyTitle} - ${storyName}`, "utf-8");
37-
fs.appendFileSync(fileName, getResultSummary(type, results), "utf8");
38-
}
39-
}
4+
const excludeStories = ["Templates", "Visualizations"];
405

416
/*
427
* See https://storybook.js.org/docs/writing-tests/test-runner#test-hook-api
@@ -48,36 +13,23 @@ const config: TestRunnerConfig = {
4813
},
4914

5015
async postVisit(page, context) {
51-
const storyContext = await getStoryContext(page, context);
52-
const validStories = excludeStories.filter((s) =>
53-
storyContext.title.includes(s),
54-
);
55-
if (validStories.length !== 0) return;
16+
if (excludeStories.some((s) => context.title.includes(s))) return;
5617

57-
const specificA11yRules = [{ id: "color-contrast", enabled: false }];
18+
const storyContext = await getStoryContext(page, context);
19+
if (storyContext.parameters?.a11y?.disable) return;
5820

5921
// Apply story-level a11y rules
6022
await configureAxe(page, {
6123
rules: [
62-
...specificA11yRules,
24+
{ id: "color-contrast", enabled: false },
6325
...(storyContext.parameters?.a11y?.config?.rules || []),
6426
],
6527
});
6628

67-
const axeResults = await getAxeResults(page, "#storybook-root");
68-
69-
writeAxeResults(
70-
storyContext.title,
71-
storyContext.name,
72-
"Violation",
73-
axeResults.violations,
74-
);
75-
writeAxeResults(
76-
storyContext.title,
77-
storyContext.name,
78-
"Incomplete",
79-
axeResults.incomplete,
80-
);
29+
await checkA11y(page, "#storybook-root", {
30+
verbose: false,
31+
detailedReport: true,
32+
});
8133
},
8234
};
8335

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
<p align="center">
2-
<a href="https://lumada-design.github.io/">
3-
<img src="https://user-images.githubusercontent.com/14975353/229386613-8f17d06d-9530-4e77-a173-dcb7587a85ea.png" alt="UI Kit logo" width="250" />
4-
</a>
5-
</p>
1+
<div align="center">
62

7-
<h4 align="center">React UI library for the Next Design System.
8-
</h4>
3+
<picture>
4+
<source srcset=".github/assets/uikit-logo-dark.svg" media="(prefers-color-scheme: dark)">
5+
<img src=".github/assets/uikit-logo-light.svg" width="160" alt="UI Kit Logo">
6+
</picture>
97

8+
<br/>
109
<br/>
1110

12-
<div align="center">
11+
Open-source **React UI library** to build high-quality digital products.
12+
13+
<br/>
1314

1415
![License](https://img.shields.io/badge/license-Apache%202-blue.svg)
1516
![React](https://img.shields.io/badge/react-17+-blue.svg)
@@ -18,16 +19,19 @@
1819

1920
</div>
2021

21-
<br/>
22+
## Why UI Kit
23+
24+
- **Enhanced Productivity**
25+
Quickly iterate with reusable, pre-built components tailored for production.
2226

23-
**NEXT UI Kit** is Hitachi Vantara open source React component library that gives you the foundation to build your application faster and consistently.
27+
- **Flexible Customization**
28+
Leverage an extensive theming system for fine-grained control over layout and appearance.
2429

25-
## Why use the UI Kit?
30+
- **Seamless Multi-Theming**
31+
Easily manage multiple themes across your application with minimal setup.
2632

27-
- **Ready to go**: Start your project with over 50 high-quality React components out of the box.
28-
- **Composable**: Compose your application UI with reusable building blocks.
29-
- **Accessible**: UI Kit follows WAI-ARIA standards for all components.
30-
- **Themeable**: Use Next Design System or customize it to match your design needs.
33+
- **Accessibility-Centric**
34+
Built to meet accessibility standards and ensure inclusivity for all users.
3135

3236
Check the [project status](https://lumada-design.github.io/uikit-docs/master/docs/project-status) so you can stay up-to-date on the project development, available packages, components status and supported versions.
3337

apps/docs/next.config.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ const withNextra = nextra({
1010
},
1111
mdxOptions: {
1212
rehypePlugins: [rehypeMdxCodeProps],
13+
rehypePrettyCodeOptions: {
14+
theme: {
15+
light: "one-dark-pro",
16+
dark: "one-dark-pro",
17+
},
18+
},
1319
},
1420
});
1521

apps/docs/src/components/Examples.tsx

Lines changed: 25 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
HvTypography,
66
} from "@hitachivantara/uikit-react-core";
77

8+
import canvas from "../pages/examples/canvas.mdx?raw";
89
import charts from "../pages/examples/charts.mdx?raw";
910
import dnd from "../pages/examples/dnd.mdx?raw";
1011
import inputs from "../pages/examples/inputs.mdx?raw";
@@ -16,22 +17,35 @@ import tables from "../pages/examples/tables.mdx?raw";
1617
*/
1718
const countCodeBlocks = (fileContent: string): number => {
1819
const codeBlockRegex = /<CodeBlock/g;
19-
const matches = fileContent.match(codeBlockRegex);
20+
const matches = fileContent?.match?.(codeBlockRegex);
2021
return matches ? matches.length : 0;
2122
};
2223

23-
const getSectionIcon = (title: string) => {
24+
const sections = [
25+
{ slug: "tables", title: "Tables", total: countCodeBlocks(tables) },
26+
{ slug: "charts", title: "Charts", total: countCodeBlocks(charts) },
27+
{ slug: "inputs", title: "Inputs", total: countCodeBlocks(inputs) },
28+
{ slug: "kpis", title: "KPIs", total: countCodeBlocks(kpis) },
29+
{ slug: "dnd", title: "Drag and Drop", total: countCodeBlocks(dnd) },
30+
{ slug: "canvas", title: "Canvas", total: countCodeBlocks(canvas) },
31+
] as const;
32+
33+
type Slug = (typeof sections)[number]["slug"];
34+
35+
const getSectionIcon = (title: Slug) => {
2436
switch (title) {
25-
case "Tables":
37+
case "tables":
2638
return <div className="i-ph-table" />;
27-
case "Charts":
39+
case "charts":
2840
return <div className="i-ph-chart-bar" />;
29-
case "Inputs":
41+
case "inputs":
3042
return <div className="i-ph-text-a-underline" />;
31-
case "KPIs":
43+
case "kpis":
3244
return <div className="i-ph-speedometer" />;
33-
case "Drag and Drop":
45+
case "dnd":
3446
return <div className="i-ph-hand-swipe-right" />;
47+
case "canvas":
48+
return <div className="i-ph-flow-arrow" />;
3549
default:
3650
return null;
3751
}
@@ -42,35 +56,6 @@ const getSectionIcon = (title: string) => {
4256
* with details about the number of components in each category.
4357
*/
4458
export const Examples = () => {
45-
// Define section categories with their respective titles and component counts
46-
const sections = [
47-
{
48-
title: "Tables",
49-
total: countCodeBlocks(tables),
50-
path: "/examples/tables",
51-
},
52-
{
53-
title: "Charts",
54-
total: countCodeBlocks(charts),
55-
path: "/examples/charts",
56-
},
57-
{
58-
title: "Inputs",
59-
total: countCodeBlocks(inputs),
60-
path: "/examples/inputs",
61-
},
62-
{
63-
title: "KPIs",
64-
total: countCodeBlocks(kpis),
65-
path: "/examples/kpis",
66-
},
67-
{
68-
title: "Drag and Drop",
69-
total: countCodeBlocks(dnd),
70-
path: "/examples/dnd",
71-
},
72-
];
73-
7459
return (
7560
<div className="max-w-6xl mx-auto px-sm md:px-md py-lg md:py-xl">
7661
{/* Page Header */}
@@ -104,9 +89,9 @@ export const Examples = () => {
10489
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-lg">
10590
{sections.map((section) => (
10691
<Link
107-
key={section.title}
108-
href={section.path}
109-
className={clsx("hover:bg-bgContainer rounded-round p-xs")}
92+
key={section.slug}
93+
href={`/examples/${section.slug}`}
94+
className="hover:bg-bgContainer rounded-round p-xs"
11095
>
11196
{/* Placeholder for section preview */}
11297
<div
@@ -116,7 +101,7 @@ export const Examples = () => {
116101
)}
117102
>
118103
<HvIconContainer color="textSubtle" size="xl">
119-
{getSectionIcon(section.title)}
104+
{getSectionIcon(section.slug)}
120105
</HvIconContainer>
121106
</div>
122107
{/* Section Title */}

apps/docs/src/components/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const Footer = () => {
6060
>
6161
<UIKitLogo />
6262
</Link>
63-
<p className="text-sm mt-sm">by Hitachi Vantara © {year}</p>
63+
<p className="text-sm mt-sm">by Pentaho © {year}</p>
6464
</div>
6565

6666
{/* Link Groups Right-Aligned */}

apps/docs/src/components/Header.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { useEffect } from "react";
21
import { useRouter } from "next/router";
32
import { HvContainer, HvTab, HvTabs } from "@hitachivantara/uikit-react-core";
43

@@ -17,13 +16,6 @@ export const Header = () => {
1716

1817
const tab = (query.tab as TabId) || "usage";
1918

20-
useEffect(() => {
21-
const tocElement = document.querySelector<HTMLElement>("nav.nextra-toc");
22-
if (tocElement) {
23-
tocElement.style.display = tab === "usage" ? "block" : "none";
24-
}
25-
}, [tab]);
26-
2719
return (
2820
<div
2921
// Hide sibling elements except for the last child when tab !== 0.

apps/docs/src/components/Main.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import createCache from "@emotion/cache";
22
import { useTheme } from "nextra-theme-docs";
3-
import { ds5, HvProvider, pentahoPlus } from "@hitachivantara/uikit-react-core";
3+
import { HvProvider, pentahoPlus } from "@hitachivantara/uikit-react-core";
44
import { HvVizProvider } from "@hitachivantara/uikit-react-viz";
55

66
const emotionCache = createCache({
@@ -14,7 +14,7 @@ export const Main = ({ children }: { children: React.ReactNode }) => {
1414

1515
return (
1616
<HvProvider
17-
themes={[pentahoPlus, ds5]}
17+
themes={[pentahoPlus]}
1818
theme="pentahoPlus"
1919
colorMode={resolvedTheme === "dark" ? "wicked" : "dawn"}
2020
emotionCache={emotionCache}

0 commit comments

Comments
 (0)