@esitorsunil/new-folder 1.0.0 → 1.0.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/index.js +27 -1
- package/dist/notification/NotificationsPanel.js +50 -1
- package/dist/notification/notificationsSlice.js +32 -1
- package/package.json +18 -13
- package/.babelrc +0 -3
- package/src/index.js +0 -2
- package/src/notification/NotificationsPanel.jsx +0 -47
- package/src/notification/notificationsSlice.js +0 -24
package/dist/index.js
CHANGED
@@ -1 +1,27 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
var _exportNames = {
|
7
|
+
NotificationsPanel: true
|
8
|
+
};
|
9
|
+
Object.defineProperty(exports, "NotificationsPanel", {
|
10
|
+
enumerable: true,
|
11
|
+
get: function get() {
|
12
|
+
return _NotificationsPanel.NotificationsPanel;
|
13
|
+
}
|
14
|
+
});
|
15
|
+
var _NotificationsPanel = require("./notification/NotificationsPanel");
|
16
|
+
var _notificationsSlice = require("./notification/notificationsSlice");
|
17
|
+
Object.keys(_notificationsSlice).forEach(function (key) {
|
18
|
+
if (key === "default" || key === "__esModule") return;
|
19
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
20
|
+
if (key in exports && exports[key] === _notificationsSlice[key]) return;
|
21
|
+
Object.defineProperty(exports, key, {
|
22
|
+
enumerable: true,
|
23
|
+
get: function get() {
|
24
|
+
return _notificationsSlice[key];
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
@@ -1 +1,50 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.NotificationsPanel = void 0;
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
8
|
+
var _reactRedux = require("react-redux");
|
9
|
+
var _notificationsSlice = require("./notificationsSlice");
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
11
|
+
// NotificationsPanel.jsx
|
12
|
+
|
13
|
+
var NotificationsPanel = exports.NotificationsPanel = function NotificationsPanel() {
|
14
|
+
var notifications = (0, _reactRedux.useSelector)(function (state) {
|
15
|
+
return state.notifications.items;
|
16
|
+
});
|
17
|
+
var dispatch = (0, _reactRedux.useDispatch)();
|
18
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
19
|
+
style: {
|
20
|
+
position: 'fixed',
|
21
|
+
top: 10,
|
22
|
+
right: 10,
|
23
|
+
zIndex: 1000
|
24
|
+
}
|
25
|
+
}, notifications.map(function (n) {
|
26
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
27
|
+
key: n.id,
|
28
|
+
style: {
|
29
|
+
background: n.type === 'error' ? '#f44336' : n.type === 'success' ? '#4caf50' : '#2196f3',
|
30
|
+
color: '#fff',
|
31
|
+
padding: '10px 15px',
|
32
|
+
marginBottom: 8,
|
33
|
+
borderRadius: 4,
|
34
|
+
minWidth: 200,
|
35
|
+
boxShadow: '0 2px 4px rgba(0,0,0,0.3)'
|
36
|
+
}
|
37
|
+
}, n.message, /*#__PURE__*/_react["default"].createElement("button", {
|
38
|
+
onClick: function onClick() {
|
39
|
+
return dispatch((0, _notificationsSlice.removeNotification)(n.id));
|
40
|
+
},
|
41
|
+
style: {
|
42
|
+
marginLeft: 10,
|
43
|
+
background: 'transparent',
|
44
|
+
border: 'none',
|
45
|
+
color: '#fff',
|
46
|
+
cursor: 'pointer'
|
47
|
+
}
|
48
|
+
}, "\xD7"));
|
49
|
+
}));
|
50
|
+
};
|
@@ -1 +1,32 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.removeNotification = exports.pushNotification = exports.notificationsReducer = exports.clearNotifications = void 0;
|
7
|
+
var _toolkit = require("@reduxjs/toolkit");
|
8
|
+
var initialState = {
|
9
|
+
items: []
|
10
|
+
};
|
11
|
+
var notificationsSlice = (0, _toolkit.createSlice)({
|
12
|
+
name: 'notifications',
|
13
|
+
initialState: initialState,
|
14
|
+
reducers: {
|
15
|
+
pushNotification: function pushNotification(state, action) {
|
16
|
+
state.items.push(action.payload);
|
17
|
+
},
|
18
|
+
removeNotification: function removeNotification(state, action) {
|
19
|
+
state.items = state.items.filter(function (n) {
|
20
|
+
return n.id !== action.payload;
|
21
|
+
});
|
22
|
+
},
|
23
|
+
clearNotifications: function clearNotifications(state) {
|
24
|
+
state.items = [];
|
25
|
+
}
|
26
|
+
}
|
27
|
+
});
|
28
|
+
var _notificationsSlice$a = notificationsSlice.actions,
|
29
|
+
pushNotification = exports.pushNotification = _notificationsSlice$a.pushNotification,
|
30
|
+
removeNotification = exports.removeNotification = _notificationsSlice$a.removeNotification,
|
31
|
+
clearNotifications = exports.clearNotifications = _notificationsSlice$a.clearNotifications;
|
32
|
+
var notificationsReducer = exports.notificationsReducer = notificationsSlice.reducer;
|
package/package.json
CHANGED
@@ -1,21 +1,26 @@
|
|
1
1
|
{
|
2
2
|
"name": "@esitorsunil/new-folder",
|
3
|
-
"version": "1.0.
|
4
|
-
"main": "index.js",
|
3
|
+
"version": "1.0.1",
|
4
|
+
"main": "dist/index.js",
|
5
|
+
"module": "dist/index.js",
|
6
|
+
"files": [
|
7
|
+
"dist"
|
8
|
+
],
|
5
9
|
"scripts": {
|
6
|
-
"
|
7
|
-
"build": "babel src --out-dir dist --copy-files"
|
10
|
+
"build": "babel src --out-dir dist --copy-files"
|
8
11
|
},
|
9
|
-
"keywords": [],
|
10
|
-
"author": "",
|
11
|
-
"license": "ISC",
|
12
|
-
"description": "",
|
13
12
|
"dependencies": {
|
14
13
|
"@reduxjs/toolkit": "^1.9.0",
|
15
14
|
"react": ">=17.0.0",
|
16
15
|
"react-dom": ">=17.0.0",
|
17
16
|
"react-redux": "^8.0.0"
|
18
17
|
},
|
18
|
+
"peerDependencies": {
|
19
|
+
"@reduxjs/toolkit": "^1.9.0",
|
20
|
+
"react": ">=17.0.0",
|
21
|
+
"react-dom": ">=17.0.0",
|
22
|
+
"react-redux": "^8.0.0"
|
23
|
+
},
|
19
24
|
"devDependencies": {
|
20
25
|
"@babel/cli": "^7.27.2",
|
21
26
|
"@babel/core": "^7.27.1",
|
@@ -24,10 +29,10 @@
|
|
24
29
|
"@babel/preset-react": "^7.27.1",
|
25
30
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24"
|
26
31
|
},
|
27
|
-
"
|
28
|
-
"
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
+
"exports": {
|
33
|
+
".": {
|
34
|
+
"import": "./dist/index.js",
|
35
|
+
"require": "./dist/index.js"
|
36
|
+
}
|
32
37
|
}
|
33
38
|
}
|
package/.babelrc
DELETED
package/src/index.js
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
// NotificationsPanel.jsx
|
2
|
-
import React from 'react';
|
3
|
-
import { useSelector, useDispatch } from 'react-redux';
|
4
|
-
import { removeNotification } from './notificationsSlice';
|
5
|
-
|
6
|
-
export const NotificationsPanel = () => {
|
7
|
-
const notifications = useSelector((state) => state.notifications.items);
|
8
|
-
const dispatch = useDispatch();
|
9
|
-
|
10
|
-
return (
|
11
|
-
<div style={{ position: 'fixed', top: 10, right: 10, zIndex: 1000 }}>
|
12
|
-
{notifications.map(n => (
|
13
|
-
<div
|
14
|
-
key={n.id}
|
15
|
-
style={{
|
16
|
-
background:
|
17
|
-
n.type === 'error'
|
18
|
-
? '#f44336'
|
19
|
-
: n.type === 'success'
|
20
|
-
? '#4caf50'
|
21
|
-
: '#2196f3',
|
22
|
-
color: '#fff',
|
23
|
-
padding: '10px 15px',
|
24
|
-
marginBottom: 8,
|
25
|
-
borderRadius: 4,
|
26
|
-
minWidth: 200,
|
27
|
-
boxShadow: '0 2px 4px rgba(0,0,0,0.3)',
|
28
|
-
}}
|
29
|
-
>
|
30
|
-
{n.message}
|
31
|
-
<button
|
32
|
-
onClick={() => dispatch(removeNotification(n.id))}
|
33
|
-
style={{
|
34
|
-
marginLeft: 10,
|
35
|
-
background: 'transparent',
|
36
|
-
border: 'none',
|
37
|
-
color: '#fff',
|
38
|
-
cursor: 'pointer',
|
39
|
-
}}
|
40
|
-
>
|
41
|
-
×
|
42
|
-
</button>
|
43
|
-
</div>
|
44
|
-
))}
|
45
|
-
</div>
|
46
|
-
);
|
47
|
-
};
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
2
|
-
|
3
|
-
const initialState = {
|
4
|
-
items: [],
|
5
|
-
};
|
6
|
-
|
7
|
-
const notificationsSlice = createSlice({
|
8
|
-
name: 'notifications',
|
9
|
-
initialState,
|
10
|
-
reducers: {
|
11
|
-
pushNotification: (state, action) => {
|
12
|
-
state.items.push(action.payload);
|
13
|
-
},
|
14
|
-
removeNotification: (state, action) => {
|
15
|
-
state.items = state.items.filter(n => n.id !== action.payload);
|
16
|
-
},
|
17
|
-
clearNotifications: (state) => {
|
18
|
-
state.items = [];
|
19
|
-
},
|
20
|
-
},
|
21
|
-
});
|
22
|
-
|
23
|
-
export const { pushNotification, removeNotification, clearNotifications } = notificationsSlice.actions;
|
24
|
-
export const notificationsReducer = notificationsSlice.reducer;
|