@shibui-ui/ui 1.25.1 → 1.26.0
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/dist/index11.js +1 -1
- package/dist/index194.js +6 -97
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +2 -2
- package/dist/index197.js +18 -2
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +2 -74
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +74 -64
- package/dist/index199.js.map +1 -1
- package/dist/index200.js +2 -2
- package/dist/index201.js +2 -57
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +39 -2
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +2 -2
- package/dist/index204.js +219 -144
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +82 -43
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +2 -51
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +94 -2
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +2 -33
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +268 -2
- package/dist/index209.js.map +1 -1
- package/dist/index210.js +2 -6
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +21 -2
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +2 -260
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +8 -16
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +2 -2
- package/dist/index215.js +15 -2
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +2 -66
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +146 -24
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +2 -2
- package/dist/index219.js +5 -2
- package/dist/index219.js.map +1 -1
- package/dist/index220.js +2 -81
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +6 -78
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +2 -2
- package/dist/index223.js +2 -133
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +92 -2
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +59 -2
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +2 -72
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +97 -94
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +2 -2
- package/dist/index229.js +2 -71
- package/dist/index229.js.map +1 -1
- package/dist/index230.js +74 -2
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +74 -2
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +2 -12
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +53 -5
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +2 -2
- package/dist/index235.js +2 -18
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +162 -2
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +43 -84
- package/dist/index237.js.map +1 -1
- package/dist/index238.js +51 -2
- package/dist/index238.js.map +1 -1
- package/dist/index239.js +2 -2
- package/dist/index240.js +33 -39
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +2 -2
- package/dist/index242.js +5 -236
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +2 -82
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +260 -2
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +16 -93
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +2 -2
- package/dist/index247.js +2 -268
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +66 -2
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +24 -13
- package/dist/index249.js.map +1 -1
- package/dist/index250.js +2 -2
- package/dist/index251.js +2 -9
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +81 -2
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +78 -12
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +2 -2
- package/dist/index255.js +111 -132
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +2 -2
- package/dist/index257.js +2 -5
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +72 -2
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +93 -5
- package/dist/index259.js.map +1 -1
- package/dist/index260.js +2 -2
- package/dist/index261.js +71 -2
- package/dist/index261.js.map +1 -1
- package/dist/index262.js +2 -92
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +2 -59
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +12 -2
- package/dist/index264.js.map +1 -1
- package/dist/index34.js +1 -1
- package/dist/index347.js +1 -1
- package/dist/index352.js +26 -19
- package/dist/index352.js.map +1 -1
- package/dist/index357.js +19 -26
- package/dist/index357.js.map +1 -1
- package/dist/index44.js +1 -1
- package/dist/index47.js +1 -1
- package/dist/index49.js +2 -2
- package/dist/index50.js +2 -2
- package/dist/index51.js +2 -2
- package/dist/index52.js +2 -2
- package/dist/index53.js +3 -3
- package/dist/index54.js +2 -2
- package/dist/index55.js +2 -2
- package/dist/index56.js +3 -3
- package/dist/index57.js +2 -2
- package/dist/index58.js +2 -2
- package/dist/index59.js +2 -2
- package/dist/index60.js +2 -2
- package/dist/index61.js +2 -2
- package/dist/index62.js +2 -2
- package/dist/index63.js +2 -2
- package/dist/index64.js +2 -2
- package/dist/index65.js +2 -2
- package/dist/index66.js +1 -1
- package/dist/index67.js +1 -1
- package/dist/index68.js +2 -2
- package/dist/index69.js +2 -2
- package/dist/index70.js +2 -2
- package/dist/index71.js +2 -2
- package/dist/index72.js +2 -2
- package/dist/index73.js +2 -2
- package/dist/index74.js +2 -2
- package/dist/index75.js +2 -2
- package/dist/index76.js +2 -2
- package/dist/index77.js +2 -2
- package/dist/index78.js +2 -2
- package/dist/index79.js +2 -2
- package/dist/index80.js +2 -2
- package/dist/index81.js +2 -2
- package/dist/index82.js +1 -1
- package/dist/index83.js +2 -2
- package/dist/index84.js +2 -2
- package/package.json +1 -1
package/dist/index238.js
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
const chevronSvg = html`
|
|
3
|
+
<svg viewBox="0 0 256 256" fill="currentColor" aria-hidden="true">
|
|
4
|
+
<path d="M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80a8,8,0,0,1,11.32-11.32L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"/>
|
|
5
|
+
</svg>`;
|
|
6
|
+
function dropdownTemplate(ctx) {
|
|
7
|
+
return html`
|
|
8
|
+
<div class="dd" part="root">
|
|
9
|
+
|
|
10
|
+
<!-- ── Trigger ── -->
|
|
11
|
+
<button
|
|
12
|
+
class="dd-trigger"
|
|
13
|
+
part="trigger"
|
|
14
|
+
aria-haspopup="true"
|
|
15
|
+
aria-expanded="${ctx.open}"
|
|
16
|
+
aria-label="${ctx.ariaLabel || ctx.label}"
|
|
17
|
+
@click="${() => ctx._toggle()}"
|
|
18
|
+
@keydown="${(e) => ctx._handleTriggerKey(e)}"
|
|
19
|
+
>
|
|
20
|
+
<slot name="trigger">${ctx.label}</slot>
|
|
21
|
+
<span class="dd-chevron" part="chevron">${chevronSvg}</span>
|
|
22
|
+
</button>
|
|
23
|
+
|
|
24
|
+
<!-- ── Panel ── -->
|
|
25
|
+
<div
|
|
26
|
+
class="dd-menu"
|
|
27
|
+
part="menu"
|
|
28
|
+
role="menu"
|
|
29
|
+
style="${ctx.minWidth ? `--dd-min-width:${ctx.minWidth}` : ""}"
|
|
30
|
+
@keydown="${(e) => ctx._handleMenuKey(e)}"
|
|
31
|
+
>
|
|
32
|
+
<!-- Header opcional (búsqueda, título) -->
|
|
33
|
+
<div class="dd-header-wrap" part="header-wrap"
|
|
34
|
+
style="${ctx._hasSlot("header") ? "" : "display:none"}">
|
|
35
|
+
<slot name="header"></slot>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<!-- Contenido: items, separadores, grupos -->
|
|
39
|
+
<slot></slot>
|
|
40
|
+
|
|
41
|
+
<!-- Footer opcional (acciones, confirmación) -->
|
|
42
|
+
<div class="dd-footer-wrap" part="footer-wrap"
|
|
43
|
+
style="${ctx._hasSlot("footer") ? "" : "display:none"}">
|
|
44
|
+
<slot name="footer"></slot>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
</div>
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
2
51
|
export {
|
|
3
|
-
|
|
52
|
+
dropdownTemplate
|
|
4
53
|
};
|
|
5
54
|
//# sourceMappingURL=index238.js.map
|
package/dist/index238.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index238.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"index238.js","sources":["../src/components/molecules/dropdown/lib-dropdown.html.ts"],"sourcesContent":["import { html, TemplateResult } from 'lit';\nimport type { LibDropdown } from './lib-dropdown.component';\n\n/* Chevron SVG inline — no depende de Phosphor ni ninguna lib */\nconst chevronSvg: TemplateResult = html`\n <svg viewBox=\"0 0 256 256\" fill=\"currentColor\" aria-hidden=\"true\">\n <path d=\"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80a8,8,0,0,1,11.32-11.32L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z\"/>\n </svg>`;\n\nexport function dropdownTemplate(ctx: LibDropdown): TemplateResult {\n return html`\n <div class=\"dd\" part=\"root\">\n\n <!-- ── Trigger ── -->\n <button\n class=\"dd-trigger\"\n part=\"trigger\"\n aria-haspopup=\"true\"\n aria-expanded=\"${ctx.open}\"\n aria-label=\"${ctx.ariaLabel || ctx.label}\"\n @click=\"${(): void => ctx._toggle()}\"\n @keydown=\"${(e: KeyboardEvent): void => ctx._handleTriggerKey(e)}\"\n >\n <slot name=\"trigger\">${ctx.label}</slot>\n <span class=\"dd-chevron\" part=\"chevron\">${chevronSvg}</span>\n </button>\n\n <!-- ── Panel ── -->\n <div\n class=\"dd-menu\"\n part=\"menu\"\n role=\"menu\"\n style=\"${ctx.minWidth ? `--dd-min-width:${ctx.minWidth}` : ''}\"\n @keydown=\"${(e: KeyboardEvent): void => ctx._handleMenuKey(e)}\"\n >\n <!-- Header opcional (búsqueda, título) -->\n <div class=\"dd-header-wrap\" part=\"header-wrap\"\n style=\"${ctx._hasSlot('header') ? '' : 'display:none'}\">\n <slot name=\"header\"></slot>\n </div>\n\n <!-- Contenido: items, separadores, grupos -->\n <slot></slot>\n\n <!-- Footer opcional (acciones, confirmación) -->\n <div class=\"dd-footer-wrap\" part=\"footer-wrap\"\n style=\"${ctx._hasSlot('footer') ? '' : 'display:none'}\">\n <slot name=\"footer\"></slot>\n </div>\n </div>\n\n </div>\n `;\n}"],"names":[],"mappings":";AAIA,MAAM,aAA6B;AAAA;AAAA;AAAA;AAK5B,SAAS,iBAAiB,KAAkC;AACjE,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAQgB,IAAI,IAAI;AAAA,sBACX,IAAI,aAAa,IAAI,KAAK;AAAA,kBAC9B,MAAY,IAAI,SAAS;AAAA,oBACvB,CAAC,MAA2B,IAAI,kBAAkB,CAAC,CAAC;AAAA;AAAA,+BAEzC,IAAI,KAAK;AAAA,kDACU,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAQ3C,IAAI,WAAW,kBAAkB,IAAI,QAAQ,KAAK,EAAE;AAAA,oBACjD,CAAC,MAA2B,IAAI,eAAe,CAAC,CAAC;AAAA;AAAA;AAAA;AAAA,mBAIlD,IAAI,SAAS,QAAQ,IAAI,KAAK,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAS5C,IAAI,SAAS,QAAQ,IAAI,KAAK,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAO/D;"}
|
package/dist/index239.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
1
|
+
const dropdownCss = '@layer tokens,reset,components;@layer reset{:host{display:inline-block;position:relative}*,*:before,*:after{box-sizing:border-box}button{font:inherit;background:none;border:none;padding:0;margin:0;cursor:pointer}}@layer components{.dd{position:relative;display:inline-block;-webkit-user-select:none;user-select:none}.dd-trigger{display:inline-flex;align-items:center;gap:var(--lib-space-sm);font-family:var(--lib-font-mono);font-size:var(--text-xs);letter-spacing:var(--tracking-wider);text-transform:uppercase;cursor:pointer;background:var(--bg-elevated);color:var(--text-primary);border:1px solid var(--border-default);padding:calc(var(--lib-space-sm) + var(--lib-space-xs)) var(--lib-space-md);white-space:nowrap;transition:background var(--duration-base) var(--ease-out),border-color var(--duration-base) var(--ease-out),color var(--duration-base) var(--ease-out)}.dd-trigger:hover{background:var(--bg-surface);border-color:var(--border-strong)}:host([open]) .dd-trigger{background:var(--bg-surface);border-color:var(--color-washi-700)}.dd-trigger:focus-visible{outline:2px solid var(--color-kaki-400);outline-offset:2px}.dd-chevron{display:flex;align-items:center;flex-shrink:0;color:var(--text-muted);transition:transform var(--duration-slow) var(--ease-out);line-height:1}.dd-chevron svg{width:12px;height:12px}:host([open]) .dd-chevron{transform:rotate(180deg)}:host([variant="ghost"]) .dd-trigger{background:transparent;border-color:transparent;color:var(--text-secondary)}:host([variant="ghost"]) .dd-trigger:hover{background:var(--bg-surface);border-color:transparent}:host([variant="ghost"][open]) .dd-trigger{background:var(--bg-surface);border-color:transparent}:host([variant="filled"]) .dd-trigger{background:var(--color-washi-900);border-color:var(--color-washi-900);color:var(--color-washi-50)}:host([variant="filled"]) .dd-trigger:hover{background:var(--color-washi-800);border-color:var(--color-washi-800)}:host([variant="filled"]) .dd-chevron{color:var(--color-washi-400)}:host([variant="kaki"]) .dd-trigger{background:var(--color-kaki-500);border-color:var(--color-kaki-500);color:#fff}:host([variant="kaki"]) .dd-trigger:hover{background:var(--color-kaki-600);border-color:var(--color-kaki-600)}:host([variant="kaki"]) .dd-chevron{color:#fff9}.dd-menu{position:absolute;top:calc(100% + 4px);left:0;z-index:300;min-width:var(--dd-min-width, 200px);background:var(--bg-elevated);border:1px solid var(--border-default);box-shadow:var(--shadow-lg);opacity:0;transform:translateY(-6px) scaleY(.97);transform-origin:top center;pointer-events:none;transition:opacity .16s var(--ease-out),transform .2s var(--ease-out)}:host([open]) .dd-menu{opacity:1;transform:translateY(0) scaleY(1);pointer-events:auto}:host([align="right"]) .dd-menu{left:auto;right:0}::slotted(.dd-item){display:flex!important;align-items:center;gap:.75rem;width:100%;padding:.75rem var(--lib-space-md);font-family:var(--lib-font-body);font-size:var(--text-sm);color:var(--text-secondary);background:transparent;border:none;cursor:pointer;text-align:left;text-decoration:none;white-space:nowrap;transition:background var(--duration-fast) var(--ease-out),color var(--duration-fast) var(--ease-out)}::slotted(.dd-item:hover){background:var(--bg-surface);color:var(--text-primary)}::slotted(.dd-item.is-active){color:var(--text-primary);background:var(--color-washi-100)}::slotted(.dd-item.is-disabled){opacity:.38;cursor:not-allowed;pointer-events:none}::slotted(.dd-item.is-danger){color:var(--color-error)}::slotted(.dd-item.is-danger:hover){background:var(--color-error-light);color:var(--color-error)}::slotted(.dd-sep){display:block!important;height:1px;background:var(--border-subtle);margin:var(--lib-space-xs) 0;border:none}::slotted(.dd-group-label){display:block!important;font-family:var(--lib-font-mono);font-size:9px;letter-spacing:var(--tracking-widest);text-transform:uppercase;color:var(--text-muted);padding:.75rem var(--lib-space-md) var(--lib-space-xs)}.dd-header-wrap{border-bottom:1px solid var(--border-subtle)}.dd-footer-wrap{border-top:1px solid var(--border-subtle);display:flex;align-items:center;justify-content:flex-end;gap:var(--lib-space-sm);padding:var(--lib-space-sm) var(--lib-space-md)}.dd-scroll-wrap{max-height:220px;overflow-y:auto;overscroll-behavior:contain}.dd-scroll-wrap::-webkit-scrollbar{width:4px}.dd-scroll-wrap::-webkit-scrollbar-track{background:transparent}.dd-scroll-wrap::-webkit-scrollbar-thumb{background:var(--color-washi-300);border-radius:2px}:host([dark]) .dd-menu{background:var(--color-washi-900);border-color:var(--color-washi-800)}:host([dark]) .dd-header-wrap{border-color:var(--color-washi-800)}:host([dark]) .dd-footer-wrap{border-color:var(--color-washi-800)}:host([dark]) ::slotted(.dd-item){color:var(--color-washi-400)}:host([dark]) ::slotted(.dd-item:hover){background:var(--color-washi-800);color:var(--color-washi-100)}:host([dark]) ::slotted(.dd-item.is-active){background:var(--color-washi-800);color:var(--color-washi-100)}:host([dark]) ::slotted(.dd-item.is-danger){color:#e87a6a}:host([dark]) ::slotted(.dd-item.is-danger:hover){background:#8c2a1a4d;color:#e87a6a}:host([dark]) ::slotted(.dd-sep){background:var(--color-washi-800)}:host([dark]) ::slotted(.dd-group-label){color:var(--color-washi-600)}}';
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
dropdownCss as default
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=index239.js.map
|
package/dist/index240.js
CHANGED
|
@@ -1,42 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
ringBg: "rgba(250,247,244,0.03)",
|
|
34
|
-
ringSize: "28px",
|
|
35
|
-
ringMix: "normal",
|
|
36
|
-
lerpFactor: 0.1
|
|
37
|
-
}
|
|
38
|
-
};
|
|
1
|
+
import { html, nothing } from "lit";
|
|
2
|
+
function emptyStateTemplate(props) {
|
|
3
|
+
const illustrationZone = props.kanji ? html`
|
|
4
|
+
<div class="es-illustration">
|
|
5
|
+
<span class="es-kanji">${props.kanji}</span>
|
|
6
|
+
</div>
|
|
7
|
+
` : html`
|
|
8
|
+
<div class="es-illustration">
|
|
9
|
+
<div class="es-icon-wrap">
|
|
10
|
+
<slot name="illustration"></slot>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
`;
|
|
14
|
+
return html`
|
|
15
|
+
<div class="es
|
|
16
|
+
${props.layout === "inline" ? "es-inline" : ""}
|
|
17
|
+
${props.size === "sm" ? "es-sm" : ""}
|
|
18
|
+
${props.tone !== "neutral" ? `es-${props.tone}` : ""}
|
|
19
|
+
${props.bordered ? "es-bordered" : ""}
|
|
20
|
+
${props.ghost ? "es-ghost" : ""}
|
|
21
|
+
">
|
|
22
|
+
${illustrationZone}
|
|
23
|
+
<div class="es-body">
|
|
24
|
+
${props.heading ? html`<h3 class="es-title">${props.heading}</h3>` : nothing}
|
|
25
|
+
${props.description ? html`<p class="es-desc">${props.description}</p>` : nothing}
|
|
26
|
+
<div class="es-actions">
|
|
27
|
+
<slot name="actions"></slot>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
39
33
|
export {
|
|
40
|
-
|
|
34
|
+
emptyStateTemplate
|
|
41
35
|
};
|
|
42
36
|
//# sourceMappingURL=index240.js.map
|
package/dist/index240.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index240.js","sources":["../src/components/
|
|
1
|
+
{"version":3,"file":"index240.js","sources":["../src/components/molecules/empty-state/lib-empty-state.html.ts"],"sourcesContent":["import { html, nothing, TemplateResult } from 'lit';\n\nexport type LibEmptyStateTone = 'neutral' | 'kaki' | 'celadon' | 'error';\nexport type LibEmptyStateLayout = 'default' | 'inline';\nexport type LibEmptyStateSize = 'sm' | 'md';\n\nexport interface EmptyStateTemplateProps {\n heading: string;\n description: string;\n kanji: string;\n tone: LibEmptyStateTone;\n layout: LibEmptyStateLayout;\n size: LibEmptyStateSize;\n bordered: boolean;\n ghost: boolean;\n}\n\n/**\n * Template para lib-empty-state.\n *\n * Estructura (ambos layouts):\n * div.es\n * div.es-illustration ← kanji | icon-wrap[slot=illustration]\n * div.es-body\n * h3.es-title\n * p.es-desc\n * div.es-actions\n * slot[name=actions]\n *\n * La zona de ilustración se omite si no hay kanji ni slot.\n * El CSS diferencia .es-inline (row) de .es (column).\n */\nexport function emptyStateTemplate(props: EmptyStateTemplateProps): TemplateResult {\n const illustrationZone = props.kanji\n ? html`\n <div class=\"es-illustration\">\n <span class=\"es-kanji\">${props.kanji}</span>\n </div>\n `\n : html`\n <div class=\"es-illustration\">\n <div class=\"es-icon-wrap\">\n <slot name=\"illustration\"></slot>\n </div>\n </div>\n `;\n\n return html`\n <div class=\"es\n ${props.layout === 'inline' ? 'es-inline' : ''}\n ${props.size === 'sm' ? 'es-sm' : ''}\n ${props.tone !== 'neutral' ? `es-${props.tone}` : ''}\n ${props.bordered ? 'es-bordered' : ''}\n ${props.ghost ? 'es-ghost' : ''}\n \">\n ${illustrationZone}\n <div class=\"es-body\">\n ${props.heading\n ? html`<h3 class=\"es-title\">${props.heading}</h3>`\n : nothing}\n ${props.description\n ? html`<p class=\"es-desc\">${props.description}</p>`\n : nothing}\n <div class=\"es-actions\">\n <slot name=\"actions\"></slot>\n </div>\n </div>\n </div>\n `;\n}"],"names":[],"mappings":";AAgCO,SAAS,mBAAmB,OAAgD;AACjF,QAAM,mBAAmB,MAAM,QAC3B;AAAA;AAAA,mCAE6B,MAAM,KAAK;AAAA;AAAA,UAGxC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQJ,SAAO;AAAA;AAAA,QAED,MAAM,WAAY,WAAY,cAAe,EAAE;AAAA,QAC/C,MAAM,SAAY,OAAY,UAAe,EAAE;AAAA,QAC/C,MAAM,SAAY,YAAY,MAAM,MAAM,IAAI,KAAK,EAAE;AAAA,QACrD,MAAM,WAAwB,gBAAgB,EAAE;AAAA,QAChD,MAAM,QAAwB,aAAe,EAAE;AAAA;AAAA,QAE/C,gBAAgB;AAAA;AAAA,UAEd,MAAM,UACJ,4BAA4B,MAAM,OAAO,UACzC,OAAO;AAAA,UACT,MAAM,cACJ,0BAA0B,MAAM,WAAW,SAC3C,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOnB;"}
|
package/dist/index241.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const tableCss = '@layer tokens,reset,components;@layer reset{:host{display:block;width:100%}*,*:before,*:after{box-sizing:border-box}}@layer components{.tbl-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;border:1px solid var(--border-subtle)}.tbl-wrap table{border:none}.tbl-wrap.tbl-sticky-head{max-height:380px;overflow-y:auto}.tbl-sticky-head thead th{position:sticky;top:0;z-index:3}table{width:100%;border-collapse:collapse;font-family:var(--lib-font-body);font-size:var(--text-sm);color:var(--text-secondary);background:var(--bg-elevated)}caption{font-family:var(--lib-font-mono);font-size:var(--text-xs);letter-spacing:var(--tracking-widest);text-transform:uppercase;color:var(--text-muted);text-align:left;padding:var(--lib-space-sm) var(--lib-space-md);background:var(--bg-surface);border-bottom:1px solid var(--border-subtle);caption-side:top}thead th{font-family:var(--lib-font-mono);font-size:10px;letter-spacing:var(--tracking-widest);text-transform:uppercase;color:var(--text-muted);font-weight:400;padding:var(--lib-space-sm) var(--lib-space-md);text-align:left;background:var(--bg-surface);border-bottom:1px solid var(--border-default);white-space:nowrap;-webkit-user-select:none;user-select:none;position:relative}thead th.is-sortable{cursor:pointer;padding-right:var(--lib-space-lg);transition:color var(--duration-fast),background var(--duration-fast)}thead th.is-sortable:hover{color:var(--text-primary);background:var(--color-washi-200)}thead th.is-sortable:after{content:"";position:absolute;right:var(--lib-space-sm);top:50%;transform:translateY(-50%);width:0;height:0;opacity:.3;border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid currentcolor;transition:opacity var(--duration-fast),transform var(--duration-base)}thead th.is-sortable:hover:after{opacity:.6}thead th.sort-asc:after{opacity:1;transform:translateY(-50%) rotate(180deg)}thead th.sort-desc:after{opacity:1;transform:translateY(-50%) rotate(0)}thead th.sort-asc,thead th.sort-desc{color:var(--text-primary);background:var(--color-washi-200)}thead th.is-num{text-align:right}tbody tr{transition:background var(--duration-fast);border-bottom:1px solid var(--border-subtle)}tbody tr:last-child{border-bottom:none}tbody td{padding:var(--lib-space-md) var(--lib-space-md);color:var(--text-secondary);font-size:var(--text-sm);vertical-align:middle;line-height:var(--leading-snug)}tfoot td{padding:var(--lib-space-sm) var(--lib-space-md);font-family:var(--lib-font-mono);font-size:10px;letter-spacing:var(--tracking-wide);color:var(--text-muted);background:var(--bg-surface);border-top:1px solid var(--border-default)}:host([size="sm"]) thead th{padding:var(--lib-space-xs) var(--lib-space-sm);font-size:9px}:host([size="sm"]) tbody td{padding:var(--lib-space-xs) var(--lib-space-sm);font-size:var(--text-xs)}:host([size="sm"]) tfoot td{padding:var(--lib-space-xs) var(--lib-space-sm)}:host([size="lg"]) thead th{padding:var(--lib-space-md) var(--lib-space-lg);font-size:11px}:host([size="lg"]) tbody td{padding:calc(var(--lib-space-md) + var(--lib-space-xs)) var(--lib-space-lg);font-size:var(--text-base)}:host([size="lg"]) tfoot td{padding:var(--lib-space-md) var(--lib-space-lg)}:host([variant="lines"]) tbody tr:hover,:host(:not([variant])) tbody tr:hover{background:var(--color-washi-50)}:host([variant="grid"]) thead th,:host([variant="grid"]) tbody td{border-right:1px solid var(--border-subtle)}:host([variant="grid"]) thead th:last-child,:host([variant="grid"]) tbody td:last-child{border-right:none}:host([variant="grid"]) tbody tr:hover{background:var(--color-washi-50)}:host([variant="striped"]) tbody tr:nth-child(2n){background:var(--bg-surface)}:host([variant="striped"]) tbody tr:hover{background:var(--color-washi-50)}:host([variant="striped"]) tbody tr:nth-child(2n):hover{background:var(--color-washi-200)}:host([variant="borderless"]) thead th{border-bottom:1px solid var(--border-default)}:host([variant="borderless"]) tbody tr{border-bottom:none}:host([variant="borderless"]) tbody td{border:none}:host([variant="borderless"]) tbody tr:hover{background:var(--bg-surface)}tbody tr.is-selected,tbody tr.is-selected:hover{background:var(--color-kaki-50);border-bottom-color:var(--color-kaki-100)}tbody tr.is-selected td{color:var(--text-primary)}tbody tr.is-error,tbody tr.is-error:hover{background:#f5ddd9;border-bottom-color:#ebc9c4}tbody tr.is-error td{color:var(--color-error)}tbody tr.is-warning,tbody tr.is-warning:hover{background:#fef9ec;border-bottom-color:#f5e6a8}tbody tr.is-warning td{color:#7a5c0a}tbody tr.is-success,tbody tr.is-success:hover{background:var(--color-celadon-50);border-bottom-color:var(--color-celadon-100)}tbody tr.is-success td{color:var(--color-celadon-600)}tbody tr.is-disabled,tbody tr.is-disabled:hover{background:transparent;opacity:.38;cursor:not-allowed}.col-sticky{position:sticky;left:0;z-index:1;background:inherit}thead .col-sticky{background:var(--bg-surface);z-index:2}.col-sticky:after{content:"";position:absolute;top:0;right:-1px;bottom:0;width:1px;background:var(--border-subtle);box-shadow:2px 0 6px #1a140e0d}.cell-num{text-align:right;font-family:var(--lib-font-mono);font-size:var(--text-xs);letter-spacing:var(--tracking-wide);color:var(--text-primary)}thead th.cell-num{color:var(--text-muted)}.cell-mono{font-family:var(--lib-font-mono);font-size:var(--text-xs);letter-spacing:var(--tracking-wide);color:var(--text-muted)}.cell-truncate{max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cell-check{width:40px;padding:var(--lib-space-md) var(--lib-space-sm) var(--lib-space-md) var(--lib-space-md)!important}.cell-check input[type=checkbox]{width:14px;height:14px;accent-color:var(--color-washi-900);cursor:pointer;display:block}.cell-avatar{display:flex;align-items:center;gap:var(--lib-space-sm)}.avatar-circle{width:28px;height:28px;border-radius:var(--radius-full);display:flex;align-items:center;justify-content:center;font-family:var(--lib-font-mono);font-size:9px;flex-shrink:0;background:var(--color-washi-200);color:var(--text-secondary)}.avatar-text{display:flex;flex-direction:column;gap:1px}.avatar-name{font-size:var(--text-sm);color:var(--text-secondary);line-height:var(--leading-tight)}.avatar-hint{font-family:var(--lib-font-mono);font-size:10px;color:var(--text-muted);letter-spacing:var(--tracking-wide)}.cell-badge{display:inline-flex;align-items:center;gap:var(--lib-space-xs);font-family:var(--lib-font-mono);font-size:9px;letter-spacing:var(--tracking-wider);text-transform:uppercase;padding:2px var(--lib-space-sm);white-space:nowrap}.cell-badge:before{content:"";width:5px;height:5px;border-radius:var(--radius-full);background:currentcolor;flex-shrink:0;opacity:.7}.cell-badge.tone-estable{color:var(--color-celadon-600);background:var(--color-celadon-50)}.cell-badge.tone-beta{color:var(--color-kaki-500);background:var(--color-kaki-50)}.cell-badge.tone-error{color:var(--color-error);background:#f5ddd9}.cell-badge.tone-warning{color:#7a5c0a;background:#fef9ec}.cell-badge.tone-inactive{color:var(--text-muted);background:var(--bg-surface)}.cell-badge.tone-info{color:#1a4a6e;background:#d6e8f5}.cell-progress{display:flex;align-items:center;gap:var(--lib-space-sm)}.progress-bar{flex:1;height:3px;background:var(--color-washi-200);position:relative;min-width:60px}.progress-fill{position:absolute;left:0;top:0;bottom:0;background:var(--color-washi-700);transition:width var(--duration-slow) var(--ease-out)}.progress-fill.tone-kaki{background:var(--color-kaki-500)}.progress-fill.tone-celadon{background:var(--color-celadon-500)}.progress-val{font-family:var(--lib-font-mono);font-size:10px;color:var(--text-muted);letter-spacing:var(--tracking-wide);flex-shrink:0;width:28px;text-align:right}.cell-actions{width:44px;text-align:right!important;padding-right:var(--lib-space-md)!important}.actions-btn{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;font-size:18px;line-height:1;color:var(--text-muted);background:transparent;border:none;cursor:pointer;border-radius:var(--radius-full);transition:background var(--duration-fast),color var(--duration-fast);opacity:0}tbody tr:hover .actions-btn{opacity:1}.actions-btn:hover{background:var(--bg-surface);color:var(--text-primary)}@keyframes dt-shimmer{0%{background-position:-600px 0}to{background-position:600px 0}}.skel-line{height:10px;background:linear-gradient(90deg,var(--color-washi-200) 25%,var(--color-washi-100) 50%,var(--color-washi-200) 75%);background-size:600px 100%;animation:dt-shimmer 1.4s infinite linear;border-radius:2px}.skel-line.w-80{width:80%}.skel-line.w-60{width:60%}.skel-line.w-40{width:40%}.skel-line.w-30{width:30%}.skel-avatar{width:28px;height:28px;border-radius:var(--radius-full);background:linear-gradient(90deg,var(--color-washi-200) 25%,var(--color-washi-100) 50%,var(--color-washi-200) 75%);background-size:600px 100%;animation:dt-shimmer 1.4s infinite linear;flex-shrink:0}.skel-cell{display:flex;align-items:center;gap:var(--lib-space-sm)}.skel-badge{height:16px;width:48px;border-radius:2px;background:linear-gradient(90deg,var(--color-washi-200) 25%,var(--color-washi-100) 50%,var(--color-washi-200) 75%);background-size:600px 100%;animation:dt-shimmer 1.4s infinite linear}.empty-row td{text-align:center;padding:var(--lib-space-xl) var(--lib-space-lg)!important;border-bottom:none!important}.empty-icon{font-size:32px;color:var(--color-washi-300);display:block;margin:0 auto var(--lib-space-md)}.empty-title{font-family:var(--lib-font-display);font-size:var(--text-xl);font-weight:var(--weight-light);color:var(--text-muted);letter-spacing:var(--tracking-tight);display:block;margin-bottom:var(--lib-space-xs)}.empty-desc{font-family:var(--lib-font-mono);font-size:10px;letter-spacing:var(--tracking-wide);color:var(--color-washi-300);text-transform:uppercase;display:block}.tbl-toolbar{display:flex;align-items:center;gap:var(--lib-space-sm);padding:var(--lib-space-sm) var(--lib-space-md);background:var(--bg-surface);border:1px solid var(--border-subtle);border-bottom:none}.tbl-toolbar-title{font-family:var(--lib-font-mono);font-size:var(--text-xs);letter-spacing:var(--tracking-wider);text-transform:uppercase;color:var(--text-secondary)}.tbl-toolbar-count{font-family:var(--lib-font-mono);font-size:10px;color:var(--text-muted);letter-spacing:var(--tracking-wide);margin-right:auto}.tbl-toolbar-search{font-family:var(--lib-font-mono);font-size:var(--text-xs);color:var(--text-primary);background:var(--bg-elevated);border:1px solid var(--border-default);padding:var(--lib-space-xs) var(--lib-space-sm);outline:none;width:180px;transition:border-color var(--duration-base),box-shadow var(--duration-base)}.tbl-toolbar-search::placeholder{color:var(--text-muted)}.tbl-toolbar-search:focus{border-color:var(--color-washi-700);box-shadow:0 0 0 3px #1a140e14}.tbl-pagination{display:flex;align-items:center;gap:var(--lib-space-xs);padding:var(--lib-space-sm) var(--lib-space-md);border:1px solid var(--border-subtle);border-top:none;background:var(--bg-surface)}.pag-info{font-family:var(--lib-font-mono);font-size:10px;letter-spacing:var(--tracking-wide);color:var(--text-muted);margin-right:auto}.pag-btn{width:28px;height:28px;display:flex;align-items:center;justify-content:center;font-family:var(--lib-font-mono);font-size:10px;letter-spacing:var(--tracking-wide);color:var(--text-muted);background:transparent;border:1px solid transparent;cursor:pointer;transition:background var(--duration-fast),color var(--duration-fast),border-color var(--duration-fast)}.pag-btn:hover{background:var(--bg-elevated);border-color:var(--border-default);color:var(--text-primary)}.pag-btn.is-active{background:var(--color-washi-900);color:var(--color-washi-50);border-color:var(--color-washi-900)}.pag-btn:disabled{opacity:.35;cursor:not-allowed;pointer-events:none}.pag-sep{font-family:var(--lib-font-mono);font-size:10px;color:var(--text-muted);padding:0 2px}:host([dark]) table{background:#0a0403;color:#7b6f67}:host([dark]) thead th{background:#060201;color:#312620;border-bottom-color:#190f0a}:host([dark]) thead th.is-sortable:hover{background:#150a06;color:#998c84}:host([dark]) thead th.sort-asc,:host([dark]) thead th.sort-desc{background:#150a06;color:#a99b93}:host([dark]) tbody tr{border-bottom-color:#150a06}:host([dark]) tbody td{color:#7b6f67}:host([dark]) tbody td.cell-num{color:#afa299}:host([dark]) tbody tr:hover{background:#150a06}:host([dark]) .tbl-wrap{border-color:#150a06}:host([dark]) tfoot td{background:#060201;border-top-color:#190f0a;color:#362b25}:host([dark]) caption{background:#060201;color:#312620;border-color:#150a06}:host([dark]) .tbl-toolbar{background:#060201;border-color:#150a06}:host([dark]) .tbl-toolbar-title{color:#51453e}:host([dark]) .tbl-toolbar-count{color:#2a1f19}:host([dark]) .tbl-toolbar-search{background:#060201;border-color:#231813;color:#998c84}:host([dark]) .tbl-toolbar-search::placeholder{color:#312620}:host([dark]) .tbl-pagination{background:#060201;border-color:#150a06}:host([dark]) .pag-btn:hover{background:#150a06;border-color:#231813;color:#998c84}:host([dark]) .avatar-circle{background:#1e130e;color:#5f524c}:host([dark]) .avatar-name{color:#8a7d75}:host([dark]) .avatar-hint{color:#362b25}:host([dark]) .progress-bar{background:#1e130e}:host([dark]) .col-sticky{background:#0a0403}:host([dark]) thead .col-sticky{background:#060201}:host([dark]) .cell-mono{color:#362b25}:host([dark]) .actions-btn:hover{background:#1e130e;color:#998c84}:host([dark]) tbody tr.is-selected,:host([dark]) tbody tr.is-selected:hover{background:#190f0a}:host([dark]) .skel-line,:host([dark]) .skel-avatar,:host([dark]) .skel-badge{background:linear-gradient(90deg,#17100c 25%,#211815,#17100c 75%);background-size:600px 100%}}';
|
|
1
|
+
const emptyStateCss = '@layer tokens,reset,components;@layer reset{:host{display:flex;width:100%;justify-content:center;align-items:center}*,*:before,*:after{box-sizing:border-box}}@layer components{.es{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:var(--lib-space-xl) var(--lib-space-lg);gap:0;width:100%}.es-illustration{margin-bottom:var(--lib-space-lg);display:flex;align-items:center;justify-content:center;position:relative}.es-icon-wrap{width:72px;height:72px;border-radius:var(--radius-full);background:var(--color-washi-100);border:1px solid var(--border-subtle);display:flex;align-items:center;justify-content:center;color:var(--color-washi-400);font-size:28px;flex-shrink:0}.es-kanji{font-family:var(--lib-font-display);font-size:6rem;line-height:1;color:var(--color-washi-200);-webkit-user-select:none;user-select:none;letter-spacing:var(--tracking-tight)}.es-body{display:flex;flex-direction:column;align-items:center;gap:0}.es-title{font-family:var(--lib-font-display);font-size:var(--text-2xl);font-weight:var(--weight-light);letter-spacing:var(--tracking-tight);color:var(--text-primary);margin-bottom:var(--lib-space-sm);line-height:var(--leading-snug)}.es-title em{font-style:italic;color:var(--text-muted)}.es-desc{font-family:var(--lib-font-body);font-size:var(--text-sm);color:var(--text-muted);line-height:var(--leading-relaxed);max-width:320px;margin:0 auto var(--lib-space-lg)}.es-actions{display:flex;align-items:center;justify-content:center;gap:var(--lib-space-sm);flex-wrap:wrap}::slotted([slot="actions"]){flex-shrink:0}:host([size="sm"]) .es{padding:var(--lib-space-lg) var(--lib-space-md)}:host([size="sm"]) .es-icon-wrap{width:48px;height:48px;font-size:20px}:host([size="sm"]) .es-illustration{margin-bottom:var(--lib-space-md)}:host([size="sm"]) .es-title{font-size:var(--text-xl);margin-bottom:var(--lib-space-xs)}:host([size="sm"]) .es-desc{font-size:var(--text-xs);margin-bottom:var(--lib-space-md)}:host([layout="inline"]) .es{flex-direction:row;text-align:left;padding:var(--lib-space-md) var(--lib-space-lg);gap:var(--lib-space-lg);align-items:center;justify-content:flex-start}:host([layout="inline"]) .es-illustration{margin-bottom:0;flex-shrink:0}:host([layout="inline"]) .es-body{align-items:flex-start;gap:var(--lib-space-xs)}:host([layout="inline"]) .es-title{font-size:var(--text-xl);margin-bottom:0}:host([layout="inline"]) .es-desc{margin:0;max-width:400px}:host([layout="inline"]) .es-actions{justify-content:flex-start;margin-top:var(--lib-space-sm)}:host([bordered]) .es{border:1px dashed var(--border-default);background:var(--bg-surface)}:host([ghost]) .es-icon-wrap{background:transparent;border:none;color:var(--color-washi-300);font-size:40px}:host([tone="kaki"]) .es-icon-wrap{background:var(--color-kaki-50);color:var(--color-kaki-500);border-color:var(--color-kaki-100)}:host([tone="celadon"]) .es-icon-wrap{background:var(--color-celadon-100);color:var(--color-celadon-500);border-color:var(--color-celadon-100)}:host([tone="error"]) .es-icon-wrap{background:#f5ddd9;color:var(--color-error);border-color:#f5ddd9}@media(max-width:640px){:host([layout="inline"]) .es{flex-direction:column;text-align:center}:host([layout="inline"]) .es-body{align-items:center}:host([layout="inline"]) .es-actions{justify-content:center}}}';
|
|
2
2
|
export {
|
|
3
|
-
|
|
3
|
+
emptyStateCss as default
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=index241.js.map
|
package/dist/index242.js
CHANGED
|
@@ -1,240 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
return
|
|
5
|
-
}
|
|
6
|
-
function renderProgress(value, tone) {
|
|
7
|
-
const pct = Math.min(100, Math.max(0, Number(value) || 0));
|
|
8
|
-
const toneClass = tone ? `tone-${tone}` : "";
|
|
9
|
-
return html`
|
|
10
|
-
<div class="cell-progress">
|
|
11
|
-
<div class="progress-bar">
|
|
12
|
-
<div class="progress-fill ${toneClass}" style="width:${pct}%"></div>
|
|
13
|
-
</div>
|
|
14
|
-
<span class="progress-val">${pct}%</span>
|
|
15
|
-
</div>
|
|
16
|
-
`;
|
|
17
|
-
}
|
|
18
|
-
function renderAvatar(row, col) {
|
|
19
|
-
const name = String(row[col.key] ?? "");
|
|
20
|
-
const initials = col.initialsKey ? String(row[col.initialsKey] ?? "").slice(0, 2).toUpperCase() : name.split(" ").map((w) => w[0]).join("").slice(0, 2).toUpperCase();
|
|
21
|
-
const hint = col.hintKey ? String(row[col.hintKey] ?? "") : "";
|
|
22
|
-
return html`
|
|
23
|
-
<div class="cell-avatar">
|
|
24
|
-
<div class="avatar-circle">${initials}</div>
|
|
25
|
-
<div class="avatar-text">
|
|
26
|
-
<span class="avatar-name">${name}</span>
|
|
27
|
-
${hint ? html`<span class="avatar-hint">${hint}</span>` : nothing}
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
`;
|
|
31
|
-
}
|
|
32
|
-
function renderActionsBtn(row, idx, onRowAction) {
|
|
33
|
-
return html`
|
|
34
|
-
<button class="actions-btn"
|
|
35
|
-
aria-label="Acciones"
|
|
36
|
-
@click="${(e) => {
|
|
37
|
-
e.stopPropagation();
|
|
38
|
-
onRowAction(row, idx);
|
|
39
|
-
}}"
|
|
40
|
-
>⋯</button>
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
|
-
function renderCell(col, row, idx, onRowAction) {
|
|
44
|
-
const value = row[col.key];
|
|
45
|
-
switch (col.type) {
|
|
46
|
-
case "badge": {
|
|
47
|
-
const tone = col.toneKey ? String(row[col.toneKey] ?? "inactive") : col.badgeTone ?? "inactive";
|
|
48
|
-
return renderBadge(value, tone);
|
|
49
|
-
}
|
|
50
|
-
case "progress":
|
|
51
|
-
return renderProgress(value, col.progressTone ?? "");
|
|
52
|
-
case "avatar":
|
|
53
|
-
return renderAvatar(row, col);
|
|
54
|
-
case "actions":
|
|
55
|
-
return renderActionsBtn(row, idx, onRowAction);
|
|
56
|
-
case "mono":
|
|
57
|
-
return html`<span class="cell-mono">${value ?? "—"}</span>`;
|
|
58
|
-
default:
|
|
59
|
-
return html`${value ?? "—"}`;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
function thClasses(col, sortKey, sortDir) {
|
|
63
|
-
const parts = [];
|
|
64
|
-
if (col.type === "num") parts.push("cell-num", "is-num");
|
|
65
|
-
if (col.sticky) parts.push("col-sticky");
|
|
66
|
-
if (col.sortable) {
|
|
67
|
-
parts.push("is-sortable");
|
|
68
|
-
if (sortKey === col.key) parts.push(sortDir === "asc" ? "sort-asc" : "sort-desc");
|
|
69
|
-
}
|
|
70
|
-
return parts.join(" ");
|
|
71
|
-
}
|
|
72
|
-
function tdClasses(col) {
|
|
73
|
-
const parts = [];
|
|
74
|
-
if (col.type === "num") parts.push("cell-num");
|
|
75
|
-
if (col.type === "actions") parts.push("cell-actions");
|
|
76
|
-
if (col.sticky) parts.push("col-sticky");
|
|
77
|
-
if (col.truncate) parts.push("cell-truncate");
|
|
78
|
-
return parts.join(" ");
|
|
79
|
-
}
|
|
80
|
-
function rowClass(row, idx, selected) {
|
|
81
|
-
const state = row._state;
|
|
82
|
-
const isSelected = selected.has(idx) || state === "selected";
|
|
83
|
-
const parts = [];
|
|
84
|
-
if (isSelected) parts.push("is-selected");
|
|
85
|
-
else if (state) parts.push(`is-${state}`);
|
|
86
|
-
return parts.join(" ");
|
|
87
|
-
}
|
|
88
|
-
const WIDTHS = ["w-80", "w-60", "w-40", "w-60", "w-80"];
|
|
89
|
-
function renderSkeletonCell(col, idx) {
|
|
90
|
-
const w = WIDTHS[idx % WIDTHS.length] ?? "w-60";
|
|
91
|
-
if (col.type === "avatar") return html`
|
|
92
|
-
<div class="skel-cell">
|
|
93
|
-
<div class="skel-avatar"></div>
|
|
94
|
-
<div style="flex:1;display:flex;flex-direction:column;gap:4px;">
|
|
95
|
-
<div class="skel-line ${w}"></div>
|
|
96
|
-
<div class="skel-line w-40" style="height:7px;"></div>
|
|
97
|
-
</div>
|
|
98
|
-
</div>`;
|
|
99
|
-
if (col.type === "badge") return html`<div class="skel-badge"></div>`;
|
|
100
|
-
if (col.type === "num") return html`<div class="skel-line ${w}" style="margin-left:auto;"></div>`;
|
|
101
|
-
return html`<div class="skel-line ${w}"></div>`;
|
|
102
|
-
}
|
|
103
|
-
function renderSkeleton(count, cols, selectable) {
|
|
104
|
-
return html`${Array.from({ length: count }, (_, r) => html`
|
|
105
|
-
<tr class="tbl-tr">
|
|
106
|
-
${selectable ? html`<td class="cell-check"></td>` : nothing}
|
|
107
|
-
${cols.map((col, c) => html`
|
|
108
|
-
<td class="${tdClasses(col)}" style="${col.type === "actions" ? "" : ""}">
|
|
109
|
-
${renderSkeletonCell(col, r + c)}
|
|
110
|
-
</td>
|
|
111
|
-
`)}
|
|
112
|
-
</tr>
|
|
113
|
-
`)}`;
|
|
114
|
-
}
|
|
115
|
-
function renderEmpty(title, desc, colSpan) {
|
|
116
|
-
return html`
|
|
117
|
-
<tr class="empty-row">
|
|
118
|
-
<td colspan="${colSpan}">
|
|
119
|
-
<span class="empty-icon">◯</span>
|
|
120
|
-
<span class="empty-title">${title}</span>
|
|
121
|
-
<span class="empty-desc">${desc}</span>
|
|
122
|
-
</td>
|
|
123
|
-
</tr>
|
|
124
|
-
`;
|
|
125
|
-
}
|
|
126
|
-
function renderToolbar(p) {
|
|
127
|
-
const countLabel = p.query ? `${p.filteredTotal} de ${p.totalRows}` : `${p.totalRows} registros`;
|
|
128
|
-
return html`
|
|
129
|
-
<div class="tbl-toolbar">
|
|
130
|
-
${p.toolbarTitle ? html`<span class="tbl-toolbar-title">${p.toolbarTitle}</span>` : nothing}
|
|
131
|
-
<span class="tbl-toolbar-count">${countLabel}</span>
|
|
132
|
-
<input
|
|
133
|
-
class="tbl-toolbar-search"
|
|
134
|
-
type="search"
|
|
135
|
-
placeholder="Buscar…"
|
|
136
|
-
.value="${p.query}"
|
|
137
|
-
@input="${(e) => p.onSearch(e.target.value)}"
|
|
138
|
-
>
|
|
139
|
-
<slot name="toolbar-actions"></slot>
|
|
140
|
-
</div>
|
|
141
|
-
`;
|
|
142
|
-
}
|
|
143
|
-
function buildPageNumbers(current, total) {
|
|
144
|
-
if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);
|
|
145
|
-
const pages = [1];
|
|
146
|
-
if (current > 3) pages.push("…");
|
|
147
|
-
const lo = Math.max(2, current - 1);
|
|
148
|
-
const hi = Math.min(total - 1, current + 1);
|
|
149
|
-
for (let i = lo; i <= hi; i++) pages.push(i);
|
|
150
|
-
if (current < total - 2) pages.push("…");
|
|
151
|
-
pages.push(total);
|
|
152
|
-
return pages;
|
|
153
|
-
}
|
|
154
|
-
function renderPagination(p) {
|
|
155
|
-
if (p.pageSize <= 0 || p.totalPages <= 1) return html``;
|
|
156
|
-
const start = (p.page - 1) * p.pageSize + 1;
|
|
157
|
-
const end = Math.min(p.page * p.pageSize, p.filteredTotal);
|
|
158
|
-
const pages = buildPageNumbers(p.page, p.totalPages);
|
|
159
|
-
return html`
|
|
160
|
-
<div class="tbl-pagination">
|
|
161
|
-
<span class="pag-info">${start}–${end} de ${p.filteredTotal}</span>
|
|
162
|
-
|
|
163
|
-
<button class="pag-btn" ?disabled="${p.page <= 1}"
|
|
164
|
-
@click="${() => p.onPageChange(p.page - 1)}">‹</button>
|
|
165
|
-
|
|
166
|
-
${pages.map((pg) => pg === "…" ? html`<span class="pag-sep">…</span>` : html`
|
|
167
|
-
<button class="pag-btn ${p.page === pg ? "is-active" : ""}"
|
|
168
|
-
@click="${() => p.onPageChange(pg)}">${pg}</button>
|
|
169
|
-
`)}
|
|
170
|
-
|
|
171
|
-
<button class="pag-btn" ?disabled="${p.page >= p.totalPages}"
|
|
172
|
-
@click="${() => p.onPageChange(p.page + 1)}">›</button>
|
|
173
|
-
</div>
|
|
174
|
-
`;
|
|
175
|
-
}
|
|
176
|
-
function dataTableTemplate(p) {
|
|
177
|
-
const colSpan = p.columns.length + (p.selectable ? 1 : 0);
|
|
178
|
-
const wrapCls = `tbl-wrap${p.stickyHead ? " tbl-sticky-head" : ""}`;
|
|
179
|
-
return html`
|
|
180
|
-
${p.toolbar ? renderToolbar(p) : nothing}
|
|
181
|
-
|
|
182
|
-
<div class="${wrapCls}">
|
|
183
|
-
<table>
|
|
184
|
-
${p.caption ? html`<caption>${p.caption}</caption>` : nothing}
|
|
185
|
-
|
|
186
|
-
<!-- THEAD -->
|
|
187
|
-
<thead>
|
|
188
|
-
<tr>
|
|
189
|
-
${p.selectable ? html`
|
|
190
|
-
<th class="cell-check">
|
|
191
|
-
<input type="checkbox"
|
|
192
|
-
.indeterminate="${p.someSelected}"
|
|
193
|
-
.checked="${p.allSelected}"
|
|
194
|
-
@change="${(e) => p.onSelectAll(e.target.checked, p.data.length)}">
|
|
195
|
-
</th>
|
|
196
|
-
` : nothing}
|
|
197
|
-
|
|
198
|
-
${p.columns.map((col) => html`
|
|
199
|
-
<th class="${thClasses(col, p.sortKey, p.sortDir)}"
|
|
200
|
-
@click="${col.sortable ? () => p.onSort(col.key) : nothing}">
|
|
201
|
-
${col.header}
|
|
202
|
-
</th>
|
|
203
|
-
`)}
|
|
204
|
-
</tr>
|
|
205
|
-
</thead>
|
|
206
|
-
|
|
207
|
-
<!-- TBODY -->
|
|
208
|
-
<tbody>
|
|
209
|
-
${p.loading ? renderSkeleton(p.skeletonRows, p.columns, p.selectable) : p.data.length === 0 ? renderEmpty(p.emptyTitle, p.emptyDesc, colSpan) : p.data.map((row, idx) => {
|
|
210
|
-
const globalIdx = (p.page - 1) * (p.pageSize || 0) + idx;
|
|
211
|
-
return html`
|
|
212
|
-
<tr class="${rowClass(row, globalIdx, p.selected)}">
|
|
213
|
-
${p.selectable ? html`
|
|
214
|
-
<td class="cell-check">
|
|
215
|
-
<input type="checkbox"
|
|
216
|
-
.checked="${p.selected.has(globalIdx)}"
|
|
217
|
-
@change="${(e) => p.onSelectRow(globalIdx, e.target.checked)}">
|
|
218
|
-
</td>
|
|
219
|
-
` : nothing}
|
|
220
|
-
|
|
221
|
-
${p.columns.map((col) => html`
|
|
222
|
-
<td class="${tdClasses(col)}">
|
|
223
|
-
${renderCell(col, row, globalIdx, p.onRowAction)}
|
|
224
|
-
</td>
|
|
225
|
-
`)}
|
|
226
|
-
</tr>
|
|
227
|
-
`;
|
|
228
|
-
})}
|
|
229
|
-
</tbody>
|
|
230
|
-
</table>
|
|
231
|
-
</div>
|
|
232
|
-
|
|
233
|
-
${renderPagination(p)}
|
|
234
|
-
<slot name="pagination"></slot>
|
|
235
|
-
`;
|
|
1
|
+
let uniqueIdCounter = 0;
|
|
2
|
+
function generateUniqueId(prefix = "lib-id-") {
|
|
3
|
+
uniqueIdCounter++;
|
|
4
|
+
return `${prefix}${uniqueIdCounter}`;
|
|
236
5
|
}
|
|
237
6
|
export {
|
|
238
|
-
|
|
7
|
+
generateUniqueId
|
|
239
8
|
};
|
|
240
9
|
//# sourceMappingURL=index242.js.map
|
package/dist/index242.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index242.js","sources":["../src/components/organisms/data-table/lib-data-table.html.ts"],"sourcesContent":["import { html, nothing, TemplateResult } from 'lit';\nimport type {\n TableColumn,\n TableRowData,\n TableVariant,\n TableSize,\n TableBadgeTone,\n} from './lib-data-table.types';\n\n/* ── Template Props ─────────────────────────────────────── */\nexport interface DataTableTemplateProps {\n columns: TableColumn[];\n data: TableRowData[];\n filteredTotal: number;\n totalRows: number;\n variant: TableVariant;\n size: TableSize;\n dark: boolean;\n loading: boolean;\n selectable: boolean;\n stickyHead: boolean;\n caption: string;\n emptyTitle: string;\n emptyDesc: string;\n toolbar: boolean;\n toolbarTitle: string;\n skeletonRows: number;\n sortKey: string;\n sortDir: 'asc' | 'desc';\n query: string;\n selected: Set<number>;\n allSelected: boolean;\n someSelected: boolean;\n page: number;\n pageSize: number;\n totalPages: number;\n onSort: (key: string) => void;\n onSearch: (q: string) => void;\n onSelectAll: (checked: boolean, total: number) => void;\n onSelectRow: (idx: number, checked: boolean) => void;\n onRowAction: (row: TableRowData, idx: number) => void;\n onPageChange: (p: number) => void;\n}\n\n/* ── Helpers: Cell renderers ───────────────────────────── */\n\nfunction renderBadge(value: unknown, tone: string): TemplateResult {\n const label = String(value ?? '');\n return html`<span class=\"cell-badge tone-${tone}\">${label}</span>`;\n}\n\nfunction renderProgress(value: unknown, tone: 'kaki' | 'celadon' | ''): TemplateResult {\n const pct = Math.min(100, Math.max(0, Number(value) || 0));\n const toneClass = tone ? `tone-${tone}` : '';\n return html`\n <div class=\"cell-progress\">\n <div class=\"progress-bar\">\n <div class=\"progress-fill ${toneClass}\" style=\"width:${pct}%\"></div>\n </div>\n <span class=\"progress-val\">${pct}%</span>\n </div>\n `;\n}\n\nfunction renderAvatar(row: TableRowData, col: TableColumn): TemplateResult {\n const name = String(row[col.key] ?? '');\n const initials = col.initialsKey\n ? String(row[col.initialsKey] ?? '').slice(0, 2).toUpperCase()\n : name.split(' ').map(w => w[0]).join('').slice(0, 2).toUpperCase();\n const hint = col.hintKey ? String(row[col.hintKey] ?? '') : '';\n\n return html`\n <div class=\"cell-avatar\">\n <div class=\"avatar-circle\">${initials}</div>\n <div class=\"avatar-text\">\n <span class=\"avatar-name\">${name}</span>\n ${hint ? html`<span class=\"avatar-hint\">${hint}</span>` : nothing}\n </div>\n </div>\n `;\n}\n\nfunction renderActionsBtn(row: TableRowData, idx: number, onRowAction: (r: TableRowData, i: number) => void): TemplateResult {\n return html`\n <button class=\"actions-btn\"\n aria-label=\"Acciones\"\n @click=\"${(e: Event):void => { e.stopPropagation(); onRowAction(row, idx); }}\"\n >⋯</button>\n `;\n}\n\nfunction renderCell(col: TableColumn, row: TableRowData, idx: number, onRowAction: (r: TableRowData, i: number) => void): TemplateResult {\n const value = row[col.key];\n\n switch (col.type) {\n case 'badge': {\n const tone = col.toneKey\n ? String(row[col.toneKey] ?? 'inactive')\n : (col.badgeTone ?? 'inactive');\n return renderBadge(value, tone as TableBadgeTone);\n }\n case 'progress':\n return renderProgress(value, col.progressTone ?? '');\n case 'avatar':\n return renderAvatar(row, col);\n case 'actions':\n return renderActionsBtn(row, idx, onRowAction);\n case 'mono':\n return html`<span class=\"cell-mono\">${value ?? '—'}</span>`;\n default:\n return html`${value ?? '—'}`;\n }\n}\n\n/* ── Helpers: Structural ───────────────────────────────── */\n\nfunction thClasses(col: TableColumn, sortKey: string, sortDir: 'asc' | 'desc'): string {\n const parts: string[] = [];\n if (col.type === 'num') parts.push('cell-num', 'is-num');\n if (col.sticky) parts.push('col-sticky');\n if (col.sortable) {\n parts.push('is-sortable');\n if (sortKey === col.key) parts.push(sortDir === 'asc' ? 'sort-asc' : 'sort-desc');\n }\n return parts.join(' ');\n}\n\nfunction tdClasses(col: TableColumn): string {\n const parts: string[] = [];\n if (col.type === 'num') parts.push('cell-num');\n if (col.type === 'actions') parts.push('cell-actions');\n if (col.sticky) parts.push('col-sticky');\n if (col.truncate) parts.push('cell-truncate');\n return parts.join(' ');\n}\n\nfunction rowClass(row: TableRowData, idx: number, selected: Set<number>): string {\n const state = row._state;\n const isSelected = selected.has(idx) || state === 'selected';\n const parts: string[] = [];\n if (isSelected) parts.push('is-selected');\n else if (state) parts.push(`is-${state}`);\n return parts.join(' ');\n}\n\n/* ── Skeleton rows ───────────────────────────────────────── */\nconst WIDTHS = ['w-80', 'w-60', 'w-40', 'w-60', 'w-80'] as const;\n\nfunction renderSkeletonCell(col: TableColumn, idx: number): TemplateResult {\n const w = WIDTHS[idx % WIDTHS.length] ?? 'w-60';\n if (col.type === 'avatar') return html`\n <div class=\"skel-cell\">\n <div class=\"skel-avatar\"></div>\n <div style=\"flex:1;display:flex;flex-direction:column;gap:4px;\">\n <div class=\"skel-line ${w}\"></div>\n <div class=\"skel-line w-40\" style=\"height:7px;\"></div>\n </div>\n </div>`;\n if (col.type === 'badge') return html`<div class=\"skel-badge\"></div>`;\n if (col.type === 'num') return html`<div class=\"skel-line ${w}\" style=\"margin-left:auto;\"></div>`;\n return html`<div class=\"skel-line ${w}\"></div>`;\n}\n\nfunction renderSkeleton(count: number, cols: TableColumn[], selectable: boolean): TemplateResult {\n return html`${Array.from({ length: count }, (_, r) => html`\n <tr class=\"tbl-tr\">\n ${selectable ? html`<td class=\"cell-check\"></td>` : nothing}\n ${cols.map((col, c) => html`\n <td class=\"${tdClasses(col)}\" style=\"${col.type === 'actions' ? '' : ''}\">\n ${renderSkeletonCell(col, r + c)}\n </td>\n `)}\n </tr>\n `)}`;\n}\n\n/* ── Empty state ─────────────────────────────────────────── */\nfunction renderEmpty(title: string, desc: string, colSpan: number): TemplateResult {\n return html`\n <tr class=\"empty-row\">\n <td colspan=\"${colSpan}\">\n <span class=\"empty-icon\">◯</span>\n <span class=\"empty-title\">${title}</span>\n <span class=\"empty-desc\">${desc}</span>\n </td>\n </tr>\n `;\n}\n\n/* ── Toolbar ─────────────────────────────────────────────── */\nfunction renderToolbar(p: DataTableTemplateProps): TemplateResult {\n const countLabel = p.query\n ? `${p.filteredTotal} de ${p.totalRows}`\n : `${p.totalRows} registros`;\n\n return html`\n <div class=\"tbl-toolbar\">\n ${p.toolbarTitle ? html`<span class=\"tbl-toolbar-title\">${p.toolbarTitle}</span>` : nothing}\n <span class=\"tbl-toolbar-count\">${countLabel}</span>\n <input\n class=\"tbl-toolbar-search\"\n type=\"search\"\n placeholder=\"Buscar…\"\n .value=\"${p.query}\"\n @input=\"${(e: Event):void => p.onSearch((e.target as HTMLInputElement).value)}\"\n >\n <slot name=\"toolbar-actions\"></slot>\n </div>\n `;\n}\n\n/* ── Built-in pagination bar ─────────────────────────────── */\nfunction buildPageNumbers(current: number, total: number): (number | '…')[] {\n if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1);\n const pages: (number | '…')[] = [1];\n if (current > 3) pages.push('…');\n const lo = Math.max(2, current - 1);\n const hi = Math.min(total - 1, current + 1);\n for (let i = lo; i <= hi; i++) pages.push(i);\n if (current < total - 2) pages.push('…');\n pages.push(total);\n return pages;\n}\n\nfunction renderPagination(p: DataTableTemplateProps): TemplateResult {\n if (p.pageSize <= 0 || p.totalPages <= 1) return html``;\n const start = (p.page - 1) * p.pageSize + 1;\n const end = Math.min(p.page * p.pageSize, p.filteredTotal);\n const pages = buildPageNumbers(p.page, p.totalPages);\n\n return html`\n <div class=\"tbl-pagination\">\n <span class=\"pag-info\">${start}–${end} de ${p.filteredTotal}</span>\n\n <button class=\"pag-btn\" ?disabled=\"${p.page <= 1}\"\n @click=\"${():void => p.onPageChange(p.page - 1)}\">‹</button>\n\n ${pages.map(pg => pg === '…'\n ? html`<span class=\"pag-sep\">…</span>`\n : html`\n <button class=\"pag-btn ${p.page === pg ? 'is-active' : ''}\"\n @click=\"${():void => p.onPageChange(pg as number)}\">${pg}</button>\n `)}\n\n <button class=\"pag-btn\" ?disabled=\"${p.page >= p.totalPages}\"\n @click=\"${():void => p.onPageChange(p.page + 1)}\">›</button>\n </div>\n `;\n}\n\n/* ── Main template ────────────────────────────────────────── */\nexport function dataTableTemplate(p: DataTableTemplateProps): TemplateResult {\n const colSpan = p.columns.length + (p.selectable ? 1 : 0);\n const wrapCls = `tbl-wrap${p.stickyHead ? ' tbl-sticky-head' : ''}`;\n\n return html`\n ${p.toolbar ? renderToolbar(p) : nothing}\n\n <div class=\"${wrapCls}\">\n <table>\n ${p.caption ? html`<caption>${p.caption}</caption>` : nothing}\n\n <!-- THEAD -->\n <thead>\n <tr>\n ${p.selectable ? html`\n <th class=\"cell-check\">\n <input type=\"checkbox\"\n .indeterminate=\"${p.someSelected}\"\n .checked=\"${p.allSelected}\"\n @change=\"${(e: Event):void =>\n p.onSelectAll((e.target as HTMLInputElement).checked, p.data.length)}\">\n </th>\n ` : nothing}\n\n ${p.columns.map(col => html`\n <th class=\"${thClasses(col, p.sortKey, p.sortDir)}\"\n @click=\"${col.sortable ? ():void => p.onSort(col.key) : nothing}\">\n ${col.header}\n </th>\n `)}\n </tr>\n </thead>\n\n <!-- TBODY -->\n <tbody>\n ${p.loading\n ? renderSkeleton(p.skeletonRows, p.columns, p.selectable)\n : p.data.length === 0\n ? renderEmpty(p.emptyTitle, p.emptyDesc, colSpan)\n : p.data.map((row, idx) => {\n const globalIdx = (p.page - 1) * (p.pageSize || 0) + idx;\n return html`\n <tr class=\"${rowClass(row, globalIdx, p.selected)}\">\n ${p.selectable ? html`\n <td class=\"cell-check\">\n <input type=\"checkbox\"\n .checked=\"${p.selected.has(globalIdx)}\"\n @change=\"${(e: Event):void =>\n p.onSelectRow(globalIdx, (e.target as HTMLInputElement).checked)}\">\n </td>\n ` : nothing}\n\n ${p.columns.map(col => html`\n <td class=\"${tdClasses(col)}\">\n ${renderCell(col, row, globalIdx, p.onRowAction)}\n </td>\n `)}\n </tr>\n `;\n })\n }\n </tbody>\n </table>\n </div>\n\n ${renderPagination(p)}\n <slot name=\"pagination\"></slot>\n `;\n}"],"names":[],"mappings":";AA8CA,SAAS,YAAY,OAAgB,MAA8B;AACjE,QAAM,QAAQ,OAAO,SAAS,EAAE;AAChC,SAAO,oCAAoC,IAAI,KAAK,KAAK;AAC3D;AAEA,SAAS,eAAe,OAAgB,MAA+C;AACrF,QAAM,MAAM,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,OAAO,KAAK,KAAK,CAAC,CAAC;AACzD,QAAM,YAAY,OAAO,QAAQ,IAAI,KAAK;AAC1C,SAAO;AAAA;AAAA;AAAA,oCAG2B,SAAS,kBAAkB,GAAG;AAAA;AAAA,mCAE/B,GAAG;AAAA;AAAA;AAGtC;AAEA,SAAS,aAAa,KAAmB,KAAkC;AACzE,QAAM,OAAW,OAAO,IAAI,IAAI,GAAG,KAAK,EAAE;AAC1C,QAAM,WAAW,IAAI,cACjB,OAAO,IAAI,IAAI,WAAW,KAAK,EAAE,EAA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ACrC,IAAI,WAAW,MAAW,EAAE,OAAO,IAAI,GAAG,IAAI,OAAO;AAAA,kBAC7D,IAAI,MAAM;AAAA;AAAA,aAEf,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAMF,EAAE,UACA,eAAe,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,IACtD,EAAE,KAAK,WAAW,IAChB,YAAY,EAAE,YAAY,EAAE,WAAW,OAAO,IAC9C,EAAE,KAAK,IAAI,CAAC,KAAK,QAAQ;AACvB,UAAM,aAAa,EAAE,OAAO,MAAM,EAAE,YAAY,KAAK;AACrD,WAAO;AAAA,iCACQ,SAAS,KAAK,WAAW,EAAE,QAAQ,CAAC;AAAA,wBAC7C,EAAE,aAAa;AAAA;AAAA;AAAA,wCAGC,EAAE,SAAS,IAAI,SAAS,CAAC;AAAA,uCAC1B,CAAC,MACV,EAAE,YAAY,WAAY,EAAE,OAA4B,OAAO,CAAC;AAAA;AAAA,0BAEpE,OAAO;AAAA;AAAA,wBAET,EAAE,QAAQ,IAAI,CAAA,QAAO;AAAA,qCACR,UAAU,GAAG,CAAC;AAAA,4BACvB,WAAW,KAAK,KAAK,WAAW,EAAE,WAAW,CAAC;AAAA;AAAA,uBAEnD,CAAC;AAAA;AAAA;AAAA,EAGR,CAAC,CACP;AAAA;AAAA;AAAA;AAAA;AAAA,MAKJ,iBAAiB,CAAC,CAAC;AAAA;AAAA;AAGzB;"}
|
|
1
|
+
{"version":3,"file":"index242.js","sources":["../src/core/a11y.ts"],"sourcesContent":["/**\n * Accessibility (a11y) Utilities - Pillar 5\n *\n * This module provides utility functions to help ensure accessibility\n * for UI components. It includes helpers for generating unique IDs\n * and retrieving ARIA attributes.\n *\n * All functions here are pure TypeScript logic, with no direct DOM manipulation\n * beyond reading attributes, and are framework-agnostic.\n */\n\nlet uniqueIdCounter = 0;\n\n/**\n * Generates a unique ID for a component or element.\n * Useful for associating elements via ARIA attributes (e.g., `aria-labelledby`, `aria-describedby`).\n * @param prefix An optional prefix for the ID. Defaults to 'lib-id-'.\n * @returns A unique ID string.\n */\nexport function generateUniqueId(prefix: string = 'lib-id-'): string {\n uniqueIdCounter++;\n return `${prefix}${uniqueIdCounter}`;\n}\n\n/**\n * Retrieves the `aria-label` attribute from an HTMLElement.\n * Provides a default fallback if `aria-label` is not explicitly set.\n * This function is meant to be used in conjunction with components that may not always have a visual label.\n * @param element The HTMLElement to check for `aria-label`.\n * @param defaultValue A fallback value to use if `aria-label` is not found.\n * @returns The value of `aria-label` or the `defaultValue`.\n */\nexport function getAriaLabel(element: HTMLElement, defaultValue: string = ''): string {\n return element.getAttribute('aria-label') || defaultValue;\n}\n"],"names":[],"mappings":"AAWA,IAAI,kBAAkB;AAQf,SAAS,iBAAiB,SAAiB,WAAmB;AACnE;AACA,SAAO,GAAG,MAAM,GAAG,eAAe;AACpC;"}
|