@moderneinc/design-system-components 7.1.0-next.d21647 → 7.1.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/SearchChip/SearchChip.d.ts +12 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.esm.js +37 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +36 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { type InputBaseProps } from '@mui/material/InputBase';
|
|
2
|
-
|
|
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
|
-
|
|
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=
|
|
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.
|
|
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:
|
|
991
|
-
fontSize: theme.typography.pxToRem(
|
|
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',
|
|
@@ -1800,7 +1804,7 @@ const StyledMenuItem = styled(MenuItem)(({ theme }) => ({
|
|
|
1800
1804
|
borderRadius: 0,
|
|
1801
1805
|
color: semanticColors.color.icon.default,
|
|
1802
1806
|
textDecoration: 'none',
|
|
1803
|
-
fontSize: theme.typography.pxToRem(typography.fontSize.
|
|
1807
|
+
fontSize: theme.typography.pxToRem(typography.fontSize.caption),
|
|
1804
1808
|
fontWeight: typography.fontWeight.regular,
|
|
1805
1809
|
lineHeight: '20px',
|
|
1806
1810
|
transition: theme.transitions.create(['background-color'], {
|
|
@@ -1820,6 +1824,7 @@ const StyledMenuItem = styled(MenuItem)(({ theme }) => ({
|
|
|
1820
1824
|
},
|
|
1821
1825
|
[`&.${menuItemClasses.focusVisible}`]: {
|
|
1822
1826
|
backgroundColor: semanticColors.color.surface.rowHover,
|
|
1827
|
+
outline: 'none',
|
|
1823
1828
|
},
|
|
1824
1829
|
}));
|
|
1825
1830
|
const MenuItemContent = styled('div')({
|
|
@@ -1897,7 +1902,11 @@ function ModMenuItem({ icon, shortcut, secondaryText, children, component, href,
|
|
|
1897
1902
|
// root is `button` (as of @mui/material 9.2) — so an `href` on the default root lands as
|
|
1898
1903
|
// an attribute on the `<li>` and never navigates (#722). Root at an anchor instead,
|
|
1899
1904
|
// unless the caller named a component (e.g. a router link) themselves.
|
|
1900
|
-
const rootProps = {
|
|
1905
|
+
const rootProps = {
|
|
1906
|
+
...rest,
|
|
1907
|
+
href,
|
|
1908
|
+
component: component ?? (href ? 'a' : undefined),
|
|
1909
|
+
};
|
|
1901
1910
|
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
1911
|
}
|
|
1903
1912
|
ModMenuItem.displayName = 'ModMenuItem';
|
|
@@ -2407,7 +2416,7 @@ function ModDataGridColumnsButton() {
|
|
|
2407
2416
|
}
|
|
2408
2417
|
ModDataGridColumnsButton.displayName = 'ModDataGridColumnsButton';
|
|
2409
2418
|
|
|
2410
|
-
const sizeStyles$
|
|
2419
|
+
const sizeStyles$2 = {
|
|
2411
2420
|
small: {
|
|
2412
2421
|
height: 16,
|
|
2413
2422
|
minWidth: 16,
|
|
@@ -2504,7 +2513,7 @@ const StyledChip$2 = styled(Chip, {
|
|
|
2504
2513
|
lineHeight: semanticTypography.chip.lineHeight,
|
|
2505
2514
|
fontWeight: semanticTypography.chip.fontWeight,
|
|
2506
2515
|
overflow: 'visible',
|
|
2507
|
-
...(size && sizeStyles$
|
|
2516
|
+
...(size && sizeStyles$2[size]),
|
|
2508
2517
|
[`& .${chipClasses.label}`]: {
|
|
2509
2518
|
padding: 0,
|
|
2510
2519
|
overflow: 'visible',
|
|
@@ -5318,12 +5327,24 @@ const ModRipplingDot = props => (jsx(Box$1, { "aria-hidden": "true", ...props, s
|
|
|
5318
5327
|
} }));
|
|
5319
5328
|
ModRipplingDot.displayName = 'ModRipplingDot';
|
|
5320
5329
|
|
|
5321
|
-
const
|
|
5330
|
+
const sizeStyles$1 = {
|
|
5331
|
+
small: {
|
|
5332
|
+
height: height.input.dense,
|
|
5333
|
+
padding: `0 ${spacing.spacing_1_1_4}px`,
|
|
5334
|
+
},
|
|
5335
|
+
medium: {
|
|
5336
|
+
height: height.input.default,
|
|
5337
|
+
padding: `0 ${spacing.spacing_1_1_2}px`,
|
|
5338
|
+
},
|
|
5339
|
+
};
|
|
5340
|
+
const StyledSearchChip = styled(InputBase, {
|
|
5341
|
+
shouldForwardProp: prop => prop !== 'size' && !isMuiInternalProp(prop),
|
|
5342
|
+
})(({ theme, size = 'medium' }) => ({
|
|
5322
5343
|
borderRadius: borderRadius.button,
|
|
5323
5344
|
border: `1px solid ${semanticColors.color.border.primary}`,
|
|
5324
5345
|
backgroundColor: semanticColors.color.surface.raised,
|
|
5325
|
-
height:
|
|
5326
|
-
padding:
|
|
5346
|
+
height: sizeStyles$1[size].height,
|
|
5347
|
+
padding: sizeStyles$1[size].padding,
|
|
5327
5348
|
gap: spacing.spacing_1_2,
|
|
5328
5349
|
fontSize: theme.typography.pxToRem(typography.fontSize.sm),
|
|
5329
5350
|
fontWeight: typography.fontWeight.medium,
|
|
@@ -5388,6 +5409,10 @@ const ClearButton = styled(ButtonBase)({
|
|
|
5388
5409
|
*
|
|
5389
5410
|
* @example
|
|
5390
5411
|
* <ModSearchChip placeholder="Search titles" value={query} onChange={handleChange} onClear={handleClear} />
|
|
5412
|
+
*
|
|
5413
|
+
* @example
|
|
5414
|
+
* // Small size
|
|
5415
|
+
* <ModSearchChip size="small" placeholder="Search titles" value={query} onChange={handleChange} />
|
|
5391
5416
|
*/
|
|
5392
5417
|
const ModSearchChip = ({ onClear, value, ...props }) => {
|
|
5393
5418
|
const hasValue = Boolean(value && String(value).length > 0);
|