@krak-stack/registry 0.1.44 → 0.1.45

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/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # @krak-stack/registry
2
+
3
+ ## 0.1.45
4
+
5
+ ### Patch Changes
6
+
7
+ - Support initial hidden columns through `DataTable.initialState.columnVisibility`, with saved user preferences taking precedence. Improve list columns with primary item actions, item menus for nonempty lists, responsive dropdowns, and truncated labels. Consolidate the column-type examples into one kitchen-sink preview.
8
+
9
+ - Preserve decoded pagination defaults in QueryStandard. Use TanStack Router's stripSearchParams({ page: 0, pageSize: 20 }) search middleware on the root route to omit defaults from URLs without making validated search state optional.
@@ -378,7 +378,10 @@ export interface DataTableProps<TData extends RowData> {
378
378
  columnDefs: readonly DataTableColDef<TData>[];
379
379
  getRowId?: (row: TData) => string;
380
380
  state?: DataTablePublicState;
381
- initialState?: Partial<DataTablePublicState>;
381
+ initialState?: Partial<DataTablePublicState> & {
382
+ /** Initial visibility defaults; saved user preferences take precedence. */
383
+ columnVisibility?: Readonly<Record<string, boolean>>;
384
+ };
382
385
  locale?: string;
383
386
  onStateChange?: (state: DataTablePublicState) => void;
384
387
  status?: DataTableStatus;
@@ -2936,6 +2936,7 @@ var HydratedDataTable = ({
2936
2936
  };
2937
2937
  var DataTable = (props) => {
2938
2938
  const locale = useKrakstackLocale3(props.locale);
2939
+ const [initialColumnVisibility] = useState(() => props.initialState?.columnVisibility ?? {});
2939
2940
  const [persistedUiAtom] = useState(() => {
2940
2941
  const pathname = globalThis.window?.location.pathname ?? "/";
2941
2942
  const columnIds = normalizeDataTableColumns(props.columnDefs).map(({ id }) => id).join(",");
@@ -2949,7 +2950,14 @@ var DataTable = (props) => {
2949
2950
  });
2950
2951
  });
2951
2952
  const [persistedUiResult, setPersistedUiState] = useAtom(persistedUiAtom);
2952
- if (!AsyncResult.isSuccess(persistedUiResult) || AsyncResult.isWaiting(persistedUiResult)) {
2953
+ const persistedUiState = useMemo(() => AsyncResult.isSuccess(persistedUiResult) ? {
2954
+ ...persistedUiResult.value,
2955
+ columnVisibility: {
2956
+ ...initialColumnVisibility,
2957
+ ...persistedUiResult.value.columnVisibility
2958
+ }
2959
+ } : undefined, [initialColumnVisibility, persistedUiResult]);
2960
+ if (!persistedUiState || AsyncResult.isWaiting(persistedUiResult)) {
2953
2961
  return /* @__PURE__ */ jsx14("div", {
2954
2962
  "aria-busy": "true",
2955
2963
  className: "invisible w-full max-w-full min-w-0 rounded-md",
@@ -2959,7 +2967,7 @@ var DataTable = (props) => {
2959
2967
  return /* @__PURE__ */ jsx14(HydratedDataTable, {
2960
2968
  ...props,
2961
2969
  locale,
2962
- persistedUiState: persistedUiResult.value,
2970
+ persistedUiState,
2963
2971
  setPersistedUiState
2964
2972
  });
2965
2973
  };
@@ -43,22 +43,24 @@ export declare const Query: Schema.Struct<{
43
43
  export type QueryType = typeof Query.Type;
44
44
  export type QueryEncoded = typeof Query.Encoded;
45
45
  export declare const QueryStandard: import("effect/StandardSchema").StandardSchemaV1<{
46
+ readonly page?: string | number | undefined;
47
+ readonly pageSize?: string | number | undefined;
46
48
  readonly globalFilter?: string | undefined;
47
49
  readonly sort?: readonly {
48
50
  readonly id: string;
49
51
  readonly direction: "asc" | "desc";
50
52
  }[] | undefined;
51
- readonly page?: string | number | undefined;
52
- readonly pageSize?: string | number | undefined;
53
53
  }, {
54
+ readonly page: number;
55
+ readonly pageSize: number;
54
56
  readonly globalFilter?: string | undefined;
55
57
  readonly sort?: readonly {
56
58
  readonly id: string;
57
59
  readonly direction: "asc" | "desc";
58
60
  }[] | undefined;
59
- readonly page?: number | undefined;
60
- readonly pageSize?: number | undefined;
61
61
  }> & Schema.Struct<{
62
+ readonly page: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
63
+ readonly pageSize: Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>;
62
64
  readonly globalFilter: Schema.optional<Schema.String>;
63
65
  readonly sort: Schema.optional<Schema.declare<readonly {
64
66
  readonly id: string;
@@ -67,8 +69,6 @@ export declare const QueryStandard: import("effect/StandardSchema").StandardSche
67
69
  readonly id: string;
68
70
  readonly direction: "asc" | "desc";
69
71
  }[]>>;
70
- readonly page: Schema.decodeTo<Schema.optional<Schema.Int>, Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>, never, never>;
71
- readonly pageSize: Schema.decodeTo<Schema.optional<Schema.Int>, Schema.decodeTo<Schema.Int, Schema.optional<Schema.Union<readonly [Schema.Number, Schema.NumberFromString]>>, never, never>, never, never>;
72
72
  }>;
73
73
  export declare const PaginationMeta: Schema.Struct<{
74
74
  readonly page: Schema.Int;
package/dist/lib/query.js CHANGED
@@ -107,17 +107,7 @@ var Query = Schema.Struct({
107
107
  }
108
108
  ]
109
109
  });
110
- var QueryStandard = Schema.toStandardSchemaV1(Schema.Struct({
111
- ...Query.fields,
112
- page: Query.fields.page.pipe(Schema.decodeTo(Schema.optional(Schema.Int), {
113
- decode: SchemaGetter.transform((page) => page === 0 ? undefined : page),
114
- encode: SchemaGetter.transform((page) => page ?? 0)
115
- })),
116
- pageSize: Query.fields.pageSize.pipe(Schema.decodeTo(Schema.optional(Schema.Int), {
117
- decode: SchemaGetter.transform((pageSize) => pageSize === 20 ? undefined : pageSize),
118
- encode: SchemaGetter.transform((pageSize) => pageSize ?? 20)
119
- }))
120
- }).annotate({ identifier: "QuerySearch" }));
110
+ var QueryStandard = Schema.toStandardSchemaV1(Query);
121
111
  var PaginationMeta = Schema.Struct({
122
112
  page: Schema.Int,
123
113
  pageSize: Schema.Int,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -11,7 +11,8 @@
11
11
  "files": [
12
12
  "dist",
13
13
  "README.md",
14
- "tailwind.css"
14
+ "tailwind.css",
15
+ "CHANGELOG.md"
15
16
  ],
16
17
  "type": "module",
17
18
  "sideEffects": false,