@peripheries/core 0.8.0 → 0.10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peripheries/core",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "description": "The shared core lineage: layout, the document kit and the display cells, on the semantic tokens",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -0,0 +1 @@
1
+ export declare function fillHrefTemplate(template: unknown, values: Readonly<Record<string, string | number | undefined | null>>): string | undefined;
@@ -2,6 +2,7 @@ import { type CSSProperties, type ReactElement, type ReactNode } from 'react';
2
2
  import { type FormattableValue, type FormatterToken } from '../../_shared/formatters';
3
3
  import { type Tone } from '../_shared/tone';
4
4
  export type DataTableAlign = 'left' | 'right' | 'center';
5
+ export type DataTableRole = 'title' | 'meta' | 'badge' | 'value';
5
6
  export interface DataTableColumn {
6
7
  key: string;
7
8
  header?: ReactNode;
@@ -9,6 +10,9 @@ export interface DataTableColumn {
9
10
  align?: DataTableAlign;
10
11
  minWidth?: number;
11
12
  format?: DataTableColumnFormat;
13
+ role?: DataTableRole;
14
+ weight?: number;
15
+ width?: number;
12
16
  }
13
17
  export type DataTableColumnFormat = 'date' | 'datetime' | 'raw' | 'unit' | FormatterToken;
14
18
  export interface DataTableCell {
@@ -17,10 +21,14 @@ export interface DataTableCell {
17
21
  }
18
22
  export type DataTableCellInput = DataTableCell | FormattableValue | ReactNode;
19
23
  export interface DataTableRow {
24
+ id?: string | number;
20
25
  cells: ReadonlyArray<DataTableCellInput> | Readonly<Record<string, DataTableCellInput>>;
21
26
  highlighted?: boolean;
22
27
  total?: boolean;
23
28
  unit?: string;
29
+ href?: string;
30
+ leading?: ReactNode;
31
+ actions?: ReactNode;
24
32
  }
25
33
  export interface DataTableProps {
26
34
  title?: string;
@@ -28,8 +36,11 @@ export interface DataTableProps {
28
36
  columns: ReadonlyArray<DataTableColumn>;
29
37
  rows: ReadonlyArray<DataTableRow>;
30
38
  baseProps?: unknown;
39
+ hrefTemplate?: string;
40
+ rowHeadingLevel?: number;
41
+ actionsWidth?: number;
31
42
  className?: string;
32
43
  style?: CSSProperties;
33
44
  }
34
45
  export declare function asWords(value: string): string;
35
- export declare function DataTable({ title, subtitle, columns, rows, baseProps, className, style }: DataTableProps): ReactElement;
46
+ export declare function DataTable({ title, subtitle, columns, rows, baseProps, hrefTemplate, rowHeadingLevel, actionsWidth, className, style }: DataTableProps): ReactElement;
@@ -16,3 +16,8 @@ export declare function useIntent<A extends string>(handler: IntentHandler<A> |
16
16
  available: boolean;
17
17
  clearMessage: () => void;
18
18
  };
19
+ export declare function useConfirmation<V>(): {
20
+ held: V | null;
21
+ ask: (value: V) => void;
22
+ clear: () => void;
23
+ };