@cryptlex/web-components 1.4.0 → 1.5.0

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 (94) hide show
  1. package/README.md +4 -13
  2. package/dist/components/data-table/column-picker.es.js +3 -4
  3. package/dist/components/data-table/column-picker.es.js.map +1 -1
  4. package/dist/components/data-table/data-table.es.js +84 -83
  5. package/dist/components/data-table/data-table.es.js.map +1 -1
  6. package/dist/components/data-table/page-size.es.js +5 -5
  7. package/dist/components/data-table/page-size.es.js.map +1 -1
  8. package/dist/components/data-table/paginator.es.js +25 -31
  9. package/dist/components/data-table/paginator.es.js.map +1 -1
  10. package/dist/components/data-table/table-actions.es.js +26 -27
  11. package/dist/components/data-table/table-actions.es.js.map +1 -1
  12. package/dist/components/data-table/table-commons.es.js +5 -4
  13. package/dist/components/data-table/table-commons.es.js.map +1 -1
  14. package/dist/components/data-table/table-content.es.js +34 -31
  15. package/dist/components/data-table/table-content.es.js.map +1 -1
  16. package/dist/components/data-table/table-filter.es.js +42 -45
  17. package/dist/components/data-table/table-filter.es.js.map +1 -1
  18. package/dist/components/key-value-card/key-value-card.es.js +17 -14
  19. package/dist/components/key-value-card/key-value-card.es.js.map +1 -1
  20. package/dist/components/sidebar/app-layout.es.js +11 -15
  21. package/dist/components/sidebar/app-layout.es.js.map +1 -1
  22. package/dist/components/sidebar/breadcrumb.es.js +2 -3
  23. package/dist/components/sidebar/breadcrumb.es.js.map +1 -1
  24. package/dist/components/sidebar/nav-main.es.js +18 -18
  25. package/dist/components/sidebar/nav-main.es.js.map +1 -1
  26. package/dist/components/static-data-table/data-table.es.js +14 -14
  27. package/dist/components/static-data-table/data-table.es.js.map +1 -1
  28. package/dist/components/ui/accordion.es.js +9 -9
  29. package/dist/components/ui/accordion.es.js.map +1 -1
  30. package/dist/components/ui/avatar.es.js +16 -16
  31. package/dist/components/ui/avatar.es.js.map +1 -1
  32. package/dist/components/ui/badge.es.js +5 -24
  33. package/dist/components/ui/badge.es.js.map +1 -1
  34. package/dist/components/ui/breadcrumb.es.js +10 -10
  35. package/dist/components/ui/breadcrumb.es.js.map +1 -1
  36. package/dist/components/ui/button.es.js +17 -18
  37. package/dist/components/ui/button.es.js.map +1 -1
  38. package/dist/components/ui/calendar.es.js +8 -8
  39. package/dist/components/ui/calendar.es.js.map +1 -1
  40. package/dist/components/ui/card.es.js +21 -21
  41. package/dist/components/ui/card.es.js.map +1 -1
  42. package/dist/components/ui/chart.es.js +76 -102
  43. package/dist/components/ui/chart.es.js.map +1 -1
  44. package/dist/components/ui/checkbox.es.js +13 -19
  45. package/dist/components/ui/checkbox.es.js.map +1 -1
  46. package/dist/components/ui/command.es.js +4 -4
  47. package/dist/components/ui/command.es.js.map +1 -1
  48. package/dist/components/ui/copy-button.es.js +20 -34
  49. package/dist/components/ui/copy-button.es.js.map +1 -1
  50. package/dist/components/ui/dialog.es.js +32 -32
  51. package/dist/components/ui/dialog.es.js.map +1 -1
  52. package/dist/components/ui/drawer.es.js +2 -2
  53. package/dist/components/ui/drawer.es.js.map +1 -1
  54. package/dist/components/ui/dropdown-menu.es.js +74 -82
  55. package/dist/components/ui/dropdown-menu.es.js.map +1 -1
  56. package/dist/components/ui/input-otp.es.js +17 -17
  57. package/dist/components/ui/input-otp.es.js.map +1 -1
  58. package/dist/components/ui/input.es.js +7 -7
  59. package/dist/components/ui/input.es.js.map +1 -1
  60. package/dist/components/ui/link-button.es.js +6 -6
  61. package/dist/components/ui/link-button.es.js.map +1 -1
  62. package/dist/components/ui/mutli-select.es.js +52 -52
  63. package/dist/components/ui/mutli-select.es.js.map +1 -1
  64. package/dist/components/ui/navigation-menu.es.js +34 -34
  65. package/dist/components/ui/navigation-menu.es.js.map +1 -1
  66. package/dist/components/ui/pagination.es.js +38 -38
  67. package/dist/components/ui/pagination.es.js.map +1 -1
  68. package/dist/components/ui/password-input.es.js +13 -13
  69. package/dist/components/ui/password-input.es.js.map +1 -1
  70. package/dist/components/ui/radio-group.es.js +11 -11
  71. package/dist/components/ui/radio-group.es.js.map +1 -1
  72. package/dist/components/ui/search-input.es.js +11 -11
  73. package/dist/components/ui/search-input.es.js.map +1 -1
  74. package/dist/components/ui/select.es.js +31 -49
  75. package/dist/components/ui/select.es.js.map +1 -1
  76. package/dist/components/ui/sheet.es.js +17 -17
  77. package/dist/components/ui/sheet.es.js.map +1 -1
  78. package/dist/components/ui/sidebar.es.js +2 -3
  79. package/dist/components/ui/sidebar.es.js.map +1 -1
  80. package/dist/components/ui/table-page-layout.es.js +2 -2
  81. package/dist/components/ui/table-page-layout.es.js.map +1 -1
  82. package/dist/components/ui/table.es.js +37 -37
  83. package/dist/components/ui/table.es.js.map +1 -1
  84. package/dist/components/ui/tabs.es.js +2 -2
  85. package/dist/components/ui/tabs.es.js.map +1 -1
  86. package/dist/components/ui/tooltip.es.js +8 -8
  87. package/dist/components/ui/tooltip.es.js.map +1 -1
  88. package/dist/index.es.d.ts +29 -54
  89. package/dist/index.es.js +253 -256
  90. package/dist/utils/index.es.js.map +1 -1
  91. package/lib/index.css +24 -5
  92. package/lib/tailwind.preset.css +52 -40
  93. package/lib/tokens.css +0 -9
  94. package/package.json +1 -1
@@ -1,10 +1,9 @@
1
- import { jsxs as p, jsx as r } from "react/jsx-runtime";
2
- import { useRouterState as a, Link as n } from "@tanstack/react-router";
3
- import { RotateCw as f, Plus as g, Pencil as u, Trash as v } from "lucide-react";
1
+ import { jsxs as p, jsx as e } from "react/jsx-runtime";
2
+ import { useRouterState as g, Link as d } from "@tanstack/react-router";
3
+ import { RotateCw as f, Plus as a, Pencil as u, Trash as w } from "lucide-react";
4
4
  import { Button as t } from "../ui/button.es.js";
5
5
  import "../ui/accordion.es.js";
6
6
  import "../ui/avatar.es.js";
7
- import "../ui/badge.es.js";
8
7
  import "../ui/breadcrumb.es.js";
9
8
  import "../ui/calendar.es.js";
10
9
  import "../ui/card.es.js";
@@ -12,7 +11,7 @@ import "../ui/chart.es.js";
12
11
  import "../ui/checkbox.es.js";
13
12
  import "@radix-ui/react-collapsible";
14
13
  import "../ui/command.es.js";
15
- import { useState as w } from "react";
14
+ import { useState as v } from "react";
16
15
  import "../ui/dialog.es.js";
17
16
  import "../ui/drawer.es.js";
18
17
  import "../ui/dropdown-menu.es.js";
@@ -35,44 +34,44 @@ import "sonner";
35
34
  import "../ui/table.es.js";
36
35
  import "../ui/tabs.es.js";
37
36
  import "../ui/tooltip.es.js";
38
- function te({
39
- table: o,
40
- tableActions: e,
41
- stateToPass: c,
42
- handleSearching: l,
43
- dataQuery: i
37
+ function or({
38
+ table: i,
39
+ tableActions: r,
40
+ stateToPass: n,
41
+ handleSearching: h,
42
+ dataQuery: o
44
43
  }) {
45
- const { location: { href: m } = {} } = a(), [h, s] = w("");
46
- return /* @__PURE__ */ p("div", { className: "flex justify-between my-0 py-2 gap-4 overflow-auto", children: [
47
- /* @__PURE__ */ p("div", { className: "flex gap-2", children: [
48
- /* @__PURE__ */ r(
44
+ const { location: { href: m } = {} } = g(), [l, s] = v("");
45
+ return /* @__PURE__ */ p("div", { className: "flex bg-card justify-between my-0 p-4 border-t border-x gap-4 overflow-auto", children: [
46
+ /* @__PURE__ */ p("div", { className: "flex gap-4", children: [
47
+ /* @__PURE__ */ e(
49
48
  t,
50
49
  {
51
- loading: i.isFetching,
50
+ loading: o.isFetching,
52
51
  icon: f,
53
- onClick: () => i.refetch(),
52
+ onClick: () => o.refetch(),
54
53
  variant: "outline"
55
54
  }
56
55
  ),
57
- e.create && o.getSelectedRowModel().rows.length === 0 && /* @__PURE__ */ p(n, { to: `${m}/create`, children: [
58
- /* @__PURE__ */ r(t, { disabled: i.isFetching, icon: g, children: "Create" }),
56
+ r.create && i.getSelectedRowModel().rows.length === 0 && /* @__PURE__ */ p(d, { to: `${m}/create`, children: [
57
+ /* @__PURE__ */ e(t, { disabled: o.isFetching, icon: a, children: "Create" }),
59
58
  " "
60
59
  ] }),
61
- o.getSelectedRowModel().rows.length > 0 && e.update && /* @__PURE__ */ r(n, { to: `${m}/edit`, state: c, children: /* @__PURE__ */ r(t, { disabled: i.isFetching, icon: u, children: "Update" }) }),
62
- o.getSelectedRowModel().rows.length > 0 && (e == null ? void 0 : e.delete) && /* @__PURE__ */ r(n, { to: `${m}/delete`, state: c, children: /* @__PURE__ */ r(t, { disabled: i.isFetching, icon: v, variant: "destructive", children: "Delete" }) })
60
+ i.getSelectedRowModel().rows.length > 0 && r.update && /* @__PURE__ */ e(d, { to: `${m}/edit`, state: n, children: /* @__PURE__ */ e(t, { disabled: o.isFetching, icon: u, children: "Update" }) }),
61
+ i.getSelectedRowModel().rows.length > 0 && (r == null ? void 0 : r.delete) && /* @__PURE__ */ e(d, { to: `${m}/delete`, state: n, children: /* @__PURE__ */ e(t, { disabled: o.isFetching, icon: w, variant: "destructive", children: "Delete" }) })
63
62
  ] }),
64
- (e == null ? void 0 : e.search) && /* @__PURE__ */ r("div", { className: "relative flex gap-1 justify-center items-center", children: /* @__PURE__ */ r(
63
+ (r == null ? void 0 : r.search) && /* @__PURE__ */ e(
65
64
  S,
66
65
  {
67
- value: h,
68
- onChange: (d) => {
69
- s(d), l(d);
66
+ value: l,
67
+ onChange: (c) => {
68
+ s(c), h(c);
70
69
  }
71
70
  }
72
- ) })
71
+ )
73
72
  ] });
74
73
  }
75
74
  export {
76
- te as default
75
+ or as default
77
76
  };
78
77
  //# sourceMappingURL=table-actions.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"table-actions.es.js","sources":["../../../lib/components/data-table/table-actions.tsx"],"sourcesContent":["import { Link, useRouterState } from '@tanstack/react-router';\n\nimport { Pencil, Plus, RotateCw, Trash } from 'lucide-react';\n\nimport type { TableActions } from '@/components/data-table/table-utils/index';\nimport { Button } from '@/components/ui/button';\nimport { SearchInput } from '@/index';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { Table } from '@tanstack/react-table';\nimport { useState } from 'react';\n\nexport default function Actions<TData>({\n table,\n tableActions,\n stateToPass,\n handleSearching,\n dataQuery,\n}: {\n table: Table<TData>;\n tableActions: TableActions;\n handleSearching: (value: string) => void;\n // TODO:Improve ts\n stateToPass: any;\n dataQuery: UseQueryResult<any, unknown>;\n}) {\n const { location: { href } = {} } = useRouterState();\n const [search, setSearch] = useState<string>('');\n return (\n <div className=\"flex justify-between my-0 py-2 gap-4 overflow-auto\">\n <div className=\"flex gap-2\">\n <Button\n loading={dataQuery.isFetching}\n icon={RotateCw}\n onClick={() => dataQuery.refetch()}\n variant={'outline'}\n />\n {/* //TODO: we can show the create, delete button based on permsission */}\n {/* All the creating routes will be with url /create in host app */}\n {tableActions.create && table.getSelectedRowModel().rows.length === 0 && (\n <Link to={`${href}/create`}>\n <Button disabled={dataQuery.isFetching} icon={Plus}>\n Create\n </Button>{' '}\n </Link>\n )}\n {/* All the updating routes will be with url /edit in host app */}\n {table.getSelectedRowModel().rows.length > 0 && tableActions.update && (\n <Link to={`${href}/edit`} state={stateToPass}>\n <Button disabled={dataQuery.isFetching} icon={Pencil}>\n Update\n </Button>\n </Link>\n )}\n {table.getSelectedRowModel().rows.length > 0 && tableActions?.delete && (\n <Link to={`${href}/delete`} state={stateToPass}>\n <Button disabled={dataQuery.isFetching} icon={Trash} variant={'destructive'}>\n Delete\n </Button>\n </Link>\n )}\n </div>\n {tableActions?.search && (\n <div className=\"relative flex gap-1 justify-center items-center\">\n <SearchInput\n value={search}\n onChange={(e) => {\n setSearch(e);\n handleSearching(e);\n }}\n />\n </div>\n )}\n </div>\n );\n}\n"],"names":["Actions","table","tableActions","stateToPass","handleSearching","dataQuery","href","useRouterState","search","setSearch","useState","jsxs","jsx","Button","RotateCw","Link","Plus","Pencil","Trash","SearchInput","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAwBA,GAAe;AAAA,EACrC,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AACF,GAOG;AACK,QAAA,EAAE,UAAU,EAAE,MAAAC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QACP,UAAU,CAACY,MAAM;AACf,UAAAX,EAAUW,CAAC,GACXhB,EAAgBgB,CAAC;AAAA,QAAA;AAAA,MACnB;AAAA,IAAA,EAEJ,CAAA;AAAA,EAAA,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"table-actions.es.js","sources":["../../../lib/components/data-table/table-actions.tsx"],"sourcesContent":["import { Link, useRouterState } from '@tanstack/react-router';\n\nimport { Pencil, Plus, RotateCw, Trash } from 'lucide-react';\n\nimport type { TableActions } from '@/components/data-table/table-utils/index';\nimport { Button } from '@/components/ui/button';\nimport { SearchInput } from '@/index';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { Table } from '@tanstack/react-table';\nimport { useState } from 'react';\n\nexport default function Actions<TData>({\n table,\n tableActions,\n stateToPass,\n handleSearching,\n dataQuery,\n}: {\n table: Table<TData>;\n tableActions: TableActions;\n handleSearching: (value: string) => void;\n // TODO:Improve ts\n stateToPass: any;\n dataQuery: UseQueryResult<any, unknown>;\n}) {\n const { location: { href } = {} } = useRouterState();\n const [search, setSearch] = useState<string>('');\n return (\n <div className=\"flex bg-card justify-between my-0 p-4 border-t border-x gap-4 overflow-auto\">\n <div className=\"flex gap-4\">\n <Button\n loading={dataQuery.isFetching}\n icon={RotateCw}\n onClick={() => dataQuery.refetch()}\n variant={'outline'}\n />\n {/* //TODO: we can show the create, delete button based on permsission */}\n {/* All the creating routes will be with url /create in host app */}\n {tableActions.create && table.getSelectedRowModel().rows.length === 0 && (\n <Link to={`${href}/create`}>\n <Button disabled={dataQuery.isFetching} icon={Plus}>\n Create\n </Button>{' '}\n </Link>\n )}\n {/* All the updating routes will be with url /edit in host app */}\n {table.getSelectedRowModel().rows.length > 0 && tableActions.update && (\n <Link to={`${href}/edit`} state={stateToPass}>\n <Button disabled={dataQuery.isFetching} icon={Pencil}>\n Update\n </Button>\n </Link>\n )}\n {table.getSelectedRowModel().rows.length > 0 && tableActions?.delete && (\n <Link to={`${href}/delete`} state={stateToPass}>\n <Button disabled={dataQuery.isFetching} icon={Trash} variant={'destructive'}>\n Delete\n </Button>\n </Link>\n )}\n </div>\n {tableActions?.search && (\n <SearchInput\n value={search}\n onChange={(e) => {\n setSearch(e);\n handleSearching(e);\n }}\n />\n )}\n </div>\n );\n}\n"],"names":["Actions","table","tableActions","stateToPass","handleSearching","dataQuery","href","useRouterState","search","setSearch","useState","jsxs","jsx","Button","RotateCw","Link","Plus","Pencil","Trash","SearchInput","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,SAAwBA,GAAe;AAAA,EACrC,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AACF,GAOG;AACK,QAAA,EAAE,UAAU,EAAE,MAAAC,MAAS,CAAC,EAAA,IAAMC,EAAe,GAC7C,CAACC,GAAQC,CAAS,IAAIC,EAAiB,EAAE;AAE7C,SAAA,gBAAAC,EAAC,OAAI,EAAA,WAAU,+EACb,UAAA;AAAA,IAAC,gBAAAA,EAAA,OAAA,EAAI,WAAU,cACb,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAASR,EAAU;AAAA,UACnB,MAAMS;AAAA,UACN,SAAS,MAAMT,EAAU,QAAQ;AAAA,UACjC,SAAS;AAAA,QAAA;AAAA,MACX;AAAA,MAGCH,EAAa,UAAUD,EAAM,oBAAA,EAAsB,KAAK,WAAW,KACjE,gBAAAU,EAAAI,GAAA,EAAK,IAAI,GAAGT,CAAI,WACf,UAAA;AAAA,QAAA,gBAAAM,EAACC,KAAO,UAAUR,EAAU,YAAY,MAAMW,GAAM,UAEpD,UAAA;AAAA,QAAU;AAAA,MAAA,GACZ;AAAA,MAGDf,EAAM,oBAAoB,EAAE,KAAK,SAAS,KAAKC,EAAa,UAC1D,gBAAAU,EAAAG,GAAA,EAAK,IAAI,GAAGT,CAAI,SAAS,OAAOH,GAC/B,UAAA,gBAAAS,EAACC,GAAO,EAAA,UAAUR,EAAU,YAAY,MAAMY,GAAQ,UAAA,SAAA,CAEtD,EACF,CAAA;AAAA,MAEDhB,EAAM,oBAAoB,EAAE,KAAK,SAAS,MAAKC,KAAA,gBAAAA,EAAc,WAC5D,gBAAAU,EAACG,GAAK,EAAA,IAAI,GAAGT,CAAI,WAAW,OAAOH,GACjC,UAAC,gBAAAS,EAAAC,GAAA,EAAO,UAAUR,EAAU,YAAY,MAAMa,GAAO,SAAS,eAAe,UAAA,SAE7E,CAAA,EACF,CAAA;AAAA,IAAA,GAEJ;AAAA,KACChB,KAAA,gBAAAA,EAAc,WACb,gBAAAU;AAAA,MAACO;AAAA,MAAA;AAAA,QACC,OAAOX;AAAA,QACP,UAAU,CAACY,MAAM;AACf,UAAAX,EAAUW,CAAC,GACXhB,EAAgBgB,CAAC;AAAA,QAAA;AAAA,MACnB;AAAA,IAAA;AAAA,EACF,GAEJ;AAEJ;"}
@@ -41,12 +41,13 @@ const a = r(), i = [
41
41
  cell: ({ row: e }) => {
42
42
  const t = e.getValue("createdAt");
43
43
  return o(t);
44
- }
44
+ },
45
+ enableHiding: !1
45
46
  })
46
47
  ];
47
48
  export {
48
- i as CHECK_BOX,
49
- m as DEFAULT_DATE_COLUMNS,
50
- h as ID_COLUMN
49
+ i as TABLE_CHECK_BOX_COLUMN,
50
+ m as TABLE_DEFAULT_DATE_COLUMNS,
51
+ h as TABLE_ID_COLUMN
51
52
  };
52
53
  //# sourceMappingURL=table-commons.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"table-commons.es.js","sources":["../../../lib/components/data-table/table-commons.tsx"],"sourcesContent":["import { FormatDate } from '@/components/data-table/table-utils/index';\nimport { Checkbox } from '@/components/ui/checkbox';\nimport { createColumnHelper } from '@tanstack/react-table';\n\nconst cH = createColumnHelper<any>();\nexport const CHECK_BOX = [\n cH.accessor('checkbox', {\n header: ({ table }) => (\n <Checkbox\n checked={\n table.getIsAllPageRowsSelected() || (table.getIsSomePageRowsSelected() && 'indeterminate')\n }\n onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}\n aria-label=\"Select all\"\n />\n ),\n\n cell: ({ row }) => (\n <Checkbox\n checked={row.getIsSelected()}\n onCheckedChange={(value) => row.toggleSelected(!!value)}\n aria-label=\"Select row\"\n />\n ),\n enableSorting: false,\n enableHiding: false,\n }),\n];\n\nexport const ID_COLUMN = [\n cH.accessor('id', {\n header: () => 'ID',\n }),\n];\nexport const DEFAULT_DATE_COLUMNS = [\n cH.accessor('createdAt', {\n header: () => 'Creation Date',\n cell: ({ row }) => {\n const date = row.getValue('createdAt') satisfies string | null | undefined;\n return FormatDate(date);\n },\n enableHiding: false,\n }),\n cH.accessor('updatedAt', {\n header: () => 'Last Updated',\n cell: ({ row }) => {\n const date = row.getValue('createdAt') satisfies string | null | undefined;\n return FormatDate(date);\n },\n }),\n];\n"],"names":["cH","createColumnHelper","CHECK_BOX","table","jsx","Checkbox","value","row","ID_COLUMN","DEFAULT_DATE_COLUMNS","date","FormatDate"],"mappings":";;;;AAIA,MAAMA,IAAKC,EAAwB,GACtBC,IAAY;AAAA,EACvBF,EAAG,SAAS,YAAY;AAAA,IACtB,QAAQ,CAAC,EAAE,OAAAG,EAAA,MACT,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SACEF,EAAM,yBAAA,KAA+BA,EAAM,0BAA+B,KAAA;AAAA,QAE5E,iBAAiB,CAACG,MAAUH,EAAM,0BAA0B,CAAC,CAACG,CAAK;AAAA,QACnE,cAAW;AAAA,MAAA;AAAA,IACb;AAAA,IAGF,MAAM,CAAC,EAAE,KAAAC,EAAA,MACP,gBAAAH;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SAASE,EAAI,cAAc;AAAA,QAC3B,iBAAiB,CAACD,MAAUC,EAAI,eAAe,CAAC,CAACD,CAAK;AAAA,QACtD,cAAW;AAAA,MAAA;AAAA,IACb;AAAA,IAEF,eAAe;AAAA,IACf,cAAc;AAAA,EACf,CAAA;AACH,GAEaE,IAAY;AAAA,EACvBR,EAAG,SAAS,MAAM;AAAA,IAChB,QAAQ,MAAM;AAAA,EACf,CAAA;AACH,GACaS,IAAuB;AAAA,EAClCT,EAAG,SAAS,aAAa;AAAA,IACvB,QAAQ,MAAM;AAAA,IACd,MAAM,CAAC,EAAE,KAAAO,QAAU;AACX,YAAAG,IAAOH,EAAI,SAAS,WAAW;AACrC,aAAOI,EAAWD,CAAI;AAAA,IACxB;AAAA,IACA,cAAc;AAAA,EAAA,CACf;AAAA,EACDV,EAAG,SAAS,aAAa;AAAA,IACvB,QAAQ,MAAM;AAAA,IACd,MAAM,CAAC,EAAE,KAAAO,QAAU;AACX,YAAAG,IAAOH,EAAI,SAAS,WAAW;AACrC,aAAOI,EAAWD,CAAI;AAAA,IAAA;AAAA,EAEzB,CAAA;AACH;"}
1
+ {"version":3,"file":"table-commons.es.js","sources":["../../../lib/components/data-table/table-commons.tsx"],"sourcesContent":["import { FormatDate } from '@/components/data-table/table-utils/index';\nimport { Checkbox } from '@/components/ui/checkbox';\nimport { createColumnHelper } from '@tanstack/react-table';\n\nconst cH = createColumnHelper<any>();\nexport const TABLE_CHECK_BOX_COLUMN = [\n cH.accessor('checkbox', {\n header: ({ table }) => (\n <Checkbox\n checked={\n table.getIsAllPageRowsSelected() || (table.getIsSomePageRowsSelected() && 'indeterminate')\n }\n onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}\n aria-label=\"Select all\"\n />\n ),\n\n cell: ({ row }) => (\n <Checkbox\n checked={row.getIsSelected()}\n onCheckedChange={(value) => row.toggleSelected(!!value)}\n aria-label=\"Select row\"\n />\n ),\n enableSorting: false,\n enableHiding: false,\n })];\n\nexport const TABLE_ID_COLUMN = [\n cH.accessor('id', {\n header: () => 'ID',\n }),\n];\nexport const TABLE_DEFAULT_DATE_COLUMNS = [\n cH.accessor('createdAt', {\n header: () => 'Creation Date',\n cell: ({ row }) => {\n const date = row.getValue('createdAt') satisfies string | null | undefined;\n return FormatDate(date);\n },\n enableHiding: false,\n }),\n cH.accessor('updatedAt', {\n header: () => 'Last Updated',\n cell: ({ row }) => {\n const date = row.getValue('createdAt') satisfies string | null | undefined;\n return FormatDate(date);\n },\n enableHiding: false,\n }),\n];\n"],"names":["cH","createColumnHelper","TABLE_CHECK_BOX_COLUMN","table","jsx","Checkbox","value","row","TABLE_ID_COLUMN","TABLE_DEFAULT_DATE_COLUMNS","date","FormatDate"],"mappings":";;;;AAIA,MAAMA,IAAKC,EAAwB,GACtBC,IAAyB;AAAA,EACpCF,EAAG,SAAS,YAAY;AAAA,IACtB,QAAQ,CAAC,EAAE,OAAAG,EAAA,MACT,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SACEF,EAAM,yBAAA,KAA+BA,EAAM,0BAA+B,KAAA;AAAA,QAE5E,iBAAiB,CAACG,MAAUH,EAAM,0BAA0B,CAAC,CAACG,CAAK;AAAA,QACnE,cAAW;AAAA,MAAA;AAAA,IACb;AAAA,IAGF,MAAM,CAAC,EAAE,KAAAC,EAAA,MACP,gBAAAH;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,SAASE,EAAI,cAAc;AAAA,QAC3B,iBAAiB,CAACD,MAAUC,EAAI,eAAe,CAAC,CAACD,CAAK;AAAA,QACtD,cAAW;AAAA,MAAA;AAAA,IACb;AAAA,IAEF,eAAe;AAAA,IACf,cAAc;AAAA,EACf,CAAA;AAAC,GAESE,IAAkB;AAAA,EAC7BR,EAAG,SAAS,MAAM;AAAA,IAChB,QAAQ,MAAM;AAAA,EACf,CAAA;AACH,GACaS,IAA6B;AAAA,EACxCT,EAAG,SAAS,aAAa;AAAA,IACvB,QAAQ,MAAM;AAAA,IACd,MAAM,CAAC,EAAE,KAAAO,QAAU;AACX,YAAAG,IAAOH,EAAI,SAAS,WAAW;AACrC,aAAOI,EAAWD,CAAI;AAAA,IACxB;AAAA,IACA,cAAc;AAAA,EAAA,CACf;AAAA,EACDV,EAAG,SAAS,aAAa;AAAA,IACvB,QAAQ,MAAM;AAAA,IACd,MAAM,CAAC,EAAE,KAAAO,QAAU;AACX,YAAAG,IAAOH,EAAI,SAAS,WAAW;AACrC,aAAOI,EAAWD,CAAI;AAAA,IACxB;AAAA,IACA,cAAc;AAAA,EACf,CAAA;AACH;"}
@@ -1,25 +1,22 @@
1
- import { jsxs as r, jsx as e, Fragment as d } from "react/jsx-runtime";
2
- import { Table as p, TableHeader as h, TableRow as c, TableCell as a, TableBody as u, TableFooter as f } from "../ui/table.es.js";
3
- import { flexRender as m } from "@tanstack/react-table";
4
- import { Info as x } from "lucide-react";
5
- function y({
1
+ import { jsxs as r, jsx as e, Fragment as m } from "react/jsx-runtime";
2
+ import { ACTIONS_COLUMN_ID as d } from "./data-table.es.js";
3
+ import { Table as p, TableHeader as f, TableRow as c, TableCell as i, TableBody as h, TableFooter as x } from "../ui/table.es.js";
4
+ import { flexRender as g } from "@tanstack/react-table";
5
+ import { Info as b } from "lucide-react";
6
+ function I({
6
7
  table: n,
7
- columns: g,
8
+ columns: u,
8
9
  dataQuery: s
9
10
  }) {
10
- var i;
11
- return /* @__PURE__ */ r(p, { className: "relative h-full w-full", children: [
12
- /* @__PURE__ */ e(h, { className: "sticky top-0 z-10", children: n.getHeaderGroups().map((o, l) => /* @__PURE__ */ e(c, { className: "border-b", children: o.headers.map((t) => /* @__PURE__ */ r(
13
- a,
11
+ var a;
12
+ return /* @__PURE__ */ r(p, { className: "size-full", children: [
13
+ /* @__PURE__ */ e(f, { className: "sticky top-0 z-10", children: n.getHeaderGroups().map((o, l) => /* @__PURE__ */ e(c, { children: o.headers.map((t) => /* @__PURE__ */ r(
14
+ i,
14
15
  {
15
- className: `
16
- px-4 py-2 text-left text-sm font-medium cursor-pointer whitespace-nowrap
17
- bg-card
18
- ${t.id === "actions" ? "sticky right-0 z-50 bg-card" : ""}
19
- `,
16
+ className: `px-4 py-2 cursor-pointer text-left text-sm font-medium bg-card whitespace-nowrap ${t.id === d ? "sticky right-0 z-50 text-center" : ""}`,
20
17
  onClick: t.column.getToggleSortingHandler(),
21
18
  children: [
22
- t.isPlaceholder ? null : m(t.column.columnDef.header, t.getContext()),
19
+ t.isPlaceholder ? null : g(t.column.columnDef.header, t.getContext()),
23
20
  {
24
21
  asc: "↑",
25
22
  desc: "↓"
@@ -28,24 +25,30 @@ function y({
28
25
  },
29
26
  t.id
30
27
  )) }, l)) }),
31
- /* @__PURE__ */ e(u, { className: "flex-1 overflow-y-auto", children: n.getRowModel().rows.length ? n.getRowModel().rows.map((o) => /* @__PURE__ */ e(c, { "data-state": o.getIsSelected() && "selected", children: o.getVisibleCells().map((l) => /* @__PURE__ */ e(
32
- a,
33
- {
34
- className: `
35
- px-4 py-2 text-left text-sm whitespace-nowrap
36
- ${l.column.id === "actions" ? "sticky right-0 bg-card text-center shadow-2xl" : ""}
28
+ /* @__PURE__ */ e(h, { className: "flex-1 overflow-y-auto", children: n.getRowModel().rows.length ? (
29
+ // Render table data
30
+ n.getRowModel().rows.map((o) => /* @__PURE__ */ e(c, { className: "transition-colors data-[state=selected]:bg-muted-foreground/30 hover:bg-muted-foreground/20", "data-state": o.getIsSelected() && "selected", children: o.getVisibleCells().map((l) => /* @__PURE__ */ e(
31
+ i,
32
+ {
33
+ className: `
34
+ px-4 py-2 text-left text-sm whitespace-nowrap
35
+ ${l.column.id === d ? "sticky right-0 w-20 bg-card" : ""}
37
36
  `,
38
- children: m(l.column.columnDef.cell, l.getContext())
39
- },
40
- l.id
41
- )) }, o.id)) : /* @__PURE__ */ e(c, { className: "h-[55vh] hover:bg-transparent cursor-not-allowed", children: /* @__PURE__ */ e(a, { colSpan: g.length, className: "border-none", children: /* @__PURE__ */ e("span", { className: "flex gap-3 justify-center items-center", children: !s.isFetching && (s.isError ? /* @__PURE__ */ r(d, { children: [
42
- /* @__PURE__ */ e(x, {}),
43
- " You don't have the required permissions. Please contact your admin."
44
- ] }) : (i = s.data) != null && i.data ? null : /* @__PURE__ */ e(d, { children: "No result found." })) }) }) }) }),
45
- s.isFetching && /* @__PURE__ */ e(f, { className: "absolute inset-0 z-20 flex justify-center items-center bg-card/80" })
37
+ children: g(l.column.columnDef.cell, l.getContext())
38
+ },
39
+ l.id
40
+ )) }, o.id))
41
+ ) : (
42
+ // Empty table
43
+ /* @__PURE__ */ e(c, { className: "cursor-not-allowed", children: /* @__PURE__ */ e(i, { colSpan: u.length, className: "border-none", children: /* @__PURE__ */ e("span", { className: "flex gap-3 justify-center items-center", children: !s.isFetching && (s.isError ? /* @__PURE__ */ r(m, { children: [
44
+ /* @__PURE__ */ e(b, {}),
45
+ " You don't have the required permissions. Please contact your admin."
46
+ ] }) : (a = s.data) != null && a.data ? null : /* @__PURE__ */ e(m, { children: "No result found." })) }) }) })
47
+ ) }),
48
+ s.isFetching && /* @__PURE__ */ e(x, { className: "absolute inset-0 z-20 flex justify-center items-center bg-card/80" })
46
49
  ] });
47
50
  }
48
51
  export {
49
- y as TableContent
52
+ I as TableContent
50
53
  };
51
54
  //# sourceMappingURL=table-content.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"table-content.es.js","sources":["../../../lib/components/data-table/table-content.tsx"],"sourcesContent":["import {\n Table as CxTable,\n TableBody,\n TableCell,\n TableFooter,\n TableHeader,\n TableRow,\n} from '@/components/ui/table';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { ColumnDef, Table, flexRender } from '@tanstack/react-table';\nimport { Info } from 'lucide-react';\n\nexport function TableContent<TData, TValue>({\n table,\n columns,\n dataQuery,\n}: {\n table: Table<TData>;\n columns: ColumnDef<TData, TValue>[];\n dataQuery: UseQueryResult<any, unknown>;\n}) {\n return (\n <CxTable className=\"relative h-full w-full\">\n <TableHeader className=\"sticky top-0 z-10\">\n {table.getHeaderGroups().map((headerGroup, index) => (\n <TableRow key={index} className=\"border-b\">\n {headerGroup.headers.map((header) => (\n <TableCell\n key={header.id}\n className={`\n px-4 py-2 text-left text-sm font-medium cursor-pointer whitespace-nowrap \n bg-card \n ${header.id === 'actions' ? 'sticky right-0 z-50 bg-card' : ''}\n `}\n onClick={header.column.getToggleSortingHandler()}\n >\n {header.isPlaceholder\n ? null\n : flexRender(header.column.columnDef.header, header.getContext())}\n {{\n asc: '↑',\n desc: '↓',\n }[header.column.getIsSorted() as string] ?? null}\n </TableCell>\n ))}\n </TableRow>\n ))}\n </TableHeader>\n <TableBody className=\"flex-1 overflow-y-auto\">\n {table.getRowModel().rows.length ? (\n table.getRowModel().rows.map((row) => (\n <TableRow key={row.id} data-state={row.getIsSelected() && 'selected'}>\n {row.getVisibleCells().map((cell) => (\n <TableCell\n key={cell.id}\n className={`\n px-4 py-2 text-left text-sm whitespace-nowrap \n ${\n cell.column.id === 'actions'\n ? 'sticky right-0 bg-card text-center shadow-2xl'\n : ''\n }\n `}\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </TableCell>\n ))}\n </TableRow>\n ))\n ) : (\n <TableRow className=\"h-[55vh] hover:bg-transparent cursor-not-allowed\">\n <TableCell colSpan={columns.length} className=\"border-none\">\n <span className=\"flex gap-3 justify-center items-center\">\n {!dataQuery.isFetching && (\n dataQuery.isError ? (\n <>\n <Info /> You don't have the required permissions. Please contact your admin.\n </>\n ) : !dataQuery.data?.data ? (\n <>No result found.</>\n ) : null\n )}\n </span>\n </TableCell>\n </TableRow>\n \n )}\n </TableBody>\n {/* Loader positioned to cover entire table viewport */}\n {dataQuery.isFetching && (\n <TableFooter className=\"absolute inset-0 z-20 flex justify-center items-center bg-card/80\" />\n )}\n </CxTable>\n );\n}\n"],"names":["TableContent","table","columns","dataQuery","jsxs","CxTable","jsx","TableHeader","headerGroup","index","TableRow","header","TableCell","flexRender","TableBody","row","cell","Fragment","Info","_a","TableFooter"],"mappings":";;;;AAYO,SAASA,EAA4B;AAAA,EAC1C,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AACF,GAIG;;AAEC,SAAA,gBAAAC,EAACC,GAAQ,EAAA,WAAU,0BACjB,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAY,WAAU,q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,eACVA,EAAU,UAEN,gBAAAC,EAAAa,GAAA,EAAA,UAAA;AAAA,MAAA,gBAAAX,EAACY,GAAK,EAAA;AAAA,MAAE;AAAA,IAAA,EACV,CAAA,KACGC,IAAAhB,EAAU,SAAV,QAAAgB,EAAgB,OAEjB,OADA,gBAAAb,EAAAW,GAAA,EAAA,UAAA,mBAAA,CAAgB,GAGxB,CAAA,EACF,CAAA,EACF,CAAA,GAGF;AAAA,IAECd,EAAU,cACR,gBAAAG,EAAAc,GAAA,EAAY,WAAU,oEAAoE,CAAA;AAAA,EAAA,GAE/F;AAEJ;"}
1
+ {"version":3,"file":"table-content.es.js","sources":["../../../lib/components/data-table/table-content.tsx"],"sourcesContent":["import { ACTIONS_COLUMN_ID } from '@/components/data-table/data-table';\nimport {\n TableBody,\n TableCell,\n Table as TableComponent,\n TableFooter,\n TableHeader,\n TableRow,\n} from '@/components/ui/table';\nimport type { UseQueryResult } from '@tanstack/react-query';\nimport { ColumnDef, Table, flexRender } from '@tanstack/react-table';\nimport { Info } from 'lucide-react';\n\nexport function TableContent<TData, TValue>({\n table,\n columns,\n dataQuery,\n}: {\n table: Table<TData>;\n columns: ColumnDef<TData, TValue>[];\n dataQuery: UseQueryResult<any, unknown>;\n}) {\n return (\n <TableComponent className=\"size-full\">\n <TableHeader className=\"sticky top-0 z-10\">\n {table.getHeaderGroups().map((headerGroup, index) => (\n <TableRow key={index}>\n {headerGroup.headers.map((header) => (\n <TableCell\n key={header.id}\n className={`px-4 py-2 cursor-pointer text-left text-sm font-medium bg-card whitespace-nowrap ${header.id === ACTIONS_COLUMN_ID ? 'sticky right-0 z-50 text-center' : ''}`}\n onClick={header.column.getToggleSortingHandler()}\n >\n {/* TODO Better interaction design here. */}\n {header.isPlaceholder\n ? null\n : flexRender(header.column.columnDef.header, header.getContext())}\n\n {{\n asc: '↑',\n desc: '↓',\n }[header.column.getIsSorted() as string] ?? null}\n </TableCell>\n ))}\n </TableRow>\n ))}\n </TableHeader>\n <TableBody className=\"flex-1 overflow-y-auto\">\n {table.getRowModel().rows.length ?\n // Render table data\n (\n table.getRowModel().rows.map((row) => (\n <TableRow className='transition-colors data-[state=selected]:bg-muted-foreground/30 hover:bg-muted-foreground/20' key={row.id} data-state={row.getIsSelected() && 'selected'}>\n {row.getVisibleCells().map((cell) => (\n <TableCell\n key={cell.id}\n className={`\n px-4 py-2 text-left text-sm whitespace-nowrap\n ${cell.column.id === ACTIONS_COLUMN_ID\n ? 'sticky right-0 w-20 bg-card'\n : ''\n }\n `}\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </TableCell>\n ))}\n </TableRow>\n ))\n )\n :\n // Empty table\n (\n <TableRow className=\"cursor-not-allowed\">\n <TableCell colSpan={columns.length} className=\"border-none\">\n <span className=\"flex gap-3 justify-center items-center\">\n {!dataQuery.isFetching && (\n dataQuery.isError ? (\n <>\n <Info /> You don't have the required permissions. Please contact your admin.\n </>\n ) : !dataQuery.data?.data ? (\n <>No result found.</>\n ) : null\n )}\n </span>\n </TableCell>\n </TableRow>\n )}\n </TableBody>\n {/* Loader positioned to cover entire table viewport */}\n {dataQuery.isFetching && (\n <TableFooter className=\"absolute inset-0 z-20 flex justify-center items-center bg-card/80\" />\n )}\n </TableComponent>\n );\n}\n"],"names":["TableContent","table","columns","dataQuery","jsxs","TableComponent","jsx","TableHeader","headerGroup","index","TableRow","header","TableCell","ACTIONS_COLUMN_ID","flexRender","TableBody","row","cell","Fragment","Info","_a","TableFooter"],"mappings":";;;;;AAaO,SAASA,EAA4B;AAAA,EAC1C,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AACF,GAIG;;AAEC,SAAA,gBAAAC,EAACC,GAAe,EAAA,WAAU,aACxB,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAY,WAAU,qBACpB,UAAMN,EAAA,kBAAkB,IAAI,CAACO,GAAaC,wBACxCC,GACE,EAAA,UAAAF,EAAY,QAAQ,IAAI,CAACG,MACxB,gBAAAP;AAAA,MAACQ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,mBAAA,CAAA,GAGxB,CAAA,EACF,CAAA,EACF,CAAA;AAAA,OAEN;AAAA,IAECjB,EAAU,cACR,gBAAAG,EAAAe,GAAA,EAAY,WAAU,oEAAoE,CAAA;AAAA,EAAA,GAE/F;AAEJ;"}
@@ -2,27 +2,27 @@ import { jsxs as n, jsx as e, Fragment as M } from "react/jsx-runtime";
2
2
  import { Badge as $ } from "../ui/badge.es.js";
3
3
  import { Button as F } from "../ui/button.es.js";
4
4
  import { Calendar as q } from "../ui/calendar.es.js";
5
- import { Form as B, FormField as s, FormItem as m, FormLabel as u, FormControl as h, FormMessage as p } from "../ui/form.es.js";
5
+ import { Form as B, FormField as m, FormItem as s, FormLabel as u, FormControl as h, FormMessage as p } from "../ui/form.es.js";
6
6
  import { Input as P } from "../ui/input.es.js";
7
- import { Popover as f, PopoverTrigger as R, PopoverContent as b } from "../ui/popover.es.js";
8
- import { Select as N, SelectTrigger as S, SelectValue as y, SelectContent as w, SelectItem as v } from "../ui/select.es.js";
7
+ import { Popover as R, PopoverTrigger as b, PopoverContent as f } from "../ui/popover.es.js";
8
+ import { Select as N, SelectTrigger as S, SelectValue as y, SelectContent as w, SelectItem as g } from "../ui/select.es.js";
9
9
  import { cn as k } from "../../utils/index.es.js";
10
10
  import { zodResolver as U } from "@hookform/resolvers/zod";
11
11
  import { format as X } from "date-fns";
12
12
  import { X as Y, FilterIcon as G } from "lucide-react";
13
13
  import { useState as T } from "react";
14
14
  import { useForm as H } from "react-hook-form";
15
- import g from "zod";
15
+ import v from "zod";
16
16
  import { getResourceDisplayName as E, COMPARISON_OPERATOR_LABELS as j, OPERATORS_FOR_FILTER_TYPE as J, FILTER_COMPARISON_OPERATORS as K } from "./table-utils/constants.es.js";
17
- const Q = g.object({
17
+ const Q = v.object({
18
18
  // For identifing a filter for updation and deletion
19
- id: g.string().min(1, "Field is required"),
20
- property: g.string().min(1, "Field is required."),
21
- operator: g.enum(K, {
19
+ id: v.string().min(1, "Field is required"),
20
+ property: v.string().min(1, "Field is required."),
21
+ operator: v.enum(K, {
22
22
  errorMap: () => ({ message: "Invalid comparison operator" })
23
23
  }),
24
- value: g.string().min(1, "Field is required.")
25
- }), ve = ({
24
+ value: v.string().min(1, "Field is required.")
25
+ }), ge = ({
26
26
  filterableProperties: t,
27
27
  filters: c,
28
28
  onFiltersChange: a
@@ -54,11 +54,11 @@ const Q = g.object({
54
54
  };
55
55
  return /* @__PURE__ */ e(B, { ...l, children: /* @__PURE__ */ n("form", { onSubmit: l.handleSubmit(V), className: "flex flex-col gap-2 min-w-60", children: [
56
56
  /* @__PURE__ */ e(
57
- s,
57
+ m,
58
58
  {
59
59
  control: l.control,
60
60
  name: "property",
61
- render: ({ field: d }) => /* @__PURE__ */ n(m, { children: [
61
+ render: ({ field: d }) => /* @__PURE__ */ n(s, { children: [
62
62
  /* @__PURE__ */ e(u, { children: "Property" }),
63
63
  /* @__PURE__ */ n(
64
64
  N,
@@ -68,7 +68,7 @@ const Q = g.object({
68
68
  disabled: !!r,
69
69
  children: [
70
70
  /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(y, {}) }) }),
71
- /* @__PURE__ */ e(w, { autoFocus: !0, children: Object.entries(t).map(([o]) => /* @__PURE__ */ e(v, { value: o, children: E(o, "admin-portal") }, o)) })
71
+ /* @__PURE__ */ e(w, { autoFocus: !0, children: Object.entries(t).map(([o]) => /* @__PURE__ */ e(g, { value: o, children: E(o, "admin-portal") }, o)) })
72
72
  ]
73
73
  }
74
74
  ),
@@ -78,16 +78,16 @@ const Q = g.object({
78
78
  ),
79
79
  i && /* @__PURE__ */ n(M, { children: [
80
80
  /* @__PURE__ */ e(
81
- s,
81
+ m,
82
82
  {
83
83
  control: l.control,
84
84
  name: "operator",
85
- render: ({ field: d }) => /* @__PURE__ */ n(m, { children: [
85
+ render: ({ field: d }) => /* @__PURE__ */ n(s, { children: [
86
86
  /* @__PURE__ */ e(u, { children: "Comparison" }),
87
87
  /* @__PURE__ */ n(N, { onValueChange: d.onChange, defaultValue: d.value, children: [
88
88
  /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(y, {}) }) }),
89
89
  /* @__PURE__ */ e(w, { children: t[i] && J[t[i]].map(
90
- (o) => /* @__PURE__ */ e(v, { value: o, children: j[o] }, o)
90
+ (o) => /* @__PURE__ */ e(g, { value: o, children: j[o] }, o)
91
91
  ) })
92
92
  ] }),
93
93
  /* @__PURE__ */ e(p, {})
@@ -114,23 +114,21 @@ const Q = g.object({
114
114
  /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-2 items-center", children: c.map((r, l) => /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
115
115
  /* @__PURE__ */ n("div", { className: "flex items-center", children: [
116
116
  /* @__PURE__ */ n(
117
- f,
117
+ R,
118
118
  {
119
119
  open: x === r.id,
120
120
  onOpenChange: (i) => {
121
121
  i || C(null);
122
122
  },
123
123
  children: [
124
- /* @__PURE__ */ e(R, { children: /* @__PURE__ */ e(
124
+ /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(
125
125
  $,
126
126
  {
127
127
  onClick: () => C(r.id),
128
- variant: "default",
129
- className: "cursor-pointer h-7",
130
128
  children: L(r)
131
129
  }
132
130
  ) }),
133
- /* @__PURE__ */ e(b, { className: "w-auto", align: "start", children: /* @__PURE__ */ e(A, { filter: r }) })
131
+ /* @__PURE__ */ e(f, { className: "w-auto", align: "start", children: /* @__PURE__ */ e(A, { filter: r }) })
134
132
  ]
135
133
  }
136
134
  ),
@@ -139,8 +137,7 @@ const Q = g.object({
139
137
  {
140
138
  icon: Y,
141
139
  variant: "destructive",
142
- className: "h-7 -ml-0.5",
143
- size: "icon",
140
+ size: "sm",
144
141
  onClick: () => _(r.id)
145
142
  }
146
143
  )
@@ -148,26 +145,26 @@ const Q = g.object({
148
145
  l < c.length - 1 && /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "and" })
149
146
  ] }, r.id)) })
150
147
  ] }) }),
151
- /* @__PURE__ */ n(f, { open: z, onOpenChange: O, children: [
152
- /* @__PURE__ */ e(R, { asChild: !0, children: /* @__PURE__ */ e(F, { icon: G, variant: "outline" }) }),
153
- /* @__PURE__ */ e(b, { className: "w-auto p-4", align: "start", children: /* @__PURE__ */ e(A, {}) })
148
+ /* @__PURE__ */ n(R, { open: z, onOpenChange: O, children: [
149
+ /* @__PURE__ */ e(b, { asChild: !0, children: /* @__PURE__ */ e(F, { icon: G, variant: "outline" }) }),
150
+ /* @__PURE__ */ e(f, { className: "w-auto p-4", align: "start", children: /* @__PURE__ */ e(A, {}) })
154
151
  ] })
155
152
  ] });
156
153
  }, W = ({ control: t, propertyType: c }) => {
157
154
  switch (c) {
158
155
  case "boolean":
159
156
  return /* @__PURE__ */ e(
160
- s,
157
+ m,
161
158
  {
162
159
  control: t,
163
160
  name: "value",
164
- render: ({ field: a }) => /* @__PURE__ */ n(m, { children: [
161
+ render: ({ field: a }) => /* @__PURE__ */ n(s, { children: [
165
162
  /* @__PURE__ */ e(u, { children: "Value" }),
166
163
  /* @__PURE__ */ n(N, { onValueChange: a.onChange, defaultValue: a.value, children: [
167
164
  /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(y, {}) }) }),
168
165
  /* @__PURE__ */ n(w, { children: [
169
- /* @__PURE__ */ e(v, { value: "true", children: "True" }),
170
- /* @__PURE__ */ e(v, { value: "false", children: "False" })
166
+ /* @__PURE__ */ e(g, { value: "true", children: "True" }),
167
+ /* @__PURE__ */ e(g, { value: "false", children: "False" })
171
168
  ] })
172
169
  ] }),
173
170
  /* @__PURE__ */ e(p, {})
@@ -176,14 +173,14 @@ const Q = g.object({
176
173
  );
177
174
  case "objectDate":
178
175
  return /* @__PURE__ */ e(
179
- s,
176
+ m,
180
177
  {
181
178
  control: t,
182
179
  name: "value",
183
- render: ({ field: a }) => /* @__PURE__ */ n(m, { className: "flex flex-col", children: [
180
+ render: ({ field: a }) => /* @__PURE__ */ n(s, { className: "flex flex-col", children: [
184
181
  /* @__PURE__ */ e(u, { children: "Value" }),
185
- /* @__PURE__ */ n(f, { children: [
186
- /* @__PURE__ */ e(R, { asChild: !0, children: /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(
182
+ /* @__PURE__ */ n(R, { children: [
183
+ /* @__PURE__ */ e(b, { asChild: !0, children: /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(
187
184
  F,
188
185
  {
189
186
  variant: "outline",
@@ -194,7 +191,7 @@ const Q = g.object({
194
191
  children: a.value ? X(new Date(a.value), "PPP") : /* @__PURE__ */ e("span", { children: "Pick a date" })
195
192
  }
196
193
  ) }) }),
197
- /* @__PURE__ */ e(b, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ e(
194
+ /* @__PURE__ */ e(f, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ e(
198
195
  q,
199
196
  {
200
197
  mode: "single",
@@ -212,18 +209,18 @@ const Q = g.object({
212
209
  );
213
210
  case "role":
214
211
  return /* @__PURE__ */ e(
215
- s,
212
+ m,
216
213
  {
217
214
  control: t,
218
215
  name: "value",
219
- render: ({ field: a }) => /* @__PURE__ */ n(m, { children: [
216
+ render: ({ field: a }) => /* @__PURE__ */ n(s, { children: [
220
217
  /* @__PURE__ */ e(u, { children: "Value" }),
221
218
  /* @__PURE__ */ n(N, { onValueChange: a.onChange, defaultValue: a.value, children: [
222
219
  /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(S, { children: /* @__PURE__ */ e(y, {}) }) }),
223
220
  /* @__PURE__ */ n(w, { children: [
224
- /* @__PURE__ */ e(v, { value: "user", children: "User" }),
225
- /* @__PURE__ */ e(v, { value: "organization-admin", children: "Organization Admin" }),
226
- /* @__PURE__ */ e(v, { value: "reseller-admin", children: "Reseller Admin" })
221
+ /* @__PURE__ */ e(g, { value: "user", children: "User" }),
222
+ /* @__PURE__ */ e(g, { value: "organization-admin", children: "Organization Admin" }),
223
+ /* @__PURE__ */ e(g, { value: "reseller-admin", children: "Reseller Admin" })
227
224
  ] })
228
225
  ] }),
229
226
  /* @__PURE__ */ e(p, {})
@@ -232,11 +229,11 @@ const Q = g.object({
232
229
  );
233
230
  case "number":
234
231
  return /* @__PURE__ */ e(
235
- s,
232
+ m,
236
233
  {
237
234
  control: t,
238
235
  name: "value",
239
- render: ({ field: a }) => /* @__PURE__ */ n(m, { children: [
236
+ render: ({ field: a }) => /* @__PURE__ */ n(s, { children: [
240
237
  /* @__PURE__ */ e(u, { children: "Value" }),
241
238
  /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(P, { ...a, type: "number" }) }),
242
239
  /* @__PURE__ */ e(p, {})
@@ -245,11 +242,11 @@ const Q = g.object({
245
242
  );
246
243
  default:
247
244
  return /* @__PURE__ */ e(
248
- s,
245
+ m,
249
246
  {
250
247
  control: t,
251
248
  name: "value",
252
- render: ({ field: a }) => /* @__PURE__ */ n(m, { children: [
249
+ render: ({ field: a }) => /* @__PURE__ */ n(s, { children: [
253
250
  /* @__PURE__ */ e(u, { children: "Value" }),
254
251
  /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(P, { ...a, type: "text" }) }),
255
252
  /* @__PURE__ */ e(p, {})
@@ -259,6 +256,6 @@ const Q = g.object({
259
256
  }
260
257
  };
261
258
  export {
262
- ve as TableFilter
259
+ ge as TableFilter
263
260
  };
264
261
  //# sourceMappingURL=table-filter.es.js.map