@axzydev/axzy_ui_system 1.8.4 → 1.8.6
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/index.cjs +60 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +47 -1
- package/dist/index.d.ts +47 -1
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -1
- package/dist/layered.css +1 -1
- package/package.json +1 -1
- package/src/components/organisms/bento/bento.tsx +115 -0
- package/src/index.css +169 -0
- package/src/index.ts +4 -1
package/package.json
CHANGED
|
@@ -404,6 +404,121 @@ export function ITBentoFeed({ groups, onItemClick, maxHeight = 330 }: ITBentoFee
|
|
|
404
404
|
);
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
+
export interface ITBentoStatItem {
|
|
408
|
+
id: string;
|
|
409
|
+
label: string;
|
|
410
|
+
value: ReactNode;
|
|
411
|
+
/** Texto de apoyo junto al número (p. ej. «de 50 tickets»). */
|
|
412
|
+
caption?: ReactNode;
|
|
413
|
+
/** Color del punto y del segmento de la barra. */
|
|
414
|
+
color?: string;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export interface ITBentoStatStripProps {
|
|
418
|
+
items: ITBentoStatItem[];
|
|
419
|
+
/** Cifra seleccionada (filtro activo). */
|
|
420
|
+
activeId?: string;
|
|
421
|
+
/** Con esto cada bloque filtra al hacer clic. */
|
|
422
|
+
onSelect?: (id: string) => void;
|
|
423
|
+
/** Dibuja la barra apilada con la proporción de cada cifra. */
|
|
424
|
+
stack?: boolean;
|
|
425
|
+
className?: string;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Tira de cifras del bento: una sola tarjeta con los bloques clicables separados
|
|
430
|
+
* por línea fina y, si se pide, la barra apilada con la proporción de cada uno.
|
|
431
|
+
* Al pasar el cursor por un bloque se resalta su segmento de la barra.
|
|
432
|
+
*/
|
|
433
|
+
export function ITBentoStatStrip({ items, activeId, onSelect, stack = false, className }: ITBentoStatStripProps) {
|
|
434
|
+
const [hovered, setHovered] = useState<string | null>(null);
|
|
435
|
+
const focus = hovered ?? activeId ?? null;
|
|
436
|
+
const total = items.reduce((acc, item) => acc + (typeof item.value === "number" ? item.value : 0), 0);
|
|
437
|
+
const clickable = typeof onSelect === "function";
|
|
438
|
+
|
|
439
|
+
return (
|
|
440
|
+
<div className={clsx("it-bento-statstrip", className)}>
|
|
441
|
+
<div className="it-bento-statstrip__grid" style={{ ["--it-bento-cols" as string]: Math.min(items.length, 4) }}>
|
|
442
|
+
{items.map((item) => {
|
|
443
|
+
const on = item.id === activeId;
|
|
444
|
+
const Tag = clickable ? "button" : "div";
|
|
445
|
+
return (
|
|
446
|
+
<Tag
|
|
447
|
+
key={item.id}
|
|
448
|
+
type={clickable ? "button" : undefined}
|
|
449
|
+
className={clsx("it-bento-statstrip__item", on && "is-on")}
|
|
450
|
+
style={{ ["--it-bento-c" as string]: item.color ?? "currentColor" } as CSSProperties}
|
|
451
|
+
onClick={clickable ? () => onSelect?.(item.id) : undefined}
|
|
452
|
+
onMouseEnter={() => setHovered(item.id)}
|
|
453
|
+
onMouseLeave={() => setHovered(null)}
|
|
454
|
+
>
|
|
455
|
+
<span className="it-bento-statstrip__label">
|
|
456
|
+
{item.color && <i style={{ background: item.color }} aria-hidden />}
|
|
457
|
+
{item.label}
|
|
458
|
+
</span>
|
|
459
|
+
<span className="it-bento-statstrip__row">
|
|
460
|
+
<span className="it-bento-statstrip__value">{item.value}</span>
|
|
461
|
+
{item.caption && <small className="it-bento-statstrip__caption">{item.caption}</small>}
|
|
462
|
+
</span>
|
|
463
|
+
</Tag>
|
|
464
|
+
);
|
|
465
|
+
})}
|
|
466
|
+
</div>
|
|
467
|
+
|
|
468
|
+
{stack && total > 0 && (
|
|
469
|
+
<div className={clsx("it-bento-statstrip__stack", focus && "is-dim")} aria-hidden>
|
|
470
|
+
{items
|
|
471
|
+
.filter((item) => typeof item.value === "number" && item.value > 0)
|
|
472
|
+
.map((item) => (
|
|
473
|
+
<i
|
|
474
|
+
key={item.id}
|
|
475
|
+
className={clsx(item.id === focus && "is-on")}
|
|
476
|
+
style={{ width: `${((Number(item.value) || 0) / total) * 100}%`, background: item.color ?? "currentColor" }}
|
|
477
|
+
onMouseEnter={() => setHovered(item.id)}
|
|
478
|
+
onMouseLeave={() => setHovered(null)}
|
|
479
|
+
onClick={clickable ? () => onSelect?.(item.id) : undefined}
|
|
480
|
+
/>
|
|
481
|
+
))}
|
|
482
|
+
</div>
|
|
483
|
+
)}
|
|
484
|
+
</div>
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export interface ITBentoPillProps {
|
|
489
|
+
/** Contenido de la píldora (texto corto). */
|
|
490
|
+
children: ReactNode;
|
|
491
|
+
/** Punto de color a la izquierda; si se omite, no se dibuja. */
|
|
492
|
+
dot?: string;
|
|
493
|
+
/** Color del texto (por defecto hereda el de la tarjeta). */
|
|
494
|
+
color?: string;
|
|
495
|
+
className?: string;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Píldora de dato dentro de una tarjeta bento: fondo traslúcido del color del
|
|
500
|
+
* texto y, opcionalmente, un punto de color. Reemplaza los `<span class="…">`
|
|
501
|
+
* hechos a mano en los héroes (no usa clases sueltas ni estilos por pantalla).
|
|
502
|
+
*/
|
|
503
|
+
export function ITBentoPill({ children, dot, color, className }: ITBentoPillProps) {
|
|
504
|
+
return (
|
|
505
|
+
<span className={clsx("it-bento-pill", className)} style={color ? { color } : undefined}>
|
|
506
|
+
{dot && <i className="it-bento-pill__dot" style={{ background: dot }} aria-hidden />}
|
|
507
|
+
<span className="it-bento-pill__text">{children}</span>
|
|
508
|
+
</span>
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
export interface ITBentoPillRowProps {
|
|
513
|
+
children: ReactNode;
|
|
514
|
+
className?: string;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/** Fila que acomoda las píldoras de una tarjeta y las deja bajar de línea. */
|
|
518
|
+
export function ITBentoPillRow({ children, className }: ITBentoPillRowProps) {
|
|
519
|
+
return <div className={clsx("flex flex-wrap items-center gap-1.5", className)}>{children}</div>;
|
|
520
|
+
}
|
|
521
|
+
|
|
407
522
|
export interface ITBentoLiveProps {
|
|
408
523
|
label: string;
|
|
409
524
|
className?: string;
|
package/src/index.css
CHANGED
|
@@ -845,3 +845,172 @@
|
|
|
845
845
|
transition: none !important;
|
|
846
846
|
}
|
|
847
847
|
}
|
|
848
|
+
|
|
849
|
+
/* Píldoras de datos del mosaico bento: chips traslúcidos que heredan el color de
|
|
850
|
+
la tarjeta (funcionan igual sobre tarjeta oscura o clara) con un punto de color. */
|
|
851
|
+
.it-bento-pill {
|
|
852
|
+
display: inline-flex;
|
|
853
|
+
align-items: center;
|
|
854
|
+
gap: 6px;
|
|
855
|
+
max-width: 100%;
|
|
856
|
+
padding: 4px 10px;
|
|
857
|
+
border-radius: 999px;
|
|
858
|
+
font-size: 11.5px;
|
|
859
|
+
font-weight: 600;
|
|
860
|
+
line-height: 1.2;
|
|
861
|
+
background: color-mix(in srgb, currentColor 12%, transparent);
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
.it-bento-pill__dot {
|
|
865
|
+
display: inline-block;
|
|
866
|
+
flex: none;
|
|
867
|
+
width: 7px;
|
|
868
|
+
height: 7px;
|
|
869
|
+
border-radius: 999px;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
.it-bento-pill__text {
|
|
873
|
+
min-width: 0;
|
|
874
|
+
overflow: hidden;
|
|
875
|
+
text-overflow: ellipsis;
|
|
876
|
+
white-space: nowrap;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
/* Tira de cifras del bento: una tarjeta con N bloques clicables separados por
|
|
880
|
+
línea fina y, opcionalmente, la barra apilada del mismo dato. */
|
|
881
|
+
.it-bento-statstrip {
|
|
882
|
+
background: var(--it-card-bg, #ffffff);
|
|
883
|
+
border-radius: 20px;
|
|
884
|
+
overflow: hidden;
|
|
885
|
+
box-shadow: inset 0 0 0 1px rgb(15 23 42 / 0.07);
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
.dark .it-bento-statstrip {
|
|
889
|
+
box-shadow: inset 0 0 0 1px rgb(229 240 243 / 0.09);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
.it-bento-statstrip__grid {
|
|
893
|
+
display: grid;
|
|
894
|
+
grid-template-columns: repeat(var(--it-bento-cols, 4), minmax(0, 1fr));
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
.it-bento-statstrip__item {
|
|
898
|
+
position: relative;
|
|
899
|
+
display: block;
|
|
900
|
+
min-width: 0;
|
|
901
|
+
padding: 12px 18px;
|
|
902
|
+
border: 0;
|
|
903
|
+
background: none;
|
|
904
|
+
text-align: left;
|
|
905
|
+
color: inherit;
|
|
906
|
+
cursor: pointer;
|
|
907
|
+
transition: background 0.2s;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
.it-bento-statstrip__item:hover {
|
|
911
|
+
background: color-mix(in srgb, currentColor 4%, transparent);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
.it-bento-statstrip__item.is-on {
|
|
915
|
+
background: color-mix(in srgb, currentColor 4%, transparent);
|
|
916
|
+
box-shadow: inset 0 -3px 0 var(--it-bento-c, currentColor);
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
.it-bento-statstrip__item:focus-visible {
|
|
920
|
+
outline: 2px solid var(--color-primary);
|
|
921
|
+
outline-offset: -2px;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
.it-bento-statstrip__item + .it-bento-statstrip__item::before {
|
|
925
|
+
content: "";
|
|
926
|
+
position: absolute;
|
|
927
|
+
left: 0;
|
|
928
|
+
top: 14px;
|
|
929
|
+
bottom: 14px;
|
|
930
|
+
border-left: 1px solid rgb(15 23 42 / 0.07);
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
.dark .it-bento-statstrip__item + .it-bento-statstrip__item::before {
|
|
934
|
+
border-left-color: rgb(229 240 243 / 0.1);
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
.it-bento-statstrip__label {
|
|
938
|
+
display: flex;
|
|
939
|
+
align-items: center;
|
|
940
|
+
gap: 7px;
|
|
941
|
+
font-size: 12.5px;
|
|
942
|
+
font-weight: 600;
|
|
943
|
+
color: var(--color-text-muted, #64748b);
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
.it-bento-statstrip__label i {
|
|
947
|
+
width: 9px;
|
|
948
|
+
height: 9px;
|
|
949
|
+
border-radius: 3px;
|
|
950
|
+
flex: none;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
.it-bento-statstrip__row {
|
|
954
|
+
display: flex;
|
|
955
|
+
align-items: baseline;
|
|
956
|
+
gap: 8px;
|
|
957
|
+
margin-top: 5px;
|
|
958
|
+
min-width: 0;
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
.it-bento-statstrip__value {
|
|
962
|
+
font-size: 32px;
|
|
963
|
+
font-weight: 800;
|
|
964
|
+
letter-spacing: -0.04em;
|
|
965
|
+
line-height: 1;
|
|
966
|
+
font-variant-numeric: tabular-nums;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
.it-bento-statstrip__caption {
|
|
970
|
+
font-size: 12px;
|
|
971
|
+
font-weight: 500;
|
|
972
|
+
color: var(--color-text-muted, #64748b);
|
|
973
|
+
overflow: hidden;
|
|
974
|
+
text-overflow: ellipsis;
|
|
975
|
+
white-space: nowrap;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
.it-bento-statstrip__stack {
|
|
979
|
+
display: flex;
|
|
980
|
+
gap: 2px;
|
|
981
|
+
height: 14px;
|
|
982
|
+
margin: 6px 20px 14px;
|
|
983
|
+
border-radius: 9px;
|
|
984
|
+
overflow: hidden;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
.it-bento-statstrip__stack i {
|
|
988
|
+
display: block;
|
|
989
|
+
height: 100%;
|
|
990
|
+
transition: width 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s;
|
|
991
|
+
cursor: pointer;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
.it-bento-statstrip__stack.is-dim i {
|
|
995
|
+
opacity: 0.3;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
.it-bento-statstrip__stack.is-dim i.is-on {
|
|
999
|
+
opacity: 1;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
@media (max-width: 760px) {
|
|
1003
|
+
.it-bento-statstrip__grid {
|
|
1004
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
.it-bento-statstrip__item + .it-bento-statstrip__item::before {
|
|
1008
|
+
display: none;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1013
|
+
.it-bento-statstrip__stack i {
|
|
1014
|
+
transition: none;
|
|
1015
|
+
}
|
|
1016
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -20,6 +20,9 @@ import {
|
|
|
20
20
|
ITBentoWeekBars,
|
|
21
21
|
ITBentoDonut,
|
|
22
22
|
ITBentoFeed,
|
|
23
|
+
ITBentoPill,
|
|
24
|
+
ITBentoPillRow,
|
|
25
|
+
ITBentoStatStrip,
|
|
23
26
|
ITBentoLive,
|
|
24
27
|
useITBentoCountUp,
|
|
25
28
|
} from "./components/organisms/bento/bento";
|
|
@@ -265,7 +268,7 @@ export {
|
|
|
265
268
|
// Components
|
|
266
269
|
ITAccordion,
|
|
267
270
|
ITBentoGrid, ITBentoTile, ITBentoGauge, ITBentoWaves, ITBentoSpark, ITBentoSegments,
|
|
268
|
-
ITBentoWeekBars, ITBentoDonut, ITBentoFeed, ITBentoLive, useITBentoCountUp,
|
|
271
|
+
ITBentoWeekBars, ITBentoDonut, ITBentoFeed, ITBentoPill, ITBentoPillRow, ITBentoLive, ITBentoStatStrip, useITBentoCountUp,
|
|
269
272
|
ITAlert, ITAvatar, ITBadget, ITBreadcrumbs, ITButton,
|
|
270
273
|
ITCalendar,
|
|
271
274
|
ITCard, ITCheckbox, ITChip, ITChipInput, ITConfirmDialog, ITDataTable, ITDatePicker,
|