@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
package/dist/index.js
CHANGED
|
@@ -760,14 +760,14 @@ var AvatarImage = styled.img.withConfig({
|
|
|
760
760
|
},
|
|
761
761
|
displayName: "Avatar__AvatarImage",
|
|
762
762
|
componentId: "sc-ezn4ax-1"
|
|
763
|
-
})(templateObject_2$
|
|
763
|
+
})(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);
|
|
764
764
|
var AvatarInitials = styled.span.withConfig({
|
|
765
765
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
766
766
|
return !prop.startsWith('$');
|
|
767
767
|
},
|
|
768
768
|
displayName: "Avatar__AvatarInitials",
|
|
769
769
|
componentId: "sc-ezn4ax-2"
|
|
770
|
-
})(templateObject_3$
|
|
770
|
+
})(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"
|
|
771
771
|
// Helper function to get initials from name
|
|
772
772
|
])), tokens.base.fontFamily.body, tokens.base.fontWeight[3], function (_a) {
|
|
773
773
|
var $size = _a.$size;
|
|
@@ -830,7 +830,7 @@ var Avatar = function Avatar(_a) {
|
|
|
830
830
|
"aria-hidden": "true"
|
|
831
831
|
}, initials));
|
|
832
832
|
};
|
|
833
|
-
var templateObject_1$l, templateObject_2$
|
|
833
|
+
var templateObject_1$l, templateObject_2$a, templateObject_3$8;
|
|
834
834
|
|
|
835
835
|
React.createElement;
|
|
836
836
|
var StyledBox = styled.div.withConfig({
|
|
@@ -844,9 +844,9 @@ var StyledBox = styled.div.withConfig({
|
|
|
844
844
|
])), function (props) {
|
|
845
845
|
return props.$display && styled.css(templateObject_1$k || (templateObject_1$k = __makeTemplateObject(["display: ", ";"], ["display: ", ";"])), props.$display);
|
|
846
846
|
}, function (props) {
|
|
847
|
-
return props.$flexDirection && styled.css(templateObject_2$
|
|
847
|
+
return props.$flexDirection && styled.css(templateObject_2$9 || (templateObject_2$9 = __makeTemplateObject(["flex-direction: ", ";"], ["flex-direction: ", ";"])), props.$flexDirection);
|
|
848
848
|
}, function (props) {
|
|
849
|
-
return props.$justifyContent && styled.css(templateObject_3$
|
|
849
|
+
return props.$justifyContent && styled.css(templateObject_3$7 || (templateObject_3$7 = __makeTemplateObject(["justify-content: ", ";"], ["justify-content: ", ";"])), props.$justifyContent);
|
|
850
850
|
}, function (props) {
|
|
851
851
|
return props.$alignItems && styled.css(templateObject_4$5 || (templateObject_4$5 = __makeTemplateObject(["align-items: ", ";"], ["align-items: ", ";"])), props.$alignItems);
|
|
852
852
|
}, function (props) {
|
|
@@ -1032,7 +1032,7 @@ var BoxTransform = function BoxTransform(props) {
|
|
|
1032
1032
|
}, rest), children);
|
|
1033
1033
|
};
|
|
1034
1034
|
var Box = BoxTransform;
|
|
1035
|
-
var templateObject_1$k, templateObject_2$
|
|
1035
|
+
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;
|
|
1036
1036
|
|
|
1037
1037
|
var add = {
|
|
1038
1038
|
path: "M13 11H19V13H13V19H11V13H5V11H11V5H13V11Z",
|
|
@@ -1062,6 +1062,10 @@ var caret = {
|
|
|
1062
1062
|
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",
|
|
1063
1063
|
name: "caret"
|
|
1064
1064
|
};
|
|
1065
|
+
var check = {
|
|
1066
|
+
path: "M9.16699 18.375L4.40039 14.7998L5.59961 13.2002L8.83301 15.625L17.2256 5.36719L18.7744 6.63281L9.16699 18.375Z",
|
|
1067
|
+
name: "check"
|
|
1068
|
+
};
|
|
1065
1069
|
var close = {
|
|
1066
1070
|
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",
|
|
1067
1071
|
name: "close"
|
|
@@ -1114,6 +1118,7 @@ var iconsData = {
|
|
|
1114
1118
|
arrowRight: arrowRight,
|
|
1115
1119
|
back: back,
|
|
1116
1120
|
caret: caret,
|
|
1121
|
+
check: check,
|
|
1117
1122
|
close: close,
|
|
1118
1123
|
directionRight: directionRight,
|
|
1119
1124
|
menu: menu,
|
|
@@ -1237,7 +1242,7 @@ var StyledLink = styled.a.withConfig({
|
|
|
1237
1242
|
},
|
|
1238
1243
|
displayName: "Button__StyledLink",
|
|
1239
1244
|
componentId: "sc-1eiuum9-1"
|
|
1240
|
-
})(templateObject_2$
|
|
1245
|
+
})(templateObject_2$8 || (templateObject_2$8 = __makeTemplateObject(["\n ", "\n border-radius: ", ";\n \n ", "\n ", "\n"], ["\n ", "\n border-radius: ", ";\n \n ", "\n ", "\n"
|
|
1241
1246
|
// Helper function to get icon size based on button size
|
|
1242
1247
|
])), baseButtonStyles, button.primary.borderRadius, getVariantStyles, getSizeStyles);
|
|
1243
1248
|
// Helper function to get icon size based on button size
|
|
@@ -1330,12 +1335,18 @@ var Button = function Button(_a) {
|
|
|
1330
1335
|
"data-testid": dataTestId
|
|
1331
1336
|
}, buttonProps), renderButtonContent(children, iconName, size));
|
|
1332
1337
|
};
|
|
1333
|
-
var templateObject_1$i, templateObject_2$
|
|
1338
|
+
var templateObject_1$i, templateObject_2$8;
|
|
1334
1339
|
|
|
1335
|
-
React.createElement;
|
|
1336
1340
|
var chip = tokens.component.chip;
|
|
1337
|
-
// Helper
|
|
1338
|
-
var getVariantStylesAsObject = function getVariantStylesAsObject(variant) {
|
|
1341
|
+
// Helper function to get variant styles as objects for CSS custom properties
|
|
1342
|
+
var getVariantStylesAsObject = function getVariantStylesAsObject(variant, selected) {
|
|
1343
|
+
// Boolean chips with selected state get special background
|
|
1344
|
+
if (selected) {
|
|
1345
|
+
return {
|
|
1346
|
+
backgroundColor: tokens.semantic.color.background['interactive-subtle'],
|
|
1347
|
+
color: chip["default"].textColor
|
|
1348
|
+
};
|
|
1349
|
+
}
|
|
1339
1350
|
switch (variant) {
|
|
1340
1351
|
case 'emphasis':
|
|
1341
1352
|
return {
|
|
@@ -1360,6 +1371,7 @@ var getVariantStylesAsObject = function getVariantStylesAsObject(variant) {
|
|
|
1360
1371
|
};
|
|
1361
1372
|
}
|
|
1362
1373
|
};
|
|
1374
|
+
// Helper function to get size styles as objects for CSS custom properties
|
|
1363
1375
|
var getSizeStylesAsObject = function getSizeStylesAsObject(size) {
|
|
1364
1376
|
switch (size) {
|
|
1365
1377
|
case 'small':
|
|
@@ -1367,11 +1379,6 @@ var getSizeStylesAsObject = function getSizeStylesAsObject(size) {
|
|
|
1367
1379
|
font: chip.sizes.small.font,
|
|
1368
1380
|
padding: chip.sizes.small.padding
|
|
1369
1381
|
};
|
|
1370
|
-
case 'large':
|
|
1371
|
-
return {
|
|
1372
|
-
font: chip.sizes.large.font,
|
|
1373
|
-
padding: chip.sizes.large.padding
|
|
1374
|
-
};
|
|
1375
1382
|
case 'medium':
|
|
1376
1383
|
default:
|
|
1377
1384
|
return {
|
|
@@ -1380,27 +1387,51 @@ var getSizeStylesAsObject = function getSizeStylesAsObject(size) {
|
|
|
1380
1387
|
};
|
|
1381
1388
|
}
|
|
1382
1389
|
};
|
|
1390
|
+
|
|
1391
|
+
React.createElement;
|
|
1383
1392
|
// Base styled component using CSS variables to avoid prop leaking
|
|
1384
|
-
var
|
|
1393
|
+
var BaseChipStyled = styled.span.withConfig({
|
|
1385
1394
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
1386
1395
|
return !prop.startsWith('$');
|
|
1387
1396
|
},
|
|
1388
|
-
displayName: "
|
|
1389
|
-
componentId: "sc-
|
|
1397
|
+
displayName: "ChipBase__BaseChipStyled",
|
|
1398
|
+
componentId: "sc-moa6zc-0"
|
|
1390
1399
|
})(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"
|
|
1391
|
-
//
|
|
1400
|
+
// Icon container for selected indicator or leading icons
|
|
1392
1401
|
])), chip["default"].borderRadius, tokens.semantic.motion.interactive, chip.variants.interactive.backgroundColor);
|
|
1402
|
+
// Icon container for selected indicator or leading icons
|
|
1403
|
+
var IconContainer = styled.span.withConfig({
|
|
1404
|
+
displayName: "ChipBase__IconContainer",
|
|
1405
|
+
componentId: "sc-moa6zc-1"
|
|
1406
|
+
})(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"
|
|
1407
|
+
// Close button for dismissible chips
|
|
1408
|
+
])), tokens.semantic.spacing.layout.sm);
|
|
1409
|
+
// Close button for dismissible chips
|
|
1410
|
+
var CloseButton = styled.button.withConfig({
|
|
1411
|
+
shouldForwardProp: function shouldForwardProp(prop) {
|
|
1412
|
+
return !prop.startsWith('$');
|
|
1413
|
+
},
|
|
1414
|
+
displayName: "ChipBase__CloseButton",
|
|
1415
|
+
componentId: "sc-moa6zc-2"
|
|
1416
|
+
})(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"
|
|
1393
1417
|
// Wrapper component that applies styles via CSS custom properties
|
|
1394
|
-
|
|
1418
|
+
])), tokens.semantic.spacing.layout.sm, function (props) {
|
|
1419
|
+
return props.$disabled ? 'not-allowed' : 'pointer';
|
|
1420
|
+
}, function (props) {
|
|
1421
|
+
return props.$disabled ? '0.6' : '1';
|
|
1422
|
+
}, tokens.semantic.motion.transition.fast, chip.variants.interactive.backgroundColor);
|
|
1423
|
+
// Wrapper component that applies styles via CSS custom properties
|
|
1424
|
+
var StyledChipWrapper = function StyledChipWrapper(_a) {
|
|
1395
1425
|
var $variant = _a.$variant,
|
|
1396
1426
|
$size = _a.$size,
|
|
1397
1427
|
$disabled = _a.$disabled,
|
|
1398
1428
|
$clickable = _a.$clickable,
|
|
1429
|
+
$selected = _a.$selected,
|
|
1399
1430
|
children = _a.children,
|
|
1400
1431
|
style = _a.style,
|
|
1401
|
-
htmlProps = __rest(_a, ["$variant", "$size", "$disabled", "$clickable", "children", "style"]);
|
|
1432
|
+
htmlProps = __rest(_a, ["$variant", "$size", "$disabled", "$clickable", "$selected", "children", "style"]);
|
|
1402
1433
|
// Get styles for variant and size
|
|
1403
|
-
var variantStyles = getVariantStylesAsObject($variant);
|
|
1434
|
+
var variantStyles = getVariantStylesAsObject($variant, $selected);
|
|
1404
1435
|
var sizeStyles = getSizeStylesAsObject($size);
|
|
1405
1436
|
// Create CSS custom properties object
|
|
1406
1437
|
var cssProps = {
|
|
@@ -1413,38 +1444,47 @@ var StyledChip = function StyledChip(_a) {
|
|
|
1413
1444
|
'--chip-hover-opacity': $disabled ? '0.6' : $clickable ? '0.8' : '1',
|
|
1414
1445
|
'--chip-active-opacity': $disabled ? '0.6' : $clickable ? '0.9' : '1'
|
|
1415
1446
|
};
|
|
1416
|
-
return /*#__PURE__*/React.createElement(
|
|
1447
|
+
return /*#__PURE__*/React.createElement(BaseChipStyled, _extends({
|
|
1417
1448
|
style: __assign(__assign({}, cssProps), style)
|
|
1418
1449
|
}, htmlProps), children);
|
|
1419
1450
|
};
|
|
1451
|
+
var templateObject_1$h, templateObject_2$7, templateObject_3$6;
|
|
1452
|
+
|
|
1453
|
+
React.createElement;
|
|
1454
|
+
/**
|
|
1455
|
+
* Chip - Compact element for displaying tags, categories, and labels
|
|
1456
|
+
*
|
|
1457
|
+
* Use this component for static display chips or simple interactive chips.
|
|
1458
|
+
* For specialized filtering patterns, use:
|
|
1459
|
+
* - FilterChip: Dismissible chips for showing applied filters
|
|
1460
|
+
* - BooleanChip: Toggleable chips for quick filter controls
|
|
1461
|
+
*
|
|
1462
|
+
* Variants:
|
|
1463
|
+
* - default: Standard gray background
|
|
1464
|
+
* - emphasis: High-contrast dark background
|
|
1465
|
+
* - subtle: Light background for secondary info
|
|
1466
|
+
* - interactive: Blue background with hover states
|
|
1467
|
+
*/
|
|
1420
1468
|
var Chip = function Chip(_a) {
|
|
1421
1469
|
var children = _a.children,
|
|
1422
1470
|
_b = _a.variant,
|
|
1423
1471
|
variant = _b === void 0 ? 'default' : _b,
|
|
1424
|
-
|
|
1425
|
-
size =
|
|
1472
|
+
_c = _a.size,
|
|
1473
|
+
size = _c === void 0 ? 'medium' : _c,
|
|
1426
1474
|
onClick = _a.onClick,
|
|
1427
|
-
|
|
1428
|
-
disabled =
|
|
1475
|
+
_d = _a.disabled,
|
|
1476
|
+
disabled = _d === void 0 ? false : _d,
|
|
1429
1477
|
dataTestId = _a["data-testid"],
|
|
1430
1478
|
ariaLabel = _a["aria-label"],
|
|
1431
1479
|
ariaDescribedBy = _a["aria-describedby"],
|
|
1432
1480
|
role = _a.role,
|
|
1433
1481
|
title = _a.title,
|
|
1434
|
-
// Legacy prop support
|
|
1435
1482
|
props = __rest(_a, ["children", "variant", "size", "onClick", "disabled", 'data-testid', 'aria-label', 'aria-describedby', "role", "title"]);
|
|
1436
1483
|
var isClickable = Boolean(onClick && !disabled);
|
|
1437
|
-
// Map legacy variants to new variants
|
|
1484
|
+
// Map legacy variants to new variants
|
|
1438
1485
|
var normalizedVariant = variant === 'light' ? 'default' : variant === 'dark' ? 'emphasis' : variant;
|
|
1439
|
-
// Support legacy title prop
|
|
1486
|
+
// Support legacy title prop
|
|
1440
1487
|
var content = children !== undefined ? children : title;
|
|
1441
|
-
// Remove styled-only props from the rest
|
|
1442
|
-
var _g = props;
|
|
1443
|
-
_g.variant;
|
|
1444
|
-
_g.size;
|
|
1445
|
-
_g.disabled;
|
|
1446
|
-
_g.clickable;
|
|
1447
|
-
var htmlProps = __rest(_g, ["variant", "size", "disabled", "clickable"]);
|
|
1448
1488
|
var handleClick = function handleClick() {
|
|
1449
1489
|
if (onClick && !disabled) {
|
|
1450
1490
|
onClick();
|
|
@@ -1456,33 +1496,177 @@ var Chip = function Chip(_a) {
|
|
|
1456
1496
|
handleClick();
|
|
1457
1497
|
}
|
|
1458
1498
|
};
|
|
1459
|
-
return /*#__PURE__*/React.createElement(
|
|
1499
|
+
return /*#__PURE__*/React.createElement(StyledChipWrapper, _extends({
|
|
1460
1500
|
$variant: normalizedVariant,
|
|
1461
1501
|
$size: size,
|
|
1462
1502
|
$disabled: disabled || undefined,
|
|
1463
1503
|
$clickable: isClickable || undefined,
|
|
1464
1504
|
onClick: isClickable ? handleClick : undefined,
|
|
1465
|
-
onKeyDown:
|
|
1505
|
+
onKeyDown: handleKeyDown,
|
|
1466
1506
|
tabIndex: isClickable ? 0 : undefined,
|
|
1467
1507
|
role: role || (isClickable ? 'button' : undefined),
|
|
1468
1508
|
"aria-label": ariaLabel,
|
|
1469
1509
|
"aria-describedby": ariaDescribedBy,
|
|
1470
1510
|
"aria-disabled": disabled ? 'true' : undefined,
|
|
1471
1511
|
"data-testid": dataTestId
|
|
1472
|
-
},
|
|
1512
|
+
}, props), content);
|
|
1473
1513
|
};
|
|
1474
|
-
// Legacy component for backward compatibility
|
|
1475
1514
|
var LegacyChip = function LegacyChip(_a) {
|
|
1476
1515
|
var title = _a.title,
|
|
1477
1516
|
_b = _a.variant,
|
|
1478
1517
|
variant = _b === void 0 ? 'light' : _b;
|
|
1479
|
-
// Map legacy variants to new variants
|
|
1480
1518
|
var newVariant = variant === 'dark' ? 'emphasis' : 'default';
|
|
1481
1519
|
return /*#__PURE__*/React.createElement(Chip, {
|
|
1482
1520
|
variant: newVariant
|
|
1483
1521
|
}, title);
|
|
1484
1522
|
};
|
|
1485
|
-
|
|
1523
|
+
|
|
1524
|
+
React.createElement;
|
|
1525
|
+
/**
|
|
1526
|
+
* FilterChip - Chip for displaying filters with selected state and optional dismissal
|
|
1527
|
+
*
|
|
1528
|
+
* Use this component to show filters that can be selected/deselected.
|
|
1529
|
+
* When selected, displays a checkmark and light blue background.
|
|
1530
|
+
* Optionally dismissible when onDismiss is provided.
|
|
1531
|
+
*
|
|
1532
|
+
* Features:
|
|
1533
|
+
* - Shows checkmark icon when selected
|
|
1534
|
+
* - Light blue background when selected
|
|
1535
|
+
* - Optional close (×) button when onDismiss is provided
|
|
1536
|
+
* - Keyboard dismissal with Delete or Backspace keys (when dismissible)
|
|
1537
|
+
* - Non-clickable body (only close button is interactive when present)
|
|
1538
|
+
* - Uses subtle/interactive background styling based on selected state
|
|
1539
|
+
* - Announces as "status" to screen readers
|
|
1540
|
+
*/
|
|
1541
|
+
var FilterChip = function FilterChip(_a) {
|
|
1542
|
+
var children = _a.children,
|
|
1543
|
+
_b = _a.selected,
|
|
1544
|
+
selected = _b === void 0 ? false : _b,
|
|
1545
|
+
onDismiss = _a.onDismiss,
|
|
1546
|
+
_c = _a.size,
|
|
1547
|
+
size = _c === void 0 ? 'medium' : _c,
|
|
1548
|
+
_d = _a.disabled,
|
|
1549
|
+
disabled = _d === void 0 ? false : _d,
|
|
1550
|
+
dataTestId = _a["data-testid"],
|
|
1551
|
+
ariaLabel = _a["aria-label"],
|
|
1552
|
+
ariaDescribedBy = _a["aria-describedby"],
|
|
1553
|
+
role = _a.role,
|
|
1554
|
+
props = __rest(_a, ["children", "selected", "onDismiss", "size", "disabled", 'data-testid', 'aria-label', 'aria-describedby', "role"]);
|
|
1555
|
+
var isDismissible = Boolean(onDismiss);
|
|
1556
|
+
var handleDismiss = function handleDismiss(event) {
|
|
1557
|
+
event.stopPropagation(); // Prevent event bubbling
|
|
1558
|
+
if (!disabled && onDismiss) {
|
|
1559
|
+
onDismiss();
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
1563
|
+
// Handle dismiss with Delete or Backspace (only when dismissible)
|
|
1564
|
+
if (!disabled && isDismissible && onDismiss && (event.key === 'Delete' || event.key === 'Backspace')) {
|
|
1565
|
+
event.preventDefault();
|
|
1566
|
+
onDismiss();
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
var handleCloseKeyDown = function handleCloseKeyDown(event) {
|
|
1570
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
1571
|
+
event.preventDefault();
|
|
1572
|
+
if (!disabled && onDismiss) onDismiss();
|
|
1573
|
+
}
|
|
1574
|
+
};
|
|
1575
|
+
// Generate accessible label for close button
|
|
1576
|
+
var closeButtonLabel = typeof children === 'string' ? "Remove ".concat(children) : 'Remove filter';
|
|
1577
|
+
return /*#__PURE__*/React.createElement(StyledChipWrapper, _extends({
|
|
1578
|
+
$variant: "subtle",
|
|
1579
|
+
$size: size,
|
|
1580
|
+
$disabled: disabled || undefined,
|
|
1581
|
+
$clickable: false,
|
|
1582
|
+
$selected: selected,
|
|
1583
|
+
onKeyDown: handleKeyDown,
|
|
1584
|
+
role: role || 'status',
|
|
1585
|
+
"aria-label": ariaLabel,
|
|
1586
|
+
"aria-describedby": ariaDescribedBy,
|
|
1587
|
+
"aria-disabled": disabled ? 'true' : undefined,
|
|
1588
|
+
"data-testid": dataTestId
|
|
1589
|
+
}, props), selected && /*#__PURE__*/React.createElement(IconContainer, {
|
|
1590
|
+
"aria-hidden": "true"
|
|
1591
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
1592
|
+
name: "check",
|
|
1593
|
+
size: "sm"
|
|
1594
|
+
})), children, isDismissible && /*#__PURE__*/React.createElement(CloseButton, {
|
|
1595
|
+
type: "button",
|
|
1596
|
+
onClick: handleDismiss,
|
|
1597
|
+
onKeyDown: handleCloseKeyDown,
|
|
1598
|
+
disabled: disabled,
|
|
1599
|
+
$disabled: disabled,
|
|
1600
|
+
"aria-label": closeButtonLabel,
|
|
1601
|
+
tabIndex: 0,
|
|
1602
|
+
"data-testid": dataTestId ? "".concat(dataTestId, "-close") : undefined
|
|
1603
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
1604
|
+
name: "close",
|
|
1605
|
+
size: "sm"
|
|
1606
|
+
})));
|
|
1607
|
+
};
|
|
1608
|
+
|
|
1609
|
+
React.createElement;
|
|
1610
|
+
/**
|
|
1611
|
+
* BooleanChip - Toggleable chip for quick filter controls
|
|
1612
|
+
*
|
|
1613
|
+
* Use this component for multi-select filter controls where users can
|
|
1614
|
+
* see which options are active. Common in table filtering patterns where
|
|
1615
|
+
* users toggle filters on/off.
|
|
1616
|
+
*
|
|
1617
|
+
* Features:
|
|
1618
|
+
* - Shows checkmark icon when selected
|
|
1619
|
+
* - Entire chip is clickable to toggle
|
|
1620
|
+
* - Keyboard activation with Space or Enter
|
|
1621
|
+
* - Uses checkbox role with aria-checked
|
|
1622
|
+
* - Visual background change when selected
|
|
1623
|
+
*/
|
|
1624
|
+
var BooleanChip = function BooleanChip(_a) {
|
|
1625
|
+
var children = _a.children,
|
|
1626
|
+
selected = _a.selected,
|
|
1627
|
+
onClick = _a.onClick,
|
|
1628
|
+
_b = _a.size,
|
|
1629
|
+
size = _b === void 0 ? 'medium' : _b,
|
|
1630
|
+
_c = _a.disabled,
|
|
1631
|
+
disabled = _c === void 0 ? false : _c,
|
|
1632
|
+
dataTestId = _a["data-testid"],
|
|
1633
|
+
ariaLabel = _a["aria-label"],
|
|
1634
|
+
ariaDescribedBy = _a["aria-describedby"],
|
|
1635
|
+
props = __rest(_a, ["children", "selected", "onClick", "size", "disabled", 'data-testid', 'aria-label', 'aria-describedby']);
|
|
1636
|
+
var handleClick = function handleClick() {
|
|
1637
|
+
if (!disabled) {
|
|
1638
|
+
onClick();
|
|
1639
|
+
}
|
|
1640
|
+
};
|
|
1641
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
1642
|
+
// Handle activation with Space or Enter
|
|
1643
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
1644
|
+
event.preventDefault();
|
|
1645
|
+
handleClick();
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
return /*#__PURE__*/React.createElement(StyledChipWrapper, _extends({
|
|
1649
|
+
$variant: "subtle",
|
|
1650
|
+
$size: size,
|
|
1651
|
+
$disabled: disabled || undefined,
|
|
1652
|
+
$clickable: !disabled,
|
|
1653
|
+
$selected: selected,
|
|
1654
|
+
onClick: handleClick,
|
|
1655
|
+
onKeyDown: handleKeyDown,
|
|
1656
|
+
tabIndex: disabled ? undefined : 0,
|
|
1657
|
+
role: "checkbox",
|
|
1658
|
+
"aria-checked": selected ? 'true' : 'false',
|
|
1659
|
+
"aria-label": ariaLabel,
|
|
1660
|
+
"aria-describedby": ariaDescribedBy,
|
|
1661
|
+
"aria-disabled": disabled ? 'true' : undefined,
|
|
1662
|
+
"data-testid": dataTestId
|
|
1663
|
+
}, props), selected && /*#__PURE__*/React.createElement(IconContainer, {
|
|
1664
|
+
"aria-hidden": "true"
|
|
1665
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
1666
|
+
name: "check",
|
|
1667
|
+
size: "sm"
|
|
1668
|
+
})), children);
|
|
1669
|
+
};
|
|
1486
1670
|
|
|
1487
1671
|
// Breakpoints using base tokens
|
|
1488
1672
|
var breakpoints$1 = {
|
|
@@ -2813,6 +2997,7 @@ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, temp
|
|
|
2813
2997
|
|
|
2814
2998
|
exports.ArtCard = ArtCard;
|
|
2815
2999
|
exports.Avatar = Avatar;
|
|
3000
|
+
exports.BooleanChip = BooleanChip;
|
|
2816
3001
|
exports.Box = Box;
|
|
2817
3002
|
exports.Breadcrumbs = Breadcrumbs;
|
|
2818
3003
|
exports.Button = Button;
|
|
@@ -2823,6 +3008,7 @@ exports.Container = Container;
|
|
|
2823
3008
|
exports.DateFormatter = DateFormatter;
|
|
2824
3009
|
exports.DesignCard = DesignCard;
|
|
2825
3010
|
exports.Dropdown = Dropdown;
|
|
3011
|
+
exports.FilterChip = FilterChip;
|
|
2826
3012
|
exports.Grid = Grid;
|
|
2827
3013
|
exports.GridCol = GridCol;
|
|
2828
3014
|
exports.Icon = Icon;
|