@moderneinc/design-system-components 7.1.0-next.d21647 → 7.1.1-next.9c4186

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.
@@ -1,5 +1,11 @@
1
1
  import { type InputBaseProps } from '@mui/material/InputBase';
2
- export interface ModSearchChipProps extends Omit<InputBaseProps, 'startAdornment' | 'endAdornment' | 'type'> {
2
+ type SearchChipSize = 'small' | 'medium';
3
+ export interface ModSearchChipProps extends Omit<InputBaseProps, 'startAdornment' | 'endAdornment' | 'type' | 'size'> {
4
+ /**
5
+ * The size of the search chip
6
+ * @default "medium"
7
+ */
8
+ size?: SearchChipSize;
3
9
  /**
4
10
  * Handler for clearing the search value (shows X icon when provided and value is non-empty)
5
11
  */
@@ -10,8 +16,13 @@ export interface ModSearchChipProps extends Omit<InputBaseProps, 'startAdornment
10
16
  *
11
17
  * @example
12
18
  * <ModSearchChip placeholder="Search titles" value={query} onChange={handleChange} onClear={handleClear} />
19
+ *
20
+ * @example
21
+ * // Small size
22
+ * <ModSearchChip size="small" placeholder="Search titles" value={query} onChange={handleChange} />
13
23
  */
14
24
  export declare const ModSearchChip: {
15
25
  ({ onClear, value, ...props }: ModSearchChipProps): import("react/jsx-runtime").JSX.Element;
16
26
  displayName: string;
17
27
  };
28
+ export {};
package/dist/index.d.ts CHANGED
@@ -2551,7 +2551,13 @@ interface ModRipplingDotProps extends BoxProps$1 {
2551
2551
  */
2552
2552
  declare const ModRipplingDot: FunctionComponent<ModRipplingDotProps>;
2553
2553
 
2554
- interface ModSearchChipProps extends Omit<InputBaseProps, 'startAdornment' | 'endAdornment' | 'type'> {
2554
+ type SearchChipSize = 'small' | 'medium';
2555
+ interface ModSearchChipProps extends Omit<InputBaseProps, 'startAdornment' | 'endAdornment' | 'type' | 'size'> {
2556
+ /**
2557
+ * The size of the search chip
2558
+ * @default "medium"
2559
+ */
2560
+ size?: SearchChipSize;
2555
2561
  /**
2556
2562
  * Handler for clearing the search value (shows X icon when provided and value is non-empty)
2557
2563
  */
@@ -2562,6 +2568,10 @@ interface ModSearchChipProps extends Omit<InputBaseProps, 'startAdornment' | 'en
2562
2568
  *
2563
2569
  * @example
2564
2570
  * <ModSearchChip placeholder="Search titles" value={query} onChange={handleChange} onClear={handleClear} />
2571
+ *
2572
+ * @example
2573
+ * // Small size
2574
+ * <ModSearchChip size="small" placeholder="Search titles" value={query} onChange={handleChange} />
2565
2575
  */
2566
2576
  declare const ModSearchChip: {
2567
2577
  ({ onClear, value, ...props }: ModSearchChipProps): react_jsx_runtime.JSX.Element;
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { semanticColors, spacing, typography, borderRadius, shadows, colors, semanticColorsDark, semanticTypography } from '@moderneinc/design-system-tokens';
2
+ import { semanticColors, spacing, typography, borderRadius, shadows, colors, semanticColorsDark, semanticTypography, height } from '@moderneinc/design-system-tokens';
3
3
  import Box from '@mui/material/Box';
4
4
  import { styled, useTheme, alpha } from '@mui/material/styles';
5
5
  import Chip, { chipClasses } from '@mui/material/Chip';
@@ -965,17 +965,21 @@ ModButtonTab.displayName = 'ModButtonTab';
965
965
  *
966
966
  * Custom styling:
967
967
  * - Rounded-rectangle border (borderRadius.button)
968
- * - Size variants (small=32px, medium=40px)
968
+ * - Size variants (small=24px, medium=40px)
969
969
  * - Border colors using semantic tokens
970
970
  * - Selected state colors from design system tokens
971
971
  */
972
972
  const StyledButtonTabGroup = styled(MuiToggleButtonGroup)(({ theme, size = 'medium' }) => {
973
973
  const sizeStyles = {
974
974
  small: {
975
- height: spacing.spacing_4,
975
+ height: spacing.spacing_3,
976
+ padding: `0 ${spacing.spacing_1_1_2}px`,
977
+ fontSize: typography.fontSize.caption,
976
978
  },
977
979
  medium: {
978
980
  height: spacing.spacing_5,
981
+ padding: `${spacing.spacing_1}px ${spacing.spacing_2}px`,
982
+ fontSize: typography.fontSize.sm,
979
983
  },
980
984
  };
981
985
  return {
@@ -987,8 +991,8 @@ const StyledButtonTabGroup = styled(MuiToggleButtonGroup)(({ theme, size = 'medi
987
991
  flex: 1,
988
992
  minWidth: 'auto',
989
993
  height: sizeStyles[size].height,
990
- padding: `${spacing.spacing_1}px ${spacing.spacing_2}px`,
991
- fontSize: theme.typography.pxToRem(typography.fontSize.sm),
994
+ padding: sizeStyles[size].padding,
995
+ fontSize: theme.typography.pxToRem(sizeStyles[size].fontSize),
992
996
  fontWeight: typography.fontWeight.regular,
993
997
  lineHeight: 1,
994
998
  textTransform: 'none',
@@ -1538,37 +1542,35 @@ const panelSurfaceStyles = {
1538
1542
  const getDataGridHeaderStyles = () => {
1539
1543
  return {
1540
1544
  // Header cell container styles - from Figma: bg, border, padding
1541
- // Height is set via density-specific selectors in DataGrid.tsx
1542
1545
  [`& .${gridClasses.columnHeader}`]: {
1543
1546
  backgroundColor: semanticColors.color.surface.dataGrid.header,
1544
1547
  borderBottom: `1px solid ${semanticColors.color.border.primary}`,
1545
- paddingTop: `${spacing.spacing_1_1_2}px`,
1546
- paddingBottom: `${spacing.spacing_1_1_2}px`,
1547
- paddingLeft: `${spacing.spacing_2}px`,
1548
- paddingRight: `${spacing.spacing_2}px`,
1548
+ paddingTop: `${spacing.spacing_1_1_4}px`,
1549
+ paddingBottom: `${spacing.spacing_1_1_4}px`,
1550
+ // WARNING: must track cell padding in DataGrid.tsx or labels sit left of
1551
+ // the column they label.
1552
+ paddingLeft: `${spacing.spacing_3}px`,
1553
+ paddingRight: `${spacing.spacing_3}px`,
1549
1554
  boxSizing: 'border-box',
1550
1555
  },
1551
1556
  // Style the filler element to match header
1552
- // Height is set via density-specific selectors in DataGrid.tsx
1553
1557
  [`& .${gridClasses.filler}`]: {
1554
1558
  backgroundColor: semanticColors.color.surface.dataGrid.header,
1555
1559
  borderBottom: `1px solid ${semanticColors.color.border.primary}`,
1556
1560
  boxSizing: 'border-box',
1557
1561
  },
1558
- // Style the default MUI column header title text to match Figma
1562
+ // NOTE: tertiary, not secondary — the mock's `--muted` is text.tertiary in
1563
+ // both modes.
1559
1564
  [`& .${gridClasses.columnHeaderTitle}`]: {
1560
- fontFamily: `${typography.fontFamily.body}, sans-serif`,
1561
- fontSize: typography.fontSize.sm,
1562
- fontWeight: typography.fontWeight.semiBold, // Always semiBold (600)
1563
- lineHeight: 'normal',
1564
- color: semanticColors.color.text.secondary, // #6b7280 by default
1565
+ ...semanticTypography.table.header,
1566
+ color: semanticColors.color.text.tertiary,
1565
1567
  transition: 'color 0.2s',
1566
1568
  textOverflow: 'clip',
1567
1569
  whiteSpace: 'break-spaces',
1568
1570
  },
1569
1571
  // Change text color on hover
1570
1572
  [`& .${gridClasses.columnHeader}:hover .${gridClasses.columnHeaderTitle}`]: {
1571
- color: semanticColors.color.icon.default, // #1f2937 on hover
1573
+ color: semanticColors.color.text.primary,
1572
1574
  },
1573
1575
  // Style the checkbox in header to match design system (16x16 from Figma)
1574
1576
  [`& .${gridClasses.columnHeaderCheckbox}`]: {
@@ -1583,9 +1585,8 @@ const getDataGridHeaderStyles = () => {
1583
1585
  },
1584
1586
  },
1585
1587
  },
1586
- // MUI clips this container when header vertical padding leaves < 16px of content
1587
- // area (e.g. compact: 38px − 24px padding = 14px). overflow:visible lets the
1588
- // sort icon render at full 16px without being cropped.
1588
+ // MUI clips this container when padding leaves < 16px of content area, which
1589
+ // crops the sort icon. Guards callers that shrink height.table.header.
1589
1590
  [`& .${gridClasses.columnHeaderTitleContainer}`]: {
1590
1591
  overflow: 'visible',
1591
1592
  lineHeight: 1,
@@ -1800,7 +1801,7 @@ const StyledMenuItem = styled(MenuItem)(({ theme }) => ({
1800
1801
  borderRadius: 0,
1801
1802
  color: semanticColors.color.icon.default,
1802
1803
  textDecoration: 'none',
1803
- fontSize: theme.typography.pxToRem(typography.fontSize.default),
1804
+ fontSize: theme.typography.pxToRem(typography.fontSize.caption),
1804
1805
  fontWeight: typography.fontWeight.regular,
1805
1806
  lineHeight: '20px',
1806
1807
  transition: theme.transitions.create(['background-color'], {
@@ -1820,6 +1821,7 @@ const StyledMenuItem = styled(MenuItem)(({ theme }) => ({
1820
1821
  },
1821
1822
  [`&.${menuItemClasses.focusVisible}`]: {
1822
1823
  backgroundColor: semanticColors.color.surface.rowHover,
1824
+ outline: 'none',
1823
1825
  },
1824
1826
  }));
1825
1827
  const MenuItemContent = styled('div')({
@@ -1897,7 +1899,11 @@ function ModMenuItem({ icon, shortcut, secondaryText, children, component, href,
1897
1899
  // root is `button` (as of @mui/material 9.2) — so an `href` on the default root lands as
1898
1900
  // an attribute on the `<li>` and never navigates (#722). Root at an anchor instead,
1899
1901
  // unless the caller named a component (e.g. a router link) themselves.
1900
- const rootProps = { ...rest, href, component: component ?? (href ? 'a' : undefined) };
1902
+ const rootProps = {
1903
+ ...rest,
1904
+ href,
1905
+ component: component ?? (href ? 'a' : undefined),
1906
+ };
1901
1907
  return (jsx(StyledMenuItem, { ...rootProps, children: jsxs(MenuItemContent, { children: [icon && jsx(IconWrapper$1, { children: icon }), jsxs(LabelContainer$3, { children: [jsx(Label$3, { children: children }), secondaryText && jsx(SecondaryLabel, { children: secondaryText })] }), shortcut && jsx(Shortcut, { children: shortcut })] }) }));
1902
1908
  }
1903
1909
  ModMenuItem.displayName = 'ModMenuItem';
@@ -2379,7 +2385,9 @@ function ModDataGrid({ autoHeight = false, toolbar, slots, sx, density = 'standa
2379
2385
  },
2380
2386
  ...sx,
2381
2387
  };
2382
- return (jsx(DataGridPro, { apiRef: apiRef, columnHeaderHeight: density === 'compact' ? 38 : density === 'comfortable' ? 52 : 44, autoHeight: autoHeight, autoPageSize: !autoHeight, getRowHeight: () => 'auto', showToolbar: !!toolbar, slots: mergedSlots, slotProps: {
2388
+ return (jsx(DataGridPro, { apiRef: apiRef,
2389
+ // One height at every density; `cell.minHeight` below still scales.
2390
+ columnHeaderHeight: height.table.header, autoHeight: autoHeight, autoPageSize: !autoHeight, getRowHeight: () => 'auto', showToolbar: !!toolbar, slots: mergedSlots, slotProps: {
2383
2391
  basePopper: {
2384
2392
  placement: 'bottom-start',
2385
2393
  },
@@ -2407,7 +2415,7 @@ function ModDataGridColumnsButton() {
2407
2415
  }
2408
2416
  ModDataGridColumnsButton.displayName = 'ModDataGridColumnsButton';
2409
2417
 
2410
- const sizeStyles$1 = {
2418
+ const sizeStyles$2 = {
2411
2419
  small: {
2412
2420
  height: 16,
2413
2421
  minWidth: 16,
@@ -2504,7 +2512,7 @@ const StyledChip$2 = styled(Chip, {
2504
2512
  lineHeight: semanticTypography.chip.lineHeight,
2505
2513
  fontWeight: semanticTypography.chip.fontWeight,
2506
2514
  overflow: 'visible',
2507
- ...(size && sizeStyles$1[size]),
2515
+ ...(size && sizeStyles$2[size]),
2508
2516
  [`& .${chipClasses.label}`]: {
2509
2517
  padding: 0,
2510
2518
  overflow: 'visible',
@@ -2552,13 +2560,7 @@ ModDataGridFiltersButton.displayName = 'ModDataGridFiltersButton';
2552
2560
  /**
2553
2561
  * ModDataGridHeaderLabel - Header label for DataGrid columns with help icon support
2554
2562
  *
2555
- * Design tokens used:
2556
- * - Font: typography.fontWeight.semiBold (600)
2557
- * - Font size: 14px (from Figma Table/header)
2558
- * - Colors:
2559
- * - Default: semanticColors.typography.bodySecondary (#6b7280)
2560
- * - Hover: semanticColors.icons.default (#1f2937)
2561
- * - Icons: semanticColors.icons.utility (#9ca3af)
2563
+ * Shares semanticTypography.table.header with the plain DataGrid column title.
2562
2564
  *
2563
2565
  * @example
2564
2566
  * // Basic usage (for custom header content)
@@ -2576,18 +2578,15 @@ const LabelContainer$2 = styled('div')({
2576
2578
  gap: `${spacing.spacing_1_2}px`,
2577
2579
  });
2578
2580
  const LabelText$1 = styled('p')({
2579
- fontFamily: `${typography.fontFamily.body}, sans-serif`,
2580
- fontSize: typography.fontSize.sm,
2581
- fontWeight: typography.fontWeight.semiBold, // Always semiBold (600)
2582
- lineHeight: 'normal',
2583
- color: semanticColors.color.text.secondary, // #6b7280 by default
2581
+ ...semanticTypography.table.header,
2582
+ color: semanticColors.color.text.tertiary,
2584
2583
  whiteSpace: 'nowrap',
2585
2584
  margin: 0,
2586
2585
  padding: 0,
2587
2586
  transition: 'color 0.2s',
2588
2587
  // Hover state - changes to primary text color
2589
2588
  '&:hover': {
2590
- color: semanticColors.color.icon.default, // #1f2937 on hover
2589
+ color: semanticColors.color.text.primary,
2591
2590
  },
2592
2591
  });
2593
2592
  const IconWrapper = styled('div')({
@@ -5318,12 +5317,24 @@ const ModRipplingDot = props => (jsx(Box$1, { "aria-hidden": "true", ...props, s
5318
5317
  } }));
5319
5318
  ModRipplingDot.displayName = 'ModRipplingDot';
5320
5319
 
5321
- const StyledSearchChip = styled(InputBase)(({ theme }) => ({
5320
+ const sizeStyles$1 = {
5321
+ small: {
5322
+ height: height.input.dense,
5323
+ padding: `0 ${spacing.spacing_1_1_4}px`,
5324
+ },
5325
+ medium: {
5326
+ height: height.input.default,
5327
+ padding: `0 ${spacing.spacing_1_1_2}px`,
5328
+ },
5329
+ };
5330
+ const StyledSearchChip = styled(InputBase, {
5331
+ shouldForwardProp: prop => prop !== 'size' && !isMuiInternalProp(prop),
5332
+ })(({ theme, size = 'medium' }) => ({
5322
5333
  borderRadius: borderRadius.button,
5323
5334
  border: `1px solid ${semanticColors.color.border.primary}`,
5324
5335
  backgroundColor: semanticColors.color.surface.raised,
5325
- height: 40,
5326
- padding: `0 ${spacing.spacing_1_1_2}px`,
5336
+ height: sizeStyles$1[size].height,
5337
+ padding: sizeStyles$1[size].padding,
5327
5338
  gap: spacing.spacing_1_2,
5328
5339
  fontSize: theme.typography.pxToRem(typography.fontSize.sm),
5329
5340
  fontWeight: typography.fontWeight.medium,
@@ -5388,6 +5399,10 @@ const ClearButton = styled(ButtonBase)({
5388
5399
  *
5389
5400
  * @example
5390
5401
  * <ModSearchChip placeholder="Search titles" value={query} onChange={handleChange} onClear={handleClear} />
5402
+ *
5403
+ * @example
5404
+ * // Small size
5405
+ * <ModSearchChip size="small" placeholder="Search titles" value={query} onChange={handleChange} />
5391
5406
  */
5392
5407
  const ModSearchChip = ({ onClear, value, ...props }) => {
5393
5408
  const hasValue = Boolean(value && String(value).length > 0);
@@ -5661,9 +5676,13 @@ const ModSkeleton = ({ colorTheme = 'light', position = 'start', ...props }) =>
5661
5676
  };
5662
5677
  ModSkeleton.displayName = 'ModSkeleton';
5663
5678
 
5664
- const sizePadding = {
5665
- small: `${spacing.spacing_3_4}px ${spacing.spacing_1_1_2}px`,
5666
- medium: `${spacing.spacing_1_1_2}px ${spacing.spacing_2}px`,
5679
+ const sizePaddingY = {
5680
+ small: spacing.spacing_3_4,
5681
+ medium: spacing.spacing_1_1_2,
5682
+ };
5683
+ const sizePaddingX = {
5684
+ small: spacing.spacing_1_1_2,
5685
+ medium: spacing.spacing_2,
5667
5686
  };
5668
5687
  const sizeFontSize = {
5669
5688
  small: typography.fontSize.xs,
@@ -5674,14 +5693,12 @@ const StyledTable = styled(MuiTable, {
5674
5693
  })(({ theme, tableSize = 'small' }) => ({
5675
5694
  borderCollapse: 'separate',
5676
5695
  borderSpacing: 0,
5696
+ // `size` scales the rows only; headers hold one treatment and one height.
5677
5697
  [`& .${tableCellClasses.head}`]: {
5698
+ ...semanticTypography.table.header,
5678
5699
  backgroundColor: semanticColors.color.surface.dataGrid.header,
5679
- color: semanticColors.color.text.primary,
5680
- fontFamily: typography.fontFamily.body,
5681
- fontSize: theme.typography.pxToRem(sizeFontSize[tableSize]),
5682
- fontWeight: typography.fontWeight.semiBold,
5683
- lineHeight: 1.4,
5684
- padding: sizePadding[tableSize],
5700
+ color: semanticColors.color.text.tertiary,
5701
+ padding: `${spacing.spacing_1_1_4}px ${sizePaddingX[tableSize]}px`,
5685
5702
  borderBottom: `1px solid ${semanticColors.color.border.primary}`,
5686
5703
  },
5687
5704
  [`& .${tableCellClasses.body}`]: {
@@ -5690,7 +5707,7 @@ const StyledTable = styled(MuiTable, {
5690
5707
  fontSize: theme.typography.pxToRem(sizeFontSize[tableSize]),
5691
5708
  fontWeight: typography.fontWeight.regular,
5692
5709
  lineHeight: 1.4,
5693
- padding: sizePadding[tableSize],
5710
+ padding: `${sizePaddingY[tableSize]}px ${sizePaddingX[tableSize]}px`,
5694
5711
  borderBottom: `1px solid ${semanticColors.color.border.primary}`,
5695
5712
  },
5696
5713
  // Drop the trailing row's bottom border so the container border (if