@veeqo/ui 6.0.1 → 6.2.0

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 (29) hide show
  1. package/dist/components/DataTable/DataTable.d.ts +1 -1
  2. package/dist/components/DataTable/components/ColumnDivider.d.ts +2 -1
  3. package/dist/components/DataTable/hooks/useColumns.d.ts +6 -3
  4. package/dist/components/DataTable/types.d.ts +24 -0
  5. package/dist/components/DataTable/utils/getColumnWidth.d.ts +2 -0
  6. package/dist/components/DateRangePicker/DateRangePicker.d.ts +1 -1
  7. package/dist/components/DateRangePicker/types.d.ts +0 -1
  8. package/dist/components/RangeCalendar/RangeCalendar.d.ts +6 -4
  9. package/dist/components/RangeCalendar/components/CalendarGrid/CalendarGrid.d.ts +10 -0
  10. package/dist/components/RangeCalendar/components/CalendarGrid/index.d.ts +1 -0
  11. package/dist/components/RangeCalendar/components/CalendarGrid/subCalendars/DodecadeCalendar.d.ts +7 -0
  12. package/dist/components/RangeCalendar/components/CalendarGrid/subCalendars/DodecadeCalendar.test.d.ts +1 -0
  13. package/dist/components/RangeCalendar/components/{CalendarGrid.d.ts → CalendarGrid/subCalendars/MonthCalendar.d.ts} +1 -1
  14. package/dist/components/RangeCalendar/components/CalendarGrid/subCalendars/YearCalendar.d.ts +6 -0
  15. package/dist/components/RangeCalendar/components/CalendarGrid/subCalendars/YearCalendar.test.d.ts +1 -0
  16. package/dist/components/RangeCalendar/components/CalendarGrid/subCalendars/index.d.ts +3 -0
  17. package/dist/components/RangeCalendar/components/CalendarGrid/subCalendars/styled.d.ts +1 -0
  18. package/dist/components/RangeCalendar/components/CalendarGrid/subCalendars/utils.d.ts +6 -0
  19. package/dist/components/RangeCalendar/components/CalendarHeader.d.ts +9 -0
  20. package/dist/components/RangeCalendar/components/CalendarHeading.d.ts +7 -0
  21. package/dist/components/RangeCalendar/components/utils.d.ts +6 -0
  22. package/dist/components/RangeCalendar/data/constants.d.ts +4 -0
  23. package/dist/components/RangeCalendar/data/useRangeCalendar.d.ts +14 -0
  24. package/dist/components/RangeCalendar/types.d.ts +5 -0
  25. package/dist/index.esm.js +1 -1
  26. package/dist/index.esm.js.map +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/index.js.map +1 -1
  29. package/package.json +5 -4
@@ -4,7 +4,7 @@ import { ColumnMenu } from './components/ColumnMenu';
4
4
  import { SelectionCell } from './components/SelectionCell';
5
5
  import { SelectionHeader } from './components/SelectionHeader';
6
6
  export declare const DataTable: {
7
- ({ ActionBarSlot, borderMode, columns: initialColumns, emptyState, expandedRowIds, loading, loadingRowCount, onChangeSort, rows, disabledRowIds, selectionMode, selectionState, setExpanded, sortState, stripingMode, enableStickyHeader, resizeableColumns, }: DataTableProps): React.JSX.Element;
7
+ ({ ActionBarSlot, borderMode, columns: initialColumns, emptyState, expandedRowIds, loading, loadingRowCount, onChangeSort, rows, disabledRowIds, selectionMode, selectionState, setExpanded, sortState, stripingMode, enableStickyHeader, resizeableColumns, onResizeColumns, }: DataTableProps): React.JSX.Element;
8
8
  defaultProps: {
9
9
  loading: boolean;
10
10
  loadingRowCount: number;
@@ -3,9 +3,10 @@ import { ColumnId, ColumnWidthHandler } from '../types';
3
3
  export type ColumnDividerProps = {
4
4
  columnId: ColumnId;
5
5
  setColumnWidth?: ColumnWidthHandler;
6
+ minWidth?: number;
6
7
  };
7
8
  export type CalculateWidthProps = {
8
9
  event: MouseEvent;
9
10
  };
10
11
  export declare const ResizerBar: import("styled-components").StyledComponent<"div", any, {}, never>;
11
- export declare const ColumnDivider: ({ columnId, setColumnWidth }: ColumnDividerProps) => React.JSX.Element;
12
+ export declare const ColumnDivider: ({ columnId, setColumnWidth, minWidth }: ColumnDividerProps) => React.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from 'react';
2
- import { ColumnConfigs } from '../types';
3
- export declare function useColumns(columns: ColumnConfigs, tableRef: RefObject<HTMLElement>): {
2
+ import { ColumnConfigs, ColumnWidthState, ResizeColumnData } from '../types';
3
+ export declare function useColumns(columns: ColumnConfigs, tableRef: RefObject<HTMLElement>, onResizeColumns?: (columnWidths: ResizeColumnData) => void): {
4
4
  visible: {
5
5
  width: import("../types").ColumnWidth | import("../types").ColumnWidthBounded | undefined;
6
6
  id: import("../types").ColumnId;
@@ -13,6 +13,7 @@ export declare function useColumns(columns: ColumnConfigs, tableRef: RefObject<H
13
13
  span?: number | undefined;
14
14
  title?: string | undefined;
15
15
  tooltip?: string | undefined;
16
+ resizeMinWidth?: number | undefined;
16
17
  renderCell: import("../types").CellRenderer;
17
18
  renderFooter?: import("../types").FooterRenderer | undefined;
18
19
  renderHeader?: import("../types").HeaderRenderer | undefined;
@@ -30,6 +31,7 @@ export declare function useColumns(columns: ColumnConfigs, tableRef: RefObject<H
30
31
  span?: number | undefined;
31
32
  title?: string | undefined;
32
33
  tooltip?: string | undefined;
34
+ resizeMinWidth?: number | undefined;
33
35
  renderCell: import("../types").CellRenderer;
34
36
  renderFooter?: import("../types").FooterRenderer | undefined;
35
37
  renderHeader?: import("../types").HeaderRenderer | undefined;
@@ -47,10 +49,11 @@ export declare function useColumns(columns: ColumnConfigs, tableRef: RefObject<H
47
49
  span?: number | undefined;
48
50
  title?: string | undefined;
49
51
  tooltip?: string | undefined;
52
+ resizeMinWidth?: number | undefined;
50
53
  renderCell: import("../types").CellRenderer;
51
54
  renderFooter?: import("../types").FooterRenderer | undefined;
52
55
  renderHeader?: import("../types").HeaderRenderer | undefined;
53
56
  renderNestedCell?: import("../types").NestedCellRenderer | undefined;
54
57
  }[];
55
- setColumnWidth: import("../types").ColumnWidthHandler;
58
+ setColumnWidth: ({ columnId, width }: ColumnWidthState) => void;
56
59
  };
@@ -30,6 +30,7 @@ export type ColumnConfig = {
30
30
  title?: string;
31
31
  tooltip?: string;
32
32
  width?: ColumnWidthFixed | ColumnWidthBounded;
33
+ resizeMinWidth?: number;
33
34
  renderCell: CellRenderer;
34
35
  renderFooter?: FooterRenderer;
35
36
  renderHeader?: HeaderRenderer;
@@ -103,26 +104,49 @@ export type SelectionMode = 'single' | 'multiple';
103
104
  export type SelectionState = [RowId[], (rowIds: RowId[]) => void];
104
105
  export type StripingMode = 'row' | 'nested';
105
106
  export interface DataTableProps {
107
+ /** slot for the action bar above the table */
106
108
  ActionBarSlot?: ReactNode;
109
+ /** Type of border for the table */
107
110
  borderMode?: BorderMode;
111
+ /** Columns for the table */
108
112
  columns: ColumnConfigs;
113
+ /** Disable specific rows of the table */
109
114
  disabledRowIds?: Array<RowId>;
115
+ /** Enable sticky header */
110
116
  enableStickyHeader?: boolean;
117
+ /** Render a custom empty state for the table */
111
118
  emptyState?: CustomState;
119
+ /** The rows that can be expanded to show more information */
112
120
  expandedRowIds?: Array<RowId>;
121
+ /** Renders a loading indicator inside the table */
113
122
  loading?: boolean;
123
+ /** Number of rows to display when loading */
114
124
  loadingRowCount?: number;
125
+ /** OnChange handler for sorting functionality */
115
126
  onChangeSort?: SortChangeHandler;
127
+ /** Rows of data to be displayed in the table */
116
128
  rows: TableRows;
129
+ /** Decide how many rows can be selected */
117
130
  selectionMode?: SelectionMode;
131
+ /** The current selected rows */
118
132
  selectionState?: SelectionState;
133
+ /** Handler to expand specific row */
119
134
  setExpanded?: SetExpandedAction;
135
+ /** State of each column's sorting */
120
136
  sortState?: SortState;
137
+ /** Renders alternate row a slightly different colour */
121
138
  stripingMode?: StripingMode;
139
+ /** Enable column resizing */
122
140
  resizeableColumns?: boolean;
141
+ /** Callback for when columns are resized */
142
+ onResizeColumns?: (columnWidths: ResizeColumnData) => void;
123
143
  }
124
144
  export type ColumnWidthsType = {
125
145
  [key: ColumnId]: ColumnWidthType;
126
146
  };
127
147
  export type ColumnWidthType = ColumnWidthFixed | ColumnWidthBounded | undefined;
148
+ export type ResizeColumnData = {
149
+ id: ColumnId;
150
+ columnWidth?: ColumnWidth | ColumnWidthBounded;
151
+ }[];
128
152
  export {};
@@ -0,0 +1,2 @@
1
+ import { ColumnConfigs, ColumnId, ColumnWidthsType } from '../types';
2
+ export declare function getColumnWidth(columnId: ColumnId, columnWidths: ColumnWidthsType, columns: ColumnConfigs): string | number | import("../types").ColumnWidthBounded | undefined;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { DateRangePickerProps } from './types';
3
- export declare const DateRangePicker: ({ className, style, isDisabled, isMultiMonth, showDatePresets, onReset, disabledRanges, selectedPreset, setSelectedPreset, selectedRange, setSelectedRange, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, ...previousPeriodProps }: DateRangePickerProps) => React.JSX.Element;
3
+ export declare const DateRangePicker: ({ className, style, isDisabled, showDatePresets, onReset, disabledRanges, selectedPreset, setSelectedPreset, selectedRange, setSelectedRange, "aria-describedby": ariaDescribedBy, "aria-label": ariaLabel, ...previousPeriodProps }: DateRangePickerProps) => React.JSX.Element;
@@ -7,7 +7,6 @@ export type DateRangePickerProps = {
7
7
  style?: CSSProperties;
8
8
  className?: string;
9
9
  isDisabled?: boolean;
10
- isMultiMonth?: boolean;
11
10
  showDatePresets?: boolean;
12
11
  onReset?: () => void;
13
12
  disabledRanges?: CalendarDate[][];
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
+ import type { DateRange, DateValue, RangeCalendarProps } from 'react-aria-components';
2
3
  import { CalendarDate } from '@internationalized/date';
3
- import type { DateValue, RangeCalendarProps } from 'react-aria-components';
4
- export type CalendarProps = RangeCalendarProps<DateValue> & React.RefAttributes<HTMLDivElement> & {
4
+ export type CalendarProps = RangeCalendarProps<DateValue> & {
5
+ value: DateRange | null | undefined;
6
+ onChange?: RangeCalendarProps<DateValue>['onChange'];
7
+ } & React.RefAttributes<HTMLDivElement> & {
5
8
  'aria-label': string;
6
- isMultiMonth?: boolean;
7
9
  disabledRanges?: CalendarDate[][];
8
10
  disallowWeekends?: boolean;
9
11
  };
10
- export declare const RangeCalendar: ({ disabledRanges, disallowWeekends, isMultiMonth, ...props }: CalendarProps) => React.JSX.Element;
12
+ export declare const RangeCalendar: ({ disabledRanges, disallowWeekends, value, onChange, ...props }: CalendarProps) => React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { CalendarLevel } from '../../types';
3
+ type CalendarGridProps = {
4
+ level: CalendarLevel;
5
+ currentYear: number;
6
+ onFocusYear: (year: number) => () => void;
7
+ onFocusMonth: (month: number) => () => void;
8
+ };
9
+ export declare const CalendarGrid: ({ level, currentYear, onFocusMonth, onFocusYear, }: CalendarGridProps) => React.JSX.Element;
10
+ export {};
@@ -0,0 +1 @@
1
+ export { CalendarGrid } from './CalendarGrid';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ type DodecadeCalendarProps = {
3
+ currentYear: number;
4
+ onFocusYear: (year: number) => () => void;
5
+ };
6
+ export declare const DodecadeCalendar: ({ currentYear, onFocusYear }: DodecadeCalendarProps) => React.JSX.Element;
7
+ export {};
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { CalendarGridProps } from 'react-aria-components';
3
- export declare const CalendarGrid: (props: CalendarGridProps) => React.JSX.Element;
3
+ export declare const MonthCalendar: (props: CalendarGridProps) => React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ type MonthCalendarProps = {
3
+ onFocusMonth: (monthIndex: number) => () => void;
4
+ };
5
+ export declare const YearCalendar: ({ onFocusMonth }: MonthCalendarProps) => React.JSX.Element;
6
+ export {};
@@ -0,0 +1,3 @@
1
+ export { DodecadeCalendar } from './DodecadeCalendar';
2
+ export { YearCalendar } from './YearCalendar';
3
+ export { MonthCalendar } from './MonthCalendar';
@@ -0,0 +1 @@
1
+ export declare const SubCalendarOption: import("styled-components").StyledComponent<"button", any, {}, never>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Gets a range of years around a given year.
3
+ * @param year The year to get the range around.
4
+ * @returns An array of years around the given year.
5
+ */
6
+ export declare const getYearsAround: (year: number) => number[];
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { CalendarLevel } from '../types';
3
+ type CalendarHeaderProps = {
4
+ level: CalendarLevel;
5
+ currentYear: number;
6
+ handleSwitchLevel: () => void;
7
+ };
8
+ export declare const CalendarHeader: ({ level, currentYear, handleSwitchLevel }: CalendarHeaderProps) => React.JSX.Element;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { HeadingProps } from 'react-aria-components';
3
+ import { CalendarLevel } from '../types';
4
+ export declare const CalendarHeading: React.ForwardRefExoticComponent<HeadingProps & {
5
+ level: CalendarLevel;
6
+ currentYear: number;
7
+ } & React.RefAttributes<HTMLHeadingElement>>;
@@ -1,2 +1,8 @@
1
1
  import type { TextStyles } from '../../../theme/modules/text';
2
2
  export declare const getTextStyles: (textTheme: TextStyles) => string;
3
+ /**
4
+ * Replaces all words with the first three letter of that word. All numbers are left alone.
5
+ *
6
+ * @example "January 2023" => "Jan 2023"
7
+ */
8
+ export declare const trimMonths: (dateString: string) => string;
@@ -0,0 +1,4 @@
1
+ import { DateDuration } from '@internationalized/date';
2
+ import { CalendarLevel } from '../types';
3
+ export declare const visibleDurationMap: Record<CalendarLevel, DateDuration>;
4
+ export declare const levelMoveLabelMap: Record<CalendarLevel, string>;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { CalendarDate } from '@internationalized/date';
3
+ import { DateRange, DateValue } from 'react-aria-components';
4
+ import { CalendarLevel } from '../types';
5
+ export declare const useRangeCalendarState: (initialValue: DateRange | null | undefined, disabledRanges: CalendarDate[][], disallowWeekends: boolean) => {
6
+ level: CalendarLevel;
7
+ focusedDate: CalendarDate | import("@internationalized/date").CalendarDateTime | import("@internationalized/date").ZonedDateTime;
8
+ setFocusedDate: import("react").Dispatch<import("react").SetStateAction<CalendarDate | import("@internationalized/date").CalendarDateTime | import("@internationalized/date").ZonedDateTime>>;
9
+ currentYear: number;
10
+ isDateUnavailable: (date: DateValue) => boolean;
11
+ onFocusMonth: (monthIndex: number) => () => void;
12
+ onFocusYear: (year: number) => () => void;
13
+ handleSwitchLevel: () => void;
14
+ };
@@ -0,0 +1,5 @@
1
+ export declare enum CalendarLevel {
2
+ DODECADE = 0,
3
+ YEAR = 1,
4
+ MONTH = 2
5
+ }