@neoptocom/neopto-ui 1.3.1 → 1.4.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.cjs CHANGED
@@ -1255,7 +1255,8 @@ var AgentButton = ({
1255
1255
  notificationMessage = "",
1256
1256
  logoSrc,
1257
1257
  logoAlt = "Agent",
1258
- animationColors = ["#7DADB9", "#3864F5", "#55468D", "#479A8D"]
1258
+ animationColors = ["#7DADB9", "#3864F5", "#55468D", "#479A8D"],
1259
+ disabled = false
1259
1260
  }) => {
1260
1261
  const [showText, setShowText] = React3.useState(false);
1261
1262
  const [delayedHasNotification, setDelayedHasNotification] = React3.useState(false);
@@ -1296,12 +1297,18 @@ var AgentButton = ({
1296
1297
  return /* @__PURE__ */ jsxRuntime.jsxs(
1297
1298
  "div",
1298
1299
  {
1299
- className: `flex justify-end items-center fixed bottom-3 right-8 z-40 h-24 transition-all duration-600 ease-in-out ${delayedHasNotification ? "w-[432px]" : "w-24"} ${isMounted ? "opacity-100" : "opacity-0"}`,
1300
+ className: `flex justify-end items-center fixed bottom-3 right-8 z-40 h-24 transition-all duration-1000 ease-in-out ${delayedHasNotification ? "w-[432px]" : "w-24"} ${isMounted ? "opacity-100" : "opacity-0"}`,
1301
+ style: {
1302
+ filter: disabled ? "grayscale(100%)" : "grayscale(0%)",
1303
+ opacity: disabled ? 0.3 : 1,
1304
+ transition: "filter 1s ease-in-out, opacity 1s ease-in-out"
1305
+ },
1300
1306
  children: [
1301
1307
  circleAnimations.map((circle, index) => /* @__PURE__ */ jsxRuntime.jsx(
1302
1308
  "div",
1303
1309
  {
1304
- className: `absolute ${circle.style} h-20 min-w-20 transition-all duration-600 ease-in-out w-20 overflow-visible flex justify-between`,
1310
+ className: `absolute ${circle.style} h-20 min-w-20 w-20 overflow-visible flex justify-between transition-opacity duration-1000 ease-in-out`,
1311
+ style: { opacity: disabled ? 0 : 1 },
1305
1312
  children: /* @__PURE__ */ jsxRuntime.jsx(
1306
1313
  AnimatedBgCircle_default,
1307
1314
  {
@@ -1316,7 +1323,11 @@ var AgentButton = ({
1316
1323
  rectAnimations.map((rect, index) => /* @__PURE__ */ jsxRuntime.jsx(
1317
1324
  "div",
1318
1325
  {
1319
- className: `absolute ${rect.style} h-20 transition-all duration-600 ease-in-out ${delayedHasNotification ? "w-[324px] opacity-100 px-0" : "w-20 px-10 opacity-0"} overflow-visible flex justify-between`,
1326
+ className: `absolute ${rect.style} h-20 transition-all ease-in-out ${delayedHasNotification ? "w-[324px] px-0" : "w-20 px-10"} overflow-visible flex justify-between`,
1327
+ style: {
1328
+ opacity: disabled ? 0 : delayedHasNotification ? 1 : 0,
1329
+ transitionDuration: "1s"
1330
+ },
1320
1331
  children: /* @__PURE__ */ jsxRuntime.jsx(AnimatedBgRectangle_default, { colors: animationColors, delay: rect.delay })
1321
1332
  },
1322
1333
  `rect-${index}`
@@ -1325,7 +1336,8 @@ var AgentButton = ({
1325
1336
  "button",
1326
1337
  {
1327
1338
  onClick: onOpenChat,
1328
- className: `flex flex-row-reverse items-center gap-1.5 fixed p-3 rounded-full shadow-md cursor-pointer h-16 mr-4 transition-all duration-600 ease-in-out border-2 border-[var(--border)] ${delayedHasNotification ? "w-[400px]" : "w-16"}`,
1339
+ disabled,
1340
+ className: `flex flex-row-reverse items-center gap-1.5 fixed p-3 rounded-full shadow-md h-16 mr-4 transition-all duration-600 ease-in-out border-2 border-[var(--border)] ${delayedHasNotification ? "w-[400px]" : "w-16"} ${disabled ? "cursor-default" : "cursor-pointer"}`,
1329
1341
  style: {
1330
1342
  background: "var(--chat-button-gradient)"
1331
1343
  },
package/dist/index.d.cts CHANGED
@@ -298,8 +298,10 @@ interface AgentButtonProps {
298
298
  logoAlt?: string;
299
299
  /** Custom animation colors */
300
300
  animationColors?: string[];
301
+ /** Whether the button is disabled (greyscale, no animations) */
302
+ disabled?: boolean;
301
303
  }
302
- declare const AgentButton: ({ onOpenChat, hasNotification, notificationMessage, logoSrc, logoAlt, animationColors, }: AgentButtonProps) => react_jsx_runtime.JSX.Element;
304
+ declare const AgentButton: ({ onOpenChat, hasNotification, notificationMessage, logoSrc, logoAlt, animationColors, disabled, }: AgentButtonProps) => react_jsx_runtime.JSX.Element;
303
305
 
304
306
  interface AnimatedBgCircleProps {
305
307
  colors: string[];
package/dist/index.d.ts CHANGED
@@ -298,8 +298,10 @@ interface AgentButtonProps {
298
298
  logoAlt?: string;
299
299
  /** Custom animation colors */
300
300
  animationColors?: string[];
301
+ /** Whether the button is disabled (greyscale, no animations) */
302
+ disabled?: boolean;
301
303
  }
302
- declare const AgentButton: ({ onOpenChat, hasNotification, notificationMessage, logoSrc, logoAlt, animationColors, }: AgentButtonProps) => react_jsx_runtime.JSX.Element;
304
+ declare const AgentButton: ({ onOpenChat, hasNotification, notificationMessage, logoSrc, logoAlt, animationColors, disabled, }: AgentButtonProps) => react_jsx_runtime.JSX.Element;
303
305
 
304
306
  interface AnimatedBgCircleProps {
305
307
  colors: string[];
package/dist/index.js CHANGED
@@ -1234,7 +1234,8 @@ var AgentButton = ({
1234
1234
  notificationMessage = "",
1235
1235
  logoSrc,
1236
1236
  logoAlt = "Agent",
1237
- animationColors = ["#7DADB9", "#3864F5", "#55468D", "#479A8D"]
1237
+ animationColors = ["#7DADB9", "#3864F5", "#55468D", "#479A8D"],
1238
+ disabled = false
1238
1239
  }) => {
1239
1240
  const [showText, setShowText] = useState(false);
1240
1241
  const [delayedHasNotification, setDelayedHasNotification] = useState(false);
@@ -1275,12 +1276,18 @@ var AgentButton = ({
1275
1276
  return /* @__PURE__ */ jsxs(
1276
1277
  "div",
1277
1278
  {
1278
- className: `flex justify-end items-center fixed bottom-3 right-8 z-40 h-24 transition-all duration-600 ease-in-out ${delayedHasNotification ? "w-[432px]" : "w-24"} ${isMounted ? "opacity-100" : "opacity-0"}`,
1279
+ className: `flex justify-end items-center fixed bottom-3 right-8 z-40 h-24 transition-all duration-1000 ease-in-out ${delayedHasNotification ? "w-[432px]" : "w-24"} ${isMounted ? "opacity-100" : "opacity-0"}`,
1280
+ style: {
1281
+ filter: disabled ? "grayscale(100%)" : "grayscale(0%)",
1282
+ opacity: disabled ? 0.3 : 1,
1283
+ transition: "filter 1s ease-in-out, opacity 1s ease-in-out"
1284
+ },
1279
1285
  children: [
1280
1286
  circleAnimations.map((circle, index) => /* @__PURE__ */ jsx(
1281
1287
  "div",
1282
1288
  {
1283
- className: `absolute ${circle.style} h-20 min-w-20 transition-all duration-600 ease-in-out w-20 overflow-visible flex justify-between`,
1289
+ className: `absolute ${circle.style} h-20 min-w-20 w-20 overflow-visible flex justify-between transition-opacity duration-1000 ease-in-out`,
1290
+ style: { opacity: disabled ? 0 : 1 },
1284
1291
  children: /* @__PURE__ */ jsx(
1285
1292
  AnimatedBgCircle_default,
1286
1293
  {
@@ -1295,7 +1302,11 @@ var AgentButton = ({
1295
1302
  rectAnimations.map((rect, index) => /* @__PURE__ */ jsx(
1296
1303
  "div",
1297
1304
  {
1298
- className: `absolute ${rect.style} h-20 transition-all duration-600 ease-in-out ${delayedHasNotification ? "w-[324px] opacity-100 px-0" : "w-20 px-10 opacity-0"} overflow-visible flex justify-between`,
1305
+ className: `absolute ${rect.style} h-20 transition-all ease-in-out ${delayedHasNotification ? "w-[324px] px-0" : "w-20 px-10"} overflow-visible flex justify-between`,
1306
+ style: {
1307
+ opacity: disabled ? 0 : delayedHasNotification ? 1 : 0,
1308
+ transitionDuration: "1s"
1309
+ },
1299
1310
  children: /* @__PURE__ */ jsx(AnimatedBgRectangle_default, { colors: animationColors, delay: rect.delay })
1300
1311
  },
1301
1312
  `rect-${index}`
@@ -1304,7 +1315,8 @@ var AgentButton = ({
1304
1315
  "button",
1305
1316
  {
1306
1317
  onClick: onOpenChat,
1307
- className: `flex flex-row-reverse items-center gap-1.5 fixed p-3 rounded-full shadow-md cursor-pointer h-16 mr-4 transition-all duration-600 ease-in-out border-2 border-[var(--border)] ${delayedHasNotification ? "w-[400px]" : "w-16"}`,
1318
+ disabled,
1319
+ className: `flex flex-row-reverse items-center gap-1.5 fixed p-3 rounded-full shadow-md h-16 mr-4 transition-all duration-600 ease-in-out border-2 border-[var(--border)] ${delayedHasNotification ? "w-[400px]" : "w-16"} ${disabled ? "cursor-default" : "cursor-pointer"}`,
1308
1320
  style: {
1309
1321
  background: "var(--chat-button-gradient)"
1310
1322
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neoptocom/neopto-ui",
3
- "version": "1.3.1",
3
+ "version": "1.4.1",
4
4
  "private": false,
5
5
  "description": "A modern React component library built with Tailwind CSS v4 and TypeScript. Features dark mode, design tokens, and comprehensive Storybook documentation. Requires Tailwind v4+.",
6
6
  "keywords": [
@@ -16,6 +16,8 @@ export interface AgentButtonProps {
16
16
  logoAlt?: string;
17
17
  /** Custom animation colors */
18
18
  animationColors?: string[];
19
+ /** Whether the button is disabled (greyscale, no animations) */
20
+ disabled?: boolean;
19
21
  }
20
22
 
21
23
  const AgentButton = ({
@@ -25,6 +27,7 @@ const AgentButton = ({
25
27
  logoSrc,
26
28
  logoAlt = "Agent",
27
29
  animationColors = ["#7DADB9", "#3864F5", "#55468D", "#479A8D"],
30
+ disabled = false,
28
31
  }: AgentButtonProps) => {
29
32
  const [showText, setShowText] = useState(false);
30
33
  const [delayedHasNotification, setDelayedHasNotification] = useState(false);
@@ -68,14 +71,20 @@ const AgentButton = ({
68
71
 
69
72
  return (
70
73
  <div
71
- className={`flex justify-end items-center fixed bottom-3 right-8 z-40 h-24 transition-all duration-600 ease-in-out ${
74
+ className={`flex justify-end items-center fixed bottom-3 right-8 z-40 h-24 transition-all duration-1000 ease-in-out ${
72
75
  delayedHasNotification ? "w-[432px]" : "w-24"
73
76
  } ${isMounted ? "opacity-100" : "opacity-0"}`}
77
+ style={{
78
+ filter: disabled ? "grayscale(100%)" : "grayscale(0%)",
79
+ opacity: disabled ? 0.3 : 1,
80
+ transition: "filter 1s ease-in-out, opacity 1s ease-in-out",
81
+ }}
74
82
  >
75
83
  {circleAnimations.map((circle, index) => (
76
84
  <div
77
85
  key={`circle-${index}`}
78
- className={`absolute ${circle.style} h-20 min-w-20 transition-all duration-600 ease-in-out w-20 overflow-visible flex justify-between`}
86
+ className={`absolute ${circle.style} h-20 min-w-20 w-20 overflow-visible flex justify-between transition-opacity duration-1000 ease-in-out`}
87
+ style={{ opacity: disabled ? 0 : 1 }}
79
88
  >
80
89
  <AnimatedBgCircle
81
90
  colors={animationColors}
@@ -87,11 +96,15 @@ const AgentButton = ({
87
96
  {rectAnimations.map((rect, index) => (
88
97
  <div
89
98
  key={`rect-${index}`}
90
- className={`absolute ${rect.style} h-20 transition-all duration-600 ease-in-out ${
99
+ className={`absolute ${rect.style} h-20 transition-all ease-in-out ${
91
100
  delayedHasNotification
92
- ? "w-[324px] opacity-100 px-0"
93
- : "w-20 px-10 opacity-0"
101
+ ? "w-[324px] px-0"
102
+ : "w-20 px-10"
94
103
  } overflow-visible flex justify-between`}
104
+ style={{
105
+ opacity: disabled ? 0 : delayedHasNotification ? 1 : 0,
106
+ transitionDuration: "1s",
107
+ }}
95
108
  >
96
109
  <AnimatedBgRectangle colors={animationColors} delay={rect.delay} />
97
110
  </div>
@@ -99,9 +112,10 @@ const AgentButton = ({
99
112
  {isMounted && (
100
113
  <button
101
114
  onClick={onOpenChat}
102
- className={`flex flex-row-reverse items-center gap-1.5 fixed p-3 rounded-full shadow-md cursor-pointer h-16 mr-4 transition-all duration-600 ease-in-out border-2 border-[var(--border)] ${
115
+ disabled={disabled}
116
+ className={`flex flex-row-reverse items-center gap-1.5 fixed p-3 rounded-full shadow-md h-16 mr-4 transition-all duration-600 ease-in-out border-2 border-[var(--border)] ${
103
117
  delayedHasNotification ? "w-[400px]" : "w-16"
104
- }`}
118
+ } ${disabled ? "cursor-default" : "cursor-pointer"}`}
105
119
  style={{
106
120
  background: "var(--chat-button-gradient)",
107
121
  }}
@@ -92,3 +92,79 @@ export const AutoToggleNotification: Story = {
92
92
  },
93
93
  };
94
94
 
95
+ export const Disabled: Story = {
96
+ args: {
97
+ disabled: true,
98
+ hasNotification: true,
99
+ notificationMessage: "This button is disabled (greyscale, no animations)",
100
+ },
101
+ };
102
+
103
+ export const DisabledWhenChatOpen: Story = {
104
+ render: (args) => {
105
+ const [chatOpen, setChatOpen] = React.useState(false);
106
+
107
+ return (
108
+ <>
109
+ <AgentButton
110
+ {...args}
111
+ disabled={chatOpen}
112
+ hasNotification={!chatOpen}
113
+ notificationMessage="Click to open chat (button will become disabled)"
114
+ onOpenChat={() => {
115
+ setChatOpen(true);
116
+ console.log("Chat opened!");
117
+ }}
118
+ />
119
+ {chatOpen && (
120
+ <div className="fixed bottom-24 right-8 bg-[var(--surface)] border border-[var(--border)] rounded-lg p-4 shadow-lg z-50 max-w-md">
121
+ <Typo variant="body-md" className="text-[var(--fg)]">
122
+ Chat is open! Notice the button is now disabled (greyscale with no animations).
123
+ </Typo>
124
+ <button
125
+ onClick={() => setChatOpen(false)}
126
+ className="mt-2 px-3 py-1 bg-[var(--color-brand)] text-white rounded-full"
127
+ >
128
+ <Typo variant="label-sm">Close Chat</Typo>
129
+ </button>
130
+ </div>
131
+ )}
132
+ </>
133
+ );
134
+ },
135
+ };
136
+
137
+ export const DisabledTransition: Story = {
138
+ render: (args) => {
139
+ const [disabled, setDisabled] = React.useState(false);
140
+
141
+ React.useEffect(() => {
142
+ const interval = setInterval(() => {
143
+ setDisabled((prev) => !prev);
144
+ }, 4000);
145
+
146
+ return () => clearInterval(interval);
147
+ }, []);
148
+
149
+ return (
150
+ <>
151
+ <AgentButton
152
+ {...args}
153
+ disabled={disabled}
154
+ hasNotification={!disabled}
155
+ notificationMessage="Watch the smooth 1-second transition!"
156
+ onOpenChat={() => console.log("Chat opened!")}
157
+ />
158
+ <div className="fixed top-8 left-8 bg-[var(--surface)] border border-[var(--border)] rounded-lg p-4 shadow-lg">
159
+ <Typo variant="body-md" className="text-[var(--fg)]">
160
+ State: <strong>{disabled ? "Disabled" : "Enabled"}</strong>
161
+ </Typo>
162
+ <Typo variant="label-sm" className="text-[var(--muted-fg)] mt-1">
163
+ Toggles every 4 seconds
164
+ </Typo>
165
+ </div>
166
+ </>
167
+ );
168
+ },
169
+ };
170
+