@algorithm-shift/design-system 1.2.953 → 1.2.955
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 +121 -85
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +121 -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" }
|
|
@@ -29278,6 +29293,8 @@ var useDynamicColumns = (config, customRenderers = {}, customFormatters = {}) =>
|
|
|
29278
29293
|
return sanitizeValue(row[accessorKey]);
|
|
29279
29294
|
};
|
|
29280
29295
|
return columnHelper.accessor(accessorFn, {
|
|
29296
|
+
...col,
|
|
29297
|
+
size: col.size > 0 ? col.size : 180,
|
|
29281
29298
|
id: col.id ?? accessorKey,
|
|
29282
29299
|
header: col.header,
|
|
29283
29300
|
cell: (info) => {
|
|
@@ -29324,9 +29341,10 @@ function DataTable({
|
|
|
29324
29341
|
const [columnVisibility, setColumnVisibility] = React10.useState({});
|
|
29325
29342
|
const [manualSort, setManualSort] = React10.useState(null);
|
|
29326
29343
|
const [searchTerm, setSearchTerm] = React10.useState("");
|
|
29344
|
+
const tableData = Array.isArray(data) ? data : [];
|
|
29327
29345
|
const dynamicCols = useDynamicColumns({ columns });
|
|
29328
29346
|
const table = useReactTable({
|
|
29329
|
-
data:
|
|
29347
|
+
data: tableData,
|
|
29330
29348
|
columns: dynamicCols,
|
|
29331
29349
|
state: {
|
|
29332
29350
|
columnFilters,
|
|
@@ -29372,6 +29390,7 @@ function DataTable({
|
|
|
29372
29390
|
}
|
|
29373
29391
|
return [];
|
|
29374
29392
|
};
|
|
29393
|
+
const pageCount = table.getPageCount() === 0 ? 1 : table.getPageCount();
|
|
29375
29394
|
return /* @__PURE__ */ jsxs31("div", { className: "overflow-hidden rounded-md w-full", children: [
|
|
29376
29395
|
/* @__PURE__ */ jsxs31("div", { className: `flex ${globalSearch ? "justify-between" : "justify-end"} p-2 bg-gray-50`, children: [
|
|
29377
29396
|
globalSearch && /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2 w-full max-w-sm", children: [
|
|
@@ -29449,88 +29468,100 @@ function DataTable({
|
|
|
29449
29468
|
] })
|
|
29450
29469
|
] })
|
|
29451
29470
|
] }),
|
|
29452
|
-
/* @__PURE__ */ jsxs31(Table3, { children: [
|
|
29471
|
+
/* @__PURE__ */ jsxs31(Table3, { className: "table-fixed", children: [
|
|
29453
29472
|
/* @__PURE__ */ jsx53(TableHeader, { children: table.getHeaderGroups().map((hg) => /* @__PURE__ */ jsx53(TableRow, { children: hg.headers.map((header, index) => {
|
|
29454
29473
|
const canSort = header.column.getCanSort();
|
|
29455
29474
|
const canFilter = header.column.getCanFilter();
|
|
29456
29475
|
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
|
-
|
|
29476
|
+
return /* @__PURE__ */ jsx53(
|
|
29477
|
+
TableHead,
|
|
29478
|
+
{
|
|
29479
|
+
className: "relative select-none",
|
|
29480
|
+
style: {
|
|
29481
|
+
width: header.column.getSize(),
|
|
29482
|
+
minWidth: header.column.columnDef.minSize,
|
|
29483
|
+
maxWidth: header.column.columnDef.maxSize
|
|
29484
|
+
},
|
|
29485
|
+
children: /* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-between", children: [
|
|
29486
|
+
/* @__PURE__ */ jsxs31(
|
|
29487
|
+
"span",
|
|
29488
|
+
{
|
|
29489
|
+
className: `flex items-center gap-1 ${canSort ? "cursor-pointer" : ""}`,
|
|
29490
|
+
onClick: () => {
|
|
29491
|
+
if (!canSort) return;
|
|
29492
|
+
const newDir = manualSort?.key === header.column.id && manualSort.dir === "asc" ? "desc" : "asc";
|
|
29493
|
+
setManualSort({ key: header.column.id, dir: newDir });
|
|
29494
|
+
onSortChange?.(header.column.id, newDir);
|
|
29495
|
+
},
|
|
29496
|
+
children: [
|
|
29497
|
+
flexRender(header.column.columnDef.header, header.getContext()),
|
|
29498
|
+
canSort && /* @__PURE__ */ jsxs31(Fragment20, { children: [
|
|
29499
|
+
sortDir === "asc" && /* @__PURE__ */ jsx53(ArrowUp, { size: 14, className: "text-gray-500" }),
|
|
29500
|
+
sortDir === "desc" && /* @__PURE__ */ jsx53(ArrowDown, { size: 14, className: "text-gray-500" }),
|
|
29501
|
+
!sortDir && /* @__PURE__ */ jsx53(ArrowUpDown, { size: 14, className: "text-gray-400" })
|
|
29502
|
+
] })
|
|
29503
|
+
]
|
|
29504
|
+
}
|
|
29505
|
+
),
|
|
29506
|
+
canFilter && /* @__PURE__ */ jsxs31(Popover, { children: [
|
|
29507
|
+
/* @__PURE__ */ jsx53(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx53(
|
|
29508
|
+
"span",
|
|
29509
|
+
{
|
|
29510
|
+
role: "presentation",
|
|
29511
|
+
className: "pl-5 cursor-pointer",
|
|
29512
|
+
onClick: (e) => e.stopPropagation(),
|
|
29513
|
+
children: /* @__PURE__ */ jsx53(FontAwesomeIcon3, { icon: faEllipsisH, className: "w-5 h-5 text-gray-500" })
|
|
29514
|
+
}
|
|
29515
|
+
) }),
|
|
29516
|
+
/* @__PURE__ */ jsx53(
|
|
29517
|
+
PopoverContent,
|
|
29497
29518
|
{
|
|
29498
|
-
|
|
29499
|
-
|
|
29500
|
-
|
|
29501
|
-
|
|
29502
|
-
|
|
29503
|
-
|
|
29519
|
+
align: "center",
|
|
29520
|
+
sideOffset: 14,
|
|
29521
|
+
className: "w-50 p-3 z-[200] border-gray-300",
|
|
29522
|
+
avoidCollisions: true,
|
|
29523
|
+
children: /* @__PURE__ */ jsxs31(
|
|
29524
|
+
"form",
|
|
29525
|
+
{
|
|
29526
|
+
onSubmit: (e) => {
|
|
29527
|
+
e.preventDefault();
|
|
29528
|
+
const formData = new FormData(e.currentTarget);
|
|
29529
|
+
const value = formData.get("filter") || "";
|
|
29530
|
+
if (onFilterChange && value) {
|
|
29531
|
+
onFilterChange({ columnKey: header.column.id, columnTerm: value });
|
|
29532
|
+
}
|
|
29533
|
+
},
|
|
29534
|
+
className: "space-y-2",
|
|
29535
|
+
children: [
|
|
29536
|
+
/* @__PURE__ */ jsx53("label", { htmlFor: "filter", className: "text-xs text-gray-500 font-normal", children: "Filter by value:" }),
|
|
29537
|
+
/* @__PURE__ */ jsx53(
|
|
29538
|
+
"input",
|
|
29539
|
+
{
|
|
29540
|
+
name: "filter",
|
|
29541
|
+
placeholder: "Search",
|
|
29542
|
+
defaultValue: header.column.getFilterValue() ?? "",
|
|
29543
|
+
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",
|
|
29544
|
+
autoComplete: "off"
|
|
29545
|
+
}
|
|
29546
|
+
),
|
|
29547
|
+
/* @__PURE__ */ jsx53("div", { className: "justify-end flex", children: /* @__PURE__ */ jsx53(
|
|
29548
|
+
Button,
|
|
29549
|
+
{
|
|
29550
|
+
type: "submit",
|
|
29551
|
+
className: "py-2 px-3 bg-[#12715B] text-white text-xs h-auto cursor-pointer",
|
|
29552
|
+
children: "Apply"
|
|
29553
|
+
}
|
|
29554
|
+
) })
|
|
29555
|
+
]
|
|
29504
29556
|
}
|
|
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
|
-
]
|
|
29557
|
+
)
|
|
29528
29558
|
}
|
|
29529
29559
|
)
|
|
29530
|
-
}
|
|
29531
|
-
)
|
|
29532
|
-
|
|
29533
|
-
|
|
29560
|
+
] })
|
|
29561
|
+
] })
|
|
29562
|
+
},
|
|
29563
|
+
`header-${header.id}-${index}`
|
|
29564
|
+
);
|
|
29534
29565
|
}) }, `header-group-${hg.id}`)) }),
|
|
29535
29566
|
/* @__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
29567
|
const meta = cell.column.columnDef.meta || {};
|
|
@@ -29539,8 +29570,13 @@ function DataTable({
|
|
|
29539
29570
|
return /* @__PURE__ */ jsxs31(
|
|
29540
29571
|
TableCell,
|
|
29541
29572
|
{
|
|
29542
|
-
className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative`,
|
|
29543
|
-
style:
|
|
29573
|
+
className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2`,
|
|
29574
|
+
style: {
|
|
29575
|
+
width: cell.column.getSize(),
|
|
29576
|
+
minWidth: cell.column.columnDef.minSize,
|
|
29577
|
+
maxWidth: cell.column.columnDef.maxSize,
|
|
29578
|
+
...meta?.cellStyle ?? {}
|
|
29579
|
+
},
|
|
29544
29580
|
onClick: () => {
|
|
29545
29581
|
if (isClickable && onCellClick) {
|
|
29546
29582
|
onCellClick(cell.row.original, cell.column.id);
|
|
@@ -29579,7 +29615,7 @@ function DataTable({
|
|
|
29579
29615
|
"Page ",
|
|
29580
29616
|
table.getState().pagination.pageIndex + 1,
|
|
29581
29617
|
" of ",
|
|
29582
|
-
|
|
29618
|
+
pageCount
|
|
29583
29619
|
] }),
|
|
29584
29620
|
/* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-2", children: [
|
|
29585
29621
|
/* @__PURE__ */ jsx53(
|
|
@@ -29926,7 +29962,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29926
29962
|
if (source === "manual") return Array.isArray(tabs) ? tabs : [];
|
|
29927
29963
|
return groupMenus(tabs);
|
|
29928
29964
|
}, [tabs, source, parentKey, menuNameKey, menuUrlKey]);
|
|
29929
|
-
const baseClasses = "text-
|
|
29965
|
+
const baseClasses = "text-foreground p-2 text-center rounded-md transition-colors";
|
|
29930
29966
|
const activeClasses = "bg-white/10 text-white";
|
|
29931
29967
|
const hoverClasses = "hover:bg-white/5";
|
|
29932
29968
|
const isActive = (path) => {
|
|
@@ -29996,7 +30032,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
29996
30032
|
DropdownMenuItem,
|
|
29997
30033
|
{
|
|
29998
30034
|
asChild: true,
|
|
29999
|
-
className: "cursor-pointer rounded-sm px-3 py-2 text-
|
|
30035
|
+
className: "cursor-pointer rounded-sm px-3 py-2 text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
|
|
30000
30036
|
children: /* @__PURE__ */ jsx57(
|
|
30001
30037
|
Link5,
|
|
30002
30038
|
{
|
|
@@ -30049,7 +30085,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
|
|
|
30049
30085
|
DropdownMenuItem,
|
|
30050
30086
|
{
|
|
30051
30087
|
asChild: true,
|
|
30052
|
-
className: "cursor-pointer rounded-sm px-3 py-2 text-
|
|
30088
|
+
className: "cursor-pointer rounded-sm px-3 py-2 text-gray-800 hover:bg-gray-100",
|
|
30053
30089
|
children: /* @__PURE__ */ jsx57(Link5, { href: item.url || "#", onClick: (e) => handleBuilderExit(e, item.url || "#"), children: item.header })
|
|
30054
30090
|
},
|
|
30055
30091
|
item.id || index
|