@kayord/ui 2.1.7 → 2.1.9

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.
@@ -11,16 +11,8 @@
11
11
  import { TableStore } from "./table.svelte";
12
12
  import DataTableHeader from "./DataTableHeader.svelte";
13
13
  import DataTableFooter from "./DataTableFooter.svelte";
14
- import { beforeNavigate, goto } from "$app/navigation";
15
- import {
16
- decodeColumnFilters,
17
- decodeGlobalFilter,
18
- decodePageIndex,
19
- decodeSorting,
20
- encodeColumnFilters,
21
- encodeSorting,
22
- encodeTableState,
23
- } from "./table-search-params";
14
+ import { beforeNavigate } from "$app/navigation";
15
+ import { decodeColumnFilters, decodeSorting, encodeColumnFilters, encodeSorting } from "./table-search-params";
24
16
  import { useSearchParams } from "runed/kit";
25
17
  import { defaultSearchParamSchema } from "./types";
26
18
  import DataTableView from "./DataTableView.svelte";
@@ -63,16 +55,6 @@
63
55
  // svelte-ignore state_referenced_locally
64
56
  const isPaginationEnabled = table.options.getPaginationRowModel !== undefined;
65
57
 
66
- // Load Default Values from Page Params
67
- // onMount(() => {
68
- // if (table.options.useURLSearchParams) {
69
- // table.setPageIndex(decodePageIndex());
70
- // table.setSorting(decodeSorting() ?? []);
71
- // table.setGlobalFilter(decodeGlobalFilter());
72
- // table.setColumnFilters(decodeColumnFilters() ?? []);
73
- // }
74
- // });
75
-
76
58
  const params = useSearchParams(defaultSearchParamSchema, { pushHistory: false });
77
59
  // Load current url search params
78
60
  onMount(() => {
@@ -115,20 +97,6 @@
115
97
  }
116
98
  });
117
99
 
118
- // Set URL Page Params
119
- // $effect(() => {
120
- // if (table.options.useURLSearchParams) {
121
- // const params = encodeTableState(table.getState());
122
- // goto(params, {
123
- // replaceState: true,
124
- // keepFocus: true,
125
- // noScroll: true,
126
- // }).catch(() => {
127
- // // Ignore navigation errors in test environments
128
- // });
129
- // }
130
- // });
131
-
132
100
  let end: HTMLElement | undefined = $state();
133
101
  </script>
134
102
 
@@ -18,7 +18,7 @@ export const encodeGlobalFilter = (state) => {
18
18
  return state.globalFilter;
19
19
  };
20
20
  export const decodeGlobalFilter = () => {
21
- const globalFilter = page.url.searchParams.get("globalFilter");
21
+ const globalFilter = page.url.searchParams.get("search");
22
22
  return globalFilter != null ? globalFilter : undefined;
23
23
  };
24
24
  export const encodePageIndex = (state) => {
@@ -34,7 +34,7 @@ export const encodeColumnFilters = (state) => {
34
34
  };
35
35
  export const decodeColumnFilters = () => {
36
36
  return page.url.searchParams
37
- .get("columnFilters")
37
+ .get("filter")
38
38
  ?.split(",")
39
39
  .map((v) => {
40
40
  const [id, stringValue] = v.split(".");
@@ -75,13 +75,13 @@ export const encodeTableState = (state, options, searchParams) => {
75
75
  searchParams.set("page", encodePageIndex(state));
76
76
  }
77
77
  if (options.globalFilter && state.globalFilter?.length > 0) {
78
- searchParams.set("globalFilter", encodeGlobalFilter(state));
78
+ searchParams.set("search", encodeGlobalFilter(state));
79
79
  }
80
80
  if (options.sorting && (state.sorting?.length ?? 0) > 0) {
81
81
  searchParams.set("sort", encodeSorting(state));
82
82
  }
83
83
  if (options.columnFilter && (state.columnFilters?.length ?? 0) > 0) {
84
- searchParams.set("columnFilters", encodeColumnFilters(state));
84
+ searchParams.set("filter", encodeColumnFilters(state));
85
85
  }
86
86
  return `?${searchParams.toString()}`;
87
87
  };
@@ -18,7 +18,11 @@
18
18
  className
19
19
  )}
20
20
  >
21
- <CalendarPrimitive.MonthSelect bind:ref class="absolute inset-0 opacity-0" {...restProps}>
21
+ <CalendarPrimitive.MonthSelect
22
+ bind:ref
23
+ class="dark:bg-popover dark:text-popover-foreground absolute inset-0 opacity-0"
24
+ {...restProps}
25
+ >
22
26
  {#snippet child({ props, monthItems, selectedMonthItem })}
23
27
  <select {...props} {value} {onchange}>
24
28
  {#each monthItems as monthItem (monthItem.value)}
@@ -17,7 +17,11 @@
17
17
  className
18
18
  )}
19
19
  >
20
- <CalendarPrimitive.YearSelect bind:ref class="absolute inset-0 opacity-0" {...restProps}>
20
+ <CalendarPrimitive.YearSelect
21
+ bind:ref
22
+ class="dark:bg-popover dark:text-popover-foreground absolute inset-0 opacity-0"
23
+ {...restProps}
24
+ >
21
25
  {#snippet child({ props, yearItems, selectedYearItem })}
22
26
  <select {...props} {value}>
23
27
  {#each yearItems as yearItem (yearItem.value)}
@@ -37,10 +37,9 @@ export function createSvelteTable(options) {
37
37
  const table = createTable(resolvedOptions);
38
38
  let state = $state(table.initialState);
39
39
  function updateOptions() {
40
- table.setOptions((prev) => {
41
- return mergeObjects(prev, options, {
40
+ table.setOptions(() => {
41
+ return mergeObjects(resolvedOptions, options, {
42
42
  state: mergeObjects(state, options.state || {}),
43
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
43
  onStateChange: (updater) => {
45
44
  if (updater instanceof Function)
46
45
  state = updater(state);
@@ -19,7 +19,7 @@
19
19
  if (children) return true;
20
20
 
21
21
  // no errors
22
- if (!errors) return false;
22
+ if (!errors || errors.length === 0) return false;
23
23
 
24
24
  // has an error but no message
25
25
  if (errors.length === 1 && !errors[0]?.message) {
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@kayord/ui",
3
3
  "private": false,
4
- "version": "2.1.7",
4
+ "version": "2.1.9",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/kayordDX/ui"
8
+ },
5
9
  "exports": {
6
10
  ".": {
7
11
  "types": "./dist/index.d.ts",
@@ -101,18 +105,18 @@
101
105
  }
102
106
  },
103
107
  "dependencies": {
104
- "bits-ui": "2.15.4",
108
+ "bits-ui": "2.15.5",
105
109
  "clsx": "^2.1.1",
106
110
  "tailwind-merge": "^3.4.0",
107
111
  "tailwind-variants": "^3.2.2"
108
112
  },
109
113
  "devDependencies": {
110
- "@eslint/compat": "^2.0.1",
111
- "@eslint/js": "^9.39.2",
112
- "@internationalized/date": "^3.10.1",
114
+ "@eslint/compat": "^2.0.2",
115
+ "@eslint/js": "^10.0.1",
116
+ "@internationalized/date": "^3.11.0",
113
117
  "@lucide/svelte": "^0.563.1",
114
118
  "@sveltejs/adapter-auto": "^7.0.0",
115
- "@sveltejs/kit": "^2.50.1",
119
+ "@sveltejs/kit": "^2.50.2",
116
120
  "@sveltejs/package": "^2.5.7",
117
121
  "@sveltejs/vite-plugin-svelte": "^6.2.4",
118
122
  "@tailwindcss/vite": "^4.1.18",
@@ -123,11 +127,11 @@
123
127
  "d3-scale": "^4.0.2",
124
128
  "d3-shape": "^3.2.0",
125
129
  "embla-carousel-svelte": "^8.6.0",
126
- "eslint": "^9.39.2",
130
+ "eslint": "^10.0.0",
127
131
  "eslint-config-prettier": "^10.1.8",
128
132
  "eslint-plugin-svelte": "^3.14.0",
129
133
  "formsnap": "^2.0.1",
130
- "globals": "^17.1.0",
134
+ "globals": "^17.3.0",
131
135
  "layerchart": "2.0.0-next.40",
132
136
  "mode-watcher": "^1.1.0",
133
137
  "paneforge": "^1.0.2",
@@ -136,15 +140,15 @@
136
140
  "prettier-plugin-tailwindcss": "^0.7.2",
137
141
  "publint": "^0.3.17",
138
142
  "runed": "^0.37.1",
139
- "svelte": "5.48.1",
140
- "svelte-check": "^4.3.5",
143
+ "svelte": "5.50.0",
144
+ "svelte-check": "^4.3.6",
141
145
  "svelte-sonner": "^1.0.7",
142
146
  "sveltekit-superforms": "^2.29.1",
143
147
  "tailwindcss": "^4.1.18",
144
148
  "tslib": "^2.8.1",
145
149
  "tw-animate-css": "1.4.0",
146
150
  "typescript": "^5.9.3",
147
- "typescript-eslint": "^8.53.1",
151
+ "typescript-eslint": "^8.55.0",
148
152
  "vaul-svelte": "1.0.0-next.7",
149
153
  "vite": "^7.3.1",
150
154
  "vitest": "^4.0.18",