hazo_ui 6.9.0 → 6.11.1

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.
@@ -0,0 +1,325 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
4
+ import { ChevronRight, Check, Circle, ChevronDown, Globe } from 'lucide-react';
5
+ import { clsx } from 'clsx';
6
+ import { twMerge } from 'tailwind-merge';
7
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
+ import { Slot } from '@radix-ui/react-slot';
9
+ import { cva } from 'class-variance-authority';
10
+
11
+ function cn(...inputs) {
12
+ return twMerge(clsx(inputs));
13
+ }
14
+ function safeHref(url) {
15
+ if (!url) return void 0;
16
+ const trimmed = url.trim();
17
+ const lower = trimmed.toLowerCase();
18
+ if (lower.startsWith("http://") || lower.startsWith("https://") || lower.startsWith("mailto:")) {
19
+ return trimmed;
20
+ }
21
+ if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
22
+ return trimmed;
23
+ }
24
+ return void 0;
25
+ }
26
+ var DropdownMenu = DropdownMenuPrimitive.Root;
27
+ var DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
28
+ var DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
29
+ var DropdownMenuSubTrigger = React.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxs(
30
+ DropdownMenuPrimitive.SubTrigger,
31
+ {
32
+ ref,
33
+ className: cn(
34
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
35
+ inset && "pl-8",
36
+ className
37
+ ),
38
+ ...props,
39
+ children: [
40
+ children,
41
+ /* @__PURE__ */ jsx(ChevronRight, { className: "ml-auto h-4 w-4" })
42
+ ]
43
+ }
44
+ ));
45
+ DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
46
+ var DropdownMenuSubContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
47
+ DropdownMenuPrimitive.SubContent,
48
+ {
49
+ ref,
50
+ className: cn(
51
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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",
52
+ className
53
+ ),
54
+ ...props
55
+ }
56
+ ));
57
+ DropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;
58
+ var DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx(
59
+ DropdownMenuPrimitive.Content,
60
+ {
61
+ ref,
62
+ sideOffset,
63
+ className: cn(
64
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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",
65
+ className
66
+ ),
67
+ ...props
68
+ }
69
+ ) }));
70
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
71
+ var DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
72
+ DropdownMenuPrimitive.Item,
73
+ {
74
+ ref,
75
+ className: cn(
76
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
77
+ inset && "pl-8",
78
+ className
79
+ ),
80
+ ...props
81
+ }
82
+ ));
83
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
84
+ var DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxs(
85
+ DropdownMenuPrimitive.CheckboxItem,
86
+ {
87
+ ref,
88
+ className: cn(
89
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
90
+ className
91
+ ),
92
+ checked,
93
+ ...props,
94
+ children: [
95
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" }) }) }),
96
+ children
97
+ ]
98
+ }
99
+ ));
100
+ DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
101
+ var DropdownMenuRadioItem = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
102
+ DropdownMenuPrimitive.RadioItem,
103
+ {
104
+ ref,
105
+ className: cn(
106
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
107
+ className
108
+ ),
109
+ ...props,
110
+ children: [
111
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }),
112
+ children
113
+ ]
114
+ }
115
+ ));
116
+ DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;
117
+ var DropdownMenuLabel = React.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsx(
118
+ DropdownMenuPrimitive.Label,
119
+ {
120
+ ref,
121
+ className: cn(
122
+ "px-2 py-1.5 text-sm font-semibold",
123
+ inset && "pl-8",
124
+ className
125
+ ),
126
+ ...props
127
+ }
128
+ ));
129
+ DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;
130
+ var DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
131
+ DropdownMenuPrimitive.Separator,
132
+ {
133
+ ref,
134
+ className: cn("-mx-1 my-1 h-px bg-muted", className),
135
+ ...props
136
+ }
137
+ ));
138
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
139
+ var buttonVariants = cva(
140
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
141
+ {
142
+ variants: {
143
+ variant: {
144
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
145
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
146
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
147
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
148
+ ghost: "hover:bg-accent hover:text-accent-foreground",
149
+ link: "text-primary underline-offset-4 hover:underline"
150
+ },
151
+ size: {
152
+ default: "h-10 px-4 py-2",
153
+ sm: "h-9 rounded-md px-3",
154
+ lg: "h-11 rounded-md px-8",
155
+ icon: "h-10 w-10"
156
+ }
157
+ },
158
+ defaultVariants: {
159
+ variant: "default",
160
+ size: "default"
161
+ }
162
+ }
163
+ );
164
+ var Button = React.forwardRef(
165
+ ({ className, variant, size, asChild = false, style, ...props }, ref) => {
166
+ const Comp = asChild ? Slot : "button";
167
+ return /* @__PURE__ */ jsx(
168
+ Comp,
169
+ {
170
+ className: cn(buttonVariants({ variant, size, className })),
171
+ style,
172
+ ref,
173
+ ...props
174
+ }
175
+ );
176
+ }
177
+ );
178
+ Button.displayName = "Button";
179
+ var native_name_cache = /* @__PURE__ */ new Map();
180
+ function get_native_name(code) {
181
+ const cached = native_name_cache.get(code);
182
+ if (cached !== void 0) return cached;
183
+ let name = code;
184
+ if (typeof Intl !== "undefined" && "DisplayNames" in Intl) {
185
+ try {
186
+ const display_names = new Intl.DisplayNames([code], {
187
+ type: "language",
188
+ languageDisplay: "standard"
189
+ });
190
+ name = display_names.of(code) ?? code;
191
+ } catch {
192
+ name = code;
193
+ }
194
+ }
195
+ native_name_cache.set(code, name);
196
+ return name;
197
+ }
198
+ function build_label(code, display) {
199
+ if (display === "code") return code.toUpperCase();
200
+ const native = get_native_name(code);
201
+ if (display === "native+code") return `${native} (${code.toUpperCase()})`;
202
+ return native;
203
+ }
204
+ var STRIPE_FLAGS = {
205
+ de: { dir: "h", colors: ["#000000", "#DD0000", "#FFCE00"] },
206
+ fr: { dir: "v", colors: ["#0055A4", "#FFFFFF", "#EF4135"] },
207
+ it: { dir: "v", colors: ["#009246", "#FFFFFF", "#CE2B37"] },
208
+ es: { dir: "h", colors: ["#AA151B", "#F1BF00", "#AA151B"] },
209
+ pt: { dir: "v", colors: ["#046A38", "#FFFFFF", "#DA291C"] },
210
+ nl: { dir: "h", colors: ["#AE1C28", "#FFFFFF", "#21468B"] }
211
+ };
212
+ var NORDIC_CROSS_FLAGS = {
213
+ sv: { bg: "#006AA7", cross: "#FECC00" },
214
+ fi: { bg: "#FFFFFF", cross: "#003580" }
215
+ };
216
+ function StripeFlag({
217
+ dir,
218
+ colors
219
+ }) {
220
+ const band = 12 / colors.length;
221
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 12", width: "16", height: "12", "aria-hidden": "true", focusable: "false", children: colors.map(
222
+ (color, i) => dir === "h" ? /* @__PURE__ */ jsx("rect", { x: 0, y: i * band, width: 16, height: band, fill: color }, i) : /* @__PURE__ */ jsx("rect", { x: i * (16 / colors.length), y: 0, width: 16 / colors.length, height: 12, fill: color }, i)
223
+ ) });
224
+ }
225
+ function NordicCrossFlag({ bg, cross }) {
226
+ return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 12", width: "16", height: "12", "aria-hidden": "true", focusable: "false", children: [
227
+ /* @__PURE__ */ jsx("rect", { width: "16", height: "12", fill: bg }),
228
+ /* @__PURE__ */ jsx("rect", { x: "5", width: "2", height: "12", fill: cross }),
229
+ /* @__PURE__ */ jsx("rect", { y: "5", width: "16", height: "2", fill: cross })
230
+ ] });
231
+ }
232
+ function get_flag_node(code) {
233
+ const lang = code.toLowerCase().split(/[-_]/)[0];
234
+ const cross = NORDIC_CROSS_FLAGS[lang];
235
+ if (cross) return /* @__PURE__ */ jsx(NordicCrossFlag, { ...cross });
236
+ const stripes = STRIPE_FLAGS[lang];
237
+ if (stripes) return /* @__PURE__ */ jsx(StripeFlag, { ...stripes });
238
+ return /* @__PURE__ */ jsx(Globe, { className: "h-3 w-3", "aria-hidden": "true" });
239
+ }
240
+ function FlagIcon({ code }) {
241
+ return /* @__PURE__ */ jsx("span", { className: "cls_locale_picker_flag inline-flex h-3.5 w-4 shrink-0 items-center justify-center overflow-hidden rounded-[2px]", children: get_flag_node(code) });
242
+ }
243
+ function LocalePicker({
244
+ variant = "dropdown",
245
+ show = "auto",
246
+ display = "native",
247
+ flags = false,
248
+ alternates,
249
+ activeLocale,
250
+ triggerLabel = "Change language",
251
+ className
252
+ }) {
253
+ const options = React.useMemo(() => {
254
+ return Object.entries(alternates ?? {}).map(([code, url]) => {
255
+ const href = safeHref(url);
256
+ if (!href) return null;
257
+ return { code, href, label: build_label(code, display) };
258
+ }).filter((o) => o !== null);
259
+ }, [alternates, display]);
260
+ if (show === "never") return null;
261
+ if (options.length === 0) return null;
262
+ if (show === "auto" && options.length < 2) return null;
263
+ if (variant === "inline") {
264
+ return /* @__PURE__ */ jsx(
265
+ "nav",
266
+ {
267
+ "aria-label": triggerLabel,
268
+ className: cn("cls_locale_picker_inline flex items-center gap-1", className),
269
+ children: options.map((opt) => /* @__PURE__ */ jsxs(
270
+ "a",
271
+ {
272
+ href: opt.href,
273
+ lang: opt.code,
274
+ "aria-current": opt.code === activeLocale ? "true" : void 0,
275
+ className: cn(
276
+ "cls_locale_picker_inline_item inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-sm transition-colors hover:bg-accent hover:text-accent-foreground",
277
+ opt.code === activeLocale && "bg-accent font-medium text-accent-foreground"
278
+ ),
279
+ children: [
280
+ flags && /* @__PURE__ */ jsx(FlagIcon, { code: opt.code }),
281
+ /* @__PURE__ */ jsx("span", { children: opt.label })
282
+ ]
283
+ },
284
+ opt.code
285
+ ))
286
+ }
287
+ );
288
+ }
289
+ const active_option = options.find((o) => o.code === activeLocale);
290
+ return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
291
+ /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
292
+ Button,
293
+ {
294
+ variant: "outline",
295
+ size: "sm",
296
+ lang: activeLocale,
297
+ "aria-label": triggerLabel,
298
+ className: cn("cls_locale_picker_trigger gap-1.5", className),
299
+ children: [
300
+ flags && /* @__PURE__ */ jsx(FlagIcon, { code: active_option?.code ?? options[0].code }),
301
+ /* @__PURE__ */ jsx("span", { className: "cls_locale_picker_trigger_label", children: variant === "compact" ? (active_option ?? options[0]).code.toUpperCase() : (active_option ?? options[0]).label }),
302
+ /* @__PURE__ */ jsx(ChevronDown, { className: "h-3.5 w-3.5 opacity-60", "aria-hidden": "true" })
303
+ ]
304
+ }
305
+ ) }),
306
+ /* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", className: "cls_locale_picker_content", children: /* @__PURE__ */ jsx(DropdownMenuRadioGroup, { value: activeLocale, children: options.map((opt) => /* @__PURE__ */ jsx(DropdownMenuPrimitive.RadioItem, { value: opt.code, asChild: true, children: /* @__PURE__ */ jsxs(
307
+ "a",
308
+ {
309
+ href: opt.href,
310
+ lang: opt.code,
311
+ className: "cls_locale_picker_radio_item relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
312
+ children: [
313
+ /* @__PURE__ */ jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(DropdownMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(Circle, { className: "h-2 w-2 fill-current" }) }) }),
314
+ flags && /* @__PURE__ */ jsx(FlagIcon, { code: opt.code }),
315
+ /* @__PURE__ */ jsx("span", { children: opt.label })
316
+ ]
317
+ }
318
+ ) }, opt.code)) }) })
319
+ ] });
320
+ }
321
+ LocalePicker.displayName = "LocalePicker";
322
+
323
+ export { LocalePicker };
324
+ //# sourceMappingURL=index.locale-picker.js.map
325
+ //# sourceMappingURL=index.locale-picker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/utils.ts","../src/components/ui/dropdown-menu.tsx","../src/components/ui/button.tsx","../src/components/locale_picker/index.tsx"],"names":["React2","jsx","jsxs","React3","DropdownMenuPrimitive2","Circle"],"mappings":";;;;;;;;;AAWO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B;AAWO,SAAS,SAAS,GAAA,EAAkC;AACzD,EAAA,IAAI,CAAC,KAAK,OAAO,MAAA;AACjB,EAAA,MAAM,OAAA,GAAU,IAAI,IAAA,EAAK;AACzB,EAAA,MAAM,KAAA,GAAQ,QAAQ,WAAA,EAAY;AAClC,EAAA,IACE,KAAA,CAAM,UAAA,CAAW,SAAS,CAAA,IAC1B,KAAA,CAAM,UAAA,CAAW,UAAU,CAAA,IAC3B,KAAA,CAAM,UAAA,CAAW,SAAS,CAAA,EAC1B;AACA,IAAA,OAAO,OAAA;AAAA,EACT;AAEA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kBAAAH,IAACI,MAAAA,EAAA,EAAO,SAAA,EAAU,sBAAA,EAAuB,GAC3C,CAAA,EACF,CAAA;AAAA,UACC,yBAASJ,GAAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAM,IAAI,IAAA,EAAM,CAAA;AAAA,0BACpCA,GAAAA,CAAC,MAAA,EAAA,EAAM,QAAA,EAAA,GAAA,CAAI,KAAA,EAAM;AAAA;AAAA;AAAA,KACnB,EAAA,EAboC,GAAA,CAAI,IAc1C,CACD,GACH,CAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;AAEA,YAAA,CAAa,WAAA,GAAc,cAAA","file":"index.locale-picker.js","sourcesContent":["// Utility functions for hazo_ui component library\n// Provides className merging utility (cn function)\n\nimport { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merges class names using clsx and tailwind-merge\n * @param inputs - Class values to merge\n * @returns Merged class string\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\n/**\n * Sanitizes a user/admin-supplied href against a scheme allowlist to prevent\n * `javascript:`/`data:`/`vbscript:` URI XSS when the value is rendered into an\n * `<a href>`. Allows http(s), mailto, and same-origin absolute paths (`/…` but\n * not protocol-relative `//…`). Returns `undefined` for anything else, so the\n * anchor renders with no href rather than an active malicious one.\n * @param url - Candidate href (may be undefined)\n * @returns The original url if allowed, otherwise undefined\n */\nexport function safeHref(url?: string): string | undefined {\n if (!url) return undefined;\n const trimmed = url.trim();\n const lower = trimmed.toLowerCase();\n if (\n lower.startsWith(\"http://\") ||\n lower.startsWith(\"https://\") ||\n lower.startsWith(\"mailto:\")\n ) {\n return trimmed;\n }\n // Same-origin absolute path, but not protocol-relative \"//host\".\n if (trimmed.startsWith(\"/\") && !trimmed.startsWith(\"//\")) {\n return trimmed;\n }\n return undefined;\n}\n\n","// DropdownMenu component for hazo_ui library\n// Based on shadcn/ui dropdown-menu component\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { Check, ChevronRight, Circle } from \"lucide-react\";\nimport { cn } from \"../../lib/utils\";\n\nconst DropdownMenu = DropdownMenuPrimitive.Root;\nconst DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;\nconst DropdownMenuGroup = DropdownMenuPrimitive.Group;\nconst DropdownMenuPortal = DropdownMenuPrimitive.Portal;\nconst DropdownMenuSub = DropdownMenuPrimitive.Sub;\nconst DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <DropdownMenuPrimitive.SubTrigger\n ref={ref}\n className={cn(\n \"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n >\n {children}\n <ChevronRight className=\"ml-auto h-4 w-4\" />\n </DropdownMenuPrimitive.SubTrigger>\n));\nDropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.SubContent>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.SubContent\n ref={ref}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuSubContent.displayName = DropdownMenuPrimitive.SubContent.displayName;\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <DropdownMenuPrimitive.Portal>\n <DropdownMenuPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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\",\n className\n )}\n {...props}\n />\n </DropdownMenuPrimitive.Portal>\n));\nDropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;\n\nconst DropdownMenuCheckboxItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>\n>(({ className, children, checked, ...props }, ref) => (\n <DropdownMenuPrimitive.CheckboxItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n checked={checked}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n));\nDropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;\n\nconst DropdownMenuRadioItem = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem>\n>(({ className, children, ...props }, ref) => (\n <DropdownMenuPrimitive.RadioItem\n ref={ref}\n className={cn(\n \"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className\n )}\n {...props}\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.RadioItem>\n));\nDropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName;\n\nconst DropdownMenuLabel = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Label>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n }\n>(({ className, inset, ...props }, ref) => (\n <DropdownMenuPrimitive.Label\n ref={ref}\n className={cn(\n \"px-2 py-1.5 text-sm font-semibold\",\n inset && \"pl-8\",\n className\n )}\n {...props}\n />\n));\nDropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName;\n\nconst DropdownMenuSeparator = React.forwardRef<\n React.ElementRef<typeof DropdownMenuPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <DropdownMenuPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n));\nDropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;\n\nconst DropdownMenuShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)}\n {...props}\n />\n );\n};\nDropdownMenuShortcut.displayName = \"DropdownMenuShortcut\";\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n};\n","// Button component for hazo_ui library\n// Based on shadcn/ui button component\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive: \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline: \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary: \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-10 w-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, style, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n style={style}\n ref={ref}\n {...props}\n />\n );\n }\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n\n","\"use client\";\n\n/**\n * LocalePicker — standard language switcher for hazo_* apps (FR-030).\n *\n * Purely prop-driven: no hazo_i18n dependency, no context, no fetch. A\n * consumer supplies `alternates` (the same locale -> URL map used for\n * `<head>` hreflang) and this renders a picker that can only ever offer\n * URLs that exist. Works identically whether hazo_i18n exists or not —\n * today it doesn't, so this component has zero runtime dependency on it.\n *\n * Built on the same Radix DropdownMenu primitives as\n * `src/components/ui/dropdown-menu.tsx`, but each option is rendered as a\n * real `<a href>` (via Radix's `asChild`) rather than a JS-only click\n * handler, so it stays crawlable and middle-click-openable.\n */\n\nimport * as React from \"react\";\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport { Circle, ChevronDown, Globe } from \"lucide-react\";\nimport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuRadioGroup,\n} from \"../ui/dropdown-menu\";\nimport { Button } from \"../ui/button\";\nimport { cn, safeHref } from \"../../lib/utils\";\n\nexport type LocalePickerVariant = \"dropdown\" | \"inline\" | \"compact\";\nexport type LocalePickerShow = \"auto\" | \"always\" | \"never\";\nexport type LocalePickerDisplay = \"native\" | \"native+code\" | \"code\";\n\nexport interface LocalePickerProps {\n /** Visual form. `dropdown` (default) and `compact` are Radix dropdown\n * menus; `inline` renders a flat row of links with no popover. */\n variant?: LocalePickerVariant;\n /** `auto` (default) renders nothing when fewer than two locales are\n * offered — single-locale apps need no conditional around this\n * component. `always` / `never` override that. */\n show?: LocalePickerShow;\n /** How each option's label is built. Default `native` — the language's\n * own name in its own script (`Deutsch`, `Svenska`), not an English\n * name and not a flag (PRD-hazo_i18n §11.2). */\n display?: LocalePickerDisplay;\n /** Render an inline SVG flag alongside each option. Default false.\n * Never emoji — Segoe UI Emoji ships no regional-indicator glyphs, so\n * flag emoji render as two letter-boxes on Windows Chrome/Edge. */\n flags?: boolean;\n /** hreflang code -> URL for the current page. The picker can only ever\n * offer locales present here — same map used for `<head>` hreflang. */\n alternates: Record<string, string>;\n /** Currently active locale, used to mark the selected option. */\n activeLocale?: string;\n /** aria-label for the trigger (dropdown/compact) or the `<nav>`\n * (inline). Defaults to a plain English \"Change language\". */\n triggerLabel?: string;\n className?: string;\n}\n\ninterface LocalePickerOption {\n code: string;\n href: string;\n label: string;\n}\n\n// ────────────────────────────────────────────────────────────────────────\n// Native language names — Intl.DisplayNames instantiated PER LANGUAGE in\n// that language's own locale, so German renders \"Deutsch\" (not \"German\"),\n// Swedish renders \"Svenska\" (not \"Swedish\"), etc.\n// ────────────────────────────────────────────────────────────────────────\n\nconst native_name_cache = new Map<string, string>();\n\nfunction get_native_name(code: string): string {\n const cached = native_name_cache.get(code);\n if (cached !== undefined) return cached;\n\n let name = code;\n if (typeof Intl !== \"undefined\" && \"DisplayNames\" in Intl) {\n try {\n const display_names = new Intl.DisplayNames([code], {\n type: \"language\",\n languageDisplay: \"standard\",\n });\n name = display_names.of(code) ?? code;\n } catch {\n name = code;\n }\n }\n native_name_cache.set(code, name);\n return name;\n}\n\nfunction build_label(code: string, display: LocalePickerDisplay): string {\n if (display === \"code\") return code.toUpperCase();\n const native = get_native_name(code);\n if (display === \"native+code\") return `${native} (${code.toUpperCase()})`;\n return native;\n}\n\n// ────────────────────────────────────────────────────────────────────────\n// Flags — minimal inline SVGs for a handful of common locales; anything\n// else (including English, deliberately — see PRD-hazo_i18n §11.2 on why\n// English has no single honest flag) falls back to a generic globe icon.\n// Never emoji.\n// ────────────────────────────────────────────────────────────────────────\n\nconst STRIPE_FLAGS: Record<string, { dir: \"h\" | \"v\"; colors: string[] }> = {\n de: { dir: \"h\", colors: [\"#000000\", \"#DD0000\", \"#FFCE00\"] },\n fr: { dir: \"v\", colors: [\"#0055A4\", \"#FFFFFF\", \"#EF4135\"] },\n it: { dir: \"v\", colors: [\"#009246\", \"#FFFFFF\", \"#CE2B37\"] },\n es: { dir: \"h\", colors: [\"#AA151B\", \"#F1BF00\", \"#AA151B\"] },\n pt: { dir: \"v\", colors: [\"#046A38\", \"#FFFFFF\", \"#DA291C\"] },\n nl: { dir: \"h\", colors: [\"#AE1C28\", \"#FFFFFF\", \"#21468B\"] },\n};\n\nconst NORDIC_CROSS_FLAGS: Record<string, { bg: string; cross: string }> = {\n sv: { bg: \"#006AA7\", cross: \"#FECC00\" },\n fi: { bg: \"#FFFFFF\", cross: \"#003580\" },\n};\n\nfunction StripeFlag({\n dir,\n colors,\n}: {\n dir: \"h\" | \"v\";\n colors: string[];\n}): React.ReactElement {\n const band = 12 / colors.length;\n return (\n <svg viewBox=\"0 0 16 12\" width=\"16\" height=\"12\" aria-hidden=\"true\" focusable=\"false\">\n {colors.map((color, i) =>\n dir === \"h\" ? (\n <rect key={i} x={0} y={i * band} width={16} height={band} fill={color} />\n ) : (\n <rect key={i} x={i * (16 / colors.length)} y={0} width={16 / colors.length} height={12} fill={color} />\n )\n )}\n </svg>\n );\n}\n\nfunction NordicCrossFlag({ bg, cross }: { bg: string; cross: string }): React.ReactElement {\n return (\n <svg viewBox=\"0 0 16 12\" width=\"16\" height=\"12\" aria-hidden=\"true\" focusable=\"false\">\n <rect width=\"16\" height=\"12\" fill={bg} />\n <rect x=\"5\" width=\"2\" height=\"12\" fill={cross} />\n <rect y=\"5\" width=\"16\" height=\"2\" fill={cross} />\n </svg>\n );\n}\n\nfunction get_flag_node(code: string): React.ReactNode {\n const lang = code.toLowerCase().split(/[-_]/)[0];\n const cross = NORDIC_CROSS_FLAGS[lang];\n if (cross) return <NordicCrossFlag {...cross} />;\n const stripes = STRIPE_FLAGS[lang];\n if (stripes) return <StripeFlag {...stripes} />;\n return <Globe className=\"h-3 w-3\" aria-hidden=\"true\" />;\n}\n\nfunction FlagIcon({ code }: { code: string }): React.ReactElement {\n return (\n <span className=\"cls_locale_picker_flag inline-flex h-3.5 w-4 shrink-0 items-center justify-center overflow-hidden rounded-[2px]\">\n {get_flag_node(code)}\n </span>\n );\n}\n\n// ────────────────────────────────────────────────────────────────────────\n// Component\n// ────────────────────────────────────────────────────────────────────────\n\nexport function LocalePicker({\n variant = \"dropdown\",\n show = \"auto\",\n display = \"native\",\n flags = false,\n alternates,\n activeLocale,\n triggerLabel = \"Change language\",\n className,\n}: LocalePickerProps): React.ReactElement | null {\n const options: LocalePickerOption[] = React.useMemo(() => {\n return Object.entries(alternates ?? {})\n .map(([code, url]) => {\n const href = safeHref(url);\n if (!href) return null;\n return { code, href, label: build_label(code, display) };\n })\n .filter((o): o is LocalePickerOption => o !== null);\n }, [alternates, display]);\n\n if (show === \"never\") return null;\n if (options.length === 0) return null;\n if (show === \"auto\" && options.length < 2) return null;\n\n if (variant === \"inline\") {\n return (\n <nav\n aria-label={triggerLabel}\n className={cn(\"cls_locale_picker_inline flex items-center gap-1\", className)}\n >\n {options.map((opt) => (\n <a\n key={opt.code}\n href={opt.href}\n lang={opt.code}\n aria-current={opt.code === activeLocale ? \"true\" : undefined}\n className={cn(\n \"cls_locale_picker_inline_item inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-sm transition-colors hover:bg-accent hover:text-accent-foreground\",\n opt.code === activeLocale && \"bg-accent font-medium text-accent-foreground\"\n )}\n >\n {flags && <FlagIcon code={opt.code} />}\n <span>{opt.label}</span>\n </a>\n ))}\n </nav>\n );\n }\n\n const active_option = options.find((o) => o.code === activeLocale);\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n variant=\"outline\"\n size=\"sm\"\n lang={activeLocale}\n aria-label={triggerLabel}\n className={cn(\"cls_locale_picker_trigger gap-1.5\", className)}\n >\n {flags && <FlagIcon code={active_option?.code ?? options[0].code} />}\n <span className=\"cls_locale_picker_trigger_label\">\n {variant === \"compact\"\n ? (active_option ?? options[0]).code.toUpperCase()\n : (active_option ?? options[0]).label}\n </span>\n <ChevronDown className=\"h-3.5 w-3.5 opacity-60\" aria-hidden=\"true\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className=\"cls_locale_picker_content\">\n <DropdownMenuRadioGroup value={activeLocale}>\n {options.map((opt) => (\n <DropdownMenuPrimitive.RadioItem key={opt.code} value={opt.code} asChild>\n <a\n href={opt.href}\n lang={opt.code}\n className=\"cls_locale_picker_radio_item relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50\"\n >\n <span className=\"absolute left-2 flex h-3.5 w-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <Circle className=\"h-2 w-2 fill-current\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {flags && <FlagIcon code={opt.code} />}\n <span>{opt.label}</span>\n </a>\n </DropdownMenuPrimitive.RadioItem>\n ))}\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\nLocalePicker.displayName = \"LocalePicker\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hazo_ui",
3
- "version": "6.9.0",
3
+ "version": "6.11.1",
4
4
  "description": "Set of UI components for common interaction elements in a SaaS app",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,6 +22,11 @@
22
22
  "import": "./dist/index.utils.js",
23
23
  "require": "./dist/index.utils.cjs"
24
24
  },
25
+ "./locale-picker": {
26
+ "types": "./dist/index.locale-picker.d.ts",
27
+ "import": "./dist/index.locale-picker.js",
28
+ "require": "./dist/index.locale-picker.cjs"
29
+ },
25
30
  "./package.json": "./package.json"
26
31
  },
27
32
  "files": [
@@ -36,16 +41,23 @@
36
41
  "dev:test-app": "npm run build && cd test-app && npm run dev",
37
42
  "lint": "eslint src",
38
43
  "type-check": "tsc --noEmit",
44
+ "test": "node --experimental-vm-modules ../node_modules/jest/bin/jest.js --config jest.config.cjs",
39
45
  "prepublishOnly": "npm run build && npm run type-check",
40
46
  "build:test-app": "npm run build && cd test-app && npm run build"
41
47
  },
42
48
  "peerDependencies": {
43
- "hazo_core": "^2.0.0",
44
- "hazo_state": "^0.3.0",
45
- "hazo_theme": "^1.3.0",
49
+ "hazo_core": "^2.2.0",
50
+ "hazo_i18n": "^0.1.0",
51
+ "hazo_state": "^0.5.0",
52
+ "hazo_theme": "^1.3.1",
46
53
  "react": "^18.0.0 || ^19.0.0",
47
54
  "react-dom": "^18.0.0 || ^19.0.0"
48
55
  },
56
+ "peerDependenciesMeta": {
57
+ "hazo_i18n": {
58
+ "optional": true
59
+ }
60
+ },
49
61
  "dependencies": {
50
62
  "@dnd-kit/core": "^6.1.0",
51
63
  "@dnd-kit/sortable": "^8.0.0",
@@ -110,15 +122,23 @@
110
122
  },
111
123
  "devDependencies": {
112
124
  "@tailwindcss/postcss": "^4.2.4",
125
+ "@testing-library/jest-dom": "^6.6.3",
126
+ "@testing-library/react": "^16.0.1",
127
+ "@testing-library/user-event": "^14.5.2",
113
128
  "@types/canvas-confetti": "^1.9.0",
129
+ "@types/jest": "^30.0.0",
130
+ "@types/node": "^20.14.10",
114
131
  "@types/react": "^18.3.3",
115
132
  "@types/react-dom": "^18.3.0",
116
- "hazo_core": "^2.0.0",
117
- "hazo_theme": "^1.3.0",
133
+ "hazo_core": "^2.2.0",
134
+ "hazo_theme": "^1.3.1",
135
+ "jest": "^30.2.0",
136
+ "jest-environment-jsdom": "^30.2.0",
118
137
  "postcss": "^8.4.49",
119
138
  "react": "^18.3.1",
120
139
  "react-dom": "^18.3.1",
121
140
  "tailwindcss": "^4.2.4",
141
+ "ts-jest": "^29.4.5",
122
142
  "tsup": "^8.0.0",
123
143
  "typescript": "^5.7.2"
124
144
  },