@uva-glass/component-library 1.57.0 → 1.58.0
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.
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
-
import { c as
|
|
3
|
-
import { NavLink as
|
|
4
|
-
import '../../assets/MenuLink.css';const
|
|
2
|
+
import { c as u } from "../../clsx-OuTLNxxd.js";
|
|
3
|
+
import { useLocation as k, NavLink as h } from "react-router-dom";
|
|
4
|
+
import '../../assets/MenuLink.css';const i = {
|
|
5
5
|
"menu-link": "_menu-link_8gjhh_1",
|
|
6
6
|
"menu-link--active": "_menu-link--active_8gjhh_8"
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
}, f = (t) => {
|
|
8
|
+
const o = k(), e = (n) => n.replace(/s$/, ""), s = (n) => {
|
|
9
|
+
const l = o.pathname.split("/").filter(Boolean), a = n.split("/").filter(Boolean).slice(-1)[0], c = e(a);
|
|
10
|
+
return l.some((r) => e(r) === c);
|
|
11
|
+
};
|
|
12
|
+
return /* @__PURE__ */ m(
|
|
13
|
+
h,
|
|
14
|
+
{
|
|
15
|
+
...t,
|
|
16
|
+
className: ({ isActive: n }) => u(i["menu-link"], {
|
|
17
|
+
[i["menu-link--active"]]: n || s(t.to)
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
};
|
|
14
22
|
export {
|
|
15
|
-
|
|
23
|
+
f as MenuLink
|
|
16
24
|
};
|
|
17
25
|
//# sourceMappingURL=MenuLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuLink.js","sources":["../../../src/components/MenuLink/MenuLink.tsx"],"sourcesContent":["import classNames from 'clsx';\nimport { NavLink } from 'react-router-dom';\n\nimport type { NavLinkProps } from 'react-router-dom';\n\nimport styles from './MenuLink.module.css';\n\n/** Represents a component for a [NavLink](https://reactrouter.com/en/main/components/nav-link) with styling. */\n// Omit style so it cannot be accidentally used\nexport const MenuLink = (props: Omit<NavLinkProps, 'style'>) => (\n <NavLink\n
|
|
1
|
+
{"version":3,"file":"MenuLink.js","sources":["../../../src/components/MenuLink/MenuLink.tsx"],"sourcesContent":["import classNames from 'clsx';\nimport { NavLink, useLocation } from 'react-router-dom';\n\nimport type { NavLinkProps } from 'react-router-dom';\n\nimport styles from './MenuLink.module.css';\n\n/** Represents a component for a [NavLink](https://reactrouter.com/en/main/components/nav-link) with styling. */\n// Omit style so it cannot be accidentally used\nexport const MenuLink = (props: Omit<NavLinkProps, 'style'>) => {\n const location = useLocation();\n\n // Helper function to remove trailing 's' from a string\n const singularize = (str: string) => str.replace(/s$/, '');\n\n // Check if 'to' path (singular version) matches any segment (singular version)\n const isActiveSingular = (to: string) => {\n const currentSegments = location.pathname.split('/').filter(Boolean);\n const latestToPath = to.split('/').filter(Boolean).slice(-1)[0]; // return only lates path removing any prepend path\n const singularizedToPath = singularize(latestToPath);\n\n return currentSegments.some((segment) => singularize(segment) === singularizedToPath);\n };\n\n return (\n <NavLink\n {...props}\n className={({ isActive }) =>\n classNames(styles['menu-link'], {\n [styles['menu-link--active']]: isActive || isActiveSingular(props.to as string),\n })\n }\n />\n );\n};\n"],"names":["MenuLink","props","location","useLocation","singularize","str","isActiveSingular","to","currentSegments","latestToPath","singularizedToPath","segment","jsx","NavLink","isActive","classNames","styles"],"mappings":";;;;;;GASaA,IAAW,CAACC,MAAuC;AAC9D,QAAMC,IAAWC,KAGXC,IAAc,CAACC,MAAgBA,EAAI,QAAQ,MAAM,EAAE,GAGnDC,IAAmB,CAACC,MAAe;AACvC,UAAMC,IAAkBN,EAAS,SAAS,MAAM,GAAG,EAAE,OAAO,OAAO,GAC7DO,IAAeF,EAAG,MAAM,GAAG,EAAE,OAAO,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,GACxDG,IAAqBN,EAAYK,CAAY;AAEnD,WAAOD,EAAgB,KAAK,CAACG,MAAYP,EAAYO,CAAO,MAAMD,CAAkB;AAAA,EAAA;AAIpF,SAAA,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MACE,GAAGZ;AAAA,MACJ,WAAW,CAAC,EAAE,UAAAa,EAAA,MACZC,EAAWC,EAAO,WAAW,GAAG;AAAA,QAC9B,CAACA,EAAO,mBAAmB,CAAC,GAAGF,KAAYR,EAAiBL,EAAM,EAAY;AAAA,MAAA,CAC/E;AAAA,IAAA;AAAA,EAAA;AAIT;"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@uva-glass/component-library",
|
|
3
3
|
"author": "Team Glass - Frontend vrienden",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.58.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
@@ -48,41 +48,41 @@
|
|
|
48
48
|
"@semantic-release/git": "^10.0.1",
|
|
49
49
|
"@semantic-release/gitlab": "^13.2.1",
|
|
50
50
|
"@semantic-release/npm": "^12.0.1",
|
|
51
|
-
"@storybook/addon-a11y": "^8.3.
|
|
52
|
-
"@storybook/addon-essentials": "^8.3.
|
|
53
|
-
"@storybook/addon-links": "^8.3.
|
|
54
|
-
"@storybook/blocks": "^8.3.
|
|
55
|
-
"@storybook/manager-api": "^8.3.
|
|
56
|
-
"@storybook/preview-api": "^8.3.
|
|
57
|
-
"@storybook/react": "^8.3.
|
|
58
|
-
"@storybook/react-vite": "^8.3.
|
|
59
|
-
"@storybook/test": "^8.3.
|
|
60
|
-
"@types/node": "^20.16.
|
|
51
|
+
"@storybook/addon-a11y": "^8.3.6",
|
|
52
|
+
"@storybook/addon-essentials": "^8.3.6",
|
|
53
|
+
"@storybook/addon-links": "^8.3.6",
|
|
54
|
+
"@storybook/blocks": "^8.3.6",
|
|
55
|
+
"@storybook/manager-api": "^8.3.6",
|
|
56
|
+
"@storybook/preview-api": "^8.3.6",
|
|
57
|
+
"@storybook/react": "^8.3.6",
|
|
58
|
+
"@storybook/react-vite": "^8.3.6",
|
|
59
|
+
"@storybook/test": "^8.3.6",
|
|
60
|
+
"@types/node": "^20.16.14",
|
|
61
61
|
"@types/react": "^18.3.11",
|
|
62
62
|
"@types/react-dom": "^18.3.1",
|
|
63
63
|
"@uva-glass/eslint-config": "^1.3.1",
|
|
64
64
|
"@uva-glass/stylelint-config": "^1.1.0",
|
|
65
|
-
"@vitejs/plugin-react": "^4.3.
|
|
65
|
+
"@vitejs/plugin-react": "^4.3.3",
|
|
66
66
|
"clsx": "^2.1.1",
|
|
67
67
|
"eslint": "^8.57.1",
|
|
68
68
|
"eslint-config-prettier": "^9.1.0",
|
|
69
69
|
"eslint-plugin-prettier": "^5.2.1",
|
|
70
70
|
"eslint-plugin-react": "^7.37.1",
|
|
71
71
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
72
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
73
|
-
"eslint-plugin-storybook": "^0.
|
|
72
|
+
"eslint-plugin-react-refresh": "^0.4.13",
|
|
73
|
+
"eslint-plugin-storybook": "^0.10.1",
|
|
74
74
|
"glob": "^11.0.0",
|
|
75
75
|
"jest": "^29.7.0",
|
|
76
76
|
"jest-environment-jsdom": "^29.7.0",
|
|
77
77
|
"jest-junit": "^16.0.0",
|
|
78
78
|
"jsdom": "^25.0.1",
|
|
79
|
-
"npm-run-all2": "^
|
|
79
|
+
"npm-run-all2": "^7.0.0",
|
|
80
80
|
"react": "^18.3.1",
|
|
81
81
|
"react-dom": "^18.3.1",
|
|
82
82
|
"react-router-dom": "^6.27.0",
|
|
83
|
-
"semantic-release": "^24.1.
|
|
84
|
-
"storybook": "^8.3.
|
|
85
|
-
"style-dictionary": "^4.1.
|
|
83
|
+
"semantic-release": "^24.1.3",
|
|
84
|
+
"storybook": "^8.3.6",
|
|
85
|
+
"style-dictionary": "^4.1.4",
|
|
86
86
|
"stylelint": "^16.10.0",
|
|
87
87
|
"stylelint-config-recommended": "^14.0.1",
|
|
88
88
|
"stylelint-config-standard": "^36.0.1",
|