ikoncomponents 1.1.5 → 1.1.7

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.
Files changed (83) hide show
  1. package/dist/hooks/use-mobile.js +2 -38
  2. package/dist/ikoncomponents/action-menu/index.js +15 -18
  3. package/dist/ikoncomponents/action-menu/type.js +1 -2
  4. package/dist/ikoncomponents/alert-dialog/index.js +6 -10
  5. package/dist/ikoncomponents/buttons/index.js +32 -23
  6. package/dist/ikoncomponents/combobox-input/index.js +14 -16
  7. package/dist/ikoncomponents/combobox-input/type.js +1 -2
  8. package/dist/ikoncomponents/data-table/datatable-column-filter/index.js +13 -16
  9. package/dist/ikoncomponents/data-table/datatable-faceted-filter/index.js +22 -58
  10. package/dist/ikoncomponents/data-table/datatable-filter-menu/index.js +18 -21
  11. package/dist/ikoncomponents/data-table/datatable-pagination/index.js +10 -13
  12. package/dist/ikoncomponents/data-table/datatable-toolbar/index.js +17 -19
  13. package/dist/ikoncomponents/data-table/function.js +4 -7
  14. package/dist/ikoncomponents/data-table/index.js +81 -116
  15. package/dist/ikoncomponents/data-table/type.js +1 -2
  16. package/dist/ikoncomponents/e-chart/index.js +32 -37
  17. package/dist/ikoncomponents/file-input/index.js +20 -11
  18. package/dist/ikoncomponents/glowing-effect/index.js +16 -18
  19. package/dist/ikoncomponents/icon/index.js +16 -40
  20. package/dist/ikoncomponents/loading-spinner/index.js +16 -8
  21. package/dist/ikoncomponents/multi-combobox/index.js +31 -30
  22. package/dist/ikoncomponents/no-data/index.js +4 -7
  23. package/dist/ikoncomponents/page-wrapper/index.js +5 -8
  24. package/dist/ikoncomponents/password-strength-meter/index.js +6 -13
  25. package/dist/ikoncomponents/phone-input/index.js +30 -54
  26. package/dist/ikoncomponents/resource-spreadsheet/index.js +11 -48
  27. package/dist/ikoncomponents/search-input/index.js +18 -9
  28. package/dist/ikoncomponents/sheet/index.js +5 -8
  29. package/dist/ikoncomponents/simple-widget/index.js +8 -11
  30. package/dist/ikoncomponents/tabs/index.js +20 -22
  31. package/dist/ikoncomponents/tabs/type.js +1 -2
  32. package/dist/ikoncomponents/theme-toggle-btn/index.js +8 -11
  33. package/dist/ikoncomponents/title-progress/index.js +4 -7
  34. package/dist/ikoncomponents/tooltip/index.js +4 -7
  35. package/dist/ikoncomponents/twolevel-dropdown/index.js +20 -53
  36. package/dist/ikoncomponents/widgets/index.js +10 -13
  37. package/dist/ikoncomponents/widgets/type.js +1 -2
  38. package/dist/index.d.ts +3 -3
  39. package/dist/index.js +70 -123
  40. package/dist/shadcn/accordion.js +28 -51
  41. package/dist/shadcn/alert-dialog.js +60 -70
  42. package/dist/shadcn/alert.d.ts +1 -1
  43. package/dist/shadcn/alert.js +25 -15
  44. package/dist/shadcn/avatar.js +24 -47
  45. package/dist/shadcn/badge.d.ts +1 -1
  46. package/dist/shadcn/badge.js +21 -13
  47. package/dist/shadcn/button.d.ts +1 -1
  48. package/dist/shadcn/button.js +21 -13
  49. package/dist/shadcn/calendar.js +42 -97
  50. package/dist/shadcn/card.js +35 -25
  51. package/dist/shadcn/checkbox.js +19 -42
  52. package/dist/shadcn/command.js +53 -43
  53. package/dist/shadcn/date-input.js +25 -60
  54. package/dist/shadcn/date-range-picker.js +14 -18
  55. package/dist/shadcn/dialog.js +56 -79
  56. package/dist/shadcn/dropdown-menu.js +61 -84
  57. package/dist/shadcn/hover-card.js +24 -47
  58. package/dist/shadcn/input.js +17 -7
  59. package/dist/shadcn/label.js +18 -41
  60. package/dist/shadcn/navigation-menu.d.ts +1 -1
  61. package/dist/shadcn/navigation-menu.js +43 -68
  62. package/dist/shadcn/popover.js +27 -50
  63. package/dist/shadcn/progress.js +19 -42
  64. package/dist/shadcn/radio-group.js +23 -45
  65. package/dist/shadcn/scroll-area.js +22 -45
  66. package/dist/shadcn/select.js +58 -81
  67. package/dist/shadcn/separator.js +18 -41
  68. package/dist/shadcn/sheet.js +52 -73
  69. package/dist/shadcn/sidebar.d.ts +1 -1
  70. package/dist/shadcn/sidebar.js +113 -141
  71. package/dist/shadcn/skeleton.js +17 -7
  72. package/dist/shadcn/slider.js +19 -42
  73. package/dist/shadcn/sonner.js +20 -11
  74. package/dist/shadcn/switch.js +18 -41
  75. package/dist/shadcn/table.js +46 -36
  76. package/dist/shadcn/tabs.js +27 -50
  77. package/dist/shadcn/textarea.js +17 -7
  78. package/dist/shadcn/tooltip.js +27 -50
  79. package/dist/shadcn/workflow.js +8 -8
  80. package/dist/styles.css +3 -0
  81. package/dist/utils/cn.js +4 -7
  82. package/dist/utils/theme-provider/index.js +16 -7
  83. package/package.json +2 -1
@@ -1,42 +1,6 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.useIsMobile = useIsMobile;
37
- const React = __importStar(require("react"));
1
+ import * as React from "react";
38
2
  const MOBILE_BREAKPOINT = 768;
39
- function useIsMobile() {
3
+ export function useIsMobile() {
40
4
  const [isMobile, setIsMobile] = React.useState(undefined);
41
5
  React.useEffect(() => {
42
6
  const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
@@ -1,45 +1,42 @@
1
- "use strict";
2
1
  "use client";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ActionMenu = ActionMenu;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const dropdown_menu_1 = require("../../shadcn/dropdown-menu");
7
- const lucide_react_1 = require("lucide-react");
8
- const buttons_1 = require("../buttons");
9
- function ActionMenu({ actionMenus, extraActionParams, }) {
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "../../shadcn/dropdown-menu";
4
+ import { MoreHorizontal } from "lucide-react";
5
+ import { IconButtonWithTooltip } from "../buttons";
6
+ export function ActionMenu({ actionMenus, extraActionParams, }) {
10
7
  const renderMenuItems = (items) => {
11
8
  items = items.filter((item) => {
12
9
  // biome-ignore lint/complexity/useOptionalChain: <explanation>
13
- return (item?.visibility === undefined || item.visibility === true || (item.visibility && item.visibility(...(extraActionParams?.arguments || []))));
10
+ return ((item === null || item === void 0 ? void 0 : item.visibility) === undefined || item.visibility === true || (item.visibility && item.visibility(...((extraActionParams === null || extraActionParams === void 0 ? void 0 : extraActionParams.arguments) || []))));
14
11
  });
15
12
  if (items.length === 0) {
16
- return (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuItem, { className: "text-center", children: "No action available." });
13
+ return _jsx(DropdownMenuItem, { className: "text-center", children: "No action available." });
17
14
  }
18
15
  return items.map((item, index) => {
19
16
  if (item.type === "label") {
20
- return (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuLabel, { children: String(item.label) }, index);
17
+ return _jsx(DropdownMenuLabel, { children: String(item.label) }, index);
21
18
  }
22
19
  if (item.type === "separator") {
23
- return (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuSeparator, {}, index);
20
+ return _jsx(DropdownMenuSeparator, {}, index);
24
21
  }
25
22
  if (item.type === "group" && item.items) {
26
- return ((0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuGroup, { children: renderMenuItems(item.items) }, index));
23
+ return (_jsx(DropdownMenuGroup, { children: renderMenuItems(item.items) }, index));
27
24
  }
28
25
  if (item.items) {
29
- return ((0, jsx_runtime_1.jsxs)(dropdown_menu_1.DropdownMenuSub, { children: [(0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuSubTrigger, { children: String(item.label) }), (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuPortal, { children: (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuSubContent, { children: renderMenuItems(item.items) }) })] }, index));
26
+ return (_jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { children: String(item.label) }), _jsx(DropdownMenuPortal, { children: _jsx(DropdownMenuSubContent, { children: renderMenuItems(item.items) }) })] }, index));
30
27
  }
31
28
  let labelContent = "";
32
29
  if (typeof item.label === "function") {
33
- labelContent = item.label(...(extraActionParams?.arguments || []));
30
+ labelContent = item.label(...((extraActionParams === null || extraActionParams === void 0 ? void 0 : extraActionParams.arguments) || []));
34
31
  }
35
32
  else {
36
33
  labelContent = item.label;
37
34
  }
38
- return ((0, jsx_runtime_1.jsxs)(dropdown_menu_1.DropdownMenuItem, { disabled: item.disabled, onClick: () =>
35
+ return (_jsxs(DropdownMenuItem, { disabled: item.disabled, onClick: () =>
39
36
  // biome-ignore lint/complexity/useOptionalChain: <explanation>
40
37
  item.onClick &&
41
- item.onClick(...(extraActionParams?.arguments || [])), children: [item.icon && (0, jsx_runtime_1.jsx)(item.icon, {}), labelContent] }, index));
38
+ item.onClick(...((extraActionParams === null || extraActionParams === void 0 ? void 0 : extraActionParams.arguments) || [])), children: [item.icon && _jsx(item.icon, {}), labelContent] }, index));
42
39
  });
43
40
  };
44
- return ((0, jsx_runtime_1.jsxs)(dropdown_menu_1.DropdownMenu, { children: [(0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuTrigger, { asChild: true, children: (0, jsx_runtime_1.jsx)(buttons_1.IconButtonWithTooltip, { variant: "ghost", tooltipContent: "Actions", className: "h-8 w-8 p-0 border-0 bg-transparent text-foreground keross:text-white elevation-0 shadow-none hover:bg-transparent", children: (0, jsx_runtime_1.jsx)(lucide_react_1.MoreHorizontal, {}) }) }), (0, jsx_runtime_1.jsx)(dropdown_menu_1.DropdownMenuContent, { className: "w-56", align: "end", children: renderMenuItems(actionMenus) })] }));
41
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(IconButtonWithTooltip, { variant: "ghost", tooltipContent: "Actions", className: "h-8 w-8 p-0 border-0 bg-transparent text-foreground keross:text-white elevation-0 shadow-none hover:bg-transparent", children: _jsx(MoreHorizontal, {}) }) }), _jsx(DropdownMenuContent, { className: "w-56", align: "end", children: renderMenuItems(actionMenus) })] }));
45
42
  }
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,24 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CustomAlertDialog = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const alert_dialog_1 = require("../../shadcn/alert-dialog");
6
- const CustomAlertDialog = ({ title, description, fontSize = "text-base", cancelText = "", // Default cancel button text
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "../../shadcn/alert-dialog";
3
+ export const CustomAlertDialog = ({ title, description, fontSize = "text-base", cancelText = "", // Default cancel button text
7
4
  confirmText = "", // Default confirm button text
8
5
  thirdOptionText = "", // Default third button text
9
6
  onCancel, // Optional callback for cancel action
10
7
  onConfirm, // Optional callback for confirm action
11
8
  onThird, // Optional callback for third action
12
9
  }) => {
13
- return ((0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialog, { open: true, children: (0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogContent, { children: [(0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogHeader, { children: [(0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogTitle, { className: fontSize, children: title }), (0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogDescription, { className: fontSize, children: description })] }), (0, jsx_runtime_1.jsxs)(alert_dialog_1.AlertDialogFooter, { children: [cancelText != "" && ((0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogCancel, { onClick: () => {
10
+ return (_jsx(AlertDialog, { open: true, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { className: fontSize, children: title }), _jsx(AlertDialogDescription, { className: fontSize, children: description })] }), _jsxs(AlertDialogFooter, { children: [cancelText != "" && (_jsx(AlertDialogCancel, { onClick: () => {
14
11
  if (onCancel)
15
12
  onCancel(); // Execute cancel callback if provided
16
- }, children: cancelText })), thirdOptionText != "" && ((0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogAction, { className: "bg-blue-500", color: "black", onClick: () => {
13
+ }, children: cancelText })), thirdOptionText != "" && (_jsx(AlertDialogAction, { className: "bg-blue-500", color: "black", onClick: () => {
17
14
  if (onThird)
18
15
  onThird(); // Execute confirm callback if provided
19
- }, children: thirdOptionText })), confirmText != "" && ((0, jsx_runtime_1.jsx)(alert_dialog_1.AlertDialogAction, { onClick: () => {
16
+ }, children: thirdOptionText })), confirmText != "" && (_jsx(AlertDialogAction, { onClick: () => {
20
17
  if (onConfirm)
21
18
  onConfirm(); // Execute confirm callback if provided
22
19
  }, children: confirmText }))] })] }) }));
23
20
  };
24
- exports.CustomAlertDialog = CustomAlertDialog;
@@ -1,29 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TextButton = TextButton;
4
- exports.TextButtonWithTooltip = TextButtonWithTooltip;
5
- exports.IconTextButton = IconTextButton;
6
- exports.IconTextButtonWithTooltip = IconTextButtonWithTooltip;
7
- exports.IconButton = IconButton;
8
- exports.IconButtonWithTooltip = IconButtonWithTooltip;
9
- const jsx_runtime_1 = require("react/jsx-runtime");
10
- const tooltip_1 = require("../tooltip");
11
- const button_1 = require("../../shadcn/button");
12
- function TextButton({ children, variant, asChild = false, size, ...props }) {
13
- return ((0, jsx_runtime_1.jsx)(button_1.Button, { variant: variant, size: size, ...props, asChild: asChild, children: children }));
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { TooltipComponent as Tooltip } from "../tooltip";
14
+ import { Button } from "../../shadcn/button";
15
+ export function TextButton(_a) {
16
+ var { children, variant, asChild = false, size } = _a, props = __rest(_a, ["children", "variant", "asChild", "size"]);
17
+ return (_jsx(Button, Object.assign({ variant: variant, size: size }, props, { asChild: asChild, children: children })));
14
18
  }
15
- function TextButtonWithTooltip({ children, variant, asChild = false, size, tooltipContent, ...props }) {
16
- return ((0, jsx_runtime_1.jsx)(tooltip_1.TooltipComponent, { tooltipContent: tooltipContent, children: (0, jsx_runtime_1.jsx)(TextButton, { variant: variant, size: size, ...props, asChild: asChild, children: children }) }));
19
+ export function TextButtonWithTooltip(_a) {
20
+ var { children, variant, asChild = false, size, tooltipContent } = _a, props = __rest(_a, ["children", "variant", "asChild", "size", "tooltipContent"]);
21
+ return (_jsx(Tooltip, { tooltipContent: tooltipContent, children: _jsx(TextButton, Object.assign({ variant: variant, size: size }, props, { asChild: asChild, children: children })) }));
17
22
  }
18
- function IconTextButton({ children, variant, asChild = false, size, ...props }) {
19
- return ((0, jsx_runtime_1.jsx)(button_1.Button, { variant: variant || "outline", size: size || "sm", ...props, asChild: asChild, children: children }));
23
+ export function IconTextButton(_a) {
24
+ var { children, variant, asChild = false, size } = _a, props = __rest(_a, ["children", "variant", "asChild", "size"]);
25
+ return (_jsx(Button, Object.assign({ variant: variant || "outline", size: size || "sm" }, props, { asChild: asChild, children: children })));
20
26
  }
21
- function IconTextButtonWithTooltip({ children, variant, size, asChild = false, tooltipContent, ...props }) {
22
- return ((0, jsx_runtime_1.jsx)(tooltip_1.TooltipComponent, { tooltipContent: tooltipContent, children: (0, jsx_runtime_1.jsx)(IconTextButton, { variant: variant, size: size, ...props, asChild: asChild, children: children }) }));
27
+ export function IconTextButtonWithTooltip(_a) {
28
+ var { children, variant, size, asChild = false, tooltipContent } = _a, props = __rest(_a, ["children", "variant", "size", "asChild", "tooltipContent"]);
29
+ return (_jsx(Tooltip, { tooltipContent: tooltipContent, children: _jsx(IconTextButton, Object.assign({ variant: variant, size: size }, props, { asChild: asChild, children: children })) }));
23
30
  }
24
- function IconButton({ children, variant, size, asChild = false, ...props }) {
25
- return ((0, jsx_runtime_1.jsx)(button_1.Button, { variant: variant || "outline", size: size || "icon", ...props, asChild: asChild, children: children }));
31
+ export function IconButton(_a) {
32
+ var { children, variant, size, asChild = false } = _a, props = __rest(_a, ["children", "variant", "size", "asChild"]);
33
+ return (_jsx(Button, Object.assign({ variant: variant || "outline", size: size || "icon" }, props, { asChild: asChild, children: children })));
26
34
  }
27
- function IconButtonWithTooltip({ children, tooltipContent, asChild = false, variant, size, ...props }) {
28
- return ((0, jsx_runtime_1.jsx)(tooltip_1.TooltipComponent, { tooltipContent: tooltipContent, children: (0, jsx_runtime_1.jsx)(IconButton, { variant: variant, size: size, ...props, asChild: asChild, children: children }) }));
35
+ export function IconButtonWithTooltip(_a) {
36
+ var { children, tooltipContent, asChild = false, variant, size } = _a, props = __rest(_a, ["children", "tooltipContent", "asChild", "variant", "size"]);
37
+ return (_jsx(Tooltip, { tooltipContent: tooltipContent, children: _jsx(IconButton, Object.assign({ variant: variant, size: size }, props, { asChild: asChild, children: children })) }));
29
38
  }
@@ -1,20 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComboboxInput = ComboboxInput;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const popover_1 = require("../../shadcn/popover");
7
- const button_1 = require("../../shadcn/button");
8
- const lucide_react_1 = require("lucide-react");
9
- const command_1 = require("../../shadcn/command");
10
- const cn_1 = require("../../utils/cn");
11
- function ComboboxInput({ placeholder, items, disabled, onSelect, defaultValue }) {
12
- const [value, setValue] = (0, react_1.useState)(defaultValue ? defaultValue : '');
13
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(popover_1.Popover, { children: [(0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { asChild: true, className: "w-full", children: (0, jsx_runtime_1.jsxs)(button_1.Button, { variant: "outline", role: "combobox", className: (0, cn_1.cn)("justify-between", !value && "text-muted-foreground", "bg-secondary"), disabled: disabled == true || (disabled && disabled(...arguments)), children: [value
14
- ? items.find((item) => item.value === value)?.label || value
15
- : placeholder, (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "opacity-50" })] }) }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { className: "p-0", align: "start", children: (0, jsx_runtime_1.jsxs)(command_1.Command, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandInput, { placeholder: "Search..." }), (0, jsx_runtime_1.jsxs)(command_1.CommandList, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandEmpty, { children: "No items found." }), (0, jsx_runtime_1.jsx)(command_1.CommandGroup, { children: items.map((item) => ((0, jsx_runtime_1.jsxs)(command_1.CommandItem, { value: item.value, disabled: item.disabled == true ||
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { Popover, PopoverContent, PopoverTrigger } from "../../shadcn/popover";
4
+ import { Button } from "../../shadcn/button";
5
+ import { Check, ChevronsUpDown } from "lucide-react";
6
+ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "../../shadcn/command";
7
+ import { cn } from "../../utils/cn";
8
+ export function ComboboxInput({ placeholder, items, disabled, onSelect, defaultValue }) {
9
+ var _a;
10
+ const [value, setValue] = useState(defaultValue ? defaultValue : '');
11
+ return (_jsx(_Fragment, { children: _jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, className: "w-full", children: _jsxs(Button, { variant: "outline", role: "combobox", className: cn("justify-between", !value && "text-muted-foreground", "bg-secondary"), disabled: disabled == true || (disabled && disabled(...arguments)), children: [value
12
+ ? ((_a = items.find((item) => item.value === value)) === null || _a === void 0 ? void 0 : _a.label) || value
13
+ : placeholder, _jsx(ChevronsUpDown, { className: "opacity-50" })] }) }), _jsx(PopoverContent, { className: "p-0", align: "start", children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: "Search..." }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "No items found." }), _jsx(CommandGroup, { children: items.map((item) => (_jsxs(CommandItem, { value: item.value, disabled: item.disabled == true ||
16
14
  (item.disabled && item.disabled(item)), onSelect: (value) => {
17
15
  setValue(value);
18
16
  onSelect && onSelect(value);
19
- }, children: [item?.label || item.value, (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: (0, cn_1.cn)("ml-auto", item.value === value ? "opacity-100" : "opacity-0") })] }, item.value))) })] })] }) })] }) }));
17
+ }, children: [(item === null || item === void 0 ? void 0 : item.label) || item.value, _jsx(Check, { className: cn("ml-auto", item.value === value ? "opacity-100" : "opacity-0") })] }, item.value))) })] })] }) })] }) }));
20
18
  }
@@ -1,2 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
@@ -1,25 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataTableColumnFilter = DataTableColumnFilter;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const command_1 = require("../../../shadcn/command");
6
- const popover_1 = require("../../../shadcn/popover");
7
- const lucide_react_1 = require("lucide-react");
8
- const function_1 = require("../function");
9
- const tooltip_1 = require("../../tooltip");
10
- const buttons_1 = require("../../buttons");
11
- const cn_1 = require("../../../utils/cn");
12
- function DataTableColumnFilter({ table, }) {
13
- return ((0, jsx_runtime_1.jsxs)(popover_1.Popover, { children: [(0, jsx_runtime_1.jsx)(tooltip_1.TooltipComponent, { tooltipContent: "Column View", children: (0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(buttons_1.IconTextButton, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Settings2, {}), "View"] }) }) }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { className: "w-[220px] p-0", align: "end", children: (0, jsx_runtime_1.jsxs)(command_1.Command, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandInput, { placeholder: "Search..." }), (0, jsx_runtime_1.jsxs)(command_1.CommandList, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandEmpty, { children: "No results found." }), (0, jsx_runtime_1.jsx)(command_1.CommandGroup, { children: table
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "../../../shadcn/command";
3
+ import { Popover, PopoverContent, PopoverTrigger } from "../../../shadcn/popover";
4
+ import { Check, Settings2 } from "lucide-react";
5
+ import { getDataTableColumnTitle } from "../function";
6
+ import { TooltipComponent as Tooltip } from "../../tooltip";
7
+ import { IconTextButton } from "../../buttons";
8
+ import { cn } from "../../../utils/cn";
9
+ export function DataTableColumnFilter({ table, }) {
10
+ return (_jsxs(Popover, { children: [_jsx(Tooltip, { tooltipContent: "Column View", children: _jsx(PopoverTrigger, { asChild: true, children: _jsxs(IconTextButton, { children: [_jsx(Settings2, {}), "View"] }) }) }), _jsx(PopoverContent, { className: "w-[220px] p-0", align: "end", children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: "Search..." }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "No results found." }), _jsx(CommandGroup, { children: table
14
11
  .getAllColumns()
15
12
  .filter((column) => typeof column.accessorFn !== "undefined" &&
16
13
  column.getCanHide())
17
14
  .map((column) => {
18
15
  const isVisbile = column.getIsVisible();
19
- return ((0, jsx_runtime_1.jsxs)(command_1.CommandItem, { onSelect: () => {
16
+ return (_jsxs(CommandItem, { onSelect: () => {
20
17
  column.toggleVisibility(!isVisbile);
21
- }, disabled: column.getIsGrouped(), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white", isVisbile
18
+ }, disabled: column.getIsGrouped(), children: [_jsx("div", { className: cn("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white", isVisbile
22
19
  ? "bg-black dark:bg-white text-white dark:text-black"
23
- : "opacity-50 [&_svg]:invisible"), children: (0, jsx_runtime_1.jsx)(lucide_react_1.Check, {}) }), (0, jsx_runtime_1.jsx)("span", { className: "overflow-hidden text-ellipsis", title: (0, function_1.getDataTableColumnTitle)(column), children: (0, function_1.getDataTableColumnTitle)(column) })] }, column.id));
20
+ : "opacity-50 [&_svg]:invisible"), children: _jsx(Check, {}) }), _jsx("span", { className: "overflow-hidden text-ellipsis", title: getDataTableColumnTitle(column), children: getDataTableColumnTitle(column) })] }, column.id));
24
21
  }) })] })] }) })] }));
25
22
  }
@@ -1,61 +1,25 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.DataTableFacetedFilter = DataTableFacetedFilter;
37
- const jsx_runtime_1 = require("react/jsx-runtime");
38
- const React = __importStar(require("react"));
39
- const lucide_react_1 = require("lucide-react");
40
- const cn_1 = require("../../../utils/cn");
41
- const badge_1 = require("../../../shadcn/badge");
42
- const command_1 = require("../../../shadcn/command");
43
- const popover_1 = require("../../../shadcn/popover");
44
- const separator_1 = require("../../../shadcn/separator");
45
- const function_1 = require("../function");
46
- const buttons_1 = require("../../buttons");
47
- function DataTableFacetedFilter({ column, }) {
48
- const facets = column?.getFacetedUniqueValues();
49
- const selectedValues = new Set(column?.getFilterValue());
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { Check, Plus, X } from "lucide-react";
4
+ import { cn } from "../../../utils/cn";
5
+ import { Badge } from "../../../shadcn/badge";
6
+ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, } from "../../../shadcn/command";
7
+ import { Popover, PopoverContent, PopoverTrigger } from "../../../shadcn/popover";
8
+ import { Separator } from "../../../shadcn/separator";
9
+ import { getDataTableColumnTitle } from "../function";
10
+ import { IconTextButtonWithTooltip } from "../../buttons";
11
+ export function DataTableFacetedFilter({ column, }) {
12
+ const facets = column === null || column === void 0 ? void 0 : column.getFacetedUniqueValues();
13
+ const selectedValues = new Set(column === null || column === void 0 ? void 0 : column.getFilterValue());
50
14
  const sortedUniqueValues = React.useMemo(() => Array.from(column.getFacetedUniqueValues().keys()).sort().slice(0, 5000), [column.getFacetedUniqueValues()]);
51
- return ((0, jsx_runtime_1.jsxs)(popover_1.Popover, { children: [(0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(buttons_1.IconTextButtonWithTooltip, { variant: "dashed", tooltipContent: (0, function_1.getDataTableColumnTitle)(column), children: [selectedValues?.size > 0 ?
52
- (0, jsx_runtime_1.jsx)(lucide_react_1.X, {})
15
+ return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(IconTextButtonWithTooltip, { variant: "dashed", tooltipContent: getDataTableColumnTitle(column), children: [(selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.size) > 0 ?
16
+ _jsx(X, {})
53
17
  :
54
- (0, jsx_runtime_1.jsx)(lucide_react_1.Plus, {}), (0, function_1.getDataTableColumnTitle)(column), selectedValues?.size > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(separator_1.Separator, { orientation: "vertical", className: "mx-2 h-4" }), (0, jsx_runtime_1.jsx)(badge_1.Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal lg:hidden", children: selectedValues.size }), (0, jsx_runtime_1.jsx)("div", { className: "hidden space-x-1 lg:flex", children: selectedValues.size > 2 ? ((0, jsx_runtime_1.jsxs)(badge_1.Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal", children: [selectedValues.size, " selected"] })) : (sortedUniqueValues
18
+ _jsx(Plus, {}), getDataTableColumnTitle(column), (selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.size) > 0 && (_jsxs(_Fragment, { children: [_jsx(Separator, { orientation: "vertical", className: "mx-2 h-4" }), _jsx(Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal lg:hidden", children: selectedValues.size }), _jsx("div", { className: "hidden space-x-1 lg:flex", children: selectedValues.size > 2 ? (_jsxs(Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal", children: [selectedValues.size, " selected"] })) : (sortedUniqueValues
55
19
  .filter((option) => selectedValues.has(option))
56
- .map((option) => ((0, jsx_runtime_1.jsx)(badge_1.Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal", children: option }, option)))) })] }))] }) }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { className: "max-w-[250px] p-0", align: "start", children: (0, jsx_runtime_1.jsxs)(command_1.Command, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandInput, { placeholder: (0, function_1.getDataTableColumnTitle)(column) }), (0, jsx_runtime_1.jsxs)(command_1.CommandList, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandEmpty, { children: "No results found." }), (0, jsx_runtime_1.jsx)(command_1.CommandGroup, { children: sortedUniqueValues.map((option) => {
20
+ .map((option) => (_jsx(Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal", children: option }, option)))) })] }))] }) }), _jsx(PopoverContent, { className: "max-w-[250px] p-0", align: "start", children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: getDataTableColumnTitle(column) }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "No results found." }), _jsx(CommandGroup, { children: sortedUniqueValues.map((option) => {
57
21
  const isSelected = selectedValues.has(option);
58
- return ((0, jsx_runtime_1.jsxs)(command_1.CommandItem, { onSelect: () => {
22
+ return (_jsxs(CommandItem, { onSelect: () => {
59
23
  if (isSelected) {
60
24
  selectedValues.delete(option);
61
25
  }
@@ -63,9 +27,9 @@ function DataTableFacetedFilter({ column, }) {
63
27
  selectedValues.add(option);
64
28
  }
65
29
  const filterValues = Array.from(selectedValues);
66
- column?.setFilterValue(filterValues.length ? filterValues : undefined);
67
- }, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white", isSelected
30
+ column === null || column === void 0 ? void 0 : column.setFilterValue(filterValues.length ? filterValues : undefined);
31
+ }, children: [_jsx("div", { className: cn("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white", isSelected
68
32
  ? "bg-black dark:bg-white text-white dark:text-black"
69
- : "opacity-50 [&_svg]:invisible"), children: (0, jsx_runtime_1.jsx)(lucide_react_1.Check, {}) }), (0, jsx_runtime_1.jsx)("span", { className: "overflow-hidden text-ellipsis", title: option, children: option }), facets?.get(option) && ((0, jsx_runtime_1.jsx)("span", { className: "ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs", children: facets.get(option) }))] }, option));
70
- }) })] }), selectedValues.size > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandSeparator, {}), (0, jsx_runtime_1.jsx)(command_1.CommandGroup, { children: (0, jsx_runtime_1.jsx)(command_1.CommandItem, { onSelect: () => column?.setFilterValue(undefined), className: "justify-center text-center", children: "Clear filters" }) })] }))] }) })] }));
33
+ : "opacity-50 [&_svg]:invisible"), children: _jsx(Check, {}) }), _jsx("span", { className: "overflow-hidden text-ellipsis", title: option, children: option }), (facets === null || facets === void 0 ? void 0 : facets.get(option)) && (_jsx("span", { className: "ml-auto flex h-4 w-4 items-center justify-center font-mono text-xs", children: facets.get(option) }))] }, option));
34
+ }) })] }), selectedValues.size > 0 && (_jsxs(_Fragment, { children: [_jsx(CommandSeparator, {}), _jsx(CommandGroup, { children: _jsx(CommandItem, { onSelect: () => column === null || column === void 0 ? void 0 : column.setFilterValue(undefined), className: "justify-center text-center", children: "Clear filters" }) })] }))] }) })] }));
71
35
  }
@@ -1,27 +1,24 @@
1
- "use strict";
2
1
  "use client";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.DataTableFilterMenu = DataTableFilterMenu;
5
- const jsx_runtime_1 = require("react/jsx-runtime");
6
- const command_1 = require("../../../shadcn/command");
7
- const popover_1 = require("../../../shadcn/popover");
8
- const cn_1 = require("../../../utils/cn");
9
- const react_1 = require("react");
10
- const tooltip_1 = require("../../tooltip");
11
- const buttons_1 = require("../../buttons");
12
- const lucide_react_1 = require("lucide-react");
13
- const function_1 = require("../function");
14
- const datatable_faceted_filter_1 = require("../datatable-faceted-filter");
15
- function DataTableFilterMenu({ table }) {
16
- const [selectedFilterItems, setSelectedFilterItems] = (0, react_1.useState)([]);
17
- return ((0, jsx_runtime_1.jsxs)("div", { className: "flex-grow flex gap-3 items-center overflow-hidden", children: [(0, jsx_runtime_1.jsxs)(popover_1.Popover, { children: [(0, jsx_runtime_1.jsx)(tooltip_1.TooltipComponent, { tooltipContent: "Filter", children: (0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(buttons_1.IconTextButton, { children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Filter, {}), "Filter"] }) }) }), (0, jsx_runtime_1.jsx)(popover_1.PopoverContent, { className: "w-[220px] p-0", align: "start", children: (0, jsx_runtime_1.jsxs)(command_1.Command, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandInput, { placeholder: "Search..." }), (0, jsx_runtime_1.jsxs)(command_1.CommandList, { children: [(0, jsx_runtime_1.jsx)(command_1.CommandEmpty, { children: "No results found." }), (0, jsx_runtime_1.jsx)(command_1.CommandGroup, { children: table
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "../../../shadcn/command";
4
+ import { Popover, PopoverContent, PopoverTrigger } from "../../../shadcn/popover";
5
+ import { cn } from "../../../utils/cn";
6
+ import { useState } from "react";
7
+ import { TooltipComponent as Tooltip } from "../../tooltip";
8
+ import { IconTextButton } from "../../buttons";
9
+ import { Check, Filter } from "lucide-react";
10
+ import { getDataTableColumnTitle } from "../function";
11
+ import { DataTableFacetedFilter } from "../datatable-faceted-filter";
12
+ export function DataTableFilterMenu({ table }) {
13
+ const [selectedFilterItems, setSelectedFilterItems] = useState([]);
14
+ return (_jsxs("div", { className: "flex-grow flex gap-3 items-center overflow-hidden", children: [_jsxs(Popover, { children: [_jsx(Tooltip, { tooltipContent: "Filter", children: _jsx(PopoverTrigger, { asChild: true, children: _jsxs(IconTextButton, { children: [_jsx(Filter, {}), "Filter"] }) }) }), _jsx(PopoverContent, { className: "w-[220px] p-0", align: "start", children: _jsxs(Command, { children: [_jsx(CommandInput, { placeholder: "Search..." }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "No results found." }), _jsx(CommandGroup, { children: table
18
15
  .getAllColumns()
19
16
  .filter((column) => typeof column.accessorFn !== "undefined" &&
20
17
  column.getCanHide())
21
18
  .map((column) => {
22
19
  const previousValues = new Set(selectedFilterItems);
23
20
  const isSelected = previousValues.has(column.id);
24
- return ((0, jsx_runtime_1.jsxs)(command_1.CommandItem, { onSelect: () => {
21
+ return (_jsxs(CommandItem, { onSelect: () => {
25
22
  if (isSelected) {
26
23
  previousValues.delete(column.id);
27
24
  }
@@ -29,13 +26,13 @@ function DataTableFilterMenu({ table }) {
29
26
  previousValues.add(column.id);
30
27
  }
31
28
  setSelectedFilterItems([...previousValues]);
32
- }, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, cn_1.cn)("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white", isSelected
29
+ }, children: [_jsx("div", { className: cn("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-black dark:border-white", isSelected
33
30
  ? "bg-black dark:bg-white text-white dark:text-black"
34
- : "opacity-50 [&_svg]:invisible"), children: (0, jsx_runtime_1.jsx)(lucide_react_1.Check, {}) }), (0, jsx_runtime_1.jsx)("span", { className: "overflow-hidden text-ellipsis", title: (0, function_1.getDataTableColumnTitle)(column), children: (0, function_1.getDataTableColumnTitle)(column) })] }, column.id));
35
- }) })] })] }) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex-grow flex gap-3 items-center overflow-auto", children: selectedFilterItems.map((columnId) => {
31
+ : "opacity-50 [&_svg]:invisible"), children: _jsx(Check, {}) }), _jsx("span", { className: "overflow-hidden text-ellipsis", title: getDataTableColumnTitle(column), children: getDataTableColumnTitle(column) })] }, column.id));
32
+ }) })] })] }) })] }), _jsx("div", { className: "flex-grow flex gap-3 items-center overflow-auto", children: selectedFilterItems.map((columnId) => {
36
33
  const column = table.getColumn(columnId);
37
34
  if (column) {
38
- return (0, jsx_runtime_1.jsx)(datatable_faceted_filter_1.DataTableFacetedFilter, { column: column }, columnId);
35
+ return _jsx(DataTableFacetedFilter, { column: column }, columnId);
39
36
  }
40
37
  }) })] }));
41
38
  }
@@ -1,16 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataTablePagination = DataTablePagination;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const lucide_react_1 = require("lucide-react");
6
- const select_1 = require("../../../shadcn/select");
7
- const buttons_1 = require("../../buttons");
1
+ import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, } from "lucide-react";
3
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../../../shadcn/select";
4
+ import { IconButtonWithTooltip } from "../../buttons";
8
5
  const defaultPageSizeArray = [15, 20, 30, 40, 50, 100];
9
- function DataTablePagination({ table, extraParams, }) {
10
- return ((0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col md:flex-row items-start md:items-center justify-between ", children: [(0, jsx_runtime_1.jsx)("small", { className: "flex-1 px-2 text-gray-600 dark:text-gray-400", children: (extraParams?.numberOfRows == undefined ||
11
- extraParams?.numberOfRows) &&
12
- extraParams?.checkBoxColumn ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [table.getFilteredSelectedRowModel().rows.length, " of", " ", table.getFilteredRowModel().rows.length, " row(s) selected."] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Total ", table.getFilteredRowModel().rows.length, " no(s) of rows."] })) }), (extraParams?.pagination == undefined || extraParams.pagination) && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-start md:items-center gap-3 flex-col md:flex-row ", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("small", { className: "text-gray-600 dark:text-gray-400", children: "Rows per page" }), (extraParams?.rowsPerPage == undefined ||
13
- extraParams.rowsPerPage) && ((0, jsx_runtime_1.jsxs)(select_1.Select, { value: `${table.getState().pagination.pageSize}`, onValueChange: (value) => {
6
+ export function DataTablePagination({ table, extraParams, }) {
7
+ return (_jsxs("div", { className: "flex flex-col md:flex-row items-start md:items-center justify-between ", children: [_jsx("small", { className: "flex-1 px-2 text-gray-600 dark:text-gray-400", children: ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.numberOfRows) == undefined ||
8
+ (extraParams === null || extraParams === void 0 ? void 0 : extraParams.numberOfRows)) &&
9
+ (extraParams === null || extraParams === void 0 ? void 0 : extraParams.checkBoxColumn) ? (_jsxs(_Fragment, { children: [table.getFilteredSelectedRowModel().rows.length, " of", " ", table.getFilteredRowModel().rows.length, " row(s) selected."] })) : (_jsxs(_Fragment, { children: ["Total ", table.getFilteredRowModel().rows.length, " no(s) of rows."] })) }), ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.pagination) == undefined || extraParams.pagination) && (_jsxs("div", { className: "flex items-start md:items-center gap-3 flex-col md:flex-row ", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("small", { className: "text-gray-600 dark:text-gray-400", children: "Rows per page" }), ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.rowsPerPage) == undefined ||
10
+ extraParams.rowsPerPage) && (_jsxs(Select, { value: `${table.getState().pagination.pageSize}`, onValueChange: (value) => {
14
11
  table.setPageSize(Number(value));
15
- }, children: [(0, jsx_runtime_1.jsx)(select_1.SelectTrigger, { className: "w-[70px] h-8", children: (0, jsx_runtime_1.jsx)(select_1.SelectValue, { placeholder: table.getState().pagination.pageSize }) }), (0, jsx_runtime_1.jsx)(select_1.SelectContent, { side: "top", children: (extraParams?.pageSizeArray || defaultPageSizeArray).map((pageSize) => ((0, jsx_runtime_1.jsx)(select_1.SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize))) })] }))] }), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("small", { className: "flex w-[100px] items-center justify-center text-gray-600 dark:text-gray-400", children: ["Page ", table.getState().pagination.pageIndex + 1, " of", " ", table.getPageCount()] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)(buttons_1.IconButtonWithTooltip, { tooltipContent: "Go to first page", size: "smIcon", className: "dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground", onClick: () => table.setPageIndex(0), disabled: !table.getCanPreviousPage(), children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsLeft, {}) }), (0, jsx_runtime_1.jsx)(buttons_1.IconButtonWithTooltip, { tooltipContent: "Go to previous page", size: "smIcon", className: "dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground", onClick: () => table.previousPage(), disabled: !table.getCanPreviousPage(), children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronLeft, {}) }), (0, jsx_runtime_1.jsx)(buttons_1.IconButtonWithTooltip, { tooltipContent: "Go to next page", size: "smIcon", className: "dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground", onClick: () => table.nextPage(), disabled: !table.getCanNextPage(), children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronRight, {}) }), (0, jsx_runtime_1.jsx)(buttons_1.IconButtonWithTooltip, { tooltipContent: "Go to last page", size: "smIcon", className: "dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground", onClick: () => table.setPageIndex(table.getPageCount() - 1), disabled: !table.getCanNextPage(), children: (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsRight, {}) })] })] })] }))] }));
12
+ }, children: [_jsx(SelectTrigger, { className: "w-[70px] h-8", children: _jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }), _jsx(SelectContent, { side: "top", children: ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.pageSizeArray) || defaultPageSizeArray).map((pageSize) => (_jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize))) })] }))] }), _jsxs(_Fragment, { children: [_jsxs("small", { className: "flex w-[100px] items-center justify-center text-gray-600 dark:text-gray-400", children: ["Page ", table.getState().pagination.pageIndex + 1, " of", " ", table.getPageCount()] }), _jsxs("div", { className: "flex items-center gap-3", children: [_jsx(IconButtonWithTooltip, { tooltipContent: "Go to first page", size: "smIcon", className: "dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground", onClick: () => table.setPageIndex(0), disabled: !table.getCanPreviousPage(), children: _jsx(ChevronsLeft, {}) }), _jsx(IconButtonWithTooltip, { tooltipContent: "Go to previous page", size: "smIcon", className: "dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground", onClick: () => table.previousPage(), disabled: !table.getCanPreviousPage(), children: _jsx(ChevronLeft, {}) }), _jsx(IconButtonWithTooltip, { tooltipContent: "Go to next page", size: "smIcon", className: "dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground", onClick: () => table.nextPage(), disabled: !table.getCanNextPage(), children: _jsx(ChevronRight, {}) }), _jsx(IconButtonWithTooltip, { tooltipContent: "Go to last page", size: "smIcon", className: "dark:bg-accent dark:text-accent-foreground keross:bg-card keross:text-foreground", onClick: () => table.setPageIndex(table.getPageCount() - 1), disabled: !table.getCanNextPage(), children: _jsx(ChevronsRight, {}) })] })] })] }))] }));
16
13
  }
@@ -1,20 +1,18 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DataTableToolbar = DataTableToolbar;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const datatable_filter_menu_1 = require("../datatable-filter-menu");
7
- const datatable_column_filter_1 = require("../datatable-column-filter");
8
- const search_input_1 = require("../../search-input");
9
- function DataTableToolbar({ table, extraParams, }) {
10
- return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex-grow flex items-center justify-between gap-3 overflow-hidden", children: [(extraParams?.defaultTools == undefined ||
11
- extraParams?.defaultTools == true ||
12
- (Array.isArray(extraParams?.defaultTools) &&
13
- extraParams?.defaultTools?.includes("search"))) && ((0, jsx_runtime_1.jsx)(search_input_1.SearchInput, { placeholder: "Search ...", onChange: (event) => table.setGlobalFilter(event.target.value), className: "max-w-sm" })), (extraParams?.defaultTools == undefined ||
14
- extraParams?.defaultTools == true ||
15
- (Array.isArray(extraParams?.defaultTools) &&
16
- extraParams?.defaultTools?.includes("filter"))) && ((0, jsx_runtime_1.jsx)(datatable_filter_menu_1.DataTableFilterMenu, { table: table }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex gap-3", children: [extraParams?.extraTools?.map((tool, index) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: tool }, index))), (extraParams?.defaultTools == undefined ||
17
- extraParams?.defaultTools == true ||
18
- (Array.isArray(extraParams?.defaultTools) &&
19
- extraParams?.defaultTools?.includes("columnFilter"))) && ((0, jsx_runtime_1.jsx)(datatable_column_filter_1.DataTableColumnFilter, { table: table }))] })] }));
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from "react";
3
+ import { DataTableFilterMenu } from "../datatable-filter-menu";
4
+ import { DataTableColumnFilter } from "../datatable-column-filter";
5
+ import { SearchInput } from "../../search-input";
6
+ export function DataTableToolbar({ table, extraParams, }) {
7
+ var _a, _b, _c, _d;
8
+ return (_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { className: "flex-grow flex items-center justify-between gap-3 overflow-hidden", children: [((extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == undefined ||
9
+ (extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == true ||
10
+ (Array.isArray(extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) &&
11
+ ((_a = extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) === null || _a === void 0 ? void 0 : _a.includes("search")))) && (_jsx(SearchInput, { placeholder: "Search ...", onChange: (event) => table.setGlobalFilter(event.target.value), className: "max-w-sm" })), ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == undefined ||
12
+ (extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == true ||
13
+ (Array.isArray(extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) &&
14
+ ((_b = extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) === null || _b === void 0 ? void 0 : _b.includes("filter")))) && (_jsx(DataTableFilterMenu, { table: table }))] }), _jsxs("div", { className: "flex gap-3", children: [(_c = extraParams === null || extraParams === void 0 ? void 0 : extraParams.extraTools) === null || _c === void 0 ? void 0 : _c.map((tool, index) => (_jsx(Fragment, { children: tool }, index))), ((extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == undefined ||
15
+ (extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) == true ||
16
+ (Array.isArray(extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) &&
17
+ ((_d = extraParams === null || extraParams === void 0 ? void 0 : extraParams.defaultTools) === null || _d === void 0 ? void 0 : _d.includes("columnFilter")))) && (_jsx(DataTableColumnFilter, { table: table }))] })] }));
20
18
  }