@erplora/outfitkit 0.1.1
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 +457 -0
- package/dist/base/anchor.d.ts +13 -0
- package/dist/base/define.d.ts +1 -0
- package/dist/base/relay.d.ts +1 -0
- package/dist/cdn.d.ts +96 -0
- package/dist/components/ok-app-launcher/ok-app-launcher.d.ts +57 -0
- package/dist/components/ok-audio/ok-audio.d.ts +45 -0
- package/dist/components/ok-avatar/ok-avatar.d.ts +36 -0
- package/dist/components/ok-avatar-group/ok-avatar-group.d.ts +38 -0
- package/dist/components/ok-bar-list/ok-bar-list.d.ts +36 -0
- package/dist/components/ok-bento/ok-bento.d.ts +17 -0
- package/dist/components/ok-bento-item/ok-bento-item.d.ts +34 -0
- package/dist/components/ok-calculator/ok-calculator.d.ts +46 -0
- package/dist/components/ok-calendar/ok-calendar.d.ts +63 -0
- package/dist/components/ok-carousel/ok-carousel.d.ts +48 -0
- package/dist/components/ok-chart/ok-chart.d.ts +55 -0
- package/dist/components/ok-chat/ok-chat.d.ts +54 -0
- package/dist/components/ok-coachmark/ok-coachmark.d.ts +69 -0
- package/dist/components/ok-code/ok-code.d.ts +28 -0
- package/dist/components/ok-color-picker/ok-color-picker.d.ts +63 -0
- package/dist/components/ok-combo/ok-combo.d.ts +46 -0
- package/dist/components/ok-command-palette/ok-command-palette.d.ts +72 -0
- package/dist/components/ok-contact-form/ok-contact-form.d.ts +54 -0
- package/dist/components/ok-cropper/ok-cropper.d.ts +60 -0
- package/dist/components/ok-cta-band/ok-cta-band.d.ts +18 -0
- package/dist/components/ok-currency/ok-currency.d.ts +31 -0
- package/dist/components/ok-data-table/ok-data-table.d.ts +312 -0
- package/dist/components/ok-date-picker/ok-date-picker.d.ts +81 -0
- package/dist/components/ok-detail-list/ok-detail-list.d.ts +30 -0
- package/dist/components/ok-diff/ok-diff.d.ts +38 -0
- package/dist/components/ok-donut/ok-donut.d.ts +38 -0
- package/dist/components/ok-drawer/ok-drawer.d.ts +56 -0
- package/dist/components/ok-dropzone/ok-dropzone.d.ts +48 -0
- package/dist/components/ok-empty-state/ok-empty-state.d.ts +16 -0
- package/dist/components/ok-error-page/ok-error-page.d.ts +77 -0
- package/dist/components/ok-event-card/ok-event-card.d.ts +56 -0
- package/dist/components/ok-feature-card/ok-feature-card.d.ts +23 -0
- package/dist/components/ok-file-item/ok-file-item.d.ts +31 -0
- package/dist/components/ok-file-manager/ok-file-manager.d.ts +145 -0
- package/dist/components/ok-footer/ok-footer.d.ts +10 -0
- package/dist/components/ok-funnel/ok-funnel.d.ts +31 -0
- package/dist/components/ok-gallery/ok-gallery.d.ts +34 -0
- package/dist/components/ok-gauge/ok-gauge.d.ts +49 -0
- package/dist/components/ok-heatmap/ok-heatmap.d.ts +45 -0
- package/dist/components/ok-hero/ok-hero.d.ts +10 -0
- package/dist/components/ok-hover-card/ok-hover-card.d.ts +76 -0
- package/dist/components/ok-icon-tile/ok-icon-tile.d.ts +24 -0
- package/dist/components/ok-image/ok-image.d.ts +56 -0
- package/dist/components/ok-inline-feedback/ok-inline-feedback.d.ts +33 -0
- package/dist/components/ok-invoice/ok-invoice.d.ts +137 -0
- package/dist/components/ok-json-viewer/ok-json-viewer.d.ts +31 -0
- package/dist/components/ok-kanban/ok-kanban.d.ts +56 -0
- package/dist/components/ok-kbd/ok-kbd.d.ts +21 -0
- package/dist/components/ok-keyboard/ok-keyboard.d.ts +35 -0
- package/dist/components/ok-kpi/ok-kpi.d.ts +24 -0
- package/dist/components/ok-language-select/ok-language-select.d.ts +31 -0
- package/dist/components/ok-lightbox/ok-lightbox.d.ts +59 -0
- package/dist/components/ok-logo-cloud/ok-logo-cloud.d.ts +14 -0
- package/dist/components/ok-loyalty-card/ok-loyalty-card.d.ts +35 -0
- package/dist/components/ok-mail/ok-mail.d.ts +117 -0
- package/dist/components/ok-menu/ok-menu.d.ts +75 -0
- package/dist/components/ok-menubar/ok-menubar.d.ts +75 -0
- package/dist/components/ok-navbar/ok-navbar.d.ts +42 -0
- package/dist/components/ok-notification-center/ok-notification-center.d.ts +79 -0
- package/dist/components/ok-org-chart/ok-org-chart.d.ts +67 -0
- package/dist/components/ok-otp/ok-otp.d.ts +31 -0
- package/dist/components/ok-page-header/ok-page-header.d.ts +23 -0
- package/dist/components/ok-pagination/ok-pagination.d.ts +44 -0
- package/dist/components/ok-pdf/ok-pdf.d.ts +32 -0
- package/dist/components/ok-phone/ok-phone.d.ts +48 -0
- package/dist/components/ok-pinpad/ok-pinpad.d.ts +29 -0
- package/dist/components/ok-pricing-card/ok-pricing-card.d.ts +31 -0
- package/dist/components/ok-product-card/ok-product-card.d.ts +25 -0
- package/dist/components/ok-qr/ok-qr.d.ts +24 -0
- package/dist/components/ok-qty-stepper/ok-qty-stepper.d.ts +35 -0
- package/dist/components/ok-range-dual/ok-range-dual.d.ts +38 -0
- package/dist/components/ok-rating/ok-rating.d.ts +33 -0
- package/dist/components/ok-receipt/ok-receipt.d.ts +103 -0
- package/dist/components/ok-reveal/ok-reveal.d.ts +21 -0
- package/dist/components/ok-rich-text/ok-rich-text.d.ts +46 -0
- package/dist/components/ok-scheduler/ok-scheduler.d.ts +74 -0
- package/dist/components/ok-select-card/ok-select-card.d.ts +37 -0
- package/dist/components/ok-signature/ok-signature.d.ts +55 -0
- package/dist/components/ok-skeleton/ok-skeleton.d.ts +40 -0
- package/dist/components/ok-sparkline/ok-sparkline.d.ts +27 -0
- package/dist/components/ok-split-button/ok-split-button.d.ts +49 -0
- package/dist/components/ok-splitter/ok-splitter.d.ts +36 -0
- package/dist/components/ok-stat/ok-stat.d.ts +16 -0
- package/dist/components/ok-status-dot/ok-status-dot.d.ts +24 -0
- package/dist/components/ok-status-pill/ok-status-pill.d.ts +22 -0
- package/dist/components/ok-stepper/ok-stepper.d.ts +33 -0
- package/dist/components/ok-store/ok-store.d.ts +33 -0
- package/dist/components/ok-tag-input/ok-tag-input.d.ts +39 -0
- package/dist/components/ok-testimonial/ok-testimonial.d.ts +21 -0
- package/dist/components/ok-time-picker/ok-time-picker.d.ts +50 -0
- package/dist/components/ok-timeline/ok-timeline.d.ts +33 -0
- package/dist/components/ok-tree/ok-tree.d.ts +46 -0
- package/dist/components/ok-video/ok-video.d.ts +49 -0
- package/dist/components/ok-widget-board/ok-widget-board.d.ts +71 -0
- package/dist/components/ok-wizard/ok-wizard.d.ts +30 -0
- package/dist/define.js +8 -0
- package/dist/erplora.css +112 -0
- package/dist/index.d.ts +158 -0
- package/dist/index.js +197 -0
- package/dist/layout.css +338 -0
- package/dist/ok-app-launcher.js +396 -0
- package/dist/ok-audio.js +308 -0
- package/dist/ok-avatar-group.js +158 -0
- package/dist/ok-avatar.js +179 -0
- package/dist/ok-bar-list.js +189 -0
- package/dist/ok-bento-item.js +168 -0
- package/dist/ok-bento.js +63 -0
- package/dist/ok-calculator.js +406 -0
- package/dist/ok-calendar.js +541 -0
- package/dist/ok-carousel.js +352 -0
- package/dist/ok-chart.js +325 -0
- package/dist/ok-chat.js +320 -0
- package/dist/ok-coachmark.js +500 -0
- package/dist/ok-code.js +190 -0
- package/dist/ok-color-picker.js +569 -0
- package/dist/ok-combo.js +294 -0
- package/dist/ok-command-palette.js +448 -0
- package/dist/ok-contact-form.js +288 -0
- package/dist/ok-cropper.js +404 -0
- package/dist/ok-cta-band.js +134 -0
- package/dist/ok-currency.js +172 -0
- package/dist/ok-data-table.js +1281 -0
- package/dist/ok-date-picker.js +736 -0
- package/dist/ok-detail-list.js +156 -0
- package/dist/ok-diff.js +200 -0
- package/dist/ok-donut.js +280 -0
- package/dist/ok-drawer.js +357 -0
- package/dist/ok-dropzone.js +376 -0
- package/dist/ok-empty-state.js +104 -0
- package/dist/ok-error-page.js +547 -0
- package/dist/ok-event-card.js +384 -0
- package/dist/ok-feature-card.js +152 -0
- package/dist/ok-file-item.js +259 -0
- package/dist/ok-file-manager.js +1116 -0
- package/dist/ok-footer.js +67 -0
- package/dist/ok-funnel.js +181 -0
- package/dist/ok-gallery.js +293 -0
- package/dist/ok-gauge.js +385 -0
- package/dist/ok-heatmap.js +268 -0
- package/dist/ok-hero.js +43 -0
- package/dist/ok-hover-card.js +480 -0
- package/dist/ok-icon-tile.js +123 -0
- package/dist/ok-image.js +471 -0
- package/dist/ok-inline-feedback.js +221 -0
- package/dist/ok-invoice.js +229 -0
- package/dist/ok-json-viewer.js +330 -0
- package/dist/ok-kanban.js +427 -0
- package/dist/ok-kbd.js +159 -0
- package/dist/ok-keyboard.js +402 -0
- package/dist/ok-kpi.js +147 -0
- package/dist/ok-language-select.js +188 -0
- package/dist/ok-lightbox.js +490 -0
- package/dist/ok-logo-cloud.js +92 -0
- package/dist/ok-loyalty-card.js +353 -0
- package/dist/ok-mail.js +562 -0
- package/dist/ok-menu.js +529 -0
- package/dist/ok-menubar.js +628 -0
- package/dist/ok-navbar.js +306 -0
- package/dist/ok-notification-center.js +545 -0
- package/dist/ok-org-chart.js +619 -0
- package/dist/ok-otp.js +199 -0
- package/dist/ok-page-header.js +202 -0
- package/dist/ok-pagination.js +366 -0
- package/dist/ok-pdf.js +160 -0
- package/dist/ok-phone.js +225 -0
- package/dist/ok-pinpad.js +171 -0
- package/dist/ok-pricing-card.js +184 -0
- package/dist/ok-product-card.js +178 -0
- package/dist/ok-qr.js +652 -0
- package/dist/ok-qty-stepper.js +212 -0
- package/dist/ok-range-dual.js +280 -0
- package/dist/ok-rating.js +199 -0
- package/dist/ok-receipt.js +183 -0
- package/dist/ok-reveal.js +94 -0
- package/dist/ok-rich-text.js +538 -0
- package/dist/ok-scheduler.js +518 -0
- package/dist/ok-select-card.js +231 -0
- package/dist/ok-signature.js +267 -0
- package/dist/ok-skeleton.js +345 -0
- package/dist/ok-sparkline.js +150 -0
- package/dist/ok-split-button.js +251 -0
- package/dist/ok-splitter.js +289 -0
- package/dist/ok-stat.js +77 -0
- package/dist/ok-status-dot.js +163 -0
- package/dist/ok-status-pill.js +123 -0
- package/dist/ok-stepper.js +299 -0
- package/dist/ok-store.js +83 -0
- package/dist/ok-tag-input.js +358 -0
- package/dist/ok-testimonial.js +136 -0
- package/dist/ok-time-picker.js +472 -0
- package/dist/ok-timeline.js +251 -0
- package/dist/ok-tree.js +266 -0
- package/dist/ok-video.js +362 -0
- package/dist/ok-widget-board.js +265 -0
- package/dist/ok-wizard.js +153 -0
- package/dist/outfitkit.js +96 -0
- package/dist/shared/anchor.js +14 -0
- package/dist/store/controller.d.ts +17 -0
- package/dist/store/idb.d.ts +16 -0
- package/dist/store/store.d.ts +39 -0
- package/dist/store-controller.js +31 -0
- package/dist/store.js +182 -0
- package/dist/theme.example.css +70 -0
- package/package.json +147 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { property } from "lit/decorators.js";
|
|
3
|
+
import { define } from "./define.js";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
6
|
+
var result = void 0;
|
|
7
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8
|
+
if (decorator = decorators[i])
|
|
9
|
+
result = decorator(target, key, result) || result;
|
|
10
|
+
if (result) __defProp(target, key, result);
|
|
11
|
+
return result;
|
|
12
|
+
};
|
|
13
|
+
const _OkAvatarGroup = class _OkAvatarGroup2 extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.avatars = [];
|
|
17
|
+
this.max = 0;
|
|
18
|
+
this.size = "md";
|
|
19
|
+
}
|
|
20
|
+
static {
|
|
21
|
+
this.styles = css`
|
|
22
|
+
:host {
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
width: auto;
|
|
25
|
+
/* Tokens propios estilo Ionic (overridables): --ok-* → --ion-* → hex. */
|
|
26
|
+
--size: 28px;
|
|
27
|
+
--font-size: 11px;
|
|
28
|
+
--overlap: 8px;
|
|
29
|
+
|
|
30
|
+
--avatar-bg: var(--ok-color-step-150, var(--ion-color-step-150, #e9edf1));
|
|
31
|
+
--avatar-fg: var(--ok-color-step-650, var(--ion-color-step-650, #4a5560));
|
|
32
|
+
--avatar-line: var(--ok-border-color, var(--ion-border-color, #d7dde3));
|
|
33
|
+
/* El ring usa el color de fondo del contenedor para "recortar" el solape. */
|
|
34
|
+
--ring-color: var(--ok-background-color, var(--ion-background-color, #ffffff));
|
|
35
|
+
|
|
36
|
+
--brand-bg: var(--ok-color-primary, var(--ion-color-primary, #3880ff));
|
|
37
|
+
--brand-fg: var(--ok-color-primary-contrast, var(--ion-color-primary-contrast, #fff));
|
|
38
|
+
--success-bg: var(--ok-color-success, var(--ion-color-success, #2dd36f));
|
|
39
|
+
--success-fg: var(--ok-color-success-contrast, var(--ion-color-success-contrast, #fff));
|
|
40
|
+
--warning-bg: var(--ok-color-warning, var(--ion-color-warning, #ffc409));
|
|
41
|
+
--warning-fg: var(--ok-color-warning-contrast, var(--ion-color-warning-contrast, #000));
|
|
42
|
+
--danger-bg: var(--ok-color-danger, var(--ion-color-danger, #eb445a));
|
|
43
|
+
--danger-fg: var(--ok-color-danger-contrast, var(--ion-color-danger-contrast, #fff));
|
|
44
|
+
--info-bg: var(--ok-color-tertiary, var(--ion-color-tertiary, #5260ff));
|
|
45
|
+
--info-fg: var(--ok-color-tertiary-contrast, var(--ion-color-tertiary-contrast, #fff));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.stack {
|
|
49
|
+
display: inline-flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.avatar {
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
display: inline-grid;
|
|
56
|
+
place-items: center;
|
|
57
|
+
width: var(--size);
|
|
58
|
+
height: var(--size);
|
|
59
|
+
border-radius: 50%;
|
|
60
|
+
background: var(--avatar-bg);
|
|
61
|
+
color: var(--avatar-fg);
|
|
62
|
+
font-size: var(--font-size);
|
|
63
|
+
font-weight: 600;
|
|
64
|
+
line-height: 1;
|
|
65
|
+
letter-spacing: -0.02em;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
flex-shrink: 0;
|
|
68
|
+
border: 1px solid var(--avatar-line);
|
|
69
|
+
user-select: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.avatar:not(:first-child) {
|
|
73
|
+
margin-left: calc(-1 * var(--overlap));
|
|
74
|
+
/* Ring del color de fondo para separar visualmente los solapes. */
|
|
75
|
+
box-shadow: 0 0 0 2px var(--ring-color);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.avatar img {
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 100%;
|
|
81
|
+
object-fit: cover;
|
|
82
|
+
display: block;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/* Tonos (solo aplican cuando se pintan iniciales). */
|
|
86
|
+
.avatar.tone-brand { background: var(--brand-bg); color: var(--brand-fg); border-color: transparent; }
|
|
87
|
+
.avatar.tone-success { background: var(--success-bg); color: var(--success-fg); border-color: transparent; }
|
|
88
|
+
.avatar.tone-warning { background: var(--warning-bg); color: var(--warning-fg); border-color: transparent; }
|
|
89
|
+
.avatar.tone-danger { background: var(--danger-bg); color: var(--danger-fg); border-color: transparent; }
|
|
90
|
+
.avatar.tone-info { background: var(--info-bg); color: var(--info-fg); border-color: transparent; }
|
|
91
|
+
|
|
92
|
+
/* Globo de overflow "+N": reusa el look de avatar con fondo neutro. */
|
|
93
|
+
.more {
|
|
94
|
+
font-variant-numeric: tabular-nums;
|
|
95
|
+
cursor: default;
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
}
|
|
99
|
+
static {
|
|
100
|
+
this.SIZES = {
|
|
101
|
+
xs: [20, 9, 6],
|
|
102
|
+
sm: [24, 10, 7],
|
|
103
|
+
md: [28, 11, 8],
|
|
104
|
+
lg: [36, 13, 10]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Devuelve las iniciales normalizadas (máx 3 chars, mayúsculas). */
|
|
108
|
+
initialsOf(item) {
|
|
109
|
+
return (item.initials ?? "").trim().slice(0, 3).toUpperCase();
|
|
110
|
+
}
|
|
111
|
+
renderAvatar(item) {
|
|
112
|
+
const label = item.label ?? item.initials ?? "";
|
|
113
|
+
const toneClass = item.tone && item.tone !== "neutral" ? `tone-${item.tone}` : "";
|
|
114
|
+
return html`
|
|
115
|
+
<span class="avatar ${toneClass}" role="img" aria-label=${label || "avatar"} title=${label}>
|
|
116
|
+
${item.src ? html`<img src=${item.src} alt=${label} loading="lazy" />` : this.initialsOf(item)}
|
|
117
|
+
</span>
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
render() {
|
|
121
|
+
const [dim, font, defOverlap] = _OkAvatarGroup2.SIZES[this.size] ?? _OkAvatarGroup2.SIZES.md;
|
|
122
|
+
const overlap = this.overlap ?? defOverlap;
|
|
123
|
+
const vars = `--size:${dim}px;--font-size:${font}px;--overlap:${overlap}px`;
|
|
124
|
+
const list = Array.isArray(this.avatars) ? this.avatars : [];
|
|
125
|
+
const limit = this.max > 0 ? this.max : list.length;
|
|
126
|
+
const visible = list.slice(0, limit);
|
|
127
|
+
const hidden = list.length - visible.length;
|
|
128
|
+
return html`
|
|
129
|
+
<div class="stack" style=${vars} role="group" aria-label="Grupo de avatares">
|
|
130
|
+
${visible.map((a) => this.renderAvatar(a))}
|
|
131
|
+
${hidden > 0 ? html`<span
|
|
132
|
+
class="avatar more"
|
|
133
|
+
role="img"
|
|
134
|
+
aria-label=${`${hidden} más`}
|
|
135
|
+
title=${`${hidden} más`}
|
|
136
|
+
>+${hidden}</span
|
|
137
|
+
>` : null}
|
|
138
|
+
</div>
|
|
139
|
+
`;
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
__decorateClass([
|
|
143
|
+
property({ attribute: false })
|
|
144
|
+
], _OkAvatarGroup.prototype, "avatars");
|
|
145
|
+
__decorateClass([
|
|
146
|
+
property({ type: Number })
|
|
147
|
+
], _OkAvatarGroup.prototype, "max");
|
|
148
|
+
__decorateClass([
|
|
149
|
+
property({ reflect: true })
|
|
150
|
+
], _OkAvatarGroup.prototype, "size");
|
|
151
|
+
__decorateClass([
|
|
152
|
+
property({ type: Number })
|
|
153
|
+
], _OkAvatarGroup.prototype, "overlap");
|
|
154
|
+
let OkAvatarGroup = _OkAvatarGroup;
|
|
155
|
+
define("ok-avatar-group", OkAvatarGroup);
|
|
156
|
+
export {
|
|
157
|
+
OkAvatarGroup
|
|
158
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { property, state } from "lit/decorators.js";
|
|
3
|
+
import { define } from "./define.js";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
6
|
+
var result = void 0;
|
|
7
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8
|
+
if (decorator = decorators[i])
|
|
9
|
+
result = decorator(target, key, result) || result;
|
|
10
|
+
if (result) __defProp(target, key, result);
|
|
11
|
+
return result;
|
|
12
|
+
};
|
|
13
|
+
class OkAvatar extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.name = "";
|
|
17
|
+
this.size = "md";
|
|
18
|
+
this.shape = "circle";
|
|
19
|
+
this.tone = "primary";
|
|
20
|
+
this.imgFailed = false;
|
|
21
|
+
this.onImgError = () => {
|
|
22
|
+
this.imgFailed = true;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
static {
|
|
26
|
+
this.styles = css`
|
|
27
|
+
:host {
|
|
28
|
+
/* Vars overridable (estilo Ionic), default = cadena --ok-* → --ion-* → hex.
|
|
29
|
+
--tone-color se reasigna por JS (CSSOM) cuando tone='auto'. */
|
|
30
|
+
--tone-color: var(--ok-primary, var(--ion-color-primary, #3880ff));
|
|
31
|
+
--background: var(--ok-avatar-bg, color-mix(in srgb, var(--tone-color) 18%, transparent));
|
|
32
|
+
--color: var(--ok-avatar-color, var(--tone-color));
|
|
33
|
+
--size: var(--ok-avatar-size, 32px);
|
|
34
|
+
--border-radius: 50%;
|
|
35
|
+
--font: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
|
|
36
|
+
|
|
37
|
+
/* Inline: el avatar es un elemento de línea (topbar, celdas de tabla, listados). */
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
vertical-align: middle;
|
|
40
|
+
font-family: var(--font);
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Tamaños predefinidos (--ok-avatar-size libre los sobrescribe). */
|
|
45
|
+
:host([size='xs']) { --size: var(--ok-avatar-size, 20px); }
|
|
46
|
+
:host([size='sm']) { --size: var(--ok-avatar-size, 24px); }
|
|
47
|
+
:host([size='md']) { --size: var(--ok-avatar-size, 32px); }
|
|
48
|
+
:host([size='lg']) { --size: var(--ok-avatar-size, 44px); }
|
|
49
|
+
|
|
50
|
+
:host([shape='rounded']) {
|
|
51
|
+
--border-radius: var(--ok-radius, var(--ion-border-radius, 8px));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.wrap {
|
|
55
|
+
position: relative;
|
|
56
|
+
display: inline-flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
width: var(--size);
|
|
60
|
+
height: var(--size);
|
|
61
|
+
border-radius: var(--border-radius);
|
|
62
|
+
background: var(--background);
|
|
63
|
+
color: var(--color);
|
|
64
|
+
font-size: calc(var(--size) * 0.4);
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
letter-spacing: 0.02em;
|
|
67
|
+
line-height: 1;
|
|
68
|
+
text-decoration: none;
|
|
69
|
+
user-select: none;
|
|
70
|
+
overflow: visible; /* el punto de estado sobresale; la imagen recorta por su propio radius */
|
|
71
|
+
}
|
|
72
|
+
a.wrap { cursor: pointer; }
|
|
73
|
+
a.wrap:focus-visible {
|
|
74
|
+
outline: 2px solid var(--tone-color);
|
|
75
|
+
outline-offset: 2px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.initials {
|
|
79
|
+
display: inline-flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
width: 100%;
|
|
83
|
+
height: 100%;
|
|
84
|
+
border-radius: inherit;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
img {
|
|
89
|
+
display: block;
|
|
90
|
+
width: 100%;
|
|
91
|
+
height: 100%;
|
|
92
|
+
border-radius: inherit;
|
|
93
|
+
object-fit: cover;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* Punto de estado (abajo-derecha), con anillo del color de la superficie. */
|
|
97
|
+
.status {
|
|
98
|
+
position: absolute;
|
|
99
|
+
right: 0;
|
|
100
|
+
bottom: 0;
|
|
101
|
+
width: calc(var(--size) * 0.28);
|
|
102
|
+
height: calc(var(--size) * 0.28);
|
|
103
|
+
border-radius: 50%;
|
|
104
|
+
box-shadow: 0 0 0 2px var(--ok-surface, var(--ion-background-color, #fff));
|
|
105
|
+
background: var(--ok-medium, var(--ion-color-medium, #5f5f5f));
|
|
106
|
+
}
|
|
107
|
+
:host([status='online']) .status { background: var(--ok-success, var(--ion-color-success, #2dd55b)); }
|
|
108
|
+
:host([status='busy']) .status { background: var(--ok-danger, var(--ion-color-danger, #c5000f)); }
|
|
109
|
+
/* offline → medium (default ya aplicado arriba). */
|
|
110
|
+
`;
|
|
111
|
+
}
|
|
112
|
+
// Iniciales: 1ª letra de las dos primeras palabras del nombre; fallback 1ª letra del email.
|
|
113
|
+
initials() {
|
|
114
|
+
const words = (this.name ?? "").trim().split(/\s+/).filter(Boolean);
|
|
115
|
+
if (words.length >= 2) return (words[0][0] + words[1][0]).toUpperCase();
|
|
116
|
+
if (words.length === 1) return words[0][0].toUpperCase();
|
|
117
|
+
const mail = (this.email ?? "").trim();
|
|
118
|
+
return mail ? mail[0].toUpperCase() : "?";
|
|
119
|
+
}
|
|
120
|
+
// Hash estable (djb2) → tono HSL determinista por nombre/email (para tone='auto').
|
|
121
|
+
autoHue() {
|
|
122
|
+
const key = (this.name || this.email || "").trim().toLowerCase();
|
|
123
|
+
let h = 5381;
|
|
124
|
+
for (let i = 0; i < key.length; i++) h = (h << 5) + h + key.charCodeAt(i) | 0;
|
|
125
|
+
return Math.abs(h) % 360;
|
|
126
|
+
}
|
|
127
|
+
willUpdate(changed) {
|
|
128
|
+
if (changed.has("src")) this.imgFailed = false;
|
|
129
|
+
if (changed.has("tone") || changed.has("name") || changed.has("email")) {
|
|
130
|
+
if (this.tone === "auto") {
|
|
131
|
+
this.style.setProperty("--tone-color", `hsl(${this.autoHue()} 55% 42%)`);
|
|
132
|
+
} else {
|
|
133
|
+
this.style.removeProperty("--tone-color");
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
render() {
|
|
138
|
+
const label = this.name || this.email || "";
|
|
139
|
+
const showImg = !!this.src && !this.imgFailed;
|
|
140
|
+
const content = html`
|
|
141
|
+
<slot>
|
|
142
|
+
${showImg ? html`<img src=${this.src} alt=${label} @error=${this.onImgError} />` : html`<span class="initials" aria-hidden="true">${this.initials()}</span>`}
|
|
143
|
+
</slot>
|
|
144
|
+
${this.status ? html`<span class="status" part="status"></span>` : null}
|
|
145
|
+
`;
|
|
146
|
+
return this.href ? html`<a class="wrap" part="avatar" href=${this.href} title=${label} aria-label=${label}>${content}</a>` : html`<span class="wrap" part="avatar" role="img" title=${label} aria-label=${label}>${content}</span>`;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
__decorateClass([
|
|
150
|
+
property({ type: String })
|
|
151
|
+
], OkAvatar.prototype, "name");
|
|
152
|
+
__decorateClass([
|
|
153
|
+
property({ type: String })
|
|
154
|
+
], OkAvatar.prototype, "email");
|
|
155
|
+
__decorateClass([
|
|
156
|
+
property({ type: String })
|
|
157
|
+
], OkAvatar.prototype, "src");
|
|
158
|
+
__decorateClass([
|
|
159
|
+
property({ type: String, reflect: true })
|
|
160
|
+
], OkAvatar.prototype, "size");
|
|
161
|
+
__decorateClass([
|
|
162
|
+
property({ type: String, reflect: true })
|
|
163
|
+
], OkAvatar.prototype, "shape");
|
|
164
|
+
__decorateClass([
|
|
165
|
+
property({ type: String, reflect: true })
|
|
166
|
+
], OkAvatar.prototype, "tone");
|
|
167
|
+
__decorateClass([
|
|
168
|
+
property({ type: String, reflect: true })
|
|
169
|
+
], OkAvatar.prototype, "status");
|
|
170
|
+
__decorateClass([
|
|
171
|
+
property({ type: String })
|
|
172
|
+
], OkAvatar.prototype, "href");
|
|
173
|
+
__decorateClass([
|
|
174
|
+
state()
|
|
175
|
+
], OkAvatar.prototype, "imgFailed");
|
|
176
|
+
define("ok-avatar", OkAvatar);
|
|
177
|
+
export {
|
|
178
|
+
OkAvatar
|
|
179
|
+
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { property } from "lit/decorators.js";
|
|
3
|
+
import { define } from "./define.js";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
6
|
+
var result = void 0;
|
|
7
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8
|
+
if (decorator = decorators[i])
|
|
9
|
+
result = decorator(target, key, result) || result;
|
|
10
|
+
if (result) __defProp(target, key, result);
|
|
11
|
+
return result;
|
|
12
|
+
};
|
|
13
|
+
const SEMANTIC = /* @__PURE__ */ new Set(["brand", "leaf", "warn", "info", "danger"]);
|
|
14
|
+
class OkBarList extends LitElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.items = [];
|
|
18
|
+
this.valueFormat = "number";
|
|
19
|
+
this.locale = "";
|
|
20
|
+
this.currency = "EUR";
|
|
21
|
+
}
|
|
22
|
+
static {
|
|
23
|
+
this.styles = css`
|
|
24
|
+
:host {
|
|
25
|
+
display: block;
|
|
26
|
+
width: 100%;
|
|
27
|
+
|
|
28
|
+
/* Tokens propios estilo Ionic: --ok-* → --ion-* → hex. */
|
|
29
|
+
--label-color: var(--ok-color-medium, var(--ion-color-medium, #6b7280));
|
|
30
|
+
--value-color: var(--ok-text-color, var(--ion-text-color, #1f2933));
|
|
31
|
+
--track-bg: var(--ok-color-step-100, var(--ion-color-step-100, #e5e7eb));
|
|
32
|
+
|
|
33
|
+
/* Variantes de color del relleno. */
|
|
34
|
+
--bar-brand: var(--ok-primary, var(--ion-color-primary, #3880ff));
|
|
35
|
+
--bar-leaf: var(--ok-success, var(--ion-color-success, #2dd36f));
|
|
36
|
+
--bar-warn: var(--ok-warning, var(--ion-color-warning, #ffc409));
|
|
37
|
+
--bar-info: var(--ok-tertiary, var(--ion-color-tertiary, #5260ff));
|
|
38
|
+
--bar-danger: var(--ok-danger, var(--ion-color-danger, #eb445a));
|
|
39
|
+
|
|
40
|
+
/* Geometría del track. */
|
|
41
|
+
--track-height: 8px;
|
|
42
|
+
--track-radius: 4px;
|
|
43
|
+
--label-width: 110px;
|
|
44
|
+
--value-width: 60px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.bars {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
gap: 8px;
|
|
51
|
+
width: 100%;
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.row {
|
|
56
|
+
display: grid;
|
|
57
|
+
grid-template-columns: var(--label-width) 1fr var(--value-width);
|
|
58
|
+
gap: 10px;
|
|
59
|
+
align-items: center;
|
|
60
|
+
font-size: 0.75rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.label {
|
|
64
|
+
color: var(--label-color);
|
|
65
|
+
white-space: nowrap;
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
text-overflow: ellipsis;
|
|
68
|
+
min-width: 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.track {
|
|
72
|
+
height: var(--track-height);
|
|
73
|
+
background: var(--track-bg);
|
|
74
|
+
border-radius: var(--track-radius);
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
position: relative;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.fill {
|
|
80
|
+
height: 100%;
|
|
81
|
+
border-radius: var(--track-radius);
|
|
82
|
+
background: var(--bar-brand);
|
|
83
|
+
transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
|
|
84
|
+
min-width: 2px;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.value {
|
|
88
|
+
text-align: right;
|
|
89
|
+
font-variant-numeric: tabular-nums;
|
|
90
|
+
color: var(--value-color);
|
|
91
|
+
font-weight: 700;
|
|
92
|
+
white-space: nowrap;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* En móvil estrecho compactamos la columna de etiqueta. */
|
|
96
|
+
@media (max-width: 420px) {
|
|
97
|
+
.row {
|
|
98
|
+
--label-width: 80px;
|
|
99
|
+
--value-width: 52px;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@media (prefers-reduced-motion: reduce) {
|
|
104
|
+
.fill {
|
|
105
|
+
transition: none;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
}
|
|
110
|
+
// Tope efectivo de la escala: prop `max` o el máximo de los valores (mínimo 1 para evitar /0).
|
|
111
|
+
get scaleMax() {
|
|
112
|
+
if (this.max != null && this.max > 0) return this.max;
|
|
113
|
+
const values = (this.items ?? []).map((i) => i.value);
|
|
114
|
+
return Math.max(1, ...values);
|
|
115
|
+
}
|
|
116
|
+
// Devuelve el background CSS del relleno según el color del ítem.
|
|
117
|
+
fillColor(color) {
|
|
118
|
+
if (!color) return "var(--bar-brand)";
|
|
119
|
+
if (SEMANTIC.has(color)) return `var(--bar-${color})`;
|
|
120
|
+
return color;
|
|
121
|
+
}
|
|
122
|
+
// Formatea el valor según value-format usando Intl nativo.
|
|
123
|
+
formatValue(value) {
|
|
124
|
+
const locale = this.locale || void 0;
|
|
125
|
+
switch (this.valueFormat) {
|
|
126
|
+
case "compact":
|
|
127
|
+
return new Intl.NumberFormat(locale, { notation: "compact", maximumFractionDigits: 1 }).format(value);
|
|
128
|
+
case "currency":
|
|
129
|
+
return new Intl.NumberFormat(locale, {
|
|
130
|
+
style: "currency",
|
|
131
|
+
currency: this.currency,
|
|
132
|
+
maximumFractionDigits: 0
|
|
133
|
+
}).format(value);
|
|
134
|
+
case "percent":
|
|
135
|
+
return new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 1 }).format(value);
|
|
136
|
+
case "number":
|
|
137
|
+
default:
|
|
138
|
+
return new Intl.NumberFormat(locale).format(value);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
render() {
|
|
142
|
+
const items = this.items ?? [];
|
|
143
|
+
const max = this.scaleMax;
|
|
144
|
+
return html`
|
|
145
|
+
<div class="bars" role="list">
|
|
146
|
+
${items.map((item) => {
|
|
147
|
+
const pct = Math.max(0, Math.min(100, item.value / max * 100));
|
|
148
|
+
const formatted = this.formatValue(item.value);
|
|
149
|
+
return html`
|
|
150
|
+
<div class="row" role="listitem">
|
|
151
|
+
<span class="label" title=${item.label}>${item.label}</span>
|
|
152
|
+
<div
|
|
153
|
+
class="track"
|
|
154
|
+
role="progressbar"
|
|
155
|
+
aria-label=${item.label}
|
|
156
|
+
aria-valuemin="0"
|
|
157
|
+
aria-valuemax=${max}
|
|
158
|
+
aria-valuenow=${item.value}
|
|
159
|
+
aria-valuetext=${formatted}
|
|
160
|
+
>
|
|
161
|
+
<div class="fill" style=${`width:${pct}%;background:${this.fillColor(item.color)}`}></div>
|
|
162
|
+
</div>
|
|
163
|
+
<span class="value">${formatted}</span>
|
|
164
|
+
</div>
|
|
165
|
+
`;
|
|
166
|
+
})}
|
|
167
|
+
</div>
|
|
168
|
+
`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
__decorateClass([
|
|
172
|
+
property({ attribute: false })
|
|
173
|
+
], OkBarList.prototype, "items");
|
|
174
|
+
__decorateClass([
|
|
175
|
+
property({ type: Number })
|
|
176
|
+
], OkBarList.prototype, "max");
|
|
177
|
+
__decorateClass([
|
|
178
|
+
property({ attribute: "value-format" })
|
|
179
|
+
], OkBarList.prototype, "valueFormat");
|
|
180
|
+
__decorateClass([
|
|
181
|
+
property()
|
|
182
|
+
], OkBarList.prototype, "locale");
|
|
183
|
+
__decorateClass([
|
|
184
|
+
property()
|
|
185
|
+
], OkBarList.prototype, "currency");
|
|
186
|
+
define("ok-bar-list", OkBarList);
|
|
187
|
+
export {
|
|
188
|
+
OkBarList
|
|
189
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { property } from "lit/decorators.js";
|
|
3
|
+
import { define } from "./define.js";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
6
|
+
var result = void 0;
|
|
7
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8
|
+
if (decorator = decorators[i])
|
|
9
|
+
result = decorator(target, key, result) || result;
|
|
10
|
+
if (result) __defProp(target, key, result);
|
|
11
|
+
return result;
|
|
12
|
+
};
|
|
13
|
+
class OkBentoItem extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.cols = 2;
|
|
17
|
+
this.rows = 1;
|
|
18
|
+
this.tone = "default";
|
|
19
|
+
this.glass = false;
|
|
20
|
+
this.interactive = false;
|
|
21
|
+
}
|
|
22
|
+
static {
|
|
23
|
+
this.styles = css`
|
|
24
|
+
:host {
|
|
25
|
+
display: block;
|
|
26
|
+
grid-column: span var(--cols, 2);
|
|
27
|
+
grid-row: span var(--rows, 1);
|
|
28
|
+
min-width: 0;
|
|
29
|
+
--color: var(--ok-text, var(--ion-text-color, #18181b));
|
|
30
|
+
--muted: var(--ok-muted, rgba(var(--ion-text-color-rgb, 24, 24, 27), 0.6));
|
|
31
|
+
--surface: var(--ok-surface, var(--ion-card-background, var(--ion-background-color, #fff)));
|
|
32
|
+
--border: var(--ok-border, rgba(var(--ion-text-color-rgb, 24, 24, 27), 0.1));
|
|
33
|
+
--radius: var(--ok-radius, 16px);
|
|
34
|
+
--accent: var(--ion-color-primary, #1496d6);
|
|
35
|
+
font-family: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
|
|
36
|
+
}
|
|
37
|
+
@media (max-width: 560px) {
|
|
38
|
+
:host { grid-column: 1 / -1; grid-row: auto; }
|
|
39
|
+
}
|
|
40
|
+
.cell {
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
height: 100%;
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
gap: 0.6rem;
|
|
46
|
+
padding: var(--pad, clamp(1.1rem, 2vw, 1.6rem));
|
|
47
|
+
color: var(--color);
|
|
48
|
+
background: var(--surface);
|
|
49
|
+
border: 1px solid var(--border);
|
|
50
|
+
border-radius: var(--radius);
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
position: relative;
|
|
53
|
+
transition: transform var(--ok-transition, 160ms ease), box-shadow var(--ok-transition, 160ms ease),
|
|
54
|
+
border-color var(--ok-transition, 160ms ease);
|
|
55
|
+
}
|
|
56
|
+
/* Tinte de acento por tono */
|
|
57
|
+
:host([tone='primary']) { --accent: var(--ion-color-primary, #1496d6); }
|
|
58
|
+
:host([tone='success']) { --accent: var(--ion-color-success, #2dd36f); }
|
|
59
|
+
:host([tone='warning']) { --accent: var(--ion-color-warning, #ffc409); }
|
|
60
|
+
:host([tone='danger']) { --accent: var(--ion-color-danger, #eb445a); }
|
|
61
|
+
:host([tone]:not([tone='default'])) .cell {
|
|
62
|
+
background: color-mix(in oklab, var(--accent) 7%, var(--surface));
|
|
63
|
+
border-color: color-mix(in oklab, var(--accent) 22%, var(--border));
|
|
64
|
+
}
|
|
65
|
+
/* Cristal esmerilado (acento, no toda la UI) */
|
|
66
|
+
:host([glass]) .cell {
|
|
67
|
+
background: color-mix(in oklab, var(--surface) 62%, transparent);
|
|
68
|
+
-webkit-backdrop-filter: blur(14px) saturate(1.4);
|
|
69
|
+
backdrop-filter: blur(14px) saturate(1.4);
|
|
70
|
+
border-color: color-mix(in oklab, var(--color) 12%, transparent);
|
|
71
|
+
box-shadow: inset 0 1px 0 color-mix(in oklab, #fff 14%, transparent);
|
|
72
|
+
}
|
|
73
|
+
:host([interactive]) .cell { cursor: pointer; }
|
|
74
|
+
:host([interactive]) .cell:hover {
|
|
75
|
+
transform: translateY(-3px);
|
|
76
|
+
border-color: color-mix(in oklab, var(--accent) 45%, var(--border));
|
|
77
|
+
box-shadow: 0 18px 40px -22px color-mix(in oklab, var(--accent) 60%, transparent);
|
|
78
|
+
}
|
|
79
|
+
a.cell { text-decoration: none; color: inherit; }
|
|
80
|
+
.ico {
|
|
81
|
+
display: inline-grid;
|
|
82
|
+
place-items: center;
|
|
83
|
+
width: 2.5rem;
|
|
84
|
+
height: 2.5rem;
|
|
85
|
+
border-radius: 12px;
|
|
86
|
+
color: var(--accent);
|
|
87
|
+
background: color-mix(in oklab, var(--accent) 14%, transparent);
|
|
88
|
+
font-size: 1.25rem;
|
|
89
|
+
}
|
|
90
|
+
/* Glifo via máscara CSS sobre la SVG del API de Iconify (funciona en Shadow DOM). */
|
|
91
|
+
.glyph {
|
|
92
|
+
width: 1.35rem;
|
|
93
|
+
height: 1.35rem;
|
|
94
|
+
background-color: currentColor;
|
|
95
|
+
-webkit-mask: var(--u) center / contain no-repeat;
|
|
96
|
+
mask: var(--u) center / contain no-repeat;
|
|
97
|
+
}
|
|
98
|
+
.eyebrow {
|
|
99
|
+
font-size: 0.7rem;
|
|
100
|
+
font-weight: 600;
|
|
101
|
+
letter-spacing: 0.05em;
|
|
102
|
+
text-transform: uppercase;
|
|
103
|
+
color: var(--muted);
|
|
104
|
+
}
|
|
105
|
+
.title {
|
|
106
|
+
margin: 0;
|
|
107
|
+
font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.35rem);
|
|
108
|
+
font-weight: 620;
|
|
109
|
+
letter-spacing: -0.015em;
|
|
110
|
+
line-height: 1.2;
|
|
111
|
+
}
|
|
112
|
+
::slotted(p) { margin: 0; color: var(--muted); line-height: 1.55; }
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
updated() {
|
|
116
|
+
this.style.setProperty("--cols", String(this.cols));
|
|
117
|
+
this.style.setProperty("--rows", String(this.rows));
|
|
118
|
+
}
|
|
119
|
+
/** "lucide:box" → "https://api.iconify.design/lucide/box.svg". */
|
|
120
|
+
iconUrl(name) {
|
|
121
|
+
const i = name.indexOf(":");
|
|
122
|
+
const prefix = i === -1 ? "lucide" : name.slice(0, i);
|
|
123
|
+
const icon = i === -1 ? name : name.slice(i + 1);
|
|
124
|
+
return `https://api.iconify.design/${prefix}/${icon}.svg`;
|
|
125
|
+
}
|
|
126
|
+
body() {
|
|
127
|
+
return html`
|
|
128
|
+
${this.icon ? html`<span class="ico"><i class="glyph" style="--u:url('${this.iconUrl(this.icon)}')"></i></span>` : null}
|
|
129
|
+
${this.eyebrow ? html`<span class="eyebrow">${this.eyebrow}</span>` : null}
|
|
130
|
+
${this.heading ? html`<h3 class="title">${this.heading}</h3>` : null}
|
|
131
|
+
<slot></slot>
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
render() {
|
|
135
|
+
return this.href ? html`<a class="cell" href=${this.href}>${this.body()}</a>` : html`<div class="cell">${this.body()}</div>`;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
__decorateClass([
|
|
139
|
+
property({ type: Number })
|
|
140
|
+
], OkBentoItem.prototype, "cols");
|
|
141
|
+
__decorateClass([
|
|
142
|
+
property({ type: Number })
|
|
143
|
+
], OkBentoItem.prototype, "rows");
|
|
144
|
+
__decorateClass([
|
|
145
|
+
property({ reflect: true })
|
|
146
|
+
], OkBentoItem.prototype, "tone");
|
|
147
|
+
__decorateClass([
|
|
148
|
+
property({ type: Boolean, reflect: true })
|
|
149
|
+
], OkBentoItem.prototype, "glass");
|
|
150
|
+
__decorateClass([
|
|
151
|
+
property({ type: Boolean, reflect: true })
|
|
152
|
+
], OkBentoItem.prototype, "interactive");
|
|
153
|
+
__decorateClass([
|
|
154
|
+
property()
|
|
155
|
+
], OkBentoItem.prototype, "href");
|
|
156
|
+
__decorateClass([
|
|
157
|
+
property()
|
|
158
|
+
], OkBentoItem.prototype, "icon");
|
|
159
|
+
__decorateClass([
|
|
160
|
+
property()
|
|
161
|
+
], OkBentoItem.prototype, "eyebrow");
|
|
162
|
+
__decorateClass([
|
|
163
|
+
property()
|
|
164
|
+
], OkBentoItem.prototype, "heading");
|
|
165
|
+
define("ok-bento-item", OkBentoItem);
|
|
166
|
+
export {
|
|
167
|
+
OkBentoItem
|
|
168
|
+
};
|