@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,518 @@
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
+ prevDay: "Previous day",
15
+ nextDay: "Next day",
16
+ empty: "No resources to display."
17
+ };
18
+ class OkScheduler extends LitElement {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.resources = [];
22
+ this.events = [];
23
+ this.date = "";
24
+ this.startHour = 8;
25
+ this.endHour = 20;
26
+ this.slotMin = 60;
27
+ this.locale = "en-US";
28
+ this.labels = {};
29
+ this.cursor = /* @__PURE__ */ new Date();
30
+ this.seeded = false;
31
+ }
32
+ static {
33
+ this.styles = css`
34
+ :host {
35
+ /* Vars overridable (estilo Ionic), default = cadena --ok-* → --ion-* → hex */
36
+ --color: var(--ok-text, var(--ion-text-color, #1c1b17));
37
+ --color-muted: var(--ok-text-muted, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.55));
38
+ --background: var(--ok-surface, var(--ion-background-color, #ffffff));
39
+ --primary-color: var(--ok-primary, var(--ion-color-primary, #3880ff));
40
+ --primary-contrast: var(--ok-primary-contrast, var(--ion-color-primary-contrast, #ffffff));
41
+ --hover-bg: var(--ok-hover, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.06));
42
+ --border-color: var(--ok-border-soft, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.12));
43
+ --border-radius: var(--ok-radius, 8px);
44
+ --resource-width: var(--ok-scheduler-resource-width, 11rem);
45
+ --hour-width: var(--ok-scheduler-hour-width, 6rem);
46
+ --row-height: var(--ok-scheduler-row-height, 3.5rem);
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 de navegación de día ──────────────────────────── */
62
+ .toolbar {
63
+ display: flex;
64
+ align-items: center;
65
+ justify-content: center;
66
+ gap: 0.25rem;
67
+ margin-bottom: 0.6rem;
68
+ }
69
+ .toolbar .title {
70
+ min-width: 12rem;
71
+ text-align: center;
72
+ font-weight: 600;
73
+ font-size: 1.05rem;
74
+ text-transform: capitalize;
75
+ }
76
+
77
+ /* ── Contenedor con scroll horizontal ───────────────────────── */
78
+ .scroll {
79
+ width: 100%;
80
+ overflow-x: auto;
81
+ overflow-y: hidden;
82
+ border: 1px solid var(--border-color);
83
+ border-radius: var(--border-radius);
84
+ -webkit-overflow-scrolling: touch;
85
+ }
86
+ /* El grid interior tiene ancho intrínseco = columna recurso + franja horaria. */
87
+ .grid {
88
+ display: inline-block;
89
+ min-width: 100%;
90
+ }
91
+
92
+ /* ── Cabecera horaria ───────────────────────────────────────── */
93
+ .head-row {
94
+ display: flex;
95
+ position: sticky;
96
+ top: 0;
97
+ z-index: 3;
98
+ }
99
+ .corner {
100
+ flex: 0 0 var(--resource-width);
101
+ width: var(--resource-width);
102
+ position: sticky;
103
+ left: 0;
104
+ z-index: 4;
105
+ background: var(--background);
106
+ border-right: 1px solid var(--border-color);
107
+ border-bottom: 1px solid var(--border-color);
108
+ }
109
+ .timeline {
110
+ display: flex;
111
+ flex: 1 1 auto;
112
+ }
113
+ .hour {
114
+ flex: 0 0 var(--hour-width);
115
+ width: var(--hour-width);
116
+ padding: 0.4rem 0.5rem;
117
+ font-size: 0.78rem;
118
+ font-weight: 600;
119
+ color: var(--color-muted);
120
+ text-align: left;
121
+ background: var(--background);
122
+ border-bottom: 1px solid var(--border-color);
123
+ border-right: 1px solid var(--border-color);
124
+ font-variant-numeric: tabular-nums;
125
+ }
126
+ .hour:last-child {
127
+ border-right: 0;
128
+ }
129
+
130
+ /* ── Filas de recurso ───────────────────────────────────────── */
131
+ .row {
132
+ display: flex;
133
+ border-top: 1px solid var(--border-color);
134
+ }
135
+ .row:first-of-type {
136
+ border-top: 0;
137
+ }
138
+ .resource {
139
+ flex: 0 0 var(--resource-width);
140
+ width: var(--resource-width);
141
+ min-height: var(--row-height);
142
+ position: sticky;
143
+ left: 0;
144
+ z-index: 2;
145
+ display: flex;
146
+ align-items: center;
147
+ gap: 0.5rem;
148
+ padding: 0.4rem 0.6rem;
149
+ background: var(--background);
150
+ border-right: 1px solid var(--border-color);
151
+ }
152
+ .avatar {
153
+ flex: 0 0 auto;
154
+ width: 2rem;
155
+ height: 2rem;
156
+ border-radius: 999px;
157
+ object-fit: cover;
158
+ background: var(--hover-bg);
159
+ }
160
+ .avatar-fallback {
161
+ flex: 0 0 auto;
162
+ display: inline-flex;
163
+ align-items: center;
164
+ justify-content: center;
165
+ width: 2rem;
166
+ height: 2rem;
167
+ border-radius: 999px;
168
+ background: var(--hover-bg);
169
+ color: var(--color-muted);
170
+ font-size: 0.85rem;
171
+ font-weight: 600;
172
+ text-transform: uppercase;
173
+ }
174
+ .resource-label {
175
+ flex: 1 1 auto;
176
+ min-width: 0;
177
+ overflow: hidden;
178
+ text-overflow: ellipsis;
179
+ white-space: nowrap;
180
+ font-weight: 500;
181
+ }
182
+
183
+ /* ── Pista de eventos (lane) de un recurso ──────────────────── */
184
+ .lane {
185
+ position: relative;
186
+ flex: 1 1 auto;
187
+ min-height: var(--row-height);
188
+ background: var(--background);
189
+ }
190
+ /* Celdas-slot clicables de fondo (para crear turnos). */
191
+ .slot {
192
+ position: absolute;
193
+ top: 0;
194
+ bottom: 0;
195
+ border-right: 1px solid var(--border-color);
196
+ cursor: pointer;
197
+ transition: background-color var(--ok-transition, 150ms ease),
198
+ color var(--ok-transition, 150ms ease), border-color var(--ok-transition, 150ms ease),
199
+ box-shadow var(--ok-transition, 150ms ease), transform 120ms ease;
200
+ }
201
+ @media (hover: hover) {
202
+ .slot:hover {
203
+ background: var(--hover-bg);
204
+ }
205
+ }
206
+ .slot:active {
207
+ transform: scale(var(--ok-press-scale, 0.97));
208
+ }
209
+ .slot:last-child {
210
+ border-right: 0;
211
+ }
212
+
213
+ /* ── Bloque de evento ───────────────────────────────────────── */
214
+ .event {
215
+ position: absolute;
216
+ top: 0.25rem;
217
+ bottom: 0.25rem;
218
+ display: flex;
219
+ flex-direction: column;
220
+ justify-content: center;
221
+ padding: 0.2rem 0.45rem;
222
+ border-radius: 6px;
223
+ color: var(--primary-contrast);
224
+ cursor: pointer;
225
+ overflow: hidden;
226
+ z-index: 1;
227
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
228
+ transition: background-color var(--ok-transition, 150ms ease),
229
+ color var(--ok-transition, 150ms ease), border-color var(--ok-transition, 150ms ease),
230
+ box-shadow var(--ok-transition, 150ms ease), transform 120ms ease, filter 0.12s ease;
231
+ }
232
+ @media (hover: hover) {
233
+ .event:hover {
234
+ filter: brightness(1.05);
235
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
236
+ }
237
+ }
238
+ .event:active {
239
+ transform: scale(var(--ok-press-scale, 0.97));
240
+ }
241
+ .event-title {
242
+ font-size: 0.78rem;
243
+ font-weight: 600;
244
+ overflow: hidden;
245
+ text-overflow: ellipsis;
246
+ white-space: nowrap;
247
+ }
248
+ .event-time {
249
+ font-size: 0.68rem;
250
+ opacity: 0.9;
251
+ overflow: hidden;
252
+ text-overflow: ellipsis;
253
+ white-space: nowrap;
254
+ font-variant-numeric: tabular-nums;
255
+ }
256
+
257
+ /* ── Estado vacío ───────────────────────────────────────────── */
258
+ .empty {
259
+ padding: 1.5rem;
260
+ text-align: center;
261
+ color: var(--color-muted);
262
+ }
263
+
264
+ @media (prefers-reduced-motion: reduce) {
265
+ .slot:active,
266
+ .event:active {
267
+ transform: none;
268
+ }
269
+ }
270
+
271
+ /* ── Responsive (móvil): franja más estrecha, recurso visible ── */
272
+ @media (max-width: 540px) {
273
+ :host {
274
+ --resource-width: 7rem;
275
+ --hour-width: 3.5rem;
276
+ }
277
+ .hour {
278
+ font-size: 0.7rem;
279
+ padding: 0.35rem 0.3rem;
280
+ }
281
+ .avatar,
282
+ .avatar-fallback {
283
+ width: 1.6rem;
284
+ height: 1.6rem;
285
+ font-size: 0.7rem;
286
+ }
287
+ .event-time {
288
+ display: none;
289
+ }
290
+ }
291
+ `;
292
+ }
293
+ /** Textos efectivos: defaults INGLÉS mezclados con los del consumidor. */
294
+ get t() {
295
+ return { ...DEFAULT_LABELS, ...this.labels };
296
+ }
297
+ // ── Helpers de fecha ──────────────────────────────────────────
298
+ // Convierte una `Date` a clave local `YYYY-MM-DD`.
299
+ dayKey(d) {
300
+ const y = d.getFullYear();
301
+ const m = String(d.getMonth() + 1).padStart(2, "0");
302
+ const day = String(d.getDate()).padStart(2, "0");
303
+ return `${y}-${m}-${day}`;
304
+ }
305
+ // Parsea `YYYY-MM-DD` (parte de fecha) a `Date` local; fallback defensivo a hoy.
306
+ parseDay(s) {
307
+ const [y, m, d] = s.slice(0, 10).split("-").map(Number);
308
+ if (y && m && d) return new Date(y, m - 1, d);
309
+ return /* @__PURE__ */ new Date();
310
+ }
311
+ // Extrae los minutos desde medianoche de una hora `HH:MM` o ISO (`...THH:MM`).
312
+ minutesOf(time) {
313
+ const t = time.includes("T") ? time.split("T")[1] : time;
314
+ const [h, m] = (t || "").split(":").map(Number);
315
+ if (Number.isFinite(h)) return h * 60 + (Number.isFinite(m) ? m : 0);
316
+ return 0;
317
+ }
318
+ // Formatea minutos-desde-medianoche a `HH:MM`.
319
+ fmtTime(mins) {
320
+ const h = Math.floor(mins / 60);
321
+ const m = mins % 60;
322
+ return `${String(h).padStart(2, "0")}:${String(m).padStart(2, "0")}`;
323
+ }
324
+ // ── Geometría de la franja ────────────────────────────────────
325
+ // Rango total de la franja en minutos (defensivo: end > start).
326
+ get rangeMinutes() {
327
+ const span = (this.endHour - this.startHour) * 60;
328
+ return span > 0 ? span : 60;
329
+ }
330
+ // Número de celdas-slot de fondo según `slot`.
331
+ get slotCount() {
332
+ const step = this.slotMin > 0 ? this.slotMin : 60;
333
+ return Math.max(1, Math.ceil(this.rangeMinutes / step));
334
+ }
335
+ // ── Navegación / eventos ──────────────────────────────────────
336
+ // Cambia el día visible (delta en días) y emite `ok-nav`.
337
+ navDay(delta) {
338
+ const next = new Date(
339
+ this.cursor.getFullYear(),
340
+ this.cursor.getMonth(),
341
+ this.cursor.getDate() + delta
342
+ );
343
+ this.cursor = next;
344
+ this.dispatchEvent(
345
+ new CustomEvent("ok-nav", {
346
+ detail: { date: this.dayKey(next) },
347
+ bubbles: true,
348
+ composed: true
349
+ })
350
+ );
351
+ }
352
+ // Emite el click sobre un evento (sin propagar al slot de fondo).
353
+ clickEvent(ev, e) {
354
+ e.stopPropagation();
355
+ this.dispatchEvent(
356
+ new CustomEvent("ok-event-click", {
357
+ detail: { id: ev.id, event: ev },
358
+ bubbles: true,
359
+ composed: true
360
+ })
361
+ );
362
+ }
363
+ // Emite el click sobre una celda-slot vacía de un recurso.
364
+ clickSlot(resourceId, mins) {
365
+ this.dispatchEvent(
366
+ new CustomEvent("ok-slot-click", {
367
+ detail: { resourceId, time: this.fmtTime(mins) },
368
+ bubbles: true,
369
+ composed: true
370
+ })
371
+ );
372
+ }
373
+ // ── Etiquetas ─────────────────────────────────────────────────
374
+ // Etiqueta del día del cursor (capitalizada vía CSS).
375
+ dayLabel() {
376
+ return this.cursor.toLocaleDateString(this.locale, {
377
+ weekday: "long",
378
+ day: "numeric",
379
+ month: "long",
380
+ year: "numeric"
381
+ });
382
+ }
383
+ // Iniciales para el avatar de respaldo (sin imagen).
384
+ initials(label) {
385
+ const parts = label.trim().split(/\s+/).filter(Boolean);
386
+ if (parts.length === 0) return "?";
387
+ if (parts.length === 1) return parts[0].slice(0, 2);
388
+ return parts[0][0] + parts[parts.length - 1][0];
389
+ }
390
+ // ── Render parcial ────────────────────────────────────────────
391
+ // Cabecera horaria: una columna por hora del rango.
392
+ renderTimelineHead() {
393
+ const hours = [];
394
+ for (let h = this.startHour; h < this.endHour; h++) hours.push(h);
395
+ return html`<div class="timeline">
396
+ ${hours.map(
397
+ (h) => html`<div class="hour">${String(h).padStart(2, "0")}:00</div>`
398
+ )}
399
+ </div>`;
400
+ }
401
+ // Lane (pista) de un recurso: celdas-slot de fondo + bloques de evento posicionados.
402
+ renderLane(resource) {
403
+ const total = this.rangeMinutes;
404
+ const startMin = this.startHour * 60;
405
+ const step = this.slotMin > 0 ? this.slotMin : 60;
406
+ const count = this.slotCount;
407
+ const slots = [];
408
+ for (let i = 0; i < count; i++) {
409
+ const slotStart = startMin + i * step;
410
+ const left = (slotStart - startMin) / total * 100;
411
+ const width = step / total * 100;
412
+ slots.push(
413
+ html`<div
414
+ class="slot"
415
+ style=${`left:${left}%;width:${width}%`}
416
+ @click=${() => this.clickSlot(resource.id, slotStart)}
417
+ ></div>`
418
+ );
419
+ }
420
+ const blocks = this.events.filter((ev) => ev.resourceId === resource.id).map((ev) => {
421
+ const s = Math.max(this.minutesOf(ev.start), startMin);
422
+ const e = Math.min(this.minutesOf(ev.end), startMin + total);
423
+ if (e <= s) return "";
424
+ const left = (s - startMin) / total * 100;
425
+ const width = (e - s) / total * 100;
426
+ return html`<div
427
+ class="event"
428
+ style=${`left:${left}%;width:${width}%;background:${ev.color || "var(--primary-color)"}`}
429
+ title=${ev.title}
430
+ @click=${(domEv) => this.clickEvent(ev, domEv)}
431
+ >
432
+ <span class="event-title">${ev.title}</span>
433
+ <span class="event-time"
434
+ >${this.fmtTime(this.minutesOf(ev.start))} – ${this.fmtTime(this.minutesOf(ev.end))}</span
435
+ >
436
+ </div>`;
437
+ });
438
+ return html`<div class="lane">${slots}${blocks}</div>`;
439
+ }
440
+ // Fila completa de un recurso: label sticky + lane.
441
+ renderRow(resource) {
442
+ return html`<div class="row">
443
+ <div class="resource">
444
+ ${resource.avatar ? html`<img class="avatar" src=${resource.avatar} alt="" loading="lazy" />` : html`<span class="avatar-fallback">${this.initials(resource.label)}</span>`}
445
+ <span class="resource-label">${resource.label}</span>
446
+ </div>
447
+ ${this.renderLane(resource)}
448
+ </div>`;
449
+ }
450
+ render() {
451
+ if (!this.seeded) {
452
+ if (this.date) this.cursor = this.parseDay(this.date);
453
+ this.seeded = true;
454
+ }
455
+ const hourCount = Math.max(1, this.endHour - this.startHour);
456
+ const timelineWidth = `calc(${hourCount} * var(--hour-width))`;
457
+ const gridStyle = `width:calc(var(--resource-width) + ${timelineWidth})`;
458
+ return html`<div class="toolbar">
459
+ <ion-button
460
+ fill="clear"
461
+ size="small"
462
+ aria-label=${this.t.prevDay}
463
+ @click=${() => this.navDay(-1)}
464
+ >
465
+ <ion-icon slot="icon-only" name="chevron-back-outline"></ion-icon>
466
+ </ion-button>
467
+ <span class="title">${this.dayLabel()}</span>
468
+ <ion-button
469
+ fill="clear"
470
+ size="small"
471
+ aria-label=${this.t.nextDay}
472
+ @click=${() => this.navDay(1)}
473
+ >
474
+ <ion-icon slot="icon-only" name="chevron-forward-outline"></ion-icon>
475
+ </ion-button>
476
+ </div>
477
+ <div class="scroll">
478
+ <div class="grid" style=${gridStyle}>
479
+ <div class="head-row">
480
+ <div class="corner"></div>
481
+ ${this.renderTimelineHead()}
482
+ </div>
483
+ ${this.resources.length ? this.resources.map((r) => this.renderRow(r)) : html`<div class="empty">${this.t.empty}</div>`}
484
+ </div>
485
+ </div>`;
486
+ }
487
+ }
488
+ __decorateClass([
489
+ property({ attribute: false })
490
+ ], OkScheduler.prototype, "resources");
491
+ __decorateClass([
492
+ property({ attribute: false })
493
+ ], OkScheduler.prototype, "events");
494
+ __decorateClass([
495
+ property()
496
+ ], OkScheduler.prototype, "date");
497
+ __decorateClass([
498
+ property({ type: Number, attribute: "start-hour" })
499
+ ], OkScheduler.prototype, "startHour");
500
+ __decorateClass([
501
+ property({ type: Number, attribute: "end-hour" })
502
+ ], OkScheduler.prototype, "endHour");
503
+ __decorateClass([
504
+ property({ type: Number, attribute: "slot-minutes" })
505
+ ], OkScheduler.prototype, "slotMin");
506
+ __decorateClass([
507
+ property()
508
+ ], OkScheduler.prototype, "locale");
509
+ __decorateClass([
510
+ property({ attribute: false })
511
+ ], OkScheduler.prototype, "labels");
512
+ __decorateClass([
513
+ state()
514
+ ], OkScheduler.prototype, "cursor");
515
+ define("ok-scheduler", OkScheduler);
516
+ export {
517
+ OkScheduler
518
+ };