@kayord/ui 0.12.21 → 0.12.23

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.
@@ -26,6 +26,9 @@
26
26
  hideHeader?: boolean;
27
27
  enableVisibility?: boolean;
28
28
  enableFullscreen?: boolean;
29
+ class?: string;
30
+ headerClass?: string;
31
+ disableUISorting?: boolean;
29
32
  }
30
33
 
31
34
  let {
@@ -41,6 +44,9 @@
41
44
  hideHeader = false,
42
45
  enableVisibility = false,
43
46
  enableFullscreen = false,
47
+ class: className,
48
+ headerClass,
49
+ disableUISorting = false,
44
50
  }: Props<T> = $props();
45
51
 
46
52
  const isPaginationEnabled = table.options.getPaginationRowModel !== undefined;
@@ -61,6 +67,7 @@
61
67
  onCheckedChange: () => r.row.toggleSelected(),
62
68
  }),
63
69
  enableResizing: false,
70
+ enableSorting: false,
64
71
  };
65
72
  columns.unshift(rowSelectionColumn);
66
73
  }
@@ -69,14 +76,15 @@
69
76
  <div
70
77
  class={cn(
71
78
  "w-full",
72
- tableStore.isFullscreen ? "absolute left-0 top-0 z-10 h-screen bg-background transition-all" : "w-full"
79
+ tableStore.isFullscreen ? "absolute left-0 top-0 z-10 h-screen bg-background transition-all" : "w-full",
80
+ className
73
81
  )}
74
82
  >
75
- <div class="py-2">
83
+ <div class={cn(headerClass)}>
76
84
  {#if header}
77
85
  {@render header()}
78
86
  {:else}
79
- <div class="flex items-center justify-between gap-2">
87
+ <div class="flex items-center justify-between gap-2 pb-2">
80
88
  <div>
81
89
  {#if leftToolbar}
82
90
  {@render leftToolbar()}
@@ -119,7 +127,7 @@
119
127
  {#each table.getHeaderGroups() as headerGroup}
120
128
  <Table.Row>
121
129
  {#each headerGroup.headers as header}
122
- <DataTableHeader {header} {table} />
130
+ <DataTableHeader {header} {table} {disableUISorting} />
123
131
  {/each}
124
132
  </Table.Row>
125
133
  {/each}
@@ -148,7 +156,9 @@
148
156
  {#each table.getRowModel().rows as row}
149
157
  <Table.Row data-state={row.getIsSelected() && "selected"}>
150
158
  {#each row.getVisibleCells() as cell}
151
- <Table.Cell>
159
+ <Table.Cell
160
+ style={`width: ${cell.column.getSize()}px; min-width:${cell.column.columnDef.minSize}px; max-width:${cell.column.columnDef.maxSize}px`}
161
+ >
152
162
  <FlexRender content={cell.column.columnDef.cell} context={cell.getContext()} />
153
163
  </Table.Cell>
154
164
  {/each}
@@ -14,6 +14,9 @@ declare class __sveltets_Render<T> {
14
14
  hideHeader?: boolean;
15
15
  enableVisibility?: boolean;
16
16
  enableFullscreen?: boolean;
17
+ class?: string;
18
+ headerClass?: string;
19
+ disableUISorting?: boolean;
17
20
  };
18
21
  events(): {};
19
22
  slots(): {};
@@ -12,4 +12,4 @@
12
12
  let { checked, class: className, ...rest }: Props = $props();
13
13
  </script>
14
14
 
15
- <Checkbox bind:checked class={cn(className)} {...rest} />
15
+ <Checkbox bind:checked class={cn("rounded-[5px]", className)} {...rest} />
@@ -6,11 +6,12 @@
6
6
  interface Props<T> {
7
7
  header: Header<T, unknown>;
8
8
  table: TypeType<T>;
9
+ disableUISorting?: boolean;
9
10
  }
10
11
 
11
- let { header, table }: Props<T> = $props();
12
+ let { header, table, disableUISorting = false }: Props<T> = $props();
12
13
 
13
- const isSortingEnabled = $derived(table.options.getSortedRowModel !== undefined);
14
+ const isSortingEnabled = $derived(table.options.getSortedRowModel !== undefined && disableUISorting !== true);
14
15
  </script>
15
16
 
16
17
  <Table.Head
@@ -20,7 +21,7 @@
20
21
  {#if !header.isPlaceholder}
21
22
  <div class="flex items-center gap-1">
22
23
  <FlexRender content={header.column.columnDef.header} context={header.getContext()} />
23
- {#if isSortingEnabled}
24
+ {#if isSortingEnabled && header.column.getCanSort()}
24
25
  <button onclick={header.column.getToggleSortingHandler()}>
25
26
  {#if header.column.getIsSorted() == "asc"}
26
27
  <ArrowDownIcon class="size-4" />
@@ -3,6 +3,7 @@ declare class __sveltets_Render<T> {
3
3
  props(): {
4
4
  header: Header<T, unknown>;
5
5
  table: TypeType<T>;
6
+ disableUISorting?: boolean;
6
7
  };
7
8
  events(): {};
8
9
  slots(): {};
@@ -16,7 +16,7 @@
16
16
  let value = $state(table.getState().pagination.pageSize.toString());
17
17
  </script>
18
18
 
19
- <div class="flex items-center justify-between p-2">
19
+ <div class="flex items-center justify-between py-2">
20
20
  <div class="flex-1 text-sm text-muted-foreground">
21
21
  {#if table.options.enableRowSelection}
22
22
  {table.getFilteredSelectedRowModel().rows.length} of
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kayord/ui",
3
3
  "private": false,
4
- "version": "0.12.21",
4
+ "version": "0.12.23",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@internationalized/date": "^3.5.6",
37
- "bits-ui": "1.0.0-next.51",
37
+ "bits-ui": "1.0.0-next.52",
38
38
  "clsx": "^2.1.1",
39
39
  "embla-carousel-svelte": "8.3.1",
40
40
  "formsnap": "2.0.0-next.1",
@@ -59,14 +59,14 @@
59
59
  "eslint": "^9.14.0",
60
60
  "eslint-config-prettier": "^9.1.0",
61
61
  "eslint-plugin-svelte": "^2.46.0",
62
- "happy-dom": "^15.11.3",
62
+ "happy-dom": "^15.11.4",
63
63
  "lucide-svelte": "^0.456.0",
64
64
  "postcss": "^8.4.49",
65
65
  "prettier": "^3.3.3",
66
66
  "prettier-plugin-svelte": "^3.2.8",
67
67
  "prettier-plugin-tailwindcss": "^0.6.8",
68
68
  "publint": "^0.2.12",
69
- "svelte": "^5.1.15",
69
+ "svelte": "^5.1.16",
70
70
  "svelte-check": "^4.0.7",
71
71
  "tailwindcss": "^3.4.14",
72
72
  "tailwindcss-animate": "^1.0.7",