@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,402 @@
|
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { property, state } from "lit/decorators.js";
|
|
3
|
+
import { define } from "./define.js";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
6
|
+
var result = void 0;
|
|
7
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
8
|
+
if (decorator = decorators[i])
|
|
9
|
+
result = decorator(target, key, result) || result;
|
|
10
|
+
if (result) __defProp(target, key, result);
|
|
11
|
+
return result;
|
|
12
|
+
};
|
|
13
|
+
const QWERTY = [
|
|
14
|
+
"1234567890".split("").map((c) => ({ base: c })),
|
|
15
|
+
[..."qwertyuiop".split("").map((c) => ({ base: c })), { base: "", label: "⌫", kind: "del" }],
|
|
16
|
+
"asdfghjkl".split("").map((c) => ({ base: c })),
|
|
17
|
+
[
|
|
18
|
+
{ base: "", label: "⇧", kind: "shift" },
|
|
19
|
+
..."zxcvbnm".split("").map((c) => ({ base: c })),
|
|
20
|
+
{ base: "," },
|
|
21
|
+
{ base: "." },
|
|
22
|
+
{ base: "\n", label: "↵", kind: "enter" }
|
|
23
|
+
],
|
|
24
|
+
[
|
|
25
|
+
{ base: "", label: "123", kind: "num" },
|
|
26
|
+
{ base: " ", label: "espacio", kind: "space" },
|
|
27
|
+
{ base: "@", label: "@", kind: "mod" }
|
|
28
|
+
]
|
|
29
|
+
];
|
|
30
|
+
const SYMBOL = [
|
|
31
|
+
"1234567890".split("").map((c) => ({ base: c })),
|
|
32
|
+
"@#$_&-+()/".split("").map((c) => ({ base: c })),
|
|
33
|
+
[
|
|
34
|
+
{ base: "", label: "ABC", kind: "num" },
|
|
35
|
+
...`*"':;!?`.split("").map((c) => ({ base: c })),
|
|
36
|
+
{ base: "", label: "⌫", kind: "del" }
|
|
37
|
+
],
|
|
38
|
+
[
|
|
39
|
+
{ base: " ", label: "espacio", kind: "space" },
|
|
40
|
+
{ base: "." },
|
|
41
|
+
{ base: "," },
|
|
42
|
+
{ base: "\n", label: "↵", kind: "enter" }
|
|
43
|
+
]
|
|
44
|
+
];
|
|
45
|
+
const NUMERIC = [
|
|
46
|
+
[{ base: "1" }, { base: "2" }, { base: "3" }],
|
|
47
|
+
[{ base: "4" }, { base: "5" }, { base: "6" }],
|
|
48
|
+
[{ base: "7" }, { base: "8" }, { base: "9" }],
|
|
49
|
+
[
|
|
50
|
+
{ base: "", label: "⌫", kind: "del" },
|
|
51
|
+
{ base: "0" },
|
|
52
|
+
{ base: "\n", label: "↵", kind: "enter" }
|
|
53
|
+
]
|
|
54
|
+
];
|
|
55
|
+
class OkKeyboard extends LitElement {
|
|
56
|
+
constructor() {
|
|
57
|
+
super(...arguments);
|
|
58
|
+
this.layout = "qwerty";
|
|
59
|
+
this.density = "touch";
|
|
60
|
+
this.value = "";
|
|
61
|
+
this.showDisplay = false;
|
|
62
|
+
this.displayLabel = "Entrada";
|
|
63
|
+
this.isShift = false;
|
|
64
|
+
this.activeLayout = "qwerty";
|
|
65
|
+
}
|
|
66
|
+
static {
|
|
67
|
+
this.styles = css`
|
|
68
|
+
:host {
|
|
69
|
+
display: block;
|
|
70
|
+
width: 100%;
|
|
71
|
+
/* Tokens propios estilo Ionic (overridables): --ok-* → --ion-* → hex. */
|
|
72
|
+
--bg: var(--ok-surface, var(--ion-background-color, #ffffff));
|
|
73
|
+
--key-bg: var(--ok-key-bg, var(--ion-color-light, #f4f5f8));
|
|
74
|
+
--key-bg-hover: var(--ok-key-bg-hover, var(--ion-color-light-shade, #e6e7ea));
|
|
75
|
+
--special-bg: var(--ok-key-special-bg, var(--ion-color-light-shade, #e6e7ea));
|
|
76
|
+
--line: var(--ok-border-color, var(--ion-border-color, #d7d8da));
|
|
77
|
+
--ink: var(--ok-text-color, var(--ion-text-color, #1f2933));
|
|
78
|
+
--ink-muted: var(--ok-color-medium, var(--ion-color-medium, #92949c));
|
|
79
|
+
--ink-faint: var(--ok-color-medium-tint, var(--ion-color-medium-tint, #b3b5bd));
|
|
80
|
+
--brand: var(--ok-color-primary, var(--ion-color-primary, #0091ce));
|
|
81
|
+
--brand-shade: var(--ok-color-primary-shade, var(--ion-color-primary-shade, #007fb5));
|
|
82
|
+
--brand-fg: var(--ok-color-primary-contrast, var(--ion-color-primary-contrast, #ffffff));
|
|
83
|
+
--radius: var(--ok-radius, 12px);
|
|
84
|
+
--key-radius: var(--ok-key-radius, 8px);
|
|
85
|
+
|
|
86
|
+
/* Métricas de densidad touch (default). */
|
|
87
|
+
--gap: 6px;
|
|
88
|
+
--key-h: 48px;
|
|
89
|
+
--key-min-w: 44px;
|
|
90
|
+
--key-fs: 16px;
|
|
91
|
+
--pad: 12px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Densidad compacta (mobile / denso). */
|
|
95
|
+
:host([density='compact']) {
|
|
96
|
+
--gap: 4px;
|
|
97
|
+
--key-h: 38px;
|
|
98
|
+
--key-min-w: 34px;
|
|
99
|
+
--key-fs: 14px;
|
|
100
|
+
--pad: 8px;
|
|
101
|
+
--radius: var(--ok-radius, 8px);
|
|
102
|
+
--key-radius: var(--ok-key-radius, 6px);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.kb-wrap {
|
|
106
|
+
display: flex;
|
|
107
|
+
flex-direction: column;
|
|
108
|
+
gap: var(--gap);
|
|
109
|
+
box-sizing: border-box;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* Tira de display (label + valor + caret). */
|
|
113
|
+
.display {
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
gap: 8px;
|
|
117
|
+
background: var(--key-bg);
|
|
118
|
+
border: 1px solid var(--line);
|
|
119
|
+
border-radius: var(--key-radius);
|
|
120
|
+
padding: 8px 12px;
|
|
121
|
+
min-height: 36px;
|
|
122
|
+
box-sizing: border-box;
|
|
123
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
124
|
+
font-size: 0.95rem;
|
|
125
|
+
color: var(--ink);
|
|
126
|
+
font-variant-numeric: tabular-nums;
|
|
127
|
+
}
|
|
128
|
+
.display__label {
|
|
129
|
+
font-size: 0.625rem;
|
|
130
|
+
color: var(--ink-muted);
|
|
131
|
+
text-transform: uppercase;
|
|
132
|
+
letter-spacing: 0.06em;
|
|
133
|
+
font-family: inherit;
|
|
134
|
+
}
|
|
135
|
+
.display__value {
|
|
136
|
+
flex: 1;
|
|
137
|
+
color: var(--ink);
|
|
138
|
+
letter-spacing: 0.05em;
|
|
139
|
+
word-break: break-all;
|
|
140
|
+
white-space: pre-wrap;
|
|
141
|
+
}
|
|
142
|
+
/* Caret parpadeante cuando el valor está vacío. */
|
|
143
|
+
.display__caret {
|
|
144
|
+
color: var(--ink-faint);
|
|
145
|
+
animation: ok-kb-blink 1s step-end infinite;
|
|
146
|
+
}
|
|
147
|
+
@keyframes ok-kb-blink {
|
|
148
|
+
50% {
|
|
149
|
+
opacity: 0;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.keys {
|
|
154
|
+
display: flex;
|
|
155
|
+
flex-direction: column;
|
|
156
|
+
gap: var(--gap);
|
|
157
|
+
padding: var(--pad);
|
|
158
|
+
background: var(--bg);
|
|
159
|
+
border: 1px solid var(--line);
|
|
160
|
+
border-radius: var(--radius);
|
|
161
|
+
user-select: none;
|
|
162
|
+
-webkit-user-select: none;
|
|
163
|
+
touch-action: manipulation;
|
|
164
|
+
box-sizing: border-box;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.row {
|
|
168
|
+
display: flex;
|
|
169
|
+
gap: var(--gap);
|
|
170
|
+
width: 100%;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.key {
|
|
174
|
+
flex: 1 1 var(--key-min-w);
|
|
175
|
+
min-width: var(--key-min-w);
|
|
176
|
+
height: var(--key-h);
|
|
177
|
+
display: inline-flex;
|
|
178
|
+
align-items: center;
|
|
179
|
+
justify-content: center;
|
|
180
|
+
background: var(--key-bg);
|
|
181
|
+
border: 1px solid var(--line);
|
|
182
|
+
border-bottom-width: 2px;
|
|
183
|
+
border-radius: var(--key-radius);
|
|
184
|
+
color: var(--ink);
|
|
185
|
+
font-family: inherit;
|
|
186
|
+
font-size: var(--key-fs);
|
|
187
|
+
font-weight: 500;
|
|
188
|
+
cursor: pointer;
|
|
189
|
+
padding: 0 2px;
|
|
190
|
+
box-sizing: border-box;
|
|
191
|
+
transition: background 120ms ease-out, transform 120ms ease-out,
|
|
192
|
+
border-color 120ms ease-out;
|
|
193
|
+
font-variant-numeric: tabular-nums;
|
|
194
|
+
}
|
|
195
|
+
.key:hover {
|
|
196
|
+
background: var(--key-bg-hover);
|
|
197
|
+
}
|
|
198
|
+
.key:active {
|
|
199
|
+
transform: scale(0.97);
|
|
200
|
+
}
|
|
201
|
+
.key:focus-visible {
|
|
202
|
+
outline: 2px solid var(--brand);
|
|
203
|
+
outline-offset: 2px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* Anchos relativos por flex-grow. */
|
|
207
|
+
.key--wide {
|
|
208
|
+
flex-grow: 1.5;
|
|
209
|
+
}
|
|
210
|
+
.key--xwide {
|
|
211
|
+
flex-grow: 2;
|
|
212
|
+
}
|
|
213
|
+
.key--space {
|
|
214
|
+
flex-grow: 6;
|
|
215
|
+
}
|
|
216
|
+
.key--enter {
|
|
217
|
+
background: var(--brand);
|
|
218
|
+
color: var(--brand-fg);
|
|
219
|
+
border-color: transparent;
|
|
220
|
+
flex-grow: 1.6;
|
|
221
|
+
}
|
|
222
|
+
.key--enter:hover {
|
|
223
|
+
background: var(--brand-shade);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/* Teclas de acción/modificadores. */
|
|
227
|
+
.key--shift,
|
|
228
|
+
.key--del,
|
|
229
|
+
.key--num,
|
|
230
|
+
.key--mod {
|
|
231
|
+
background: var(--special-bg);
|
|
232
|
+
color: var(--ink-muted);
|
|
233
|
+
font-size: 0.8125rem;
|
|
234
|
+
font-weight: 500;
|
|
235
|
+
letter-spacing: 0.04em;
|
|
236
|
+
text-transform: uppercase;
|
|
237
|
+
flex-grow: 1.4;
|
|
238
|
+
}
|
|
239
|
+
.key--shift:hover,
|
|
240
|
+
.key--del:hover,
|
|
241
|
+
.key--num:hover,
|
|
242
|
+
.key--mod:hover {
|
|
243
|
+
background: var(--key-bg-hover);
|
|
244
|
+
color: var(--ink);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/* Shift activo: la tecla shift se ilumina con marca. */
|
|
248
|
+
:host([is-shift]) .key--shift {
|
|
249
|
+
background: var(--brand);
|
|
250
|
+
color: var(--brand-fg);
|
|
251
|
+
border-color: transparent;
|
|
252
|
+
}
|
|
253
|
+
/* Shift activo: las teclas de carácter muestran mayúscula. */
|
|
254
|
+
:host([is-shift]) .key--char {
|
|
255
|
+
text-transform: uppercase;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/* Modo numérico: rejilla de 3 columnas centrada. */
|
|
259
|
+
.keys--numeric {
|
|
260
|
+
display: grid;
|
|
261
|
+
grid-template-columns: repeat(3, 1fr);
|
|
262
|
+
gap: var(--gap);
|
|
263
|
+
max-width: 320px;
|
|
264
|
+
}
|
|
265
|
+
.keys--numeric .row {
|
|
266
|
+
display: contents;
|
|
267
|
+
}
|
|
268
|
+
.keys--numeric .key {
|
|
269
|
+
flex: initial;
|
|
270
|
+
font-size: 1.375rem;
|
|
271
|
+
font-weight: 600;
|
|
272
|
+
}
|
|
273
|
+
`;
|
|
274
|
+
}
|
|
275
|
+
willUpdate(changed) {
|
|
276
|
+
if (changed.has("layout")) {
|
|
277
|
+
this.activeLayout = this.layout;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
get rows() {
|
|
281
|
+
switch (this.activeLayout) {
|
|
282
|
+
case "numeric":
|
|
283
|
+
return NUMERIC;
|
|
284
|
+
case "symbol":
|
|
285
|
+
return SYMBOL;
|
|
286
|
+
default:
|
|
287
|
+
return QWERTY;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
emit(name, detail) {
|
|
291
|
+
this.dispatchEvent(new CustomEvent(name, { detail, bubbles: true, composed: true }));
|
|
292
|
+
}
|
|
293
|
+
setValue(next) {
|
|
294
|
+
this.value = next;
|
|
295
|
+
this.emit("ok-input", { value: next });
|
|
296
|
+
}
|
|
297
|
+
handleKey(k) {
|
|
298
|
+
switch (k.kind) {
|
|
299
|
+
case "shift":
|
|
300
|
+
this.isShift = !this.isShift;
|
|
301
|
+
return;
|
|
302
|
+
case "del":
|
|
303
|
+
this.setValue(this.value.slice(0, -1));
|
|
304
|
+
this.emit("ok-key", { key: "Backspace" });
|
|
305
|
+
return;
|
|
306
|
+
case "enter":
|
|
307
|
+
this.emit("ok-key", { key: "Enter" });
|
|
308
|
+
this.emit("ok-enter", { value: this.value });
|
|
309
|
+
return;
|
|
310
|
+
case "num":
|
|
311
|
+
this.activeLayout = this.activeLayout === "qwerty" ? "symbol" : "qwerty";
|
|
312
|
+
return;
|
|
313
|
+
default: {
|
|
314
|
+
let ch = k.base;
|
|
315
|
+
if (this.isShift && ch.length === 1 && ch !== " " && ch !== "\n") {
|
|
316
|
+
ch = ch.toUpperCase();
|
|
317
|
+
}
|
|
318
|
+
this.setValue(this.value + ch);
|
|
319
|
+
this.emit("ok-key", { key: ch });
|
|
320
|
+
if (this.isShift && k.kind !== "mod") {
|
|
321
|
+
this.isShift = false;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
renderKey(k) {
|
|
327
|
+
const isChar = !k.kind || k.kind === "space" || k.kind === "mod";
|
|
328
|
+
const cls = [
|
|
329
|
+
"key",
|
|
330
|
+
isChar ? "key--char" : "",
|
|
331
|
+
k.kind ? `key--${k.kind}` : ""
|
|
332
|
+
].filter(Boolean).join(" ");
|
|
333
|
+
let label = k.label ?? k.base;
|
|
334
|
+
if (this.isShift && isChar && k.base.length === 1 && k.base !== " " && k.base !== "\n") {
|
|
335
|
+
label = k.base.toUpperCase();
|
|
336
|
+
}
|
|
337
|
+
return html`
|
|
338
|
+
<button
|
|
339
|
+
type="button"
|
|
340
|
+
class=${cls}
|
|
341
|
+
part="key"
|
|
342
|
+
aria-label=${k.kind === "space" ? "espacio" : k.kind === "del" ? "borrar" : k.kind === "enter" ? "intro" : label}
|
|
343
|
+
@click=${() => this.handleKey(k)}
|
|
344
|
+
>
|
|
345
|
+
${label}
|
|
346
|
+
</button>
|
|
347
|
+
`;
|
|
348
|
+
}
|
|
349
|
+
renderDisplay() {
|
|
350
|
+
if (!this.showDisplay) return null;
|
|
351
|
+
return html`
|
|
352
|
+
<div class="display" part="display">
|
|
353
|
+
<span class="display__label">${this.displayLabel}</span>
|
|
354
|
+
<span class="display__value"
|
|
355
|
+
>${this.value}${this.value.length === 0 ? html`<span class="display__caret">_</span>` : null}</span
|
|
356
|
+
>
|
|
357
|
+
</div>
|
|
358
|
+
`;
|
|
359
|
+
}
|
|
360
|
+
render() {
|
|
361
|
+
const numeric = this.activeLayout === "numeric";
|
|
362
|
+
return html`
|
|
363
|
+
<div class="kb-wrap">
|
|
364
|
+
${this.renderDisplay()}
|
|
365
|
+
<div
|
|
366
|
+
class=${`keys${numeric ? " keys--numeric" : ""}`}
|
|
367
|
+
role="group"
|
|
368
|
+
aria-label="Teclado en pantalla"
|
|
369
|
+
>
|
|
370
|
+
${this.rows.map(
|
|
371
|
+
(row) => html`<div class="row" role="row">${row.map((k) => this.renderKey(k))}</div>`
|
|
372
|
+
)}
|
|
373
|
+
</div>
|
|
374
|
+
</div>
|
|
375
|
+
`;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
__decorateClass([
|
|
379
|
+
property({ reflect: true })
|
|
380
|
+
], OkKeyboard.prototype, "layout");
|
|
381
|
+
__decorateClass([
|
|
382
|
+
property({ reflect: true })
|
|
383
|
+
], OkKeyboard.prototype, "density");
|
|
384
|
+
__decorateClass([
|
|
385
|
+
property()
|
|
386
|
+
], OkKeyboard.prototype, "value");
|
|
387
|
+
__decorateClass([
|
|
388
|
+
property({ type: Boolean, attribute: "show-display" })
|
|
389
|
+
], OkKeyboard.prototype, "showDisplay");
|
|
390
|
+
__decorateClass([
|
|
391
|
+
property({ attribute: "display-label" })
|
|
392
|
+
], OkKeyboard.prototype, "displayLabel");
|
|
393
|
+
__decorateClass([
|
|
394
|
+
property({ type: Boolean, reflect: true, attribute: "is-shift" })
|
|
395
|
+
], OkKeyboard.prototype, "isShift");
|
|
396
|
+
__decorateClass([
|
|
397
|
+
state()
|
|
398
|
+
], OkKeyboard.prototype, "activeLayout");
|
|
399
|
+
define("ok-keyboard", OkKeyboard);
|
|
400
|
+
export {
|
|
401
|
+
OkKeyboard
|
|
402
|
+
};
|
package/dist/ok-kpi.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
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 OkKpi extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.trend = "flat";
|
|
17
|
+
}
|
|
18
|
+
static {
|
|
19
|
+
this.styles = css`
|
|
20
|
+
:host {
|
|
21
|
+
display: block;
|
|
22
|
+
width: 100%;
|
|
23
|
+
/* Tokens propios estilo Ionic (overridables): --ok-* → --ion-* → hex. */
|
|
24
|
+
--background: var(--ok-card-background, var(--ion-card-background, var(--ion-background-color, #ffffff)));
|
|
25
|
+
--color: var(--ok-text-color, var(--ion-text-color, #1f2933));
|
|
26
|
+
--label-color: var(--ok-color-medium, var(--ion-color-medium, #92949c));
|
|
27
|
+
--border-color: var(--ok-border-color, var(--ion-border-color, rgba(0, 0, 0, 0.08)));
|
|
28
|
+
--border-radius: var(--ok-radius, 12px);
|
|
29
|
+
--box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
30
|
+
--padding: 1rem 1.125rem;
|
|
31
|
+
/* Colores de tendencia. */
|
|
32
|
+
--trend-up-color: var(--ok-color-success, var(--ion-color-success, #2dd36f));
|
|
33
|
+
--trend-down-color: var(--ok-color-danger, var(--ion-color-danger, #eb445a));
|
|
34
|
+
--trend-flat-color: var(--ok-color-medium, var(--ion-color-medium, #92949c));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.card {
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
width: 100%;
|
|
40
|
+
background: var(--background);
|
|
41
|
+
color: var(--color);
|
|
42
|
+
border: 1px solid var(--border-color);
|
|
43
|
+
border-radius: var(--border-radius);
|
|
44
|
+
box-shadow: var(--box-shadow);
|
|
45
|
+
padding: var(--padding);
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
gap: 0.375rem;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Fila superior: label + icono opcional. */
|
|
52
|
+
.top {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
gap: 0.5rem;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.label {
|
|
60
|
+
margin: 0;
|
|
61
|
+
font-size: 0.6875rem;
|
|
62
|
+
font-weight: 600;
|
|
63
|
+
letter-spacing: 0.05em;
|
|
64
|
+
text-transform: uppercase;
|
|
65
|
+
color: var(--label-color);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.label-icon {
|
|
69
|
+
font-size: 1.25rem;
|
|
70
|
+
color: var(--label-color);
|
|
71
|
+
flex: 0 0 auto;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.value {
|
|
75
|
+
margin: 0;
|
|
76
|
+
font-size: 1.75rem;
|
|
77
|
+
font-weight: 700;
|
|
78
|
+
line-height: 1.1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* Delta: flecha + texto, coloreado según tendencia. */
|
|
82
|
+
.delta {
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: 0.25rem;
|
|
86
|
+
font-size: 0.8125rem;
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
}
|
|
89
|
+
.delta ion-icon {
|
|
90
|
+
font-size: 1rem;
|
|
91
|
+
}
|
|
92
|
+
.delta.up {
|
|
93
|
+
color: var(--trend-up-color);
|
|
94
|
+
}
|
|
95
|
+
.delta.down {
|
|
96
|
+
color: var(--trend-down-color);
|
|
97
|
+
}
|
|
98
|
+
.delta.flat {
|
|
99
|
+
color: var(--trend-flat-color);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
::slotted(*) {
|
|
103
|
+
margin-top: 0.25rem;
|
|
104
|
+
}
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
/** Devuelve el ion-icon de flecha según la tendencia. */
|
|
108
|
+
trendIcon() {
|
|
109
|
+
if (this.trend === "up") return "trending-up";
|
|
110
|
+
if (this.trend === "down") return "trending-down";
|
|
111
|
+
return "remove";
|
|
112
|
+
}
|
|
113
|
+
render() {
|
|
114
|
+
return html`
|
|
115
|
+
<div class="card">
|
|
116
|
+
<div class="top">
|
|
117
|
+
${this.label ? html`<p class="label">${this.label}</p>` : null}
|
|
118
|
+
${this.icon ? html`<ion-icon class="label-icon" name=${this.icon} aria-hidden="true"></ion-icon>` : null}
|
|
119
|
+
</div>
|
|
120
|
+
${this.value ? html`<p class="value">${this.value}</p>` : null}
|
|
121
|
+
${this.delta ? html`<span class="delta ${this.trend}">
|
|
122
|
+
<ion-icon name=${this.trendIcon()} aria-hidden="true"></ion-icon>${this.delta}
|
|
123
|
+
</span>` : null}
|
|
124
|
+
<slot></slot>
|
|
125
|
+
</div>
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
__decorateClass([
|
|
130
|
+
property()
|
|
131
|
+
], OkKpi.prototype, "label");
|
|
132
|
+
__decorateClass([
|
|
133
|
+
property()
|
|
134
|
+
], OkKpi.prototype, "value");
|
|
135
|
+
__decorateClass([
|
|
136
|
+
property()
|
|
137
|
+
], OkKpi.prototype, "delta");
|
|
138
|
+
__decorateClass([
|
|
139
|
+
property()
|
|
140
|
+
], OkKpi.prototype, "trend");
|
|
141
|
+
__decorateClass([
|
|
142
|
+
property()
|
|
143
|
+
], OkKpi.prototype, "icon");
|
|
144
|
+
define("ok-kpi", OkKpi);
|
|
145
|
+
export {
|
|
146
|
+
OkKpi
|
|
147
|
+
};
|