@common-origin/design-system 1.5.0 → 1.6.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/components/atoms/Chip/BooleanChip.d.ts +23 -0
- package/dist/components/atoms/Chip/Chip.d.ts +22 -9
- package/dist/components/atoms/Chip/FilterChip.d.ts +27 -0
- package/dist/components/atoms/Chip/index.d.ts +2 -0
- package/dist/components/atoms/Chip/shared/ChipBase.d.ts +8 -0
- package/dist/components/atoms/Chip/shared/types.d.ts +18 -0
- package/dist/components/atoms/Chip/shared/utils.d.ts +47 -0
- package/dist/index.esm.js +229 -45
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +230 -44
- package/dist/index.js.map +1 -1
- package/dist/types/icons.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/atoms/CoverImage/CoverImage.d.ts +0 -11
- package/dist/components/atoms/CoverImage/index.d.ts +0 -1
- package/dist/components/dateFormatter.d.ts +0 -7
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseChipProps } from './shared/types';
|
|
3
|
+
export interface BooleanChipProps extends BaseChipProps {
|
|
4
|
+
/** Whether the chip is in selected state */
|
|
5
|
+
selected: boolean;
|
|
6
|
+
/** Callback function when the chip is clicked/toggled */
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* BooleanChip - Toggleable chip for quick filter controls
|
|
11
|
+
*
|
|
12
|
+
* Use this component for multi-select filter controls where users can
|
|
13
|
+
* see which options are active. Common in table filtering patterns where
|
|
14
|
+
* users toggle filters on/off.
|
|
15
|
+
*
|
|
16
|
+
* Features:
|
|
17
|
+
* - Shows checkmark icon when selected
|
|
18
|
+
* - Entire chip is clickable to toggle
|
|
19
|
+
* - Keyboard activation with Space or Enter
|
|
20
|
+
* - Uses checkbox role with aria-checked
|
|
21
|
+
* - Visual background change when selected
|
|
22
|
+
*/
|
|
23
|
+
export declare const BooleanChip: React.FC<BooleanChipProps>;
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { BaseChipProps, ChipVariant, LegacyVariant } from './shared/types';
|
|
3
|
+
export interface ChipProps extends BaseChipProps {
|
|
4
|
+
/** Visual style variant */
|
|
5
|
+
variant?: ChipVariant | LegacyVariant;
|
|
6
|
+
/** Click handler for interactive chips */
|
|
6
7
|
onClick?: () => void;
|
|
7
|
-
|
|
8
|
-
'data-testid'?: string;
|
|
9
|
-
'aria-label'?: string;
|
|
10
|
-
'aria-describedby'?: string;
|
|
8
|
+
/** Custom ARIA role override */
|
|
11
9
|
role?: string;
|
|
10
|
+
/** Legacy title prop for backward compatibility */
|
|
12
11
|
title?: string;
|
|
13
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Chip - Compact element for displaying tags, categories, and labels
|
|
15
|
+
*
|
|
16
|
+
* Use this component for static display chips or simple interactive chips.
|
|
17
|
+
* For specialized filtering patterns, use:
|
|
18
|
+
* - FilterChip: Dismissible chips for showing applied filters
|
|
19
|
+
* - BooleanChip: Toggleable chips for quick filter controls
|
|
20
|
+
*
|
|
21
|
+
* Variants:
|
|
22
|
+
* - default: Standard gray background
|
|
23
|
+
* - emphasis: High-contrast dark background
|
|
24
|
+
* - subtle: Light background for secondary info
|
|
25
|
+
* - interactive: Blue background with hover states
|
|
26
|
+
*/
|
|
14
27
|
export declare const Chip: React.FC<ChipProps>;
|
|
15
28
|
export interface LegacyChipProps {
|
|
16
29
|
title: string;
|
|
17
|
-
variant?:
|
|
30
|
+
variant?: LegacyVariant;
|
|
18
31
|
}
|
|
19
32
|
export declare const LegacyChip: React.FC<LegacyChipProps>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BaseChipProps } from './shared/types';
|
|
3
|
+
export interface FilterChipProps extends BaseChipProps {
|
|
4
|
+
/** Whether the filter is in selected/applied state */
|
|
5
|
+
selected?: boolean;
|
|
6
|
+
/** Callback function when the chip is dismissed via close button or keyboard */
|
|
7
|
+
onDismiss?: () => void;
|
|
8
|
+
/** Custom ARIA role override */
|
|
9
|
+
role?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* FilterChip - Chip for displaying filters with selected state and optional dismissal
|
|
13
|
+
*
|
|
14
|
+
* Use this component to show filters that can be selected/deselected.
|
|
15
|
+
* When selected, displays a checkmark and light blue background.
|
|
16
|
+
* Optionally dismissible when onDismiss is provided.
|
|
17
|
+
*
|
|
18
|
+
* Features:
|
|
19
|
+
* - Shows checkmark icon when selected
|
|
20
|
+
* - Light blue background when selected
|
|
21
|
+
* - Optional close (×) button when onDismiss is provided
|
|
22
|
+
* - Keyboard dismissal with Delete or Backspace keys (when dismissible)
|
|
23
|
+
* - Non-clickable body (only close button is interactive when present)
|
|
24
|
+
* - Uses subtle/interactive background styling based on selected state
|
|
25
|
+
* - Announces as "status" to screen readers
|
|
26
|
+
*/
|
|
27
|
+
export declare const FilterChip: React.FC<FilterChipProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { InternalStyledProps } from './types';
|
|
3
|
+
export declare const BaseChipStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
4
|
+
export declare const IconContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
5
|
+
export declare const CloseButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
6
|
+
$disabled?: boolean | undefined;
|
|
7
|
+
}>> & string;
|
|
8
|
+
export declare const StyledChipWrapper: React.FC<React.PropsWithChildren<InternalStyledProps & React.HTMLAttributes<HTMLSpanElement>>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface BaseChipProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
size?: 'small' | 'medium';
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
'data-testid'?: string;
|
|
7
|
+
'aria-label'?: string;
|
|
8
|
+
'aria-describedby'?: string;
|
|
9
|
+
}
|
|
10
|
+
export type ChipVariant = 'default' | 'emphasis' | 'subtle' | 'interactive';
|
|
11
|
+
export interface InternalStyledProps {
|
|
12
|
+
$variant: ChipVariant;
|
|
13
|
+
$size: BaseChipProps['size'];
|
|
14
|
+
$disabled?: boolean;
|
|
15
|
+
$clickable?: boolean;
|
|
16
|
+
$selected?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export type LegacyVariant = 'light' | 'dark';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ChipVariant, BaseChipProps } from './types';
|
|
2
|
+
declare const chip: {
|
|
3
|
+
default: {
|
|
4
|
+
backgroundColor: string;
|
|
5
|
+
textColor: string;
|
|
6
|
+
borderRadius: string;
|
|
7
|
+
padding: string;
|
|
8
|
+
font: string;
|
|
9
|
+
};
|
|
10
|
+
variants: {
|
|
11
|
+
emphasis: {
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
textColor: string;
|
|
14
|
+
};
|
|
15
|
+
subtle: {
|
|
16
|
+
backgroundColor: string;
|
|
17
|
+
textColor: string;
|
|
18
|
+
};
|
|
19
|
+
interactive: {
|
|
20
|
+
backgroundColor: string;
|
|
21
|
+
textColor: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
sizes: {
|
|
25
|
+
small: {
|
|
26
|
+
padding: string;
|
|
27
|
+
font: string;
|
|
28
|
+
};
|
|
29
|
+
medium: {
|
|
30
|
+
padding: string;
|
|
31
|
+
font: string;
|
|
32
|
+
};
|
|
33
|
+
large: {
|
|
34
|
+
padding: string;
|
|
35
|
+
font: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare const getVariantStylesAsObject: (variant: ChipVariant, selected?: boolean) => {
|
|
40
|
+
backgroundColor: string;
|
|
41
|
+
color: string;
|
|
42
|
+
};
|
|
43
|
+
export declare const getSizeStylesAsObject: (size: BaseChipProps['size']) => {
|
|
44
|
+
font: string;
|
|
45
|
+
padding: string;
|
|
46
|
+
};
|
|
47
|
+
export { chip as chipTokens };
|
package/dist/index.esm.js
CHANGED
|
@@ -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$a || (templateObject_2$a = __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$8 || (templateObject_3$8 = __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,7 @@ var Avatar = function Avatar(_a) {
|
|
|
828
828
|
"aria-hidden": "true"
|
|
829
829
|
}, initials));
|
|
830
830
|
};
|
|
831
|
-
var templateObject_1$l, templateObject_2$
|
|
831
|
+
var templateObject_1$l, templateObject_2$a, templateObject_3$8;
|
|
832
832
|
|
|
833
833
|
React.createElement;
|
|
834
834
|
var StyledBox = styled.div.withConfig({
|
|
@@ -842,9 +842,9 @@ var StyledBox = styled.div.withConfig({
|
|
|
842
842
|
])), function (props) {
|
|
843
843
|
return props.$display && css(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["display: ", ";"], ["display: ", ";"])), props.$display);
|
|
844
844
|
}, function (props) {
|
|
845
|
-
return props.$flexDirection && css(templateObject_2$
|
|
845
|
+
return props.$flexDirection && css(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["flex-direction: ", ";"], ["flex-direction: ", ";"])), props.$flexDirection);
|
|
846
846
|
}, function (props) {
|
|
847
|
-
return props.$justifyContent && css(templateObject_3$
|
|
847
|
+
return props.$justifyContent && css(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["justify-content: ", ";"], ["justify-content: ", ";"])), props.$justifyContent);
|
|
848
848
|
}, function (props) {
|
|
849
849
|
return props.$alignItems && css(templateObject_4$5 || (templateObject_4$5 = __makeTemplateObject(["align-items: ", ";"], ["align-items: ", ";"])), props.$alignItems);
|
|
850
850
|
}, function (props) {
|
|
@@ -1030,7 +1030,7 @@ var BoxTransform = function BoxTransform(props) {
|
|
|
1030
1030
|
}, rest), children);
|
|
1031
1031
|
};
|
|
1032
1032
|
var Box = BoxTransform;
|
|
1033
|
-
var templateObject_1$k, templateObject_2$
|
|
1033
|
+
var templateObject_1$k, templateObject_2$9, templateObject_3$7, templateObject_4$5, templateObject_5$4, templateObject_6$2, templateObject_7$2, templateObject_8$1, templateObject_9$1, templateObject_10$1, templateObject_11$1, templateObject_12$1, templateObject_13$1, 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;
|
|
1034
1034
|
|
|
1035
1035
|
var add = {
|
|
1036
1036
|
path: "M13 11H19V13H13V19H11V13H5V11H11V5H13V11Z",
|
|
@@ -1060,6 +1060,10 @@ var caret = {
|
|
|
1060
1060
|
path: "m14.77 11.808-4.458-3.715A.8.8 0 0 0 9 8.708v6.584a.8.8 0 0 0 1.312.614l4.458-3.714a.25.25 0 0 0 0-.384Z",
|
|
1061
1061
|
name: "caret"
|
|
1062
1062
|
};
|
|
1063
|
+
var check = {
|
|
1064
|
+
path: "M9.16699 18.375L4.40039 14.7998L5.59961 13.2002L8.83301 15.625L17.2256 5.36719L18.7744 6.63281L9.16699 18.375Z",
|
|
1065
|
+
name: "check"
|
|
1066
|
+
};
|
|
1063
1067
|
var close = {
|
|
1064
1068
|
path: "M19.4141 6L13.4141 12L19.4141 18L18 19.4141L12 13.4141L6 19.4141L4.58594 18L10.5859 12L4.58594 6L6 4.58594L12 10.5859L18 4.58594L19.4141 6Z",
|
|
1065
1069
|
name: "close"
|
|
@@ -1112,6 +1116,7 @@ var iconsData = {
|
|
|
1112
1116
|
arrowRight: arrowRight,
|
|
1113
1117
|
back: back,
|
|
1114
1118
|
caret: caret,
|
|
1119
|
+
check: check,
|
|
1115
1120
|
close: close,
|
|
1116
1121
|
directionRight: directionRight,
|
|
1117
1122
|
menu: menu,
|
|
@@ -1235,7 +1240,7 @@ var StyledLink = styled.a.withConfig({
|
|
|
1235
1240
|
},
|
|
1236
1241
|
displayName: "Button__StyledLink",
|
|
1237
1242
|
componentId: "sc-1eiuum9-1"
|
|
1238
|
-
})(templateObject_2$
|
|
1243
|
+
})(templateObject_2$8 || (templateObject_2$8 = __makeTemplateObject(["\n ", "\n border-radius: ", ";\n \n ", "\n ", "\n"], ["\n ", "\n border-radius: ", ";\n \n ", "\n ", "\n"
|
|
1239
1244
|
// Helper function to get icon size based on button size
|
|
1240
1245
|
])), baseButtonStyles, button.primary.borderRadius, getVariantStyles, getSizeStyles);
|
|
1241
1246
|
// Helper function to get icon size based on button size
|
|
@@ -1328,12 +1333,18 @@ var Button = function Button(_a) {
|
|
|
1328
1333
|
"data-testid": dataTestId
|
|
1329
1334
|
}, buttonProps), renderButtonContent(children, iconName, size));
|
|
1330
1335
|
};
|
|
1331
|
-
var templateObject_1$i, templateObject_2$
|
|
1336
|
+
var templateObject_1$i, templateObject_2$8;
|
|
1332
1337
|
|
|
1333
|
-
React.createElement;
|
|
1334
1338
|
var chip = tokens.component.chip;
|
|
1335
|
-
// Helper
|
|
1336
|
-
var getVariantStylesAsObject = function getVariantStylesAsObject(variant) {
|
|
1339
|
+
// Helper function to get variant styles as objects for CSS custom properties
|
|
1340
|
+
var getVariantStylesAsObject = function getVariantStylesAsObject(variant, selected) {
|
|
1341
|
+
// Boolean chips with selected state get special background
|
|
1342
|
+
if (selected) {
|
|
1343
|
+
return {
|
|
1344
|
+
backgroundColor: tokens.semantic.color.background['interactive-subtle'],
|
|
1345
|
+
color: chip["default"].textColor
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1337
1348
|
switch (variant) {
|
|
1338
1349
|
case 'emphasis':
|
|
1339
1350
|
return {
|
|
@@ -1358,6 +1369,7 @@ var getVariantStylesAsObject = function getVariantStylesAsObject(variant) {
|
|
|
1358
1369
|
};
|
|
1359
1370
|
}
|
|
1360
1371
|
};
|
|
1372
|
+
// Helper function to get size styles as objects for CSS custom properties
|
|
1361
1373
|
var getSizeStylesAsObject = function getSizeStylesAsObject(size) {
|
|
1362
1374
|
switch (size) {
|
|
1363
1375
|
case 'small':
|
|
@@ -1365,11 +1377,6 @@ var getSizeStylesAsObject = function getSizeStylesAsObject(size) {
|
|
|
1365
1377
|
font: chip.sizes.small.font,
|
|
1366
1378
|
padding: chip.sizes.small.padding
|
|
1367
1379
|
};
|
|
1368
|
-
case 'large':
|
|
1369
|
-
return {
|
|
1370
|
-
font: chip.sizes.large.font,
|
|
1371
|
-
padding: chip.sizes.large.padding
|
|
1372
|
-
};
|
|
1373
1380
|
case 'medium':
|
|
1374
1381
|
default:
|
|
1375
1382
|
return {
|
|
@@ -1378,27 +1385,51 @@ var getSizeStylesAsObject = function getSizeStylesAsObject(size) {
|
|
|
1378
1385
|
};
|
|
1379
1386
|
}
|
|
1380
1387
|
};
|
|
1388
|
+
|
|
1389
|
+
React.createElement;
|
|
1381
1390
|
// Base styled component using CSS variables to avoid prop leaking
|
|
1382
|
-
var
|
|
1391
|
+
var BaseChipStyled = styled.span.withConfig({
|
|
1383
1392
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
1384
1393
|
return !prop.startsWith('$');
|
|
1385
1394
|
},
|
|
1386
|
-
displayName: "
|
|
1387
|
-
componentId: "sc-
|
|
1395
|
+
displayName: "ChipBase__BaseChipStyled",
|
|
1396
|
+
componentId: "sc-moa6zc-0"
|
|
1388
1397
|
})(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: ", ";\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: ", ";\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"
|
|
1389
|
-
//
|
|
1398
|
+
// Icon container for selected indicator or leading icons
|
|
1390
1399
|
])), chip["default"].borderRadius, tokens.semantic.motion.interactive, chip.variants.interactive.backgroundColor);
|
|
1400
|
+
// Icon container for selected indicator or leading icons
|
|
1401
|
+
var IconContainer = styled.span.withConfig({
|
|
1402
|
+
displayName: "ChipBase__IconContainer",
|
|
1403
|
+
componentId: "sc-moa6zc-1"
|
|
1404
|
+
})(templateObject_2$7 || (templateObject_2$7 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n margin-right: ", ";\n"], ["\n display: inline-flex;\n align-items: center;\n margin-right: ", ";\n"
|
|
1405
|
+
// Close button for dismissible chips
|
|
1406
|
+
])), tokens.semantic.spacing.layout.sm);
|
|
1407
|
+
// Close button for dismissible chips
|
|
1408
|
+
var CloseButton = styled.button.withConfig({
|
|
1409
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
1410
|
+
return !prop.startsWith('$');
|
|
1411
|
+
},
|
|
1412
|
+
displayName: "ChipBase__CloseButton",
|
|
1413
|
+
componentId: "sc-moa6zc-2"
|
|
1414
|
+
})(templateObject_3$6 || (templateObject_3$6 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: ", ";\n background: transparent;\n border: none;\n padding: 0;\n cursor: ", ";\n opacity: ", ";\n color: inherit;\n transition: ", ";\n \n &:hover:not(:disabled) {\n opacity: 0.7;\n }\n \n &:active:not(:disabled) {\n opacity: 0.9;\n }\n \n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n border-radius: 2px;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n margin-left: ", ";\n background: transparent;\n border: none;\n padding: 0;\n cursor: ", ";\n opacity: ", ";\n color: inherit;\n transition: ", ";\n \n &:hover:not(:disabled) {\n opacity: 0.7;\n }\n \n &:active:not(:disabled) {\n opacity: 0.9;\n }\n \n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: 2px;\n border-radius: 2px;\n }\n"
|
|
1391
1415
|
// Wrapper component that applies styles via CSS custom properties
|
|
1392
|
-
|
|
1416
|
+
])), tokens.semantic.spacing.layout.sm, function (props) {
|
|
1417
|
+
return props.$disabled ? 'not-allowed' : 'pointer';
|
|
1418
|
+
}, function (props) {
|
|
1419
|
+
return props.$disabled ? '0.6' : '1';
|
|
1420
|
+
}, tokens.semantic.motion.transition.fast, chip.variants.interactive.backgroundColor);
|
|
1421
|
+
// Wrapper component that applies styles via CSS custom properties
|
|
1422
|
+
var StyledChipWrapper = function StyledChipWrapper(_a) {
|
|
1393
1423
|
var $variant = _a.$variant,
|
|
1394
1424
|
$size = _a.$size,
|
|
1395
1425
|
$disabled = _a.$disabled,
|
|
1396
1426
|
$clickable = _a.$clickable,
|
|
1427
|
+
$selected = _a.$selected,
|
|
1397
1428
|
children = _a.children,
|
|
1398
1429
|
style = _a.style,
|
|
1399
|
-
htmlProps = __rest(_a, ["$variant", "$size", "$disabled", "$clickable", "children", "style"]);
|
|
1430
|
+
htmlProps = __rest(_a, ["$variant", "$size", "$disabled", "$clickable", "$selected", "children", "style"]);
|
|
1400
1431
|
// Get styles for variant and size
|
|
1401
|
-
var variantStyles = getVariantStylesAsObject($variant);
|
|
1432
|
+
var variantStyles = getVariantStylesAsObject($variant, $selected);
|
|
1402
1433
|
var sizeStyles = getSizeStylesAsObject($size);
|
|
1403
1434
|
// Create CSS custom properties object
|
|
1404
1435
|
var cssProps = {
|
|
@@ -1411,38 +1442,47 @@ var StyledChip = function StyledChip(_a) {
|
|
|
1411
1442
|
'--chip-hover-opacity': $disabled ? '0.6' : $clickable ? '0.8' : '1',
|
|
1412
1443
|
'--chip-active-opacity': $disabled ? '0.6' : $clickable ? '0.9' : '1'
|
|
1413
1444
|
};
|
|
1414
|
-
return /*#__PURE__*/React.createElement(
|
|
1445
|
+
return /*#__PURE__*/React.createElement(BaseChipStyled, _extends({
|
|
1415
1446
|
style: __assign(__assign({}, cssProps), style)
|
|
1416
1447
|
}, htmlProps), children);
|
|
1417
1448
|
};
|
|
1449
|
+
var templateObject_1$h, templateObject_2$7, templateObject_3$6;
|
|
1450
|
+
|
|
1451
|
+
React.createElement;
|
|
1452
|
+
/**
|
|
1453
|
+
* Chip - Compact element for displaying tags, categories, and labels
|
|
1454
|
+
*
|
|
1455
|
+
* Use this component for static display chips or simple interactive chips.
|
|
1456
|
+
* For specialized filtering patterns, use:
|
|
1457
|
+
* - FilterChip: Dismissible chips for showing applied filters
|
|
1458
|
+
* - BooleanChip: Toggleable chips for quick filter controls
|
|
1459
|
+
*
|
|
1460
|
+
* Variants:
|
|
1461
|
+
* - default: Standard gray background
|
|
1462
|
+
* - emphasis: High-contrast dark background
|
|
1463
|
+
* - subtle: Light background for secondary info
|
|
1464
|
+
* - interactive: Blue background with hover states
|
|
1465
|
+
*/
|
|
1418
1466
|
var Chip = function Chip(_a) {
|
|
1419
1467
|
var children = _a.children,
|
|
1420
1468
|
_b = _a.variant,
|
|
1421
1469
|
variant = _b === void 0 ? 'default' : _b,
|
|
1422
|
-
|
|
1423
|
-
size =
|
|
1470
|
+
_c = _a.size,
|
|
1471
|
+
size = _c === void 0 ? 'medium' : _c,
|
|
1424
1472
|
onClick = _a.onClick,
|
|
1425
|
-
|
|
1426
|
-
disabled =
|
|
1473
|
+
_d = _a.disabled,
|
|
1474
|
+
disabled = _d === void 0 ? false : _d,
|
|
1427
1475
|
dataTestId = _a["data-testid"],
|
|
1428
1476
|
ariaLabel = _a["aria-label"],
|
|
1429
1477
|
ariaDescribedBy = _a["aria-describedby"],
|
|
1430
1478
|
role = _a.role,
|
|
1431
1479
|
title = _a.title,
|
|
1432
|
-
// Legacy prop support
|
|
1433
1480
|
props = __rest(_a, ["children", "variant", "size", "onClick", "disabled", 'data-testid', 'aria-label', 'aria-describedby', "role", "title"]);
|
|
1434
1481
|
var isClickable = Boolean(onClick && !disabled);
|
|
1435
|
-
// Map legacy variants to new variants
|
|
1482
|
+
// Map legacy variants to new variants
|
|
1436
1483
|
var normalizedVariant = variant === 'light' ? 'default' : variant === 'dark' ? 'emphasis' : variant;
|
|
1437
|
-
// Support legacy title prop
|
|
1484
|
+
// Support legacy title prop
|
|
1438
1485
|
var content = children !== undefined ? children : title;
|
|
1439
|
-
// Remove styled-only props from the rest
|
|
1440
|
-
var _g = props;
|
|
1441
|
-
_g.variant;
|
|
1442
|
-
_g.size;
|
|
1443
|
-
_g.disabled;
|
|
1444
|
-
_g.clickable;
|
|
1445
|
-
var htmlProps = __rest(_g, ["variant", "size", "disabled", "clickable"]);
|
|
1446
1486
|
var handleClick = function handleClick() {
|
|
1447
1487
|
if (onClick && !disabled) {
|
|
1448
1488
|
onClick();
|
|
@@ -1454,33 +1494,177 @@ var Chip = function Chip(_a) {
|
|
|
1454
1494
|
handleClick();
|
|
1455
1495
|
}
|
|
1456
1496
|
};
|
|
1457
|
-
return /*#__PURE__*/React.createElement(
|
|
1497
|
+
return /*#__PURE__*/React.createElement(StyledChipWrapper, _extends({
|
|
1458
1498
|
$variant: normalizedVariant,
|
|
1459
1499
|
$size: size,
|
|
1460
1500
|
$disabled: disabled || undefined,
|
|
1461
1501
|
$clickable: isClickable || undefined,
|
|
1462
1502
|
onClick: isClickable ? handleClick : undefined,
|
|
1463
|
-
onKeyDown:
|
|
1503
|
+
onKeyDown: handleKeyDown,
|
|
1464
1504
|
tabIndex: isClickable ? 0 : undefined,
|
|
1465
1505
|
role: role || (isClickable ? 'button' : undefined),
|
|
1466
1506
|
"aria-label": ariaLabel,
|
|
1467
1507
|
"aria-describedby": ariaDescribedBy,
|
|
1468
1508
|
"aria-disabled": disabled ? 'true' : undefined,
|
|
1469
1509
|
"data-testid": dataTestId
|
|
1470
|
-
},
|
|
1510
|
+
}, props), content);
|
|
1471
1511
|
};
|
|
1472
|
-
// Legacy component for backward compatibility
|
|
1473
1512
|
var LegacyChip = function LegacyChip(_a) {
|
|
1474
1513
|
var title = _a.title,
|
|
1475
1514
|
_b = _a.variant,
|
|
1476
1515
|
variant = _b === void 0 ? 'light' : _b;
|
|
1477
|
-
// Map legacy variants to new variants
|
|
1478
1516
|
var newVariant = variant === 'dark' ? 'emphasis' : 'default';
|
|
1479
1517
|
return /*#__PURE__*/React.createElement(Chip, {
|
|
1480
1518
|
variant: newVariant
|
|
1481
1519
|
}, title);
|
|
1482
1520
|
};
|
|
1483
|
-
|
|
1521
|
+
|
|
1522
|
+
React.createElement;
|
|
1523
|
+
/**
|
|
1524
|
+
* FilterChip - Chip for displaying filters with selected state and optional dismissal
|
|
1525
|
+
*
|
|
1526
|
+
* Use this component to show filters that can be selected/deselected.
|
|
1527
|
+
* When selected, displays a checkmark and light blue background.
|
|
1528
|
+
* Optionally dismissible when onDismiss is provided.
|
|
1529
|
+
*
|
|
1530
|
+
* Features:
|
|
1531
|
+
* - Shows checkmark icon when selected
|
|
1532
|
+
* - Light blue background when selected
|
|
1533
|
+
* - Optional close (×) button when onDismiss is provided
|
|
1534
|
+
* - Keyboard dismissal with Delete or Backspace keys (when dismissible)
|
|
1535
|
+
* - Non-clickable body (only close button is interactive when present)
|
|
1536
|
+
* - Uses subtle/interactive background styling based on selected state
|
|
1537
|
+
* - Announces as "status" to screen readers
|
|
1538
|
+
*/
|
|
1539
|
+
var FilterChip = function FilterChip(_a) {
|
|
1540
|
+
var children = _a.children,
|
|
1541
|
+
_b = _a.selected,
|
|
1542
|
+
selected = _b === void 0 ? false : _b,
|
|
1543
|
+
onDismiss = _a.onDismiss,
|
|
1544
|
+
_c = _a.size,
|
|
1545
|
+
size = _c === void 0 ? 'medium' : _c,
|
|
1546
|
+
_d = _a.disabled,
|
|
1547
|
+
disabled = _d === void 0 ? false : _d,
|
|
1548
|
+
dataTestId = _a["data-testid"],
|
|
1549
|
+
ariaLabel = _a["aria-label"],
|
|
1550
|
+
ariaDescribedBy = _a["aria-describedby"],
|
|
1551
|
+
role = _a.role,
|
|
1552
|
+
props = __rest(_a, ["children", "selected", "onDismiss", "size", "disabled", 'data-testid', 'aria-label', 'aria-describedby', "role"]);
|
|
1553
|
+
var isDismissible = Boolean(onDismiss);
|
|
1554
|
+
var handleDismiss = function handleDismiss(event) {
|
|
1555
|
+
event.stopPropagation(); // Prevent event bubbling
|
|
1556
|
+
if (!disabled && onDismiss) {
|
|
1557
|
+
onDismiss();
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
1561
|
+
// Handle dismiss with Delete or Backspace (only when dismissible)
|
|
1562
|
+
if (!disabled && isDismissible && onDismiss && (event.key === 'Delete' || event.key === 'Backspace')) {
|
|
1563
|
+
event.preventDefault();
|
|
1564
|
+
onDismiss();
|
|
1565
|
+
}
|
|
1566
|
+
};
|
|
1567
|
+
var handleCloseKeyDown = function handleCloseKeyDown(event) {
|
|
1568
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
1569
|
+
event.preventDefault();
|
|
1570
|
+
if (!disabled && onDismiss) onDismiss();
|
|
1571
|
+
}
|
|
1572
|
+
};
|
|
1573
|
+
// Generate accessible label for close button
|
|
1574
|
+
var closeButtonLabel = typeof children === 'string' ? "Remove ".concat(children) : 'Remove filter';
|
|
1575
|
+
return /*#__PURE__*/React.createElement(StyledChipWrapper, _extends({
|
|
1576
|
+
$variant: "subtle",
|
|
1577
|
+
$size: size,
|
|
1578
|
+
$disabled: disabled || undefined,
|
|
1579
|
+
$clickable: false,
|
|
1580
|
+
$selected: selected,
|
|
1581
|
+
onKeyDown: handleKeyDown,
|
|
1582
|
+
role: role || 'status',
|
|
1583
|
+
"aria-label": ariaLabel,
|
|
1584
|
+
"aria-describedby": ariaDescribedBy,
|
|
1585
|
+
"aria-disabled": disabled ? 'true' : undefined,
|
|
1586
|
+
"data-testid": dataTestId
|
|
1587
|
+
}, props), selected && /*#__PURE__*/React.createElement(IconContainer, {
|
|
1588
|
+
"aria-hidden": "true"
|
|
1589
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
1590
|
+
name: "check",
|
|
1591
|
+
size: "sm"
|
|
1592
|
+
})), children, isDismissible && /*#__PURE__*/React.createElement(CloseButton, {
|
|
1593
|
+
type: "button",
|
|
1594
|
+
onClick: handleDismiss,
|
|
1595
|
+
onKeyDown: handleCloseKeyDown,
|
|
1596
|
+
disabled: disabled,
|
|
1597
|
+
$disabled: disabled,
|
|
1598
|
+
"aria-label": closeButtonLabel,
|
|
1599
|
+
tabIndex: 0,
|
|
1600
|
+
"data-testid": dataTestId ? "".concat(dataTestId, "-close") : undefined
|
|
1601
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
1602
|
+
name: "close",
|
|
1603
|
+
size: "sm"
|
|
1604
|
+
})));
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
React.createElement;
|
|
1608
|
+
/**
|
|
1609
|
+
* BooleanChip - Toggleable chip for quick filter controls
|
|
1610
|
+
*
|
|
1611
|
+
* Use this component for multi-select filter controls where users can
|
|
1612
|
+
* see which options are active. Common in table filtering patterns where
|
|
1613
|
+
* users toggle filters on/off.
|
|
1614
|
+
*
|
|
1615
|
+
* Features:
|
|
1616
|
+
* - Shows checkmark icon when selected
|
|
1617
|
+
* - Entire chip is clickable to toggle
|
|
1618
|
+
* - Keyboard activation with Space or Enter
|
|
1619
|
+
* - Uses checkbox role with aria-checked
|
|
1620
|
+
* - Visual background change when selected
|
|
1621
|
+
*/
|
|
1622
|
+
var BooleanChip = function BooleanChip(_a) {
|
|
1623
|
+
var children = _a.children,
|
|
1624
|
+
selected = _a.selected,
|
|
1625
|
+
onClick = _a.onClick,
|
|
1626
|
+
_b = _a.size,
|
|
1627
|
+
size = _b === void 0 ? 'medium' : _b,
|
|
1628
|
+
_c = _a.disabled,
|
|
1629
|
+
disabled = _c === void 0 ? false : _c,
|
|
1630
|
+
dataTestId = _a["data-testid"],
|
|
1631
|
+
ariaLabel = _a["aria-label"],
|
|
1632
|
+
ariaDescribedBy = _a["aria-describedby"],
|
|
1633
|
+
props = __rest(_a, ["children", "selected", "onClick", "size", "disabled", 'data-testid', 'aria-label', 'aria-describedby']);
|
|
1634
|
+
var handleClick = function handleClick() {
|
|
1635
|
+
if (!disabled) {
|
|
1636
|
+
onClick();
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
1640
|
+
// Handle activation with Space or Enter
|
|
1641
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
1642
|
+
event.preventDefault();
|
|
1643
|
+
handleClick();
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
return /*#__PURE__*/React.createElement(StyledChipWrapper, _extends({
|
|
1647
|
+
$variant: "subtle",
|
|
1648
|
+
$size: size,
|
|
1649
|
+
$disabled: disabled || undefined,
|
|
1650
|
+
$clickable: !disabled,
|
|
1651
|
+
$selected: selected,
|
|
1652
|
+
onClick: handleClick,
|
|
1653
|
+
onKeyDown: handleKeyDown,
|
|
1654
|
+
tabIndex: disabled ? undefined : 0,
|
|
1655
|
+
role: "checkbox",
|
|
1656
|
+
"aria-checked": selected ? 'true' : 'false',
|
|
1657
|
+
"aria-label": ariaLabel,
|
|
1658
|
+
"aria-describedby": ariaDescribedBy,
|
|
1659
|
+
"aria-disabled": disabled ? 'true' : undefined,
|
|
1660
|
+
"data-testid": dataTestId
|
|
1661
|
+
}, props), selected && /*#__PURE__*/React.createElement(IconContainer, {
|
|
1662
|
+
"aria-hidden": "true"
|
|
1663
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
1664
|
+
name: "check",
|
|
1665
|
+
size: "sm"
|
|
1666
|
+
})), children);
|
|
1667
|
+
};
|
|
1484
1668
|
|
|
1485
1669
|
// Breakpoints using base tokens
|
|
1486
1670
|
var breakpoints$1 = {
|
|
@@ -2809,5 +2993,5 @@ var ResponsiveGrid = function ResponsiveGrid(_a) {
|
|
|
2809
2993
|
};
|
|
2810
2994
|
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;
|
|
2811
2995
|
|
|
2812
|
-
export { ArtCard, Avatar, Box, Breadcrumbs, Button, Chip, ChipGroup, CodeBlock, Container, DateFormatter, DesignCard, Dropdown, Grid, GridCol, Icon, IconButton, LegacyChip, PageTitle, Picture, ProgressBar, ReleaseCard, ResponsiveGrid, SectionSeparator, Stack, Typography, iconsData, tokens };
|
|
2996
|
+
export { ArtCard, Avatar, BooleanChip, Box, Breadcrumbs, Button, Chip, ChipGroup, CodeBlock, Container, DateFormatter, DesignCard, Dropdown, FilterChip, Grid, GridCol, Icon, IconButton, LegacyChip, PageTitle, Picture, ProgressBar, ReleaseCard, ResponsiveGrid, SectionSeparator, Stack, Typography, iconsData, tokens };
|
|
2813
2997
|
//# sourceMappingURL=index.esm.js.map
|