@algorithm-shift/design-system 1.2.65 → 1.2.66

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.mjs CHANGED
@@ -157,7 +157,7 @@ function TabList({
157
157
  }
158
158
 
159
159
  // src/components/Layout/TabGroup.tsx
160
- import { useMemo } from "react";
160
+ import { useEffect as useEffect2, useMemo } from "react";
161
161
  import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
162
162
  function TabGroupComponent({
163
163
  children,
@@ -167,6 +167,11 @@ function TabGroupComponent({
167
167
  activeTab,
168
168
  onTabChange
169
169
  }) {
170
+ useEffect2(() => {
171
+ if (list && list.length > 0 && !activeTab && onTabChange) {
172
+ onTabChange(list[0]?.tabId);
173
+ }
174
+ }, [list, activeTab, onTabChange]);
170
175
  const formatedList = useMemo(
171
176
  () => Array.isArray(list) ? [...list].sort((a, b) => (a.orderNumber ?? 0) - (b.orderNumber ?? 0)) : [],
172
177
  [list]
@@ -26820,7 +26825,7 @@ var Icon2 = ({ iconType = "fontawesome", name = "Envelope", className, fontSize
26820
26825
  var Icon_default = Icon2;
26821
26826
 
26822
26827
  // src/components/Inputs/TextInput/TextInput.tsx
26823
- import { useEffect as useEffect2 } from "react";
26828
+ import { useEffect as useEffect3 } from "react";
26824
26829
 
26825
26830
  // src/components/ui/input.tsx
26826
26831
  import { jsx as jsx18 } from "react/jsx-runtime";
@@ -26849,7 +26854,7 @@ var TextInput = ({ className, style, ...props }) => {
26849
26854
  const isDisabled = props.isDisabled ?? false;
26850
26855
  const isReadonly = props.isReadonly ?? false;
26851
26856
  const isAutocomplete = props.isAutocomplete ?? false;
26852
- useEffect2(() => {
26857
+ useEffect3(() => {
26853
26858
  if (props.value !== void 0) {
26854
26859
  const e = { target: { value: props.value } };
26855
26860
  handleChange?.(e);
@@ -26883,7 +26888,7 @@ var TextInput = ({ className, style, ...props }) => {
26883
26888
  var TextInput_default = TextInput;
26884
26889
 
26885
26890
  // src/components/Inputs/NumberInput/NumberInput.tsx
26886
- import { useEffect as useEffect3 } from "react";
26891
+ import { useEffect as useEffect4 } from "react";
26887
26892
  import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
26888
26893
  var NumberInput = ({ className, style, ...props }) => {
26889
26894
  const placeholder = props.placeholder ?? "Placeholder text";
@@ -26891,7 +26896,7 @@ var NumberInput = ({ className, style, ...props }) => {
26891
26896
  const isDisabled = props.isDisabled ?? false;
26892
26897
  const isReadonly = props.isReadonly ?? false;
26893
26898
  const isAutocomplete = props.isAutocomplete ?? false;
26894
- useEffect3(() => {
26899
+ useEffect4(() => {
26895
26900
  if (props.value !== void 0) {
26896
26901
  const e = { target: { value: props.value } };
26897
26902
  handleChange?.(e);
@@ -26929,7 +26934,7 @@ var NumberInput = ({ className, style, ...props }) => {
26929
26934
  var NumberInput_default = NumberInput;
26930
26935
 
26931
26936
  // src/components/Inputs/EmailInput/EmailInput.tsx
26932
- import { useEffect as useEffect4 } from "react";
26937
+ import { useEffect as useEffect5 } from "react";
26933
26938
  import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
26934
26939
  var EmailInput = ({ className, style, ...props }) => {
26935
26940
  const placeholder = props.placeholder ?? "Placeholder text";
@@ -26937,7 +26942,7 @@ var EmailInput = ({ className, style, ...props }) => {
26937
26942
  const isDisabled = props.isDisabled ?? false;
26938
26943
  const isReadonly = props.isReadonly ?? false;
26939
26944
  const isAutocomplete = props.isAutocomplete ?? false;
26940
- useEffect4(() => {
26945
+ useEffect5(() => {
26941
26946
  if (props.value !== void 0) {
26942
26947
  const e = { target: { value: props.value } };
26943
26948
  handleChange?.(e);
@@ -26974,7 +26979,7 @@ var EmailInput = ({ className, style, ...props }) => {
26974
26979
  var EmailInput_default = EmailInput;
26975
26980
 
26976
26981
  // src/components/Inputs/PasswordInput/PasswordInput.tsx
26977
- import { useEffect as useEffect5 } from "react";
26982
+ import { useEffect as useEffect6 } from "react";
26978
26983
  import { Fragment as Fragment5, jsx as jsx22, jsxs as jsxs10 } from "react/jsx-runtime";
26979
26984
  var PasswordInput = ({ className, style, ...props }) => {
26980
26985
  const placeholder = props.placeholder ?? "Placeholder text";
@@ -26982,7 +26987,7 @@ var PasswordInput = ({ className, style, ...props }) => {
26982
26987
  const isDisabled = props.isDisabled ?? false;
26983
26988
  const isReadonly = props.isReadonly ?? false;
26984
26989
  const isAutocomplete = props.isAutocomplete ?? false;
26985
- useEffect5(() => {
26990
+ useEffect6(() => {
26986
26991
  if (props.value !== void 0) {
26987
26992
  const e = { target: { value: props.value } };
26988
26993
  handleChange?.(e);
@@ -27020,7 +27025,7 @@ var PasswordInput = ({ className, style, ...props }) => {
27020
27025
  var PasswordInput_default = PasswordInput;
27021
27026
 
27022
27027
  // src/components/Inputs/Textarea/Textarea.tsx
27023
- import { useEffect as useEffect6 } from "react";
27028
+ import { useEffect as useEffect7 } from "react";
27024
27029
 
27025
27030
  // src/components/ui/textarea.tsx
27026
27031
  import { jsx as jsx23 } from "react/jsx-runtime";
@@ -27046,7 +27051,7 @@ var Textarea2 = ({ className, style, ...props }) => {
27046
27051
  const isDisabled = props.isDisabled ?? false;
27047
27052
  const isReadonly = props.isReadonly ?? false;
27048
27053
  const isAutocomplete = props.isAutocomplete ?? false;
27049
- useEffect6(() => {
27054
+ useEffect7(() => {
27050
27055
  if (props.value !== void 0) {
27051
27056
  const e = { target: { value: props.value } };
27052
27057
  handleChange?.(e);
@@ -27080,7 +27085,7 @@ var Textarea2 = ({ className, style, ...props }) => {
27080
27085
  var Textarea_default = Textarea2;
27081
27086
 
27082
27087
  // src/components/Inputs/UrlInput/UrlInput.tsx
27083
- import { useEffect as useEffect7 } from "react";
27088
+ import { useEffect as useEffect8 } from "react";
27084
27089
  import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
27085
27090
  var UrlInput = ({ className, style, ...props }) => {
27086
27091
  const placeholder = props.placeholder ?? "Placeholder text";
@@ -27088,7 +27093,7 @@ var UrlInput = ({ className, style, ...props }) => {
27088
27093
  const isDisabled = props.isDisabled ?? false;
27089
27094
  const isReadonly = props.isReadonly ?? false;
27090
27095
  const isAutocomplete = props.isAutocomplete ?? false;
27091
- useEffect7(() => {
27096
+ useEffect8(() => {
27092
27097
  if (props.value !== void 0) {
27093
27098
  const e = { target: { value: props.value } };
27094
27099
  handleChange?.(e);
@@ -27126,7 +27131,7 @@ var UrlInput = ({ className, style, ...props }) => {
27126
27131
  var UrlInput_default = UrlInput;
27127
27132
 
27128
27133
  // src/components/Inputs/Checkbox/Checkbox.tsx
27129
- import { useEffect as useEffect8 } from "react";
27134
+ import { useEffect as useEffect9 } from "react";
27130
27135
 
27131
27136
  // src/components/ui/checkbox.tsx
27132
27137
  import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
@@ -27182,7 +27187,7 @@ var CheckboxInput = ({ className, style, ...props }) => {
27182
27187
  const isEditable = props.isEditable ?? true;
27183
27188
  const isDisabled = props.isDisabled ?? false;
27184
27189
  const text = props.text ? props.text : "Subscribe";
27185
- useEffect8(() => {
27190
+ useEffect9(() => {
27186
27191
  if (props.value) {
27187
27192
  handleChange(props.value);
27188
27193
  }
@@ -27209,7 +27214,7 @@ var CheckboxInput = ({ className, style, ...props }) => {
27209
27214
  var Checkbox_default = CheckboxInput;
27210
27215
 
27211
27216
  // src/components/Inputs/RadioInput/RadioInput.tsx
27212
- import { useEffect as useEffect9 } from "react";
27217
+ import { useEffect as useEffect10 } from "react";
27213
27218
 
27214
27219
  // src/components/ui/radio-group.tsx
27215
27220
  import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
@@ -27269,7 +27274,7 @@ var RadioInput = ({
27269
27274
  value: item[dataKey || "value"],
27270
27275
  label: item[dataLabel || "label"]
27271
27276
  }));
27272
- useEffect9(() => {
27277
+ useEffect10(() => {
27273
27278
  if (props.value !== void 0) {
27274
27279
  handleChange?.(props.value);
27275
27280
  }
@@ -27299,7 +27304,7 @@ var RadioInput = ({
27299
27304
  var RadioInput_default = RadioInput;
27300
27305
 
27301
27306
  // src/components/Inputs/MultiCheckbox/MultiCheckbox.tsx
27302
- import { useCallback, useEffect as useEffect10, useState as useState2 } from "react";
27307
+ import { useCallback, useEffect as useEffect11, useState as useState2 } from "react";
27303
27308
  import { jsx as jsx31, jsxs as jsxs15 } from "react/jsx-runtime";
27304
27309
  var MultiCheckbox = ({
27305
27310
  className,
@@ -27318,7 +27323,7 @@ var MultiCheckbox = ({
27318
27323
  value: item[dataKey || "value"],
27319
27324
  label: item[dataLabel || "label"]
27320
27325
  }));
27321
- useEffect10(() => {
27326
+ useEffect11(() => {
27322
27327
  if (propValue !== void 0) {
27323
27328
  onChange?.(propValue);
27324
27329
  }
@@ -27359,7 +27364,7 @@ var MultiCheckbox = ({
27359
27364
  var MultiCheckbox_default = MultiCheckbox;
27360
27365
 
27361
27366
  // src/components/Inputs/RichText/RichText.tsx
27362
- import { useEffect as useEffect11 } from "react";
27367
+ import { useEffect as useEffect12 } from "react";
27363
27368
 
27364
27369
  // src/components/Global/TinyMceEditor.tsx
27365
27370
  import { useMemo as useMemo2, useRef } from "react";
@@ -27435,7 +27440,7 @@ function MyEditor({
27435
27440
  // src/components/Inputs/RichText/RichText.tsx
27436
27441
  import { jsx as jsx33, jsxs as jsxs16 } from "react/jsx-runtime";
27437
27442
  function RichText({ className, style, ...props }) {
27438
- useEffect11(() => {
27443
+ useEffect12(() => {
27439
27444
  if (props.value !== void 0) {
27440
27445
  handleChange?.(props.value);
27441
27446
  }
@@ -27460,7 +27465,7 @@ function RichText({ className, style, ...props }) {
27460
27465
  }
27461
27466
 
27462
27467
  // src/components/Inputs/Dropdown/Dropdown.tsx
27463
- import { useEffect as useEffect12 } from "react";
27468
+ import { useEffect as useEffect13 } from "react";
27464
27469
 
27465
27470
  // src/components/ui/select.tsx
27466
27471
  import * as SelectPrimitive from "@radix-ui/react-select";
@@ -27596,7 +27601,7 @@ var Dropdown = ({ className, style, ...props }) => {
27596
27601
  const isEditable = props.isEditable ?? true;
27597
27602
  const isDisabled = props.isDisabled ?? false;
27598
27603
  const isReadonly = props.isReadonly ?? false;
27599
- useEffect12(() => {
27604
+ useEffect13(() => {
27600
27605
  if (props.value !== void 0) {
27601
27606
  handleChange(props.value);
27602
27607
  }
@@ -27637,7 +27642,7 @@ var Dropdown = ({ className, style, ...props }) => {
27637
27642
  var Dropdown_default = Dropdown;
27638
27643
 
27639
27644
  // src/components/Inputs/SwitchToggle/SwitchToggle.tsx
27640
- import { useEffect as useEffect13 } from "react";
27645
+ import { useEffect as useEffect14 } from "react";
27641
27646
 
27642
27647
  // src/components/ui/switch.tsx
27643
27648
  import * as SwitchPrimitive from "@radix-ui/react-switch";
@@ -27673,7 +27678,7 @@ import { Fragment as Fragment11, jsx as jsx37, jsxs as jsxs19 } from "react/jsx-
27673
27678
  var SwitchToggle = ({ className, style, ...props }) => {
27674
27679
  const isEditable = props.isEditable ?? true;
27675
27680
  const isDisabled = props.isDisabled ?? false;
27676
- useEffect13(() => {
27681
+ useEffect14(() => {
27677
27682
  if (props.value !== void 0) {
27678
27683
  handleChange?.(props.value);
27679
27684
  }
@@ -27700,7 +27705,7 @@ var SwitchToggle = ({ className, style, ...props }) => {
27700
27705
  var SwitchToggle_default = SwitchToggle;
27701
27706
 
27702
27707
  // src/components/Inputs/PhoneInput/PhoneInput.tsx
27703
- import { useEffect as useEffect14 } from "react";
27708
+ import { useEffect as useEffect15 } from "react";
27704
27709
  import { PhoneInput as PhoneInputField } from "react-international-phone";
27705
27710
  import "react-international-phone/style.css";
27706
27711
  import { Fragment as Fragment12, jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
@@ -27708,7 +27713,7 @@ var PhoneInput = ({ className, style, ...props }) => {
27708
27713
  const placeholder = props.placeholder ?? "Enter phone number";
27709
27714
  const isEditable = props.isEditable ?? true;
27710
27715
  const isDisabled = props.isDisabled ?? false;
27711
- useEffect14(() => {
27716
+ useEffect15(() => {
27712
27717
  if (props.value !== void 0) {
27713
27718
  handleChange?.(props.value);
27714
27719
  }
@@ -27724,7 +27729,7 @@ var PhoneInput = ({ className, style, ...props }) => {
27724
27729
  name: props.name,
27725
27730
  value: props.value || "",
27726
27731
  className: cn(
27727
- "rounded-md",
27732
+ "rounded-md border-1",
27728
27733
  className,
27729
27734
  props.errorMessage ? "border-red-500" : ""
27730
27735
  ),
@@ -27747,7 +27752,7 @@ var PhoneInput = ({ className, style, ...props }) => {
27747
27752
  var PhoneInput_default = PhoneInput;
27748
27753
 
27749
27754
  // src/components/Inputs/SearchInput/SearchInput.tsx
27750
- import { useEffect as useEffect15 } from "react";
27755
+ import { useEffect as useEffect16 } from "react";
27751
27756
  import { Fragment as Fragment13, jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
27752
27757
  var SearchInput = ({ className, style, ...props }) => {
27753
27758
  const placeholder = props.placeholder ?? "Placeholder text";
@@ -27755,7 +27760,7 @@ var SearchInput = ({ className, style, ...props }) => {
27755
27760
  const isDisabled = props.isDisabled ?? false;
27756
27761
  const isReadonly = props.isReadonly ?? false;
27757
27762
  const isAutocomplete = props.isAutocomplete ?? false;
27758
- useEffect15(() => {
27763
+ useEffect16(() => {
27759
27764
  if (props.value !== void 0) {
27760
27765
  const e = { target: { value: props.value } };
27761
27766
  handleChange?.(e);
@@ -27793,11 +27798,11 @@ var SearchInput = ({ className, style, ...props }) => {
27793
27798
  var SearchInput_default = SearchInput;
27794
27799
 
27795
27800
  // src/components/Inputs/FileInput/FileInput.tsx
27796
- import { useEffect as useEffect16 } from "react";
27801
+ import { useEffect as useEffect17 } from "react";
27797
27802
  import { jsx as jsx40, jsxs as jsxs22 } from "react/jsx-runtime";
27798
27803
  var FileInput2 = ({ className, style, ...props }) => {
27799
27804
  const placeholder = props.placeholder ?? "Placeholder text";
27800
- useEffect16(() => {
27805
+ useEffect17(() => {
27801
27806
  if (props.value !== void 0) {
27802
27807
  const e = { target: { value: props.value } };
27803
27808
  handleChange?.(e);
@@ -27830,7 +27835,7 @@ var FileInput2 = ({ className, style, ...props }) => {
27830
27835
  var FileInput_default = FileInput2;
27831
27836
 
27832
27837
  // src/components/Inputs/DatePicker/DatePicker.tsx
27833
- import { useEffect as useEffect17 } from "react";
27838
+ import { useEffect as useEffect18 } from "react";
27834
27839
  import { Fragment as Fragment14, jsx as jsx41, jsxs as jsxs23 } from "react/jsx-runtime";
27835
27840
  function DatePicker({ className, style, ...props }) {
27836
27841
  const placeholder = props.placeholder ?? "Placeholder text";
@@ -27856,7 +27861,7 @@ function DatePicker({ className, style, ...props }) {
27856
27861
  };
27857
27862
  const minDate = resolveDate(minimumDate, customMinimumDate);
27858
27863
  const maxDate = resolveDate(maximumDate, customMaximumDate);
27859
- useEffect17(() => {
27864
+ useEffect18(() => {
27860
27865
  if (props.value !== void 0) {
27861
27866
  handleChange(props.value);
27862
27867
  }
@@ -27902,7 +27907,7 @@ function DatePicker({ className, style, ...props }) {
27902
27907
  }
27903
27908
 
27904
27909
  // src/components/Inputs/DateRange/DateRange.tsx
27905
- import React5, { useEffect as useEffect19 } from "react";
27910
+ import React5, { useEffect as useEffect20 } from "react";
27906
27911
  import { addDays, format } from "date-fns";
27907
27912
 
27908
27913
  // src/components/ui/calendar.tsx
@@ -28130,7 +28135,7 @@ var DateRange = ({ className, style, ...props }) => {
28130
28135
  to: addDays(/* @__PURE__ */ new Date(), 7)
28131
28136
  }
28132
28137
  );
28133
- useEffect19(() => {
28138
+ useEffect20(() => {
28134
28139
  if (props.value && isDateRange(props.value)) {
28135
28140
  handleChange?.(props.value);
28136
28141
  }
@@ -28177,7 +28182,7 @@ var DateRange = ({ className, style, ...props }) => {
28177
28182
  var DateRange_default = DateRange;
28178
28183
 
28179
28184
  // src/components/Inputs/TextInputGroup/TextInputGroup.tsx
28180
- import { useEffect as useEffect20 } from "react";
28185
+ import { useEffect as useEffect21 } from "react";
28181
28186
  import { Fragment as Fragment16, jsx as jsx45, jsxs as jsxs25 } from "react/jsx-runtime";
28182
28187
  var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
28183
28188
  const placeholder = props.placeholder ?? "Placeholder text";
@@ -28185,7 +28190,7 @@ var TextInputGroup = ({ className, style, prepend, append, ...props }) => {
28185
28190
  const isDisabled = props.isDisabled ?? false;
28186
28191
  const isReadonly = props.isReadonly ?? false;
28187
28192
  const isAutocomplete = props.isAutocomplete ?? false;
28188
- useEffect20(() => {
28193
+ useEffect21(() => {
28189
28194
  if (props.value !== void 0) {
28190
28195
  const e = { target: { value: props.value } };
28191
28196
  handleChange?.(e);
@@ -28245,7 +28250,6 @@ import {
28245
28250
  flexRender,
28246
28251
  getCoreRowModel,
28247
28252
  getPaginationRowModel,
28248
- getSortedRowModel,
28249
28253
  getFilteredRowModel,
28250
28254
  useReactTable
28251
28255
  } from "@tanstack/react-table";
@@ -28346,16 +28350,20 @@ function DataTable({
28346
28350
  onPageChange,
28347
28351
  pageSize = 10,
28348
28352
  paginationMode = "client",
28349
- totalRecords = 0
28353
+ totalRecords = 0,
28354
+ onSortChange,
28355
+ onFilterChange,
28356
+ onGlobalSearch,
28357
+ globalSearch
28350
28358
  }) {
28351
- const [sorting, setSorting] = React6.useState([]);
28352
28359
  const [columnFilters, setColumnFilters] = React6.useState([]);
28353
28360
  const [columnVisibility, setColumnVisibility] = React6.useState({});
28361
+ const [manualSort, setManualSort] = React6.useState(null);
28362
+ const [searchTerm, setSearchTerm] = React6.useState("");
28354
28363
  const table = useReactTable({
28355
28364
  data,
28356
28365
  columns,
28357
28366
  state: {
28358
- sorting,
28359
28367
  columnFilters,
28360
28368
  columnVisibility,
28361
28369
  pagination: {
@@ -28363,11 +28371,9 @@ function DataTable({
28363
28371
  pageSize
28364
28372
  }
28365
28373
  },
28366
- onSortingChange: setSorting,
28367
28374
  onColumnFiltersChange: setColumnFilters,
28368
28375
  onColumnVisibilityChange: setColumnVisibility,
28369
28376
  getCoreRowModel: getCoreRowModel(),
28370
- getSortedRowModel: getSortedRowModel(),
28371
28377
  getFilteredRowModel: getFilteredRowModel(),
28372
28378
  getPaginationRowModel: pagination && paginationMode === "client" ? getPaginationRowModel() : void 0,
28373
28379
  manualPagination: paginationMode === "server",
@@ -28397,68 +28403,105 @@ function DataTable({
28397
28403
  }
28398
28404
  return [];
28399
28405
  };
28400
- return /* @__PURE__ */ jsxs26("div", { className: "overflow-hidden rounded-md border w-full", children: [
28401
- /* @__PURE__ */ jsx47("div", { className: "flex justify-end p-2", children: /* @__PURE__ */ jsxs26(Popover, { children: [
28402
- /* @__PURE__ */ jsx47(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
28403
- Button,
28404
- {
28405
- variant: "outline",
28406
- size: "sm",
28407
- className: "px-3 py-1 text-xs cursor-pointer",
28408
- children: "Manage Columns"
28409
- }
28410
- ) }),
28411
- /* @__PURE__ */ jsxs26(PopoverContent, { align: "end", className: "w-48 p-3 space-y-2", children: [
28412
- /* @__PURE__ */ jsx47("div", { className: "text-sm font-medium mb-2", children: "Show / Hide Columns" }),
28413
- /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-2 text-sm font-semibold border-b pb-2 mb-2", children: [
28406
+ return /* @__PURE__ */ jsxs26("div", { className: "overflow-hidden rounded-md w-full", children: [
28407
+ /* @__PURE__ */ jsxs26("div", { className: `flex ${globalSearch ? "justify-between" : "justify-end"} p-2 border-b bg-gray-50`, children: [
28408
+ globalSearch && /* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-2 w-full max-w-sm", children: [
28409
+ /* @__PURE__ */ jsxs26("div", { className: "relative w-full", children: [
28414
28410
  /* @__PURE__ */ jsx47(
28415
28411
  "input",
28416
28412
  {
28417
- type: "checkbox",
28418
- checked: table.getAllLeafColumns().every((col) => col.getIsVisible()),
28419
- ref: (input) => {
28420
- if (input) {
28421
- input.indeterminate = table.getAllLeafColumns().some((col) => col.getIsVisible()) && !table.getAllLeafColumns().every((col) => col.getIsVisible());
28413
+ type: "text",
28414
+ placeholder: "Search...",
28415
+ value: searchTerm,
28416
+ onChange: (e) => setSearchTerm(e.target.value),
28417
+ onKeyDown: (e) => {
28418
+ if (e.key === "Enter" && onGlobalSearch) {
28419
+ onGlobalSearch(searchTerm.trim());
28422
28420
  }
28423
28421
  },
28424
- onChange: (e) => {
28425
- table.getAllLeafColumns().forEach(
28426
- (col) => col.toggleVisibility(e.target.checked)
28427
- );
28428
- }
28422
+ className: "border border-gray-300 rounded-md text-sm px-3 py-2 pl-8 w-full focus:outline-none focus:ring-1 focus:ring-[#12715B]"
28429
28423
  }
28430
28424
  ),
28431
- "Toggle All"
28425
+ /* @__PURE__ */ jsx47(Search, { className: "absolute left-2 top-2.5 text-gray-400", size: 16 })
28432
28426
  ] }),
28433
- table.getAllLeafColumns().map((column) => /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-2 text-sm", children: [
28434
- /* @__PURE__ */ jsx47(
28435
- "input",
28436
- {
28437
- type: "checkbox",
28438
- checked: column.getIsVisible(),
28439
- onChange: (e) => column.toggleVisibility(e.target.checked)
28440
- }
28441
- ),
28442
- column.columnDef.header?.toString() ?? column.id
28443
- ] }, column.id))
28427
+ /* @__PURE__ */ jsx47(
28428
+ Button,
28429
+ {
28430
+ size: "sm",
28431
+ className: "bg-[#12715B] text-white text-xs h-auto py-2 px-3",
28432
+ onClick: () => onGlobalSearch?.(searchTerm.trim()),
28433
+ children: "Search"
28434
+ }
28435
+ )
28436
+ ] }),
28437
+ /* @__PURE__ */ jsxs26(Popover, { children: [
28438
+ /* @__PURE__ */ jsx47(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx47(
28439
+ Button,
28440
+ {
28441
+ variant: "outline",
28442
+ size: "sm",
28443
+ className: "px-3 py-1 text-xs cursor-pointer",
28444
+ children: "Manage Columns"
28445
+ }
28446
+ ) }),
28447
+ /* @__PURE__ */ jsxs26(PopoverContent, { align: "end", className: "w-48 p-3 space-y-2", children: [
28448
+ /* @__PURE__ */ jsx47("div", { className: "text-sm font-medium mb-2", children: "Show / Hide Columns" }),
28449
+ /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-2 text-sm font-semibold border-b pb-2 mb-2", children: [
28450
+ /* @__PURE__ */ jsx47(
28451
+ "input",
28452
+ {
28453
+ type: "checkbox",
28454
+ checked: table.getAllLeafColumns().every((col) => col.getIsVisible()),
28455
+ ref: (input) => {
28456
+ if (input) {
28457
+ input.indeterminate = table.getAllLeafColumns().some((col) => col.getIsVisible()) && !table.getAllLeafColumns().every((col) => col.getIsVisible());
28458
+ }
28459
+ },
28460
+ onChange: (e) => {
28461
+ table.getAllLeafColumns().forEach(
28462
+ (col) => col.toggleVisibility(e.target.checked)
28463
+ );
28464
+ }
28465
+ }
28466
+ ),
28467
+ "Toggle All"
28468
+ ] }),
28469
+ table.getAllLeafColumns().map((column) => /* @__PURE__ */ jsxs26("label", { className: "flex items-center gap-2 text-sm", children: [
28470
+ /* @__PURE__ */ jsx47(
28471
+ "input",
28472
+ {
28473
+ type: "checkbox",
28474
+ checked: column.getIsVisible(),
28475
+ onChange: (e) => column.toggleVisibility(e.target.checked)
28476
+ }
28477
+ ),
28478
+ column.columnDef.header?.toString() ?? column.id
28479
+ ] }, column.id))
28480
+ ] })
28444
28481
  ] })
28445
- ] }) }),
28482
+ ] }),
28446
28483
  /* @__PURE__ */ jsxs26(Table3, { children: [
28447
28484
  /* @__PURE__ */ jsx47(TableHeader, { children: table.getHeaderGroups().map((hg) => /* @__PURE__ */ jsx47(TableRow, { children: hg.headers.map((header) => {
28448
28485
  const canSort = header.column.getCanSort();
28449
28486
  const canFilter = header.column.getCanFilter();
28487
+ const sortDir = manualSort?.key === header.column.id ? manualSort.dir : null;
28450
28488
  return /* @__PURE__ */ jsx47(TableHead, { className: "relative select-none", children: /* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between", children: [
28451
28489
  /* @__PURE__ */ jsxs26(
28452
28490
  "span",
28453
28491
  {
28454
28492
  className: `flex items-center gap-1 ${canSort ? "cursor-pointer" : ""}`,
28455
- onClick: canSort ? header.column.getToggleSortingHandler() : void 0,
28493
+ onClick: () => {
28494
+ if (!canSort) return;
28495
+ const newDir = manualSort?.key === header.column.id && manualSort.dir === "asc" ? "desc" : "asc";
28496
+ setManualSort({ key: header.column.id, dir: newDir });
28497
+ onSortChange?.(header.column.id, newDir);
28498
+ },
28456
28499
  children: [
28457
28500
  flexRender(header.column.columnDef.header, header.getContext()),
28458
28501
  canSort && /* @__PURE__ */ jsxs26(Fragment17, { children: [
28459
- header.column.getIsSorted() === "asc" && /* @__PURE__ */ jsx47(ArrowUp, { size: 14, className: "text-gray-500" }),
28460
- header.column.getIsSorted() === "desc" && /* @__PURE__ */ jsx47(ArrowDown, { size: 14, className: "text-gray-500" }),
28461
- !header.column.getIsSorted() && /* @__PURE__ */ jsx47(ArrowUpDown, { size: 14, className: "text-gray-400" })
28502
+ sortDir === "asc" && /* @__PURE__ */ jsx47(ArrowUp, { size: 14, className: "text-gray-500" }),
28503
+ sortDir === "desc" && /* @__PURE__ */ jsx47(ArrowDown, { size: 14, className: "text-gray-500" }),
28504
+ !sortDir && /* @__PURE__ */ jsx47(ArrowUpDown, { size: 14, className: "text-gray-400" })
28462
28505
  ] })
28463
28506
  ]
28464
28507
  }
@@ -28476,8 +28519,8 @@ function DataTable({
28476
28519
  /* @__PURE__ */ jsx47(
28477
28520
  PopoverContent,
28478
28521
  {
28479
- align: "start",
28480
- sideOffset: 4,
28522
+ align: "center",
28523
+ sideOffset: 14,
28481
28524
  className: "w-50 p-3 z-[200] border-gray-300",
28482
28525
  avoidCollisions: true,
28483
28526
  children: /* @__PURE__ */ jsxs26(
@@ -28486,8 +28529,10 @@ function DataTable({
28486
28529
  onSubmit: (e) => {
28487
28530
  e.preventDefault();
28488
28531
  const formData = new FormData(e.currentTarget);
28489
- const value = formData.get("filter");
28490
- header.column.setFilterValue(value || void 0);
28532
+ const value = formData.get("filter") || "";
28533
+ if (onFilterChange && value) {
28534
+ onFilterChange({ columnKey: header.column.id, columnTerm: value });
28535
+ }
28491
28536
  },
28492
28537
  className: "space-y-2",
28493
28538
  children: [
@@ -28577,9 +28622,13 @@ var Table4 = ({
28577
28622
  paginationMode = "client",
28578
28623
  itemsPerPage = 10,
28579
28624
  onPageChange,
28625
+ onSortChange,
28626
+ onFilterChange,
28627
+ onGlobalSearch,
28580
28628
  page,
28581
28629
  loading = false,
28582
28630
  totalRecords = 0,
28631
+ globalSearch = false,
28583
28632
  ...props
28584
28633
  }) => {
28585
28634
  const rawColumns = Array.isArray(columns) ? columns : [];
@@ -28600,7 +28649,11 @@ var Table4 = ({
28600
28649
  onPageChange?.({ page: pageIndex + 1, itemsPerPage: pageSize });
28601
28650
  },
28602
28651
  paginationMode,
28603
- totalRecords
28652
+ totalRecords,
28653
+ onSortChange: (col, dir) => onSortChange?.({ sort_by: col, sort_order: dir }),
28654
+ onFilterChange: (filters) => onFilterChange?.({ columnKey: filters.columnKey, columnTerm: filters.columnTerm }),
28655
+ onGlobalSearch: (term) => onGlobalSearch?.({ searchTerm: term }),
28656
+ globalSearch
28604
28657
  }
28605
28658
  ) });
28606
28659
  };
@@ -28997,20 +29050,20 @@ function Navbar({
28997
29050
  userName = "Guest User"
28998
29051
  }) {
28999
29052
  const isMobileView = canvasMode === "mobile" || canvasMode === "tablet";
29000
- return /* @__PURE__ */ jsx58("nav", { className: "w-full border-b bg-white shadow-sm", style, children: /* @__PURE__ */ jsxs33("div", { className: "mx-auto flex max-w-7xl items-center justify-between px-4 py-4", children: [
29053
+ return /* @__PURE__ */ jsx58("nav", { className: "w-full border-b border-b-white dark:border-b-gray-800 dark:bg-gray-800 bg-white shadow-sm", style, children: /* @__PURE__ */ jsxs33("div", { className: "mx-auto flex max-w-[90%] items-center justify-between px-4 py-4", children: [
29001
29054
  /* @__PURE__ */ jsx58(Link6, { href: "/", className: "flex items-center space-x-2", children: imageUrl ? /* @__PURE__ */ jsx58(Image3, { src: imageUrl, alt: altText, width: 200, height: 200 }) : /* @__PURE__ */ jsx58("span", { className: "font-semibold text-blue-700", children: "Logo" }) }),
29002
29055
  !isMobileView && /* @__PURE__ */ jsx58("div", { className: "flex items-center space-x-6 sm:hidden md:flex", children: list.map((item) => /* @__PURE__ */ jsx58(
29003
29056
  Link6,
29004
29057
  {
29005
29058
  href: item.url || "#",
29006
- className: "text-sm font-medium text-gray-600 hover:text-gray-900 transition-colors",
29059
+ className: "text-sm font-medium dark:text-white text-gray-600 hover:text-gray-900 transition-colors",
29007
29060
  children: item.header
29008
29061
  },
29009
29062
  item.id
29010
29063
  )) }),
29011
29064
  /* @__PURE__ */ jsxs33("div", { className: "flex items-center space-x-3", children: [
29012
29065
  !isMobileView ? /* @__PURE__ */ jsx58("div", { className: "flex-1 px-6", children: /* @__PURE__ */ jsxs33("div", { className: "relative w-full max-w-md border border-gray-300 rounded-md", children: [
29013
- /* @__PURE__ */ jsx58(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" }),
29066
+ /* @__PURE__ */ jsx58(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 dark:text-white text-gray-400" }),
29014
29067
  /* @__PURE__ */ jsx58(Input, { placeholder: "Search", className: "pl-9 text-gray-400" })
29015
29068
  ] }) }) : /* @__PURE__ */ jsx58(
29016
29069
  Button,
@@ -29021,13 +29074,13 @@ function Navbar({
29021
29074
  children: /* @__PURE__ */ jsx58(Search, { className: "h-5 w-5 text-gray-400" })
29022
29075
  }
29023
29076
  ),
29024
- /* @__PURE__ */ jsxs33("div", { className: "relative bg-[#E9E9E9] rounded-md", children: [
29025
- /* @__PURE__ */ jsx58(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ jsx58(Bell, { className: "h-5 w-5 text-[#1C1B1F]" }) }),
29077
+ /* @__PURE__ */ jsxs33("div", { className: "relative bg-[#E9E9E9] dark:bg-gray-700 rounded-md", children: [
29078
+ /* @__PURE__ */ jsx58(Button, { variant: "ghost", size: "icon", children: /* @__PURE__ */ jsx58(Bell, { className: "h-5 w-5 text-[#1C1B1F] dark:text-gray-400" }) }),
29026
29079
  badgeType === "number" && !(hideBadgeWhenZero && badgeCount === 0) && Number(badgeCount) > 0 ? /* @__PURE__ */ jsx58("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__ */ jsx58("span", { className: "absolute -top-1 -right-1 flex h-2 w-2 items-center justify-center rounded-full bg-red-500" })
29027
29080
  ] }),
29028
29081
  /* @__PURE__ */ jsxs33(DropdownMenu, { children: [
29029
29082
  /* @__PURE__ */ jsx58(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs33("div", { className: "flex items-center space-x-2", children: [
29030
- !isMobileView && showName && /* @__PURE__ */ jsx58("h4", { className: "text-[#000000] text-[13px] font-[500] mb-0", children: userName }),
29083
+ !isMobileView && showName && /* @__PURE__ */ jsx58("h4", { className: "text-[#000000] dark:text-gray-300 text-[13px] font-[500] mb-0", children: userName }),
29031
29084
  !isMobileView ? /* @__PURE__ */ jsxs33(Fragment18, { children: [
29032
29085
  /* @__PURE__ */ jsx58(Avatar, { className: "cursor-pointer h-8 w-8 text-gray-900", children: profileType === "avatar" ? /* @__PURE__ */ jsx58(
29033
29086
  AvatarImage,
@@ -29041,7 +29094,7 @@ function Navbar({
29041
29094
  {
29042
29095
  variant: "ghost",
29043
29096
  size: "icon",
29044
- className: "text-gray-900 md:hidden",
29097
+ className: "text-gray-900 md:hidden dark:invert",
29045
29098
  children: /* @__PURE__ */ jsx58(Menu, { className: "h-6 w-6" })
29046
29099
  }
29047
29100
  )
@@ -29050,16 +29103,16 @@ function Navbar({
29050
29103
  {
29051
29104
  variant: "ghost",
29052
29105
  size: "icon",
29053
- className: "text-gray-900",
29106
+ className: "text-gray-900 dark:invert",
29054
29107
  children: /* @__PURE__ */ jsx58(Menu, { className: "h-6 w-6" })
29055
29108
  }
29056
29109
  )
29057
29110
  ] }) }),
29058
- /* @__PURE__ */ jsxs33(DropdownMenuContent, { align: "end", className: "bg-white", children: [
29059
- profileMenu && profileMenu.length > 0 && /* @__PURE__ */ jsx58(Fragment18, { children: profileMenu.map((item) => /* @__PURE__ */ jsx58(DropdownMenuItem, { className: "text-black", children: /* @__PURE__ */ jsx58(Link6, { href: item.url || "#", children: item.header }) }, item.id)) }),
29111
+ /* @__PURE__ */ jsxs33(DropdownMenuContent, { align: "end", className: "bg-white dark:bg-gray-800", children: [
29112
+ profileMenu && profileMenu.length > 0 && /* @__PURE__ */ jsx58(Fragment18, { children: profileMenu.map((item) => /* @__PURE__ */ jsx58(DropdownMenuItem, { className: "text-black dark:invert", children: /* @__PURE__ */ jsx58(Link6, { href: item.url || "#", children: item.header }) }, item.id)) }),
29060
29113
  /* @__PURE__ */ jsxs33("div", { className: "md:hidden", children: [
29061
29114
  /* @__PURE__ */ jsx58(DropdownMenuSeparator, {}),
29062
- list && list.length > 0 && /* @__PURE__ */ jsx58(Fragment18, { children: list.map((item) => /* @__PURE__ */ jsx58(DropdownMenuItem, { className: "text-black", children: /* @__PURE__ */ jsx58(Link6, { href: item.url || "#", children: item.header }) }, item.id)) })
29115
+ list && list.length > 0 && /* @__PURE__ */ jsx58(Fragment18, { children: list.map((item) => /* @__PURE__ */ jsx58(DropdownMenuItem, { className: "text-black dark:invert", children: /* @__PURE__ */ jsx58(Link6, { href: item.url || "#", children: item.header }) }, item.id)) })
29063
29116
  ] })
29064
29117
  ] })
29065
29118
  ] })