@algorithm-shift/design-system 1.2.984 → 1.2.986
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 +16 -28
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +121 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +126 -96
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -8,6 +8,7 @@ import { ClassValue } from 'clsx';
|
|
|
8
8
|
interface ModalProps {
|
|
9
9
|
isOpen: boolean | string;
|
|
10
10
|
onModalClose?: () => void;
|
|
11
|
+
onModalOpen?: () => void;
|
|
11
12
|
title: string;
|
|
12
13
|
children: React$1.ReactNode;
|
|
13
14
|
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -15,7 +16,7 @@ interface ModalProps {
|
|
|
15
16
|
className?: string;
|
|
16
17
|
style?: React$1.CSSProperties;
|
|
17
18
|
}
|
|
18
|
-
declare function Modal({ isOpen, onModalClose, title, children, size, showCloseButton, className, style }: ModalProps): react_jsx_runtime.JSX.Element | null;
|
|
19
|
+
declare function Modal({ isOpen, onModalClose, onModalOpen, title, children, size, showCloseButton, className, style }: ModalProps): react_jsx_runtime.JSX.Element | null;
|
|
19
20
|
|
|
20
21
|
interface ElementProps {
|
|
21
22
|
children?: React.ReactNode;
|
|
@@ -234,6 +235,7 @@ interface NavbarProps extends ElementProps {
|
|
|
234
235
|
isBuilder?: boolean;
|
|
235
236
|
source?: string;
|
|
236
237
|
navList?: Record<string, any>;
|
|
238
|
+
onSearch?: (search: { searchTerm: string }) => void;
|
|
237
239
|
}
|
|
238
240
|
|
|
239
241
|
interface BreadcrumbProps extends ElementProps {
|
|
@@ -243,6 +245,8 @@ interface BreadcrumbProps extends ElementProps {
|
|
|
243
245
|
interface ButtonGroupProps extends ElementProps {
|
|
244
246
|
textContent?: string;
|
|
245
247
|
list?: Record<string, any>;
|
|
248
|
+
onGroupItemClick?: (data: { item: Record<string, any>}) => void;
|
|
249
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
246
250
|
}
|
|
247
251
|
interface AccordionProps extends ElementProps {
|
|
248
252
|
name?: string;
|
|
@@ -311,7 +315,7 @@ declare const Typography: ({ className, style, tagName, textContent, }: Typograp
|
|
|
311
315
|
|
|
312
316
|
declare const Breadcrumb: ({ list, className, style }: BreadcrumbProps) => react_jsx_runtime.JSX.Element;
|
|
313
317
|
|
|
314
|
-
declare function
|
|
318
|
+
declare function ButtonGroup({ style, textContent, className, list, onGroupItemClick, onClick }: ButtonGroupProps): react_jsx_runtime.JSX.Element;
|
|
315
319
|
|
|
316
320
|
type IconSet = 'fa-css' | 'fa' | 'fontawesome' | 'lucide';
|
|
317
321
|
type FAPrefix = 'fas' | 'far' | 'fab' | string;
|
|
@@ -449,7 +453,8 @@ declare const StagesComponent: ({ stages, isShowBtn, buttonText, className, styl
|
|
|
449
453
|
|
|
450
454
|
declare const Spacer: ({ className, style }: ElementProps) => react_jsx_runtime.JSX.Element;
|
|
451
455
|
|
|
452
|
-
declare function Navbar({ style, badgeType, badgeCount, hideBadgeWhenZero, profileType, showName, imageUrl, altText, canvasMode,
|
|
456
|
+
declare function Navbar({ style, badgeType, badgeCount, hideBadgeWhenZero, profileType, showName, imageUrl, altText, canvasMode, // desktop | mobile | tablet
|
|
457
|
+
list, profileMenu, userName, isBuilder, source, navList, onSearch }: NavbarProps): react_jsx_runtime.JSX.Element;
|
|
453
458
|
|
|
454
459
|
declare const _default$1: React$1.MemoExoticComponent<({ className, style, loading: externalLoading, dataKey, dataLabel, apiUrl, isPaginationEnabled, limit, canvasMode, ...props }: BarChartProps) => react_jsx_runtime.JSX.Element>;
|
|
455
460
|
|
|
@@ -473,4 +478,4 @@ declare const Toaster: ({ ...props }: ToasterProps) => react_jsx_runtime.JSX.Ele
|
|
|
473
478
|
declare function cn(...inputs: ClassValue[]): string;
|
|
474
479
|
declare function getInitials(name: string): string;
|
|
475
480
|
|
|
476
|
-
export { Accordion, AccordionGroup, _default$1 as BarChart, Breadcrumb, ButtonWrapper as Button,
|
|
481
|
+
export { Accordion, AccordionGroup, _default$1 as BarChart, Breadcrumb, ButtonWrapper as Button, ButtonGroup, CheckboxInput as Checkbox, Container, DateTimePicker as DatePicker, DateRange, Dropdown, EmailInput as Email, EmailComposer, FileInput, Flex as FlexLayout, Grid as GridLayout, HistoryTimeline, Icon, ImageControl as Image, Modal, MultiCheckbox, LazyMultiSelectDropdown as MultiSelect, Navbar, NumberInput, CustomPagination as Pagination, PasswordInput as Password, PhoneInput as Phone, _default as PieChart, RadioInput as RadioGroup, _default$2 as Repeater, RichText, SearchInput as Search, Shape, Slot, Spacer, StagesComponent as Stages, SwitchToggle, TabGroupComponent as TabGroup, TabList, Table, Tabs, TextInput as Text, TextInputGroup, Textarea, Toaster, Typography, UrlInput as URL, cn, getInitials, showSonnerToast };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { ClassValue } from 'clsx';
|
|
|
8
8
|
interface ModalProps {
|
|
9
9
|
isOpen: boolean | string;
|
|
10
10
|
onModalClose?: () => void;
|
|
11
|
+
onModalOpen?: () => void;
|
|
11
12
|
title: string;
|
|
12
13
|
children: React$1.ReactNode;
|
|
13
14
|
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
@@ -15,7 +16,7 @@ interface ModalProps {
|
|
|
15
16
|
className?: string;
|
|
16
17
|
style?: React$1.CSSProperties;
|
|
17
18
|
}
|
|
18
|
-
declare function Modal({ isOpen, onModalClose, title, children, size, showCloseButton, className, style }: ModalProps): react_jsx_runtime.JSX.Element | null;
|
|
19
|
+
declare function Modal({ isOpen, onModalClose, onModalOpen, title, children, size, showCloseButton, className, style }: ModalProps): react_jsx_runtime.JSX.Element | null;
|
|
19
20
|
|
|
20
21
|
interface ElementProps {
|
|
21
22
|
children?: React.ReactNode;
|
|
@@ -234,6 +235,7 @@ interface NavbarProps extends ElementProps {
|
|
|
234
235
|
isBuilder?: boolean;
|
|
235
236
|
source?: string;
|
|
236
237
|
navList?: Record<string, any>;
|
|
238
|
+
onSearch?: (search: { searchTerm: string }) => void;
|
|
237
239
|
}
|
|
238
240
|
|
|
239
241
|
interface BreadcrumbProps extends ElementProps {
|
|
@@ -243,6 +245,8 @@ interface BreadcrumbProps extends ElementProps {
|
|
|
243
245
|
interface ButtonGroupProps extends ElementProps {
|
|
244
246
|
textContent?: string;
|
|
245
247
|
list?: Record<string, any>;
|
|
248
|
+
onGroupItemClick?: (data: { item: Record<string, any>}) => void;
|
|
249
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
246
250
|
}
|
|
247
251
|
interface AccordionProps extends ElementProps {
|
|
248
252
|
name?: string;
|
|
@@ -311,7 +315,7 @@ declare const Typography: ({ className, style, tagName, textContent, }: Typograp
|
|
|
311
315
|
|
|
312
316
|
declare const Breadcrumb: ({ list, className, style }: BreadcrumbProps) => react_jsx_runtime.JSX.Element;
|
|
313
317
|
|
|
314
|
-
declare function
|
|
318
|
+
declare function ButtonGroup({ style, textContent, className, list, onGroupItemClick, onClick }: ButtonGroupProps): react_jsx_runtime.JSX.Element;
|
|
315
319
|
|
|
316
320
|
type IconSet = 'fa-css' | 'fa' | 'fontawesome' | 'lucide';
|
|
317
321
|
type FAPrefix = 'fas' | 'far' | 'fab' | string;
|
|
@@ -449,7 +453,8 @@ declare const StagesComponent: ({ stages, isShowBtn, buttonText, className, styl
|
|
|
449
453
|
|
|
450
454
|
declare const Spacer: ({ className, style }: ElementProps) => react_jsx_runtime.JSX.Element;
|
|
451
455
|
|
|
452
|
-
declare function Navbar({ style, badgeType, badgeCount, hideBadgeWhenZero, profileType, showName, imageUrl, altText, canvasMode,
|
|
456
|
+
declare function Navbar({ style, badgeType, badgeCount, hideBadgeWhenZero, profileType, showName, imageUrl, altText, canvasMode, // desktop | mobile | tablet
|
|
457
|
+
list, profileMenu, userName, isBuilder, source, navList, onSearch }: NavbarProps): react_jsx_runtime.JSX.Element;
|
|
453
458
|
|
|
454
459
|
declare const _default$1: React$1.MemoExoticComponent<({ className, style, loading: externalLoading, dataKey, dataLabel, apiUrl, isPaginationEnabled, limit, canvasMode, ...props }: BarChartProps) => react_jsx_runtime.JSX.Element>;
|
|
455
460
|
|
|
@@ -473,4 +478,4 @@ declare const Toaster: ({ ...props }: ToasterProps) => react_jsx_runtime.JSX.Ele
|
|
|
473
478
|
declare function cn(...inputs: ClassValue[]): string;
|
|
474
479
|
declare function getInitials(name: string): string;
|
|
475
480
|
|
|
476
|
-
export { Accordion, AccordionGroup, _default$1 as BarChart, Breadcrumb, ButtonWrapper as Button,
|
|
481
|
+
export { Accordion, AccordionGroup, _default$1 as BarChart, Breadcrumb, ButtonWrapper as Button, ButtonGroup, CheckboxInput as Checkbox, Container, DateTimePicker as DatePicker, DateRange, Dropdown, EmailInput as Email, EmailComposer, FileInput, Flex as FlexLayout, Grid as GridLayout, HistoryTimeline, Icon, ImageControl as Image, Modal, MultiCheckbox, LazyMultiSelectDropdown as MultiSelect, Navbar, NumberInput, CustomPagination as Pagination, PasswordInput as Password, PhoneInput as Phone, _default as PieChart, RadioInput as RadioGroup, _default$2 as Repeater, RichText, SearchInput as Search, Shape, Slot, Spacer, StagesComponent as Stages, SwitchToggle, TabGroupComponent as TabGroup, TabList, Table, Tabs, TextInput as Text, TextInputGroup, Textarea, Toaster, Typography, UrlInput as URL, cn, getInitials, showSonnerToast };
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ __export(src_exports, {
|
|
|
36
36
|
BarChart: () => BarChart_default,
|
|
37
37
|
Breadcrumb: () => Breadcrumb_default,
|
|
38
38
|
Button: () => Button_default,
|
|
39
|
-
ButtonGroup: () =>
|
|
39
|
+
ButtonGroup: () => ButtonGroup,
|
|
40
40
|
Checkbox: () => Checkbox_default,
|
|
41
41
|
Container: () => Container_default,
|
|
42
42
|
DatePicker: () => DateTimePicker,
|
|
@@ -119,6 +119,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
119
119
|
function Modal({
|
|
120
120
|
isOpen,
|
|
121
121
|
onModalClose,
|
|
122
|
+
onModalOpen,
|
|
122
123
|
title,
|
|
123
124
|
children,
|
|
124
125
|
size = "md",
|
|
@@ -126,6 +127,11 @@ function Modal({
|
|
|
126
127
|
className = "",
|
|
127
128
|
style = {}
|
|
128
129
|
}) {
|
|
130
|
+
(0, import_react.useEffect)(() => {
|
|
131
|
+
if (isOpen && onModalOpen) {
|
|
132
|
+
onModalOpen();
|
|
133
|
+
}
|
|
134
|
+
}, [isOpen]);
|
|
129
135
|
(0, import_react.useEffect)(() => {
|
|
130
136
|
const handleEscape = (e) => {
|
|
131
137
|
if (e.key === "Escape") {
|
|
@@ -647,6 +653,7 @@ var Breadcrumb_default = Breadcrumb;
|
|
|
647
653
|
|
|
648
654
|
// src/components/Basic/ButtonGroup/ButtonGroup.tsx
|
|
649
655
|
var import_lucide_react3 = require("lucide-react");
|
|
656
|
+
var import_link2 = __toESM(require("next/link"));
|
|
650
657
|
|
|
651
658
|
// src/components/ui/dropdown-menu.tsx
|
|
652
659
|
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"));
|
|
@@ -706,6 +713,19 @@ function DropdownMenuItem({
|
|
|
706
713
|
}
|
|
707
714
|
);
|
|
708
715
|
}
|
|
716
|
+
function DropdownMenuSeparator({
|
|
717
|
+
className,
|
|
718
|
+
...props
|
|
719
|
+
}) {
|
|
720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
721
|
+
DropdownMenuPrimitive.Separator,
|
|
722
|
+
{
|
|
723
|
+
"data-slot": "dropdown-menu-separator",
|
|
724
|
+
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
725
|
+
...props
|
|
726
|
+
}
|
|
727
|
+
);
|
|
728
|
+
}
|
|
709
729
|
function DropdownMenuSub({
|
|
710
730
|
...props
|
|
711
731
|
}) {
|
|
@@ -752,9 +772,9 @@ function DropdownMenuSubContent({
|
|
|
752
772
|
}
|
|
753
773
|
|
|
754
774
|
// src/components/Basic/ButtonGroup/ButtonGroup.tsx
|
|
755
|
-
var import_link2 = __toESM(require("next/link"));
|
|
756
775
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
757
|
-
function
|
|
776
|
+
function ButtonGroup({ style, textContent, className, list = [], onGroupItemClick, onClick }) {
|
|
777
|
+
const data = Array.isArray(list) ? list : [];
|
|
758
778
|
const bgColor = style?.backgroundColor || "";
|
|
759
779
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "inline-flex rounded-md overflow-hidden border border-teal-200 bg-teal-700 items-center focus:ring-0", style: { backgroundColor: bgColor }, children: [
|
|
760
780
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
@@ -762,6 +782,7 @@ function SplitButton({ style, textContent, className, list = [] }) {
|
|
|
762
782
|
{
|
|
763
783
|
className: `rounded-none border-r px-4 py-2 text-whit focus:ring-0 ${className || ""}`,
|
|
764
784
|
style: { backgroundColor: bgColor },
|
|
785
|
+
onClick: (e) => onClick?.(e),
|
|
765
786
|
children: textContent || "Button"
|
|
766
787
|
}
|
|
767
788
|
),
|
|
@@ -775,7 +796,24 @@ function SplitButton({ style, textContent, className, list = [] }) {
|
|
|
775
796
|
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react3.ChevronDown, { className: "w-4 h-4" })
|
|
776
797
|
}
|
|
777
798
|
) }),
|
|
778
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
799
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
800
|
+
DropdownMenuContent,
|
|
801
|
+
{
|
|
802
|
+
align: "end",
|
|
803
|
+
className: "bg-white min-w-[120px]",
|
|
804
|
+
children: data.map((item) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
805
|
+
DropdownMenuItem,
|
|
806
|
+
{
|
|
807
|
+
className: "text-black",
|
|
808
|
+
onSelect: () => onGroupItemClick?.({
|
|
809
|
+
item
|
|
810
|
+
}),
|
|
811
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_link2.default, { href: item.url || "#", children: item.header })
|
|
812
|
+
},
|
|
813
|
+
item.id
|
|
814
|
+
))
|
|
815
|
+
}
|
|
816
|
+
)
|
|
779
817
|
] })
|
|
780
818
|
] });
|
|
781
819
|
}
|
|
@@ -1552,6 +1590,7 @@ function MultiCheckbox({
|
|
|
1552
1590
|
{
|
|
1553
1591
|
id: props.name ? `${props.name}-${opt.value}` : opt.value,
|
|
1554
1592
|
className: cn(hasError && "text-red-600"),
|
|
1593
|
+
htmlFor: props.name ? `${props.name}-${opt.value}` : opt.value,
|
|
1555
1594
|
children: opt.label
|
|
1556
1595
|
}
|
|
1557
1596
|
)
|
|
@@ -2167,7 +2206,8 @@ function LazySelectDropdown({
|
|
|
2167
2206
|
onFocus: handleFocus,
|
|
2168
2207
|
onChange: handleSearchChange,
|
|
2169
2208
|
readOnly: !isOpen || readOnly,
|
|
2170
|
-
disabled
|
|
2209
|
+
disabled,
|
|
2210
|
+
autoComplete: "off"
|
|
2171
2211
|
}
|
|
2172
2212
|
),
|
|
2173
2213
|
selectedOption && !disabled && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
@@ -3355,7 +3395,8 @@ function LazyMultiSelectDropdown({
|
|
|
3355
3395
|
value: isOpen ? searchTerm : "",
|
|
3356
3396
|
onChange: handleSearch,
|
|
3357
3397
|
readOnly,
|
|
3358
|
-
disabled
|
|
3398
|
+
disabled,
|
|
3399
|
+
autoComplete: "off"
|
|
3359
3400
|
}
|
|
3360
3401
|
)
|
|
3361
3402
|
]
|
|
@@ -3923,13 +3964,13 @@ function DataTable({
|
|
|
3923
3964
|
const shouldShowLeftDots = leftSiblingIndex > 2;
|
|
3924
3965
|
const shouldShowRightDots = rightSiblingIndex < totalPages - 1;
|
|
3925
3966
|
if (!shouldShowLeftDots && shouldShowRightDots) {
|
|
3926
|
-
return [1, 2, 3, "..."
|
|
3967
|
+
return [1, 2, 3, "..."];
|
|
3927
3968
|
}
|
|
3928
3969
|
if (shouldShowLeftDots && !shouldShowRightDots) {
|
|
3929
3970
|
return [1, "...", totalPages - 2, totalPages - 1, totalPages];
|
|
3930
3971
|
}
|
|
3931
3972
|
if (shouldShowLeftDots && shouldShowRightDots) {
|
|
3932
|
-
return [1, "...", currentPage - 1, currentPage, currentPage + 1, "..."
|
|
3973
|
+
return [1, "...", currentPage - 1, currentPage, currentPage + 1, "..."];
|
|
3933
3974
|
}
|
|
3934
3975
|
return [];
|
|
3935
3976
|
};
|
|
@@ -4135,7 +4176,7 @@ function DataTable({
|
|
|
4135
4176
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
|
|
4136
4177
|
TableCell,
|
|
4137
4178
|
{
|
|
4138
|
-
className:
|
|
4179
|
+
className: `break-words whitespace-normal align-top ${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2`,
|
|
4139
4180
|
style: {
|
|
4140
4181
|
width: cell.column.getSize(),
|
|
4141
4182
|
minWidth: cell.column.columnDef.minSize,
|
|
@@ -5249,7 +5290,11 @@ var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
|
5249
5290
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
5250
5291
|
|
|
5251
5292
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
5293
|
+
var import_react34 = require("react");
|
|
5252
5294
|
var import_lucide_react18 = require("lucide-react");
|
|
5295
|
+
var import_image2 = __toESM(require("next/image"));
|
|
5296
|
+
var import_link4 = __toESM(require("next/link"));
|
|
5297
|
+
var import_navigation3 = require("next/navigation");
|
|
5253
5298
|
|
|
5254
5299
|
// src/components/ui/avatar.tsx
|
|
5255
5300
|
var React12 = __toESM(require("react"));
|
|
@@ -5290,11 +5335,6 @@ var AvatarFallback = React12.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
5290
5335
|
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
5291
5336
|
|
|
5292
5337
|
// src/components/Navigation/Navbar/Navbar.tsx
|
|
5293
|
-
var import_link4 = __toESM(require("next/link"));
|
|
5294
|
-
var import_image2 = __toESM(require("next/image"));
|
|
5295
|
-
var import_navigation3 = require("next/navigation");
|
|
5296
|
-
var import_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
|
|
5297
|
-
var import_react34 = require("react");
|
|
5298
5338
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
5299
5339
|
function Navbar({
|
|
5300
5340
|
style,
|
|
@@ -5306,44 +5346,76 @@ function Navbar({
|
|
|
5306
5346
|
imageUrl,
|
|
5307
5347
|
altText = "Logo",
|
|
5308
5348
|
canvasMode = "desktop",
|
|
5349
|
+
// desktop | mobile | tablet
|
|
5309
5350
|
list = [],
|
|
5310
5351
|
profileMenu = [],
|
|
5311
5352
|
userName = "Guest User",
|
|
5312
5353
|
isBuilder = false,
|
|
5313
5354
|
source,
|
|
5314
|
-
navList
|
|
5355
|
+
navList,
|
|
5356
|
+
onSearch
|
|
5315
5357
|
}) {
|
|
5316
|
-
const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
|
|
5317
5358
|
const router = (0, import_navigation3.useRouter)();
|
|
5318
|
-
const [
|
|
5319
|
-
|
|
5359
|
+
const [screenMode, setScreenMode] = (0, import_react34.useState)(
|
|
5360
|
+
canvasMode
|
|
5361
|
+
);
|
|
5362
|
+
(0, import_react34.useEffect)(() => {
|
|
5363
|
+
const detectMode = () => {
|
|
5364
|
+
if (window.innerWidth < 640) setScreenMode("mobile");
|
|
5365
|
+
else if (window.innerWidth < 1024) setScreenMode("tablet");
|
|
5366
|
+
else setScreenMode("desktop");
|
|
5367
|
+
};
|
|
5368
|
+
detectMode();
|
|
5369
|
+
window.addEventListener("resize", detectMode);
|
|
5370
|
+
return () => window.removeEventListener("resize", detectMode);
|
|
5371
|
+
}, []);
|
|
5372
|
+
const mode = canvasMode || screenMode;
|
|
5373
|
+
const isMobile = mode === "mobile";
|
|
5374
|
+
const isTablet = mode === "tablet";
|
|
5375
|
+
const isDesktop = mode === "desktop";
|
|
5320
5376
|
const handleBuilderExit = (0, import_react34.useCallback)(
|
|
5321
5377
|
(e, url) => {
|
|
5322
5378
|
if (isBuilder) {
|
|
5323
5379
|
e.preventDefault();
|
|
5324
|
-
|
|
5325
|
-
|
|
5380
|
+
showSonnerToast({ variant: "info", title: `You will be redirected to ${url} in the real app.`, duration: 3e3 });
|
|
5381
|
+
} else {
|
|
5382
|
+
router.push(url);
|
|
5326
5383
|
}
|
|
5327
5384
|
},
|
|
5328
5385
|
[isBuilder]
|
|
5329
5386
|
);
|
|
5330
|
-
const
|
|
5331
|
-
if (
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
const formatedMenu = (0, import_react34.useMemo)(() => {
|
|
5337
|
-
if (source === "state" && navList && navList.length) {
|
|
5338
|
-
return navList.map((i) => ({ ...i, header: i.name || "Menu" }));
|
|
5387
|
+
const formattedMenu = (0, import_react34.useMemo)(() => {
|
|
5388
|
+
if (source === "state" && navList?.length) {
|
|
5389
|
+
return navList.map((i) => ({
|
|
5390
|
+
...i,
|
|
5391
|
+
header: i.name || "Menu"
|
|
5392
|
+
}));
|
|
5339
5393
|
}
|
|
5340
|
-
return list
|
|
5341
|
-
}, [source, navList]);
|
|
5394
|
+
return list;
|
|
5395
|
+
}, [source, navList, list]);
|
|
5396
|
+
const RenderSearchInput = () => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "flex-1 px-2", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "relative w-full max-w-md border border-gray-300 rounded-md", children: [
|
|
5397
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_lucide_react18.Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 dark:text-white text-gray-400" }),
|
|
5398
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5399
|
+
Input,
|
|
5400
|
+
{
|
|
5401
|
+
placeholder: "Search",
|
|
5402
|
+
className: "pl-9 text-gray-500",
|
|
5403
|
+
onKeyDown: (event) => {
|
|
5404
|
+
if (event.key === "Enter") {
|
|
5405
|
+
const query = event.target.value;
|
|
5406
|
+
onSearch?.({
|
|
5407
|
+
searchTerm: query
|
|
5408
|
+
});
|
|
5409
|
+
}
|
|
5410
|
+
}
|
|
5411
|
+
}
|
|
5412
|
+
)
|
|
5413
|
+
] }) });
|
|
5342
5414
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
5343
5415
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5344
5416
|
"nav",
|
|
5345
5417
|
{
|
|
5346
|
-
className: "w-full h-[75px] border-b border-
|
|
5418
|
+
className: "w-full min-h-[75px] border-b border-gray-200 dark:border-gray-800 dark:bg-gray-800 bg-white shadow-sm",
|
|
5347
5419
|
style,
|
|
5348
5420
|
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "mx-auto flex max-w-[90%] items-center justify-between px-4 py-4", children: [
|
|
5349
5421
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
@@ -5352,69 +5424,36 @@ function Navbar({
|
|
|
5352
5424
|
href: "/",
|
|
5353
5425
|
onClick: (e) => handleBuilderExit(e, "/"),
|
|
5354
5426
|
className: "flex items-center space-x-2",
|
|
5355
|
-
children: imageUrl ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_image2.default, { src: imageUrl, alt: altText, width:
|
|
5427
|
+
children: imageUrl ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_image2.default, { src: imageUrl, alt: altText, width: 180, height: 40 }) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "font-semibold text-blue-700", children: "Logo" })
|
|
5356
5428
|
}
|
|
5357
5429
|
),
|
|
5358
|
-
|
|
5430
|
+
isDesktop && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "hidden md:flex items-center space-x-6", children: formattedMenu.map((item) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5359
5431
|
import_link4.default,
|
|
5360
5432
|
{
|
|
5361
|
-
href: item.url
|
|
5433
|
+
href: item.url,
|
|
5362
5434
|
onClick: (e) => handleBuilderExit(e, item.url),
|
|
5363
|
-
className: "text-sm font-medium dark:text-white
|
|
5435
|
+
className: "text-sm font-medium text-gray-600 dark:text-white hover:text-gray-900",
|
|
5364
5436
|
children: item.header
|
|
5365
5437
|
},
|
|
5366
5438
|
item.id
|
|
5367
5439
|
)) }),
|
|
5368
5440
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center space-x-3", children: [
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5372
|
-
|
|
5373
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "relative bg-[#E9E9E9] dark:bg-gray-700 rounded-md", children: [
|
|
5374
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_lucide_react18.Bell, { className: "h-5 w-5 text-[#1C1B1F] dark:text-gray-400" }) }),
|
|
5375
|
-
badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("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__ */ (0, import_jsx_runtime66.jsx)("span", { className: "absolute -top-1 -right-1 flex h-2 w-2 items-center justify-center rounded-full bg-red-500" })
|
|
5441
|
+
(isDesktop || isTablet) && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(RenderSearchInput, {}),
|
|
5442
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "relative bg-gray-200 dark:bg-gray-700 rounded-md", children: [
|
|
5443
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_lucide_react18.Bell, { className: "h-5 w-5 text-gray-700 dark:text-gray-300" }) }),
|
|
5444
|
+
badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("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__ */ (0, import_jsx_runtime66.jsx)("span", { className: "absolute -top-1 -right-1 h-2 w-2 bg-red-500 rounded-full" })
|
|
5376
5445
|
] }),
|
|
5377
5446
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(DropdownMenu, { children: [
|
|
5378
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center space-x-2", children: [
|
|
5379
|
-
!
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
AvatarImage,
|
|
5383
|
-
{
|
|
5384
|
-
src: "/images/appbuilder/toolset/profile.svg",
|
|
5385
|
-
alt: "Profile"
|
|
5386
|
-
}
|
|
5387
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("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) }) }),
|
|
5388
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5389
|
-
Button,
|
|
5390
|
-
{
|
|
5391
|
-
variant: "ghost",
|
|
5392
|
-
size: "icon",
|
|
5393
|
-
className: "text-gray-900 md:hidden dark:invert",
|
|
5394
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_lucide_react18.Menu, { className: "h-6 w-6" })
|
|
5395
|
-
}
|
|
5396
|
-
)
|
|
5397
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Button, { variant: "ghost", size: "icon", className: "text-gray-900 dark:invert", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_lucide_react18.Menu, { className: "h-6 w-6" }) })
|
|
5447
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center space-x-2 cursor-pointer", children: [
|
|
5448
|
+
!isMobile && showName && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h4", { className: "text-gray-900 dark:text-gray-300 text-sm", children: userName }),
|
|
5449
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Avatar, { className: "h-8 w-8", children: profileType === "avatar" ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(AvatarImage, { src: "/images/appbuilder/toolset/profile.svg", alt: "profile" }) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "bg-green-700 text-white h-full w-full rounded-full flex items-center justify-center text-xs", children: getInitials(userName) }) }),
|
|
5450
|
+
(isMobile || isTablet) && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_lucide_react18.Menu, { className: "h-6 w-6" }) })
|
|
5398
5451
|
] }) }),
|
|
5399
5452
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(DropdownMenuContent, { align: "end", className: "bg-white dark:bg-gray-800", children: [
|
|
5400
|
-
profileMenu
|
|
5401
|
-
|
|
5402
|
-
{
|
|
5403
|
-
|
|
5404
|
-
onClick: (e) => handleBuilderExit(e, item.url),
|
|
5405
|
-
children: item.header
|
|
5406
|
-
}
|
|
5407
|
-
) }, item.id)) }),
|
|
5408
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "md:hidden", children: [
|
|
5409
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_react_dropdown_menu.DropdownMenuSeparator, {}),
|
|
5410
|
-
formatedMenu && formatedMenu.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_jsx_runtime66.Fragment, { children: formatedMenu.map((item) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DropdownMenuItem, { className: "text-black dark:invert", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5411
|
-
import_link4.default,
|
|
5412
|
-
{
|
|
5413
|
-
href: item.url || "#",
|
|
5414
|
-
onClick: (e) => handleBuilderExit(e, item.url),
|
|
5415
|
-
children: item.header
|
|
5416
|
-
}
|
|
5417
|
-
) }, item.id)) })
|
|
5453
|
+
profileMenu.map((item) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DropdownMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_link4.default, { href: item.url, onClick: (e) => handleBuilderExit(e, item.url), children: item.header }) }, item.id)),
|
|
5454
|
+
(isMobile || isTablet) && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
5455
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DropdownMenuSeparator, {}),
|
|
5456
|
+
formattedMenu.map((item) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DropdownMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_link4.default, { href: item.url, onClick: (e) => handleBuilderExit(e, item.url), children: item.header }) }, item.id))
|
|
5418
5457
|
] })
|
|
5419
5458
|
] })
|
|
5420
5459
|
] })
|
|
@@ -5422,16 +5461,7 @@ function Navbar({
|
|
|
5422
5461
|
] })
|
|
5423
5462
|
}
|
|
5424
5463
|
),
|
|
5425
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
5426
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(DialogHeader, { children: [
|
|
5427
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DialogTitle, { children: "Exit Builder?" }),
|
|
5428
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DialogDescription, { children: "You are about to leave the builder. Any unsaved changes may be lost." })
|
|
5429
|
-
] }),
|
|
5430
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(DialogFooter, { children: [
|
|
5431
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Button, { className: "cursor-pointer bg-[#12715b] text-[#fff]", variant: "outline", onClick: () => setShowExitDialog(false), children: "Cancel" }),
|
|
5432
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Button, { className: "cursor-pointer border-[#12715b] border", onClick: confirmExit, children: "Yes, Exit" })
|
|
5433
|
-
] })
|
|
5434
|
-
] }) })
|
|
5464
|
+
isMobile && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(RenderSearchInput, {}) })
|
|
5435
5465
|
] });
|
|
5436
5466
|
}
|
|
5437
5467
|
|