@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,67 @@
|
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { define } from "./define.js";
|
|
3
|
+
class OkFooter extends LitElement {
|
|
4
|
+
static {
|
|
5
|
+
this.styles = css`
|
|
6
|
+
:host {
|
|
7
|
+
--background: var(--ok-surface, var(--ion-card-background, #ffffff));
|
|
8
|
+
--color: var(--ok-text, var(--ion-text-color, #1c1b17));
|
|
9
|
+
--color-muted: var(--ok-muted, rgba(var(--ion-text-color-rgb, 24, 24, 27), 0.55));
|
|
10
|
+
--border-color: var(--ok-border, rgba(var(--ion-text-color-rgb, 24, 24, 27), 0.12));
|
|
11
|
+
--border-color-soft: var(--ok-border-soft, rgba(var(--ion-text-color-rgb, 24, 24, 27), 0.07));
|
|
12
|
+
--primary-color: var(--ok-primary, var(--ion-color-primary, #3880ff));
|
|
13
|
+
--max-width: var(--ok-container-max, 1140px);
|
|
14
|
+
--padding: var(--ok-spacing, var(--ion-padding, 16px));
|
|
15
|
+
--font: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
|
|
16
|
+
|
|
17
|
+
display: block;
|
|
18
|
+
background: var(--background);
|
|
19
|
+
border-top: 1px solid var(--border-color);
|
|
20
|
+
color: var(--color);
|
|
21
|
+
font-family: var(--font);
|
|
22
|
+
}
|
|
23
|
+
.wrap {
|
|
24
|
+
max-width: var(--max-width);
|
|
25
|
+
margin-inline: auto;
|
|
26
|
+
padding: 2rem var(--padding);
|
|
27
|
+
display: grid;
|
|
28
|
+
gap: 1.5rem;
|
|
29
|
+
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
|
30
|
+
}
|
|
31
|
+
.bottom {
|
|
32
|
+
border-top: 1px solid var(--border-color-soft);
|
|
33
|
+
padding: 1rem var(--padding);
|
|
34
|
+
text-align: center;
|
|
35
|
+
color: var(--color-muted);
|
|
36
|
+
font-size: 0.85rem;
|
|
37
|
+
max-width: var(--max-width);
|
|
38
|
+
margin-inline: auto;
|
|
39
|
+
}
|
|
40
|
+
::slotted(a) {
|
|
41
|
+
color: var(--color-muted);
|
|
42
|
+
text-decoration: none;
|
|
43
|
+
/* Micro-interacción: transición sutil en color al hacer hover. */
|
|
44
|
+
transition: background-color var(--ok-transition, 150ms ease), color var(--ok-transition, 150ms ease), border-color var(--ok-transition, 150ms ease), box-shadow var(--ok-transition, 150ms ease), transform 120ms ease;
|
|
45
|
+
}
|
|
46
|
+
/* Hover de enlaces solo con ratón (evita estados pegados en táctil). */
|
|
47
|
+
@media (hover: hover) {
|
|
48
|
+
::slotted(a:hover) { color: var(--primary-color); }
|
|
49
|
+
}
|
|
50
|
+
@media (prefers-reduced-motion: reduce) {
|
|
51
|
+
::slotted(a):active { transform: none; }
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
return html`
|
|
57
|
+
<footer>
|
|
58
|
+
<div class="wrap"><slot></slot></div>
|
|
59
|
+
<div class="bottom"><slot name="bottom"></slot></div>
|
|
60
|
+
</footer>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
define("ok-footer", OkFooter);
|
|
65
|
+
export {
|
|
66
|
+
OkFooter
|
|
67
|
+
};
|
|
@@ -0,0 +1,181 @@
|
|
|
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 OkFunnel extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.steps = [];
|
|
17
|
+
this.minWidth = 12;
|
|
18
|
+
}
|
|
19
|
+
static {
|
|
20
|
+
this.styles = css`
|
|
21
|
+
:host {
|
|
22
|
+
display: block;
|
|
23
|
+
width: 100%;
|
|
24
|
+
/* Tokens propios estilo Ionic (overridables): --ok-* → --ion-* → hex. */
|
|
25
|
+
--brand: var(--ok-color-primary, var(--ion-color-primary, #0091ce));
|
|
26
|
+
--brand-fg: var(
|
|
27
|
+
--ok-color-primary-contrast,
|
|
28
|
+
var(--ion-color-primary-contrast, #ffffff)
|
|
29
|
+
);
|
|
30
|
+
--leaf: var(--ok-color-success, var(--ion-color-success, #2dd36f));
|
|
31
|
+
--leaf-fg: var(
|
|
32
|
+
--ok-color-success-contrast,
|
|
33
|
+
var(--ion-color-success-contrast, #ffffff)
|
|
34
|
+
);
|
|
35
|
+
--warn: var(--ok-color-warning, var(--ion-color-warning, #ffc409));
|
|
36
|
+
--warn-fg: var(
|
|
37
|
+
--ok-color-warning-contrast,
|
|
38
|
+
var(--ion-color-warning-contrast, #1f2933)
|
|
39
|
+
);
|
|
40
|
+
--bg-3: var(--ok-color-step-150, var(--ion-color-step-150, #e6e8ec));
|
|
41
|
+
--ink: var(--ok-text-color, var(--ion-text-color, #1f2933));
|
|
42
|
+
--ink-2: var(--ok-color-medium, var(--ion-color-medium, #6b7280));
|
|
43
|
+
--ink-3: var(--ok-color-medium, var(--ion-color-medium, #92949c));
|
|
44
|
+
--radius: var(--ok-border-radius, var(--ion-border-radius, 6px));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.funnel {
|
|
48
|
+
display: flex;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
gap: 4px;
|
|
51
|
+
width: 100%;
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.step {
|
|
56
|
+
display: grid;
|
|
57
|
+
grid-template-columns: 1fr auto;
|
|
58
|
+
gap: 12px;
|
|
59
|
+
align-items: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.bar {
|
|
63
|
+
height: 32px;
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
background: linear-gradient(
|
|
66
|
+
90deg,
|
|
67
|
+
var(--brand),
|
|
68
|
+
color-mix(in oklch, var(--brand) 60%, var(--bg-3))
|
|
69
|
+
);
|
|
70
|
+
border-radius: var(--radius);
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
padding: 0 12px;
|
|
74
|
+
color: var(--brand-fg);
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
font-weight: 500;
|
|
77
|
+
min-width: 0;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
white-space: nowrap;
|
|
80
|
+
text-overflow: ellipsis;
|
|
81
|
+
transition: width 0.25s ease;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.bar--leaf {
|
|
85
|
+
background: linear-gradient(
|
|
86
|
+
90deg,
|
|
87
|
+
var(--leaf),
|
|
88
|
+
color-mix(in oklch, var(--leaf) 60%, var(--bg-3))
|
|
89
|
+
);
|
|
90
|
+
color: var(--leaf-fg);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.bar--warn {
|
|
94
|
+
background: linear-gradient(
|
|
95
|
+
90deg,
|
|
96
|
+
var(--warn),
|
|
97
|
+
color-mix(in oklch, var(--warn) 60%, var(--bg-3))
|
|
98
|
+
);
|
|
99
|
+
color: var(--warn-fg);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.bar--mute {
|
|
103
|
+
background: var(--bg-3);
|
|
104
|
+
color: var(--ink-2);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.meta {
|
|
108
|
+
font-size: 11.5px;
|
|
109
|
+
color: var(--ink-3);
|
|
110
|
+
font-variant-numeric: tabular-nums;
|
|
111
|
+
white-space: nowrap;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.meta b {
|
|
115
|
+
color: var(--ink);
|
|
116
|
+
font-weight: 600;
|
|
117
|
+
}
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
/** Formatea un número absoluto con separadores de miles. */
|
|
121
|
+
fmtCount(n) {
|
|
122
|
+
return new Intl.NumberFormat(this.locale).format(n);
|
|
123
|
+
}
|
|
124
|
+
/** Formatea un porcentaje con un decimal. */
|
|
125
|
+
fmtPct(n) {
|
|
126
|
+
return new Intl.NumberFormat(this.locale, {
|
|
127
|
+
maximumFractionDigits: 1
|
|
128
|
+
}).format(n);
|
|
129
|
+
}
|
|
130
|
+
render() {
|
|
131
|
+
const steps = this.steps ?? [];
|
|
132
|
+
const top = steps.length ? steps[0].value : 0;
|
|
133
|
+
return html`
|
|
134
|
+
<div
|
|
135
|
+
class="funnel"
|
|
136
|
+
role="list"
|
|
137
|
+
aria-label="Embudo de conversión"
|
|
138
|
+
>
|
|
139
|
+
${steps.map((s, i) => {
|
|
140
|
+
const ratio = top > 0 ? s.value / top : 0;
|
|
141
|
+
const width = Math.max(this.minWidth, Math.round(ratio * 100));
|
|
142
|
+
const globalPct = top > 0 ? s.value / top * 100 : 0;
|
|
143
|
+
const prev = i > 0 ? steps[i - 1].value : s.value;
|
|
144
|
+
const stepPct = prev > 0 ? s.value / prev * 100 : 0;
|
|
145
|
+
const variant = s.color ?? "brand";
|
|
146
|
+
const cls = variant === "brand" ? "bar" : `bar bar--${variant}`;
|
|
147
|
+
return html`
|
|
148
|
+
<div
|
|
149
|
+
class="step"
|
|
150
|
+
role="listitem"
|
|
151
|
+
aria-label=${`${s.label}: ${this.fmtCount(
|
|
152
|
+
s.value
|
|
153
|
+
)} (${this.fmtPct(globalPct)}%)`}
|
|
154
|
+
>
|
|
155
|
+
<div class=${cls} style=${`width:${width}%`} title=${s.label}>
|
|
156
|
+
${s.label}
|
|
157
|
+
</div>
|
|
158
|
+
<span class="meta">
|
|
159
|
+
<b>${this.fmtCount(s.value)}</b> ·
|
|
160
|
+
${i === 0 ? `${this.fmtPct(globalPct)}%` : `${this.fmtPct(stepPct)}%`}
|
|
161
|
+
</span>
|
|
162
|
+
</div>
|
|
163
|
+
`;
|
|
164
|
+
})}
|
|
165
|
+
</div>
|
|
166
|
+
`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
__decorateClass([
|
|
170
|
+
property({ attribute: false })
|
|
171
|
+
], OkFunnel.prototype, "steps");
|
|
172
|
+
__decorateClass([
|
|
173
|
+
property()
|
|
174
|
+
], OkFunnel.prototype, "locale");
|
|
175
|
+
__decorateClass([
|
|
176
|
+
property({ type: Number, attribute: "min-width" })
|
|
177
|
+
], OkFunnel.prototype, "minWidth");
|
|
178
|
+
define("ok-funnel", OkFunnel);
|
|
179
|
+
export {
|
|
180
|
+
OkFunnel
|
|
181
|
+
};
|
|
@@ -0,0 +1,293 @@
|
|
|
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 OkGallery extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.images = [];
|
|
17
|
+
this.selectable = false;
|
|
18
|
+
this.selected = [];
|
|
19
|
+
this.minSize = 160;
|
|
20
|
+
this.columns = 0;
|
|
21
|
+
}
|
|
22
|
+
static {
|
|
23
|
+
this.styles = css`
|
|
24
|
+
:host {
|
|
25
|
+
display: block;
|
|
26
|
+
width: 100%;
|
|
27
|
+
/* Tokens overridables estilo Ionic: cadena --ok-* → --ion-* → hex. */
|
|
28
|
+
--gap: var(--ok-gallery-gap, 8px);
|
|
29
|
+
--radius: var(--ok-gallery-radius, var(--ion-border-radius, 10px));
|
|
30
|
+
--brand: var(--ok-primary, var(--ion-color-primary, #3880ff));
|
|
31
|
+
--brand-contrast: var(
|
|
32
|
+
--ok-primary-contrast,
|
|
33
|
+
var(--ion-color-primary-contrast, #ffffff)
|
|
34
|
+
);
|
|
35
|
+
--placeholder-bg: var(--ok-gallery-ph, var(--ion-color-light, #e6e8ec));
|
|
36
|
+
--placeholder-bg-2: var(
|
|
37
|
+
--ok-gallery-ph-2,
|
|
38
|
+
var(--ion-color-light-shade, #cfd2d8)
|
|
39
|
+
);
|
|
40
|
+
--placeholder-ink: var(
|
|
41
|
+
--ok-gallery-ph-ink,
|
|
42
|
+
var(--ion-color-medium, #92949c)
|
|
43
|
+
);
|
|
44
|
+
--caption-color: var(--ok-gallery-caption, #ffffff);
|
|
45
|
+
--min-size: 160px;
|
|
46
|
+
--columns: 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.grid {
|
|
50
|
+
display: grid;
|
|
51
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--min-size), 1fr));
|
|
52
|
+
gap: var(--gap);
|
|
53
|
+
width: 100%;
|
|
54
|
+
}
|
|
55
|
+
/* Cuando se fuerza un número fijo de columnas. */
|
|
56
|
+
:host([columns]) .grid {
|
|
57
|
+
grid-template-columns: repeat(var(--columns), 1fr);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.item {
|
|
61
|
+
position: relative;
|
|
62
|
+
aspect-ratio: 1;
|
|
63
|
+
background: var(--placeholder-bg);
|
|
64
|
+
border-radius: var(--radius);
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
transition: transform 180ms ease-out;
|
|
68
|
+
padding: 0;
|
|
69
|
+
border: none;
|
|
70
|
+
width: 100%;
|
|
71
|
+
display: block;
|
|
72
|
+
font: inherit;
|
|
73
|
+
color: inherit;
|
|
74
|
+
text-align: left;
|
|
75
|
+
}
|
|
76
|
+
.item:hover {
|
|
77
|
+
transform: scale(1.02);
|
|
78
|
+
}
|
|
79
|
+
.item:focus-visible {
|
|
80
|
+
outline: 2px solid var(--brand);
|
|
81
|
+
outline-offset: 2px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.item img {
|
|
85
|
+
width: 100%;
|
|
86
|
+
height: 100%;
|
|
87
|
+
object-fit: cover;
|
|
88
|
+
display: block;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* Placeholder de rayas diagonales para imágenes sin src. */
|
|
92
|
+
.item--ph {
|
|
93
|
+
background: repeating-linear-gradient(
|
|
94
|
+
45deg,
|
|
95
|
+
var(--placeholder-bg) 0 8px,
|
|
96
|
+
var(--placeholder-bg-2) 8px 16px
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
.ph-label {
|
|
100
|
+
position: absolute;
|
|
101
|
+
inset: 0;
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
font-family: var(--ok-font-mono, ui-monospace, monospace);
|
|
106
|
+
font-size: 10.5px;
|
|
107
|
+
color: var(--placeholder-ink);
|
|
108
|
+
text-transform: uppercase;
|
|
109
|
+
letter-spacing: 0.06em;
|
|
110
|
+
padding: 4px;
|
|
111
|
+
text-align: center;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Caption inferior con gradiente, aparece al hover. */
|
|
115
|
+
.caption {
|
|
116
|
+
position: absolute;
|
|
117
|
+
inset: auto 0 0 0;
|
|
118
|
+
padding: 24px 10px 8px;
|
|
119
|
+
background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent);
|
|
120
|
+
color: var(--caption-color);
|
|
121
|
+
font-size: 11.5px;
|
|
122
|
+
font-weight: 500;
|
|
123
|
+
opacity: 0;
|
|
124
|
+
transition: opacity 180ms ease-out;
|
|
125
|
+
pointer-events: none;
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
overflow: hidden;
|
|
128
|
+
text-overflow: ellipsis;
|
|
129
|
+
}
|
|
130
|
+
.item:hover .caption,
|
|
131
|
+
.item:focus-visible .caption {
|
|
132
|
+
opacity: 1;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* Badge circular de selección arriba-derecha. */
|
|
136
|
+
.select {
|
|
137
|
+
position: absolute;
|
|
138
|
+
top: 8px;
|
|
139
|
+
right: 8px;
|
|
140
|
+
width: 22px;
|
|
141
|
+
height: 22px;
|
|
142
|
+
border-radius: 50%;
|
|
143
|
+
background: rgba(0, 0, 0, 0.45);
|
|
144
|
+
border: 2px solid #ffffff;
|
|
145
|
+
display: inline-flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: center;
|
|
148
|
+
color: #ffffff;
|
|
149
|
+
opacity: 0;
|
|
150
|
+
cursor: pointer;
|
|
151
|
+
padding: 0;
|
|
152
|
+
transition: opacity 180ms ease-out, background 180ms ease-out;
|
|
153
|
+
}
|
|
154
|
+
.select svg {
|
|
155
|
+
width: 13px;
|
|
156
|
+
height: 13px;
|
|
157
|
+
display: none;
|
|
158
|
+
}
|
|
159
|
+
.item:hover .select,
|
|
160
|
+
.item:focus-within .select {
|
|
161
|
+
opacity: 1;
|
|
162
|
+
}
|
|
163
|
+
.select:focus-visible {
|
|
164
|
+
opacity: 1;
|
|
165
|
+
outline: 2px solid var(--brand-contrast);
|
|
166
|
+
outline-offset: 1px;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* Estado seleccionado: badge relleno de marca + outline en el item. */
|
|
170
|
+
.item--selected .select {
|
|
171
|
+
opacity: 1;
|
|
172
|
+
background: var(--brand);
|
|
173
|
+
border-color: var(--brand);
|
|
174
|
+
color: var(--brand-contrast);
|
|
175
|
+
}
|
|
176
|
+
.item--selected .select svg {
|
|
177
|
+
display: block;
|
|
178
|
+
}
|
|
179
|
+
.item--selected {
|
|
180
|
+
outline: 2px solid var(--brand);
|
|
181
|
+
outline-offset: -2px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
@media (prefers-reduced-motion: reduce) {
|
|
185
|
+
.item,
|
|
186
|
+
.caption,
|
|
187
|
+
.select {
|
|
188
|
+
transition: none;
|
|
189
|
+
}
|
|
190
|
+
.item:hover {
|
|
191
|
+
transform: none;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
`;
|
|
195
|
+
}
|
|
196
|
+
// Devuelve la clave de selección de una imagen: su id, o el índice como fallback.
|
|
197
|
+
keyOf(img, index) {
|
|
198
|
+
return img.id ?? index;
|
|
199
|
+
}
|
|
200
|
+
isSelected(key) {
|
|
201
|
+
return this.selected.includes(key);
|
|
202
|
+
}
|
|
203
|
+
// Alterna la selección y emite `ok-select` con la nueva lista.
|
|
204
|
+
toggle(img, index, ev) {
|
|
205
|
+
ev.stopPropagation();
|
|
206
|
+
const key = this.keyOf(img, index);
|
|
207
|
+
const next = this.isSelected(key) ? this.selected.filter((k) => k !== key) : [...this.selected, key];
|
|
208
|
+
this.selected = next;
|
|
209
|
+
this.dispatchEvent(
|
|
210
|
+
new CustomEvent("ok-select", {
|
|
211
|
+
detail: { id: key, index, selected: next },
|
|
212
|
+
bubbles: true,
|
|
213
|
+
composed: true
|
|
214
|
+
})
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
// Abre la imagen (para emparejar con ok-lightbox). Emite `ok-open`.
|
|
218
|
+
open(img, index) {
|
|
219
|
+
this.dispatchEvent(
|
|
220
|
+
new CustomEvent("ok-open", {
|
|
221
|
+
detail: { id: this.keyOf(img, index), index, image: img },
|
|
222
|
+
bubbles: true,
|
|
223
|
+
composed: true
|
|
224
|
+
})
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
render() {
|
|
228
|
+
return html`
|
|
229
|
+
<div
|
|
230
|
+
class="grid"
|
|
231
|
+
role="${this.selectable ? "listbox" : "list"}"
|
|
232
|
+
aria-multiselectable="${this.selectable ? "true" : "false"}"
|
|
233
|
+
style="--min-size:${this.minSize}px;--columns:${this.columns};"
|
|
234
|
+
>
|
|
235
|
+
${this.images.map((img, index) => {
|
|
236
|
+
const key = this.keyOf(img, index);
|
|
237
|
+
const sel = this.selectable && this.isSelected(key);
|
|
238
|
+
const isPh = !img.src;
|
|
239
|
+
return html`
|
|
240
|
+
<button
|
|
241
|
+
type="button"
|
|
242
|
+
class="item ${isPh ? "item--ph" : ""} ${sel ? "item--selected" : ""}"
|
|
243
|
+
role="${this.selectable ? "option" : "listitem"}"
|
|
244
|
+
aria-selected="${this.selectable ? String(sel) : "undefined"}"
|
|
245
|
+
aria-label="${img.alt || img.label || `Imagen ${index + 1}`}"
|
|
246
|
+
@click=${() => this.open(img, index)}
|
|
247
|
+
>
|
|
248
|
+
${isPh ? html`<span class="ph-label">${img.label || ""}</span>` : html`<img src="${img.src}" alt="${img.alt || ""}" loading="lazy" />`}
|
|
249
|
+
${img.label ? html`<span class="caption">${img.label}</span>` : null}
|
|
250
|
+
${this.selectable ? html`<span
|
|
251
|
+
class="select"
|
|
252
|
+
role="checkbox"
|
|
253
|
+
aria-checked="${String(sel)}"
|
|
254
|
+
aria-label="Seleccionar"
|
|
255
|
+
tabindex="0"
|
|
256
|
+
@click=${(e) => this.toggle(img, index, e)}
|
|
257
|
+
@keydown=${(e) => {
|
|
258
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
259
|
+
this.toggle(img, index, e);
|
|
260
|
+
}
|
|
261
|
+
}}
|
|
262
|
+
>${selectIcon}</span
|
|
263
|
+
>` : null}
|
|
264
|
+
</button>
|
|
265
|
+
`;
|
|
266
|
+
})}
|
|
267
|
+
</div>
|
|
268
|
+
`;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
__decorateClass([
|
|
272
|
+
property({ attribute: false })
|
|
273
|
+
], OkGallery.prototype, "images");
|
|
274
|
+
__decorateClass([
|
|
275
|
+
property({ type: Boolean, reflect: true })
|
|
276
|
+
], OkGallery.prototype, "selectable");
|
|
277
|
+
__decorateClass([
|
|
278
|
+
property({ attribute: false })
|
|
279
|
+
], OkGallery.prototype, "selected");
|
|
280
|
+
__decorateClass([
|
|
281
|
+
property({ type: Number, attribute: "min-size" })
|
|
282
|
+
], OkGallery.prototype, "minSize");
|
|
283
|
+
__decorateClass([
|
|
284
|
+
property({ type: Number, reflect: true })
|
|
285
|
+
], OkGallery.prototype, "columns");
|
|
286
|
+
const selectIcon = html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
|
287
|
+
stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
288
|
+
<path d="M5 13l4 4L19 7" />
|
|
289
|
+
</svg>`;
|
|
290
|
+
define("ok-gallery", OkGallery);
|
|
291
|
+
export {
|
|
292
|
+
OkGallery
|
|
293
|
+
};
|