@janovix/blocks 1.2.0-rc.14 → 1.2.0-rc.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/dist/index.cjs +53 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +127 -11
- package/dist/index.d.ts +127 -11
- package/dist/index.js +50 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var React2 = require('react');
|
|
3
4
|
var nextThemes = require('next-themes');
|
|
4
5
|
var lucideReact = require('lucide-react');
|
|
5
6
|
var react = require('motion/react');
|
|
6
|
-
var React2 = require('react');
|
|
7
7
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
var reactSlot = require('@radix-ui/react-slot');
|
|
@@ -42,6 +42,15 @@ var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive)
|
|
|
42
42
|
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
43
43
|
var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
|
|
44
44
|
|
|
45
|
+
var NotificationsContext = React2.createContext(null);
|
|
46
|
+
function useNotificationsContext() {
|
|
47
|
+
return React2.useContext(NotificationsContext);
|
|
48
|
+
}
|
|
49
|
+
var LanguageContext = React2.createContext(null);
|
|
50
|
+
function useLanguageContext() {
|
|
51
|
+
return React2.useContext(LanguageContext);
|
|
52
|
+
}
|
|
53
|
+
|
|
45
54
|
// node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
46
55
|
function r(e) {
|
|
47
56
|
var t, f, n = "";
|
|
@@ -3536,7 +3545,11 @@ function ThemeSwitcher({
|
|
|
3536
3545
|
"button",
|
|
3537
3546
|
{
|
|
3538
3547
|
"aria-label": labels[key],
|
|
3539
|
-
className: cn(
|
|
3548
|
+
className: cn(
|
|
3549
|
+
"relative flex items-center justify-center",
|
|
3550
|
+
sizes.button,
|
|
3551
|
+
shapeClass
|
|
3552
|
+
),
|
|
3540
3553
|
onClick: () => handleThemeClick(key),
|
|
3541
3554
|
type: "button",
|
|
3542
3555
|
children: [
|
|
@@ -3555,7 +3568,7 @@ function ThemeSwitcher({
|
|
|
3555
3568
|
Icon,
|
|
3556
3569
|
{
|
|
3557
3570
|
className: cn(
|
|
3558
|
-
"relative z-10
|
|
3571
|
+
"relative z-10",
|
|
3559
3572
|
sizes.icon,
|
|
3560
3573
|
isActive ? "text-foreground" : "text-muted-foreground"
|
|
3561
3574
|
)
|
|
@@ -3569,6 +3582,10 @@ function ThemeSwitcher({
|
|
|
3569
3582
|
}
|
|
3570
3583
|
);
|
|
3571
3584
|
}
|
|
3585
|
+
var defaultLanguages = [
|
|
3586
|
+
{ key: "en", label: "EN", nativeName: "English" },
|
|
3587
|
+
{ key: "es", label: "ES", nativeName: "Espa\xF1ol" }
|
|
3588
|
+
];
|
|
3572
3589
|
var sizeClasses2 = {
|
|
3573
3590
|
sm: {
|
|
3574
3591
|
container: "h-7 p-0.5 text-xs",
|
|
@@ -3598,18 +3615,27 @@ var shapeClasses2 = {
|
|
|
3598
3615
|
pill: "rounded-full"
|
|
3599
3616
|
};
|
|
3600
3617
|
function LanguageSwitcher({
|
|
3601
|
-
languages,
|
|
3602
|
-
currentLanguage,
|
|
3603
|
-
onLanguageChange,
|
|
3618
|
+
languages: propLanguages,
|
|
3619
|
+
currentLanguage: propCurrentLanguage,
|
|
3620
|
+
onLanguageChange: propOnLanguageChange,
|
|
3604
3621
|
labels = {},
|
|
3605
3622
|
className,
|
|
3606
3623
|
size = "sm",
|
|
3607
3624
|
shape = "rounded",
|
|
3608
3625
|
variant = "default",
|
|
3609
|
-
showIcon =
|
|
3626
|
+
showIcon = false,
|
|
3610
3627
|
align = "center",
|
|
3611
3628
|
side = "top"
|
|
3612
3629
|
}) {
|
|
3630
|
+
const context = useLanguageContext();
|
|
3631
|
+
const contextLanguages = context?.languages?.map((lang) => ({
|
|
3632
|
+
key: lang.code,
|
|
3633
|
+
label: lang.code.toUpperCase(),
|
|
3634
|
+
nativeName: lang.name
|
|
3635
|
+
}));
|
|
3636
|
+
const languages = propLanguages ?? contextLanguages ?? defaultLanguages;
|
|
3637
|
+
const currentLanguage = propCurrentLanguage ?? context?.language ?? "en";
|
|
3638
|
+
const onLanguageChange = propOnLanguageChange ?? context?.setLanguage;
|
|
3613
3639
|
const sizes = sizeClasses2[size];
|
|
3614
3640
|
const shapeClass = shapeClasses2[shape];
|
|
3615
3641
|
const defaultLabels2 = {
|
|
@@ -3639,7 +3665,7 @@ function LanguageSwitcher({
|
|
|
3639
3665
|
children: languages.map(({ key, nativeName }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3640
3666
|
DropdownMenuItem,
|
|
3641
3667
|
{
|
|
3642
|
-
onClick: () => onLanguageChange(key),
|
|
3668
|
+
onClick: () => onLanguageChange?.(key),
|
|
3643
3669
|
className: cn(
|
|
3644
3670
|
"justify-center text-xs font-semibold cursor-pointer px-3",
|
|
3645
3671
|
currentLanguage === key && "bg-accent"
|
|
@@ -3675,7 +3701,7 @@ function LanguageSwitcher({
|
|
|
3675
3701
|
{
|
|
3676
3702
|
"aria-label": label,
|
|
3677
3703
|
className: cn("relative font-semibold", sizes.button, shapeClass),
|
|
3678
|
-
onClick: () => onLanguageChange(key),
|
|
3704
|
+
onClick: () => onLanguageChange?.(key),
|
|
3679
3705
|
type: "button",
|
|
3680
3706
|
children: [
|
|
3681
3707
|
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: isActive && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4981,12 +5007,12 @@ function playNotificationSound(soundType = "chime", soundUrl) {
|
|
|
4981
5007
|
}
|
|
4982
5008
|
}
|
|
4983
5009
|
function NotificationsWidget({
|
|
4984
|
-
notifications,
|
|
4985
|
-
onMarkAsRead,
|
|
4986
|
-
onMarkAllAsRead,
|
|
4987
|
-
onDismiss,
|
|
4988
|
-
onClearAll,
|
|
4989
|
-
onNotificationClick,
|
|
5010
|
+
notifications: propNotifications,
|
|
5011
|
+
onMarkAsRead: propOnMarkAsRead,
|
|
5012
|
+
onMarkAllAsRead: propOnMarkAllAsRead,
|
|
5013
|
+
onDismiss: propOnDismiss,
|
|
5014
|
+
onClearAll: propOnClearAll,
|
|
5015
|
+
onNotificationClick: propOnNotificationClick,
|
|
4990
5016
|
size = "md",
|
|
4991
5017
|
maxVisible = 5,
|
|
4992
5018
|
playSound = true,
|
|
@@ -5000,6 +5026,13 @@ function NotificationsWidget({
|
|
|
5000
5026
|
pulseStyle = "ring",
|
|
5001
5027
|
soundCooldown = 2e3
|
|
5002
5028
|
}) {
|
|
5029
|
+
const context = useNotificationsContext();
|
|
5030
|
+
const notifications = propNotifications ?? context?.notifications ?? [];
|
|
5031
|
+
const onMarkAsRead = propOnMarkAsRead ?? context?.markAsRead;
|
|
5032
|
+
const onMarkAllAsRead = propOnMarkAllAsRead ?? context?.markAllAsRead;
|
|
5033
|
+
const onDismiss = propOnDismiss ?? context?.dismiss;
|
|
5034
|
+
const onClearAll = propOnClearAll ?? context?.clearAll;
|
|
5035
|
+
const onNotificationClick = propOnNotificationClick ?? context?.onNotificationClick;
|
|
5003
5036
|
const [isOpen, setIsOpen] = React2__namespace.useState(false);
|
|
5004
5037
|
const [prevCount, setPrevCount] = React2__namespace.useState(0);
|
|
5005
5038
|
const lastSoundPlayedRef = React2__namespace.useRef(0);
|
|
@@ -5442,7 +5475,9 @@ exports.DropdownMenuSub = DropdownMenuSub;
|
|
|
5442
5475
|
exports.DropdownMenuSubContent = DropdownMenuSubContent;
|
|
5443
5476
|
exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
|
|
5444
5477
|
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
5478
|
+
exports.LanguageContext = LanguageContext;
|
|
5445
5479
|
exports.LanguageSwitcher = LanguageSwitcher;
|
|
5480
|
+
exports.NotificationsContext = NotificationsContext;
|
|
5446
5481
|
exports.NotificationsWidget = NotificationsWidget;
|
|
5447
5482
|
exports.Popover = Popover;
|
|
5448
5483
|
exports.PopoverAnchor = PopoverAnchor;
|
|
@@ -5459,6 +5494,9 @@ exports.TooltipProvider = TooltipProvider;
|
|
|
5459
5494
|
exports.TooltipTrigger = TooltipTrigger;
|
|
5460
5495
|
exports.buttonVariants = buttonVariants;
|
|
5461
5496
|
exports.cn = cn;
|
|
5497
|
+
exports.defaultLanguages = defaultLanguages;
|
|
5462
5498
|
exports.toggleVariants = toggleVariants;
|
|
5499
|
+
exports.useLanguageContext = useLanguageContext;
|
|
5500
|
+
exports.useNotificationsContext = useNotificationsContext;
|
|
5463
5501
|
//# sourceMappingURL=index.cjs.map
|
|
5464
5502
|
//# sourceMappingURL=index.cjs.map
|