@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.
Files changed (210) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +457 -0
  3. package/dist/base/anchor.d.ts +13 -0
  4. package/dist/base/define.d.ts +1 -0
  5. package/dist/base/relay.d.ts +1 -0
  6. package/dist/cdn.d.ts +96 -0
  7. package/dist/components/ok-app-launcher/ok-app-launcher.d.ts +57 -0
  8. package/dist/components/ok-audio/ok-audio.d.ts +45 -0
  9. package/dist/components/ok-avatar/ok-avatar.d.ts +36 -0
  10. package/dist/components/ok-avatar-group/ok-avatar-group.d.ts +38 -0
  11. package/dist/components/ok-bar-list/ok-bar-list.d.ts +36 -0
  12. package/dist/components/ok-bento/ok-bento.d.ts +17 -0
  13. package/dist/components/ok-bento-item/ok-bento-item.d.ts +34 -0
  14. package/dist/components/ok-calculator/ok-calculator.d.ts +46 -0
  15. package/dist/components/ok-calendar/ok-calendar.d.ts +63 -0
  16. package/dist/components/ok-carousel/ok-carousel.d.ts +48 -0
  17. package/dist/components/ok-chart/ok-chart.d.ts +55 -0
  18. package/dist/components/ok-chat/ok-chat.d.ts +54 -0
  19. package/dist/components/ok-coachmark/ok-coachmark.d.ts +69 -0
  20. package/dist/components/ok-code/ok-code.d.ts +28 -0
  21. package/dist/components/ok-color-picker/ok-color-picker.d.ts +63 -0
  22. package/dist/components/ok-combo/ok-combo.d.ts +46 -0
  23. package/dist/components/ok-command-palette/ok-command-palette.d.ts +72 -0
  24. package/dist/components/ok-contact-form/ok-contact-form.d.ts +54 -0
  25. package/dist/components/ok-cropper/ok-cropper.d.ts +60 -0
  26. package/dist/components/ok-cta-band/ok-cta-band.d.ts +18 -0
  27. package/dist/components/ok-currency/ok-currency.d.ts +31 -0
  28. package/dist/components/ok-data-table/ok-data-table.d.ts +312 -0
  29. package/dist/components/ok-date-picker/ok-date-picker.d.ts +81 -0
  30. package/dist/components/ok-detail-list/ok-detail-list.d.ts +30 -0
  31. package/dist/components/ok-diff/ok-diff.d.ts +38 -0
  32. package/dist/components/ok-donut/ok-donut.d.ts +38 -0
  33. package/dist/components/ok-drawer/ok-drawer.d.ts +56 -0
  34. package/dist/components/ok-dropzone/ok-dropzone.d.ts +48 -0
  35. package/dist/components/ok-empty-state/ok-empty-state.d.ts +16 -0
  36. package/dist/components/ok-error-page/ok-error-page.d.ts +77 -0
  37. package/dist/components/ok-event-card/ok-event-card.d.ts +56 -0
  38. package/dist/components/ok-feature-card/ok-feature-card.d.ts +23 -0
  39. package/dist/components/ok-file-item/ok-file-item.d.ts +31 -0
  40. package/dist/components/ok-file-manager/ok-file-manager.d.ts +145 -0
  41. package/dist/components/ok-footer/ok-footer.d.ts +10 -0
  42. package/dist/components/ok-funnel/ok-funnel.d.ts +31 -0
  43. package/dist/components/ok-gallery/ok-gallery.d.ts +34 -0
  44. package/dist/components/ok-gauge/ok-gauge.d.ts +49 -0
  45. package/dist/components/ok-heatmap/ok-heatmap.d.ts +45 -0
  46. package/dist/components/ok-hero/ok-hero.d.ts +10 -0
  47. package/dist/components/ok-hover-card/ok-hover-card.d.ts +76 -0
  48. package/dist/components/ok-icon-tile/ok-icon-tile.d.ts +24 -0
  49. package/dist/components/ok-image/ok-image.d.ts +56 -0
  50. package/dist/components/ok-inline-feedback/ok-inline-feedback.d.ts +33 -0
  51. package/dist/components/ok-invoice/ok-invoice.d.ts +137 -0
  52. package/dist/components/ok-json-viewer/ok-json-viewer.d.ts +31 -0
  53. package/dist/components/ok-kanban/ok-kanban.d.ts +56 -0
  54. package/dist/components/ok-kbd/ok-kbd.d.ts +21 -0
  55. package/dist/components/ok-keyboard/ok-keyboard.d.ts +35 -0
  56. package/dist/components/ok-kpi/ok-kpi.d.ts +24 -0
  57. package/dist/components/ok-language-select/ok-language-select.d.ts +31 -0
  58. package/dist/components/ok-lightbox/ok-lightbox.d.ts +59 -0
  59. package/dist/components/ok-logo-cloud/ok-logo-cloud.d.ts +14 -0
  60. package/dist/components/ok-loyalty-card/ok-loyalty-card.d.ts +35 -0
  61. package/dist/components/ok-mail/ok-mail.d.ts +117 -0
  62. package/dist/components/ok-menu/ok-menu.d.ts +75 -0
  63. package/dist/components/ok-menubar/ok-menubar.d.ts +75 -0
  64. package/dist/components/ok-navbar/ok-navbar.d.ts +42 -0
  65. package/dist/components/ok-notification-center/ok-notification-center.d.ts +79 -0
  66. package/dist/components/ok-org-chart/ok-org-chart.d.ts +67 -0
  67. package/dist/components/ok-otp/ok-otp.d.ts +31 -0
  68. package/dist/components/ok-page-header/ok-page-header.d.ts +23 -0
  69. package/dist/components/ok-pagination/ok-pagination.d.ts +44 -0
  70. package/dist/components/ok-pdf/ok-pdf.d.ts +32 -0
  71. package/dist/components/ok-phone/ok-phone.d.ts +48 -0
  72. package/dist/components/ok-pinpad/ok-pinpad.d.ts +29 -0
  73. package/dist/components/ok-pricing-card/ok-pricing-card.d.ts +31 -0
  74. package/dist/components/ok-product-card/ok-product-card.d.ts +25 -0
  75. package/dist/components/ok-qr/ok-qr.d.ts +24 -0
  76. package/dist/components/ok-qty-stepper/ok-qty-stepper.d.ts +35 -0
  77. package/dist/components/ok-range-dual/ok-range-dual.d.ts +38 -0
  78. package/dist/components/ok-rating/ok-rating.d.ts +33 -0
  79. package/dist/components/ok-receipt/ok-receipt.d.ts +103 -0
  80. package/dist/components/ok-reveal/ok-reveal.d.ts +21 -0
  81. package/dist/components/ok-rich-text/ok-rich-text.d.ts +46 -0
  82. package/dist/components/ok-scheduler/ok-scheduler.d.ts +74 -0
  83. package/dist/components/ok-select-card/ok-select-card.d.ts +37 -0
  84. package/dist/components/ok-signature/ok-signature.d.ts +55 -0
  85. package/dist/components/ok-skeleton/ok-skeleton.d.ts +40 -0
  86. package/dist/components/ok-sparkline/ok-sparkline.d.ts +27 -0
  87. package/dist/components/ok-split-button/ok-split-button.d.ts +49 -0
  88. package/dist/components/ok-splitter/ok-splitter.d.ts +36 -0
  89. package/dist/components/ok-stat/ok-stat.d.ts +16 -0
  90. package/dist/components/ok-status-dot/ok-status-dot.d.ts +24 -0
  91. package/dist/components/ok-status-pill/ok-status-pill.d.ts +22 -0
  92. package/dist/components/ok-stepper/ok-stepper.d.ts +33 -0
  93. package/dist/components/ok-store/ok-store.d.ts +33 -0
  94. package/dist/components/ok-tag-input/ok-tag-input.d.ts +39 -0
  95. package/dist/components/ok-testimonial/ok-testimonial.d.ts +21 -0
  96. package/dist/components/ok-time-picker/ok-time-picker.d.ts +50 -0
  97. package/dist/components/ok-timeline/ok-timeline.d.ts +33 -0
  98. package/dist/components/ok-tree/ok-tree.d.ts +46 -0
  99. package/dist/components/ok-video/ok-video.d.ts +49 -0
  100. package/dist/components/ok-widget-board/ok-widget-board.d.ts +71 -0
  101. package/dist/components/ok-wizard/ok-wizard.d.ts +30 -0
  102. package/dist/define.js +8 -0
  103. package/dist/erplora.css +112 -0
  104. package/dist/index.d.ts +158 -0
  105. package/dist/index.js +197 -0
  106. package/dist/layout.css +338 -0
  107. package/dist/ok-app-launcher.js +396 -0
  108. package/dist/ok-audio.js +308 -0
  109. package/dist/ok-avatar-group.js +158 -0
  110. package/dist/ok-avatar.js +179 -0
  111. package/dist/ok-bar-list.js +189 -0
  112. package/dist/ok-bento-item.js +168 -0
  113. package/dist/ok-bento.js +63 -0
  114. package/dist/ok-calculator.js +406 -0
  115. package/dist/ok-calendar.js +541 -0
  116. package/dist/ok-carousel.js +352 -0
  117. package/dist/ok-chart.js +325 -0
  118. package/dist/ok-chat.js +320 -0
  119. package/dist/ok-coachmark.js +500 -0
  120. package/dist/ok-code.js +190 -0
  121. package/dist/ok-color-picker.js +569 -0
  122. package/dist/ok-combo.js +294 -0
  123. package/dist/ok-command-palette.js +448 -0
  124. package/dist/ok-contact-form.js +288 -0
  125. package/dist/ok-cropper.js +404 -0
  126. package/dist/ok-cta-band.js +134 -0
  127. package/dist/ok-currency.js +172 -0
  128. package/dist/ok-data-table.js +1281 -0
  129. package/dist/ok-date-picker.js +736 -0
  130. package/dist/ok-detail-list.js +156 -0
  131. package/dist/ok-diff.js +200 -0
  132. package/dist/ok-donut.js +280 -0
  133. package/dist/ok-drawer.js +357 -0
  134. package/dist/ok-dropzone.js +376 -0
  135. package/dist/ok-empty-state.js +104 -0
  136. package/dist/ok-error-page.js +547 -0
  137. package/dist/ok-event-card.js +384 -0
  138. package/dist/ok-feature-card.js +152 -0
  139. package/dist/ok-file-item.js +259 -0
  140. package/dist/ok-file-manager.js +1116 -0
  141. package/dist/ok-footer.js +67 -0
  142. package/dist/ok-funnel.js +181 -0
  143. package/dist/ok-gallery.js +293 -0
  144. package/dist/ok-gauge.js +385 -0
  145. package/dist/ok-heatmap.js +268 -0
  146. package/dist/ok-hero.js +43 -0
  147. package/dist/ok-hover-card.js +480 -0
  148. package/dist/ok-icon-tile.js +123 -0
  149. package/dist/ok-image.js +471 -0
  150. package/dist/ok-inline-feedback.js +221 -0
  151. package/dist/ok-invoice.js +229 -0
  152. package/dist/ok-json-viewer.js +330 -0
  153. package/dist/ok-kanban.js +427 -0
  154. package/dist/ok-kbd.js +159 -0
  155. package/dist/ok-keyboard.js +402 -0
  156. package/dist/ok-kpi.js +147 -0
  157. package/dist/ok-language-select.js +188 -0
  158. package/dist/ok-lightbox.js +490 -0
  159. package/dist/ok-logo-cloud.js +92 -0
  160. package/dist/ok-loyalty-card.js +353 -0
  161. package/dist/ok-mail.js +562 -0
  162. package/dist/ok-menu.js +529 -0
  163. package/dist/ok-menubar.js +628 -0
  164. package/dist/ok-navbar.js +306 -0
  165. package/dist/ok-notification-center.js +545 -0
  166. package/dist/ok-org-chart.js +619 -0
  167. package/dist/ok-otp.js +199 -0
  168. package/dist/ok-page-header.js +202 -0
  169. package/dist/ok-pagination.js +366 -0
  170. package/dist/ok-pdf.js +160 -0
  171. package/dist/ok-phone.js +225 -0
  172. package/dist/ok-pinpad.js +171 -0
  173. package/dist/ok-pricing-card.js +184 -0
  174. package/dist/ok-product-card.js +178 -0
  175. package/dist/ok-qr.js +652 -0
  176. package/dist/ok-qty-stepper.js +212 -0
  177. package/dist/ok-range-dual.js +280 -0
  178. package/dist/ok-rating.js +199 -0
  179. package/dist/ok-receipt.js +183 -0
  180. package/dist/ok-reveal.js +94 -0
  181. package/dist/ok-rich-text.js +538 -0
  182. package/dist/ok-scheduler.js +518 -0
  183. package/dist/ok-select-card.js +231 -0
  184. package/dist/ok-signature.js +267 -0
  185. package/dist/ok-skeleton.js +345 -0
  186. package/dist/ok-sparkline.js +150 -0
  187. package/dist/ok-split-button.js +251 -0
  188. package/dist/ok-splitter.js +289 -0
  189. package/dist/ok-stat.js +77 -0
  190. package/dist/ok-status-dot.js +163 -0
  191. package/dist/ok-status-pill.js +123 -0
  192. package/dist/ok-stepper.js +299 -0
  193. package/dist/ok-store.js +83 -0
  194. package/dist/ok-tag-input.js +358 -0
  195. package/dist/ok-testimonial.js +136 -0
  196. package/dist/ok-time-picker.js +472 -0
  197. package/dist/ok-timeline.js +251 -0
  198. package/dist/ok-tree.js +266 -0
  199. package/dist/ok-video.js +362 -0
  200. package/dist/ok-widget-board.js +265 -0
  201. package/dist/ok-wizard.js +153 -0
  202. package/dist/outfitkit.js +96 -0
  203. package/dist/shared/anchor.js +14 -0
  204. package/dist/store/controller.d.ts +17 -0
  205. package/dist/store/idb.d.ts +16 -0
  206. package/dist/store/store.d.ts +39 -0
  207. package/dist/store-controller.js +31 -0
  208. package/dist/store.js +182 -0
  209. package/dist/theme.example.css +70 -0
  210. 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
+ };