@axzydev/axzy_ui_system 1.8.5 → 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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "packageManager": "pnpm@10.34.0",
5
5
  "private": false,
6
6
  "license": "MIT",
7
- "version": "1.8.5",
7
+ "version": "1.8.6",
8
8
  "type": "module",
9
9
  "sideEffects": [
10
10
  "*.css"
@@ -404,6 +404,87 @@ 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
+
407
488
  export interface ITBentoPillProps {
408
489
  /** Contenido de la píldora (texto corto). */
409
490
  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,