caplink-saas-ui-shared-component-library 0.2.5 → 0.3.1

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.
Files changed (58) hide show
  1. package/README.md +5 -1
  2. package/dist/components/spreadsheet/lib/date-formatter.d.ts +1 -0
  3. package/dist/components/spreadsheet/lib/get-alphabet-columns.d.ts +1 -0
  4. package/dist/components/spreadsheet/lib/get-text-width-by-font.d.ts +1 -0
  5. package/dist/components/spreadsheet/lib/indexed-alphabet.d.ts +1 -0
  6. package/dist/components/spreadsheet/lib/normalize-value.d.ts +5 -0
  7. package/dist/components/spreadsheet/lib/one-line-string.d.ts +1 -0
  8. package/dist/components/spreadsheet/lib/text-overflow.d.ts +1 -0
  9. package/dist/components/spreadsheet/lib/use-spreadsheet.d.ts +1 -0
  10. package/dist/components/spreadsheet/model/matrix.d.ts +59 -0
  11. package/dist/components/spreadsheet/model/spreadsheet.d.ts +167 -0
  12. package/dist/components/spreadsheet/ui/cell.d.ts +2 -0
  13. package/dist/components/spreadsheet/ui/containers/index.d.ts +7 -0
  14. package/dist/components/spreadsheet/ui/containers/matrix.d.ts +7 -0
  15. package/dist/components/spreadsheet/ui/containers/root.d.ts +7 -0
  16. package/dist/components/spreadsheet/ui/context.d.ts +4 -0
  17. package/dist/components/spreadsheet/ui/data-editor/boolean.d.ts +3 -0
  18. package/dist/components/spreadsheet/ui/data-editor/date.d.ts +3 -0
  19. package/dist/components/spreadsheet/ui/data-editor/index.d.ts +20 -0
  20. package/dist/components/spreadsheet/ui/data-editor/numeric.d.ts +3 -0
  21. package/dist/components/spreadsheet/ui/data-editor/select.d.ts +7 -0
  22. package/dist/components/spreadsheet/ui/data-editor/text.d.ts +3 -0
  23. package/dist/components/spreadsheet/ui/header.d.ts +1 -0
  24. package/dist/components/spreadsheet/ui/icons/add-row-icon.d.ts +3 -0
  25. package/dist/components/spreadsheet/ui/icons/integer-icon.d.ts +3 -0
  26. package/dist/components/spreadsheet/ui/icons/remove-row-icon.d.ts +3 -0
  27. package/dist/components/spreadsheet/ui/index.d.ts +3 -0
  28. package/dist/components/spreadsheet/ui/indicators/column-indicator.d.ts +11 -0
  29. package/dist/components/spreadsheet/ui/indicators/column-title-indicator.d.ts +9 -0
  30. package/dist/components/spreadsheet/ui/indicators/corner-indicator.d.ts +3 -0
  31. package/dist/components/spreadsheet/ui/indicators/drag-indicator.d.ts +10 -0
  32. package/dist/components/spreadsheet/ui/indicators/row-indicator.d.ts +3 -0
  33. package/dist/components/spreadsheet/ui/rows.d.ts +1 -0
  34. package/dist/components/spreadsheet/ui/start.d.ts +3 -0
  35. package/dist/components/spreadsheet/ui/toolbar.d.ts +1 -0
  36. package/dist/components/tmp/numeric.d.ts +25 -0
  37. package/dist/index.d.ts +4 -74
  38. package/dist/index.es.js +10115 -0
  39. package/dist/index.es.js.map +1 -0
  40. package/dist/index.umd.js +139 -0
  41. package/dist/index.umd.js.map +1 -0
  42. package/dist/shared/lib/cn.d.ts +3 -0
  43. package/dist/shared/lib/move-input-cursor-to-end.d.ts +2 -0
  44. package/dist/shared/lib/read-text-from-clipboard.d.ts +5 -0
  45. package/dist/shared/lib/use-focused.d.ts +3 -0
  46. package/dist/shared/lib/use-select-on-focus.d.ts +3 -0
  47. package/dist/shared/ui/button.d.ts +12 -0
  48. package/dist/shared/ui/dropdown-menu.d.ts +27 -0
  49. package/dist/shared/ui/input.d.ts +5 -0
  50. package/dist/shared/ui/select.d.ts +13 -0
  51. package/dist/shared/ui/tooltip.d.ts +7 -0
  52. package/dist/stories/spreadsheet.stories.d.ts +21 -0
  53. package/dist/types.d.ts +3 -0
  54. package/package.json +46 -35
  55. package/dist/src/index.css +0 -1223
  56. package/dist/src/index.css.map +0 -1
  57. package/dist/src/index.js +0 -12657
  58. package/dist/src/index.js.map +0 -1
package/README.md CHANGED
@@ -48,7 +48,11 @@ An expected component development workflow would be:
48
48
  We use Storybook to develop and test the components. To start the Storybook server, run:
49
49
 
50
50
  ```bash
51
- npm run storybook
51
+ npm run sb:dev
52
+ ```
53
+
54
+ ```bash
55
+ npm run sb:build
52
56
  ```
53
57
 
54
58
  This will start the Storybook server and open a browser window with the Storybook UI. You can use this to develop and test the components.
@@ -0,0 +1 @@
1
+ export declare function dateFormatter(value: string): string | null;
@@ -0,0 +1 @@
1
+ export declare function getAlphabetColumns(range: number): string[];
@@ -0,0 +1 @@
1
+ export declare function getTextWidthByFont(text: string, font?: string): number;
@@ -0,0 +1 @@
1
+ export declare function indexedAlphabet(columns: number): string;
@@ -0,0 +1,5 @@
1
+ import * as Spreadsheet from '../model/spreadsheet';
2
+ export declare function normalizeValue(params: {
3
+ value: unknown;
4
+ dataEditorType: Spreadsheet.DataEditorType;
5
+ }): unknown;
@@ -0,0 +1 @@
1
+ export declare function oneLineString(value: string): boolean;
@@ -0,0 +1 @@
1
+ export declare function textOverflow(text: string, maxWidth: number): boolean;
@@ -0,0 +1 @@
1
+ export declare function useSpreadsheet(): import('../model/spreadsheet').Context;
@@ -0,0 +1,59 @@
1
+ /** A cell cordinates in matrix */
2
+ export type Point = {
3
+ row: number;
4
+ column: number;
5
+ };
6
+ /** Range between two points. */
7
+ export type PointRange = {
8
+ /** The top-left point */
9
+ start: Point;
10
+ /** The bottom-right point */
11
+ end: Point;
12
+ };
13
+ /** Counts of the rows and column in a matrix */
14
+ export type Size = {
15
+ /** Count of the rows in the matrix */
16
+ rows: number;
17
+ /** Count of the columns in the matrix */
18
+ columns: number;
19
+ };
20
+ export type Matrix<T> = Array<Array<T | undefined>>;
21
+ /** Creates an empty matrix with given rows and columns */
22
+ export declare function createEmpty<T>(size: Size, fill?: T): Matrix<T>;
23
+ /** Gets the count of rows of given matrix */
24
+ export declare function getRowsCount(matrix: Matrix<unknown>): number;
25
+ /** Gets the count of columns of given matrix */
26
+ export declare function getColumnsCount(matrix: Matrix<unknown>): number;
27
+ /** Gets the count of rows and columns of given matrix */
28
+ export declare function getSize(matrix: Matrix<unknown>): Size;
29
+ /** Gets the value at row and column of matrix. */
30
+ export declare function getPoint<T>(params: {
31
+ point: Point;
32
+ matrix: Matrix<T>;
33
+ }): T | undefined;
34
+ /** Checks if the source and target point are equal */
35
+ export declare function isSamePoint(source: Point, target: Point): boolean;
36
+ /** Returns whether given point exists in given range */
37
+ export declare function hasPointInRange(pointRange: PointRange, point: Point): boolean;
38
+ /** Determines whether all columns are selected */
39
+ export declare function hasEntireColumns(params: {
40
+ matrix: Matrix<unknown>;
41
+ pointRange: PointRange;
42
+ }): boolean;
43
+ /** Determines which row is entirely selected in given selection */
44
+ export declare function hasEntireRows(params: {
45
+ matrix: Matrix<unknown>;
46
+ pointRange: PointRange;
47
+ row: number;
48
+ }): boolean;
49
+ /** Converts string value into an matrix */
50
+ export declare function parseString(value: string): Matrix<unknown>;
51
+ /**
52
+ * Overlaps a given Matrix B (mB) starting in a specific point into a given Matrix A (mA)
53
+ * Matrix B (mB) always has priority when replacing cell values
54
+ */
55
+ export declare function overlap(params: {
56
+ mA: Matrix<unknown>;
57
+ mB: Matrix<unknown>;
58
+ point: Point;
59
+ }): Matrix<unknown>;
@@ -0,0 +1,167 @@
1
+ import { MouseEvent, PropsWithChildren } from 'react';
2
+
3
+ import type * as Matrix from '../model/matrix';
4
+ export declare const COLUMN_TITLE_CONTAINER_PADDING_X = 16;
5
+ export declare const COLUMN_TITLE_CONTAINER_GAP = 8;
6
+ export declare const COLUMN_TITLE_ICON_WIDTH = 16;
7
+ /** Spreadsheet column initial width */
8
+ export declare const COLUMN_INITIAL_WIDTH: number;
9
+ /** Spreadsheet column max width */
10
+ export declare const COLUMN_MAX_WIDTH: number;
11
+ /** Spreadsheet column min width */
12
+ export declare const COLUMN_MIN_WIDTH: number;
13
+ /** Spreadsheet column title single char length */
14
+ export declare const COLUMN_TITLE_CHAR_LENGTH = 12;
15
+ /** Spreadsheet column title initial height */
16
+ export declare const COLUMN_TITLE_INITIAL_HEIGHT = 36;
17
+ /** Spreadsheet cell initial height */
18
+ export declare const CELL_INITIAL_HEIGHT = 26;
19
+ export declare const NUMERIC_DATA_EDITOR_TYPES: readonly DataEditorType[];
20
+ /** Dimensions of an element */
21
+ export type Dimensions = {
22
+ /** The element's width in pixels */
23
+ width: number;
24
+ /** The element's height in pixels */
25
+ height: number;
26
+ };
27
+ /** Select component item props */
28
+ export type SelectItem = {
29
+ text: string;
30
+ value: string;
31
+ };
32
+ /** The mode of the cell */
33
+ export type Mode = 'edit' | 'readonly' | 'view';
34
+ /** Cell data editor type */
35
+ export type DataEditorType = 'Boolean' | 'String' | 'Select' | 'Date' | 'Integer' | 'Currency' | 'Float' | 'Decimal' | 'Percentage';
36
+ export type DataEditor = {
37
+ mode: Mode;
38
+ /** Data editor current value */
39
+ value?: unknown;
40
+ /** Whether data editor data changes */
41
+ onChange?: ({ data, point }: {
42
+ data: unknown;
43
+ point?: Matrix.Point;
44
+ }) => void;
45
+ /** Whether user paste any value on data editor */
46
+ onPaste?: (point?: Matrix.Point) => void;
47
+ /** Whether user blur current data editor */
48
+ onBlur?: () => void;
49
+ /** Whether user clicks current data editor */
50
+ onClick?: <T>(e: MouseEvent<T>) => void;
51
+ /** Cell mode setter */
52
+ setMode?: (mode: Mode) => void;
53
+ selected?: boolean;
54
+ column: Column;
55
+ width: number;
56
+ coordinates: Matrix.Point;
57
+ };
58
+ export type DataViewer = {
59
+ width: number;
60
+ mode: Mode;
61
+ /** Data viewer current value */
62
+ value?: unknown;
63
+ column: Column;
64
+ coordinates: Matrix.Point;
65
+ selected?: boolean;
66
+ };
67
+ export type ColumnState = {
68
+ /** Whether column is readonly to user */
69
+ readonly?: boolean;
70
+ /** Whether column is visible to user */
71
+ visible?: boolean;
72
+ /** Column width in px */
73
+ width: number;
74
+ };
75
+ export type ColumnSettings = {
76
+ select?: {
77
+ items: Array<SelectItem>;
78
+ };
79
+ numeric?: {
80
+ min?: number;
81
+ max?: number;
82
+ allowNegative?: boolean;
83
+ roundingRule?: string;
84
+ decimalScale?: number;
85
+ currency?: string;
86
+ };
87
+ string?: {
88
+ maskData?: string;
89
+ maskVisible?: boolean;
90
+ charLimit?: number;
91
+ };
92
+ };
93
+ /** Spreadsheet column meta data and settings */
94
+ export type Column = {
95
+ /** Column identifier */
96
+ id: string;
97
+ /** Column name to be displayed */
98
+ name: string;
99
+ /** Column tooltip description */
100
+ description?: string;
101
+ /** Column position */
102
+ position: number;
103
+ /** Column data editor type */
104
+ dataEditorType: DataEditorType;
105
+ /** Alphabet letter by position */
106
+ alphabetLetter?: string;
107
+ /** Column element states */
108
+ state: ColumnState;
109
+ /** Column settings */
110
+ settings?: ColumnSettings;
111
+ };
112
+ /** Initial column params before spreadsheet internal setup */
113
+ export type InitialColumn = Pick<Column, Exclude<keyof Column, 'alphabetLetter' | 'position' | 'width'>>;
114
+ /** Spreadsheet Cell component */
115
+ export type Cell = {
116
+ /** The cell value */
117
+ value?: unknown;
118
+ /** Point coordinates of the cell */
119
+ coordinates: Matrix.Point;
120
+ width: number;
121
+ };
122
+ export type Props = {
123
+ matrix: Matrix.Matrix<unknown>;
124
+ onMatrixChange?: (matrix: Matrix.Matrix<unknown>) => void;
125
+ startingColumns: InitialColumn[];
126
+ /** Defines if user can add or delete rows */
127
+ staticRows?: boolean;
128
+ className?: string;
129
+ };
130
+ export type Context = {
131
+ size: Matrix.Size;
132
+ matrix: Matrix.Matrix<unknown>;
133
+ columns: Column[];
134
+ emptySize: boolean;
135
+ /** Defines if user can add or delete rows */
136
+ staticRows?: boolean;
137
+ hasSomeEntireRow?: boolean;
138
+ /** Whether last row is highlighted */
139
+ highlightLastRow?: boolean;
140
+ pointRange: Matrix.PointRange | null;
141
+ setPointRange: (pointRange: Matrix.PointRange | null) => void;
142
+ containerDimensions: Dimensions;
143
+ setContainerDimensions: (dimensions: Dimensions) => void;
144
+ onPaste: (point: Matrix.Point) => void;
145
+ onChange: (params: {
146
+ data: unknown;
147
+ point: Matrix.Point;
148
+ }) => void;
149
+ onRemoveRow: () => void;
150
+ onSelectRow: (row: number, event?: MouseEvent) => void;
151
+ onSelectCell: (point: Matrix.Point) => void;
152
+ isCellSelected: (point: Matrix.Point) => boolean;
153
+ onInsertNewRow: () => void;
154
+ onColumnResize: (params: {
155
+ width: number;
156
+ position: number;
157
+ }) => void;
158
+ onSelectSpreadsheet: () => void;
159
+ onColumnVisibilityChange: (params: {
160
+ columnId: string;
161
+ visible?: boolean;
162
+ }) => void;
163
+ onRestoreColumnsVisibility: () => void;
164
+ };
165
+ export type ContextProvider = Omit<PropsWithChildren<Props>, 'className'>;
166
+ /** Spreadsheet columns internal states and values setup function */
167
+ export declare function setupColumns(columns: InitialColumn[]): Column[];
@@ -0,0 +1,2 @@
1
+ import * as Spreadsheet from '../model/spreadsheet';
2
+ export declare function Cell(props: Spreadsheet.Cell): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { Matrix } from './matrix';
2
+ import { Root } from './root';
3
+
4
+ export declare const Container: {
5
+ Matrix: typeof Matrix;
6
+ Root: typeof Root;
7
+ };
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ type MatrixProps = PropsWithChildren<{
4
+ className?: string;
5
+ }>;
6
+ export declare function Matrix(props: MatrixProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ type RootProps = PropsWithChildren<{
4
+ className?: string;
5
+ }>;
6
+ export declare function Root(props: RootProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import * as Spreadsheet from '../model/spreadsheet';
3
+ export declare const SpreadsheetContext: import('react').Context<Spreadsheet.Context | null>;
4
+ export declare function SpreadsheetContextProvider(props: Spreadsheet.ContextProvider): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type * as Spreadsheet from '../../model/spreadsheet';
2
+ export declare function BooleanDataEditor(props: Spreadsheet.DataEditor): import("react/jsx-runtime").JSX.Element;
3
+ export declare function BooleanDataViewer(params: Spreadsheet.DataViewer): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type * as Spreadsheet from '../../model/spreadsheet';
2
+ export declare function DateDataEditor(props: Spreadsheet.DataEditor): import("react/jsx-runtime").JSX.Element;
3
+ export declare function DateDataViewer(props: Spreadsheet.DataViewer): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { BooleanDataEditor, BooleanDataViewer } from './boolean';
2
+ import { DateDataEditor, DateDataViewer } from './date';
3
+ import { NumericDataViewer, NumericEditor } from './numeric';
4
+ import { SelectDataEditor, SelectDataViewer } from './select';
5
+ import { TextDataEditor, TextDataViewer } from './text';
6
+
7
+ export declare const DataEditor: {
8
+ Date: typeof DateDataEditor;
9
+ Text: typeof TextDataEditor;
10
+ Boolean: typeof BooleanDataEditor;
11
+ Numeric: typeof NumericEditor;
12
+ Select: typeof SelectDataEditor;
13
+ };
14
+ export declare const DataViewer: {
15
+ Date: typeof DateDataViewer;
16
+ Text: typeof TextDataViewer;
17
+ Boolean: typeof BooleanDataViewer;
18
+ Numeric: typeof NumericDataViewer;
19
+ Select: typeof SelectDataViewer;
20
+ };
@@ -0,0 +1,3 @@
1
+ import type * as Spreadsheet from '../../model/spreadsheet';
2
+ export declare function NumericEditor(props: Spreadsheet.DataEditor): import("react/jsx-runtime").JSX.Element;
3
+ export declare function NumericDataViewer(props: Spreadsheet.DataViewer): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import type * as Spreadsheet from '../../model/spreadsheet';
2
+ export declare function SelectDataEditor(props: {
3
+ items: Array<Spreadsheet.SelectItem>;
4
+ } & Spreadsheet.DataEditor): import("react/jsx-runtime").JSX.Element;
5
+ export declare function SelectDataViewer(props: {
6
+ items: Array<Spreadsheet.SelectItem>;
7
+ } & Spreadsheet.DataViewer): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import * as Spreadsheet from '../../model/spreadsheet';
2
+ export declare function TextDataEditor(props: Spreadsheet.DataEditor): import("react/jsx-runtime").JSX.Element;
3
+ export declare function TextDataViewer(props: Spreadsheet.DataViewer): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function Header(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { SVGProps } from 'react';
2
+
3
+ export declare function AddRowIcon(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { SVGProps } from 'react';
2
+
3
+ export declare function IntegerIcon(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { SVGProps } from 'react';
2
+
3
+ export declare function RemoveRowIcon(props: SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { Props } from '../model/spreadsheet';
2
+
3
+ export declare function Spreadsheet(props: Props): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ import * as Spreadsheet from '../../model/spreadsheet';
4
+ type ColumnIndicatorProps = PropsWithChildren<{
5
+ className?: string;
6
+ column: Spreadsheet.Column;
7
+ visible?: boolean;
8
+ width: number;
9
+ }>;
10
+ export declare function ColumnIndicator(props: ColumnIndicatorProps): import("react/jsx-runtime").JSX.Element | null;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ import * as Spreadsheet from '../../model/spreadsheet';
2
+ type ColumnTitleIndicatorProps = {
3
+ className?: string;
4
+ column: Spreadsheet.Column;
5
+ width: number;
6
+ visible?: boolean;
7
+ };
8
+ export declare function ColumnTitleIndicator({ column, width, visible }: ColumnTitleIndicatorProps): import("react/jsx-runtime").JSX.Element | null;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare function CornerIndicator({ className }: {
2
+ className?: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { DragEvent } from 'react';
2
+
3
+ type DragIndicatorProps = {
4
+ onDragStart?: (e: DragEvent<HTMLButtonElement>) => void;
5
+ onDrag?: (e: DragEvent<HTMLButtonElement>) => void;
6
+ onDragEnd?: (e: DragEvent<HTMLButtonElement>) => void;
7
+ className?: string;
8
+ };
9
+ export declare function DragIndicator(props: DragIndicatorProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare function RowIndicator({ row }: {
2
+ row: number;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function Rows(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare function Start({ className }: {
2
+ className?: string;
3
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1 @@
1
+ export declare function Toolbar(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { ClipboardEvent, FocusEvent, MouseEvent } from 'react';
2
+ import { Column, DataEditorType } from '../spreadsheet/model/spreadsheet';
3
+
4
+ export type NumericFieldProps = {
5
+ value?: string;
6
+ onChange?: (value?: string | number) => void;
7
+ onBlur?: () => void;
8
+ onFocus?: (e: FocusEvent<HTMLInputElement>) => void;
9
+ onClick?: (e: MouseEvent<HTMLInputElement>) => void;
10
+ onPaste?: (e: ClipboardEvent<HTMLInputElement>) => void;
11
+ tabIndex?: number;
12
+ dataEditorType: DataEditorType;
13
+ settings?: Partial<Column['settings']>;
14
+ disabled?: boolean;
15
+ testid?: string;
16
+ className?: string;
17
+ dataCypress?: string;
18
+ };
19
+ export declare const percentageRatio = 100;
20
+ export declare const percentageScaleToBeDisregarded = 2;
21
+ export declare function getDecimalScale(params: {
22
+ dataEditorType: DataEditorType;
23
+ decimalScale?: number;
24
+ }): number | undefined;
25
+ export declare const NumericField: import('react').ForwardRefExoticComponent<NumericFieldProps & import('react').RefAttributes<HTMLInputElement>>;
package/dist/index.d.ts CHANGED
@@ -1,77 +1,7 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import { Spreadsheet } from './components/spreadsheet/ui';
2
+ import { MatrixTypes, SpreadsheetTypes } from './types';
2
3
 
3
- type Matrix<T> = Array<Array<T | undefined>>;
4
-
5
- declare namespace MatrixConverter {
6
- type Input = {
7
- columns: Column[];
8
- matrix: Matrix<unknown>;
9
- };
10
- type Output = {
11
- value: unknown;
12
- dataEditorType: DataEditorType;
13
- convertedValue?: {
14
- Boolean?: boolean;
15
- Integer?: number;
16
- Currency?: number;
17
- Decimal?: number;
18
- Float?: number;
19
- Percentage?: number;
20
- Date?: number;
21
- Select?: string;
22
- };
23
- };
24
- }
25
-
26
- type SelectItem = {
27
- text: string;
28
- value: string;
29
- };
30
- type DataEditorType = 'Boolean' | 'String' | 'Select' | 'Date' | 'Integer' | 'Currency' | 'Float' | 'Decimal' | 'Percentage';
31
- type Column = {
32
- id: string;
33
- name: string;
34
- description?: string;
35
- width: number;
36
- visible?: boolean;
37
- position: number;
38
- dataEditorType: DataEditorType;
39
- alphabetLetter?: string;
40
- readonly?: boolean;
41
- settings?: {
42
- select?: {
43
- items: Array<SelectItem>;
44
- };
45
- numeric?: {
46
- min?: number;
47
- max?: number;
48
- allowNegative?: boolean;
49
- roundingRule?: string;
50
- decimalPlaces?: number;
51
- currency?: string;
52
- };
53
- string?: {
54
- maskData?: string;
55
- maskVisible?: boolean;
56
- charLimit?: string;
57
- };
58
- };
59
- };
60
- type InitialColumn = Pick<Column, Exclude<keyof Column, 'id' | 'alphabetLetter' | 'position' | 'width'>> & {
61
- width?: number;
62
- };
63
- type Props = {
64
- matrix: Matrix<unknown>;
65
- onMatrixChange?: (matrix: MatrixConverter.Output[][]) => void;
66
- startingColumns: InitialColumn[];
67
- staticRows?: boolean;
68
- className?: string;
69
- };
70
-
71
- declare function Spreadsheet(props: Props): react_jsx_runtime.JSX.Element;
72
-
73
- declare const CapLink: {
4
+ export declare const CapLink: {
74
5
  Spreadsheet: typeof Spreadsheet;
75
6
  };
76
-
77
- export { CapLink };
7
+ export type { MatrixTypes, SpreadsheetTypes };