@erplora/outfitkit 0.1.14 → 0.1.16

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 (54) hide show
  1. package/dist/base/icons.d.ts +59 -0
  2. package/dist/base/icons.test.d.ts +1 -0
  3. package/dist/cdn.d.ts +1 -0
  4. package/dist/components/ok-data-table/csv-encoding.d.ts +4 -0
  5. package/dist/components/ok-data-table/csv-encoding.test.d.ts +1 -0
  6. package/dist/components/ok-kpi/ok-kpi.d.ts +1 -1
  7. package/dist/components/ok-theme-picker/ok-theme-picker.d.ts +46 -0
  8. package/dist/components/ok-theme-picker/ok-theme-picker.test.d.ts +1 -0
  9. package/dist/index.d.ts +4 -2
  10. package/dist/index.js +4 -0
  11. package/dist/ok-app-launcher.js +4 -3
  12. package/dist/ok-audio.js +4 -3
  13. package/dist/ok-calendar.js +4 -3
  14. package/dist/ok-carousel.js +3 -2
  15. package/dist/ok-chat.js +2 -1
  16. package/dist/ok-combo.js +2 -1
  17. package/dist/ok-command-palette.js +3 -2
  18. package/dist/ok-data-table.js +27 -16
  19. package/dist/ok-date-picker.js +4 -3
  20. package/dist/ok-drawer.js +3 -2
  21. package/dist/ok-dropzone.js +5 -4
  22. package/dist/ok-empty-state.js +2 -1
  23. package/dist/ok-error-page.js +2 -1
  24. package/dist/ok-file-manager.js +5 -4
  25. package/dist/ok-icon-tile.js +2 -1
  26. package/dist/ok-inline-feedback.js +8 -7
  27. package/dist/ok-kpi.js +7 -6
  28. package/dist/ok-lightbox.js +7 -6
  29. package/dist/ok-mail.js +10 -9
  30. package/dist/ok-menu.js +2 -1
  31. package/dist/ok-menubar.js +6 -5
  32. package/dist/ok-notification-center.js +4 -3
  33. package/dist/ok-pdf.js +4 -3
  34. package/dist/ok-pinpad.js +3 -2
  35. package/dist/ok-qty-stepper.js +3 -2
  36. package/dist/ok-rating.js +3 -2
  37. package/dist/ok-scheduler.js +3 -2
  38. package/dist/ok-select-card.js +2 -1
  39. package/dist/ok-signature.js +3 -2
  40. package/dist/ok-split-button.js +3 -2
  41. package/dist/ok-status-pill.js +2 -1
  42. package/dist/ok-stepper.js +2 -1
  43. package/dist/ok-tag-input.js +2 -1
  44. package/dist/ok-theme-picker.js +221 -0
  45. package/dist/ok-timeline.js +2 -1
  46. package/dist/ok-tree.js +3 -2
  47. package/dist/ok-video.js +5 -4
  48. package/dist/ok-widget-board.js +2 -1
  49. package/dist/outfitkit.bundle.js +3378 -3117
  50. package/dist/outfitkit.js +1 -0
  51. package/dist/palettes.css +422 -0
  52. package/dist/shared/icons.js +194 -0
  53. package/dist/theme/palettes.test.d.ts +1 -0
  54. package/package.json +10 -2
@@ -0,0 +1,59 @@
1
+ export declare const iconAdd: string;
2
+ export declare const iconAlertCircle: string;
3
+ export declare const iconAlertCircleOutline: string;
4
+ export declare const iconAppsOutline: string;
5
+ export declare const iconArchiveOutline: string;
6
+ export declare const iconArrowRedoOutline: string;
7
+ export declare const iconArrowUndoOutline: string;
8
+ export declare const iconBackspaceOutline: string;
9
+ export declare const iconCalendarOutline: string;
10
+ export declare const iconCheckmarkCircle: string;
11
+ export declare const iconCheckmarkOutline: string;
12
+ export declare const iconChevronBack: string;
13
+ export declare const iconChevronBackOutline: string;
14
+ export declare const iconChevronDownOutline: string;
15
+ export declare const iconChevronForward: string;
16
+ export declare const iconChevronForwardOutline: string;
17
+ export declare const iconChevronUpOutline: string;
18
+ export declare const iconClose: string;
19
+ export declare const iconCloseOutline: string;
20
+ export declare const iconCloudUploadOutline: string;
21
+ export declare const iconCreateOutline: string;
22
+ export declare const iconDocumentAttachOutline: string;
23
+ export declare const iconDocumentOutline: string;
24
+ export declare const iconDocumentTextOutline: string;
25
+ export declare const iconDownloadOutline: string;
26
+ export declare const iconEllipsisVertical: string;
27
+ export declare const iconExpandOutline: string;
28
+ export declare const iconFileTrayOutline: string;
29
+ export declare const iconFolderOpenOutline: string;
30
+ export declare const iconInformationCircle: string;
31
+ export declare const iconMenuOutline: string;
32
+ export declare const iconNotificationsOffOutline: string;
33
+ export declare const iconOpenOutline: string;
34
+ export declare const iconPlayOutline: string;
35
+ export declare const iconRemove: string;
36
+ export declare const iconSearchOutline: string;
37
+ export declare const iconSend: string;
38
+ export declare const iconSwapVerticalOutline: string;
39
+ export declare const iconTrashOutline: string;
40
+ export declare const iconTrendingDown: string;
41
+ export declare const iconTrendingUp: string;
42
+ export declare const iconVolumeHighOutline: string;
43
+ export declare const iconVolumeLowOutline: string;
44
+ export declare const iconVolumeMuteOutline: string;
45
+ export declare const iconWarning: string;
46
+ /**
47
+ * Normaliza un icono que llega como STRING: el que pasa el consumidor por prop
48
+ * (`<ok-kpi icon="receipt-outline">`, las rowActions de ok-data-table, los items de un menú) o el
49
+ * valor por defecto de una prop. Devuelve algo listo para la prop `.icon` de ion-icon:
50
+ *
51
+ * · SVG inline (`<svg …>`) → lo hornea aquí mismo a data-URI.
52
+ * · un nombre que OutfitKit trae → su SVG horneado (sin red, sin depender del host).
53
+ * · cualquier otro nombre → se devuelve tal cual: ion-icon lo resuelve contra el registro
54
+ * global del host (window.Ionicons.map). Es el comportamiento de siempre → no rompe a nadie.
55
+ *
56
+ * Usamos `.icon` y no `name` porque la prop `icon` de ion-icon acepta AMBOS (un data-URI lo trata
57
+ * como src; un nombre lo busca en el registro), mientras que `name` solo acepta nombres.
58
+ */
59
+ export declare function okIcon(value?: string | null): string | undefined;
@@ -0,0 +1 @@
1
+ export {};
package/dist/cdn.d.ts CHANGED
@@ -73,6 +73,7 @@ import './components/ok-hover-card/ok-hover-card.js';
73
73
  import './components/ok-notification-center/ok-notification-center.js';
74
74
  import './components/ok-coachmark/ok-coachmark.js';
75
75
  import './components/ok-select-card/ok-select-card.js';
76
+ import './components/ok-theme-picker/ok-theme-picker.js';
76
77
  import './components/ok-error-page/ok-error-page.js';
77
78
  import './components/ok-date-picker/ok-date-picker.js';
78
79
  import './components/ok-time-picker/ok-time-picker.js';
@@ -0,0 +1,4 @@
1
+ /** BOM UTF-8: al frente del export para que Excel detecte la codificación. */
2
+ export declare const CSV_BOM = "\uFEFF";
3
+ /** Bytes de un fichero CSV → texto: UTF-8 estricto con fallback a Windows-1252 (Excel). */
4
+ export declare function decodeCsvBuffer(buf: ArrayBuffer): string;
@@ -12,7 +12,7 @@ export declare class OkKpi extends LitElement {
12
12
  trend: OkKpiTrend;
13
13
  /** Nombre de un ion-icon opcional mostrado junto al label. */
14
14
  icon?: string;
15
- /** Devuelve el ion-icon de flecha según la tendencia. */
15
+ /** Devuelve el icono de flecha según la tendencia (SVG horneado, ver base/icons.ts). */
16
16
  private trendIcon;
17
17
  render(): unknown;
18
18
  }
@@ -0,0 +1,46 @@
1
+ import { LitElement } from 'lit';
2
+ export interface OkThemePickerPalette {
3
+ /** Id de la paleta (valor de `data-ok-palette`; 'erplora' = default sin atributo). */
4
+ id: string;
5
+ /** Nombre visible/accesible. */
6
+ label: string;
7
+ /** Color de marca para el swatch. */
8
+ brand: string;
9
+ }
10
+ /** Paletas canónicas — espejo 1:1 de palettes.css (guard en palettes.test.ts). */
11
+ export declare const DEFAULT_PALETTES: OkThemePickerPalette[];
12
+ /** Único punto que escribe `data-ok-palette`: 'erplora' (o vacío) QUITA el atributo. */
13
+ export declare function applyPalette(root: Element, palette: string): void;
14
+ export type OkThemePickerMode = 'system' | 'light' | 'dark';
15
+ export interface OkThemePickerLabels {
16
+ /** Encabezado de la sección de paletas. */
17
+ palette: string;
18
+ /** Encabezado de la sección de modo. */
19
+ mode: string;
20
+ system: string;
21
+ light: string;
22
+ dark: string;
23
+ }
24
+ export declare class OkThemePicker extends LitElement {
25
+ static styles: import("lit").CSSResult;
26
+ /** Paleta activa ('erplora' = marca por defecto). */
27
+ palette: string;
28
+ /** Modo de color activo. */
29
+ mode: OkThemePickerMode;
30
+ /** Oculta el segmento de modo (para hosts con su propio toggle claro/oscuro). */
31
+ hideMode: boolean;
32
+ /** Paletas a mostrar (default: las canónicas de palettes.css). */
33
+ palettes: OkThemePickerPalette[];
34
+ /** Textos i18n (parcial; se mezclan sobre los defaults en inglés). */
35
+ labels: Partial<OkThemePickerLabels>;
36
+ private get t();
37
+ private emitChange;
38
+ private pickPalette;
39
+ private pickMode;
40
+ render(): unknown;
41
+ }
42
+ declare global {
43
+ interface HTMLElementTagNameMap {
44
+ 'ok-theme-picker': OkThemePicker;
45
+ }
46
+ }
@@ -0,0 +1 @@
1
+ import './ok-theme-picker.js';
package/dist/index.d.ts CHANGED
@@ -51,9 +51,9 @@ export { OkAudio } from './components/ok-audio/ok-audio.js';
51
51
  export { OkVideo } from './components/ok-video/ok-video.js';
52
52
  export { OkPdf } from './components/ok-pdf/ok-pdf.js';
53
53
  export { OkReceipt } from './components/ok-receipt/ok-receipt.js';
54
- export type { ReceiptData, ReceiptLine, ReceiptTax, ReceiptPayment, ReceiptBusiness, } from './components/ok-receipt/ok-receipt.js';
54
+ export type { ReceiptData, ReceiptLine, ReceiptTax, ReceiptPayment, ReceiptBusiness, OkReceiptLabels, } from './components/ok-receipt/ok-receipt.js';
55
55
  export { OkInvoice } from './components/ok-invoice/ok-invoice.js';
56
- export type { InvoiceData, InvoiceParty, InvoiceLine, InvoiceTaxLine, } from './components/ok-invoice/ok-invoice.js';
56
+ export type { InvoiceData, InvoiceParty, InvoiceLine, InvoiceTaxLine, OkInvoiceLabels, } from './components/ok-invoice/ok-invoice.js';
57
57
  export { OkTimeline } from './components/ok-timeline/ok-timeline.js';
58
58
  export type { OkTimelineItem } from './components/ok-timeline/ok-timeline.js';
59
59
  export { OkQtyStepper } from './components/ok-qty-stepper/ok-qty-stepper.js';
@@ -115,6 +115,8 @@ export { OkCoachmark } from './components/ok-coachmark/ok-coachmark.js';
115
115
  export type { OkCoachStep, OkCoachPlacement, OkCoachmarkLabels } from './components/ok-coachmark/ok-coachmark.js';
116
116
  export { OkSelectCard } from './components/ok-select-card/ok-select-card.js';
117
117
  export type { OkSelectCardChangeDetail } from './components/ok-select-card/ok-select-card.js';
118
+ export { OkThemePicker, DEFAULT_PALETTES, applyPalette } from './components/ok-theme-picker/ok-theme-picker.js';
119
+ export type { OkThemePickerPalette, OkThemePickerMode, OkThemePickerLabels, } from './components/ok-theme-picker/ok-theme-picker.js';
118
120
  export { OkErrorPage } from './components/ok-error-page/ok-error-page.js';
119
121
  export type { OkErrorPageVariant, OkErrorPageMode, OkErrorCheckStatus, OkErrorShortcut, OkErrorCheck } from './components/ok-error-page/ok-error-page.js';
120
122
  export { OkDatePicker } from './components/ok-date-picker/ok-date-picker.js';
package/dist/index.js CHANGED
@@ -74,6 +74,7 @@ import { OkHoverCard } from "./ok-hover-card.js";
74
74
  import { OkNotificationCenter } from "./ok-notification-center.js";
75
75
  import { OkCoachmark } from "./ok-coachmark.js";
76
76
  import { OkSelectCard } from "./ok-select-card.js";
77
+ import { DEFAULT_PALETTES, OkThemePicker, applyPalette } from "./ok-theme-picker.js";
77
78
  import { OkErrorPage } from "./ok-error-page.js";
78
79
  import { OkDatePicker } from "./ok-date-picker.js";
79
80
  import { OkTimePicker } from "./ok-time-picker.js";
@@ -96,6 +97,7 @@ import { OkAvatarGroup } from "./ok-avatar-group.js";
96
97
  import { OkOrgChart } from "./ok-org-chart.js";
97
98
  import { OkFileManager } from "./ok-file-manager.js";
98
99
  export {
100
+ DEFAULT_PALETTES,
99
101
  OkAppLauncher,
100
102
  OkAudio,
101
103
  OkAvatar,
@@ -185,6 +187,7 @@ export {
185
187
  OkStore,
186
188
  OkTagInput,
187
189
  OkTestimonial,
190
+ OkThemePicker,
188
191
  OkTimePicker,
189
192
  OkTimeline,
190
193
  OkTree,
@@ -192,6 +195,7 @@ export {
192
195
  OkWidgetBoard,
193
196
  OkWizard,
194
197
  StoreController,
198
+ applyPalette,
195
199
  createStore,
196
200
  store
197
201
  };
@@ -1,6 +1,7 @@
1
1
  import { LitElement, css, render, nothing, html } from "lit";
2
2
  import { property, state } from "lit/decorators.js";
3
3
  import { define } from "./define.js";
4
+ import { o as okIcon, u as iconAppsOutline, v as iconCloseOutline } from "./shared/icons.js";
4
5
  var __defProp = Object.defineProperty;
5
6
  var __decorateClass = (decorators, target, key, kind) => {
6
7
  var result = void 0;
@@ -337,7 +338,7 @@ class OkAppLauncher extends LitElement {
337
338
  @click=${() => this.selectApp(app)}
338
339
  >
339
340
  <span class="box">
340
- ${this.isResolvedSvg(icon) ? html`<ion-icon .icon=${icon}></ion-icon>` : html`<ion-icon .name=${icon}></ion-icon>`}
341
+ ${this.isResolvedSvg(icon) ? html`<ion-icon .icon=${icon}></ion-icon>` : html`<ion-icon .icon=${okIcon(icon)}></ion-icon>`}
341
342
  </span>
342
343
  <span class="label">${app.label}</span>
343
344
  </button>`;
@@ -352,7 +353,7 @@ class OkAppLauncher extends LitElement {
352
353
  aria-label=${this.t.apps}
353
354
  @click=${() => this.toggle()}
354
355
  >
355
- <ion-icon name="apps-outline"></ion-icon>
356
+ <ion-icon .icon=${iconAppsOutline}></ion-icon>
356
357
  </button>
357
358
  `;
358
359
  }
@@ -370,7 +371,7 @@ class OkAppLauncher extends LitElement {
370
371
  aria-label=${this.t.close}
371
372
  @click=${() => this.close()}
372
373
  >
373
- <ion-icon name="close-outline"></ion-icon>
374
+ <ion-icon .icon=${iconCloseOutline}></ion-icon>
374
375
  </button>
375
376
  </div>
376
377
  ${this.apps.length ? html`<div class="grid">${this.apps.map((app) => this.renderApp(app))}</div>` : html`<div class="empty">${this.t.empty}</div>`}
package/dist/ok-audio.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { LitElement, css, html } from "lit";
2
2
  import { property, state, query } from "lit/decorators.js";
3
3
  import { define } from "./define.js";
4
+ import { E as iconVolumeMuteOutline, F as iconVolumeLowOutline, G as iconVolumeHighOutline, o as okIcon } from "./shared/icons.js";
4
5
  var __defProp = Object.defineProperty;
5
6
  var __decorateClass = (decorators, target, key, kind) => {
6
7
  var result = void 0;
@@ -217,7 +218,7 @@ class OkAudio extends LitElement {
217
218
  }
218
219
  render() {
219
220
  const pct = this.duration ? this.current / this.duration * 100 : 0;
220
- const volIcon = this.muted || this.volume === 0 ? "volume-mute-outline" : this.volume < 0.5 ? "volume-low-outline" : "volume-high-outline";
221
+ const volIcon = this.muted || this.volume === 0 ? iconVolumeMuteOutline : this.volume < 0.5 ? iconVolumeLowOutline : iconVolumeHighOutline;
221
222
  return html`
222
223
  <div class="player">
223
224
  ${this.title ? html`<div class="title">${this.title}</div>` : ""}
@@ -240,7 +241,7 @@ class OkAudio extends LitElement {
240
241
  >
241
242
  <ion-icon
242
243
  slot="icon-only"
243
- name=${this.playing ? "pause" : "play"}
244
+ .icon=${okIcon(this.playing ? "pause" : "play")}
244
245
  ></ion-icon>
245
246
  </ion-button>
246
247
 
@@ -258,7 +259,7 @@ class OkAudio extends LitElement {
258
259
  aria-label=${this.muted ? this.t.unmute : this.t.mute}
259
260
  @click=${this.toggleMute}
260
261
  >
261
- <ion-icon slot="icon-only" name=${volIcon}></ion-icon>
262
+ <ion-icon slot="icon-only" .icon=${okIcon(volIcon)}></ion-icon>
262
263
  </ion-button>
263
264
  <input
264
265
  type="range"
@@ -1,6 +1,7 @@
1
1
  import { LitElement, css, html } from "lit";
2
2
  import { property, state } from "lit/decorators.js";
3
3
  import { define } from "./define.js";
4
+ import { g as iconChevronForwardOutline, t as iconChevronBackOutline } from "./shared/icons.js";
4
5
  var __defProp = Object.defineProperty;
5
6
  var __decorateClass = (decorators, target, key, kind) => {
6
7
  var result = void 0;
@@ -461,7 +462,7 @@ class OkCalendar extends LitElement {
461
462
  (ev) => html`<div class="agenda-item" @click=${(e) => this.clickEvent(ev, e)}>
462
463
  <span class="dot" style=${`background:${ev.color || "var(--primary-color)"}`}></span>
463
464
  <span class="agenda-title">${ev.title}</span>
464
- <ion-icon name="chevron-forward-outline"></ion-icon>
465
+ <ion-icon .icon=${iconChevronForwardOutline}></ion-icon>
465
466
  </div>`
466
467
  )}
467
468
  </div>`;
@@ -482,7 +483,7 @@ class OkCalendar extends LitElement {
482
483
  aria-label=${this.t.prevMonth}
483
484
  @click=${() => this.navMonth(-1)}
484
485
  >
485
- <ion-icon slot="icon-only" name="chevron-back-outline"></ion-icon>
486
+ <ion-icon slot="icon-only" .icon=${iconChevronBackOutline}></ion-icon>
486
487
  </ion-button>
487
488
  <span class="title">${this.monthLabel()}</span>
488
489
  <ion-button
@@ -491,7 +492,7 @@ class OkCalendar extends LitElement {
491
492
  aria-label=${this.t.nextMonth}
492
493
  @click=${() => this.navMonth(1)}
493
494
  >
494
- <ion-icon slot="icon-only" name="chevron-forward-outline"></ion-icon>
495
+ <ion-icon slot="icon-only" .icon=${iconChevronForwardOutline}></ion-icon>
495
496
  </ion-button>
496
497
  </div>
497
498
  <div class="toggle" role="tablist">
@@ -1,6 +1,7 @@
1
1
  import { LitElement, css, html } from "lit";
2
2
  import { property, state, query } from "lit/decorators.js";
3
3
  import { define } from "./define.js";
4
+ import { t as iconChevronBackOutline, g as iconChevronForwardOutline } from "./shared/icons.js";
4
5
  var __defProp = Object.defineProperty;
5
6
  var __decorateClass = (decorators, target, key, kind) => {
6
7
  var result = void 0;
@@ -272,7 +273,7 @@ class OkCarousel extends LitElement {
272
273
  ?disabled=${n <= 1 || !this.loop && atStart}
273
274
  @click=${() => this.prev()}
274
275
  >
275
- <ion-icon slot="icon-only" name="chevron-back-outline"></ion-icon>
276
+ <ion-icon slot="icon-only" .icon=${iconChevronBackOutline}></ion-icon>
276
277
  </ion-button>
277
278
 
278
279
  <div
@@ -298,7 +299,7 @@ class OkCarousel extends LitElement {
298
299
  ?disabled=${n <= 1 || !this.loop && atEnd}
299
300
  @click=${() => this.next()}
300
301
  >
301
- <ion-icon slot="icon-only" name="chevron-forward-outline"></ion-icon>
302
+ <ion-icon slot="icon-only" .icon=${iconChevronForwardOutline}></ion-icon>
302
303
  </ion-button>
303
304
  </div>
304
305
 
package/dist/ok-chat.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { LitElement, css, html } from "lit";
2
2
  import { property, query } from "lit/decorators.js";
3
3
  import { define } from "./define.js";
4
+ import { B as iconSend } from "./shared/icons.js";
4
5
  var __defProp = Object.defineProperty;
5
6
  var __decorateClass = (decorators, target, key, kind) => {
6
7
  var result = void 0;
@@ -287,7 +288,7 @@ class OkChat extends LitElement {
287
288
  aria-label=${this.t.send}
288
289
  @click=${() => this.send()}
289
290
  >
290
- <ion-icon slot="icon-only" name="send"></ion-icon>
291
+ <ion-icon slot="icon-only" .icon=${iconSend}></ion-icon>
291
292
  </ion-button>
292
293
  </div>`}
293
294
  `;
package/dist/ok-combo.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { LitElement, css, html } from "lit";
2
2
  import { property, state } from "lit/decorators.js";
3
3
  import { define } from "./define.js";
4
+ import { w as iconChevronDownOutline } from "./shared/icons.js";
4
5
  var __defProp = Object.defineProperty;
5
6
  var __decorateClass = (decorators, target, key, kind) => {
6
7
  var result = void 0;
@@ -244,7 +245,7 @@ class OkCombo extends LitElement {
244
245
  @keydown=${(e) => this.handleKeydown(e)}
245
246
  ></ion-input>
246
247
  <span class="chevron">
247
- <ion-icon name="chevron-down-outline"></ion-icon>
248
+ <ion-icon .icon=${iconChevronDownOutline}></ion-icon>
248
249
  </span>
249
250
  ${this.open ? html`<ul class="dropdown" role="listbox">
250
251
  ${items.length ? items.map(
@@ -1,6 +1,7 @@
1
1
  import { LitElement, css, html } from "lit";
2
2
  import { property, state, query } from "lit/decorators.js";
3
3
  import { define } from "./define.js";
4
+ import { o as okIcon, L as iconSearchOutline } from "./shared/icons.js";
4
5
  var __defProp = Object.defineProperty;
5
6
  var __decorateClass = (decorators, target, key, kind) => {
6
7
  var result = void 0;
@@ -367,7 +368,7 @@ class OkCommandPalette extends LitElement {
367
368
  }}
368
369
  >
369
370
  <span class="icon">
370
- ${cmd.icon ? html`<ion-icon .name=${cmd.icon}></ion-icon>` : ""}
371
+ ${cmd.icon ? html`<ion-icon .icon=${okIcon(cmd.icon)}></ion-icon>` : ""}
371
372
  </span>
372
373
  <span class="body">
373
374
  <span class="label">${cmd.label}</span>
@@ -391,7 +392,7 @@ class OkCommandPalette extends LitElement {
391
392
  >
392
393
  <div class="panel">
393
394
  <div class="search">
394
- <ion-icon name="search-outline"></ion-icon>
395
+ <ion-icon .icon=${iconSearchOutline}></ion-icon>
395
396
  <input
396
397
  type="text"
397
398
  .value=${this.queryText}
@@ -3,6 +3,17 @@ import { property, state } from "lit/decorators.js";
3
3
  import { repeat } from "lit/directives/repeat.js";
4
4
  import { styleMap } from "lit/directives/style-map.js";
5
5
  import { define } from "./define.js";
6
+ import { N as iconCalendarOutline, s as iconEllipsisVertical, o as okIcon, m as iconClose, a as iconChevronBack, Q as iconChevronForward, R as iconFileTrayOutline, S as iconSwapVerticalOutline, T as iconChevronUpOutline, w as iconChevronDownOutline } from "./shared/icons.js";
7
+ const CSV_BOM = "\uFEFF";
8
+ function decodeCsvBuffer(buf) {
9
+ let text;
10
+ try {
11
+ text = new TextDecoder("utf-8", { fatal: true }).decode(buf);
12
+ } catch {
13
+ text = new TextDecoder("windows-1252").decode(buf);
14
+ }
15
+ return text.charCodeAt(0) === 65279 ? text.slice(1) : text;
16
+ }
6
17
  var __defProp = Object.defineProperty;
7
18
  var __decorateClass = (decorators, target, key, kind) => {
8
19
  var result = void 0;
@@ -407,7 +418,7 @@ class OkDataTable extends LitElement {
407
418
  const head = cols.map((c) => this.csvEscape(c.key)).join(",");
408
419
  const lines = this.rows.map((r) => cols.map((c) => this.csvEscape(r[c.key])).join(","));
409
420
  const csv = [head, ...lines].join("\r\n");
410
- const blob = new Blob([csv], { type: "text/csv;charset=utf-8" });
421
+ const blob = new Blob([CSV_BOM + csv], { type: "text/csv;charset=utf-8" });
411
422
  const url = URL.createObjectURL(blob);
412
423
  const a = document.createElement("a");
413
424
  a.href = url;
@@ -455,7 +466,7 @@ class OkDataTable extends LitElement {
455
466
  const input = ev.target;
456
467
  const file = input.files?.[0];
457
468
  if (!file) return;
458
- const text = await file.text();
469
+ const text = decodeCsvBuffer(await file.arrayBuffer());
459
470
  const { headers, rows } = this.parseCsv(text);
460
471
  this.emit("csvImport", { headers, rows });
461
472
  this.emit("import", { headers, rows });
@@ -773,7 +784,7 @@ class OkDataTable extends LitElement {
773
784
  }
774
785
  return html`
775
786
  <span class="tk-daterange" role="group" aria-label=${col.header}>
776
- <ion-icon name="calendar-outline"></ion-icon>
787
+ <ion-icon .icon=${iconCalendarOutline}></ion-icon>
777
788
  <ion-input type="date" aria-label=${this.t.fromOf.replace("{label}", col.header)} .value=${f?.from ?? ""} @ionChange=${(e) => this.onInlineRange(col, "from", e)}></ion-input>
778
789
  <span class="arr">→</span>
779
790
  <ion-input type="date" aria-label=${this.t.toOf.replace("{label}", col.header)} .value=${f?.to ?? ""} @ionChange=${(e) => this.onInlineRange(col, "to", e)}></ion-input>
@@ -785,7 +796,7 @@ class OkDataTable extends LitElement {
785
796
  if (!this.menuActions.length) return nothing;
786
797
  return html`
787
798
  <ion-button class="toolbtn" fill="clear" aria-label=${this.t.moreActions} @click=${(e) => this.openMenu(e)}>
788
- <ion-icon slot="icon-only" name="ellipsis-vertical"></ion-icon>
799
+ <ion-icon slot="icon-only" .icon=${iconEllipsisVertical}></ion-icon>
789
800
  </ion-button>
790
801
  <ion-popover
791
802
  .isOpen=${this.menuOpen}
@@ -801,7 +812,7 @@ class OkDataTable extends LitElement {
801
812
  this.menuOpen = false;
802
813
  this.emit("menuAction", { actionId: a.id });
803
814
  }}>
804
- ${a.icon ? html`<ion-icon slot="start" name=${a.icon} color=${a.color ?? nothing}></ion-icon>` : nothing}
815
+ ${a.icon ? html`<ion-icon slot="start" .icon=${okIcon(a.icon)} color=${a.color ?? nothing}></ion-icon>` : nothing}
805
816
  <ion-label color=${a.color ?? nothing}>${a.label}</ion-label>
806
817
  </ion-item>
807
818
  `
@@ -829,7 +840,7 @@ class OkDataTable extends LitElement {
829
840
  aria-disabled=${disabled ? "true" : nothing}
830
841
  @click=${() => this.emit("rowAction", { actionId: a.id, row })}
831
842
  >
832
- ${loading ? html`<ion-spinner slot="icon-only" name="dots"></ion-spinner>` : a.icon ? html`<ion-icon slot="icon-only" name=${a.icon}></ion-icon>` : a.label}
843
+ ${loading ? html`<ion-spinner slot="icon-only" name="dots"></ion-spinner>` : a.icon ? html`<ion-icon slot="icon-only" .icon=${okIcon(a.icon)}></ion-icon>` : a.label}
833
844
  </ion-button>
834
845
  `;
835
846
  }
@@ -842,7 +853,7 @@ class OkDataTable extends LitElement {
842
853
  toolButton(icon, on, onClick, label, badge) {
843
854
  return html`
844
855
  <ion-button class="toolbtn" size="small" fill=${on ? "solid" : "outline"} title=${label} aria-label=${label} @click=${onClick}>
845
- <ion-icon slot="icon-only" name=${icon}></ion-icon>
856
+ <ion-icon slot="icon-only" .icon=${okIcon(icon)}></ion-icon>
846
857
  ${badge && badge > 0 ? html`<span class="badge">${badge}</span>` : nothing}
847
858
  </ion-button>
848
859
  `;
@@ -958,7 +969,7 @@ class OkDataTable extends LitElement {
958
969
  title=${this.primaryAction.label}
959
970
  aria-label=${this.primaryAction.label}
960
971
  @click=${() => this.emit("primaryAction", {})}
961
- ><ion-icon slot="icon-only" name=${this.primaryAction.icon ?? "add"}></ion-icon></ion-button>
972
+ ><ion-icon slot="icon-only" .icon=${okIcon(this.primaryAction.icon ?? "add")}></ion-icon></ion-button>
962
973
  ` : nothing}
963
974
  <!-- El módulo proyecta aquí acciones globales adicionales. -->
964
975
  <slot name="toolbar"></slot>
@@ -967,7 +978,7 @@ class OkDataTable extends LitElement {
967
978
  <div class="selbar">
968
979
  <strong>${this.t.selected.replace("{n}", String(selCount))}</strong>
969
980
  <button class="sel-clear" @click=${() => this.setSelection(/* @__PURE__ */ new Set())}>
970
- <ion-icon name="close" style="font-size:14px"></ion-icon> ${this.t.clear}
981
+ <ion-icon .icon=${iconClose} style="font-size:14px"></ion-icon> ${this.t.clear}
971
982
  </button>
972
983
  </div>
973
984
  ` : nothing}
@@ -991,11 +1002,11 @@ class OkDataTable extends LitElement {
991
1002
  </div>
992
1003
  ${pages > 1 ? html`
993
1004
  <div class="nav">
994
- <ion-button size="small" fill="clear" ?disabled=${current === 0} @click=${() => goTo(current - 1)}><ion-icon slot="icon-only" name="chevron-back"></ion-icon></ion-button>
1005
+ <ion-button size="small" fill="clear" ?disabled=${current === 0} @click=${() => goTo(current - 1)}><ion-icon slot="icon-only" .icon=${iconChevronBack}></ion-icon></ion-button>
995
1006
  ${this.pageList(current + 1, pages).map(
996
1007
  (p) => p === "…" ? html`<span class="pgap">…</span>` : html`<button class=${`pnum${p === current + 1 ? " on" : ""}`} @click=${() => goTo(p - 1)}>${p}</button>`
997
1008
  )}
998
- <ion-button size="small" fill="clear" ?disabled=${current >= pages - 1} @click=${() => goTo(current + 1)}><ion-icon slot="icon-only" name="chevron-forward"></ion-icon></ion-button>
1009
+ <ion-button size="small" fill="clear" ?disabled=${current >= pages - 1} @click=${() => goTo(current + 1)}><ion-icon slot="icon-only" .icon=${iconChevronForward}></ion-icon></ion-button>
999
1010
  </div>
1000
1011
  ` : nothing}
1001
1012
  </div>
@@ -1014,7 +1025,7 @@ class OkDataTable extends LitElement {
1014
1025
  <aside class="drawer" role="dialog" aria-label=${isFilters ? this.t.filters : this.t.form}>
1015
1026
  <header class="dh">
1016
1027
  <strong>${isFilters ? this.t.filters : this.t.newRecord}</strong>
1017
- <ion-button fill="clear" size="small" aria-label=${this.t.close} @click=${() => this.close()}><ion-icon slot="icon-only" name="close"></ion-icon></ion-button>
1028
+ <ion-button fill="clear" size="small" aria-label=${this.t.close} @click=${() => this.close()}><ion-icon slot="icon-only" .icon=${iconClose}></ion-icon></ion-button>
1018
1029
  </header>
1019
1030
  <div class="db">
1020
1031
  ${isFilters ? clientFilters ? this.filterColumns.map((c) => this.renderClientFilter(c)) : this.filterColumns.map((c) => html`<div class="fblock">${this.renderFilterControl(c)}</div>`) : html`<slot name="create"></slot>`}
@@ -1066,7 +1077,7 @@ class OkDataTable extends LitElement {
1066
1077
  emptyState() {
1067
1078
  return html`
1068
1079
  <div class="empty">
1069
- <span class="empty-ic"><ion-icon name="file-tray-outline"></ion-icon></span>
1080
+ <span class="empty-ic"><ion-icon .icon=${iconFileTrayOutline}></ion-icon></span>
1070
1081
  <span>${this.effEmptyMessage}</span>
1071
1082
  </div>
1072
1083
  `;
@@ -1088,7 +1099,7 @@ class OkDataTable extends LitElement {
1088
1099
  const sortable = this.isSortable(c);
1089
1100
  const active = sortable && (this.serverSide ? this.sort === c.key : this.clientSort === c.key);
1090
1101
  const dir = this.serverSide ? this.sortDir : this.clientSortDir;
1091
- const caretIcon = !active ? "swap-vertical-outline" : dir === "asc" ? "chevron-up-outline" : "chevron-down-outline";
1102
+ const caretIcon = !active ? iconSwapVerticalOutline : dir === "asc" ? iconChevronUpOutline : iconChevronDownOutline;
1092
1103
  return html`
1093
1104
  <div
1094
1105
  class=${`gcell gh ${alignCls(c.align)}${sortable ? " sortable" : ""}`}
@@ -1096,7 +1107,7 @@ class OkDataTable extends LitElement {
1096
1107
  @click=${() => this.onHeaderClick(c)}
1097
1108
  >
1098
1109
  <span>${c.header}</span>
1099
- ${sortable ? html`<span class=${`caret${active ? " on" : ""}`}><ion-icon name=${caretIcon}></ion-icon></span>` : nothing}
1110
+ ${sortable ? html`<span class=${`caret${active ? " on" : ""}`}><ion-icon .icon=${okIcon(caretIcon)}></ion-icon></span>` : nothing}
1100
1111
  </div>
1101
1112
  `;
1102
1113
  })}
@@ -1141,7 +1152,7 @@ class OkDataTable extends LitElement {
1141
1152
  <ion-card class=${`rcard${selected ? " selected" : ""}`}>
1142
1153
  ${hasHead ? html`
1143
1154
  <ion-card-header class="rcard-head">
1144
- ${icon != null && icon !== "" ? html`<span class="rc-icon">${typeof icon === "string" ? html`<ion-icon name=${icon}></ion-icon>` : icon}</span>` : nothing}
1155
+ ${icon != null && icon !== "" ? html`<span class="rc-icon">${typeof icon === "string" ? html`<ion-icon .icon=${okIcon(icon)}></ion-icon>` : icon}</span>` : nothing}
1145
1156
  <span class="rc-title">${this.cardTitle ? this.cardTitle(row) : nothing}</span>
1146
1157
  ${this.selectable ? html`<ion-checkbox .checked=${selected} aria-label=${this.t.select} @ionChange=${() => this.toggleRow(key)}></ion-checkbox>` : nothing}
1147
1158
  </ion-card-header>
@@ -2,6 +2,7 @@ import { LitElement, css, nothing, html } from "lit";
2
2
  import { property, state } from "lit/decorators.js";
3
3
  import { define } from "./define.js";
4
4
  import { c as computeAnchor } from "./shared/anchor.js";
5
+ import { N as iconCalendarOutline, t as iconChevronBackOutline, g as iconChevronForwardOutline } from "./shared/icons.js";
5
6
  var __defProp = Object.defineProperty;
6
7
  var __decorateClass = (decorators, target, key, kind) => {
7
8
  var result = void 0;
@@ -533,7 +534,7 @@ class OkDatePicker extends LitElement {
533
534
  aria-label=${label || this.t.open}
534
535
  @click=${() => this.toggle()}
535
536
  >
536
- <ion-icon name="calendar-outline"></ion-icon>
537
+ <ion-icon .icon=${iconCalendarOutline}></ion-icon>
537
538
  <span class="label ${label ? "" : "placeholder"}">${label || this.placeholder}</span>
538
539
  </button>
539
540
  ${this.open ? html`<div
@@ -573,7 +574,7 @@ class OkDatePicker extends LitElement {
573
574
  aria-label=${this.t.prev}
574
575
  @click=${() => this.prevMonth()}
575
576
  >
576
- <ion-icon name="chevron-back-outline"></ion-icon>
577
+ <ion-icon .icon=${iconChevronBackOutline}></ion-icon>
577
578
  </button>` : html`<span style="width:28px"></span>`}
578
579
  <span class="title">${title}</span>
579
580
  ${offset === (this.months === 2 ? 1 : 0) ? html`<button
@@ -582,7 +583,7 @@ class OkDatePicker extends LitElement {
582
583
  aria-label=${this.t.next}
583
584
  @click=${() => this.nextMonth()}
584
585
  >
585
- <ion-icon name="chevron-forward-outline"></ion-icon>
586
+ <ion-icon .icon=${iconChevronForwardOutline}></ion-icon>
586
587
  </button>` : html`<span style="width:28px"></span>`}
587
588
  </div>
588
589
  <div class="grid" role="grid">
package/dist/ok-drawer.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { LitElement, css, html } from "lit";
2
2
  import { property, query } from "lit/decorators.js";
3
3
  import { define } from "./define.js";
4
+ import { o as okIcon, v as iconCloseOutline } from "./shared/icons.js";
4
5
  var __defProp = Object.defineProperty;
5
6
  var __decorateClass = (decorators, target, key, kind) => {
6
7
  var result = void 0;
@@ -301,7 +302,7 @@ class OkDrawer extends LitElement {
301
302
  tabindex="-1"
302
303
  >
303
304
  <header class="header">
304
- ${this.icon ? html`<ion-icon .name=${this.icon} aria-hidden="true"></ion-icon>` : ""}
305
+ ${this.icon ? html`<ion-icon .icon=${okIcon(this.icon)} aria-hidden="true"></ion-icon>` : ""}
305
306
  ${this.heading ? html`<h2 class="heading">${this.heading}</h2>` : html`<span class="heading"></span>`}
306
307
  <div class="header-actions">
307
308
  <slot name="header-actions"></slot>
@@ -312,7 +313,7 @@ class OkDrawer extends LitElement {
312
313
  title=${this.t.close}
313
314
  @click=${() => this.requestClose("button")}
314
315
  >
315
- <ion-icon name="close-outline" aria-hidden="true"></ion-icon>
316
+ <ion-icon .icon=${iconCloseOutline} aria-hidden="true"></ion-icon>
316
317
  </button>` : ""}
317
318
  </div>
318
319
  </header>