dawn-ui-react 1.0.0-alpha.34 → 1.0.0-alpha.35

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 (76) hide show
  1. package/dist/components/alert-dialog/alert-dialog.types.d.ts +2 -1
  2. package/dist/components/color-picker/color-picker-lightness-slider.d.ts +1 -2
  3. package/dist/components/color-picker/color-picker-transparency-slider.d.ts +1 -2
  4. package/dist/components/form/form-context.d.ts +7 -7
  5. package/dist/components/form/form-set-heading.d.ts +1 -1
  6. package/dist/components/form/form.types.d.ts +5 -1
  7. package/dist/components/input-group/index.d.ts +2 -1
  8. package/dist/components/input-group/input-group-input.d.ts +1 -1
  9. package/dist/components/input-group/input-group-separator.d.ts +2 -0
  10. package/dist/components/input-group/input-group.types.d.ts +3 -1
  11. package/dist/components/layer-tree/index.d.ts +12 -7
  12. package/dist/components/layer-tree/layer-tree-body.d.ts +1 -1
  13. package/dist/components/layer-tree/layer-tree-context.d.ts +373 -0
  14. package/dist/components/layer-tree/layer-tree-icon-cell.d.ts +2 -0
  15. package/dist/components/layer-tree/layer-tree-locked-all.d.ts +2 -0
  16. package/dist/components/layer-tree/layer-tree-locked-cell.d.ts +2 -0
  17. package/dist/components/layer-tree/layer-tree-row.d.ts +1 -1
  18. package/dist/components/layer-tree/layer-tree-sort.d.ts +1 -1
  19. package/dist/components/layer-tree/layer-tree-text-cell.d.ts +2 -0
  20. package/dist/components/layer-tree/layer-tree-trigger-cell.d.ts +3 -0
  21. package/dist/components/layer-tree/layer-tree-utils.d.ts +3 -0
  22. package/dist/components/layer-tree/layer-tree-visibility-all.d.ts +2 -0
  23. package/dist/components/layer-tree/layer-tree-visibility-cell.d.ts +2 -0
  24. package/dist/components/layer-tree/layer-tree.d.ts +3 -3
  25. package/dist/components/layer-tree/layer-tree.types.d.ts +87 -17
  26. package/dist/components/number-field/number-field.d.ts +1 -1
  27. package/dist/components/number-field/number-field.types.d.ts +1 -0
  28. package/dist/components/table/index.d.ts +25 -17
  29. package/dist/components/table/table-badge-cell.d.ts +2 -0
  30. package/dist/components/table/table-body.d.ts +2 -0
  31. package/dist/components/table/table-checkbox-cell.d.ts +2 -0
  32. package/dist/components/table/table-context.d.ts +405 -0
  33. package/dist/components/table/table-date-cell.d.ts +2 -0
  34. package/dist/components/table/table-date-filter-chip.d.ts +3 -0
  35. package/dist/components/table/table-date-filter-form.d.ts +3 -0
  36. package/dist/components/table/table-filter-list.d.ts +2 -0
  37. package/dist/components/table/table-filter-menu.d.ts +2 -0
  38. package/dist/components/table/table-header.d.ts +1 -1
  39. package/dist/components/table/table-image-cell.d.ts +2 -0
  40. package/dist/components/table/table-number-cell.d.ts +2 -0
  41. package/dist/components/table/table-number-filter-chip.d.ts +3 -0
  42. package/dist/components/table/table-number-filter-form.d.ts +3 -0
  43. package/dist/components/table/table-select-filter-chip.d.ts +3 -0
  44. package/dist/components/table/table-select-filter-form.d.ts +3 -0
  45. package/dist/components/table/table-select-header.d.ts +2 -0
  46. package/dist/components/table/table-sort-chip.d.ts +3 -0
  47. package/dist/components/table/table-sort-list.d.ts +2 -0
  48. package/dist/components/table/table-sort-menu.d.ts +2 -0
  49. package/dist/components/table/table-string-filter-chip.d.ts +3 -0
  50. package/dist/components/table/table-string-filter-form.d.ts +3 -0
  51. package/dist/components/table/table-text-cell.d.ts +2 -0
  52. package/dist/components/table/table-viewport.d.ts +2 -0
  53. package/dist/components/table/table.types.d.ts +116 -70
  54. package/dist/components/table/table.utils.d.ts +17 -4
  55. package/dist/dawn-ui-react.js +28250 -16465
  56. package/dist/dawn-ui-react.umd.cjs +80 -69
  57. package/dist/hooks/theme/constants.d.ts +1 -1
  58. package/dist/styles.css +7 -7
  59. package/package.json +28 -28
  60. package/dist/components/layer-tree/layer-tree-node-toggle.d.ts +0 -2
  61. package/dist/components/layer-tree/layer-tree-node.d.ts +0 -3
  62. package/dist/components/table/table-body-grid.d.ts +0 -2
  63. package/dist/components/table/table-body-list.d.ts +0 -2
  64. package/dist/components/table/table-change-view.d.ts +0 -2
  65. package/dist/components/table/table-content.d.ts +0 -2
  66. package/dist/components/table/table-data-set-select.d.ts +0 -2
  67. package/dist/components/table/table-data-set-tabs.d.ts +0 -2
  68. package/dist/components/table/table-filter-form.d.ts +0 -3
  69. package/dist/components/table/table-filter.d.ts +0 -2
  70. package/dist/components/table/table-filters.d.ts +0 -2
  71. package/dist/components/table/table-refresh.d.ts +0 -3
  72. package/dist/components/table/table-row-grid.d.ts +0 -2
  73. package/dist/components/table/table-row-list.d.ts +0 -2
  74. package/dist/components/table/table-sort.d.ts +0 -2
  75. package/dist/components/table/table.constants.d.ts +0 -64
  76. package/dist/components/table/table.d.ts +0 -19
@@ -1,32 +1,12 @@
1
+ import { default as z } from 'zod';
1
2
  import { MenuTrigger } from '../menu';
2
- import { SelectTrigger } from '../select';
3
- import { Tabs } from '../tabs';
3
+ import { BadgeProps } from '../badge';
4
4
  import { Button } from '../button';
5
+ import { Checkbox } from '../checkbox';
5
6
  import { inputVariants } from '../input/input.types';
6
- import { filterDefinitions } from './table.constants';
7
- import { Column, ColumnDef, Row, Table as TanstackTable } from '@tanstack/react-table';
7
+ import { features } from './table-context';
8
+ import { Column, RowData } from '@tanstack/react-table';
8
9
  import { VariantProps } from 'class-variance-authority';
9
- import { z } from 'zod';
10
- export type FilterOperator = 'equals' | 'notEquals' | 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'before' | 'after' | 'between' | 'anyOf' | 'noneOf' | 'empty' | 'notEmpty';
11
- export type TextOperator = Extract<FilterOperator, 'equals' | 'notEquals' | 'contains' | 'notContains' | 'startsWith' | 'endsWith'>;
12
- export type SelectOperator = Extract<FilterOperator, 'equals' | 'notEquals' | 'anyOf' | 'noneOf'>;
13
- export type NumberOperator = Extract<FilterOperator, 'equals' | 'notEquals' | 'greaterThan' | 'greaterThanOrEqual' | 'lessThan' | 'lessThanOrEqual' | 'between'>;
14
- export type FilterType = 'text' | 'select' | 'number';
15
- export type TextFilterValue = {
16
- filterOperator: TextOperator;
17
- filterValue: string;
18
- };
19
- export type SelectFilterValue = {
20
- filterOperator: SelectOperator;
21
- filterValue: string | string[];
22
- };
23
- export type NumberFilterValue = {
24
- filterOperator: NumberOperator;
25
- filterValue: number | [number, number];
26
- };
27
- export type TableFilterProps = React.ComponentProps<typeof MenuTrigger> & {
28
- operatorLabels?: Partial<Record<FilterOperator, string>>;
29
- };
30
10
  export type TableFirstPageProps = React.ComponentProps<typeof Button>;
31
11
  export type TableFooterProps = React.ComponentProps<'tfoot'>;
32
12
  export type TableHeaderProps = React.ComponentProps<'thead'>;
@@ -42,26 +22,10 @@ export type TableResultsProps = Omit<React.ComponentProps<'div'>, 'children'> &
42
22
  export type TablePreviousPageProps = React.ComponentProps<typeof Button>;
43
23
  export type TableRefreshProps = React.ComponentProps<typeof Button>;
44
24
  export type TableSearchProps = React.ComponentProps<'input'> & VariantProps<typeof inputVariants>;
45
- export type TableProps<TData, TValue> = React.ComponentProps<'div'> & {
46
- table: TanstackTable<TData>;
47
- dataSets?: TableDataSet<TData, TValue>[];
48
- currentDataSet?: TableDataSet<TData, TValue>;
49
- setCurrentDataSet?: React.Dispatch<React.SetStateAction<TableDataSet<TData, TValue>>>;
50
- defaultView?: TableView;
51
- };
52
25
  export type TableColumnToggleProps = React.ComponentProps<typeof MenuTrigger>;
53
- export type TableRowListProps<TData> = React.ComponentProps<'tr'> & {
54
- row: Row<TData>;
55
- };
56
- export type TableBodyListProps<TData> = Omit<React.ComponentProps<'tbody'>, 'children'> & {
26
+ export type TableRowProps = React.ComponentProps<'tr'>;
27
+ export type TableBodyProps = React.ComponentProps<'tbody'> & {
57
28
  showDivider?: boolean;
58
- children: (row: Row<TData>) => React.ReactNode;
59
- };
60
- export type TableBodyGridProps<TData> = Omit<React.ComponentProps<'tbody'>, 'children'> & {
61
- children?: (row: Row<TData>) => React.ReactNode;
62
- };
63
- export type TableRowGridProps<TData> = React.ComponentProps<'tr'> & {
64
- row: Row<TData>;
65
29
  };
66
30
  export type TableNavProps = React.ComponentProps<'div'> & {
67
31
  sticky?: boolean;
@@ -71,34 +35,116 @@ export type TablePagingProps = React.ComponentProps<'div'> & {
71
35
  min?: number;
72
36
  max?: number;
73
37
  };
74
- export type TableContainerProps = React.ComponentProps<'table'>;
38
+ export type TableContainerProps = React.ComponentProps<'div'>;
75
39
  export type TableToolbarProps = React.ComponentProps<'div'> & {
76
40
  sticky?: boolean;
77
41
  };
78
- export type TableFiltersProps = React.ComponentProps<'ul'> & {
79
- operatorLabels?: Partial<Record<FilterOperator, string>>;
80
- };
81
- export type TableFilterFormProps<TData, TValue, TFilterType extends keyof typeof filterDefinitions> = React.ComponentProps<'form'> & {
82
- column: Column<TData, TValue>;
83
- filterType: TFilterType;
84
- operatorLabels?: Partial<Record<FilterOperator, string>>;
85
- clearLabel?: React.ReactNode;
86
- submitLabel?: React.ReactNode;
87
- renderClearButton?: (defaultButton: React.ReactNode) => React.ReactNode;
88
- renderSubmitButton?: (defaultButton: React.ReactNode) => React.ReactNode;
89
- };
90
- export type FilterValue<T extends keyof typeof filterDefinitions> = z.infer<(typeof filterDefinitions)[T]['schema']>;
91
- export type TableSortProps = React.ComponentProps<typeof MenuTrigger> & {
92
- ascendingLabel?: string;
93
- descendingLabel?: string;
94
- };
95
- export type TableDataSet<TData, TValue> = {
96
- id: string;
97
- label: string;
98
- data: TData[];
99
- columns: ColumnDef<TData, TValue>[];
100
- };
101
- export type TableView = 'grid' | 'list';
102
- export type TableDataSetSelectProps = React.ComponentProps<typeof SelectTrigger>;
103
- export type TableDataSetTabsProps = React.ComponentProps<typeof Tabs>;
42
+ export type TableFilterMenuProps = React.ComponentProps<'button'>;
43
+ export type TableFilterListProps = React.ComponentProps<'ul'>;
44
+ export type TableDateFilterFormProps<TData extends RowData> = React.ComponentProps<'form'> & {
45
+ column: Column<typeof features, TData, unknown>;
46
+ };
47
+ export type TableDateFilterChipProps<TData extends RowData> = React.ComponentProps<'button'> & {
48
+ column: Column<typeof features, TData, unknown>;
49
+ };
50
+ export type TableStringFilterFormProps<TData extends RowData> = React.ComponentProps<'form'> & {
51
+ column: Column<typeof features, TData, unknown>;
52
+ };
53
+ export type TableStringFilterChipProps<TData extends RowData> = React.ComponentProps<'button'> & {
54
+ column: Column<typeof features, TData, unknown>;
55
+ };
56
+ export type TableNumberFilterFormProps<TData extends RowData> = React.ComponentProps<'form'> & {
57
+ column: Column<typeof features, TData, unknown>;
58
+ };
59
+ export type TableNumberFilterChipProps<TData extends RowData> = React.ComponentProps<'button'> & {
60
+ column: Column<typeof features, TData, unknown>;
61
+ };
62
+ export type TableSelectFilterFormProps<TData extends RowData> = React.ComponentProps<'form'> & {
63
+ column: Column<typeof features, TData, unknown>;
64
+ };
65
+ export type TableSelectFilterChipProps<TData extends RowData> = React.ComponentProps<'button'> & {
66
+ column: Column<typeof features, TData, unknown>;
67
+ };
68
+ export type TableSelectFilterOption = string | number | boolean;
69
+ export type TableSelectFilterValue = TableSelectFilterOption[];
70
+ export type TableSortChipProps<TData extends RowData> = React.ComponentProps<'button'> & {
71
+ column: Column<typeof features, TData, unknown>;
72
+ };
73
+ export type TableSortMenuProps = React.ComponentProps<typeof MenuTrigger>;
104
74
  export type TableChangeViewProps = React.ComponentProps<typeof Button>;
75
+ export type TableCheckboxCellProps = React.ComponentProps<typeof Checkbox>;
76
+ export type TableSelectHeaderProps = React.ComponentProps<typeof Checkbox>;
77
+ export type TableTextCellProps = React.ComponentProps<'span'>;
78
+ export type TableDateCellProps = React.ComponentProps<'span'>;
79
+ export type TableNumberCellProps = React.ComponentProps<'span'>;
80
+ export type TableImageCellProps = React.ComponentProps<'img'>;
81
+ export type TableViewportProps = React.ComponentProps<'table'>;
82
+ export type TableSortListProps = React.ComponentProps<'ul'>;
83
+ export type TableBadgeCellProps = Omit<BadgeProps, 'tone'> & {
84
+ tone?: BadgeProps['tone'] | ((value: string) => BadgeProps['tone']);
85
+ };
86
+ export declare const stringFilterOperators: readonly ["equals", "notEquals", "contains", "notContains", "startsWith", "endsWith"];
87
+ export declare const numberFilterOperators: readonly ["equals", "notEquals", "greaterThan", "lessThan", "between"];
88
+ export declare const dateFilterOperators: readonly ["equals", "notEquals", "greaterThan", "lessThan", "between"];
89
+ export type DateFilterOperator = (typeof dateFilterOperators)[number];
90
+ export type StringFilterOperator = (typeof stringFilterOperators)[number];
91
+ export type NumberFilterOperator = (typeof numberFilterOperators)[number];
92
+ export type FilterOperator = StringFilterOperator | NumberFilterOperator;
93
+ export declare const defaultFilterOperatorLabels: {
94
+ equals: string;
95
+ notEquals: string;
96
+ contains: string;
97
+ notContains: string;
98
+ startsWith: string;
99
+ endsWith: string;
100
+ greaterThan: string;
101
+ lessThan: string;
102
+ between: string;
103
+ };
104
+ export interface TableColumnMeta {
105
+ filterVariant?: 'range' | 'select' | 'date' | 'string' | 'number';
106
+ }
107
+ export interface TableMeta {
108
+ translations?: {
109
+ filterOperatorLabels?: Partial<Record<FilterOperator, string>>;
110
+ buttonLabels?: {
111
+ reset?: string;
112
+ apply?: string;
113
+ ascending?: string;
114
+ descending?: string;
115
+ };
116
+ };
117
+ }
118
+ export declare const dateFilterSchema: z.ZodObject<{
119
+ filterOperator: z.ZodEnum<{
120
+ equals: "equals";
121
+ between: "between";
122
+ notEquals: "notEquals";
123
+ greaterThan: "greaterThan";
124
+ lessThan: "lessThan";
125
+ }>;
126
+ filterValueFrom: z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodISODate]>;
127
+ filterValueTo: z.ZodUnion<readonly [z.ZodLiteral<"">, z.ZodISODate]>;
128
+ }, z.core.$strip>;
129
+ export declare const stringFilterSchema: z.ZodObject<{
130
+ filterOperator: z.ZodEnum<{
131
+ endsWith: "endsWith";
132
+ startsWith: "startsWith";
133
+ equals: "equals";
134
+ notEquals: "notEquals";
135
+ contains: "contains";
136
+ notContains: "notContains";
137
+ }>;
138
+ filterValue: z.ZodString;
139
+ }, z.core.$strip>;
140
+ export declare const numberFilterSchema: z.ZodObject<{
141
+ filterOperator: z.ZodEnum<{
142
+ equals: "equals";
143
+ between: "between";
144
+ notEquals: "notEquals";
145
+ greaterThan: "greaterThan";
146
+ lessThan: "lessThan";
147
+ }>;
148
+ filterValueFrom: z.ZodString;
149
+ filterValueTo: z.ZodString;
150
+ }, z.core.$strip>;
@@ -1,4 +1,17 @@
1
- import { FilterFn } from '@tanstack/react-table';
2
- export declare const textFilterFn: FilterFn<any>;
3
- export declare const selectFilterFn: FilterFn<any>;
4
- export declare const numberFilterFn: FilterFn<any>;
1
+ import { DateFilterOperator, NumberFilterOperator, StringFilterOperator } from './table.types';
2
+ export type DateFilterValue = {
3
+ operator: DateFilterOperator;
4
+ date: [string, string];
5
+ };
6
+ export type StringFilterValue = {
7
+ operator: StringFilterOperator;
8
+ value: string;
9
+ };
10
+ export type NumberFilterValue = {
11
+ operator: NumberFilterOperator;
12
+ number: [string, string];
13
+ };
14
+ export declare const selectFilterFn: import('@tanstack/react-table').CreatedFilterFn<any, any>;
15
+ export declare const dateFilterFn: import('@tanstack/react-table').CreatedFilterFn<any, any>;
16
+ export declare const stringFilterFn: import('@tanstack/react-table').CreatedFilterFn<any, any>;
17
+ export declare const numberFilterFn: import('@tanstack/react-table').CreatedFilterFn<any, any>;