@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,251 @@
|
|
|
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
|
+
more: "More actions",
|
|
15
|
+
menu: "Actions",
|
|
16
|
+
empty: "No actions"
|
|
17
|
+
};
|
|
18
|
+
class OkSplitButton extends LitElement {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.label = "";
|
|
22
|
+
this.color = "primary";
|
|
23
|
+
this.fill = "solid";
|
|
24
|
+
this.items = [];
|
|
25
|
+
this.labels = {};
|
|
26
|
+
this.open = false;
|
|
27
|
+
this.onDocClick = (e) => {
|
|
28
|
+
if (!e.composedPath().includes(this)) this.close();
|
|
29
|
+
};
|
|
30
|
+
this.onKeydown = (e) => {
|
|
31
|
+
if (e.key === "Escape") this.close();
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
static {
|
|
35
|
+
this.styles = css`
|
|
36
|
+
:host {
|
|
37
|
+
/* Vars overridable (estilo Ionic), default = cadena --ok-* → --ion-* → hex */
|
|
38
|
+
--color: var(--ok-text, var(--ion-text-color, #1c1b17));
|
|
39
|
+
--color-muted: var(--ok-text-muted, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.6));
|
|
40
|
+
--hover-bg: var(--ok-hover, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.06));
|
|
41
|
+
--panel-bg: var(--ok-surface, var(--ion-card-background, var(--ion-background-color, #ffffff)));
|
|
42
|
+
--border-color: var(--ok-border, rgba(var(--ion-text-color-rgb, 28, 27, 23), 0.12));
|
|
43
|
+
--border-radius: var(--ok-radius, 8px);
|
|
44
|
+
--shadow: var(--ok-shadow, 0 8px 28px rgba(0, 0, 0, 0.18));
|
|
45
|
+
--font: var(--ok-font, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
|
|
46
|
+
|
|
47
|
+
/* INLINE: solo lo que miden los botones. */
|
|
48
|
+
display: inline-block;
|
|
49
|
+
position: relative;
|
|
50
|
+
color: var(--color);
|
|
51
|
+
font-family: var(--font);
|
|
52
|
+
}
|
|
53
|
+
/* Grupo: botón principal + caret pegados, con separación visual entre ambos. */
|
|
54
|
+
.group {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: stretch;
|
|
57
|
+
}
|
|
58
|
+
/* El botón principal pierde el redondeo derecho; el caret pierde el izquierdo. */
|
|
59
|
+
.main {
|
|
60
|
+
--border-radius: var(--border-radius) 0 0 var(--border-radius);
|
|
61
|
+
margin: 0;
|
|
62
|
+
}
|
|
63
|
+
.caret {
|
|
64
|
+
--border-radius: 0 var(--border-radius) var(--border-radius) 0;
|
|
65
|
+
--padding-start: 6px;
|
|
66
|
+
--padding-end: 6px;
|
|
67
|
+
margin: 0;
|
|
68
|
+
min-width: 0;
|
|
69
|
+
border-left: 1px solid rgba(255, 255, 255, 0.25);
|
|
70
|
+
}
|
|
71
|
+
.caret ion-icon {
|
|
72
|
+
font-size: 1rem;
|
|
73
|
+
}
|
|
74
|
+
/* Menú/popover propio, posicionado bajo el grupo y alineado a la izquierda. */
|
|
75
|
+
.menu {
|
|
76
|
+
position: absolute;
|
|
77
|
+
top: calc(100% + 6px);
|
|
78
|
+
left: 0;
|
|
79
|
+
z-index: 1000;
|
|
80
|
+
min-width: 180px;
|
|
81
|
+
max-width: 280px;
|
|
82
|
+
padding: 0.3rem;
|
|
83
|
+
background: var(--panel-bg);
|
|
84
|
+
border: 1px solid var(--border-color);
|
|
85
|
+
border-radius: var(--border-radius);
|
|
86
|
+
box-shadow: var(--shadow);
|
|
87
|
+
box-sizing: border-box;
|
|
88
|
+
}
|
|
89
|
+
.item {
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
gap: 0.55rem;
|
|
93
|
+
width: 100%;
|
|
94
|
+
box-sizing: border-box;
|
|
95
|
+
padding: 0.5rem 0.6rem;
|
|
96
|
+
border: 0;
|
|
97
|
+
background: none;
|
|
98
|
+
color: inherit;
|
|
99
|
+
font: inherit;
|
|
100
|
+
text-align: left;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
border-radius: 6px;
|
|
103
|
+
transition: background-color var(--ok-transition, 150ms ease), color var(--ok-transition, 150ms ease),
|
|
104
|
+
border-color var(--ok-transition, 150ms ease), box-shadow var(--ok-transition, 150ms ease),
|
|
105
|
+
transform 120ms ease;
|
|
106
|
+
}
|
|
107
|
+
@media (hover: hover) {
|
|
108
|
+
.item:hover {
|
|
109
|
+
background: var(--hover-bg);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
.item:active {
|
|
113
|
+
transform: scale(var(--ok-press-scale, 0.97));
|
|
114
|
+
}
|
|
115
|
+
@media (prefers-reduced-motion: reduce) {
|
|
116
|
+
.item:hover,
|
|
117
|
+
.item:active {
|
|
118
|
+
transform: none;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
.item ion-icon {
|
|
122
|
+
flex: 0 0 auto;
|
|
123
|
+
font-size: 1.05rem;
|
|
124
|
+
color: var(--color-muted);
|
|
125
|
+
}
|
|
126
|
+
.item .label {
|
|
127
|
+
flex: 1 1 auto;
|
|
128
|
+
min-width: 0;
|
|
129
|
+
overflow: hidden;
|
|
130
|
+
text-overflow: ellipsis;
|
|
131
|
+
white-space: nowrap;
|
|
132
|
+
}
|
|
133
|
+
.empty {
|
|
134
|
+
padding: 0.5rem 0.6rem;
|
|
135
|
+
font-size: 0.85rem;
|
|
136
|
+
color: var(--color-muted);
|
|
137
|
+
}
|
|
138
|
+
`;
|
|
139
|
+
}
|
|
140
|
+
// Textos efectivos: defaults en inglés + overrides del consumidor.
|
|
141
|
+
get t() {
|
|
142
|
+
return { ...DEFAULT_LABELS, ...this.labels };
|
|
143
|
+
}
|
|
144
|
+
disconnectedCallback() {
|
|
145
|
+
super.disconnectedCallback();
|
|
146
|
+
this.unbind();
|
|
147
|
+
}
|
|
148
|
+
bind() {
|
|
149
|
+
document.addEventListener("click", this.onDocClick, true);
|
|
150
|
+
document.addEventListener("keydown", this.onKeydown);
|
|
151
|
+
}
|
|
152
|
+
unbind() {
|
|
153
|
+
document.removeEventListener("click", this.onDocClick, true);
|
|
154
|
+
document.removeEventListener("keydown", this.onKeydown);
|
|
155
|
+
}
|
|
156
|
+
toggle() {
|
|
157
|
+
this.open ? this.close() : this.openMenu();
|
|
158
|
+
}
|
|
159
|
+
openMenu() {
|
|
160
|
+
if (this.open) return;
|
|
161
|
+
this.open = true;
|
|
162
|
+
this.bind();
|
|
163
|
+
this.dispatchEvent(
|
|
164
|
+
new CustomEvent("ok-open", { detail: { open: true }, bubbles: true, composed: true })
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
close() {
|
|
168
|
+
if (!this.open) return;
|
|
169
|
+
this.open = false;
|
|
170
|
+
this.unbind();
|
|
171
|
+
this.dispatchEvent(
|
|
172
|
+
new CustomEvent("ok-open", { detail: { open: false }, bubbles: true, composed: true })
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
// Click en la acción principal: emite `ok-main` (no abre el menú).
|
|
176
|
+
mainClick() {
|
|
177
|
+
this.dispatchEvent(new CustomEvent("ok-main", { detail: {}, bubbles: true, composed: true }));
|
|
178
|
+
}
|
|
179
|
+
// Click en un item del menú: emite `ok-select` y cierra.
|
|
180
|
+
selectItem(item) {
|
|
181
|
+
this.dispatchEvent(
|
|
182
|
+
new CustomEvent("ok-select", {
|
|
183
|
+
detail: { id: item.id, item },
|
|
184
|
+
bubbles: true,
|
|
185
|
+
composed: true
|
|
186
|
+
})
|
|
187
|
+
);
|
|
188
|
+
this.close();
|
|
189
|
+
}
|
|
190
|
+
renderItem(item) {
|
|
191
|
+
return html`<button
|
|
192
|
+
type="button"
|
|
193
|
+
class="item"
|
|
194
|
+
role="menuitem"
|
|
195
|
+
@click=${() => this.selectItem(item)}
|
|
196
|
+
>
|
|
197
|
+
${item.icon ? html`<ion-icon .name=${item.icon}></ion-icon>` : ""}
|
|
198
|
+
<span class="label">${item.label}</span>
|
|
199
|
+
</button>`;
|
|
200
|
+
}
|
|
201
|
+
render() {
|
|
202
|
+
return html`
|
|
203
|
+
<div class="group">
|
|
204
|
+
<ion-button
|
|
205
|
+
class="main"
|
|
206
|
+
color=${this.color}
|
|
207
|
+
fill=${this.fill}
|
|
208
|
+
@click=${() => this.mainClick()}
|
|
209
|
+
>
|
|
210
|
+
${this.label}
|
|
211
|
+
</ion-button>
|
|
212
|
+
<ion-button
|
|
213
|
+
class="caret"
|
|
214
|
+
color=${this.color}
|
|
215
|
+
fill=${this.fill}
|
|
216
|
+
aria-haspopup="menu"
|
|
217
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
218
|
+
aria-label=${this.t.more}
|
|
219
|
+
@click=${() => this.toggle()}
|
|
220
|
+
>
|
|
221
|
+
<ion-icon slot="icon-only" name="chevron-down-outline"></ion-icon>
|
|
222
|
+
</ion-button>
|
|
223
|
+
</div>
|
|
224
|
+
${this.open ? html`<div class="menu" role="menu" aria-label=${this.t.menu}>
|
|
225
|
+
${this.items.length ? this.items.map((item) => this.renderItem(item)) : html`<div class="empty">${this.t.empty}</div>`}
|
|
226
|
+
</div>` : ""}
|
|
227
|
+
`;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
__decorateClass([
|
|
231
|
+
property()
|
|
232
|
+
], OkSplitButton.prototype, "label");
|
|
233
|
+
__decorateClass([
|
|
234
|
+
property()
|
|
235
|
+
], OkSplitButton.prototype, "color");
|
|
236
|
+
__decorateClass([
|
|
237
|
+
property()
|
|
238
|
+
], OkSplitButton.prototype, "fill");
|
|
239
|
+
__decorateClass([
|
|
240
|
+
property({ attribute: false })
|
|
241
|
+
], OkSplitButton.prototype, "items");
|
|
242
|
+
__decorateClass([
|
|
243
|
+
property({ attribute: false })
|
|
244
|
+
], OkSplitButton.prototype, "labels");
|
|
245
|
+
__decorateClass([
|
|
246
|
+
state()
|
|
247
|
+
], OkSplitButton.prototype, "open");
|
|
248
|
+
define("ok-split-button", OkSplitButton);
|
|
249
|
+
export {
|
|
250
|
+
OkSplitButton
|
|
251
|
+
};
|
|
@@ -0,0 +1,289 @@
|
|
|
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
|
+
class OkSplitter extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
this.orientation = "horizontal";
|
|
17
|
+
this.size = 50;
|
|
18
|
+
this.min = 10;
|
|
19
|
+
this.max = 90;
|
|
20
|
+
this.collapsed = "none";
|
|
21
|
+
this.dragging = false;
|
|
22
|
+
this._size = 50;
|
|
23
|
+
this._splitEl = null;
|
|
24
|
+
this._pointerId = null;
|
|
25
|
+
}
|
|
26
|
+
static {
|
|
27
|
+
this.styles = css`
|
|
28
|
+
:host {
|
|
29
|
+
display: block;
|
|
30
|
+
width: 100%;
|
|
31
|
+
/* Tokens propios estilo Ionic (overridables): --ok-* → --ion-* → hex. */
|
|
32
|
+
--bg: var(--ok-surface, var(--ion-background-color, #ffffff));
|
|
33
|
+
--divider-bg: var(--ok-surface-2, var(--ion-color-step-50, #f4f5f8));
|
|
34
|
+
--divider-bg-hover: var(--ok-surface-3, var(--ion-color-step-100, #e9eaee));
|
|
35
|
+
--line: var(--ok-border-color, var(--ion-border-color, #e0e0e0));
|
|
36
|
+
--grip: var(--ok-color-medium, var(--ion-color-medium, #92949c));
|
|
37
|
+
--radius: var(--ok-radius-lg, 12px);
|
|
38
|
+
--divider-size: 6px;
|
|
39
|
+
--min-height: 200px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.split {
|
|
43
|
+
display: flex;
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
min-height: var(--min-height);
|
|
47
|
+
background: var(--bg);
|
|
48
|
+
border: 1px solid var(--line);
|
|
49
|
+
border-radius: var(--radius);
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
box-sizing: border-box;
|
|
52
|
+
}
|
|
53
|
+
.split.vertical {
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.pane {
|
|
58
|
+
min-width: 0;
|
|
59
|
+
min-height: 0;
|
|
60
|
+
overflow: auto;
|
|
61
|
+
box-sizing: border-box;
|
|
62
|
+
}
|
|
63
|
+
/* En arrastre, suprimir selección de texto. */
|
|
64
|
+
:host([dragging]) {
|
|
65
|
+
user-select: none;
|
|
66
|
+
}
|
|
67
|
+
:host([dragging]) .pane {
|
|
68
|
+
pointer-events: none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.divider {
|
|
72
|
+
flex: 0 0 var(--divider-size);
|
|
73
|
+
background: var(--divider-bg);
|
|
74
|
+
position: relative;
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
cursor: col-resize;
|
|
79
|
+
transition: background 120ms ease-out;
|
|
80
|
+
touch-action: none;
|
|
81
|
+
align-self: stretch;
|
|
82
|
+
}
|
|
83
|
+
.split.vertical .divider {
|
|
84
|
+
cursor: row-resize;
|
|
85
|
+
}
|
|
86
|
+
.divider:hover,
|
|
87
|
+
:host([dragging]) .divider {
|
|
88
|
+
background: var(--divider-bg-hover);
|
|
89
|
+
}
|
|
90
|
+
.divider::before {
|
|
91
|
+
border-left: 1px solid var(--line);
|
|
92
|
+
}
|
|
93
|
+
.split.horizontal .divider {
|
|
94
|
+
border-left: 1px solid var(--line);
|
|
95
|
+
border-right: 1px solid var(--line);
|
|
96
|
+
}
|
|
97
|
+
.split.vertical .divider {
|
|
98
|
+
border-top: 1px solid var(--line);
|
|
99
|
+
border-bottom: 1px solid var(--line);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Grip de puntos radiales (vertical para split horizontal). */
|
|
103
|
+
.grip {
|
|
104
|
+
pointer-events: none;
|
|
105
|
+
}
|
|
106
|
+
.split.horizontal .grip {
|
|
107
|
+
width: 2px;
|
|
108
|
+
height: 18px;
|
|
109
|
+
background: radial-gradient(
|
|
110
|
+
circle,
|
|
111
|
+
var(--grip) 1px,
|
|
112
|
+
transparent 1.5px
|
|
113
|
+
)
|
|
114
|
+
0 0 / 2px 5px repeat-y;
|
|
115
|
+
}
|
|
116
|
+
.split.vertical .grip {
|
|
117
|
+
width: 18px;
|
|
118
|
+
height: 2px;
|
|
119
|
+
background: radial-gradient(
|
|
120
|
+
circle,
|
|
121
|
+
var(--grip) 1px,
|
|
122
|
+
transparent 1.5px
|
|
123
|
+
)
|
|
124
|
+
0 0 / 5px 2px repeat-x;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Panel colapsado: ocupa todo, oculta divisor + otro panel. */
|
|
128
|
+
.divider.hidden,
|
|
129
|
+
.pane.hidden {
|
|
130
|
+
display: none;
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
connectedCallback() {
|
|
135
|
+
super.connectedCallback();
|
|
136
|
+
this._size = this._clamp(this.size);
|
|
137
|
+
}
|
|
138
|
+
willUpdate(changed) {
|
|
139
|
+
if (changed.has("size") || changed.has("min") || changed.has("max")) {
|
|
140
|
+
this._size = this._clamp(this.size);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// Restringe el tamaño a [min, max] dentro de [0, 100].
|
|
144
|
+
_clamp(v) {
|
|
145
|
+
const lo = Math.max(0, Math.min(100, this.min));
|
|
146
|
+
const hi = Math.max(lo, Math.min(100, this.max));
|
|
147
|
+
return Math.max(lo, Math.min(hi, v));
|
|
148
|
+
}
|
|
149
|
+
_onPointerDown(e) {
|
|
150
|
+
if (this.collapsed !== "none") return;
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
const target = e.currentTarget;
|
|
153
|
+
this._splitEl = this.renderRoot.querySelector(".split");
|
|
154
|
+
this._pointerId = e.pointerId;
|
|
155
|
+
target.setPointerCapture(e.pointerId);
|
|
156
|
+
this.dragging = true;
|
|
157
|
+
}
|
|
158
|
+
_onPointerMove(e) {
|
|
159
|
+
if (!this.dragging || !this._splitEl) return;
|
|
160
|
+
const rect = this._splitEl.getBoundingClientRect();
|
|
161
|
+
let pct;
|
|
162
|
+
if (this.orientation === "vertical") {
|
|
163
|
+
const h = rect.height;
|
|
164
|
+
pct = h > 0 ? (e.clientY - rect.top) / h * 100 : this._size;
|
|
165
|
+
} else {
|
|
166
|
+
const w = rect.width;
|
|
167
|
+
pct = w > 0 ? (e.clientX - rect.left) / w * 100 : this._size;
|
|
168
|
+
}
|
|
169
|
+
const next = this._clamp(Math.round(pct * 10) / 10);
|
|
170
|
+
if (next !== this._size) {
|
|
171
|
+
this._size = next;
|
|
172
|
+
this._emit();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
_onPointerUp(e) {
|
|
176
|
+
if (!this.dragging) return;
|
|
177
|
+
const target = e.currentTarget;
|
|
178
|
+
if (this._pointerId !== null && target.hasPointerCapture?.(this._pointerId)) {
|
|
179
|
+
target.releasePointerCapture(this._pointerId);
|
|
180
|
+
}
|
|
181
|
+
this._pointerId = null;
|
|
182
|
+
this.dragging = false;
|
|
183
|
+
this.size = this._size;
|
|
184
|
+
}
|
|
185
|
+
// Permitir teclado en el divisor para accesibilidad.
|
|
186
|
+
_onKeyDown(e) {
|
|
187
|
+
if (this.collapsed !== "none") return;
|
|
188
|
+
const horiz = this.orientation === "horizontal";
|
|
189
|
+
let delta = 0;
|
|
190
|
+
if (horiz && e.key === "ArrowLeft" || !horiz && e.key === "ArrowUp") delta = -2;
|
|
191
|
+
else if (horiz && e.key === "ArrowRight" || !horiz && e.key === "ArrowDown") delta = 2;
|
|
192
|
+
else if (e.key === "Home") {
|
|
193
|
+
this._setSize(this.min);
|
|
194
|
+
e.preventDefault();
|
|
195
|
+
return;
|
|
196
|
+
} else if (e.key === "End") {
|
|
197
|
+
this._setSize(this.max);
|
|
198
|
+
e.preventDefault();
|
|
199
|
+
return;
|
|
200
|
+
} else return;
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
this._setSize(this._size + delta);
|
|
203
|
+
}
|
|
204
|
+
_setSize(v) {
|
|
205
|
+
const next = this._clamp(v);
|
|
206
|
+
if (next !== this._size) {
|
|
207
|
+
this._size = next;
|
|
208
|
+
this.size = next;
|
|
209
|
+
this._emit();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
// Emite ok-resize con el tamaño actual del primer panel (%).
|
|
213
|
+
_emit() {
|
|
214
|
+
this.dispatchEvent(
|
|
215
|
+
new CustomEvent("ok-resize", {
|
|
216
|
+
detail: { size: this._size },
|
|
217
|
+
bubbles: true,
|
|
218
|
+
composed: true
|
|
219
|
+
})
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
render() {
|
|
223
|
+
const horiz = this.orientation === "horizontal";
|
|
224
|
+
const startHidden = this.collapsed === "start";
|
|
225
|
+
const endHidden = this.collapsed === "end";
|
|
226
|
+
const dividerHidden = this.collapsed !== "none";
|
|
227
|
+
const startFlex = startHidden ? "0 0 0" : endHidden ? "1 1 auto" : `0 0 ${this._size}%`;
|
|
228
|
+
const endFlex = endHidden ? "0 0 0" : startHidden ? "1 1 auto" : "1 1 0";
|
|
229
|
+
const axis = horiz ? "horizontal" : "vertical";
|
|
230
|
+
return html`
|
|
231
|
+
<div class="split ${axis}">
|
|
232
|
+
<div
|
|
233
|
+
class="pane start ${startHidden ? "hidden" : ""}"
|
|
234
|
+
style="flex:${startFlex}"
|
|
235
|
+
>
|
|
236
|
+
<slot name="start"></slot>
|
|
237
|
+
</div>
|
|
238
|
+
<div
|
|
239
|
+
class="divider ${dividerHidden ? "hidden" : ""}"
|
|
240
|
+
role="separator"
|
|
241
|
+
tabindex="0"
|
|
242
|
+
aria-orientation=${horiz ? "vertical" : "horizontal"}
|
|
243
|
+
aria-valuenow=${Math.round(this._size)}
|
|
244
|
+
aria-valuemin=${Math.round(this.min)}
|
|
245
|
+
aria-valuemax=${Math.round(this.max)}
|
|
246
|
+
aria-label="Redimensionar paneles"
|
|
247
|
+
@pointerdown=${this._onPointerDown}
|
|
248
|
+
@pointermove=${this._onPointerMove}
|
|
249
|
+
@pointerup=${this._onPointerUp}
|
|
250
|
+
@pointercancel=${this._onPointerUp}
|
|
251
|
+
@keydown=${this._onKeyDown}
|
|
252
|
+
>
|
|
253
|
+
<span class="grip"></span>
|
|
254
|
+
</div>
|
|
255
|
+
<div
|
|
256
|
+
class="pane end ${endHidden ? "hidden" : ""}"
|
|
257
|
+
style="flex:${endFlex}"
|
|
258
|
+
>
|
|
259
|
+
<slot name="end"></slot>
|
|
260
|
+
</div>
|
|
261
|
+
</div>
|
|
262
|
+
`;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
__decorateClass([
|
|
266
|
+
property({ reflect: true })
|
|
267
|
+
], OkSplitter.prototype, "orientation");
|
|
268
|
+
__decorateClass([
|
|
269
|
+
property({ type: Number })
|
|
270
|
+
], OkSplitter.prototype, "size");
|
|
271
|
+
__decorateClass([
|
|
272
|
+
property({ type: Number })
|
|
273
|
+
], OkSplitter.prototype, "min");
|
|
274
|
+
__decorateClass([
|
|
275
|
+
property({ type: Number })
|
|
276
|
+
], OkSplitter.prototype, "max");
|
|
277
|
+
__decorateClass([
|
|
278
|
+
property()
|
|
279
|
+
], OkSplitter.prototype, "collapsed");
|
|
280
|
+
__decorateClass([
|
|
281
|
+
property({ type: Boolean, reflect: true })
|
|
282
|
+
], OkSplitter.prototype, "dragging");
|
|
283
|
+
__decorateClass([
|
|
284
|
+
state()
|
|
285
|
+
], OkSplitter.prototype, "_size");
|
|
286
|
+
define("ok-splitter", OkSplitter);
|
|
287
|
+
export {
|
|
288
|
+
OkSplitter
|
|
289
|
+
};
|
package/dist/ok-stat.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { LitElement, css, html } from "lit";
|
|
2
|
+
import { property } 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
|
+
class OkStat extends LitElement {
|
|
14
|
+
static {
|
|
15
|
+
this.styles = css`
|
|
16
|
+
:host {
|
|
17
|
+
display: block;
|
|
18
|
+
width: 100%;
|
|
19
|
+
/* Tokens propios estilo Ionic (overridables): --ok-* → --ion-* → hex. */
|
|
20
|
+
--color: var(--ok-text-color, var(--ion-text-color, #1f2933));
|
|
21
|
+
--label-color: var(--ok-color-medium, var(--ion-color-medium, #92949c));
|
|
22
|
+
--hint-color: var(--ok-color-medium, var(--ion-color-medium, #92949c));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.stat {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
gap: 0.125rem;
|
|
29
|
+
width: 100%;
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.label {
|
|
34
|
+
margin: 0;
|
|
35
|
+
font-size: 0.75rem;
|
|
36
|
+
font-weight: 500;
|
|
37
|
+
color: var(--label-color);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.value {
|
|
41
|
+
margin: 0;
|
|
42
|
+
font-size: 1.25rem;
|
|
43
|
+
font-weight: 700;
|
|
44
|
+
line-height: 1.15;
|
|
45
|
+
color: var(--color);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.hint {
|
|
49
|
+
margin: 0;
|
|
50
|
+
font-size: 0.75rem;
|
|
51
|
+
color: var(--hint-color);
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
return html`
|
|
57
|
+
<div class="stat">
|
|
58
|
+
${this.label ? html`<p class="label">${this.label}</p>` : null}
|
|
59
|
+
${this.value ? html`<p class="value">${this.value}</p>` : null}
|
|
60
|
+
${this.hint ? html`<p class="hint">${this.hint}</p>` : null}
|
|
61
|
+
</div>
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
__decorateClass([
|
|
66
|
+
property()
|
|
67
|
+
], OkStat.prototype, "label");
|
|
68
|
+
__decorateClass([
|
|
69
|
+
property()
|
|
70
|
+
], OkStat.prototype, "value");
|
|
71
|
+
__decorateClass([
|
|
72
|
+
property()
|
|
73
|
+
], OkStat.prototype, "hint");
|
|
74
|
+
define("ok-stat", OkStat);
|
|
75
|
+
export {
|
|
76
|
+
OkStat
|
|
77
|
+
};
|