@civicactions/cmsds-open-data-components 3.0.0-alpha.23 → 3.0.0-alpha.24
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/main.js +18 -21
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +2 -18
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -31,30 +31,23 @@ function $parcel$interopDefault(a) {
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
const $cf8eeac354b9dd32$var$NavLink = ({ link: link , className: className , wrapLabel: wrapLabel })=>{
|
|
34
|
+
const $24918217e48ac525$var$NavLink = ({ link: link , className: className , wrapLabel: wrapLabel , clickHandler: clickHandler })=>{
|
|
36
35
|
const innerHtml = wrapLabel ? /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
37
36
|
children: link.label
|
|
38
37
|
}) : link.label;
|
|
39
|
-
// if (validator.isURL(link.url, { require_protocol: true })) {
|
|
40
|
-
// return (
|
|
41
|
-
// <a className={className} href={link.url}>
|
|
42
|
-
// {innerHtml}
|
|
43
|
-
// </a>
|
|
44
|
-
// );
|
|
45
|
-
// } else {
|
|
46
38
|
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$NavLink), {
|
|
47
39
|
className: ({ isActive: isActive })=>isActive ? `dc-c-active-link ${className}` : `${className}`,
|
|
48
40
|
to: link.url,
|
|
41
|
+
onClick: clickHandler ? clickHandler : undefined,
|
|
49
42
|
children: innerHtml
|
|
50
43
|
});
|
|
51
44
|
// }
|
|
52
45
|
};
|
|
53
|
-
$
|
|
46
|
+
$24918217e48ac525$var$NavLink.defaultProps = {
|
|
54
47
|
wrapLabel: false,
|
|
55
48
|
className: null
|
|
56
49
|
};
|
|
57
|
-
$
|
|
50
|
+
$24918217e48ac525$var$NavLink.propTypes = {
|
|
58
51
|
link: (0, $hgUW1$proptypes).shape({
|
|
59
52
|
url: (0, $hgUW1$proptypes).string,
|
|
60
53
|
label: (0, $hgUW1$proptypes).string,
|
|
@@ -65,7 +58,7 @@ $cf8eeac354b9dd32$var$NavLink.propTypes = {
|
|
|
65
58
|
* Will wrap the link label in a span for help with styling.
|
|
66
59
|
*/ wrapLabel: (0, $hgUW1$proptypes).bool
|
|
67
60
|
};
|
|
68
|
-
var $
|
|
61
|
+
var $24918217e48ac525$export$2e2bcd8739ae039 = $24918217e48ac525$var$NavLink;
|
|
69
62
|
|
|
70
63
|
|
|
71
64
|
const $4f153ca537d853e5$var$SubMenu = ({ link: link , linkClasses: linkClasses , wrapLabel: wrapLabel })=>{
|
|
@@ -111,7 +104,7 @@ const $4f153ca537d853e5$var$SubMenu = ({ link: link , linkClasses: linkClasses ,
|
|
|
111
104
|
/*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
112
105
|
className: "dc-c-site-menu--sub-menu",
|
|
113
106
|
children: link.submenu.map((s)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
114
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $
|
|
107
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $24918217e48ac525$export$2e2bcd8739ae039), {
|
|
115
108
|
link: s,
|
|
116
109
|
wrapLabel: wrapLabel
|
|
117
110
|
})
|
|
@@ -124,7 +117,7 @@ var $4f153ca537d853e5$export$2e2bcd8739ae039 = $4f153ca537d853e5$var$SubMenu;
|
|
|
124
117
|
|
|
125
118
|
|
|
126
119
|
|
|
127
|
-
const $f57121650539d8c5$var$NavBar = ({ links: links , menuName: menuName , menuId: menuId , menuClasses: menuClasses , linkClasses: linkClasses , wrapLabel: wrapLabel })=>{
|
|
120
|
+
const $f57121650539d8c5$var$NavBar = ({ links: links , menuName: menuName , menuId: menuId , menuClasses: menuClasses , linkClasses: linkClasses , wrapLabel: wrapLabel , clickHandler: clickHandler })=>{
|
|
128
121
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("nav", {
|
|
129
122
|
className: `dc-c-${menuId}-menu`,
|
|
130
123
|
"aria-labelledby": `dc-c-${menuId}-menu--heading`,
|
|
@@ -143,10 +136,11 @@ const $f57121650539d8c5$var$NavBar = ({ links: links , menuName: menuName , menu
|
|
|
143
136
|
linkClasses: linkClasses
|
|
144
137
|
}, link.id);
|
|
145
138
|
else return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
146
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $
|
|
139
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $24918217e48ac525$export$2e2bcd8739ae039), {
|
|
147
140
|
link: link,
|
|
148
141
|
className: linkClasses,
|
|
149
|
-
wrapLabel: wrapLabel
|
|
142
|
+
wrapLabel: wrapLabel,
|
|
143
|
+
clickHandler: clickHandler
|
|
150
144
|
})
|
|
151
145
|
}, link.id);
|
|
152
146
|
})
|
|
@@ -3345,8 +3339,7 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
|
|
|
3345
3339
|
}
|
|
3346
3340
|
function handleClick(event) {
|
|
3347
3341
|
// Links are wrapped in spans, this checks if the parent is an A, also check if in the search modal.
|
|
3348
|
-
if (
|
|
3349
|
-
event.target.closest(".dc-c-search-dialog")) setMenuOpen(false);
|
|
3342
|
+
if (event.target.closest(".dc-c-search-dialog")) setMenuOpen(false);
|
|
3350
3343
|
}
|
|
3351
3344
|
function handleSearchEnter(event) {
|
|
3352
3345
|
// Close upon user hitting enter on search.
|
|
@@ -3382,6 +3375,9 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
|
|
|
3382
3375
|
}
|
|
3383
3376
|
};
|
|
3384
3377
|
};
|
|
3378
|
+
const handleMobileLinkClick = (e)=>{
|
|
3379
|
+
if (e.target.closest("a").getAttribute("href") === window.location.pathname) setMenuOpen(false);
|
|
3380
|
+
};
|
|
3385
3381
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("header", {
|
|
3386
3382
|
className: `dc-c-header dc-c-mobile-header ${menuOpen ? "menu-open" : ""}`,
|
|
3387
3383
|
"aria-label": "Site header",
|
|
@@ -3486,7 +3482,8 @@ const $caaccb8ea608e518$var$MobileHeader = ({ siteName: siteName , links: links
|
|
|
3486
3482
|
menuName: "Main Nav",
|
|
3487
3483
|
menuId: "site",
|
|
3488
3484
|
menuClasses: "dc-c-header--links dc-c-header--mobile-links",
|
|
3489
|
-
linkClasses: "ds-u-margin-left--1 ds-u-padding-bottom--2 ds-text-heading--md"
|
|
3485
|
+
linkClasses: "ds-u-margin-left--1 ds-u-padding-bottom--2 ds-text-heading--md",
|
|
3486
|
+
clickHandler: handleMobileLinkClick
|
|
3490
3487
|
}),
|
|
3491
3488
|
mobile && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3492
3489
|
className: "cms-mobile-header--container",
|
|
@@ -3641,7 +3638,7 @@ const $a6df0aa147323304$var$Footer = ({ links: links , showEmail: showEmail , em
|
|
|
3641
3638
|
className: "ds-u-font-size--sm ds-u-margin-bottom--3",
|
|
3642
3639
|
children: footerOpenDataToolLinks.map((link)=>/*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
3643
3640
|
className: "ds-u-margin-bottom--1",
|
|
3644
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $
|
|
3641
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $24918217e48ac525$export$2e2bcd8739ae039), {
|
|
3645
3642
|
link: link,
|
|
3646
3643
|
className: "dc-menu-item"
|
|
3647
3644
|
})
|
|
@@ -3672,7 +3669,7 @@ const $a6df0aa147323304$var$Footer = ({ links: links , showEmail: showEmail , em
|
|
|
3672
3669
|
}, link.id);
|
|
3673
3670
|
return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
|
|
3674
3671
|
className: "ds-u-margin-bottom--1",
|
|
3675
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $
|
|
3672
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $24918217e48ac525$export$2e2bcd8739ae039), {
|
|
3676
3673
|
link: link,
|
|
3677
3674
|
className: "dc-menu-item"
|
|
3678
3675
|
})
|