@common-origin/design-system 1.7.0 → 1.8.1
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/components/atoms/Badge/Badge.d.ts +18 -0
- package/dist/components/atoms/Badge/index.d.ts +2 -0
- package/dist/components/atoms/SectionSeparator/SectionSeparator.d.ts +26 -0
- package/dist/components/atoms/SectionSeparator/index.d.ts +1 -0
- package/dist/components/atoms/index.d.ts +1 -0
- package/dist/index.esm.js +80 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +79 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface BadgeProps {
|
|
3
|
+
/** Content to wrap with the badge */
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
/** Number to display in the badge. If 0, badge is hidden */
|
|
6
|
+
count?: number;
|
|
7
|
+
/** Maximum number to display before showing "99+" */
|
|
8
|
+
max?: number;
|
|
9
|
+
/** Visual variant of the badge */
|
|
10
|
+
variant?: 'default' | 'primary' | 'error' | 'warning' | 'success';
|
|
11
|
+
/** Show only a dot indicator instead of count */
|
|
12
|
+
dot?: boolean;
|
|
13
|
+
/** Screen reader label for the badge */
|
|
14
|
+
'aria-label'?: string;
|
|
15
|
+
/** Additional CSS class */
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const Badge: React.FC<BadgeProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SectionSeparatorProps {
|
|
3
|
+
/** Variant style of the separator */
|
|
4
|
+
variant?: 'default' | 'strong' | 'minimal';
|
|
5
|
+
/** Size variation affecting spacing */
|
|
6
|
+
size?: 'small' | 'medium' | 'large' | 'xlarge';
|
|
7
|
+
/** Data test id for testing */
|
|
8
|
+
'data-testid'?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* SectionSeparator is an atomic component that provides visual separation between content sections.
|
|
12
|
+
*
|
|
13
|
+
* Features:
|
|
14
|
+
* - Multiple variants (default, strong, minimal)
|
|
15
|
+
* - Size variations for different spacing needs
|
|
16
|
+
* - Semantic token usage for consistent styling
|
|
17
|
+
* - Full accessibility support
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <SectionSeparator />
|
|
22
|
+
* <SectionSeparator variant="strong" size="xlarge" />
|
|
23
|
+
* <SectionSeparator variant="minimal" />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const SectionSeparator: React.FC<SectionSeparatorProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SectionSeparator';
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
-
import styled, { css } from 'styled-components';
|
|
2
|
+
import styled, { keyframes, css } from 'styled-components';
|
|
3
3
|
import Link from 'next/link';
|
|
4
4
|
import { parseISO, format } from 'date-fns';
|
|
5
5
|
import Image from 'next/image';
|
|
@@ -745,7 +745,7 @@ var AvatarContainer = styled.div.withConfig({
|
|
|
745
745
|
},
|
|
746
746
|
displayName: "Avatar__AvatarContainer",
|
|
747
747
|
componentId: "sc-ezn4ax-0"
|
|
748
|
-
})(templateObject_1$
|
|
748
|
+
})(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n background-color: ", ";\n overflow: hidden;\n flex-shrink: 0;\n"], ["\n position: relative;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n background-color: ", ";\n overflow: hidden;\n flex-shrink: 0;\n"])), function (_a) {
|
|
749
749
|
var $size = _a.$size;
|
|
750
750
|
return tokens.semantic.size.avatar[$size];
|
|
751
751
|
}, function (_a) {
|
|
@@ -758,14 +758,14 @@ var AvatarImage = styled.img.withConfig({
|
|
|
758
758
|
},
|
|
759
759
|
displayName: "Avatar__AvatarImage",
|
|
760
760
|
componentId: "sc-ezn4ax-1"
|
|
761
|
-
})(templateObject_2$
|
|
761
|
+
})(templateObject_2$b || (templateObject_2$b = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: ", ";\n /* Remove the img role since the container already has role=\"img\" */\n"], ["\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: ", ";\n /* Remove the img role since the container already has role=\"img\" */\n"])), tokens.base.border.radius.circle);
|
|
762
762
|
var AvatarInitials = styled.span.withConfig({
|
|
763
763
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
764
764
|
return !prop.startsWith('$');
|
|
765
765
|
},
|
|
766
766
|
displayName: "Avatar__AvatarInitials",
|
|
767
767
|
componentId: "sc-ezn4ax-2"
|
|
768
|
-
})(templateObject_3$
|
|
768
|
+
})(templateObject_3$9 || (templateObject_3$9 = __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"
|
|
769
769
|
// Helper function to get initials from name
|
|
770
770
|
])), tokens.base.fontFamily.body, tokens.base.fontWeight[3], function (_a) {
|
|
771
771
|
var $size = _a.$size;
|
|
@@ -828,7 +828,80 @@ var Avatar = function Avatar(_a) {
|
|
|
828
828
|
"aria-hidden": "true"
|
|
829
829
|
}, initials));
|
|
830
830
|
};
|
|
831
|
-
var templateObject_1$
|
|
831
|
+
var templateObject_1$m, templateObject_2$b, templateObject_3$9;
|
|
832
|
+
|
|
833
|
+
React.createElement;
|
|
834
|
+
var _a$6 = tokens.semantic,
|
|
835
|
+
color$4 = _a$6.color,
|
|
836
|
+
typography$3 = _a$6.typography,
|
|
837
|
+
_b$2 = tokens.base,
|
|
838
|
+
fontSize = _b$2.fontSize;
|
|
839
|
+
_b$2.shadow;
|
|
840
|
+
var scaleIn = keyframes(templateObject_1$l || (templateObject_1$l = __makeTemplateObject(["\n from {\n transform: scale(0.8);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n"], ["\n from {\n transform: scale(0.8);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n"])));
|
|
841
|
+
var BadgeWrapper = styled.span.withConfig({
|
|
842
|
+
displayName: "Badge__BadgeWrapper",
|
|
843
|
+
componentId: "sc-tjz4pp-0"
|
|
844
|
+
})(templateObject_2$a || (templateObject_2$a = __makeTemplateObject(["\n position: relative;\n display: inline-flex;\n vertical-align: middle;\n flex-shrink: 0;\n"], ["\n position: relative;\n display: inline-flex;\n vertical-align: middle;\n flex-shrink: 0;\n"])));
|
|
845
|
+
var BadgeIndicator = styled.span.withConfig({
|
|
846
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
847
|
+
return !prop.startsWith('$');
|
|
848
|
+
},
|
|
849
|
+
displayName: "Badge__BadgeIndicator",
|
|
850
|
+
componentId: "sc-tjz4pp-1"
|
|
851
|
+
})(templateObject_3$8 || (templateObject_3$8 = __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 font: ", ";\n font-size: ", ";\n font-weight: 600;\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 font: ", ";\n font-size: ", ";\n font-weight: 600;\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) {
|
|
852
|
+
return props.$isVisible ? 'flex' : 'none';
|
|
853
|
+
}, function (props) {
|
|
854
|
+
return props.$isDot ? '8px' : '20px';
|
|
855
|
+
}, function (props) {
|
|
856
|
+
return props.$isDot ? '8px' : '20px';
|
|
857
|
+
}, function (props) {
|
|
858
|
+
return props.$isDot ? '0' : '0 6px';
|
|
859
|
+
}, tokens.base.border.radius.circle, typography$3.caption, fontSize[1], color$4.background["default"], scaleIn, function (props) {
|
|
860
|
+
switch (props.$variant) {
|
|
861
|
+
case 'primary':
|
|
862
|
+
return "\n background-color: ".concat(color$4.background.interactive, ";\n color: ").concat(color$4.text.inverse, ";\n ");
|
|
863
|
+
case 'error':
|
|
864
|
+
return "\n background-color: ".concat(color$4.background.error, ";\n color: ").concat(color$4.text.inverse, ";\n ");
|
|
865
|
+
case 'warning':
|
|
866
|
+
return "\n background-color: ".concat(color$4.background.warning, ";\n color: ").concat(color$4.text.inverse, ";\n ");
|
|
867
|
+
case 'success':
|
|
868
|
+
return "\n background-color: ".concat(color$4.background.success, ";\n color: ").concat(color$4.text.inverse, ";\n ");
|
|
869
|
+
default:
|
|
870
|
+
return "\n background-color: ".concat(color$4.background.emphasis, ";\n color: ").concat(color$4.text.inverse, ";\n ");
|
|
871
|
+
}
|
|
872
|
+
});
|
|
873
|
+
var ScreenReaderOnly = styled.span.withConfig({
|
|
874
|
+
displayName: "Badge__ScreenReaderOnly",
|
|
875
|
+
componentId: "sc-tjz4pp-2"
|
|
876
|
+
})(templateObject_4$6 || (templateObject_4$6 = __makeTemplateObject(["\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n"], ["\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n"])));
|
|
877
|
+
var Badge = function Badge(_a) {
|
|
878
|
+
var children = _a.children,
|
|
879
|
+
_b = _a.count,
|
|
880
|
+
count = _b === void 0 ? 0 : _b,
|
|
881
|
+
_c = _a.max,
|
|
882
|
+
max = _c === void 0 ? 99 : _c,
|
|
883
|
+
_d = _a.variant,
|
|
884
|
+
variant = _d === void 0 ? 'default' : _d,
|
|
885
|
+
_e = _a.dot,
|
|
886
|
+
dot = _e === void 0 ? false : _e,
|
|
887
|
+
ariaLabel = _a["aria-label"],
|
|
888
|
+
className = _a.className;
|
|
889
|
+
var isVisible = dot || count > 0;
|
|
890
|
+
var displayCount = count > max ? "".concat(max, "+") : count.toString();
|
|
891
|
+
// Generate default aria-label if not provided
|
|
892
|
+
var defaultAriaLabel = dot ? 'New notification indicator' : count === 1 ? '1 notification' : "".concat(count, " notifications");
|
|
893
|
+
var label = ariaLabel || defaultAriaLabel;
|
|
894
|
+
return /*#__PURE__*/React.createElement(BadgeWrapper, {
|
|
895
|
+
className: className
|
|
896
|
+
}, children, /*#__PURE__*/React.createElement(BadgeIndicator, {
|
|
897
|
+
$variant: variant,
|
|
898
|
+
$isDot: dot,
|
|
899
|
+
$isVisible: isVisible,
|
|
900
|
+
role: "status",
|
|
901
|
+
"aria-live": "polite"
|
|
902
|
+
}, !dot && displayCount, /*#__PURE__*/React.createElement(ScreenReaderOnly, null, label)));
|
|
903
|
+
};
|
|
904
|
+
var templateObject_1$l, templateObject_2$a, templateObject_3$8, templateObject_4$6;
|
|
832
905
|
|
|
833
906
|
React.createElement;
|
|
834
907
|
var StyledBox = styled.div.withConfig({
|
|
@@ -1403,7 +1476,7 @@ var BaseChipStyled = styled.span.withConfig({
|
|
|
1403
1476
|
},
|
|
1404
1477
|
displayName: "ChipBase__BaseChipStyled",
|
|
1405
1478
|
componentId: "sc-moa6zc-0"
|
|
1406
|
-
})(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n height: max-content;\n border-radius: 12px;\n box-sizing: border-box;\n user-select: none;\n white-space: nowrap;\n transition: ", ";\n \n /* Use CSS custom properties set by wrapper */\n background-color: var(--chip-bg-color);\n color: var(--chip-text-color);\n font: var(--chip-font);\n padding: var(--chip-padding);\n opacity: var(--chip-opacity, 1);\n cursor: var(--chip-cursor, default);\n \n &:hover {\n opacity: var(--chip-hover-opacity, var(--chip-opacity, 1));\n }\n \n &:active {\n opacity: var(--chip-active-opacity, var(--chip-opacity, 1));\n }\n \n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n height: max-content;\n border-radius: 12px;\n box-sizing: border-box;\n user-select: none;\n white-space: nowrap;\n transition: ", ";\n \n /* Use CSS custom properties set by wrapper */\n background-color: var(--chip-bg-color);\n color: var(--chip-text-color);\n font: var(--chip-font);\n padding: var(--chip-padding);\n opacity: var(--chip-opacity, 1);\n cursor: var(--chip-cursor, default);\n \n &:hover {\n opacity: var(--chip-hover-opacity, var(--chip-opacity, 1));\n }\n \n &:active {\n opacity: var(--chip-active-opacity, var(--chip-opacity, 1));\n }\n \n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n }\n"
|
|
1479
|
+
})(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n height: max-content;\n border-radius: 12px;\n box-sizing: border-box;\n user-select: none;\n white-space: nowrap;\n transition: width ", ";\n \n /* Use CSS custom properties set by wrapper */\n background-color: var(--chip-bg-color);\n color: var(--chip-text-color);\n font: var(--chip-font);\n padding: var(--chip-padding);\n opacity: var(--chip-opacity, 1);\n cursor: var(--chip-cursor, default);\n \n &:hover {\n opacity: var(--chip-hover-opacity, var(--chip-opacity, 1));\n }\n \n &:active {\n opacity: var(--chip-active-opacity, var(--chip-opacity, 1));\n }\n \n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n height: max-content;\n border-radius: 12px;\n box-sizing: border-box;\n user-select: none;\n white-space: nowrap;\n transition: width ", ";\n \n /* Use CSS custom properties set by wrapper */\n background-color: var(--chip-bg-color);\n color: var(--chip-text-color);\n font: var(--chip-font);\n padding: var(--chip-padding);\n opacity: var(--chip-opacity, 1);\n cursor: var(--chip-cursor, default);\n \n &:hover {\n opacity: var(--chip-hover-opacity, var(--chip-opacity, 1));\n }\n \n &:active {\n opacity: var(--chip-active-opacity, var(--chip-opacity, 1));\n }\n \n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n }\n"
|
|
1407
1480
|
// Icon container for selected indicator or leading icons
|
|
1408
1481
|
])), tokens.semantic.motion.interactive, chip.variants.interactive.backgroundColor);
|
|
1409
1482
|
// Icon container for selected indicator or leading icons
|
|
@@ -3036,5 +3109,5 @@ var ResponsiveGrid = function ResponsiveGrid(_a) {
|
|
|
3036
3109
|
};
|
|
3037
3110
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31, templateObject_32, templateObject_33, templateObject_34, templateObject_35;
|
|
3038
3111
|
|
|
3039
|
-
export { ArtCard, Avatar, BooleanChip, Box, Breadcrumbs, Button, Chip, ChipGroup, CodeBlock, Container, DateFormatter, DesignCard, Divider, Dropdown, FilterChip, Grid, GridCol, Icon, IconButton, LegacyChip, PageTitle, Picture, ProgressBar, ReleaseCard, ResponsiveGrid, Stack, Typography, iconsData, tokens };
|
|
3112
|
+
export { ArtCard, Avatar, Badge, BooleanChip, Box, Breadcrumbs, Button, Chip, ChipGroup, CodeBlock, Container, DateFormatter, DesignCard, Divider, Dropdown, FilterChip, Grid, GridCol, Icon, IconButton, LegacyChip, PageTitle, Picture, ProgressBar, ReleaseCard, ResponsiveGrid, Stack, Typography, iconsData, tokens };
|
|
3040
3113
|
//# sourceMappingURL=index.esm.js.map
|