@vinorcola/dynamic-table 1.0.0 → 1.0.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.
@@ -1,4 +1,4 @@
1
- import type { BaseItem, Dictionary, ItemKey, Primitive } from ".";
1
+ import type { BaseItem, Dictionary, ItemKey, Primitive } from "./index.js";
2
2
  export type ValueResolver<Item extends BaseItem, Value extends Primitive> = (item: Item) => Value | null;
3
3
  interface BaseColumneDefinition<Value extends Primitive> {
4
4
  readonly title: string;
@@ -1,8 +1,8 @@
1
1
  import { type ReactNode } from "react";
2
- import type { InternalColumn, InternalColumns } from "./useColumns";
3
- import { type FilterType } from "./useFilterState";
4
- import { type InternalSortableColumn } from "./useSortState";
5
- import type { BaseItem, Dictionary, Primitive } from ".";
2
+ import type { BaseItem, Dictionary, Primitive } from "./index.js";
3
+ import type { InternalColumn, InternalColumns } from "./useColumns.js";
4
+ import { type FilterType } from "./useFilterState.js";
5
+ import { type InternalSortableColumn } from "./useSortState.js";
6
6
  export interface Props {
7
7
  children?: ReactNode;
8
8
  }
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import cx from "@vinorcola/utils/classNames";
3
3
  import { useEffect, useMemo } from "react";
4
- import { AscSortIcon, CheckedIcon, CloseIcon, ColumnsIcon, DescSortIcon, FilterIcon, HideIcon, NextIcon, PreviousIcon, SearchIcon, SortIcon, UncheckedIcon, } from "./Icon";
5
- import { usePopup } from "./UniquePopupProvider";
6
- import { isSearchable, isSelectable } from "./useFilterState";
7
- import { isMaskable } from "./useMaskableColumns";
8
- import { isSortable } from "./useSortState";
9
- import DynamicTable from ".";
4
+ import { AscSortIcon, CheckedIcon, CloseIcon, ColumnsIcon, DescSortIcon, FilterIcon, HideIcon, NextIcon, PreviousIcon, SearchIcon, SortIcon, UncheckedIcon, } from "./Icon.js";
5
+ import { usePopup } from "./UniquePopupProvider.js";
6
+ import DynamicTable from "./index.js";
7
+ import { isSearchable, isSelectable } from "./useFilterState.js";
8
+ import { isMaskable } from "./useMaskableColumns.js";
9
+ import { isSortable } from "./useSortState.js";
10
10
  export function TableContainer(props) {
11
11
  return _jsx("div", { children: props.children });
12
12
  }
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from "react";
2
- import type { Primitive } from ".";
2
+ import type { Primitive } from "./index.ts";
3
3
  export interface DictionaryEntry {
4
4
  title: string;
5
5
  prepend?: ReactNode;
package/lib/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { Key as ReactKey } from "react";
2
- import type { ColumnDefinition } from "./ColumnDefinition";
3
- import { type FilterState } from "./useFilterState";
4
- import type { ColumnsMaskState } from "./useMaskableColumns";
5
- import { type PaginationState } from "./usePagination";
6
- import { type SortState } from "./useSortState";
2
+ import type { ColumnDefinition } from "./ColumnDefinition.js";
3
+ import { type FilterState } from "./useFilterState.js";
4
+ import type { ColumnsMaskState } from "./useMaskableColumns.js";
5
+ import { type PaginationState } from "./usePagination.js";
6
+ import { type SortState } from "./useSortState.js";
7
7
  export type Primitive = boolean | Date | number | string;
8
8
  export type BaseItem = Record<string, any> & {
9
9
  readonly id: ReactKey;
@@ -26,27 +26,27 @@ interface Props<Item extends BaseItem> {
26
26
  }
27
27
  declare function DynamicTable<Item extends BaseItem>(props: Props<Item>): import("react/jsx-runtime").JSX.Element;
28
28
  declare namespace DynamicTable {
29
- var TableContainer: typeof import("./DefaultTheme").TableContainer;
30
- var Controller: typeof import("./DefaultTheme").Controller;
31
- var ColumnsPopup: typeof import("./DefaultTheme").ColumnsPopup;
32
- var Table: typeof import("./DefaultTheme").Table;
33
- var HeaderContainer: typeof import("./DefaultTheme").HeaderContainer;
34
- var HeaderLine: typeof import("./DefaultTheme").HeaderLine;
35
- var Header: typeof import("./DefaultTheme").Header;
36
- var HeaderActions: typeof import("./DefaultTheme").HeaderActions;
37
- var HeaderStatus: typeof import("./DefaultTheme").HeaderStatus;
38
- var SearchFilterPopup: typeof import("./DefaultTheme").SearchFilterPopup;
39
- var SelectionFilterPopup: typeof import("./DefaultTheme").SelectionFilterPopup;
40
- var BodyContainer: typeof import("./DefaultTheme").BodyContainer;
41
- var Line: typeof import("./DefaultTheme").Line;
42
- var Cell: typeof import("./DefaultTheme").Cell;
43
- var ClickableCell: typeof import("./DefaultTheme").ClickableCell;
44
- var FooterContainer: typeof import("./DefaultTheme").FooterContainer;
45
- var ItemsPerPageSelector: typeof import("./DefaultTheme").ItemsPerPageSelector;
46
- var PageSelector: typeof import("./DefaultTheme").PageSelector;
47
- var PageButton: typeof import("./DefaultTheme").PageButton;
48
- var Button: typeof import("./DefaultTheme").Button;
49
- var Popup: typeof import("./DefaultTheme").Popup;
50
- var Loader: typeof import("./DefaultTheme").Loader;
29
+ var TableContainer: typeof import("./DefaultTheme.js").TableContainer;
30
+ var Controller: typeof import("./DefaultTheme.js").Controller;
31
+ var ColumnsPopup: typeof import("./DefaultTheme.js").ColumnsPopup;
32
+ var Table: typeof import("./DefaultTheme.js").Table;
33
+ var HeaderContainer: typeof import("./DefaultTheme.js").HeaderContainer;
34
+ var HeaderLine: typeof import("./DefaultTheme.js").HeaderLine;
35
+ var Header: typeof import("./DefaultTheme.js").Header;
36
+ var HeaderActions: typeof import("./DefaultTheme.js").HeaderActions;
37
+ var HeaderStatus: typeof import("./DefaultTheme.js").HeaderStatus;
38
+ var SearchFilterPopup: typeof import("./DefaultTheme.js").SearchFilterPopup;
39
+ var SelectionFilterPopup: typeof import("./DefaultTheme.js").SelectionFilterPopup;
40
+ var BodyContainer: typeof import("./DefaultTheme.js").BodyContainer;
41
+ var Line: typeof import("./DefaultTheme.js").Line;
42
+ var Cell: typeof import("./DefaultTheme.js").Cell;
43
+ var ClickableCell: typeof import("./DefaultTheme.js").ClickableCell;
44
+ var FooterContainer: typeof import("./DefaultTheme.js").FooterContainer;
45
+ var ItemsPerPageSelector: typeof import("./DefaultTheme.js").ItemsPerPageSelector;
46
+ var PageSelector: typeof import("./DefaultTheme.js").PageSelector;
47
+ var PageButton: typeof import("./DefaultTheme.js").PageButton;
48
+ var Button: typeof import("./DefaultTheme.js").Button;
49
+ var Popup: typeof import("./DefaultTheme.js").Popup;
50
+ var Loader: typeof import("./DefaultTheme.js").Loader;
51
51
  }
52
52
  export default DynamicTable;
package/lib/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { BodyContainer, Button, Cell, ClickableCell, ColumnsPopup, Controller, FooterContainer, Header, HeaderActions, HeaderContainer, HeaderLine, HeaderStatus, ItemsPerPageSelector, Line, Loader, PageButton, PageSelector, Popup, SearchFilterPopup, SelectionFilterPopup, Table, TableContainer, } from "./DefaultTheme";
3
- import UniquePopupProvider from "./UniquePopupProvider";
4
- import useColumns from "./useColumns";
5
- import useFilterState from "./useFilterState";
6
- import useItems from "./useItems";
7
- import useMaskableColumns from "./useMaskableColumns";
8
- import usePagination from "./usePagination";
9
- import useSortState from "./useSortState";
2
+ import { BodyContainer, Button, Cell, ClickableCell, ColumnsPopup, Controller, FooterContainer, Header, HeaderActions, HeaderContainer, HeaderLine, HeaderStatus, ItemsPerPageSelector, Line, Loader, PageButton, PageSelector, Popup, SearchFilterPopup, SelectionFilterPopup, Table, TableContainer, } from "./DefaultTheme.js";
3
+ import UniquePopupProvider from "./UniquePopupProvider.js";
4
+ import useColumns from "./useColumns.js";
5
+ import useFilterState from "./useFilterState.js";
6
+ import useItems from "./useItems.js";
7
+ import useMaskableColumns from "./useMaskableColumns.js";
8
+ import usePagination from "./usePagination.js";
9
+ import useSortState from "./useSortState.js";
10
10
  export { default as Dictionary } from "./Dictionary";
11
11
  export default function DynamicTable(props) {
12
12
  const columns = useColumns(props.columns);
@@ -1,4 +1,4 @@
1
- import type { BaseItem, ColumnDefinition, Dictionary, Primitive, ValueResolver } from ".";
1
+ import type { BaseItem, ColumnDefinition, Dictionary, Primitive, ValueResolver } from "./index.js";
2
2
  /**
3
3
  * A column that is loading a dictionary.
4
4
  */
package/lib/useColumns.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { replaceElement } from "@vinorcola/utils/list";
2
2
  import { useEffect, useRef, useState } from "react";
3
- import { isAccessorColumnDefinition } from "./ColumnDefinition";
3
+ import { isAccessorColumnDefinition } from "./ColumnDefinition.js";
4
4
  /**
5
5
  * Transform a list of column definitions into a list of internal columns.
6
6
  *
@@ -1,6 +1,6 @@
1
- import type { InternalColumn, InternalColumns } from "./useColumns";
2
- import type { InternalItems } from "./useItems";
3
- import type { BaseItem, Primitive } from ".";
1
+ import type { BaseItem, Primitive } from "./index.js";
2
+ import type { InternalColumn, InternalColumns } from "./useColumns.js";
3
+ import type { InternalItems } from "./useItems.js";
4
4
  /**
5
5
  * A filter type.
6
6
  */
@@ -56,6 +56,6 @@ export declare function isSelectable<Item extends BaseItem, Value extends Primit
56
56
  */
57
57
  export default function useFilterState<Item extends BaseItem>(columns: InternalColumns<Item>, items: InternalItems<Item>, initialFilterState?: FilterState): {
58
58
  columns: InternalFilterableColumn<Item, Primitive>[];
59
- items: import("./useItems").InternalItem<Item>[];
59
+ items: import("./useItems.js").InternalItem<Item>[];
60
60
  clearFilterState: () => void;
61
61
  };
package/lib/useItems.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type Key, type ReactNode } from "react";
2
- import type { InternalColumns } from "./useColumns";
3
- import type { SortableValue } from "./useSortState";
4
- import type { BaseItem, Primitive } from ".";
2
+ import type { BaseItem, Primitive } from "./index.js";
3
+ import type { InternalColumns } from "./useColumns.js";
4
+ import type { SortableValue } from "./useSortState.js";
5
5
  /**
6
6
  * A value that is loading (waiting for an async column dictionary to be available).
7
7
  */
@@ -1,6 +1,6 @@
1
- import type { InternalColumn } from "./useColumns";
2
- import type { InternalItems } from "./useItems";
3
- import type { BaseItem, Primitive } from ".";
1
+ import type { BaseItem, Primitive } from "./index.js";
2
+ import type { InternalColumn } from "./useColumns.js";
3
+ import type { InternalItems } from "./useItems.js";
4
4
  /**
5
5
  * A complete columns mask state.
6
6
  */
@@ -26,7 +26,7 @@ export default function useMaskableColumns<Item extends BaseItem>(columns: Inter
26
26
  allColumns: InternalMaskableColumn<Item, Primitive>[];
27
27
  columns: InternalMaskableColumn<Item, Primitive>[];
28
28
  items: {
29
- values: import("./useItems").InternalValue[];
29
+ values: import("./useItems.js").InternalValue[];
30
30
  key: import("react").Key;
31
31
  item: Item;
32
32
  target: string | null;
@@ -1,5 +1,5 @@
1
- import type { InternalItems } from "./useItems";
2
- import type { BaseItem } from ".";
1
+ import type { BaseItem } from "./index.js";
2
+ import type { InternalItems } from "./useItems.js";
3
3
  /**
4
4
  * A complete pagination state.
5
5
  */
@@ -13,7 +13,7 @@ export interface PaginationState {
13
13
  * Return pagination state & pagination control as well as items to display on the current page.
14
14
  */
15
15
  export default function usePagination<Item extends BaseItem>(items: InternalItems<Item>, initialPaginationState?: PaginationState): {
16
- items: import("./useItems").InternalItem<Item>[];
16
+ items: import("./useItems.js").InternalItem<Item>[];
17
17
  itemsPerPage: number;
18
18
  onItemsPerPageChange: (itemsPerPage: number) => void;
19
19
  totalPages: number;
@@ -1,6 +1,6 @@
1
- import type { InternalColumn, InternalColumns } from "./useColumns";
2
- import type { InternalItems, InternalItem } from "./useItems";
3
- import type { BaseItem, Primitive } from ".";
1
+ import type { BaseItem, Primitive } from "./index.js";
2
+ import type { InternalColumn, InternalColumns } from "./useColumns.js";
3
+ import type { InternalItems, InternalItem } from "./useItems.js";
4
4
  /**
5
5
  * A sort direction.
6
6
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vinorcola/dynamic-table",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A table to ease the display of a filterable, sortable and paginable dataset.",
5
5
  "keywords": [
6
6
  "table",