laif-ds 0.1.55 → 0.1.56

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.
@@ -0,0 +1,62 @@
1
+ "use client";
2
+ var m = /* @__PURE__ */ ((e) => (e.AND = "AND", e.OR = "OR", e))(m || {});
3
+ function f(e, i, r, t, a) {
4
+ const u = e.getValue(i), o = t == null ? void 0 : t.find((n) => n.column === i), s = (o == null ? void 0 : o.innerFiltersMode) ?? "OR";
5
+ if (a) return !0;
6
+ if (Array.isArray(u))
7
+ return s === "AND" ? r.every((n) => u.includes(n)) : r.some((n) => u.includes(n));
8
+ switch (s) {
9
+ case "AND":
10
+ return r.every((n) => String(u) === n);
11
+ case "OR":
12
+ default:
13
+ return r.some((n) => String(u) === n);
14
+ }
15
+ }
16
+ function h(e, i) {
17
+ return e.reduce(
18
+ (r, t) => (t.filterFn && (r[t.column] = (a, u, o) => {
19
+ if (i) return !0;
20
+ const s = a.getValue(u);
21
+ switch (t.innerFiltersMode ?? "OR") {
22
+ case "AND":
23
+ return o.every(
24
+ (c) => t.filterFn(s, [c])
25
+ );
26
+ case "OR":
27
+ default:
28
+ return o.some(
29
+ (c) => t.filterFn(s, [c])
30
+ );
31
+ }
32
+ }), r),
33
+ {}
34
+ ) || {};
35
+ }
36
+ function A(e, i) {
37
+ const {
38
+ rowHeight: r = 1,
39
+ headerHeight: t = 1,
40
+ containerHeight: a = 1,
41
+ onPageChange: u,
42
+ setPagination: o
43
+ } = i, s = (e == null ? void 0 : e.offsetHeight) || a, n = Math.floor(
44
+ (s - t) / r
45
+ ), c = n > 1 ? n : 1;
46
+ o((g) => g.pageSize !== c ? (u && u(0, c), { ...g, pageSize: c }) : g);
47
+ }
48
+ function F(e, i) {
49
+ let r;
50
+ return function(...t) {
51
+ clearTimeout(r), r = setTimeout(() => {
52
+ e(...t);
53
+ }, i);
54
+ };
55
+ }
56
+ export {
57
+ m as ELogicalFilterOperator,
58
+ h as createCustomFilterFns,
59
+ f as createMultiValueFilterFn,
60
+ F as debounce,
61
+ A as updatePageSizeFromContainer
62
+ };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as o, jsxs as M, Fragment as N } from "react/jsx-runtime";
3
3
  import { useContext as R, useRef as a, useState as s, useCallback as k, useMemo as y, useEffect as u } from "react";
4
- import A from "../../../../../_virtual/index8.js";
4
+ import A from "../../../../../_virtual/index7.js";
5
5
  import B from "../../../../../_virtual/debounce.js";
6
6
  import { GanttContext as F } from "../Gantt/GanttContext.js";
7
7
  import { transformData as O } from "../../utils/transformData.js";
@@ -1,23 +1,25 @@
1
1
  "use client";
2
- import { jsx as i, jsxs as e } from "react/jsx-runtime";
3
- import { cn as t } from "../../lib/utils.js";
4
- import { buttonVariants as l } from "./button.js";
5
- import c from "../../node_modules/lucide-react/dist/esm/icons/ellipsis.js";
6
- import p from "../../node_modules/lucide-react/dist/esm/icons/chevron-right.js";
7
- import m from "../../node_modules/lucide-react/dist/esm/icons/chevron-left.js";
8
- function N({ className: a, ...n }) {
2
+ import { jsx as i, jsxs as o } from "react/jsx-runtime";
3
+ import { cn as e } from "../../lib/utils.js";
4
+ import { buttonVariants as c } from "./button.js";
5
+ import p from "../../node_modules/lucide-react/dist/esm/icons/ellipsis.js";
6
+ import m from "../../node_modules/lucide-react/dist/esm/icons/chevron-right.js";
7
+ import u from "../../node_modules/lucide-react/dist/esm/icons/chevron-left.js";
8
+ import g from "../../node_modules/lucide-react/dist/esm/icons/chevron-first.js";
9
+ import d from "../../node_modules/lucide-react/dist/esm/icons/chevron-last.js";
10
+ function C({ className: a, ...n }) {
9
11
  return /* @__PURE__ */ i(
10
12
  "nav",
11
13
  {
12
14
  role: "navigation",
13
15
  "aria-label": "pagination",
14
16
  "data-slot": "pagination",
15
- className: t("mx-auto flex w-full justify-center", a),
17
+ className: e("mx-auto flex w-full justify-center", a),
16
18
  ...n
17
19
  }
18
20
  );
19
21
  }
20
- function P({
22
+ function L({
21
23
  className: a,
22
24
  ...n
23
25
  }) {
@@ -25,19 +27,20 @@ function P({
25
27
  "ul",
26
28
  {
27
29
  "data-slot": "pagination-content",
28
- className: t("flex flex-row items-center gap-1", a),
30
+ className: e("flex flex-row items-center gap-1", a),
29
31
  ...n
30
32
  }
31
33
  );
32
34
  }
33
- function v({ ...a }) {
35
+ function j({ ...a }) {
34
36
  return /* @__PURE__ */ i("li", { "data-slot": "pagination-item", ...a });
35
37
  }
36
- function o({
38
+ function r({
37
39
  className: a,
38
40
  isActive: n,
39
- size: r = "icon",
40
- ...s
41
+ isDisabled: t,
42
+ size: s = "icon",
43
+ ...l
41
44
  }) {
42
45
  return /* @__PURE__ */ i(
43
46
  "a",
@@ -45,77 +48,117 @@ function o({
45
48
  "aria-current": n ? "page" : void 0,
46
49
  "data-slot": "pagination-link",
47
50
  "data-active": n,
48
- className: t(
49
- l({
51
+ className: e(
52
+ c({
50
53
  variant: n ? "outline" : "ghost",
51
- size: r
54
+ // variant: isDisabled ? "disabled" : isActive ? "outline" : "ghost",
55
+ size: s
52
56
  }),
57
+ t && "pointer-events-none cursor-not-allowed opacity-40",
53
58
  a
54
59
  ),
55
- ...s
60
+ ...l
56
61
  }
57
62
  );
58
63
  }
59
- function b({
64
+ function y({
60
65
  className: a,
61
- ...n
66
+ label: n,
67
+ ...t
62
68
  }) {
63
- return /* @__PURE__ */ e(
64
- o,
69
+ return /* @__PURE__ */ o(
70
+ r,
65
71
  {
66
72
  "aria-label": "Go to previous page",
67
- size: "default",
68
- className: t("gap-1 px-2.5 sm:pl-2.5", a),
69
- ...n,
73
+ className: e("gap-1 px-2.5 sm:pl-2.5", a),
74
+ ...t,
70
75
  children: [
71
- /* @__PURE__ */ i(m, {}),
72
- /* @__PURE__ */ i("span", { className: "hidden sm:block", children: "Previous" })
76
+ /* @__PURE__ */ i(g, {}),
77
+ /* @__PURE__ */ i("span", { className: "hidden sm:block", children: n ?? "First" })
73
78
  ]
74
79
  }
75
80
  );
76
81
  }
77
- function j({
82
+ function G({
78
83
  className: a,
79
- ...n
84
+ label: n,
85
+ ...t
86
+ }) {
87
+ return /* @__PURE__ */ o(
88
+ r,
89
+ {
90
+ "aria-label": "Go to previous page",
91
+ className: e("gap-1 px-2.5 sm:pl-2.5", a),
92
+ ...t,
93
+ children: [
94
+ /* @__PURE__ */ i(u, {}),
95
+ /* @__PURE__ */ i("span", { className: "hidden sm:block", children: n ?? "Previous" })
96
+ ]
97
+ }
98
+ );
99
+ }
100
+ function w({
101
+ className: a,
102
+ label: n,
103
+ ...t
80
104
  }) {
81
- return /* @__PURE__ */ e(
82
- o,
105
+ return /* @__PURE__ */ o(
106
+ r,
83
107
  {
84
108
  "aria-label": "Go to next page",
85
- size: "default",
86
- className: t("gap-1 px-2.5 sm:pr-2.5", a),
87
- ...n,
109
+ className: e("gap-1 px-2.5 sm:pr-2.5", a),
110
+ ...t,
111
+ children: [
112
+ /* @__PURE__ */ i("span", { className: "hidden sm:block", children: n ?? "Next" }),
113
+ /* @__PURE__ */ i(m, {})
114
+ ]
115
+ }
116
+ );
117
+ }
118
+ function F({
119
+ className: a,
120
+ label: n,
121
+ ...t
122
+ }) {
123
+ return /* @__PURE__ */ o(
124
+ r,
125
+ {
126
+ "aria-label": "Go to next page",
127
+ className: e("gap-1 px-2.5 sm:pr-2.5", a),
128
+ ...t,
88
129
  children: [
89
- /* @__PURE__ */ i("span", { className: "hidden sm:block", children: "Next" }),
90
- /* @__PURE__ */ i(p, {})
130
+ /* @__PURE__ */ i("span", { className: "hidden sm:block", children: n ?? "Last" }),
131
+ /* @__PURE__ */ i(d, {})
91
132
  ]
92
133
  }
93
134
  );
94
135
  }
95
- function k({
136
+ function z({
96
137
  className: a,
97
138
  ...n
98
139
  }) {
99
- return /* @__PURE__ */ e(
140
+ return /* @__PURE__ */ o(
100
141
  "span",
101
142
  {
102
143
  "aria-hidden": !0,
103
144
  "data-slot": "pagination-ellipsis",
104
- className: t("flex size-9 items-center justify-center", a),
145
+ className: e("flex size-9 items-center justify-center", a),
105
146
  ...n,
106
147
  children: [
107
- /* @__PURE__ */ i(c, { className: "size-4" }),
148
+ /* @__PURE__ */ i(p, { className: "size-4" }),
108
149
  /* @__PURE__ */ i("span", { className: "sr-only", children: "More pages" })
109
150
  ]
110
151
  }
111
152
  );
112
153
  }
113
154
  export {
114
- N as Pagination,
115
- P as PaginationContent,
116
- k as PaginationEllipsis,
117
- v as PaginationItem,
118
- o as PaginationLink,
119
- j as PaginationNext,
120
- b as PaginationPrevious
155
+ C as Pagination,
156
+ L as PaginationContent,
157
+ z as PaginationEllipsis,
158
+ y as PaginationFirst,
159
+ j as PaginationItem,
160
+ F as PaginationLast,
161
+ r as PaginationLink,
162
+ w as PaginationNext,
163
+ G as PaginationPrevious
121
164
  };
package/dist/index.d.ts CHANGED
@@ -45,6 +45,7 @@ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
45
45
  import * as SelectPrimitive from '@radix-ui/react-select';
46
46
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
47
47
  import { SeparatorProps } from '@radix-ui/react-separator';
48
+ import { SetStateAction } from 'react';
48
49
  import * as SliderPrimitive from '@radix-ui/react-slider';
49
50
  import { Slot } from '@radix-ui/react-slot';
50
51
  import * as SwitchPrimitive from '@radix-ui/react-switch';
@@ -650,7 +651,7 @@ export declare enum DataRepeatTypes {
650
651
  MONTH = "MONTH"
651
652
  }
652
653
 
653
- export declare function DataTable<TData, TValue>({ columns, data, loading, emptyComponent, className, rowSelection, onRowSelectionChange, checkable, onCheckedRowsChange, notFoundMessage, searchBar, dropdownFilters, }: DataTableProps<TData, TValue>): JSX.Element;
654
+ export declare function DataTable<TData, TValue>({ columns, data, loading, emptyComponent, className, rowSelection, onRowSelectionChange, checkable, onCheckedRowsChange, notFoundMessage, searchBar, dropdownFilters, totalItems, datatableSizes, paginationPlaceholders, serverOptions, setServerOptions, }: DataTableProps<TData, TValue>): JSX.Element;
654
655
 
655
656
  declare interface DataTableProps<TData, TValue> {
656
657
  columns: ColumnDef<TData, TValue>[];
@@ -663,8 +664,13 @@ declare interface DataTableProps<TData, TValue> {
663
664
  checkable?: boolean;
664
665
  onCheckedRowsChange?: (checkedRows: TData[]) => void;
665
666
  notFoundMessage?: string;
666
- searchBar?: SearchBarProps;
667
- dropdownFilters?: DropdownFilterProp[];
667
+ searchBar?: ISearchBarProps;
668
+ dropdownFilters?: IDropdownFilterProp[];
669
+ totalItems?: number;
670
+ datatableSizes?: IDatatableSizes;
671
+ paginationPlaceholders?: IDatatablePaginationPlaceholders;
672
+ serverOptions?: IServerOptionsProps;
673
+ setServerOptions?: (value: SetStateAction<IServerOptionsProps>) => void;
668
674
  }
669
675
 
670
676
  export declare function DatePicker({ value, onChange, placeholder, dateFormat, className, buttonVariant, disabled, size, }: DatePickerProps): JSX.Element;
@@ -720,20 +726,6 @@ export declare function DrawerTitle({ className, ...props }: React_2.ComponentPr
720
726
 
721
727
  export declare function DrawerTrigger({ ...props }: React_2.ComponentProps<typeof Drawer_2.Trigger>): JSX.Element;
722
728
 
723
- declare interface DropdownFilterItem {
724
- label: string;
725
- value: string;
726
- }
727
-
728
- declare interface DropdownFilterProp {
729
- column: string;
730
- placeholder: string;
731
- label?: string;
732
- innerFiltersMode?: ELogicalFilterOperator;
733
- items: DropdownFilterItem[];
734
- filterFn?: (rowValue: unknown, filterValue: string[]) => boolean;
735
- }
736
-
737
729
  export declare const DropdownMenu: React_2.FC<DropdownMenuPrimitive.DropdownMenuProps>;
738
730
 
739
731
  export declare const DropdownMenuContent: React_2.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React_2.RefAttributes<HTMLDivElement>, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
@@ -883,6 +875,35 @@ declare interface IconProps {
883
875
 
884
876
  declare type IconSize = keyof typeof sizeMap;
885
877
 
878
+ declare interface IDatatablePaginationPlaceholders {
879
+ rows?: string;
880
+ pages?: string;
881
+ first?: string;
882
+ previous?: string;
883
+ next?: string;
884
+ last?: string;
885
+ }
886
+
887
+ declare interface IDatatableSizes {
888
+ rowHeight?: number;
889
+ headerHeight?: number;
890
+ containerHeight?: number;
891
+ }
892
+
893
+ declare interface IDropdownFilterItem {
894
+ label: string;
895
+ value: string;
896
+ }
897
+
898
+ declare interface IDropdownFilterProp {
899
+ column: string;
900
+ placeholder: string;
901
+ label?: string;
902
+ innerFiltersMode?: ELogicalFilterOperator;
903
+ items: IDropdownFilterItem[];
904
+ filterFn?: (rowValue: unknown, filterValue: string[]) => boolean;
905
+ }
906
+
886
907
  export declare const Input: React_2.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React_2.RefAttributes<HTMLInputElement>>;
887
908
 
888
909
  export declare function InputOTP({ className, containerClassName, ...props }: React_2.ComponentProps<typeof OTPInput> & {
@@ -925,6 +946,35 @@ declare interface InterruptPromptProps {
925
946
  close: () => void;
926
947
  }
927
948
 
949
+ declare interface IPaginationProps {
950
+ pageIndex: number;
951
+ pageSize: number;
952
+ }
953
+
954
+ declare interface ISearchBarProps {
955
+ placeholder?: string;
956
+ columns: string[];
957
+ }
958
+
959
+ declare interface IServerFilterProps {
960
+ searchbarFilters?: {
961
+ value: string;
962
+ columns: string[];
963
+ };
964
+ dropdownFilters?: {
965
+ [column: string]: {
966
+ logic: ELogicalFilterOperator;
967
+ value: string[];
968
+ column: string;
969
+ };
970
+ };
971
+ }
972
+
973
+ declare interface IServerOptionsProps {
974
+ pagination: IPaginationProps;
975
+ filters?: IServerFilterProps;
976
+ }
977
+
928
978
  export declare function Label({ className, ...props }: React_2.ComponentProps<typeof LabelPrimitive.Root>): JSX.Element;
929
979
 
930
980
  export declare function MarkdownRenderer({ children }: MarkdownRendererProps): JSX.Element;
@@ -1182,15 +1232,17 @@ export declare function PaginationEllipsis({ className, ...props }: React_2.Comp
1182
1232
 
1183
1233
  export declare function PaginationItem({ ...props }: React_2.ComponentProps<"li">): JSX.Element;
1184
1234
 
1185
- export declare function PaginationLink({ className, isActive, size, ...props }: PaginationLinkProps): JSX.Element;
1235
+ export declare function PaginationLink({ className, isActive, isDisabled, size, ...props }: PaginationLinkProps): JSX.Element;
1186
1236
 
1187
1237
  declare type PaginationLinkProps = {
1188
1238
  isActive?: boolean;
1239
+ isDisabled?: boolean;
1240
+ label?: string;
1189
1241
  } & Pick<React_2.ComponentProps<typeof Button>, "size"> & React_2.ComponentProps<"a">;
1190
1242
 
1191
- export declare function PaginationNext({ className, ...props }: React_2.ComponentProps<typeof PaginationLink>): JSX.Element;
1243
+ export declare function PaginationNext({ className, label, ...props }: React_2.ComponentProps<typeof PaginationLink>): JSX.Element;
1192
1244
 
1193
- export declare function PaginationPrevious({ className, ...props }: React_2.ComponentProps<typeof PaginationLink>): JSX.Element;
1245
+ export declare function PaginationPrevious({ className, label, ...props }: React_2.ComponentProps<typeof PaginationLink>): JSX.Element;
1194
1246
 
1195
1247
  declare interface PartialToolCall {
1196
1248
  state: "partial-call";
@@ -1298,11 +1350,6 @@ export declare function ScrollArea({ className, children, ...props }: React_2.Co
1298
1350
 
1299
1351
  export declare function ScrollBar({ className, orientation, ...props }: React_2.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>): JSX.Element;
1300
1352
 
1301
- declare interface SearchBarProps {
1302
- placeholder?: string;
1303
- columns: string[];
1304
- }
1305
-
1306
1353
  export declare function Select({ size, label, labelClassName, ...props }: SelectProps): JSX.Element;
1307
1354
 
1308
1355
  export declare function SelectContent({ className, children, position, ...props }: React_2.ComponentProps<typeof SelectPrimitive.Content>): JSX.Element;
@@ -3,7 +3,7 @@ import { stringify as w } from "../../comma-separated-tokens/index.js";
3
3
  import { ok as u } from "../../devlop/lib/default.js";
4
4
  import { svg as m, html as C } from "../../property-information/index.js";
5
5
  import { stringify as N } from "../../space-separated-tokens/index.js";
6
- import S from "../../../_virtual/index4.js";
6
+ import S from "../../../_virtual/index5.js";
7
7
  import { whitespace as j } from "../../hast-util-whitespace/lib/index.js";
8
8
  import { name as x } from "../../estree-util-is-identifier-name/lib/index.js";
9
9
  import { VFileMessage as h } from "../../vfile-message/lib/index.js";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __exports as r } from "../../../_virtual/index7.js";
2
+ import { __exports as r } from "../../../_virtual/index8.js";
3
3
  import { __require as c } from "../../inline-style-parser/index.js";
4
4
  var f;
5
5
  function j() {
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { bail as P } from "../../bail/index.js";
3
- import y from "../../../_virtual/index5.js";
3
+ import y from "../../../_virtual/index6.js";
4
4
  import z from "../../is-plain-obj/index.js";
5
5
  import { CallableInstance as C } from "./callable-instance.js";
6
6
  import { trough as A } from "../../trough/lib/index.js";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { __module as e } from "../../../_virtual/index6.js";
2
+ import { __module as e } from "../../../_virtual/index4.js";
3
3
  import { __require as i } from "../cjs/use-sync-external-store-shim.production.js";
4
4
  import { __require as o } from "../cjs/use-sync-external-store-shim.development.js";
5
5
  var r;