Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
20 changes: 11 additions & 9 deletions lib/cql/src/cqlInput/CqlInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,16 @@ export const createCqlInput = (

public createTemplate(partialTheme: DeepPartial<CqlTheme>) {
const {
input,
color: baseColor,
input: {
layout: inputLayout,
chipWrapper: { color: chipWrapperColor, chipContent, chipHandle },
placeholder,
},
tokens,
chipWrapper,
baseBorderRadius,
baseFontSize,
chipContent,
chipHandle,
typeahead,
placeholder
} = applyPartialTheme(partialTheme);
const template = document.createElement("template");
template.innerHTML = `
Expand All @@ -212,6 +213,7 @@ export const createCqlInput = (
/* Hide scrollbars to emulate input scroll */
-ms-overflow-style: none; /* Internet Explorer 10+ */
scrollbar-width: none; /* Firefox, Safari 18.2+, Chromium 121+ */
color: ${baseColor.text};
}

.container::-webkit-scrollbar {
Expand All @@ -230,7 +232,7 @@ export const createCqlInput = (
chip-wrapper {
display: inline-flex;
flex-shrink: 0;
background-color: ${chipWrapper.color.background};
background-color: ${chipWrapperColor.background};
margin: 0 5px;
border-radius: ${baseBorderRadius};
}
Expand Down Expand Up @@ -262,7 +264,7 @@ export const createCqlInput = (

.Cql__ContentEditable {
width: 100%;
padding: ${input.layout.padding};
padding: ${inputLayout.padding};
border-radius: ${baseBorderRadius};
}

Expand Down Expand Up @@ -394,6 +396,7 @@ export const createCqlInput = (
}

.Cql__TypeaheadPopoverContainer, .Cql__ErrorPopover {
color: ${baseColor.text};
position: absolute;
min-width: ${typeahead.layout.minWidth};
margin: 0;
Comment on lines 398 to 402
Expand All @@ -410,7 +413,6 @@ export const createCqlInput = (
padding: ${typeahead.layout.padding};
font-size: ${baseFontSize};
border-radius: ${typeahead.layout.borderRadius};
color: #eee;
background-color: ${typeahead.color.background};
border: 1px solid grey;
overflow: hidden;
Expand Down Expand Up @@ -477,7 +479,7 @@ export const createCqlInput = (
width: 100%;
left: 0;
top: 0;
padding: calc(${input.layout.padding} + ${chipContent.layout.padding});
padding: calc(${inputLayout.padding} + ${chipContent.layout.padding});
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
Expand Down
94 changes: 50 additions & 44 deletions lib/cql/src/cqlInput/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,36 @@ import { mergeDeep } from "../utils/merge";
export type CqlTheme = {
baseFontSize: string;
baseBorderRadius: string;
input: {
layout: {
padding: string;
};
color: {
text: string;
};
placeholder: {
color: {
text: string;
};
};
chipWrapper: {
color: {
background: string;
};
};
chipContent: {
input: {
layout: {
padding: string;
};
color: {
readonly: string;
chipWrapper: {
color: {
background: string;
};
chipContent: {
layout: {
padding: string;
};
color: {
readonly: string;
};
};
chipHandle: {
color: {
background: string;
border: string;
};
};
};
};
chipHandle: {
color: {
background: string;
border: string;
placeholder: {
color: {
text: string;
};
};
};
typeahead: {
Expand Down Expand Up @@ -68,33 +71,36 @@ export type CqlTheme = {
const defaultTheme: CqlTheme = {
baseFontSize: "28px",
baseBorderRadius: "5px",
input: {
layout: {
padding: "5px",
},
},
placeholder: {
color: {
text: "#9d9d9d",
},
},
chipWrapper: {
color: {
background: "rgba(255,255,255,0.2)",
},
color: {
text: "#eee",
},
chipContent: {
input: {
layout: {
padding: "5px",
},
color: {
readonly: "#bbb",
placeholder: {
color: {
text: "#9d9d9d",
},
},
},
chipHandle: {
color: {
background: "#3737378f",
border: "none",
chipWrapper: {
color: {
background: "rgba(255,255,255,0.2)",
},
chipContent: {
layout: {
padding: "5px",
},
color: {
readonly: "#bbb",
},
},
chipHandle: {
color: {
background: "#3737378f",
border: "none",
},
},
Comment on lines +98 to +103
},
},
typeahead: {
Expand Down
1 change: 1 addition & 0 deletions lib/cql/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export {
CqlStr,
CqlField,
} from "./lang/ast.ts";
export type { CqlTheme } from './cqlInput/theme.ts';
Loading