react-notify-sdk 1.0.14 → 1.0.15

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.
@@ -0,0 +1,7 @@
1
+ import { NotifyMessage } from './types';
2
+ interface NotifyMessageProps {
3
+ message: NotifyMessage;
4
+ device: string;
5
+ }
6
+ declare const NotificationMessage: ({ message, device }: NotifyMessageProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default NotificationMessage;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const NotificationMessage = ({ message, device }) => {
3
+ return (_jsxs("div", { style: {
4
+ position: 'absolute',
5
+ top: message?.position === 'top' ? '24px' : undefined,
6
+ bottom: message?.position === 'bottom' ? '24px' : undefined,
7
+ left: '50%',
8
+ transform: 'translateX(-50%)',
9
+ zIndex: 20,
10
+ width: device === 'Mobile' ? '100%' : device === 'Tablet' ? '80%' : `${message?.width}%`,
11
+ paddingTop: '4px', // p-4 = 1rem
12
+ paddingBottom: '4px',
13
+ paddingLeft: '12px',
14
+ paddingRight: '12px',
15
+ backgroundColor: message?.backgroundColor,
16
+ border: `1px solid ${message?.textColor}`, // Completed border style
17
+ borderRadius: "8px"
18
+ }, children: [_jsx("p", { className: `text-lg font-semibold text-[${message?.textColor}]`, style: {
19
+ fontSize: '1.125rem', // text-lg = 18px = 1.125rem
20
+ fontWeight: 600, // font-semibold = 600
21
+ color: `${message?.textColor}`,
22
+ }, children: message.title }), _jsx("p", { className: `text-sm text-[${message?.textColor}]`, style: {
23
+ marginTop: '8px',
24
+ fontSize: '0.875rem', // text-sm = 14px = 0.875rem
25
+ color: `${message?.textColor}`,
26
+ }, children: message.content })] }));
27
+ };
28
+ export default NotificationMessage;
@@ -1,2 +1,2 @@
1
1
  import { NotifyMessageProviderProps } from './types';
2
- export declare const NotifyProvider: ({ projectId, disableDefaultStyles, }: NotifyMessageProviderProps) => import("react/jsx-runtime").JSX.Element | null;
2
+ export declare const NotifyProvider: ({ projectId, }: NotifyMessageProviderProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,14 +1,39 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  // src/FeatureMessage.tsx
3
3
  import { useEffect, useState } from 'react';
4
4
  import { useLocation } from 'react-router-dom';
5
- import clsx from 'clsx';
5
+ import NotificationMessage from './NotifyMessage';
6
+ import { styled } from "goober";
6
7
  import { supabase } from './supabase/supabaseClient';
7
8
  import useDeviceDetection from './UseDeviceDetection';
8
- export const NotifyProvider = ({ projectId,
9
+ const FadeWrapper = styled("div") `
10
+ animation: fadeIn 0.4s ease-out, fadeOut 0.4s ease-in 2.6s;
11
+ @keyframes fadeIn {
12
+ from {
13
+ opacity: 0;
14
+ transform: translateY(-0.5rem);
15
+ }
16
+ to {
17
+ opacity: 1;
18
+ transform: translateY(0);
19
+ }
20
+ }
21
+ @keyframes fadeOut {
22
+ from {
23
+ opacity: 1;
24
+ transform: translateY(0);
25
+ }
26
+ to {
27
+ opacity: 0;
28
+ transform: translateY(-0.5rem);
29
+ }
30
+ }
31
+ `;
32
+ export const NotifyProvider = ({ projectId,
9
33
  //className,
10
34
  //style,
11
- disableDefaultStyles = false, }) => {
35
+ //disableDefaultStyles = true,
36
+ }) => {
12
37
  const [message, setMessage] = useState(null);
13
38
  const location = useLocation();
14
39
  const device = useDeviceDetection();
@@ -47,33 +72,6 @@ disableDefaultStyles = false, }) => {
47
72
  }, [location.pathname, projectId]);
48
73
  if (!message)
49
74
  return null;
50
- const defaultClasses = `absolute ${message?.position}-6 left-1/2 transform -translate-x-1/2 z-20 w-full md:w-[${message?.width}%] px-3 py-1 bg-[${message?.backgroundColor}] border border-[${message?.borderColor}] text-[${message?.textColor}] rounded-lg shadow`;
51
- return (_jsxs("div", { className: clsx(!disableDefaultStyles && defaultClasses), style: !disableDefaultStyles ?
52
- {
53
- position: 'absolute',
54
- top: message?.position === 'top' ? '24px' : undefined,
55
- bottom: message?.position === 'bottom' ? '24px' : undefined,
56
- left: '50%',
57
- transform: 'translateX(-50%)',
58
- zIndex: 20,
59
- width: device === 'Mobile' ? '100%' : device === 'Tablet' ? '80%' : `${message?.width}%`,
60
- paddingTop: '4px', // p-4 = 1rem
61
- paddingBottom: '4px',
62
- paddingLeft: '12px',
63
- paddingRight: '12px',
64
- backgroundColor: message?.backgroundColor,
65
- border: `1px solid ${message?.textColor}`, // Completed border style
66
- borderRadius: "8px"
67
- }
68
- :
69
- {}, children: [_jsx("strong", { className: `block mb-2 text-lg font-semibold text-[${message?.textColor}]`, style: {
70
- display: 'block',
71
- marginBottom: '0.5rem', // mb-2 = 0.5rem
72
- fontSize: '1.125rem', // text-lg = 18px = 1.125rem
73
- fontWeight: 600, // font-semibold = 600
74
- color: `${message?.textColor}`,
75
- }, children: message.title }), _jsx("p", { className: `text-sm text-[${message?.textColor}]`, style: {
76
- fontSize: '0.875rem', // text-sm = 14px = 0.875rem
77
- color: `${message?.textColor}`,
78
- }, children: message.content })] }));
75
+ //const defaultClasses = `absolute ${message?.position}-6 left-1/2 transform -translate-x-1/2 z-20 w-full md:w-[${message?.width}%] px-3 py-1 bg-[${message?.backgroundColor}] border border-[${message?.borderColor}] text-[${message?.textColor}] rounded-lg shadow`;
76
+ return (_jsx(FadeWrapper, { children: _jsx(NotificationMessage, { message: message, device: device }) }));
79
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-notify-sdk",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "SDK for displaying real-time route-specific messages in React apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,7 +16,8 @@
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
18
  "@supabase/supabase-js": "^2.50.0",
19
- "clsx": "^2.1.1"
19
+ "clsx": "^2.1.1",
20
+ "goober": "^2.1.16"
20
21
  },
21
22
  "devDependencies": {
22
23
  "@types/react": "^19.1.8",