@cere/cere-design-system 0.0.18 → 0.0.19

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.mjs CHANGED
@@ -1794,6 +1794,17 @@ var useIsMobile = () => {
1794
1794
  import MuiButton from "@mui/material/Button";
1795
1795
  import { styled } from "@mui/material/styles";
1796
1796
  import { jsx as jsx4 } from "react/jsx-runtime";
1797
+ var BUTTON_SPACING = {
1798
+ borderRadius: "8px",
1799
+ padding: "8px 16px",
1800
+ iconMargin: "8px"
1801
+ };
1802
+ var BUTTON_TYPOGRAPHY = {
1803
+ fontSize: "16px",
1804
+ fontWeight: 500,
1805
+ lineHeight: 1.5,
1806
+ letterSpacing: "0.8px"
1807
+ };
1797
1808
  var StyledPrimaryButton = styled(MuiButton)(() => ({
1798
1809
  backgroundColor: colors.primary.main,
1799
1810
  color: colors.primary.contrastText,
@@ -1808,21 +1819,42 @@ var StyledPrimaryButton = styled(MuiButton)(() => ({
1808
1819
  color: colors.grey[500]
1809
1820
  }
1810
1821
  }));
1822
+ var iconStyles = {
1823
+ "& > *": {
1824
+ fontSize: BUTTON_TYPOGRAPHY.fontSize
1825
+ }
1826
+ };
1811
1827
  var StyledSecondaryButton = styled(MuiButton)(() => ({
1812
- backgroundColor: "transparent",
1813
- color: colors.primary.main,
1814
- border: `1px solid ${colors.primary.main}`,
1828
+ backgroundColor: deploymentSurfaceTokens.surfaceHigh,
1829
+ color: deploymentSurfaceTokens.textPrimary,
1830
+ border: `1px solid ${deploymentSurfaceTokens.strokeOutside}`,
1831
+ borderRadius: BUTTON_SPACING.borderRadius,
1832
+ padding: BUTTON_SPACING.padding,
1833
+ textTransform: "capitalize",
1834
+ letterSpacing: BUTTON_TYPOGRAPHY.letterSpacing,
1835
+ fontSize: BUTTON_TYPOGRAPHY.fontSize,
1836
+ fontWeight: BUTTON_TYPOGRAPHY.fontWeight,
1837
+ lineHeight: BUTTON_TYPOGRAPHY.lineHeight,
1815
1838
  "&:hover": {
1816
1839
  backgroundColor: colors.background.selected,
1817
- borderColor: colors.primary.light
1840
+ borderColor: deploymentSurfaceTokens.strokeOutside
1818
1841
  },
1819
1842
  "&:active": {
1820
1843
  backgroundColor: colors.background.selected,
1821
- borderColor: colors.primary.dark
1844
+ borderColor: deploymentSurfaceTokens.borderDefault
1822
1845
  },
1823
1846
  "&:disabled": {
1824
1847
  borderColor: colors.grey[300],
1825
- color: colors.grey[500]
1848
+ color: colors.grey[500],
1849
+ backgroundColor: colors.grey[50]
1850
+ },
1851
+ "& .MuiButton-startIcon": {
1852
+ marginRight: BUTTON_SPACING.iconMargin,
1853
+ ...iconStyles
1854
+ },
1855
+ "& .MuiButton-endIcon": {
1856
+ marginLeft: BUTTON_SPACING.iconMargin,
1857
+ ...iconStyles
1826
1858
  }
1827
1859
  }));
1828
1860
  var StyledTertiaryButton = styled(MuiButton)(() => ({
@@ -1838,6 +1870,11 @@ var StyledTertiaryButton = styled(MuiButton)(() => ({
1838
1870
  color: colors.grey[500]
1839
1871
  }
1840
1872
  }));
1873
+ var BUTTON_COMPONENTS = {
1874
+ primary: StyledPrimaryButton,
1875
+ secondary: StyledSecondaryButton,
1876
+ tertiary: StyledTertiaryButton
1877
+ };
1841
1878
  var Button = ({
1842
1879
  variant = "primary",
1843
1880
  children,
@@ -1845,21 +1882,13 @@ var Button = ({
1845
1882
  endIcon,
1846
1883
  ...props
1847
1884
  }) => {
1885
+ const ButtonComponent = BUTTON_COMPONENTS[variant];
1848
1886
  const buttonProps = {
1849
1887
  ...props,
1850
1888
  startIcon,
1851
1889
  endIcon
1852
1890
  };
1853
- switch (variant) {
1854
- case "primary":
1855
- return /* @__PURE__ */ jsx4(StyledPrimaryButton, { ...buttonProps, children });
1856
- case "secondary":
1857
- return /* @__PURE__ */ jsx4(StyledSecondaryButton, { ...buttonProps, children });
1858
- case "tertiary":
1859
- return /* @__PURE__ */ jsx4(StyledTertiaryButton, { ...buttonProps, children });
1860
- default:
1861
- return /* @__PURE__ */ jsx4(StyledPrimaryButton, { ...buttonProps, children });
1862
- }
1891
+ return /* @__PURE__ */ jsx4(ButtonComponent, { ...buttonProps, children });
1863
1892
  };
1864
1893
 
1865
1894
  // src/components/buttons/IconButton.tsx
@@ -4976,7 +5005,6 @@ import {
4976
5005
  useTheme as useTheme2,
4977
5006
  LinearProgress as LinearProgress2
4978
5007
  } from "@mui/material";
4979
- import MoreHorizIcon from "@mui/icons-material/MoreHoriz";
4980
5008
  import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
4981
5009
  import ChevronRightIcon2 from "@mui/icons-material/ChevronRight";
4982
5010
  import ContentCopyIcon from "@mui/icons-material/ContentCopy";
@@ -5006,7 +5034,7 @@ var ENTITY_LABELS = {
5006
5034
  engagement: "Engagement",
5007
5035
  agent: "Agent"
5008
5036
  };
5009
- var ENTITY_ICON_SIZE = 24;
5037
+ var ENTITY_ICON_SIZE = 16;
5010
5038
  var ENTITY_ICONS = {
5011
5039
  workspace: /* @__PURE__ */ jsx42(WorkOutlineIcon, { sx: { fontSize: ENTITY_ICON_SIZE } }),
5012
5040
  stream: /* @__PURE__ */ jsx42(WavesIcon, { sx: { fontSize: ENTITY_ICON_SIZE } }),
@@ -5021,6 +5049,18 @@ var STATUS_DOT_COLORS = {
5021
5049
  disabled: deploymentStatusColors.disabledDim
5022
5050
  };
5023
5051
  var CHEVRON_SIZE = 16;
5052
+ var ENTITY_CHIP_STYLES = {
5053
+ borderRadius: "12px",
5054
+ borderWidth: "1.5px",
5055
+ padding: { left: 0.75, right: 1, vertical: 0.25 },
5056
+ gap: 0.5
5057
+ };
5058
+ var ENTITY_CHIP_TYPOGRAPHY = {
5059
+ fontSize: "12px",
5060
+ fontWeight: 500,
5061
+ lineHeight: 1.33,
5062
+ letterSpacing: "0.07px"
5063
+ };
5024
5064
  var StatusDot = styled28(Box12, {
5025
5065
  shouldForwardProp: (p) => p !== "status"
5026
5066
  })(({ status }) => ({
@@ -5036,13 +5076,13 @@ var EntityChip = ({ entityType, color }) => /* @__PURE__ */ jsxs19(
5036
5076
  sx: {
5037
5077
  display: "inline-flex",
5038
5078
  alignItems: "center",
5039
- gap: 0.5,
5040
- pl: 1,
5041
- pr: 1.5,
5042
- py: 0.5,
5043
- borderRadius: "16px",
5079
+ gap: ENTITY_CHIP_STYLES.gap,
5080
+ pl: ENTITY_CHIP_STYLES.padding.left,
5081
+ pr: ENTITY_CHIP_STYLES.padding.right,
5082
+ py: ENTITY_CHIP_STYLES.padding.vertical,
5083
+ borderRadius: ENTITY_CHIP_STYLES.borderRadius,
5044
5084
  backgroundColor: deploymentSurfaceTokens.surfaceHigh,
5045
- border: `2px solid ${color}`,
5085
+ border: `${ENTITY_CHIP_STYLES.borderWidth} solid ${color}`,
5046
5086
  flexShrink: 0
5047
5087
  },
5048
5088
  children: [
@@ -5051,8 +5091,13 @@ var EntityChip = ({ entityType, color }) => /* @__PURE__ */ jsxs19(
5051
5091
  Typography10,
5052
5092
  {
5053
5093
  variant: "body2",
5054
- fontWeight: 500,
5055
- sx: { color: "black", lineHeight: 1.42, fontSize: "14px", letterSpacing: "0.07px" },
5094
+ fontWeight: ENTITY_CHIP_TYPOGRAPHY.fontWeight,
5095
+ sx: {
5096
+ color: "black",
5097
+ lineHeight: ENTITY_CHIP_TYPOGRAPHY.lineHeight,
5098
+ fontSize: ENTITY_CHIP_TYPOGRAPHY.fontSize,
5099
+ letterSpacing: ENTITY_CHIP_TYPOGRAPHY.letterSpacing
5100
+ },
5056
5101
  children: ENTITY_LABELS[entityType]
5057
5102
  }
5058
5103
  )
@@ -5115,31 +5160,42 @@ var CapacityBar = ({ value, indented = false }) => /* @__PURE__ */ jsxs19(Box12,
5115
5160
  }
5116
5161
  )
5117
5162
  ] });
5118
- var CardActionList = ({ actions }) => /* @__PURE__ */ jsx42(Fragment9, { children: actions.map((action) => /* @__PURE__ */ jsxs19(
5163
+ var getActionButtonStyles = (action) => {
5164
+ const baseStyles = {
5165
+ display: "inline-flex",
5166
+ alignItems: "center",
5167
+ gap: 0.5,
5168
+ cursor: action.onClick ? "pointer" : "default",
5169
+ background: "none",
5170
+ font: "inherit",
5171
+ color: deploymentSurfaceTokens.textPrimary,
5172
+ whiteSpace: "nowrap",
5173
+ "&:hover": action.onClick ? { opacity: 0.7 } : void 0
5174
+ };
5175
+ const variantStyles = action.outlined ? {
5176
+ border: `1px solid ${deploymentSurfaceTokens.strokeOutside}`,
5177
+ borderRadius: "8px",
5178
+ p: 1,
5179
+ bgcolor: "white"
5180
+ } : {
5181
+ border: "none",
5182
+ p: 0
5183
+ };
5184
+ return { ...baseStyles, ...variantStyles };
5185
+ };
5186
+ var CardAction = ({ action }) => /* @__PURE__ */ jsxs19(
5119
5187
  Box12,
5120
5188
  {
5121
5189
  component: action.onClick ? "button" : "span",
5122
5190
  onClick: action.onClick,
5123
- sx: {
5124
- display: "inline-flex",
5125
- alignItems: "center",
5126
- gap: 0.5,
5127
- cursor: action.onClick ? "pointer" : "default",
5128
- background: "none",
5129
- border: "none",
5130
- p: 0,
5131
- font: "inherit",
5132
- color: deploymentSurfaceTokens.textPrimary,
5133
- whiteSpace: "nowrap",
5134
- "&:hover": action.onClick ? { opacity: 0.7 } : void 0
5135
- },
5191
+ sx: getActionButtonStyles(action),
5136
5192
  children: [
5137
5193
  action.icon && /* @__PURE__ */ jsx42(Box12, { component: "span", sx: { display: "flex", alignItems: "center" }, children: action.icon }),
5138
- /* @__PURE__ */ jsx42(Typography10, { variant: "body2", fontWeight: 500, component: "span", sx: { fontSize: "14px" }, children: action.label })
5194
+ action.label && /* @__PURE__ */ jsx42(Typography10, { variant: "body2", fontWeight: 500, component: "span", sx: { fontSize: "14px" }, children: action.label })
5139
5195
  ]
5140
- },
5141
- action.id
5142
- )) });
5196
+ }
5197
+ );
5198
+ var CardActionList = ({ actions }) => /* @__PURE__ */ jsx42(Fragment9, { children: actions.map((action) => /* @__PURE__ */ jsx42(CardAction, { action }, action.id)) });
5143
5199
  var DeploymentDashboardCard = ({
5144
5200
  entityType,
5145
5201
  title,
@@ -5153,20 +5209,25 @@ var DeploymentDashboardCard = ({
5153
5209
  expanded: controlledExpanded,
5154
5210
  onExpandToggle,
5155
5211
  onCopyId,
5156
- onContextMenu,
5157
5212
  className,
5158
5213
  children
5159
5214
  }) => {
5160
5215
  const theme2 = useTheme2();
5161
5216
  const entityColor = theme2.palette.deployment?.entity?.[entityType] ?? deploymentEntityColors[entityType];
5217
+ const isControlled = expandable && onExpandToggle != null;
5162
5218
  const { expanded, toggle } = useControlledExpand(
5163
- expandable && onExpandToggle != null ? controlledExpanded : void 0,
5164
- expandable && onExpandToggle != null ? onExpandToggle : void 0
5219
+ isControlled ? controlledExpanded : void 0,
5220
+ isControlled ? onExpandToggle : void 0
5165
5221
  );
5166
5222
  const isWorkspace = entityType === "workspace";
5167
5223
  const isDeployment = entityType === "deployment";
5168
- const isAgent = entityType === "agent";
5169
- const capacityClamped = isDeployment && capacity != null ? Math.min(100, Math.max(0, capacity)) : void 0;
5224
+ const getClampedCapacity = (capacity2) => {
5225
+ if (!isDeployment || capacity2 == null) {
5226
+ return void 0;
5227
+ }
5228
+ return Math.min(100, Math.max(0, capacity2));
5229
+ };
5230
+ const capacityClamped = getClampedCapacity(capacity);
5170
5231
  return /* @__PURE__ */ jsxs19(
5171
5232
  Paper,
5172
5233
  {
@@ -5178,7 +5239,7 @@ var DeploymentDashboardCard = ({
5178
5239
  boxShadow: isWorkspace ? deploymentSurfaceTokens.workspaceShadow : "none",
5179
5240
  px: 1,
5180
5241
  py: isDeployment ? 2 : 1,
5181
- pl: isAgent && !expandable ? 2 : 1,
5242
+ pl: 1,
5182
5243
  display: "flex",
5183
5244
  flexDirection: "column",
5184
5245
  gap: 0
@@ -5196,7 +5257,7 @@ var DeploymentDashboardCard = ({
5196
5257
  children: [
5197
5258
  /* @__PURE__ */ jsxs19(Box12, { sx: { display: "flex", flexDirection: "column", gap: 0.5, minWidth: 0 }, children: [
5198
5259
  /* @__PURE__ */ jsxs19(Box12, { sx: { display: "flex", gap: 1, alignItems: "center" }, children: [
5199
- expandable && /* @__PURE__ */ jsx42(
5260
+ expandable ? /* @__PURE__ */ jsx42(
5200
5261
  IconButton8,
5201
5262
  {
5202
5263
  size: "small",
@@ -5205,7 +5266,7 @@ var DeploymentDashboardCard = ({
5205
5266
  sx: { p: "5px" },
5206
5267
  children: expanded ? /* @__PURE__ */ jsx42(ExpandMoreIcon, { sx: { fontSize: CHEVRON_SIZE, color: deploymentSurfaceTokens.accentBlue } }) : /* @__PURE__ */ jsx42(ChevronRightIcon2, { sx: { fontSize: CHEVRON_SIZE, color: deploymentSurfaceTokens.accentBlue } })
5207
5268
  }
5208
- ),
5269
+ ) : /* @__PURE__ */ jsx42(Box12, { sx: { width: 26, flexShrink: 0 } }),
5209
5270
  /* @__PURE__ */ jsx42(EntityChip, { entityType, color: entityColor }),
5210
5271
  /* @__PURE__ */ jsx42(
5211
5272
  Typography10,
@@ -5225,7 +5286,7 @@ var DeploymentDashboardCard = ({
5225
5286
  sx: {
5226
5287
  display: "flex",
5227
5288
  gap: 2,
5228
- px: expandable ? "36px" : 0,
5289
+ px: "34px",
5229
5290
  color: deploymentSurfaceTokens.textSecondary
5230
5291
  },
5231
5292
  children: [
@@ -5244,22 +5305,7 @@ var DeploymentDashboardCard = ({
5244
5305
  ] }),
5245
5306
  /* @__PURE__ */ jsxs19(Box12, { sx: { display: "flex", gap: 1, alignItems: "center", flexShrink: 0 }, children: [
5246
5307
  statusIndicator != null && /* @__PURE__ */ jsx42(StatusDot, { status: statusIndicator, "aria-hidden": true }),
5247
- /* @__PURE__ */ jsx42(CardActionList, { actions }),
5248
- onContextMenu && /* @__PURE__ */ jsx42(
5249
- IconButton8,
5250
- {
5251
- size: "small",
5252
- onClick: onContextMenu,
5253
- "aria-label": "Open menu",
5254
- sx: {
5255
- border: `1px solid ${deploymentSurfaceTokens.strokeOutside}`,
5256
- borderRadius: "8px",
5257
- p: 1,
5258
- bgcolor: "white"
5259
- },
5260
- children: /* @__PURE__ */ jsx42(MoreHorizIcon, { sx: { fontSize: CHEVRON_SIZE, color: deploymentSurfaceTokens.textPrimary } })
5261
- }
5262
- )
5308
+ /* @__PURE__ */ jsx42(CardActionList, { actions })
5263
5309
  ] })
5264
5310
  ]
5265
5311
  }
@@ -5458,7 +5504,7 @@ var Rail = styled30(Box13, {
5458
5504
  flexShrink: 0,
5459
5505
  alignSelf: "stretch"
5460
5506
  }));
5461
- var TreeRow = ({ node, depth, onExpandToggle, onCopyId, onContextMenu, renderCard }) => {
5507
+ var TreeRow = ({ node, depth, onExpandToggle, onCopyId, renderCard }) => {
5462
5508
  const hasChildren = Boolean(node.children && node.children.length > 0);
5463
5509
  const { expanded, toggle } = useControlledExpand(
5464
5510
  onExpandToggle != null ? node.expanded : void 0,
@@ -5488,7 +5534,6 @@ var TreeRow = ({ node, depth, onExpandToggle, onCopyId, onContextMenu, renderCar
5488
5534
  depth: depth + 1,
5489
5535
  onExpandToggle,
5490
5536
  onCopyId,
5491
- onContextMenu,
5492
5537
  renderCard
5493
5538
  },
5494
5539
  child.id
@@ -5511,7 +5556,6 @@ var TreeRow = ({ node, depth, onExpandToggle, onCopyId, onContextMenu, renderCar
5511
5556
  expanded,
5512
5557
  onExpandToggle: hasChildren ? toggle : void 0,
5513
5558
  onCopyId: onCopyId && node.idDisplay ? () => onCopyId(node.id) : void 0,
5514
- onContextMenu: onContextMenu ? (e) => onContextMenu(node.id, e) : void 0,
5515
5559
  children: renderedChildren
5516
5560
  }
5517
5561
  );
@@ -5521,7 +5565,6 @@ var DeploymentDashboardTree = ({
5521
5565
  nodes,
5522
5566
  onExpandToggle,
5523
5567
  onCopyId,
5524
- onContextMenu,
5525
5568
  renderCard
5526
5569
  }) => {
5527
5570
  return /* @__PURE__ */ jsx45(
@@ -5541,7 +5584,6 @@ var DeploymentDashboardTree = ({
5541
5584
  depth: 0,
5542
5585
  onExpandToggle,
5543
5586
  onCopyId,
5544
- onContextMenu,
5545
5587
  renderCard
5546
5588
  },
5547
5589
  node.id