@xyo-network/react-footer 2.64.0-rc.6 → 2.64.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/browser/AlwaysLinks.cjs +64 -0
- package/dist/browser/AlwaysLinks.cjs.map +1 -0
- package/dist/browser/AlwaysLinks.d.cts +9 -0
- package/dist/browser/AlwaysLinks.d.cts.map +1 -0
- package/dist/browser/Footer.cjs +94 -0
- package/dist/browser/Footer.cjs.map +1 -0
- package/dist/browser/Footer.d.cts +11 -0
- package/dist/browser/Footer.d.cts.map +1 -0
- package/dist/browser/Link.cjs +53 -0
- package/dist/{node/Link.mjs.map → browser/Link.cjs.map} +1 -1
- package/dist/browser/Link.d.cts +4 -0
- package/dist/browser/Link.d.cts.map +1 -0
- package/dist/browser/Links.cjs +35 -0
- package/dist/{node/Links.mjs.map → browser/Links.cjs.map} +1 -1
- package/dist/browser/Links.d.cts +4 -0
- package/dist/browser/Links.d.cts.map +1 -0
- package/dist/browser/Xyo/AlwaysLinks.cjs +104 -0
- package/dist/browser/Xyo/AlwaysLinks.cjs.map +1 -0
- package/dist/browser/Xyo/AlwaysLinks.d.cts +11 -0
- package/dist/browser/Xyo/AlwaysLinks.d.cts.map +1 -0
- package/dist/browser/Xyo/DeveloperLinks.cjs +76 -0
- package/dist/browser/Xyo/DeveloperLinks.cjs.map +1 -0
- package/dist/browser/Xyo/DeveloperLinks.d.cts +4 -0
- package/dist/browser/Xyo/DeveloperLinks.d.cts.map +1 -0
- package/dist/browser/Xyo/Footer.cjs +213 -0
- package/dist/browser/Xyo/Footer.cjs.map +1 -0
- package/dist/browser/Xyo/Footer.d.cts +4 -0
- package/dist/browser/Xyo/Footer.d.cts.map +1 -0
- package/dist/browser/Xyo/MoreLinks.cjs +74 -0
- package/dist/browser/Xyo/MoreLinks.cjs.map +1 -0
- package/dist/browser/Xyo/MoreLinks.d.cts +4 -0
- package/dist/browser/Xyo/MoreLinks.d.cts.map +1 -0
- package/dist/browser/Xyo/NetworkLinks.cjs +75 -0
- package/dist/browser/Xyo/NetworkLinks.cjs.map +1 -0
- package/dist/browser/Xyo/NetworkLinks.d.cts +4 -0
- package/dist/browser/Xyo/NetworkLinks.d.cts.map +1 -0
- package/dist/browser/Xyo/SocialLinks.cjs +84 -0
- package/dist/browser/Xyo/SocialLinks.cjs.map +1 -0
- package/dist/browser/Xyo/SocialLinks.d.cts +4 -0
- package/dist/browser/Xyo/SocialLinks.d.cts.map +1 -0
- package/dist/browser/Xyo/SocialLinks.d.mts.map +1 -1
- package/dist/browser/Xyo/SocialLinks.d.ts.map +1 -1
- package/dist/browser/Xyo/SocialLinks.js.map +1 -1
- package/dist/browser/Xyo/SupportLinks.cjs +73 -0
- package/dist/browser/Xyo/SupportLinks.cjs.map +1 -0
- package/dist/browser/Xyo/SupportLinks.d.cts +4 -0
- package/dist/browser/Xyo/SupportLinks.d.cts.map +1 -0
- package/dist/browser/Xyo/TokenLinks.cjs +76 -0
- package/dist/browser/Xyo/TokenLinks.cjs.map +1 -0
- package/dist/browser/Xyo/TokenLinks.d.cts +4 -0
- package/dist/browser/Xyo/TokenLinks.d.cts.map +1 -0
- package/dist/browser/Xyo/index.cjs +253 -0
- package/dist/browser/Xyo/index.cjs.map +1 -0
- package/dist/browser/Xyo/index.d.cts +9 -0
- package/dist/browser/Xyo/index.d.cts.map +1 -0
- package/dist/browser/index.cjs +258 -0
- package/dist/browser/index.cjs.map +1 -0
- package/dist/browser/index.d.cts +7 -0
- package/dist/browser/index.d.cts.map +1 -0
- package/dist/browser/lib/copyrightLinkTitle.cjs +29 -0
- package/dist/{node/lib/copyrightLinkTitle.mjs.map → browser/lib/copyrightLinkTitle.cjs.map} +1 -1
- package/dist/browser/lib/copyrightLinkTitle.d.cts +2 -0
- package/dist/browser/lib/copyrightLinkTitle.d.cts.map +1 -0
- package/dist/browser/lib/index.cjs +31 -0
- package/dist/browser/lib/index.cjs.map +1 -0
- package/dist/browser/lib/index.d.cts +2 -0
- package/dist/browser/lib/index.d.cts.map +1 -0
- package/dist/docs.json +71093 -0
- package/dist/node/AlwaysLinks.cjs +68 -0
- package/dist/node/AlwaysLinks.cjs.map +1 -0
- package/dist/node/AlwaysLinks.d.cts +9 -0
- package/dist/node/AlwaysLinks.d.cts.map +1 -0
- package/dist/node/AlwaysLinks.js +37 -30
- package/dist/node/AlwaysLinks.js.map +1 -1
- package/dist/node/Footer.cjs +98 -0
- package/dist/node/Footer.cjs.map +1 -0
- package/dist/node/Footer.d.cts +11 -0
- package/dist/node/Footer.d.cts.map +1 -0
- package/dist/node/Footer.js +54 -36
- package/dist/node/Footer.js.map +1 -1
- package/dist/node/Link.cjs +57 -0
- package/dist/node/Link.cjs.map +1 -0
- package/dist/node/Link.d.cts +4 -0
- package/dist/node/Link.d.cts.map +1 -0
- package/dist/node/Link.js +12 -35
- package/dist/node/Link.js.map +1 -1
- package/dist/node/Links.cjs +39 -0
- package/dist/node/Links.cjs.map +1 -0
- package/dist/node/Links.d.cts +4 -0
- package/dist/node/Links.d.cts.map +1 -0
- package/dist/node/Links.js +9 -32
- package/dist/node/Links.js.map +1 -1
- package/dist/node/Xyo/AlwaysLinks.cjs +109 -0
- package/dist/node/Xyo/AlwaysLinks.cjs.map +1 -0
- package/dist/node/Xyo/AlwaysLinks.d.cts +11 -0
- package/dist/node/Xyo/AlwaysLinks.d.cts.map +1 -0
- package/dist/node/Xyo/AlwaysLinks.js +50 -31
- package/dist/node/Xyo/AlwaysLinks.js.map +1 -1
- package/dist/node/Xyo/DeveloperLinks.cjs +80 -0
- package/dist/node/Xyo/DeveloperLinks.cjs.map +1 -0
- package/dist/node/Xyo/DeveloperLinks.d.cts +4 -0
- package/dist/node/Xyo/DeveloperLinks.d.cts.map +1 -0
- package/dist/node/Xyo/DeveloperLinks.js +47 -32
- package/dist/node/Xyo/DeveloperLinks.js.map +1 -1
- package/dist/node/Xyo/Footer.cjs +217 -0
- package/dist/node/Xyo/Footer.cjs.map +1 -0
- package/dist/node/Xyo/Footer.d.cts +4 -0
- package/dist/node/Xyo/Footer.d.cts.map +1 -0
- package/dist/node/Xyo/Footer.js +162 -43
- package/dist/node/Xyo/Footer.js.map +1 -1
- package/dist/node/Xyo/MoreLinks.cjs +78 -0
- package/dist/node/Xyo/MoreLinks.cjs.map +1 -0
- package/dist/node/Xyo/MoreLinks.d.cts +4 -0
- package/dist/node/Xyo/MoreLinks.d.cts.map +1 -0
- package/dist/node/Xyo/MoreLinks.js +45 -30
- package/dist/node/Xyo/MoreLinks.js.map +1 -1
- package/dist/node/Xyo/NetworkLinks.cjs +79 -0
- package/dist/node/Xyo/NetworkLinks.cjs.map +1 -0
- package/dist/node/Xyo/NetworkLinks.d.cts +4 -0
- package/dist/node/Xyo/NetworkLinks.d.cts.map +1 -0
- package/dist/node/Xyo/NetworkLinks.js +46 -31
- package/dist/node/Xyo/NetworkLinks.js.map +1 -1
- package/dist/node/Xyo/SocialLinks.cjs +88 -0
- package/dist/node/Xyo/SocialLinks.cjs.map +1 -0
- package/dist/node/Xyo/SocialLinks.d.cts +4 -0
- package/dist/node/Xyo/SocialLinks.d.cts.map +1 -0
- package/dist/node/Xyo/SocialLinks.d.mts.map +1 -1
- package/dist/node/Xyo/SocialLinks.d.ts.map +1 -1
- package/dist/node/Xyo/SocialLinks.js +56 -39
- package/dist/node/Xyo/SocialLinks.js.map +1 -1
- package/dist/node/Xyo/SupportLinks.cjs +77 -0
- package/dist/node/Xyo/SupportLinks.cjs.map +1 -0
- package/dist/node/Xyo/SupportLinks.d.cts +4 -0
- package/dist/node/Xyo/SupportLinks.d.cts.map +1 -0
- package/dist/node/Xyo/SupportLinks.js +44 -29
- package/dist/node/Xyo/SupportLinks.js.map +1 -1
- package/dist/node/Xyo/TokenLinks.cjs +80 -0
- package/dist/node/Xyo/TokenLinks.cjs.map +1 -0
- package/dist/node/Xyo/TokenLinks.d.cts +4 -0
- package/dist/node/Xyo/TokenLinks.d.cts.map +1 -0
- package/dist/node/Xyo/TokenLinks.js +47 -32
- package/dist/node/Xyo/TokenLinks.js.map +1 -1
- package/dist/node/Xyo/index.cjs +265 -0
- package/dist/node/Xyo/index.cjs.map +1 -0
- package/dist/node/Xyo/index.d.cts +9 -0
- package/dist/node/Xyo/index.d.cts.map +1 -0
- package/dist/node/Xyo/index.js +228 -35
- package/dist/node/Xyo/index.js.map +1 -1
- package/dist/node/index.cjs +275 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +7 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.js +233 -31
- package/dist/node/index.js.map +1 -1
- package/dist/node/lib/copyrightLinkTitle.cjs +33 -0
- package/dist/node/lib/copyrightLinkTitle.cjs.map +1 -0
- package/dist/node/lib/copyrightLinkTitle.d.cts +2 -0
- package/dist/node/lib/copyrightLinkTitle.d.cts.map +1 -0
- package/dist/node/lib/copyrightLinkTitle.js +4 -27
- package/dist/node/lib/copyrightLinkTitle.js.map +1 -1
- package/dist/node/lib/index.cjs +35 -0
- package/dist/node/lib/index.cjs.map +1 -0
- package/dist/node/lib/index.d.cts +2 -0
- package/dist/node/lib/index.d.cts.map +1 -0
- package/dist/node/lib/index.js +6 -21
- package/dist/node/lib/index.js.map +1 -1
- package/package.json +16 -16
- package/src/Xyo/SocialLinks.tsx +1 -0
- package/dist/browser/Xyo/Footer.stories.js +0 -29
- package/dist/browser/Xyo/Footer.stories.js.map +0 -1
- package/dist/node/AlwaysLinks.mjs +0 -12
- package/dist/node/AlwaysLinks.mjs.map +0 -1
- package/dist/node/Footer.mjs +0 -31
- package/dist/node/Footer.mjs.map +0 -1
- package/dist/node/Link.mjs +0 -31
- package/dist/node/Links.mjs +0 -13
- package/dist/node/Xyo/AlwaysLinks.mjs +0 -37
- package/dist/node/Xyo/AlwaysLinks.mjs.map +0 -1
- package/dist/node/Xyo/DeveloperLinks.mjs +0 -14
- package/dist/node/Xyo/DeveloperLinks.mjs.map +0 -1
- package/dist/node/Xyo/Footer.mjs +0 -49
- package/dist/node/Xyo/Footer.mjs.map +0 -1
- package/dist/node/Xyo/Footer.stories.js +0 -54
- package/dist/node/Xyo/Footer.stories.js.map +0 -1
- package/dist/node/Xyo/Footer.stories.mjs +0 -29
- package/dist/node/Xyo/Footer.stories.mjs.map +0 -1
- package/dist/node/Xyo/MoreLinks.mjs +0 -12
- package/dist/node/Xyo/MoreLinks.mjs.map +0 -1
- package/dist/node/Xyo/NetworkLinks.mjs +0 -13
- package/dist/node/Xyo/NetworkLinks.mjs.map +0 -1
- package/dist/node/Xyo/SocialLinks.mjs +0 -22
- package/dist/node/Xyo/SocialLinks.mjs.map +0 -1
- package/dist/node/Xyo/SupportLinks.mjs +0 -11
- package/dist/node/Xyo/SupportLinks.mjs.map +0 -1
- package/dist/node/Xyo/TokenLinks.mjs +0 -14
- package/dist/node/Xyo/TokenLinks.mjs.map +0 -1
- package/dist/node/Xyo/index.mjs +0 -9
- package/dist/node/Xyo/index.mjs.map +0 -1
- package/dist/node/index.mjs +0 -7
- package/dist/node/index.mjs.map +0 -1
- package/dist/node/lib/copyrightLinkTitle.mjs +0 -7
- package/dist/node/lib/index.mjs +0 -2
- package/dist/node/lib/index.mjs.map +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/AlwaysLinks.tsx
|
|
21
|
+
var AlwaysLinks_exports = {};
|
|
22
|
+
__export(AlwaysLinks_exports, {
|
|
23
|
+
FooterAlwaysLinks: () => FooterAlwaysLinks
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(AlwaysLinks_exports);
|
|
26
|
+
var import_icons_material = require("@mui/icons-material");
|
|
27
|
+
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
28
|
+
|
|
29
|
+
// src/Link.tsx
|
|
30
|
+
var import_assert = require("@xylabs/assert");
|
|
31
|
+
var import_react_link = require("@xylabs/react-link");
|
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
33
|
+
var convertToBetaIfNeeded = (url, currentUrl = new URL(document.location.href)) => {
|
|
34
|
+
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
35
|
+
const currentUrlObj = typeof currentUrl === "string" ? new URL(currentUrl) : currentUrl;
|
|
36
|
+
const currentHostnameParts = currentUrlObj.hostname.split(".");
|
|
37
|
+
const beta = currentHostnameParts.shift() === "beta";
|
|
38
|
+
if (beta) {
|
|
39
|
+
const currentHostnameWithoutBeta = currentHostnameParts.join(".");
|
|
40
|
+
if (currentHostnameWithoutBeta === urlObj.hostname) {
|
|
41
|
+
urlObj.hostname = currentUrlObj.hostname;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return urlObj;
|
|
45
|
+
};
|
|
46
|
+
var FooterLink = ({ target, href, margin = 0.5, variant = "body2", ...props }) => {
|
|
47
|
+
const url = new URL((0, import_assert.assertEx)(href, "href not set"));
|
|
48
|
+
(0, import_assert.assertEx)(url.hostname, "Hostname is required in href");
|
|
49
|
+
const convertedUrl = convertToBetaIfNeeded(url);
|
|
50
|
+
if (document.location.hostname === convertedUrl.hostname) {
|
|
51
|
+
const to = url.search.length > 0 ? `${convertedUrl.pathname}${convertedUrl.search}` : url.pathname;
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_link.LinkEx, { margin, to, target, variant, ...props });
|
|
53
|
+
} else {
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_link.LinkEx, { margin, href, target: target ?? "_blank", variant, ...props });
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/AlwaysLinks.tsx
|
|
59
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
60
|
+
var FooterAlwaysLinks = ({ style, footerLinks, onMore, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_flexbox.FlexRow, { flexWrap: "wrap", textTransform: "uppercase", style: { opacity: 0.6, ...style }, ...props, children: [
|
|
61
|
+
footerLinks == null ? void 0 : footerLinks.map((footerLink, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FooterLink, { noWrap: true, paddingX: 1, margin: 0, ...footerLink, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: footerLink.title }) }, index)),
|
|
62
|
+
onMore ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexRow, { style: { cursor: "pointer" }, paddingX: 0.5, onClick: onMore, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.MoreHoriz, { color: "primary", fontSize: "small" }) }) : null
|
|
63
|
+
] });
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
FooterAlwaysLinks
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=AlwaysLinks.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/AlwaysLinks.tsx","../../src/Link.tsx"],"sourcesContent":["import { MoreHoriz as MoreHorizIcon } from '@mui/icons-material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { LinkExProps } from '@xylabs/react-link'\n\nimport { FooterLink } from './Link'\n\nexport interface FooterAlwaysLinksProps extends FlexBoxProps {\n footerLinks?: LinkExProps[]\n onMore?: () => void\n}\n\nexport const FooterAlwaysLinks: React.FC<FooterAlwaysLinksProps> = ({ style, footerLinks, onMore, ...props }) => (\n <FlexRow flexWrap=\"wrap\" textTransform=\"uppercase\" style={{ opacity: 0.6, ...style }} {...props}>\n {footerLinks?.map((footerLink, index) => (\n <FooterLink noWrap key={index} paddingX={1} margin={0} {...footerLink}>\n <small>{footerLink.title}</small>\n </FooterLink>\n ))}\n {onMore ? (\n <FlexRow style={{ cursor: 'pointer' }} paddingX={0.5} onClick={onMore}>\n <MoreHorizIcon color=\"primary\" fontSize=\"small\" />\n </FlexRow>\n ) : null}\n </FlexRow>\n)\n","import { assertEx } from '@xylabs/assert'\nimport { LinkEx, LinkExProps } from '@xylabs/react-link'\n\n/**\n * @description\n * FooterLink automatically uses a local To if the link is to the current domain\n * If the link is not local, it defaults to target being _blank\n * In the case of 'beta' domains, it navigates correctly\n */\n\nconst convertToBetaIfNeeded = (url: string | URL, currentUrl = new URL(document.location.href)) => {\n const urlObj = typeof url === 'string' ? new URL(url) : url\n const currentUrlObj = typeof currentUrl === 'string' ? new URL(currentUrl) : currentUrl\n const currentHostnameParts = currentUrlObj.hostname.split('.')\n const beta = currentHostnameParts.shift() === 'beta'\n if (beta) {\n const currentHostnameWithoutBeta = currentHostnameParts.join('.')\n if (currentHostnameWithoutBeta === urlObj.hostname) {\n urlObj.hostname = currentUrlObj.hostname\n }\n }\n return urlObj\n}\n\nexport const FooterLink: React.FC<LinkExProps> = ({ target, href, margin = 0.5, variant = 'body2', ...props }) => {\n const url = new URL(assertEx(href, 'href not set'))\n assertEx(url.hostname, 'Hostname is required in href')\n const convertedUrl = convertToBetaIfNeeded(url)\n if (document.location.hostname === convertedUrl.hostname) {\n const to = url.search.length > 0 ? `${convertedUrl.pathname}${convertedUrl.search}` : url.pathname\n return <LinkEx margin={margin} to={to} target={target} variant={variant} {...props} />\n } else {\n return <LinkEx margin={margin} href={href} target={target ?? '_blank'} variant={variant} {...props} />\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2C;AAC3C,2BAAsC;;;ACDtC,oBAAyB;AACzB,wBAAoC;AA6BzB;AApBX,IAAM,wBAAwB,CAAC,KAAmB,aAAa,IAAI,IAAI,SAAS,SAAS,IAAI,MAAM;AACjG,QAAM,SAAS,OAAO,QAAQ,WAAW,IAAI,IAAI,GAAG,IAAI;AACxD,QAAM,gBAAgB,OAAO,eAAe,WAAW,IAAI,IAAI,UAAU,IAAI;AAC7E,QAAM,uBAAuB,cAAc,SAAS,MAAM,GAAG;AAC7D,QAAM,OAAO,qBAAqB,MAAM,MAAM;AAC9C,MAAI,MAAM;AACR,UAAM,6BAA6B,qBAAqB,KAAK,GAAG;AAChE,QAAI,+BAA+B,OAAO,UAAU;AAClD,aAAO,WAAW,cAAc;AAAA,IAClC;AAAA,EACF;AACA,SAAO;AACT;AAEO,IAAM,aAAoC,CAAC,EAAE,QAAQ,MAAM,SAAS,KAAK,UAAU,SAAS,GAAG,MAAM,MAAM;AAChH,QAAM,MAAM,IAAI,QAAI,wBAAS,MAAM,cAAc,CAAC;AAClD,8BAAS,IAAI,UAAU,8BAA8B;AACrD,QAAM,eAAe,sBAAsB,GAAG;AAC9C,MAAI,SAAS,SAAS,aAAa,aAAa,UAAU;AACxD,UAAM,KAAK,IAAI,OAAO,SAAS,IAAI,GAAG,aAAa,QAAQ,GAAG,aAAa,MAAM,KAAK,IAAI;AAC1F,WAAO,4CAAC,4BAAO,QAAgB,IAAQ,QAAgB,SAAmB,GAAG,OAAO;AAAA,EACtF,OAAO;AACL,WAAO,4CAAC,4BAAO,QAAgB,MAAY,QAAQ,UAAU,UAAU,SAAmB,GAAG,OAAO;AAAA,EACtG;AACF;;;ADtBE,IAAAA,sBAAA;AADK,IAAM,oBAAsD,CAAC,EAAE,OAAO,aAAa,QAAQ,GAAG,MAAM,MACzG,8CAAC,gCAAQ,UAAS,QAAO,eAAc,aAAY,OAAO,EAAE,SAAS,KAAK,GAAG,MAAM,GAAI,GAAG,OACvF;AAAA,6CAAa,IAAI,CAAC,YAAY,UAC7B,6CAAC,cAAW,QAAM,MAAa,UAAU,GAAG,QAAQ,GAAI,GAAG,YACzD,uDAAC,WAAO,qBAAW,OAAM,KADH,KAExB;AAAA,EAED,SACC,6CAAC,gCAAQ,OAAO,EAAE,QAAQ,UAAU,GAAG,UAAU,KAAK,SAAS,QAC7D,uDAAC,sBAAAC,WAAA,EAAc,OAAM,WAAU,UAAS,SAAQ,GAClD,IACE;AAAA,GACN;","names":["import_jsx_runtime","MoreHorizIcon"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FlexBoxProps } from '@xylabs/react-flexbox';
|
|
3
|
+
import { LinkExProps } from '@xylabs/react-link';
|
|
4
|
+
export interface FooterAlwaysLinksProps extends FlexBoxProps {
|
|
5
|
+
footerLinks?: LinkExProps[];
|
|
6
|
+
onMore?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const FooterAlwaysLinks: React.FC<FooterAlwaysLinksProps>;
|
|
9
|
+
//# sourceMappingURL=AlwaysLinks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlwaysLinks.d.ts","sourceRoot":"","sources":["../../src/AlwaysLinks.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAW,MAAM,uBAAuB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIhD,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D,WAAW,CAAC,EAAE,WAAW,EAAE,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;CACpB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAa9D,CAAA"}
|
package/dist/node/AlwaysLinks.js
CHANGED
|
@@ -1,36 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
// src/AlwaysLinks.tsx
|
|
2
|
+
import { MoreHoriz as MoreHorizIcon } from "@mui/icons-material";
|
|
3
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
|
4
|
+
|
|
5
|
+
// src/Link.tsx
|
|
6
|
+
import { assertEx } from "@xylabs/assert";
|
|
7
|
+
import { LinkEx } from "@xylabs/react-link";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var convertToBetaIfNeeded = (url, currentUrl = new URL(document.location.href)) => {
|
|
10
|
+
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
11
|
+
const currentUrlObj = typeof currentUrl === "string" ? new URL(currentUrl) : currentUrl;
|
|
12
|
+
const currentHostnameParts = currentUrlObj.hostname.split(".");
|
|
13
|
+
const beta = currentHostnameParts.shift() === "beta";
|
|
14
|
+
if (beta) {
|
|
15
|
+
const currentHostnameWithoutBeta = currentHostnameParts.join(".");
|
|
16
|
+
if (currentHostnameWithoutBeta === urlObj.hostname) {
|
|
17
|
+
urlObj.hostname = currentUrlObj.hostname;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return urlObj;
|
|
9
21
|
};
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
22
|
+
var FooterLink = ({ target, href, margin = 0.5, variant = "body2", ...props }) => {
|
|
23
|
+
const url = new URL(assertEx(href, "href not set"));
|
|
24
|
+
assertEx(url.hostname, "Hostname is required in href");
|
|
25
|
+
const convertedUrl = convertToBetaIfNeeded(url);
|
|
26
|
+
if (document.location.hostname === convertedUrl.hostname) {
|
|
27
|
+
const to = url.search.length > 0 ? `${convertedUrl.pathname}${convertedUrl.search}` : url.pathname;
|
|
28
|
+
return /* @__PURE__ */ jsx(LinkEx, { margin, to, target, variant, ...props });
|
|
29
|
+
} else {
|
|
30
|
+
return /* @__PURE__ */ jsx(LinkEx, { margin, href, target: target ?? "_blank", variant, ...props });
|
|
15
31
|
}
|
|
16
|
-
return to;
|
|
17
32
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_icons_material = require("@mui/icons-material");
|
|
26
|
-
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
27
|
-
var import_Link = require("./Link");
|
|
28
|
-
const FooterAlwaysLinks = ({ style, footerLinks, onMore, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_flexbox.FlexRow, { flexWrap: "wrap", textTransform: "uppercase", style: { opacity: 0.6, ...style }, ...props, children: [
|
|
29
|
-
footerLinks?.map((footerLink, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Link.FooterLink, { noWrap: true, paddingX: 1, margin: 0, ...footerLink, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: footerLink.title }) }, index)),
|
|
30
|
-
onMore ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_flexbox.FlexRow, { style: { cursor: "pointer" }, paddingX: 0.5, onClick: onMore, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.MoreHoriz, { color: "primary", fontSize: "small" }) }) : null
|
|
33
|
+
|
|
34
|
+
// src/AlwaysLinks.tsx
|
|
35
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
36
|
+
var FooterAlwaysLinks = ({ style, footerLinks, onMore, ...props }) => /* @__PURE__ */ jsxs(FlexRow, { flexWrap: "wrap", textTransform: "uppercase", style: { opacity: 0.6, ...style }, ...props, children: [
|
|
37
|
+
footerLinks == null ? void 0 : footerLinks.map((footerLink, index) => /* @__PURE__ */ jsx2(FooterLink, { noWrap: true, paddingX: 1, margin: 0, ...footerLink, children: /* @__PURE__ */ jsx2("small", { children: footerLink.title }) }, index)),
|
|
38
|
+
onMore ? /* @__PURE__ */ jsx2(FlexRow, { style: { cursor: "pointer" }, paddingX: 0.5, onClick: onMore, children: /* @__PURE__ */ jsx2(MoreHorizIcon, { color: "primary", fontSize: "small" }) }) : null
|
|
31
39
|
] });
|
|
32
|
-
|
|
33
|
-
0 && (module.exports = {
|
|
40
|
+
export {
|
|
34
41
|
FooterAlwaysLinks
|
|
35
|
-
}
|
|
42
|
+
};
|
|
36
43
|
//# sourceMappingURL=AlwaysLinks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/AlwaysLinks.tsx"],"sourcesContent":["import { MoreHoriz as MoreHorizIcon } from '@mui/icons-material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { LinkExProps } from '@xylabs/react-link'\n\nimport { FooterLink } from './Link'\n\nexport interface FooterAlwaysLinksProps extends FlexBoxProps {\n footerLinks?: LinkExProps[]\n onMore?: () => void\n}\n\nexport const FooterAlwaysLinks: React.FC<FooterAlwaysLinksProps> = ({ style, footerLinks, onMore, ...props }) => (\n <FlexRow flexWrap=\"wrap\" textTransform=\"uppercase\" style={{ opacity: 0.6, ...style }} {...props}>\n {footerLinks?.map((footerLink, index) => (\n <FooterLink noWrap key={index} paddingX={1} margin={0} {...footerLink}>\n <small>{footerLink.title}</small>\n </FooterLink>\n ))}\n {onMore ? (\n <FlexRow style={{ cursor: 'pointer' }} paddingX={0.5} onClick={onMore}>\n <MoreHorizIcon color=\"primary\" fontSize=\"small\" />\n </FlexRow>\n ) : null}\n </FlexRow>\n)\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/AlwaysLinks.tsx","../../src/Link.tsx"],"sourcesContent":["import { MoreHoriz as MoreHorizIcon } from '@mui/icons-material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { LinkExProps } from '@xylabs/react-link'\n\nimport { FooterLink } from './Link'\n\nexport interface FooterAlwaysLinksProps extends FlexBoxProps {\n footerLinks?: LinkExProps[]\n onMore?: () => void\n}\n\nexport const FooterAlwaysLinks: React.FC<FooterAlwaysLinksProps> = ({ style, footerLinks, onMore, ...props }) => (\n <FlexRow flexWrap=\"wrap\" textTransform=\"uppercase\" style={{ opacity: 0.6, ...style }} {...props}>\n {footerLinks?.map((footerLink, index) => (\n <FooterLink noWrap key={index} paddingX={1} margin={0} {...footerLink}>\n <small>{footerLink.title}</small>\n </FooterLink>\n ))}\n {onMore ? (\n <FlexRow style={{ cursor: 'pointer' }} paddingX={0.5} onClick={onMore}>\n <MoreHorizIcon color=\"primary\" fontSize=\"small\" />\n </FlexRow>\n ) : null}\n </FlexRow>\n)\n","import { assertEx } from '@xylabs/assert'\nimport { LinkEx, LinkExProps } from '@xylabs/react-link'\n\n/**\n * @description\n * FooterLink automatically uses a local To if the link is to the current domain\n * If the link is not local, it defaults to target being _blank\n * In the case of 'beta' domains, it navigates correctly\n */\n\nconst convertToBetaIfNeeded = (url: string | URL, currentUrl = new URL(document.location.href)) => {\n const urlObj = typeof url === 'string' ? new URL(url) : url\n const currentUrlObj = typeof currentUrl === 'string' ? new URL(currentUrl) : currentUrl\n const currentHostnameParts = currentUrlObj.hostname.split('.')\n const beta = currentHostnameParts.shift() === 'beta'\n if (beta) {\n const currentHostnameWithoutBeta = currentHostnameParts.join('.')\n if (currentHostnameWithoutBeta === urlObj.hostname) {\n urlObj.hostname = currentUrlObj.hostname\n }\n }\n return urlObj\n}\n\nexport const FooterLink: React.FC<LinkExProps> = ({ target, href, margin = 0.5, variant = 'body2', ...props }) => {\n const url = new URL(assertEx(href, 'href not set'))\n assertEx(url.hostname, 'Hostname is required in href')\n const convertedUrl = convertToBetaIfNeeded(url)\n if (document.location.hostname === convertedUrl.hostname) {\n const to = url.search.length > 0 ? `${convertedUrl.pathname}${convertedUrl.search}` : url.pathname\n return <LinkEx margin={margin} to={to} target={target} variant={variant} {...props} />\n } else {\n return <LinkEx margin={margin} href={href} target={target ?? '_blank'} variant={variant} {...props} />\n }\n}\n"],"mappings":";AAAA,SAAS,aAAa,qBAAqB;AAC3C,SAAuB,eAAe;;;ACDtC,SAAS,gBAAgB;AACzB,SAAS,cAA2B;AA6BzB;AApBX,IAAM,wBAAwB,CAAC,KAAmB,aAAa,IAAI,IAAI,SAAS,SAAS,IAAI,MAAM;AACjG,QAAM,SAAS,OAAO,QAAQ,WAAW,IAAI,IAAI,GAAG,IAAI;AACxD,QAAM,gBAAgB,OAAO,eAAe,WAAW,IAAI,IAAI,UAAU,IAAI;AAC7E,QAAM,uBAAuB,cAAc,SAAS,MAAM,GAAG;AAC7D,QAAM,OAAO,qBAAqB,MAAM,MAAM;AAC9C,MAAI,MAAM;AACR,UAAM,6BAA6B,qBAAqB,KAAK,GAAG;AAChE,QAAI,+BAA+B,OAAO,UAAU;AAClD,aAAO,WAAW,cAAc;AAAA,IAClC;AAAA,EACF;AACA,SAAO;AACT;AAEO,IAAM,aAAoC,CAAC,EAAE,QAAQ,MAAM,SAAS,KAAK,UAAU,SAAS,GAAG,MAAM,MAAM;AAChH,QAAM,MAAM,IAAI,IAAI,SAAS,MAAM,cAAc,CAAC;AAClD,WAAS,IAAI,UAAU,8BAA8B;AACrD,QAAM,eAAe,sBAAsB,GAAG;AAC9C,MAAI,SAAS,SAAS,aAAa,aAAa,UAAU;AACxD,UAAM,KAAK,IAAI,OAAO,SAAS,IAAI,GAAG,aAAa,QAAQ,GAAG,aAAa,MAAM,KAAK,IAAI;AAC1F,WAAO,oBAAC,UAAO,QAAgB,IAAQ,QAAgB,SAAmB,GAAG,OAAO;AAAA,EACtF,OAAO;AACL,WAAO,oBAAC,UAAO,QAAgB,MAAY,QAAQ,UAAU,UAAU,SAAmB,GAAG,OAAO;AAAA,EACtG;AACF;;;ADtBE,SAGM,OAAAA,MAHN;AADK,IAAM,oBAAsD,CAAC,EAAE,OAAO,aAAa,QAAQ,GAAG,MAAM,MACzG,qBAAC,WAAQ,UAAS,QAAO,eAAc,aAAY,OAAO,EAAE,SAAS,KAAK,GAAG,MAAM,GAAI,GAAG,OACvF;AAAA,6CAAa,IAAI,CAAC,YAAY,UAC7B,gBAAAA,KAAC,cAAW,QAAM,MAAa,UAAU,GAAG,QAAQ,GAAI,GAAG,YACzD,0BAAAA,KAAC,WAAO,qBAAW,OAAM,KADH,KAExB;AAAA,EAED,SACC,gBAAAA,KAAC,WAAQ,OAAO,EAAE,QAAQ,UAAU,GAAG,UAAU,KAAK,SAAS,QAC7D,0BAAAA,KAAC,iBAAc,OAAM,WAAU,UAAS,SAAQ,GAClD,IACE;AAAA,GACN;","names":["jsx"]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/Footer.tsx
|
|
21
|
+
var Footer_exports = {};
|
|
22
|
+
__export(Footer_exports, {
|
|
23
|
+
Footer: () => Footer
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Footer_exports);
|
|
26
|
+
var import_material = require("@mui/material");
|
|
27
|
+
var import_react_flexbox2 = require("@xylabs/react-flexbox");
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
|
|
30
|
+
// src/AlwaysLinks.tsx
|
|
31
|
+
var import_icons_material = require("@mui/icons-material");
|
|
32
|
+
var import_react_flexbox = require("@xylabs/react-flexbox");
|
|
33
|
+
|
|
34
|
+
// src/Link.tsx
|
|
35
|
+
var import_assert = require("@xylabs/assert");
|
|
36
|
+
var import_react_link = require("@xylabs/react-link");
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
var convertToBetaIfNeeded = (url, currentUrl = new URL(document.location.href)) => {
|
|
39
|
+
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
40
|
+
const currentUrlObj = typeof currentUrl === "string" ? new URL(currentUrl) : currentUrl;
|
|
41
|
+
const currentHostnameParts = currentUrlObj.hostname.split(".");
|
|
42
|
+
const beta = currentHostnameParts.shift() === "beta";
|
|
43
|
+
if (beta) {
|
|
44
|
+
const currentHostnameWithoutBeta = currentHostnameParts.join(".");
|
|
45
|
+
if (currentHostnameWithoutBeta === urlObj.hostname) {
|
|
46
|
+
urlObj.hostname = currentUrlObj.hostname;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return urlObj;
|
|
50
|
+
};
|
|
51
|
+
var FooterLink = ({ target, href, margin = 0.5, variant = "body2", ...props }) => {
|
|
52
|
+
const url = new URL((0, import_assert.assertEx)(href, "href not set"));
|
|
53
|
+
(0, import_assert.assertEx)(url.hostname, "Hostname is required in href");
|
|
54
|
+
const convertedUrl = convertToBetaIfNeeded(url);
|
|
55
|
+
if (document.location.hostname === convertedUrl.hostname) {
|
|
56
|
+
const to = url.search.length > 0 ? `${convertedUrl.pathname}${convertedUrl.search}` : url.pathname;
|
|
57
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_link.LinkEx, { margin, to, target, variant, ...props });
|
|
58
|
+
} else {
|
|
59
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_link.LinkEx, { margin, href, target: target ?? "_blank", variant, ...props });
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// src/AlwaysLinks.tsx
|
|
64
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
65
|
+
var FooterAlwaysLinks = ({ style, footerLinks, onMore, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_react_flexbox.FlexRow, { flexWrap: "wrap", textTransform: "uppercase", style: { opacity: 0.6, ...style }, ...props, children: [
|
|
66
|
+
footerLinks == null ? void 0 : footerLinks.map((footerLink, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FooterLink, { noWrap: true, paddingX: 1, margin: 0, ...footerLink, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("small", { children: footerLink.title }) }, index)),
|
|
67
|
+
onMore ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_flexbox.FlexRow, { style: { cursor: "pointer" }, paddingX: 0.5, onClick: onMore, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_icons_material.MoreHoriz, { color: "primary", fontSize: "small" }) }) : null
|
|
68
|
+
] });
|
|
69
|
+
|
|
70
|
+
// src/Footer.tsx
|
|
71
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
72
|
+
var Footer = ({ alwaysFooterLinksProps, children, container, dynamicHeight = false, ...props }) => {
|
|
73
|
+
const [more, setMore] = (0, import_react.useState)(false);
|
|
74
|
+
const onMore = () => {
|
|
75
|
+
setMore(!more);
|
|
76
|
+
};
|
|
77
|
+
const theme = (0, import_material.useTheme)();
|
|
78
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
79
|
+
import_react_flexbox2.FlexCol,
|
|
80
|
+
{
|
|
81
|
+
alignItems: "stretch",
|
|
82
|
+
onMouseLeave: () => {
|
|
83
|
+
setMore(false);
|
|
84
|
+
},
|
|
85
|
+
...props,
|
|
86
|
+
children: [
|
|
87
|
+
more && dynamicHeight ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_flexbox2.FlexCol, { alignItems: "stretch", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_flexbox2.FlexRow, { bottom: -1, position: "absolute", width: "100%", bgcolor: theme.palette.background.default, children: container && container !== "none" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material.Container, { children }) : children }) }) : null,
|
|
88
|
+
!dynamicHeight ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_flexbox2.FlexCol, { alignItems: "stretch", children: container && container !== "none" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material.Container, { children }) : children }) : null,
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_flexbox2.FlexRow, { children: container && container !== "none" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_material.Container, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FooterAlwaysLinks, { ...alwaysFooterLinksProps, onMore: dynamicHeight ? onMore : void 0 }) }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FooterAlwaysLinks, { ...alwaysFooterLinksProps, onMore: dynamicHeight ? onMore : void 0 }) })
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
};
|
|
94
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
95
|
+
0 && (module.exports = {
|
|
96
|
+
Footer
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=Footer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Footer.tsx","../../src/AlwaysLinks.tsx","../../src/Link.tsx"],"sourcesContent":["import { Container, ContainerProps, useTheme } from '@mui/material'\nimport { FlexBoxProps, FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport { useState } from 'react'\n\nimport { FooterAlwaysLinks, FooterAlwaysLinksProps } from './AlwaysLinks'\n\nexport interface FooterProps extends FlexBoxProps {\n alwaysFooterLinksProps?: FooterAlwaysLinksProps\n container?: ContainerProps['maxWidth'] | 'none'\n dynamicHeight?: boolean\n}\n\nexport const Footer: React.FC<FooterProps> = ({ alwaysFooterLinksProps, children, container, dynamicHeight = false, ...props }) => {\n const [more, setMore] = useState(false)\n const onMore = () => {\n setMore(!more)\n }\n\n const theme = useTheme()\n\n return (\n <FlexCol\n alignItems=\"stretch\"\n onMouseLeave={() => {\n setMore(false)\n }}\n {...props}\n >\n {more && dynamicHeight ? (\n <FlexCol alignItems=\"stretch\">\n <FlexRow bottom={-1} position=\"absolute\" width=\"100%\" bgcolor={theme.palette.background.default}>\n {container && container !== 'none' ? <Container>{children}</Container> : children}\n </FlexRow>\n </FlexCol>\n ) : null}\n {!dynamicHeight ? (\n <FlexCol alignItems=\"stretch\">{container && container !== 'none' ? <Container>{children}</Container> : children}</FlexCol>\n ) : null}\n <FlexRow>\n {container && container !== 'none' ? (\n <Container>\n <FooterAlwaysLinks {...alwaysFooterLinksProps} onMore={dynamicHeight ? onMore : undefined} />\n </Container>\n ) : (\n <FooterAlwaysLinks {...alwaysFooterLinksProps} onMore={dynamicHeight ? onMore : undefined} />\n )}\n </FlexRow>\n </FlexCol>\n )\n}\n","import { MoreHoriz as MoreHorizIcon } from '@mui/icons-material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { LinkExProps } from '@xylabs/react-link'\n\nimport { FooterLink } from './Link'\n\nexport interface FooterAlwaysLinksProps extends FlexBoxProps {\n footerLinks?: LinkExProps[]\n onMore?: () => void\n}\n\nexport const FooterAlwaysLinks: React.FC<FooterAlwaysLinksProps> = ({ style, footerLinks, onMore, ...props }) => (\n <FlexRow flexWrap=\"wrap\" textTransform=\"uppercase\" style={{ opacity: 0.6, ...style }} {...props}>\n {footerLinks?.map((footerLink, index) => (\n <FooterLink noWrap key={index} paddingX={1} margin={0} {...footerLink}>\n <small>{footerLink.title}</small>\n </FooterLink>\n ))}\n {onMore ? (\n <FlexRow style={{ cursor: 'pointer' }} paddingX={0.5} onClick={onMore}>\n <MoreHorizIcon color=\"primary\" fontSize=\"small\" />\n </FlexRow>\n ) : null}\n </FlexRow>\n)\n","import { assertEx } from '@xylabs/assert'\nimport { LinkEx, LinkExProps } from '@xylabs/react-link'\n\n/**\n * @description\n * FooterLink automatically uses a local To if the link is to the current domain\n * If the link is not local, it defaults to target being _blank\n * In the case of 'beta' domains, it navigates correctly\n */\n\nconst convertToBetaIfNeeded = (url: string | URL, currentUrl = new URL(document.location.href)) => {\n const urlObj = typeof url === 'string' ? new URL(url) : url\n const currentUrlObj = typeof currentUrl === 'string' ? new URL(currentUrl) : currentUrl\n const currentHostnameParts = currentUrlObj.hostname.split('.')\n const beta = currentHostnameParts.shift() === 'beta'\n if (beta) {\n const currentHostnameWithoutBeta = currentHostnameParts.join('.')\n if (currentHostnameWithoutBeta === urlObj.hostname) {\n urlObj.hostname = currentUrlObj.hostname\n }\n }\n return urlObj\n}\n\nexport const FooterLink: React.FC<LinkExProps> = ({ target, href, margin = 0.5, variant = 'body2', ...props }) => {\n const url = new URL(assertEx(href, 'href not set'))\n assertEx(url.hostname, 'Hostname is required in href')\n const convertedUrl = convertToBetaIfNeeded(url)\n if (document.location.hostname === convertedUrl.hostname) {\n const to = url.search.length > 0 ? `${convertedUrl.pathname}${convertedUrl.search}` : url.pathname\n return <LinkEx margin={margin} to={to} target={target} variant={variant} {...props} />\n } else {\n return <LinkEx margin={margin} href={href} target={target ?? '_blank'} variant={variant} {...props} />\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAoD;AACpD,IAAAA,wBAA+C;AAC/C,mBAAyB;;;ACFzB,4BAA2C;AAC3C,2BAAsC;;;ACDtC,oBAAyB;AACzB,wBAAoC;AA6BzB;AApBX,IAAM,wBAAwB,CAAC,KAAmB,aAAa,IAAI,IAAI,SAAS,SAAS,IAAI,MAAM;AACjG,QAAM,SAAS,OAAO,QAAQ,WAAW,IAAI,IAAI,GAAG,IAAI;AACxD,QAAM,gBAAgB,OAAO,eAAe,WAAW,IAAI,IAAI,UAAU,IAAI;AAC7E,QAAM,uBAAuB,cAAc,SAAS,MAAM,GAAG;AAC7D,QAAM,OAAO,qBAAqB,MAAM,MAAM;AAC9C,MAAI,MAAM;AACR,UAAM,6BAA6B,qBAAqB,KAAK,GAAG;AAChE,QAAI,+BAA+B,OAAO,UAAU;AAClD,aAAO,WAAW,cAAc;AAAA,IAClC;AAAA,EACF;AACA,SAAO;AACT;AAEO,IAAM,aAAoC,CAAC,EAAE,QAAQ,MAAM,SAAS,KAAK,UAAU,SAAS,GAAG,MAAM,MAAM;AAChH,QAAM,MAAM,IAAI,QAAI,wBAAS,MAAM,cAAc,CAAC;AAClD,8BAAS,IAAI,UAAU,8BAA8B;AACrD,QAAM,eAAe,sBAAsB,GAAG;AAC9C,MAAI,SAAS,SAAS,aAAa,aAAa,UAAU;AACxD,UAAM,KAAK,IAAI,OAAO,SAAS,IAAI,GAAG,aAAa,QAAQ,GAAG,aAAa,MAAM,KAAK,IAAI;AAC1F,WAAO,4CAAC,4BAAO,QAAgB,IAAQ,QAAgB,SAAmB,GAAG,OAAO;AAAA,EACtF,OAAO;AACL,WAAO,4CAAC,4BAAO,QAAgB,MAAY,QAAQ,UAAU,UAAU,SAAmB,GAAG,OAAO;AAAA,EACtG;AACF;;;ADtBE,IAAAC,sBAAA;AADK,IAAM,oBAAsD,CAAC,EAAE,OAAO,aAAa,QAAQ,GAAG,MAAM,MACzG,8CAAC,gCAAQ,UAAS,QAAO,eAAc,aAAY,OAAO,EAAE,SAAS,KAAK,GAAG,MAAM,GAAI,GAAG,OACvF;AAAA,6CAAa,IAAI,CAAC,YAAY,UAC7B,6CAAC,cAAW,QAAM,MAAa,UAAU,GAAG,QAAQ,GAAI,GAAG,YACzD,uDAAC,WAAO,qBAAW,OAAM,KADH,KAExB;AAAA,EAED,SACC,6CAAC,gCAAQ,OAAO,EAAE,QAAQ,UAAU,GAAG,UAAU,KAAK,SAAS,QAC7D,uDAAC,sBAAAC,WAAA,EAAc,OAAM,WAAU,UAAS,SAAQ,GAClD,IACE;AAAA,GACN;;;ADFE,IAAAC,sBAAA;AATG,IAAM,SAAgC,CAAC,EAAE,wBAAwB,UAAU,WAAW,gBAAgB,OAAO,GAAG,MAAM,MAAM;AACjI,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAS,KAAK;AACtC,QAAM,SAAS,MAAM;AACnB,YAAQ,CAAC,IAAI;AAAA,EACf;AAEA,QAAM,YAAQ,0BAAS;AAEvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,YAAW;AAAA,MACX,cAAc,MAAM;AAClB,gBAAQ,KAAK;AAAA,MACf;AAAA,MACC,GAAG;AAAA,MAEH;AAAA,gBAAQ,gBACP,6CAAC,iCAAQ,YAAW,WAClB,uDAAC,iCAAQ,QAAQ,IAAI,UAAS,YAAW,OAAM,QAAO,SAAS,MAAM,QAAQ,WAAW,SACrF,uBAAa,cAAc,SAAS,6CAAC,6BAAW,UAAS,IAAe,UAC3E,GACF,IACE;AAAA,QACH,CAAC,gBACA,6CAAC,iCAAQ,YAAW,WAAW,uBAAa,cAAc,SAAS,6CAAC,6BAAW,UAAS,IAAe,UAAS,IAC9G;AAAA,QACJ,6CAAC,iCACE,uBAAa,cAAc,SAC1B,6CAAC,6BACC,uDAAC,qBAAmB,GAAG,wBAAwB,QAAQ,gBAAgB,SAAS,QAAW,GAC7F,IAEA,6CAAC,qBAAmB,GAAG,wBAAwB,QAAQ,gBAAgB,SAAS,QAAW,GAE/F;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["import_react_flexbox","import_jsx_runtime","MoreHorizIcon","import_jsx_runtime"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ContainerProps } from '@mui/material';
|
|
3
|
+
import { FlexBoxProps } from '@xylabs/react-flexbox';
|
|
4
|
+
import { FooterAlwaysLinksProps } from './AlwaysLinks';
|
|
5
|
+
export interface FooterProps extends FlexBoxProps {
|
|
6
|
+
alwaysFooterLinksProps?: FooterAlwaysLinksProps;
|
|
7
|
+
container?: ContainerProps['maxWidth'] | 'none';
|
|
8
|
+
dynamicHeight?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const Footer: React.FC<FooterProps>;
|
|
11
|
+
//# sourceMappingURL=Footer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../src/Footer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAa,cAAc,EAAY,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,YAAY,EAAoB,MAAM,uBAAuB,CAAA;AAGtE,OAAO,EAAqB,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEzE,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,sBAAsB,CAAC,EAAE,sBAAsB,CAAA;IAC/C,SAAS,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,MAAM,CAAA;IAC/C,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAqCxC,CAAA"}
|
package/dist/node/Footer.js
CHANGED
|
@@ -1,39 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
// src/Footer.tsx
|
|
2
|
+
import { Container, useTheme } from "@mui/material";
|
|
3
|
+
import { FlexCol, FlexRow as FlexRow2 } from "@xylabs/react-flexbox";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
|
|
6
|
+
// src/AlwaysLinks.tsx
|
|
7
|
+
import { MoreHoriz as MoreHorizIcon } from "@mui/icons-material";
|
|
8
|
+
import { FlexRow } from "@xylabs/react-flexbox";
|
|
9
|
+
|
|
10
|
+
// src/Link.tsx
|
|
11
|
+
import { assertEx } from "@xylabs/assert";
|
|
12
|
+
import { LinkEx } from "@xylabs/react-link";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
var convertToBetaIfNeeded = (url, currentUrl = new URL(document.location.href)) => {
|
|
15
|
+
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
16
|
+
const currentUrlObj = typeof currentUrl === "string" ? new URL(currentUrl) : currentUrl;
|
|
17
|
+
const currentHostnameParts = currentUrlObj.hostname.split(".");
|
|
18
|
+
const beta = currentHostnameParts.shift() === "beta";
|
|
19
|
+
if (beta) {
|
|
20
|
+
const currentHostnameWithoutBeta = currentHostnameParts.join(".");
|
|
21
|
+
if (currentHostnameWithoutBeta === urlObj.hostname) {
|
|
22
|
+
urlObj.hostname = currentUrlObj.hostname;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return urlObj;
|
|
9
26
|
};
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
27
|
+
var FooterLink = ({ target, href, margin = 0.5, variant = "body2", ...props }) => {
|
|
28
|
+
const url = new URL(assertEx(href, "href not set"));
|
|
29
|
+
assertEx(url.hostname, "Hostname is required in href");
|
|
30
|
+
const convertedUrl = convertToBetaIfNeeded(url);
|
|
31
|
+
if (document.location.hostname === convertedUrl.hostname) {
|
|
32
|
+
const to = url.search.length > 0 ? `${convertedUrl.pathname}${convertedUrl.search}` : url.pathname;
|
|
33
|
+
return /* @__PURE__ */ jsx(LinkEx, { margin, to, target, variant, ...props });
|
|
34
|
+
} else {
|
|
35
|
+
return /* @__PURE__ */ jsx(LinkEx, { margin, href, target: target ?? "_blank", variant, ...props });
|
|
15
36
|
}
|
|
16
|
-
return to;
|
|
17
37
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
const
|
|
30
|
-
const [more, setMore] = (0, import_react.useState)(false);
|
|
38
|
+
|
|
39
|
+
// src/AlwaysLinks.tsx
|
|
40
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
41
|
+
var FooterAlwaysLinks = ({ style, footerLinks, onMore, ...props }) => /* @__PURE__ */ jsxs(FlexRow, { flexWrap: "wrap", textTransform: "uppercase", style: { opacity: 0.6, ...style }, ...props, children: [
|
|
42
|
+
footerLinks == null ? void 0 : footerLinks.map((footerLink, index) => /* @__PURE__ */ jsx2(FooterLink, { noWrap: true, paddingX: 1, margin: 0, ...footerLink, children: /* @__PURE__ */ jsx2("small", { children: footerLink.title }) }, index)),
|
|
43
|
+
onMore ? /* @__PURE__ */ jsx2(FlexRow, { style: { cursor: "pointer" }, paddingX: 0.5, onClick: onMore, children: /* @__PURE__ */ jsx2(MoreHorizIcon, { color: "primary", fontSize: "small" }) }) : null
|
|
44
|
+
] });
|
|
45
|
+
|
|
46
|
+
// src/Footer.tsx
|
|
47
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
48
|
+
var Footer = ({ alwaysFooterLinksProps, children, container, dynamicHeight = false, ...props }) => {
|
|
49
|
+
const [more, setMore] = useState(false);
|
|
31
50
|
const onMore = () => {
|
|
32
51
|
setMore(!more);
|
|
33
52
|
};
|
|
34
|
-
const theme =
|
|
35
|
-
return /* @__PURE__ */ (
|
|
36
|
-
|
|
53
|
+
const theme = useTheme();
|
|
54
|
+
return /* @__PURE__ */ jsxs2(
|
|
55
|
+
FlexCol,
|
|
37
56
|
{
|
|
38
57
|
alignItems: "stretch",
|
|
39
58
|
onMouseLeave: () => {
|
|
@@ -41,15 +60,14 @@ const Footer = ({ alwaysFooterLinksProps, children, container, dynamicHeight = f
|
|
|
41
60
|
},
|
|
42
61
|
...props,
|
|
43
62
|
children: [
|
|
44
|
-
more && dynamicHeight ? /* @__PURE__ */ (
|
|
45
|
-
!dynamicHeight ? /* @__PURE__ */ (
|
|
46
|
-
/* @__PURE__ */ (
|
|
63
|
+
more && dynamicHeight ? /* @__PURE__ */ jsx3(FlexCol, { alignItems: "stretch", children: /* @__PURE__ */ jsx3(FlexRow2, { bottom: -1, position: "absolute", width: "100%", bgcolor: theme.palette.background.default, children: container && container !== "none" ? /* @__PURE__ */ jsx3(Container, { children }) : children }) }) : null,
|
|
64
|
+
!dynamicHeight ? /* @__PURE__ */ jsx3(FlexCol, { alignItems: "stretch", children: container && container !== "none" ? /* @__PURE__ */ jsx3(Container, { children }) : children }) : null,
|
|
65
|
+
/* @__PURE__ */ jsx3(FlexRow2, { children: container && container !== "none" ? /* @__PURE__ */ jsx3(Container, { children: /* @__PURE__ */ jsx3(FooterAlwaysLinks, { ...alwaysFooterLinksProps, onMore: dynamicHeight ? onMore : void 0 }) }) : /* @__PURE__ */ jsx3(FooterAlwaysLinks, { ...alwaysFooterLinksProps, onMore: dynamicHeight ? onMore : void 0 }) })
|
|
47
66
|
]
|
|
48
67
|
}
|
|
49
68
|
);
|
|
50
69
|
};
|
|
51
|
-
|
|
52
|
-
0 && (module.exports = {
|
|
70
|
+
export {
|
|
53
71
|
Footer
|
|
54
|
-
}
|
|
72
|
+
};
|
|
55
73
|
//# sourceMappingURL=Footer.js.map
|
package/dist/node/Footer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Footer.tsx"],"sourcesContent":["import { Container, ContainerProps, useTheme } from '@mui/material'\nimport { FlexBoxProps, FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport { useState } from 'react'\n\nimport { FooterAlwaysLinks, FooterAlwaysLinksProps } from './AlwaysLinks'\n\nexport interface FooterProps extends FlexBoxProps {\n alwaysFooterLinksProps?: FooterAlwaysLinksProps\n container?: ContainerProps['maxWidth'] | 'none'\n dynamicHeight?: boolean\n}\n\nexport const Footer: React.FC<FooterProps> = ({ alwaysFooterLinksProps, children, container, dynamicHeight = false, ...props }) => {\n const [more, setMore] = useState(false)\n const onMore = () => {\n setMore(!more)\n }\n\n const theme = useTheme()\n\n return (\n <FlexCol\n alignItems=\"stretch\"\n onMouseLeave={() => {\n setMore(false)\n }}\n {...props}\n >\n {more && dynamicHeight ? (\n <FlexCol alignItems=\"stretch\">\n <FlexRow bottom={-1} position=\"absolute\" width=\"100%\" bgcolor={theme.palette.background.default}>\n {container && container !== 'none' ? <Container>{children}</Container> : children}\n </FlexRow>\n </FlexCol>\n ) : null}\n {!dynamicHeight ? (\n <FlexCol alignItems=\"stretch\">{container && container !== 'none' ? <Container>{children}</Container> : children}</FlexCol>\n ) : null}\n <FlexRow>\n {container && container !== 'none' ? (\n <Container>\n <FooterAlwaysLinks {...alwaysFooterLinksProps} onMore={dynamicHeight ? onMore : undefined} />\n </Container>\n ) : (\n <FooterAlwaysLinks {...alwaysFooterLinksProps} onMore={dynamicHeight ? onMore : undefined} />\n )}\n </FlexRow>\n </FlexCol>\n )\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/Footer.tsx","../../src/AlwaysLinks.tsx","../../src/Link.tsx"],"sourcesContent":["import { Container, ContainerProps, useTheme } from '@mui/material'\nimport { FlexBoxProps, FlexCol, FlexRow } from '@xylabs/react-flexbox'\nimport { useState } from 'react'\n\nimport { FooterAlwaysLinks, FooterAlwaysLinksProps } from './AlwaysLinks'\n\nexport interface FooterProps extends FlexBoxProps {\n alwaysFooterLinksProps?: FooterAlwaysLinksProps\n container?: ContainerProps['maxWidth'] | 'none'\n dynamicHeight?: boolean\n}\n\nexport const Footer: React.FC<FooterProps> = ({ alwaysFooterLinksProps, children, container, dynamicHeight = false, ...props }) => {\n const [more, setMore] = useState(false)\n const onMore = () => {\n setMore(!more)\n }\n\n const theme = useTheme()\n\n return (\n <FlexCol\n alignItems=\"stretch\"\n onMouseLeave={() => {\n setMore(false)\n }}\n {...props}\n >\n {more && dynamicHeight ? (\n <FlexCol alignItems=\"stretch\">\n <FlexRow bottom={-1} position=\"absolute\" width=\"100%\" bgcolor={theme.palette.background.default}>\n {container && container !== 'none' ? <Container>{children}</Container> : children}\n </FlexRow>\n </FlexCol>\n ) : null}\n {!dynamicHeight ? (\n <FlexCol alignItems=\"stretch\">{container && container !== 'none' ? <Container>{children}</Container> : children}</FlexCol>\n ) : null}\n <FlexRow>\n {container && container !== 'none' ? (\n <Container>\n <FooterAlwaysLinks {...alwaysFooterLinksProps} onMore={dynamicHeight ? onMore : undefined} />\n </Container>\n ) : (\n <FooterAlwaysLinks {...alwaysFooterLinksProps} onMore={dynamicHeight ? onMore : undefined} />\n )}\n </FlexRow>\n </FlexCol>\n )\n}\n","import { MoreHoriz as MoreHorizIcon } from '@mui/icons-material'\nimport { FlexBoxProps, FlexRow } from '@xylabs/react-flexbox'\nimport { LinkExProps } from '@xylabs/react-link'\n\nimport { FooterLink } from './Link'\n\nexport interface FooterAlwaysLinksProps extends FlexBoxProps {\n footerLinks?: LinkExProps[]\n onMore?: () => void\n}\n\nexport const FooterAlwaysLinks: React.FC<FooterAlwaysLinksProps> = ({ style, footerLinks, onMore, ...props }) => (\n <FlexRow flexWrap=\"wrap\" textTransform=\"uppercase\" style={{ opacity: 0.6, ...style }} {...props}>\n {footerLinks?.map((footerLink, index) => (\n <FooterLink noWrap key={index} paddingX={1} margin={0} {...footerLink}>\n <small>{footerLink.title}</small>\n </FooterLink>\n ))}\n {onMore ? (\n <FlexRow style={{ cursor: 'pointer' }} paddingX={0.5} onClick={onMore}>\n <MoreHorizIcon color=\"primary\" fontSize=\"small\" />\n </FlexRow>\n ) : null}\n </FlexRow>\n)\n","import { assertEx } from '@xylabs/assert'\nimport { LinkEx, LinkExProps } from '@xylabs/react-link'\n\n/**\n * @description\n * FooterLink automatically uses a local To if the link is to the current domain\n * If the link is not local, it defaults to target being _blank\n * In the case of 'beta' domains, it navigates correctly\n */\n\nconst convertToBetaIfNeeded = (url: string | URL, currentUrl = new URL(document.location.href)) => {\n const urlObj = typeof url === 'string' ? new URL(url) : url\n const currentUrlObj = typeof currentUrl === 'string' ? new URL(currentUrl) : currentUrl\n const currentHostnameParts = currentUrlObj.hostname.split('.')\n const beta = currentHostnameParts.shift() === 'beta'\n if (beta) {\n const currentHostnameWithoutBeta = currentHostnameParts.join('.')\n if (currentHostnameWithoutBeta === urlObj.hostname) {\n urlObj.hostname = currentUrlObj.hostname\n }\n }\n return urlObj\n}\n\nexport const FooterLink: React.FC<LinkExProps> = ({ target, href, margin = 0.5, variant = 'body2', ...props }) => {\n const url = new URL(assertEx(href, 'href not set'))\n assertEx(url.hostname, 'Hostname is required in href')\n const convertedUrl = convertToBetaIfNeeded(url)\n if (document.location.hostname === convertedUrl.hostname) {\n const to = url.search.length > 0 ? `${convertedUrl.pathname}${convertedUrl.search}` : url.pathname\n return <LinkEx margin={margin} to={to} target={target} variant={variant} {...props} />\n } else {\n return <LinkEx margin={margin} href={href} target={target ?? '_blank'} variant={variant} {...props} />\n }\n}\n"],"mappings":"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","names":["FlexRow","jsx","jsx","jsxs","FlexRow"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/Link.tsx
|
|
21
|
+
var Link_exports = {};
|
|
22
|
+
__export(Link_exports, {
|
|
23
|
+
FooterLink: () => FooterLink
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(Link_exports);
|
|
26
|
+
var import_assert = require("@xylabs/assert");
|
|
27
|
+
var import_react_link = require("@xylabs/react-link");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var convertToBetaIfNeeded = (url, currentUrl = new URL(document.location.href)) => {
|
|
30
|
+
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
31
|
+
const currentUrlObj = typeof currentUrl === "string" ? new URL(currentUrl) : currentUrl;
|
|
32
|
+
const currentHostnameParts = currentUrlObj.hostname.split(".");
|
|
33
|
+
const beta = currentHostnameParts.shift() === "beta";
|
|
34
|
+
if (beta) {
|
|
35
|
+
const currentHostnameWithoutBeta = currentHostnameParts.join(".");
|
|
36
|
+
if (currentHostnameWithoutBeta === urlObj.hostname) {
|
|
37
|
+
urlObj.hostname = currentUrlObj.hostname;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return urlObj;
|
|
41
|
+
};
|
|
42
|
+
var FooterLink = ({ target, href, margin = 0.5, variant = "body2", ...props }) => {
|
|
43
|
+
const url = new URL((0, import_assert.assertEx)(href, "href not set"));
|
|
44
|
+
(0, import_assert.assertEx)(url.hostname, "Hostname is required in href");
|
|
45
|
+
const convertedUrl = convertToBetaIfNeeded(url);
|
|
46
|
+
if (document.location.hostname === convertedUrl.hostname) {
|
|
47
|
+
const to = url.search.length > 0 ? `${convertedUrl.pathname}${convertedUrl.search}` : url.pathname;
|
|
48
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_link.LinkEx, { margin, to, target, variant, ...props });
|
|
49
|
+
} else {
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_link.LinkEx, { margin, href, target: target ?? "_blank", variant, ...props });
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
FooterLink
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=Link.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/Link.tsx"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { LinkEx, LinkExProps } from '@xylabs/react-link'\n\n/**\n * @description\n * FooterLink automatically uses a local To if the link is to the current domain\n * If the link is not local, it defaults to target being _blank\n * In the case of 'beta' domains, it navigates correctly\n */\n\nconst convertToBetaIfNeeded = (url: string | URL, currentUrl = new URL(document.location.href)) => {\n const urlObj = typeof url === 'string' ? new URL(url) : url\n const currentUrlObj = typeof currentUrl === 'string' ? new URL(currentUrl) : currentUrl\n const currentHostnameParts = currentUrlObj.hostname.split('.')\n const beta = currentHostnameParts.shift() === 'beta'\n if (beta) {\n const currentHostnameWithoutBeta = currentHostnameParts.join('.')\n if (currentHostnameWithoutBeta === urlObj.hostname) {\n urlObj.hostname = currentUrlObj.hostname\n }\n }\n return urlObj\n}\n\nexport const FooterLink: React.FC<LinkExProps> = ({ target, href, margin = 0.5, variant = 'body2', ...props }) => {\n const url = new URL(assertEx(href, 'href not set'))\n assertEx(url.hostname, 'Hostname is required in href')\n const convertedUrl = convertToBetaIfNeeded(url)\n if (document.location.hostname === convertedUrl.hostname) {\n const to = url.search.length > 0 ? `${convertedUrl.pathname}${convertedUrl.search}` : url.pathname\n return <LinkEx margin={margin} to={to} target={target} variant={variant} {...props} />\n } else {\n return <LinkEx margin={margin} href={href} target={target ?? '_blank'} variant={variant} {...props} />\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyB;AACzB,wBAAoC;AA6BzB;AApBX,IAAM,wBAAwB,CAAC,KAAmB,aAAa,IAAI,IAAI,SAAS,SAAS,IAAI,MAAM;AACjG,QAAM,SAAS,OAAO,QAAQ,WAAW,IAAI,IAAI,GAAG,IAAI;AACxD,QAAM,gBAAgB,OAAO,eAAe,WAAW,IAAI,IAAI,UAAU,IAAI;AAC7E,QAAM,uBAAuB,cAAc,SAAS,MAAM,GAAG;AAC7D,QAAM,OAAO,qBAAqB,MAAM,MAAM;AAC9C,MAAI,MAAM;AACR,UAAM,6BAA6B,qBAAqB,KAAK,GAAG;AAChE,QAAI,+BAA+B,OAAO,UAAU;AAClD,aAAO,WAAW,cAAc;AAAA,IAClC;AAAA,EACF;AACA,SAAO;AACT;AAEO,IAAM,aAAoC,CAAC,EAAE,QAAQ,MAAM,SAAS,KAAK,UAAU,SAAS,GAAG,MAAM,MAAM;AAChH,QAAM,MAAM,IAAI,QAAI,wBAAS,MAAM,cAAc,CAAC;AAClD,8BAAS,IAAI,UAAU,8BAA8B;AACrD,QAAM,eAAe,sBAAsB,GAAG;AAC9C,MAAI,SAAS,SAAS,aAAa,aAAa,UAAU;AACxD,UAAM,KAAK,IAAI,OAAO,SAAS,IAAI,GAAG,aAAa,QAAQ,GAAG,aAAa,MAAM,KAAK,IAAI;AAC1F,WAAO,4CAAC,4BAAO,QAAgB,IAAQ,QAAgB,SAAmB,GAAG,OAAO;AAAA,EACtF,OAAO;AACL,WAAO,4CAAC,4BAAO,QAAgB,MAAY,QAAQ,UAAU,UAAU,SAAmB,GAAG,OAAO;AAAA,EACtG;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/Link.tsx"],"names":[],"mappings":";AACA,OAAO,EAAU,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAuBxD,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAU5C,CAAA"}
|
package/dist/node/Link.js
CHANGED
|
@@ -1,30 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var Link_exports = {};
|
|
20
|
-
__export(Link_exports, {
|
|
21
|
-
FooterLink: () => FooterLink
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(Link_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_assert = require("@xylabs/assert");
|
|
26
|
-
var import_react_link = require("@xylabs/react-link");
|
|
27
|
-
const convertToBetaIfNeeded = (url, currentUrl = new URL(document.location.href)) => {
|
|
1
|
+
// src/Link.tsx
|
|
2
|
+
import { assertEx } from "@xylabs/assert";
|
|
3
|
+
import { LinkEx } from "@xylabs/react-link";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var convertToBetaIfNeeded = (url, currentUrl = new URL(document.location.href)) => {
|
|
28
6
|
const urlObj = typeof url === "string" ? new URL(url) : url;
|
|
29
7
|
const currentUrlObj = typeof currentUrl === "string" ? new URL(currentUrl) : currentUrl;
|
|
30
8
|
const currentHostnameParts = currentUrlObj.hostname.split(".");
|
|
@@ -37,19 +15,18 @@ const convertToBetaIfNeeded = (url, currentUrl = new URL(document.location.href)
|
|
|
37
15
|
}
|
|
38
16
|
return urlObj;
|
|
39
17
|
};
|
|
40
|
-
|
|
41
|
-
const url = new URL(
|
|
42
|
-
|
|
18
|
+
var FooterLink = ({ target, href, margin = 0.5, variant = "body2", ...props }) => {
|
|
19
|
+
const url = new URL(assertEx(href, "href not set"));
|
|
20
|
+
assertEx(url.hostname, "Hostname is required in href");
|
|
43
21
|
const convertedUrl = convertToBetaIfNeeded(url);
|
|
44
22
|
if (document.location.hostname === convertedUrl.hostname) {
|
|
45
23
|
const to = url.search.length > 0 ? `${convertedUrl.pathname}${convertedUrl.search}` : url.pathname;
|
|
46
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ jsx(LinkEx, { margin, to, target, variant, ...props });
|
|
47
25
|
} else {
|
|
48
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ jsx(LinkEx, { margin, href, target: target ?? "_blank", variant, ...props });
|
|
49
27
|
}
|
|
50
28
|
};
|
|
51
|
-
|
|
52
|
-
0 && (module.exports = {
|
|
29
|
+
export {
|
|
53
30
|
FooterLink
|
|
54
|
-
}
|
|
31
|
+
};
|
|
55
32
|
//# sourceMappingURL=Link.js.map
|