Skip to content
Merged
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
10 changes: 6 additions & 4 deletions frontend/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ ol,
ul,
dl,
table,
pre,
hr {
pre {
padding: 0;
margin: 0 0 1rem;
list-style-type: none;
Expand Down Expand Up @@ -122,11 +121,14 @@ h3 {

h4,
h5 {
margin: 0;
font-size: 1em;
font-weight: 500;
}

hr {
padding: 0;
margin: 0;
border: 1px solid var(--border);
}

Expand Down Expand Up @@ -169,9 +171,9 @@ textarea {

input,
textarea {
padding: 6px 10px;
padding: var(--input-padding, 6px 10px);
background: var(--placeholder-background);
border: 1px solid var(--border-darker);
border: var(--input-border, 1px solid var(--border-darker));
}

label {
Expand Down
50 changes: 29 additions & 21 deletions frontend/css/grid.css
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
.flex-row {
display: flex;
flex-wrap: wrap;
align-items: center;
margin: 0 -0.25rem;
:root {
--flex-gap: 0.5rem;
}

.flex-row > * {
margin: 0.25rem;
}
.flex-column {
display: flex;
flex-direction: column;
gap: var(--flex-gap);

.flex-row > label {
display: contents;
> h3 {
margin: 0;
}
}

.flex-row > label > * {
margin: 0.25rem;
}
.flex-row {
display: flex;
flex-wrap: wrap;
gap: var(--flex-gap);
align-items: center;

.flex-row .grow {
flex-grow: 1;
}
> h3 {
margin: 0;
}

.remove-row {
opacity: 0;
}
> label {
display: contents;
}

@media (hover: hover) and (width > 767px) {
.remove-row {
opacity: 0;
}
}

.flex-row:hover .remove-row {
opacity: 1;
&:hover .remove-row {
opacity: 1;
}
}
14 changes: 3 additions & 11 deletions frontend/src/AutocompleteInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
valueSelector?: (val: string, input: HTMLInputElement) => string;
/** Automatically adjust the size of the input element. */
setSize?: boolean;
/** An optional class name to assign to the input element. */
className?: string | undefined;
/** A key binding to add for this input. */
key?: KeySpec;
/** A function that checks the entered value for validity. */
Expand All @@ -58,7 +56,6 @@
valueExtractor,
valueSelector,
setSize = false,
className,
key,
checkValidity,
clearButton = false,
Expand Down Expand Up @@ -152,7 +149,7 @@
}
</script>

<span class={className}>
<span>
<input
type="text"
autocomplete="off"
Expand Down Expand Up @@ -220,27 +217,22 @@
span {
position: relative;
display: inline-block;
flex: var(--autocomplete-wrapper-flex, initial);
}

input {
width: 100%;
}

ul {
position: absolute;
position: var(--autocomplete-list-position, absolute);
z-index: var(--z-index-autocomplete);
overflow: hidden auto;
background-color: var(--background);
border: 1px solid var(--border-darker);
box-shadow: var(--box-shadow-dropdown);
}

:global(aside) ul {
/* the only way to get the list to overflow the
aside is to put it in fixed position */
position: fixed;
}

li {
min-width: 8rem;
padding: 0 0.5em;
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/charts/Chart.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
</div>

<style>
.flex-row {
margin-bottom: var(--flex-gap);
}

@media print {
button.show-charts {
display: none;
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/charts/ChartSwitcher.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@

<style>
div {
margin-bottom: 1.5em;
font-size: 1em;
margin-bottom: 1em;
color: var(--text-color-lightest);
text-align: center;
}
Expand Down
7 changes: 1 addition & 6 deletions frontend/src/editor/SliceEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
);
</script>

<form onsubmit={save}>
<form onsubmit={save} class="flex-column">
<div class="editor" {@attach attach_editor(editor)}></div>
<div class="flex-row">
<span class="spacer"></span>
Expand All @@ -107,12 +107,7 @@
</form>

<style>
label span {
margin-right: 1rem;
}

.editor {
margin-bottom: 0.5rem;
border: 1px solid var(--sidebar-border);
}
</style>
11 changes: 1 addition & 10 deletions frontend/src/entry-forms/AccountInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,11 @@
suggestions?: string[] | undefined;
/** The date to enter this account for to exclude closed accounts. */
date?: string | undefined;
/** An optional class name to assign to the input element. */
className?: string;
/** Whether to mark the input as required. */
required?: boolean;
}

let {
value = $bindable(),
suggestions,
date,
className,
required,
}: Props = $props();
let { value = $bindable(), suggestions, date, required }: Props = $props();

let checkValidity = $derived((val: string) =>
!$accounts_set.size || $accounts_set.has(val) || (required !== true && !val)
Expand All @@ -46,7 +38,6 @@
<AutocompleteInput
placeholder={_("Account")}
bind:value
{className}
{checkValidity}
{required}
suggestions={filtered_suggestions}
Expand Down
12 changes: 3 additions & 9 deletions frontend/src/entry-forms/Balance.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
let { entry = $bindable() }: Props = $props();
</script>

<div>
<div class="flex-column">
<div class="flex-row">
<input
type="date"
Expand All @@ -28,7 +28,6 @@
/>
<h4>{_("Balance")}</h4>
<AccountInput
className="grow"
bind:value={
() => entry.account,
(account: string) => {
Expand All @@ -37,6 +36,7 @@
}
date={entry.date}
required
--autocomplete-wrapper-flex="1"
/>
<input
type="tel"
Expand All @@ -52,7 +52,6 @@
required
/>
<AutocompleteInput
className="currency"
placeholder={_("Currency")}
suggestions={$currencies}
bind:value={
Expand All @@ -62,6 +61,7 @@
}
}
required
--autocomplete-wrapper-flex="0 6em"
/>
<AddMetadataButton
bind:meta={
Expand All @@ -81,9 +81,3 @@
}
/>
</div>

<style>
div :global(.currency) {
width: 6em;
}
</style>
8 changes: 4 additions & 4 deletions frontend/src/entry-forms/EntryMetadata.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
}}
required
/>
:
<input
type="text"
class="value"
Expand All @@ -49,6 +50,7 @@
onclick={() => {
meta = meta.add();
}}
aria-label={_("Add metadata")}
title={_("Add metadata")}
>
+
Expand All @@ -59,17 +61,15 @@

<style>
div {
padding-left: 56px;
font-size: 0.8em;
padding-left: 3rem;
}

input.key {
width: 10em;
width: 12rem;
}

input.value {
flex-grow: 1;
max-width: 15em;
}

@media (width <= 767px) {
Expand Down
11 changes: 4 additions & 7 deletions frontend/src/entry-forms/Note.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
let { entry = $bindable() }: Props = $props();
</script>

<div>
<div class="flex-column">
<div class="flex-row">
<input
type="date"
Expand All @@ -27,7 +27,6 @@
/>
<h4>{_("Note")}</h4>
<AccountInput
className="grow"
bind:value={
() => entry.account,
(account: string) => {
Expand All @@ -36,6 +35,7 @@
}
date={entry.date}
required
--autocomplete-wrapper-flex="1"
/>
<AddMetadataButton
bind:meta={
Expand All @@ -47,8 +47,8 @@
/>
</div>
<textarea
name="comment"
rows={2}
placeholder="Comment"
bind:value={
() => entry.comment,
(comment: string) => {
Expand All @@ -68,9 +68,6 @@

<style>
textarea {
flex-grow: 1;
width: 100%;
padding: 8px;
font: inherit;
resize: vertical;
}
</style>
Loading