@fvc/notification 1.1.0 → 1.2.1

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/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import{notification as n}from"antd";import t,{useMemo as o}from"react";import{Icon as i}from"@fvc/icons";var r,e=function(){return e=Object.assign||function(n){for(var t,o=1,i=arguments.length;o<i;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},e.apply(this,arguments)};function c(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}"function"==typeof SuppressedError&&SuppressedError,function(n){n.success="success",n.info="info",n.warning="warning",n.error="error"}(r||(r={}));var a,f={exports:{}};
1
+ import{notification as n}from"antd";import t,{useMemo as i}from"react";import{Icon as o}from"@fvc/icons";var e;function c(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}!function(n){n.success="success",n.info="info",n.warning="warning",n.error="error"}(e||(e={})),"function"==typeof SuppressedError&&SuppressedError;var r,a={exports:{}};
2
2
  /*!
3
3
  Copyright (c) 2018 Jed Watson.
4
4
  Licensed under the MIT License (MIT), see
5
5
  http://jedwatson.github.io/classnames
6
- */var s,p=(a||(a=1,s=f,function(){var n={}.hasOwnProperty;function t(){for(var n="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(n=i(n,o(r)))}return n}function o(o){if("string"==typeof o||"number"==typeof o)return o;if("object"!=typeof o)return"";if(Array.isArray(o))return t.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var r="";for(var e in o)n.call(o,e)&&o[e]&&(r=i(r,e));return r}function i(n,t){return t?n?n+" "+t:n+t:n}s.exports?(t.default=t,s.exports=t):window.classNames=t}()),f.exports),l=c(p),u="fvc-notification",v=function(n){switch(n){case r.success:return t.createElement(i.CheckCircleOutline,{color:"var(--link-on-dark-bg-color-400)",width:24,height:24});case r.info:return t.createElement(i.Info,{color:"var(--gray-300)",width:24,height:24});case r.warning:return t.createElement(i.Warning,{color:"var(--orange-200)",width:24,height:24});case r.error:return t.createElement(i.Report,{color:"var(--warning-text-on-dark-bg-color-400)",width:24,height:24});default:return}},g=function(n){var t,o=n.icon,i=n.innerComponent,r=function(n,t){var o={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&t.indexOf(i)<0&&(o[i]=n[i]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(n);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(n,i[r])&&(o[i[r]]=n[i[r]])}return o}(n,["icon","innerComponent"]);return e(e({},r),{icon:o||v(r.type),btn:i,className:l((t={},t[r.className]=!!r.className,t))})},d=function(t,o){return void 0===o&&(o=n),function(n){return o[t](e({},g(e(e({},n),{type:t}))))}};!function(n,t){void 0===t&&(t={});var o=t.insertAt;if("undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===o&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=n:r.appendChild(document.createTextNode(n))}}('.fvc-notification {\n font-family: "Roboto", sans-serif;\n}\n.fvc-notification .fvc-notification-notice-wrapper {\n background-color: var(--blue-gray-700) !important;\n border-radius: 8px;\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice {\n padding: 16px;\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-close {\n width: 16px;\n height: 16px;\n top: 4px;\n right: 4px;\n border-radius: 50%;\n background-color: var(--blue-gray-900);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-close:hover {\n background-color: var(--blue-gray-900);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-close-icon {\n width: 7px;\n height: 7px;\n color: var(--blue-gray-250);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-with-icon .fvc-notification-notice-message, .fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-message {\n font-family: Roboto, Arial, sans-serif;\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n margin-bottom: 0;\n margin-left: 0;\n color: var(--neutral-0);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-with-icon .fvc-notification-notice-message {\n margin-left: 32px;\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-icon {\n transform: translateY(-3px);\n display: flex;\n align-items: flex-start;\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-btn {\n display: flex;\n width: 100%;\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-success .fvc-notification-notice-message {\n color: var(--link-on-dark-bg-color-400);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-info .fvc-notification-notice-message {\n color: var(--gray-300);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-error .fvc-notification-notice-message {\n color: var(--warning-icon-on-dark-bg-color-400);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-warning .fvc-notification-notice-message {\n color: var(--orange-200);\n}');var y={config:function(t){n.config(e(e({},t),{prefixCls:u}))},destroy:function(t){n.destroy(t)},open:function(t){n.open(e({},g(t)))},success:d(r.success),info:d(r.info),warning:d(r.warning),error:d(r.error),useNotification:function(t){var i=function(n,t){var o="function"==typeof Symbol&&n[Symbol.iterator];if(!o)return n;var i,r,e=o.call(n),c=[];try{for(;(void 0===t||t-- >0)&&!(i=e.next()).done;)c.push(i.value)}catch(n){r={error:n}}finally{try{i&&!i.done&&(o=e.return)&&o.call(e)}finally{if(r)throw r.error}}return c}(n.useNotification(e(e({},t),{prefixCls:u})),2),c=i[0],a=i[1];return[o((function(){return{info:d(r.info,c),success:d(r.success,c),error:d(r.error,c),warning:d(r.warning,c),open:function(n){c.open(e({},g(e({},n))))},destroy:c.destroy}}),[c]),a]}};export{y as notification};
6
+ */var f,s=(r||(r=1,f=a,function(){var n={}.hasOwnProperty;function t(){for(var n="",t=0;t<arguments.length;t++){var e=arguments[t];e&&(n=o(n,i(e)))}return n}function i(i){if("string"==typeof i||"number"==typeof i)return i;if("object"!=typeof i)return"";if(Array.isArray(i))return t.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var e="";for(var c in i)n.call(i,c)&&i[c]&&(e=o(e,c));return e}function o(n,t){return t?n?n+" "+t:n+t:n}f.exports?(t.default=t,f.exports=t):window.classNames=t}()),a.exports),p=c(s);const l="fvc-notification",v=n=>{switch(n){case e.success:return t.createElement(o.CheckCircleOutline,{color:"var(--link-on-dark-bg-color-400)",width:24,height:24});case e.info:return t.createElement(o.Info,{color:"var(--gray-300)",width:24,height:24});case e.warning:return t.createElement(o.Warning,{color:"var(--orange-200)",width:24,height:24});case e.error:return t.createElement(o.Report,{color:"var(--warning-text-on-dark-bg-color-400)",width:24,height:24});default:return}},g=n=>{var{icon:t,innerComponent:i}=n,o=function(n,t){var i={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&t.indexOf(o)<0&&(i[o]=n[o]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var e=0;for(o=Object.getOwnPropertySymbols(n);e<o.length;e++)t.indexOf(o[e])<0&&Object.prototype.propertyIsEnumerable.call(n,o[e])&&(i[o[e]]=n[o[e]])}return i}(n,["icon","innerComponent"]);return Object.assign(Object.assign({},o),{icon:t||v(o.type),btn:i,className:p({[o.className]:!!o.className})})},u=(t,i=n)=>n=>i[t](Object.assign({},g(Object.assign(Object.assign({},n),{type:t}))));!function(n,t){void 0===t&&(t={});var i=t.insertAt;if("undefined"!=typeof document){var o=document.head||document.getElementsByTagName("head")[0],e=document.createElement("style");e.type="text/css","top"===i&&o.firstChild?o.insertBefore(e,o.firstChild):o.appendChild(e),e.styleSheet?e.styleSheet.cssText=n:e.appendChild(document.createTextNode(n))}}('.fvc-notification {\n font-family: "Roboto", sans-serif;\n}\n.fvc-notification .fvc-notification-notice-wrapper {\n background-color: var(--blue-gray-700) !important;\n border-radius: 8px;\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice {\n padding: 16px;\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-close {\n width: 16px;\n height: 16px;\n top: 4px;\n right: 4px;\n border-radius: 50%;\n background-color: var(--blue-gray-900);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-close:hover {\n background-color: var(--blue-gray-900);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-close-icon {\n width: 7px;\n height: 7px;\n color: var(--blue-gray-250);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-with-icon .fvc-notification-notice-message, .fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-message {\n font-family: Roboto, Arial, sans-serif;\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n margin-bottom: 0;\n margin-left: 0;\n color: var(--neutral-0);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-with-icon .fvc-notification-notice-message {\n margin-left: 32px;\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-icon {\n transform: translateY(-3px);\n display: flex;\n align-items: flex-start;\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-btn {\n display: flex;\n width: 100%;\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-success .fvc-notification-notice-message {\n color: var(--link-on-dark-bg-color-400);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-info .fvc-notification-notice-message {\n color: var(--gray-300);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-error .fvc-notification-notice-message {\n color: var(--warning-icon-on-dark-bg-color-400);\n}\n.fvc-notification .fvc-notification-notice-wrapper .fvc-notification-notice-warning .fvc-notification-notice-message {\n color: var(--orange-200);\n}');const d={config:t=>{n.config(Object.assign(Object.assign({},t),{prefixCls:l}))},destroy:t=>{n.destroy(t)},open:t=>{n.open(Object.assign({},g(t)))},success:u(e.success),info:u(e.info),warning:u(e.warning),error:u(e.error),useNotification:t=>{const[o,c]=n.useNotification(Object.assign(Object.assign({},t),{prefixCls:l}));return[i(()=>({info:u(e.info,o),success:u(e.success,o),error:u(e.error,o),warning:u(e.warning,o),open:n=>{o.open(Object.assign({},g(Object.assign({},n))))},destroy:o.destroy}),[o]),c]}};export{d as notification};
@@ -1,6 +1,6 @@
1
- import React, { ReactNode } from 'react';
2
1
  import { ArgsProps as BaseArgsProps } from 'antd/es/notification';
3
2
  import { GlobalConfigProps, NotificationConfig as BaseNotificationConfig, NotificationInstance as BaseNotificationInstance } from 'antd/es/notification/interface';
3
+ import React, { ReactNode } from 'react';
4
4
  export type ArgsProps = Omit<BaseArgsProps, 'description'> & {
5
5
  innerComponent?: ReactNode;
6
6
  };
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import { notification as baseNotification, NotificationArgsProps as BaseNotificationArgsProps } from 'antd';
2
+ import React from 'react';
3
3
  import { ArgsProps, NotificationInstance, NotificationTypes, StaticFn } from '../types';
4
4
  export declare const prefixCls = "fvc-notification";
5
5
  export declare const getNotificationIcon: (type: BaseNotificationArgsProps["type"]) => React.JSX.Element | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fvc/notification",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "main": "./dist/lib/index.js",
5
5
  "types": "./dist/lib/notification/src/index.d.ts",
6
6
  "files": [
@@ -18,12 +18,13 @@
18
18
  }
19
19
  },
20
20
  "scripts": {
21
- "build": "rm -rf dist && rm -rf .rollup.cache && eslint --config ../../eslint.config.js . && bunx tsc --noEmit && rollup -c ./rollup.config.mjs"
22
- },
23
- "dependencies": {
24
- "react": "^18.0.0",
25
- "antd": "^5.0.0",
26
- "@fvc/icons": "file:../icons"
21
+ "build": "rollup -c ./rollup.config.mjs",
22
+ "clean": "rm -rf dist && rm -rf .rollup.cache && rm -rf .turbo",
23
+ "lint": "eslint --config ../../eslint.config.js \"src/**/*.{ts,tsx}\"",
24
+ "lint:fix": "eslint --config ../../eslint.config.js \"src/**/*.{ts,tsx}\" --fix",
25
+ "format": "prettier --write \"src/**/*.{ts,tsx}\"",
26
+ "type-check": "tsc --noEmit",
27
+ "test": "bun test --preload ../../tests/happydom.ts --preload ../../tests/testing-library.tsx"
27
28
  },
28
29
  "peerDependencies": {
29
30
  "@fvc/icons": "*",