@common-origin/design-system 1.16.0 → 2.0.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/index.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  var React = require('react');
4
4
  var styled = require('styled-components');
5
- var Link = require('next/link');
6
5
  var dateFns = require('date-fns');
7
6
 
8
7
  function _extends() {
@@ -747,7 +746,7 @@ var semantic$a = {
747
746
  h1: "700 3rem/3rem 'Inter', sans-serif",
748
747
  h2: "700 2rem/2.5rem 'Inter', sans-serif",
749
748
  h3: "700 1.75rem/2.25rem 'Inter', sans-serif",
750
- h4: "500 1.5rem/2rem 'Inter', sans-serif",
749
+ h4: "700 1.5rem/2rem 'Inter', sans-serif",
751
750
  h5: "500 1.25rem/1.75rem 'Inter', sans-serif",
752
751
  h6: "500 1.125rem/1.5rem 'Inter', sans-serif",
753
752
  subtitle: "500 1rem/1.5rem 'Inter', sans-serif",
@@ -806,7 +805,7 @@ var AvatarInitials = styled.span.withConfig({
806
805
  },
807
806
  displayName: "Avatar__AvatarInitials",
808
807
  componentId: "sc-ezn4ax-2"
809
- })(templateObject_3$i || (templateObject_3$i = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n color: ", ";\n line-height: 1;\n text-transform: uppercase;\n user-select: none;\n"], ["\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n color: ", ";\n line-height: 1;\n text-transform: uppercase;\n user-select: none;\n"
808
+ })(templateObject_3$h || (templateObject_3$h = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n color: ", ";\n line-height: 1;\n text-transform: uppercase;\n user-select: none;\n"], ["\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n color: ", ";\n line-height: 1;\n text-transform: uppercase;\n user-select: none;\n"
810
809
  // Helper function to get initials from name
811
810
  ])), tokensData.base.fontFamily.body, tokensData.base.fontWeight[3], function (_a) {
812
811
  var $size = _a.$size;
@@ -869,7 +868,7 @@ var Avatar = function Avatar(_a) {
869
868
  "aria-hidden": "true"
870
869
  }, initials));
871
870
  };
872
- var templateObject_1$y, templateObject_2$l, templateObject_3$i;
871
+ var templateObject_1$y, templateObject_2$l, templateObject_3$h;
873
872
 
874
873
  React.createElement;
875
874
  var _a$5 = tokensData.semantic,
@@ -1020,7 +1019,7 @@ var BadgeIndicator = styled.span.withConfig({
1020
1019
  },
1021
1020
  displayName: "Badge__BadgeIndicator",
1022
1021
  componentId: "sc-tjz4pp-1"
1023
- })(templateObject_3$h || (templateObject_3$h = __makeTemplateObject(["\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: ", ";\n align-items: center;\n justify-content: center;\n min-width: ", ";\n height: ", ";\n padding: ", ";\n border-radius: ", ";\n line-height: 1;\n white-space: nowrap;\n box-shadow: 0 0 0 2px ", ";\n animation: ", " 0.2s ease-out;\n \n ", "\n"], ["\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: ", ";\n align-items: center;\n justify-content: center;\n min-width: ", ";\n height: ", ";\n padding: ", ";\n border-radius: ", ";\n line-height: 1;\n white-space: nowrap;\n box-shadow: 0 0 0 2px ", ";\n animation: ", " 0.2s ease-out;\n \n ", "\n"])), function (props) {
1022
+ })(templateObject_3$g || (templateObject_3$g = __makeTemplateObject(["\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: ", ";\n align-items: center;\n justify-content: center;\n min-width: ", ";\n height: ", ";\n padding: ", ";\n border-radius: ", ";\n line-height: 1;\n white-space: nowrap;\n box-shadow: 0 0 0 2px ", ";\n animation: ", " 0.2s ease-out;\n \n ", "\n"], ["\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: ", ";\n align-items: center;\n justify-content: center;\n min-width: ", ";\n height: ", ";\n padding: ", ";\n border-radius: ", ";\n line-height: 1;\n white-space: nowrap;\n box-shadow: 0 0 0 2px ", ";\n animation: ", " 0.2s ease-out;\n \n ", "\n"])), function (props) {
1024
1023
  return props.$isVisible ? 'flex' : 'none';
1025
1024
  }, function (props) {
1026
1025
  return props.$isDot ? '8px' : '16px';
@@ -1076,7 +1075,7 @@ var Badge = function Badge(_a) {
1076
1075
  color: "inverse"
1077
1076
  }, displayCount), /*#__PURE__*/React.createElement(ScreenReaderOnly, null, label)));
1078
1077
  };
1079
- var templateObject_1$w, templateObject_2$k, templateObject_3$h, templateObject_4$e;
1078
+ var templateObject_1$w, templateObject_2$k, templateObject_3$g, templateObject_4$e;
1080
1079
 
1081
1080
  React.createElement;
1082
1081
  var StyledBox = styled.div.withConfig({
@@ -1092,7 +1091,7 @@ var StyledBox = styled.div.withConfig({
1092
1091
  }, function (props) {
1093
1092
  return props.$flexDirection && styled.css(templateObject_2$j || (templateObject_2$j = __makeTemplateObject(["flex-direction: ", ";"], ["flex-direction: ", ";"])), props.$flexDirection);
1094
1093
  }, function (props) {
1095
- return props.$justifyContent && styled.css(templateObject_3$g || (templateObject_3$g = __makeTemplateObject(["justify-content: ", ";"], ["justify-content: ", ";"])), props.$justifyContent);
1094
+ return props.$justifyContent && styled.css(templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["justify-content: ", ";"], ["justify-content: ", ";"])), props.$justifyContent);
1096
1095
  }, function (props) {
1097
1096
  return props.$alignItems && styled.css(templateObject_4$d || (templateObject_4$d = __makeTemplateObject(["align-items: ", ";"], ["align-items: ", ";"])), props.$alignItems);
1098
1097
  }, function (props) {
@@ -1278,7 +1277,7 @@ var BoxTransform = function BoxTransform(props) {
1278
1277
  }, rest), children);
1279
1278
  };
1280
1279
  var Box = BoxTransform;
1281
- var templateObject_1$v, templateObject_2$j, templateObject_3$g, templateObject_4$d, templateObject_5$a, templateObject_6$9, templateObject_7$7, templateObject_8$3, templateObject_9$2, templateObject_10$2, templateObject_11$2, templateObject_12$2, templateObject_13$2, templateObject_14$1, templateObject_15$1, templateObject_16$1, templateObject_17$1, templateObject_18$1, templateObject_19$1, templateObject_20$1, templateObject_21$1, templateObject_22$1, templateObject_23$1, templateObject_24$1, templateObject_25$1, templateObject_26$1, templateObject_27$1, templateObject_28$1, templateObject_29$1, templateObject_30$1, templateObject_31$1, templateObject_32$1, templateObject_33$1, templateObject_34$1, templateObject_35$1, templateObject_36, templateObject_37, templateObject_38, templateObject_39, templateObject_40, templateObject_41, templateObject_42, templateObject_43;
1280
+ var templateObject_1$v, templateObject_2$j, templateObject_3$f, templateObject_4$d, templateObject_5$a, templateObject_6$9, templateObject_7$7, templateObject_8$3, templateObject_9$2, templateObject_10$2, templateObject_11$2, templateObject_12$2, templateObject_13$2, templateObject_14$1, templateObject_15$1, templateObject_16$1, templateObject_17$1, templateObject_18$1, templateObject_19$1, templateObject_20$1, templateObject_21$1, templateObject_22$1, templateObject_23$1, templateObject_24$1, templateObject_25$1, templateObject_26$1, templateObject_27$1, templateObject_28$1, templateObject_29$1, templateObject_30$1, templateObject_31$1, templateObject_32$1, templateObject_33$1, templateObject_34$1, templateObject_35$1, templateObject_36, templateObject_37, templateObject_38, templateObject_39, templateObject_40, templateObject_41, templateObject_42, templateObject_43;
1282
1281
 
1283
1282
  var add = {
1284
1283
  path: "M13 11H19V13H13V19H11V13H5V11H11V5H13V11Z",
@@ -1305,7 +1304,7 @@ var arrowRight = {
1305
1304
  name: "arrowRight"
1306
1305
  };
1307
1306
  var bell = {
1308
- path: "M12.0001 2C15.3561 2 18.1753 4.52384 18.546 7.85938L18.7979 10.125C18.8012 10.1546 18.8024 10.1676 18.8038 10.1797C18.9166 11.1628 19.2372 12.1106 19.7432 12.9609C19.7494 12.9714 19.7553 12.9824 19.7706 13.0078L20.3487 13.9707C20.5997 14.3891 20.829 14.7681 20.9795 15.0879C21.1276 15.4024 21.2852 15.8285 21.209 16.3115C21.1337 16.789 20.8882 17.2229 20.5176 17.5332C20.1426 17.8471 19.6956 17.931 19.3497 17.9658C18.998 18.0012 18.5554 18 18.0674 18H5.93268C5.44476 18 5.00211 18.0012 4.65045 17.9658C4.30456 17.931 3.85755 17.8471 3.48248 17.5332C3.1119 17.2229 2.86641 16.789 2.79107 16.3115C2.7149 15.8285 2.87247 15.4024 3.02057 15.0879C3.17116 14.7681 3.40038 14.3891 3.65143 13.9707L4.22955 13.0078C4.24481 12.9824 4.25068 12.9714 4.25689 12.9609C4.76296 12.1106 5.08348 11.1628 5.19635 10.1797C5.19773 10.1676 5.19892 10.1546 5.20221 10.125L5.45416 7.85938C5.82477 4.52384 8.644 2 12.0001 2ZM12.0001 4C9.6631 4 7.69954 5.75741 7.44146 8.08008L7.18951 10.3457C7.18638 10.3739 7.18457 10.3907 7.18268 10.4072C7.03761 11.6714 6.62638 12.8909 5.97564 13.9844C5.96724 13.9985 5.95885 14.013 5.94439 14.0371L5.36627 15C5.09277 15.4558 4.92766 15.7334 4.83014 15.9404C4.82533 15.9506 4.82155 15.9606 4.81744 15.9697C4.82787 15.971 4.83877 15.9744 4.85064 15.9756C5.07838 15.9985 5.40111 16 5.93268 16H18.0674C18.599 16 18.9217 15.9985 19.1495 15.9756C19.161 15.9744 19.1716 15.9709 19.1817 15.9697C19.1776 15.9607 19.1747 15.9505 19.17 15.9404C19.0725 15.7334 18.9074 15.4558 18.6338 15L18.0557 14.0371C18.0413 14.013 18.0329 13.9985 18.0245 13.9844C17.3737 12.8909 16.9625 11.6714 16.8174 10.4072C16.8155 10.3907 16.8137 10.3739 16.8106 10.3457L16.5587 8.08008C16.3006 5.75741 14.337 4 12.0001 4Z M12.0001 22C10.9897 22 10.0894 21.4972 9.419 20.7256C8.75348 19.9595 8.31404 18.9367 8.11822 17.8408C8.0211 17.2971 8.38314 16.7778 8.92682 16.6807C9.47038 16.5837 9.98987 16.9457 10.087 17.4893C10.233 18.3066 10.5467 18.9742 10.9288 19.4141C11.3063 19.8486 11.6896 20 12.0001 20C12.3106 20 12.6938 19.8486 13.0713 19.4141C13.4535 18.9742 13.7671 18.3066 13.9131 17.4893C14.0102 16.9457 14.5297 16.5837 15.0733 16.6807C15.617 16.7778 15.979 17.2971 15.8819 17.8408C15.6861 18.9367 15.2466 19.9595 14.5811 20.7256C13.9108 21.4972 13.0104 22 12.0001 22Z",
1307
+ path: "M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2ZM12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4ZM15.707 9.70703L13.4141 12L15.707 14.293L14.293 15.707L12 13.4141L9.70703 15.707L8.29297 14.293L10.5859 12L8.29297 9.70703L9.70703 8.29297L12 10.5859L14.293 8.29297L15.707 9.70703Z",
1309
1308
  name: "bell"
1310
1309
  };
1311
1310
  var back = {
@@ -1608,16 +1607,6 @@ var StyledLink = styled.a.withConfig({
1608
1607
  displayName: "Button__StyledLink",
1609
1608
  componentId: "sc-1eiuum9-1"
1610
1609
  })(templateObject_2$i || (templateObject_2$i = __makeTemplateObject(["\n ", "\n border-radius: ", ";\n \n ", "\n ", "\n"], ["\n ", "\n border-radius: ", ";\n \n ", "\n ", "\n"
1611
- // Styled Next.js Link component (modern API without legacyBehavior)
1612
- ])), baseButtonStyles, button.primary.borderRadius, getVariantStyles, getSizeStyles);
1613
- // Styled Next.js Link component (modern API without legacyBehavior)
1614
- var StyledNextLink = styled(Link).withConfig({
1615
- shouldForwardProp: function shouldForwardProp(prop) {
1616
- return !prop.startsWith('$');
1617
- },
1618
- displayName: "Button__StyledNextLink",
1619
- componentId: "sc-1eiuum9-2"
1620
- })(templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["\n ", "\n border-radius: ", ";\n \n ", "\n ", "\n"], ["\n ", "\n border-radius: ", ";\n \n ", "\n ", "\n"
1621
1610
  // Helper function to get icon size based on button size
1622
1611
  ])), baseButtonStyles, button.primary.borderRadius, getVariantStyles, getSizeStyles);
1623
1612
  // Helper function to get icon size based on button size
@@ -1654,18 +1643,21 @@ var Button = function Button(_a) {
1654
1643
  children = _a.children,
1655
1644
  target = _a.target,
1656
1645
  iconName = _a.iconName,
1646
+ LinkComponent = _a.linkComponent,
1657
1647
  dataTestId = _a["data-testid"],
1658
- rest = __rest(_a, ["variant", "size", "url", "purpose", "children", "target", "iconName", 'data-testid']);
1659
- // For internal links, use Next.js Link (modern API without legacyBehavior)
1660
- if (purpose === 'link' && url && !url.startsWith('http') && !target) {
1661
- return /*#__PURE__*/React.createElement(StyledNextLink, {
1662
- href: url,
1648
+ rest = __rest(_a, ["variant", "size", "url", "purpose", "children", "target", "iconName", "linkComponent", 'data-testid']);
1649
+ // For links with custom link component (e.g., Next.js Link, React Router Link)
1650
+ if (purpose === 'link' && url && LinkComponent) {
1651
+ return /*#__PURE__*/React.createElement(LinkComponent, {
1652
+ href: url
1653
+ }, /*#__PURE__*/React.createElement(StyledLink, {
1654
+ as: "span",
1663
1655
  $variant: variant,
1664
1656
  $size: size,
1665
1657
  "data-testid": dataTestId
1666
- }, renderButtonContent(children, iconName, size));
1658
+ }, renderButtonContent(children, iconName, size)));
1667
1659
  }
1668
- // For external links or links with target
1660
+ // For standard links (external or without custom component)
1669
1661
  if (purpose === 'link' && url) {
1670
1662
  var linkProps = rest;
1671
1663
  return /*#__PURE__*/React.createElement(StyledLink, _extends({
@@ -1706,7 +1698,7 @@ var Button = function Button(_a) {
1706
1698
  "data-testid": dataTestId
1707
1699
  }, buttonProps), renderButtonContent(children, iconName, size));
1708
1700
  };
1709
- var templateObject_1$t, templateObject_2$i, templateObject_3$f;
1701
+ var templateObject_1$t, templateObject_2$i;
1710
1702
 
1711
1703
  var chip = tokensData.component.chip;
1712
1704
  // Helper function to get variant styles as objects for CSS custom properties
@@ -2737,7 +2729,8 @@ var isInternalUrl = function isInternalUrl(url) {
2737
2729
  return url.startsWith('/') && !url.startsWith('http');
2738
2730
  };
2739
2731
  var Breadcrumbs = function Breadcrumbs(_a) {
2740
- var breadcrumbs = _a.breadcrumbs;
2732
+ var breadcrumbs = _a.breadcrumbs,
2733
+ LinkComponent = _a.linkComponent;
2741
2734
  return /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(BreadcrumbNavStyled, {
2742
2735
  "aria-label": "breadcrumb"
2743
2736
  }, /*#__PURE__*/React.createElement("ol", null, breadcrumbs.map(function (breadcrumb, index) {
@@ -2745,15 +2738,16 @@ var Breadcrumbs = function Breadcrumbs(_a) {
2745
2738
  key: index
2746
2739
  }, index === breadcrumbs.length - 1 ? /*#__PURE__*/React.createElement(Typography, {
2747
2740
  variant: "caption"
2748
- }, breadcrumb.label) : isInternalUrl(breadcrumb.url) ? /*#__PURE__*/React.createElement(Link, {
2741
+ }, breadcrumb.label) : LinkComponent && isInternalUrl(breadcrumb.url) ? /*#__PURE__*/React.createElement(LinkComponent, {
2749
2742
  href: breadcrumb.url
2750
2743
  }, /*#__PURE__*/React.createElement(Typography, {
2751
2744
  variant: "caption"
2752
- }, breadcrumb.label)) : /*#__PURE__*/React.createElement("a", {
2753
- href: breadcrumb.url,
2745
+ }, breadcrumb.label)) : /*#__PURE__*/React.createElement("a", _extends({
2746
+ href: breadcrumb.url
2747
+ }, !isInternalUrl(breadcrumb.url) && {
2754
2748
  target: "_blank",
2755
2749
  rel: "noopener noreferrer"
2756
- }, /*#__PURE__*/React.createElement(Typography, {
2750
+ }), /*#__PURE__*/React.createElement(Typography, {
2757
2751
  variant: "caption"
2758
2752
  }, breadcrumb.label)));
2759
2753
  }))));
@@ -2770,14 +2764,12 @@ var CardSmall = function CardSmall(_a) {
2770
2764
  picture = _a.picture,
2771
2765
  subtitle = _a.subtitle,
2772
2766
  meta = _a.meta,
2773
- href = _a.href;
2767
+ href = _a.href,
2768
+ LinkComponent = _a.linkComponent;
2774
2769
  if (!picture || !meta) {
2775
2770
  return null;
2776
2771
  }
2777
- return /*#__PURE__*/React.createElement(CardSmallStyled, null, /*#__PURE__*/React.createElement(Link, {
2778
- href: href || '#',
2779
- "aria-label": title
2780
- }, /*#__PURE__*/React.createElement(Stack, {
2772
+ var content = /*#__PURE__*/React.createElement(Stack, {
2781
2773
  direction: "column",
2782
2774
  gap: "sm"
2783
2775
  }, /*#__PURE__*/React.createElement(Picture, {
@@ -2799,7 +2791,14 @@ var CardSmall = function CardSmall(_a) {
2799
2791
  }, subtitle), meta && /*#__PURE__*/React.createElement(Typography, {
2800
2792
  variant: "label",
2801
2793
  color: "subdued"
2802
- }, meta))))));
2794
+ }, meta))));
2795
+ return /*#__PURE__*/React.createElement(CardSmallStyled, null, LinkComponent && href ? /*#__PURE__*/React.createElement(LinkComponent, {
2796
+ href: href,
2797
+ "aria-label": title
2798
+ }, content) : /*#__PURE__*/React.createElement("a", {
2799
+ href: href || '#',
2800
+ "aria-label": title
2801
+ }, content));
2803
2802
  };
2804
2803
  var templateObject_1$h;
2805
2804