@digital-b2c/coreui-kit 0.15.5 → 0.15.7
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 +41 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +56 -29
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +87 -83
- package/dist/index.d.ts +87 -83
- package/dist/index.mjs +41 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3044,7 +3044,7 @@ var MiniBanner = ({
|
|
|
3044
3044
|
const goBackNode = slots == null ? void 0 : slots.goBack;
|
|
3045
3045
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx47__default.default(MiniBanner_module_default.minibanner, MiniBanner_module_default[variant], className), children: [
|
|
3046
3046
|
((background == null ? void 0 : background.src) || ((_d = background == null ? void 0 : background.desktop) == null ? void 0 : _d.src) || ((_e = background == null ? void 0 : background.mobile) == null ? void 0 : _e.src)) && /* @__PURE__ */ jsxRuntime.jsx(Picture, __spreadValues({ className: MiniBanner_module_default.background }, background)),
|
|
3047
|
-
/* @__PURE__ */ jsxRuntime.jsx(Container, { className: clsx47__default.default(
|
|
3047
|
+
/* @__PURE__ */ jsxRuntime.jsx(Container, { className: clsx47__default.default(MiniBanner_module_default.container), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: MiniBanner_module_default.wrapper, children: [
|
|
3048
3048
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: MiniBanner_module_default.textContainer, children: [
|
|
3049
3049
|
(logo == null ? void 0 : logo.src) && /* @__PURE__ */ jsxRuntime.jsx(Picture, __spreadValues({ className: MiniBanner_module_default.logo }, logo)),
|
|
3050
3050
|
pretitleNode && /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx47__default.default(MiniBanner_module_default.pretitle, "small"), children: pretitleNode }),
|
|
@@ -3297,6 +3297,29 @@ var NavigationBrandBars = ({
|
|
|
3297
3297
|
}
|
|
3298
3298
|
);
|
|
3299
3299
|
};
|
|
3300
|
+
var getPathname = () => typeof window === "undefined" ? "" : window.location.pathname;
|
|
3301
|
+
var useActivePath = () => {
|
|
3302
|
+
const [pathname, setPathname] = React70.useState(getPathname);
|
|
3303
|
+
React70.useEffect(() => {
|
|
3304
|
+
const handlePopState = () => setPathname(getPathname());
|
|
3305
|
+
window.addEventListener("popstate", handlePopState);
|
|
3306
|
+
return () => window.removeEventListener("popstate", handlePopState);
|
|
3307
|
+
}, []);
|
|
3308
|
+
return pathname;
|
|
3309
|
+
};
|
|
3310
|
+
|
|
3311
|
+
// src/utils/isPathActive.ts
|
|
3312
|
+
var normalize = (path) => path.replace(/\/+$/, "") || "/";
|
|
3313
|
+
var isPathActive = (url, pathname) => {
|
|
3314
|
+
if (!url || !pathname) return false;
|
|
3315
|
+
let targetPath;
|
|
3316
|
+
try {
|
|
3317
|
+
targetPath = new URL(url, "http://localhost").pathname;
|
|
3318
|
+
} catch (e) {
|
|
3319
|
+
return false;
|
|
3320
|
+
}
|
|
3321
|
+
return normalize(targetPath) === normalize(pathname);
|
|
3322
|
+
};
|
|
3300
3323
|
var NavigationDesktop = ({
|
|
3301
3324
|
navItems,
|
|
3302
3325
|
openIndex,
|
|
@@ -3305,6 +3328,7 @@ var NavigationDesktop = ({
|
|
|
3305
3328
|
baseId,
|
|
3306
3329
|
isTransparent = false
|
|
3307
3330
|
}) => {
|
|
3331
|
+
const pathname = useActivePath();
|
|
3308
3332
|
if (!(navItems == null ? void 0 : navItems.length)) return null;
|
|
3309
3333
|
const handleTriggerKeyDown = (e, index) => {
|
|
3310
3334
|
var _a;
|
|
@@ -3322,23 +3346,28 @@ var NavigationDesktop = ({
|
|
|
3322
3346
|
}
|
|
3323
3347
|
};
|
|
3324
3348
|
return /* @__PURE__ */ jsxRuntime.jsx("ul", { className: Navigation_module_default.navTabs, children: navItems.map((item, index) => {
|
|
3325
|
-
var _a, _b, _c, _d;
|
|
3349
|
+
var _a, _b, _c, _d, _e;
|
|
3326
3350
|
const isOpen = openIndex === index;
|
|
3327
3351
|
if (item.type === "link") {
|
|
3352
|
+
const isCurrent2 = item.isActive || isPathActive((_a = item.cta) == null ? void 0 : _a.url, pathname);
|
|
3328
3353
|
return /* @__PURE__ */ jsxRuntime.jsx("li", { className: Navigation_module_default.navTab, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3329
3354
|
"a",
|
|
3330
3355
|
{
|
|
3331
|
-
href: (
|
|
3332
|
-
className: clsx47__default.default(Navigation_module_default.navTabLink,
|
|
3333
|
-
"aria-current":
|
|
3334
|
-
target: ((
|
|
3335
|
-
rel: ((
|
|
3356
|
+
href: (_b = item.cta) == null ? void 0 : _b.url,
|
|
3357
|
+
className: clsx47__default.default(Navigation_module_default.navTabLink, isCurrent2 && Navigation_module_default.navTabActive),
|
|
3358
|
+
"aria-current": isCurrent2 ? "page" : void 0,
|
|
3359
|
+
target: ((_c = item.cta) == null ? void 0 : _c.isExternal) ? "_blank" : void 0,
|
|
3360
|
+
rel: ((_d = item.cta) == null ? void 0 : _d.isExternal) ? "noopener noreferrer" : void 0,
|
|
3336
3361
|
onMouseEnter: () => onOpen(null),
|
|
3337
3362
|
onFocus: () => onOpen(null),
|
|
3338
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: (
|
|
3363
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: (_e = item.cta) == null ? void 0 : _e.label })
|
|
3339
3364
|
}
|
|
3340
3365
|
) }, index);
|
|
3341
3366
|
}
|
|
3367
|
+
const isCurrent = item.isActive || item.items.some((sub) => {
|
|
3368
|
+
var _a2;
|
|
3369
|
+
return sub.type === "link" && isPathActive((_a2 = sub.cta) == null ? void 0 : _a2.url, pathname);
|
|
3370
|
+
});
|
|
3342
3371
|
return /* @__PURE__ */ jsxRuntime.jsx("li", { className: Navigation_module_default.navTab, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3343
3372
|
"button",
|
|
3344
3373
|
{
|
|
@@ -3347,7 +3376,7 @@ var NavigationDesktop = ({
|
|
|
3347
3376
|
className: clsx47__default.default(
|
|
3348
3377
|
Navigation_module_default.navTabLink,
|
|
3349
3378
|
Navigation_module_default.navTabTrigger,
|
|
3350
|
-
(
|
|
3379
|
+
(isCurrent || isOpen) && Navigation_module_default.navTabActive,
|
|
3351
3380
|
isOpen && Navigation_module_default.navTabTriggerOpen
|
|
3352
3381
|
),
|
|
3353
3382
|
"aria-expanded": isOpen,
|
|
@@ -3826,8 +3855,8 @@ var Navigation2 = (props) => {
|
|
|
3826
3855
|
),
|
|
3827
3856
|
"aria-label": "Main",
|
|
3828
3857
|
onKeyDown: handleNavKeyDown,
|
|
3829
|
-
onMouseEnter: isExternal ? () => setIsHovered(true) : void 0,
|
|
3830
|
-
onMouseLeave: isExternal ? () => setIsHovered(false) : scheduleClose,
|
|
3858
|
+
onMouseEnter: isExternal && !isTabletBelow ? () => setIsHovered(true) : void 0,
|
|
3859
|
+
onMouseLeave: isExternal ? !isTabletBelow ? () => setIsHovered(false) : void 0 : scheduleClose,
|
|
3831
3860
|
children: [
|
|
3832
3861
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: Navigation_module_default.mainBar, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: Navigation_module_default.inner, children: [
|
|
3833
3862
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: Navigation_module_default.topRow, children: [
|
|
@@ -5387,6 +5416,7 @@ exports.UpcomingEventCard = UpcomingEventCard;
|
|
|
5387
5416
|
exports.UserMenu = UserMenu;
|
|
5388
5417
|
exports.resolveCompoundSlots = resolveCompoundSlots;
|
|
5389
5418
|
exports.svgs = svgs;
|
|
5419
|
+
exports.useActivePath = useActivePath;
|
|
5390
5420
|
exports.useIntersectionObserver = useIntersectionObserver;
|
|
5391
5421
|
exports.useIsAtTop = useIsAtTop;
|
|
5392
5422
|
//# sourceMappingURL=index.cjs.map
|