Skip to content

Commit

Permalink
Merge pull request #75 from AegisJSProject/release/v0.2.0
Browse files Browse the repository at this point in the history
More custom properties and stylesheets
  • Loading branch information
shgysk8zer0 authored Sep 28, 2024
2 parents 60997e0 + 931cb44 commit e0e7fb5
Show file tree
Hide file tree
Showing 14 changed files with 858 additions and 52 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [v0.2.0] - 2024-09-27

### Added
- More custom properties
- More stylesheets
- More customization

## [v0.1.3] - 2024-09-26

### Added
Expand Down
117 changes: 105 additions & 12 deletions button.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { css } from '@aegisjsproject/core/parsers/css.js';
import { primary, blue, light } from './palette/bootstrap.js';
import { blue, green, red, yellow, gray } from './palette/bootstrap.js';
import {
colorLight, colorDark, btnPrimary, btnPrimaryActive,
btnPrimaryHover, btnDisabled, btnSuccess, btnSuccessActive, btnSuccessHover, btnDanger, btnDangerActive,
btnDangerHover, btnWarning, btnWarningActive, btnWarningHover,
} from './palette/aegis.js';

export const btn = css`.btn:not([hidden]) {
cursor: pointer;
Expand All @@ -9,23 +14,111 @@ export const btn = css`.btn:not([hidden]) {
font-family: inherit;
border-radius: 4px;
text-decoration: none;
}
.btn.btn-primary {
color: ${light};
background-color: ${primary};
border-width: 1px;
border-style: solid;
border-color: ${blue[6]});
transition: background-color 150ms ease-in-out, border-color 150ms ease-in-out;
transition: background-color 150ms ease-in-out, border-color 150ms ease-in-out, color 150ms ease-in-out;
}
.btn.btn-small {
padding: 0.5em 1em;
font-size: 0.7em;
}
.btn.btn-big {
padding: 0.7em 1.3em;
font-size: 1.3em;
}`;

const primary = css`.btn.btn-primary {
background-color: var(--aegis-btn-primary, ${btnPrimary});
color: var(--aegis-color-dark, ${colorDark});
border-color: ${blue[6]};
}
.btn.btn-primary:hover {
background-color: ${blue[5]};
.btn.btn-primary:not(:disabled):hover, .btn.btn-primary:not(:disabled):focus {
background-color: var(--aegis-btn-primary-hover, ${btnPrimaryHover});
border-color: ${blue[7]};
}
.btn.btn-primary:active {
background-color: ${blue[6]};
.btn.btn-primary:not(:disabled):active {
background-color: var(--aegis-btn-primary-active, ${btnPrimaryActive});
border-color: ${blue[8]};
}
.btn.btn-primary:disabled {
background-color: var(--aegis-btn-active-disabled, ${btnDisabled});
color: var(--aegis-color-light, ${colorLight});
border-color: ${gray[6]};
cursor: not-allowed;
}`;

const success = css`.btn.btn-success {
background-color: var(--aegis-btn-success, ${btnSuccess});
color: var(--aegis-color-dark, ${colorDark});
border-color: ${green[6]};
}
.btn.btn-success:not(:disabled):hover, .btn.btn-success:not(:disabled):focus {
background-color: var(--aegis-btn-success-hover, ${btnSuccessHover});
border-color: ${blue[7]};
}
.btn.btn-success:not(:disabled):active {
background-color: var(--aegis-btn-success-active, ${btnSuccessActive});
border-color: ${blue[8]};
}
.btn.btn-success:disabled {
background-color: var(--aegis-btn-active-disabled, ${btnDisabled});
color: var(--aegis-color-light, ${colorLight});
border-color: ${gray[6]};
cursor: not-allowed;
}`;

const danger = css`.btn.btn-danger {
background-color: var(--aegis-btn-danger, ${btnDanger});
color: var(--aegis-color-dark, ${colorDark});
border-color: ${red[6]};
}
.btn.btn-danger:not(:disabled):hover, .btn.btn-danger:not(:disabled):focus {
background-color: var(--aegis-btn-danger-hover, ${btnDangerHover});
border-color: ${red[7]};
}
.btn.btn-danger:not(:disabled):active {
background-color: var(--aegis-btn-danger-active, ${btnDangerActive});
border-color: ${red[8]};
}
.btn.btn-danger:disabled {
background-color: var(--aegis-btn-active-disabled, ${btnDisabled});
color: var(--aegis-color-light, ${colorLight});
border-color: ${gray[6]};
cursor: not-allowed;
}`;

const warning = css`.btn.btn-warning {
background-color: var(--aegis-btn-warning, ${btnWarning});
color: var(--aegis-color-dark, ${colorDark});
border-color: ${yellow[6]};
}
.btn.btn-warning:not(:disabled):hover, .btn.btn-warning:not(:disabled):focus {
background-color: var(--aegis-btn-warning-hover, ${btnWarningHover});
border-color: ${yellow[7]};
}
.btn.btn-warning:not(:disabled):active {
background-color: var(--aegis-btn-warning-active, ${btnWarningActive});
border-color: ${yellow[8]};
}
.btn.btn-warning:disabled {
background-color: var(--aegis-btn-active-disabled, ${btnDisabled});
color: var(--aegis-color-light, ${colorLight});
border-color: ${gray[6]};
cursor: not-allowed;
}`;

export { primary as btnPrimary, success as btnSuccess, danger as btnDanger, warning as btnWarning };
32 changes: 32 additions & 0 deletions consts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import {
colorLight, colorDark, bgLight, bgDark, borderLight, borderDark, btnPrimary, btnPrimaryActive,
btnPrimaryHover, btnDisabled, btnSuccess, btnSuccessActive, btnSuccessHover, btnDanger, btnDangerActive,
btnDangerHover, btnWarning, btnWarningActive, btnWarningHover,
} from './palette/aegis.js';

export const customProperties = {
'font': { initialValue: 'system-ui', syntax: '<custom-ident> | <string>' },
'color-light': { initialValue: colorLight, syntax: '<color>' },
'color-dark': { initialValue: colorDark, syntax: '<color>' },
'bg-light': { initialValue: bgLight, syntax: '<color>' },
'bg-dark': { initialValue: bgDark, syntax: '<color>' },
'border-color-light': { initialValue: borderLight, syntax: '<color>' },
'border-color-dark': { initialValue: borderDark, syntax: '<color>' },
'border-radius': { initialValue: '8px', syntax: '<length>' },
'btn-primary': { initialValue: btnPrimary, syntax: '<color>' },
'btn-primary-hover': { initialValue: btnPrimaryHover, syntax: '<color>' },
'btn-primary-active': { initialValue: btnPrimaryActive, syntax: '<color>' },
'btn-primary-disabled': { initialValue: btnDisabled, syntax: '<color>' },
'btn-danger': { initialValue: btnDanger, syntax: '<color>' },
'btn-danger-hover': { initialValue: btnDangerHover, syntax: '<color>' },
'btn-danger-active': { initialValue: btnDangerActive, syntax: '<color>' },
'btn-danger-disabled': { initialValue: btnDisabled, syntax: '<color>' },
'btn-success': { initialValue: btnSuccess, syntax: '<color>' },
'btn-success-hover': { initialValue: btnSuccessHover, syntax: '<color>' },
'btn-success-active': { initialValue: btnSuccessActive, syntax: '<color>' },
'btn-success-disabled': { initialValue: btnDisabled, syntax: '<color>' },
'btn-warning': { initialValue: btnWarning, syntax: '<color>' },
'btn-warning-hover': { initialValue: btnWarningHover, syntax: '<color>' },
'btn-warning-active': { initialValue: btnWarningActive, syntax: '<color>' },
'btn-warning-disabled': { initialValue: btnDisabled, syntax: '<color>' },
};
70 changes: 70 additions & 0 deletions forms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { css } from '@aegisjsproject/parsers/css.js';

export const forms = css`.form-group {
border: 1px solid transparent;
padding: var(--form-group-padding, 0.4em 0.8em);
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;
}
.form-group .input-label.required::after {
content: ' *';
display: inline;
font-size: 0.8em;
font-weight: 800;
}
.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;
}
.form-group textarea.input {
resize: vertical;
}
.form-group .input:invalid {
box-shadow: none;
}
.form-group .input:invalid:not(:focus) {
color: var(--invalid-color, #-871717);
border-color: currentColor;
background-color: var(--invalid-background, #F7C1C1);
}
.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;
}
.form-group input[hidden]:checked + label[for].btn-toggle {
background-color: var(--button-background);
}
.form-group input[hidden]:not(:checked) + label[for].btn-toggle .when-checked {
display: none;
}
.form-group input[hidden]:checked + label[for].btn-toggle .when-unchecked {
display: none;
}`;
Loading

0 comments on commit e0e7fb5

Please sign in to comment.