Skip to content

Commit 9b2c4d2

Browse files
authored
Merge branch 'main' into fix/react-table-copy
2 parents d972485 + 896c2af commit 9b2c4d2

30 files changed

Lines changed: 5539 additions & 453 deletions

.github/workflows/chromatic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
run: yarn install --immutable
2626

2727
- name: Publish to Chromatic
28-
uses: chromaui/action@42839e8c28caf61a16433fa96a03b312bbc47ab5 # v16.6.3
28+
uses: chromaui/action@a200f3ba3ff81232c47ac7942347fb212b1a67dc # v16.8.0
2929
with:
3030
token: ${{ secrets.GITHUB_TOKEN }}
3131
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
run: npx cypress install
122122

123123
- name: Cypress run
124-
uses: cypress-io/github-action@c495c3ddffba403ba11be95fffb67e25203b3799 # v7.1.10
124+
uses: cypress-io/github-action@dace029018fcdf86e0df89a31bc3cfa5b32570d8 # v7.3.0
125125
with:
126126
browser: chrome
127127
component: true
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { SearchIcon } from '@storybook/icons';
2+
import * as React from 'react';
3+
import { IconButton } from 'storybook/internal/components';
4+
import { addons, types } from 'storybook/manager-api';
5+
6+
const ADDON_ID = 'content-search';
7+
const TOOL_ID = `${ADDON_ID}/toolbar`;
8+
const isMac = navigator.platform.toUpperCase().includes('MAC');
9+
const shortcut = isMac ? '⌘⇧F' : 'Ctrl+Shift+F';
10+
11+
function SearchButton() {
12+
const openSearch = React.useCallback(() => {
13+
const dialog = document.getElementById('pagefind-search-container');
14+
if (dialog && dialog instanceof HTMLDialogElement && !dialog.open) {
15+
dialog.showModal();
16+
setTimeout(() => dialog.querySelector<HTMLInputElement>('.pagefind-ui__search-input')?.focus(), 50);
17+
}
18+
}, []);
19+
20+
React.useEffect(() => {
21+
const handleKeydown = (e: KeyboardEvent) => {
22+
if ((e.metaKey || e.ctrlKey) && e.shiftKey && e.key === 'f') {
23+
e.preventDefault();
24+
openSearch();
25+
}
26+
};
27+
document.addEventListener('keydown', handleKeydown);
28+
return () => document.removeEventListener('keydown', handleKeydown);
29+
}, [openSearch]);
30+
31+
return (
32+
<IconButton key={TOOL_ID} title={`Search docs (${shortcut})`} style={{ order: -2 }} onClick={openSearch}>
33+
<SearchIcon />
34+
Search Docs (Beta)
35+
</IconButton>
36+
);
37+
}
38+
39+
addons.register(ADDON_ID, () => {
40+
addons.add(TOOL_ID, {
41+
type: types.TOOLEXTRA,
42+
title: 'Search documentation content',
43+
render: () => <SearchButton />,
44+
});
45+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#pagefind-search-container {
2+
border: none;
3+
padding: 1rem;
4+
max-width: 80vw;
5+
max-height: 80vh;
6+
width: 100%;
7+
overflow-y: auto;
8+
background: var(--sapBackgroundColor);
9+
border-radius: var(--sapElement_BorderCornerRadius);
10+
box-shadow: var(--sapContent_Shadow3);
11+
}
12+
#pagefind-search-container::backdrop {
13+
background: rgba(0, 0, 0, 0.5);
14+
}
15+
#pagefind-search-container .pagefind-ui__result-link {
16+
color: var(--sapLinkColor);
17+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* global PagefindUI */
2+
3+
const container = document.getElementById('pagefind-search-container');
4+
5+
if (container) {
6+
try {
7+
new PagefindUI({
8+
element: '#pagefind-ui',
9+
bundlePath: new URL('./pagefind/', import.meta.url).pathname,
10+
showSubResults: true,
11+
showImages: false,
12+
showEmptyFilters: false,
13+
});
14+
} catch {
15+
// PagefindUI may not be available in dev mode (index only exists after build)
16+
}
17+
18+
container.addEventListener('click', (e) => {
19+
if (e.target === container) container.close();
20+
});
21+
}

.storybook/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const config: StorybookConfig = {
8181
shouldRemoveUndefinedFromOptional: true,
8282
},
8383
},
84-
staticDirs: isDevMode ? ['images-dev'] : ['images'],
84+
staticDirs: isDevMode ? ['images-dev', 'content-search'] : ['images', 'content-search'],
8585
viteFinal: (viteConfig) =>
8686
mergeConfig(viteConfig, {
8787
build: {

.storybook/manager-head.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,13 @@
5252
}
5353
</script>
5454
<link rel="icon" href="favicon.ico" />
55+
56+
<!-- Pagefind content search (index built by scripts/storybook-search/build-index.ts) -->
57+
<link href="./pagefind/pagefind-ui.css" rel="stylesheet">
58+
<link href="./content-search.css" rel="stylesheet">
59+
60+
<dialog id="pagefind-search-container" aria-label="Search documentation">
61+
<div id="pagefind-ui"></div>
62+
</dialog>
63+
<script src="./pagefind/pagefind-ui.js" type="module"></script>
64+
<script src="./content-search.js" type="module"></script>

.storybook/manager.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { addons } from 'storybook/manager-api';
55
import { Badge } from './components/Badge.js';
66
import { Fiori4ReactTheme } from './theme.js';
77
import './components/VersionSwitch.js';
8+
import './components/ContentSearch.js';
89

910
const customTags = new Set(['package:@ui5/webcomponents-react-charts', 'custom']);
1011

0 commit comments

Comments
 (0)