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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.4.1] - 2026-09-22

### Changed
- Switch to using `:user-invalid` instead of outdated hacks around `:invalid`
- Implement form styles using nesting

## [v0.4.0] - 2026-06-14

### Added
Expand Down
103 changes: 52 additions & 51 deletions forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,66 +7,67 @@ export const forms = css`@layer component.aegisjsproject.forms {
margin-bottom: 0.4em;
border-radius: 6px;
transition: border-color 200ms ease-in-out;
}

.form-group:focus-within {
border-color: var(--form-group-border, #cacaca);
}

.form-group .input-label {
display: block;
margin: 0.4em 0;
}
&:focus-within {
border-color: var(--form-group-border, #cacaca);
}

.form-group .input-label.required::after {
content: ' *';
display: inline;
font-size: 0.8em;
font-weight: 800;
}
.input-label {
display: block;
margin: 0.4em 0;

.form-group .input, .form-group .input:required:invalid:placeholder-shown {
display: block;
width: var(--input-width, 100%);
max-width: 100%;
color: currentColor;
border-style: solid;
border-color: var(--input-border, #cacaca);
border-width: 0 0 1px 0;
background: transparent;
padding: var(--form-group-padding, 0.5em 0.3em);
transition: color 300ms ease-in-out, background-color 300ms ease-in-out;
}
&.required::after {
content: ' *';
display: inline;
font-size: 0.8em;
font-weight: 800;
}
}

.form-group textarea.input {
resize: vertical;
}
.input {
display: block;
width: var(--input-width, 100%);
max-width: 100%;
color: currentColor;
border-style: solid;
border-color: var(--input-border, #cacaca);
border-width: 0 0 1px 0;
background: transparent;
padding: var(--form-group-padding, 0.5em 0.3em);
transition: color 300ms ease-in-out, background-color 300ms ease-in-out;

.form-group .input:invalid {
box-shadow: none;
}
&:user-invalid {
box-shadow: none;
color: var(--invalid-color, #871717);
border-color: currentColor;
background-color: var(--invalid-background, #F7C1C1);
}
}

.form-group .input:invalid:not(:focus) {
color: var(--invalid-color, #-871717);
border-color: currentColor;
background-color: var(--invalid-background, #F7C1C1);
}
textarea.input {
resize: vertical;
}

.form-group input[hidden] + label[for].btn-toggle {
background-color: var(--button-disabled-background);
margin: var(--form-group-margin, 0.3rem);
transition: background-color 300ms ease-in-out;
}
input[hidden] {
& + label[for].btn-toggle {
background-color: var(--button-disabled-background);
margin: var(--form-group-margin, 0.3rem);
transition: background-color 300ms ease-in-out;
}

.form-group input[hidden]:checked + label[for].btn-toggle {
background-color: var(--button-background);
}
&:checked + label[for].btn-toggle {
background-color: var(--button-background);

.form-group input[hidden]:not(:checked) + label[for].btn-toggle .when-checked {
display: none;
}
.when-unchecked {
display: none;
}
}

.form-group input[hidden]:checked + label[for].btn-toggle .when-unchecked {
display: none;
&:not(:checked) + label[for].btn-toggle {
.when-checked {
display: none;
}
}
}
}
}`;
45 changes: 23 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aegisjsproject/styles",
"version": "0.4.0",
"version": "0.4.1",
"description": "Pre-made and reusable styles for `@aegisjsproject/core`",
"keywords": [
"aegis",
Expand Down
Loading