Skip to content

Commit

Permalink
Merge 2b7ff7b into 277deee
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed May 14, 2023
2 parents 277deee + 2b7ff7b commit 29cba45
Show file tree
Hide file tree
Showing 6 changed files with 568 additions and 371 deletions.
4 changes: 2 additions & 2 deletions build-addons.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ try {
let entryPoint = path.join(BASE_DIR, dir, 'index.ts');
const exportKey = `./addons/${dir}`;
const exportValues = {
types: `./addons/${dir}/index.d.ts`,
require: '',
import: '',
types: `./addons/${dir}/index.d.ts`
import: ''
};

if (!existsSync(entryPoint)) {
Expand Down
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"build": "npm run clean && npm run build:core && npm run pack-and-extract && npm run build:addons && npm run style && husky install",
"build:core": "microbundle --jsx React.createElement --jsxFragment React.Fragment",
"build:addons": "node build-addons.mjs",
"postbuild": "./prepend-use-client.sh",
"setup": "npm run clean && npm run build && npm run pack-and-extract",
"pack-and-extract": "yarn pack -f react-toastify.tgz && npm run rm-pkg && npm run extract-pkg",
"rm-pkg": "rimraf node_modules/react-toastify && mkdir -p node_modules/react-toastify",
Expand Down Expand Up @@ -96,15 +97,15 @@
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.4.0",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"@types/jest": "^29.5.1",
"@types/react": "^18.2.6",
"@types/react-dom": "^18.2.4",
"@typescript-eslint/eslint-plugin": "^5.59.5",
"@typescript-eslint/parser": "^5.59.5",
"coveralls": "^3.0.9",
"cssnano": "^5.1.15",
"cssnano": "^6.0.1",
"cssnano-cli": "^1.0.5",
"eslint": "^8.35.0",
"eslint": "^8.40.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.32.2",
Expand All @@ -114,17 +115,17 @@
"jest-environment-jsdom": "^29.5.0",
"jest-jasmine2": "^29.5.0",
"microbundle": "^0.15.1",
"postcss": "^8.4.21",
"postcss": "^8.4.23",
"postcss-cli": "^10.1.0",
"prettier": "2.8.4",
"prettier": "2.8.8",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"rimraf": "^4.4.0",
"sass": "^1.58.3",
"rimraf": "^5.0.0",
"sass": "^1.62.1",
"style2js": "^1.0.1",
"ts-jest": "^29.0.5",
"ts-jest": "^29.1.0",
"tslib": "^2.5.0",
"typescript": "^4.9.5"
"typescript": "^5.0.4"
},
"dependencies": {
"clsx": "^1.1.1"
Expand Down Expand Up @@ -165,4 +166,4 @@
"import": "./addons/use-notification-center/index.esm.mjs"
}
}
}
}
8 changes: 8 additions & 0 deletions prepend-use-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# TODO yeah maybe let's make something more robust and futur proof
files=("react-toastify.js" "react-toastify.esm.mjs" "inject-style.js" "inject-style.esm.mjs")

for f in ${files[*]}; do
echo -e "'use client';\n$(cat ./dist/${f})" > ./dist/${f}
done
4 changes: 2 additions & 2 deletions src/components/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ export function ProgressBar({
// so if controlledProgress is set
// it means that this is also the case for progress
const animationEvent = {
[controlledProgress && progress! >= 1
[controlledProgress && (progress as number)! >= 1
? 'onTransitionEnd'
: 'onAnimationEnd']:
controlledProgress && progress! < 1
controlledProgress && (progress as number)! < 1
? null
: () => {
isIn && closeToast();
Expand Down
25 changes: 14 additions & 11 deletions src/utils/mapper.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { Toast, ToastItem, ToastItemStatus } from '../types';

export function toToastItem(toast: Toast, status: ToastItemStatus): ToastItem {
return {
content: toast.content,
containerId: toast.props.containerId,
id: toast.props.toastId,
theme: toast.props.theme,
type: toast.props.type,
data: toast.props.data || {},
isLoading: toast.props.isLoading,
icon: toast.props.icon,
status
};
return toast != null
? {
content: toast.content,
containerId: toast.props.containerId,
id: toast.props.toastId,
theme: toast.props.theme,
type: toast.props.type,
data: toast.props.data || {},
isLoading: toast.props.isLoading,
icon: toast.props.icon,
status
}
: // monkey patch for now
({} as ToastItem);
}

0 comments on commit 29cba45

Please sign in to comment.