@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.
- package/LICENSE +21 -0
- package/README.md +457 -0
- package/dist/base/anchor.d.ts +13 -0
- package/dist/base/define.d.ts +1 -0
- package/dist/base/relay.d.ts +1 -0
- package/dist/cdn.d.ts +96 -0
- package/dist/components/ok-app-launcher/ok-app-launcher.d.ts +57 -0
- package/dist/components/ok-audio/ok-audio.d.ts +45 -0
- package/dist/components/ok-avatar/ok-avatar.d.ts +36 -0
- package/dist/components/ok-avatar-group/ok-avatar-group.d.ts +38 -0
- package/dist/components/ok-bar-list/ok-bar-list.d.ts +36 -0
- package/dist/components/ok-bento/ok-bento.d.ts +17 -0
- package/dist/components/ok-bento-item/ok-bento-item.d.ts +34 -0
- package/dist/components/ok-calculator/ok-calculator.d.ts +46 -0
- package/dist/components/ok-calendar/ok-calendar.d.ts +63 -0
- package/dist/components/ok-carousel/ok-carousel.d.ts +48 -0
- package/dist/components/ok-chart/ok-chart.d.ts +55 -0
- package/dist/components/ok-chat/ok-chat.d.ts +54 -0
- package/dist/components/ok-coachmark/ok-coachmark.d.ts +69 -0
- package/dist/components/ok-code/ok-code.d.ts +28 -0
- package/dist/components/ok-color-picker/ok-color-picker.d.ts +63 -0
- package/dist/components/ok-combo/ok-combo.d.ts +46 -0
- package/dist/components/ok-command-palette/ok-command-palette.d.ts +72 -0
- package/dist/components/ok-contact-form/ok-contact-form.d.ts +54 -0
- package/dist/components/ok-cropper/ok-cropper.d.ts +60 -0
- package/dist/components/ok-cta-band/ok-cta-band.d.ts +18 -0
- package/dist/components/ok-currency/ok-currency.d.ts +31 -0
- package/dist/components/ok-data-table/ok-data-table.d.ts +312 -0
- package/dist/components/ok-date-picker/ok-date-picker.d.ts +81 -0
- package/dist/components/ok-detail-list/ok-detail-list.d.ts +30 -0
- package/dist/components/ok-diff/ok-diff.d.ts +38 -0
- package/dist/components/ok-donut/ok-donut.d.ts +38 -0
- package/dist/components/ok-drawer/ok-drawer.d.ts +56 -0
- package/dist/components/ok-dropzone/ok-dropzone.d.ts +48 -0
- package/dist/components/ok-empty-state/ok-empty-state.d.ts +16 -0
- package/dist/components/ok-error-page/ok-error-page.d.ts +77 -0
- package/dist/components/ok-event-card/ok-event-card.d.ts +56 -0
- package/dist/components/ok-feature-card/ok-feature-card.d.ts +23 -0
- package/dist/components/ok-file-item/ok-file-item.d.ts +31 -0
- package/dist/components/ok-file-manager/ok-file-manager.d.ts +145 -0
- package/dist/components/ok-footer/ok-footer.d.ts +10 -0
- package/dist/components/ok-funnel/ok-funnel.d.ts +31 -0
- package/dist/components/ok-gallery/ok-gallery.d.ts +34 -0
- package/dist/components/ok-gauge/ok-gauge.d.ts +49 -0
- package/dist/components/ok-heatmap/ok-heatmap.d.ts +45 -0
- package/dist/components/ok-hero/ok-hero.d.ts +10 -0
- package/dist/components/ok-hover-card/ok-hover-card.d.ts +76 -0
- package/dist/components/ok-icon-tile/ok-icon-tile.d.ts +24 -0
- package/dist/components/ok-image/ok-image.d.ts +56 -0
- package/dist/components/ok-inline-feedback/ok-inline-feedback.d.ts +33 -0
- package/dist/components/ok-invoice/ok-invoice.d.ts +137 -0
- package/dist/components/ok-json-viewer/ok-json-viewer.d.ts +31 -0
- package/dist/components/ok-kanban/ok-kanban.d.ts +56 -0
- package/dist/components/ok-kbd/ok-kbd.d.ts +21 -0
- package/dist/components/ok-keyboard/ok-keyboard.d.ts +35 -0
- package/dist/components/ok-kpi/ok-kpi.d.ts +24 -0
- package/dist/components/ok-language-select/ok-language-select.d.ts +31 -0
- package/dist/components/ok-lightbox/ok-lightbox.d.ts +59 -0
- package/dist/components/ok-logo-cloud/ok-logo-cloud.d.ts +14 -0
- package/dist/components/ok-loyalty-card/ok-loyalty-card.d.ts +35 -0
- package/dist/components/ok-mail/ok-mail.d.ts +117 -0
- package/dist/components/ok-menu/ok-menu.d.ts +75 -0
- package/dist/components/ok-menubar/ok-menubar.d.ts +75 -0
- package/dist/components/ok-navbar/ok-navbar.d.ts +42 -0
- package/dist/components/ok-notification-center/ok-notification-center.d.ts +79 -0
- package/dist/components/ok-org-chart/ok-org-chart.d.ts +67 -0
- package/dist/components/ok-otp/ok-otp.d.ts +31 -0
- package/dist/components/ok-page-header/ok-page-header.d.ts +23 -0
- package/dist/components/ok-pagination/ok-pagination.d.ts +44 -0
- package/dist/components/ok-pdf/ok-pdf.d.ts +32 -0
- package/dist/components/ok-phone/ok-phone.d.ts +48 -0
- package/dist/components/ok-pinpad/ok-pinpad.d.ts +29 -0
- package/dist/components/ok-pricing-card/ok-pricing-card.d.ts +31 -0
- package/dist/components/ok-product-card/ok-product-card.d.ts +25 -0
- package/dist/components/ok-qr/ok-qr.d.ts +24 -0
- package/dist/components/ok-qty-stepper/ok-qty-stepper.d.ts +35 -0
- package/dist/components/ok-range-dual/ok-range-dual.d.ts +38 -0
- package/dist/components/ok-rating/ok-rating.d.ts +33 -0
- package/dist/components/ok-receipt/ok-receipt.d.ts +103 -0
- package/dist/components/ok-reveal/ok-reveal.d.ts +21 -0
- package/dist/components/ok-rich-text/ok-rich-text.d.ts +46 -0
- package/dist/components/ok-scheduler/ok-scheduler.d.ts +74 -0
- package/dist/components/ok-select-card/ok-select-card.d.ts +37 -0
- package/dist/components/ok-signature/ok-signature.d.ts +55 -0
- package/dist/components/ok-skeleton/ok-skeleton.d.ts +40 -0
- package/dist/components/ok-sparkline/ok-sparkline.d.ts +27 -0
- package/dist/components/ok-split-button/ok-split-button.d.ts +49 -0
- package/dist/components/ok-splitter/ok-splitter.d.ts +36 -0
- package/dist/components/ok-stat/ok-stat.d.ts +16 -0
- package/dist/components/ok-status-dot/ok-status-dot.d.ts +24 -0
- package/dist/components/ok-status-pill/ok-status-pill.d.ts +22 -0
- package/dist/components/ok-stepper/ok-stepper.d.ts +33 -0
- package/dist/components/ok-store/ok-store.d.ts +33 -0
- package/dist/components/ok-tag-input/ok-tag-input.d.ts +39 -0
- package/dist/components/ok-testimonial/ok-testimonial.d.ts +21 -0
- package/dist/components/ok-time-picker/ok-time-picker.d.ts +50 -0
- package/dist/components/ok-timeline/ok-timeline.d.ts +33 -0
- package/dist/components/ok-tree/ok-tree.d.ts +46 -0
- package/dist/components/ok-video/ok-video.d.ts +49 -0
- package/dist/components/ok-widget-board/ok-widget-board.d.ts +71 -0
- package/dist/components/ok-wizard/ok-wizard.d.ts +30 -0
- package/dist/define.js +8 -0
- package/dist/erplora.css +112 -0
- package/dist/index.d.ts +158 -0
- package/dist/index.js +197 -0
- package/dist/layout.css +338 -0
- package/dist/ok-app-launcher.js +396 -0
- package/dist/ok-audio.js +308 -0
- package/dist/ok-avatar-group.js +158 -0
- package/dist/ok-avatar.js +179 -0
- package/dist/ok-bar-list.js +189 -0
- package/dist/ok-bento-item.js +168 -0
- package/dist/ok-bento.js +63 -0
- package/dist/ok-calculator.js +406 -0
- package/dist/ok-calendar.js +541 -0
- package/dist/ok-carousel.js +352 -0
- package/dist/ok-chart.js +325 -0
- package/dist/ok-chat.js +320 -0
- package/dist/ok-coachmark.js +500 -0
- package/dist/ok-code.js +190 -0
- package/dist/ok-color-picker.js +569 -0
- package/dist/ok-combo.js +294 -0
- package/dist/ok-command-palette.js +448 -0
- package/dist/ok-contact-form.js +288 -0
- package/dist/ok-cropper.js +404 -0
- package/dist/ok-cta-band.js +134 -0
- package/dist/ok-currency.js +172 -0
- package/dist/ok-data-table.js +1281 -0
- package/dist/ok-date-picker.js +736 -0
- package/dist/ok-detail-list.js +156 -0
- package/dist/ok-diff.js +200 -0
- package/dist/ok-donut.js +280 -0
- package/dist/ok-drawer.js +357 -0
- package/dist/ok-dropzone.js +376 -0
- package/dist/ok-empty-state.js +104 -0
- package/dist/ok-error-page.js +547 -0
- package/dist/ok-event-card.js +384 -0
- package/dist/ok-feature-card.js +152 -0
- package/dist/ok-file-item.js +259 -0
- package/dist/ok-file-manager.js +1116 -0
- package/dist/ok-footer.js +67 -0
- package/dist/ok-funnel.js +181 -0
- package/dist/ok-gallery.js +293 -0
- package/dist/ok-gauge.js +385 -0
- package/dist/ok-heatmap.js +268 -0
- package/dist/ok-hero.js +43 -0
- package/dist/ok-hover-card.js +480 -0
- package/dist/ok-icon-tile.js +123 -0
- package/dist/ok-image.js +471 -0
- package/dist/ok-inline-feedback.js +221 -0
- package/dist/ok-invoice.js +229 -0
- package/dist/ok-json-viewer.js +330 -0
- package/dist/ok-kanban.js +427 -0
- package/dist/ok-kbd.js +159 -0
- package/dist/ok-keyboard.js +402 -0
- package/dist/ok-kpi.js +147 -0
- package/dist/ok-language-select.js +188 -0
- package/dist/ok-lightbox.js +490 -0
- package/dist/ok-logo-cloud.js +92 -0
- package/dist/ok-loyalty-card.js +353 -0
- package/dist/ok-mail.js +562 -0
- package/dist/ok-menu.js +529 -0
- package/dist/ok-menubar.js +628 -0
- package/dist/ok-navbar.js +306 -0
- package/dist/ok-notification-center.js +545 -0
- package/dist/ok-org-chart.js +619 -0
- package/dist/ok-otp.js +199 -0
- package/dist/ok-page-header.js +202 -0
- package/dist/ok-pagination.js +366 -0
- package/dist/ok-pdf.js +160 -0
- package/dist/ok-phone.js +225 -0
- package/dist/ok-pinpad.js +171 -0
- package/dist/ok-pricing-card.js +184 -0
- package/dist/ok-product-card.js +178 -0
- package/dist/ok-qr.js +652 -0
- package/dist/ok-qty-stepper.js +212 -0
- package/dist/ok-range-dual.js +280 -0
- package/dist/ok-rating.js +199 -0
- package/dist/ok-receipt.js +183 -0
- package/dist/ok-reveal.js +94 -0
- package/dist/ok-rich-text.js +538 -0
- package/dist/ok-scheduler.js +518 -0
- package/dist/ok-select-card.js +231 -0
- package/dist/ok-signature.js +267 -0
- package/dist/ok-skeleton.js +345 -0
- package/dist/ok-sparkline.js +150 -0
- package/dist/ok-split-button.js +251 -0
- package/dist/ok-splitter.js +289 -0
- package/dist/ok-stat.js +77 -0
- package/dist/ok-status-dot.js +163 -0
- package/dist/ok-status-pill.js +123 -0
- package/dist/ok-stepper.js +299 -0
- package/dist/ok-store.js +83 -0
- package/dist/ok-tag-input.js +358 -0
- package/dist/ok-testimonial.js +136 -0
- package/dist/ok-time-picker.js +472 -0
- package/dist/ok-timeline.js +251 -0
- package/dist/ok-tree.js +266 -0
- package/dist/ok-video.js +362 -0
- package/dist/ok-widget-board.js +265 -0
- package/dist/ok-wizard.js +153 -0
- package/dist/outfitkit.js +96 -0
- package/dist/shared/anchor.js +14 -0
- package/dist/store/controller.d.ts +17 -0
- package/dist/store/idb.d.ts +16 -0
- package/dist/store/store.d.ts +39 -0
- package/dist/store-controller.js +31 -0
- package/dist/store.js +182 -0
- package/dist/theme.example.css +70 -0
- package/package.json +147 -0
|
@@ -0,0 +1,306 @@
|
|
|
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
|
+
menu: "Menu",
|
|
15
|
+
close: "Close"
|
|
16
|
+
};
|
|
17
|
+
const MOBILE_BREAKPOINT = "(max-width: 800px)";
|
|
18
|
+
let panelSheetAdopted = false;
|
|
19
|
+
function adoptPanelSheet() {
|
|
20
|
+
if (panelSheetAdopted) return;
|
|
21
|
+
panelSheetAdopted = true;
|
|
22
|
+
const sheet = new CSSStyleSheet();
|
|
23
|
+
sheet.replaceSync(`
|
|
24
|
+
ion-modal.ok-navbar-modal {
|
|
25
|
+
--width: var(--ok-navbar-panel-width, min(320px, 86vw));
|
|
26
|
+
--height: 100%;
|
|
27
|
+
--border-radius: 0;
|
|
28
|
+
--background: var(--ok-surface, var(--ion-card-background, #ffffff));
|
|
29
|
+
--box-shadow: -12px 0 40px rgba(0, 0, 0, 0.18);
|
|
30
|
+
/* El host del modal es un flex que centra el wrapper: lo anclamos a la derecha. */
|
|
31
|
+
justify-content: flex-end;
|
|
32
|
+
align-items: stretch;
|
|
33
|
+
}
|
|
34
|
+
.ok-navbar-modal .ok-navbar-panel {
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
height: 100%;
|
|
37
|
+
overflow-y: auto;
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
padding: 0.5rem var(--ok-spacing, var(--ion-padding, 16px)) var(--ok-spacing, var(--ion-padding, 16px));
|
|
41
|
+
background: var(--ok-surface, var(--ion-card-background, #ffffff));
|
|
42
|
+
color: var(--ok-text, var(--ion-text-color, #1c1b17));
|
|
43
|
+
font-family: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
|
|
44
|
+
}
|
|
45
|
+
.ok-navbar-modal .ok-navbar-panel-head { display: flex; justify-content: flex-end; }
|
|
46
|
+
.ok-navbar-modal .ok-navbar-close {
|
|
47
|
+
background: none;
|
|
48
|
+
border: 0;
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
padding: 0.5rem;
|
|
51
|
+
color: inherit;
|
|
52
|
+
}
|
|
53
|
+
.ok-navbar-modal .ok-navbar-close span { display: block; width: 22px; height: 2px; position: relative; }
|
|
54
|
+
.ok-navbar-modal .ok-navbar-close span::before,
|
|
55
|
+
.ok-navbar-modal .ok-navbar-close span::after {
|
|
56
|
+
content: '';
|
|
57
|
+
position: absolute;
|
|
58
|
+
left: 0;
|
|
59
|
+
top: 0;
|
|
60
|
+
width: 22px;
|
|
61
|
+
height: 2px;
|
|
62
|
+
background: currentColor;
|
|
63
|
+
border-radius: 2px;
|
|
64
|
+
}
|
|
65
|
+
.ok-navbar-modal .ok-navbar-close span::before { transform: rotate(45deg); }
|
|
66
|
+
.ok-navbar-modal .ok-navbar-close span::after { transform: rotate(-45deg); }
|
|
67
|
+
.ok-navbar-modal .ok-navbar-links { display: flex; flex-direction: column; }
|
|
68
|
+
.ok-navbar-modal .ok-navbar-links a {
|
|
69
|
+
display: block;
|
|
70
|
+
padding: 0.85rem 0;
|
|
71
|
+
color: inherit;
|
|
72
|
+
text-decoration: none;
|
|
73
|
+
font-size: 0.95rem;
|
|
74
|
+
border-top: 1px solid var(--ok-border-soft, rgba(var(--ion-text-color-rgb, 24, 24, 27), 0.07));
|
|
75
|
+
}
|
|
76
|
+
.ok-navbar-modal .ok-navbar-links a:first-child { border-top: 0; }
|
|
77
|
+
/* Acciones al pie: en columna, separadas de los enlaces y a ancho completo. */
|
|
78
|
+
.ok-navbar-modal .ok-navbar-actions {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
align-items: stretch;
|
|
82
|
+
gap: 0.6rem;
|
|
83
|
+
margin-top: 1.25rem;
|
|
84
|
+
padding-top: 1.25rem;
|
|
85
|
+
border-top: 1px solid var(--ok-border, rgba(var(--ion-text-color-rgb, 24, 24, 27), 0.12));
|
|
86
|
+
}
|
|
87
|
+
.ok-navbar-modal .ok-navbar-actions ion-button { width: 100%; }
|
|
88
|
+
`);
|
|
89
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
|
|
90
|
+
}
|
|
91
|
+
class OkNavbar extends LitElement {
|
|
92
|
+
constructor() {
|
|
93
|
+
super(...arguments);
|
|
94
|
+
this.sticky = false;
|
|
95
|
+
this.glass = false;
|
|
96
|
+
this.open = false;
|
|
97
|
+
this.labels = {};
|
|
98
|
+
this.isMobile = false;
|
|
99
|
+
this.mq = null;
|
|
100
|
+
this.modal = null;
|
|
101
|
+
this.linksHost = null;
|
|
102
|
+
this.actionsHost = null;
|
|
103
|
+
this.closeBtn = null;
|
|
104
|
+
this.movedNodes = [];
|
|
105
|
+
this.onMqChange = (e) => {
|
|
106
|
+
this.isMobile = e.matches;
|
|
107
|
+
if (!e.matches) this.open = false;
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
static {
|
|
111
|
+
this.styles = css`
|
|
112
|
+
:host {
|
|
113
|
+
/* Vars overridable (estilo Ionic), default = cadena --ok-* → --ion-* → hex */
|
|
114
|
+
--background: var(--ok-surface, var(--ion-card-background, #ffffff));
|
|
115
|
+
--color: var(--ok-text, var(--ion-text-color, #1c1b17));
|
|
116
|
+
--border-color: var(--ok-border, rgba(var(--ion-text-color-rgb, 24, 24, 27), 0.12));
|
|
117
|
+
--primary-color: var(--ok-primary, var(--ion-color-primary, #3880ff));
|
|
118
|
+
--max-width: var(--ok-container-max, 1140px);
|
|
119
|
+
--padding: var(--ok-spacing, var(--ion-padding, 16px));
|
|
120
|
+
--font: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
|
|
121
|
+
|
|
122
|
+
display: block;
|
|
123
|
+
background: var(--background);
|
|
124
|
+
border-bottom: 1px solid var(--border-color);
|
|
125
|
+
color: var(--color);
|
|
126
|
+
font-family: var(--font);
|
|
127
|
+
}
|
|
128
|
+
:host([sticky]) { position: sticky; top: 0; z-index: 50; }
|
|
129
|
+
/* Navbar de cristal (tendencia 2026): fondo translúcido + desenfoque. Úsalo con sticky. */
|
|
130
|
+
:host([glass]) {
|
|
131
|
+
background: color-mix(in oklab, var(--background) 72%, transparent);
|
|
132
|
+
-webkit-backdrop-filter: blur(14px) saturate(1.4);
|
|
133
|
+
backdrop-filter: blur(14px) saturate(1.4);
|
|
134
|
+
border-bottom-color: color-mix(in oklab, var(--color) 9%, transparent);
|
|
135
|
+
}
|
|
136
|
+
.bar {
|
|
137
|
+
position: relative;
|
|
138
|
+
max-width: var(--max-width);
|
|
139
|
+
margin-inline: auto;
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
gap: 1rem;
|
|
143
|
+
padding: 0.6rem var(--padding);
|
|
144
|
+
}
|
|
145
|
+
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
|
|
146
|
+
.spacer { flex: 1; }
|
|
147
|
+
.links { display: flex; align-items: center; gap: 1.75rem; }
|
|
148
|
+
.links-inner { display: flex; align-items: center; gap: 1.25rem; }
|
|
149
|
+
.actions { display: flex; align-items: center; gap: 0.5rem; }
|
|
150
|
+
::slotted(a) {
|
|
151
|
+
color: var(--color);
|
|
152
|
+
text-decoration: none;
|
|
153
|
+
font-size: 0.95rem;
|
|
154
|
+
/* Micro-interacción: transición sutil en color al hacer hover. */
|
|
155
|
+
transition: background-color var(--ok-transition, 150ms ease), color var(--ok-transition, 150ms ease), border-color var(--ok-transition, 150ms ease), box-shadow var(--ok-transition, 150ms ease), transform 120ms ease;
|
|
156
|
+
}
|
|
157
|
+
/* Hover de enlaces solo con ratón (evita estados pegados en táctil). */
|
|
158
|
+
@media (hover: hover) {
|
|
159
|
+
::slotted(a:hover) { color: var(--primary-color); }
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.burger {
|
|
163
|
+
display: block;
|
|
164
|
+
background: none;
|
|
165
|
+
border: 0;
|
|
166
|
+
cursor: pointer;
|
|
167
|
+
padding: 0.5rem;
|
|
168
|
+
color: var(--color);
|
|
169
|
+
/* Micro-interacción: feedback sutil al presionar el burger. */
|
|
170
|
+
transition: background-color var(--ok-transition, 150ms ease), color var(--ok-transition, 150ms ease), border-color var(--ok-transition, 150ms ease), box-shadow var(--ok-transition, 150ms ease), transform 120ms ease;
|
|
171
|
+
}
|
|
172
|
+
@media (hover: hover) {
|
|
173
|
+
.burger:hover { color: var(--primary-color); }
|
|
174
|
+
}
|
|
175
|
+
.burger:active { transform: scale(var(--ok-press-scale, 0.97)); }
|
|
176
|
+
@media (prefers-reduced-motion: reduce) {
|
|
177
|
+
::slotted(a):active, .burger:hover, .burger:active { transform: none; }
|
|
178
|
+
}
|
|
179
|
+
.burger span { display: block; width: 22px; height: 2px; background: currentColor; border-radius: 2px; position: relative; }
|
|
180
|
+
.burger span::before, .burger span::after { content: ''; position: absolute; left: 0; width: 22px; height: 2px; background: currentColor; border-radius: 2px; }
|
|
181
|
+
.burger span::before { top: -7px; }
|
|
182
|
+
.burger span::after { top: 7px; }
|
|
183
|
+
`;
|
|
184
|
+
}
|
|
185
|
+
get t() {
|
|
186
|
+
return { ...DEFAULT_LABELS, ...this.labels };
|
|
187
|
+
}
|
|
188
|
+
connectedCallback() {
|
|
189
|
+
super.connectedCallback();
|
|
190
|
+
this.mq = window.matchMedia(MOBILE_BREAKPOINT);
|
|
191
|
+
this.isMobile = this.mq.matches;
|
|
192
|
+
this.mq.addEventListener("change", this.onMqChange);
|
|
193
|
+
}
|
|
194
|
+
disconnectedCallback() {
|
|
195
|
+
super.disconnectedCallback();
|
|
196
|
+
this.mq?.removeEventListener("change", this.onMqChange);
|
|
197
|
+
this.mq = null;
|
|
198
|
+
this.restoreNodes();
|
|
199
|
+
this.modal?.remove();
|
|
200
|
+
this.modal = null;
|
|
201
|
+
}
|
|
202
|
+
updated(changed) {
|
|
203
|
+
if (changed.has("open")) {
|
|
204
|
+
if (this.open) void this.presentPanel();
|
|
205
|
+
else void this.modal?.dismiss();
|
|
206
|
+
}
|
|
207
|
+
if (changed.has("labels")) this.closeBtn?.setAttribute("aria-label", this.t.close);
|
|
208
|
+
}
|
|
209
|
+
openPanel() {
|
|
210
|
+
this.open = true;
|
|
211
|
+
}
|
|
212
|
+
// ── Panel móvil (ion-modal en <body>, contenido movido imperativamente) ────────────
|
|
213
|
+
buildModal() {
|
|
214
|
+
const modal = document.createElement("ion-modal");
|
|
215
|
+
modal.classList.add("ok-navbar-modal");
|
|
216
|
+
const panel = document.createElement("div");
|
|
217
|
+
panel.className = "ok-navbar-panel";
|
|
218
|
+
const head = document.createElement("div");
|
|
219
|
+
head.className = "ok-navbar-panel-head";
|
|
220
|
+
this.closeBtn = document.createElement("button");
|
|
221
|
+
this.closeBtn.className = "ok-navbar-close";
|
|
222
|
+
this.closeBtn.setAttribute("aria-label", this.t.close);
|
|
223
|
+
this.closeBtn.appendChild(document.createElement("span"));
|
|
224
|
+
this.closeBtn.addEventListener("click", () => {
|
|
225
|
+
this.open = false;
|
|
226
|
+
});
|
|
227
|
+
head.appendChild(this.closeBtn);
|
|
228
|
+
this.linksHost = document.createElement("nav");
|
|
229
|
+
this.linksHost.className = "ok-navbar-links";
|
|
230
|
+
this.actionsHost = document.createElement("div");
|
|
231
|
+
this.actionsHost.className = "ok-navbar-actions";
|
|
232
|
+
panel.append(head, this.linksHost, this.actionsHost);
|
|
233
|
+
panel.addEventListener("click", (e) => {
|
|
234
|
+
if (e.target?.closest("a")) this.open = false;
|
|
235
|
+
});
|
|
236
|
+
modal.appendChild(panel);
|
|
237
|
+
modal.addEventListener("ionModalDidDismiss", () => {
|
|
238
|
+
this.restoreNodes();
|
|
239
|
+
this.open = false;
|
|
240
|
+
});
|
|
241
|
+
document.body.appendChild(modal);
|
|
242
|
+
return modal;
|
|
243
|
+
}
|
|
244
|
+
async presentPanel() {
|
|
245
|
+
if (!this.isMobile) return;
|
|
246
|
+
adoptPanelSheet();
|
|
247
|
+
if (!this.modal) this.modal = this.buildModal();
|
|
248
|
+
if (this.movedNodes.length === 0 && this.linksHost && this.actionsHost) {
|
|
249
|
+
for (const el of Array.from(this.children)) {
|
|
250
|
+
const slot = el.getAttribute("slot");
|
|
251
|
+
if (slot === "brand") continue;
|
|
252
|
+
this.movedNodes.push(el);
|
|
253
|
+
(slot === "actions" ? this.actionsHost : this.linksHost).appendChild(el);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
await customElements.whenDefined("ion-modal");
|
|
257
|
+
await this.modal.present();
|
|
258
|
+
}
|
|
259
|
+
restoreNodes() {
|
|
260
|
+
for (const el of this.movedNodes) this.appendChild(el);
|
|
261
|
+
this.movedNodes = [];
|
|
262
|
+
}
|
|
263
|
+
render() {
|
|
264
|
+
return html`
|
|
265
|
+
<nav class="bar">
|
|
266
|
+
<div class="brand"><slot name="brand"></slot></div>
|
|
267
|
+
<div class="spacer"></div>
|
|
268
|
+
${this.isMobile ? html`
|
|
269
|
+
<button
|
|
270
|
+
class="burger"
|
|
271
|
+
aria-label=${this.t.menu}
|
|
272
|
+
aria-haspopup="dialog"
|
|
273
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
274
|
+
@click=${this.openPanel}
|
|
275
|
+
>
|
|
276
|
+
<span></span>
|
|
277
|
+
</button>
|
|
278
|
+
` : html`
|
|
279
|
+
<div class="links">
|
|
280
|
+
<div class="links-inner"><slot></slot></div>
|
|
281
|
+
<div class="actions"><slot name="actions"></slot></div>
|
|
282
|
+
</div>
|
|
283
|
+
`}
|
|
284
|
+
</nav>
|
|
285
|
+
`;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
__decorateClass([
|
|
289
|
+
property({ type: Boolean, reflect: true })
|
|
290
|
+
], OkNavbar.prototype, "sticky");
|
|
291
|
+
__decorateClass([
|
|
292
|
+
property({ type: Boolean, reflect: true })
|
|
293
|
+
], OkNavbar.prototype, "glass");
|
|
294
|
+
__decorateClass([
|
|
295
|
+
property({ type: Boolean, reflect: true })
|
|
296
|
+
], OkNavbar.prototype, "open");
|
|
297
|
+
__decorateClass([
|
|
298
|
+
property({ attribute: false })
|
|
299
|
+
], OkNavbar.prototype, "labels");
|
|
300
|
+
__decorateClass([
|
|
301
|
+
state()
|
|
302
|
+
], OkNavbar.prototype, "isMobile");
|
|
303
|
+
define("ok-navbar", OkNavbar);
|
|
304
|
+
export {
|
|
305
|
+
OkNavbar
|
|
306
|
+
};
|