refactor(editor): extract filterable list component (#9278)

This commit is contained in:
Saul-Mirone
2024-12-24 05:14:22 +00:00
parent ea0a345533
commit 4ce5cf20c3
17 changed files with 64 additions and 69 deletions

View File

@@ -1,2 +1,3 @@
export { FONT_BASE, FONT_SM, FONT_XS } from './font.js';
export { PANEL_BASE, PANEL_BASE_COLORS } from './panel.js';
export { FONT_BASE, FONT_SM, FONT_XS } from './font';
export { PANEL_BASE, PANEL_BASE_COLORS } from './panel';
export { scrollbarStyle } from './scrollbar-style';

View File

@@ -0,0 +1,37 @@
import { css, unsafeCSS } from 'lit';
/**
* You should add a container before the scrollbar style to prevent the style pollution of the whole doc.
*/
export const scrollbarStyle = (container: string) => {
if (!container) {
console.error(
'To prevent style pollution of the whole doc, you must add a container before the scrollbar style.'
);
return css``;
}
// sanitize container name
if (container.includes('{') || container.includes('}')) {
console.error('Invalid container name! Please use a valid CSS selector.');
return css``;
}
return css`
${unsafeCSS(container)} {
scrollbar-gutter: stable;
}
${unsafeCSS(container)}::-webkit-scrollbar {
-webkit-appearance: none;
width: 4px;
height: 4px;
}
${unsafeCSS(container)}::-webkit-scrollbar-thumb {
border-radius: 2px;
background-color: #b1b1b1;
}
${unsafeCSS(container)}::-webkit-scrollbar-corner {
display: none;
}
`;
};