@algorithm-shift/design-system 1.2.984 → 1.2.985
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.css +10 -28
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +84 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -87
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -609,6 +609,19 @@ function DropdownMenuItem({
|
|
|
609
609
|
}
|
|
610
610
|
);
|
|
611
611
|
}
|
|
612
|
+
function DropdownMenuSeparator({
|
|
613
|
+
className,
|
|
614
|
+
...props
|
|
615
|
+
}) {
|
|
616
|
+
return /* @__PURE__ */ jsx16(
|
|
617
|
+
DropdownMenuPrimitive.Separator,
|
|
618
|
+
{
|
|
619
|
+
"data-slot": "dropdown-menu-separator",
|
|
620
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
621
|
+
...props
|
|
622
|
+
}
|
|
623
|
+
);
|
|
624
|
+
}
|
|
612
625
|
function DropdownMenuSub({
|
|
613
626
|
...props
|
|
614
627
|
}) {
|
|
@@ -5166,7 +5179,11 @@ import { jsx as jsx63, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
|
5166
5179
|
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
5167
5180
|
|
|
5168
5181
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
5182
|
+
import { useCallback as useCallback4, useMemo as useMemo9, useState as useState14, useEffect as useEffect26 } from "react";
|
|
5169
5183
|
import { Bell, Search as Search2, Menu as Menu2 } from "lucide-react";
|
|
5184
|
+
import Image3 from "next/image";
|
|
5185
|
+
import Link4 from "next/link";
|
|
5186
|
+
import { useRouter as useRouter2 } from "next/navigation";
|
|
5170
5187
|
|
|
5171
5188
|
// src/components/ui/avatar.tsx
|
|
5172
5189
|
import * as React12 from "react";
|
|
@@ -5207,11 +5224,6 @@ var AvatarFallback = React12.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
5207
5224
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
5208
5225
|
|
|
5209
5226
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
5210
|
-
import Link4 from "next/link";
|
|
5211
|
-
import Image3 from "next/image";
|
|
5212
|
-
import { useRouter as useRouter2 } from "next/navigation";
|
|
5213
|
-
import { DropdownMenuSeparator } from "@radix-ui/react-dropdown-menu";
|
|
5214
|
-
import { useCallback as useCallback4, useMemo as useMemo9, useState as useState14 } from "react";
|
|
5215
5227
|
import { Fragment as Fragment23, jsx as jsx66, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
5216
5228
|
function Navbar({
|
|
5217
5229
|
style,
|
|
@@ -5223,44 +5235,76 @@ function Navbar({
|
|
|
5223
5235
|
imageUrl,
|
|
5224
5236
|
altText = "Logo",
|
|
5225
5237
|
canvasMode = "desktop",
|
|
5238
|
+
// desktop | mobile | tablet
|
|
5226
5239
|
list = [],
|
|
5227
5240
|
profileMenu = [],
|
|
5228
5241
|
userName = "Guest User",
|
|
5229
5242
|
isBuilder = false,
|
|
5230
5243
|
source,
|
|
5231
|
-
navList
|
|
5244
|
+
navList,
|
|
5245
|
+
onSearch
|
|
5232
5246
|
}) {
|
|
5233
|
-
const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
|
|
5234
5247
|
const router = useRouter2();
|
|
5235
|
-
const [
|
|
5236
|
-
|
|
5248
|
+
const [screenMode, setScreenMode] = useState14(
|
|
5249
|
+
canvasMode
|
|
5250
|
+
);
|
|
5251
|
+
useEffect26(() => {
|
|
5252
|
+
const detectMode = () => {
|
|
5253
|
+
if (window.innerWidth < 640) setScreenMode("mobile");
|
|
5254
|
+
else if (window.innerWidth < 1024) setScreenMode("tablet");
|
|
5255
|
+
else setScreenMode("desktop");
|
|
5256
|
+
};
|
|
5257
|
+
detectMode();
|
|
5258
|
+
window.addEventListener("resize", detectMode);
|
|
5259
|
+
return () => window.removeEventListener("resize", detectMode);
|
|
5260
|
+
}, []);
|
|
5261
|
+
const mode = canvasMode || screenMode;
|
|
5262
|
+
const isMobile = mode === "mobile";
|
|
5263
|
+
const isTablet = mode === "tablet";
|
|
5264
|
+
const isDesktop = mode === "desktop";
|
|
5237
5265
|
const handleBuilderExit = useCallback4(
|
|
5238
5266
|
(e, url) => {
|
|
5239
5267
|
if (isBuilder) {
|
|
5240
5268
|
e.preventDefault();
|
|
5241
|
-
|
|
5242
|
-
|
|
5269
|
+
showSonnerToast({ variant: "info", title: `You will be redirected to ${url} in the real app.`, duration: 3e3 });
|
|
5270
|
+
} else {
|
|
5271
|
+
router.push(url);
|
|
5243
5272
|
}
|
|
5244
5273
|
},
|
|
5245
5274
|
[isBuilder]
|
|
5246
5275
|
);
|
|
5247
|
-
const
|
|
5248
|
-
if (
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
const formatedMenu = useMemo9(() => {
|
|
5254
|
-
if (source === "state" && navList && navList.length) {
|
|
5255
|
-
return navList.map((i) => ({ ...i, header: i.name || "Menu" }));
|
|
5276
|
+
const formattedMenu = useMemo9(() => {
|
|
5277
|
+
if (source === "state" && navList?.length) {
|
|
5278
|
+
return navList.map((i) => ({
|
|
5279
|
+
...i,
|
|
5280
|
+
header: i.name || "Menu"
|
|
5281
|
+
}));
|
|
5256
5282
|
}
|
|
5257
|
-
return list
|
|
5258
|
-
}, [source, navList]);
|
|
5283
|
+
return list;
|
|
5284
|
+
}, [source, navList, list]);
|
|
5285
|
+
const RenderSearchInput = () => /* @__PURE__ */ jsx66("div", { className: "flex-1 px-2", children: /* @__PURE__ */ jsxs40("div", { className: "relative w-full max-w-md border border-gray-300 rounded-md", children: [
|
|
5286
|
+
/* @__PURE__ */ jsx66(Search2, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 dark:text-white text-gray-400" }),
|
|
5287
|
+
/* @__PURE__ */ jsx66(
|
|
5288
|
+
Input,
|
|
5289
|
+
{
|
|
5290
|
+
placeholder: "Search",
|
|
5291
|
+
className: "pl-9 text-gray-500",
|
|
5292
|
+
onKeyDown: (event) => {
|
|
5293
|
+
if (event.key === "Enter") {
|
|
5294
|
+
const query = event.target.value;
|
|
5295
|
+
onSearch?.({
|
|
5296
|
+
searchTerm: query
|
|
5297
|
+
});
|
|
5298
|
+
}
|
|
5299
|
+
}
|
|
5300
|
+
}
|
|
5301
|
+
)
|
|
5302
|
+
] }) });
|
|
5259
5303
|
return /* @__PURE__ */ jsxs40(Fragment23, { children: [
|
|
5260
5304
|
/* @__PURE__ */ jsx66(
|
|
5261
5305
|
"nav",
|
|
5262
5306
|
{
|
|
5263
|
-
className: "w-full h-[75px] border-b border-
|
|
5307
|
+
className: "w-full min-h-[75px] border-b border-gray-200 dark:border-gray-800 dark:bg-gray-800 bg-white shadow-sm",
|
|
5264
5308
|
style,
|
|
5265
5309
|
children: /* @__PURE__ */ jsxs40("div", { className: "mx-auto flex max-w-[90%] items-center justify-between px-4 py-4", children: [
|
|
5266
5310
|
/* @__PURE__ */ jsx66(
|
|
@@ -5269,69 +5313,36 @@ function Navbar({
|
|
|
5269
5313
|
href: "/",
|
|
5270
5314
|
onClick: (e) => handleBuilderExit(e, "/"),
|
|
5271
5315
|
className: "flex items-center space-x-2",
|
|
5272
|
-
children: imageUrl ? /* @__PURE__ */ jsx66(Image3, { src: imageUrl, alt: altText, width:
|
|
5316
|
+
children: imageUrl ? /* @__PURE__ */ jsx66(Image3, { src: imageUrl, alt: altText, width: 180, height: 40 }) : /* @__PURE__ */ jsx66("span", { className: "font-semibold text-blue-700", children: "Logo" })
|
|
5273
5317
|
}
|
|
5274
5318
|
),
|
|
5275
|
-
|
|
5319
|
+
isDesktop && /* @__PURE__ */ jsx66("div", { className: "hidden md:flex items-center space-x-6", children: formattedMenu.map((item) => /* @__PURE__ */ jsx66(
|
|
5276
5320
|
Link4,
|
|
5277
5321
|
{
|
|
5278
|
-
href: item.url
|
|
5322
|
+
href: item.url,
|
|
5279
5323
|
onClick: (e) => handleBuilderExit(e, item.url),
|
|
5280
|
-
className: "text-sm font-medium dark:text-white
|
|
5324
|
+
className: "text-sm font-medium text-gray-600 dark:text-white hover:text-gray-900",
|
|
5281
5325
|
children: item.header
|
|
5282
5326
|
},
|
|
5283
5327
|
item.id
|
|
5284
5328
|
)) }),
|
|
5285
5329
|
/* @__PURE__ */ jsxs40("div", { className: "flex items-center space-x-3", children: [
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
/* @__PURE__ */ jsx66(
|
|
5289
|
-
|
|
5290
|
-
/* @__PURE__ */ jsxs40("div", { className: "relative bg-[#E9E9E9] dark:bg-gray-700 rounded-md", children: [
|
|
5291
|
-
/* @__PURE__ */ jsx66(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ jsx66(Bell, { className: "h-5 w-5 text-[#1C1B1F] dark:text-gray-400" }) }),
|
|
5292
|
-
badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */ jsx66("span", { className: "absolute -top-1 -right-1 flex h-4 w-4 items-center justify-center rounded-full bg-red-500 text-[10px] text-white leading-8", children: badgeCount }) : /* @__PURE__ */ jsx66("span", { className: "absolute -top-1 -right-1 flex h-2 w-2 items-center justify-center rounded-full bg-red-500" })
|
|
5330
|
+
(isDesktop || isTablet) && /* @__PURE__ */ jsx66(RenderSearchInput, {}),
|
|
5331
|
+
/* @__PURE__ */ jsxs40("div", { className: "relative bg-gray-200 dark:bg-gray-700 rounded-md", children: [
|
|
5332
|
+
/* @__PURE__ */ jsx66(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ jsx66(Bell, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }) }),
|
|
5333
|
+
badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */ jsx66("span", { className: "absolute -top-1 -right-1 h-4 w-4 flex items-center justify-center bg-red-500 rounded-full text-white text-[10px]", children: badgeCount }) : !hideBadgeWhenZero && /* @__PURE__ */ jsx66("span", { className: "absolute -top-1 -right-1 h-2 w-2 bg-red-500 rounded-full" })
|
|
5293
5334
|
] }),
|
|
5294
5335
|
/* @__PURE__ */ jsxs40(DropdownMenu, { children: [
|
|
5295
|
-
/* @__PURE__ */ jsx66(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs40("div", { className: "flex items-center space-x-2", children: [
|
|
5296
|
-
!
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
AvatarImage,
|
|
5300
|
-
{
|
|
5301
|
-
src: "/images/appbuilder/toolset/profile.svg",
|
|
5302
|
-
alt: "Profile"
|
|
5303
|
-
}
|
|
5304
|
-
) : /* @__PURE__ */ jsx66("div", { className: "w-8 h-8 bg-[#12715b] rounded-full text-[#fff] text-center text-[11px] flex items-center justify-center", children: userName && getInitials(userName) }) }),
|
|
5305
|
-
/* @__PURE__ */ jsx66(
|
|
5306
|
-
Button,
|
|
5307
|
-
{
|
|
5308
|
-
variant: "ghost",
|
|
5309
|
-
size: "icon",
|
|
5310
|
-
className: "text-gray-900 md:hidden dark:invert",
|
|
5311
|
-
children: /* @__PURE__ */ jsx66(Menu2, { className: "h-6 w-6" })
|
|
5312
|
-
}
|
|
5313
|
-
)
|
|
5314
|
-
] }) : /* @__PURE__ */ jsx66(Button, { variant: "ghost", size: "icon", className: "text-gray-900 dark:invert", children: /* @__PURE__ */ jsx66(Menu2, { className: "h-6 w-6" }) })
|
|
5336
|
+
/* @__PURE__ */ jsx66(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs40("div", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
5337
|
+
!isMobile && showName && /* @__PURE__ */ jsx66("h4", { className: "text-gray-900 dark:text-gray-300 text-sm", children: userName }),
|
|
5338
|
+
/* @__PURE__ */ jsx66(Avatar, { className: "h-8 w-8", children: profileType === "avatar" ? /* @__PURE__ */ jsx66(AvatarImage, { src: "/images/appbuilder/toolset/profile.svg", alt: "profile" }) : /* @__PURE__ */ jsx66("div", { className: "bg-green-700 text-white h-full w-full rounded-full flex items-center justify-center text-xs", children: getInitials(userName) }) }),
|
|
5339
|
+
(isMobile || isTablet) && /* @__PURE__ */ jsx66(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ jsx66(Menu2, { className: "h-6 w-6" }) })
|
|
5315
5340
|
] }) }),
|
|
5316
5341
|
/* @__PURE__ */ jsxs40(DropdownMenuContent, { align: "end", className: "bg-white dark:bg-gray-800", children: [
|
|
5317
|
-
profileMenu
|
|
5318
|
-
|
|
5319
|
-
{
|
|
5320
|
-
href: item.url || "#",
|
|
5321
|
-
onClick: (e) => handleBuilderExit(e, item.url),
|
|
5322
|
-
children: item.header
|
|
5323
|
-
}
|
|
5324
|
-
) }, item.id)) }),
|
|
5325
|
-
/* @__PURE__ */ jsxs40("div", { className: "md:hidden", children: [
|
|
5342
|
+
profileMenu.map((item) => /* @__PURE__ */ jsx66(DropdownMenuItem, { children: /* @__PURE__ */ jsx66(Link4, { href: item.url, onClick: (e) => handleBuilderExit(e, item.url), children: item.header }) }, item.id)),
|
|
5343
|
+
(isMobile || isTablet) && /* @__PURE__ */ jsxs40(Fragment23, { children: [
|
|
5326
5344
|
/* @__PURE__ */ jsx66(DropdownMenuSeparator, {}),
|
|
5327
|
-
|
|
5328
|
-
Link4,
|
|
5329
|
-
{
|
|
5330
|
-
href: item.url || "#",
|
|
5331
|
-
onClick: (e) => handleBuilderExit(e, item.url),
|
|
5332
|
-
children: item.header
|
|
5333
|
-
}
|
|
5334
|
-
) }, item.id)) })
|
|
5345
|
+
formattedMenu.map((item) => /* @__PURE__ */ jsx66(DropdownMenuItem, { children: /* @__PURE__ */ jsx66(Link4, { href: item.url, onClick: (e) => handleBuilderExit(e, item.url), children: item.header }) }, item.id))
|
|
5335
5346
|
] })
|
|
5336
5347
|
] })
|
|
5337
5348
|
] })
|
|
@@ -5339,21 +5350,12 @@ function Navbar({
|
|
|
5339
5350
|
] })
|
|
5340
5351
|
}
|
|
5341
5352
|
),
|
|
5342
|
-
/* @__PURE__ */ jsx66(
|
|
5343
|
-
/* @__PURE__ */ jsxs40(DialogHeader, { children: [
|
|
5344
|
-
/* @__PURE__ */ jsx66(DialogTitle, { children: "Exit Builder?" }),
|
|
5345
|
-
/* @__PURE__ */ jsx66(DialogDescription, { children: "You are about to leave the builder. Any unsaved changes may be lost." })
|
|
5346
|
-
] }),
|
|
5347
|
-
/* @__PURE__ */ jsxs40(DialogFooter, { children: [
|
|
5348
|
-
/* @__PURE__ */ jsx66(Button, { className: "cursor-pointer bg-[#12715b] text-[#fff]", variant: "outline", onClick: () => setShowExitDialog(false), children: "Cancel" }),
|
|
5349
|
-
/* @__PURE__ */ jsx66(Button, { className: "cursor-pointer border-[#12715b] border", onClick: confirmExit, children: "Yes, Exit" })
|
|
5350
|
-
] })
|
|
5351
|
-
] }) })
|
|
5353
|
+
isMobile && /* @__PURE__ */ jsx66("div", { className: "p-3", children: /* @__PURE__ */ jsx66(RenderSearchInput, {}) })
|
|
5352
5354
|
] });
|
|
5353
5355
|
}
|
|
5354
5356
|
|
|
5355
5357
|
// src/components/Chart/BarChart.tsx
|
|
5356
|
-
import React13, { useEffect as
|
|
5358
|
+
import React13, { useEffect as useEffect27, useMemo as useMemo10, useState as useState15, useCallback as useCallback5 } from "react";
|
|
5357
5359
|
import axios3 from "axios";
|
|
5358
5360
|
import {
|
|
5359
5361
|
BarChart,
|
|
@@ -5431,7 +5433,7 @@ var ChartComponent = ({
|
|
|
5431
5433
|
const [currentPage, setCurrentPage] = useState15(1);
|
|
5432
5434
|
const effectiveData = apiUrl ? rawData : props.data || [];
|
|
5433
5435
|
const effectiveLoading = apiUrl ? localLoading : externalLoading;
|
|
5434
|
-
|
|
5436
|
+
useEffect27(() => {
|
|
5435
5437
|
if (apiUrl) {
|
|
5436
5438
|
setCurrentPage(1);
|
|
5437
5439
|
}
|
|
@@ -5473,7 +5475,7 @@ var ChartComponent = ({
|
|
|
5473
5475
|
if (!cancelled) setLocalLoading(false);
|
|
5474
5476
|
}
|
|
5475
5477
|
}, [apiUrl, limit]);
|
|
5476
|
-
|
|
5478
|
+
useEffect27(() => {
|
|
5477
5479
|
if (!apiUrl) return;
|
|
5478
5480
|
fetchData(currentPage);
|
|
5479
5481
|
}, [apiUrl, currentPage, fetchData]);
|
|
@@ -5672,7 +5674,7 @@ var ChartComponent = ({
|
|
|
5672
5674
|
var BarChart_default = React13.memo(ChartComponent);
|
|
5673
5675
|
|
|
5674
5676
|
// src/components/Chart/PieChart.tsx
|
|
5675
|
-
import React14, { useEffect as
|
|
5677
|
+
import React14, { useEffect as useEffect28, useMemo as useMemo11, useState as useState16 } from "react";
|
|
5676
5678
|
import axios4 from "axios";
|
|
5677
5679
|
import {
|
|
5678
5680
|
PieChart,
|
|
@@ -5762,7 +5764,7 @@ var DonutChart = ({
|
|
|
5762
5764
|
const [localLoading, setLocalLoading] = useState16(false);
|
|
5763
5765
|
const effectiveData = apiUrl ? rawData : props.data || [];
|
|
5764
5766
|
const effectiveLoading = apiUrl ? localLoading : externalLoading;
|
|
5765
|
-
|
|
5767
|
+
useEffect28(() => {
|
|
5766
5768
|
if (!apiUrl) return;
|
|
5767
5769
|
let cancelled = false;
|
|
5768
5770
|
const fetchData = async () => {
|
|
@@ -5844,7 +5846,7 @@ var DonutChart = ({
|
|
|
5844
5846
|
return { inner: 70, outer: 130 };
|
|
5845
5847
|
};
|
|
5846
5848
|
const [mounted, setMounted] = useState16(false);
|
|
5847
|
-
|
|
5849
|
+
useEffect28(() => {
|
|
5848
5850
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
5849
5851
|
return () => clearTimeout(timeout);
|
|
5850
5852
|
}, []);
|