@digital-b2c/coreui-kit 0.15.5 → 0.15.6
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/LICENSE.txt +21 -21
- package/README.md +52 -52
- package/dist/index.cjs +40 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +3 -2
- 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 +40 -11
- package/dist/index.mjs.map +1 -1
- package/dist/types/global.d.ts +25 -25
- package/package.json +101 -101
package/LICENSE.txt
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Luxottica
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Luxottica
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
# CoreUI Kit
|
|
2
|
-
|
|
3
|
-
A React‑based design system and component library.
|
|
4
|
-
|
|
5
|
-
## 🚀 Getting Started
|
|
6
|
-
|
|
7
|
-
Install
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Development
|
|
14
|
-
|
|
15
|
-
- Run the build in watch mode
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm run dev
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Start Storybook
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
npm run storybook
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Run tests
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
npm test
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Lint/format
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm run lint
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## 🛠️ Usage
|
|
40
|
-
|
|
41
|
-
Import components in other projects:
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
import '@digital-b2c/coreui-kit/styles.css'
|
|
45
|
-
|
|
46
|
-
import { MiniSectionCta } from '@digital-b2c/coreui-kit'
|
|
47
|
-
|
|
48
|
-
<MiniSectionCta>
|
|
49
|
-
<MiniSectionCta.Title>Header</MiniSectionCta.Title>
|
|
50
|
-
<MiniSectionCta.Subtitle>Description</MiniSectionCta.Subtitle>
|
|
51
|
-
</MiniSectionCta>
|
|
52
|
-
```
|
|
1
|
+
# CoreUI Kit
|
|
2
|
+
|
|
3
|
+
A React‑based design system and component library.
|
|
4
|
+
|
|
5
|
+
## 🚀 Getting Started
|
|
6
|
+
|
|
7
|
+
Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Development
|
|
14
|
+
|
|
15
|
+
- Run the build in watch mode
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm run dev
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Start Storybook
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm run storybook
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Run tests
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm test
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Lint/format
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm run lint
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 🛠️ Usage
|
|
40
|
+
|
|
41
|
+
Import components in other projects:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import '@digital-b2c/coreui-kit/styles.css'
|
|
45
|
+
|
|
46
|
+
import { MiniSectionCta } from '@digital-b2c/coreui-kit'
|
|
47
|
+
|
|
48
|
+
<MiniSectionCta>
|
|
49
|
+
<MiniSectionCta.Title>Header</MiniSectionCta.Title>
|
|
50
|
+
<MiniSectionCta.Subtitle>Description</MiniSectionCta.Subtitle>
|
|
51
|
+
</MiniSectionCta>
|
|
52
|
+
```
|
package/dist/index.cjs
CHANGED
|
@@ -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
|