@stokr/components-library 3.0.33 → 3.0.35

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.
@@ -67,7 +67,7 @@ const FooterMenu = ({
67
67
  /* @__PURE__ */ jsx(Title, { collapse: group.collapse, children: group.name }),
68
68
  isMobile && !group.social && /* @__PURE__ */ jsx(ArrowDown, { isOpened: activeGroups[groupKey] })
69
69
  ] }),
70
- /* @__PURE__ */ jsx(CollapseWrapper, { collapse: isMobile && group.collapse, isOpened: activeGroups[groupKey], children: /* @__PURE__ */ jsx(Items, { social: group.social, children: group.social ? /* @__PURE__ */ jsx(SocialLinksContainer, { children: group.items.map((item) => /* @__PURE__ */ jsx(Item, { social: true, children: /* @__PURE__ */ jsx(SocialLink, { href: item.url, alt: item.name, target: "_blank", rel: "noopener noreferrer", children: socialSvg[item.name] }) }, item.name)) }) : group.items.map((item) => /* @__PURE__ */ jsx(Item, { children: /* @__PURE__ */ jsxs(Link, { target: item.external ? "_blank" : "", href: item.url, rel: "noopener noreferrer", children: [
70
+ /* @__PURE__ */ jsx(CollapseWrapper, { collapse: isMobile && group.collapse, isOpened: activeGroups[groupKey], children: /* @__PURE__ */ jsx(Items, { social: group.social, children: group.social ? /* @__PURE__ */ jsx(SocialLinksContainer, { children: group.items.map((item) => /* @__PURE__ */ jsx(Item, { social: true, children: /* @__PURE__ */ jsx(SocialLink, { href: item.url, alt: item.name, target: "_blank", rel: "noopener noreferrer", children: socialSvg[item.name] }) }, item.name)) }) : group.items.map((item) => /* @__PURE__ */ jsx(Item, { children: /* @__PURE__ */ jsxs(Link, { target: item.external ? "_blank" : "", to: item.url, rel: "noopener noreferrer", children: [
71
71
  item.name,
72
72
  item.showNumber && jobOpeningsNumber > 0 && /* @__PURE__ */ jsx(HiringTotalNumber, { style: { marginLeft: "4px" }, children: jobOpeningsNumber })
73
73
  ] }) }, item.name)) }) })
@@ -1,7 +1,7 @@
1
1
  import styled from "styled-components";
2
2
  import { colors } from "../../styles/colors.js";
3
3
  import theme from "../../styles/theme.js";
4
- import { Link as Link$1 } from "react-router-dom";
4
+ import stdin_default from "../SmartLink/SmartLink.js";
5
5
  const Container = styled.div`
6
6
  z-index: 2;
7
7
  position: relative;
@@ -186,7 +186,7 @@ const Item = styled.li.withConfig({
186
186
  padding-right: 16px;
187
187
  }
188
188
  `;
189
- const Link = styled(Link$1)`
189
+ const Link = styled(stdin_default)`
190
190
  display: inline-block;
191
191
  font-family: 'Open Sans';
192
192
  font-weight: bold;
@@ -1,17 +1,17 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useMemo, useState, useEffect } from "react";
3
3
  import PropTypes from "prop-types";
4
- import { Link } from "react-router-dom";
4
+ import stdin_default$1 from "../SmartLink/SmartLink.js";
5
5
  import { Button } from "../Button/Button.styles.js";
6
- import stdin_default$1 from "../SvgIcons/LogoSvg.js";
6
+ import stdin_default$2 from "../SvgIcons/LogoSvg.js";
7
7
  import "../SvgIcons/SocialInstagram.js";
8
8
  import { MenuNav } from "../MenuNav/MenuNav.styles.js";
9
- import stdin_default$3 from "../MainMenu/MainMenu.js";
9
+ import stdin_default$4 from "../MainMenu/MainMenu.js";
10
10
  import { StepsProgressSignup, StepsProgressHeader } from "../StepsProgress/StepsProgress.js";
11
11
  import { NotificationCounter } from "../NotificationCounter/NotificationCounter.styles.js";
12
12
  import avatarPlaceholder from "../../static/images/avatar-placeholder.png.js";
13
13
  import { StyledHeader, SidebarToggle, HamburgerIcon, HeaderInner, MainNavWrap, Logo, HeaderMainNav, ProgressWrap, QuickNavWrap, MobileMenuToggler, HeaderQuickNav, LoginButton, UserAccount, UserButton, SignupButton, MobileMenu, MobileMenuPart, MobileMenuItem, MobileMenuLink, CTAContainer, SocialLinksContainer, UserAvatar, MobileMenuWrapper, StyledSubMenu } from "./Header.styles.js";
14
- import stdin_default$2 from "../MainMenu/DynamicMainMenu.js";
14
+ import stdin_default$3 from "../MainMenu/DynamicMainMenu.js";
15
15
  import { SocialLink, ArrowDown } from "../Footer/FooterMenu.styles.js";
16
16
  import { Collapse } from "react-collapse";
17
17
  import { usePrevious, useMobileView } from "../../utils/customHooks.js";
@@ -190,10 +190,10 @@ function HeaderView({
190
190
  withSidebar && /* @__PURE__ */ jsx(SidebarToggle, { isSidebarExpanded, onClick: sidebarHandler, children: /* @__PURE__ */ jsx(HamburgerIcon, {}) }),
191
191
  /* @__PURE__ */ jsxs(HeaderInner, { withSidebar, children: [
192
192
  /* @__PURE__ */ jsxs(MainNavWrap, { hasProgress: progress, children: [
193
- /* @__PURE__ */ jsx(Logo, { isHighlight: currentActiveMenu === "main", children: useRelativePathForMenu ? /* @__PURE__ */ jsx("a", { href: platformURL, "data-cy": "logo-nav-link", children: /* @__PURE__ */ jsx(stdin_default$1, {}) }) : /* @__PURE__ */ jsx(Link, { to: "/", "data-cy": "logo-nav-link", children: /* @__PURE__ */ jsx(stdin_default$1, {}) }) }),
193
+ /* @__PURE__ */ jsx(Logo, { isHighlight: currentActiveMenu === "main", children: /* @__PURE__ */ jsx(stdin_default$1, { to: useRelativePathForMenu ? "/" : platformURL, "data-cy": "logo-nav-link", children: /* @__PURE__ */ jsx(stdin_default$2, {}) }) }),
194
194
  !progress && /* @__PURE__ */ jsx(HeaderMainNav, { children: /* @__PURE__ */ jsx(MenuNav, { children: /* @__PURE__ */ jsxs("ul", { children: [
195
195
  /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
196
- Link,
196
+ stdin_default$1,
197
197
  {
198
198
  to: newPlatformUrl + "/featured-assets",
199
199
  "data-cy": "invest-nav-link",
@@ -224,7 +224,7 @@ function HeaderView({
224
224
  }
225
225
  ) }),
226
226
  /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
227
- Link,
227
+ stdin_default$1,
228
228
  {
229
229
  to: newPlatformUrl + "/team",
230
230
  "data-cy": "team-nav-link",
@@ -327,33 +327,20 @@ function HeaderView({
327
327
  /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(MobileMenuLink, { to: newPlatformUrl + "/team", children: "Team" }) })
328
328
  ] }) }) }) }),
329
329
  hasLoggedInSession(user) ? /* @__PURE__ */ jsxs(Fragment, { children: [
330
- !signupFlow && /* @__PURE__ */ jsx(MobileMenuPart, { withPadding: true, flexColumn: true, borderTop: true, children: /* @__PURE__ */ jsx(MenuNav, { mobile: true, children: /* @__PURE__ */ jsx("ul", { children: isAdmin ? /* @__PURE__ */ jsx(Fragment, { children: isVentureDashboard ? /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(Link, { to: "/settings", children: "Settings" }) }) : /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(
331
- Link,
332
- {
333
- to: getConfig("adminUrl"),
334
- onClick: (e) => {
335
- e.preventDefault();
336
- toggleMenu("main");
337
- },
338
- children: "Dashboard"
339
- }
340
- ) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
330
+ !signupFlow && /* @__PURE__ */ jsx(MobileMenuPart, { withPadding: true, flexColumn: true, borderTop: true, children: /* @__PURE__ */ jsx(MenuNav, { mobile: true, children: /* @__PURE__ */ jsx("ul", { children: isAdmin ? /* @__PURE__ */ jsx(Fragment, { children: isVentureDashboard ? /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(stdin_default$1, { to: "/settings", children: "Settings" }) }) : /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(stdin_default$1, { to: getConfig("adminUrl"), onClick: () => toggleMenu("main"), children: "Dashboard" }) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
341
331
  /* @__PURE__ */ jsxs(MobileMenuItem, { children: [
342
332
  /* @__PURE__ */ jsx(
343
- Link,
333
+ stdin_default$1,
344
334
  {
345
- to: newPlatformUrlForUserMenu ? `${newPlatformUrlForUserMenu}/overview` : "/overview",
346
- onClick: (e) => {
347
- e.preventDefault();
348
- toggleMenu("main");
349
- },
335
+ to: `${newPlatformUrlForUserMenu}/overview`,
336
+ onClick: () => toggleMenu("main"),
350
337
  children: "Dashboard"
351
338
  }
352
339
  ),
353
340
  checkTodoStatus(user) > 0 && /* @__PURE__ */ jsx(NotificationCounter, { mobileMenu: true, children: checkTodoStatus(user) })
354
341
  ] }),
355
342
  /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(
356
- Link,
343
+ stdin_default$1,
357
344
  {
358
345
  to: `${newPlatformUrlForUserMenu}/settings/profile-and-privacy`,
359
346
  onClick: () => toggleMenu("main"),
@@ -361,7 +348,7 @@ function HeaderView({
361
348
  }
362
349
  ) }),
363
350
  /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(
364
- Link,
351
+ stdin_default$1,
365
352
  {
366
353
  to: `${newPlatformUrlForUserMenu}/settings/liquid-address`,
367
354
  onClick: () => toggleMenu("main"),
@@ -369,7 +356,7 @@ function HeaderView({
369
356
  }
370
357
  ) }),
371
358
  /* @__PURE__ */ jsx(MobileMenuItem, { children: /* @__PURE__ */ jsx(
372
- Link,
359
+ stdin_default$1,
373
360
  {
374
361
  to: `${newPlatformUrlForUserMenu}/settings/investment-eligibility`,
375
362
  onClick: () => toggleMenu("main"),
@@ -420,10 +407,10 @@ function HeaderView({
420
407
  ] })
421
408
  ] })
422
409
  ] }),
423
- /* @__PURE__ */ jsx(stdin_default$2, { isMenuActive: currentActiveMenu === "products", options: productMenuItems }),
424
- /* @__PURE__ */ jsx(stdin_default$2, { isMenuActive: currentActiveMenu === "media", options: mediaMenuItems }),
410
+ /* @__PURE__ */ jsx(stdin_default$3, { isMenuActive: currentActiveMenu === "products", options: productMenuItems }),
411
+ /* @__PURE__ */ jsx(stdin_default$3, { isMenuActive: currentActiveMenu === "media", options: mediaMenuItems }),
425
412
  /* @__PURE__ */ jsx(
426
- stdin_default$3,
413
+ stdin_default$4,
427
414
  {
428
415
  isMenuActive: currentActiveMenu === "main",
429
416
  logoutUser,
@@ -1,5 +1,5 @@
1
1
  import styled from "styled-components";
2
- import { Link } from "react-router-dom";
2
+ import stdin_default from "../SmartLink/SmartLink.js";
3
3
  import rwd, { rwdMax } from "../../styles/rwd.js";
4
4
  import { colors } from "../../styles/colors.js";
5
5
  import spacing from "../../styles/spacing.js";
@@ -364,7 +364,7 @@ const MobileMenuItem = styled.li.withConfig({
364
364
  const MobileMenuWrapper = styled.div`
365
365
  cursor: pointer;
366
366
  `;
367
- const MobileMenuLink = styled(Link)`
367
+ const MobileMenuLink = styled(stdin_default)`
368
368
  width: 100%;
369
369
  `;
370
370
  const MobileMenuPart = styled.div.withConfig({
@@ -0,0 +1,24 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import "react";
3
+ import PropTypes from "prop-types";
4
+ import { Link } from "react-router-dom";
5
+ const isExternalUrl = (to) => {
6
+ if (typeof to !== "string" || to === "") return false;
7
+ return /^([a-z][a-z0-9+.-]*:|\/\/)/i.test(to);
8
+ };
9
+ const SmartLink = ({ to, children, ...rest }) => {
10
+ if (isExternalUrl(to)) {
11
+ return /* @__PURE__ */ jsx("a", { href: to, ...rest, children });
12
+ }
13
+ return /* @__PURE__ */ jsx(Link, { to, ...rest, children });
14
+ };
15
+ SmartLink.propTypes = {
16
+ to: PropTypes.string,
17
+ children: PropTypes.node
18
+ };
19
+ var stdin_default = SmartLink;
20
+ export {
21
+ SmartLink,
22
+ stdin_default as default,
23
+ isExternalUrl
24
+ };
package/dist/index.js CHANGED
@@ -88,6 +88,7 @@ import { StepController } from "./components/StepController/StepController.js";
88
88
  import { StepControllerConsumer, StepControllerContext, StepControllerProvider } from "./components/StepController/StepControllerContext.js";
89
89
  import { StepsProgressHeader, StepsProgressSignup } from "./components/StepsProgress/StepsProgress.js";
90
90
  import { Container, Item, Items, Wrap } from "./components/StepsProgress/StepsProgress.styles.js";
91
+ import { SmartLink, isExternalUrl } from "./components/SmartLink/SmartLink.js";
91
92
  import { Switch } from "./components/Switch/Switch.js";
92
93
  import { Tabs } from "./components/Tabs/Tabs.js";
93
94
  import { Breakdown } from "./components/breakdown/Breakdown.js";
@@ -492,6 +493,7 @@ export {
492
493
  SideLine,
493
494
  SideModal,
494
495
  Slider,
496
+ SmartLink,
495
497
  Snackbar,
496
498
  SnackbarContext,
497
499
  SnackbarProvider,
@@ -610,6 +612,7 @@ export {
610
612
  identify,
611
613
  initAnalytics,
612
614
  isAlreadyOnOnboardingFlow,
615
+ isExternalUrl,
613
616
  isUSInvestor,
614
617
  km_ify,
615
618
  learnMoreCategoryPropTypes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "3.0.33",
3
+ "version": "3.0.35",
4
4
  "description": "STOKR - Components Library",
5
5
  "author": "Bilal Hodzic <bilal@stokr.io>",
6
6
  "license": "MIT",