@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/index.d.mts CHANGED
@@ -131,7 +131,7 @@ interface TabsProps extends ElementProps {
131
131
  tabs?: Record<string, any>;
132
132
  pathname?: string;
133
133
  verticalMenu?: boolean;
134
- canvasMode?: 'desktop' | 'tablet' | 'mobile';
134
+ canvasMode?: 'desktop' | 'tablet' | 'mobile' | 'app';
135
135
  isBuilder?: boolean;
136
136
  source?: string;
137
137
  parentKey?: string;
@@ -163,7 +163,7 @@ interface PieChartProps extends ElementProps {
163
163
  showPercentage?: boolean;
164
164
  showLegends?: boolean;
165
165
  labelType?: string;
166
- canvasMode?: 'desktop' | 'tablet' | 'mobile';
166
+ canvasMode?: 'desktop' | 'tablet' | 'mobile' | 'app';
167
167
  loading?: boolean;
168
168
  }
169
169
 
@@ -171,7 +171,7 @@ interface BarChartProps extends ElementProps {
171
171
  data?: Record<string, any>;
172
172
  chartType?: string;
173
173
  legendsPosition?: string;
174
- canvasMode?: 'desktop' | 'tablet' | 'mobile';
174
+ canvasMode?: 'desktop' | 'tablet' | 'mobile' | 'app';
175
175
  loading?: boolean;
176
176
  }
177
177
 
@@ -201,7 +201,7 @@ interface NavbarProps extends ElementProps {
201
201
  showName?: boolean;
202
202
  imageUrl?: string;
203
203
  altText?: string;
204
- canvasMode?: 'desktop' | 'tablet' | 'mobile' | string;
204
+ canvasMode?: 'desktop' | 'tablet' | 'mobile' | 'app' | string;
205
205
  list?: Record<string, any>;
206
206
  profileMenu?: Record<string, any>;
207
207
  userName?: string;
package/dist/index.d.ts CHANGED
@@ -131,7 +131,7 @@ interface TabsProps extends ElementProps {
131
131
  tabs?: Record<string, any>;
132
132
  pathname?: string;
133
133
  verticalMenu?: boolean;
134
- canvasMode?: 'desktop' | 'tablet' | 'mobile';
134
+ canvasMode?: 'desktop' | 'tablet' | 'mobile' | 'app';
135
135
  isBuilder?: boolean;
136
136
  source?: string;
137
137
  parentKey?: string;
@@ -163,7 +163,7 @@ interface PieChartProps extends ElementProps {
163
163
  showPercentage?: boolean;
164
164
  showLegends?: boolean;
165
165
  labelType?: string;
166
- canvasMode?: 'desktop' | 'tablet' | 'mobile';
166
+ canvasMode?: 'desktop' | 'tablet' | 'mobile' | 'app';
167
167
  loading?: boolean;
168
168
  }
169
169
 
@@ -171,7 +171,7 @@ interface BarChartProps extends ElementProps {
171
171
  data?: Record<string, any>;
172
172
  chartType?: string;
173
173
  legendsPosition?: string;
174
- canvasMode?: 'desktop' | 'tablet' | 'mobile';
174
+ canvasMode?: 'desktop' | 'tablet' | 'mobile' | 'app';
175
175
  loading?: boolean;
176
176
  }
177
177
 
@@ -201,7 +201,7 @@ interface NavbarProps extends ElementProps {
201
201
  showName?: boolean;
202
202
  imageUrl?: string;
203
203
  altText?: string;
204
- canvasMode?: 'desktop' | 'tablet' | 'mobile' | string;
204
+ canvasMode?: 'desktop' | 'tablet' | 'mobile' | 'app' | string;
205
205
  list?: Record<string, any>;
206
206
  profileMenu?: Record<string, any>;
207
207
  userName?: string;
package/dist/index.js CHANGED
@@ -28163,17 +28163,32 @@ var import_react23 = require("react");
28163
28163
  var import_react_international_phone = require("react-international-phone");
28164
28164
  var import_style = require("react-international-phone/style.css");
28165
28165
  var import_jsx_runtime40 = require("react/jsx-runtime");
28166
+ var ensureIndiaCode = (val) => {
28167
+ if (!val) return "";
28168
+ const trimmed = val.trim();
28169
+ if (trimmed.startsWith("+")) return trimmed;
28170
+ const local = trimmed.replace(/^0+/, "");
28171
+ return `+91${local}`;
28172
+ };
28166
28173
  var PhoneInput = ({ className, style, ...props }) => {
28167
28174
  const placeholder = props.placeholder ?? "Enter phone number";
28168
28175
  const isEditable = props.isEditable ?? true;
28169
28176
  const isDisabled = props.isDisabled ?? false;
28170
28177
  (0, import_react23.useEffect)(() => {
28171
28178
  if (props.value !== void 0) {
28172
- handleChange?.(props.value);
28179
+ const normalized = ensureIndiaCode(props.value);
28180
+ handleChange?.(normalized);
28173
28181
  }
28174
28182
  }, []);
28175
28183
  const handleChange = (val) => {
28176
- props.onChange?.(val, props?.name || "");
28184
+ const normalized = ensureIndiaCode(val);
28185
+ const event = {
28186
+ target: {
28187
+ name: props.name || "",
28188
+ value: normalized
28189
+ }
28190
+ };
28191
+ props.onChange?.(event, props.name || "");
28177
28192
  };
28178
28193
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
28179
28194
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
@@ -28181,7 +28196,7 @@ var PhoneInput = ({ className, style, ...props }) => {
28181
28196
  {
28182
28197
  defaultCountry: "in",
28183
28198
  name: props.name,
28184
- value: props.value || "",
28199
+ value: props.value ? ensureIndiaCode(props.value) : "",
28185
28200
  className: cn(
28186
28201
  "rounded-md border-1",
28187
28202
  className,
@@ -28191,7 +28206,7 @@ var PhoneInput = ({ className, style, ...props }) => {
28191
28206
  ...style,
28192
28207
  borderColor: props.errorMessage ? "#f87171" : style?.borderColor
28193
28208
  },
28194
- onChange: (phone) => handleChange(phone),
28209
+ onChange: handleChange,
28195
28210
  inputProps: {
28196
28211
  id: "phone-field",
28197
28212
  style: { width: "100%", border: "none", outline: "none" }
@@ -29413,9 +29428,10 @@ function DataTable({
29413
29428
  const [columnVisibility, setColumnVisibility] = React10.useState({});
29414
29429
  const [manualSort, setManualSort] = React10.useState(null);
29415
29430
  const [searchTerm, setSearchTerm] = React10.useState("");
29431
+ const tableData = Array.isArray(data) ? data : [];
29416
29432
  const dynamicCols = useDynamicColumns({ columns });
29417
29433
  const table = (0, import_react_table2.useReactTable)({
29418
- data: data ?? [],
29434
+ data: tableData,
29419
29435
  columns: dynamicCols,
29420
29436
  state: {
29421
29437
  columnFilters,
@@ -29461,6 +29477,7 @@ function DataTable({
29461
29477
  }
29462
29478
  return [];
29463
29479
  };
29480
+ const pageCount = table.getPageCount() === 0 ? 1 : table.getPageCount();
29464
29481
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "overflow-hidden rounded-md w-full", children: [
29465
29482
  /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: `flex ${globalSearch ? "justify-between" : "justify-end"} p-2 bg-gray-50`, children: [
29466
29483
  globalSearch && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2 w-full max-w-sm", children: [
@@ -29538,88 +29555,100 @@ function DataTable({
29538
29555
  ] })
29539
29556
  ] })
29540
29557
  ] }),
29541
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Table3, { children: [
29558
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Table3, { className: "table-fixed", children: [
29542
29559
  /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableHeader, { children: table.getHeaderGroups().map((hg) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableRow, { children: hg.headers.map((header, index) => {
29543
29560
  const canSort = header.column.getCanSort();
29544
29561
  const canFilter = header.column.getCanFilter();
29545
29562
  const sortDir = manualSort?.key === header.column.id ? manualSort.dir : null;
29546
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableHead, { className: "relative select-none", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
29547
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
29548
- "span",
29549
- {
29550
- className: `flex items-center gap-1 ${canSort ? "cursor-pointer" : ""}`,
29551
- onClick: () => {
29552
- if (!canSort) return;
29553
- const newDir = manualSort?.key === header.column.id && manualSort.dir === "asc" ? "desc" : "asc";
29554
- setManualSort({ key: header.column.id, dir: newDir });
29555
- onSortChange?.(header.column.id, newDir);
29556
- },
29557
- children: [
29558
- (0, import_react_table2.flexRender)(header.column.columnDef.header, header.getContext()),
29559
- canSort && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
29560
- sortDir === "asc" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowUp, { size: 14, className: "text-gray-500" }),
29561
- sortDir === "desc" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowDown, { size: 14, className: "text-gray-500" }),
29562
- !sortDir && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowUpDown, { size: 14, className: "text-gray-400" })
29563
- ] })
29564
- ]
29565
- }
29566
- ),
29567
- canFilter && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Popover, { children: [
29568
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
29569
- "span",
29570
- {
29571
- role: "presentation",
29572
- className: "pl-5 cursor-pointer",
29573
- onClick: (e) => e.stopPropagation(),
29574
- children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons2.faEllipsisH, className: "w-5 h-5 text-gray-500" })
29575
- }
29576
- ) }),
29577
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
29578
- PopoverContent,
29579
- {
29580
- align: "center",
29581
- sideOffset: 14,
29582
- className: "w-50 p-3 z-[200] border-gray-300",
29583
- avoidCollisions: true,
29584
- children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
29585
- "form",
29563
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
29564
+ TableHead,
29565
+ {
29566
+ className: "relative select-none",
29567
+ style: {
29568
+ width: header.column.getSize(),
29569
+ minWidth: header.column.columnDef.minSize,
29570
+ maxWidth: header.column.columnDef.maxSize
29571
+ },
29572
+ children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center justify-between", children: [
29573
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
29574
+ "span",
29575
+ {
29576
+ className: `flex items-center gap-1 ${canSort ? "cursor-pointer" : ""}`,
29577
+ onClick: () => {
29578
+ if (!canSort) return;
29579
+ const newDir = manualSort?.key === header.column.id && manualSort.dir === "asc" ? "desc" : "asc";
29580
+ setManualSort({ key: header.column.id, dir: newDir });
29581
+ onSortChange?.(header.column.id, newDir);
29582
+ },
29583
+ children: [
29584
+ (0, import_react_table2.flexRender)(header.column.columnDef.header, header.getContext()),
29585
+ canSort && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
29586
+ sortDir === "asc" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowUp, { size: 14, className: "text-gray-500" }),
29587
+ sortDir === "desc" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowDown, { size: 14, className: "text-gray-500" }),
29588
+ !sortDir && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ArrowUpDown, { size: 14, className: "text-gray-400" })
29589
+ ] })
29590
+ ]
29591
+ }
29592
+ ),
29593
+ canFilter && /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(Popover, { children: [
29594
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
29595
+ "span",
29596
+ {
29597
+ role: "presentation",
29598
+ className: "pl-5 cursor-pointer",
29599
+ onClick: (e) => e.stopPropagation(),
29600
+ children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react_fontawesome3.FontAwesomeIcon, { icon: import_free_solid_svg_icons2.faEllipsisH, className: "w-5 h-5 text-gray-500" })
29601
+ }
29602
+ ) }),
29603
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
29604
+ PopoverContent,
29586
29605
  {
29587
- onSubmit: (e) => {
29588
- e.preventDefault();
29589
- const formData = new FormData(e.currentTarget);
29590
- const value = formData.get("filter") || "";
29591
- if (onFilterChange && value) {
29592
- onFilterChange({ columnKey: header.column.id, columnTerm: value });
29606
+ align: "center",
29607
+ sideOffset: 14,
29608
+ className: "w-50 p-3 z-[200] border-gray-300",
29609
+ avoidCollisions: true,
29610
+ children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
29611
+ "form",
29612
+ {
29613
+ onSubmit: (e) => {
29614
+ e.preventDefault();
29615
+ const formData = new FormData(e.currentTarget);
29616
+ const value = formData.get("filter") || "";
29617
+ if (onFilterChange && value) {
29618
+ onFilterChange({ columnKey: header.column.id, columnTerm: value });
29619
+ }
29620
+ },
29621
+ className: "space-y-2",
29622
+ children: [
29623
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { htmlFor: "filter", className: "text-xs text-gray-500 font-normal", children: "Filter by value:" }),
29624
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
29625
+ "input",
29626
+ {
29627
+ name: "filter",
29628
+ placeholder: "Search",
29629
+ defaultValue: header.column.getFilterValue() ?? "",
29630
+ 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",
29631
+ autoComplete: "off"
29632
+ }
29633
+ ),
29634
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "justify-end flex", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
29635
+ Button,
29636
+ {
29637
+ type: "submit",
29638
+ className: "py-2 px-3 bg-[#12715B] text-white text-xs h-auto cursor-pointer",
29639
+ children: "Apply"
29640
+ }
29641
+ ) })
29642
+ ]
29593
29643
  }
29594
- },
29595
- className: "space-y-2",
29596
- children: [
29597
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("label", { htmlFor: "filter", className: "text-xs text-gray-500 font-normal", children: "Filter by value:" }),
29598
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
29599
- "input",
29600
- {
29601
- name: "filter",
29602
- placeholder: "Search",
29603
- defaultValue: header.column.getFilterValue() ?? "",
29604
- 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",
29605
- autoComplete: "off"
29606
- }
29607
- ),
29608
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "justify-end flex", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
29609
- Button,
29610
- {
29611
- type: "submit",
29612
- className: "py-2 px-3 bg-[#12715B] text-white text-xs h-auto cursor-pointer",
29613
- children: "Apply"
29614
- }
29615
- ) })
29616
- ]
29644
+ )
29617
29645
  }
29618
29646
  )
29619
- }
29620
- )
29621
- ] })
29622
- ] }) }, `header-${header.id}-${index}`);
29647
+ ] })
29648
+ ] })
29649
+ },
29650
+ `header-${header.id}-${index}`
29651
+ );
29623
29652
  }) }, `header-group-${hg.id}`)) }),
29624
29653
  /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableBody, { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_jsx_runtime53.Fragment, { children: Array.from({ length: 5 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableRow, { children: dynamicCols.map((_2, j) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(TableCell, { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("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__ */ (0, import_jsx_runtime53.jsx)(TableRow, { children: row.getVisibleCells().map((cell, cellIndex, arr) => {
29625
29654
  const meta = cell.column.columnDef.meta || {};
@@ -29628,8 +29657,13 @@ function DataTable({
29628
29657
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
29629
29658
  TableCell,
29630
29659
  {
29631
- className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative`,
29632
- style: meta?.cellStyle,
29660
+ className: `${meta?.cellClass ?? ""} ${isClickable ? "cursor-pointer hover:bg-gray-100 underline text-blue-500" : ""} relative py-2`,
29661
+ style: {
29662
+ width: cell.column.getSize(),
29663
+ minWidth: cell.column.columnDef.minSize,
29664
+ maxWidth: cell.column.columnDef.maxSize,
29665
+ ...meta?.cellStyle ?? {}
29666
+ },
29633
29667
  onClick: () => {
29634
29668
  if (isClickable && onCellClick) {
29635
29669
  onCellClick(cell.row.original, cell.column.id);
@@ -29668,7 +29702,7 @@ function DataTable({
29668
29702
  "Page ",
29669
29703
  table.getState().pagination.pageIndex + 1,
29670
29704
  " of ",
29671
- table.getPageCount()
29705
+ pageCount
29672
29706
  ] }),
29673
29707
  /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-2", children: [
29674
29708
  /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
@@ -30015,7 +30049,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30015
30049
  if (source === "manual") return Array.isArray(tabs) ? tabs : [];
30016
30050
  return groupMenus(tabs);
30017
30051
  }, [tabs, source, parentKey, menuNameKey, menuUrlKey]);
30018
- const baseClasses = "text-[12px] text-foreground p-2 text-center rounded-md transition-colors";
30052
+ const baseClasses = "text-foreground p-2 text-center rounded-md transition-colors";
30019
30053
  const activeClasses = "bg-white/10 text-white";
30020
30054
  const hoverClasses = "hover:bg-white/5";
30021
30055
  const isActive = (path) => {
@@ -30085,7 +30119,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30085
30119
  DropdownMenuItem,
30086
30120
  {
30087
30121
  asChild: true,
30088
- className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
30122
+ className: "cursor-pointer rounded-sm px-3 py-2 text-gray-800 hover:bg-gray-100 focus:bg-gray-100",
30089
30123
  children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
30090
30124
  import_link5.default,
30091
30125
  {
@@ -30138,7 +30172,7 @@ var Tabs = ({ className, style, tabs, verticalMenu, pathname, canvasMode, isBuil
30138
30172
  DropdownMenuItem,
30139
30173
  {
30140
30174
  asChild: true,
30141
- className: "cursor-pointer rounded-sm px-3 py-2 text-[12px] text-gray-800 hover:bg-gray-100",
30175
+ className: "cursor-pointer rounded-sm px-3 py-2 text-gray-800 hover:bg-gray-100",
30142
30176
  children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_link5.default, { href: item.url || "#", onClick: (e) => handleBuilderExit(e, item.url || "#"), children: item.header })
30143
30177
  },
30144
30178
  item.id || index