@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,163 @@
|
|
|
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 OkStatusDot extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.tone = "off";
|
|
17
|
+
this.size = "md";
|
|
18
|
+
this.pulse = false;
|
|
19
|
+
this.showLabel = false;
|
|
20
|
+
}
|
|
21
|
+
static {
|
|
22
|
+
this.styles = css`
|
|
23
|
+
:host {
|
|
24
|
+
/* Átomo inline: ocupa solo su contenido. */
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
vertical-align: middle;
|
|
28
|
+
/* Tono por defecto (off). Cada variante reescribe --dot-color en :host([tone=...]). */
|
|
29
|
+
--dot-color: var(--ok-color-medium, var(--ion-color-medium, #92949c));
|
|
30
|
+
--dot-size: 0.625rem;
|
|
31
|
+
--label-color: var(--ok-text-color, var(--ion-text-color, #1f2933));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* ---- Tonos: --ok-* → --ion-color-* → hex (tomados del diseño ux antiguo) ---- */
|
|
35
|
+
:host([tone='ok']) {
|
|
36
|
+
--dot-color: var(--ok-color-success, var(--ion-color-success, #4f9d6e));
|
|
37
|
+
}
|
|
38
|
+
:host([tone='warn']) {
|
|
39
|
+
--dot-color: var(--ok-color-warning, var(--ion-color-warning, #d8a23a));
|
|
40
|
+
}
|
|
41
|
+
:host([tone='danger']) {
|
|
42
|
+
--dot-color: var(--ok-color-danger, var(--ion-color-danger, #d8553f));
|
|
43
|
+
}
|
|
44
|
+
:host([tone='info']) {
|
|
45
|
+
--dot-color: var(--ok-color-primary, var(--ion-color-primary, #3880ff));
|
|
46
|
+
}
|
|
47
|
+
:host([tone='off']) {
|
|
48
|
+
--dot-color: var(--ok-color-medium, var(--ion-color-medium, #92949c));
|
|
49
|
+
}
|
|
50
|
+
:host([tone='brand']) {
|
|
51
|
+
--dot-color: var(--ok-color-secondary, var(--ion-color-secondary, #0091ce));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* ---- Tamaños ---- */
|
|
55
|
+
:host([size='sm']) {
|
|
56
|
+
--dot-size: 0.5rem;
|
|
57
|
+
}
|
|
58
|
+
:host([size='lg']) {
|
|
59
|
+
--dot-size: 0.875rem;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.wrap {
|
|
63
|
+
display: inline-flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: 0.375rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dot {
|
|
69
|
+
position: relative;
|
|
70
|
+
flex-shrink: 0;
|
|
71
|
+
width: var(--dot-size);
|
|
72
|
+
height: var(--dot-size);
|
|
73
|
+
border-radius: 999px;
|
|
74
|
+
background: var(--dot-color);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Aro de pulso: halo que escala y se desvanece como señal "en vivo". */
|
|
78
|
+
:host([pulse]) .dot::after {
|
|
79
|
+
content: '';
|
|
80
|
+
position: absolute;
|
|
81
|
+
inset: 0;
|
|
82
|
+
border-radius: inherit;
|
|
83
|
+
background: var(--dot-color);
|
|
84
|
+
animation: ok-status-pulse 1.6s ease-out infinite;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@keyframes ok-status-pulse {
|
|
88
|
+
0% {
|
|
89
|
+
transform: scale(1);
|
|
90
|
+
opacity: 0.55;
|
|
91
|
+
}
|
|
92
|
+
70% {
|
|
93
|
+
transform: scale(2.6);
|
|
94
|
+
opacity: 0;
|
|
95
|
+
}
|
|
96
|
+
100% {
|
|
97
|
+
transform: scale(2.6);
|
|
98
|
+
opacity: 0;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@media (prefers-reduced-motion: reduce) {
|
|
103
|
+
:host([pulse]) .dot::after {
|
|
104
|
+
animation: none;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.label {
|
|
109
|
+
font-size: 0.8125rem;
|
|
110
|
+
font-weight: 500;
|
|
111
|
+
color: var(--label-color);
|
|
112
|
+
line-height: 1.2;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Etiqueta accesible oculta visualmente (sr-only). */
|
|
116
|
+
.sr-only {
|
|
117
|
+
position: absolute;
|
|
118
|
+
width: 1px;
|
|
119
|
+
height: 1px;
|
|
120
|
+
padding: 0;
|
|
121
|
+
margin: -1px;
|
|
122
|
+
overflow: hidden;
|
|
123
|
+
clip: rect(0, 0, 0, 0);
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
border: 0;
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
128
|
+
}
|
|
129
|
+
render() {
|
|
130
|
+
const labelInline = this.label && this.showLabel;
|
|
131
|
+
const labelSr = this.label && !this.showLabel;
|
|
132
|
+
return html`
|
|
133
|
+
<span
|
|
134
|
+
class="wrap"
|
|
135
|
+
role="img"
|
|
136
|
+
aria-label=${this.label ?? this.tone}
|
|
137
|
+
>
|
|
138
|
+
<span class="dot"></span>
|
|
139
|
+
${labelInline ? html`<span class="label">${this.label}</span>` : null}
|
|
140
|
+
${labelSr ? html`<span class="sr-only">${this.label}</span>` : null}
|
|
141
|
+
</span>
|
|
142
|
+
`;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
__decorateClass([
|
|
146
|
+
property({ reflect: true })
|
|
147
|
+
], OkStatusDot.prototype, "tone");
|
|
148
|
+
__decorateClass([
|
|
149
|
+
property({ reflect: true })
|
|
150
|
+
], OkStatusDot.prototype, "size");
|
|
151
|
+
__decorateClass([
|
|
152
|
+
property({ type: Boolean, reflect: true })
|
|
153
|
+
], OkStatusDot.prototype, "pulse");
|
|
154
|
+
__decorateClass([
|
|
155
|
+
property()
|
|
156
|
+
], OkStatusDot.prototype, "label");
|
|
157
|
+
__decorateClass([
|
|
158
|
+
property({ type: Boolean, attribute: "show-label" })
|
|
159
|
+
], OkStatusDot.prototype, "showLabel");
|
|
160
|
+
define("ok-status-dot", OkStatusDot);
|
|
161
|
+
export {
|
|
162
|
+
OkStatusDot
|
|
163
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
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 OkStatusPill extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.tone = "neutral";
|
|
17
|
+
this.dot = false;
|
|
18
|
+
this.size = "md";
|
|
19
|
+
}
|
|
20
|
+
static {
|
|
21
|
+
this.styles = css`
|
|
22
|
+
:host {
|
|
23
|
+
/* Vars overridable (estilo Ionic), default = cadena --ok-* → --ion-* → hex.
|
|
24
|
+
--tone-color (base: fondo/punto/icono) y --tone-shade (texto) se reasignan por tone abajo. */
|
|
25
|
+
--tone-color: var(--ok-medium, var(--ion-color-medium, #5f5f5f));
|
|
26
|
+
--tone-shade: var(--ok-medium, var(--ion-color-medium-shade, #545454));
|
|
27
|
+
--background-opacity: var(--ok-pill-bg-opacity, 0.14);
|
|
28
|
+
--border-radius: var(--ok-pill-radius, 999px);
|
|
29
|
+
--font: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
|
|
30
|
+
|
|
31
|
+
/* Inline: el pill vive en celdas de tabla, cabeceras y listados. */
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
vertical-align: middle;
|
|
34
|
+
font-family: var(--font);
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* Mapa de tonos → color Ionic (base + shade para el texto). */
|
|
39
|
+
:host([tone='success']) {
|
|
40
|
+
--tone-color: var(--ok-success, var(--ion-color-success, #2dd55b));
|
|
41
|
+
--tone-shade: var(--ok-success, var(--ion-color-success-shade, #28bb50));
|
|
42
|
+
}
|
|
43
|
+
:host([tone='warning']) {
|
|
44
|
+
--tone-color: var(--ok-warning, var(--ion-color-warning, #ffc409));
|
|
45
|
+
--tone-shade: var(--ok-warning-shade, var(--ion-color-warning-shade, #e0ac08));
|
|
46
|
+
}
|
|
47
|
+
:host([tone='danger']) {
|
|
48
|
+
--tone-color: var(--ok-danger, var(--ion-color-danger, #c5000f));
|
|
49
|
+
--tone-shade: var(--ok-danger, var(--ion-color-danger-shade, #ad000d));
|
|
50
|
+
}
|
|
51
|
+
:host([tone='info']) {
|
|
52
|
+
--tone-color: var(--ok-info, var(--ion-color-secondary, #0163aa));
|
|
53
|
+
--tone-shade: var(--ok-info, var(--ion-color-secondary-shade, #015896));
|
|
54
|
+
}
|
|
55
|
+
:host([tone='primary']) {
|
|
56
|
+
--tone-color: var(--ok-primary, var(--ion-color-primary, #3880ff));
|
|
57
|
+
--tone-shade: var(--ok-primary, var(--ion-color-primary-shade, #3171e0));
|
|
58
|
+
}
|
|
59
|
+
/* neutral / sin tono → medium (default ya aplicado en :host). */
|
|
60
|
+
|
|
61
|
+
.pill {
|
|
62
|
+
display: inline-flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
gap: 0.4em;
|
|
65
|
+
padding: 0.25em 0.7em;
|
|
66
|
+
border-radius: var(--border-radius);
|
|
67
|
+
/* Fondo tonal: el color del tono con baja opacidad. */
|
|
68
|
+
background: color-mix(in srgb, var(--tone-color) calc(var(--background-opacity) * 100%), transparent);
|
|
69
|
+
color: var(--ok-pill-color, var(--tone-shade));
|
|
70
|
+
font-size: 0.8125rem;
|
|
71
|
+
font-weight: 600;
|
|
72
|
+
line-height: 1.4;
|
|
73
|
+
white-space: nowrap;
|
|
74
|
+
}
|
|
75
|
+
:host([size='sm']) .pill {
|
|
76
|
+
font-size: 0.72rem;
|
|
77
|
+
padding: 0.2em 0.6em;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
ion-icon {
|
|
81
|
+
flex: 0 0 auto;
|
|
82
|
+
font-size: 1.05em;
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Punto de color (estilo Linear) en vez de icono. */
|
|
87
|
+
.dot {
|
|
88
|
+
flex: 0 0 auto;
|
|
89
|
+
width: 0.5em;
|
|
90
|
+
height: 0.5em;
|
|
91
|
+
border-radius: 50%;
|
|
92
|
+
background: var(--tone-color);
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
}
|
|
96
|
+
render() {
|
|
97
|
+
return html`
|
|
98
|
+
<span class="pill" part="pill">
|
|
99
|
+
${this.dot ? html`<span class="dot" part="dot" aria-hidden="true"></span>` : this.icon ? html`<ion-icon name=${this.icon} aria-hidden="true"></ion-icon>` : null}
|
|
100
|
+
<slot>${this.label ?? ""}</slot>
|
|
101
|
+
</span>
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
__decorateClass([
|
|
106
|
+
property({ type: String, reflect: true })
|
|
107
|
+
], OkStatusPill.prototype, "tone");
|
|
108
|
+
__decorateClass([
|
|
109
|
+
property({ type: String })
|
|
110
|
+
], OkStatusPill.prototype, "label");
|
|
111
|
+
__decorateClass([
|
|
112
|
+
property({ type: String })
|
|
113
|
+
], OkStatusPill.prototype, "icon");
|
|
114
|
+
__decorateClass([
|
|
115
|
+
property({ type: Boolean, reflect: true })
|
|
116
|
+
], OkStatusPill.prototype, "dot");
|
|
117
|
+
__decorateClass([
|
|
118
|
+
property({ type: String, reflect: true })
|
|
119
|
+
], OkStatusPill.prototype, "size");
|
|
120
|
+
define("ok-status-pill", OkStatusPill);
|
|
121
|
+
export {
|
|
122
|
+
OkStatusPill
|
|
123
|
+
};
|
|
@@ -0,0 +1,299 @@
|
|
|
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 DEFAULT_LABELS = {
|
|
14
|
+
stepCount: "Step {n} of {total}"
|
|
15
|
+
};
|
|
16
|
+
class OkStepper extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.steps = [];
|
|
20
|
+
this.current = 0;
|
|
21
|
+
this.labels = {};
|
|
22
|
+
}
|
|
23
|
+
static {
|
|
24
|
+
this.styles = css`
|
|
25
|
+
/* Theming en dos capas: cadena --ok-* → --ion-* → hex (sin variables privadas). */
|
|
26
|
+
:host {
|
|
27
|
+
display: block;
|
|
28
|
+
width: 100%;
|
|
29
|
+
max-width: 100%;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
/* Colores derivados del tema, overridable por componente al estilo Ionic. */
|
|
32
|
+
--color-primary: var(--ok-color-primary, var(--ion-color-primary, #3880ff));
|
|
33
|
+
--color-on-primary: var(--ok-color-primary-contrast, var(--ion-color-primary-contrast, #fff));
|
|
34
|
+
--color-muted: var(--ok-color-medium, var(--ion-color-medium, #92949c));
|
|
35
|
+
--color-line: var(--ok-border-color, var(--ion-border-color, #e0e0e0));
|
|
36
|
+
--color-text: var(--ok-text-color, var(--ion-text-color, #1f2937));
|
|
37
|
+
--circle-size: 2rem;
|
|
38
|
+
font-family: var(--ok-font-family, var(--ion-font-family, inherit));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* ---------- Vista desktop (horizontal) ---------- */
|
|
42
|
+
.steps {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: flex-start;
|
|
45
|
+
width: 100%;
|
|
46
|
+
list-style: none;
|
|
47
|
+
margin: 0;
|
|
48
|
+
padding: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.step {
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
align-items: center;
|
|
55
|
+
flex: 1 1 0;
|
|
56
|
+
min-width: 0;
|
|
57
|
+
position: relative;
|
|
58
|
+
text-align: center;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Botón clicable (todo el bloque círculo+texto). CSP-safe: sin handlers inline. */
|
|
62
|
+
.step-btn {
|
|
63
|
+
appearance: none;
|
|
64
|
+
background: transparent;
|
|
65
|
+
border: 0;
|
|
66
|
+
padding: 0;
|
|
67
|
+
margin: 0;
|
|
68
|
+
width: 100%;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
color: inherit;
|
|
71
|
+
font: inherit;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: 0.375rem;
|
|
76
|
+
transition: background-color var(--ok-transition, 150ms ease),
|
|
77
|
+
color var(--ok-transition, 150ms ease), border-color var(--ok-transition, 150ms ease),
|
|
78
|
+
box-shadow var(--ok-transition, 150ms ease), transform 120ms ease;
|
|
79
|
+
}
|
|
80
|
+
.step-btn:focus-visible {
|
|
81
|
+
outline: 2px solid var(--color-primary);
|
|
82
|
+
outline-offset: 2px;
|
|
83
|
+
border-radius: 0.5rem;
|
|
84
|
+
}
|
|
85
|
+
/* Hover sutil solo con ratón: el círculo se acerca al primary. */
|
|
86
|
+
@media (hover: hover) {
|
|
87
|
+
.step-btn:hover .circle {
|
|
88
|
+
border-color: var(--color-primary);
|
|
89
|
+
color: var(--color-primary);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
.step-btn:active {
|
|
93
|
+
transform: scale(var(--ok-press-scale, 0.97));
|
|
94
|
+
}
|
|
95
|
+
@media (prefers-reduced-motion: reduce) {
|
|
96
|
+
.step-btn:active {
|
|
97
|
+
transform: none;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* La línea conectora se dibuja a la izquierda de cada círculo (excepto el primero). */
|
|
102
|
+
.step:not(:first-child) .circle-row::before {
|
|
103
|
+
content: '';
|
|
104
|
+
position: absolute;
|
|
105
|
+
top: calc(var(--circle-size) / 2);
|
|
106
|
+
right: 50%;
|
|
107
|
+
left: -50%;
|
|
108
|
+
height: 2px;
|
|
109
|
+
background: var(--color-line);
|
|
110
|
+
z-index: 0;
|
|
111
|
+
}
|
|
112
|
+
/* Si el paso es <= current, la línea entrante se pinta como completada. */
|
|
113
|
+
.step.completed .circle-row::before,
|
|
114
|
+
.step.active .circle-row::before {
|
|
115
|
+
background: var(--color-primary);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.circle-row {
|
|
119
|
+
position: relative;
|
|
120
|
+
display: flex;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
width: 100%;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.circle {
|
|
126
|
+
position: relative;
|
|
127
|
+
z-index: 1;
|
|
128
|
+
width: var(--circle-size);
|
|
129
|
+
height: var(--circle-size);
|
|
130
|
+
border-radius: 50%;
|
|
131
|
+
display: inline-flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
justify-content: center;
|
|
134
|
+
font-size: 0.875rem;
|
|
135
|
+
font-weight: 600;
|
|
136
|
+
border: 2px solid var(--color-line);
|
|
137
|
+
background: var(--ok-background, var(--ion-background-color, #fff));
|
|
138
|
+
color: var(--color-muted);
|
|
139
|
+
transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* Pendiente: muted (por defecto). Completado: relleno primary con check. */
|
|
143
|
+
.step.completed .circle {
|
|
144
|
+
background: var(--color-primary);
|
|
145
|
+
border-color: var(--color-primary);
|
|
146
|
+
color: var(--color-on-primary);
|
|
147
|
+
}
|
|
148
|
+
/* Activo: resaltado con anillo. */
|
|
149
|
+
.step.active .circle {
|
|
150
|
+
border-color: var(--color-primary);
|
|
151
|
+
color: var(--color-primary);
|
|
152
|
+
box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-primary) 18%, transparent);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.circle ion-icon {
|
|
156
|
+
font-size: 1.125rem;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.labels {
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
gap: 0.125rem;
|
|
163
|
+
padding: 0 0.25rem;
|
|
164
|
+
}
|
|
165
|
+
.label {
|
|
166
|
+
font-size: 0.8125rem;
|
|
167
|
+
font-weight: 500;
|
|
168
|
+
color: var(--color-muted);
|
|
169
|
+
line-height: 1.25;
|
|
170
|
+
overflow-wrap: anywhere;
|
|
171
|
+
}
|
|
172
|
+
.step.active .label {
|
|
173
|
+
color: var(--color-text);
|
|
174
|
+
font-weight: 600;
|
|
175
|
+
}
|
|
176
|
+
.step.completed .label {
|
|
177
|
+
color: var(--color-text);
|
|
178
|
+
}
|
|
179
|
+
.description {
|
|
180
|
+
font-size: 0.75rem;
|
|
181
|
+
color: var(--color-muted);
|
|
182
|
+
line-height: 1.2;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/* ---------- Vista móvil (compacta) ---------- */
|
|
186
|
+
.compact {
|
|
187
|
+
display: none;
|
|
188
|
+
align-items: center;
|
|
189
|
+
gap: 0.625rem;
|
|
190
|
+
width: 100%;
|
|
191
|
+
}
|
|
192
|
+
.compact .circle {
|
|
193
|
+
flex: 0 0 auto;
|
|
194
|
+
}
|
|
195
|
+
.compact-text {
|
|
196
|
+
display: flex;
|
|
197
|
+
flex-direction: column;
|
|
198
|
+
min-width: 0;
|
|
199
|
+
}
|
|
200
|
+
.compact-count {
|
|
201
|
+
font-size: 0.75rem;
|
|
202
|
+
color: var(--color-muted);
|
|
203
|
+
font-weight: 500;
|
|
204
|
+
}
|
|
205
|
+
.compact-label {
|
|
206
|
+
font-size: 0.9375rem;
|
|
207
|
+
font-weight: 600;
|
|
208
|
+
color: var(--color-text);
|
|
209
|
+
overflow: hidden;
|
|
210
|
+
text-overflow: ellipsis;
|
|
211
|
+
white-space: nowrap;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* Breakpoint: por debajo de 640px colapsamos a la vista compacta. */
|
|
215
|
+
@media (max-width: 640px) {
|
|
216
|
+
.steps {
|
|
217
|
+
display: none;
|
|
218
|
+
}
|
|
219
|
+
.compact {
|
|
220
|
+
display: flex;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
`;
|
|
224
|
+
}
|
|
225
|
+
/** Textos efectivos: defaults INGLÉS mezclados con los del consumidor. */
|
|
226
|
+
get t() {
|
|
227
|
+
return { ...DEFAULT_LABELS, ...this.labels };
|
|
228
|
+
}
|
|
229
|
+
/** Emite ok-step-select al pulsar un paso. */
|
|
230
|
+
_select(index) {
|
|
231
|
+
this.dispatchEvent(
|
|
232
|
+
new CustomEvent("ok-step-select", {
|
|
233
|
+
detail: { index },
|
|
234
|
+
bubbles: true,
|
|
235
|
+
composed: true
|
|
236
|
+
})
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
/** Estado de un paso respecto al actual. */
|
|
240
|
+
_stateClass(i) {
|
|
241
|
+
if (i < this.current) return "completed";
|
|
242
|
+
if (i === this.current) return "active";
|
|
243
|
+
return "pending";
|
|
244
|
+
}
|
|
245
|
+
render() {
|
|
246
|
+
const total = this.steps.length;
|
|
247
|
+
const cur = this.steps[this.current];
|
|
248
|
+
return html`
|
|
249
|
+
<!-- Desktop: pasos horizontales conectados -->
|
|
250
|
+
<ol class="steps" role="list">
|
|
251
|
+
${this.steps.map((step, i) => {
|
|
252
|
+
const state = this._stateClass(i);
|
|
253
|
+
return html`<li class="step ${state}">
|
|
254
|
+
<button
|
|
255
|
+
type="button"
|
|
256
|
+
class="step-btn"
|
|
257
|
+
aria-current=${i === this.current ? "step" : "false"}
|
|
258
|
+
@click=${() => this._select(i)}
|
|
259
|
+
>
|
|
260
|
+
<span class="circle-row">
|
|
261
|
+
<span class="circle">
|
|
262
|
+
${i < this.current ? html`<ion-icon name="checkmark-outline" aria-hidden="true"></ion-icon>` : html`${i + 1}`}
|
|
263
|
+
</span>
|
|
264
|
+
</span>
|
|
265
|
+
<span class="labels">
|
|
266
|
+
<span class="label">${step.label}</span>
|
|
267
|
+
${step.description ? html`<span class="description">${step.description}</span>` : ""}
|
|
268
|
+
</span>
|
|
269
|
+
</button>
|
|
270
|
+
</li>`;
|
|
271
|
+
})}
|
|
272
|
+
</ol>
|
|
273
|
+
|
|
274
|
+
<!-- Móvil: resumen compacto "Paso X de N · label" -->
|
|
275
|
+
<div class="compact">
|
|
276
|
+
<span class="circle">${this.current + 1}</span>
|
|
277
|
+
<span class="compact-text">
|
|
278
|
+
<span class="compact-count"
|
|
279
|
+
>${this.t.stepCount.replace("{n}", String(this.current + 1)).replace("{total}", String(total))}</span
|
|
280
|
+
>
|
|
281
|
+
<span class="compact-label">${cur ? cur.label : ""}</span>
|
|
282
|
+
</span>
|
|
283
|
+
</div>
|
|
284
|
+
`;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
__decorateClass([
|
|
288
|
+
property({ attribute: false })
|
|
289
|
+
], OkStepper.prototype, "steps");
|
|
290
|
+
__decorateClass([
|
|
291
|
+
property({ type: Number })
|
|
292
|
+
], OkStepper.prototype, "current");
|
|
293
|
+
__decorateClass([
|
|
294
|
+
property({ attribute: false })
|
|
295
|
+
], OkStepper.prototype, "labels");
|
|
296
|
+
define("ok-stepper", OkStepper);
|
|
297
|
+
export {
|
|
298
|
+
OkStepper
|
|
299
|
+
};
|
package/dist/ok-store.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { property } from "lit/decorators.js";
|
|
3
|
+
import { define } from "./define.js";
|
|
4
|
+
import { createStore } from "./store.js";
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
7
|
+
var result = void 0;
|
|
8
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9
|
+
if (decorator = decorators[i])
|
|
10
|
+
result = decorator(target, key, result) || result;
|
|
11
|
+
if (result) __defProp(target, key, result);
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
class OkStore extends LitElement {
|
|
15
|
+
static {
|
|
16
|
+
this.styles = css`
|
|
17
|
+
:host { display: contents; }
|
|
18
|
+
`;
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
super.connectedCallback();
|
|
22
|
+
this.ensureStore();
|
|
23
|
+
}
|
|
24
|
+
disconnectedCallback() {
|
|
25
|
+
super.disconnectedCallback();
|
|
26
|
+
this.unsubscribe?.();
|
|
27
|
+
this.unsubscribe = void 0;
|
|
28
|
+
}
|
|
29
|
+
updated(changed) {
|
|
30
|
+
if (changed.has("name")) this.ensureStore();
|
|
31
|
+
}
|
|
32
|
+
// Crea (o recrea si cambió `name`) el store y se (re)suscribe a sus cambios.
|
|
33
|
+
ensureStore() {
|
|
34
|
+
if (this.store && this.currentName === this.name) return;
|
|
35
|
+
this.unsubscribe?.();
|
|
36
|
+
this.currentName = this.name;
|
|
37
|
+
this.store = createStore({ name: this.name });
|
|
38
|
+
this.unsubscribe = this.store.subscribe((value, key) => {
|
|
39
|
+
this.dispatchEvent(
|
|
40
|
+
new CustomEvent("ok-store-change", {
|
|
41
|
+
detail: { key, value },
|
|
42
|
+
bubbles: true,
|
|
43
|
+
composed: true
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
void this.store.ready.then(() => {
|
|
48
|
+
this.dispatchEvent(
|
|
49
|
+
new CustomEvent("ok-store-ready", { bubbles: true, composed: true })
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** Lee un valor del store (SÍNCRONO). */
|
|
54
|
+
get(key) {
|
|
55
|
+
return this.store.get(key);
|
|
56
|
+
}
|
|
57
|
+
/** Escribe un valor en el store. */
|
|
58
|
+
set(key, value) {
|
|
59
|
+
this.store.set(key, value);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Actualiza un valor a partir del previo. Se llama `updateValue` (no `update`) porque `update`
|
|
63
|
+
* es un método reservado del ciclo de vida de LitElement; usa el `.store.update()` directamente
|
|
64
|
+
* si prefieres el nombre corto.
|
|
65
|
+
*/
|
|
66
|
+
updateValue(key, fn) {
|
|
67
|
+
this.store.update(key, fn);
|
|
68
|
+
}
|
|
69
|
+
/** Borra una clave. */
|
|
70
|
+
delete(key) {
|
|
71
|
+
this.store.delete(key);
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
return html`<slot></slot>`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
__decorateClass([
|
|
78
|
+
property()
|
|
79
|
+
], OkStore.prototype, "name");
|
|
80
|
+
define("ok-store", OkStore);
|
|
81
|
+
export {
|
|
82
|
+
OkStore
|
|
83
|
+
};
|