@flochat/react 1.0.0
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/README.md +91 -0
- package/dist/index.d.mts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Flochat
|
|
2
|
+
|
|
3
|
+
Professional Floating Social Contact Component for React Applications.
|
|
4
|
+
|
|
5
|
+
Flochat is a high-performance, customizable React component designed to integrate social media and contact links into web applications with a refined user experience. It provides a non-intrusive interface for users to connect via various platforms.
|
|
6
|
+
|
|
7
|
+
## Key Features
|
|
8
|
+
|
|
9
|
+
- **Configurable Layouts**: Supports Multiple expansion styles including Stack, Fan, and Grid.
|
|
10
|
+
- **Aesthetic Versatility**: Includes a curated set of professional gradients and support for custom branding.
|
|
11
|
+
- **Extensive Platform Support**: Pre-configured for major platforms including WhatsApp, LinkedIn, Twitter, Instagram, GitHub, and more.
|
|
12
|
+
- **Technical Excellence**: Optimized for performance, fully responsive, and compatible with both light and dark mode architectures.
|
|
13
|
+
- **Modern Stack**: Built with React, Framer Motion for fluid transitions, and Lucide React for iconography.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install the package and its required peer dependencies:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @flochat/react framer-motion lucide-react
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Flochat } from "@flochat/react";
|
|
27
|
+
|
|
28
|
+
const App = () => (
|
|
29
|
+
<Flochat
|
|
30
|
+
position="bottom-right"
|
|
31
|
+
socialLinks={[
|
|
32
|
+
{
|
|
33
|
+
platform: "linkedin",
|
|
34
|
+
url: "https://linkedin.com/in/...",
|
|
35
|
+
label: "LinkedIn",
|
|
36
|
+
},
|
|
37
|
+
{ platform: "whatsapp", url: "https://wa.me/...", label: "WhatsApp" },
|
|
38
|
+
{ platform: "email", url: "mailto:support@example.com", label: "Email" },
|
|
39
|
+
]}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export default App;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## API Reference
|
|
47
|
+
|
|
48
|
+
### Flochat Props
|
|
49
|
+
|
|
50
|
+
| Property | Type | Default | Description |
|
|
51
|
+
| :--------------- | :------------------------------------------------------ | :--------------- | :---------------------------------------------------------- |
|
|
52
|
+
| `size` | `'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | Specifies the dimensions of the component. |
|
|
53
|
+
| `position` | `'bottom-right' \| 'bottom-left'` | `'bottom-right'` | Determines the anchored position on the viewport. |
|
|
54
|
+
| `socialLinks` | `SocialLink[]` | `[]` | Array of contact and social link objects. |
|
|
55
|
+
| `animationStyle` | `'fan' \| 'stack' \| 'grid'` | `'stack'` | The animation pattern for menu expansion. |
|
|
56
|
+
| `color` | `string` | `'blue'` | Preset gradient name or `'custom'`. |
|
|
57
|
+
| `showLabels` | `boolean` | `false` | When enabled, displays text labels alongside icons. |
|
|
58
|
+
| `toggleIcon` | `'share' \| 'message' \| 'zap' \| 'sparkles' \| 'grid'` | `'share'` | The primary button icon. |
|
|
59
|
+
| `brandColors` | `boolean` | `false` | If true, uses official platform colors for contact buttons. |
|
|
60
|
+
| `bottomOffset` | `number` | `32` | Adjusts the vertical offset from the bottom. |
|
|
61
|
+
|
|
62
|
+
### SocialLink Interface
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
interface SocialLink {
|
|
66
|
+
platform:
|
|
67
|
+
| "instagram"
|
|
68
|
+
| "twitter"
|
|
69
|
+
| "facebook"
|
|
70
|
+
| "linkedin"
|
|
71
|
+
| "youtube"
|
|
72
|
+
| "github"
|
|
73
|
+
| "whatsapp"
|
|
74
|
+
| "email"
|
|
75
|
+
| "phone";
|
|
76
|
+
url: string;
|
|
77
|
+
label: string;
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Development and Build
|
|
82
|
+
|
|
83
|
+
Flochat is distributed as a tree-shakeable package. To integrate into your development workflow:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm run build
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## License
|
|
90
|
+
|
|
91
|
+
This project is licensed under the MIT License.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface SocialLink {
|
|
4
|
+
platform: 'instagram' | 'twitter' | 'facebook' | 'linkedin' | 'youtube' | 'github' | 'whatsapp' | 'email' | 'phone';
|
|
5
|
+
url: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
interface FlochatProps {
|
|
9
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
10
|
+
position?: 'bottom-right' | 'bottom-left';
|
|
11
|
+
bottomOffset?: number;
|
|
12
|
+
color?: string;
|
|
13
|
+
customColors?: {
|
|
14
|
+
primary: string;
|
|
15
|
+
secondary: string;
|
|
16
|
+
hover: string;
|
|
17
|
+
};
|
|
18
|
+
socialLinks?: SocialLink[];
|
|
19
|
+
showLabels?: boolean;
|
|
20
|
+
animationStyle?: 'fan' | 'stack' | 'grid';
|
|
21
|
+
toggleIcon?: 'share' | 'message' | 'zap' | 'sparkles' | 'grid';
|
|
22
|
+
brandColors?: boolean;
|
|
23
|
+
isAbsolute?: boolean;
|
|
24
|
+
}
|
|
25
|
+
declare function Flochat({ size, position, bottomOffset, color, customColors, socialLinks, showLabels, animationStyle, toggleIcon, brandColors, isAbsolute }: FlochatProps): react_jsx_runtime.JSX.Element;
|
|
26
|
+
|
|
27
|
+
export { Flochat, type FlochatProps, type SocialLink };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface SocialLink {
|
|
4
|
+
platform: 'instagram' | 'twitter' | 'facebook' | 'linkedin' | 'youtube' | 'github' | 'whatsapp' | 'email' | 'phone';
|
|
5
|
+
url: string;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
interface FlochatProps {
|
|
9
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
10
|
+
position?: 'bottom-right' | 'bottom-left';
|
|
11
|
+
bottomOffset?: number;
|
|
12
|
+
color?: string;
|
|
13
|
+
customColors?: {
|
|
14
|
+
primary: string;
|
|
15
|
+
secondary: string;
|
|
16
|
+
hover: string;
|
|
17
|
+
};
|
|
18
|
+
socialLinks?: SocialLink[];
|
|
19
|
+
showLabels?: boolean;
|
|
20
|
+
animationStyle?: 'fan' | 'stack' | 'grid';
|
|
21
|
+
toggleIcon?: 'share' | 'message' | 'zap' | 'sparkles' | 'grid';
|
|
22
|
+
brandColors?: boolean;
|
|
23
|
+
isAbsolute?: boolean;
|
|
24
|
+
}
|
|
25
|
+
declare function Flochat({ size, position, bottomOffset, color, customColors, socialLinks, showLabels, animationStyle, toggleIcon, brandColors, isAbsolute }: FlochatProps): react_jsx_runtime.JSX.Element;
|
|
26
|
+
|
|
27
|
+
export { Flochat, type FlochatProps, type SocialLink };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var h=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var D=(n,t)=>{for(var m in t)h(n,m,{get:t[m],enumerable:!0})},L=(n,t,m,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of P(t))!z.call(n,a)&&a!==m&&h(n,a,{get:()=>t[a],enumerable:!(i=v(t,a))||i.enumerable});return n};var O=n=>L(h({},"__esModule",{value:!0}),n);var G={};D(G,{Flochat:()=>$});module.exports=O(G);var w=require("react"),o=require("lucide-react"),b=require("framer-motion"),e=require("react/jsx-runtime"),R={sm:{button:"40px",icon:16,social:14},md:{button:"48px",icon:20,social:16},lg:{button:"56px",icon:24,social:18},xl:{button:"64px",icon:28,social:20}},F={blue:{from:"#1E40AF",to:"#3B82F6"},emerald:{from:"#065F46",to:"#10B981"},rose:{from:"#9F1239",to:"#F43F5E"},amber:{from:"#92400E",to:"#F59E0B"},violet:{from:"#5B21B6",to:"#8B5CF6"},indigo:{from:"#3730A3",to:"#6366F1"},cyan:{from:"#0E7490",to:"#06B6D4"},slate:{from:"#1E293B",to:"#475569"},orange:{from:"#9A3412",to:"#F97316"},pink:{from:"#9D174D",to:"#EC4899"},teal:{from:"#0D9488",to:"#2DD4BF"},lime:{from:"#4D7C0F",to:"#A3E635"},gold:{from:"#A16207",to:"#EAB308"},crimson:{from:"#991B1B",to:"#EF4444"},fuchsia:{from:"#86198F",to:"#E879F9"}},T={instagram:{icon:o.Instagram,color:"#E4405F"},twitter:{icon:o.Twitter,color:"#1DA1F2"},facebook:{icon:o.Facebook,color:"#1877F2"},linkedin:{icon:o.Linkedin,color:"#0A66C2"},youtube:{icon:o.Youtube,color:"#FF0000"},github:{icon:o.Github,color:"#181717"},whatsapp:{icon:o.MessageCircle,color:"#25D366"},email:{icon:o.Mail,color:"#EA4335"},phone:{icon:o.Phone,color:"#34A853"}},_={share:o.Share2,message:o.MessageCircle,zap:o.Zap,sparkles:o.Sparkles,grid:o.Grid3X3};function $({size:n="md",position:t="bottom-right",bottomOffset:m=32,color:i="blue",customColors:a,socialLinks:x=[],showLabels:k=!1,animationStyle:u="stack",toggleIcon:E="share",brandColors:A=!1,isAbsolute:S=!1}){let[g,C]=(0,w.useState)(!1),I=_[E],s=R[n],y=(r,l)=>{if(l&&a)return{backgroundColor:a.primary};let c=F[r]||F.blue;return{background:`linear-gradient(135deg, ${c.from}, ${c.to})`}},B=(r,l)=>{let c=60+r*54;if(u==="stack")return{x:0,y:-c};if(u==="fan"){let p=Math.PI/2.5*(r/Math.max(1,l-1)),f=80;return{x:(t==="bottom-right"?-1:1)*Math.sin(p)*f,y:-Math.cos(p)*f}}if(u==="grid"){let p=Math.floor(r/2),f=r%2;return{x:(t==="bottom-right"?-1:1)*(f*54),y:-(p+1)*54}}return{x:0,y:0}};return(0,e.jsxs)("div",{style:{position:S?"absolute":"fixed",zIndex:9999,bottom:`${m}px`,right:t==="bottom-right"?"32px":"auto",left:t==="bottom-left"?"32px":"auto",fontFamily:"system-ui, -apple-system, sans-serif"},children:[(0,e.jsx)(b.AnimatePresence,{children:g&&x.map((r,l)=>{let c=T[r.platform],p=c.icon,{x:f,y:M}=B(l,x.length);return(0,e.jsx)(b.motion.div,{initial:{opacity:0,scale:.5,x:0,y:0},animate:{opacity:1,scale:1,x:f,y:M},exit:{opacity:0,scale:.5,x:0,y:0},transition:{type:"spring",stiffness:400,damping:25,delay:l*.05},style:{position:"absolute",display:"flex",alignItems:"center",left:t==="bottom-left"?0:"auto",right:t==="bottom-right"?0:"auto"},children:(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexDirection:t==="bottom-right"?"row-reverse":"row"},children:[(0,e.jsx)("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",style:{...A?{backgroundColor:c.color}:y(i,i==="custom"),width:s.button,height:s.button,borderRadius:"9999px",display:"flex",alignItems:"center",justifyContent:"center",color:"white",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",transition:"transform 0.2s",cursor:"pointer"},onMouseEnter:d=>d.currentTarget.style.transform="scale(1.1)",onMouseLeave:d=>d.currentTarget.style.transform="scale(1)",children:(0,e.jsx)(p,{size:s.social})}),k&&(0,e.jsx)("span",{style:{backgroundColor:"white",border:"1px solid #e2e8f0",padding:"4px 8px",borderRadius:"4px",fontSize:"11px",fontWeight:600,color:"#1a202c",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",whiteSpace:"nowrap"},children:r.label})]})},`${r.platform}-${l}`)})}),(0,e.jsx)(b.motion.button,{onClick:()=>C(!g),style:{...y(i,i==="custom"),width:s.button,height:s.button,borderRadius:"9999px",display:"flex",alignItems:"center",justifyContent:"center",color:"white",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",cursor:"pointer",position:"relative",zIndex:10,border:"none",outline:"none"},animate:{rotate:g?90:0},whileTap:{scale:.92},children:g?(0,e.jsx)(o.X,{size:s.icon}):(0,e.jsx)(I,{size:s.icon})})]})}0&&(module.exports={Flochat});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as M}from"react";import{Share2 as v,X as P,Instagram as z,Twitter as D,Facebook as L,Linkedin as O,Youtube as R,Github as T,MessageCircle as x,Mail as _,Phone as $,Zap as G,Sparkles as X,Grid3X3 as Z}from"lucide-react";import{motion as u,AnimatePresence as j}from"framer-motion";import{jsx as t,jsxs as h}from"react/jsx-runtime";var N={sm:{button:"40px",icon:16,social:14},md:{button:"48px",icon:20,social:16},lg:{button:"56px",icon:24,social:18},xl:{button:"64px",icon:28,social:20}},d={blue:{from:"#1E40AF",to:"#3B82F6"},emerald:{from:"#065F46",to:"#10B981"},rose:{from:"#9F1239",to:"#F43F5E"},amber:{from:"#92400E",to:"#F59E0B"},violet:{from:"#5B21B6",to:"#8B5CF6"},indigo:{from:"#3730A3",to:"#6366F1"},cyan:{from:"#0E7490",to:"#06B6D4"},slate:{from:"#1E293B",to:"#475569"},orange:{from:"#9A3412",to:"#F97316"},pink:{from:"#9D174D",to:"#EC4899"},teal:{from:"#0D9488",to:"#2DD4BF"},lime:{from:"#4D7C0F",to:"#A3E635"},gold:{from:"#A16207",to:"#EAB308"},crimson:{from:"#991B1B",to:"#EF4444"},fuchsia:{from:"#86198F",to:"#E879F9"}},W={instagram:{icon:z,color:"#E4405F"},twitter:{icon:D,color:"#1DA1F2"},facebook:{icon:L,color:"#1877F2"},linkedin:{icon:O,color:"#0A66C2"},youtube:{icon:R,color:"#FF0000"},github:{icon:T,color:"#181717"},whatsapp:{icon:x,color:"#25D366"},email:{icon:_,color:"#EA4335"},phone:{icon:$,color:"#34A853"}},Y={share:v,message:x,zap:G,sparkles:X,grid:Z};function Q({size:y="md",position:e="bottom-right",bottomOffset:F=32,color:l="blue",customColors:f,socialLinks:b=[],showLabels:w=!1,animationStyle:m="stack",toggleIcon:k="share",brandColors:E=!1,isAbsolute:A=!1}){let[c,S]=M(!1),C=Y[k],r=N[y],g=(o,n)=>{if(n&&f)return{backgroundColor:f.primary};let a=d[o]||d.blue;return{background:`linear-gradient(135deg, ${a.from}, ${a.to})`}},I=(o,n)=>{let a=60+o*54;if(m==="stack")return{x:0,y:-a};if(m==="fan"){let i=Math.PI/2.5*(o/Math.max(1,n-1)),s=80;return{x:(e==="bottom-right"?-1:1)*Math.sin(i)*s,y:-Math.cos(i)*s}}if(m==="grid"){let i=Math.floor(o/2),s=o%2;return{x:(e==="bottom-right"?-1:1)*(s*54),y:-(i+1)*54}}return{x:0,y:0}};return h("div",{style:{position:A?"absolute":"fixed",zIndex:9999,bottom:`${F}px`,right:e==="bottom-right"?"32px":"auto",left:e==="bottom-left"?"32px":"auto",fontFamily:"system-ui, -apple-system, sans-serif"},children:[t(j,{children:c&&b.map((o,n)=>{let a=W[o.platform],i=a.icon,{x:s,y:B}=I(n,b.length);return t(u.div,{initial:{opacity:0,scale:.5,x:0,y:0},animate:{opacity:1,scale:1,x:s,y:B},exit:{opacity:0,scale:.5,x:0,y:0},transition:{type:"spring",stiffness:400,damping:25,delay:n*.05},style:{position:"absolute",display:"flex",alignItems:"center",left:e==="bottom-left"?0:"auto",right:e==="bottom-right"?0:"auto"},children:h("div",{style:{display:"flex",alignItems:"center",gap:"12px",flexDirection:e==="bottom-right"?"row-reverse":"row"},children:[t("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",style:{...E?{backgroundColor:a.color}:g(l,l==="custom"),width:r.button,height:r.button,borderRadius:"9999px",display:"flex",alignItems:"center",justifyContent:"center",color:"white",boxShadow:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",transition:"transform 0.2s",cursor:"pointer"},onMouseEnter:p=>p.currentTarget.style.transform="scale(1.1)",onMouseLeave:p=>p.currentTarget.style.transform="scale(1)",children:t(i,{size:r.social})}),w&&t("span",{style:{backgroundColor:"white",border:"1px solid #e2e8f0",padding:"4px 8px",borderRadius:"4px",fontSize:"11px",fontWeight:600,color:"#1a202c",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",whiteSpace:"nowrap"},children:o.label})]})},`${o.platform}-${n}`)})}),t(u.button,{onClick:()=>S(!c),style:{...g(l,l==="custom"),width:r.button,height:r.button,borderRadius:"9999px",display:"flex",alignItems:"center",justifyContent:"center",color:"white",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)",cursor:"pointer",position:"relative",zIndex:10,border:"none",outline:"none"},animate:{rotate:c?90:0},whileTap:{scale:.92},children:c?t(P,{size:r.icon}):t(C,{size:r.icon})})]})}export{Q as Flochat};
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flochat/react",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"module": "dist/index.mjs",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --minify",
|
|
12
|
+
"dev": "tsup src/index.ts --format cjs,esm --watch --dts",
|
|
13
|
+
"lint": "eslint src/**/*.ts*"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"framer-motion": "^12.23.12",
|
|
17
|
+
"lucide-react": "^0.539.0"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"react": "^18.0.0",
|
|
21
|
+
"react-dom": "^18.0.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"tsup": "^8.0.0",
|
|
25
|
+
"typescript": "^5.0.0",
|
|
26
|
+
"@types/react": "^18.0.0",
|
|
27
|
+
"@types/react-dom": "^18.0.0",
|
|
28
|
+
"react": "^18.0.0",
|
|
29
|
+
"react-dom": "^18.0.0"
|
|
30
|
+
}
|
|
31
|
+
}
|