@moderneinc/neo-styled-components 2.8.0-next.22110f → 2.8.0-next.4df497

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,13 +1,22 @@
1
1
  import { type AlertProps } from '@mui/material/Alert';
2
2
  import type { ReactNode } from 'react';
3
+ type Intent = 'info' | 'success' | 'error' | 'warning' | 'neutral';
4
+ type BannerType = 'outlined' | 'filled';
3
5
  export interface NeoBannerProps extends Omit<AlertProps, 'variant' | 'severity' | 'color'> {
4
6
  /**
5
- * The visual style variant of the banner
6
- * @default "light"
7
+ * The intent/purpose of the banner
8
+ * @default "info"
7
9
  *
8
- * @figmaPropMapping color (Dark|Light|Success|Error|Warning) → variant
10
+ * @figmaPropMapping Intention (Info|Success|Error|Warning|Neutral) → intent
9
11
  */
10
- variant?: 'dark' | 'light' | 'success' | 'error' | 'warning';
12
+ intent?: Intent;
13
+ /**
14
+ * Visual type: outlined (light bg) or filled (solid bg)
15
+ * @default "outlined"
16
+ *
17
+ * @figmaPropMapping Type (Outlined|Filled) → type
18
+ */
19
+ type?: BannerType;
11
20
  /**
12
21
  * The message text to display
13
22
  *
@@ -18,20 +27,20 @@ export interface NeoBannerProps extends Omit<AlertProps, 'variant' | 'severity'
18
27
  * Horizontal alignment of the message content
19
28
  * @default "left"
20
29
  *
21
- * @figmaPropMapping messagePosition (Left|Center) → messagePosition
30
+ * @figmaPropMapping Message Position (Left|Center) → messagePosition
22
31
  */
23
32
  messagePosition?: 'left' | 'center';
24
33
  /**
25
34
  * Optional link text to display after the message
26
35
  *
27
- * @figmaPropMapping link (boolean) → linkText (string)
36
+ * @figmaPropMapping Show Link (boolean) → linkText (string)
28
37
  */
29
38
  linkText?: string;
30
39
  /**
31
40
  * Whether to show the close button
32
41
  * @default true
33
42
  *
34
- * @figmaPropMapping closeIcon → showClose
43
+ * @figmaPropMapping Dismissible → showClose
35
44
  */
36
45
  showClose?: boolean;
37
46
  /**
@@ -48,19 +57,8 @@ export interface NeoBannerProps extends Omit<AlertProps, 'variant' | 'severity'
48
57
  */
49
58
  onLinkClick?: () => void;
50
59
  }
51
- /**
52
- * NeoBanner - Inline banner/alert component based on MUI Alert
53
- *
54
- * @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC/Neo---Moderne-Design-system---2025?node-id=4170-2158
55
- *
56
- * Figma Props Mapping:
57
- * - color (Dark|Light|Success|Error|Warning) → variant (dark|light|success|error|warning)
58
- * - messagePosition (Left|Center) → messagePosition ("left"|"center")
59
- * - closeIcon (boolean) → showClose (boolean)
60
- * - link (boolean) → linkText (string)
61
- * - {Message} → message (string)
62
- */
63
60
  export declare const NeoBanner: {
64
- ({ variant, 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;
65
62
  displayName: string;
66
63
  };
64
+ export {};
package/dist/index.d.ts CHANGED
@@ -362,14 +362,23 @@ declare const NeoBadge: {
362
362
  displayName: string;
363
363
  };
364
364
 
365
+ type Intent = 'info' | 'success' | 'error' | 'warning' | 'neutral';
366
+ type BannerType = 'outlined' | 'filled';
365
367
  interface NeoBannerProps extends Omit<AlertProps, 'variant' | 'severity' | 'color'> {
366
368
  /**
367
- * The visual style variant of the banner
368
- * @default "light"
369
+ * The intent/purpose of the banner
370
+ * @default "info"
371
+ *
372
+ * @figmaPropMapping Intention (Info|Success|Error|Warning|Neutral) → intent
373
+ */
374
+ intent?: Intent;
375
+ /**
376
+ * Visual type: outlined (light bg) or filled (solid bg)
377
+ * @default "outlined"
369
378
  *
370
- * @figmaPropMapping color (Dark|Light|Success|Error|Warning) → variant
379
+ * @figmaPropMapping Type (Outlined|Filled) → type
371
380
  */
372
- variant?: 'dark' | 'light' | 'success' | 'error' | 'warning';
381
+ type?: BannerType;
373
382
  /**
374
383
  * The message text to display
375
384
  *
@@ -380,20 +389,20 @@ interface NeoBannerProps extends Omit<AlertProps, 'variant' | 'severity' | 'colo
380
389
  * Horizontal alignment of the message content
381
390
  * @default "left"
382
391
  *
383
- * @figmaPropMapping messagePosition (Left|Center) → messagePosition
392
+ * @figmaPropMapping Message Position (Left|Center) → messagePosition
384
393
  */
385
394
  messagePosition?: 'left' | 'center';
386
395
  /**
387
396
  * Optional link text to display after the message
388
397
  *
389
- * @figmaPropMapping link (boolean) → linkText (string)
398
+ * @figmaPropMapping Show Link (boolean) → linkText (string)
390
399
  */
391
400
  linkText?: string;
392
401
  /**
393
402
  * Whether to show the close button
394
403
  * @default true
395
404
  *
396
- * @figmaPropMapping closeIcon → showClose
405
+ * @figmaPropMapping Dismissible → showClose
397
406
  */
398
407
  showClose?: boolean;
399
408
  /**
@@ -410,20 +419,8 @@ interface NeoBannerProps extends Omit<AlertProps, 'variant' | 'severity' | 'colo
410
419
  */
411
420
  onLinkClick?: () => void;
412
421
  }
413
- /**
414
- * NeoBanner - Inline banner/alert component based on MUI Alert
415
- *
416
- * @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC/Neo---Moderne-Design-system---2025?node-id=4170-2158
417
- *
418
- * Figma Props Mapping:
419
- * - color (Dark|Light|Success|Error|Warning) → variant (dark|light|success|error|warning)
420
- * - messagePosition (Left|Center) → messagePosition ("left"|"center")
421
- * - closeIcon (boolean) → showClose (boolean)
422
- * - link (boolean) → linkText (string)
423
- * - {Message} → message (string)
424
- */
425
422
  declare const NeoBanner: {
426
- ({ variant, 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;
427
424
  displayName: string;
428
425
  };
429
426
 
package/dist/index.esm.js CHANGED
@@ -955,33 +955,27 @@ const __iconNode = [
955
955
  ];
956
956
  const X = createLucideIcon("x", __iconNode);
957
957
 
958
+ const intentColors = {
959
+ info: semanticColors.status.info,
960
+ success: semanticColors.status.success,
961
+ error: semanticColors.status.error,
962
+ warning: semanticColors.status.warning,
963
+ neutral: semanticColors.status.neutral,
964
+ };
958
965
  // biome-ignore lint/suspicious/noExplicitAny: Type cast required to override MUI Alert variant type without global augmentation
959
966
  const StyledAlert$2 = styled(Alert, {
960
- shouldForwardProp: prop => prop !== 'messagePosition' && prop !== 'variant',
961
- })(({ variant = 'light', messagePosition = 'left' }) => {
962
- // Variant-specific styles
963
- const variantStyles = {
964
- dark: {
965
- backgroundColor: semanticColors.surfaces.snackbarBrand,
967
+ shouldForwardProp: prop => prop !== 'messagePosition' && prop !== 'intent' && prop !== 'bannerType',
968
+ })(({ intent = 'info', bannerType = 'outlined', messagePosition = 'left' }) => {
969
+ const palette = intentColors[intent];
970
+ const typeStyles = bannerType === 'filled'
971
+ ? {
972
+ backgroundColor: palette.dark,
966
973
  color: semanticColors.surfaces.white,
967
- },
968
- light: {
969
- backgroundColor: semanticColors.status.info.light,
970
- color: colors.grey['800'],
971
- },
972
- success: {
973
- backgroundColor: semanticColors.status.success.light,
974
- color: colors.grey['800'],
975
- },
976
- error: {
977
- backgroundColor: semanticColors.status.error.light,
978
- color: colors.grey['800'],
979
- },
980
- warning: {
981
- backgroundColor: semanticColors.status.warning.light,
974
+ }
975
+ : {
976
+ backgroundColor: palette.light,
982
977
  color: colors.grey['800'],
983
- },
984
- };
978
+ };
985
979
  return {
986
980
  width: '100%',
987
981
  minHeight: 52,
@@ -995,9 +989,9 @@ const StyledAlert$2 = styled(Alert, {
995
989
  ...(messagePosition === 'center' && { position: 'relative' }),
996
990
  boxShadow: `${shadows.neutralSmall.x}px ${shadows.neutralSmall.y}px ${shadows.neutralSmall.blur}px ${shadows.neutralSmall.spread}px ${shadows.neutralSmall.shadow}`,
997
991
  fontSize: typography.fontSize.default,
998
- fontWeight: typography.fontWeight.regular,
992
+ fontWeight: typography.fontWeight.medium,
999
993
  lineHeight: 1.5,
1000
- ...variantStyles[variant],
994
+ ...typeStyles,
1001
995
  [`& .${alertClasses.icon}`]: {
1002
996
  padding: 0,
1003
997
  opacity: 1,
@@ -1020,26 +1014,18 @@ const StyledAlert$2 = styled(Alert, {
1020
1014
  },
1021
1015
  };
1022
1016
  });
1023
- const LinkText = styled('span')(({ variant = 'light' }) => {
1024
- const getLinkColor = () => {
1025
- if (variant === 'dark') {
1026
- return semanticColors.typography.link.default; // #f9fafb (light gray/white)
1027
- }
1028
- if (variant === 'light') {
1029
- return semanticColors.typography.link.primary; // #2f42ff (blue)
1030
- }
1031
- // For success, error, warning - use dark body color #1f2937
1032
- return colors.grey['800'];
1033
- };
1034
- return {
1035
- fontWeight: typography.fontWeight.semiBold,
1036
- color: getLinkColor(),
1037
- cursor: 'pointer',
1038
- '&:hover': {
1039
- textDecoration: 'underline',
1040
- },
1041
- };
1042
- });
1017
+ const LinkText = styled('span')(({ bannerType = 'outlined' }) => ({
1018
+ marginLeft: 'auto',
1019
+ fontWeight: typography.fontWeight.semiBold,
1020
+ color: bannerType === 'filled'
1021
+ ? semanticColors.typography.link.white
1022
+ : semanticColors.typography.link.primary,
1023
+ cursor: 'pointer',
1024
+ whiteSpace: 'nowrap',
1025
+ '&:hover': {
1026
+ textDecoration: 'underline',
1027
+ },
1028
+ }));
1043
1029
  const StyledIconButton$1 = styled(IconButton)(({ closeIconColor }) => ({
1044
1030
  padding: 0,
1045
1031
  color: closeIconColor,
@@ -1047,35 +1033,9 @@ const StyledIconButton$1 = styled(IconButton)(({ closeIconColor }) => ({
1047
1033
  backgroundColor: 'transparent',
1048
1034
  },
1049
1035
  }));
1050
- /**
1051
- * NeoBanner - Inline banner/alert component based on MUI Alert
1052
- *
1053
- * @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC/Neo---Moderne-Design-system---2025?node-id=4170-2158
1054
- *
1055
- * Figma Props Mapping:
1056
- * - color (Dark|Light|Success|Error|Warning) → variant (dark|light|success|error|warning)
1057
- * - messagePosition (Left|Center) → messagePosition ("left"|"center")
1058
- * - closeIcon (boolean) → showClose (boolean)
1059
- * - link (boolean) → linkText (string)
1060
- * - {Message} → message (string)
1061
- */
1062
- const NeoBanner = ({ variant = 'light', message, messagePosition = 'left', linkText, showClose = true, icon, onClose, onLinkClick, ...props }) => {
1063
- const getCloseIconColor = () => {
1064
- if (variant === 'dark') {
1065
- return semanticColors.surfaces.white;
1066
- }
1067
- if (variant === 'success') {
1068
- return semanticColors.status.success.default;
1069
- }
1070
- if (variant === 'error') {
1071
- return semanticColors.status.error.default;
1072
- }
1073
- if (variant === 'warning') {
1074
- return semanticColors.status.warning.default;
1075
- }
1076
- return colors.grey['800'];
1077
- };
1078
- return (jsx(StyledAlert$2, { ...props, variant: variant, messagePosition: messagePosition, icon: messagePosition === 'left' ? icon || false : false, action: showClose ? (jsx(StyledIconButton$1, { size: "small", onClick: onClose, closeIconColor: getCloseIconColor(), children: jsx(X, { size: 24 }) })) : undefined, children: messagePosition === 'center' ? (jsxs(Fragment, { children: [icon, jsx("span", { children: message }), linkText && (jsx(LinkText, { variant: variant, onClick: onLinkClick, children: linkText }))] })) : (jsxs(Fragment, { children: [jsx("span", { children: message }), linkText && (jsx(LinkText, { variant: variant, onClick: onLinkClick, children: linkText }))] })) }));
1036
+ const NeoBanner = ({ intent = 'info', type = 'outlined', message, messagePosition = 'left', linkText, showClose = true, icon, onClose, onLinkClick, ...props }) => {
1037
+ const closeIconColor = type === 'filled' ? semanticColors.surfaces.white : intentColors[intent].default;
1038
+ 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 }))] })) }));
1079
1039
  };
1080
1040
  NeoBanner.displayName = 'NeoBanner';
1081
1041