@sqrzro/admin 2.1.0-bz.9 → 2.1.0-r19.3

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 (126) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +8 -5
  3. package/assets/images/check-white.svg +3 -0
  4. package/assets/images/chevron.svg +3 -0
  5. package/assets/images/close.svg +3 -0
  6. package/assets/images/danger.svg +3 -0
  7. package/assets/images/eye.svg +12 -0
  8. package/assets/images/info.svg +3 -0
  9. package/assets/images/success.svg +3 -0
  10. package/assets/images/warning.svg +3 -0
  11. package/dist/components/AppLayout/index.d.ts +2 -2
  12. package/dist/components/AppLayout/index.js +7 -5
  13. package/dist/components/AppNavigation/index.d.ts +4 -2
  14. package/dist/components/AppNavigation/index.js +4 -13
  15. package/dist/components/AppNavigationComponent/index.d.ts +11 -0
  16. package/dist/components/AppNavigationComponent/index.js +19 -0
  17. package/dist/components/AppNavigationSub/index.d.ts +11 -0
  18. package/dist/components/AppNavigationSub/index.js +12 -0
  19. package/dist/components/Auth/index.d.ts +10 -0
  20. package/dist/components/Auth/index.js +10 -0
  21. package/dist/components/Badge/index.d.ts +1 -2
  22. package/dist/components/Badge/index.js +16 -7
  23. package/dist/components/BooleanFilter/index.d.ts +0 -1
  24. package/dist/components/Dashboard/index.d.ts +0 -1
  25. package/dist/components/Dashboard/index.js +1 -1
  26. package/dist/components/DataTable/index.d.ts +5 -0
  27. package/dist/components/DataTable/index.js +5 -0
  28. package/dist/components/DateFilter/index.d.ts +0 -1
  29. package/dist/components/DateFilter/index.js +24 -1
  30. package/dist/components/DropdownFilter/index.d.ts +0 -1
  31. package/dist/components/FilterBar/index.d.ts +4 -3
  32. package/dist/components/FilterBar/index.js +30 -3
  33. package/dist/components/FilterBarClearButton/index.d.ts +5 -0
  34. package/dist/components/FilterBarClearButton/index.js +5 -0
  35. package/dist/components/FilterBarItem/index.d.ts +4 -3
  36. package/dist/components/FilterBarItem/index.js +6 -5
  37. package/dist/components/GridList/index.d.ts +2 -3
  38. package/dist/components/GridListItem/index.d.ts +1 -2
  39. package/dist/components/GridListItem/index.js +3 -2
  40. package/dist/components/InfoPanel/index.d.ts +2 -2
  41. package/dist/components/InfoPanel/index.js +18 -6
  42. package/dist/components/List/index.d.ts +4 -20
  43. package/dist/components/List/index.js +13 -17
  44. package/dist/components/ListActions/index.d.ts +6 -4
  45. package/dist/components/ListActions/index.js +16 -3
  46. package/dist/components/ListClientComponent/index.d.ts +13 -0
  47. package/dist/components/ListClientComponent/index.js +14 -0
  48. package/dist/components/ListComponent/index.d.ts +13 -0
  49. package/dist/components/ListComponent/index.js +21 -0
  50. package/dist/components/ListItem/index.d.ts +19 -10
  51. package/dist/components/ListItem/index.js +18 -5
  52. package/dist/components/ListSkeleton/index.d.ts +4 -0
  53. package/dist/components/ListSkeleton/index.js +5 -0
  54. package/dist/components/MeActions/index.d.ts +4 -2
  55. package/dist/components/MeActions/index.js +4 -11
  56. package/dist/components/MePanel/index.d.ts +3 -2
  57. package/dist/components/MePanel/index.js +3 -2
  58. package/dist/components/Menu/index.d.ts +7 -0
  59. package/dist/components/Menu/index.js +7 -0
  60. package/dist/components/MenuItem/index.d.ts +4 -0
  61. package/dist/components/MenuItem/index.js +20 -0
  62. package/dist/components/Page/index.d.ts +4 -3
  63. package/dist/components/Page/index.js +6 -3
  64. package/dist/components/PageActions/index.d.ts +0 -1
  65. package/dist/components/PaginatedList/index.d.ts +8 -0
  66. package/dist/components/PaginatedList/index.js +18 -0
  67. package/dist/components/PaginatedListComponent/index.d.ts +13 -0
  68. package/dist/components/PaginatedListComponent/index.js +20 -0
  69. package/dist/components/Pagination/index.d.ts +7 -0
  70. package/dist/components/Pagination/index.js +40 -0
  71. package/dist/components/PaginationItem/index.d.ts +9 -0
  72. package/dist/components/PaginationItem/index.js +16 -0
  73. package/dist/components/Panel/index.d.ts +3 -2
  74. package/dist/components/Panel/index.js +13 -2
  75. package/dist/components/RootLayout/index.d.ts +2 -2
  76. package/dist/components/RootLayout/index.js +6 -12
  77. package/dist/components/SettingsForm/index.d.ts +6 -0
  78. package/dist/components/SettingsForm/index.js +14 -0
  79. package/dist/components/SettingsPage/index.d.ts +2 -0
  80. package/dist/components/SettingsPage/index.js +9 -0
  81. package/dist/components/Table/index.d.ts +6 -7
  82. package/dist/components/Table/index.js +16 -14
  83. package/dist/components/TableClientComponent/index.d.ts +0 -1
  84. package/dist/components/TableClientComponent/index.js +2 -11
  85. package/dist/components/TableComponent/index.d.ts +11 -0
  86. package/dist/components/TableComponent/index.js +17 -0
  87. package/dist/components/Tabs/index.d.ts +2 -7
  88. package/dist/components/Tabs/index.js +5 -22
  89. package/dist/components/TabsComponent/index.d.ts +7 -0
  90. package/dist/components/TabsComponent/index.js +9 -0
  91. package/dist/components/index.d.ts +12 -5
  92. package/dist/components/index.js +5 -2
  93. package/dist/hooks/useNavigation.d.ts +11 -0
  94. package/dist/hooks/useNavigation.js +27 -0
  95. package/dist/index.cjs +1266 -0
  96. package/dist/index.cjs.map +1 -0
  97. package/dist/index.js.map +1 -0
  98. package/dist/interfaces.d.ts +8 -2
  99. package/dist/services/ConfigService.d.ts +8 -3
  100. package/dist/services/ConfigService.js +6 -6
  101. package/dist/services/PermissionService.d.ts +3 -0
  102. package/dist/services/PermissionService.js +30 -0
  103. package/dist/services/SettingsService.d.ts +8 -0
  104. package/dist/services/SettingsService.js +9 -0
  105. package/dist/styles/config.js +119 -47
  106. package/dist/styles/tailwind.d.ts +9 -1
  107. package/dist/styles/tailwind.js +16 -3
  108. package/package.json +46 -45
  109. package/dist/components/Icon/index.d.ts +0 -8
  110. package/dist/components/Icon/index.js +0 -22
  111. package/dist/components/LoginForm/index.d.ts +0 -8
  112. package/dist/components/LoginForm/index.js +0 -7
  113. package/dist/icons/ErrorIcon/index.d.ts +0 -3
  114. package/dist/icons/ErrorIcon/index.js +0 -5
  115. package/dist/icons/InfoIcon/index.d.ts +0 -3
  116. package/dist/icons/InfoIcon/index.js +0 -5
  117. package/dist/icons/SuccessIcon/index.d.ts +0 -3
  118. package/dist/icons/SuccessIcon/index.js +0 -5
  119. package/dist/icons/WarningIcon/index.d.ts +0 -3
  120. package/dist/icons/WarningIcon/index.js +0 -5
  121. package/dist/services/AuthService.d.ts +0 -1
  122. package/dist/services/AuthService.js +0 -5
  123. package/dist/utility/formatters.d.ts +0 -1
  124. package/dist/utility/formatters.js +0 -8
  125. /package/{postcss.js → postcss.cjs} +0 -0
  126. /package/{tailwind.js → tailwind.cjs} +0 -0
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023 Richard Carter
1
+ Copyright 2024 Richard Carter
2
2
 
3
3
  Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
4
4
 
package/README.md CHANGED
@@ -1,14 +1,17 @@
1
1
  <div align="center">
2
2
 
3
- # Square Zero Admin
4
-
5
- Square Zero Admin is an intentionally opionated collection of components, hooks, services and utilities that lets you very quickly build admin systems in Typescript & React.
3
+ <h1>
4
+ <img src="assets/logo.svg" alt="" width="64" style="margin-bottom: 5px">
5
+ <br />
6
+ Square Zero Admin
7
+ </h1>
6
8
 
7
- [Click here to get started](/story/guides-installation--page)
9
+ <p>An intentionally opionated collection of components, hooks, services and utilities that lets you very quickly build admin systems in Typescript & React.</p>
10
+ <p>[Click here to get started](/story/guides-installation--page)</p>
8
11
 
9
12
  <hr />
10
13
 
11
- [![GitHub license](https://img.shields.io/badge/license-ISC-blue.svg)](https://github.com/sqrzro/admin/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/@sqrzro/admin.svg?style=flat)](https://www.npmjs.com/package/@sqrzro/admin) [![Build](https://github.com/sqrzro/admin/actions/workflows/development.yml/badge.svg)](https://github.com/sqrzro/admin/actions/workflows/development.yml)
14
+ [![GitHub license](https://img.shields.io/badge/license-ISC-blue.svg)](https://github.com/sqrzro/sqrzro/admin/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/@sqrzro/admin.svg?style=flat)](https://www.npmjs.com/package/@sqrzro/admin) [![Build](https://github.com/sqrzro/sqrzro/admin/actions/workflows/development.yml/badge.svg)](https://github.com/sqrzro/sqrzro/admin/actions/workflows/development.yml)
12
15
 
13
16
  </div>
14
17
 
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M20.7071 5.29289C21.0976 5.68342 21.0976 6.31658 20.7071 6.70711L9.70711 17.7071C9.31658 18.0976 8.68342 18.0976 8.29289 17.7071L3.29289 12.7071C2.90237 12.3166 2.90237 11.6834 3.29289 11.2929C3.68342 10.9024 4.31658 10.9024 4.70711 11.2929L9 15.5858L19.2929 5.29289C19.6834 4.90237 20.3166 4.90237 20.7071 5.29289Z" fill="white"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M5.29289 8.29289C5.68342 7.90237 6.31658 7.90237 6.70711 8.29289L12 13.5858L17.2929 8.29289C17.6834 7.90237 18.3166 7.90237 18.7071 8.29289C19.0976 8.68342 19.0976 9.31658 18.7071 9.70711L12.7071 15.7071C12.3166 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70711C4.90237 9.31658 4.90237 8.68342 5.29289 8.29289Z" fill="#64748B"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z" fill="#64748B"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3ZM1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM8.29289 8.29289C8.68342 7.90237 9.31658 7.90237 9.70711 8.29289L12 10.5858L14.2929 8.29289C14.6834 7.90237 15.3166 7.90237 15.7071 8.29289C16.0976 8.68342 16.0976 9.31658 15.7071 9.70711L13.4142 12L15.7071 14.2929C16.0976 14.6834 16.0976 15.3166 15.7071 15.7071C15.3166 16.0976 14.6834 16.0976 14.2929 15.7071L12 13.4142L9.70711 15.7071C9.31658 16.0976 8.68342 16.0976 8.29289 15.7071C7.90237 15.3166 7.90237 14.6834 8.29289 14.2929L10.5858 12L8.29289 9.70711C7.90237 9.31658 7.90237 8.68342 8.29289 8.29289Z" fill="#EF4444"/>
3
+ </svg>
@@ -0,0 +1,12 @@
1
+ <svg width="24" height="72" viewBox="0 0 24 72" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_61_10)">
3
+ <path d="M2.42012 12.7132C2.28394 12.4975 2.21584 12.3897 2.17772 12.2234C2.14909 12.0985 2.14909 11.9015 2.17772 11.7766C2.21584 11.6103 2.28394 11.5025 2.42012 11.2868C3.54553 9.50484 6.8954 5 12.0004 5C17.1054 5 20.4553 9.50484 21.5807 11.2868C21.7169 11.5025 21.785 11.6103 21.8231 11.7766C21.8517 11.9015 21.8517 12.0985 21.8231 12.2234C21.785 12.3897 21.7169 12.4975 21.5807 12.7132C20.4553 14.4952 17.1054 19 12.0004 19C6.8954 19 3.54553 14.4952 2.42012 12.7132Z" stroke="#1e293b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M12.0004 15C13.6573 15 15.0004 13.6569 15.0004 12C15.0004 10.3431 13.6573 9 12.0004 9C10.3435 9 9.0004 10.3431 9.0004 12C9.0004 13.6569 10.3435 15 12.0004 15Z" stroke="#1e293b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
5
+ <path d="M10.7429 53.0923C11.1494 53.0322 11.5686 53 12.0004 53C17.1054 53 20.4553 57.5048 21.5807 59.2868C21.7169 59.5025 21.785 59.6103 21.8231 59.7767C21.8518 59.9016 21.8517 60.0987 21.8231 60.2236C21.7849 60.3899 21.7164 60.4985 21.5792 60.7156C21.2793 61.1901 20.8222 61.8571 20.2165 62.5805M6.72432 54.715C4.56225 56.1817 3.09445 58.2194 2.42111 59.2853C2.28428 59.5019 2.21587 59.6102 2.17774 59.7765C2.1491 59.9014 2.14909 60.0984 2.17771 60.2234C2.21583 60.3897 2.28393 60.4975 2.42013 60.7132C3.54554 62.4952 6.89541 67 12.0004 67C14.0588 67 15.8319 66.2676 17.2888 65.2766M3.00042 51L21.0004 69M9.8791 57.8787C9.3362 58.4216 9.00042 59.1716 9.00042 60C9.00042 61.6569 10.3436 63 12.0004 63C12.8288 63 13.5788 62.6642 14.1217 62.1213" stroke="#1e293b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
6
+ </g>
7
+ <defs>
8
+ <clipPath id="clip0_61_10">
9
+ <rect width="24" height="72" fill="white"/>
10
+ </clipPath>
11
+ </defs>
12
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3ZM1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM11 8C11 7.44772 11.4477 7 12 7H12.01C12.5623 7 13.01 7.44772 13.01 8C13.01 8.55228 12.5623 9 12.01 9H12C11.4477 9 11 8.55228 11 8ZM12 11C12.5523 11 13 11.4477 13 12V16C13 16.5523 12.5523 17 12 17C11.4477 17 11 16.5523 11 16V12C11 11.4477 11.4477 11 12 11Z" fill="#3B82F6"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3ZM1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM17.2071 8.29289C17.5976 8.68342 17.5976 9.31658 17.2071 9.70711L11.2071 15.7071C10.8166 16.0976 10.1834 16.0976 9.79289 15.7071L6.79289 12.7071C6.40237 12.3166 6.40237 11.6834 6.79289 11.2929C7.18342 10.9024 7.81658 10.9024 8.20711 11.2929L10.5 13.5858L15.7929 8.29289C16.1834 7.90237 16.8166 7.90237 17.2071 8.29289Z" fill="#22C55E"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3ZM1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12ZM12 7C12.5523 7 13 7.44772 13 8V12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12V8C11 7.44772 11.4477 7 12 7ZM11 16C11 15.4477 11.4477 15 12 15H12.01C12.5623 15 13.01 15.4477 13.01 16C13.01 16.5523 12.5623 17 12.01 17H12C11.4477 17 11 16.5523 11 16Z" fill="#EAB308"/>
3
+ </svg>
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
2
1
  export interface AppLayoutProps {
3
2
  children: React.ReactNode;
3
+ logoutButton?: React.ReactNode;
4
4
  user?: {
5
5
  name: string;
6
6
  } | null;
7
7
  }
8
- declare function AppLayout({ children, user }: Readonly<AppLayoutProps>): React.ReactElement;
8
+ declare function AppLayout({ children, logoutButton, user, }: Readonly<AppLayoutProps>): Promise<React.ReactElement>;
9
9
  export default AppLayout;
@@ -1,12 +1,14 @@
1
- 'use server';
2
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Fragment } from 'react';
4
- import { Container, Link } from '@sqrzro/components';
2
+ import { Link, tw } from '@sqrzro/components';
5
3
  import { getConfig } from '../../services/ConfigService';
4
+ import { getLayout } from '../../services/SettingsService';
6
5
  import AppNavigation from '../AppNavigation';
7
6
  import MePanel from '../MePanel';
8
- function AppLayout({ children, user }) {
7
+ async function AppLayout({ children, logoutButton, user, }) {
9
8
  const config = getConfig();
10
- return (_jsxs(Fragment, { children: [_jsx("header", { className: "bg-slate-800", children: _jsx(Container, { isFullWidth: true, children: _jsxs("div", { className: "flex h-16 items-center border-b border-slate-700", children: [_jsxs(Link, { className: "h-9 w-9", href: "/", children: [config.logo?.(), _jsx("span", { className: "sr-only", children: config.app.name })] }), _jsx(AppNavigation, {}), _jsx(MePanel, { user: user })] }) }) }), _jsx("main", { className: "mb-10 block", children: children })] }));
9
+ const layout = await getLayout();
10
+ return (_jsxs("div", { className: tw('', layout === 'sidebar' ? 'grid grid-cols-[12rem_1fr]' : null), children: [_jsx("header", { className: "bg-slate-800", children: _jsxs("div", { className: tw('flex items-center', layout === 'sidebar'
11
+ ? 'h-screen flex-col'
12
+ : 'h-16 border-b border-slate-700 px-4'), children: [_jsxs(Link, { className: tw(layout === 'sidebar' ? 'my-7 h-12 w-12' : 'h-9 w-9'), href: "/", children: [config.logo?.(), _jsx("span", { className: "sr-only", children: config.app.name })] }), _jsx(AppNavigation, { layout: layout }), _jsx(MePanel, { layout: layout, logoutButton: logoutButton, user: user })] }) }), _jsx("main", { className: "mb-10 block", children: children })] }));
11
13
  }
12
14
  export default AppLayout;
@@ -1,3 +1,5 @@
1
- /// <reference types="react" />
2
- declare function AppNavigation(): React.ReactElement;
1
+ interface AppNavigationProps {
2
+ layout?: string;
3
+ }
4
+ declare function AppNavigation({ layout, }: Readonly<AppNavigationProps>): Promise<React.ReactElement>;
3
5
  export default AppNavigation;
@@ -1,17 +1,8 @@
1
- 'use client';
2
1
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import clsx from 'clsx';
4
- import { Link } from '@sqrzro/components';
5
- import { useNavigation } from '@sqrzro/hooks';
6
2
  import { getConfig } from '../../services/ConfigService';
7
- function getNavigation() {
8
- const { navigation } = getConfig();
9
- return Object.entries(navigation).map(([href, label]) => ({ href, label }));
10
- }
11
- function AppNavigation() {
12
- const navigation = useNavigation(getNavigation());
13
- return (_jsx("nav", { className: "h-full pl-6", children: _jsx("ul", { className: "flex h-full items-center gap-2", children: navigation.map(({ href, isActive, label }) => (_jsx("li", { className: "h-full", children: _jsx(Link, { className: clsx('relative flex h-full items-center px-1 font-semibold', isActive
14
- ? 'text-white before:absolute before:bottom-0 before:left-0 before:right-0 before:h-1 before:bg-primary'
15
- : 'text-white/80 hover:text-white'), href: href, children: label }) }, href))) }) }));
3
+ import { filterList } from '../../services/PermissionService';
4
+ import AppNavigationComponent from '../AppNavigationComponent';
5
+ async function AppNavigation({ layout, }) {
6
+ return (_jsx(AppNavigationComponent, { data: await filterList(getConfig().navigation), layout: layout }));
16
7
  }
17
8
  export default AppNavigation;
@@ -0,0 +1,11 @@
1
+ interface ConfigNavigationObject {
2
+ href: string;
3
+ label: string;
4
+ permission?: string;
5
+ }
6
+ interface AppNavigationComponentProps {
7
+ data: ConfigNavigationObject[];
8
+ layout?: string;
9
+ }
10
+ declare function AppNavigationComponent({ data, layout, }: Readonly<AppNavigationComponentProps>): React.ReactElement;
11
+ export default AppNavigationComponent;
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Link, tw } from '@sqrzro/components';
4
+ import useNavigation from '../../hooks/useNavigation';
5
+ function getActiveClassNames(layout) {
6
+ if (layout === 'sidebar') {
7
+ return 'bg-slate-700 text-white';
8
+ }
9
+ return 'before:bg-primary text-white before:absolute before:bottom-0 before:left-0 before:right-0 before:h-1';
10
+ }
11
+ function AppNavigationComponent({ data, layout, }) {
12
+ const navigation = useNavigation(data);
13
+ return (_jsx("nav", { className: tw('h-full', layout === 'sidebar' ? 'w-full' : 'pl-6'), children: _jsx("ul", { className: tw('flex h-full gap-4', layout === 'sidebar' ? 'flex-col items-start' : 'items-center'), children: navigation.map(({ href, isActive, label }) => (_jsx("li", { className: tw(layout === 'sidebar' ? 'w-full' : 'h-full'), children: _jsx(Link, { className: tw(layout === 'sidebar'
14
+ ? 'block px-4 py-3'
15
+ : 'relative flex h-full items-center px-1 font-semibold', isActive
16
+ ? getActiveClassNames(layout)
17
+ : 'text-white/80 hover:text-white'), href: href, children: label }) }, href))) }) }));
18
+ }
19
+ export default AppNavigationComponent;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ interface ConfigNavigationObject {
3
+ href: string;
4
+ label: string;
5
+ permission?: string;
6
+ }
7
+ interface AppNavigationSubProps {
8
+ data: ConfigNavigationObject[];
9
+ }
10
+ declare function AppNavigationSub({ data }: Readonly<AppNavigationSubProps>): React.ReactElement;
11
+ export default AppNavigationSub;
@@ -0,0 +1,12 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Fragment, useState } from 'react';
4
+ import { Link } from '@sqrzro/components';
5
+ function AppNavigationSub({ data }) {
6
+ const [isOpen, setIsOpen] = useState(false);
7
+ function toggleIsOpen() {
8
+ setIsOpen((prev) => !prev);
9
+ }
10
+ return (_jsxs(Fragment, { children: [_jsx("button", { onClick: toggleIsOpen, type: "button", children: "Open" }), isOpen ? (_jsx("ul", { children: data.map(({ href, label }) => (_jsx("li", { children: _jsx(Link, { href: href, children: label }) }, href))) })) : null] }));
11
+ }
12
+ export default AppNavigationSub;
@@ -0,0 +1,10 @@
1
+ declare const classNames: {
2
+ root: string;
3
+ logo: string;
4
+ panel: string;
5
+ title: string;
6
+ link: string;
7
+ actions: string;
8
+ footer: string;
9
+ };
10
+ export default classNames;
@@ -0,0 +1,10 @@
1
+ const classNames = {
2
+ root: 'bg-slate-800 gap-8',
3
+ logo: 'mx-auto flex h-12 w-32 items-end',
4
+ panel: 'rounded bg-white p-8 shadow-lg pb-10',
5
+ title: 'text-lg font-semibold mb-6 leading-none',
6
+ link: 'font-semibold text-link',
7
+ actions: 'pt-2 w-full',
8
+ footer: '-mb-2',
9
+ };
10
+ export default classNames;
@@ -1,8 +1,7 @@
1
- /// <reference types="react" />
2
1
  import type { StyleVariant } from '@sqrzro/interfaces';
3
2
  export interface BadgeProps {
4
3
  children: React.ReactNode;
5
- variant: StyleVariant;
4
+ variant?: StyleVariant | null;
6
5
  }
7
6
  declare function Badge({ children, variant }: Readonly<BadgeProps>): React.ReactElement;
8
7
  export default Badge;
@@ -1,11 +1,20 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import clsx from 'clsx';
3
- const variantMap = {
4
- info: 'bg-sky-100 border-sky-300 text-sky-700',
5
- warning: 'bg-yellow-100 border-yellow-300 text-yellow-700',
6
- success: 'bg-emerald-100 border-emerald-300 text-emerald-600',
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { tw } from '@sqrzro/components';
3
+ const classMap = {
4
+ danger: 'bg-red-100 text-red-700',
5
+ error: 'bg-red-100 text-red-700',
6
+ info: 'bg-sky-100 text-sky-700',
7
+ warning: 'bg-yellow-100 text-yellow-700',
8
+ success: 'bg-green-100 text-green-700',
9
+ };
10
+ const dotMap = {
11
+ danger: 'fill-red-400',
12
+ error: 'fill-red-400',
13
+ info: 'fill-sky-400',
14
+ warning: 'fill-yellow-400',
15
+ success: 'fill-green-400',
7
16
  };
8
17
  function Badge({ children, variant }) {
9
- return (_jsx("strong", { className: clsx('block rounded border px-2 py-1 text-xs', variantMap[variant]), children: children }));
18
+ return (_jsxs("strong", { className: tw('inline-flex items-center gap-1.5 rounded-full bg-slate-100 px-2 py-1 text-xs font-medium text-slate-600', variant ? classMap[variant] : null), "data-testid": "badge-root", children: [_jsx("svg", { "aria-hidden": "true", className: tw('h-1.5 w-1.5 fill-slate-400', variant ? dotMap[variant] : null), viewBox: "0 0 6 6", children: _jsx("circle", { cx: "3", cy: "3", r: "3" }) }), children] }));
10
19
  }
11
20
  export default Badge;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { FilterComponentProps } from '../../interfaces';
3
2
  declare function BooleanFilter({ name, onChange, value, }: Readonly<FilterComponentProps>): React.ReactElement;
4
3
  export declare function renderBooleanValue(value: string): string;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface DashboardProps {
3
2
  children?: React.ReactNode;
4
3
  title: string;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  function Dashboard({ children, title }) {
3
- return (_jsxs("div", { children: [_jsx("h1", { className: "mx-auto text-center text-4xl font-semibold", children: title }), children] }));
3
+ return (_jsxs("div", { className: "py-8", children: [_jsx("h1", { className: "mx-auto text-center text-4xl font-semibold", children: title }), children] }));
4
4
  }
5
5
  export default Dashboard;
@@ -0,0 +1,5 @@
1
+ export interface DataTableProps {
2
+ data: Record<string, React.ReactNode>;
3
+ }
4
+ declare function DataTable({ data }: Readonly<DataTableProps>): React.ReactElement;
5
+ export default DataTable;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ function DataTable({ data }) {
3
+ return (_jsx("table", { children: _jsx("tbody", { children: Object.entries(data).map(([key, value]) => (_jsxs("tr", { className: "odd:bg-slate-100", children: [_jsx("th", { className: "p-2 font-normal", children: key }), _jsx("td", { className: "p-2 text-right", children: value })] }, key))) }) }));
4
+ }
5
+ export default DataTable;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { FilterComponentProps } from '../../interfaces';
3
2
  declare function DateFilter({ name, onChange, value }: Readonly<FilterComponentProps>): React.ReactElement;
4
3
  export declare function transformDateValue(value?: string | null): string;
@@ -1,7 +1,30 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { CalendarInput } from '@sqrzro/components';
3
+ import { formatDate } from '@sqrzro/utility';
4
+ function parseValueUp(value) {
5
+ if (!value) {
6
+ return '';
7
+ }
8
+ if (Array.isArray(value)) {
9
+ return value.map((item) => formatDate(item, 'YYYY-MM-DD')).join(',');
10
+ }
11
+ return formatDate(value, 'YYYY-MM-DD');
12
+ }
13
+ function parseValueDown(value) {
14
+ if (!value) {
15
+ return null;
16
+ }
17
+ if (value.includes(',')) {
18
+ const [start, end] = value.split(',').map((item) => new Date(item));
19
+ return [start, end];
20
+ }
21
+ return new Date(value);
22
+ }
3
23
  function DateFilter({ name, onChange, value }) {
4
- return _jsx(CalendarInput, { name: name, onChange: onChange, value: value, isPanelOnly: true, isRange: true });
24
+ function handleChange(event) {
25
+ onChange({ target: { name, value: parseValueUp(event.target.value) } });
26
+ }
27
+ return (_jsx(CalendarInput, { name: name, onChange: handleChange, value: parseValueDown(value), isPanelOnly: true, isRange: true }));
5
28
  }
6
29
  export function transformDateValue(value) {
7
30
  return value || '';
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { SimpleObject } from '@sqrzro/interfaces';
3
2
  import type { FilterComponentProps } from '../../interfaces';
4
3
  declare function DropdownFilter({ data, name, onChange, value, }: Readonly<FilterComponentProps>): React.ReactElement;
@@ -1,8 +1,9 @@
1
- /// <reference types="react" />
2
1
  import type { FilterObject } from '../FilterBarItem';
3
2
  export type { FilterObject } from '../FilterBarItem';
4
3
  export interface FilterBarProps {
5
- map: FilterObject[];
4
+ hasSearch?: boolean;
5
+ layout?: string;
6
+ map?: FilterObject[];
6
7
  }
7
- declare function FilterBar({ map }: Readonly<FilterBarProps>): React.ReactElement;
8
+ declare function FilterBar({ hasSearch, layout, map }: Readonly<FilterBarProps>): React.ReactElement;
8
9
  export default FilterBar;
@@ -1,12 +1,39 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from 'react';
4
+ import { TextInput, tw } from '@sqrzro/components';
3
5
  import { useFilters } from '@sqrzro/hooks';
6
+ import { useRouter } from 'next/navigation';
7
+ import FilterBarClearButton from '../FilterBarClearButton';
4
8
  import FilterBarItem from '../FilterBarItem';
5
- function FilterBar({ map }) {
9
+ function FilterBar({ hasSearch, layout, map }) {
10
+ const router = useRouter();
6
11
  const [filters, setFilter] = useFilters();
12
+ const [search, setSearch] = useState(filters.get('search') || '');
7
13
  function handleChange(name, value) {
8
14
  setFilter(name, value);
15
+ router.refresh();
9
16
  }
10
- return (_jsx("ul", { className: "relative flex gap-2 before:absolute before:left-[calc(50%-50vw)] before:top-full before:h-24 before:w-screen before:bg-slate-800", children: map.map((filter) => (_jsx(FilterBarItem, { onChange: handleChange, value: filters.get(filter.name) || '', ...filter }, filter.name))) }));
17
+ function handleSearchChange(event) {
18
+ setSearch(event.target.value || '');
19
+ }
20
+ function handleSearchClear() {
21
+ setSearch('');
22
+ setFilter('search', '');
23
+ }
24
+ function handleSearchKeyDown(event) {
25
+ if (event.key === 'Enter') {
26
+ setFilter('search', event.currentTarget.value);
27
+ }
28
+ }
29
+ return (_jsxs("ul", { className: tw('flex gap-2', layout === 'sidebar'
30
+ ? ''
31
+ : 'relative before:absolute before:left-[calc(50%-50vw)] before:top-full before:h-24 before:w-screen before:bg-slate-800'), children: [hasSearch ? (_jsxs("li", { className: "relative", children: [_jsx(TextInput, { classNames: {
32
+ root: {
33
+ default: tw('h-8 w-56 rounded-full border border-slate-400 px-3 text-xs text-white placeholder:text-slate-300', filters.get('search')
34
+ ? 'bg-slate-700'
35
+ : 'bg-transparent focus:bg-slate-700'),
36
+ },
37
+ }, name: "search", onChange: handleSearchChange, onKeyDown: handleSearchKeyDown, placeholder: "Search...", value: search }), filters.get('search') ? (_jsx(FilterBarClearButton, { onClick: handleSearchClear })) : null] })) : null, (map || []).map((filter) => (_jsx(FilterBarItem, { onChange: handleChange, value: filters.get(filter.name) || '', ...filter }, filter.name)))] }));
11
38
  }
12
39
  export default FilterBar;
@@ -0,0 +1,5 @@
1
+ interface FilterBarClearButtonProps {
2
+ onClick: () => void;
3
+ }
4
+ declare function FilterBarClearButton({ onClick, }: Readonly<FilterBarClearButtonProps>): React.ReactElement;
5
+ export default FilterBarClearButton;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ function FilterBarClearButton({ onClick, }) {
3
+ return (_jsxs("button", { className: "absolute right-0 top-0 flex h-full w-10 select-none items-center justify-center", onClick: onClick, type: "button", children: [_jsx("span", { className: "sr-only", children: "Remove" }), _jsx("span", { className: "flex h-4 w-4 items-center justify-center rounded-full bg-white leading-none text-slate-800", children: "\u00D7" })] }));
4
+ }
5
+ export default FilterBarClearButton;
@@ -1,8 +1,9 @@
1
- /// <reference types="react" />
2
- import type { SimpleObject } from '@sqrzro/interfaces';
3
1
  export type FilterType = 'boolean' | 'date' | 'dropdown';
4
2
  export interface FilterObject {
5
- data?: SimpleObject[];
3
+ data?: {
4
+ id: string;
5
+ name: string;
6
+ }[];
6
7
  label: string;
7
8
  name: string;
8
9
  type: FilterType;
@@ -1,10 +1,11 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useRef } from 'react';
4
- import clsx from 'clsx';
3
+ import { tw } from '@sqrzro/components';
4
+ import { useClickOutside } from '@sqrzro/hooks';
5
5
  import BooleanFilter, { renderBooleanValue } from '../BooleanFilter';
6
6
  import DateFilter, { renderDateValue, transformDateValue } from '../DateFilter';
7
7
  import DropdownFilter, { renderDropdownValue } from '../DropdownFilter';
8
+ import FilterBarClearButton from '../FilterBarClearButton';
8
9
  const map = {
9
10
  boolean: { component: BooleanFilter, renderValue: renderBooleanValue },
10
11
  date: {
@@ -17,15 +18,15 @@ const map = {
17
18
  };
18
19
  const DEFAULT_SIZE = 'w-56';
19
20
  function FilterBarItem({ data, label, name, onChange, type, value, }) {
20
- const panel = useRef(null);
21
+ const [isOpen, setIsOpen, node] = useClickOutside();
21
22
  function handleChange(event) {
22
23
  onChange(name, event.target.value);
23
- panel.current?.hidePopover();
24
+ setIsOpen(false);
24
25
  }
25
26
  function handleClear() {
26
27
  onChange(name, '');
27
28
  }
28
29
  const { component: FilterComponent, renderValue, size, transformValue } = map[type];
29
- return (_jsxs("li", { className: clsx('relative inline-flex gap-2 rounded-full border px-5 py-2 text-xs text-white', value ? 'border-solid border-slate-400' : 'border-dashed border-slate-500', value ? 'bg-slate-700 pr-10' : 'text-slate-500'), children: [_jsx("p", { className: "", children: label }), value ? (_jsx("p", { className: "border-l border-l-slate-300 pl-2 font-semibold", children: renderValue(value, data) })) : null, _jsx("button", { className: clsx('absolute left-0 top-0 h-full select-none text-transparent', value ? 'right-10' : 'right-0'), id: `${name}-control`, popovertarget: `${name}-target`, type: "button", children: "Edit" }), value ? (_jsxs("button", { className: "absolute right-0 top-0 flex h-full w-10 select-none items-center justify-center", onClick: handleClear, type: "button", children: [_jsx("span", { className: "sr-only", children: "Remove" }), _jsx("span", { className: "flex h-4 w-4 items-center justify-center rounded-full bg-white leading-none text-slate-800", children: "\u00D7" })] })) : null, _jsx("div", { ref: panel, anchor: `${name}-control`, className: clsx('show left-[anchor(left)] top-[anchor(bottom)] -ml-px mt-2 origin-top-left origin-top-left rounded bg-white shadow-lg', size || DEFAULT_SIZE), id: `${name}-target`, popover: "auto", children: _jsx("div", { className: "py-1", role: "none", children: _jsx(FilterComponent, { data: data, name: name, onChange: handleChange, value: transformValue ? transformValue(value) : value }) }) })] }));
30
+ return (_jsxs("li", { ref: node, className: tw('relative inline-flex h-8 items-center gap-2 rounded-full border px-5 text-xs text-white', value ? 'border-solid border-slate-400' : 'border-dashed border-slate-400', value ? 'bg-slate-700 pr-10' : 'text-slate-300'), children: [_jsx("p", { className: "", children: label }), value ? (_jsx("p", { className: "border-l border-l-slate-300 pl-2 font-semibold", children: renderValue(value, data) })) : null, _jsx("button", { className: tw('absolute left-0 top-0 h-full select-none text-transparent', value ? 'right-10' : 'right-0'), onClick: () => setIsOpen(!isOpen), type: "button", children: "Edit" }), value ? _jsx(FilterBarClearButton, { onClick: handleClear }) : null, _jsx("div", { className: tw('show absolute left-0 top-full z-10 -ml-px mt-2 origin-top-left origin-top-left rounded bg-white shadow-lg', size || DEFAULT_SIZE, isOpen ? 'block' : 'hidden'), children: _jsx("div", { className: "py-1", role: "none", children: _jsx(FilterComponent, { data: data, name: name, onChange: handleChange, value: transformValue ? transformValue(value) : value }) }) })] }));
30
31
  }
31
32
  export default FilterBarItem;
@@ -1,5 +1,4 @@
1
- /// <reference types="react" />
2
1
  import type { ListProps } from '../List';
3
- export type GridListProps<Item, Params> = Omit<ListProps<Item, Params>, 'renderItem'>;
4
- declare function GridList<Item extends object, Params = object>(props: GridListProps<Item, Params>): React.ReactElement;
2
+ export type GridListProps<Item extends object, Params> = Omit<ListProps<Item, Params>, 'renderItem'>;
3
+ declare function GridList<Item extends object, Params>(props: GridListProps<Item, Params>): React.ReactElement;
5
4
  export default GridList;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { ListObject } from '../ListItem';
3
- declare function GridListItem({ actions: Actions, href, id, image, meta, subtitle, title, }: Readonly<ListObject>): React.ReactElement;
2
+ declare function GridListItem({ description, href, id, image, imageHref, meta, title, }: Readonly<ListObject>): React.ReactElement;
4
3
  export default GridListItem;
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment } from 'react';
2
3
  import { Link } from '@sqrzro/components';
3
4
  import { renderMeta } from '../ListItem';
4
- function GridListItem({ actions: Actions, href, id, image, meta, subtitle, title, }) {
5
- return (_jsx("li", { children: _jsxs("article", { className: "bg-panel overflow-hidden rounded p-4 shadow", children: [_jsx("div", { className: "mb-4 h-64 rounded border border border-slate-300 bg-slate-50 p-4", children: image ? (_jsx("img", { alt: "", className: "h-full w-full object-contain", src: image })) : null }), _jsx("h2", { className: "text-base font-semibold", children: href ? _jsx(Link, { href: href, children: title }) : title }), subtitle ? _jsx("p", { className: "text-xs text-slate-500", children: subtitle }) : null, meta || Actions ? _jsx("hr", { className: "my-4" }) : null, _jsxs("div", { className: "flex items-center justify-between", children: [meta ? renderMeta(meta) : null, Actions ? _jsx(Actions, { id: id }) : null] })] }) }));
5
+ function GridListItem({ description, href, id, image, imageHref, meta, title, }) {
6
+ return (_jsx("li", { children: _jsxs("article", { className: "bg-panel overflow-hidden rounded p-4 shadow", children: [_jsx("div", { className: "relative mb-4 h-64 rounded border border border-slate-300 bg-slate-50 p-4", children: image ? (_jsxs(Fragment, { children: [_jsx("img", { alt: "", className: "h-full w-full object-contain", src: image }), imageHref ? (_jsx(Link, { className: "absolute inset-0", href: imageHref, scroll: false, children: _jsx("span", { className: "sr-only", children: "Edit Image" }) })) : null] })) : imageHref ? (_jsxs(Link, { className: "absolute inset-0 flex flex-col items-center justify-center gap-3 font-semibold text-slate-500", href: imageHref, scroll: false, children: [_jsx("i", { className: "block h-12 w-12 rounded-full border-2 border-slate-300" }), "Add Image"] })) : null }), _jsx("h2", { className: "text-base font-semibold", children: href ? _jsx(Link, { href: href, children: title }) : title }), description ? _jsx("p", { className: "text-xs text-slate-500", children: description }) : null, meta ? (_jsxs(Fragment, { children: [_jsx("hr", { className: "my-4" }), _jsx("div", { className: "flex items-center justify-between", children: meta ? renderMeta(id, meta) : null })] })) : null, href ? (_jsxs(Fragment, { children: [_jsx("hr", { className: "my-4" }), _jsx(Link, { href: href, scroll: false, children: "Edit" })] })) : null] }) }));
6
7
  }
7
8
  export default GridListItem;
@@ -1,8 +1,8 @@
1
- /// <reference types="react" />
2
1
  import type { StyleVariant } from '@sqrzro/interfaces';
2
+ type InfoPanelVariant = StyleVariant | 'mail';
3
3
  export interface InfoPanelProps {
4
4
  children: React.ReactNode;
5
- variant?: StyleVariant;
5
+ variant?: InfoPanelVariant;
6
6
  }
7
7
  declare function InfoPanel({ children, variant }: Readonly<InfoPanelProps>): React.ReactElement;
8
8
  export default InfoPanel;
@@ -1,10 +1,22 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import clsx from 'clsx';
3
- const variantMap = {
4
- info: 'bg-sky-50 border-sky-200 text-sky-700',
5
- warning: 'bg-yellow-50 border-yellow-100 text-yellow-700',
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { tw } from '@sqrzro/components';
3
+ const iconClassMap = {
4
+ danger: 'bg-[url(/admin/images/danger.svg)]',
5
+ error: 'bg-[url(/admin/images/danger.svg)]',
6
+ info: 'bg-[url(/admin/images/info.svg)]',
7
+ mail: 'bg-[url(/admin/images/mail.svg)]',
8
+ success: 'bg-[url(/admin/images/success.svg)]',
9
+ warning: 'bg-[url(/admin/images/warning.svg)]',
10
+ };
11
+ const classMap = {
12
+ danger: 'bg-red-100 text-red-700',
13
+ error: 'bg-red-100 text-red-700',
14
+ info: 'bg-sky-100 text-sky-700',
15
+ mail: 'bg-sky-100 text-sky-700',
16
+ success: 'bg-green-100 text-green-700',
17
+ warning: 'bg-yellow-100 text-yellow-700',
6
18
  };
7
19
  function InfoPanel({ children, variant = 'info' }) {
8
- return (_jsx("aside", { className: clsx('rounded border px-3 py-2', variantMap[variant]), children: children }));
20
+ return (_jsxs("aside", { className: tw('flex gap-2 rounded p-4', classMap[variant]), children: [_jsx("i", { className: tw('aspect-square w-5 flex-none bg-contain bg-no-repeat', iconClassMap[variant]) }), _jsx("div", { children: children })] }));
9
21
  }
10
22
  export default InfoPanel;
@@ -1,24 +1,8 @@
1
- /// <reference types="react" />
2
- import type { EmptyMessageProps } from '@sqrzro/components';
3
- import type { Errorable } from '@sqrzro/interfaces';
4
1
  import type { FilterObject } from '../FilterBar';
5
- import type { ListObject } from '../ListItem';
6
- export interface ListComponentProps {
7
- params?: Record<string, string>;
8
- searchParams?: Record<string, string>;
9
- }
10
- export interface ListProps<Item, Params = object> {
11
- actions?: ({ id }: {
12
- readonly id: number;
13
- }) => React.ReactElement;
14
- columns?: number;
15
- emptyMessageProps?: EmptyMessageProps;
2
+ import type { ListComponentProps } from '../ListComponent';
3
+ export interface ListProps<Item extends object, Params> extends Omit<ListComponentProps<Item, Params>, 'actions'> {
4
+ actions?: (data: Record<string, unknown>) => React.ReactNode;
16
5
  filters?: FilterObject[];
17
- fn: (params?: Params, searchParams?: Record<string, string>) => Promise<Errorable<Item[]>>;
18
- renderItem?: (props: ListObject) => React.ReactElement;
19
- params?: Params;
20
- searchParams?: Record<string, string>;
21
- transformer?: (item: Item) => ListObject;
22
6
  }
23
- declare function List<Item extends object, Params = object>({ actions, columns, emptyMessageProps, filters, fn, params, renderItem, searchParams, transformer, }: Readonly<ListProps<Item, Params>>): Promise<React.ReactElement>;
7
+ declare function List<Item extends object, Params>({ filters, hasSearch, ...props }: Readonly<ListProps<Item, Params>>): Promise<React.ReactElement>;
24
8
  export default List;