@djangocfg/ui-core 2.1.252 → 2.1.254

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/README.md CHANGED
@@ -39,6 +39,8 @@ pnpm add @djangocfg/ui-core
39
39
  ### Overlay (7)
40
40
  `Dialog` `AlertDialog` `Sheet` `Drawer` `Popover` `HoverCard` `Tooltip`
41
41
 
42
+ Default **`TooltipContent`** styling uses semantic **popover** tokens (`bg-popover`, `text-popover-foreground`, `border-border`, shadow) — not `primary` — so hints read as neutral floating UI.
43
+
42
44
  ### Feedback (5)
43
45
  `Toaster` `Alert` `Progress` `Badge` `Avatar`
44
46
 
@@ -51,7 +53,7 @@ pnpm add @djangocfg/ui-core
51
53
  ### Specialized (13)
52
54
  `ButtonGroup` `Empty` `Spinner` `Preloader` `Kbd` `TokenIcon` `InputGroup` `Item` `ImageWithFallback` `OgImage` `CopyButton` `CopyField` `StaticPagination`
53
55
 
54
- ## Hooks (16)
56
+ ## Hooks (17)
55
57
 
56
58
  | Hook | Description |
57
59
  |------|-------------|
@@ -68,6 +70,7 @@ pnpm add @djangocfg/ui-core
68
70
  | `useEventListener` | Event bus |
69
71
  | `useDebugTools` | Debug utilities |
70
72
  | `useHotkey` | Keyboard shortcuts (react-hotkeys-hook) |
73
+ | `useShortcutModLabel()` | Returns `⌘` or `Ctrl` for shortcut hints (Apple vs Windows/Linux); pairs with `metaKey \|\| ctrlKey` handlers |
71
74
  | `useBrowserDetect` | Browser detection (Chrome, Safari, in-app browsers, etc.) |
72
75
  | `useDeviceDetect` | Device detection (mobile, tablet, desktop, OS, etc.) |
73
76
  | `useResolvedTheme` | Current resolved theme (light/dark/system) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/ui-core",
3
- "version": "2.1.252",
3
+ "version": "2.1.254",
4
4
  "description": "Pure React UI component library without Next.js dependencies - for Electron, Vite, CRA apps",
5
5
  "keywords": [
6
6
  "ui-components",
@@ -81,7 +81,7 @@
81
81
  "playground": "playground dev"
82
82
  },
83
83
  "peerDependencies": {
84
- "@djangocfg/i18n": "^2.1.252",
84
+ "@djangocfg/i18n": "^2.1.254",
85
85
  "consola": "^3.4.2",
86
86
  "lucide-react": "^0.545.0",
87
87
  "moment": "^2.30.1",
@@ -143,9 +143,9 @@
143
143
  "vaul": "1.1.2"
144
144
  },
145
145
  "devDependencies": {
146
- "@djangocfg/i18n": "^2.1.252",
146
+ "@djangocfg/i18n": "^2.1.254",
147
147
  "@djangocfg/playground": "workspace:*",
148
- "@djangocfg/typescript-config": "^2.1.252",
148
+ "@djangocfg/typescript-config": "^2.1.254",
149
149
  "@types/node": "^24.7.2",
150
150
  "@types/react": "^19.1.0",
151
151
  "@types/react-dom": "^19.1.0",
@@ -21,7 +21,7 @@ const TooltipContent = React.forwardRef<
21
21
  ref={ref}
22
22
  sideOffset={sideOffset}
23
23
  className={cn(
24
- "z-150 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
24
+ "z-[200] overflow-hidden rounded-md border border-border bg-popover px-3 py-1.5 text-xs text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
25
25
  className
26
26
  )}
27
27
  {...props}
@@ -25,6 +25,7 @@ export { useStoredValue } from './useStoredValue';
25
25
  export type { UseStoredValueOptions, StorageType } from './useStoredValue';
26
26
  export { useHotkey, useHotkeysContext, HotkeysProvider, isHotkeyPressed } from './useHotkey';
27
27
  export type { UseHotkeyOptions, HotkeyCallback, Keys, HotkeyRefType } from './useHotkey';
28
+ export { useShortcutModLabel } from './useShortcutModLabel';
28
29
  export { useBrowserDetect } from './useBrowserDetect';
29
30
  export type { BrowserInfo } from './useBrowserDetect';
30
31
  export { useDeviceDetect } from './useDeviceDetect';
@@ -0,0 +1,26 @@
1
+ 'use client';
2
+
3
+ import { useSyncExternalStore } from 'react';
4
+
5
+ const noopSubscribe = () => () => {};
6
+
7
+ /**
8
+ * Apple platforms use Meta (⌘) for “primary” shortcuts; Windows/Linux use Ctrl.
9
+ * Matches typical `event.metaKey || event.ctrlKey` handling in app hotkeys.
10
+ */
11
+ function isAppleLikeClient(): boolean {
12
+ if (typeof navigator === 'undefined') return false;
13
+ const ua = navigator.userAgent;
14
+ if (/Mac|iPhone|iPad|iPod/i.test(ua)) return true;
15
+ // iPadOS 13+ may report as MacIntel with touch
16
+ if (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1) return true;
17
+ return false;
18
+ }
19
+
20
+ /**
21
+ * Modifier label for shortcut hints (e.g. tooltips): `⌘` on Apple, `Ctrl` elsewhere.
22
+ * SSR / first server snapshot returns `Ctrl` to match `getServerSnapshot`.
23
+ */
24
+ export function useShortcutModLabel(): '⌘' | 'Ctrl' {
25
+ return useSyncExternalStore(noopSubscribe, () => (isAppleLikeClient() ? '⌘' : 'Ctrl'), () => 'Ctrl');
26
+ }
@@ -39,6 +39,8 @@
39
39
 
40
40
  /* Sidebar colors */
41
41
  --color-sidebar-background: hsl(var(--sidebar-background));
42
+ /* Shorthand used by shadcn sidebar (`bg-sidebar` / `text-sidebar`) — same surface as sidebar-background */
43
+ --color-sidebar: hsl(var(--sidebar-background));
42
44
  --color-sidebar-foreground: hsl(var(--sidebar-foreground));
43
45
  --color-sidebar-primary: hsl(var(--sidebar-primary));
44
46
  --color-sidebar-primary-foreground: hsl(var(--sidebar-primary-foreground));