@algorithm-shift/design-system 1.2.953 → 1.2.954
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/client.js +11 -3
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +11 -3
- package/dist/client.mjs.map +1 -1
- package/dist/index.css +3 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +119 -85
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +119 -85
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -28068,17 +28068,32 @@ import { useEffect as useEffect17 } from "react";
|
|
|
28068
28068
|
import { PhoneInput as PhoneInputField } from "react-international-phone";
|
|
28069
28069
|
import "react-international-phone/style.css";
|
|
28070
28070
|
import { Fragment as Fragment14, jsx as jsx40, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
28071
|
+
var ensureIndiaCode = (val) => {
|
|
28072
|
+
if (!val) return "";
|
|
28073
|
+
const trimmed = val.trim();
|
|
28074
|
+
if (trimmed.startsWith("+")) return trimmed;
|
|
28075
|
+
const local = trimmed.replace(/^0+/, "");
|
|
28076
|
+
return `+91${local}`;
|
|
28077
|
+
};
|
|
28071
28078
|
var PhoneInput = ({ className, style, ...props }) => {
|
|
28072
28079
|
const placeholder = props.placeholder ?? "Enter phone number";
|
|
28073
28080
|
const isEditable = props.isEditable ?? true;
|
|
28074
28081
|
const isDisabled = props.isDisabled ?? false;
|
|
28075
28082
|
useEffect17(() => {
|
|
28076
28083
|
if (props.value !== void 0) {
|
|
28077
|
-
|
|
28084
|
+
const normalized = ensureIndiaCode(props.value);
|
|
28085
|
+
handleChange?.(normalized);
|
|
28078
28086
|
}
|
|
28079
28087
|
}, []);
|
|
28080
28088
|
const handleChange = (val) => {
|
|
28081
|
-
|
|
28089
|
+
const normalized = ensureIndiaCode(val);
|
|
28090
|
+
const event = {
|
|
28091
|
+
target: {
|
|
28092
|
+
name: props.name || "",
|
|
28093
|
+
value: normalized
|
|
28094
|
+
}
|
|
28095
|
+
};
|
|
28096
|
+
props.onChange?.(event, props.name || "");
|
|
28082
28097
|
};
|
|
28083
28098
|
return /* @__PURE__ */ jsxs21(Fragment14, { children: [
|
|
28084
28099
|
/* @__PURE__ */ jsx40(
|
|
@@ -28086,7 +28101,7 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
28086
28101
|
{
|
|
28087
28102
|
defaultCountry: "in",
|
|
28088
28103
|
name: props.name,
|
|
28089
|
-
value: props.value
|
|
28104
|
+
value: props.value ? ensureIndiaCode(props.value) : "",
|
|
28090
28105
|
className: cn(
|
|
28091
28106
|
"rounded-md border-1",
|
|
28092
28107
|
className,
|
|
@@ -28096,7 +28111,7 @@ var PhoneInput = ({ className, style, ...props }) => {
|
|
|
28096
28111
|
...style,
|
|
28097
28112
|
borderColor: props.errorMessage ? "#f87171" : style?.borderColor
|
|
28098
28113
|
},
|
|
28099
|
-
onChange:
|
|
28114
|
+
onChange: handleChange,
|
|
28100
28115
|
inputProps: {
|
|
28101
28116
|
id: "phone-field",
|
|
28102
28117
|
style: { width: "100%", border: "none", outline: "none" }
|
|
@@ -29324,9 +29339,10 @@ function DataTable({
|
|
|
29324
29339
|
const [columnVisibility, setColumnVisibility] = React10.useState({});
|
|
29325
29340
|
const [manualSort, setManualSort] = React10.useState(null);
|
|
29326
29341
|
const [searchTerm, setSearchTerm] = React10.useState("");
|
|
29342
|
+
const tableData = Array.isArray(data) ? data : [];
|
|
29327
29343
|
const dynamicCols = useDynamicColumns({ columns });
|
|
29328
29344
|
const table = useReactTable({
|
|
29329
|
-
data:
|
|
29345
|
+
data: tableData,
|
|
29330
29346
|
columns: dynamicCols,
|
|
29331
29347
|
state: {
|
|
29332
29348
|
columnFilters,
|
|
@@ -29372,6 +29388,7 @@ function DataTable({
|
|
|
29372
29388
|
}
|
|
29373
29389
|
return [];
|
|
29374
29390
|
};
|
|
29391
|
+
const pageCount = table.getPageCount() === 0 ? 1 : table.getPageCount();
|
|
29375
29392
|
return /* @__PURE__ */ jsxs31("div", { className: "overflow-hidden rounded-md w-full", children: [
|
|
29376
29393
|
/* @__PURE__ */ jsxs31("div", { className: `flex ${globalSearch ? "justify-between" : "justify-end"} p-2 bg-gray-50`, children: [
|
|
29377
29394
|
globalSearch && /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2 w-full max-w-sm", children: [
|
|
@@ -29449,88 +29466,100 @@ function DataTable({
|
|
|
29449
29466
|
] })
|
|
29450
29467
|
] })
|
|
29451
29468
|
] }),
|
|
29452
|
-
/* @__PURE__ */ jsxs31(Table3, { children: [
|
|
29469
|
+
/* @__PURE__ */ jsxs31(Table3, { className: "table-fixed", children: [
|
|
29453
29470
|
/* @__PURE__ */ jsx53(TableHeader, { children: table.getHeaderGroups().map((hg) => /* @__PURE__ */ jsx53(TableRow, { children: hg.headers.map((header, index) => {
|
|
29454
29471
|
const canSort = header.column.getCanSort();
|
|
29455
29472
|
const canFilter = header.column.getCanFilter();
|
|
29456
29473
|
const sortDir = manualSort?.key === header.column.id ? manualSort.dir : null;
|
|
29457
|
-
return /* @__PURE__ */ jsx53(
|
|
29458
|
-
|
|
29459
|
-
|
|
29460
|
-
|
|
29461
|
-
|
|
29462
|
-
|
|
29463
|
-
|
|
29464
|
-
|
|
29465
|
-
|
|
29466
|
-
|
|
29467
|
-
|
|
29468
|
-
|
|
29469
|
-
|
|
29470
|
-
|
|
29471
|
-
|
|
29472
|
-
|
|
29473
|
-
|
|
29474
|
-
|
|
29475
|
-
|
|
29476
|
-
|
|
29477
|
-
|
|
29478
|
-
|
|
29479
|
-
|
|
29480
|
-
|
|
29481
|
-
|
|
29482
|
-
|
|
29483
|
-
|
|
29484
|
-
|
|
29485
|
-
|
|
29486
|
-
|
|
29487
|
-
|
|
29488
|
-
|
|
29489
|
-
|
|
29490
|
-
|
|
29491
|
-
|
|
29492
|
-
|
|
29493
|
-
|
|
29494
|
-
|
|
29495
|
-
|
|
29496
|
-
|
|
29474
|
+
return /* @__PURE__ */ jsx53(
|
|
29475
|
+
TableHead,
|
|
29476
|
+
{
|
|
29477
|
+
className: "relative select-none",
|
|
29478
|
+
style: {
|
|
29479
|
+
width: header.column.getSize(),
|
|
29480
|
+
minWidth: header.column.columnDef.minSize,
|
|
29481
|
+
maxWidth: header.column.columnDef.maxSize
|
|
29482
|
+
},
|
|
29483
|
+
children: /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between", children: [
|
|
29484
|
+
/* @__PURE__ */ jsxs31(
|
|
29485
|
+
"span",
|
|
29486
|
+
{
|
|
29487
|
+
className: `flex items-center gap-1 ${canSort ? "cursor-pointer" : ""}`,
|
|
29488
|
+
onClick: () => {
|
|
29489
|
+
if (!canSort) return;
|
|
29490
|
+
const newDir = manualSort?.key === header.column.id && manualSort.dir === "asc" ? "desc" : "asc";
|
|
29491
|
+
setManualSort({ key: header.column.id, dir: newDir });
|
|
29492
|
+
onSortChange?.(header.column.id, newDir);
|
|
29493
|
+
},
|
|
29494
|
+
children: [
|
|
29495
|
+
flexRender(header.column.columnDef.header, header.getContext()),
|
|
29496
|
+
canSort && /* @__PURE__ */ jsxs31(Fragment20, { children: [
|
|
29497
|
+
sortDir === "asc" && /* @__PURE__ */ jsx53(ArrowUp, { size: 14, className: "text-gray-500" }),
|
|
29498
|
+
sortDir === "desc" && /* @__PURE__ */ jsx53(ArrowDown, { size: 14, className: "text-gray-500" }),
|
|
29499
|
+
!sortDir && /* @__PURE__ */ jsx53(ArrowUpDown, { size: 14, className: "text-gray-400" })
|
|
29500
|
+
] })
|
|
29501
|
+
]
|
|
29502
|
+
}
|
|
29503
|
+
),
|
|
29504
|
+
canFilter && /* @__PURE__ */ jsxs31(Popover, { children: [
|
|
29505
|
+
/* @__PURE__ */ jsx53(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx53(
|
|
29506
|
+
"span",
|
|
29507
|
+
{
|
|
29508
|
+
role: "presentation",
|
|
29509
|
+
className: "pl-5 cursor-pointer",
|
|
29510
|
+
onClick: (e) => e.stopPropagation(),
|
|
29511
|
+
children: /* @__PURE__ */ jsx53(FontAwesomeIcon3, { icon: faEllipsisH, className: "w-5 h-5 text-gray-500" })
|
|
29512
|
+
}
|
|
29513
|
+
) }),
|
|
29514
|
+
/* @__PURE__ */ jsx53(
|
|
29515
|
+
PopoverContent,
|
|
29497
29516
|
{
|
|
29498
|
-
|
|
29499
|
-
|
|
29500
|
-
|
|
29501
|
-
|
|
29502
|
-
|
|
29503
|
-
|
|
29517
|
+
align: "center",
|
|
29518
|
+
sideOffset: 14,
|
|
29519
|
+
className: "w-50 p-3 z-[200] border-gray-300",
|
|
29520
|
+
avoidCollisions: true,
|
|
29521
|
+
children: /* @__PURE__ */ jsxs31(
|
|
29522
|
+
"form",
|
|
29523
|
+
{
|
|
29524
|
+
onSubmit: (e) => {
|
|
29525
|
+
e.preventDefault();
|
|
29526
|
+
const formData = new FormData(e.currentTarget);
|
|
29527
|
+
const value = formData.get("filter") || "";
|
|
29528
|
+
if (onFilterChange && value) {
|
|
29529
|
+
onFilterChange({ columnKey: header.column.id, columnTerm: value });
|
|
29530
|
+
}
|
|
29531
|
+
},
|
|
29532
|
+
className: "space-y-2",
|
|
29533
|
+
children: [
|
|
29534
|
+
/* @__PURE__ */ jsx53("label", { htmlFor: "filter", className: "text-xs text-gray-500 font-normal", children: "Filter by value:" }),
|
|
29535
|
+
/* @__PURE__ */ jsx53(
|
|
29536
|
+
"input",
|
|
29537
|
+
{
|
|
29538
|
+
name: "filter",
|
|
29539
|
+
placeholder: "Search",
|
|
29540
|
+
defaultValue: header.column.getFilterValue() ?? "",
|
|
29541
|
+
className: "border-gray-300 border-1 block p-3 rounded-md text-xs w-full h-9 focus:ring-0 focus:border-gray-300 focus-visible:ring-0 focus-visible:border-gray-300 focus-visible:outline-none mt-2 font-normal",
|
|
29542
|
+
autoComplete: "off"
|
|
29543
|
+
}
|
|
29544
|
+
),
|
|
29545
|
+
/* @__PURE__ */ jsx53("div", { className: "justify-end flex", children: /* @__PURE__ */ jsx53(
|
|
29546
|
+
Button,
|
|
29547
|
+
{
|
|
29548
|
+
type: "submit",
|
|
29549
|
+
className: "py-2 px-3 bg-[#12715B] text-white text-xs h-auto cursor-pointer",
|
|
29550
|
+
children: "Apply"
|
|
29551
|
+
}
|
|
29552
|
+
) })
|
|
29553
|
+
]
|
|
29504
29554
|
}
|
|
29505
|
-
|
|
29506
|
-
className: "space-y-2",
|
|
29507
|
-
children: [
|
|
29508
|
-
/* @__PURE__ */ jsx53("label", { htmlFor: "filter", className: "text-xs text-gray-500 font-normal", children: "Filter by value:" }),
|
|
29509
|
-
/* @__PURE__ */ jsx53(
|
|
29510
|
-
"input",
|
|
29511
|
-
{
|
|
29512
|
-
name: "filter",
|
|
29513
|
-
placeholder: "Search",
|
|
29514
|
-
defaultValue: header.column.getFilterValue() ?? "",
|
|
29515
|
-
className: "border-gray-300 border-1 block p-3 rounded-md text-xs w-full h-9 focus:ring-0 focus:border-gray-300 focus-visible:ring-0 focus-visible:border-gray-300 focus-visible:outline-none mt-2 font-normal",
|
|
29516
|
-
autoComplete: "off"
|
|
29517
|
-
}
|
|
29518
|
-
),
|
|
29519
|
-
/* @__PURE__ */ jsx53("div", { className: "justify-end flex", children: /* @__PURE__ */ jsx53(
|
|
29520
|
-
Button,
|
|
29521
|
-
{
|
|
29522
|
-
type: "submit",
|
|
29523
|
-
className: "py-2 px-3 bg-[#12715B] text-white text-xs h-auto cursor-pointer",
|
|
29524
|
-
children: "Apply"
|
|
29525
|
-
}
|
|
29526
|
-
) })
|
|
29527
|
-
]
|
|
29555
|
+
)
|
|
29528
29556
|
}
|
|
29529
29557
|
)
|
|
29530
|
-
}
|
|
29531
|
-
)
|
|
29532
|
-
|
|
29533
|
-
|
|
29558
|
+
] })
|
|
29559
|
+
] })
|
|
29560
|
+
},
|
|
29561
|
+
`header-${header.id}-${index}`
|
|
29562
|
+
);
|
|
29534
29563
|
}) }, `header-group-${hg.id}`)) }),
|
|
29535
29564
|
/* @__PURE__ */ jsx53(TableBody, { children: loading ? /* @__PURE__ */ jsx53(Fragment20, { children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ jsx53(TableRow, { children: dynamicCols.map((_2, j) => /* @__PURE__ */ jsx53(TableCell, { className: "p-3", children: /* @__PURE__ */ jsx53("span", { className: "h-4 bg-gray-200 rounded w-3/4 block animate-pulse" }) }, j)) }, i)) }) : table.getRowModel().rows.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx53(TableRow, { children: row.getVisibleCells().map((cell, cellIndex, arr) => {
|
|
29536
29565
|
const meta = cell.column.columnDef.meta || {};
|
|
@@ -29539,8 +29568,13 @@ function DataTable({
|
|
|
29539
29568
|
return /* @__PURE__ */ jsxs31(
|
|
29540
29569
|
TableCell,
|
|
29541
29570
|
{
|
|
29542
|
-
className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative`,
|
|
29543
|
-
style:
|
|
29571
|
+
className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2`,
|
|
29572
|
+
style: {
|
|
29573
|
+
width: cell.column.getSize(),
|
|
29574
|
+
minWidth: cell.column.columnDef.minSize,
|
|
29575
|
+
maxWidth: cell.column.columnDef.maxSize,
|
|
29576
|
+
...meta?.cellStyle ?? {}
|
|
29577
|
+
},
|
|
29544
29578
|
onClick: () => {
|
|
29545
29579
|
if (isClickable && onCellClick) {
|
|
29546
29580
|
onCellClick(cell.row.original, cell.column.id);
|
|
@@ -29579,7 +29613,7 @@ function DataTable({
|
|
|
29579
29613
|
"Page ",
|
|
29580
29614
|
table.getState().pagination.pageIndex + 1,
|
|
29581
29615
|
" of ",
|
|
29582
|
-
|
|
29616
|
+
pageCount
|
|
29583
29617
|
] }),
|
|
29584
29618
|
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2", children: [
|
|
29585
29619
|
/* @__PURE__ */ jsx53(
|
|
@@ -29926,7 +29960,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29926
29960
|
if (source === "manual") return Array.isArray(tabs) ? tabs : [];
|
|
29927
29961
|
return groupMenus(tabs);
|
|
29928
29962
|
}, [tabs, source, parentKey, menuNameKey, menuUrlKey]);
|
|
29929
|
-
const baseClasses = "text-
|
|
29963
|
+
const baseClasses = "text-foreground p-2 text-center rounded-md transition-colors";
|
|
29930
29964
|
const activeClasses = "bg-white/10 text-white";
|
|
29931
29965
|
const hoverClasses = "hover:bg-white/5";
|
|
29932
29966
|
const isActive = (path) => {
|
|
@@ -29996,7 +30030,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29996
30030
|
DropdownMenuItem,
|
|
29997
30031
|
{
|
|
29998
30032
|
asChild: true,
|
|
29999
|
-
className: "cursor-pointer rounded-sm px-3 py-2 text-
|
|
30033
|
+
className: "cursor-pointer rounded-sm px-3 py-2 text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
|
|
30000
30034
|
children: /* @__PURE__ */ jsx57(
|
|
30001
30035
|
Link5,
|
|
30002
30036
|
{
|
|
@@ -30049,7 +30083,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30049
30083
|
DropdownMenuItem,
|
|
30050
30084
|
{
|
|
30051
30085
|
asChild: true,
|
|
30052
|
-
className: "cursor-pointer rounded-sm px-3 py-2 text-
|
|
30086
|
+
className: "cursor-pointer rounded-sm px-3 py-2 text-gray-800 hover:bg-gray-100",
|
|
30053
30087
|
children: /* @__PURE__ */ jsx57(Link5, { href: item.url || "#", onClick: (e) => handleBuilderExit(e, item.url || "#"), children: item.header })
|
|
30054
30088
|
},
|
|
30055
30089
|
item.id || index
|