@sankhyatronics/sankhya-cms 0.0.0-stage → 0.0.9
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.
- package/LICENSE +21 -0
- package/README.md +34 -3
- package/custom-elements.json +4008 -0
- package/dist/bento-grid/index.d.ts +27 -0
- package/dist/bento-grid/index.js +10 -0
- package/dist/bento-grid/index.js.map +1 -0
- package/dist/card/index.d.ts +20 -0
- package/dist/card/index.js +9 -0
- package/dist/card/index.js.map +1 -0
- package/dist/carousel/index.d.ts +44 -0
- package/dist/carousel/index.js +10 -0
- package/dist/carousel/index.js.map +1 -0
- package/dist/chunk-23IHTBAB.js +557 -0
- package/dist/chunk-23IHTBAB.js.map +1 -0
- package/dist/chunk-2VZFHTBC.js +203 -0
- package/dist/chunk-2VZFHTBC.js.map +1 -0
- package/dist/chunk-3ERKQNZT.js +155 -0
- package/dist/chunk-3ERKQNZT.js.map +1 -0
- package/dist/chunk-3JU3R22O.js +193 -0
- package/dist/chunk-3JU3R22O.js.map +1 -0
- package/dist/chunk-3TCP25JG.js +347 -0
- package/dist/chunk-3TCP25JG.js.map +1 -0
- package/dist/chunk-3VE6VFJ4.js +87 -0
- package/dist/chunk-3VE6VFJ4.js.map +1 -0
- package/dist/chunk-4HKSA5UT.js +312 -0
- package/dist/chunk-4HKSA5UT.js.map +1 -0
- package/dist/chunk-5REZSZCK.js +266 -0
- package/dist/chunk-5REZSZCK.js.map +1 -0
- package/dist/chunk-5UFRGZWG.js +268 -0
- package/dist/chunk-5UFRGZWG.js.map +1 -0
- package/dist/chunk-74MILER4.js +215 -0
- package/dist/chunk-74MILER4.js.map +1 -0
- package/dist/chunk-7PSYCTEN.js +118 -0
- package/dist/chunk-7PSYCTEN.js.map +1 -0
- package/dist/chunk-E52WO7R7.js +279 -0
- package/dist/chunk-E52WO7R7.js.map +1 -0
- package/dist/chunk-EUXUH3YW.js +15 -0
- package/dist/chunk-EUXUH3YW.js.map +1 -0
- package/dist/chunk-IMACP7HN.js +156 -0
- package/dist/chunk-IMACP7HN.js.map +1 -0
- package/dist/chunk-LHU23TF6.js +273 -0
- package/dist/chunk-LHU23TF6.js.map +1 -0
- package/dist/chunk-OEX5FDMR.js +250 -0
- package/dist/chunk-OEX5FDMR.js.map +1 -0
- package/dist/chunk-RHAOQ6K4.js +138 -0
- package/dist/chunk-RHAOQ6K4.js.map +1 -0
- package/dist/chunk-RMIJVTFS.js +397 -0
- package/dist/chunk-RMIJVTFS.js.map +1 -0
- package/dist/chunk-TIU73O7I.js +221 -0
- package/dist/chunk-TIU73O7I.js.map +1 -0
- package/dist/chunk-USNFT4DU.js +125 -0
- package/dist/chunk-USNFT4DU.js.map +1 -0
- package/dist/chunk-VYON56QO.js +90 -0
- package/dist/chunk-VYON56QO.js.map +1 -0
- package/dist/chunk-WCO7JAIK.js +195 -0
- package/dist/chunk-WCO7JAIK.js.map +1 -0
- package/dist/chunk-XHBC23TV.js +254 -0
- package/dist/chunk-XHBC23TV.js.map +1 -0
- package/dist/chunk-XXPBFHWR.js +70 -0
- package/dist/chunk-XXPBFHWR.js.map +1 -0
- package/dist/chunk-YYK4GQUW.js +299 -0
- package/dist/chunk-YYK4GQUW.js.map +1 -0
- package/dist/cms-theme.css +15 -0
- package/dist/content-block/index.d.ts +25 -0
- package/dist/content-block/index.js +11 -0
- package/dist/content-block/index.js.map +1 -0
- package/dist/cookie-consent/index.d.ts +33 -0
- package/dist/cookie-consent/index.js +9 -0
- package/dist/cookie-consent/index.js.map +1 -0
- package/dist/dropdown/index.d.ts +89 -0
- package/dist/dropdown/index.js +9 -0
- package/dist/dropdown/index.js.map +1 -0
- package/dist/feature-split/index.d.ts +38 -0
- package/dist/feature-split/index.js +11 -0
- package/dist/feature-split/index.js.map +1 -0
- package/dist/features-section/index.d.ts +50 -0
- package/dist/features-section/index.js +14 -0
- package/dist/features-section/index.js.map +1 -0
- package/dist/footer/index.d.ts +64 -0
- package/dist/footer/index.js +9 -0
- package/dist/footer/index.js.map +1 -0
- package/dist/header/index.d.ts +112 -0
- package/dist/header/index.js +10 -0
- package/dist/header/index.js.map +1 -0
- package/dist/hero/index.d.ts +32 -0
- package/dist/hero/index.js +10 -0
- package/dist/hero/index.js.map +1 -0
- package/dist/icon-button/index.d.ts +23 -0
- package/dist/icon-button/index.js +9 -0
- package/dist/icon-button/index.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/items-accordion/index.d.ts +31 -0
- package/dist/items-accordion/index.js +10 -0
- package/dist/items-accordion/index.js.map +1 -0
- package/dist/markdown/index.d.ts +33 -0
- package/dist/markdown/index.js +9 -0
- package/dist/markdown/index.js.map +1 -0
- package/dist/menu-grid/index.d.ts +21 -0
- package/dist/menu-grid/index.js +9 -0
- package/dist/menu-grid/index.js.map +1 -0
- package/dist/menu-grid-item/index.d.ts +53 -0
- package/dist/menu-grid-item/index.js +9 -0
- package/dist/menu-grid-item/index.js.map +1 -0
- package/dist/menu-item/index.d.ts +50 -0
- package/dist/menu-item/index.js +9 -0
- package/dist/menu-item/index.js.map +1 -0
- package/dist/promo-banner/index.d.ts +22 -0
- package/dist/promo-banner/index.js +10 -0
- package/dist/promo-banner/index.js.map +1 -0
- package/dist/schema/index.d.ts +72 -0
- package/dist/schema/index.js +75 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/select/index.d.ts +77 -0
- package/dist/select/index.js +10 -0
- package/dist/select/index.js.map +1 -0
- package/dist/shared/icons.d.ts +77 -0
- package/dist/shared/icons.js +64 -0
- package/dist/shared/icons.js.map +1 -0
- package/dist/shared/styles.d.ts +90 -0
- package/dist/shared/styles.js +48 -0
- package/dist/shared/styles.js.map +1 -0
- package/dist/stats/index.d.ts +17 -0
- package/dist/stats/index.js +9 -0
- package/dist/stats/index.js.map +1 -0
- package/dist/testimonials/index.d.ts +25 -0
- package/dist/testimonials/index.js +10 -0
- package/dist/testimonials/index.js.map +1 -0
- package/dist/theme.css +292 -0
- package/dist/themes.css +65 -0
- package/dist/theming/index.d.ts +28 -0
- package/dist/theming/index.js +53 -0
- package/dist/theming/index.js.map +1 -0
- package/package.json +160 -3
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import {
|
|
2
|
+
controlBaseStyles,
|
|
3
|
+
fontFamilyStyles
|
|
4
|
+
} from "./chunk-RHAOQ6K4.js";
|
|
5
|
+
import {
|
|
6
|
+
__decorateClass
|
|
7
|
+
} from "./chunk-EUXUH3YW.js";
|
|
8
|
+
|
|
9
|
+
// src/menu-item/MenuItem.ts
|
|
10
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
11
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
12
|
+
var MenuItem = class extends LitElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.title = "";
|
|
16
|
+
this.href = "";
|
|
17
|
+
this.description = "";
|
|
18
|
+
this.badge = "";
|
|
19
|
+
this.active = false;
|
|
20
|
+
this.compact = false;
|
|
21
|
+
this.showDescription = true;
|
|
22
|
+
this.target = "_self";
|
|
23
|
+
this.hasIcon = false;
|
|
24
|
+
this.onIconSlotChange = (event) => {
|
|
25
|
+
this.hasIcon = event.target.assignedNodes({ flatten: true }).length > 0;
|
|
26
|
+
};
|
|
27
|
+
this.onClick = (event) => {
|
|
28
|
+
const selectEvent = new CustomEvent("menu-item-select", {
|
|
29
|
+
detail: { href: this.href },
|
|
30
|
+
bubbles: true,
|
|
31
|
+
composed: true,
|
|
32
|
+
cancelable: true
|
|
33
|
+
});
|
|
34
|
+
this.dispatchEvent(selectEvent);
|
|
35
|
+
if (selectEvent.defaultPrevented) event.preventDefault();
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
render() {
|
|
39
|
+
const showDescription = !!this.description && this.showDescription;
|
|
40
|
+
const classes = ["menu-item", this.active ? "active" : "", this.compact ? "compact" : "", showDescription ? "" : "no-description"].filter(Boolean).join(" ");
|
|
41
|
+
return html`
|
|
42
|
+
<a part="item" class=${classes} href=${this.href} target=${this.target} @click=${this.onClick}>
|
|
43
|
+
<span class="menu-item-icon" part="icon" ?hidden=${!this.hasIcon}><slot name="icon" @slotchange=${this.onIconSlotChange}></slot></span>
|
|
44
|
+
<span class="menu-item-content" part="content">
|
|
45
|
+
<span class="menu-item-header" part="header">
|
|
46
|
+
<span part="title" class="menu-item-title">${this.title}</span>
|
|
47
|
+
${this.badge ? html`<span part="badge" class="menu-item-badge">${this.badge}</span>` : nothing}
|
|
48
|
+
</span>
|
|
49
|
+
${showDescription ? html`<p part="description" class="menu-item-description">${this.description}</p>` : nothing}
|
|
50
|
+
</span>
|
|
51
|
+
</a>
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
/** `focus()` on the element focuses its link, so `st-dropdown` can arrow-key between items. */
|
|
56
|
+
MenuItem.shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
57
|
+
MenuItem.styles = css`
|
|
58
|
+
${controlBaseStyles}
|
|
59
|
+
|
|
60
|
+
:host {
|
|
61
|
+
display: block;
|
|
62
|
+
${fontFamilyStyles}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@keyframes st-menu-item-badge-pop {
|
|
66
|
+
from {
|
|
67
|
+
transform: scale(0);
|
|
68
|
+
}
|
|
69
|
+
70% {
|
|
70
|
+
transform: scale(1.12);
|
|
71
|
+
}
|
|
72
|
+
to {
|
|
73
|
+
transform: scale(1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@keyframes st-menu-item-fade-in {
|
|
78
|
+
from {
|
|
79
|
+
opacity: 0;
|
|
80
|
+
}
|
|
81
|
+
to {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.menu-item {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: flex-start;
|
|
89
|
+
gap: 12px;
|
|
90
|
+
padding: 12px 16px;
|
|
91
|
+
font-size: 0.875rem;
|
|
92
|
+
text-decoration: none;
|
|
93
|
+
color: var(--st-color-text);
|
|
94
|
+
border-radius: 6px;
|
|
95
|
+
/* The source's 'all 0.15s', minus visibility: animating the visibility this link inherits
|
|
96
|
+
from a dropdown panel kept it unfocusable for a frame after the panel opened. */
|
|
97
|
+
transition-property: background-color, color, padding, transform, border-color;
|
|
98
|
+
transition-duration: 0.15s;
|
|
99
|
+
transition-timing-function: ease;
|
|
100
|
+
box-sizing: border-box;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* The source's hover nudge (x: 4px) is done with padding, not a transform: a transform would
|
|
104
|
+
spill past a scrolling panel's edge (st-source-bar's menus) and show a horizontal scrollbar.
|
|
105
|
+
Keyboard focus gets the same treatment as hover. */
|
|
106
|
+
.menu-item:hover,
|
|
107
|
+
.menu-item:focus-visible {
|
|
108
|
+
background: var(--st-color-hover);
|
|
109
|
+
color: var(--st-color-text-strong);
|
|
110
|
+
padding-left: 20px;
|
|
111
|
+
transition-duration: 0.1s;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.menu-item.compact:hover,
|
|
115
|
+
.menu-item.compact:focus-visible {
|
|
116
|
+
padding-left: 16px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.menu-item:active {
|
|
120
|
+
transform: scale(0.99);
|
|
121
|
+
transition-duration: 0.1s;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.menu-item.active {
|
|
125
|
+
background-color: var(--st-color-accent-subtle);
|
|
126
|
+
color: var(--st-color-accent-text);
|
|
127
|
+
border-left: 4px solid var(--st-color-accent);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.menu-item-icon {
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-shrink: 0;
|
|
133
|
+
margin-top: 2px;
|
|
134
|
+
transition: transform 0.2s ease;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.menu-item-icon:hover {
|
|
138
|
+
transform: rotate(5deg);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.menu-item-icon[hidden] {
|
|
142
|
+
display: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.menu-item-icon ::slotted(*) {
|
|
146
|
+
width: 16px;
|
|
147
|
+
height: 16px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.menu-item-content {
|
|
151
|
+
flex: 1;
|
|
152
|
+
min-width: 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.menu-item-header {
|
|
156
|
+
display: flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
justify-content: space-between;
|
|
159
|
+
gap: 8px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.menu-item-title {
|
|
163
|
+
font-weight: 500;
|
|
164
|
+
overflow: hidden;
|
|
165
|
+
text-overflow: ellipsis;
|
|
166
|
+
white-space: nowrap;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.menu-item-badge {
|
|
170
|
+
display: inline-flex;
|
|
171
|
+
align-items: center;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
min-width: 20px;
|
|
174
|
+
height: 20px;
|
|
175
|
+
padding: 0 6px;
|
|
176
|
+
font-size: 0.75rem;
|
|
177
|
+
font-weight: 500;
|
|
178
|
+
border-radius: 9999px;
|
|
179
|
+
flex-shrink: 0;
|
|
180
|
+
background: var(--st-color-accent-subtle);
|
|
181
|
+
color: var(--st-color-accent-text);
|
|
182
|
+
animation: st-menu-item-badge-pop 0.35s ease-out;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.menu-item-description {
|
|
186
|
+
display: -webkit-box;
|
|
187
|
+
margin: 4px 0 0;
|
|
188
|
+
font-size: 0.75rem;
|
|
189
|
+
color: var(--st-color-text-muted);
|
|
190
|
+
-webkit-box-orient: vertical;
|
|
191
|
+
overflow: hidden;
|
|
192
|
+
line-height: 1.4;
|
|
193
|
+
animation: st-menu-item-fade-in 0.2s ease;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.menu-item.compact {
|
|
197
|
+
padding: 8px 12px;
|
|
198
|
+
gap: 8px;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.menu-item.compact .menu-item-icon ::slotted(*) {
|
|
202
|
+
width: 14px;
|
|
203
|
+
height: 14px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.menu-item.compact .menu-item-title {
|
|
207
|
+
font-size: 0.75rem;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.menu-item.compact .menu-item-description {
|
|
211
|
+
font-size: 0.75rem;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.menu-item.no-description {
|
|
215
|
+
align-items: center;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.menu-item.no-description .menu-item-icon {
|
|
219
|
+
margin-top: 0;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@media (prefers-reduced-motion: reduce) {
|
|
223
|
+
.menu-item,
|
|
224
|
+
.menu-item-icon {
|
|
225
|
+
transition: none;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.menu-item:active,
|
|
229
|
+
.menu-item-icon:hover {
|
|
230
|
+
transform: none;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.menu-item-badge,
|
|
234
|
+
.menu-item-description {
|
|
235
|
+
animation: none;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
`;
|
|
239
|
+
__decorateClass([
|
|
240
|
+
property({ type: String })
|
|
241
|
+
], MenuItem.prototype, "title", 2);
|
|
242
|
+
__decorateClass([
|
|
243
|
+
property({ type: String })
|
|
244
|
+
], MenuItem.prototype, "href", 2);
|
|
245
|
+
__decorateClass([
|
|
246
|
+
property({ type: String })
|
|
247
|
+
], MenuItem.prototype, "description", 2);
|
|
248
|
+
__decorateClass([
|
|
249
|
+
property({ type: String })
|
|
250
|
+
], MenuItem.prototype, "badge", 2);
|
|
251
|
+
__decorateClass([
|
|
252
|
+
property({ type: Boolean, reflect: true })
|
|
253
|
+
], MenuItem.prototype, "active", 2);
|
|
254
|
+
__decorateClass([
|
|
255
|
+
property({ type: Boolean, reflect: true })
|
|
256
|
+
], MenuItem.prototype, "compact", 2);
|
|
257
|
+
__decorateClass([
|
|
258
|
+
property({ type: Boolean, attribute: "show-description" })
|
|
259
|
+
], MenuItem.prototype, "showDescription", 2);
|
|
260
|
+
__decorateClass([
|
|
261
|
+
property({ type: String })
|
|
262
|
+
], MenuItem.prototype, "target", 2);
|
|
263
|
+
__decorateClass([
|
|
264
|
+
state()
|
|
265
|
+
], MenuItem.prototype, "hasIcon", 2);
|
|
266
|
+
MenuItem = __decorateClass([
|
|
267
|
+
customElement("st-menu-item")
|
|
268
|
+
], MenuItem);
|
|
269
|
+
|
|
270
|
+
export {
|
|
271
|
+
MenuItem
|
|
272
|
+
};
|
|
273
|
+
//# sourceMappingURL=chunk-LHU23TF6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/menu-item/MenuItem.ts"],"sourcesContent":["import { LitElement, css, html, nothing } from 'lit';\r\nimport { customElement, property, state } from 'lit/decorators.js';\r\n\r\nimport { controlBaseStyles, fontFamilyStyles } from '../shared/styles';\r\nimport type { MenuItemSelectEventDetail } from './MenuItemEvents';\r\n\r\n/**\r\n * A single flat nav row — icon (`slot=\"icon\"`) + title + badge on one line, an optional\r\n * description below — as opposed to `st-menu-grid-item`'s card for a multi-column grid. A 1:1\r\n * port of `SankhyaUI`'s React `MenuItem` (`SankhyaCMS/SankhyaUI/src/components/Menu`): same\r\n * markup and CSS, with its `motion` effects redone in CSS — nudges right and scales to 1.01 on\r\n * hover / 0.99 while pressed, the icon tilts on hover, the badge pops in, the description fades\r\n * in. Colors come from the suite theme rather than per-item utility classes.\r\n *\r\n * Renders a real `<a href>` but fires a *cancelable* `menu-item-select` event (detail: `{ href }`)\r\n * before navigating — a host doing client-side routing calls `event.preventDefault()` on it (the\r\n * source used react-router's `Link` here; the suite apps have no router).\r\n */\r\n@customElement('st-menu-item')\r\nexport class MenuItem extends LitElement {\r\n /** `focus()` on the element focuses its link, so `st-dropdown` can arrow-key between items. */\r\n static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };\r\n\r\n static styles = css`\r\n ${controlBaseStyles}\r\n\r\n :host {\r\n display: block;\r\n ${fontFamilyStyles}\r\n }\r\n\r\n @keyframes st-menu-item-badge-pop {\r\n from {\r\n transform: scale(0);\r\n }\r\n 70% {\r\n transform: scale(1.12);\r\n }\r\n to {\r\n transform: scale(1);\r\n }\r\n }\r\n\r\n @keyframes st-menu-item-fade-in {\r\n from {\r\n opacity: 0;\r\n }\r\n to {\r\n opacity: 1;\r\n }\r\n }\r\n\r\n .menu-item {\r\n display: flex;\r\n align-items: flex-start;\r\n gap: 12px;\r\n padding: 12px 16px;\r\n font-size: 0.875rem;\r\n text-decoration: none;\r\n color: var(--st-color-text);\r\n border-radius: 6px;\r\n /* The source's 'all 0.15s', minus visibility: animating the visibility this link inherits\r\n from a dropdown panel kept it unfocusable for a frame after the panel opened. */\r\n transition-property: background-color, color, padding, transform, border-color;\r\n transition-duration: 0.15s;\r\n transition-timing-function: ease;\r\n box-sizing: border-box;\r\n }\r\n\r\n /* The source's hover nudge (x: 4px) is done with padding, not a transform: a transform would\r\n spill past a scrolling panel's edge (st-source-bar's menus) and show a horizontal scrollbar.\r\n Keyboard focus gets the same treatment as hover. */\r\n .menu-item:hover,\r\n .menu-item:focus-visible {\r\n background: var(--st-color-hover);\r\n color: var(--st-color-text-strong);\r\n padding-left: 20px;\r\n transition-duration: 0.1s;\r\n }\r\n\r\n .menu-item.compact:hover,\r\n .menu-item.compact:focus-visible {\r\n padding-left: 16px;\r\n }\r\n\r\n .menu-item:active {\r\n transform: scale(0.99);\r\n transition-duration: 0.1s;\r\n }\r\n\r\n .menu-item.active {\r\n background-color: var(--st-color-accent-subtle);\r\n color: var(--st-color-accent-text);\r\n border-left: 4px solid var(--st-color-accent);\r\n }\r\n\r\n .menu-item-icon {\r\n display: flex;\r\n flex-shrink: 0;\r\n margin-top: 2px;\r\n transition: transform 0.2s ease;\r\n }\r\n\r\n .menu-item-icon:hover {\r\n transform: rotate(5deg);\r\n }\r\n\r\n .menu-item-icon[hidden] {\r\n display: none;\r\n }\r\n\r\n .menu-item-icon ::slotted(*) {\r\n width: 16px;\r\n height: 16px;\r\n }\r\n\r\n .menu-item-content {\r\n flex: 1;\r\n min-width: 0;\r\n }\r\n\r\n .menu-item-header {\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-between;\r\n gap: 8px;\r\n }\r\n\r\n .menu-item-title {\r\n font-weight: 500;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n }\r\n\r\n .menu-item-badge {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n min-width: 20px;\r\n height: 20px;\r\n padding: 0 6px;\r\n font-size: 0.75rem;\r\n font-weight: 500;\r\n border-radius: 9999px;\r\n flex-shrink: 0;\r\n background: var(--st-color-accent-subtle);\r\n color: var(--st-color-accent-text);\r\n animation: st-menu-item-badge-pop 0.35s ease-out;\r\n }\r\n\r\n .menu-item-description {\r\n display: -webkit-box;\r\n margin: 4px 0 0;\r\n font-size: 0.75rem;\r\n color: var(--st-color-text-muted);\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n line-height: 1.4;\r\n animation: st-menu-item-fade-in 0.2s ease;\r\n }\r\n\r\n .menu-item.compact {\r\n padding: 8px 12px;\r\n gap: 8px;\r\n }\r\n\r\n .menu-item.compact .menu-item-icon ::slotted(*) {\r\n width: 14px;\r\n height: 14px;\r\n }\r\n\r\n .menu-item.compact .menu-item-title {\r\n font-size: 0.75rem;\r\n }\r\n\r\n .menu-item.compact .menu-item-description {\r\n font-size: 0.75rem;\r\n }\r\n\r\n .menu-item.no-description {\r\n align-items: center;\r\n }\r\n\r\n .menu-item.no-description .menu-item-icon {\r\n margin-top: 0;\r\n }\r\n\r\n @media (prefers-reduced-motion: reduce) {\r\n .menu-item,\r\n .menu-item-icon {\r\n transition: none;\r\n }\r\n\r\n .menu-item:active,\r\n .menu-item-icon:hover {\r\n transform: none;\r\n }\r\n\r\n .menu-item-badge,\r\n .menu-item-description {\r\n animation: none;\r\n }\r\n }\r\n `;\r\n\r\n @property({ type: String })\r\n title = '';\r\n\r\n @property({ type: String })\r\n href = '';\r\n\r\n @property({ type: String })\r\n description = '';\r\n\r\n /** Small trailing label, e.g. a count or \"New\"/\"Beta\" — omit for none. */\r\n @property({ type: String })\r\n badge = '';\r\n\r\n /** Highlights this row as the current page (source: `isActive`). */\r\n @property({ type: Boolean, reflect: true })\r\n active = false;\r\n\r\n @property({ type: Boolean, reflect: true })\r\n compact = false;\r\n\r\n /** Suppresses the description even when `description` is set (source: `showDescription`, default `true`). */\r\n @property({ type: Boolean, attribute: 'show-description' })\r\n showDescription = true;\r\n\r\n /** `target` for the `<a>` (source default `_self`). */\r\n @property({ type: String })\r\n target = '_self';\r\n\r\n /** Whether `slot=\"icon\"` has content, so an omitted icon leaves no empty box. */\r\n @state() private hasIcon = false;\r\n\r\n private onIconSlotChange = (event: Event): void => {\r\n this.hasIcon = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\r\n };\r\n\r\n private onClick = (event: MouseEvent): void => {\r\n const selectEvent = new CustomEvent<MenuItemSelectEventDetail>('menu-item-select', {\r\n detail: { href: this.href },\r\n bubbles: true,\r\n composed: true,\r\n cancelable: true\r\n });\r\n this.dispatchEvent(selectEvent);\r\n if (selectEvent.defaultPrevented) event.preventDefault();\r\n };\r\n\r\n render() {\r\n const showDescription = !!this.description && this.showDescription;\r\n const classes = ['menu-item', this.active ? 'active' : '', this.compact ? 'compact' : '', showDescription ? '' : 'no-description']\r\n .filter(Boolean)\r\n .join(' ');\r\n return html`\r\n <a part=\"item\" class=${classes} href=${this.href} target=${this.target} @click=${this.onClick}>\r\n <span class=\"menu-item-icon\" part=\"icon\" ?hidden=${!this.hasIcon}><slot name=\"icon\" @slotchange=${this.onIconSlotChange}></slot></span>\r\n <span class=\"menu-item-content\" part=\"content\">\r\n <span class=\"menu-item-header\" part=\"header\">\r\n <span part=\"title\" class=\"menu-item-title\">${this.title}</span>\r\n ${this.badge ? html`<span part=\"badge\" class=\"menu-item-badge\">${this.badge}</span>` : nothing}\r\n </span>\r\n ${showDescription ? html`<p part=\"description\" class=\"menu-item-description\">${this.description}</p>` : nothing}\r\n </span>\r\n </a>\r\n `;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;AAAA,SAAS,YAAY,KAAK,MAAM,eAAe;AAC/C,SAAS,eAAe,UAAU,aAAa;AAkBxC,IAAM,WAAN,cAAuB,WAAW;AAAA,EAAlC;AAAA;AA4LL,iBAAQ;AAGR,gBAAO;AAGP,uBAAc;AAId,iBAAQ;AAIR,kBAAS;AAGT,mBAAU;AAIV,2BAAkB;AAIlB,kBAAS;AAGA,SAAQ,UAAU;AAE3B,SAAQ,mBAAmB,CAAC,UAAuB;AACjD,WAAK,UAAW,MAAM,OAA2B,cAAc,EAAE,SAAS,KAAK,CAAC,EAAE,SAAS;AAAA,IAC7F;AAEA,SAAQ,UAAU,CAAC,UAA4B;AAC7C,YAAM,cAAc,IAAI,YAAuC,oBAAoB;AAAA,QACjF,QAAQ,EAAE,MAAM,KAAK,KAAK;AAAA,QAC1B,SAAS;AAAA,QACT,UAAU;AAAA,QACV,YAAY;AAAA,MACd,CAAC;AACD,WAAK,cAAc,WAAW;AAC9B,UAAI,YAAY,iBAAkB,OAAM,eAAe;AAAA,IACzD;AAAA;AAAA,EAEA,SAAS;AACP,UAAM,kBAAkB,CAAC,CAAC,KAAK,eAAe,KAAK;AACnD,UAAM,UAAU,CAAC,aAAa,KAAK,SAAS,WAAW,IAAI,KAAK,UAAU,YAAY,IAAI,kBAAkB,KAAK,gBAAgB,EAC9H,OAAO,OAAO,EACd,KAAK,GAAG;AACX,WAAO;AAAA,6BACkB,OAAO,SAAS,KAAK,IAAI,WAAW,KAAK,MAAM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A;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmLtB;AAAA,EADC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GA3Lf,SA4LX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GA9Lf,SA+LX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAjMf,SAkMX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GArMf,SAsMX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAzM/B,SA0MX;AAGA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GA5M/B,SA6MX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,WAAW,mBAAmB,CAAC;AAAA,GAhN/C,SAiNX;AAIA;AAAA,EADC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GApNf,SAqNX;AAGiB;AAAA,EAAhB,MAAM;AAAA,GAxNI,SAwNM;AAxNN,WAAN;AAAA,EADN,cAAc,cAAc;AAAA,GAChB;","names":[]}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cardTitleStyles,
|
|
3
|
+
iconTileStyles,
|
|
4
|
+
invertedSectionTextStyles,
|
|
5
|
+
reducedMotionStyles,
|
|
6
|
+
sectionHeaderStyles,
|
|
7
|
+
sectionSubtitleStyles,
|
|
8
|
+
sectionTitleStyles
|
|
9
|
+
} from "./chunk-3VE6VFJ4.js";
|
|
10
|
+
import {
|
|
11
|
+
controlBaseStyles,
|
|
12
|
+
fontFamilyStyles
|
|
13
|
+
} from "./chunk-RHAOQ6K4.js";
|
|
14
|
+
import {
|
|
15
|
+
__decorateClass
|
|
16
|
+
} from "./chunk-EUXUH3YW.js";
|
|
17
|
+
|
|
18
|
+
// src/bento-grid/BentoGrid.ts
|
|
19
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
20
|
+
import { customElement, property } from "lit/decorators.js";
|
|
21
|
+
import "iconify-icon";
|
|
22
|
+
var BentoGrid = class extends LitElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.inverted = false;
|
|
26
|
+
this.title = "";
|
|
27
|
+
this.subtitle = "";
|
|
28
|
+
this.items = [];
|
|
29
|
+
}
|
|
30
|
+
renderCard(item) {
|
|
31
|
+
const classes = `card col-${item.colSpan ?? 1} row-${item.rowSpan ?? 1} ${item.imageSrc ? "has-image" : ""}`;
|
|
32
|
+
const body = html`
|
|
33
|
+
${item.imageSrc ? html`<div class="image-wrapper" part="image-wrapper">
|
|
34
|
+
<img class="image" part="image" src=${item.imageSrc} alt=${item.imageAlt ?? item.title} />
|
|
35
|
+
</div>` : nothing}
|
|
36
|
+
<div class="content" part="content">
|
|
37
|
+
${item.icon ? html`<div class="icon" part="icon"><iconify-icon icon=${item.icon}></iconify-icon></div>` : nothing}
|
|
38
|
+
<div class="text">
|
|
39
|
+
<h3 class="card-title" part="card-title">${item.title}</h3>
|
|
40
|
+
${item.description ? html`<p class="card-description" part="card-description">${item.description}</p>` : nothing}
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
`;
|
|
44
|
+
return item.href ? html`<a part="card" class=${classes} href=${item.href}>${body}</a>` : html`<div part="card" class=${classes}>${body}</div>`;
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
return html`
|
|
48
|
+
<div class="container" part="container">
|
|
49
|
+
${this.title || this.subtitle ? html`<div class="header" part="header">
|
|
50
|
+
${this.title ? html`<h2 class="title" part="title">${this.title}</h2>` : nothing}
|
|
51
|
+
${this.subtitle ? html`<p class="subtitle" part="subtitle">${this.subtitle}</p>` : nothing}
|
|
52
|
+
</div>` : nothing}
|
|
53
|
+
<div class="grid" part="grid">${this.items.map((item) => this.renderCard(item))}</div>
|
|
54
|
+
</div>
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
BentoGrid.styles = css`
|
|
59
|
+
${controlBaseStyles}
|
|
60
|
+
|
|
61
|
+
:host {
|
|
62
|
+
display: block;
|
|
63
|
+
padding: var(--st-cms-section-padding) var(--st-space-24);
|
|
64
|
+
background: var(--st-color-page);
|
|
65
|
+
${fontFamilyStyles}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:host([inverted]) {
|
|
69
|
+
background: var(--st-color-text-strong);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.container {
|
|
73
|
+
max-width: var(--st-cms-container-max);
|
|
74
|
+
margin: 0 auto;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.header {
|
|
78
|
+
${sectionHeaderStyles}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.title {
|
|
82
|
+
${sectionTitleStyles}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.subtitle {
|
|
86
|
+
${sectionSubtitleStyles}
|
|
87
|
+
margin-bottom: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
${invertedSectionTextStyles}
|
|
91
|
+
|
|
92
|
+
.grid {
|
|
93
|
+
display: grid;
|
|
94
|
+
grid-template-columns: repeat(4, 1fr);
|
|
95
|
+
grid-auto-rows: minmax(240px, auto);
|
|
96
|
+
gap: var(--st-space-24);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.card {
|
|
100
|
+
position: relative;
|
|
101
|
+
display: flex;
|
|
102
|
+
flex-direction: column;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
border: 1px solid var(--st-color-border);
|
|
105
|
+
border-radius: var(--st-space-24);
|
|
106
|
+
background: var(--st-color-surface);
|
|
107
|
+
color: inherit;
|
|
108
|
+
text-decoration: none;
|
|
109
|
+
transition:
|
|
110
|
+
transform 0.3s ease,
|
|
111
|
+
box-shadow 0.3s ease;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:host([inverted]) .card {
|
|
115
|
+
background: var(--st-color-text-strong);
|
|
116
|
+
border-color: var(--st-color-text);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.card:hover {
|
|
120
|
+
transform: translateY(-4px);
|
|
121
|
+
box-shadow: 0 12px 24px -10px var(--st-shadow-color-lg);
|
|
122
|
+
z-index: 1;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.image-wrapper {
|
|
126
|
+
position: absolute;
|
|
127
|
+
inset: 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.image-wrapper::after {
|
|
131
|
+
content: '';
|
|
132
|
+
position: absolute;
|
|
133
|
+
inset: 0;
|
|
134
|
+
background: linear-gradient(to bottom, transparent 0%, var(--st-shadow-color-xl) 100%);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.image {
|
|
138
|
+
width: 100%;
|
|
139
|
+
height: 100%;
|
|
140
|
+
object-fit: cover;
|
|
141
|
+
transition: transform 0.5s ease;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.card:hover .image {
|
|
145
|
+
transform: scale(1.05);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.content {
|
|
149
|
+
position: relative;
|
|
150
|
+
z-index: 1;
|
|
151
|
+
margin-top: auto;
|
|
152
|
+
padding: var(--st-space-24);
|
|
153
|
+
display: flex;
|
|
154
|
+
flex-direction: column;
|
|
155
|
+
gap: var(--st-space-16);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.icon {
|
|
159
|
+
${iconTileStyles}
|
|
160
|
+
width: var(--st-size-40);
|
|
161
|
+
height: var(--st-size-40);
|
|
162
|
+
font-size: 24px;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.text {
|
|
166
|
+
padding: var(--st-space-16);
|
|
167
|
+
border-radius: var(--st-radius-md);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.card-title {
|
|
171
|
+
${cardTitleStyles}
|
|
172
|
+
font-size: var(--st-text-lg);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.card-description {
|
|
176
|
+
margin: 0;
|
|
177
|
+
font-size: var(--st-text-md);
|
|
178
|
+
color: var(--st-color-text-muted);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
:host([inverted]) .card-title {
|
|
182
|
+
color: var(--st-color-on-solid);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
:host([inverted]) .card-description {
|
|
186
|
+
color: var(--st-color-border);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.card.has-image .card-title,
|
|
190
|
+
.card.has-image .card-description {
|
|
191
|
+
color: var(--st-color-on-solid);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.card.has-image .icon {
|
|
195
|
+
background: var(--st-shadow-color-lg);
|
|
196
|
+
color: var(--st-color-on-solid);
|
|
197
|
+
backdrop-filter: blur(4px);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.col-1 { grid-column: span 1; }
|
|
201
|
+
.col-2 { grid-column: span 2; }
|
|
202
|
+
.col-3 { grid-column: span 3; }
|
|
203
|
+
.col-4 { grid-column: span 4; }
|
|
204
|
+
.row-1 { grid-row: span 1; }
|
|
205
|
+
.row-2 { grid-row: span 2; }
|
|
206
|
+
|
|
207
|
+
@media (max-width: 1024px) {
|
|
208
|
+
.grid {
|
|
209
|
+
grid-template-columns: repeat(2, 1fr);
|
|
210
|
+
}
|
|
211
|
+
.col-3,
|
|
212
|
+
.col-4 {
|
|
213
|
+
grid-column: span 2;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@media (max-width: 640px) {
|
|
218
|
+
.grid {
|
|
219
|
+
grid-template-columns: 1fr;
|
|
220
|
+
}
|
|
221
|
+
.col-1,
|
|
222
|
+
.col-2,
|
|
223
|
+
.col-3,
|
|
224
|
+
.col-4 {
|
|
225
|
+
grid-column: span 1;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
${reducedMotionStyles}
|
|
230
|
+
`;
|
|
231
|
+
__decorateClass([
|
|
232
|
+
property({ type: Boolean, reflect: true })
|
|
233
|
+
], BentoGrid.prototype, "inverted", 2);
|
|
234
|
+
__decorateClass([
|
|
235
|
+
property({ type: String })
|
|
236
|
+
], BentoGrid.prototype, "title", 2);
|
|
237
|
+
__decorateClass([
|
|
238
|
+
property({ type: String })
|
|
239
|
+
], BentoGrid.prototype, "subtitle", 2);
|
|
240
|
+
__decorateClass([
|
|
241
|
+
property({ attribute: false })
|
|
242
|
+
], BentoGrid.prototype, "items", 2);
|
|
243
|
+
BentoGrid = __decorateClass([
|
|
244
|
+
customElement("st-bento-grid")
|
|
245
|
+
], BentoGrid);
|
|
246
|
+
|
|
247
|
+
export {
|
|
248
|
+
BentoGrid
|
|
249
|
+
};
|
|
250
|
+
//# sourceMappingURL=chunk-OEX5FDMR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/bento-grid/BentoGrid.ts"],"sourcesContent":["import { LitElement, css, html, nothing } from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\nimport 'iconify-icon';\r\n\r\nimport { controlBaseStyles, fontFamilyStyles } from '../shared/styles';\r\nimport {\r\n cardTitleStyles,\r\n iconTileStyles,\r\n reducedMotionStyles,\r\n sectionHeaderStyles,\r\n sectionSubtitleStyles,\r\n sectionTitleStyles, invertedSectionTextStyles } from '../shared/section-styles';\r\n\r\nexport interface BentoGridItem {\r\n title: string;\r\n description?: string;\r\n /** Iconify icon name, e.g. `mdi:home`. */\r\n icon?: string;\r\n imageSrc?: string;\r\n imageAlt?: string;\r\n colSpan?: 1 | 2 | 3 | 4;\r\n rowSpan?: 1 | 2;\r\n /** Turns the card into a link. */\r\n href?: string;\r\n}\r\n\r\n/** A responsive 4-column bento grid of icon/image cards. Items are set via the `items` property. */\r\n@customElement('st-bento-grid')\r\nexport class BentoGrid extends LitElement {\r\n static styles = css`\r\n ${controlBaseStyles}\r\n\r\n :host {\r\n display: block;\r\n padding: var(--st-cms-section-padding) var(--st-space-24);\r\n background: var(--st-color-page);\r\n ${fontFamilyStyles}\r\n }\r\n\r\n :host([inverted]) {\r\n background: var(--st-color-text-strong);\r\n }\r\n\r\n .container {\r\n max-width: var(--st-cms-container-max);\r\n margin: 0 auto;\r\n }\r\n\r\n .header {\r\n ${sectionHeaderStyles}\r\n }\r\n\r\n .title {\r\n ${sectionTitleStyles}\r\n }\r\n\r\n .subtitle {\r\n ${sectionSubtitleStyles}\r\n margin-bottom: 0;\r\n }\r\n\r\n ${invertedSectionTextStyles}\r\n\r\n .grid {\r\n display: grid;\r\n grid-template-columns: repeat(4, 1fr);\r\n grid-auto-rows: minmax(240px, auto);\r\n gap: var(--st-space-24);\r\n }\r\n\r\n .card {\r\n position: relative;\r\n display: flex;\r\n flex-direction: column;\r\n overflow: hidden;\r\n border: 1px solid var(--st-color-border);\r\n border-radius: var(--st-space-24);\r\n background: var(--st-color-surface);\r\n color: inherit;\r\n text-decoration: none;\r\n transition:\r\n transform 0.3s ease,\r\n box-shadow 0.3s ease;\r\n }\r\n\r\n :host([inverted]) .card {\r\n background: var(--st-color-text-strong);\r\n border-color: var(--st-color-text);\r\n }\r\n\r\n .card:hover {\r\n transform: translateY(-4px);\r\n box-shadow: 0 12px 24px -10px var(--st-shadow-color-lg);\r\n z-index: 1;\r\n }\r\n\r\n .image-wrapper {\r\n position: absolute;\r\n inset: 0;\r\n }\r\n\r\n .image-wrapper::after {\r\n content: '';\r\n position: absolute;\r\n inset: 0;\r\n background: linear-gradient(to bottom, transparent 0%, var(--st-shadow-color-xl) 100%);\r\n }\r\n\r\n .image {\r\n width: 100%;\r\n height: 100%;\r\n object-fit: cover;\r\n transition: transform 0.5s ease;\r\n }\r\n\r\n .card:hover .image {\r\n transform: scale(1.05);\r\n }\r\n\r\n .content {\r\n position: relative;\r\n z-index: 1;\r\n margin-top: auto;\r\n padding: var(--st-space-24);\r\n display: flex;\r\n flex-direction: column;\r\n gap: var(--st-space-16);\r\n }\r\n\r\n .icon {\r\n ${iconTileStyles}\r\n width: var(--st-size-40);\r\n height: var(--st-size-40);\r\n font-size: 24px;\r\n }\r\n\r\n .text {\r\n padding: var(--st-space-16);\r\n border-radius: var(--st-radius-md);\r\n }\r\n\r\n .card-title {\r\n ${cardTitleStyles}\r\n font-size: var(--st-text-lg);\r\n }\r\n\r\n .card-description {\r\n margin: 0;\r\n font-size: var(--st-text-md);\r\n color: var(--st-color-text-muted);\r\n }\r\n\r\n :host([inverted]) .card-title {\r\n color: var(--st-color-on-solid);\r\n }\r\n\r\n :host([inverted]) .card-description {\r\n color: var(--st-color-border);\r\n }\r\n\r\n .card.has-image .card-title,\r\n .card.has-image .card-description {\r\n color: var(--st-color-on-solid);\r\n }\r\n\r\n .card.has-image .icon {\r\n background: var(--st-shadow-color-lg);\r\n color: var(--st-color-on-solid);\r\n backdrop-filter: blur(4px);\r\n }\r\n\r\n .col-1 { grid-column: span 1; }\r\n .col-2 { grid-column: span 2; }\r\n .col-3 { grid-column: span 3; }\r\n .col-4 { grid-column: span 4; }\r\n .row-1 { grid-row: span 1; }\r\n .row-2 { grid-row: span 2; }\r\n\r\n @media (max-width: 1024px) {\r\n .grid {\r\n grid-template-columns: repeat(2, 1fr);\r\n }\r\n .col-3,\r\n .col-4 {\r\n grid-column: span 2;\r\n }\r\n }\r\n\r\n @media (max-width: 640px) {\r\n .grid {\r\n grid-template-columns: 1fr;\r\n }\r\n .col-1,\r\n .col-2,\r\n .col-3,\r\n .col-4 {\r\n grid-column: span 1;\r\n }\r\n }\r\n\r\n ${reducedMotionStyles}\r\n `;\r\n\r\n @property({ type: Boolean, reflect: true })\r\n inverted = false;\r\n\r\n @property({ type: String })\r\n title = '';\r\n\r\n @property({ type: String })\r\n subtitle = '';\r\n\r\n @property({ attribute: false })\r\n items: BentoGridItem[] = [];\r\n\r\n private renderCard(item: BentoGridItem) {\r\n const classes = `card col-${item.colSpan ?? 1} row-${item.rowSpan ?? 1} ${item.imageSrc ? 'has-image' : ''}`;\r\n const body = html`\r\n ${item.imageSrc\r\n ? html`<div class=\"image-wrapper\" part=\"image-wrapper\">\r\n <img class=\"image\" part=\"image\" src=${item.imageSrc} alt=${item.imageAlt ?? item.title} />\r\n </div>`\r\n : nothing}\r\n <div class=\"content\" part=\"content\">\r\n ${item.icon ? html`<div class=\"icon\" part=\"icon\"><iconify-icon icon=${item.icon}></iconify-icon></div>` : nothing}\r\n <div class=\"text\">\r\n <h3 class=\"card-title\" part=\"card-title\">${item.title}</h3>\r\n ${item.description ? html`<p class=\"card-description\" part=\"card-description\">${item.description}</p>` : nothing}\r\n </div>\r\n </div>\r\n `;\r\n return item.href\r\n ? html`<a part=\"card\" class=${classes} href=${item.href}>${body}</a>`\r\n : html`<div part=\"card\" class=${classes}>${body}</div>`;\r\n }\r\n\r\n render() {\r\n return html`\r\n <div class=\"container\" part=\"container\">\r\n ${this.title || this.subtitle\r\n ? html`<div class=\"header\" part=\"header\">\r\n ${this.title ? html`<h2 class=\"title\" part=\"title\">${this.title}</h2>` : nothing}\r\n ${this.subtitle ? html`<p class=\"subtitle\" part=\"subtitle\">${this.subtitle}</p>` : nothing}\r\n </div>`\r\n : nothing}\r\n <div class=\"grid\" part=\"grid\">${this.items.map((item) => this.renderCard(item))}</div>\r\n </div>\r\n `;\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY,KAAK,MAAM,eAAe;AAC/C,SAAS,eAAe,gBAAgB;AACxC,OAAO;AA0BA,IAAM,YAAN,cAAwB,WAAW;AAAA,EAAnC;AAAA;AAgLL,oBAAW;AAGX,iBAAQ;AAGR,oBAAW;AAGX,iBAAyB,C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