@telamonjs/ui 1.0.1 → 1.0.3

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - `ModernSidebar` no longer causes a hydration mismatch for users who saved the compact sidebar. The sidebar store read the preference from localStorage while being created, so the first client render differed from the server's and Radix ids shifted; it now reads it after hydration.
8
+
9
+ ## 1.0.2
10
+
11
+ Tagged but not published to npm: 1.0.3 includes it.
12
+
13
+ ### Patch Changes
14
+
15
+ - `react-grid-layout` is now a dependency instead of an optional peer. The root entry reaches `DashboardGrid`, whose dynamic `import('react-grid-layout')` failed the build ("Module not found") in apps that had not installed it.
16
+
3
17
  ## 1.0.1
4
18
 
5
19
  First public release of `@telamonjs/ui`. Release notes: [CHANGELOG.md](https://github.com/telamonjs/telamonjs/blob/main/CHANGELOG.md).
package/README.md CHANGED
@@ -35,11 +35,10 @@ pnpm add @telamonjs/ui framer-motion jspdf jspdf-autotable next next-auth papapa
35
35
  | `next-intl` | `^4.14.0` |
36
36
  | `@tanstack/react-query` | `^5.90.2` |
37
37
  | `@prisma/client` (optional) | `^5.0.0 \|\| ^6.0.0` |
38
- | `react-grid-layout` (optional) | `^1.5.0 \|\| ^2.0.0` |
39
38
  <!-- /generated:peers -->
40
39
 
41
- `react-grid-layout` is only needed for `DashboardGrid` (also import
42
- `react-grid-layout/css/styles.css`), and `@prisma/client` only for the
40
+ `DashboardGrid` needs the `react-grid-layout` stylesheet
41
+ (`import 'react-grid-layout/css/styles.css'`), and `@prisma/client` is only needed for the
43
42
  `./server` pagination helpers. Then load the styles and the Tailwind preset:
44
43
 
45
44
  ```tsx
@@ -12,7 +12,7 @@ export declare class ErrorBoundary extends Component<Props, State> {
12
12
  constructor(props: Props);
13
13
  static getDerivedStateFromError(error: Error): State;
14
14
  componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
15
- render(): string | number | bigint | boolean | React.JSX.Element | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined;
15
+ render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
16
16
  }
17
17
  interface ErrorFallbackProps {
18
18
  error?: Error;
@@ -7,4 +7,4 @@ export type { ModuleMetadata, ListConfig, CrudColumnDef, FormConfig, QueryConfig
7
7
  export type { ColorPreset, StatItem, HeaderBadgeConfig, HeaderStatsConfig, DialogHeaderConfig, DialogHeaderProps, StatsGridProps, } from '../types/dialog-header';
8
8
  export type { MenuItem, SingleMenuItem, GroupMenuItem, SeparatorMenuItem, MenuItemType, MenuVariant, IconComponent, } from '../types/menu';
9
9
  export type { Density, GapSize, DialogSize, DialogHeight, FieldLayout, CardFieldLayout, } from '../utils/spacing';
10
- export declare const version = "1.0.1";
10
+ export declare const version = "1.0.3";
@@ -1,6 +1,6 @@
1
1
  // src/exports/types-constants.ts
2
2
  import { createPaginatedResponse, asQueryFn } from "../types/pagination.js";
3
- var version = "1.0.1";
3
+ var version = "1.0.3";
4
4
  export {
5
5
  asQueryFn,
6
6
  createPaginatedResponse,
@@ -3,6 +3,7 @@
3
3
  // src/layouts/ModernSidebar.tsx
4
4
  import {
5
5
  useCallback,
6
+ useEffect,
6
7
  useMemo,
7
8
  useState
8
9
  } from "react";
@@ -10,6 +11,7 @@ import { usePathname } from "next/navigation";
10
11
  import { useMediaQuery } from "../hooks/use-mobile.js";
11
12
  import { useTelamonjsT, useText } from "../i18n/use-t.js";
12
13
  import {
14
+ useSidebarStore,
13
15
  useSidebarState,
14
16
  useIsMobileOpen,
15
17
  useSidebarActions
@@ -50,6 +52,9 @@ function ModernSidebar({
50
52
  const text = useText();
51
53
  const effectiveSystemName = systemName ?? t("shell.systemName");
52
54
  const pathname = usePathname();
55
+ useEffect(() => {
56
+ void useSidebarStore.persist.rehydrate();
57
+ }, []);
53
58
  const sidebarState = useSidebarState();
54
59
  const isMobileOpen = useIsMobileOpen();
55
60
  const menuStack = useMenuStack();
@@ -27,7 +27,12 @@ var useSidebarStore = create()(
27
27
  }),
28
28
  {
29
29
  name: SIDEBAR_STORAGE_KEY,
30
- partialize: (state) => ({ sidebarState: state.sidebarState })
30
+ partialize: (state) => ({ sidebarState: state.sidebarState }),
31
+ // localStorage is synchronous, so the store would read the saved
32
+ // preference while being created and the first client render would
33
+ // differ from the server's (hydration mismatch, shifted Radix ids).
34
+ // ModernSidebar calls persist.rehydrate() after mount instead.
35
+ skipHydration: true
31
36
  }
32
37
  )
33
38
  ),
@@ -6,7 +6,7 @@ declare const Command: React.ForwardRefExoticComponent<Omit<{
6
6
  ref?: React.Ref<HTMLDivElement>;
7
7
  } & {
8
8
  asChild?: boolean;
9
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
9
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
10
10
  label?: string;
11
11
  shouldFilter?: boolean;
12
12
  filter?: (value: string, search: string, keywords?: string[]) => number;
@@ -32,7 +32,7 @@ declare const CommandList: React.ForwardRefExoticComponent<Omit<{
32
32
  ref?: React.Ref<HTMLDivElement>;
33
33
  } & {
34
34
  asChild?: boolean;
35
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
35
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
36
36
  label?: string;
37
37
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
38
38
  declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
@@ -41,14 +41,14 @@ declare const CommandEmpty: React.ForwardRefExoticComponent<Omit<{
41
41
  ref?: React.Ref<HTMLDivElement>;
42
42
  } & {
43
43
  asChild?: boolean;
44
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
44
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
45
45
  declare const CommandGroup: React.ForwardRefExoticComponent<Omit<{
46
46
  children?: React.ReactNode;
47
47
  } & Omit<Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {
48
48
  ref?: React.Ref<HTMLDivElement>;
49
49
  } & {
50
50
  asChild?: boolean;
51
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "heading"> & {
51
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "heading"> & {
52
52
  heading?: React.ReactNode;
53
53
  value?: string;
54
54
  forceMount?: boolean;
@@ -57,7 +57,7 @@ declare const CommandSeparator: React.ForwardRefExoticComponent<Omit<Pick<Pick<R
57
57
  ref?: React.Ref<HTMLDivElement>;
58
58
  } & {
59
59
  asChild?: boolean;
60
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>> & {
60
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild"> & {
61
61
  alwaysRender?: boolean;
62
62
  } & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
63
63
  declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
@@ -66,7 +66,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
66
66
  ref?: React.Ref<HTMLDivElement>;
67
67
  } & {
68
68
  asChild?: boolean;
69
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "disabled" | "onSelect"> & {
69
+ }, "key" | keyof React.HTMLAttributes<HTMLDivElement> | "asChild">, "value" | "disabled" | "onSelect"> & {
70
70
  disabled?: boolean;
71
71
  onSelect?: (value: string) => void;
72
72
  value?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telamonjs/ui",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "description": "Admin framework for Next.js + React: declarative CRUD (CrudConfig + TanStack Query), 36-type field system, rich dialogs, app shell, dashboards and charts",
6
6
  "main": "dist/index.js",
@@ -126,6 +126,7 @@
126
126
  "next-themes": "^0.4.6",
127
127
  "react-aria": "^3.44.0",
128
128
  "react-day-picker": "^9.11.1",
129
+ "react-grid-layout": "^2.2.4",
129
130
  "react-is": "^19.2.0",
130
131
  "react-resizable-panels": "^3.0.6",
131
132
  "react-stately": "^3.42.0",
@@ -145,7 +146,6 @@
145
146
  "papaparse": "^5.5.0",
146
147
  "react": "^18.0.0 || ^19.0.0",
147
148
  "react-dom": "^18.0.0 || ^19.0.0",
148
- "react-grid-layout": "^1.5.0 || ^2.0.0",
149
149
  "react-hook-form": "^7.0.0",
150
150
  "sonner": "^1.7.1 || ^2.0.7",
151
151
  "xlsx": "^0.18.0",
@@ -156,9 +156,6 @@
156
156
  "peerDependenciesMeta": {
157
157
  "@prisma/client": {
158
158
  "optional": true
159
- },
160
- "react-grid-layout": {
161
- "optional": true
162
159
  }
163
160
  },
164
161
  "devDependencies": {