@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,357 @@
1
+ import { LitElement, css, html } from "lit";
2
+ import { property, query } 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
+ close: "Close"
15
+ };
16
+ const FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), ion-button:not([disabled]), ion-input, ion-searchbar, [tabindex]:not([tabindex="-1"])';
17
+ class OkDrawer extends LitElement {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.open = false;
21
+ this.side = "end";
22
+ this.width = "420px";
23
+ this.scrim = true;
24
+ this.dismissible = true;
25
+ this.labels = {};
26
+ this.previousFocus = null;
27
+ this.hasFooter = false;
28
+ this.onDocKeydown = (e) => {
29
+ if (!this.open) return;
30
+ if (e.key === "Escape") {
31
+ if (this.dismissible) {
32
+ e.preventDefault();
33
+ this.requestClose("esc");
34
+ }
35
+ return;
36
+ }
37
+ if (e.key === "Tab") this.trapFocus(e);
38
+ };
39
+ }
40
+ static {
41
+ this.styles = css`
42
+ :host {
43
+ /* Vars overridable (estilo Ionic), default = cadena --ok-* → --ion-* → hex */
44
+ --color: var(--ok-text, var(--ion-text-color, #1c1b17));
45
+ --color-muted: var(--ok-text-muted, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.6));
46
+ --panel-bg: var(--ok-drawer-bg, var(--ok-surface, var(--ion-card-background, var(--ion-background-color, #ffffff))));
47
+ --scrim-bg: var(--ok-scrim, rgba(0, 0, 0, 0.4));
48
+ --border-soft: var(--ok-border-soft, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.08));
49
+ --shadow: var(--ok-shadow-md, 0 10px 40px rgba(0, 0, 0, 0.22));
50
+ --font: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
51
+
52
+ /* El host no ocupa caja: scrim y panel van a position:fixed sobre todo. */
53
+ display: contents;
54
+ }
55
+
56
+ /* Scrim a pantalla completa (cierra al click si dismissible). */
57
+ .scrim {
58
+ position: fixed;
59
+ inset: 0;
60
+ z-index: 2000;
61
+ background: var(--scrim-bg);
62
+ animation: fade-in 180ms ease;
63
+ }
64
+
65
+ /* Panel lateral fijo: columna header · body (scroll) · footer. */
66
+ .panel {
67
+ position: fixed;
68
+ top: 0;
69
+ bottom: 0;
70
+ z-index: 2001;
71
+ /* Cadena: token global → prop width (inyectada como var local) → 420px. */
72
+ width: var(--ok-drawer-width, var(--drawer-width, 420px));
73
+ max-width: 100vw;
74
+ display: flex;
75
+ flex-direction: column;
76
+ box-sizing: border-box;
77
+ background: var(--panel-bg);
78
+ box-shadow: var(--shadow);
79
+ font-family: var(--font);
80
+ color: var(--color);
81
+ /* Lado por defecto: end (derecha en LTR). */
82
+ inset-inline-end: 0;
83
+ border-inline-start: 1px solid var(--border-soft);
84
+ animation: slide-in-end 200ms ease;
85
+ }
86
+ :host([side='start']) .panel {
87
+ inset-inline-end: auto;
88
+ inset-inline-start: 0;
89
+ border-inline-start: 0;
90
+ border-inline-end: 1px solid var(--border-soft);
91
+ animation: slide-in-start 200ms ease;
92
+ }
93
+
94
+ @keyframes fade-in {
95
+ from { opacity: 0; }
96
+ to { opacity: 1; }
97
+ }
98
+ @keyframes slide-in-end {
99
+ from { transform: translateX(100%); }
100
+ to { transform: translateX(0); }
101
+ }
102
+ @keyframes slide-in-start {
103
+ from { transform: translateX(-100%); }
104
+ to { transform: translateX(0); }
105
+ }
106
+ @media (prefers-reduced-motion: reduce) {
107
+ .scrim,
108
+ .panel {
109
+ animation: none;
110
+ }
111
+ }
112
+
113
+ /* Cabecera: icono + título + acciones extra + botón X. */
114
+ .header {
115
+ flex: 0 0 auto;
116
+ display: flex;
117
+ align-items: center;
118
+ gap: 0.6rem;
119
+ padding: 0.85rem 1rem;
120
+ border-bottom: 1px solid var(--border-soft);
121
+ }
122
+ .header > ion-icon {
123
+ flex: 0 0 auto;
124
+ font-size: 1.25rem;
125
+ color: var(--color-muted);
126
+ }
127
+ .heading {
128
+ flex: 1 1 auto;
129
+ min-width: 0;
130
+ margin: 0;
131
+ font-size: 1.05rem;
132
+ font-weight: 600;
133
+ overflow: hidden;
134
+ text-overflow: ellipsis;
135
+ white-space: nowrap;
136
+ }
137
+ /* Acciones extra de cabecera (slot header-actions) + botón cerrar. */
138
+ .header-actions {
139
+ flex: 0 0 auto;
140
+ display: flex;
141
+ align-items: center;
142
+ gap: 0.25rem;
143
+ }
144
+ .close {
145
+ flex: 0 0 auto;
146
+ display: inline-flex;
147
+ align-items: center;
148
+ justify-content: center;
149
+ width: 32px;
150
+ height: 32px;
151
+ padding: 0;
152
+ border: 0;
153
+ border-radius: 8px;
154
+ background: none;
155
+ color: var(--color-muted);
156
+ font-size: 1.25rem;
157
+ cursor: pointer;
158
+ transition: background-color var(--ok-transition, 150ms ease), color var(--ok-transition, 150ms ease);
159
+ }
160
+ @media (hover: hover) {
161
+ .close:hover {
162
+ background: var(--ok-hover, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.06));
163
+ color: var(--color);
164
+ }
165
+ }
166
+
167
+ /* Cuerpo: scroll interno. */
168
+ .body {
169
+ flex: 1 1 auto;
170
+ min-height: 0;
171
+ overflow-y: auto;
172
+ padding: 1rem;
173
+ box-sizing: border-box;
174
+ }
175
+
176
+ /* Pie fijo opcional (se oculta si el slot está vacío). */
177
+ .footer {
178
+ flex: 0 0 auto;
179
+ padding: 0.75rem 1rem;
180
+ border-top: 1px solid var(--border-soft);
181
+ }
182
+ .footer.empty {
183
+ display: none;
184
+ }
185
+
186
+ /* En móvil el panel ocupa todo el ancho. */
187
+ @media (max-width: 640px) {
188
+ .panel {
189
+ width: 100%;
190
+ border: 0;
191
+ }
192
+ }
193
+ `;
194
+ }
195
+ /** Textos efectivos (defaults inglés + overrides). */
196
+ get t() {
197
+ return { ...DEFAULT_LABELS, ...this.labels };
198
+ }
199
+ disconnectedCallback() {
200
+ super.disconnectedCallback();
201
+ document.removeEventListener("keydown", this.onDocKeydown);
202
+ }
203
+ // ── Apertura / cierre ──────────────────────────────────────────────────────
204
+ updated(changed) {
205
+ if (!changed.has("open")) return;
206
+ const was = changed.get("open");
207
+ if (this.open && !was) this.afterOpen();
208
+ else if (!this.open && was) this.afterClose();
209
+ }
210
+ // Al abrir: guarda el foco actual, enfoca el panel y arma el teclado global.
211
+ afterOpen() {
212
+ this.previousFocus = document.activeElement ?? null;
213
+ document.addEventListener("keydown", this.onDocKeydown);
214
+ this.updateComplete.then(() => {
215
+ const first = this.focusables()[0];
216
+ (first ?? this.panel)?.focus();
217
+ });
218
+ this.dispatchEvent(
219
+ new CustomEvent("ok-open", { detail: { open: true }, bubbles: true, composed: true })
220
+ );
221
+ }
222
+ // Al cerrar: desarma el teclado y restaura el foco previo.
223
+ afterClose() {
224
+ document.removeEventListener("keydown", this.onDocKeydown);
225
+ this.previousFocus?.focus?.();
226
+ this.previousFocus = null;
227
+ }
228
+ /**
229
+ * Gesto de cierre (scrim/esc/botón): emite `ok-close` CANCELABLE con la razón. Si nadie hace
230
+ * `preventDefault()` se auto-cierra (fallback no-controlado); un padre controlado puede vetar.
231
+ */
232
+ requestClose(reason) {
233
+ const ev = new CustomEvent("ok-close", {
234
+ detail: { reason },
235
+ bubbles: true,
236
+ composed: true,
237
+ cancelable: true
238
+ });
239
+ const proceed = this.dispatchEvent(ev);
240
+ if (proceed) this.open = false;
241
+ }
242
+ /** Abre el drawer (azúcar imperativo; equivale a `open = true`). */
243
+ show() {
244
+ this.open = true;
245
+ }
246
+ /** Cierra el drawer sin pasar por el gesto cancelable (azúcar imperativo). */
247
+ hide() {
248
+ this.open = false;
249
+ }
250
+ // ── Focus trap ─────────────────────────────────────────────────────────────
251
+ // Enfocables del panel (shadow) + del contenido slotted (light DOM del host).
252
+ focusables() {
253
+ const inShadow = this.panel ? Array.from(this.panel.querySelectorAll(FOCUSABLE)) : [];
254
+ const inLight = Array.from(this.querySelectorAll(FOCUSABLE));
255
+ return [...inShadow, ...inLight].filter((el) => el.offsetParent !== null || el === document.activeElement);
256
+ }
257
+ // Mantiene Tab/Shift+Tab ciclando dentro del drawer mientras está abierto.
258
+ trapFocus(e) {
259
+ const list = this.focusables();
260
+ if (!list.length) {
261
+ e.preventDefault();
262
+ this.panel?.focus();
263
+ return;
264
+ }
265
+ const active = this.shadowRoot?.activeElement ?? document.activeElement;
266
+ const idx = active ? list.indexOf(active) : -1;
267
+ if (e.shiftKey) {
268
+ if (idx <= 0) {
269
+ e.preventDefault();
270
+ list[list.length - 1].focus();
271
+ }
272
+ } else if (idx === -1 || idx === list.length - 1) {
273
+ e.preventDefault();
274
+ list[0].focus();
275
+ }
276
+ }
277
+ // ── Interacción ────────────────────────────────────────────────────────────
278
+ // Cierra al click en el scrim (solo si dismissible).
279
+ onScrimClick() {
280
+ if (this.dismissible) this.requestClose("scrim");
281
+ }
282
+ onFooterSlotChange(e) {
283
+ const slot = e.target;
284
+ const has = slot.assignedNodes({ flatten: true }).length > 0;
285
+ if (has !== this.hasFooter) {
286
+ this.hasFooter = has;
287
+ this.requestUpdate();
288
+ }
289
+ }
290
+ // ── Render ─────────────────────────────────────────────────────────────────
291
+ render() {
292
+ if (!this.open) return html``;
293
+ return html`
294
+ ${this.scrim ? html`<div class="scrim" @click=${() => this.onScrimClick()}></div>` : ""}
295
+ <aside
296
+ class="panel"
297
+ style="--drawer-width:${this.width}"
298
+ role="dialog"
299
+ aria-modal="true"
300
+ aria-label=${this.heading ?? "drawer"}
301
+ tabindex="-1"
302
+ >
303
+ <header class="header">
304
+ ${this.icon ? html`<ion-icon .name=${this.icon} aria-hidden="true"></ion-icon>` : ""}
305
+ ${this.heading ? html`<h2 class="heading">${this.heading}</h2>` : html`<span class="heading"></span>`}
306
+ <div class="header-actions">
307
+ <slot name="header-actions"></slot>
308
+ ${this.dismissible ? html`<button
309
+ class="close"
310
+ type="button"
311
+ aria-label=${this.t.close}
312
+ title=${this.t.close}
313
+ @click=${() => this.requestClose("button")}
314
+ >
315
+ <ion-icon name="close-outline" aria-hidden="true"></ion-icon>
316
+ </button>` : ""}
317
+ </div>
318
+ </header>
319
+ <div class="body"><slot></slot></div>
320
+ <footer class=${this.hasFooter ? "footer" : "footer empty"}>
321
+ <slot name="footer" @slotchange=${(e) => this.onFooterSlotChange(e)}></slot>
322
+ </footer>
323
+ </aside>
324
+ `;
325
+ }
326
+ }
327
+ __decorateClass([
328
+ property({ type: Boolean, reflect: true })
329
+ ], OkDrawer.prototype, "open");
330
+ __decorateClass([
331
+ property({ reflect: true })
332
+ ], OkDrawer.prototype, "side");
333
+ __decorateClass([
334
+ property()
335
+ ], OkDrawer.prototype, "width");
336
+ __decorateClass([
337
+ property()
338
+ ], OkDrawer.prototype, "heading");
339
+ __decorateClass([
340
+ property()
341
+ ], OkDrawer.prototype, "icon");
342
+ __decorateClass([
343
+ property({ type: Boolean })
344
+ ], OkDrawer.prototype, "scrim");
345
+ __decorateClass([
346
+ property({ type: Boolean })
347
+ ], OkDrawer.prototype, "dismissible");
348
+ __decorateClass([
349
+ property({ attribute: false })
350
+ ], OkDrawer.prototype, "labels");
351
+ __decorateClass([
352
+ query(".panel")
353
+ ], OkDrawer.prototype, "panel");
354
+ define("ok-drawer", OkDrawer);
355
+ export {
356
+ OkDrawer
357
+ };