@hexdspace/react 0.0.9 → 0.0.10

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -110,12 +110,41 @@ var DEFAULT_NOTIFICATION_CHANNEL = "app.notifications";
110
110
 
111
111
  // src/feature/notifier/infra/web/react/CustomToastTransition.tsx
112
112
  import { cssTransition } from "react-toastify";
113
+ var CUSTOM_TRANSITION_STYLE_ID = "hexd-toast-transition-styles";
114
+ var CUSTOM_TRANSITION_STYLES = `
115
+ @keyframes slideIn {
116
+ from { transform: translateY(-20px); opacity: 0; }
117
+ to { transform: translateY(0); opacity: 1; }
118
+ }
119
+
120
+ @keyframes slideOut {
121
+ from { transform: translateY(0); opacity: 1; }
122
+ to { transform: translateY(-20px); opacity: 0; }
123
+ }
124
+
125
+ .slideIn {
126
+ animation: slideIn 0.35s forwards;
127
+ }
128
+
129
+ .slideOut {
130
+ animation: slideOut 0.25s forwards;
131
+ }
132
+ `;
133
+ var ensureCustomToastTransitionStyles = () => {
134
+ if (typeof document === "undefined") return;
135
+ if (document.getElementById(CUSTOM_TRANSITION_STYLE_ID)) return;
136
+ const style = document.createElement("style");
137
+ style.id = CUSTOM_TRANSITION_STYLE_ID;
138
+ style.textContent = CUSTOM_TRANSITION_STYLES;
139
+ document.head.appendChild(style);
140
+ };
113
141
  var SlideUp = cssTransition({
114
142
  enter: "slideIn",
115
143
  exit: "slideOut",
116
144
  collapseDuration: 300
117
145
  });
118
146
  var buildToastTransition = (transition) => {
147
+ ensureCustomToastTransitionStyles();
119
148
  if (!transition) return SlideUp;
120
149
  return cssTransition(transition);
121
150
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexdspace/react",
3
- "version": "0.0.9",
3
+ "version": "0.0.10",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",