@tristan2828/ui-foundation 4.121.0 → 4.122.0

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.
@@ -1,5 +1,5 @@
1
1
  import { useSyncExternalStore } from 'react';
2
- // Whether the screen is under 48rem (useIsMobile's 768px), read through
2
+ // Whether the screen is under 48rem (768px; useIsMobile returns this), read through
3
3
  // matchMedia as a store, so rendering on the server or where matchMedia is
4
4
  // missing (a test's DOM) gives "not a phone" instead of failing on
5
5
  // `window`. DataTable's row list, FilterBar and SecondaryFilters' sheet
@@ -1,14 +1,8 @@
1
- import * as React from "react";
2
- const MOBILE_BREAKPOINT = 768;
1
+ import { useIsPhone } from "./use-is-phone.js";
2
+ // shadcn's hook (the sidebar, sonner and the package's own code read it),
3
+ // answered by useIsPhone so the 768px breakpoint lives in one place. Same
4
+ // result as shadcn's own `window.innerWidth < 768`, and safe where
5
+ // matchMedia is missing.
3
6
  export function useIsMobile() {
4
- const [isMobile, setIsMobile] = React.useState(() => window.innerWidth < MOBILE_BREAKPOINT);
5
- React.useEffect(() => {
6
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
7
- const onChange = () => {
8
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
9
- };
10
- mql.addEventListener("change", onChange);
11
- return () => mql.removeEventListener("change", onChange);
12
- }, []);
13
- return isMobile;
7
+ return useIsPhone();
14
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tristan2828/ui-foundation",
3
- "version": "4.121.0",
3
+ "version": "4.122.0",
4
4
  "description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
5
5
  "license": "MIT",
6
6
  "repository": {