@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,471 @@
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
+ class OkImage extends LitElement {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.src = "";
17
+ this.alt = "";
18
+ this.ratio = "16:9";
19
+ this.radius = "md";
20
+ this.zoom = "none";
21
+ this.placeholderText = "cargando…";
22
+ this.loaded = false;
23
+ this.errored = false;
24
+ this.zooming = false;
25
+ this.lightboxOpen = false;
26
+ this.lensX = 50;
27
+ this.lensY = 50;
28
+ this.closeLightbox = () => {
29
+ this.lightboxOpen = false;
30
+ };
31
+ this.onKeydown = (e) => {
32
+ if (e.key === "Escape" && this.lightboxOpen) this.closeLightbox();
33
+ };
34
+ }
35
+ static {
36
+ this.styles = css`
37
+ :host {
38
+ display: block;
39
+ width: 100%;
40
+ /* Tokens propios estilo Ionic (overridables): --ok-* → --ion-* → hex/literal. */
41
+ --bg: var(--ok-surface-variant, var(--ion-color-step-100, #e9edf0));
42
+ --radius: var(--ok-radius-md, 8px);
43
+ --caption-color: #ffffff;
44
+ --caption-fade: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.66));
45
+ --ph-color: var(--ok-color-medium, var(--ion-color-medium, #92949c));
46
+ --shimmer-tint: rgba(0, 0, 0, 0.08);
47
+ --lens-size: 96px;
48
+ --lens-scale: 1.5;
49
+ --dur-fade: 280ms;
50
+ --dur-fast: 120ms;
51
+ --ease: cubic-bezier(0.22, 1, 0.36, 1);
52
+ }
53
+
54
+ /* ---------- Marco ---------- */
55
+ .frame {
56
+ display: block;
57
+ position: relative;
58
+ overflow: hidden;
59
+ width: 100%;
60
+ background: var(--bg);
61
+ border-radius: var(--radius);
62
+ aspect-ratio: 16 / 9;
63
+ }
64
+ :host([ratio='square']) .frame {
65
+ aspect-ratio: 1 / 1;
66
+ }
67
+ :host([ratio='portrait']) .frame {
68
+ aspect-ratio: 3 / 4;
69
+ }
70
+ :host([ratio='free']) .frame {
71
+ aspect-ratio: auto;
72
+ }
73
+ :host([radius='sm']) {
74
+ --radius: var(--ok-radius-sm, 6px);
75
+ }
76
+ :host([radius='lg']) {
77
+ --radius: var(--ok-radius-xl, 14px);
78
+ }
79
+
80
+ /* ---------- Imagen ---------- */
81
+ .el {
82
+ display: block;
83
+ width: 100%;
84
+ height: 100%;
85
+ object-fit: cover;
86
+ opacity: 0;
87
+ transition: opacity var(--dur-fade) var(--ease),
88
+ transform var(--dur-fade) var(--ease);
89
+ transform-origin: center center;
90
+ }
91
+ :host([ratio='free']) .el {
92
+ height: auto;
93
+ }
94
+ .frame.is-loaded .el {
95
+ opacity: 1;
96
+ }
97
+
98
+ /* ---------- Placeholder + shimmer ---------- */
99
+ .ph {
100
+ position: absolute;
101
+ inset: 0;
102
+ display: grid;
103
+ place-items: center;
104
+ background: linear-gradient(135deg, var(--bg), color-mix(in srgb, var(--bg) 70%, #fff));
105
+ color: var(--ph-color);
106
+ font-size: 0.7rem;
107
+ letter-spacing: 0.06em;
108
+ text-transform: uppercase;
109
+ opacity: 1;
110
+ transition: opacity var(--dur-fade) var(--ease);
111
+ }
112
+ .ph::after {
113
+ content: '';
114
+ position: absolute;
115
+ inset: 0;
116
+ background: linear-gradient(
117
+ 90deg,
118
+ transparent 0%,
119
+ var(--shimmer-tint) 50%,
120
+ transparent 100%
121
+ );
122
+ background-size: 200% 100%;
123
+ animation: shimmer 1.6s linear infinite;
124
+ pointer-events: none;
125
+ }
126
+ @keyframes shimmer {
127
+ from {
128
+ background-position: 200% 0;
129
+ }
130
+ to {
131
+ background-position: -200% 0;
132
+ }
133
+ }
134
+ .frame.is-loaded .ph,
135
+ .frame.is-error .ph {
136
+ opacity: 0;
137
+ pointer-events: none;
138
+ }
139
+ .frame.is-error .ph::after {
140
+ animation: none;
141
+ }
142
+ .frame.is-error .err {
143
+ opacity: 1;
144
+ }
145
+ .err {
146
+ position: absolute;
147
+ inset: 0;
148
+ display: grid;
149
+ place-items: center;
150
+ background: var(--bg);
151
+ color: var(--ph-color);
152
+ font-size: 0.7rem;
153
+ letter-spacing: 0.04em;
154
+ opacity: 0;
155
+ transition: opacity var(--dur-fade) var(--ease);
156
+ }
157
+
158
+ /* ---------- Caption ---------- */
159
+ .caption {
160
+ position: absolute;
161
+ left: 0;
162
+ right: 0;
163
+ bottom: 0;
164
+ padding: 1.5rem 0.75rem 0.75rem;
165
+ background: var(--caption-fade);
166
+ color: var(--caption-color);
167
+ font-size: 0.85rem;
168
+ font-weight: 500;
169
+ pointer-events: none;
170
+ z-index: 2;
171
+ }
172
+
173
+ /* ---------- Zoom: lens ---------- */
174
+ :host([zoom='lens']) .frame {
175
+ cursor: zoom-in;
176
+ }
177
+ :host([zoom='lens']) .frame.is-zooming {
178
+ cursor: zoom-out;
179
+ }
180
+ :host([zoom='lens']) .frame.is-zooming .el {
181
+ transform: scale(var(--lens-scale));
182
+ }
183
+ .lens {
184
+ position: absolute;
185
+ width: var(--lens-size);
186
+ height: var(--lens-size);
187
+ border: 2px solid #fff;
188
+ border-radius: var(--ok-radius-sm, 6px);
189
+ background: rgba(255, 255, 255, 0.1);
190
+ backdrop-filter: blur(2px);
191
+ pointer-events: none;
192
+ opacity: 0;
193
+ box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.2);
194
+ transition: opacity var(--dur-fast) var(--ease);
195
+ z-index: 3;
196
+ }
197
+ .frame.is-zooming .lens {
198
+ opacity: 1;
199
+ }
200
+
201
+ /* ---------- Zoom: lightbox ---------- */
202
+ :host([zoom='lightbox']) .frame {
203
+ cursor: pointer;
204
+ }
205
+ .lb-hint {
206
+ position: absolute;
207
+ top: 0.5rem;
208
+ right: 0.5rem;
209
+ width: 28px;
210
+ height: 28px;
211
+ display: grid;
212
+ place-items: center;
213
+ border-radius: var(--ok-radius-sm, 6px);
214
+ background: rgba(0, 0, 0, 0.5);
215
+ color: #fff;
216
+ opacity: 0;
217
+ transition: opacity var(--dur-fast) var(--ease);
218
+ pointer-events: none;
219
+ z-index: 3;
220
+ }
221
+ :host([zoom='lightbox']) .frame:hover .lb-hint {
222
+ opacity: 1;
223
+ }
224
+ .lb-hint svg {
225
+ width: 14px;
226
+ height: 14px;
227
+ }
228
+
229
+ /* ---------- Overlay del lightbox ---------- */
230
+ .lightbox {
231
+ position: fixed;
232
+ inset: 0;
233
+ z-index: 9999;
234
+ display: grid;
235
+ place-items: center;
236
+ padding: 2rem;
237
+ background: rgba(0, 0, 0, 0.85);
238
+ cursor: zoom-out;
239
+ animation: lb-in var(--dur-fade) var(--ease);
240
+ }
241
+ @keyframes lb-in {
242
+ from {
243
+ opacity: 0;
244
+ }
245
+ to {
246
+ opacity: 1;
247
+ }
248
+ }
249
+ .lightbox img {
250
+ max-width: 100%;
251
+ max-height: 100%;
252
+ object-fit: contain;
253
+ border-radius: var(--ok-radius-md, 8px);
254
+ box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
255
+ }
256
+ .lb-close {
257
+ position: absolute;
258
+ top: 1rem;
259
+ right: 1rem;
260
+ width: 40px;
261
+ height: 40px;
262
+ display: grid;
263
+ place-items: center;
264
+ border: none;
265
+ border-radius: 50%;
266
+ background: rgba(255, 255, 255, 0.14);
267
+ color: #fff;
268
+ cursor: pointer;
269
+ transition: background var(--dur-fast) var(--ease);
270
+ }
271
+ .lb-close:hover {
272
+ background: rgba(255, 255, 255, 0.28);
273
+ }
274
+ .lb-close svg {
275
+ width: 20px;
276
+ height: 20px;
277
+ }
278
+
279
+ @media (prefers-reduced-motion: reduce) {
280
+ .el,
281
+ .ph,
282
+ .lightbox {
283
+ transition-duration: 0.01ms;
284
+ animation: none;
285
+ }
286
+ .ph::after {
287
+ animation: none;
288
+ }
289
+ }
290
+ `;
291
+ }
292
+ // Resetea el estado de carga cuando cambia el src.
293
+ willUpdate(changed) {
294
+ if (changed.has("src")) {
295
+ this.loaded = false;
296
+ this.errored = false;
297
+ }
298
+ }
299
+ onLoad() {
300
+ this.loaded = true;
301
+ }
302
+ onError() {
303
+ this.errored = true;
304
+ }
305
+ // ---------- Lens: seguir el puntero ----------
306
+ onPointerMove(e) {
307
+ if (this.zoom !== "lens" || !this.zooming) return;
308
+ const frame = e.currentTarget;
309
+ const r = frame.getBoundingClientRect();
310
+ this.lensX = Math.min(100, Math.max(0, (e.clientX - r.left) / r.width * 100));
311
+ this.lensY = Math.min(100, Math.max(0, (e.clientY - r.top) / r.height * 100));
312
+ }
313
+ onFrameClick() {
314
+ if (this.zoom === "lens") {
315
+ this.zooming = !this.zooming;
316
+ return;
317
+ }
318
+ if (this.zoom === "lightbox") {
319
+ this.openLightbox();
320
+ }
321
+ }
322
+ onPointerEnter() {
323
+ }
324
+ onPointerLeave() {
325
+ if (this.zoom === "lens") this.zooming = false;
326
+ }
327
+ openLightbox() {
328
+ this.lightboxOpen = true;
329
+ this.dispatchEvent(
330
+ new CustomEvent("ok-open", {
331
+ detail: { src: this.src, alt: this.alt },
332
+ bubbles: true,
333
+ composed: true
334
+ })
335
+ );
336
+ }
337
+ connectedCallback() {
338
+ super.connectedCallback();
339
+ window.addEventListener("keydown", this.onKeydown);
340
+ }
341
+ disconnectedCallback() {
342
+ super.disconnectedCallback();
343
+ window.removeEventListener("keydown", this.onKeydown);
344
+ }
345
+ renderLens() {
346
+ if (this.zoom !== "lens") return null;
347
+ return html`
348
+ <span
349
+ class="lens"
350
+ style="left:${this.lensX}%;top:${this.lensY}%;transform:translate(-50%,-50%);"
351
+ ></span>
352
+ `;
353
+ }
354
+ renderLightboxHint() {
355
+ if (this.zoom !== "lightbox") return null;
356
+ return html`
357
+ <span class="lb-hint" aria-hidden="true">
358
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
359
+ <circle cx="11" cy="11" r="8"></circle>
360
+ <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
361
+ <line x1="11" y1="8" x2="11" y2="14"></line>
362
+ <line x1="8" y1="11" x2="14" y2="11"></line>
363
+ </svg>
364
+ </span>
365
+ `;
366
+ }
367
+ renderLightbox() {
368
+ if (!this.lightboxOpen) return null;
369
+ return html`
370
+ <div class="lightbox" role="dialog" aria-modal="true" @click=${this.closeLightbox}>
371
+ <button
372
+ class="lb-close"
373
+ type="button"
374
+ aria-label="Cerrar"
375
+ @click=${this.closeLightbox}
376
+ >
377
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
378
+ <line x1="18" y1="6" x2="6" y2="18"></line>
379
+ <line x1="6" y1="6" x2="18" y2="18"></line>
380
+ </svg>
381
+ </button>
382
+ <img src=${this.src} alt=${this.alt} />
383
+ </div>
384
+ `;
385
+ }
386
+ render() {
387
+ const interactive = this.zoom !== "none";
388
+ const cls = [
389
+ "frame",
390
+ this.loaded ? "is-loaded" : "",
391
+ this.errored ? "is-error" : "",
392
+ this.zooming ? "is-zooming" : ""
393
+ ].filter(Boolean).join(" ");
394
+ return html`
395
+ <div
396
+ class=${cls}
397
+ role=${interactive ? "button" : "img"}
398
+ aria-label=${interactive ? this.alt || "Imagen" : this.alt}
399
+ tabindex=${interactive ? "0" : "-1"}
400
+ @click=${interactive ? this.onFrameClick : null}
401
+ @keydown=${interactive ? (e) => {
402
+ if (e.key === "Enter" || e.key === " ") {
403
+ e.preventDefault();
404
+ this.onFrameClick();
405
+ }
406
+ } : null}
407
+ @pointermove=${this.onPointerMove}
408
+ @pointerenter=${this.onPointerEnter}
409
+ @pointerleave=${this.onPointerLeave}
410
+ >
411
+ <img
412
+ class="el"
413
+ src=${this.src}
414
+ alt=${this.alt}
415
+ loading="lazy"
416
+ decoding="async"
417
+ @load=${this.onLoad}
418
+ @error=${this.onError}
419
+ />
420
+ <div class="ph" aria-hidden="true">${this.placeholderText}</div>
421
+ <div class="err" aria-hidden=${!this.errored}>imagen no disponible</div>
422
+ ${this.renderLens()} ${this.renderLightboxHint()}
423
+ ${this.caption ? html`<div class="caption">${this.caption}</div>` : null}
424
+ </div>
425
+ ${this.renderLightbox()}
426
+ `;
427
+ }
428
+ }
429
+ __decorateClass([
430
+ property()
431
+ ], OkImage.prototype, "src");
432
+ __decorateClass([
433
+ property()
434
+ ], OkImage.prototype, "alt");
435
+ __decorateClass([
436
+ property({ reflect: true })
437
+ ], OkImage.prototype, "ratio");
438
+ __decorateClass([
439
+ property()
440
+ ], OkImage.prototype, "caption");
441
+ __decorateClass([
442
+ property({ reflect: true })
443
+ ], OkImage.prototype, "radius");
444
+ __decorateClass([
445
+ property({ reflect: true })
446
+ ], OkImage.prototype, "zoom");
447
+ __decorateClass([
448
+ property({ attribute: "placeholder-text" })
449
+ ], OkImage.prototype, "placeholderText");
450
+ __decorateClass([
451
+ state()
452
+ ], OkImage.prototype, "loaded");
453
+ __decorateClass([
454
+ state()
455
+ ], OkImage.prototype, "errored");
456
+ __decorateClass([
457
+ state()
458
+ ], OkImage.prototype, "zooming");
459
+ __decorateClass([
460
+ state()
461
+ ], OkImage.prototype, "lightboxOpen");
462
+ __decorateClass([
463
+ state()
464
+ ], OkImage.prototype, "lensX");
465
+ __decorateClass([
466
+ state()
467
+ ], OkImage.prototype, "lensY");
468
+ define("ok-image", OkImage);
469
+ export {
470
+ OkImage
471
+ };
@@ -0,0 +1,221 @@
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 DEFAULT_LABELS = {
14
+ dismiss: "Dismiss"
15
+ };
16
+ class OkInlineFeedback extends LitElement {
17
+ constructor() {
18
+ super(...arguments);
19
+ this.tone = "info";
20
+ this.dismissible = false;
21
+ this.hidden = false;
22
+ this.labels = {};
23
+ this.hasActions = false;
24
+ this.onActionsSlotChange = (e) => {
25
+ const slot = e.target;
26
+ this.hasActions = slot.assignedNodes({ flatten: true }).length > 0;
27
+ };
28
+ }
29
+ static {
30
+ this.styles = css`
31
+ :host {
32
+ /* Vars overridable (estilo Ionic), default = cadena --ok-* → --ion-* → hex.
33
+ --tone-color y --tone-icon se reasignan por tone abajo. */
34
+ --tone-color: var(--ok-primary, var(--ion-color-primary, #3880ff));
35
+ --background-opacity: 0.1;
36
+ --color: var(--ok-text, var(--ion-text-color, #1c1b17));
37
+ --border-radius: var(--ok-radius, var(--ion-border-radius, 8px));
38
+ --padding: var(--ok-spacing, var(--ion-padding, 16px));
39
+ --accent-width: 4px;
40
+ --font: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
41
+
42
+ /* Responsive: el banner ocupa el ancho del contenedor. */
43
+ display: block;
44
+ width: 100%;
45
+ font-family: var(--font);
46
+ box-sizing: border-box;
47
+ }
48
+ :host([hidden]) { display: none; }
49
+
50
+ /* Mapa de tonos → color Ionic + icono por defecto. */
51
+ :host([tone='success']) { --tone-color: var(--ok-success, var(--ion-color-success, #2dd55b)); }
52
+ :host([tone='warning']) { --tone-color: var(--ok-warning, var(--ion-color-warning, #ffc409)); }
53
+ :host([tone='danger']) { --tone-color: var(--ok-danger, var(--ion-color-danger, #c5000f)); }
54
+ :host([tone='neutral']) { --tone-color: var(--ok-medium, var(--ion-color-medium, #5f5f5f)); }
55
+ /* info / sin tono → primary (default ya aplicado en :host). */
56
+
57
+ .box {
58
+ position: relative;
59
+ display: flex;
60
+ align-items: flex-start;
61
+ gap: 0.75rem;
62
+ padding: var(--padding);
63
+ border-radius: var(--border-radius);
64
+ border-inline-start: var(--accent-width) solid var(--tone-color);
65
+ /* Fondo tonal: el color del tono con baja opacidad (color-mix con fallback al borde fino). */
66
+ background: color-mix(in srgb, var(--tone-color) calc(var(--background-opacity) * 100%), transparent);
67
+ color: var(--color);
68
+ }
69
+
70
+ .icon {
71
+ flex: 0 0 auto;
72
+ font-size: 1.4rem;
73
+ line-height: 1;
74
+ color: var(--tone-color);
75
+ margin-top: 0.05rem;
76
+ }
77
+
78
+ .content {
79
+ flex: 1 1 auto;
80
+ min-width: 0;
81
+ display: flex;
82
+ flex-direction: column;
83
+ gap: 0.5rem;
84
+ }
85
+ .row {
86
+ display: flex;
87
+ align-items: flex-start;
88
+ gap: 1rem;
89
+ }
90
+ .text {
91
+ flex: 1 1 auto;
92
+ min-width: 0;
93
+ display: flex;
94
+ flex-direction: column;
95
+ gap: 0.2rem;
96
+ }
97
+ .heading {
98
+ font-weight: 700;
99
+ font-size: 0.98rem;
100
+ line-height: 1.3;
101
+ }
102
+ .body {
103
+ font-size: 0.92rem;
104
+ line-height: 1.45;
105
+ }
106
+ .actions {
107
+ flex: 0 0 auto;
108
+ display: flex;
109
+ align-items: center;
110
+ gap: 0.5rem;
111
+ }
112
+ /* Si no hay actions, el slot queda vacío y no ocupa espacio. */
113
+ .actions.empty { display: none; }
114
+
115
+ .close {
116
+ flex: 0 0 auto;
117
+ background: none;
118
+ border: 0;
119
+ cursor: pointer;
120
+ padding: 0.15rem;
121
+ margin: -0.15rem -0.15rem 0 0;
122
+ color: inherit;
123
+ opacity: 0.6;
124
+ font-size: 1.2rem;
125
+ line-height: 1;
126
+ border-radius: 4px;
127
+ transition: background-color var(--ok-transition, 150ms ease), color var(--ok-transition, 150ms ease),
128
+ border-color var(--ok-transition, 150ms ease), box-shadow var(--ok-transition, 150ms ease),
129
+ opacity 0.15s ease, transform 120ms ease;
130
+ }
131
+ @media (hover: hover) {
132
+ .close:hover { opacity: 1; background: rgba(var(--ion-text-color-rgb, 24, 24, 27), 0.07); }
133
+ }
134
+ .close:active { transform: scale(var(--ok-press-scale, 0.97)); }
135
+
136
+ /* Móvil: las actions bajan bajo el texto (apiladas a ancho completo). */
137
+ @media (max-width: 640px) {
138
+ .row { flex-direction: column; align-items: stretch; }
139
+ .actions { width: 100%; }
140
+ }
141
+ @media (prefers-reduced-motion: reduce) {
142
+ .close:hover,
143
+ .close:active { transform: none; }
144
+ }
145
+ `;
146
+ }
147
+ // Textos efectivos: defaults en inglés + overrides del consumidor.
148
+ get t() {
149
+ return { ...DEFAULT_LABELS, ...this.labels };
150
+ }
151
+ // Icono por defecto según el tono (overridable por la prop `icon`).
152
+ defaultIcon() {
153
+ switch (this.tone) {
154
+ case "success":
155
+ return "checkmark-circle";
156
+ case "warning":
157
+ return "warning";
158
+ case "danger":
159
+ return "alert-circle";
160
+ case "neutral":
161
+ return "information-circle";
162
+ case "info":
163
+ default:
164
+ return "information-circle";
165
+ }
166
+ }
167
+ // Oculta el banner y avisa al consumidor; éste puede revertir restaurando `hidden=false`.
168
+ dismiss() {
169
+ this.hidden = true;
170
+ this.dispatchEvent(new CustomEvent("ok-dismiss", { bubbles: true, composed: true }));
171
+ }
172
+ render() {
173
+ const iconName = this.icon ?? this.defaultIcon();
174
+ return html`
175
+ <div class="box" role="status">
176
+ <ion-icon class="icon" name=${iconName} aria-hidden="true"></ion-icon>
177
+ <div class="content">
178
+ <div class="row">
179
+ <div class="text">
180
+ ${this.heading ? html`<div class="heading">${this.heading}</div>` : null}
181
+ <div class="body"><slot></slot></div>
182
+ </div>
183
+ <div class="actions ${this.hasActions ? "" : "empty"}">
184
+ <slot name="actions" @slotchange=${this.onActionsSlotChange}></slot>
185
+ </div>
186
+ </div>
187
+ </div>
188
+ ${this.dismissible ? html`
189
+ <button class="close" aria-label=${this.t.dismiss} @click=${this.dismiss}>
190
+ <ion-icon name="close" aria-hidden="true"></ion-icon>
191
+ </button>
192
+ ` : null}
193
+ </div>
194
+ `;
195
+ }
196
+ }
197
+ __decorateClass([
198
+ property({ type: String, reflect: true })
199
+ ], OkInlineFeedback.prototype, "tone");
200
+ __decorateClass([
201
+ property({ type: String })
202
+ ], OkInlineFeedback.prototype, "heading");
203
+ __decorateClass([
204
+ property({ type: String })
205
+ ], OkInlineFeedback.prototype, "icon");
206
+ __decorateClass([
207
+ property({ type: Boolean, reflect: true })
208
+ ], OkInlineFeedback.prototype, "dismissible");
209
+ __decorateClass([
210
+ property({ type: Boolean, reflect: true })
211
+ ], OkInlineFeedback.prototype, "hidden");
212
+ __decorateClass([
213
+ property({ attribute: false })
214
+ ], OkInlineFeedback.prototype, "labels");
215
+ __decorateClass([
216
+ state()
217
+ ], OkInlineFeedback.prototype, "hasActions");
218
+ define("ok-inline-feedback", OkInlineFeedback);
219
+ export {
220
+ OkInlineFeedback
221
+ };