@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,345 @@
|
|
|
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 OkSkeleton extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.variant = "text";
|
|
17
|
+
this.lines = 1;
|
|
18
|
+
this.preset = "none";
|
|
19
|
+
this.rows = 5;
|
|
20
|
+
this.cols = 4;
|
|
21
|
+
}
|
|
22
|
+
static {
|
|
23
|
+
this.styles = css`
|
|
24
|
+
:host {
|
|
25
|
+
display: block;
|
|
26
|
+
width: 100%;
|
|
27
|
+
/* Tokens propios estilo Ionic (overridables): --ok-* → --ion-* → hex. */
|
|
28
|
+
--skel-from: var(--ok-skeleton-base, var(--ion-color-step-100, #e9edf2));
|
|
29
|
+
--skel-to: var(--ok-skeleton-highlight, var(--ion-color-step-200, #d3dae2));
|
|
30
|
+
--surface: var(--ok-surface, var(--ion-card-background, var(--ion-background-color, #fff)));
|
|
31
|
+
--line: var(--ok-border-color, var(--ion-border-color, #e2e8f0));
|
|
32
|
+
--radius-sm: var(--ok-radius-sm, 4px);
|
|
33
|
+
--radius-md: var(--ok-radius-md, 8px);
|
|
34
|
+
--radius-lg: var(--ok-radius-lg, 12px);
|
|
35
|
+
--radius-xl: var(--ok-radius-xl, 16px);
|
|
36
|
+
--radius-pill: var(--ok-radius-pill, 999px);
|
|
37
|
+
--speed: var(--ok-skeleton-speed, 1.4s);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* Bloque base con shimmer horizontal. */
|
|
41
|
+
.skel {
|
|
42
|
+
display: block;
|
|
43
|
+
background: linear-gradient(
|
|
44
|
+
90deg,
|
|
45
|
+
var(--skel-from) 0%,
|
|
46
|
+
var(--skel-to) 50%,
|
|
47
|
+
var(--skel-from) 100%
|
|
48
|
+
);
|
|
49
|
+
background-size: 200% 100%;
|
|
50
|
+
animation: skel-shimmer var(--speed) linear infinite;
|
|
51
|
+
border-radius: var(--radius-sm);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@keyframes skel-shimmer {
|
|
55
|
+
0% {
|
|
56
|
+
background-position: 200% 0;
|
|
57
|
+
}
|
|
58
|
+
100% {
|
|
59
|
+
background-position: -200% 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Variantes de forma. */
|
|
64
|
+
.v-text {
|
|
65
|
+
height: 12px;
|
|
66
|
+
width: 100%;
|
|
67
|
+
border-radius: 4px;
|
|
68
|
+
}
|
|
69
|
+
.v-title {
|
|
70
|
+
height: 18px;
|
|
71
|
+
width: 60%;
|
|
72
|
+
border-radius: 4px;
|
|
73
|
+
}
|
|
74
|
+
.v-circle {
|
|
75
|
+
border-radius: 50%;
|
|
76
|
+
aspect-ratio: 1;
|
|
77
|
+
}
|
|
78
|
+
.v-avatar {
|
|
79
|
+
width: 36px;
|
|
80
|
+
height: 36px;
|
|
81
|
+
border-radius: 50%;
|
|
82
|
+
}
|
|
83
|
+
.v-button {
|
|
84
|
+
height: 32px;
|
|
85
|
+
width: 96px;
|
|
86
|
+
border-radius: var(--radius-md);
|
|
87
|
+
}
|
|
88
|
+
.v-chip {
|
|
89
|
+
height: 22px;
|
|
90
|
+
width: 72px;
|
|
91
|
+
border-radius: var(--radius-pill);
|
|
92
|
+
}
|
|
93
|
+
.v-card {
|
|
94
|
+
height: 120px;
|
|
95
|
+
border-radius: var(--radius-lg);
|
|
96
|
+
}
|
|
97
|
+
.v-row {
|
|
98
|
+
height: 44px;
|
|
99
|
+
border-radius: var(--radius-md);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Stack de líneas de texto con anchos decrecientes (92/78/60%). */
|
|
103
|
+
.stack {
|
|
104
|
+
display: flex;
|
|
105
|
+
flex-direction: column;
|
|
106
|
+
gap: 6px;
|
|
107
|
+
}
|
|
108
|
+
.stack .line:nth-child(2) {
|
|
109
|
+
width: 92%;
|
|
110
|
+
}
|
|
111
|
+
.stack .line:nth-child(3) {
|
|
112
|
+
width: 78%;
|
|
113
|
+
}
|
|
114
|
+
.stack .line:nth-child(n + 4) {
|
|
115
|
+
width: 60%;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Preset: card. */
|
|
119
|
+
.preset-card {
|
|
120
|
+
background: var(--surface);
|
|
121
|
+
border: 1px solid var(--line);
|
|
122
|
+
border-radius: var(--radius-xl);
|
|
123
|
+
padding: 16px;
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: 12px;
|
|
127
|
+
box-sizing: border-box;
|
|
128
|
+
}
|
|
129
|
+
.preset-card .head {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
gap: 12px;
|
|
133
|
+
}
|
|
134
|
+
.preset-card .head .meta {
|
|
135
|
+
flex: 1;
|
|
136
|
+
display: flex;
|
|
137
|
+
flex-direction: column;
|
|
138
|
+
gap: 6px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* Preset: table (replica la rejilla de ok-data-table). */
|
|
142
|
+
.preset-table {
|
|
143
|
+
background: var(--surface);
|
|
144
|
+
border: 1px solid var(--line);
|
|
145
|
+
border-radius: var(--radius-xl);
|
|
146
|
+
padding: 6px 14px;
|
|
147
|
+
box-sizing: border-box;
|
|
148
|
+
}
|
|
149
|
+
.preset-table .trow {
|
|
150
|
+
display: grid;
|
|
151
|
+
gap: 16px;
|
|
152
|
+
padding: 14px 0;
|
|
153
|
+
border-bottom: 1px solid var(--line);
|
|
154
|
+
align-items: center;
|
|
155
|
+
}
|
|
156
|
+
.preset-table .trow:last-child {
|
|
157
|
+
border-bottom: none;
|
|
158
|
+
}
|
|
159
|
+
.preset-table .trow.head .skel {
|
|
160
|
+
opacity: 0.55;
|
|
161
|
+
height: 10px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* Preset: chart (barras con shimmer vertical). */
|
|
165
|
+
.preset-chart {
|
|
166
|
+
background: var(--surface);
|
|
167
|
+
border: 1px solid var(--line);
|
|
168
|
+
border-radius: var(--radius-xl);
|
|
169
|
+
padding: 16px;
|
|
170
|
+
height: 180px;
|
|
171
|
+
display: flex;
|
|
172
|
+
align-items: flex-end;
|
|
173
|
+
gap: 6px;
|
|
174
|
+
box-sizing: border-box;
|
|
175
|
+
}
|
|
176
|
+
.preset-chart .bar {
|
|
177
|
+
flex: 1;
|
|
178
|
+
border-radius: var(--radius-sm);
|
|
179
|
+
background: linear-gradient(
|
|
180
|
+
180deg,
|
|
181
|
+
var(--skel-from) 0%,
|
|
182
|
+
var(--skel-to) 50%,
|
|
183
|
+
var(--skel-from) 100%
|
|
184
|
+
);
|
|
185
|
+
background-size: 100% 200%;
|
|
186
|
+
animation: skel-shimmer-v var(--speed) linear infinite;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@keyframes skel-shimmer-v {
|
|
190
|
+
0% {
|
|
191
|
+
background-position: 0 200%;
|
|
192
|
+
}
|
|
193
|
+
100% {
|
|
194
|
+
background-position: 0 -200%;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* Accesibilidad: sin movimiento si el usuario lo pide. */
|
|
199
|
+
@media (prefers-reduced-motion: reduce) {
|
|
200
|
+
.skel,
|
|
201
|
+
.preset-chart .bar {
|
|
202
|
+
animation: none;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
`;
|
|
206
|
+
}
|
|
207
|
+
/** Estilos inline (width/height/radius) aplicados al bloque. */
|
|
208
|
+
blockStyle() {
|
|
209
|
+
const parts = [];
|
|
210
|
+
if (this.width) parts.push(`width:${this.width}`);
|
|
211
|
+
if (this.height) parts.push(`height:${this.height}`);
|
|
212
|
+
if (this.radius) parts.push(`border-radius:${this.radius}`);
|
|
213
|
+
return parts.join(";");
|
|
214
|
+
}
|
|
215
|
+
/** Bloque base con la clase de variante. */
|
|
216
|
+
renderBlock(variant = this.variant) {
|
|
217
|
+
return html`
|
|
218
|
+
<div
|
|
219
|
+
class="skel v-${variant}"
|
|
220
|
+
style=${this.blockStyle()}
|
|
221
|
+
part="block"
|
|
222
|
+
></div>
|
|
223
|
+
`;
|
|
224
|
+
}
|
|
225
|
+
/** Stack de líneas con anchos decrecientes (la 1ª al 100%). */
|
|
226
|
+
renderStack() {
|
|
227
|
+
const n = Math.max(1, this.lines);
|
|
228
|
+
const cls = this.variant === "title" ? "v-title" : "v-text";
|
|
229
|
+
return html`
|
|
230
|
+
<div class="stack">
|
|
231
|
+
${Array.from(
|
|
232
|
+
{ length: n },
|
|
233
|
+
() => html`<div class="skel line ${cls}" part="line"></div>`
|
|
234
|
+
)}
|
|
235
|
+
</div>
|
|
236
|
+
`;
|
|
237
|
+
}
|
|
238
|
+
/** Preset card: avatar + dos líneas de meta + bloque de cuerpo + acciones. */
|
|
239
|
+
renderPresetCard() {
|
|
240
|
+
return html`
|
|
241
|
+
<div class="preset-card" part="card">
|
|
242
|
+
<div class="head">
|
|
243
|
+
<div class="skel v-avatar"></div>
|
|
244
|
+
<div class="meta">
|
|
245
|
+
<div class="skel v-title" style="width:50%"></div>
|
|
246
|
+
<div class="skel v-text" style="width:80%"></div>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
<div class="skel v-card" style="height:80px"></div>
|
|
250
|
+
<div class="head" style="justify-content:flex-end">
|
|
251
|
+
<div class="skel v-button"></div>
|
|
252
|
+
<div class="skel v-button" style="width:72px"></div>
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
`;
|
|
256
|
+
}
|
|
257
|
+
/** Preset table: replica la rejilla de ok-data-table (cabecera + filas). */
|
|
258
|
+
renderPresetTable() {
|
|
259
|
+
const cols = Math.max(1, this.cols);
|
|
260
|
+
const rows = Math.max(1, this.rows);
|
|
261
|
+
const template = Array.from({ length: cols }, (_, i) => {
|
|
262
|
+
if (i === 0) return "1.6fr";
|
|
263
|
+
if (i === cols - 1) return "0.6fr";
|
|
264
|
+
return "1fr";
|
|
265
|
+
}).join(" ");
|
|
266
|
+
const rowStyle = `grid-template-columns:${template}`;
|
|
267
|
+
const cell = () => html`<div class="skel v-text"></div>`;
|
|
268
|
+
return html`
|
|
269
|
+
<div class="preset-table" part="table">
|
|
270
|
+
<div class="trow head" style=${rowStyle}>
|
|
271
|
+
${Array.from({ length: cols }, cell)}
|
|
272
|
+
</div>
|
|
273
|
+
${Array.from(
|
|
274
|
+
{ length: rows },
|
|
275
|
+
() => html`<div class="trow" style=${rowStyle}>
|
|
276
|
+
${Array.from({ length: cols }, cell)}
|
|
277
|
+
</div>`
|
|
278
|
+
)}
|
|
279
|
+
</div>
|
|
280
|
+
`;
|
|
281
|
+
}
|
|
282
|
+
/** Preset chart: barras con alturas pseudo-variadas. */
|
|
283
|
+
renderPresetChart() {
|
|
284
|
+
const n = Math.max(1, this.cols);
|
|
285
|
+
const heights = [40, 70, 55, 90, 35, 65, 80, 50, 75, 45, 60, 85];
|
|
286
|
+
return html`
|
|
287
|
+
<div class="preset-chart" part="chart">
|
|
288
|
+
${Array.from(
|
|
289
|
+
{ length: n },
|
|
290
|
+
(_, i) => html`<div
|
|
291
|
+
class="bar"
|
|
292
|
+
style="height:${heights[i % heights.length]}%"
|
|
293
|
+
></div>`
|
|
294
|
+
)}
|
|
295
|
+
</div>
|
|
296
|
+
`;
|
|
297
|
+
}
|
|
298
|
+
render() {
|
|
299
|
+
let content;
|
|
300
|
+
switch (this.preset) {
|
|
301
|
+
case "card":
|
|
302
|
+
content = this.renderPresetCard();
|
|
303
|
+
break;
|
|
304
|
+
case "table":
|
|
305
|
+
content = this.renderPresetTable();
|
|
306
|
+
break;
|
|
307
|
+
case "chart":
|
|
308
|
+
content = this.renderPresetChart();
|
|
309
|
+
break;
|
|
310
|
+
default:
|
|
311
|
+
content = this.lines > 1 ? this.renderStack() : this.renderBlock();
|
|
312
|
+
}
|
|
313
|
+
return html`
|
|
314
|
+
<div role="status" aria-busy="true" aria-live="polite">${content}</div>
|
|
315
|
+
`;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
__decorateClass([
|
|
319
|
+
property()
|
|
320
|
+
], OkSkeleton.prototype, "variant");
|
|
321
|
+
__decorateClass([
|
|
322
|
+
property({ type: Number })
|
|
323
|
+
], OkSkeleton.prototype, "lines");
|
|
324
|
+
__decorateClass([
|
|
325
|
+
property()
|
|
326
|
+
], OkSkeleton.prototype, "width");
|
|
327
|
+
__decorateClass([
|
|
328
|
+
property()
|
|
329
|
+
], OkSkeleton.prototype, "height");
|
|
330
|
+
__decorateClass([
|
|
331
|
+
property()
|
|
332
|
+
], OkSkeleton.prototype, "radius");
|
|
333
|
+
__decorateClass([
|
|
334
|
+
property()
|
|
335
|
+
], OkSkeleton.prototype, "preset");
|
|
336
|
+
__decorateClass([
|
|
337
|
+
property({ type: Number })
|
|
338
|
+
], OkSkeleton.prototype, "rows");
|
|
339
|
+
__decorateClass([
|
|
340
|
+
property({ type: Number })
|
|
341
|
+
], OkSkeleton.prototype, "cols");
|
|
342
|
+
define("ok-skeleton", OkSkeleton);
|
|
343
|
+
export {
|
|
344
|
+
OkSkeleton
|
|
345
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { LitElement, css, svg, 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 OkSparkline extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.values = [];
|
|
17
|
+
this.type = "line";
|
|
18
|
+
this.color = "";
|
|
19
|
+
this.width = 120;
|
|
20
|
+
this.height = 32;
|
|
21
|
+
this.filled = false;
|
|
22
|
+
}
|
|
23
|
+
static {
|
|
24
|
+
this.styles = css`
|
|
25
|
+
:host {
|
|
26
|
+
/* Color por defecto: cadena --ok-* → --ion-* → hex. */
|
|
27
|
+
--color: var(--ok-primary, var(--ion-color-primary, #3880ff));
|
|
28
|
+
|
|
29
|
+
/* Sparkline = inline, fluye con el texto. */
|
|
30
|
+
display: inline-block;
|
|
31
|
+
line-height: 0;
|
|
32
|
+
vertical-align: middle;
|
|
33
|
+
}
|
|
34
|
+
svg {
|
|
35
|
+
display: block;
|
|
36
|
+
overflow: visible;
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
}
|
|
40
|
+
// Padding interno para que el trazo no se recorte en los bordes.
|
|
41
|
+
get pad() {
|
|
42
|
+
return 2;
|
|
43
|
+
}
|
|
44
|
+
// Color efectivo: prop explícita o el token del componente (--color).
|
|
45
|
+
get stroke() {
|
|
46
|
+
return this.color || "var(--color)";
|
|
47
|
+
}
|
|
48
|
+
// Mapea cada valor a coordenadas {x, y} dentro del área útil del SVG.
|
|
49
|
+
points() {
|
|
50
|
+
const data = this.values ?? [];
|
|
51
|
+
const n = data.length;
|
|
52
|
+
if (!n) return [];
|
|
53
|
+
const pad = this.pad;
|
|
54
|
+
const w = this.width - pad * 2;
|
|
55
|
+
const h = this.height - pad * 2;
|
|
56
|
+
const min = Math.min(...data);
|
|
57
|
+
const max = Math.max(...data);
|
|
58
|
+
const range = max - min || 1;
|
|
59
|
+
const step = n > 1 ? w / (n - 1) : 0;
|
|
60
|
+
return data.map((value, i) => {
|
|
61
|
+
const x = n > 1 ? pad + i * step : pad + w / 2;
|
|
62
|
+
const y = pad + (1 - (value - min) / range) * h;
|
|
63
|
+
return { x, y };
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
// Render de la serie como línea (polyline) + área opcional.
|
|
67
|
+
renderLine() {
|
|
68
|
+
const pts = this.points();
|
|
69
|
+
if (pts.length < 2) {
|
|
70
|
+
return pts.length === 1 ? svg`<circle cx=${pts[0].x} cy=${pts[0].y} r="2" fill=${this.stroke} />` : svg``;
|
|
71
|
+
}
|
|
72
|
+
const line = pts.map((p) => `${p.x},${p.y}`).join(" ");
|
|
73
|
+
const baseY = this.height - this.pad;
|
|
74
|
+
const area = `${pts[0].x},${baseY} ${line} ${pts[pts.length - 1].x},${baseY}`;
|
|
75
|
+
return svg`
|
|
76
|
+
${this.filled ? svg`<polygon points=${area} fill=${this.stroke} fill-opacity="0.15" stroke="none" />` : svg``}
|
|
77
|
+
<polyline
|
|
78
|
+
points=${line}
|
|
79
|
+
fill="none"
|
|
80
|
+
stroke=${this.stroke}
|
|
81
|
+
stroke-width="1.5"
|
|
82
|
+
stroke-linecap="round"
|
|
83
|
+
stroke-linejoin="round"
|
|
84
|
+
/>
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
// Render de la serie como barras escaladas a min/max.
|
|
88
|
+
renderBars() {
|
|
89
|
+
const data = this.values ?? [];
|
|
90
|
+
const n = data.length;
|
|
91
|
+
if (!n) return svg``;
|
|
92
|
+
const pad = this.pad;
|
|
93
|
+
const w = this.width - pad * 2;
|
|
94
|
+
const h = this.height - pad * 2;
|
|
95
|
+
const min = Math.min(...data, 0);
|
|
96
|
+
const max = Math.max(...data);
|
|
97
|
+
const range = max - min || 1;
|
|
98
|
+
const slot = w / n;
|
|
99
|
+
const gap = slot * 0.25;
|
|
100
|
+
const barW = Math.max(slot - gap, 1);
|
|
101
|
+
const baseY = this.height - pad;
|
|
102
|
+
return data.map((value, i) => {
|
|
103
|
+
const barH = (value - min) / range * h;
|
|
104
|
+
const x = pad + i * slot + gap / 2;
|
|
105
|
+
const y = baseY - barH;
|
|
106
|
+
return svg`<rect
|
|
107
|
+
x=${x}
|
|
108
|
+
y=${y}
|
|
109
|
+
width=${barW}
|
|
110
|
+
height=${Math.max(barH, 0.5)}
|
|
111
|
+
rx="1"
|
|
112
|
+
fill=${this.stroke}
|
|
113
|
+
/>`;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
render() {
|
|
117
|
+
return html`<svg
|
|
118
|
+
width=${this.width}
|
|
119
|
+
height=${this.height}
|
|
120
|
+
viewBox=${`0 0 ${this.width} ${this.height}`}
|
|
121
|
+
preserveAspectRatio="none"
|
|
122
|
+
role="img"
|
|
123
|
+
aria-hidden="true"
|
|
124
|
+
>
|
|
125
|
+
${this.type === "bar" ? this.renderBars() : this.renderLine()}
|
|
126
|
+
</svg>`;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
__decorateClass([
|
|
130
|
+
property({ attribute: false })
|
|
131
|
+
], OkSparkline.prototype, "values");
|
|
132
|
+
__decorateClass([
|
|
133
|
+
property()
|
|
134
|
+
], OkSparkline.prototype, "type");
|
|
135
|
+
__decorateClass([
|
|
136
|
+
property()
|
|
137
|
+
], OkSparkline.prototype, "color");
|
|
138
|
+
__decorateClass([
|
|
139
|
+
property({ type: Number })
|
|
140
|
+
], OkSparkline.prototype, "width");
|
|
141
|
+
__decorateClass([
|
|
142
|
+
property({ type: Number })
|
|
143
|
+
], OkSparkline.prototype, "height");
|
|
144
|
+
__decorateClass([
|
|
145
|
+
property({ type: Boolean })
|
|
146
|
+
], OkSparkline.prototype, "filled");
|
|
147
|
+
define("ok-sparkline", OkSparkline);
|
|
148
|
+
export {
|
|
149
|
+
OkSparkline
|
|
150
|
+
};
|