@umituz/web-design-system 4.6.0 → 4.6.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/web-design-system",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Web Design System - Tailwind v4 authored, precompiled CSS shipped. Atomic Design components (Atoms, Molecules, Organisms, Templates) for React applications.",
|
|
@@ -652,4 +652,28 @@ describe('accessia supersets', () => {
|
|
|
652
652
|
expect(options[0]?.textContent).toBe('Newest');
|
|
653
653
|
expect(options[2]?.textContent).toBe('Other');
|
|
654
654
|
});
|
|
655
|
+
|
|
656
|
+
it('DataTable initialSort orders rows before any header click', () => {
|
|
657
|
+
interface Local {
|
|
658
|
+
id: string;
|
|
659
|
+
name: string;
|
|
660
|
+
}
|
|
661
|
+
render(
|
|
662
|
+
<DataTable<Local>
|
|
663
|
+
data={[
|
|
664
|
+
{ id: 'b', name: 'bravo' },
|
|
665
|
+
{ id: 'a', name: 'alpha' },
|
|
666
|
+
]}
|
|
667
|
+
sortable
|
|
668
|
+
initialSort={{ id: 'name', dir: 'asc' }}
|
|
669
|
+
columns={[{ id: 'name', header: 'Name', accessor: 'name', sortable: true, sortValue: (r) => r.name }]}
|
|
670
|
+
/>,
|
|
671
|
+
);
|
|
672
|
+
expect(screen.getAllByRole('row')[1]?.textContent).toContain('alpha');
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
it('Progress info tone paints the fill info', () => {
|
|
676
|
+
render(<Progress value={60} tone="info" aria-label="load" />);
|
|
677
|
+
expect(screen.getByRole('progressbar', { name: 'load' }).querySelector('div')?.className).toContain('bg-info');
|
|
678
|
+
});
|
|
655
679
|
});
|
|
@@ -12,7 +12,7 @@ export interface ProgressProps extends HTMLAttributes<HTMLDivElement>, BaseProps
|
|
|
12
12
|
value?: number;
|
|
13
13
|
max?: number;
|
|
14
14
|
size?: 'sm' | 'md' | 'lg';
|
|
15
|
-
tone?: 'primary' | 'success' | 'warning' | 'destructive';
|
|
15
|
+
tone?: 'primary' | 'success' | 'warning' | 'destructive' | 'info';
|
|
16
16
|
label?: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -22,11 +22,12 @@ const sizeStyles: Record<'sm' | 'md' | 'lg', string> = {
|
|
|
22
22
|
lg: 'h-3',
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const toneStyles: Record<'primary' | 'success' | 'warning' | 'destructive', string> = {
|
|
25
|
+
const toneStyles: Record<'primary' | 'success' | 'warning' | 'destructive' | 'info', string> = {
|
|
26
26
|
primary: 'bg-primary',
|
|
27
27
|
success: 'bg-success',
|
|
28
28
|
warning: 'bg-warning',
|
|
29
29
|
destructive: 'bg-destructive',
|
|
30
|
+
info: 'bg-info',
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
export const Progress = forwardRef<HTMLDivElement, ProgressProps>(
|
|
@@ -67,6 +67,7 @@ export interface DataTableProps<T> extends BaseProps {
|
|
|
67
67
|
size?: MediumSizes;
|
|
68
68
|
sortable?: boolean;
|
|
69
69
|
sort?: SortState;
|
|
70
|
+
initialSort?: SortState;
|
|
70
71
|
onSortChange?: (id: string) => void;
|
|
71
72
|
rowKey?: (row: T) => string;
|
|
72
73
|
selectedId?: string;
|
|
@@ -229,6 +230,7 @@ export function DataTable<T>({
|
|
|
229
230
|
size = 'md',
|
|
230
231
|
sortable = false,
|
|
231
232
|
sort,
|
|
233
|
+
initialSort,
|
|
232
234
|
onSortChange,
|
|
233
235
|
rowKey,
|
|
234
236
|
selectedId,
|
|
@@ -244,7 +246,7 @@ export function DataTable<T>({
|
|
|
244
246
|
rowLabel,
|
|
245
247
|
...props
|
|
246
248
|
}: DataTableProps<T>) {
|
|
247
|
-
const [internalSort, setInternalSort] = useState<SortState | null>(null);
|
|
249
|
+
const [internalSort, setInternalSort] = useState<SortState | null>(initialSort ?? null);
|
|
248
250
|
const [currentPage, setCurrentPage] = useState(1);
|
|
249
251
|
|
|
250
252
|
const activeSort = sort ?? internalSort;
|