@djangocfg/layouts 2.1.163 → 2.1.165

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/layouts",
3
- "version": "2.1.163",
3
+ "version": "2.1.165",
4
4
  "description": "Simple, straightforward layout components for Next.js - import and use with props",
5
5
  "keywords": [
6
6
  "layouts",
@@ -74,12 +74,12 @@
74
74
  "check": "tsc --noEmit"
75
75
  },
76
76
  "peerDependencies": {
77
- "@djangocfg/api": "^2.1.163",
78
- "@djangocfg/centrifugo": "^2.1.163",
79
- "@djangocfg/i18n": "^2.1.163",
80
- "@djangocfg/ui-core": "^2.1.163",
81
- "@djangocfg/ui-nextjs": "^2.1.163",
82
- "@djangocfg/ui-tools": "^2.1.163",
77
+ "@djangocfg/api": "^2.1.165",
78
+ "@djangocfg/centrifugo": "^2.1.165",
79
+ "@djangocfg/i18n": "^2.1.165",
80
+ "@djangocfg/ui-core": "^2.1.165",
81
+ "@djangocfg/ui-nextjs": "^2.1.165",
82
+ "@djangocfg/ui-tools": "^2.1.165",
83
83
  "@hookform/resolvers": "^5.2.2",
84
84
  "consola": "^3.4.2",
85
85
  "lucide-react": "^0.545.0",
@@ -102,13 +102,13 @@
102
102
  "uuid": "^11.1.0"
103
103
  },
104
104
  "devDependencies": {
105
- "@djangocfg/api": "^2.1.163",
106
- "@djangocfg/i18n": "^2.1.163",
107
- "@djangocfg/centrifugo": "^2.1.163",
108
- "@djangocfg/typescript-config": "^2.1.163",
109
- "@djangocfg/ui-core": "^2.1.163",
110
- "@djangocfg/ui-nextjs": "^2.1.163",
111
- "@djangocfg/ui-tools": "^2.1.163",
105
+ "@djangocfg/api": "^2.1.165",
106
+ "@djangocfg/i18n": "^2.1.165",
107
+ "@djangocfg/centrifugo": "^2.1.165",
108
+ "@djangocfg/typescript-config": "^2.1.165",
109
+ "@djangocfg/ui-core": "^2.1.165",
110
+ "@djangocfg/ui-nextjs": "^2.1.165",
111
+ "@djangocfg/ui-tools": "^2.1.165",
112
112
  "@types/node": "^24.7.2",
113
113
  "@types/react": "^19.1.0",
114
114
  "@types/react-dom": "^19.1.0",
@@ -24,6 +24,7 @@ import {
24
24
  DropdownMenuContent,
25
25
  DropdownMenuItem,
26
26
  DropdownMenuTrigger,
27
+ getLanguageFlag,
27
28
  } from '@djangocfg/ui-core/components';
28
29
 
29
30
  // Default locale labels
@@ -61,8 +62,10 @@ export interface LocaleSwitcherProps {
61
62
  variant?: 'ghost' | 'outline' | 'default';
62
63
  /** Button size */
63
64
  size?: 'sm' | 'default' | 'lg' | 'icon';
64
- /** Show icon */
65
+ /** Show icon (Globe icon, default: true) */
65
66
  showIcon?: boolean;
67
+ /** Show flag emoji (default: true) */
68
+ showFlag?: boolean;
66
69
  /** Custom className */
67
70
  className?: string;
68
71
  }
@@ -76,6 +79,7 @@ export function LocaleSwitcher({
76
79
  variant = 'ghost',
77
80
  size = 'sm',
78
81
  showIcon = true,
82
+ showFlag = true,
79
83
  className,
80
84
  }: LocaleSwitcherProps) {
81
85
  const allLabels = { ...DEFAULT_LABELS, ...labels };
@@ -88,26 +92,38 @@ export function LocaleSwitcher({
88
92
  return label;
89
93
  };
90
94
 
95
+ const getFlag = (code: string) => {
96
+ if (!showFlag) return null;
97
+ const flag = getLanguageFlag(code);
98
+ return flag || null;
99
+ };
100
+
91
101
  const currentLabel = showCode ? locale.toUpperCase() : getLabel(locale);
102
+ const currentFlag = getFlag(locale);
92
103
 
93
104
  return (
94
105
  <DropdownMenu>
95
106
  <DropdownMenuTrigger asChild>
96
107
  <Button variant={variant} size={size} className={className}>
97
- {showIcon && <Globe className="h-4 w-4 mr-1" />}
108
+ {showIcon && !currentFlag && <Globe className="h-4 w-4 mr-1" />}
109
+ {currentFlag && <span className="mr-1">{currentFlag}</span>}
98
110
  <span>{currentLabel}</span>
99
111
  </Button>
100
112
  </DropdownMenuTrigger>
101
113
  <DropdownMenuContent align="end">
102
- {locales.map((code) => (
103
- <DropdownMenuItem
104
- key={code}
105
- onClick={() => onChange(code)}
106
- className={code === locale ? 'bg-accent' : ''}
107
- >
108
- {getLabel(code)}
109
- </DropdownMenuItem>
110
- ))}
114
+ {locales.map((code) => {
115
+ const flag = getFlag(code);
116
+ return (
117
+ <DropdownMenuItem
118
+ key={code}
119
+ onClick={() => onChange(code)}
120
+ className={code === locale ? 'bg-accent' : ''}
121
+ >
122
+ {flag && <span className="mr-2">{flag}</span>}
123
+ {getLabel(code)}
124
+ </DropdownMenuItem>
125
+ );
126
+ })}
111
127
  </DropdownMenuContent>
112
128
  </DropdownMenu>
113
129
  );