@moderneinc/neo-styled-components 4.0.1-next.ee3643 → 4.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/IconButton/IconButton.d.ts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.esm.js +44 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +44 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type IconButtonProps } from '@mui/material/IconButton';
|
|
2
2
|
type IconButtonSize = 'small' | 'medium';
|
|
3
|
+
type IconButtonVariant = 'default' | 'nav';
|
|
3
4
|
export interface NeoIconButtonProps extends Omit<IconButtonProps, 'color' | 'size'> {
|
|
4
5
|
/**
|
|
5
6
|
* The size of the icon button
|
|
@@ -8,11 +9,25 @@ export interface NeoIconButtonProps extends Omit<IconButtonProps, 'color' | 'siz
|
|
|
8
9
|
* @figma Size
|
|
9
10
|
*/
|
|
10
11
|
size?: IconButtonSize;
|
|
12
|
+
/**
|
|
13
|
+
* The visual variant of the icon button
|
|
14
|
+
* - `default`: Transparent neutral style
|
|
15
|
+
* - `nav`: White background with border, used in global navigation
|
|
16
|
+
* @default "default"
|
|
17
|
+
*/
|
|
18
|
+
variant?: IconButtonVariant;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the button is in an active/selected state (e.g., popover is open).
|
|
21
|
+
* Only applies to the `nav` variant.
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
active?: boolean;
|
|
11
25
|
}
|
|
12
26
|
/**
|
|
13
27
|
* NeoIconButton - Icon-only button component based on MUI IconButton
|
|
14
28
|
*
|
|
15
29
|
* Simple, neutral icon button with transparent background and icon color states.
|
|
30
|
+
* Use `variant="nav"` for the global navigation pill-shaped button style.
|
|
16
31
|
*
|
|
17
32
|
* @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC?node-id=11126-21344
|
|
18
33
|
*
|
|
@@ -25,7 +40,7 @@ export interface NeoIconButtonProps extends Omit<IconButtonProps, 'color' | 'siz
|
|
|
25
40
|
* - State=Loading → not yet implemented
|
|
26
41
|
*/
|
|
27
42
|
export declare const NeoIconButton: {
|
|
28
|
-
({ size, ...props }: NeoIconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
({ size, variant, active, ...props }: NeoIconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
29
44
|
displayName: string;
|
|
30
45
|
};
|
|
31
46
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1421,6 +1421,7 @@ declare const NeoGeneralAvatar: {
|
|
|
1421
1421
|
};
|
|
1422
1422
|
|
|
1423
1423
|
type IconButtonSize = 'small' | 'medium';
|
|
1424
|
+
type IconButtonVariant = 'default' | 'nav';
|
|
1424
1425
|
interface NeoIconButtonProps extends Omit<IconButtonProps, 'color' | 'size'> {
|
|
1425
1426
|
/**
|
|
1426
1427
|
* The size of the icon button
|
|
@@ -1429,11 +1430,25 @@ interface NeoIconButtonProps extends Omit<IconButtonProps, 'color' | 'size'> {
|
|
|
1429
1430
|
* @figma Size
|
|
1430
1431
|
*/
|
|
1431
1432
|
size?: IconButtonSize;
|
|
1433
|
+
/**
|
|
1434
|
+
* The visual variant of the icon button
|
|
1435
|
+
* - `default`: Transparent neutral style
|
|
1436
|
+
* - `nav`: White background with border, used in global navigation
|
|
1437
|
+
* @default "default"
|
|
1438
|
+
*/
|
|
1439
|
+
variant?: IconButtonVariant;
|
|
1440
|
+
/**
|
|
1441
|
+
* Whether the button is in an active/selected state (e.g., popover is open).
|
|
1442
|
+
* Only applies to the `nav` variant.
|
|
1443
|
+
* @default false
|
|
1444
|
+
*/
|
|
1445
|
+
active?: boolean;
|
|
1432
1446
|
}
|
|
1433
1447
|
/**
|
|
1434
1448
|
* NeoIconButton - Icon-only button component based on MUI IconButton
|
|
1435
1449
|
*
|
|
1436
1450
|
* Simple, neutral icon button with transparent background and icon color states.
|
|
1451
|
+
* Use `variant="nav"` for the global navigation pill-shaped button style.
|
|
1437
1452
|
*
|
|
1438
1453
|
* @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC?node-id=11126-21344
|
|
1439
1454
|
*
|
|
@@ -1446,7 +1461,7 @@ interface NeoIconButtonProps extends Omit<IconButtonProps, 'color' | 'size'> {
|
|
|
1446
1461
|
* - State=Loading → not yet implemented
|
|
1447
1462
|
*/
|
|
1448
1463
|
declare const NeoIconButton: {
|
|
1449
|
-
({ size, ...props }: NeoIconButtonProps): react_jsx_runtime.JSX.Element;
|
|
1464
|
+
({ size, variant, active, ...props }: NeoIconButtonProps): react_jsx_runtime.JSX.Element;
|
|
1450
1465
|
displayName: string;
|
|
1451
1466
|
};
|
|
1452
1467
|
|
package/dist/index.esm.js
CHANGED
|
@@ -3409,10 +3409,18 @@ function subMonths(date, amount, options) {
|
|
|
3409
3409
|
}
|
|
3410
3410
|
|
|
3411
3411
|
// Props that should not be forwarded to IconButton (Button-specific props that IconButton doesn't support)
|
|
3412
|
-
const buttonOnlyProps = [
|
|
3412
|
+
const buttonOnlyProps = [
|
|
3413
|
+
'size',
|
|
3414
|
+
'startIcon',
|
|
3415
|
+
'endIcon',
|
|
3416
|
+
'fullWidth',
|
|
3417
|
+
'disableElevation',
|
|
3418
|
+
'variant',
|
|
3419
|
+
'active',
|
|
3420
|
+
];
|
|
3413
3421
|
const StyledIconButton = styled(IconButton, {
|
|
3414
3422
|
shouldForwardProp: prop => !buttonOnlyProps.includes(prop),
|
|
3415
|
-
})(({ theme, size = 'medium' }) => {
|
|
3423
|
+
})(({ theme, size = 'medium', variant = 'default', active = false }) => {
|
|
3416
3424
|
// Size configurations using theme.spacing()
|
|
3417
3425
|
const sizeConfig = {
|
|
3418
3426
|
small: {
|
|
@@ -3447,8 +3455,8 @@ const StyledIconButton = styled(IconButton, {
|
|
|
3447
3455
|
outlineOffset: 2,
|
|
3448
3456
|
},
|
|
3449
3457
|
};
|
|
3450
|
-
//
|
|
3451
|
-
const
|
|
3458
|
+
// Default variant - transparent neutral style
|
|
3459
|
+
const defaultStyles = {
|
|
3452
3460
|
backgroundColor: 'transparent',
|
|
3453
3461
|
color: semanticColors.icons.default,
|
|
3454
3462
|
border: 'none',
|
|
@@ -3464,15 +3472,44 @@ const StyledIconButton = styled(IconButton, {
|
|
|
3464
3472
|
color: semanticColors.icons.disabled,
|
|
3465
3473
|
},
|
|
3466
3474
|
};
|
|
3475
|
+
// Nav variant - 44px pill with border, used in global navigation
|
|
3476
|
+
const activeNavStyles = {
|
|
3477
|
+
backgroundColor: semanticColors.icons.pressedBackground,
|
|
3478
|
+
borderColor: 'transparent',
|
|
3479
|
+
color: semanticColors.buttons.primary.pressed,
|
|
3480
|
+
};
|
|
3481
|
+
const navStyles = {
|
|
3482
|
+
backgroundColor: semanticColors.surfaces.white,
|
|
3483
|
+
color: semanticColors.icons.default,
|
|
3484
|
+
border: `1px solid ${semanticColors.border.secondary}`,
|
|
3485
|
+
'&:hover': {
|
|
3486
|
+
backgroundColor: semanticColors.input.hoverBackground,
|
|
3487
|
+
borderColor: semanticColors.border.primary,
|
|
3488
|
+
color: semanticColors.icons.default,
|
|
3489
|
+
},
|
|
3490
|
+
'&:active': activeNavStyles,
|
|
3491
|
+
[`&.${iconButtonClasses.disabled}`]: {
|
|
3492
|
+
backgroundColor: semanticColors.surfaces.white,
|
|
3493
|
+
borderColor: semanticColors.border.secondary,
|
|
3494
|
+
color: semanticColors.icons.disabled,
|
|
3495
|
+
opacity: 0.5,
|
|
3496
|
+
},
|
|
3497
|
+
...(active ? activeNavStyles : {}),
|
|
3498
|
+
};
|
|
3499
|
+
const variantStyles = {
|
|
3500
|
+
default: defaultStyles,
|
|
3501
|
+
nav: navStyles,
|
|
3502
|
+
};
|
|
3467
3503
|
return {
|
|
3468
3504
|
...baseStyles,
|
|
3469
|
-
...
|
|
3505
|
+
...variantStyles[variant],
|
|
3470
3506
|
};
|
|
3471
3507
|
});
|
|
3472
3508
|
/**
|
|
3473
3509
|
* NeoIconButton - Icon-only button component based on MUI IconButton
|
|
3474
3510
|
*
|
|
3475
3511
|
* Simple, neutral icon button with transparent background and icon color states.
|
|
3512
|
+
* Use `variant="nav"` for the global navigation pill-shaped button style.
|
|
3476
3513
|
*
|
|
3477
3514
|
* @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC?node-id=11126-21344
|
|
3478
3515
|
*
|
|
@@ -3484,8 +3521,8 @@ const StyledIconButton = styled(IconButton, {
|
|
|
3484
3521
|
* - State=Focus → CSS :focus-visible
|
|
3485
3522
|
* - State=Loading → not yet implemented
|
|
3486
3523
|
*/
|
|
3487
|
-
const NeoIconButton = ({ size = 'medium', ...props }) => {
|
|
3488
|
-
return jsx(StyledIconButton, { size: size, ...props });
|
|
3524
|
+
const NeoIconButton = ({ size = 'medium', variant = 'default', active = false, ...props }) => {
|
|
3525
|
+
return (jsx(StyledIconButton, { size: size, variant: variant, active: active, disableRipple: variant === 'nav', ...props }));
|
|
3489
3526
|
};
|
|
3490
3527
|
NeoIconButton.displayName = 'NeoIconButton';
|
|
3491
3528
|
|