marz-ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,181 @@
1
+ class n extends HTMLElement {
2
+ constructor() {
3
+ super(), this.attachShadow({ mode: "open" }), this.overlay = document.createElement("div"), this.overlay.className = "marz-sidepanel-overlay", this.overlay.style.display = "none", this.panel = document.createElement("div"), this.panel.className = "marz-sidepanel", this.header = document.createElement("div"), this.header.className = "marz-sidepanel-header", this.titleElement = document.createElement("h2"), this.titleElement.textContent = "Settings", this.closeButton = document.createElement("button"), this.closeButton.className = "marz-sidepanel-close", this.closeButton.textContent = "✕", this.closeButton.setAttribute("aria-label", "Close"), this.header.appendChild(this.titleElement), this.header.appendChild(this.closeButton);
4
+ const e = document.createElement("div");
5
+ e.className = "marz-sidepanel-content", this.contentSlot = document.createElement("slot"), this.contentSlot.name = "content", e.appendChild(this.contentSlot);
6
+ const t = document.createElement("div");
7
+ t.className = "marz-sidepanel-actions", this.actionsSlot = document.createElement("slot"), this.actionsSlot.name = "actions", t.appendChild(this.actionsSlot), e.appendChild(t), this.panel.appendChild(this.header), this.panel.appendChild(e), this.overlay.appendChild(this.panel);
8
+ const a = document.createElement("style");
9
+ a.textContent = this.getStyles(), this.shadowRoot.appendChild(a), this.shadowRoot.appendChild(this.overlay), this.closeButton.addEventListener("click", () => this.close()), this.overlay.addEventListener("click", (i) => {
10
+ i.target === this.overlay && this.close();
11
+ }), document.addEventListener("keydown", (i) => {
12
+ i.key === "Escape" && this.isOpen && this.close();
13
+ });
14
+ }
15
+ static get observedAttributes() {
16
+ return ["is-open", "title"];
17
+ }
18
+ connectedCallback() {
19
+ this.render();
20
+ }
21
+ attributeChangedCallback(e, t, a) {
22
+ t !== a && this.render();
23
+ }
24
+ render() {
25
+ const e = this.hasAttribute("is-open"), t = this.getAttribute("title") || "Settings";
26
+ this.titleElement.textContent = t, this.overlay.style.display = e ? "flex" : "none", e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "";
27
+ }
28
+ getStyles() {
29
+ return `
30
+ :host {
31
+ display: block;
32
+ }
33
+
34
+ .marz-sidepanel-overlay {
35
+ position: fixed;
36
+ top: 0;
37
+ left: 0;
38
+ width: 100%;
39
+ height: 100%;
40
+ background-color: rgba(var(--primary-rgb, 43, 43, 43), 0.1);
41
+ z-index: 1000;
42
+ display: flex;
43
+ justify-content: flex-end;
44
+ align-items: stretch;
45
+ backdrop-filter: blur(2px);
46
+ }
47
+
48
+ .marz-sidepanel {
49
+ width: 90%;
50
+ max-width: 600px;
51
+ height: 100%;
52
+ background-color: var(--bg, #f9fbfd);
53
+ border-left: 1px solid var(--bg-element-2, rgba(0, 0, 0, 0.04));
54
+ display: flex;
55
+ flex-direction: column;
56
+ animation: marz-slideIn 0.3s ease-out;
57
+ overflow-y: auto;
58
+ box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
59
+ }
60
+
61
+ .marz-sidepanel-header {
62
+ display: flex;
63
+ justify-content: space-between;
64
+ align-items: center;
65
+ padding: var(--safe-padding, 16px);
66
+ border-bottom: 1px solid var(--bg-element-2, rgba(0, 0, 0, 0.04));
67
+ flex-shrink: 0;
68
+ }
69
+
70
+ .marz-sidepanel-header h2 {
71
+ margin: 0;
72
+ color: var(--heading, #11324a);
73
+ font-family: 'Inter', sans-serif;
74
+ font-size: 32px;
75
+ font-weight: 800;
76
+ }
77
+
78
+ .marz-sidepanel-close {
79
+ display: inline-block;
80
+ cursor: pointer;
81
+ border: 0;
82
+ border-radius: 3em;
83
+ font-weight: 700;
84
+ line-height: 1;
85
+ font-family: 'Inter', sans-serif;
86
+ transition: all 100ms;
87
+ box-sizing: border-box;
88
+ padding: 10px 10px;
89
+ font-size: 12px;
90
+ min-width: 32px;
91
+ height: 32px;
92
+ border: var(--secondary, #ababab) 1px solid;
93
+ background-color: transparent;
94
+ color: var(--text, #3b3b3b);
95
+ }
96
+
97
+ .marz-sidepanel-close:hover {
98
+ border: var(--primary, #2b2b2b) 1px solid;
99
+ background-color: var(--bg-element, rgba(0, 0, 0, 0.02));
100
+ }
101
+
102
+ .marz-sidepanel-close:active {
103
+ border: var(--primary, #2b2b2b) 1px solid;
104
+ background-color: var(--bg-element-2, rgba(0, 0, 0, 0.04));
105
+ }
106
+
107
+ .marz-sidepanel-content {
108
+ flex: 1;
109
+ padding: var(--safe-padding, 16px);
110
+ display: flex;
111
+ flex-direction: column;
112
+ gap: var(--small-padding, 12px);
113
+ }
114
+
115
+ .marz-sidepanel-actions {
116
+ display: flex;
117
+ gap: var(--small-padding, 12px);
118
+ margin-top: var(--safe-padding, 16px);
119
+ justify-content: flex-end;
120
+ }
121
+
122
+ ::slotted(*) {
123
+ margin-bottom: var(--small-padding, 12px);
124
+ }
125
+
126
+ @keyframes marz-slideIn {
127
+ from {
128
+ transform: translateX(100%);
129
+ }
130
+ to {
131
+ transform: translateX(0);
132
+ }
133
+ }
134
+
135
+ /* Mobile adjustments */
136
+ @media only screen and (max-width: 48em) {
137
+ .marz-sidepanel {
138
+ width: 90%;
139
+ }
140
+
141
+ .marz-sidepanel-actions {
142
+ flex-direction: column;
143
+ }
144
+ }
145
+
146
+ /* Desktop adjustments */
147
+ @media only screen and (min-width: 48em) {
148
+ .marz-sidepanel {
149
+ max-width: 600px;
150
+ }
151
+ }
152
+ `;
153
+ }
154
+ // Public API
155
+ get isOpen() {
156
+ return this.hasAttribute("is-open");
157
+ }
158
+ set isOpen(e) {
159
+ e ? this.setAttribute("is-open", "") : this.removeAttribute("is-open");
160
+ }
161
+ get title() {
162
+ return this.getAttribute("title") || "Settings";
163
+ }
164
+ set title(e) {
165
+ this.setAttribute("title", e);
166
+ }
167
+ // Public methods
168
+ open() {
169
+ this.isOpen = !0;
170
+ }
171
+ close() {
172
+ this.isOpen = !1, this.dispatchEvent(new CustomEvent("close", {
173
+ bubbles: !0,
174
+ composed: !0
175
+ }));
176
+ }
177
+ }
178
+ customElements.get("marz-sidepanel") || customElements.define("marz-sidepanel", n);
179
+ export {
180
+ n as MarzSidepanel
181
+ };
@@ -0,0 +1,42 @@
1
+ export declare class MarzSidepanel extends HTMLElement {
2
+ private overlay;
3
+ private panel;
4
+ private header;
5
+ private titleElement;
6
+ private closeButton;
7
+ private contentSlot;
8
+ private actionsSlot;
9
+ static get observedAttributes(): string[];
10
+ constructor();
11
+ connectedCallback(): void;
12
+ attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void;
13
+ private render;
14
+ private getStyles;
15
+ get isOpen(): boolean;
16
+ set isOpen(value: boolean);
17
+ get title(): string;
18
+ set title(value: string);
19
+ open(): void;
20
+ close(): void;
21
+ }
22
+
23
+ /**
24
+ * Marz Sidepanel Web Component
25
+ * A framework-agnostic modal sidepanel component with slide-in animation
26
+ */
27
+ export declare interface MarzSidepanelProps {
28
+ isOpen?: boolean;
29
+ title?: string;
30
+ }
31
+
32
+ export { }
33
+
34
+
35
+ declare global {
36
+ interface HTMLElementTagNameMap {
37
+ 'marz-button': import('../components/button').MarzButton;
38
+ 'marz-input': import('../components/input').MarzInput;
39
+ 'marz-sidepanel': import('../components/sidepanel').MarzSidepanel;
40
+ }
41
+ }
42
+
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { MarzButton as e } from "./components/button/index.js";
2
+ import { MarzInput as p } from "./components/input/index.js";
3
+ import { MarzSidepanel as a } from "./components/sidepanel/index.js";
4
+ const o = "1.0.0";
5
+ export {
6
+ e as MarzButton,
7
+ p as MarzInput,
8
+ a as MarzSidepanel,
9
+ o as VERSION
10
+ };