@moderneinc/neo-styled-components 2.8.0-next.fea0d4 → 3.0.0-next.ac08ae

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,5 @@
1
1
  import { type AlertProps } from '@mui/material/Alert';
2
- import type { ReactNode } from 'react';
2
+ import { type ReactNode } from 'react';
3
3
  type Intent = 'info' | 'success' | 'error' | 'warning' | 'neutral';
4
4
  type BannerType = 'outlined' | 'filled';
5
5
  export interface NeoBannerProps extends Omit<AlertProps, 'variant' | 'severity' | 'color'> {
@@ -38,7 +38,7 @@ export interface NeoBannerProps extends Omit<AlertProps, 'variant' | 'severity'
38
38
  linkText?: string;
39
39
  /**
40
40
  * Whether to show the close button
41
- * @default true
41
+ * @default false
42
42
  *
43
43
  * @figmaPropMapping Dismissible → showClose
44
44
  */
@@ -58,7 +58,7 @@ export interface NeoBannerProps extends Omit<AlertProps, 'variant' | 'severity'
58
58
  onLinkClick?: () => void;
59
59
  }
60
60
  export declare const NeoBanner: {
61
- ({ intent, type, message, messagePosition, linkText, showClose, icon, onClose, onLinkClick, ...props }: NeoBannerProps): import("react/jsx-runtime").JSX.Element;
61
+ ({ intent, type, message, messagePosition, linkText, showClose, icon, onClose, onLinkClick, ...props }: NeoBannerProps): import("react/jsx-runtime").JSX.Element | null;
62
62
  displayName: string;
63
63
  };
64
64
  export {};
package/dist/Tag/Tag.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { type ChipProps } from '@mui/material/Chip';
1
+ import Chip from '@mui/material/Chip';
2
+ import type { ComponentPropsWithoutRef, ElementType } from 'react';
2
3
  declare module '@mui/material/Chip' {
3
4
  interface ChipPropsColorOverrides {
4
5
  violet: true;
@@ -12,7 +13,7 @@ declare module '@mui/material/Chip' {
12
13
  filled: true;
13
14
  }
14
15
  }
15
- export interface NeoTagProps extends Omit<ChipProps, 'variant' | 'size'> {
16
+ type NeoTagOwnProps = {
16
17
  /**
17
18
  * The size of the tag
18
19
  * @figma m (sm|md|lg)
@@ -31,7 +32,10 @@ export interface NeoTagProps extends Omit<ChipProps, 'variant' | 'size'> {
31
32
  * @default "default"
32
33
  */
33
34
  color?: 'default' | 'error' | 'warning' | 'success' | 'info' | 'violet' | 'beta';
34
- }
35
+ };
36
+ export type NeoTagProps<C extends ElementType = typeof Chip> = NeoTagOwnProps & Omit<ComponentPropsWithoutRef<C>, keyof NeoTagOwnProps> & {
37
+ component?: C;
38
+ };
35
39
  /**
36
40
  * NeoTag - Small pill-shaped label component based on MUI Chip
37
41
  *
@@ -43,7 +47,8 @@ export interface NeoTagProps extends Omit<ChipProps, 'variant' | 'size'> {
43
47
  * - state (Neutral|Error|Warning|Success|Info|Violet|Beta) → color (default|error|warning|success|info|violet|beta)
44
48
  * - Label text → label prop
45
49
  */
46
- export declare const NeoTag: {
47
- ({ size, variant, ...props }: NeoTagProps): import("react/jsx-runtime").JSX.Element;
48
- displayName: string;
49
- };
50
+ export declare function NeoTag<C extends ElementType = typeof Chip>({ size, variant, ...props }: NeoTagProps<C>): import("react/jsx-runtime").JSX.Element;
51
+ export declare namespace NeoTag {
52
+ var displayName: string;
53
+ }
54
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
- import React__default, { ReactNode, ElementType, HTMLAttributes, ComponentType } from 'react';
3
+ import React__default, { ReactNode, ElementType, HTMLAttributes, ComponentType, ComponentPropsWithoutRef } from 'react';
4
4
  import { GridDensity, GridFilterPanel } from '@mui/x-data-grid';
5
5
  import { AvatarProps } from '@mui/material/Avatar';
6
- import { ChipProps } from '@mui/material/Chip';
6
+ import Chip, { ChipProps } from '@mui/material/Chip';
7
7
  import { AlertProps } from '@mui/material/Alert';
8
8
  import { LinkProps } from '@mui/material/Link';
9
9
  import * as ButtonBase from '@mui/material/ButtonBase';
@@ -400,7 +400,7 @@ interface NeoBannerProps extends Omit<AlertProps, 'variant' | 'severity' | 'colo
400
400
  linkText?: string;
401
401
  /**
402
402
  * Whether to show the close button
403
- * @default true
403
+ * @default false
404
404
  *
405
405
  * @figmaPropMapping Dismissible → showClose
406
406
  */
@@ -420,7 +420,7 @@ interface NeoBannerProps extends Omit<AlertProps, 'variant' | 'severity' | 'colo
420
420
  onLinkClick?: () => void;
421
421
  }
422
422
  declare const NeoBanner: {
423
- ({ intent, type, message, messagePosition, linkText, showClose, icon, onClose, onLinkClick, ...props }: NeoBannerProps): react_jsx_runtime.JSX.Element;
423
+ ({ intent, type, message, messagePosition, linkText, showClose, icon, onClose, onLinkClick, ...props }: NeoBannerProps): react_jsx_runtime.JSX.Element | null;
424
424
  displayName: string;
425
425
  };
426
426
 
@@ -2218,7 +2218,7 @@ declare module '@mui/material/Chip' {
2218
2218
  filled: true;
2219
2219
  }
2220
2220
  }
2221
- interface NeoTagProps extends Omit<ChipProps, 'variant' | 'size'> {
2221
+ type NeoTagOwnProps = {
2222
2222
  /**
2223
2223
  * The size of the tag
2224
2224
  * @figma m (sm|md|lg)
@@ -2237,7 +2237,10 @@ interface NeoTagProps extends Omit<ChipProps, 'variant' | 'size'> {
2237
2237
  * @default "default"
2238
2238
  */
2239
2239
  color?: 'default' | 'error' | 'warning' | 'success' | 'info' | 'violet' | 'beta';
2240
- }
2240
+ };
2241
+ type NeoTagProps<C extends ElementType = typeof Chip> = NeoTagOwnProps & Omit<ComponentPropsWithoutRef<C>, keyof NeoTagOwnProps> & {
2242
+ component?: C;
2243
+ };
2241
2244
  /**
2242
2245
  * NeoTag - Small pill-shaped label component based on MUI Chip
2243
2246
  *
@@ -2249,10 +2252,10 @@ interface NeoTagProps extends Omit<ChipProps, 'variant' | 'size'> {
2249
2252
  * - state (Neutral|Error|Warning|Success|Info|Violet|Beta) → color (default|error|warning|success|info|violet|beta)
2250
2253
  * - Label text → label prop
2251
2254
  */
2252
- declare const NeoTag: {
2253
- ({ size, variant, ...props }: NeoTagProps): react_jsx_runtime.JSX.Element;
2254
- displayName: string;
2255
- };
2255
+ declare function NeoTag<C extends ElementType = typeof Chip>({ size, variant, ...props }: NeoTagProps<C>): react_jsx_runtime.JSX.Element;
2256
+ declare namespace NeoTag {
2257
+ var displayName: string;
2258
+ }
2256
2259
 
2257
2260
  interface NeoToastProps extends Omit<AlertProps, 'variant' | 'severity' | 'color'> {
2258
2261
  /**
package/dist/index.esm.js CHANGED
@@ -7,7 +7,7 @@ import Chip, { chipClasses } from '@mui/material/Chip';
7
7
  import SvgIcon, { svgIconClasses } from '@mui/material/SvgIcon';
8
8
  import Alert, { alertClasses } from '@mui/material/Alert';
9
9
  import IconButton, { iconButtonClasses } from '@mui/material/IconButton';
10
- import React, { forwardRef, createElement, useRef, useCallback, useState, useMemo, useEffect } from 'react';
10
+ import React, { forwardRef, createElement, useState, useRef, useCallback, useMemo, useEffect } from 'react';
11
11
  import Breadcrumbs, { breadcrumbsClasses } from '@mui/material/Breadcrumbs';
12
12
  import Link from '@mui/material/Link';
13
13
  import ButtonBase, { buttonBaseClasses } from '@mui/material/ButtonBase';
@@ -136,7 +136,7 @@ const AvatarContainer = styled(Box)(({ size = 'medium' }) => ({
136
136
  alignItems: 'center',
137
137
  justifyContent: 'center',
138
138
  overflow: 'hidden',
139
- boxShadow: `${shadows.neutralSmall.x}px ${shadows.neutralSmall.y}px ${shadows.neutralSmall.blur}px ${shadows.neutralSmall.spread}px ${shadows.neutralSmall.shadow}`,
139
+ boxShadow: `${shadows.neutral.small.x}px ${shadows.neutral.small.y}px ${shadows.neutral.small.blur}px ${shadows.neutral.small.spread}px ${shadows.neutral.small.shadow}`,
140
140
  }),
141
141
  '&:focus-within': {
142
142
  ...focusRingStyles,
@@ -998,7 +998,7 @@ const StyledAlert$2 = styled(Alert, {
998
998
  alignItems: 'center',
999
999
  justifyContent: messagePosition === 'center' ? 'center' : 'flex-start',
1000
1000
  ...(messagePosition === 'center' && { position: 'relative' }),
1001
- boxShadow: `${shadows.neutralSmall.x}px ${shadows.neutralSmall.y}px ${shadows.neutralSmall.blur}px ${shadows.neutralSmall.spread}px ${shadows.neutralSmall.shadow}`,
1001
+ boxShadow: `${shadows.neutral.small.x}px ${shadows.neutral.small.y}px ${shadows.neutral.small.blur}px ${shadows.neutral.small.spread}px ${shadows.neutral.small.shadow}`,
1002
1002
  fontSize: typography.fontSize.default,
1003
1003
  fontWeight: typography.fontWeight.medium,
1004
1004
  lineHeight: 1.5,
@@ -1044,9 +1044,17 @@ const StyledIconButton$1 = styled(IconButton)(({ closeIconColor }) => ({
1044
1044
  backgroundColor: 'transparent',
1045
1045
  },
1046
1046
  }));
1047
- const NeoBanner = ({ intent = 'info', type = 'outlined', message, messagePosition = 'left', linkText, showClose = true, icon, onClose, onLinkClick, ...props }) => {
1047
+ const NeoBanner = ({ intent = 'info', type = 'outlined', message, messagePosition = 'left', linkText, showClose = false, icon, onClose, onLinkClick, ...props }) => {
1048
+ const [dismissed, setDismissed] = useState(false);
1049
+ const handleClose = () => {
1050
+ setDismissed(true);
1051
+ onClose?.();
1052
+ };
1053
+ if (dismissed) {
1054
+ return null;
1055
+ }
1048
1056
  const closeIconColor = type === 'filled' ? semanticColors.surfaces.white : intentColors[intent].default;
1049
- return (jsx(StyledAlert$2, { ...props, intent: intent, bannerType: type, messagePosition: messagePosition, icon: messagePosition === 'left' ? icon || false : false, action: showClose ? (jsx(StyledIconButton$1, { size: "small", onClick: onClose, closeIconColor: closeIconColor, children: jsx(X, { size: 24 }) })) : undefined, children: messagePosition === 'center' ? (jsxs(Fragment, { children: [icon, jsx("span", { children: message }), linkText && (jsx(LinkText, { bannerType: type, onClick: onLinkClick, children: linkText }))] })) : (jsxs(Fragment, { children: [jsx("span", { children: message }), linkText && (jsx(LinkText, { bannerType: type, onClick: onLinkClick, children: linkText }))] })) }));
1057
+ return (jsx(StyledAlert$2, { ...props, intent: intent, bannerType: type, messagePosition: messagePosition, icon: messagePosition === 'left' ? icon || false : false, action: showClose ? (jsx(StyledIconButton$1, { size: "small", onClick: handleClose, closeIconColor: closeIconColor, children: jsx(X, { size: 24 }) })) : undefined, children: messagePosition === 'center' ? (jsxs(Fragment, { children: [icon, jsx("span", { children: message }), linkText && (jsx(LinkText, { bannerType: type, onClick: onLinkClick, children: linkText }))] })) : (jsxs(Fragment, { children: [jsx("span", { children: message }), linkText && (jsx(LinkText, { bannerType: type, onClick: onLinkClick, children: linkText }))] })) }));
1050
1058
  };
1051
1059
  NeoBanner.displayName = 'NeoBanner';
1052
1060
 
@@ -2839,9 +2847,9 @@ const StyledChip$1 = styled(Chip)(({ theme, size, variant, color }) => ({
2839
2847
  * - state (Neutral|Error|Warning|Success|Info|Violet|Beta) → color (default|error|warning|success|info|violet|beta)
2840
2848
  * - Label text → label prop
2841
2849
  */
2842
- const NeoTag = ({ size = 'small', variant = 'outlined', ...props }) => {
2850
+ function NeoTag({ size = 'small', variant = 'outlined', ...props }) {
2843
2851
  return jsx(StyledChip$1, { size: size, variant: variant, ...props });
2844
- };
2852
+ }
2845
2853
  NeoTag.displayName = 'NeoTag';
2846
2854
 
2847
2855
  /**
@@ -4063,11 +4071,11 @@ const StyledFooter = styled(Box, {
4063
4071
  '&::before': {
4064
4072
  content: showShadow ? '""' : 'none',
4065
4073
  position: 'absolute',
4066
- top: `-${shadows.neutralRegular.blur}px`, // -4px
4074
+ top: `-${shadows.neutral.regular.blur}px`, // -4px
4067
4075
  left: 0,
4068
4076
  right: 0,
4069
- height: `${shadows.neutralRegular.blur}px`, // 4px
4070
- background: `linear-gradient(to top, ${shadows.neutralRegular.shadow}, transparent)`, // rgba(31, 41, 55, 0.1)
4077
+ height: `${shadows.neutral.regular.blur}px`, // 4px
4078
+ background: `linear-gradient(to top, ${shadows.neutral.regular.shadow}, transparent)`, // rgba(31, 41, 55, 0.1)
4071
4079
  pointerEvents: 'none',
4072
4080
  },
4073
4081
  [theme.breakpoints.down('sm')]: {
@@ -4486,7 +4494,7 @@ const InfoIconWrapper = styled('span')({
4486
4494
  });
4487
4495
  const StyledInputBase = styled(InputBase, {
4488
4496
  shouldForwardProp: prop => prop !== 'size' && prop !== 'destructive',
4489
- })(({ theme, size = 'medium', destructive, startAdornment }) => {
4497
+ })(({ theme, size = 'medium', destructive, startAdornment, multiline }) => {
4490
4498
  const sizeConfig = {
4491
4499
  small: {
4492
4500
  height: spacing.spacing_5,
@@ -4503,7 +4511,7 @@ const StyledInputBase = styled(InputBase, {
4503
4511
  };
4504
4512
  const sizeStyles = sizeConfig[size];
4505
4513
  return {
4506
- height: sizeStyles.height,
4514
+ height: multiline ? 'auto' : sizeStyles.height,
4507
4515
  fontSize: sizeStyles.fontSize,
4508
4516
  borderRadius: sizeStyles.borderRadius,
4509
4517
  backgroundColor: semanticColors.input.background,
@@ -6427,7 +6435,7 @@ const StyledSwitch = styled(Switch, {
6427
6435
  [`& .${switchClasses.thumb}`]: {
6428
6436
  width: config.thumbSize,
6429
6437
  height: config.thumbSize,
6430
- boxShadow: `${shadows.neutralSmall.x}px ${shadows.neutralSmall.y}px ${shadows.neutralSmall.blur}px ${shadows.neutralSmall.spread}px ${shadows.neutralSmall.shadow}`,
6438
+ boxShadow: `${shadows.neutral.small.x}px ${shadows.neutral.small.y}px ${shadows.neutral.small.blur}px ${shadows.neutral.small.spread}px ${shadows.neutral.small.shadow}`,
6431
6439
  transition: theme.transitions.create(['width'], {
6432
6440
  duration: theme.transitions.duration.shortest,
6433
6441
  }),
@@ -6596,7 +6604,7 @@ const StyledTooltip = styled(Tooltip, {
6596
6604
  justifyContent: 'center',
6597
6605
  }),
6598
6606
  // Apply shadow
6599
- boxShadow: `${shadows.neutralMedium.x}px ${shadows.neutralMedium.y}px ${shadows.neutralMedium.blur}px ${shadows.neutralMedium.spread}px ${shadows.neutralMedium.shadow}`,
6607
+ boxShadow: `${shadows.neutral.medium.x}px ${shadows.neutral.medium.y}px ${shadows.neutral.medium.blur}px ${shadows.neutral.medium.spread}px ${shadows.neutral.medium.shadow}`,
6600
6608
  },
6601
6609
  // Style the arrow
6602
6610
  [`& .${tooltipClasses.arrow}`]: {