diff --git a/icon-button.js b/button-social.js
similarity index 89%
rename from icon-button.js
rename to button-social.js
index 1e440d3..eca435f 100644
--- a/icon-button.js
+++ b/button-social.js
@@ -1,4 +1,5 @@
-class BotonSocial extends HTMLElement {
+class SocialButton extends HTMLElement {
+ static TAG = 'button-social'
static css = `
:host {
all: initial;
@@ -43,7 +44,7 @@ class BotonSocial extends HTMLElement {
const style = document.createElement("style");
const container = document.createElement("div");
- style.innerHTML = BotonSocial.css;
+ style.innerHTML = SocialButton.css;
container.innerHTML = `
`;
@@ -52,4 +53,4 @@ class BotonSocial extends HTMLElement {
}
}
-customElements.define('button-social', BotonSocial);
+customElements.define(SocialButton.TAG, SocialButton);
diff --git a/button.js b/button.js
index 2f1b149..80c5833 100644
--- a/button.js
+++ b/button.js
@@ -1,8 +1,10 @@
-
-
class ButtonVirto extends HTMLElement {
- static TAG = 'button-virto'
+ static TAG = 'virto-button'
static css = `
+ :host {
+ display: inline-block;
+ width: 100%;
+ }
button {
font-family: Outfit, sans-serif;
cursor: pointer;
@@ -11,34 +13,60 @@ class ButtonVirto extends HTMLElement {
min-height: 44px;
padding: 12px;
border-radius: 1000px;
- border: 1px solid var(--colors-alpha-dark-100, #1A1A1A1F)
- opacity: 0px;
+ border: 1px solid #1A1A1A1F;
+ opacity: 1;
background-color: var(--color-fill-btn);
color: var(--color-bg);
transition: background-color 500ms ease;
- &:hover, &:focus {
- background-color: var(--color-accent);
- }
}
-
-`;
+ button:hover {
+ background-color: var(--color-accent);
+ }
+ :host([variant="secondary"]) button {
+ background-color: var(--color-input);
+ color: var(--color-txt);
+ border: 1px solid var(--color-alt-rgb);
+ }
+ :host([variant="secondary"]) button:hover,
+ :host([variant="secondary"]) button:focus {
+ background-color: var(--color-fill-social-btn);
+ }
+ `;
constructor() {
super();
this.attachShadow({ mode: 'open' });
+ }
+
+ connectedCallback() {
+ this.render();
+ }
+
+ render() {
const style = document.createElement("style");
const btn = document.createElement("button");
- style.innerHTML = ButtonVirto.css;
- btn.innerText = this.getAttribute("label") || "Button";
+ style.textContent = ButtonVirto.css;
+ btn.textContent = this.getAttribute("label") || "Button";
+ this.shadowRoot.innerHTML = '';
this.shadowRoot.append(style, btn);
}
- connectedCallback() {
- this.addEventListener('click', function () {
- alert('auch')
- })
+ static get observedAttributes() {
+ return ['label', 'variant'];
+ }
+
+ attributeChangedCallback(name, oldValue, newValue) {
+ if (name === 'label' && this.shadowRoot) {
+ const btn = this.shadowRoot.querySelector('button');
+ if (btn) {
+ btn.textContent = newValue || "Button";
+ }
+ }
+ if (name === 'variant') {
+ this.render();
+ }
}
- }
+}
- customElements.define(ButtonVirto.TAG, ButtonVirto);
\ No newline at end of file
+customElements.define(ButtonVirto.TAG, ButtonVirto);
\ No newline at end of file
diff --git a/checkbox.js b/checkbox.js
new file mode 100644
index 0000000..d111d81
--- /dev/null
+++ b/checkbox.js
@@ -0,0 +1,68 @@
+class CustomCheckbox extends HTMLElement {
+ static TAG = 'checkbox-virto';
+ static css = `
+ :host {
+ display: block;
+ width: 100%;
+ }
+ .checkbox-container {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ }
+ input[type="checkbox"] {
+ appearance: none;
+ width: 20px;
+ height: 20px;
+ border-radius: 4px;
+ background-color: var(--checkbox-bg, #e0e0e0);
+ border: 1px solid var(--checkbox-border, #ccc);
+ display: grid;
+ place-content: center;
+ margin-right: 10px;
+ }
+ input[type="checkbox"]:checked {
+ background-color: var(--checkbox-checked-bg, #24AF37);
+ border-color: var(--checkbox-checked-border, #24AF37);
+ }
+ input[type="checkbox"]:checked::before {
+ content: '✔';
+ color: var(--checkbox-check-color, white);
+ font-size: 14px;
+ }
+ label {
+ color: var(--checkbox-label-color, #333);
+ font-size: 16px;
+ text-align: center;
+ }
+ `;
+
+ constructor() {
+ super();
+ this.attachShadow({ mode: 'open' });
+ }
+
+ connectedCallback() {
+ this.render();
+ }
+
+ render() {
+ const style = document.createElement('style');
+ style.textContent = CustomCheckbox.css;
+
+ const container = document.createElement('div');
+ container.className = 'checkbox-container';
+
+ const checkbox = document.createElement('input');
+ checkbox.type = 'checkbox';
+
+ const label = document.createElement('label');
+ label.textContent = this.getAttribute('label') || 'Checkbox Label';
+
+ container.append(checkbox, label);
+ this.shadowRoot.append(style, container);
+ }
+}
+
+customElements.define(CustomCheckbox.TAG, CustomCheckbox);
\ No newline at end of file
diff --git a/dialog.js b/dialog.js
index 6396ea7..52faa91 100644
--- a/dialog.js
+++ b/dialog.js
@@ -1,74 +1,115 @@
-class DialogoModal extends HTMLElement {
- static css = `
- :host {
- all: initial;
- display: flex;
- flex: 1;
- justify-content: center;
- align-items: center;
- height: 100dvh;
- overflow-x: auto;
- }
+import 'https://early.webawesome.com/webawesome@3.0.0-alpha.7/dist/components/dialog/dialog.js';
- div {
- display: flex;
- flex-direction: column;
- gap: 1em;
- font-family: Outfit, sans-serif;
- width: 100%;
- max-width: 528px;
- height: fit-content;
- background: linear-gradient(0deg, rgba(231, 247, 232, 0.5), rgba(231, 247, 232, 0.5)),
- radial-gradient(84.04% 109.28% at 10.3% 12.14%, rgba(86, 201, 96, 0.5) 0%, rgba(198, 235, 199, 0) 98.5%);
- border-radius: 12px;
- box-shadow: 0px 2px var(--Blurblur-3, 3px) -1px rgba(26, 26, 26, 0.08),
- 0px 1px var(--Blurblur-0, 0px) 0px rgba(26, 26, 26, 0.08);
- backdrop-filter: blur(32px);
- padding: 1em;
- gap: clamp(4px, 1vw, var(--spacing7, 14px));
- opacity: 1;
- }
+const tagFn = fn => (strings, ...parts) => fn(parts.reduce((tpl, value, i) => `${tpl}${strings[i]}${value}`, '').concat(strings[parts.length]));
+const html = tagFn(s => new DOMParser().parseFromString(`${s}`, 'text/html').querySelector('template'));
+const css = tagFn(s => s);
- header {
- display: flex;
- align-items: center;
- gap: 1em;
- }
+const dialogTp = html`
+
+ ${this.getAttribute("label") || "Login to Virto"}
-