@ricsam/react-spreadsheets 0.0.13 → 0.0.15
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/README.md +22 -1
- package/dist/cjs/lib.cjs +673 -482
- package/dist/cjs/lib.cjs.map +6 -5
- package/dist/cjs/package.json +1 -1
- package/dist/mjs/lib.mjs +665 -474
- package/dist/mjs/lib.mjs.map +6 -5
- package/dist/mjs/package.json +1 -1
- package/dist/styles.css +201 -32
- package/dist/types/spreadsheet/spreadsheet.d.ts +3 -0
- package/dist/types/workbook/sheet-navigation.d.ts +15 -0
- package/package.json +2 -2
package/dist/mjs/package.json
CHANGED
package/dist/styles.css
CHANGED
|
@@ -563,38 +563,6 @@
|
|
|
563
563
|
color: var(--_rsp-text);
|
|
564
564
|
}
|
|
565
565
|
|
|
566
|
-
.rsp-sheet-tab.rsp-sheet-tab-active {
|
|
567
|
-
background: var(--_rsp-accent);
|
|
568
|
-
border-color: transparent;
|
|
569
|
-
color: var(--_rsp-accent-contrast);
|
|
570
|
-
font-weight: 600;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
/* Icon buttons inside the active tab must read against the accent fill. */
|
|
574
|
-
.rsp-sheet-tab.rsp-sheet-tab-active .rsp-icon-button {
|
|
575
|
-
color: var(--_rsp-accent-contrast);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
.rsp-sheet-tab.rsp-sheet-tab-active .rsp-icon-button:hover {
|
|
579
|
-
background: rgba(255, 255, 255, 0.22);
|
|
580
|
-
color: var(--_rsp-accent-contrast);
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
/* Per-tab action buttons reveal on hover / when the tab is active. */
|
|
584
|
-
.rsp-sheet-tab .sheet-tab-actions {
|
|
585
|
-
display: flex;
|
|
586
|
-
align-items: center;
|
|
587
|
-
gap: 2px;
|
|
588
|
-
opacity: 0;
|
|
589
|
-
transition: opacity var(--_rsp-transition);
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
.rsp-sheet-tab:hover .sheet-tab-actions,
|
|
593
|
-
.rsp-sheet-tab.rsp-sheet-tab-active .sheet-tab-actions,
|
|
594
|
-
.rsp-sheet-tab:focus-within .sheet-tab-actions {
|
|
595
|
-
opacity: 1;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
566
|
.rsp-sheet-tab-input {
|
|
599
567
|
font: inherit;
|
|
600
568
|
color: var(--_rsp-text);
|
|
@@ -678,6 +646,207 @@
|
|
|
678
646
|
font-variant-numeric: tabular-nums;
|
|
679
647
|
}
|
|
680
648
|
|
|
649
|
+
/* Sheet navigation stays outside the virtualized grid. */
|
|
650
|
+
.rsp-sheet-navigation {
|
|
651
|
+
position: relative;
|
|
652
|
+
flex: none;
|
|
653
|
+
min-width: 0;
|
|
654
|
+
}
|
|
655
|
+
.rsp-workbook,
|
|
656
|
+
.rsp-workbook-body {
|
|
657
|
+
min-width: 0;
|
|
658
|
+
}
|
|
659
|
+
.rsp-workbook-name {
|
|
660
|
+
overflow: hidden;
|
|
661
|
+
text-overflow: ellipsis;
|
|
662
|
+
}
|
|
663
|
+
.rsp-sheet-tabs-scroll {
|
|
664
|
+
flex: 1;
|
|
665
|
+
min-width: 0;
|
|
666
|
+
padding: 3px;
|
|
667
|
+
}
|
|
668
|
+
.rsp-sheet-tab {
|
|
669
|
+
flex: none;
|
|
670
|
+
max-width: 180px;
|
|
671
|
+
min-height: 32px;
|
|
672
|
+
font-family: inherit;
|
|
673
|
+
}
|
|
674
|
+
.rsp-sheet-tab span {
|
|
675
|
+
overflow: hidden;
|
|
676
|
+
text-overflow: ellipsis;
|
|
677
|
+
}
|
|
678
|
+
.rsp-sheet-tab.rsp-sheet-tab-active {
|
|
679
|
+
background: var(--_rsp-bg);
|
|
680
|
+
color: var(--_rsp-text);
|
|
681
|
+
border-color: var(--_rsp-border);
|
|
682
|
+
box-shadow: inset 0 -2px var(--_rsp-accent);
|
|
683
|
+
font-weight: 600;
|
|
684
|
+
}
|
|
685
|
+
.rsp-sheet-navigation .rsp-icon-button {
|
|
686
|
+
width: 32px;
|
|
687
|
+
height: 32px;
|
|
688
|
+
flex: none;
|
|
689
|
+
color: var(--_rsp-header-text);
|
|
690
|
+
}
|
|
691
|
+
.rsp-add-sheet-button {
|
|
692
|
+
width: 32px;
|
|
693
|
+
height: 32px;
|
|
694
|
+
padding: 0;
|
|
695
|
+
flex: none;
|
|
696
|
+
border-style: solid;
|
|
697
|
+
}
|
|
698
|
+
.rsp-zoom-controls {
|
|
699
|
+
flex: none;
|
|
700
|
+
margin-inline-start: auto;
|
|
701
|
+
padding-inline-start: 6px;
|
|
702
|
+
border-inline-start: 1px solid var(--_rsp-border);
|
|
703
|
+
}
|
|
704
|
+
.rsp-zoom-reset {
|
|
705
|
+
border: 0;
|
|
706
|
+
background: transparent;
|
|
707
|
+
cursor: pointer;
|
|
708
|
+
min-height: 32px;
|
|
709
|
+
color: var(--_rsp-header-text);
|
|
710
|
+
}
|
|
711
|
+
.rsp-sheet-navigation button:focus-visible {
|
|
712
|
+
outline: 2px solid var(--_rsp-accent);
|
|
713
|
+
outline-offset: -2px;
|
|
714
|
+
}
|
|
715
|
+
.rsp-sheet-rename {
|
|
716
|
+
display: flex;
|
|
717
|
+
flex-wrap: wrap;
|
|
718
|
+
align-items: center;
|
|
719
|
+
gap: 8px;
|
|
720
|
+
padding: 10px;
|
|
721
|
+
border-top: 1px solid var(--_rsp-border);
|
|
722
|
+
background: var(--_rsp-header-bg);
|
|
723
|
+
font-size: 12px;
|
|
724
|
+
}
|
|
725
|
+
.rsp-sheet-rename input {
|
|
726
|
+
flex: 1;
|
|
727
|
+
width: 120px;
|
|
728
|
+
min-width: 80px;
|
|
729
|
+
min-height: 32px;
|
|
730
|
+
box-sizing: border-box;
|
|
731
|
+
box-shadow: none;
|
|
732
|
+
}
|
|
733
|
+
.rsp-sheet-rename input:focus {
|
|
734
|
+
outline: 2px solid var(--_rsp-accent);
|
|
735
|
+
outline-offset: 1px;
|
|
736
|
+
}
|
|
737
|
+
.rsp-sheet-action {
|
|
738
|
+
border: 1px solid var(--_rsp-border);
|
|
739
|
+
border-radius: var(--_rsp-radius-sm);
|
|
740
|
+
padding: 6px 10px;
|
|
741
|
+
min-height: 32px;
|
|
742
|
+
background: var(--_rsp-bg);
|
|
743
|
+
color: var(--_rsp-text);
|
|
744
|
+
cursor: pointer;
|
|
745
|
+
font: inherit;
|
|
746
|
+
}
|
|
747
|
+
.rsp-sheet-action:hover {
|
|
748
|
+
background: var(--_rsp-hover-bg);
|
|
749
|
+
}
|
|
750
|
+
.rsp-sheet-error {
|
|
751
|
+
padding: 8px 10px;
|
|
752
|
+
color: var(--_rsp-danger);
|
|
753
|
+
background: var(--_rsp-bg);
|
|
754
|
+
font-size: 12px;
|
|
755
|
+
overflow-wrap: anywhere;
|
|
756
|
+
}
|
|
757
|
+
.rsp-sheet-menu {
|
|
758
|
+
position: absolute;
|
|
759
|
+
inset-inline-end: 10px;
|
|
760
|
+
bottom: calc(100% + 4px);
|
|
761
|
+
z-index: 50;
|
|
762
|
+
width: 220px;
|
|
763
|
+
max-width: calc(100% - 20px);
|
|
764
|
+
padding: 4px;
|
|
765
|
+
box-sizing: border-box;
|
|
766
|
+
background: var(--_rsp-bg);
|
|
767
|
+
color: var(--_rsp-text);
|
|
768
|
+
border: 1px solid var(--_rsp-border);
|
|
769
|
+
border-radius: var(--_rsp-radius-sm);
|
|
770
|
+
font-size: 12px;
|
|
771
|
+
}
|
|
772
|
+
.rsp-sheet-menu button {
|
|
773
|
+
display: flex;
|
|
774
|
+
justify-content: space-between;
|
|
775
|
+
align-items: center;
|
|
776
|
+
gap: 12px;
|
|
777
|
+
width: 100%;
|
|
778
|
+
min-height: 36px;
|
|
779
|
+
border: 0;
|
|
780
|
+
border-radius: var(--_rsp-radius-sm);
|
|
781
|
+
padding: 8px;
|
|
782
|
+
font: inherit;
|
|
783
|
+
text-align: start;
|
|
784
|
+
color: inherit;
|
|
785
|
+
background: transparent;
|
|
786
|
+
cursor: pointer;
|
|
787
|
+
}
|
|
788
|
+
.rsp-sheet-menu button:hover,
|
|
789
|
+
.rsp-sheet-menu button:focus-visible {
|
|
790
|
+
background: var(--_rsp-hover-bg);
|
|
791
|
+
}
|
|
792
|
+
.rsp-sheet-menu .rsp-sheet-delete {
|
|
793
|
+
color: var(--_rsp-danger);
|
|
794
|
+
}
|
|
795
|
+
.rsp-sheet-menu button[aria-disabled="true"] {
|
|
796
|
+
color: var(--_rsp-muted-text);
|
|
797
|
+
cursor: not-allowed;
|
|
798
|
+
}
|
|
799
|
+
.rsp-sheet-menu-name {
|
|
800
|
+
padding: 8px;
|
|
801
|
+
overflow: hidden;
|
|
802
|
+
text-overflow: ellipsis;
|
|
803
|
+
white-space: nowrap;
|
|
804
|
+
font-weight: 600;
|
|
805
|
+
}
|
|
806
|
+
.rsp-sheet-menu-hint {
|
|
807
|
+
padding: 4px 8px 8px;
|
|
808
|
+
color: var(--_rsp-header-text);
|
|
809
|
+
}
|
|
810
|
+
.rsp-sr-only {
|
|
811
|
+
position: absolute;
|
|
812
|
+
width: 1px;
|
|
813
|
+
height: 1px;
|
|
814
|
+
padding: 0;
|
|
815
|
+
margin: -1px;
|
|
816
|
+
overflow: hidden;
|
|
817
|
+
clip-path: inset(50%);
|
|
818
|
+
white-space: nowrap;
|
|
819
|
+
border: 0;
|
|
820
|
+
}
|
|
821
|
+
@media (pointer: coarse) {
|
|
822
|
+
.rsp-sheet-navigation button {
|
|
823
|
+
min-height: 44px;
|
|
824
|
+
}
|
|
825
|
+
.rsp-sheet-navigation .rsp-icon-button,
|
|
826
|
+
.rsp-add-sheet-button {
|
|
827
|
+
min-width: 44px;
|
|
828
|
+
}
|
|
829
|
+
.rsp-sheet-rename input {
|
|
830
|
+
font-size: 16px;
|
|
831
|
+
min-height: 44px;
|
|
832
|
+
}
|
|
833
|
+
.rsp-sheet-tabs {
|
|
834
|
+
flex-wrap: wrap;
|
|
835
|
+
}
|
|
836
|
+
.rsp-sheet-tabs-scroll {
|
|
837
|
+
flex-basis: calc(100% - 120px);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
@media (prefers-reduced-motion: reduce) {
|
|
841
|
+
.rsp-sheet-navigation *,
|
|
842
|
+
.rsp-sheet-navigation *::before,
|
|
843
|
+
.rsp-sheet-navigation *::after {
|
|
844
|
+
transition: none;
|
|
845
|
+
animation: none;
|
|
846
|
+
scroll-behavior: auto;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
|
|
681
850
|
/* Formula bar ------------------------------------------------------ */
|
|
682
851
|
|
|
683
852
|
.rsp-formula-bar {
|
|
@@ -42,6 +42,9 @@ export interface SpreadsheetProps {
|
|
|
42
42
|
'aria-describedby'?: string;
|
|
43
43
|
cellData?: Map<string, SerializedCellValue>;
|
|
44
44
|
onCellDataChange?: (data: Map<string, SerializedCellValue>) => void;
|
|
45
|
+
/** Changed cells only; undefined deletes. Takes precedence over onCellDataChange.
|
|
46
|
+
* Controlled consumers must synchronously accept or throw to reject the patch. */
|
|
47
|
+
onCellDataPatch?: (patch: Map<string, SerializedCellValue>) => void;
|
|
45
48
|
onCellDataChangeError?: (error: unknown) => void;
|
|
46
49
|
/** Finite number of rows. Omit for an unbounded sheet. */
|
|
47
50
|
rowCount?: number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SheetNavigationProps {
|
|
3
|
+
sheets: string[];
|
|
4
|
+
activeSheet: string;
|
|
5
|
+
workbookName: string;
|
|
6
|
+
panelId?: string;
|
|
7
|
+
onSelect: (name: string) => void;
|
|
8
|
+
onAdd: () => void;
|
|
9
|
+
onRename: (oldName: string, newName: string) => void;
|
|
10
|
+
onDelete: (name: string) => void;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/** Workbook chrome only: never takes over the grid's keyboard events. */
|
|
14
|
+
export declare function SheetNavigation({ sheets, activeSheet, workbookName, panelId, onSelect, onAdd, onRename, onDelete, children }: SheetNavigationProps): React.JSX.Element;
|
|
15
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ricsam/react-spreadsheets",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "Headless-friendly React spreadsheet and workbook components: infinite virtualized grid, zoom, resizing, clipboard, fill handles and formula-engine bindings.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/mjs/lib.mjs",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@happy-dom/global-registrator": "^18.0.1",
|
|
57
|
-
"@ricsam/formula-engine": "
|
|
57
|
+
"@ricsam/formula-engine": "0.3.7",
|
|
58
58
|
"@ricsam/selection-manager": "^0.0.33",
|
|
59
59
|
"@testing-library/react": "^16.3.0",
|
|
60
60
|
"@types/bun": "latest",
|