@common-origin/design-system 1.16.1 → 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/README.md +40 -1
- package/dist/components/atoms/Button/Button.d.ts +6 -0
- package/dist/components/molecules/Breadcrumbs/Breadcrumbs.d.ts +5 -0
- package/dist/components/molecules/CardSmall/CardSmall.d.ts +5 -0
- package/dist/index.esm.js +36 -37
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +36 -37
- package/dist/index.js.map +1 -1
- package/dist/styles/tokens.json +1 -1
- package/dist/tokens/index.esm.js +1 -1
- package/dist/tokens/index.js +1 -1
- package/package.json +4 -3
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: "
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
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",
|
|
@@ -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
|
|
1660
|
-
if (purpose === 'link' && url &&
|
|
1661
|
-
return /*#__PURE__*/React.createElement(
|
|
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
|
|
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
|
|
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(
|
|
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
|
-
|
|
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
|
|