@arch-cadre/ui 0.0.11 → 0.0.16
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/build.config.ts +23 -0
- package/dist/components/.gitkeep +0 -0
- package/dist/components/accordion.cjs +62 -0
- package/dist/components/accordion.d.ts +7 -0
- package/dist/components/accordion.mjs +58 -0
- package/dist/components/alert-dialog.cjs +127 -0
- package/dist/components/alert-dialog.d.ts +14 -0
- package/dist/components/alert-dialog.mjs +144 -0
- package/dist/components/alert.cjs +58 -0
- package/dist/components/alert.d.ts +9 -0
- package/dist/components/alert.mjs +62 -0
- package/dist/components/aspect-ratio.cjs +19 -0
- package/dist/components/aspect-ratio.d.ts +4 -0
- package/dist/components/aspect-ratio.mjs +9 -0
- package/dist/components/avatar.cjs +44 -0
- package/dist/components/avatar.d.ts +6 -0
- package/dist/components/avatar.mjs +50 -0
- package/dist/components/badge.cjs +41 -0
- package/dist/components/badge.d.ts +9 -0
- package/dist/components/badge.mjs +37 -0
- package/dist/components/breadcrumb.cjs +106 -0
- package/dist/components/breadcrumb.d.ts +11 -0
- package/dist/components/breadcrumb.mjs +105 -0
- package/dist/components/button-group.cjs +65 -0
- package/dist/components/button-group.d.ts +12 -0
- package/dist/components/button-group.mjs +76 -0
- package/dist/components/button.cjs +57 -0
- package/dist/components/button.d.ts +10 -0
- package/dist/components/button.mjs +51 -0
- package/dist/components/calendar.cjs +143 -0
- package/dist/components/calendar.d.ts +8 -0
- package/dist/components/calendar.mjs +191 -0
- package/dist/components/card.cjs +86 -0
- package/dist/components/card.d.ts +9 -0
- package/dist/components/card.mjs +90 -0
- package/dist/components/checkbox.cjs +28 -0
- package/dist/components/checkbox.d.ts +4 -0
- package/dist/components/checkbox.mjs +30 -0
- package/dist/components/collapsible.cjs +37 -0
- package/dist/components/collapsible.d.ts +6 -0
- package/dist/components/collapsible.mjs +31 -0
- package/dist/components/command.cjs +125 -0
- package/dist/components/command.d.ts +18 -0
- package/dist/components/command.mjs +169 -0
- package/dist/components/context-menu.cjs +188 -0
- package/dist/components/context-menu.d.ts +25 -0
- package/dist/components/context-menu.mjs +218 -0
- package/dist/components/dialog.cjs +123 -0
- package/dist/components/dialog.d.ts +15 -0
- package/dist/components/dialog.mjs +130 -0
- package/dist/components/drawer.cjs +118 -0
- package/dist/components/drawer.d.ts +13 -0
- package/dist/components/drawer.mjs +124 -0
- package/dist/components/dropdown-menu.cjs +190 -0
- package/dist/components/dropdown-menu.d.ts +25 -0
- package/dist/components/dropdown-menu.mjs +226 -0
- package/dist/components/empty.cjs +92 -0
- package/dist/components/empty.d.ts +12 -0
- package/dist/components/empty.mjs +102 -0
- package/dist/components/field.cjs +173 -0
- package/dist/components/field.d.ts +25 -0
- package/dist/components/field.mjs +228 -0
- package/dist/components/form.cjs +143 -0
- package/dist/components/form.d.ts +23 -0
- package/dist/components/form.mjs +123 -0
- package/dist/components/hover-card.cjs +46 -0
- package/dist/components/hover-card.d.ts +6 -0
- package/dist/components/hover-card.mjs +35 -0
- package/dist/components/input-group.cjs +130 -0
- package/dist/components/input-group.d.ts +16 -0
- package/dist/components/input-group.mjs +155 -0
- package/dist/components/input-otp.cjs +69 -0
- package/dist/components/input-otp.d.ts +11 -0
- package/dist/components/input-otp.mjs +59 -0
- package/dist/components/input.cjs +22 -0
- package/dist/components/input.d.ts +3 -0
- package/dist/components/input.mjs +19 -0
- package/dist/components/item.cjs +168 -0
- package/dist/components/item.d.ts +23 -0
- package/dist/components/item.mjs +187 -0
- package/dist/components/kbd.cjs +31 -0
- package/dist/components/kbd.d.ts +4 -0
- package/dist/components/kbd.mjs +28 -0
- package/dist/components/label.cjs +22 -0
- package/dist/components/label.d.ts +4 -0
- package/dist/components/label.mjs +21 -0
- package/dist/components/language-switcher.cjs +43 -0
- package/dist/components/language-switcher.d.ts +2 -0
- package/dist/components/language-switcher.mjs +30 -0
- package/dist/components/menubar.cjs +207 -0
- package/dist/components/menubar.d.ts +26 -0
- package/dist/components/menubar.mjs +246 -0
- package/dist/components/navigation-menu.cjs +113 -0
- package/dist/components/navigation-menu.d.ts +14 -0
- package/dist/components/navigation-menu.mjs +166 -0
- package/dist/components/pagination.cjs +106 -0
- package/dist/components/pagination.d.ts +15 -0
- package/dist/components/pagination.mjs +116 -0
- package/dist/components/popover.cjs +53 -0
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/popover.mjs +40 -0
- package/dist/components/progress.cjs +29 -0
- package/dist/components/progress.d.ts +4 -0
- package/dist/components/progress.mjs +30 -0
- package/dist/components/radio-group.cjs +39 -0
- package/dist/components/radio-group.d.ts +5 -0
- package/dist/components/radio-group.mjs +43 -0
- package/dist/components/scroll-area.cjs +45 -0
- package/dist/components/scroll-area.d.ts +7 -0
- package/dist/components/scroll-area.mjs +59 -0
- package/dist/components/select.cjs +140 -0
- package/dist/components/select.d.ts +15 -0
- package/dist/components/select.mjs +173 -0
- package/dist/components/separator.cjs +26 -0
- package/dist/components/separator.d.ts +4 -0
- package/dist/components/separator.mjs +25 -0
- package/dist/components/sheet.cjs +120 -0
- package/dist/components/sheet.d.ts +13 -0
- package/dist/components/sheet.mjs +119 -0
- package/dist/components/sidebar.cjs +508 -0
- package/dist/components/sidebar.d.ts +69 -0
- package/dist/components/sidebar.mjs +635 -0
- package/dist/components/skeleton.cjs +20 -0
- package/dist/components/skeleton.d.ts +3 -0
- package/dist/components/skeleton.mjs +13 -0
- package/dist/components/slider.cjs +43 -0
- package/dist/components/slider.d.ts +4 -0
- package/dist/components/slider.mjs +59 -0
- package/dist/components/sonner.cjs +49 -0
- package/dist/components/sonner.d.ts +4 -0
- package/dist/components/sonner.mjs +36 -0
- package/dist/components/spinner.cjs +22 -0
- package/dist/components/spinner.d.ts +3 -0
- package/dist/components/spinner.mjs +15 -0
- package/dist/components/switch.cjs +25 -0
- package/dist/components/switch.d.ts +4 -0
- package/dist/components/switch.mjs +30 -0
- package/dist/components/table.cjs +101 -0
- package/dist/components/table.d.ts +10 -0
- package/dist/components/table.mjs +115 -0
- package/dist/components/tabs.cjs +55 -0
- package/dist/components/tabs.d.ts +7 -0
- package/dist/components/tabs.mjs +63 -0
- package/dist/components/textarea.cjs +20 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.mjs +16 -0
- package/dist/components/toggle-group.cjs +65 -0
- package/dist/components/toggle-group.d.ts +9 -0
- package/dist/components/toggle-group.mjs +65 -0
- package/dist/components/toggle.cjs +47 -0
- package/dist/components/toggle.d.ts +9 -0
- package/dist/components/toggle.mjs +41 -0
- package/dist/components/tooltip.cjs +56 -0
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.mjs +49 -0
- package/dist/hooks/.gitkeep +0 -0
- package/dist/hooks/use-mobile.cjs +23 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.mjs +17 -0
- package/dist/hooks/use-user.cjs +21 -0
- package/dist/hooks/use-user.d.ts +12 -0
- package/dist/hooks/use-user.mjs +12 -0
- package/dist/index.cjs +179 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.mjs +15 -0
- package/dist/lib/utils.cjs +11 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.mjs +5 -0
- package/dist/logo.cjs +49 -0
- package/dist/logo.d.ts +15 -0
- package/dist/logo.mjs +32 -0
- package/dist/postcss.config.cjs +13 -0
- package/dist/postcss.config.d.mts +3 -0
- package/dist/postcss.config.mjs +6 -0
- package/dist/providers/auth-provider.cjs +44 -0
- package/dist/providers/auth-provider.d.ts +15 -0
- package/dist/providers/auth-provider.mjs +37 -0
- package/dist/providers/index.cjs +47 -0
- package/dist/providers/index.d.ts +7 -0
- package/dist/providers/index.mjs +33 -0
- package/dist/shared/access-denied.cjs +38 -0
- package/dist/shared/access-denied.d.ts +2 -0
- package/dist/shared/access-denied.mjs +12 -0
- package/dist/shared/loader.cjs +95 -0
- package/dist/shared/loader.d.ts +11 -0
- package/dist/shared/loader.mjs +98 -0
- package/dist/shared/page-loader.cjs +23 -0
- package/dist/shared/page-loader.d.ts +7 -0
- package/dist/shared/page-loader.mjs +6 -0
- package/dist/shared/scroll-fade-effect.cjs +21 -0
- package/dist/shared/scroll-fade-effect.d.ts +4 -0
- package/dist/shared/scroll-fade-effect.mjs +20 -0
- package/dist/styles/globals.css +1 -0
- package/package.json +58 -49
- package/scripts/switchToDist.js +55 -0
- package/scripts/switchToSrc.js +52 -0
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert-dialog.tsx +1 -1
- package/src/components/alert.tsx +1 -1
- package/src/components/aspect-ratio.tsx +2 -1
- package/src/components/avatar.tsx +1 -1
- package/src/components/badge.tsx +3 -3
- package/src/components/breadcrumb.tsx +5 -3
- package/src/components/button-group.tsx +4 -2
- package/src/components/button.tsx +3 -3
- package/src/components/calendar.tsx +2 -2
- package/src/components/checkbox.tsx +2 -2
- package/src/components/collapsible.tsx +2 -1
- package/src/components/command.tsx +1 -1
- package/src/components/context-menu.tsx +2 -2
- package/src/components/dialog.tsx +2 -2
- package/src/components/dropdown-menu.tsx +2 -2
- package/src/components/empty.tsx +1 -0
- package/src/components/field.tsx +5 -2
- package/src/components/form.tsx +9 -7
- package/src/components/hover-card.tsx +1 -1
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-otp.tsx +1 -1
- package/src/components/item.tsx +3 -3
- package/src/components/kbd.tsx +1 -0
- package/src/components/label.tsx +1 -1
- package/src/components/language-switcher.tsx +16 -17
- package/src/components/menubar.tsx +2 -2
- package/src/components/navigation-menu.tsx +2 -2
- package/src/components/pagination.tsx +5 -2
- package/src/components/popover.tsx +1 -1
- package/src/components/progress.tsx +1 -1
- package/src/components/radio-group.tsx +2 -2
- package/src/components/scroll-area.tsx +1 -1
- package/src/components/select.tsx +2 -2
- package/src/components/separator.tsx +1 -1
- package/src/components/sheet.tsx +2 -2
- package/src/components/sidebar.tsx +6 -6
- package/src/components/skeleton.tsx +1 -0
- package/src/components/slider.tsx +1 -1
- package/src/components/sonner.tsx +1 -0
- package/src/components/spinner.tsx +1 -0
- package/src/components/switch.tsx +1 -1
- package/src/components/tabs.tsx +1 -1
- package/src/components/toggle-group.tsx +2 -2
- package/src/components/toggle.tsx +2 -2
- package/src/components/tooltip.tsx +1 -1
- package/src/hooks/use-user.ts +2 -2
- package/src/index.ts +10 -5
- package/src/logo.tsx +1 -0
- package/src/providers/auth-provider.tsx +7 -6
- package/src/providers/index.tsx +1 -0
- package/src/shared/access-denied.tsx +1 -0
- package/src/shared/loader.tsx +2 -1
- package/src/shared/page-loader.tsx +1 -0
- package/src/shared/scroll-fade-effect.tsx +1 -1
- package/src/styles/globals.css +258 -244
- package/biome.json +0 -38
- package/src/components/carousel.tsx +0 -241
- package/src/components/chart.tsx +0 -357
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Input = Input;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _utils = require("../lib/utils.cjs");
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
function Input({
|
|
12
|
+
className,
|
|
13
|
+
type,
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */React.createElement("input", {
|
|
17
|
+
type,
|
|
18
|
+
"data-slot": "input",
|
|
19
|
+
className: (0, _utils.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className),
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
|
+
function Input({ className, type, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ React.createElement(
|
|
5
|
+
"input",
|
|
6
|
+
{
|
|
7
|
+
type,
|
|
8
|
+
"data-slot": "input",
|
|
9
|
+
className: cn(
|
|
10
|
+
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
11
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
12
|
+
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
13
|
+
className
|
|
14
|
+
),
|
|
15
|
+
...props
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
export { Input };
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Item = Item;
|
|
7
|
+
exports.ItemActions = ItemActions;
|
|
8
|
+
exports.ItemContent = ItemContent;
|
|
9
|
+
exports.ItemDescription = ItemDescription;
|
|
10
|
+
exports.ItemFooter = ItemFooter;
|
|
11
|
+
exports.ItemGroup = ItemGroup;
|
|
12
|
+
exports.ItemHeader = ItemHeader;
|
|
13
|
+
exports.ItemMedia = ItemMedia;
|
|
14
|
+
exports.ItemSeparator = ItemSeparator;
|
|
15
|
+
exports.ItemTitle = ItemTitle;
|
|
16
|
+
var _radixUi = require("radix-ui");
|
|
17
|
+
var _classVarianceAuthority = require("class-variance-authority");
|
|
18
|
+
var React = _interopRequireWildcard(require("react"));
|
|
19
|
+
var _utils = require("../lib/utils.cjs");
|
|
20
|
+
var _separator = require("./separator.cjs");
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
|
+
function ItemGroup({
|
|
24
|
+
className,
|
|
25
|
+
...props
|
|
26
|
+
}) {
|
|
27
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
28
|
+
role: "list",
|
|
29
|
+
"data-slot": "item-group",
|
|
30
|
+
className: (0, _utils.cn)("group/item-group flex flex-col", className),
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function ItemSeparator({
|
|
35
|
+
className,
|
|
36
|
+
...props
|
|
37
|
+
}) {
|
|
38
|
+
return /* @__PURE__ */React.createElement(_separator.Separator, {
|
|
39
|
+
"data-slot": "item-separator",
|
|
40
|
+
orientation: "horizontal",
|
|
41
|
+
className: (0, _utils.cn)("my-0", className),
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const itemVariants = (0, _classVarianceAuthority.cva)("group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", {
|
|
46
|
+
variants: {
|
|
47
|
+
variant: {
|
|
48
|
+
default: "bg-transparent",
|
|
49
|
+
outline: "border-border",
|
|
50
|
+
muted: "bg-muted/50"
|
|
51
|
+
},
|
|
52
|
+
size: {
|
|
53
|
+
default: "p-4 gap-4 ",
|
|
54
|
+
sm: "py-3 px-4 gap-2.5"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
defaultVariants: {
|
|
58
|
+
variant: "default",
|
|
59
|
+
size: "default"
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
function Item({
|
|
63
|
+
className,
|
|
64
|
+
variant = "default",
|
|
65
|
+
size = "default",
|
|
66
|
+
asChild = false,
|
|
67
|
+
...props
|
|
68
|
+
}) {
|
|
69
|
+
const Comp = asChild ? _radixUi.Slot.Slot : "div";
|
|
70
|
+
return /* @__PURE__ */React.createElement(Comp, {
|
|
71
|
+
"data-slot": "item",
|
|
72
|
+
"data-variant": variant,
|
|
73
|
+
"data-size": size,
|
|
74
|
+
className: (0, _utils.cn)(itemVariants({
|
|
75
|
+
variant,
|
|
76
|
+
size,
|
|
77
|
+
className
|
|
78
|
+
})),
|
|
79
|
+
...props
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const itemMediaVariants = (0, _classVarianceAuthority.cva)("flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5", {
|
|
83
|
+
variants: {
|
|
84
|
+
variant: {
|
|
85
|
+
default: "bg-transparent",
|
|
86
|
+
icon: "size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4",
|
|
87
|
+
image: "size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
defaultVariants: {
|
|
91
|
+
variant: "default"
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
function ItemMedia({
|
|
95
|
+
className,
|
|
96
|
+
variant = "default",
|
|
97
|
+
...props
|
|
98
|
+
}) {
|
|
99
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
100
|
+
"data-slot": "item-media",
|
|
101
|
+
"data-variant": variant,
|
|
102
|
+
className: (0, _utils.cn)(itemMediaVariants({
|
|
103
|
+
variant,
|
|
104
|
+
className
|
|
105
|
+
})),
|
|
106
|
+
...props
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function ItemContent({
|
|
110
|
+
className,
|
|
111
|
+
...props
|
|
112
|
+
}) {
|
|
113
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
114
|
+
"data-slot": "item-content",
|
|
115
|
+
className: (0, _utils.cn)("flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none", className),
|
|
116
|
+
...props
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function ItemTitle({
|
|
120
|
+
className,
|
|
121
|
+
...props
|
|
122
|
+
}) {
|
|
123
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
124
|
+
"data-slot": "item-title",
|
|
125
|
+
className: (0, _utils.cn)("flex w-fit items-center gap-2 text-sm leading-snug font-medium", className),
|
|
126
|
+
...props
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function ItemDescription({
|
|
130
|
+
className,
|
|
131
|
+
...props
|
|
132
|
+
}) {
|
|
133
|
+
return /* @__PURE__ */React.createElement("p", {
|
|
134
|
+
"data-slot": "item-description",
|
|
135
|
+
className: (0, _utils.cn)("text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance", "[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4", className),
|
|
136
|
+
...props
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function ItemActions({
|
|
140
|
+
className,
|
|
141
|
+
...props
|
|
142
|
+
}) {
|
|
143
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
144
|
+
"data-slot": "item-actions",
|
|
145
|
+
className: (0, _utils.cn)("flex items-center gap-2", className),
|
|
146
|
+
...props
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function ItemHeader({
|
|
150
|
+
className,
|
|
151
|
+
...props
|
|
152
|
+
}) {
|
|
153
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
154
|
+
"data-slot": "item-header",
|
|
155
|
+
className: (0, _utils.cn)("flex basis-full items-center justify-between gap-2", className),
|
|
156
|
+
...props
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function ItemFooter({
|
|
160
|
+
className,
|
|
161
|
+
...props
|
|
162
|
+
}) {
|
|
163
|
+
return /* @__PURE__ */React.createElement("div", {
|
|
164
|
+
"data-slot": "item-footer",
|
|
165
|
+
className: (0, _utils.cn)("flex basis-full items-center justify-between gap-2", className),
|
|
166
|
+
...props
|
|
167
|
+
});
|
|
168
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Separator } from "./separator";
|
|
4
|
+
declare function ItemGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
5
|
+
declare function ItemSeparator({ className, ...props }: React.ComponentProps<typeof Separator>): React.JSX.Element;
|
|
6
|
+
declare const itemVariants: (props?: ({
|
|
7
|
+
variant?: "default" | "outline" | "muted" | null | undefined;
|
|
8
|
+
size?: "default" | "sm" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
10
|
+
declare function Item({ className, variant, size, asChild, ...props }: React.ComponentProps<"div"> & VariantProps<typeof itemVariants> & {
|
|
11
|
+
asChild?: boolean;
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
declare const itemMediaVariants: (props?: ({
|
|
14
|
+
variant?: "default" | "image" | "icon" | null | undefined;
|
|
15
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
16
|
+
declare function ItemMedia({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>): React.JSX.Element;
|
|
17
|
+
declare function ItemContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
18
|
+
declare function ItemTitle({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
19
|
+
declare function ItemDescription({ className, ...props }: React.ComponentProps<"p">): React.JSX.Element;
|
|
20
|
+
declare function ItemActions({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
21
|
+
declare function ItemHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
22
|
+
declare function ItemFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
23
|
+
export { Item, ItemMedia, ItemContent, ItemActions, ItemGroup, ItemSeparator, ItemTitle, ItemDescription, ItemHeader, ItemFooter, };
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { Slot as SlotPrimitive } from "radix-ui";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/utils.mjs";
|
|
5
|
+
import { Separator } from "./separator.mjs";
|
|
6
|
+
function ItemGroup({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
role: "list",
|
|
11
|
+
"data-slot": "item-group",
|
|
12
|
+
className: cn("group/item-group flex flex-col", className),
|
|
13
|
+
...props
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
function ItemSeparator({
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}) {
|
|
21
|
+
return /* @__PURE__ */ React.createElement(
|
|
22
|
+
Separator,
|
|
23
|
+
{
|
|
24
|
+
"data-slot": "item-separator",
|
|
25
|
+
orientation: "horizontal",
|
|
26
|
+
className: cn("my-0", className),
|
|
27
|
+
...props
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
const itemVariants = cva(
|
|
32
|
+
"group/item flex items-center border border-transparent text-sm rounded-md transition-colors [a]:hover:bg-accent/50 [a]:transition-colors duration-100 flex-wrap outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
33
|
+
{
|
|
34
|
+
variants: {
|
|
35
|
+
variant: {
|
|
36
|
+
default: "bg-transparent",
|
|
37
|
+
outline: "border-border",
|
|
38
|
+
muted: "bg-muted/50"
|
|
39
|
+
},
|
|
40
|
+
size: {
|
|
41
|
+
default: "p-4 gap-4 ",
|
|
42
|
+
sm: "py-3 px-4 gap-2.5"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
variant: "default",
|
|
47
|
+
size: "default"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
function Item({
|
|
52
|
+
className,
|
|
53
|
+
variant = "default",
|
|
54
|
+
size = "default",
|
|
55
|
+
asChild = false,
|
|
56
|
+
...props
|
|
57
|
+
}) {
|
|
58
|
+
const Comp = asChild ? SlotPrimitive.Slot : "div";
|
|
59
|
+
return /* @__PURE__ */ React.createElement(
|
|
60
|
+
Comp,
|
|
61
|
+
{
|
|
62
|
+
"data-slot": "item",
|
|
63
|
+
"data-variant": variant,
|
|
64
|
+
"data-size": size,
|
|
65
|
+
className: cn(itemVariants({ variant, size, className })),
|
|
66
|
+
...props
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
const itemMediaVariants = cva(
|
|
71
|
+
"flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none group-has-[[data-slot=item-description]]/item:translate-y-0.5",
|
|
72
|
+
{
|
|
73
|
+
variants: {
|
|
74
|
+
variant: {
|
|
75
|
+
default: "bg-transparent",
|
|
76
|
+
icon: "size-8 border rounded-sm bg-muted [&_svg:not([class*='size-'])]:size-4",
|
|
77
|
+
image: "size-10 rounded-sm overflow-hidden [&_img]:size-full [&_img]:object-cover"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
defaultVariants: {
|
|
81
|
+
variant: "default"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
function ItemMedia({
|
|
86
|
+
className,
|
|
87
|
+
variant = "default",
|
|
88
|
+
...props
|
|
89
|
+
}) {
|
|
90
|
+
return /* @__PURE__ */ React.createElement(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
"data-slot": "item-media",
|
|
94
|
+
"data-variant": variant,
|
|
95
|
+
className: cn(itemMediaVariants({ variant, className })),
|
|
96
|
+
...props
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
function ItemContent({ className, ...props }) {
|
|
101
|
+
return /* @__PURE__ */ React.createElement(
|
|
102
|
+
"div",
|
|
103
|
+
{
|
|
104
|
+
"data-slot": "item-content",
|
|
105
|
+
className: cn(
|
|
106
|
+
"flex flex-1 flex-col gap-1 [&+[data-slot=item-content]]:flex-none",
|
|
107
|
+
className
|
|
108
|
+
),
|
|
109
|
+
...props
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
function ItemTitle({ className, ...props }) {
|
|
114
|
+
return /* @__PURE__ */ React.createElement(
|
|
115
|
+
"div",
|
|
116
|
+
{
|
|
117
|
+
"data-slot": "item-title",
|
|
118
|
+
className: cn(
|
|
119
|
+
"flex w-fit items-center gap-2 text-sm leading-snug font-medium",
|
|
120
|
+
className
|
|
121
|
+
),
|
|
122
|
+
...props
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
function ItemDescription({ className, ...props }) {
|
|
127
|
+
return /* @__PURE__ */ React.createElement(
|
|
128
|
+
"p",
|
|
129
|
+
{
|
|
130
|
+
"data-slot": "item-description",
|
|
131
|
+
className: cn(
|
|
132
|
+
"text-muted-foreground line-clamp-2 text-sm leading-normal font-normal text-balance",
|
|
133
|
+
"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
|
|
134
|
+
className
|
|
135
|
+
),
|
|
136
|
+
...props
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
function ItemActions({ className, ...props }) {
|
|
141
|
+
return /* @__PURE__ */ React.createElement(
|
|
142
|
+
"div",
|
|
143
|
+
{
|
|
144
|
+
"data-slot": "item-actions",
|
|
145
|
+
className: cn("flex items-center gap-2", className),
|
|
146
|
+
...props
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
function ItemHeader({ className, ...props }) {
|
|
151
|
+
return /* @__PURE__ */ React.createElement(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
"data-slot": "item-header",
|
|
155
|
+
className: cn(
|
|
156
|
+
"flex basis-full items-center justify-between gap-2",
|
|
157
|
+
className
|
|
158
|
+
),
|
|
159
|
+
...props
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
function ItemFooter({ className, ...props }) {
|
|
164
|
+
return /* @__PURE__ */ React.createElement(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
167
|
+
"data-slot": "item-footer",
|
|
168
|
+
className: cn(
|
|
169
|
+
"flex basis-full items-center justify-between gap-2",
|
|
170
|
+
className
|
|
171
|
+
),
|
|
172
|
+
...props
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
export {
|
|
177
|
+
Item,
|
|
178
|
+
ItemMedia,
|
|
179
|
+
ItemContent,
|
|
180
|
+
ItemActions,
|
|
181
|
+
ItemGroup,
|
|
182
|
+
ItemSeparator,
|
|
183
|
+
ItemTitle,
|
|
184
|
+
ItemDescription,
|
|
185
|
+
ItemHeader,
|
|
186
|
+
ItemFooter
|
|
187
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Kbd = Kbd;
|
|
7
|
+
exports.KbdGroup = KbdGroup;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _utils = require("../lib/utils.cjs");
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function Kbd({
|
|
13
|
+
className,
|
|
14
|
+
...props
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */React.createElement("kbd", {
|
|
17
|
+
"data-slot": "kbd",
|
|
18
|
+
className: (0, _utils.cn)("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none", "[&_svg:not([class*='size-'])]:size-3", "[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10", className),
|
|
19
|
+
...props
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function KbdGroup({
|
|
23
|
+
className,
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
return /* @__PURE__ */React.createElement("kbd", {
|
|
27
|
+
"data-slot": "kbd-group",
|
|
28
|
+
className: (0, _utils.cn)("inline-flex items-center gap-1", className),
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "../lib/utils.mjs";
|
|
3
|
+
function Kbd({ className, ...props }) {
|
|
4
|
+
return /* @__PURE__ */ React.createElement(
|
|
5
|
+
"kbd",
|
|
6
|
+
{
|
|
7
|
+
"data-slot": "kbd",
|
|
8
|
+
className: cn(
|
|
9
|
+
"bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none",
|
|
10
|
+
"[&_svg:not([class*='size-'])]:size-3",
|
|
11
|
+
"[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",
|
|
12
|
+
className
|
|
13
|
+
),
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
function KbdGroup({ className, ...props }) {
|
|
19
|
+
return /* @__PURE__ */ React.createElement(
|
|
20
|
+
"kbd",
|
|
21
|
+
{
|
|
22
|
+
"data-slot": "kbd-group",
|
|
23
|
+
className: cn("inline-flex items-center gap-1", className),
|
|
24
|
+
...props
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
export { Kbd, KbdGroup };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Label = Label;
|
|
8
|
+
var _radixUi = require("radix-ui");
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _utils = require("../lib/utils.cjs");
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function Label({
|
|
14
|
+
className,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
return /* @__PURE__ */React.createElement(_radixUi.Label.Root, {
|
|
18
|
+
"data-slot": "label",
|
|
19
|
+
className: (0, _utils.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Label as LabelPrimitive } from "radix-ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../lib/utils.mjs";
|
|
5
|
+
function Label({
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ React.createElement(
|
|
10
|
+
LabelPrimitive.Root,
|
|
11
|
+
{
|
|
12
|
+
"data-slot": "label",
|
|
13
|
+
className: cn(
|
|
14
|
+
"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
|
|
15
|
+
className
|
|
16
|
+
),
|
|
17
|
+
...props
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
export { Label };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.LanguageSwitcher = LanguageSwitcher;
|
|
8
|
+
var _intl = require("@arch-cadre/intl");
|
|
9
|
+
var _lucideReact = require("lucide-react");
|
|
10
|
+
var _navigation = require("next/navigation");
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _button = require("./button.cjs");
|
|
13
|
+
var _dropdownMenu = require("./dropdown-menu.cjs");
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function LanguageSwitcher() {
|
|
17
|
+
const locale = (0, _intl.useLocale)();
|
|
18
|
+
const router = (0, _navigation.useRouter)();
|
|
19
|
+
const {
|
|
20
|
+
t
|
|
21
|
+
} = (0, _intl.useTranslation)();
|
|
22
|
+
const handleLanguageChange = newLocale => {
|
|
23
|
+
document.cookie = `NEXT_LOCALE=${newLocale}; path=/; max-age=31536000; SameSite=Lax`;
|
|
24
|
+
router.refresh();
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */React.createElement(_dropdownMenu.DropdownMenu, null, /* @__PURE__ */React.createElement(_dropdownMenu.DropdownMenuTrigger, {
|
|
27
|
+
asChild: true
|
|
28
|
+
}, /* @__PURE__ */React.createElement(_button.Button, {
|
|
29
|
+
variant: "ghost",
|
|
30
|
+
size: "icon",
|
|
31
|
+
className: "size-9"
|
|
32
|
+
}, /* @__PURE__ */React.createElement(_lucideReact.Languages, {
|
|
33
|
+
className: "size-4"
|
|
34
|
+
}), /* @__PURE__ */React.createElement("span", {
|
|
35
|
+
className: "sr-only"
|
|
36
|
+
}, t("Switch language")))), /* @__PURE__ */React.createElement(_dropdownMenu.DropdownMenuContent, {
|
|
37
|
+
align: "end"
|
|
38
|
+
}, _intl.LOCALES.map(loc => /* @__PURE__ */React.createElement(_dropdownMenu.DropdownMenuItem, {
|
|
39
|
+
key: loc,
|
|
40
|
+
onClick: () => handleLanguageChange(loc),
|
|
41
|
+
className: locale === loc ? "font-bold" : ""
|
|
42
|
+
}, loc))));
|
|
43
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { LOCALES, useLocale, useTranslation } from "@arch-cadre/intl";
|
|
3
|
+
import { Languages } from "lucide-react";
|
|
4
|
+
import { useRouter } from "next/navigation";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { Button } from "./button.mjs";
|
|
7
|
+
import {
|
|
8
|
+
DropdownMenu,
|
|
9
|
+
DropdownMenuContent,
|
|
10
|
+
DropdownMenuItem,
|
|
11
|
+
DropdownMenuTrigger
|
|
12
|
+
} from "./dropdown-menu.mjs";
|
|
13
|
+
export function LanguageSwitcher() {
|
|
14
|
+
const locale = useLocale();
|
|
15
|
+
const router = useRouter();
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
const handleLanguageChange = (newLocale) => {
|
|
18
|
+
document.cookie = `NEXT_LOCALE=${newLocale}; path=/; max-age=31536000; SameSite=Lax`;
|
|
19
|
+
router.refresh();
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ React.createElement(DropdownMenu, null, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(Button, { variant: "ghost", size: "icon", className: "size-9" }, /* @__PURE__ */ React.createElement(Languages, { className: "size-4" }), /* @__PURE__ */ React.createElement("span", { className: "sr-only" }, t("Switch language")))), /* @__PURE__ */ React.createElement(DropdownMenuContent, { align: "end" }, LOCALES.map((loc) => /* @__PURE__ */ React.createElement(
|
|
22
|
+
DropdownMenuItem,
|
|
23
|
+
{
|
|
24
|
+
key: loc,
|
|
25
|
+
onClick: () => handleLanguageChange(loc),
|
|
26
|
+
className: locale === loc ? "font-bold" : ""
|
|
27
|
+
},
|
|
28
|
+
loc
|
|
29
|
+
))));
|
|
30
|
+
}
|