@axzydev/axzy_ui_system 1.8.5 → 1.8.7
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 +48 -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 +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +47 -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 +87 -0
- package/src/index.css +139 -0
- package/src/index.ts +2 -1
package/package.json
CHANGED
|
@@ -404,6 +404,93 @@ 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
|
+
/**
|
|
426
|
+
* Cifras que forman la barra, cuando no todas las de la tira se suman
|
|
427
|
+
* (p. ej. «sin asignar» es un subconjunto de «abiertos»). Por defecto usa `items`.
|
|
428
|
+
*/
|
|
429
|
+
stackItems?: ITBentoStatItem[];
|
|
430
|
+
className?: string;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Tira de cifras del bento: una sola tarjeta con los bloques clicables separados
|
|
435
|
+
* por línea fina y, si se pide, la barra apilada con la proporción de cada uno.
|
|
436
|
+
* Al pasar el cursor por un bloque se resalta su segmento de la barra.
|
|
437
|
+
*/
|
|
438
|
+
export function ITBentoStatStrip({ items, activeId, onSelect, stack = false, stackItems, className }: ITBentoStatStripProps) {
|
|
439
|
+
const [hovered, setHovered] = useState<string | null>(null);
|
|
440
|
+
const focus = hovered ?? activeId ?? null;
|
|
441
|
+
const parts = stackItems ?? items;
|
|
442
|
+
const total = parts.reduce((acc, item) => acc + (typeof item.value === "number" ? item.value : 0), 0);
|
|
443
|
+
const clickable = typeof onSelect === "function";
|
|
444
|
+
|
|
445
|
+
return (
|
|
446
|
+
<div className={clsx("it-bento-statstrip", className)}>
|
|
447
|
+
<div className="it-bento-statstrip__grid" style={{ ["--it-bento-cols" as string]: Math.min(items.length, 4) }}>
|
|
448
|
+
{items.map((item) => {
|
|
449
|
+
const on = item.id === activeId;
|
|
450
|
+
const Tag = clickable ? "button" : "div";
|
|
451
|
+
return (
|
|
452
|
+
<Tag
|
|
453
|
+
key={item.id}
|
|
454
|
+
type={clickable ? "button" : undefined}
|
|
455
|
+
className={clsx("it-bento-statstrip__item", on && "is-on")}
|
|
456
|
+
style={{ ["--it-bento-c" as string]: item.color ?? "currentColor" } as CSSProperties}
|
|
457
|
+
onClick={clickable ? () => onSelect?.(item.id) : undefined}
|
|
458
|
+
onMouseEnter={() => setHovered(item.id)}
|
|
459
|
+
onMouseLeave={() => setHovered(null)}
|
|
460
|
+
>
|
|
461
|
+
<span className="it-bento-statstrip__label">
|
|
462
|
+
{item.color && <i style={{ background: item.color }} aria-hidden />}
|
|
463
|
+
{item.label}
|
|
464
|
+
</span>
|
|
465
|
+
<span className="it-bento-statstrip__row">
|
|
466
|
+
<span className="it-bento-statstrip__value">{item.value}</span>
|
|
467
|
+
{item.caption && <small className="it-bento-statstrip__caption">{item.caption}</small>}
|
|
468
|
+
</span>
|
|
469
|
+
</Tag>
|
|
470
|
+
);
|
|
471
|
+
})}
|
|
472
|
+
</div>
|
|
473
|
+
|
|
474
|
+
{stack && total > 0 && (
|
|
475
|
+
<div className={clsx("it-bento-statstrip__stack", focus && "is-dim")} aria-hidden>
|
|
476
|
+
{parts
|
|
477
|
+
.filter((item) => typeof item.value === "number" && item.value > 0)
|
|
478
|
+
.map((item) => (
|
|
479
|
+
<i
|
|
480
|
+
key={item.id}
|
|
481
|
+
className={clsx(item.id === focus && "is-on")}
|
|
482
|
+
style={{ width: `${((Number(item.value) || 0) / total) * 100}%`, background: item.color ?? "currentColor" }}
|
|
483
|
+
onMouseEnter={() => setHovered(item.id)}
|
|
484
|
+
onMouseLeave={() => setHovered(null)}
|
|
485
|
+
onClick={clickable ? () => onSelect?.(item.id) : undefined}
|
|
486
|
+
/>
|
|
487
|
+
))}
|
|
488
|
+
</div>
|
|
489
|
+
)}
|
|
490
|
+
</div>
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
|
|
407
494
|
export interface ITBentoPillProps {
|
|
408
495
|
/** Contenido de la píldora (texto corto). */
|
|
409
496
|
children: ReactNode;
|
package/src/index.css
CHANGED
|
@@ -875,3 +875,142 @@
|
|
|
875
875
|
text-overflow: ellipsis;
|
|
876
876
|
white-space: nowrap;
|
|
877
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
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
ITBentoFeed,
|
|
23
23
|
ITBentoPill,
|
|
24
24
|
ITBentoPillRow,
|
|
25
|
+
ITBentoStatStrip,
|
|
25
26
|
ITBentoLive,
|
|
26
27
|
useITBentoCountUp,
|
|
27
28
|
} from "./components/organisms/bento/bento";
|
|
@@ -267,7 +268,7 @@ export {
|
|
|
267
268
|
// Components
|
|
268
269
|
ITAccordion,
|
|
269
270
|
ITBentoGrid, ITBentoTile, ITBentoGauge, ITBentoWaves, ITBentoSpark, ITBentoSegments,
|
|
270
|
-
ITBentoWeekBars, ITBentoDonut, ITBentoFeed, ITBentoPill, ITBentoPillRow, ITBentoLive, useITBentoCountUp,
|
|
271
|
+
ITBentoWeekBars, ITBentoDonut, ITBentoFeed, ITBentoPill, ITBentoPillRow, ITBentoLive, ITBentoStatStrip, useITBentoCountUp,
|
|
271
272
|
ITAlert, ITAvatar, ITBadget, ITBreadcrumbs, ITButton,
|
|
272
273
|
ITCalendar,
|
|
273
274
|
ITCard, ITCheckbox, ITChip, ITChipInput, ITConfirmDialog, ITDataTable, ITDatePicker,
|