@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,541 @@
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
+ month: "Month",
15
+ agenda: "Agenda",
16
+ more: "+{n} more",
17
+ agendaEmpty: "No upcoming events.",
18
+ prevMonth: "Previous month",
19
+ nextMonth: "Next month"
20
+ };
21
+ const WEEKDAY_REF = new Date(2021, 1, 1);
22
+ class OkCalendar extends LitElement {
23
+ constructor() {
24
+ super(...arguments);
25
+ this.events = [];
26
+ this.value = "";
27
+ this.view = "month";
28
+ this.maxPerDay = 3;
29
+ this.locale = "en-US";
30
+ this.labels = {};
31
+ this.cursor = /* @__PURE__ */ new Date();
32
+ this.seeded = false;
33
+ }
34
+ static {
35
+ this.styles = css`
36
+ :host {
37
+ /* Vars overridable (estilo Ionic), default = cadena --ok-* → --ion-* → hex */
38
+ --color: var(--ok-text, var(--ion-text-color, #1c1b17));
39
+ --color-muted: var(--ok-text-muted, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.55));
40
+ --background: var(--ok-surface, var(--ion-background-color, #ffffff));
41
+ --primary-color: var(--ok-primary, var(--ion-color-primary, #3880ff));
42
+ --primary-contrast: var(--ok-primary-contrast, var(--ion-color-primary-contrast, #ffffff));
43
+ --hover-bg: var(--ok-hover, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.06));
44
+ --border-color: var(--ok-border-soft, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.12));
45
+ --today-bg: var(--ok-today-bg, rgba(var(--ion-color-primary-rgb, 56, 128, 255), 0.1));
46
+ --border-radius: var(--ok-radius, 8px);
47
+ --font: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
48
+
49
+ /* Por defecto ocupa el ancho del contenedor y es responsive. */
50
+ display: block;
51
+ width: 100%;
52
+ color: var(--color);
53
+ font-family: var(--font);
54
+ font-size: 0.95rem;
55
+ box-sizing: border-box;
56
+ }
57
+ * {
58
+ box-sizing: border-box;
59
+ }
60
+
61
+ /* ── Cabecera ───────────────────────────────────────────────── */
62
+ .header {
63
+ display: flex;
64
+ align-items: center;
65
+ justify-content: space-between;
66
+ gap: 0.5rem;
67
+ margin-bottom: 0.75rem;
68
+ flex-wrap: wrap;
69
+ }
70
+ .nav {
71
+ display: flex;
72
+ align-items: center;
73
+ gap: 0.25rem;
74
+ }
75
+ .title {
76
+ min-width: 9rem;
77
+ text-align: center;
78
+ font-weight: 600;
79
+ font-size: 1.05rem;
80
+ text-transform: capitalize;
81
+ }
82
+ .toggle {
83
+ display: inline-flex;
84
+ border: 1px solid var(--border-color);
85
+ border-radius: var(--border-radius);
86
+ overflow: hidden;
87
+ }
88
+ .toggle button {
89
+ border: 0;
90
+ background: none;
91
+ color: var(--color-muted);
92
+ font: inherit;
93
+ font-size: 0.85rem;
94
+ padding: 0.35rem 0.75rem;
95
+ cursor: pointer;
96
+ transition: background-color var(--ok-transition, 150ms ease),
97
+ color var(--ok-transition, 150ms ease), border-color var(--ok-transition, 150ms ease),
98
+ box-shadow var(--ok-transition, 150ms ease), transform 120ms ease;
99
+ }
100
+ @media (hover: hover) {
101
+ .toggle button:not(.active):hover {
102
+ background: var(--hover-bg);
103
+ color: var(--color);
104
+ }
105
+ }
106
+ .toggle button:active {
107
+ transform: scale(var(--ok-press-scale, 0.97));
108
+ }
109
+ .toggle button.active {
110
+ background: var(--primary-color);
111
+ color: var(--primary-contrast);
112
+ }
113
+
114
+ /* ── Vista MES ──────────────────────────────────────────────── */
115
+ .grid {
116
+ display: grid;
117
+ grid-template-columns: repeat(7, minmax(0, 1fr));
118
+ gap: 1px;
119
+ background: var(--border-color);
120
+ border: 1px solid var(--border-color);
121
+ border-radius: var(--border-radius);
122
+ overflow: hidden;
123
+ }
124
+ .weekday {
125
+ background: var(--background);
126
+ padding: 0.4rem 0.25rem;
127
+ text-align: center;
128
+ font-size: 0.75rem;
129
+ font-weight: 600;
130
+ color: var(--color-muted);
131
+ text-transform: uppercase;
132
+ }
133
+ .day {
134
+ background: var(--background);
135
+ min-height: 5.5rem;
136
+ padding: 0.3rem;
137
+ display: flex;
138
+ flex-direction: column;
139
+ gap: 0.2rem;
140
+ cursor: pointer;
141
+ transition: background-color var(--ok-transition, 150ms ease),
142
+ color var(--ok-transition, 150ms ease), border-color var(--ok-transition, 150ms ease),
143
+ box-shadow var(--ok-transition, 150ms ease), transform 120ms ease;
144
+ overflow: hidden;
145
+ }
146
+ @media (hover: hover) {
147
+ .day:hover {
148
+ background: var(--hover-bg);
149
+ }
150
+ }
151
+ .day:active {
152
+ transform: scale(var(--ok-press-scale, 0.97));
153
+ }
154
+ .day.other-month {
155
+ opacity: 0.4;
156
+ }
157
+ .day.today .daynum {
158
+ background: var(--primary-color);
159
+ color: var(--primary-contrast);
160
+ }
161
+ .day.selected {
162
+ box-shadow: inset 0 0 0 2px var(--primary-color);
163
+ }
164
+ .daynum {
165
+ align-self: flex-end;
166
+ display: inline-flex;
167
+ align-items: center;
168
+ justify-content: center;
169
+ min-width: 1.5rem;
170
+ height: 1.5rem;
171
+ padding: 0 0.35rem;
172
+ border-radius: 999px;
173
+ font-size: 0.8rem;
174
+ font-variant-numeric: tabular-nums;
175
+ }
176
+ .chips {
177
+ display: flex;
178
+ flex-direction: column;
179
+ gap: 0.15rem;
180
+ min-width: 0;
181
+ }
182
+ .chip {
183
+ display: flex;
184
+ align-items: center;
185
+ gap: 0.3rem;
186
+ padding: 0.1rem 0.3rem;
187
+ border-radius: 4px;
188
+ font-size: 0.72rem;
189
+ line-height: 1.3;
190
+ color: var(--primary-contrast);
191
+ cursor: pointer;
192
+ overflow: hidden;
193
+ white-space: nowrap;
194
+ text-overflow: ellipsis;
195
+ transition: background-color var(--ok-transition, 150ms ease),
196
+ color var(--ok-transition, 150ms ease), border-color var(--ok-transition, 150ms ease),
197
+ box-shadow var(--ok-transition, 150ms ease), transform 120ms ease;
198
+ }
199
+ @media (hover: hover) {
200
+ .chip:hover {
201
+ filter: brightness(1.05);
202
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
203
+ }
204
+ }
205
+ .chip:active {
206
+ transform: scale(var(--ok-press-scale, 0.97));
207
+ }
208
+ .chip .chip-title {
209
+ overflow: hidden;
210
+ text-overflow: ellipsis;
211
+ }
212
+ .more {
213
+ font-size: 0.7rem;
214
+ color: var(--color-muted);
215
+ padding: 0 0.3rem;
216
+ cursor: pointer;
217
+ }
218
+
219
+ /* ── Vista AGENDA ───────────────────────────────────────────── */
220
+ .agenda {
221
+ display: flex;
222
+ flex-direction: column;
223
+ gap: 1rem;
224
+ }
225
+ .agenda-empty {
226
+ color: var(--color-muted);
227
+ padding: 1rem;
228
+ text-align: center;
229
+ }
230
+ .agenda-group {
231
+ display: flex;
232
+ flex-direction: column;
233
+ gap: 0.35rem;
234
+ }
235
+ .agenda-date {
236
+ font-size: 0.8rem;
237
+ font-weight: 600;
238
+ color: var(--color-muted);
239
+ text-transform: capitalize;
240
+ border-bottom: 1px solid var(--border-color);
241
+ padding-bottom: 0.25rem;
242
+ }
243
+ .agenda-item {
244
+ display: flex;
245
+ align-items: center;
246
+ gap: 0.5rem;
247
+ padding: 0.4rem 0.3rem;
248
+ border-radius: var(--border-radius);
249
+ cursor: pointer;
250
+ transition: background-color var(--ok-transition, 150ms ease),
251
+ color var(--ok-transition, 150ms ease), border-color var(--ok-transition, 150ms ease),
252
+ box-shadow var(--ok-transition, 150ms ease), transform 120ms ease;
253
+ }
254
+ @media (hover: hover) {
255
+ .agenda-item:hover {
256
+ background: var(--hover-bg);
257
+ }
258
+ }
259
+ .agenda-item:active {
260
+ transform: scale(var(--ok-press-scale, 0.97));
261
+ }
262
+ .dot {
263
+ flex: 0 0 auto;
264
+ width: 0.6rem;
265
+ height: 0.6rem;
266
+ border-radius: 999px;
267
+ }
268
+ .agenda-title {
269
+ flex: 1 1 auto;
270
+ min-width: 0;
271
+ overflow: hidden;
272
+ text-overflow: ellipsis;
273
+ white-space: nowrap;
274
+ }
275
+
276
+ @media (prefers-reduced-motion: reduce) {
277
+ .toggle button:active,
278
+ .day:active,
279
+ .chip:active,
280
+ .agenda-item:active {
281
+ transform: none;
282
+ }
283
+ }
284
+
285
+ /* ── Responsive (móvil) ─────────────────────────────────────── */
286
+ @media (max-width: 540px) {
287
+ .day {
288
+ min-height: 3.5rem;
289
+ padding: 0.2rem;
290
+ }
291
+ .weekday {
292
+ font-size: 0.65rem;
293
+ padding: 0.3rem 0.1rem;
294
+ }
295
+ .chip-title {
296
+ display: none;
297
+ }
298
+ .chip {
299
+ height: 0.5rem;
300
+ padding: 0;
301
+ }
302
+ }
303
+ `;
304
+ }
305
+ /** Textos efectivos: defaults INGLÉS mezclados con los del consumidor. */
306
+ get t() {
307
+ return { ...DEFAULT_LABELS, ...this.labels };
308
+ }
309
+ // Nombres cortos de los días (Lun–Dom) según el locale actual.
310
+ weekdays() {
311
+ const fmt = new Intl.DateTimeFormat(this.locale, { weekday: "short" });
312
+ return Array.from(
313
+ { length: 7 },
314
+ (_, i) => fmt.format(new Date(WEEKDAY_REF.getFullYear(), WEEKDAY_REF.getMonth(), 1 + i))
315
+ );
316
+ }
317
+ // Normaliza una fecha (`YYYY-MM-DD` o ISO) a clave local `YYYY-MM-DD`.
318
+ dayKey(d) {
319
+ const y = d.getFullYear();
320
+ const m = String(d.getMonth() + 1).padStart(2, "0");
321
+ const day = String(d.getDate()).padStart(2, "0");
322
+ return `${y}-${m}-${day}`;
323
+ }
324
+ // Parsea una cadena de fecha del consumidor a `Date` local (ignora la hora si es ISO).
325
+ parseDate(s) {
326
+ const datePart = s.slice(0, 10);
327
+ const [y, m, d] = datePart.split("-").map(Number);
328
+ if (y && m && d) return new Date(y, m - 1, d);
329
+ const parsed = new Date(s);
330
+ return isNaN(parsed.getTime()) ? /* @__PURE__ */ new Date() : parsed;
331
+ }
332
+ // Índice eventos por día (`YYYY-MM-DD` → eventos), ordenados por título para estabilidad.
333
+ indexEvents() {
334
+ const map = /* @__PURE__ */ new Map();
335
+ for (const ev of this.events) {
336
+ const key = this.dayKey(this.parseDate(ev.date));
337
+ const arr = map.get(key);
338
+ if (arr) arr.push(ev);
339
+ else map.set(key, [ev]);
340
+ }
341
+ return map;
342
+ }
343
+ // Cambia el mes visible (delta en meses) y emite `ok-nav`.
344
+ navMonth(delta) {
345
+ const next = new Date(this.cursor.getFullYear(), this.cursor.getMonth() + delta, 1);
346
+ this.cursor = next;
347
+ this.dispatchEvent(
348
+ new CustomEvent("ok-nav", {
349
+ detail: { year: next.getFullYear(), month: next.getMonth() + 1 },
350
+ bubbles: true,
351
+ composed: true
352
+ })
353
+ );
354
+ }
355
+ // Cambia de vista y emite `ok-view-change`.
356
+ setView(view) {
357
+ if (view === this.view) return;
358
+ this.view = view;
359
+ this.dispatchEvent(
360
+ new CustomEvent("ok-view-change", {
361
+ detail: { view },
362
+ bubbles: true,
363
+ composed: true
364
+ })
365
+ );
366
+ }
367
+ // Selecciona un día y emite `ok-date-select`.
368
+ selectDay(key) {
369
+ this.value = key;
370
+ this.dispatchEvent(
371
+ new CustomEvent("ok-date-select", {
372
+ detail: { date: key },
373
+ bubbles: true,
374
+ composed: true
375
+ })
376
+ );
377
+ }
378
+ // Emite el click sobre un evento (sin propagar al día contenedor).
379
+ clickEvent(ev, e) {
380
+ e.stopPropagation();
381
+ this.dispatchEvent(
382
+ new CustomEvent("ok-event-click", {
383
+ detail: { id: ev.id, event: ev },
384
+ bubbles: true,
385
+ composed: true
386
+ })
387
+ );
388
+ }
389
+ // Etiqueta de mes/año del cursor (capitalizada vía CSS).
390
+ monthLabel() {
391
+ return this.cursor.toLocaleDateString(this.locale, { month: "long", year: "numeric" });
392
+ }
393
+ // Construye la matriz de días visibles (semanas que empiezan en lunes).
394
+ buildDays() {
395
+ const year = this.cursor.getFullYear();
396
+ const month = this.cursor.getMonth();
397
+ const first = new Date(year, month, 1);
398
+ const offset = (first.getDay() + 6) % 7;
399
+ const start = new Date(year, month, 1 - offset);
400
+ const days = [];
401
+ for (let i = 0; i < 42; i++) {
402
+ days.push(new Date(start.getFullYear(), start.getMonth(), start.getDate() + i));
403
+ }
404
+ return days;
405
+ }
406
+ // Render de la vista MES.
407
+ renderMonth(byDay) {
408
+ const todayKey = this.dayKey(/* @__PURE__ */ new Date());
409
+ const month = this.cursor.getMonth();
410
+ const days = this.buildDays();
411
+ return html`<div class="grid">
412
+ ${this.weekdays().map((w) => html`<div class="weekday">${w}</div>`)}
413
+ ${days.map((d) => {
414
+ const key = this.dayKey(d);
415
+ const dayEvents = byDay.get(key) ?? [];
416
+ const visible = dayEvents.slice(0, this.maxPerDay);
417
+ const extra = dayEvents.length - visible.length;
418
+ const classes = [
419
+ "day",
420
+ d.getMonth() !== month ? "other-month" : "",
421
+ key === todayKey ? "today" : "",
422
+ key === this.value ? "selected" : ""
423
+ ].filter(Boolean).join(" ");
424
+ return html`<div class=${classes} @click=${() => this.selectDay(key)}>
425
+ <span class="daynum">${d.getDate()}</span>
426
+ <div class="chips">
427
+ ${visible.map(
428
+ (ev) => html`<span
429
+ class="chip"
430
+ style=${`background:${ev.color || "var(--primary-color)"}`}
431
+ title=${ev.title}
432
+ @click=${(e) => this.clickEvent(ev, e)}
433
+ >
434
+ <span class="chip-title">${ev.title}</span>
435
+ </span>`
436
+ )}
437
+ ${extra > 0 ? html`<span class="more">${this.t.more.replace("{n}", String(extra))}</span>` : ""}
438
+ </div>
439
+ </div>`;
440
+ })}
441
+ </div>`;
442
+ }
443
+ // Render de la vista AGENDA: próximos eventos (hoy en adelante) agrupados por día.
444
+ renderAgenda(byDay) {
445
+ const todayKey = this.dayKey(/* @__PURE__ */ new Date());
446
+ const keys = [...byDay.keys()].filter((k) => k >= todayKey).sort();
447
+ if (keys.length === 0) {
448
+ return html`<div class="agenda-empty">${this.t.agendaEmpty}</div>`;
449
+ }
450
+ return html`<div class="agenda">
451
+ ${keys.map((key) => {
452
+ const d = this.parseDate(key);
453
+ const label = d.toLocaleDateString(this.locale, {
454
+ weekday: "long",
455
+ day: "numeric",
456
+ month: "long"
457
+ });
458
+ return html`<div class="agenda-group">
459
+ <div class="agenda-date">${label}</div>
460
+ ${byDay.get(key).map(
461
+ (ev) => html`<div class="agenda-item" @click=${(e) => this.clickEvent(ev, e)}>
462
+ <span class="dot" style=${`background:${ev.color || "var(--primary-color)"}`}></span>
463
+ <span class="agenda-title">${ev.title}</span>
464
+ <ion-icon name="chevron-forward-outline"></ion-icon>
465
+ </div>`
466
+ )}
467
+ </div>`;
468
+ })}
469
+ </div>`;
470
+ }
471
+ render() {
472
+ if (!this.seeded) {
473
+ if (this.value) this.cursor = this.parseDate(this.value);
474
+ this.seeded = true;
475
+ }
476
+ const byDay = this.indexEvents();
477
+ return html`<div class="header">
478
+ <div class="nav">
479
+ <ion-button
480
+ fill="clear"
481
+ size="small"
482
+ aria-label=${this.t.prevMonth}
483
+ @click=${() => this.navMonth(-1)}
484
+ >
485
+ <ion-icon slot="icon-only" name="chevron-back-outline"></ion-icon>
486
+ </ion-button>
487
+ <span class="title">${this.monthLabel()}</span>
488
+ <ion-button
489
+ fill="clear"
490
+ size="small"
491
+ aria-label=${this.t.nextMonth}
492
+ @click=${() => this.navMonth(1)}
493
+ >
494
+ <ion-icon slot="icon-only" name="chevron-forward-outline"></ion-icon>
495
+ </ion-button>
496
+ </div>
497
+ <div class="toggle" role="tablist">
498
+ <button
499
+ type="button"
500
+ class=${this.view === "month" ? "active" : ""}
501
+ @click=${() => this.setView("month")}
502
+ >
503
+ ${this.t.month}
504
+ </button>
505
+ <button
506
+ type="button"
507
+ class=${this.view === "agenda" ? "active" : ""}
508
+ @click=${() => this.setView("agenda")}
509
+ >
510
+ ${this.t.agenda}
511
+ </button>
512
+ </div>
513
+ </div>
514
+ ${this.view === "agenda" ? this.renderAgenda(byDay) : this.renderMonth(byDay)}`;
515
+ }
516
+ }
517
+ __decorateClass([
518
+ property({ attribute: false })
519
+ ], OkCalendar.prototype, "events");
520
+ __decorateClass([
521
+ property()
522
+ ], OkCalendar.prototype, "value");
523
+ __decorateClass([
524
+ property()
525
+ ], OkCalendar.prototype, "view");
526
+ __decorateClass([
527
+ property({ type: Number, attribute: "max-per-day" })
528
+ ], OkCalendar.prototype, "maxPerDay");
529
+ __decorateClass([
530
+ property()
531
+ ], OkCalendar.prototype, "locale");
532
+ __decorateClass([
533
+ property({ attribute: false })
534
+ ], OkCalendar.prototype, "labels");
535
+ __decorateClass([
536
+ state()
537
+ ], OkCalendar.prototype, "cursor");
538
+ define("ok-calendar", OkCalendar);
539
+ export {
540
+ OkCalendar
541
+ };