@janovix/blocks 1.2.0-rc.14 → 1.2.0-rc.15
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 +46 -12
- 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 +43 -14
- 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 = "";
|
|
@@ -3569,6 +3578,10 @@ function ThemeSwitcher({
|
|
|
3569
3578
|
}
|
|
3570
3579
|
);
|
|
3571
3580
|
}
|
|
3581
|
+
var defaultLanguages = [
|
|
3582
|
+
{ key: "en", label: "EN", nativeName: "English" },
|
|
3583
|
+
{ key: "es", label: "ES", nativeName: "Espa\xF1ol" }
|
|
3584
|
+
];
|
|
3572
3585
|
var sizeClasses2 = {
|
|
3573
3586
|
sm: {
|
|
3574
3587
|
container: "h-7 p-0.5 text-xs",
|
|
@@ -3598,9 +3611,9 @@ var shapeClasses2 = {
|
|
|
3598
3611
|
pill: "rounded-full"
|
|
3599
3612
|
};
|
|
3600
3613
|
function LanguageSwitcher({
|
|
3601
|
-
languages,
|
|
3602
|
-
currentLanguage,
|
|
3603
|
-
onLanguageChange,
|
|
3614
|
+
languages: propLanguages,
|
|
3615
|
+
currentLanguage: propCurrentLanguage,
|
|
3616
|
+
onLanguageChange: propOnLanguageChange,
|
|
3604
3617
|
labels = {},
|
|
3605
3618
|
className,
|
|
3606
3619
|
size = "sm",
|
|
@@ -3610,6 +3623,15 @@ function LanguageSwitcher({
|
|
|
3610
3623
|
align = "center",
|
|
3611
3624
|
side = "top"
|
|
3612
3625
|
}) {
|
|
3626
|
+
const context = useLanguageContext();
|
|
3627
|
+
const contextLanguages = context?.languages?.map((lang) => ({
|
|
3628
|
+
key: lang.code,
|
|
3629
|
+
label: lang.code.toUpperCase(),
|
|
3630
|
+
nativeName: lang.name
|
|
3631
|
+
}));
|
|
3632
|
+
const languages = propLanguages ?? contextLanguages ?? defaultLanguages;
|
|
3633
|
+
const currentLanguage = propCurrentLanguage ?? context?.language ?? "en";
|
|
3634
|
+
const onLanguageChange = propOnLanguageChange ?? context?.setLanguage;
|
|
3613
3635
|
const sizes = sizeClasses2[size];
|
|
3614
3636
|
const shapeClass = shapeClasses2[shape];
|
|
3615
3637
|
const defaultLabels2 = {
|
|
@@ -3639,7 +3661,7 @@ function LanguageSwitcher({
|
|
|
3639
3661
|
children: languages.map(({ key, nativeName }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3640
3662
|
DropdownMenuItem,
|
|
3641
3663
|
{
|
|
3642
|
-
onClick: () => onLanguageChange(key),
|
|
3664
|
+
onClick: () => onLanguageChange?.(key),
|
|
3643
3665
|
className: cn(
|
|
3644
3666
|
"justify-center text-xs font-semibold cursor-pointer px-3",
|
|
3645
3667
|
currentLanguage === key && "bg-accent"
|
|
@@ -3675,7 +3697,7 @@ function LanguageSwitcher({
|
|
|
3675
3697
|
{
|
|
3676
3698
|
"aria-label": label,
|
|
3677
3699
|
className: cn("relative font-semibold", sizes.button, shapeClass),
|
|
3678
|
-
onClick: () => onLanguageChange(key),
|
|
3700
|
+
onClick: () => onLanguageChange?.(key),
|
|
3679
3701
|
type: "button",
|
|
3680
3702
|
children: [
|
|
3681
3703
|
/* @__PURE__ */ jsxRuntime.jsx(react.AnimatePresence, { children: isActive && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4981,12 +5003,12 @@ function playNotificationSound(soundType = "chime", soundUrl) {
|
|
|
4981
5003
|
}
|
|
4982
5004
|
}
|
|
4983
5005
|
function NotificationsWidget({
|
|
4984
|
-
notifications,
|
|
4985
|
-
onMarkAsRead,
|
|
4986
|
-
onMarkAllAsRead,
|
|
4987
|
-
onDismiss,
|
|
4988
|
-
onClearAll,
|
|
4989
|
-
onNotificationClick,
|
|
5006
|
+
notifications: propNotifications,
|
|
5007
|
+
onMarkAsRead: propOnMarkAsRead,
|
|
5008
|
+
onMarkAllAsRead: propOnMarkAllAsRead,
|
|
5009
|
+
onDismiss: propOnDismiss,
|
|
5010
|
+
onClearAll: propOnClearAll,
|
|
5011
|
+
onNotificationClick: propOnNotificationClick,
|
|
4990
5012
|
size = "md",
|
|
4991
5013
|
maxVisible = 5,
|
|
4992
5014
|
playSound = true,
|
|
@@ -5000,6 +5022,13 @@ function NotificationsWidget({
|
|
|
5000
5022
|
pulseStyle = "ring",
|
|
5001
5023
|
soundCooldown = 2e3
|
|
5002
5024
|
}) {
|
|
5025
|
+
const context = useNotificationsContext();
|
|
5026
|
+
const notifications = propNotifications ?? context?.notifications ?? [];
|
|
5027
|
+
const onMarkAsRead = propOnMarkAsRead ?? context?.markAsRead;
|
|
5028
|
+
const onMarkAllAsRead = propOnMarkAllAsRead ?? context?.markAllAsRead;
|
|
5029
|
+
const onDismiss = propOnDismiss ?? context?.dismiss;
|
|
5030
|
+
const onClearAll = propOnClearAll ?? context?.clearAll;
|
|
5031
|
+
const onNotificationClick = propOnNotificationClick ?? context?.onNotificationClick;
|
|
5003
5032
|
const [isOpen, setIsOpen] = React2__namespace.useState(false);
|
|
5004
5033
|
const [prevCount, setPrevCount] = React2__namespace.useState(0);
|
|
5005
5034
|
const lastSoundPlayedRef = React2__namespace.useRef(0);
|
|
@@ -5442,7 +5471,9 @@ exports.DropdownMenuSub = DropdownMenuSub;
|
|
|
5442
5471
|
exports.DropdownMenuSubContent = DropdownMenuSubContent;
|
|
5443
5472
|
exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
|
|
5444
5473
|
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
5474
|
+
exports.LanguageContext = LanguageContext;
|
|
5445
5475
|
exports.LanguageSwitcher = LanguageSwitcher;
|
|
5476
|
+
exports.NotificationsContext = NotificationsContext;
|
|
5446
5477
|
exports.NotificationsWidget = NotificationsWidget;
|
|
5447
5478
|
exports.Popover = Popover;
|
|
5448
5479
|
exports.PopoverAnchor = PopoverAnchor;
|
|
@@ -5459,6 +5490,9 @@ exports.TooltipProvider = TooltipProvider;
|
|
|
5459
5490
|
exports.TooltipTrigger = TooltipTrigger;
|
|
5460
5491
|
exports.buttonVariants = buttonVariants;
|
|
5461
5492
|
exports.cn = cn;
|
|
5493
|
+
exports.defaultLanguages = defaultLanguages;
|
|
5462
5494
|
exports.toggleVariants = toggleVariants;
|
|
5495
|
+
exports.useLanguageContext = useLanguageContext;
|
|
5496
|
+
exports.useNotificationsContext = useNotificationsContext;
|
|
5463
5497
|
//# sourceMappingURL=index.cjs.map
|
|
5464
5498
|
//# sourceMappingURL=index.cjs.map
|