@portnet/ui 0.0.91 → 0.0.92

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.
@@ -101,7 +101,7 @@ const StyledMuiTextField = (0, _styles.styled)( /*#__PURE__*/React.forwardRef((_
101
101
  },
102
102
  "& .MuiInputBase-input": {
103
103
  lineHeight: "1",
104
- padding: "4px 12px",
104
+ padding: "1px 6px",
105
105
  fontSize: "0.7rem"
106
106
  }
107
107
  },
@@ -52,7 +52,7 @@ const alertsReducer = (state, _ref) => {
52
52
  switch (type) {
53
53
  case "ADD_ALERT":
54
54
  return [...state, {
55
- id: (0, _uuid.v4)(),
55
+ id: payload.id,
56
56
  type: payload.type,
57
57
  message: payload.message
58
58
  }];
@@ -67,14 +67,28 @@ const PuiAlertProvider = _ref2 => {
67
67
  children
68
68
  } = _ref2;
69
69
  const [alerts, alertsDispatch] = React.useReducer(alertsReducer, alertsInitialState);
70
- const dispatchAlert = (type, message) => {
70
+ const dispatchAlert = function dispatchAlert(type, message) {
71
+ let isClosingAutomatic = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
72
+ let closeDelay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5000;
73
+ const alertId = (0, _uuid.v4)();
71
74
  alertsDispatch({
72
75
  type: "ADD_ALERT",
73
76
  payload: {
77
+ id: alertId,
74
78
  type,
75
79
  message
76
80
  }
77
81
  });
82
+ if (isClosingAutomatic) {
83
+ setTimeout(() => {
84
+ alertsDispatch({
85
+ type: "CLOSE_ALERT",
86
+ payload: {
87
+ id: alertId
88
+ }
89
+ });
90
+ }, closeDelay);
91
+ }
78
92
  };
79
93
  const closeHandler = id => {
80
94
  alertsDispatch({
@@ -88,7 +102,7 @@ const PuiAlertProvider = _ref2 => {
88
102
  value: {
89
103
  dispatchAlert
90
104
  },
91
- children: [children, Boolean(alerts.length) && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
105
+ children: [children, /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
92
106
  sx: {
93
107
  position: "fixed",
94
108
  transform: "translateX(-50%)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portnet/ui",
3
- "version": "0.0.91",
3
+ "version": "0.0.92",
4
4
  "description": "Portnet UI",
5
5
  "keywords": [
6
6
  "react",