diff --git a/Standard UI Components/components.js b/Standard UI Components/components.js
index 07565e8..b97cad5 100644
--- a/Standard UI Components/components.js
+++ b/Standard UI Components/components.js
@@ -14,20 +14,20 @@ smButton.innerHTML = `
:host([disabled='true']) .button{
cursor: default;
opacity: 1;
- background: rgba(var(--text), 0.4) !important;
- color: rgba(var(--foreground), 1);
+ background: rgba(var(--text-color), 0.4) !important;
+ color: rgba(var(--foreground-color), 1);
}
:host([variant='primary']) .button{
background: var(--accent-color);
- color: rgba(var(--foreground), 1);
+ color: rgba(var(--foreground-color), 1);
}
:host([variant='outlined']) .button{
box-shadow: 0 0 0 0.1rem var(--accent-color) inset;
- background: rgba(var(--foreground), 1);
+ background: rgba(var(--foreground-color), 1);
color: var(--accent-color);
}
:host([variant='no-outline']) .button{
- background: rgba(var(--foreground), 1);
+ background: rgba(var(--foreground-color), 1);
color: var(--accent-color);
}
.button {
@@ -40,11 +40,11 @@ smButton.innerHTML = `
transition: box-shadow 0.3s;
text-transform: uppercase;
font-weight: 500;
- color: rgba(var(--text), 0.9);
+ color: rgba(var(--text-color), 0.9);
letter-spacing: 0.1rem;
font-family: var(--font-family);
font-size: 0.9rem;
- background: rgba(var(--text), 0.1);
+ background: rgba(var(--text-color), 0.1);
-webkit-tap-highlight-color: transparent;
outline: none;
}
@@ -170,7 +170,7 @@ smInput.innerHTML = `
height: 1.6rem;
width: 1.6rem;
padding: 0.5rem;
- stroke: rgba(var(--text), 0.7);
+ stroke: rgba(var(--text-color), 0.7);
stroke-width: 10;
overflow: visible;
stroke-linecap: round;
@@ -187,7 +187,7 @@ smInput.innerHTML = `
padding: 0.6rem 1rem;
border-radius: 0.2em;
transition: opacity 0.3s;
- background: rgba(var(--text), 0.1);
+ background: rgba(var(--text-color), 0.1);
font-family: var(--font-family);
width: 100%
}
@@ -224,7 +224,7 @@ smInput.innerHTML = `
border: none;
background: transparent;
outline: none;
- color: rgba(var(--text), 1);
+ color: rgba(var(--text-color), 1);
width: 100%;
}
.animate-label .container input {
@@ -244,7 +244,7 @@ smInput.innerHTML = `
}
@media (any-hover: hover){
.icon:hover{
- background: rgba(var(--text), 0.1);
+ background: rgba(var(--text-color), 0.1);
}
}
@@ -303,7 +303,7 @@ customElements.define('sm-input',
}
}
- checkInput = (label, inputParent, clear, helperText) => {
+ checkInput = () => {
if (!this.hasAttribute('placeholder') || this.getAttribute('placeholder') === '')
return;
if (this.input.value !== '') {
@@ -364,6 +364,10 @@ customElements.define('sm-input',
})
this.input.addEventListener('input', e => {
this.checkInput()
+ this.dispatchEvent(new CustomEvent('input', {
+ bubbles: true,
+ composed: true
+ }))
})
this.input.addEventListener('change', e => {
this.valueChanged = true;
@@ -434,7 +438,7 @@ smTabs.innerHTML = `
display: none;
}
:host([variant="tab"]) slot[name="tab"]::slotted(.active){
- color: rgba(var(--foreground), 1);
+ color: rgba(var(--foreground-color), 1);
}
slot[name="tab"]::slotted(.active){
@@ -523,6 +527,7 @@ customElements.define('sm-tabs', class extends HTMLElement {
}
this.prevTab
this.allTabs
+
this.shadowRoot.querySelector('slot[name="panel"]').addEventListener('slotchange', () => {
this.shadowRoot.querySelector('slot[name="panel"]').assignedElements().forEach((panel, index) => {
panel.classList.add('hide-completely')
@@ -613,7 +618,7 @@ customElements.define('sm-tabs', class extends HTMLElement {
},
{ threshold: 1.0 })
observer.observe(this.tabHeader)
- if (this.hasAttribute('swipable') && this.getAttribute('swipable') == 'true') {
+ if (this.hasAttribute('enable-swipe') && this.getAttribute('enable-swipe') == 'true') {
let touchStartTime = 0,
touchEndTime = 0,
swipeTimeThreshold = 200,
@@ -724,7 +729,7 @@ p{
.checkbox:active .icon,
.checkbox:focus .icon{
- background: rgba(var(--text), 0.2);
+ background: rgba(var(--text-color), 0.2);
}
.checkbox input {
@@ -740,7 +745,7 @@ p{
.checkbox input:checked ~ svg .checkmark {
stroke-dashoffset: 0;
- stroke: rgba(var(--foreground), 1);
+ stroke: rgba(var(--foreground-color), 1);
}
.checkbox input:checked ~ svg {
stroke: var(--accent-color);
@@ -754,7 +759,7 @@ p{
height: 2.6rem;
width: 2.6rem;
padding: 0.7rem;
- stroke: rgba(var(--text), 0.7);
+ stroke: rgba(var(--text-color), 0.7);
stroke-width: 6;
overflow: visible;
stroke-linecap: round;
@@ -810,6 +815,13 @@ customElements.define('sm-checkbox', class extends HTMLElement {
this.setAttribute('checked', value)
}
+ dispatch = () => {
+ this.dispatchEvent(new CustomEvent('change', {
+ bubbles: true,
+ composed: true
+ }))
+ }
+
connectedCallback() {
this.addEventListener('keyup', e => {
if ((e.code === "Enter" || e.code === "Space") && this.isDisabled == false) {
@@ -834,10 +846,12 @@ customElements.define('sm-checkbox', class extends HTMLElement {
if (newValue == 'true') {
this.isChecked = true
this.input.checked = true
+ this.dispatch()
}
else {
this.isChecked = false
this.input.checked = false
+ this.dispatch()
}
}
}
@@ -870,7 +884,7 @@ smAudio.innerHTML = `
user-select: none;
padding: 0.6rem;
border-radius: 0.2rem;
- background: rgba(var(--text), 0.08);
+ background: rgba(var(--text-color), 0.08);
overflow: hidden;
width: 100%;
}
@@ -880,7 +894,7 @@ smAudio.innerHTML = `
}
.icon{
- stroke: rgba(var(--text), 1);
+ stroke: rgba(var(--text-color), 1);
stroke-width: 6;
stroke-linecap: round;
stroke-linejoin: round;
@@ -895,7 +909,7 @@ smAudio.innerHTML = `
}
.icon:hover{
- background: rgba(var(--text), 0.1);
+ background: rgba(var(--text-color), 0.1);
}
audio {
@@ -1061,7 +1075,7 @@ input {
height: 1.4rem;
-webkit-transition: background 0.3s;
transition: background 0.3s;
- background: rgba(var(--text), 0.4);
+ background: rgba(var(--text-color), 0.4);
box-shadow: 0 0.1rem 0.3rem #00000040 inset;
border-radius: 1rem;
}
@@ -1083,7 +1097,7 @@ input {
position: absolute;
height: 2.6rem;
width: 2.6rem;
- background: rgba(var(--text), 0.2);
+ background: rgba(var(--text-color), 0.2);
border-radius: 2rem;
opacity: 0;
transition: opacity 0.3s;
@@ -1099,7 +1113,7 @@ input {
border-radius: 1rem;
box-shadow: 0 0.1rem 0.4rem #00000060;
transition: transform 0.3s;
- border: solid 0.3rem rgba(var(--foreground), 1);
+ border: solid 0.3rem rgba(var(--foreground-color), 1);
}
input:checked ~ .button {
@@ -1150,8 +1164,14 @@ customElements.define('sm-switch', class extends HTMLElement {
this.setAttribute('checked', value)
}
- connectedCallback() {
+ dispatch = () => {
+ this.dispatchEvent(new CustomEvent('change', {
+ bubbles: true,
+ composed: true
+ }))
+ }
+ connectedCallback() {
this.addEventListener('keyup', e => {
if ((e.code === "Enter" || e.code === "Space") && this.isDisabled == false) {
this.isChecked = !this.isChecked
@@ -1176,10 +1196,12 @@ customElements.define('sm-switch', class extends HTMLElement {
if (newValue == 'true') {
this.isChecked = true
this.input.checked = true
+ this.dispatch()
}
else {
this.isChecked = false
this.input.checked = false
+ this.dispatch()
}
}
}
@@ -1199,7 +1221,7 @@ smSelect.innerHTML = `
fill: none;
height: 0.8rem;
width: 0.8rem;
- stroke: rgba(var(--text), 0.7);
+ stroke: rgba(var(--text-color), 0.7);
stroke-width: 6;
overflow: visible;
stroke-linecap: round;
@@ -1220,13 +1242,6 @@ smSelect.innerHTML = `
width: 100%;
-webkit-tap-highlight-color: transparent;
}
- .heading{
- text-transform: capitalize;
- color: var(--accent-color);
- grid-area: heading;
- font-weight: 500;
- margin-bottom: 0.2rem;
- }
.option-text{
overflow: hidden;
text-overflow: ellipsis;
@@ -1238,8 +1253,8 @@ smSelect.innerHTML = `
grid-template-columns: 1fr auto;
grid-template-areas: 'heading heading' '. .';
padding: 0.4rem 1rem;
- background: rgba(var(--text), 0.06);
- border: solid 1px rgba(var(--text), 0.2);
+ background: rgba(var(--text-color), 0.06);
+ border: solid 1px rgba(var(--text-color), 0.2);
align-items: center;
outline: none;
}
@@ -1264,9 +1279,9 @@ smSelect.innerHTML = `
display: flex;
flex-direction: column;
min-width: 100%;
- background: rgba(var(--foreground), 1);
+ background: rgba(var(--foreground-color), 1);
transition: opacity 0.3s, top 0.3s;
- border: solid 1px rgba(var(--text), 0.2);
+ border: solid 1px rgba(var(--text-color), 0.2);
border-radius: 0.2rem;
z-index: 2;
box-shadow: 0.4rem 0.8rem 1.2rem #00000030;
@@ -1277,7 +1292,6 @@ smSelect.innerHTML = `
-
select title