@veracity/vui 2.17.2-beta.2 → 2.18.0-beta.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.
- package/dist/cjs/footer/footer.d.ts.map +1 -1
- package/dist/cjs/footer/footer.js +7 -10
- package/dist/cjs/utils/dates.d.ts +1 -0
- package/dist/cjs/utils/dates.d.ts.map +1 -1
- package/dist/cjs/utils/dates.js +6 -1
- package/dist/esm/footer/footer.d.ts.map +1 -1
- package/dist/esm/footer/footer.js +8 -11
- package/dist/esm/utils/dates.d.ts +1 -0
- package/dist/esm/utils/dates.d.ts.map +1 -1
- package/dist/esm/utils/dates.js +4 -0
- package/package.json +1 -1
- package/src/footer/footer.tsx +9 -14
- package/src/utils/dates.ts +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../src/footer/footer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAwC,YAAY,EAAE,MAAM,SAAS,CAAA;AAO5E,OAAO,EAAkB,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,UAAU,MAAM,cAAc,CAAA;AACrC,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAK3C,eAAO,MAAM,UAAU,+HAItB,CAAA;
|
|
1
|
+
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../src/footer/footer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAwC,YAAY,EAAE,MAAM,SAAS,CAAA;AAO5E,OAAO,EAAkB,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,UAAU,MAAM,cAAc,CAAA;AACrC,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAK3C,eAAO,MAAM,UAAU,+HAItB,CAAA;AAKD,oGAAoG;AACpG,eAAO,MAAM,MAAM;YAoNT,mBAAmB;aAClB,oBAAoB;aACpB,oBAAoB;UACvB,iBAAiB;SAClB,gBAAgB;aACZ,oBAAoB;CAC9B,CAAA;AAUD,eAAe,MAAM,CAAA"}
|
|
@@ -39,16 +39,14 @@ exports.FooterBase = core_1.styled.divBox `
|
|
|
39
39
|
padding: 5 3;
|
|
40
40
|
`;
|
|
41
41
|
/*@formatter:on*/
|
|
42
|
+
const currentYear = (0, utils_1.getCurrentYear)();
|
|
42
43
|
/** Branded Veracity Footer with trademark and links sections. Controls max-width of the content. */
|
|
43
44
|
exports.Footer = (0, core_1.vui)((props, ref) => {
|
|
44
45
|
const { applicationLinks, applicationSocialLinks = [], applicationStaticItems = [], children, className, columns, isApplication = false, isDNV = false, linkedIn, size, variant, isSlim } = props, rest = __rest(props, ["applicationLinks", "applicationSocialLinks", "applicationStaticItems", "children", "className", "columns", "isApplication", "isDNV", "linkedIn", "size", "variant", "isSlim"]);
|
|
45
46
|
const context = { size, variant };
|
|
46
47
|
const styles = (0, core_1.useStyleConfig)('Footer', props);
|
|
47
|
-
if (isApplication)
|
|
48
|
-
|
|
49
|
-
console.error('Footer: isApplication is true but applicationLinks is not set.');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
48
|
+
if (isApplication && !applicationLinks)
|
|
49
|
+
console.error('Footer: isApplication is true but applicationLinks not set.');
|
|
52
50
|
const slimLinks = [
|
|
53
51
|
{
|
|
54
52
|
id: 'home',
|
|
@@ -62,19 +60,18 @@ exports.Footer = (0, core_1.vui)((props, ref) => {
|
|
|
62
60
|
(_a = section.links) === null || _a === void 0 ? void 0 : _a.map(link => {
|
|
63
61
|
if (!link)
|
|
64
62
|
return;
|
|
65
|
-
if (['home', 'support', 'status'].includes(link.id || ''))
|
|
63
|
+
if (['home', 'support', 'status'].includes(link.id || ''))
|
|
66
64
|
slimLinks.push(link);
|
|
67
|
-
}
|
|
68
65
|
});
|
|
69
66
|
});
|
|
70
67
|
});
|
|
71
68
|
const downMd = (0, core_1.useDown)('md');
|
|
72
69
|
const downLg = (0, core_1.useDown)('lg');
|
|
73
|
-
return ((0, jsx_runtime_1.jsx)(context_1.FooterProvider, { value: context, children: (0, jsx_runtime_1.jsxs)(exports.FooterBase, Object.assign({ className: (0, utils_1.cs)('vui-footer', isApplication ? 'vui-footer-app' : '', className), px: isApplication ? '40px' : 3, py: isSlim ? (downMd ? '16px' : '9px') : 5, role: "contentinfo" }, styles.container, { ref: ref }, rest, { children: [isApplication && ((0, jsx_runtime_1.jsx)(footerContent_1.default, { alignContent: "center", alignItems: "center", maxW: "100%", children: (0, jsx_runtime_1.jsxs)(footerRow_1.default, { alignContent: "space-between", w: 1, children: [(0, jsx_runtime_1.jsx)(box_1.Box, { alignItems: "self-start", columnGap: 3, flex: { xs: '0 0 100%', sm: '0 0 100%', md: '0 0 100%', lg: '0 0 50%' }, py: { xs: 1, sm: 1, md: 1.25, lg: 1.5 }, wrap: true, children: applicationLinks === null || applicationLinks === void 0 ? void 0 : applicationLinks.map((link, index) => ((0, jsx_runtime_1.jsxs)(box_1.Box, { flex: { xs: '0 0 50%', sm: '0 0 auto' }, children: [link.items && ((0, jsx_runtime_1.jsxs)(menu_1.default, Object.assign({ isLazy: false, offset: [-16, 9], placement: "top-start", size: "lg" }, rest, { children: [(0, jsx_runtime_1.jsx)(menu_1.default.Button, Object.assign({ as: link_1.Link, className: "vui-footerLink-trigger", pt: "3px", role: "button", text: link.text, title: link.text }, styles.link, rest)), (0, jsx_runtime_1.jsx)(menu_1.default.List, Object.assign({ maxH: 400, right: 0, w: 320 }, styles.list, { children: link.items.map(({ text, url }, index) => ((0, jsx_runtime_1.jsx)(menu_1.default.Item, Object.assign({ isTruncated: true, linkProps: { href: url }, text: text, title: text }, styles.item), index))) }))] }))), !link.items && (0, jsx_runtime_1.jsx)(footerLink_1.default, Object.assign({}, link, { href: link.url }))] }, index))) }), downLg && (0, jsx_runtime_1.jsx)(divider_1.Divider, { borderColor: "sandstone.main", mb: 0.5, mt: 1, w: 1 }), (0, jsx_runtime_1.jsxs)(box_1.Box, { centerV: true, columnGap: 3, flex: { xs: '0 0 100%', sm: '0 0 100%', md: '0 0 100%', lg: '0 0 50%' }, justifyContent: { sm: 'center', lg: 'flex-end' }, py: { xs: 1, sm: 1, md: 1.25, lg: 1.5 }, wrap: true, children: [applicationStaticItems === null || applicationStaticItems === void 0 ? void 0 : applicationStaticItems.map((text, index) => ((0, jsx_runtime_1.jsx)(box_1.Box, { children: (0, jsx_runtime_1.jsx)(t_1.T, { size: "sm", children: text }) }, index))), isDNV ? ((0, jsx_runtime_1.jsx)(box_1.Box, { children: (0, jsx_runtime_1.
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)(context_1.FooterProvider, { value: context, children: (0, jsx_runtime_1.jsxs)(exports.FooterBase, Object.assign({ className: (0, utils_1.cs)('vui-footer', isApplication ? 'vui-footer-app' : '', className), px: isApplication ? '40px' : 3, py: isSlim ? (downMd ? '16px' : '9px') : 5, role: "contentinfo" }, styles.container, { ref: ref }, rest, { children: [isApplication && ((0, jsx_runtime_1.jsx)(footerContent_1.default, { alignContent: "center", alignItems: "center", maxW: "100%", children: (0, jsx_runtime_1.jsxs)(footerRow_1.default, { alignContent: "space-between", w: 1, children: [(0, jsx_runtime_1.jsx)(box_1.Box, { alignItems: "self-start", columnGap: 3, flex: { xs: '0 0 100%', sm: '0 0 100%', md: '0 0 100%', lg: '0 0 50%' }, py: { xs: 1, sm: 1, md: 1.25, lg: 1.5 }, wrap: true, children: applicationLinks === null || applicationLinks === void 0 ? void 0 : applicationLinks.map((link, index) => ((0, jsx_runtime_1.jsxs)(box_1.Box, { flex: { xs: '0 0 50%', sm: '0 0 auto' }, children: [link.items && ((0, jsx_runtime_1.jsxs)(menu_1.default, Object.assign({ isLazy: false, offset: [-16, 9], placement: "top-start", size: "lg" }, rest, { children: [(0, jsx_runtime_1.jsx)(menu_1.default.Button, Object.assign({ as: link_1.Link, className: "vui-footerLink-trigger", pt: "3px", role: "button", text: link.text, title: link.text }, styles.link, rest)), (0, jsx_runtime_1.jsx)(menu_1.default.List, Object.assign({ maxH: 400, right: 0, w: 320 }, styles.list, { children: link.items.map(({ text, url }, index) => ((0, jsx_runtime_1.jsx)(menu_1.default.Item, Object.assign({ isTruncated: true, linkProps: { href: url }, text: text, title: text }, styles.item), index))) }))] }))), !link.items && (0, jsx_runtime_1.jsx)(footerLink_1.default, Object.assign({}, link, { href: link.url }))] }, index))) }), downLg && (0, jsx_runtime_1.jsx)(divider_1.Divider, { borderColor: "sandstone.main", mb: 0.5, mt: 1, w: 1 }), (0, jsx_runtime_1.jsxs)(box_1.Box, { centerV: true, columnGap: 3, flex: { xs: '0 0 100%', sm: '0 0 100%', md: '0 0 100%', lg: '0 0 50%' }, justifyContent: { sm: 'center', lg: 'flex-end' }, py: { xs: 1, sm: 1, md: 1.25, lg: 1.5 }, wrap: true, children: [applicationStaticItems === null || applicationStaticItems === void 0 ? void 0 : applicationStaticItems.map((text, index) => ((0, jsx_runtime_1.jsx)(box_1.Box, { children: (0, jsx_runtime_1.jsx)(t_1.T, { size: "sm", children: text }) }, index))), isDNV ? ((0, jsx_runtime_1.jsx)(box_1.Box, { children: (0, jsx_runtime_1.jsxs)(t_1.T, { size: "sm", children: ["\u00A9 DNV AS ", currentYear] }) })) : ((0, jsx_runtime_1.jsx)(box_1.Box, { children: (0, jsx_runtime_1.jsxs)(t_1.T, { size: "sm", children: [(0, jsx_runtime_1.jsx)(t_1.T, { weight: "demi", children: "Veracity by DNV" }), ", DNV AS"] }) })), (0, jsx_runtime_1.jsxs)(box_1.Box, { children: [applicationSocialLinks === null || applicationSocialLinks === void 0 ? void 0 : applicationSocialLinks.map((link, index) => ((0, jsx_runtime_1.jsx)(link_1.Link, Object.assign({ "aria-label": link.text, fontWeight: "demi", href: link.url, iconLeft: (0, jsx_runtime_1.jsx)(link_1.Link.Icon, { name: `cubCircle${link.text}`, radius: "50%", size: "xs" }), isExternal: true, mr: 1, size: { _: 'sm', md: 'md' } }, styles.link), index))), (0, jsx_runtime_1.jsx)(link_1.Link, Object.assign({ fontWeight: "demi", href: linkedIn !== null && linkedIn !== void 0 ? linkedIn : footerTrademark_1.defaultLinkedInUrl, isExternal: true, size: { _: 'sm', md: 'md' } }, styles.link, { children: (0, jsx_runtime_1.jsx)(footerHeading_1.default, { fontSize: "16px", mb: 0, text: "Follow us" }) }))] })] })] }) })), !isApplication && isSlim && ((0, jsx_runtime_1.jsx)(footerContent_1.default, { alignContent: "center", alignItems: "center", maxW: { xs: 343, sm: 305, md: 720, lg: 975 }, children: (0, jsx_runtime_1.jsxs)(footerRow_1.default, { children: [slimLinks.map(({ text, url, id }, index) => {
|
|
74
71
|
/** if the screen is small drop one specific link */
|
|
75
|
-
if (downLg &&
|
|
72
|
+
if (downLg && id === 'support')
|
|
76
73
|
return;
|
|
77
|
-
return ((0, jsx_runtime_1.jsx)(footerSlimColumn_1.default, { children: (0, jsx_runtime_1.jsx)(footerLink_1.default,
|
|
74
|
+
return ((0, jsx_runtime_1.jsx)(footerSlimColumn_1.default, { children: (0, jsx_runtime_1.jsx)(footerLink_1.default, { href: url, text: text }) }, index));
|
|
78
75
|
}), downMd && (0, jsx_runtime_1.jsx)(divider_1.Divider, { borderColor: "sandstone.main", mb: 0.5, mt: 1, w: 1 }), (0, jsx_runtime_1.jsx)(footerSlimColumn_1.default, { centerV: true, children: (0, jsx_runtime_1.jsxs)(t_1.T, { size: "xs", children: [(0, jsx_runtime_1.jsx)(t_1.T, { weight: "demi", children: "Veracity by DNV" }), ", DNV AS"] }) }), (0, jsx_runtime_1.jsx)(footerSlimColumn_1.default, { children: (0, jsx_runtime_1.jsx)(link_1.Link, Object.assign({ fontWeight: "demi", href: linkedIn !== null && linkedIn !== void 0 ? linkedIn : footerTrademark_1.defaultLinkedInUrl, iconLeft: (0, jsx_runtime_1.jsx)(link_1.Link.Icon, { mr: 1, name: "cubCircleLinkedIn", radius: "50%", size: "xs" }), isExternal: true, size: { _: 'sm', md: 'md' } }, styles.link, { children: (0, jsx_runtime_1.jsx)(footerHeading_1.default, { fontSize: "16px", mb: 0, text: "Follow us" }) })) })] }) })), !isApplication && !isSlim && ((0, jsx_runtime_1.jsxs)(footerContent_1.default, { children: [children !== null && children !== void 0 ? children : (columns && ((0, jsx_runtime_1.jsx)(footerRow_1.default, { children: columns.map((sections, index) => ((0, jsx_runtime_1.jsx)(footerColumn_1.default, { sections: sections }, index))) }))), children || columns ? (0, jsx_runtime_1.jsx)(divider_1.Divider, { borderColor: "sandstone.main", my: 4 }) : null, (0, jsx_runtime_1.jsx)(footerRow_1.default, { children: (0, jsx_runtime_1.jsx)(footerTrademark_1.FooterTrademark, { linkedIn: linkedIn }) })] }))] })) }));
|
|
79
76
|
});
|
|
80
77
|
exports.Footer.Column = footerColumn_1.default;
|
|
@@ -22,4 +22,5 @@ export declare const sameYearSameMonth: (a?: Date, b?: Date) => boolean;
|
|
|
22
22
|
export declare const sameYear: (a?: Date, b?: Date) => boolean;
|
|
23
23
|
export declare const sameDate: (a?: Date, b?: Date) => boolean;
|
|
24
24
|
export declare const utcDateToLocale: (utcDate?: Date) => string | undefined;
|
|
25
|
+
export declare const getCurrentYear: () => number;
|
|
25
26
|
//# sourceMappingURL=dates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../../../src/utils/dates.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,WAExD;AAED,mDAAmD;AACnD,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GA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Q1C,CAAA;AAED,eAAO,MAAM,eAAe,aAAc,IAAI,uBAI7C,CAAA;AAED,eAAO,MAAM,cAAc,cAG1B,CAAA"}
|
package/dist/cjs/utils/dates.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.utcDateToLocale = exports.sameDate = exports.sameYear = exports.sameYearSameMonth = exports.generateDateByUTCValue = exports.getDateUTCValue = exports.validateDateFormat = exports.parseIsoDate = exports.formatIsoDate = exports.isValidDate = void 0;
|
|
3
|
+
exports.getCurrentYear = exports.utcDateToLocale = exports.sameDate = exports.sameYear = exports.sameYearSameMonth = exports.generateDateByUTCValue = exports.getDateUTCValue = exports.validateDateFormat = exports.parseIsoDate = exports.formatIsoDate = exports.isValidDate = void 0;
|
|
4
4
|
/** Checks if the provided value is a valid date */
|
|
5
5
|
function isValidDate(value) {
|
|
6
6
|
return `${new Date(value)}` !== 'Invalid Date';
|
|
@@ -76,3 +76,8 @@ const utcDateToLocale = (utcDate) => {
|
|
|
76
76
|
return localDateSameDay.toLocaleDateString();
|
|
77
77
|
};
|
|
78
78
|
exports.utcDateToLocale = utcDateToLocale;
|
|
79
|
+
const getCurrentYear = () => {
|
|
80
|
+
const currentDate = new Date();
|
|
81
|
+
return currentDate.getFullYear();
|
|
82
|
+
};
|
|
83
|
+
exports.getCurrentYear = getCurrentYear;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../src/footer/footer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAwC,YAAY,EAAE,MAAM,SAAS,CAAA;AAO5E,OAAO,EAAkB,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,UAAU,MAAM,cAAc,CAAA;AACrC,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAK3C,eAAO,MAAM,UAAU,+HAItB,CAAA;
|
|
1
|
+
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../src/footer/footer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAwC,YAAY,EAAE,MAAM,SAAS,CAAA;AAO5E,OAAO,EAAkB,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5D,OAAO,YAAY,MAAM,gBAAgB,CAAA;AACzC,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAC3C,OAAO,UAAU,MAAM,cAAc,CAAA;AACrC,OAAO,SAAS,MAAM,aAAa,CAAA;AACnC,OAAO,aAAa,MAAM,iBAAiB,CAAA;AAK3C,eAAO,MAAM,UAAU,+HAItB,CAAA;AAKD,oGAAoG;AACpG,eAAO,MAAM,MAAM;YAoNT,mBAAmB;aAClB,oBAAoB;aACpB,oBAAoB;UACvB,iBAAiB;SAClB,gBAAgB;aACZ,oBAAoB;CAC9B,CAAA;AAUD,eAAe,MAAM,CAAA"}
|
|
@@ -5,7 +5,7 @@ import { Divider } from '../divider';
|
|
|
5
5
|
import { Link } from '../link';
|
|
6
6
|
import Menu from '../menu';
|
|
7
7
|
import { T } from '../t';
|
|
8
|
-
import { cs } from '../utils';
|
|
8
|
+
import { cs, getCurrentYear } from '../utils';
|
|
9
9
|
import { FooterProvider } from './context';
|
|
10
10
|
import FooterColumn from './footerColumn';
|
|
11
11
|
import FooterContent from './footerContent';
|
|
@@ -22,16 +22,14 @@ export const FooterBase = styled.divBox `
|
|
|
22
22
|
padding: 5 3;
|
|
23
23
|
`;
|
|
24
24
|
/*@formatter:on*/
|
|
25
|
+
const currentYear = getCurrentYear();
|
|
25
26
|
/** Branded Veracity Footer with trademark and links sections. Controls max-width of the content. */
|
|
26
27
|
export const Footer = vui((props, ref) => {
|
|
27
28
|
const { applicationLinks, applicationSocialLinks = [], applicationStaticItems = [], children, className, columns, isApplication = false, isDNV = false, linkedIn, size, variant, isSlim, ...rest } = props;
|
|
28
29
|
const context = { size, variant };
|
|
29
30
|
const styles = useStyleConfig('Footer', props);
|
|
30
|
-
if (isApplication)
|
|
31
|
-
|
|
32
|
-
console.error('Footer: isApplication is true but applicationLinks is not set.');
|
|
33
|
-
}
|
|
34
|
-
}
|
|
31
|
+
if (isApplication && !applicationLinks)
|
|
32
|
+
console.error('Footer: isApplication is true but applicationLinks not set.');
|
|
35
33
|
const slimLinks = [
|
|
36
34
|
{
|
|
37
35
|
id: 'home',
|
|
@@ -44,19 +42,18 @@ export const Footer = vui((props, ref) => {
|
|
|
44
42
|
section.links?.map(link => {
|
|
45
43
|
if (!link)
|
|
46
44
|
return;
|
|
47
|
-
if (['home', 'support', 'status'].includes(link.id || ''))
|
|
45
|
+
if (['home', 'support', 'status'].includes(link.id || ''))
|
|
48
46
|
slimLinks.push(link);
|
|
49
|
-
}
|
|
50
47
|
});
|
|
51
48
|
});
|
|
52
49
|
});
|
|
53
50
|
const downMd = useDown('md');
|
|
54
51
|
const downLg = useDown('lg');
|
|
55
|
-
return (_jsx(FooterProvider, { value: context, children: _jsxs(FooterBase, { className: cs('vui-footer', isApplication ? 'vui-footer-app' : '', className), px: isApplication ? '40px' : 3, py: isSlim ? (downMd ? '16px' : '9px') : 5, role: "contentinfo", ...styles.container, ref: ref, ...rest, children: [isApplication && (_jsx(FooterContent, { alignContent: "center", alignItems: "center", maxW: "100%", children: _jsxs(FooterRow, { alignContent: "space-between", w: 1, children: [_jsx(Box, { alignItems: "self-start", columnGap: 3, flex: { xs: '0 0 100%', sm: '0 0 100%', md: '0 0 100%', lg: '0 0 50%' }, py: { xs: 1, sm: 1, md: 1.25, lg: 1.5 }, wrap: true, children: applicationLinks?.map((link, index) => (_jsxs(Box, { flex: { xs: '0 0 50%', sm: '0 0 auto' }, children: [link.items && (_jsxs(Menu, { isLazy: false, offset: [-16, 9], placement: "top-start", size: "lg", ...rest, children: [_jsx(Menu.Button, { as: Link, className: "vui-footerLink-trigger", pt: "3px", role: "button", text: link.text, title: link.text, ...styles.link, ...rest }), _jsx(Menu.List, { maxH: 400, right: 0, w: 320, ...styles.list, children: link.items.map(({ text, url }, index) => (_jsx(Menu.Item, { isTruncated: true, linkProps: { href: url }, text: text, title: text, ...styles.item }, index))) })] })), !link.items && _jsx(FooterLink, { ...link, href: link.url })] }, index))) }), downLg && _jsx(Divider, { borderColor: "sandstone.main", mb: 0.5, mt: 1, w: 1 }), _jsxs(Box, { centerV: true, columnGap: 3, flex: { xs: '0 0 100%', sm: '0 0 100%', md: '0 0 100%', lg: '0 0 50%' }, justifyContent: { sm: 'center', lg: 'flex-end' }, py: { xs: 1, sm: 1, md: 1.25, lg: 1.5 }, wrap: true, children: [applicationStaticItems?.map((text, index) => (_jsx(Box, { children: _jsx(T, { size: "sm", children: text }) }, index))), isDNV ? (_jsx(Box, { children:
|
|
52
|
+
return (_jsx(FooterProvider, { value: context, children: _jsxs(FooterBase, { className: cs('vui-footer', isApplication ? 'vui-footer-app' : '', className), px: isApplication ? '40px' : 3, py: isSlim ? (downMd ? '16px' : '9px') : 5, role: "contentinfo", ...styles.container, ref: ref, ...rest, children: [isApplication && (_jsx(FooterContent, { alignContent: "center", alignItems: "center", maxW: "100%", children: _jsxs(FooterRow, { alignContent: "space-between", w: 1, children: [_jsx(Box, { alignItems: "self-start", columnGap: 3, flex: { xs: '0 0 100%', sm: '0 0 100%', md: '0 0 100%', lg: '0 0 50%' }, py: { xs: 1, sm: 1, md: 1.25, lg: 1.5 }, wrap: true, children: applicationLinks?.map((link, index) => (_jsxs(Box, { flex: { xs: '0 0 50%', sm: '0 0 auto' }, children: [link.items && (_jsxs(Menu, { isLazy: false, offset: [-16, 9], placement: "top-start", size: "lg", ...rest, children: [_jsx(Menu.Button, { as: Link, className: "vui-footerLink-trigger", pt: "3px", role: "button", text: link.text, title: link.text, ...styles.link, ...rest }), _jsx(Menu.List, { maxH: 400, right: 0, w: 320, ...styles.list, children: link.items.map(({ text, url }, index) => (_jsx(Menu.Item, { isTruncated: true, linkProps: { href: url }, text: text, title: text, ...styles.item }, index))) })] })), !link.items && _jsx(FooterLink, { ...link, href: link.url })] }, index))) }), downLg && _jsx(Divider, { borderColor: "sandstone.main", mb: 0.5, mt: 1, w: 1 }), _jsxs(Box, { centerV: true, columnGap: 3, flex: { xs: '0 0 100%', sm: '0 0 100%', md: '0 0 100%', lg: '0 0 50%' }, justifyContent: { sm: 'center', lg: 'flex-end' }, py: { xs: 1, sm: 1, md: 1.25, lg: 1.5 }, wrap: true, children: [applicationStaticItems?.map((text, index) => (_jsx(Box, { children: _jsx(T, { size: "sm", children: text }) }, index))), isDNV ? (_jsx(Box, { children: _jsxs(T, { size: "sm", children: ["\u00A9 DNV AS ", currentYear] }) })) : (_jsx(Box, { children: _jsxs(T, { size: "sm", children: [_jsx(T, { weight: "demi", children: "Veracity by DNV" }), ", DNV AS"] }) })), _jsxs(Box, { children: [applicationSocialLinks?.map((link, index) => (_jsx(Link, { "aria-label": link.text, fontWeight: "demi", href: link.url, iconLeft: _jsx(Link.Icon, { name: `cubCircle${link.text}`, radius: "50%", size: "xs" }), isExternal: true, mr: 1, size: { _: 'sm', md: 'md' }, ...styles.link }, index))), _jsx(Link, { fontWeight: "demi", href: linkedIn ?? defaultLinkedInUrl, isExternal: true, size: { _: 'sm', md: 'md' }, ...styles.link, children: _jsx(FooterHeading, { fontSize: "16px", mb: 0, text: "Follow us" }) })] })] })] }) })), !isApplication && isSlim && (_jsx(FooterContent, { alignContent: "center", alignItems: "center", maxW: { xs: 343, sm: 305, md: 720, lg: 975 }, children: _jsxs(FooterRow, { children: [slimLinks.map(({ text, url, id }, index) => {
|
|
56
53
|
/** if the screen is small drop one specific link */
|
|
57
|
-
if (downLg &&
|
|
54
|
+
if (downLg && id === 'support')
|
|
58
55
|
return;
|
|
59
|
-
return (_jsx(FooterSlimColumn, { children: _jsx(FooterLink, {
|
|
56
|
+
return (_jsx(FooterSlimColumn, { children: _jsx(FooterLink, { href: url, text: text }) }, index));
|
|
60
57
|
}), downMd && _jsx(Divider, { borderColor: "sandstone.main", mb: 0.5, mt: 1, w: 1 }), _jsx(FooterSlimColumn, { centerV: true, children: _jsxs(T, { size: "xs", children: [_jsx(T, { weight: "demi", children: "Veracity by DNV" }), ", DNV AS"] }) }), _jsx(FooterSlimColumn, { children: _jsx(Link, { fontWeight: "demi", href: linkedIn ?? defaultLinkedInUrl, iconLeft: _jsx(Link.Icon, { mr: 1, name: "cubCircleLinkedIn", radius: "50%", size: "xs" }), isExternal: true, size: { _: 'sm', md: 'md' }, ...styles.link, children: _jsx(FooterHeading, { fontSize: "16px", mb: 0, text: "Follow us" }) }) })] }) })), !isApplication && !isSlim && (_jsxs(FooterContent, { children: [children ??
|
|
61
58
|
(columns && (_jsx(FooterRow, { children: columns.map((sections, index) => (_jsx(FooterColumn, { sections: sections }, index))) }))), children || columns ? _jsx(Divider, { borderColor: "sandstone.main", my: 4 }) : null, _jsx(FooterRow, { children: _jsx(FooterTrademark, { linkedIn: linkedIn }) })] }))] }) }));
|
|
62
59
|
});
|
|
@@ -22,4 +22,5 @@ export declare const sameYearSameMonth: (a?: Date, b?: Date) => boolean;
|
|
|
22
22
|
export declare const sameYear: (a?: Date, b?: Date) => boolean;
|
|
23
23
|
export declare const sameDate: (a?: Date, b?: Date) => boolean;
|
|
24
24
|
export declare const utcDateToLocale: (utcDate?: Date) => string | undefined;
|
|
25
|
+
export declare const getCurrentYear: () => number;
|
|
25
26
|
//# sourceMappingURL=dates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dates.d.ts","sourceRoot":"","sources":["../../../src/utils/dates.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,wBAAgB,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,WAExD;AAED,mDAAmD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C,CAAA;AAED,eAAO,MAAM,QAAQ,OAAQ,IAAI,MAAM,IAAI,YAQ1C,CAAA;AAED,eAAO,MAAM,eAAe,aAAc,IAAI,uBAI7C,CAAA;AAED,eAAO,MAAM,cAAc,cAG1B,CAAA"}
|
package/dist/esm/utils/dates.js
CHANGED
|
@@ -63,3 +63,7 @@ export const utcDateToLocale = (utcDate) => {
|
|
|
63
63
|
const localDateSameDay = new Date(utcDate.getUTCFullYear(), utcDate.getUTCMonth(), utcDate.getUTCDate());
|
|
64
64
|
return localDateSameDay.toLocaleDateString();
|
|
65
65
|
};
|
|
66
|
+
export const getCurrentYear = () => {
|
|
67
|
+
const currentDate = new Date();
|
|
68
|
+
return currentDate.getFullYear();
|
|
69
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veracity/vui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0-beta.0",
|
|
4
4
|
"description": "Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
package/src/footer/footer.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { Divider } from '../divider'
|
|
|
6
6
|
import { Link } from '../link'
|
|
7
7
|
import Menu from '../menu'
|
|
8
8
|
import { T } from '../t'
|
|
9
|
-
import { cs } from '../utils'
|
|
9
|
+
import { cs, getCurrentYear } from '../utils'
|
|
10
10
|
import { FooterProvider } from './context'
|
|
11
11
|
import { FooterLinkData, FooterProps } from './footer.types'
|
|
12
12
|
import FooterColumn from './footerColumn'
|
|
@@ -26,6 +26,8 @@ export const FooterBase = styled.divBox`
|
|
|
26
26
|
`
|
|
27
27
|
/*@formatter:on*/
|
|
28
28
|
|
|
29
|
+
const currentYear = getCurrentYear()
|
|
30
|
+
|
|
29
31
|
/** Branded Veracity Footer with trademark and links sections. Controls max-width of the content. */
|
|
30
32
|
export const Footer = vui<'div', FooterProps>((props, ref) => {
|
|
31
33
|
const {
|
|
@@ -48,11 +50,7 @@ export const Footer = vui<'div', FooterProps>((props, ref) => {
|
|
|
48
50
|
|
|
49
51
|
const styles = useStyleConfig('Footer', props)
|
|
50
52
|
|
|
51
|
-
if (isApplication)
|
|
52
|
-
if (!applicationLinks) {
|
|
53
|
-
console.error('Footer: isApplication is true but applicationLinks is not set.')
|
|
54
|
-
}
|
|
55
|
-
}
|
|
53
|
+
if (isApplication && !applicationLinks) console.error('Footer: isApplication is true but applicationLinks not set.')
|
|
56
54
|
|
|
57
55
|
const slimLinks: FooterLinkData[] = [
|
|
58
56
|
{
|
|
@@ -66,10 +64,7 @@ export const Footer = vui<'div', FooterProps>((props, ref) => {
|
|
|
66
64
|
column.map(section => {
|
|
67
65
|
section.links?.map(link => {
|
|
68
66
|
if (!link) return
|
|
69
|
-
|
|
70
|
-
if (['home', 'support', 'status'].includes(link.id || '')) {
|
|
71
|
-
slimLinks.push(link)
|
|
72
|
-
}
|
|
67
|
+
if (['home', 'support', 'status'].includes(link.id || '')) slimLinks.push(link)
|
|
73
68
|
})
|
|
74
69
|
})
|
|
75
70
|
})
|
|
@@ -149,7 +144,7 @@ export const Footer = vui<'div', FooterProps>((props, ref) => {
|
|
|
149
144
|
|
|
150
145
|
{isDNV ? (
|
|
151
146
|
<Box>
|
|
152
|
-
<T size="sm">© DNV AS
|
|
147
|
+
<T size="sm">© DNV AS {currentYear}</T>
|
|
153
148
|
</Box>
|
|
154
149
|
) : (
|
|
155
150
|
<Box>
|
|
@@ -190,13 +185,13 @@ export const Footer = vui<'div', FooterProps>((props, ref) => {
|
|
|
190
185
|
{!isApplication && isSlim && (
|
|
191
186
|
<FooterContent alignContent="center" alignItems="center" maxW={{ xs: 343, sm: 305, md: 720, lg: 975 }}>
|
|
192
187
|
<FooterRow>
|
|
193
|
-
{slimLinks.map((
|
|
188
|
+
{slimLinks.map(({ text, url, id }, index) => {
|
|
194
189
|
/** if the screen is small drop one specific link */
|
|
195
|
-
if (downLg &&
|
|
190
|
+
if (downLg && id === 'support') return
|
|
196
191
|
|
|
197
192
|
return (
|
|
198
193
|
<FooterSlimColumn key={index}>
|
|
199
|
-
<FooterLink {
|
|
194
|
+
<FooterLink href={url} text={text} />
|
|
200
195
|
</FooterSlimColumn>
|
|
201
196
|
)
|
|
202
197
|
})}
|
package/src/utils/dates.ts
CHANGED
|
@@ -72,3 +72,8 @@ export const utcDateToLocale = (utcDate?: Date) => {
|
|
|
72
72
|
const localDateSameDay = new Date(utcDate.getUTCFullYear(), utcDate.getUTCMonth(), utcDate.getUTCDate())
|
|
73
73
|
return localDateSameDay.toLocaleDateString()
|
|
74
74
|
}
|
|
75
|
+
|
|
76
|
+
export const getCurrentYear = () => {
|
|
77
|
+
const currentDate = new Date()
|
|
78
|
+
return currentDate.getFullYear()
|
|
79
|
+
}
|