{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/notification/style/index.ts"],"sourcesContent":["import type { FullToken, GenerateStyle } from '@antdv/theme';\nimport { genComponentStyleHook, Keyframes, mergeToken, resetComponent } from '@antdv/theme';\nimport genNotificationPlacementStyle from './placement';\n\n/** Component only token. Which will handle additional calculation of alias token */\nexport interface ComponentToken {\n  zIndexPopup: number\n  width: number\n}\n\nexport interface NotificationToken extends FullToken<'Notification'> {\n  notificationBg: string\n  notificationPaddingVertical: number\n  notificationPaddingHorizontal: number\n  notificationPadding: string\n  notificationMarginBottom: number\n  notificationMarginEdge: number\n  animationMaxHeight: number\n  notificationIconSize: number\n  notificationCloseButtonSize: number\n}\n\nconst genNotificationStyle: GenerateStyle<NotificationToken> = (token) => {\n  const {\n    iconCls,\n    componentCls, // .ant-notification\n    boxShadowSecondary,\n    fontSizeLG,\n    notificationMarginBottom,\n    borderRadiusLG,\n    colorSuccess,\n    colorInfo,\n    colorWarning,\n    colorError,\n    colorTextHeading,\n    notificationBg,\n    notificationPadding,\n    notificationMarginEdge,\n    motionDurationMid,\n    motionEaseInOut,\n    fontSize,\n    lineHeight,\n    width,\n    notificationIconSize,\n  } = token;\n\n  const noticeCls = `${componentCls}-notice`;\n\n  const notificationFadeIn = new Keyframes('antNotificationFadeIn', {\n    '0%': {\n      left: {\n        _skip_check_: true,\n        value: width,\n      },\n      opacity: 0,\n    },\n\n    '100%': {\n      left: {\n        _skip_check_: true,\n        value: 0,\n      },\n      opacity: 1,\n    },\n  });\n\n  const notificationFadeOut = new Keyframes('antNotificationFadeOut', {\n    '0%': {\n      maxHeight: token.animationMaxHeight,\n      marginBottom: notificationMarginBottom,\n      opacity: 1,\n    },\n\n    '100%': {\n      maxHeight: 0,\n      marginBottom: 0,\n      paddingTop: 0,\n      paddingBottom: 0,\n      opacity: 0,\n    },\n  });\n\n  return [\n    // ============================ Holder ============================\n    {\n      [componentCls]: {\n        ...resetComponent(token),\n\n        'position': 'fixed',\n        'zIndex': token.zIndexPopup,\n        'marginInlineEnd': notificationMarginEdge,\n\n        [`${componentCls}-hook-holder`]: {\n          position: 'relative',\n        },\n\n        [`&${componentCls}-top, &${componentCls}-bottom`]: {\n          [`${componentCls}-notice`]: {\n            marginInline: 'auto auto',\n          },\n        },\n\n        [`&${componentCls}-topLeft, &${componentCls}-bottomLeft`]: {\n          [`${componentCls}-notice`]: {\n            marginInlineEnd: 'auto',\n            marginInlineStart: 0,\n          },\n        },\n\n        //  animation\n        [`${componentCls}-fade-enter, ${componentCls}-fade-appear`]: {\n          animationDuration: token.motionDurationMid,\n          animationTimingFunction: motionEaseInOut,\n          animationFillMode: 'both',\n          opacity: 0,\n          animationPlayState: 'paused',\n        },\n\n        [`${componentCls}-fade-leave`]: {\n          animationTimingFunction: motionEaseInOut,\n          animationFillMode: 'both',\n\n          animationDuration: motionDurationMid,\n          animationPlayState: 'paused',\n        },\n\n        [`${componentCls}-fade-enter${componentCls}-fade-enter-active, ${componentCls}-fade-appear${componentCls}-fade-appear-active`]:\n          {\n            animationName: notificationFadeIn,\n            animationPlayState: 'running',\n          },\n\n        [`${componentCls}-fade-leave${componentCls}-fade-leave-active`]: {\n          animationName: notificationFadeOut,\n          animationPlayState: 'running',\n        },\n\n        // placement\n        ...genNotificationPlacementStyle(token),\n\n        // RTL\n        '&-rtl': {\n          direction: 'rtl',\n\n          [`${componentCls}-notice-btn`]: {\n            float: 'left',\n          },\n        },\n      },\n    },\n\n    // ============================ Notice ============================\n    {\n      [noticeCls]: {\n        position: 'relative',\n        width,\n        maxWidth: `calc(100vw - ${notificationMarginEdge * 2}px)`,\n        marginBottom: notificationMarginBottom,\n        marginInlineStart: 'auto',\n        padding: notificationPadding,\n        overflow: 'hidden',\n        lineHeight,\n        wordWrap: 'break-word',\n        background: notificationBg,\n        borderRadius: borderRadiusLG,\n        boxShadow: boxShadowSecondary,\n\n        [`${componentCls}-close-icon`]: {\n          fontSize,\n          cursor: 'pointer',\n        },\n\n        [`${noticeCls}-message`]: {\n          marginBottom: token.marginXS,\n          color: colorTextHeading,\n          fontSize: fontSizeLG,\n          lineHeight: token.lineHeightLG,\n        },\n\n        [`${noticeCls}-description`]: {\n          fontSize,\n        },\n\n        [`&${noticeCls}-closable ${noticeCls}-message`]: {\n          paddingInlineEnd: token.paddingLG,\n        },\n\n        [`${noticeCls}-with-icon ${noticeCls}-message`]: {\n          marginBottom: token.marginXS,\n          marginInlineStart: token.marginSM + notificationIconSize,\n          fontSize: fontSizeLG,\n        },\n\n        [`${noticeCls}-with-icon ${noticeCls}-description`]: {\n          marginInlineStart: token.marginSM + notificationIconSize,\n          fontSize,\n        },\n\n        // Icon & color style in different selector level\n        // https://github.com/ant-design/ant-design/issues/16503\n        // https://github.com/ant-design/ant-design/issues/15512\n        [`${noticeCls}-icon`]: {\n          position: 'absolute',\n          fontSize: notificationIconSize,\n          lineHeight: 0,\n\n          // icon-font\n          [`&-success${iconCls}`]: {\n            color: colorSuccess,\n          },\n          [`&-info${iconCls}`]: {\n            color: colorInfo,\n          },\n          [`&-warning${iconCls}`]: {\n            color: colorWarning,\n          },\n          [`&-error${iconCls}`]: {\n            color: colorError,\n          },\n        },\n\n        [`${noticeCls}-close`]: {\n          'position': 'absolute',\n          'top': token.notificationPaddingVertical,\n          'insetInlineEnd': token.notificationPaddingHorizontal,\n          'color': token.colorIcon,\n          'outline': 'none',\n          'width': token.notificationCloseButtonSize,\n          'height': token.notificationCloseButtonSize,\n          'borderRadius': token.borderRadiusSM,\n          'transition': `background-color ${token.motionDurationMid}, color ${token.motionDurationMid}`,\n          'display': 'flex',\n          'alignItems': 'center',\n          'justifyContent': 'center',\n\n          '&:hover': {\n            color: token.colorIconHover,\n            backgroundColor: token.wireframe ? 'transparent' : token.colorFillContent,\n          },\n        },\n\n        [`${noticeCls}-btn`]: {\n          float: 'right',\n          marginTop: token.marginSM,\n        },\n      },\n    },\n\n    // ============================= Pure =============================\n    {\n      [`${noticeCls}-pure-panel`]: {\n        margin: 0,\n      },\n    },\n  ];\n};\n\n// ============================== Export ==============================\nexport default genComponentStyleHook(\n  'Notification',\n  (token) => {\n    const notificationPaddingVertical = token.paddingMD;\n    const notificationPaddingHorizontal = token.paddingLG;\n\n    const notificationToken = mergeToken<NotificationToken>(token, {\n      // default.less variables\n      notificationBg: token.colorBgElevated,\n      notificationPaddingVertical,\n      notificationPaddingHorizontal,\n      // index.less variables\n      notificationPadding: `${token.paddingMD}px ${token.paddingContentHorizontalLG}px`,\n      notificationMarginBottom: token.margin,\n      notificationMarginEdge: token.marginLG,\n      animationMaxHeight: 150,\n      notificationIconSize: token.fontSizeLG * token.lineHeightLG,\n      notificationCloseButtonSize: token.controlHeightLG * 0.55,\n    });\n\n    return [genNotificationStyle(notificationToken)];\n  },\n  token => ({\n    zIndexPopup: token.zIndexPopupBase + 50,\n    width: 384,\n  }),\n);\n"],"names":["Keyframes","mergeToken"],"mappings":";;;;;;;AAsBA,MAAM,oBAAA,GAAyD,CAAC,KAAU,KAAA;AACxE,EAAM,MAAA;AAAA,IACJ,OAAA;AAAA,IACA,YAAA;AAAA;AAAA,IACA,kBAAA;AAAA,IACA,UAAA;AAAA,IACA,wBAAA;AAAA,IACA,cAAA;AAAA,IACA,YAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAA;AAAA,IACA,UAAA;AAAA,IACA,gBAAA;AAAA,IACA,cAAA;AAAA,IACA,mBAAA;AAAA,IACA,sBAAA;AAAA,IACA,iBAAA;AAAA,IACA,eAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,oBAAA;AAAA,GACE,GAAA,KAAA,CAAA;AAEJ,EAAM,MAAA,SAAA,GAAY,GAAG,YAAY,CAAA,OAAA,CAAA,CAAA;AAEjC,EAAM,MAAA,kBAAA,GAAqB,IAAIA,QAAA,CAAU,uBAAyB,EAAA;AAAA,IAChE,IAAM,EAAA;AAAA,MACJ,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,IAAA;AAAA,QACd,KAAO,EAAA,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