@tirth_jasoliya/ui 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/core/error.cjs +3 -0
- package/dist/components/core/error.cjs.map +1 -0
- package/dist/components/core/error.d.cts +5 -0
- package/dist/components/core/error.d.ts +5 -0
- package/dist/components/core/error.js +3 -0
- package/dist/components/core/error.js.map +1 -0
- package/dist/components/core/event-success.cjs +3 -0
- package/dist/components/core/event-success.cjs.map +1 -0
- package/dist/components/core/event-success.d.cts +5 -0
- package/dist/components/core/event-success.d.ts +5 -0
- package/dist/components/core/event-success.js +3 -0
- package/dist/components/core/event-success.js.map +1 -0
- package/dist/components/core/index.cjs +3 -0
- package/dist/components/core/index.cjs.map +1 -0
- package/dist/components/core/index.d.cts +7 -0
- package/dist/components/core/index.d.ts +7 -0
- package/dist/components/core/index.js +3 -0
- package/dist/components/core/index.js.map +1 -0
- package/dist/components/core/loader.cjs +3 -0
- package/dist/components/core/loader.cjs.map +1 -0
- package/dist/components/core/loader.d.cts +5 -0
- package/dist/components/core/loader.d.ts +5 -0
- package/dist/components/core/loader.js +3 -0
- package/dist/components/core/loader.js.map +1 -0
- package/dist/components/core/notfound.cjs +3 -0
- package/dist/components/core/notfound.cjs.map +1 -0
- package/dist/components/core/notfound.d.cts +5 -0
- package/dist/components/core/notfound.d.ts +5 -0
- package/dist/components/core/notfound.js +3 -0
- package/dist/components/core/notfound.js.map +1 -0
- package/dist/components/core/offline-content.cjs +3 -0
- package/dist/components/core/offline-content.cjs.map +1 -0
- package/dist/components/core/offline-content.d.cts +5 -0
- package/dist/components/core/offline-content.d.ts +5 -0
- package/dist/components/core/offline-content.js +3 -0
- package/dist/components/core/offline-content.js.map +1 -0
- package/dist/components/core/unauthorized.cjs +3 -0
- package/dist/components/core/unauthorized.cjs.map +1 -0
- package/dist/components/core/unauthorized.d.cts +5 -0
- package/dist/components/core/unauthorized.d.ts +5 -0
- package/dist/components/core/unauthorized.js +3 -0
- package/dist/components/core/unauthorized.js.map +1 -0
- package/dist/components/data/data-table/data-table-action-bar.cjs +3 -0
- package/dist/components/data/data-table/data-table-action-bar.cjs.map +1 -0
- package/dist/components/data/data-table/data-table-action-bar.d.cts +26 -0
- package/dist/components/data/data-table/data-table-action-bar.d.ts +26 -0
- package/dist/components/data/data-table/data-table-action-bar.js +3 -0
- package/dist/components/data/data-table/data-table-action-bar.js.map +1 -0
- package/dist/components/data/data-table/data-table-column-header.cjs +3 -0
- package/dist/components/data/data-table/data-table-column-header.cjs.map +1 -0
- package/dist/components/data/data-table/data-table-column-header.d.cts +11 -0
- package/dist/components/data/data-table/data-table-column-header.d.ts +11 -0
- package/dist/components/data/data-table/data-table-column-header.js +3 -0
- package/dist/components/data/data-table/data-table-column-header.js.map +1 -0
- package/dist/components/data/data-table/data-table-faceted-filter.cjs +3 -0
- package/dist/components/data/data-table/data-table-faceted-filter.cjs.map +1 -0
- package/dist/components/data/data-table/data-table-faceted-filter.d.cts +18 -0
- package/dist/components/data/data-table/data-table-faceted-filter.d.ts +18 -0
- package/dist/components/data/data-table/data-table-faceted-filter.js +3 -0
- package/dist/components/data/data-table/data-table-faceted-filter.js.map +1 -0
- package/dist/components/data/data-table/data-table-pagination.cjs +3 -0
- package/dist/components/data/data-table/data-table-pagination.cjs.map +1 -0
- package/dist/components/data/data-table/data-table-pagination.d.cts +12 -0
- package/dist/components/data/data-table/data-table-pagination.d.ts +12 -0
- package/dist/components/data/data-table/data-table-pagination.js +3 -0
- package/dist/components/data/data-table/data-table-pagination.js.map +1 -0
- package/dist/components/data/data-table/data-table-toolbar.cjs +3 -0
- package/dist/components/data/data-table/data-table-toolbar.cjs.map +1 -0
- package/dist/components/data/data-table/data-table-toolbar.d.cts +23 -0
- package/dist/components/data/data-table/data-table-toolbar.d.ts +23 -0
- package/dist/components/data/data-table/data-table-toolbar.js +3 -0
- package/dist/components/data/data-table/data-table-toolbar.js.map +1 -0
- package/dist/components/data/data-table/data-table-types.cjs +3 -0
- package/dist/components/data/data-table/data-table-types.cjs.map +1 -0
- package/dist/components/data/data-table/data-table-types.d.cts +69 -0
- package/dist/components/data/data-table/data-table-types.d.ts +69 -0
- package/dist/components/data/data-table/data-table-types.js +2 -0
- package/dist/components/data/data-table/data-table-types.js.map +1 -0
- package/dist/components/data/data-table/data-table-view-options.cjs +3 -0
- package/dist/components/data/data-table/data-table-view-options.cjs.map +1 -0
- package/dist/components/data/data-table/data-table-view-options.d.cts +9 -0
- package/dist/components/data/data-table/data-table-view-options.d.ts +9 -0
- package/dist/components/data/data-table/data-table-view-options.js +3 -0
- package/dist/components/data/data-table/data-table-view-options.js.map +1 -0
- package/dist/components/data/data-table/data-table.cjs +3 -0
- package/dist/components/data/data-table/data-table.cjs.map +1 -0
- package/dist/components/data/data-table/data-table.d.cts +8 -0
- package/dist/components/data/data-table/data-table.d.ts +8 -0
- package/dist/components/data/data-table/data-table.js +3 -0
- package/dist/components/data/data-table/data-table.js.map +1 -0
- package/dist/components/data/data-table/index.cjs +3 -0
- package/dist/components/data/data-table/index.cjs.map +1 -0
- package/dist/components/data/data-table/index.d.cts +16 -0
- package/dist/components/data/data-table/index.d.ts +16 -0
- package/dist/components/data/data-table/index.js +3 -0
- package/dist/components/data/data-table/index.js.map +1 -0
- package/dist/components/data/data-template/data-template-action-bar.cjs +3 -0
- package/dist/components/data/data-template/data-template-action-bar.cjs.map +1 -0
- package/dist/components/data/data-template/data-template-action-bar.d.cts +14 -0
- package/dist/components/data/data-template/data-template-action-bar.d.ts +14 -0
- package/dist/components/data/data-template/data-template-action-bar.js +3 -0
- package/dist/components/data/data-template/data-template-action-bar.js.map +1 -0
- package/dist/components/data/data-template/data-template-pagination.cjs +3 -0
- package/dist/components/data/data-template/data-template-pagination.cjs.map +1 -0
- package/dist/components/data/data-template/data-template-pagination.d.cts +17 -0
- package/dist/components/data/data-template/data-template-pagination.d.ts +17 -0
- package/dist/components/data/data-template/data-template-pagination.js +3 -0
- package/dist/components/data/data-template/data-template-pagination.js.map +1 -0
- package/dist/components/data/data-template/data-template-toolbar.cjs +3 -0
- package/dist/components/data/data-template/data-template-toolbar.cjs.map +1 -0
- package/dist/components/data/data-template/data-template-toolbar.d.cts +27 -0
- package/dist/components/data/data-template/data-template-toolbar.d.ts +27 -0
- package/dist/components/data/data-template/data-template-toolbar.js +3 -0
- package/dist/components/data/data-template/data-template-toolbar.js.map +1 -0
- package/dist/components/data/data-template/data-template-types.cjs +3 -0
- package/dist/components/data/data-template/data-template-types.cjs.map +1 -0
- package/dist/components/data/data-template/data-template-types.d.cts +107 -0
- package/dist/components/data/data-template/data-template-types.d.ts +107 -0
- package/dist/components/data/data-template/data-template-types.js +2 -0
- package/dist/components/data/data-template/data-template-types.js.map +1 -0
- package/dist/components/data/data-template/data-template.cjs +3 -0
- package/dist/components/data/data-template/data-template.cjs.map +1 -0
- package/dist/components/data/data-template/data-template.d.cts +8 -0
- package/dist/components/data/data-template/data-template.d.ts +8 -0
- package/dist/components/data/data-template/data-template.js +3 -0
- package/dist/components/data/data-template/data-template.js.map +1 -0
- package/dist/components/data/data-template/index.cjs +3 -0
- package/dist/components/data/data-template/index.cjs.map +1 -0
- package/dist/components/data/data-template/index.d.cts +8 -0
- package/dist/components/data/data-template/index.d.ts +8 -0
- package/dist/components/data/data-template/index.js +3 -0
- package/dist/components/data/data-template/index.js.map +1 -0
- package/dist/components/general.cjs +3 -0
- package/dist/components/general.cjs.map +1 -0
- package/dist/components/general.d.cts +51 -0
- package/dist/components/general.d.ts +51 -0
- package/dist/components/general.js +3 -0
- package/dist/components/general.js.map +1 -0
- package/dist/components/layouts/app-container.cjs +3 -0
- package/dist/components/layouts/app-container.cjs.map +1 -0
- package/dist/components/layouts/app-container.d.cts +13 -0
- package/dist/components/layouts/app-container.d.ts +13 -0
- package/dist/components/layouts/app-container.js +3 -0
- package/dist/components/layouts/app-container.js.map +1 -0
- package/dist/components/layouts/app-content.cjs +3 -0
- package/dist/components/layouts/app-content.cjs.map +1 -0
- package/dist/components/layouts/app-content.d.cts +45 -0
- package/dist/components/layouts/app-content.d.ts +45 -0
- package/dist/components/layouts/app-content.js +3 -0
- package/dist/components/layouts/app-content.js.map +1 -0
- package/dist/components/layouts/app-footer.cjs +3 -0
- package/dist/components/layouts/app-footer.cjs.map +1 -0
- package/dist/components/layouts/app-footer.d.cts +18 -0
- package/dist/components/layouts/app-footer.d.ts +18 -0
- package/dist/components/layouts/app-footer.js +3 -0
- package/dist/components/layouts/app-footer.js.map +1 -0
- package/dist/components/layouts/app-header.cjs +3 -0
- package/dist/components/layouts/app-header.cjs.map +1 -0
- package/dist/components/layouts/app-header.d.cts +19 -0
- package/dist/components/layouts/app-header.d.ts +19 -0
- package/dist/components/layouts/app-header.js +3 -0
- package/dist/components/layouts/app-header.js.map +1 -0
- package/dist/components/layouts/factories.cjs +3 -0
- package/dist/components/layouts/factories.cjs.map +1 -0
- package/dist/components/layouts/factories.d.cts +18 -0
- package/dist/components/layouts/factories.d.ts +18 -0
- package/dist/components/layouts/factories.js +3 -0
- package/dist/components/layouts/factories.js.map +1 -0
- package/dist/components/layouts/index.cjs +3 -0
- package/dist/components/layouts/index.cjs.map +1 -0
- package/dist/components/layouts/index.d.cts +8 -0
- package/dist/components/layouts/index.d.ts +8 -0
- package/dist/components/layouts/index.js +3 -0
- package/dist/components/layouts/index.js.map +1 -0
- package/dist/components/ui/badge.cjs +3 -0
- package/dist/components/ui/badge.cjs.map +1 -0
- package/dist/components/ui/badge.d.cts +13 -0
- package/dist/components/ui/badge.d.ts +13 -0
- package/dist/components/ui/badge.js +3 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/button.cjs +3 -0
- package/dist/components/ui/button.cjs.map +1 -0
- package/dist/components/ui/button.d.cts +14 -0
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/button.js +3 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/card.cjs +3 -0
- package/dist/components/ui/card.cjs.map +1 -0
- package/dist/components/ui/card.d.cts +12 -0
- package/dist/components/ui/card.d.ts +12 -0
- package/dist/components/ui/card.js +3 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.cjs +3 -0
- package/dist/components/ui/checkbox.cjs.map +1 -0
- package/dist/components/ui/checkbox.d.cts +7 -0
- package/dist/components/ui/checkbox.d.ts +7 -0
- package/dist/components/ui/checkbox.js +3 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/command.cjs +3 -0
- package/dist/components/ui/command.cjs.map +1 -0
- package/dist/components/ui/command.d.cts +20 -0
- package/dist/components/ui/command.d.ts +20 -0
- package/dist/components/ui/command.js +3 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/dialog.cjs +3 -0
- package/dist/components/ui/dialog.cjs.map +1 -0
- package/dist/components/ui/dialog.d.cts +16 -0
- package/dist/components/ui/dialog.d.ts +16 -0
- package/dist/components/ui/dialog.js +3 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.cjs +3 -0
- package/dist/components/ui/dropdown-menu.cjs.map +1 -0
- package/dist/components/ui/dropdown-menu.d.cts +28 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu.js +3 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/input.cjs +3 -0
- package/dist/components/ui/input.cjs.map +1 -0
- package/dist/components/ui/input.d.cts +6 -0
- package/dist/components/ui/input.d.ts +6 -0
- package/dist/components/ui/input.js +3 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/popover.cjs +3 -0
- package/dist/components/ui/popover.cjs.map +1 -0
- package/dist/components/ui/popover.d.cts +10 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/popover.js +3 -0
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/select.cjs +3 -0
- package/dist/components/ui/select.cjs.map +1 -0
- package/dist/components/ui/select.d.cts +18 -0
- package/dist/components/ui/select.d.ts +18 -0
- package/dist/components/ui/select.js +3 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.cjs +3 -0
- package/dist/components/ui/separator.cjs.map +1 -0
- package/dist/components/ui/separator.d.cts +7 -0
- package/dist/components/ui/separator.d.ts +7 -0
- package/dist/components/ui/separator.js +3 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.cjs +3 -0
- package/dist/components/ui/sheet.cjs.map +1 -0
- package/dist/components/ui/sheet.d.cts +18 -0
- package/dist/components/ui/sheet.d.ts +18 -0
- package/dist/components/ui/sheet.js +3 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/table.cjs +3 -0
- package/dist/components/ui/table.cjs.map +1 -0
- package/dist/components/ui/table.d.cts +13 -0
- package/dist/components/ui/table.d.ts +13 -0
- package/dist/components/ui/table.js +3 -0
- package/dist/components/ui/table.js.map +1 -0
- package/dist/components/ui/toggle.cjs +3 -0
- package/dist/components/ui/toggle.cjs.map +1 -0
- package/dist/components/ui/toggle.d.cts +16 -0
- package/dist/components/ui/toggle.d.ts +16 -0
- package/dist/components/ui/toggle.js +3 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.cjs +3 -0
- package/dist/components/ui/tooltip.cjs.map +1 -0
- package/dist/components/ui/tooltip.d.cts +10 -0
- package/dist/components/ui/tooltip.d.ts +10 -0
- package/dist/components/ui/tooltip.js +3 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/context/app-meta/context.cjs +3 -0
- package/dist/context/app-meta/context.cjs.map +1 -0
- package/dist/context/app-meta/context.d.cts +18 -0
- package/dist/context/app-meta/context.d.ts +18 -0
- package/dist/context/app-meta/context.js +3 -0
- package/dist/context/app-meta/context.js.map +1 -0
- package/dist/context/app-meta/hooks.cjs +3 -0
- package/dist/context/app-meta/hooks.cjs.map +1 -0
- package/dist/context/app-meta/hooks.d.cts +10 -0
- package/dist/context/app-meta/hooks.d.ts +10 -0
- package/dist/context/app-meta/hooks.js +3 -0
- package/dist/context/app-meta/hooks.js.map +1 -0
- package/dist/context/app-meta/index.cjs +3 -0
- package/dist/context/app-meta/index.cjs.map +1 -0
- package/dist/context/app-meta/index.d.cts +5 -0
- package/dist/context/app-meta/index.d.ts +5 -0
- package/dist/context/app-meta/index.js +3 -0
- package/dist/context/app-meta/index.js.map +1 -0
- package/dist/context/app-meta/types.cjs +3 -0
- package/dist/context/app-meta/types.cjs.map +1 -0
- package/dist/context/app-meta/types.d.cts +48 -0
- package/dist/context/app-meta/types.d.ts +48 -0
- package/dist/context/app-meta/types.js +2 -0
- package/dist/context/app-meta/types.js.map +1 -0
- package/dist/context/index.cjs +3 -0
- package/dist/context/index.cjs.map +1 -0
- package/dist/context/index.d.cts +5 -0
- package/dist/context/index.d.ts +5 -0
- package/dist/context/index.js +3 -0
- package/dist/context/index.js.map +1 -0
- package/dist/index.cjs +2 -3241
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -406
- package/dist/index.d.ts +29 -406
- package/dist/index.js +2 -3198
- package/dist/index.js.map +1 -1
- package/dist/lib/utils.cjs +3 -0
- package/dist/lib/utils.cjs.map +1 -0
- package/dist/lib/utils.d.cts +5 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +3 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +32 -11
package/dist/index.cjs
CHANGED
|
@@ -1,3242 +1,3 @@
|
|
|
1
|
-
"use
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
AppMetaProvider: () => AppMetaProvider,
|
|
34
|
-
Checkmark: () => Checkmark,
|
|
35
|
-
DataTable: () => DataTable,
|
|
36
|
-
DataTableActionBar: () => DataTableActionBar,
|
|
37
|
-
DataTableActionBarAction: () => DataTableActionBarAction,
|
|
38
|
-
DataTableActionBarSelection: () => DataTableActionBarSelection,
|
|
39
|
-
DataTemplate: () => DataTemplate,
|
|
40
|
-
DataTemplateActionBar: () => DataTemplateActionBar,
|
|
41
|
-
DataTemplateActionBarAction: () => DataTemplateActionBarAction,
|
|
42
|
-
DataTemplateActionBarSelection: () => DataTemplateActionBarSelection,
|
|
43
|
-
GeneralHelper: () => GeneralHelper,
|
|
44
|
-
createLayoutComponents: () => createLayoutComponents,
|
|
45
|
-
createPageTemplateHook: () => createPageTemplateHook,
|
|
46
|
-
createTypedAppMetaContext: () => createTypedAppMetaContext
|
|
47
|
-
});
|
|
48
|
-
module.exports = __toCommonJS(index_exports);
|
|
49
|
-
|
|
50
|
-
// src/components/data/data-table/data-table.tsx
|
|
51
|
-
var import_react_table = require("@tanstack/react-table");
|
|
52
|
-
var import_lucide_react5 = require("lucide-react");
|
|
53
|
-
|
|
54
|
-
// src/components/ui/button.tsx
|
|
55
|
-
var import_radix_ui = require("radix-ui");
|
|
56
|
-
var import_class_variance_authority = require("class-variance-authority");
|
|
57
|
-
|
|
58
|
-
// src/lib/utils.ts
|
|
59
|
-
var import_clsx = require("clsx");
|
|
60
|
-
var import_tailwind_merge = require("tailwind-merge");
|
|
61
|
-
function cn(...inputs) {
|
|
62
|
-
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// src/components/ui/button.tsx
|
|
66
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
67
|
-
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
68
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
69
|
-
{
|
|
70
|
-
variants: {
|
|
71
|
-
variant: {
|
|
72
|
-
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
|
|
73
|
-
destructive: "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
74
|
-
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
75
|
-
secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
|
|
76
|
-
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
77
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
78
|
-
},
|
|
79
|
-
size: {
|
|
80
|
-
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
81
|
-
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
82
|
-
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
|
|
83
|
-
icon: "size-9"
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
defaultVariants: {
|
|
87
|
-
variant: "default",
|
|
88
|
-
size: "default"
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
function Button({
|
|
93
|
-
className,
|
|
94
|
-
variant,
|
|
95
|
-
size,
|
|
96
|
-
asChild = false,
|
|
97
|
-
...props
|
|
98
|
-
}) {
|
|
99
|
-
const Comp = asChild ? import_radix_ui.Slot.Slot : "button";
|
|
100
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
101
|
-
Comp,
|
|
102
|
-
{
|
|
103
|
-
"data-slot": "button",
|
|
104
|
-
className: cn(buttonVariants({ variant, size, className }), "transition-none"),
|
|
105
|
-
...props
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// src/components/ui/table.tsx
|
|
111
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
112
|
-
function Table({ className, ...props }) {
|
|
113
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
114
|
-
"div",
|
|
115
|
-
{
|
|
116
|
-
"data-slot": "table-container",
|
|
117
|
-
className: "relative w-full overflow-auto max-h-full",
|
|
118
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
119
|
-
"table",
|
|
120
|
-
{
|
|
121
|
-
"data-slot": "table",
|
|
122
|
-
className: cn("w-full caption-bottom text-sm", className),
|
|
123
|
-
...props
|
|
124
|
-
}
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
function TableHeader({ className, ...props }) {
|
|
130
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
131
|
-
"thead",
|
|
132
|
-
{
|
|
133
|
-
"data-slot": "table-header",
|
|
134
|
-
className: cn("[&_tr]:border-b", className),
|
|
135
|
-
...props
|
|
136
|
-
}
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
function TableBody({ className, ...props }) {
|
|
140
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
141
|
-
"tbody",
|
|
142
|
-
{
|
|
143
|
-
"data-slot": "table-body",
|
|
144
|
-
className: cn("[&_tr:last-child]:border-0", className),
|
|
145
|
-
...props
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
function TableFooter({ className, ...props }) {
|
|
150
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
151
|
-
"tfoot",
|
|
152
|
-
{
|
|
153
|
-
"data-slot": "table-footer",
|
|
154
|
-
className: cn(
|
|
155
|
-
"bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
|
|
156
|
-
className
|
|
157
|
-
),
|
|
158
|
-
...props
|
|
159
|
-
}
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
function TableRow({ className, ...props }) {
|
|
163
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
164
|
-
"tr",
|
|
165
|
-
{
|
|
166
|
-
"data-slot": "table-row",
|
|
167
|
-
className: cn(
|
|
168
|
-
"hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
|
|
169
|
-
className
|
|
170
|
-
),
|
|
171
|
-
...props
|
|
172
|
-
}
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
function TableHead({ className, ...props }) {
|
|
176
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
177
|
-
"th",
|
|
178
|
-
{
|
|
179
|
-
"data-slot": "table-head",
|
|
180
|
-
className: cn(
|
|
181
|
-
"text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",
|
|
182
|
-
className
|
|
183
|
-
),
|
|
184
|
-
...props
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
function TableCell({ className, ...props }) {
|
|
189
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
190
|
-
"td",
|
|
191
|
-
{
|
|
192
|
-
"data-slot": "table-cell",
|
|
193
|
-
className: cn(
|
|
194
|
-
"p-2 align-middle whitespace-nowrap",
|
|
195
|
-
className
|
|
196
|
-
),
|
|
197
|
-
...props
|
|
198
|
-
}
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// src/components/ui/card.tsx
|
|
203
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
204
|
-
function Card({ className, ...props }) {
|
|
205
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
206
|
-
"div",
|
|
207
|
-
{
|
|
208
|
-
"data-slot": "card",
|
|
209
|
-
className: cn(
|
|
210
|
-
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
211
|
-
className
|
|
212
|
-
),
|
|
213
|
-
...props
|
|
214
|
-
}
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
function CardContent({ className, ...props }) {
|
|
218
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
219
|
-
"div",
|
|
220
|
-
{
|
|
221
|
-
"data-slot": "card-content",
|
|
222
|
-
className: cn("px-6", className),
|
|
223
|
-
...props
|
|
224
|
-
}
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// src/components/ui/tooltip.tsx
|
|
229
|
-
var import_radix_ui2 = require("radix-ui");
|
|
230
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
231
|
-
function TooltipProvider({
|
|
232
|
-
delayDuration = 0,
|
|
233
|
-
...props
|
|
234
|
-
}) {
|
|
235
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
236
|
-
import_radix_ui2.Tooltip.Provider,
|
|
237
|
-
{
|
|
238
|
-
"data-slot": "tooltip-provider",
|
|
239
|
-
delayDuration,
|
|
240
|
-
...props
|
|
241
|
-
}
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
function Tooltip({
|
|
245
|
-
...props
|
|
246
|
-
}) {
|
|
247
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui2.Tooltip.Root, { "data-slot": "tooltip", ...props }) });
|
|
248
|
-
}
|
|
249
|
-
function TooltipTrigger({
|
|
250
|
-
...props
|
|
251
|
-
}) {
|
|
252
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui2.Tooltip.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
253
|
-
}
|
|
254
|
-
function TooltipContent({
|
|
255
|
-
className,
|
|
256
|
-
sideOffset = 0,
|
|
257
|
-
children,
|
|
258
|
-
...props
|
|
259
|
-
}) {
|
|
260
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui2.Tooltip.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
261
|
-
import_radix_ui2.Tooltip.Content,
|
|
262
|
-
{
|
|
263
|
-
"data-slot": "tooltip-content",
|
|
264
|
-
sideOffset,
|
|
265
|
-
className: cn(
|
|
266
|
-
"bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",
|
|
267
|
-
className
|
|
268
|
-
),
|
|
269
|
-
...props,
|
|
270
|
-
children: [
|
|
271
|
-
children,
|
|
272
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_radix_ui2.Tooltip.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
273
|
-
]
|
|
274
|
-
}
|
|
275
|
-
) });
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// src/components/data/data-table/data-table-toolbar.tsx
|
|
279
|
-
var import_lucide_react3 = require("lucide-react");
|
|
280
|
-
|
|
281
|
-
// src/components/ui/input.tsx
|
|
282
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
283
|
-
function Input({ className, type, ...props }) {
|
|
284
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
285
|
-
"input",
|
|
286
|
-
{
|
|
287
|
-
type,
|
|
288
|
-
"data-slot": "input",
|
|
289
|
-
className: cn(
|
|
290
|
-
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
291
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
292
|
-
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
293
|
-
className
|
|
294
|
-
),
|
|
295
|
-
...props
|
|
296
|
-
}
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// src/components/ui/select.tsx
|
|
301
|
-
var import_radix_ui3 = require("radix-ui");
|
|
302
|
-
var import_lucide_react = require("lucide-react");
|
|
303
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
304
|
-
function Select({
|
|
305
|
-
...props
|
|
306
|
-
}) {
|
|
307
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui3.Select.Root, { "data-slot": "select", ...props });
|
|
308
|
-
}
|
|
309
|
-
function SelectValue({
|
|
310
|
-
...props
|
|
311
|
-
}) {
|
|
312
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui3.Select.Value, { "data-slot": "select-value", ...props });
|
|
313
|
-
}
|
|
314
|
-
function SelectTrigger({
|
|
315
|
-
className,
|
|
316
|
-
size = "default",
|
|
317
|
-
children,
|
|
318
|
-
...props
|
|
319
|
-
}) {
|
|
320
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
321
|
-
import_radix_ui3.Select.Trigger,
|
|
322
|
-
{
|
|
323
|
-
"data-slot": "select-trigger",
|
|
324
|
-
"data-size": size,
|
|
325
|
-
className: cn(
|
|
326
|
-
"border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
327
|
-
className
|
|
328
|
-
),
|
|
329
|
-
...props,
|
|
330
|
-
children: [
|
|
331
|
-
children,
|
|
332
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui3.Select.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.ChevronDownIcon, { className: "size-4 opacity-50" }) })
|
|
333
|
-
]
|
|
334
|
-
}
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
function SelectContent({
|
|
338
|
-
className,
|
|
339
|
-
children,
|
|
340
|
-
position = "popper",
|
|
341
|
-
...props
|
|
342
|
-
}) {
|
|
343
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui3.Select.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
344
|
-
import_radix_ui3.Select.Content,
|
|
345
|
-
{
|
|
346
|
-
"data-slot": "select-content",
|
|
347
|
-
className: cn(
|
|
348
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
349
|
-
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
350
|
-
className
|
|
351
|
-
),
|
|
352
|
-
position,
|
|
353
|
-
...props,
|
|
354
|
-
children: [
|
|
355
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectScrollUpButton, {}),
|
|
356
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
357
|
-
import_radix_ui3.Select.Viewport,
|
|
358
|
-
{
|
|
359
|
-
className: cn(
|
|
360
|
-
"p-1",
|
|
361
|
-
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
362
|
-
),
|
|
363
|
-
children
|
|
364
|
-
}
|
|
365
|
-
),
|
|
366
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectScrollDownButton, {})
|
|
367
|
-
]
|
|
368
|
-
}
|
|
369
|
-
) });
|
|
370
|
-
}
|
|
371
|
-
function SelectItem({
|
|
372
|
-
className,
|
|
373
|
-
children,
|
|
374
|
-
...props
|
|
375
|
-
}) {
|
|
376
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
377
|
-
import_radix_ui3.Select.Item,
|
|
378
|
-
{
|
|
379
|
-
"data-slot": "select-item",
|
|
380
|
-
className: cn(
|
|
381
|
-
"focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
382
|
-
className
|
|
383
|
-
),
|
|
384
|
-
...props,
|
|
385
|
-
children: [
|
|
386
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui3.Select.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.CheckIcon, { className: "size-4" }) }) }),
|
|
387
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_radix_ui3.Select.ItemText, { children })
|
|
388
|
-
]
|
|
389
|
-
}
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
function SelectScrollUpButton({
|
|
393
|
-
className,
|
|
394
|
-
...props
|
|
395
|
-
}) {
|
|
396
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
397
|
-
import_radix_ui3.Select.ScrollUpButton,
|
|
398
|
-
{
|
|
399
|
-
"data-slot": "select-scroll-up-button",
|
|
400
|
-
className: cn(
|
|
401
|
-
"flex cursor-default items-center justify-center py-1",
|
|
402
|
-
className
|
|
403
|
-
),
|
|
404
|
-
...props,
|
|
405
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.ChevronUpIcon, { className: "size-4" })
|
|
406
|
-
}
|
|
407
|
-
);
|
|
408
|
-
}
|
|
409
|
-
function SelectScrollDownButton({
|
|
410
|
-
className,
|
|
411
|
-
...props
|
|
412
|
-
}) {
|
|
413
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
414
|
-
import_radix_ui3.Select.ScrollDownButton,
|
|
415
|
-
{
|
|
416
|
-
"data-slot": "select-scroll-down-button",
|
|
417
|
-
className: cn(
|
|
418
|
-
"flex cursor-default items-center justify-center py-1",
|
|
419
|
-
className
|
|
420
|
-
),
|
|
421
|
-
...props,
|
|
422
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react.ChevronDownIcon, { className: "size-4" })
|
|
423
|
-
}
|
|
424
|
-
);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
// src/components/ui/dropdown-menu.tsx
|
|
428
|
-
var import_radix_ui4 = require("radix-ui");
|
|
429
|
-
var import_lucide_react2 = require("lucide-react");
|
|
430
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
431
|
-
function DropdownMenu({
|
|
432
|
-
...props
|
|
433
|
-
}) {
|
|
434
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui4.DropdownMenu.Root, { "data-slot": "dropdown-menu", ...props });
|
|
435
|
-
}
|
|
436
|
-
function DropdownMenuTrigger({
|
|
437
|
-
...props
|
|
438
|
-
}) {
|
|
439
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
440
|
-
import_radix_ui4.DropdownMenu.Trigger,
|
|
441
|
-
{
|
|
442
|
-
"data-slot": "dropdown-menu-trigger",
|
|
443
|
-
...props
|
|
444
|
-
}
|
|
445
|
-
);
|
|
446
|
-
}
|
|
447
|
-
function DropdownMenuContent({
|
|
448
|
-
className,
|
|
449
|
-
sideOffset = 4,
|
|
450
|
-
...props
|
|
451
|
-
}) {
|
|
452
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui4.DropdownMenu.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
453
|
-
import_radix_ui4.DropdownMenu.Content,
|
|
454
|
-
{
|
|
455
|
-
"data-slot": "dropdown-menu-content",
|
|
456
|
-
sideOffset,
|
|
457
|
-
className: cn(
|
|
458
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",
|
|
459
|
-
className
|
|
460
|
-
),
|
|
461
|
-
...props
|
|
462
|
-
}
|
|
463
|
-
) });
|
|
464
|
-
}
|
|
465
|
-
function DropdownMenuGroup({
|
|
466
|
-
...props
|
|
467
|
-
}) {
|
|
468
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui4.DropdownMenu.Group, { "data-slot": "dropdown-menu-group", ...props });
|
|
469
|
-
}
|
|
470
|
-
function DropdownMenuItem({
|
|
471
|
-
className,
|
|
472
|
-
inset,
|
|
473
|
-
variant = "default",
|
|
474
|
-
...props
|
|
475
|
-
}) {
|
|
476
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
477
|
-
import_radix_ui4.DropdownMenu.Item,
|
|
478
|
-
{
|
|
479
|
-
"data-slot": "dropdown-menu-item",
|
|
480
|
-
"data-inset": inset,
|
|
481
|
-
"data-variant": variant,
|
|
482
|
-
className: cn(
|
|
483
|
-
"cursor-pointer focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
484
|
-
className
|
|
485
|
-
),
|
|
486
|
-
...props
|
|
487
|
-
}
|
|
488
|
-
);
|
|
489
|
-
}
|
|
490
|
-
function DropdownMenuCheckboxItem({
|
|
491
|
-
className,
|
|
492
|
-
children,
|
|
493
|
-
checked,
|
|
494
|
-
...props
|
|
495
|
-
}) {
|
|
496
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
497
|
-
import_radix_ui4.DropdownMenu.CheckboxItem,
|
|
498
|
-
{
|
|
499
|
-
"data-slot": "dropdown-menu-checkbox-item",
|
|
500
|
-
className: cn(
|
|
501
|
-
"focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
502
|
-
className
|
|
503
|
-
),
|
|
504
|
-
checked,
|
|
505
|
-
...props,
|
|
506
|
-
children: [
|
|
507
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_radix_ui4.DropdownMenu.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.CheckIcon, { className: "size-4" }) }) }),
|
|
508
|
-
children
|
|
509
|
-
]
|
|
510
|
-
}
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
function DropdownMenuLabel({
|
|
514
|
-
className,
|
|
515
|
-
inset,
|
|
516
|
-
...props
|
|
517
|
-
}) {
|
|
518
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
519
|
-
import_radix_ui4.DropdownMenu.Label,
|
|
520
|
-
{
|
|
521
|
-
"data-slot": "dropdown-menu-label",
|
|
522
|
-
"data-inset": inset,
|
|
523
|
-
className: cn(
|
|
524
|
-
"px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",
|
|
525
|
-
className
|
|
526
|
-
),
|
|
527
|
-
...props
|
|
528
|
-
}
|
|
529
|
-
);
|
|
530
|
-
}
|
|
531
|
-
function DropdownMenuSeparator({
|
|
532
|
-
className,
|
|
533
|
-
...props
|
|
534
|
-
}) {
|
|
535
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
536
|
-
import_radix_ui4.DropdownMenu.Separator,
|
|
537
|
-
{
|
|
538
|
-
"data-slot": "dropdown-menu-separator",
|
|
539
|
-
className: cn("bg-border -mx-1 my-1 h-px", className),
|
|
540
|
-
...props
|
|
541
|
-
}
|
|
542
|
-
);
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
// src/components/data/data-table/data-table-toolbar.tsx
|
|
546
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
547
|
-
function DataTableToolbar({
|
|
548
|
-
table,
|
|
549
|
-
filters = [],
|
|
550
|
-
globalFilter,
|
|
551
|
-
onGlobalFilterChange,
|
|
552
|
-
enableGlobalFilter = true,
|
|
553
|
-
onExport,
|
|
554
|
-
onRefresh,
|
|
555
|
-
loading = false,
|
|
556
|
-
enableColumnVisibility = true,
|
|
557
|
-
data,
|
|
558
|
-
onClearSorting,
|
|
559
|
-
onClearFilters,
|
|
560
|
-
enableColumnPinning = false
|
|
561
|
-
}) {
|
|
562
|
-
const getAllLeafColumns = () => {
|
|
563
|
-
return table.getAllLeafColumns().filter((column) => column.getCanHide?.() !== false);
|
|
564
|
-
};
|
|
565
|
-
const getGroupColumns = () => {
|
|
566
|
-
return table.getAllColumns().filter(
|
|
567
|
-
(column) => !table.getAllLeafColumns().includes(column) && column.columns?.length && column.columns.some((col) => col.getCanHide?.() !== false)
|
|
568
|
-
);
|
|
569
|
-
};
|
|
570
|
-
const getUngroupedLeafColumns = () => {
|
|
571
|
-
const groupedColumnIds = new Set(
|
|
572
|
-
getGroupColumns().flatMap(
|
|
573
|
-
(group) => group.columns?.filter((col) => col.getCanHide?.() !== false).map((c) => c.id) || []
|
|
574
|
-
)
|
|
575
|
-
);
|
|
576
|
-
return getAllLeafColumns().filter((column) => !groupedColumnIds.has(column.id));
|
|
577
|
-
};
|
|
578
|
-
const getColumnDisplayName = (columnId, groupName) => {
|
|
579
|
-
if (groupName && columnId.startsWith(`${groupName}.`)) {
|
|
580
|
-
const cleanId = columnId.replace(`${groupName}.`, "");
|
|
581
|
-
return cleanId.split("_").map((word) => word.slice(1)).join(" ");
|
|
582
|
-
}
|
|
583
|
-
return columnId.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
584
|
-
};
|
|
585
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "rounded-xl", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "px-2", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex flex-col gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
586
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center gap-3", children: filters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-3 flex-wrap", children: [
|
|
587
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex items-center gap-2 text-sm font-medium text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Filter, { className: "h-4 w-4" }) }),
|
|
588
|
-
filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: cn("relative min-w-[150px]", filter.width), children: filter.type === "select" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
589
|
-
Select,
|
|
590
|
-
{
|
|
591
|
-
value: table.getColumn(filter.key)?.getFilterValue() ?? "",
|
|
592
|
-
onValueChange: (value) => table.getColumn(filter.key)?.setFilterValue(value === "all" ? "" : value),
|
|
593
|
-
children: [
|
|
594
|
-
filter.icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(filter.icon, { className: "size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" }) }),
|
|
595
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectTrigger, { className: cn("h-9 rounded-lg w-full", filter.icon && "pl-9"), children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectValue, { placeholder: filter.placeholder }) }),
|
|
596
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(SelectContent, { className: "rounded-lg", children: [
|
|
597
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectItem, { value: "all", children: "All" }),
|
|
598
|
-
filter.options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SelectItem, { value: option.value, children: option.label }, option.label))
|
|
599
|
-
] })
|
|
600
|
-
]
|
|
601
|
-
}
|
|
602
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative", children: [
|
|
603
|
-
filter.icon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(filter.icon, { className: "size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" }) }),
|
|
604
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
605
|
-
Input,
|
|
606
|
-
{
|
|
607
|
-
placeholder: filter.placeholder,
|
|
608
|
-
value: table.getColumn(filter.key)?.getFilterValue() ?? "",
|
|
609
|
-
onChange: (event) => table.getColumn(filter.key)?.setFilterValue(event.target.value),
|
|
610
|
-
className: cn("h-9 rounded-lg", filter.icon && "pl-9"),
|
|
611
|
-
type: filter.type === "number" ? "number" : filter.type === "date" ? "date" : "text"
|
|
612
|
-
}
|
|
613
|
-
)
|
|
614
|
-
] }) }, filter.key))
|
|
615
|
-
] }) }),
|
|
616
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
617
|
-
enableGlobalFilter && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative", children: [
|
|
618
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
619
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
620
|
-
Input,
|
|
621
|
-
{
|
|
622
|
-
placeholder: "Global search...",
|
|
623
|
-
value: globalFilter ?? "",
|
|
624
|
-
onChange: (event) => onGlobalFilterChange(event.target.value),
|
|
625
|
-
className: "pl-9 max-w-max"
|
|
626
|
-
}
|
|
627
|
-
)
|
|
628
|
-
] }),
|
|
629
|
-
onExport && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Button, { variant: "outline", size: "sm", onClick: () => onExport(data), className: "rounded-lg", children: [
|
|
630
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Download, { className: "mr-2 h-4 w-4" }),
|
|
631
|
-
"Export"
|
|
632
|
-
] }),
|
|
633
|
-
enableColumnVisibility && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenu, { children: [
|
|
634
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Button, { variant: "outline", size: "sm", className: "rounded-lg gap-1", children: [
|
|
635
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Columns" }),
|
|
636
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ChevronDown, { className: "h-4 w-4 opacity-50" })
|
|
637
|
-
] }) }),
|
|
638
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuContent, { align: "end", className: "w-[220px] rounded-lg max-h-[400px] overflow-y-auto", children: [
|
|
639
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuLabel, { className: "px-4 py-2 text-sm font-medium", children: "Toggle Columns" }),
|
|
640
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuSeparator, {}),
|
|
641
|
-
getUngroupedLeafColumns().length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuGroup, { children: [
|
|
642
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuLabel, { className: "px-4 py-1.5 text-sm font-medium text-muted-foreground", children: "General" }),
|
|
643
|
-
getUngroupedLeafColumns().map((column) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
644
|
-
DropdownMenuCheckboxItem,
|
|
645
|
-
{
|
|
646
|
-
className: "text-sm",
|
|
647
|
-
checked: column.getIsVisible(),
|
|
648
|
-
onCheckedChange: (value) => column.toggleVisibility(!!value),
|
|
649
|
-
children: getColumnDisplayName(column.id)
|
|
650
|
-
},
|
|
651
|
-
column.id
|
|
652
|
-
))
|
|
653
|
-
] }),
|
|
654
|
-
getGroupColumns().map((group) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuGroup, { children: [
|
|
655
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuSeparator, {}),
|
|
656
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuLabel, { className: "px-4 py-1.5 text-sm font-medium text-muted-foreground", children: group.id }),
|
|
657
|
-
group.columns?.filter((column) => column.getCanHide?.() !== false).map((column) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
658
|
-
DropdownMenuCheckboxItem,
|
|
659
|
-
{
|
|
660
|
-
className: "text-sm",
|
|
661
|
-
checked: column.getIsVisible(),
|
|
662
|
-
onCheckedChange: (value) => column.toggleVisibility(!!value),
|
|
663
|
-
children: getColumnDisplayName(column.id, group.id)
|
|
664
|
-
},
|
|
665
|
-
column.id
|
|
666
|
-
))
|
|
667
|
-
] }, group.id))
|
|
668
|
-
] })
|
|
669
|
-
] }),
|
|
670
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenu, { children: [
|
|
671
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { variant: "outline", size: "sm", className: "rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Settings2, { className: "h-4 w-4" }) }) }),
|
|
672
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuContent, { align: "end", className: "w-[200px] rounded-lg", children: [
|
|
673
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuLabel, { children: "Table Settings" }),
|
|
674
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuSeparator, {}),
|
|
675
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuItem, { onClick: onClearSorting, children: [
|
|
676
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ArrowUpDown, { className: "mr-2 h-4 w-4" }),
|
|
677
|
-
"Clear All Sorting"
|
|
678
|
-
] }),
|
|
679
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(DropdownMenuItem, { onClick: onClearFilters, children: [
|
|
680
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Filter, { className: "mr-2 h-4 w-4" }),
|
|
681
|
-
"Clear All Filters"
|
|
682
|
-
] }),
|
|
683
|
-
enableColumnPinning && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
684
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuSeparator, {}),
|
|
685
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DropdownMenuLabel, { children: "Column Pinning" }),
|
|
686
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
687
|
-
DropdownMenuItem,
|
|
688
|
-
{
|
|
689
|
-
onClick: () => table.setColumnPinning({ left: [], right: [] }),
|
|
690
|
-
children: [
|
|
691
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.PinOff, { className: "mr-2 h-4 w-4" }),
|
|
692
|
-
"Reset All Pinning"
|
|
693
|
-
]
|
|
694
|
-
}
|
|
695
|
-
),
|
|
696
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
697
|
-
DropdownMenuItem,
|
|
698
|
-
{
|
|
699
|
-
onClick: () => {
|
|
700
|
-
const leftColumns = getAllLeafColumns().filter((column) => column.getCanPin?.() !== false).map((column) => column.id);
|
|
701
|
-
table.setColumnPinning({ left: leftColumns, right: [] });
|
|
702
|
-
},
|
|
703
|
-
children: [
|
|
704
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Pin, { className: "mr-2 h-4 w-4 rotate-90" }),
|
|
705
|
-
"Pin All Left"
|
|
706
|
-
]
|
|
707
|
-
}
|
|
708
|
-
),
|
|
709
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
710
|
-
DropdownMenuItem,
|
|
711
|
-
{
|
|
712
|
-
onClick: () => {
|
|
713
|
-
const rightColumns = getAllLeafColumns().filter((column) => column.getCanPin?.() !== false).map((column) => column.id);
|
|
714
|
-
table.setColumnPinning({ left: [], right: rightColumns });
|
|
715
|
-
},
|
|
716
|
-
children: [
|
|
717
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Pin, { className: "mr-2 h-4 w-4 -rotate-90" }),
|
|
718
|
-
"Pin All Right"
|
|
719
|
-
]
|
|
720
|
-
}
|
|
721
|
-
)
|
|
722
|
-
] })
|
|
723
|
-
] })
|
|
724
|
-
] }),
|
|
725
|
-
onRefresh && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Button, { variant: "outline", size: "sm", onClick: onRefresh, disabled: loading, className: "rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.RefreshCw, { className: cn("h-4 w-4", loading && "animate-spin") }) })
|
|
726
|
-
] })
|
|
727
|
-
] }) }) }) });
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
// src/components/data/data-table/data-table-pagination.tsx
|
|
731
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
732
|
-
function DataTablePagination({ table, config }) {
|
|
733
|
-
if (!config.enabled) return null;
|
|
734
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "rounded-xl", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
735
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center gap-6 text-sm text-muted-foreground", children: config.showInfo !== false && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
|
|
736
|
-
"Showing ",
|
|
737
|
-
table.getState().pagination.pageIndex * table.getState().pagination.pageSize + 1,
|
|
738
|
-
" to",
|
|
739
|
-
" ",
|
|
740
|
-
Math.min(
|
|
741
|
-
(table.getState().pagination.pageIndex + 1) * table.getState().pagination.pageSize,
|
|
742
|
-
table.getFilteredRowModel().rows.length
|
|
743
|
-
),
|
|
744
|
-
" ",
|
|
745
|
-
"of ",
|
|
746
|
-
table.getFilteredRowModel().rows.length,
|
|
747
|
-
" entries"
|
|
748
|
-
] }) }),
|
|
749
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
750
|
-
config.pageSizeOptions && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
751
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium", children: "Rows per page:" }),
|
|
752
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
753
|
-
Select,
|
|
754
|
-
{
|
|
755
|
-
value: `${table.getState().pagination.pageSize}`,
|
|
756
|
-
onValueChange: (value) => table.setPageSize(Number(value)),
|
|
757
|
-
children: [
|
|
758
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectTrigger, { className: "h-9 w-[70px] rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectValue, {}) }),
|
|
759
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectContent, { side: "top", className: "rounded-lg", children: config.pageSizeOptions.map((pageSize) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize)) })
|
|
760
|
-
]
|
|
761
|
-
}
|
|
762
|
-
)
|
|
763
|
-
] }),
|
|
764
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
765
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
766
|
-
Button,
|
|
767
|
-
{
|
|
768
|
-
variant: "outline",
|
|
769
|
-
size: "sm",
|
|
770
|
-
onClick: () => table.setPageIndex(0),
|
|
771
|
-
disabled: !table.getCanPreviousPage(),
|
|
772
|
-
className: "rounded-lg",
|
|
773
|
-
children: "First"
|
|
774
|
-
}
|
|
775
|
-
),
|
|
776
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
777
|
-
Button,
|
|
778
|
-
{
|
|
779
|
-
variant: "outline",
|
|
780
|
-
size: "sm",
|
|
781
|
-
onClick: () => table.previousPage(),
|
|
782
|
-
disabled: !table.getCanPreviousPage(),
|
|
783
|
-
className: "rounded-lg",
|
|
784
|
-
children: "Previous"
|
|
785
|
-
}
|
|
786
|
-
),
|
|
787
|
-
config.showPageNumbers && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center gap-1", children: Array.from({ length: Math.min(5, table.getPageCount()) }, (_, i) => {
|
|
788
|
-
const pageIndex = table.getState().pagination.pageIndex;
|
|
789
|
-
const pageNumber = pageIndex - 2 + i + 1;
|
|
790
|
-
if (pageNumber < 1 || pageNumber > table.getPageCount()) return null;
|
|
791
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
792
|
-
Button,
|
|
793
|
-
{
|
|
794
|
-
variant: pageNumber === pageIndex + 1 ? "default" : "outline",
|
|
795
|
-
size: "sm",
|
|
796
|
-
className: "size-8 p-0 rounded-lg",
|
|
797
|
-
onClick: () => table.setPageIndex(pageNumber - 1),
|
|
798
|
-
children: pageNumber
|
|
799
|
-
},
|
|
800
|
-
pageNumber
|
|
801
|
-
);
|
|
802
|
-
}) }),
|
|
803
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
804
|
-
Button,
|
|
805
|
-
{
|
|
806
|
-
variant: "outline",
|
|
807
|
-
size: "sm",
|
|
808
|
-
onClick: () => table.nextPage(),
|
|
809
|
-
disabled: !table.getCanNextPage(),
|
|
810
|
-
className: "rounded-lg",
|
|
811
|
-
children: "Next"
|
|
812
|
-
}
|
|
813
|
-
),
|
|
814
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
815
|
-
Button,
|
|
816
|
-
{
|
|
817
|
-
variant: "outline",
|
|
818
|
-
size: "sm",
|
|
819
|
-
onClick: () => table.setPageIndex(table.getPageCount() - 1),
|
|
820
|
-
disabled: !table.getCanNextPage(),
|
|
821
|
-
className: "rounded-lg",
|
|
822
|
-
children: "Last"
|
|
823
|
-
}
|
|
824
|
-
)
|
|
825
|
-
] })
|
|
826
|
-
] })
|
|
827
|
-
] }) }) });
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
// src/components/ui/toggle.tsx
|
|
831
|
-
var import_radix_ui5 = require("radix-ui");
|
|
832
|
-
var import_class_variance_authority2 = require("class-variance-authority");
|
|
833
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
834
|
-
var toggleVariants = (0, import_class_variance_authority2.cva)(
|
|
835
|
-
"inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",
|
|
836
|
-
{
|
|
837
|
-
variants: {
|
|
838
|
-
variant: {
|
|
839
|
-
default: "bg-transparent",
|
|
840
|
-
outline: "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"
|
|
841
|
-
},
|
|
842
|
-
size: {
|
|
843
|
-
sm: "h-7 px-0 min-w-7",
|
|
844
|
-
default: "h-8 px-1 min-w-8",
|
|
845
|
-
lg: "h-9 px-2 min-w-10"
|
|
846
|
-
},
|
|
847
|
-
bg: {
|
|
848
|
-
enabled: "data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
|
|
849
|
-
disabled: ""
|
|
850
|
-
}
|
|
851
|
-
},
|
|
852
|
-
defaultVariants: {
|
|
853
|
-
variant: "default",
|
|
854
|
-
size: "default",
|
|
855
|
-
bg: "enabled"
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
);
|
|
859
|
-
function Toggle({
|
|
860
|
-
className,
|
|
861
|
-
variant,
|
|
862
|
-
size,
|
|
863
|
-
noBg,
|
|
864
|
-
...props
|
|
865
|
-
}) {
|
|
866
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
867
|
-
import_radix_ui5.Toggle.Root,
|
|
868
|
-
{
|
|
869
|
-
"data-slot": "toggle",
|
|
870
|
-
className: cn(toggleVariants({ className, variant, size, bg: noBg ? "disabled" : "enabled" })),
|
|
871
|
-
...props
|
|
872
|
-
}
|
|
873
|
-
);
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
// src/components/ui/checkbox.tsx
|
|
877
|
-
var import_radix_ui6 = require("radix-ui");
|
|
878
|
-
var import_lucide_react4 = require("lucide-react");
|
|
879
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
880
|
-
function Checkbox({
|
|
881
|
-
className,
|
|
882
|
-
...props
|
|
883
|
-
}) {
|
|
884
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
885
|
-
import_radix_ui6.Checkbox.Root,
|
|
886
|
-
{
|
|
887
|
-
"data-slot": "checkbox",
|
|
888
|
-
className: cn(
|
|
889
|
-
"peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
890
|
-
className
|
|
891
|
-
),
|
|
892
|
-
...props,
|
|
893
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
894
|
-
import_radix_ui6.Checkbox.Indicator,
|
|
895
|
-
{
|
|
896
|
-
"data-slot": "checkbox-indicator",
|
|
897
|
-
className: "flex items-center justify-center text-current transition-none",
|
|
898
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.CheckIcon, { className: "size-3.5" })
|
|
899
|
-
}
|
|
900
|
-
)
|
|
901
|
-
}
|
|
902
|
-
);
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
// src/components/data/data-table/data-table.tsx
|
|
906
|
-
var import_react = require("react");
|
|
907
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
908
|
-
function DataTable({
|
|
909
|
-
data,
|
|
910
|
-
columns: initialColumns,
|
|
911
|
-
filters = [],
|
|
912
|
-
pagination = { enabled: false },
|
|
913
|
-
settings = {},
|
|
914
|
-
header,
|
|
915
|
-
footer,
|
|
916
|
-
className = "",
|
|
917
|
-
maxHeight = "600px",
|
|
918
|
-
loading = false,
|
|
919
|
-
error,
|
|
920
|
-
emptyMessage = "No data available",
|
|
921
|
-
onRowSelectionChange,
|
|
922
|
-
onExport,
|
|
923
|
-
onRefresh,
|
|
924
|
-
onTableReady,
|
|
925
|
-
children
|
|
926
|
-
}) {
|
|
927
|
-
const [sorting, setSorting] = (0, import_react.useState)([]);
|
|
928
|
-
const [columnFilters, setColumnFilters] = (0, import_react.useState)([]);
|
|
929
|
-
const [columnVisibility, setColumnVisibility] = (0, import_react.useState)({});
|
|
930
|
-
const [rowSelection, setRowSelection] = (0, import_react.useState)({});
|
|
931
|
-
const [globalFilter, setGlobalFilter] = (0, import_react.useState)("");
|
|
932
|
-
const [columnOrder, setColumnOrder] = (0, import_react.useState)([]);
|
|
933
|
-
const [columnPinning, setColumnPinning] = (0, import_react.useState)(
|
|
934
|
-
settings.enableColumnPinning ? { left: [], right: [] } : {}
|
|
935
|
-
);
|
|
936
|
-
const {
|
|
937
|
-
enableSorting = true,
|
|
938
|
-
enableFiltering = true,
|
|
939
|
-
enableGlobalFilter = true,
|
|
940
|
-
enableColumnVisibility = true,
|
|
941
|
-
enableRowSelection = true,
|
|
942
|
-
stickyHeader = true,
|
|
943
|
-
toolbar = false,
|
|
944
|
-
showSerialNumbers = true,
|
|
945
|
-
fixedCheckboxColumn = true,
|
|
946
|
-
striped = true,
|
|
947
|
-
hoverable = true,
|
|
948
|
-
compact = true,
|
|
949
|
-
bordered = true,
|
|
950
|
-
fullHeight = false,
|
|
951
|
-
enableColumnResizing = false,
|
|
952
|
-
enableColumnPinning = true,
|
|
953
|
-
hideHeader = false
|
|
954
|
-
} = settings;
|
|
955
|
-
const columns = (0, import_react.useMemo)(() => {
|
|
956
|
-
const cols = [...initialColumns];
|
|
957
|
-
const processColumns = (columns2) => {
|
|
958
|
-
return columns2.map((col) => {
|
|
959
|
-
if (col.id === "select" || col.id === "serialNumber") {
|
|
960
|
-
return col;
|
|
961
|
-
}
|
|
962
|
-
const newCol = {
|
|
963
|
-
...col,
|
|
964
|
-
enablePinning: true
|
|
965
|
-
};
|
|
966
|
-
if (col.columns) {
|
|
967
|
-
newCol.columns = processColumns(col.columns);
|
|
968
|
-
}
|
|
969
|
-
return newCol;
|
|
970
|
-
});
|
|
971
|
-
};
|
|
972
|
-
const processedCols = processColumns(cols);
|
|
973
|
-
if (enableRowSelection) {
|
|
974
|
-
const selectColumn = {
|
|
975
|
-
id: "select",
|
|
976
|
-
header: ({ table: table2 }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
977
|
-
Checkbox,
|
|
978
|
-
{
|
|
979
|
-
checked: table2.getIsAllPageRowsSelected() || table2.getIsSomePageRowsSelected() && "indeterminate",
|
|
980
|
-
onCheckedChange: (value) => table2.toggleAllPageRowsSelected(!!value),
|
|
981
|
-
"aria-label": "Select all"
|
|
982
|
-
}
|
|
983
|
-
),
|
|
984
|
-
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("flex items-center justify-center"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
985
|
-
Checkbox,
|
|
986
|
-
{
|
|
987
|
-
checked: row.getIsSelected(),
|
|
988
|
-
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
989
|
-
"aria-label": "Select row"
|
|
990
|
-
}
|
|
991
|
-
) }),
|
|
992
|
-
enableSorting: false,
|
|
993
|
-
enableHiding: false,
|
|
994
|
-
enablePinning: true,
|
|
995
|
-
headerAlign: "center",
|
|
996
|
-
size: 10
|
|
997
|
-
};
|
|
998
|
-
processedCols.unshift(selectColumn);
|
|
999
|
-
}
|
|
1000
|
-
if (showSerialNumbers) {
|
|
1001
|
-
const serialColumn = {
|
|
1002
|
-
id: "serialNumber",
|
|
1003
|
-
header: "No.",
|
|
1004
|
-
cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-center font-medium text-muted-foreground", children: row.index + 1 }),
|
|
1005
|
-
enableSorting: true,
|
|
1006
|
-
enableHiding: false,
|
|
1007
|
-
enablePinning: true,
|
|
1008
|
-
size: 60,
|
|
1009
|
-
headerAlign: "center"
|
|
1010
|
-
};
|
|
1011
|
-
processedCols.unshift(serialColumn);
|
|
1012
|
-
}
|
|
1013
|
-
return processedCols;
|
|
1014
|
-
}, [initialColumns, showSerialNumbers, enableRowSelection, fixedCheckboxColumn]);
|
|
1015
|
-
const table = (0, import_react_table.useReactTable)({
|
|
1016
|
-
data,
|
|
1017
|
-
columns,
|
|
1018
|
-
onSortingChange: enableSorting ? setSorting : void 0,
|
|
1019
|
-
onColumnFiltersChange: enableFiltering ? setColumnFilters : void 0,
|
|
1020
|
-
onGlobalFilterChange: enableGlobalFilter ? setGlobalFilter : void 0,
|
|
1021
|
-
getCoreRowModel: (0, import_react_table.getCoreRowModel)(),
|
|
1022
|
-
getPaginationRowModel: pagination.enabled ? (0, import_react_table.getPaginationRowModel)() : void 0,
|
|
1023
|
-
getSortedRowModel: enableSorting ? (0, import_react_table.getSortedRowModel)() : void 0,
|
|
1024
|
-
getFilteredRowModel: enableFiltering ? (0, import_react_table.getFilteredRowModel)() : void 0,
|
|
1025
|
-
onColumnVisibilityChange: enableColumnVisibility ? setColumnVisibility : void 0,
|
|
1026
|
-
onRowSelectionChange: enableRowSelection ? setRowSelection : void 0,
|
|
1027
|
-
onColumnOrderChange: setColumnOrder,
|
|
1028
|
-
onColumnPinningChange: enableColumnPinning ? setColumnPinning : void 0,
|
|
1029
|
-
state: {
|
|
1030
|
-
sorting: enableSorting ? sorting : void 0,
|
|
1031
|
-
columnFilters: enableFiltering ? columnFilters : void 0,
|
|
1032
|
-
columnVisibility: enableColumnVisibility ? columnVisibility : void 0,
|
|
1033
|
-
rowSelection: enableRowSelection ? rowSelection : {},
|
|
1034
|
-
globalFilter,
|
|
1035
|
-
columnOrder,
|
|
1036
|
-
columnPinning: enableColumnPinning ? columnPinning : {}
|
|
1037
|
-
},
|
|
1038
|
-
initialState: {
|
|
1039
|
-
pagination: pagination.enabled ? { pageSize: pagination.pageSize || 10 } : void 0,
|
|
1040
|
-
columnPinning: enableColumnPinning ? {
|
|
1041
|
-
left: [
|
|
1042
|
-
...showSerialNumbers ? ["serialNumber"] : [],
|
|
1043
|
-
...enableRowSelection ? ["select"] : []
|
|
1044
|
-
],
|
|
1045
|
-
right: []
|
|
1046
|
-
} : void 0
|
|
1047
|
-
},
|
|
1048
|
-
enableRowSelection,
|
|
1049
|
-
enableColumnResizing,
|
|
1050
|
-
enableColumnPinning,
|
|
1051
|
-
columnResizeMode: "onChange"
|
|
1052
|
-
});
|
|
1053
|
-
(0, import_react.useEffect)(() => {
|
|
1054
|
-
if (onTableReady) {
|
|
1055
|
-
onTableReady(table);
|
|
1056
|
-
}
|
|
1057
|
-
}, [table, onTableReady]);
|
|
1058
|
-
(0, import_react.useEffect)(() => {
|
|
1059
|
-
if (enableRowSelection && onRowSelectionChange) {
|
|
1060
|
-
const selectedRows = table.getFilteredSelectedRowModel().rows.map((row) => row.original);
|
|
1061
|
-
onRowSelectionChange(selectedRows);
|
|
1062
|
-
}
|
|
1063
|
-
}, [rowSelection, enableRowSelection, onRowSelectionChange, table]);
|
|
1064
|
-
const handleClearSorting = (0, import_react.useCallback)(() => {
|
|
1065
|
-
setSorting([]);
|
|
1066
|
-
}, []);
|
|
1067
|
-
const handleClearFilters = (0, import_react.useCallback)(() => {
|
|
1068
|
-
setColumnFilters([]);
|
|
1069
|
-
setGlobalFilter("");
|
|
1070
|
-
}, []);
|
|
1071
|
-
const handlePinColumn = (columnId, side) => {
|
|
1072
|
-
if (!enableColumnPinning) return;
|
|
1073
|
-
const alwaysPinnedLeft = [
|
|
1074
|
-
...showSerialNumbers ? ["serialNumber"] : [],
|
|
1075
|
-
...enableRowSelection && fixedCheckboxColumn ? ["select"] : []
|
|
1076
|
-
];
|
|
1077
|
-
const newPinning = {
|
|
1078
|
-
left: [...(columnPinning.left ?? []).filter((id) => alwaysPinnedLeft.includes(id))],
|
|
1079
|
-
right: [...columnPinning.right ?? []]
|
|
1080
|
-
};
|
|
1081
|
-
if (side === false) {
|
|
1082
|
-
newPinning.left = newPinning.left.filter((id) => id !== columnId);
|
|
1083
|
-
newPinning.right = newPinning.right.filter((id) => id !== columnId);
|
|
1084
|
-
} else if (side === "right") {
|
|
1085
|
-
newPinning.left = newPinning.left.filter((id) => id !== columnId);
|
|
1086
|
-
if (!newPinning.right.includes(columnId)) {
|
|
1087
|
-
newPinning.right.push(columnId);
|
|
1088
|
-
}
|
|
1089
|
-
} else if (side === "left") {
|
|
1090
|
-
newPinning.right = newPinning.right.filter((id) => id !== columnId);
|
|
1091
|
-
if (!newPinning.left.includes(columnId) && !alwaysPinnedLeft.includes(columnId)) {
|
|
1092
|
-
newPinning.left.push(columnId);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
table.setColumnPinning(newPinning);
|
|
1096
|
-
};
|
|
1097
|
-
const renderTableHeader = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableHeader, { className: cn(
|
|
1098
|
-
stickyHeader && "sticky top-0 bg-sidebar z-20"
|
|
1099
|
-
), children: table.getHeaderGroups().map((headerGroup, groupIndex) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableRow, { className: "hover:bg-transparent", children: headerGroup.headers.map((header2, index) => {
|
|
1100
|
-
const isGroupHeader = header2.depth === 0 && header2.colSpan > 1;
|
|
1101
|
-
const isPinnedLeft = enableColumnPinning && (header2.column.getIsPinned() === "left" || header2.column.id === "serialNumber" || header2.column.id === "select" && enableRowSelection);
|
|
1102
|
-
const isPinnedRight = enableColumnPinning && header2.column.getIsPinned() === "right";
|
|
1103
|
-
const canSort = header2.column.getCanSort();
|
|
1104
|
-
const canPin = enableColumnPinning && header2.column.columnDef.enablePinning !== false;
|
|
1105
|
-
const isSerialNumber = header2.column.id === "serialNumber";
|
|
1106
|
-
const isCheckbox = header2.column.id === "select";
|
|
1107
|
-
const alwaysPinned = isSerialNumber || isCheckbox && fixedCheckboxColumn;
|
|
1108
|
-
const headerAlign = header2.column.columnDef.headerAlign || "left";
|
|
1109
|
-
const flexJustify = {
|
|
1110
|
-
left: "justify-start",
|
|
1111
|
-
center: "justify-center",
|
|
1112
|
-
right: "justify-end"
|
|
1113
|
-
}[headerAlign];
|
|
1114
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1115
|
-
TableHead,
|
|
1116
|
-
{
|
|
1117
|
-
colSpan: header2.colSpan,
|
|
1118
|
-
className: cn(
|
|
1119
|
-
"font-semibold text-foreground bg-sidebar group px-0",
|
|
1120
|
-
!compact && "py-2",
|
|
1121
|
-
bordered && index < headerGroup.headers.length - 1 && "border-r",
|
|
1122
|
-
"relative",
|
|
1123
|
-
isPinnedLeft && "sticky left-0 z-15 bg-sidebar",
|
|
1124
|
-
isPinnedRight && "sticky right-0 z-15 bg-sidebar",
|
|
1125
|
-
(isSerialNumber || isCheckbox) && "sticky left-0 z-15 bg-sidebar",
|
|
1126
|
-
isGroupHeader ? "text-center" : "text-left"
|
|
1127
|
-
),
|
|
1128
|
-
style: {
|
|
1129
|
-
width: header2.getSize() !== 150 ? header2.getSize() : "auto",
|
|
1130
|
-
minWidth: header2.getSize() !== 150 ? header2.getSize() : "auto",
|
|
1131
|
-
...isPinnedLeft && {
|
|
1132
|
-
left: isSerialNumber ? 0 : isCheckbox ? showSerialNumbers ? table.getColumn("serialNumber")?.getSize() || 0 : 0 : getLeftOffset(header2.column)
|
|
1133
|
-
},
|
|
1134
|
-
...isPinnedRight && { right: getRightOffset(header2.column) },
|
|
1135
|
-
...isSerialNumber && { left: 0 }
|
|
1136
|
-
},
|
|
1137
|
-
children: [
|
|
1138
|
-
isGroupHeader ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex items-center justify-center", children: (0, import_react_table.flexRender)(header2.column.columnDef.header, header2.getContext()) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("relative flex items-center w-full px-2", flexJustify), children: [
|
|
1139
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
1140
|
-
canSort && headerAlign === "right" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "ml-1 order-2", children: header2.column.getIsSorted() && {
|
|
1141
|
-
asc: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronUp, { className: "h-4 w-4" }),
|
|
1142
|
-
desc: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronDown, { className: "h-4 w-4" })
|
|
1143
|
-
}[header2.column.getIsSorted()] }),
|
|
1144
|
-
header2.isPlaceholder ? null : (0, import_react_table.flexRender)(header2.column.columnDef.header, header2.getContext()),
|
|
1145
|
-
canSort && headerAlign !== "right" && header2.column.getIsSorted() && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "ml-1 order-2", children: header2.column.getIsSorted() && {
|
|
1146
|
-
asc: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronUp, { className: "h-4 w-4" }),
|
|
1147
|
-
desc: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronDown, { className: "h-4 w-4" })
|
|
1148
|
-
}[header2.column.getIsSorted()] })
|
|
1149
|
-
] }),
|
|
1150
|
-
(canSort || canPin && !alwaysPinned) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DropdownMenu, { children: [
|
|
1151
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuTrigger, { asChild: true, className: cn(
|
|
1152
|
-
"absolute",
|
|
1153
|
-
headerAlign === "left" && "right-1",
|
|
1154
|
-
headerAlign === "center" && "right-1",
|
|
1155
|
-
headerAlign === "right" && "left-1"
|
|
1156
|
-
), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1157
|
-
Toggle,
|
|
1158
|
-
{
|
|
1159
|
-
variant: "default",
|
|
1160
|
-
size: "sm",
|
|
1161
|
-
noBg: true,
|
|
1162
|
-
tabIndex: -1,
|
|
1163
|
-
className: "opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",
|
|
1164
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.MoreHorizontal, { className: "h-4 w-4" })
|
|
1165
|
-
}
|
|
1166
|
-
) }),
|
|
1167
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(DropdownMenuContent, { align: "end", className: "w-48", children: [
|
|
1168
|
-
canSort && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1169
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuLabel, { children: "Sorting" }),
|
|
1170
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1171
|
-
DropdownMenuItem,
|
|
1172
|
-
{
|
|
1173
|
-
onClick: () => header2.column.toggleSorting(false),
|
|
1174
|
-
children: [
|
|
1175
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronUp, { className: "mr-2 h-4 w-4" }),
|
|
1176
|
-
"Sort Ascending"
|
|
1177
|
-
]
|
|
1178
|
-
}
|
|
1179
|
-
),
|
|
1180
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1181
|
-
DropdownMenuItem,
|
|
1182
|
-
{
|
|
1183
|
-
onClick: () => header2.column.toggleSorting(true),
|
|
1184
|
-
children: [
|
|
1185
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronDown, { className: "mr-2 h-4 w-4" }),
|
|
1186
|
-
"Sort Descending"
|
|
1187
|
-
]
|
|
1188
|
-
}
|
|
1189
|
-
),
|
|
1190
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1191
|
-
DropdownMenuItem,
|
|
1192
|
-
{
|
|
1193
|
-
onClick: () => header2.column.clearSorting(),
|
|
1194
|
-
disabled: !header2.column.getIsSorted(),
|
|
1195
|
-
children: [
|
|
1196
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ChevronsUpDown, { className: "mr-2 h-4 w-4" }),
|
|
1197
|
-
"Clear Sort"
|
|
1198
|
-
]
|
|
1199
|
-
}
|
|
1200
|
-
),
|
|
1201
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuSeparator, {})
|
|
1202
|
-
] }),
|
|
1203
|
-
canPin && !alwaysPinned && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1204
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DropdownMenuLabel, { children: "Pin Column" }),
|
|
1205
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1206
|
-
DropdownMenuItem,
|
|
1207
|
-
{
|
|
1208
|
-
onClick: () => handlePinColumn(header2.column.id, "right"),
|
|
1209
|
-
disabled: header2.column.getIsPinned() === "right",
|
|
1210
|
-
children: [
|
|
1211
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.MoveRightIcon, {}),
|
|
1212
|
-
"Pin Right"
|
|
1213
|
-
]
|
|
1214
|
-
}
|
|
1215
|
-
),
|
|
1216
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1217
|
-
DropdownMenuItem,
|
|
1218
|
-
{
|
|
1219
|
-
onClick: () => handlePinColumn(header2.column.id, false),
|
|
1220
|
-
disabled: !header2.column.getIsPinned(),
|
|
1221
|
-
children: [
|
|
1222
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.PinOffIcon, {}),
|
|
1223
|
-
"Unpin"
|
|
1224
|
-
]
|
|
1225
|
-
}
|
|
1226
|
-
)
|
|
1227
|
-
] })
|
|
1228
|
-
] })
|
|
1229
|
-
] })
|
|
1230
|
-
] }),
|
|
1231
|
-
enableColumnResizing && header2.column.getCanResize() && !isGroupHeader && header2.colSpan === 1 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1232
|
-
"div",
|
|
1233
|
-
{
|
|
1234
|
-
className: "absolute right-0 top-0 h-full w-1 bg-border hover:bg-primary cursor-col-resize opacity-0 hover:opacity-100 transition-opacity",
|
|
1235
|
-
onMouseDown: header2.getResizeHandler()
|
|
1236
|
-
}
|
|
1237
|
-
)
|
|
1238
|
-
]
|
|
1239
|
-
},
|
|
1240
|
-
header2.id
|
|
1241
|
-
);
|
|
1242
|
-
}) }, headerGroup.id)) });
|
|
1243
|
-
const getLeftOffset = (column) => {
|
|
1244
|
-
if (!enableColumnPinning) return void 0;
|
|
1245
|
-
let offset = 0;
|
|
1246
|
-
const pinnedLeftColumns = table.getLeftHeaderGroups()[0]?.headers || [];
|
|
1247
|
-
const alwaysPinnedColumns = [
|
|
1248
|
-
...showSerialNumbers ? ["serialNumber"] : [],
|
|
1249
|
-
...enableRowSelection ? ["select"] : []
|
|
1250
|
-
];
|
|
1251
|
-
for (const col of pinnedLeftColumns) {
|
|
1252
|
-
if (col.id === column.id) break;
|
|
1253
|
-
if (alwaysPinnedColumns.includes(col.id)) {
|
|
1254
|
-
const column2 = table.getColumn(col.id);
|
|
1255
|
-
if (column2) {
|
|
1256
|
-
offset += column2.getSize();
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
return offset;
|
|
1261
|
-
};
|
|
1262
|
-
const getRightOffset = (column) => {
|
|
1263
|
-
if (!enableColumnPinning) return void 0;
|
|
1264
|
-
const pinnedRightIds = table.getState().columnPinning.right || [];
|
|
1265
|
-
const columnIndex = pinnedRightIds.indexOf(column.id);
|
|
1266
|
-
if (columnIndex === -1) return void 0;
|
|
1267
|
-
let offset = 0;
|
|
1268
|
-
for (let i = columnIndex + 1; i < pinnedRightIds.length; i++) {
|
|
1269
|
-
const col = table.getColumn(pinnedRightIds[i]);
|
|
1270
|
-
if (col) {
|
|
1271
|
-
offset += col.getSize();
|
|
1272
|
-
}
|
|
1273
|
-
}
|
|
1274
|
-
return offset;
|
|
1275
|
-
};
|
|
1276
|
-
if (error) {
|
|
1277
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Card, { className: "w-full rounded-xl shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardContent, { className: "flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-center", children: [
|
|
1278
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-red-500 mb-3 text-2xl", children: "\u26A0\uFE0F" }),
|
|
1279
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-sm text-muted-foreground mb-4", children: error }),
|
|
1280
|
-
onRefresh && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Button, { variant: "outline", size: "sm", onClick: onRefresh, className: "rounded-lg", children: [
|
|
1281
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Loader2, { className: "mr-2 h-4 w-4" }),
|
|
1282
|
-
"Try Again"
|
|
1283
|
-
] })
|
|
1284
|
-
] }) }) });
|
|
1285
|
-
}
|
|
1286
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: cn("w-full space-y-2 flex flex-col h-full", className), children: [
|
|
1287
|
-
header && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Card, { className: "rounded-2xl py-2 sticky top-0 z-20", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardContent, { className: "px-2", children: header }) }),
|
|
1288
|
-
toolbar && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1289
|
-
DataTableToolbar,
|
|
1290
|
-
{
|
|
1291
|
-
table,
|
|
1292
|
-
filters,
|
|
1293
|
-
globalFilter,
|
|
1294
|
-
onGlobalFilterChange: setGlobalFilter,
|
|
1295
|
-
enableGlobalFilter,
|
|
1296
|
-
onExport,
|
|
1297
|
-
onRefresh,
|
|
1298
|
-
loading,
|
|
1299
|
-
enableColumnVisibility,
|
|
1300
|
-
enableColumnPinning,
|
|
1301
|
-
data,
|
|
1302
|
-
onClearSorting: handleClearSorting,
|
|
1303
|
-
onClearFilters: handleClearFilters
|
|
1304
|
-
}
|
|
1305
|
-
),
|
|
1306
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Card, { className: cn("shadow-sm overflow-auto py-0", fullHeight && "flex-1"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CardContent, { className: "p-0 h-full", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative flex flex-col h-full justify-between", children: [
|
|
1307
|
-
loading && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-xl", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm", children: [
|
|
1308
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Loader2, { className: "size-5 animate-spin text-primary" }),
|
|
1309
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-sm font-medium text-muted-foreground", children: "Loading..." })
|
|
1310
|
-
] }) }),
|
|
1311
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "relative rounded-t-xl overflow-auto border-b", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Table, { className: "border-collapse w-full", children: [
|
|
1312
|
-
!hideHeader && renderTableHeader(),
|
|
1313
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1314
|
-
TableRow,
|
|
1315
|
-
{
|
|
1316
|
-
"data-state": row.getIsSelected() && "selected",
|
|
1317
|
-
className: cn(
|
|
1318
|
-
hoverable && "hover:bg-muted/50",
|
|
1319
|
-
striped && rowIndex % 2 === 0 && "bg-muted/20",
|
|
1320
|
-
row.getIsSelected() && "bg-muted",
|
|
1321
|
-
"border-b last:border-b-0"
|
|
1322
|
-
),
|
|
1323
|
-
children: row.getVisibleCells().map((cell, cellIndex) => {
|
|
1324
|
-
const isPinnedLeft = enableColumnPinning && (cell.column.getIsPinned() === "left" || cell.column.id === "serialNumber" || cell.column.id === "select" && enableRowSelection);
|
|
1325
|
-
const isPinnedRight = enableColumnPinning && cell.column.getIsPinned() === "right";
|
|
1326
|
-
const isSerialNumber = cell.column.id === "serialNumber";
|
|
1327
|
-
const isCheckbox = cell.column.id === "select";
|
|
1328
|
-
const alwaysPinned = isSerialNumber || isCheckbox && fixedCheckboxColumn;
|
|
1329
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1330
|
-
TableCell,
|
|
1331
|
-
{
|
|
1332
|
-
className: cn(
|
|
1333
|
-
compact ? "py-2" : "py-4",
|
|
1334
|
-
bordered && cellIndex < row.getVisibleCells().length && "border-r",
|
|
1335
|
-
isPinnedLeft && "sticky left-0 z-10 bg-sidebar/97",
|
|
1336
|
-
isPinnedRight && "sticky right-0 z-10 bg-sidebar/97",
|
|
1337
|
-
isSerialNumber && "sticky left-0 z-10 bg-sidebar/97",
|
|
1338
|
-
"p-1"
|
|
1339
|
-
),
|
|
1340
|
-
style: {
|
|
1341
|
-
width: cell.column.getSize() !== 150 ? cell.column.getSize() : "auto",
|
|
1342
|
-
minWidth: cell.column.getSize() !== 150 ? cell.column.getSize() : "auto",
|
|
1343
|
-
...isPinnedLeft && {
|
|
1344
|
-
left: isSerialNumber ? 0 : isCheckbox ? showSerialNumbers ? table.getColumn("serialNumber")?.getSize() || 0 : 0 : getLeftOffset(cell.column)
|
|
1345
|
-
},
|
|
1346
|
-
...isPinnedRight && { right: getRightOffset(cell.column) },
|
|
1347
|
-
...isSerialNumber && { left: 0 }
|
|
1348
|
-
},
|
|
1349
|
-
children: (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext())
|
|
1350
|
-
},
|
|
1351
|
-
cell.id
|
|
1352
|
-
);
|
|
1353
|
-
})
|
|
1354
|
-
},
|
|
1355
|
-
row.id
|
|
1356
|
-
)) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableCell, { colSpan: columns.length, className: "h-32 text-center border-0", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex flex-col items-center gap-3", children: [
|
|
1357
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-muted-foreground text-5xl", children: "\u{1F4CB}" }),
|
|
1358
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-muted-foreground font-medium", children: emptyMessage })
|
|
1359
|
-
] }) }) }) })
|
|
1360
|
-
] }) }),
|
|
1361
|
-
footer && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "sticky bottom-0 bg-sidebar w-full z-20", style: {
|
|
1362
|
-
width: "100%",
|
|
1363
|
-
minWidth: "fit-content"
|
|
1364
|
-
}, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Table, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableFooter, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableRow, { className: "bg-sidebar", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TableCell, { colSpan: columns.length, className: "p-2", children: footer }) }) }) }) })
|
|
1365
|
-
] }) }) }),
|
|
1366
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DataTablePagination, { table, config: pagination }),
|
|
1367
|
-
children && children(table)
|
|
1368
|
-
] }) });
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
// src/components/ui/separator.tsx
|
|
1372
|
-
var import_radix_ui7 = require("radix-ui");
|
|
1373
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1374
|
-
function Separator({
|
|
1375
|
-
className,
|
|
1376
|
-
orientation = "horizontal",
|
|
1377
|
-
decorative = true,
|
|
1378
|
-
...props
|
|
1379
|
-
}) {
|
|
1380
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1381
|
-
import_radix_ui7.Separator.Root,
|
|
1382
|
-
{
|
|
1383
|
-
"data-slot": "separator-root",
|
|
1384
|
-
decorative,
|
|
1385
|
-
orientation,
|
|
1386
|
-
className: cn(
|
|
1387
|
-
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
|
1388
|
-
className
|
|
1389
|
-
),
|
|
1390
|
-
...props
|
|
1391
|
-
}
|
|
1392
|
-
);
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
// src/components/data/data-table/data-table-action-bar.tsx
|
|
1396
|
-
var import_lucide_react6 = require("lucide-react");
|
|
1397
|
-
var import_framer_motion = require("framer-motion");
|
|
1398
|
-
var React = __toESM(require("react"), 1);
|
|
1399
|
-
var ReactDOM = __toESM(require("react-dom"), 1);
|
|
1400
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1401
|
-
function DataTableActionBar({
|
|
1402
|
-
table,
|
|
1403
|
-
visible: visibleProp,
|
|
1404
|
-
container: containerProp,
|
|
1405
|
-
children,
|
|
1406
|
-
className,
|
|
1407
|
-
...props
|
|
1408
|
-
}) {
|
|
1409
|
-
const [mounted, setMounted] = React.useState(false);
|
|
1410
|
-
React.useLayoutEffect(() => {
|
|
1411
|
-
setMounted(true);
|
|
1412
|
-
}, []);
|
|
1413
|
-
React.useEffect(() => {
|
|
1414
|
-
function onKeyDown(event) {
|
|
1415
|
-
if (event.key === "Escape" && table) {
|
|
1416
|
-
table.toggleAllRowsSelected(false);
|
|
1417
|
-
}
|
|
1418
|
-
}
|
|
1419
|
-
window.addEventListener("keydown", onKeyDown);
|
|
1420
|
-
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1421
|
-
}, [table]);
|
|
1422
|
-
const container = containerProp ?? (mounted ? globalThis.document?.body : null);
|
|
1423
|
-
if (!container || !table) return null;
|
|
1424
|
-
const visible = visibleProp ?? table.getFilteredSelectedRowModel().rows.length > 0;
|
|
1425
|
-
return ReactDOM.createPortal(
|
|
1426
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_framer_motion.AnimatePresence, { children: visible && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1427
|
-
import_framer_motion.motion.div,
|
|
1428
|
-
{
|
|
1429
|
-
role: "toolbar",
|
|
1430
|
-
"aria-orientation": "horizontal",
|
|
1431
|
-
initial: { opacity: 0, y: 20 },
|
|
1432
|
-
animate: { opacity: 1, y: 0 },
|
|
1433
|
-
exit: { opacity: 0, y: 20 },
|
|
1434
|
-
transition: { duration: 0.3, ease: "easeInOut" },
|
|
1435
|
-
className: cn(
|
|
1436
|
-
"fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",
|
|
1437
|
-
className
|
|
1438
|
-
),
|
|
1439
|
-
...props,
|
|
1440
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(TooltipProvider, { children: [
|
|
1441
|
-
"1",
|
|
1442
|
-
children
|
|
1443
|
-
] })
|
|
1444
|
-
}
|
|
1445
|
-
) }),
|
|
1446
|
-
container
|
|
1447
|
-
);
|
|
1448
|
-
}
|
|
1449
|
-
function DataTableActionBarAction({
|
|
1450
|
-
size = "sm",
|
|
1451
|
-
tooltip,
|
|
1452
|
-
isPending,
|
|
1453
|
-
disabled,
|
|
1454
|
-
className,
|
|
1455
|
-
children,
|
|
1456
|
-
...props
|
|
1457
|
-
}) {
|
|
1458
|
-
const trigger = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1459
|
-
Button,
|
|
1460
|
-
{
|
|
1461
|
-
variant: "secondary",
|
|
1462
|
-
size,
|
|
1463
|
-
className: cn(
|
|
1464
|
-
"gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",
|
|
1465
|
-
size === "icon" ? "size-8" : "h-8 px-3",
|
|
1466
|
-
className
|
|
1467
|
-
),
|
|
1468
|
-
disabled: disabled || isPending,
|
|
1469
|
-
...props,
|
|
1470
|
-
children: isPending ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react6.Loader, { className: "animate-spin" }) : children
|
|
1471
|
-
}
|
|
1472
|
-
);
|
|
1473
|
-
if (!tooltip) return trigger;
|
|
1474
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Tooltip, { children: [
|
|
1475
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipTrigger, { asChild: true, children: trigger }),
|
|
1476
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1477
|
-
TooltipContent,
|
|
1478
|
-
{
|
|
1479
|
-
sideOffset: 8,
|
|
1480
|
-
className: "rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",
|
|
1481
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: tooltip })
|
|
1482
|
-
}
|
|
1483
|
-
)
|
|
1484
|
-
] });
|
|
1485
|
-
}
|
|
1486
|
-
function DataTableActionBarSelection({ table }) {
|
|
1487
|
-
const onClearSelection = React.useCallback(() => {
|
|
1488
|
-
if (table) {
|
|
1489
|
-
table.toggleAllRowsSelected(false);
|
|
1490
|
-
}
|
|
1491
|
-
}, [table]);
|
|
1492
|
-
if (!table) return null;
|
|
1493
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3", children: [
|
|
1494
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "whitespace-nowrap text-sm font-medium", children: [
|
|
1495
|
-
table.getFilteredSelectedRowModel().rows.length,
|
|
1496
|
-
" selected"
|
|
1497
|
-
] }),
|
|
1498
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Separator, { orientation: "vertical", className: "mr-2 ml-3 data-[orientation=vertical]:h-4" }),
|
|
1499
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Tooltip, { children: [
|
|
1500
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Button, { variant: "ghost", size: "icon", className: "size-6 rounded-md", onClick: onClearSelection, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react6.X, { className: "size-3.5" }) }) }),
|
|
1501
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1502
|
-
TooltipContent,
|
|
1503
|
-
{
|
|
1504
|
-
sideOffset: 10,
|
|
1505
|
-
className: "flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",
|
|
1506
|
-
children: [
|
|
1507
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: "Clear selection" }),
|
|
1508
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("kbd", { className: "select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("abbr", { title: "Escape", className: "no-underline", children: "Esc" }) })
|
|
1509
|
-
]
|
|
1510
|
-
}
|
|
1511
|
-
)
|
|
1512
|
-
] })
|
|
1513
|
-
] });
|
|
1514
|
-
}
|
|
1515
|
-
|
|
1516
|
-
// src/components/data/data-table/data-table-column-header.tsx
|
|
1517
|
-
var import_lucide_react7 = require("lucide-react");
|
|
1518
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1519
|
-
|
|
1520
|
-
// src/components/data/data-table/data-table-view-options.tsx
|
|
1521
|
-
var import_lucide_react8 = require("lucide-react");
|
|
1522
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1523
|
-
|
|
1524
|
-
// src/components/ui/badge.tsx
|
|
1525
|
-
var import_radix_ui8 = require("radix-ui");
|
|
1526
|
-
var import_class_variance_authority3 = require("class-variance-authority");
|
|
1527
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1528
|
-
var badgeVariants = (0, import_class_variance_authority3.cva)(
|
|
1529
|
-
"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
1530
|
-
{
|
|
1531
|
-
variants: {
|
|
1532
|
-
variant: {
|
|
1533
|
-
default: "border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
|
|
1534
|
-
secondary: "border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
|
|
1535
|
-
destructive: "border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
|
|
1536
|
-
outline: "text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"
|
|
1537
|
-
}
|
|
1538
|
-
},
|
|
1539
|
-
defaultVariants: {
|
|
1540
|
-
variant: "default"
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
);
|
|
1544
|
-
|
|
1545
|
-
// src/components/ui/command.tsx
|
|
1546
|
-
var import_cmdk = require("cmdk");
|
|
1547
|
-
var import_lucide_react10 = require("lucide-react");
|
|
1548
|
-
|
|
1549
|
-
// src/components/ui/dialog.tsx
|
|
1550
|
-
var import_radix_ui9 = require("radix-ui");
|
|
1551
|
-
var import_lucide_react9 = require("lucide-react");
|
|
1552
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1553
|
-
|
|
1554
|
-
// src/components/ui/command.tsx
|
|
1555
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1556
|
-
|
|
1557
|
-
// src/components/ui/popover.tsx
|
|
1558
|
-
var import_radix_ui10 = require("radix-ui");
|
|
1559
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1560
|
-
|
|
1561
|
-
// src/components/data/data-table/data-table-faceted-filter.tsx
|
|
1562
|
-
var import_lucide_react11 = require("lucide-react");
|
|
1563
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1564
|
-
|
|
1565
|
-
// src/components/data/data-template/data-template.tsx
|
|
1566
|
-
var import_react2 = require("react");
|
|
1567
|
-
var import_lucide_react14 = require("lucide-react");
|
|
1568
|
-
|
|
1569
|
-
// src/components/data/data-template/data-template-toolbar.tsx
|
|
1570
|
-
var import_lucide_react12 = require("lucide-react");
|
|
1571
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1572
|
-
function DataTemplateToolbar({
|
|
1573
|
-
fields,
|
|
1574
|
-
filters,
|
|
1575
|
-
globalFilter,
|
|
1576
|
-
onGlobalFilterChange,
|
|
1577
|
-
fieldFilters,
|
|
1578
|
-
onFieldFilterChange,
|
|
1579
|
-
sortField,
|
|
1580
|
-
sortDirection,
|
|
1581
|
-
onSortChange,
|
|
1582
|
-
selectedCount,
|
|
1583
|
-
totalCount,
|
|
1584
|
-
visibleCount,
|
|
1585
|
-
onExport,
|
|
1586
|
-
onRefresh,
|
|
1587
|
-
loading,
|
|
1588
|
-
onClearFilters,
|
|
1589
|
-
onClearSorting
|
|
1590
|
-
}) {
|
|
1591
|
-
const sortableFields = fields.filter((field) => field.sortable);
|
|
1592
|
-
const hasActiveFilters = Object.values(fieldFilters).some((value) => value !== void 0 && value !== null && value !== "") || globalFilter !== "";
|
|
1593
|
-
const hasActiveSorting = sortField !== "";
|
|
1594
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "rounded-xl p-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "px-2", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex flex-col gap-6", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
1595
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center gap-3", children: filters.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-3 flex-wrap", children: [
|
|
1596
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center gap-2 text-sm font-medium text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.Filter, { className: "h-4 w-4" }) }),
|
|
1597
|
-
filters.map((filter) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "relative min-w-[150px]", children: filter.type === "select" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
1598
|
-
Select,
|
|
1599
|
-
{
|
|
1600
|
-
value: fieldFilters[filter.key] || "all",
|
|
1601
|
-
onValueChange: (value) => onFieldFilterChange(filter.key, value),
|
|
1602
|
-
children: [
|
|
1603
|
-
filter.icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(filter.icon, { className: "size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" }),
|
|
1604
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectTrigger, { className: cn("h-9 rounded-lg w-full", filter.icon && "pl-9"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectValue, { placeholder: filter.placeholder || "Select..." }) }),
|
|
1605
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(SelectContent, { className: "rounded-lg", children: [
|
|
1606
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectItem, { value: "all", children: "All" }),
|
|
1607
|
-
filter.options?.map((option) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SelectItem, { value: option.value, children: option.label }, option.value))
|
|
1608
|
-
] })
|
|
1609
|
-
]
|
|
1610
|
-
}
|
|
1611
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
|
|
1612
|
-
filter.icon && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(filter.icon, { className: "size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground" }),
|
|
1613
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1614
|
-
Input,
|
|
1615
|
-
{
|
|
1616
|
-
type: filter.type,
|
|
1617
|
-
placeholder: filter.placeholder,
|
|
1618
|
-
value: fieldFilters[filter.key] || "",
|
|
1619
|
-
onChange: (e) => onFieldFilterChange(filter.key, e.target.value),
|
|
1620
|
-
className: cn("h-9 rounded-lg", filter.icon && "pl-9")
|
|
1621
|
-
}
|
|
1622
|
-
)
|
|
1623
|
-
] }) }, String(filter.key)))
|
|
1624
|
-
] }) }),
|
|
1625
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1626
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
|
|
1627
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
1628
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1629
|
-
Input,
|
|
1630
|
-
{
|
|
1631
|
-
placeholder: "Global search...",
|
|
1632
|
-
value: globalFilter,
|
|
1633
|
-
onChange: (e) => onGlobalFilterChange(e.target.value),
|
|
1634
|
-
className: "pl-9 h-9 rounded-lg max-w-max"
|
|
1635
|
-
}
|
|
1636
|
-
)
|
|
1637
|
-
] }),
|
|
1638
|
-
sortableFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { children: [
|
|
1639
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Button, { variant: "outline", size: "sm", className: "rounded-lg gap-1", children: [
|
|
1640
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: "Sort" }),
|
|
1641
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.ChevronDown, { className: "h-4 w-4 opacity-50" })
|
|
1642
|
-
] }) }),
|
|
1643
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuContent, { align: "end", className: "w-[200px] rounded-lg", children: [
|
|
1644
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuLabel, { children: "Sort By" }),
|
|
1645
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuSeparator, {}),
|
|
1646
|
-
sortableFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
|
|
1647
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuItem, { onClick: () => onSortChange(field.key, "asc"), children: [
|
|
1648
|
-
field.label,
|
|
1649
|
-
" (A-Z)"
|
|
1650
|
-
] }),
|
|
1651
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuItem, { onClick: () => onSortChange(field.key, "desc"), children: [
|
|
1652
|
-
field.label,
|
|
1653
|
-
" (Z-A)"
|
|
1654
|
-
] })
|
|
1655
|
-
] }, String(field.key))),
|
|
1656
|
-
hasActiveSorting && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
1657
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuSeparator, {}),
|
|
1658
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuItem, { onClick: onClearSorting, children: "Clear All Sorting" })
|
|
1659
|
-
] })
|
|
1660
|
-
] })
|
|
1661
|
-
] }),
|
|
1662
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { children: [
|
|
1663
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Button, { variant: "outline", size: "sm", className: "rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.Settings2, { className: "h-4 w-4" }) }) }),
|
|
1664
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenuContent, { align: "end", className: "w-[200px] rounded-lg", children: [
|
|
1665
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuLabel, { children: "Table Settings" }),
|
|
1666
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuSeparator, {}),
|
|
1667
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuItem, { onClick: onClearSorting, children: "Clear All Sorting" }),
|
|
1668
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuItem, { onClick: onClearFilters, children: "Clear All Filters" })
|
|
1669
|
-
] })
|
|
1670
|
-
] }),
|
|
1671
|
-
onExport && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Button, { variant: "outline", size: "sm", onClick: onExport, className: "rounded-lg", children: [
|
|
1672
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.Download, { className: "mr-2 h-4 w-4" }),
|
|
1673
|
-
"Export"
|
|
1674
|
-
] }),
|
|
1675
|
-
onRefresh && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
1676
|
-
Button,
|
|
1677
|
-
{
|
|
1678
|
-
variant: "outline",
|
|
1679
|
-
size: "sm",
|
|
1680
|
-
onClick: onRefresh,
|
|
1681
|
-
disabled: loading,
|
|
1682
|
-
className: "rounded-lg",
|
|
1683
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react12.RefreshCw, { className: cn("h-4 w-4", loading && "animate-spin") })
|
|
1684
|
-
}
|
|
1685
|
-
)
|
|
1686
|
-
] })
|
|
1687
|
-
] }) }) }) });
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
// src/components/data/data-template/data-template-pagination.tsx
|
|
1691
|
-
var import_lucide_react13 = require("lucide-react");
|
|
1692
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1693
|
-
function DataTemplatePagination({
|
|
1694
|
-
currentPage,
|
|
1695
|
-
totalPages,
|
|
1696
|
-
pageSize,
|
|
1697
|
-
totalItems,
|
|
1698
|
-
onPageChange,
|
|
1699
|
-
onPageSizeChange,
|
|
1700
|
-
config
|
|
1701
|
-
}) {
|
|
1702
|
-
if (!config.enabled) {
|
|
1703
|
-
return null;
|
|
1704
|
-
}
|
|
1705
|
-
const pageSizeOptions = config.pageSizeOptions || [10, 20, 50, 100];
|
|
1706
|
-
const startItem = (currentPage - 1) * pageSize + 1;
|
|
1707
|
-
const endItem = Math.min(currentPage * pageSize, totalItems);
|
|
1708
|
-
const canPreviousPage = currentPage > 1;
|
|
1709
|
-
const canNextPage = currentPage < totalPages;
|
|
1710
|
-
const getPageNumbers = () => {
|
|
1711
|
-
const delta = 2;
|
|
1712
|
-
const range = [];
|
|
1713
|
-
const rangeWithDots = [];
|
|
1714
|
-
for (let i = Math.max(2, currentPage - delta); i <= Math.min(totalPages - 1, currentPage + delta); i++) {
|
|
1715
|
-
range.push(i);
|
|
1716
|
-
}
|
|
1717
|
-
if (currentPage - delta > 2) {
|
|
1718
|
-
rangeWithDots.push(1, "...");
|
|
1719
|
-
} else {
|
|
1720
|
-
rangeWithDots.push(1);
|
|
1721
|
-
}
|
|
1722
|
-
rangeWithDots.push(...range);
|
|
1723
|
-
if (currentPage + delta < totalPages - 1) {
|
|
1724
|
-
rangeWithDots.push("...", totalPages);
|
|
1725
|
-
} else if (totalPages > 1) {
|
|
1726
|
-
rangeWithDots.push(totalPages);
|
|
1727
|
-
}
|
|
1728
|
-
return rangeWithDots;
|
|
1729
|
-
};
|
|
1730
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "rounded-xl", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col sm:flex-row items-center justify-between gap-4", children: [
|
|
1731
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center gap-6 text-sm text-muted-foreground", children: config.showInfo !== false && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { children: [
|
|
1732
|
-
"Showing ",
|
|
1733
|
-
startItem,
|
|
1734
|
-
" to ",
|
|
1735
|
-
endItem,
|
|
1736
|
-
" of ",
|
|
1737
|
-
totalItems,
|
|
1738
|
-
" entries"
|
|
1739
|
-
] }) }),
|
|
1740
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col sm:flex-row items-center gap-4", children: [
|
|
1741
|
-
pageSizeOptions && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1742
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-sm font-medium whitespace-nowrap", children: "Page size:" }),
|
|
1743
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Select, { value: `${pageSize}`, onValueChange: (value) => onPageSizeChange(Number(value)), children: [
|
|
1744
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SelectTrigger, { className: "h-9 w-[70px] rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SelectValue, {}) }),
|
|
1745
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SelectContent, { side: "top", className: "rounded-lg", children: pageSizeOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(SelectItem, { value: `${size}`, children: size }, size)) })
|
|
1746
|
-
] })
|
|
1747
|
-
] }),
|
|
1748
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
1749
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1750
|
-
Button,
|
|
1751
|
-
{
|
|
1752
|
-
variant: "outline",
|
|
1753
|
-
size: "sm",
|
|
1754
|
-
onClick: () => onPageChange(1),
|
|
1755
|
-
disabled: !canPreviousPage,
|
|
1756
|
-
className: "hidden sm:flex rounded-lg",
|
|
1757
|
-
children: [
|
|
1758
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react13.ChevronsLeft, { className: "h-4 w-4" }),
|
|
1759
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sr-only", children: "Go to first page" })
|
|
1760
|
-
]
|
|
1761
|
-
}
|
|
1762
|
-
),
|
|
1763
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1764
|
-
Button,
|
|
1765
|
-
{
|
|
1766
|
-
variant: "outline",
|
|
1767
|
-
size: "sm",
|
|
1768
|
-
onClick: () => onPageChange(currentPage - 1),
|
|
1769
|
-
disabled: !canPreviousPage,
|
|
1770
|
-
className: "rounded-lg",
|
|
1771
|
-
children: [
|
|
1772
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react13.ChevronLeft, { className: "h-4 w-4 sm:mr-2" }),
|
|
1773
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "hidden sm:inline", children: "Previous" }),
|
|
1774
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sr-only sm:hidden", children: "Go to previous page" })
|
|
1775
|
-
]
|
|
1776
|
-
}
|
|
1777
|
-
),
|
|
1778
|
-
config.showPageNumbers && totalPages > 1 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "hidden sm:flex items-center gap-1", children: getPageNumbers().map((pageNumber, index) => {
|
|
1779
|
-
if (pageNumber === "...") {
|
|
1780
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "px-2 py-1 text-sm text-muted-foreground", children: "..." }, `dots-${index}`);
|
|
1781
|
-
}
|
|
1782
|
-
const page = pageNumber;
|
|
1783
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1784
|
-
Button,
|
|
1785
|
-
{
|
|
1786
|
-
variant: page === currentPage ? "default" : "outline",
|
|
1787
|
-
size: "sm",
|
|
1788
|
-
className: "w-9 h-9 p-0 rounded-lg",
|
|
1789
|
-
onClick: () => onPageChange(page),
|
|
1790
|
-
children: page
|
|
1791
|
-
},
|
|
1792
|
-
page
|
|
1793
|
-
);
|
|
1794
|
-
}) }),
|
|
1795
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg", children: [
|
|
1796
|
-
currentPage,
|
|
1797
|
-
" of ",
|
|
1798
|
-
totalPages
|
|
1799
|
-
] }),
|
|
1800
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1801
|
-
Button,
|
|
1802
|
-
{
|
|
1803
|
-
variant: "outline",
|
|
1804
|
-
size: "sm",
|
|
1805
|
-
onClick: () => onPageChange(currentPage + 1),
|
|
1806
|
-
disabled: !canNextPage,
|
|
1807
|
-
className: "rounded-lg",
|
|
1808
|
-
children: [
|
|
1809
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "hidden sm:inline", children: "Next" }),
|
|
1810
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react13.ChevronRight, { className: "h-4 w-4 sm:ml-2" }),
|
|
1811
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sr-only sm:hidden", children: "Go to next page" })
|
|
1812
|
-
]
|
|
1813
|
-
}
|
|
1814
|
-
),
|
|
1815
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
1816
|
-
Button,
|
|
1817
|
-
{
|
|
1818
|
-
variant: "outline",
|
|
1819
|
-
size: "sm",
|
|
1820
|
-
onClick: () => onPageChange(totalPages),
|
|
1821
|
-
disabled: !canNextPage,
|
|
1822
|
-
className: "hidden sm:flex rounded-lg",
|
|
1823
|
-
children: [
|
|
1824
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react13.ChevronsRight, { className: "h-4 w-4" }),
|
|
1825
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "sr-only", children: "Go to last page" })
|
|
1826
|
-
]
|
|
1827
|
-
}
|
|
1828
|
-
)
|
|
1829
|
-
] })
|
|
1830
|
-
] })
|
|
1831
|
-
] }) });
|
|
1832
|
-
}
|
|
1833
|
-
|
|
1834
|
-
// src/components/data/data-template/data-template.tsx
|
|
1835
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1836
|
-
function DataTemplate({
|
|
1837
|
-
data,
|
|
1838
|
-
template,
|
|
1839
|
-
fields = [],
|
|
1840
|
-
filters = [],
|
|
1841
|
-
pagination = { enabled: false },
|
|
1842
|
-
settings = {},
|
|
1843
|
-
header,
|
|
1844
|
-
footer,
|
|
1845
|
-
className = "",
|
|
1846
|
-
loading = false,
|
|
1847
|
-
error,
|
|
1848
|
-
emptyMessage = "No items found",
|
|
1849
|
-
emptyIcon,
|
|
1850
|
-
onSelectionChange,
|
|
1851
|
-
onExport,
|
|
1852
|
-
onRefresh,
|
|
1853
|
-
onTemplateReady,
|
|
1854
|
-
children
|
|
1855
|
-
}) {
|
|
1856
|
-
const {
|
|
1857
|
-
enableSorting = true,
|
|
1858
|
-
enableFiltering = true,
|
|
1859
|
-
enableGlobalSearch = true,
|
|
1860
|
-
enableSelection = false,
|
|
1861
|
-
enableExport = false,
|
|
1862
|
-
toolbar = true,
|
|
1863
|
-
selectionMode = "multiple",
|
|
1864
|
-
gridCols = { default: 3, sm: 1, md: 2, lg: 3, xl: 4, "2xl": 6 },
|
|
1865
|
-
gap = 4,
|
|
1866
|
-
aspectRatio = "auto",
|
|
1867
|
-
minCardWidth = 350,
|
|
1868
|
-
maxCardWidth = 350
|
|
1869
|
-
} = settings;
|
|
1870
|
-
const [globalFilter, setGlobalFilter] = (0, import_react2.useState)("");
|
|
1871
|
-
const [fieldFilters, setFieldFilters] = (0, import_react2.useState)({});
|
|
1872
|
-
const [sortField, setSortField] = (0, import_react2.useState)("");
|
|
1873
|
-
const [sortDirection, setSortDirection] = (0, import_react2.useState)("asc");
|
|
1874
|
-
const [selectedItems, setSelectedItems] = (0, import_react2.useState)(/* @__PURE__ */ new Set());
|
|
1875
|
-
const [currentPage, setCurrentPage] = (0, import_react2.useState)(1);
|
|
1876
|
-
const [pageSize, setPageSize] = (0, import_react2.useState)(pagination.pageSize || 12);
|
|
1877
|
-
const [currentGridCols, setCurrentGridCols] = (0, import_react2.useState)(gridCols.default);
|
|
1878
|
-
const filteredAndSortedData = (0, import_react2.useMemo)(() => {
|
|
1879
|
-
let result = [...data];
|
|
1880
|
-
if (enableGlobalSearch && globalFilter) {
|
|
1881
|
-
const searchableFields = fields.filter((field) => field.searchable !== false);
|
|
1882
|
-
result = result.filter(
|
|
1883
|
-
(item) => searchableFields.some((field) => {
|
|
1884
|
-
const value = item[field.key];
|
|
1885
|
-
return value?.toString().toLowerCase().includes(globalFilter.toLowerCase());
|
|
1886
|
-
})
|
|
1887
|
-
);
|
|
1888
|
-
}
|
|
1889
|
-
if (enableFiltering) {
|
|
1890
|
-
Object.keys(fieldFilters).forEach((key) => {
|
|
1891
|
-
const value = fieldFilters[key];
|
|
1892
|
-
if (value !== void 0 && value !== null && value !== "") {
|
|
1893
|
-
const field = fields.find((f) => f.key === key);
|
|
1894
|
-
if (field) {
|
|
1895
|
-
result = result.filter((item) => {
|
|
1896
|
-
const itemValue = item[key];
|
|
1897
|
-
if (field.type === "boolean") {
|
|
1898
|
-
return itemValue === (value === "true");
|
|
1899
|
-
} else if (field.type === "number") {
|
|
1900
|
-
return itemValue === Number(value);
|
|
1901
|
-
} else {
|
|
1902
|
-
return itemValue?.toString().toLowerCase().includes(String(value).toLowerCase());
|
|
1903
|
-
}
|
|
1904
|
-
});
|
|
1905
|
-
}
|
|
1906
|
-
}
|
|
1907
|
-
});
|
|
1908
|
-
}
|
|
1909
|
-
if (enableSorting && sortField) {
|
|
1910
|
-
const field = fields.find((f) => f.key === sortField);
|
|
1911
|
-
if (field) {
|
|
1912
|
-
result.sort((a, b) => {
|
|
1913
|
-
const aValue = a[sortField];
|
|
1914
|
-
const bValue = b[sortField];
|
|
1915
|
-
if (field.type === "number") {
|
|
1916
|
-
return sortDirection === "asc" ? Number(aValue) - Number(bValue) : Number(bValue) - Number(aValue);
|
|
1917
|
-
} else if (field.type === "date") {
|
|
1918
|
-
const aDate = new Date(aValue);
|
|
1919
|
-
const bDate = new Date(bValue);
|
|
1920
|
-
return sortDirection === "asc" ? aDate.getTime() - bDate.getTime() : bDate.getTime() - aDate.getTime();
|
|
1921
|
-
} else {
|
|
1922
|
-
const aStr = String(aValue).toLowerCase();
|
|
1923
|
-
const bStr = String(bValue).toLowerCase();
|
|
1924
|
-
return sortDirection === "asc" ? aStr.localeCompare(bStr) : bStr.localeCompare(aStr);
|
|
1925
|
-
}
|
|
1926
|
-
});
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
return result;
|
|
1930
|
-
}, [
|
|
1931
|
-
data,
|
|
1932
|
-
globalFilter,
|
|
1933
|
-
fieldFilters,
|
|
1934
|
-
sortField,
|
|
1935
|
-
sortDirection,
|
|
1936
|
-
fields,
|
|
1937
|
-
enableGlobalSearch,
|
|
1938
|
-
enableFiltering,
|
|
1939
|
-
enableSorting
|
|
1940
|
-
]);
|
|
1941
|
-
const paginatedData = (0, import_react2.useMemo)(() => {
|
|
1942
|
-
if (!pagination.enabled) return filteredAndSortedData;
|
|
1943
|
-
const startIndex = (currentPage - 1) * pageSize;
|
|
1944
|
-
const endIndex = startIndex + pageSize;
|
|
1945
|
-
return filteredAndSortedData.slice(startIndex, endIndex);
|
|
1946
|
-
}, [filteredAndSortedData, currentPage, pageSize, pagination.enabled]);
|
|
1947
|
-
const totalPages = Math.ceil(filteredAndSortedData.length / pageSize);
|
|
1948
|
-
const handleToggleSelect = (0, import_react2.useCallback)(
|
|
1949
|
-
(index) => {
|
|
1950
|
-
if (!enableSelection) return;
|
|
1951
|
-
setSelectedItems((prev) => {
|
|
1952
|
-
const newSelection = new Set(prev);
|
|
1953
|
-
if (selectionMode === "single") {
|
|
1954
|
-
newSelection.clear();
|
|
1955
|
-
newSelection.add(index);
|
|
1956
|
-
} else {
|
|
1957
|
-
if (newSelection.has(index)) {
|
|
1958
|
-
newSelection.delete(index);
|
|
1959
|
-
} else {
|
|
1960
|
-
newSelection.add(index);
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
return newSelection;
|
|
1964
|
-
});
|
|
1965
|
-
},
|
|
1966
|
-
[enableSelection, selectionMode]
|
|
1967
|
-
);
|
|
1968
|
-
const handleSelectAll = (0, import_react2.useCallback)(() => {
|
|
1969
|
-
if (!enableSelection || selectionMode === "single") return;
|
|
1970
|
-
if (selectedItems.size === filteredAndSortedData.length) {
|
|
1971
|
-
setSelectedItems(/* @__PURE__ */ new Set());
|
|
1972
|
-
} else {
|
|
1973
|
-
setSelectedItems(new Set(filteredAndSortedData.map((_, index) => index)));
|
|
1974
|
-
}
|
|
1975
|
-
}, [enableSelection, selectionMode, selectedItems.size, filteredAndSortedData.length]);
|
|
1976
|
-
const handleFieldFilterChange = (0, import_react2.useCallback)((key, value) => {
|
|
1977
|
-
setFieldFilters((prev) => ({ ...prev, [key]: value }));
|
|
1978
|
-
setCurrentPage(1);
|
|
1979
|
-
}, []);
|
|
1980
|
-
const handleSortChange = (0, import_react2.useCallback)((field, direction) => {
|
|
1981
|
-
setSortField(field);
|
|
1982
|
-
setSortDirection(direction);
|
|
1983
|
-
}, []);
|
|
1984
|
-
const handleClearFilters = (0, import_react2.useCallback)(() => {
|
|
1985
|
-
setGlobalFilter("");
|
|
1986
|
-
setFieldFilters({});
|
|
1987
|
-
setCurrentPage(1);
|
|
1988
|
-
}, []);
|
|
1989
|
-
const handleClearSorting = (0, import_react2.useCallback)(() => {
|
|
1990
|
-
setSortField("");
|
|
1991
|
-
setSortDirection("asc");
|
|
1992
|
-
}, []);
|
|
1993
|
-
const controller = (0, import_react2.useMemo)(
|
|
1994
|
-
() => ({
|
|
1995
|
-
getSelectedItems: () => Array.from(selectedItems).map((index) => filteredAndSortedData[index]),
|
|
1996
|
-
clearSelection: () => setSelectedItems(/* @__PURE__ */ new Set()),
|
|
1997
|
-
selectAll: handleSelectAll,
|
|
1998
|
-
getFilteredData: () => filteredAndSortedData,
|
|
1999
|
-
getTotalCount: () => data.length,
|
|
2000
|
-
getVisibleCount: () => filteredAndSortedData.length,
|
|
2001
|
-
refresh: () => onRefresh?.(),
|
|
2002
|
-
exportData: () => onExport?.(filteredAndSortedData)
|
|
2003
|
-
}),
|
|
2004
|
-
[selectedItems, filteredAndSortedData, data.length, handleSelectAll, onRefresh, onExport]
|
|
2005
|
-
);
|
|
2006
|
-
const controllerRef = (0, import_react2.useRef)(null);
|
|
2007
|
-
controllerRef.current = controller;
|
|
2008
|
-
(0, import_react2.useEffect)(() => {
|
|
2009
|
-
if (onTemplateReady && controllerRef.current) {
|
|
2010
|
-
onTemplateReady(controllerRef.current);
|
|
2011
|
-
}
|
|
2012
|
-
}, []);
|
|
2013
|
-
(0, import_react2.useEffect)(() => {
|
|
2014
|
-
if (enableSelection && onSelectionChange) {
|
|
2015
|
-
const selected = Array.from(selectedItems).map((index) => filteredAndSortedData[index]);
|
|
2016
|
-
onSelectionChange(selected);
|
|
2017
|
-
}
|
|
2018
|
-
}, [selectedItems]);
|
|
2019
|
-
const gridContainerClasses = cn(
|
|
2020
|
-
"w-full",
|
|
2021
|
-
"overflow-hidden",
|
|
2022
|
-
// Prevent any potential overflow issues
|
|
2023
|
-
className
|
|
2024
|
-
);
|
|
2025
|
-
const gridClasses = cn(
|
|
2026
|
-
"grid",
|
|
2027
|
-
`gap-${gap}`,
|
|
2028
|
-
"w-full",
|
|
2029
|
-
// Ensure grid takes full width
|
|
2030
|
-
"mx-auto",
|
|
2031
|
-
// Center the grid if it doesn't take full width
|
|
2032
|
-
"items-start"
|
|
2033
|
-
// Align items to the top
|
|
2034
|
-
);
|
|
2035
|
-
const gridStyle = {
|
|
2036
|
-
// Primary grid definition - choose one of these options:
|
|
2037
|
-
gridTemplateColumns: currentGridCols === 0 ? `repeat(auto-fill, minmax(clamp(${minCardWidth}px, 30%, ${maxCardWidth}px), 1fr))` : `repeat(auto-fill, minmax(clamp(${minCardWidth}px, calc(100%/${currentGridCols} - ${gap * 4}px), ${maxCardWidth}px), 1fr))`,
|
|
2038
|
-
// gridTemplateColumns: `repeat(auto-fill, minmax(clamp(${minCardWidth}px, calc(100%/${Math.min(
|
|
2039
|
-
// currentGridCols,
|
|
2040
|
-
// gridCols["2xl"] || 6
|
|
2041
|
-
// )} - ${gap * 4}px), ${maxCardWidth}px))`,
|
|
2042
|
-
// Option 1: Fully fluid grid (recommended)
|
|
2043
|
-
// gridTemplateColumns: `repeat(auto-fill, minmax(clamp(${minCardWidth}px, 30%, ${maxCardWidth}px), 1fr))`,
|
|
2044
|
-
// Option 2: More controlled fluid grid
|
|
2045
|
-
// gridTemplateColumns: `repeat(auto-fit, minmax(clamp(${minCardWidth}px, 25vw, ${maxCardWidth}px), 1fr))`,
|
|
2046
|
-
// Option 3: Fixed maximum columns with fluid width
|
|
2047
|
-
// gridTemplateColumns: `repeat(min(6, auto-fill), minmax(${minCardWidth}px, ${maxCardWidth}px))`,
|
|
2048
|
-
// Additional grid enhancements
|
|
2049
|
-
justifyItems: "center",
|
|
2050
|
-
// Center items horizontally in their grid cells
|
|
2051
|
-
alignItems: "stretch",
|
|
2052
|
-
// Stretch items vertically to fill the grid cell
|
|
2053
|
-
gridAutoRows: "1fr",
|
|
2054
|
-
// Make all rows the same height
|
|
2055
|
-
gridAutoFlow: "dense"
|
|
2056
|
-
// Try to fill holes in the grid
|
|
2057
|
-
};
|
|
2058
|
-
if (error) {
|
|
2059
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Card, { className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CardContent, { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "text-center", children: [
|
|
2060
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-red-500 mb-3 text-2xl", children: "\u26A0\uFE0F" }),
|
|
2061
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm text-muted-foreground mb-4", children: error }),
|
|
2062
|
-
onRefresh && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Button, { variant: "outline", size: "sm", onClick: onRefresh, children: [
|
|
2063
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.Loader2, { className: "mr-2 h-4 w-4" }),
|
|
2064
|
-
"Try Again"
|
|
2065
|
-
] })
|
|
2066
|
-
] }) }) });
|
|
2067
|
-
}
|
|
2068
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("w-full flex gap-2 flex-col h-full", gridContainerClasses), children: [
|
|
2069
|
-
header && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Card, { className: "shadow-sm border-0 py-0 text-xl font-bold", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CardContent, { className: "p-2", children: header }) }),
|
|
2070
|
-
toolbar && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2071
|
-
DataTemplateToolbar,
|
|
2072
|
-
{
|
|
2073
|
-
fields,
|
|
2074
|
-
filters,
|
|
2075
|
-
globalFilter,
|
|
2076
|
-
onGlobalFilterChange: setGlobalFilter,
|
|
2077
|
-
fieldFilters,
|
|
2078
|
-
onFieldFilterChange: handleFieldFilterChange,
|
|
2079
|
-
sortField,
|
|
2080
|
-
sortDirection,
|
|
2081
|
-
onSortChange: handleSortChange,
|
|
2082
|
-
selectedCount: selectedItems.size,
|
|
2083
|
-
totalCount: data.length,
|
|
2084
|
-
visibleCount: filteredAndSortedData.length,
|
|
2085
|
-
onExport: enableExport ? () => onExport?.(filteredAndSortedData) : void 0,
|
|
2086
|
-
onRefresh,
|
|
2087
|
-
loading,
|
|
2088
|
-
onClearFilters: handleClearFilters,
|
|
2089
|
-
onClearSorting: handleClearSorting
|
|
2090
|
-
}
|
|
2091
|
-
),
|
|
2092
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Card, { className: "border-0 overflow-auto shadow-none py-0 p-2 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CardContent, { className: "px-0", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative", children: [
|
|
2093
|
-
loading && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm", children: [
|
|
2094
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react14.Loader2, { className: "size-5 animate-spin text-primary" }),
|
|
2095
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-sm font-medium text-muted-foreground", children: "Loading..." })
|
|
2096
|
-
] }) }),
|
|
2097
|
-
paginatedData.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2098
|
-
"div",
|
|
2099
|
-
{
|
|
2100
|
-
className: cn(gridClasses),
|
|
2101
|
-
style: gridStyle,
|
|
2102
|
-
children: paginatedData.map((item, index) => {
|
|
2103
|
-
const globalIndex = pagination.enabled ? (currentPage - 1) * pageSize + index : index;
|
|
2104
|
-
const isSelected = selectedItems.has(globalIndex);
|
|
2105
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2106
|
-
"div",
|
|
2107
|
-
{
|
|
2108
|
-
className: cn(
|
|
2109
|
-
"relative h-full w-full flex flex-col",
|
|
2110
|
-
"transition-all duration-200 overflow-hidden",
|
|
2111
|
-
"rounded-2xl",
|
|
2112
|
-
"border border-border/20 hover:border-border/50",
|
|
2113
|
-
aspectRatio === "square" ? "aspect-square" : "",
|
|
2114
|
-
aspectRatio === "video" ? "aspect-video" : "",
|
|
2115
|
-
enableSelection ? "cursor-pointer" : "",
|
|
2116
|
-
isSelected ? "ring-2 ring-primary" : ""
|
|
2117
|
-
),
|
|
2118
|
-
onClick: () => enableSelection && handleToggleSelect(globalIndex),
|
|
2119
|
-
children: [
|
|
2120
|
-
enableSelection && selectionMode === "multiple" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute top-2 right-2 z-10", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2121
|
-
Checkbox,
|
|
2122
|
-
{
|
|
2123
|
-
checked: isSelected,
|
|
2124
|
-
onCheckedChange: () => handleToggleSelect(globalIndex),
|
|
2125
|
-
className: "bg-background/80 backdrop-blur-sm",
|
|
2126
|
-
onClick: (e) => e.stopPropagation()
|
|
2127
|
-
}
|
|
2128
|
-
) }),
|
|
2129
|
-
template(item, index, isSelected, () => handleToggleSelect(globalIndex))
|
|
2130
|
-
]
|
|
2131
|
-
},
|
|
2132
|
-
globalIndex
|
|
2133
|
-
);
|
|
2134
|
-
})
|
|
2135
|
-
}
|
|
2136
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-4 items-center justify-center py-12 text-center", children: [
|
|
2137
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-6xl", children: emptyIcon || "\u{1F4CB}" }),
|
|
2138
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-lg font-medium text-muted-foreground mb-2", children: emptyMessage }),
|
|
2139
|
-
(globalFilter || Object.values(fieldFilters).some((v) => v)) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { variant: "outline", onClick: handleClearFilters, children: "Clear Filters" })
|
|
2140
|
-
] })
|
|
2141
|
-
] }) }) }),
|
|
2142
|
-
pagination.enabled && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2143
|
-
DataTemplatePagination,
|
|
2144
|
-
{
|
|
2145
|
-
currentPage,
|
|
2146
|
-
totalPages,
|
|
2147
|
-
pageSize,
|
|
2148
|
-
totalItems: filteredAndSortedData.length,
|
|
2149
|
-
onPageChange: setCurrentPage,
|
|
2150
|
-
onPageSizeChange: (size) => {
|
|
2151
|
-
setPageSize(size);
|
|
2152
|
-
setCurrentPage(1);
|
|
2153
|
-
},
|
|
2154
|
-
config: pagination
|
|
2155
|
-
}
|
|
2156
|
-
) }),
|
|
2157
|
-
footer && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "p-2 m-0.5", children: footer }),
|
|
2158
|
-
children && children(controller)
|
|
2159
|
-
] });
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
// src/components/data/data-template/data-template-action-bar.tsx
|
|
2163
|
-
var import_lucide_react15 = require("lucide-react");
|
|
2164
|
-
var import_framer_motion2 = require("framer-motion");
|
|
2165
|
-
var React2 = __toESM(require("react"), 1);
|
|
2166
|
-
var ReactDOM2 = __toESM(require("react-dom"), 1);
|
|
2167
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2168
|
-
function DataTemplateActionBar({
|
|
2169
|
-
controller,
|
|
2170
|
-
visible: visibleProp,
|
|
2171
|
-
container: containerProp,
|
|
2172
|
-
children,
|
|
2173
|
-
className,
|
|
2174
|
-
...props
|
|
2175
|
-
}) {
|
|
2176
|
-
const [mounted, setMounted] = React2.useState(false);
|
|
2177
|
-
React2.useLayoutEffect(() => {
|
|
2178
|
-
setMounted(true);
|
|
2179
|
-
}, []);
|
|
2180
|
-
React2.useEffect(() => {
|
|
2181
|
-
function onKeyDown(event) {
|
|
2182
|
-
if (event.key === "Escape" && controller) {
|
|
2183
|
-
controller.clearSelection();
|
|
2184
|
-
}
|
|
2185
|
-
}
|
|
2186
|
-
window.addEventListener("keydown", onKeyDown);
|
|
2187
|
-
return () => window.removeEventListener("keydown", onKeyDown);
|
|
2188
|
-
}, [controller]);
|
|
2189
|
-
const container = containerProp ?? (mounted ? globalThis.document?.body : null);
|
|
2190
|
-
if (!container || !controller) return null;
|
|
2191
|
-
const selectedItems = controller.getSelectedItems();
|
|
2192
|
-
const visible = visibleProp ?? selectedItems.length > 0;
|
|
2193
|
-
return ReactDOM2.createPortal(
|
|
2194
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_framer_motion2.AnimatePresence, { children: visible && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2195
|
-
import_framer_motion2.motion.div,
|
|
2196
|
-
{
|
|
2197
|
-
role: "toolbar",
|
|
2198
|
-
"aria-orientation": "horizontal",
|
|
2199
|
-
initial: { opacity: 0, y: 20 },
|
|
2200
|
-
animate: { opacity: 1, y: 0 },
|
|
2201
|
-
exit: { opacity: 0, y: 20 },
|
|
2202
|
-
transition: { duration: 0.3, ease: "easeInOut" },
|
|
2203
|
-
className: cn(
|
|
2204
|
-
"fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-8 ring-primary/5",
|
|
2205
|
-
className
|
|
2206
|
-
),
|
|
2207
|
-
...props,
|
|
2208
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipProvider, { children })
|
|
2209
|
-
}
|
|
2210
|
-
) }),
|
|
2211
|
-
container
|
|
2212
|
-
);
|
|
2213
|
-
}
|
|
2214
|
-
function DataTemplateActionBarAction({
|
|
2215
|
-
size = "sm",
|
|
2216
|
-
variant = "secondary",
|
|
2217
|
-
tooltip,
|
|
2218
|
-
isPending,
|
|
2219
|
-
disabled,
|
|
2220
|
-
className,
|
|
2221
|
-
children,
|
|
2222
|
-
onClick,
|
|
2223
|
-
...props
|
|
2224
|
-
}) {
|
|
2225
|
-
const trigger = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2226
|
-
Button,
|
|
2227
|
-
{
|
|
2228
|
-
variant,
|
|
2229
|
-
size,
|
|
2230
|
-
className: cn(
|
|
2231
|
-
"gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",
|
|
2232
|
-
size === "icon" ? "size-8" : "h-8 px-3",
|
|
2233
|
-
className
|
|
2234
|
-
),
|
|
2235
|
-
disabled: disabled || isPending,
|
|
2236
|
-
onClick,
|
|
2237
|
-
...props,
|
|
2238
|
-
children: isPending ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.Loader, { className: "animate-spin" }) : children
|
|
2239
|
-
}
|
|
2240
|
-
);
|
|
2241
|
-
if (!tooltip) return trigger;
|
|
2242
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Tooltip, { children: [
|
|
2243
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipTrigger, { asChild: true, children: trigger }),
|
|
2244
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2245
|
-
TooltipContent,
|
|
2246
|
-
{
|
|
2247
|
-
sideOffset: 8,
|
|
2248
|
-
className: "rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",
|
|
2249
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: tooltip })
|
|
2250
|
-
}
|
|
2251
|
-
)
|
|
2252
|
-
] });
|
|
2253
|
-
}
|
|
2254
|
-
function DataTemplateActionBarSelection({ controller }) {
|
|
2255
|
-
const onClearSelection = React2.useCallback(() => {
|
|
2256
|
-
if (controller) {
|
|
2257
|
-
controller.clearSelection();
|
|
2258
|
-
}
|
|
2259
|
-
}, [controller]);
|
|
2260
|
-
if (!controller) return null;
|
|
2261
|
-
const selectedItems = controller.getSelectedItems();
|
|
2262
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3", children: [
|
|
2263
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("span", { className: "whitespace-nowrap text-sm font-medium", children: [
|
|
2264
|
-
selectedItems.length,
|
|
2265
|
-
" selected"
|
|
2266
|
-
] }),
|
|
2267
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Separator, { orientation: "vertical", className: "mr-2 ml-3 data-[orientation=vertical]:h-4" }),
|
|
2268
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Tooltip, { children: [
|
|
2269
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { variant: "ghost", size: "icon", className: "size-6 rounded-md", onClick: onClearSelection, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react15.X, { className: "size-3.5" }) }) }),
|
|
2270
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2271
|
-
TooltipContent,
|
|
2272
|
-
{
|
|
2273
|
-
sideOffset: 10,
|
|
2274
|
-
className: "flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foreground bg-secondary [&>span]:hidden",
|
|
2275
|
-
children: [
|
|
2276
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: "Clear selection" }),
|
|
2277
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("kbd", { className: "select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("abbr", { title: "Escape", className: "no-underline", children: "Esc" }) })
|
|
2278
|
-
]
|
|
2279
|
-
}
|
|
2280
|
-
)
|
|
2281
|
-
] })
|
|
2282
|
-
] });
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2285
|
-
// src/components/layouts/app-container.tsx
|
|
2286
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2287
|
-
var spacingClasses = {
|
|
2288
|
-
"none": "gap-0",
|
|
2289
|
-
"tight": "gap-2",
|
|
2290
|
-
"default": "gap-4",
|
|
2291
|
-
"loose": "gap-6",
|
|
2292
|
-
"extra-loose": "gap-8"
|
|
2293
|
-
};
|
|
2294
|
-
var paddingClasses = {
|
|
2295
|
-
"none": "p-0",
|
|
2296
|
-
"tight": "p-2",
|
|
2297
|
-
"default": "p-4",
|
|
2298
|
-
"loose": "p-6"
|
|
2299
|
-
};
|
|
2300
|
-
var AppContainer = ({
|
|
2301
|
-
children,
|
|
2302
|
-
className,
|
|
2303
|
-
spacing = "tight",
|
|
2304
|
-
padding = "none"
|
|
2305
|
-
}) => {
|
|
2306
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: cn(
|
|
2307
|
-
"flex flex-col h-full",
|
|
2308
|
-
spacingClasses[spacing],
|
|
2309
|
-
paddingClasses[padding],
|
|
2310
|
-
className
|
|
2311
|
-
), children });
|
|
2312
|
-
};
|
|
2313
|
-
|
|
2314
|
-
// src/components/layouts/app-header.tsx
|
|
2315
|
-
var import_lucide_react16 = require("lucide-react");
|
|
2316
|
-
var import_react_router = require("react-router");
|
|
2317
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2318
|
-
var AppHeader = ({
|
|
2319
|
-
className,
|
|
2320
|
-
columns = [],
|
|
2321
|
-
showBackButton = true,
|
|
2322
|
-
meta = { title: "" }
|
|
2323
|
-
}) => {
|
|
2324
|
-
const renderBackAction = () => {
|
|
2325
|
-
if (!meta.backAction || !showBackButton) return null;
|
|
2326
|
-
const buttonProps = {
|
|
2327
|
-
variant: "secondary",
|
|
2328
|
-
size: "icon",
|
|
2329
|
-
className: "hover:bg-primary/20 inline-flex"
|
|
2330
|
-
};
|
|
2331
|
-
if (meta.backAction.href) {
|
|
2332
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_router.NavLink, { to: meta.backAction.href, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Button, { ...buttonProps, children: [
|
|
2333
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react16.ArrowLeftIcon, { className: "size-6" }),
|
|
2334
|
-
meta.backAction.content
|
|
2335
|
-
] }) });
|
|
2336
|
-
}
|
|
2337
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Button, { ...buttonProps, onClick: meta.backAction.onClick, children: [
|
|
2338
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react16.ArrowLeftIcon, { className: "size-6" }),
|
|
2339
|
-
meta.backAction.content
|
|
2340
|
-
] });
|
|
2341
|
-
};
|
|
2342
|
-
const renderMetadata = () => {
|
|
2343
|
-
if (!meta.metadata || meta.metadata.length === 0) return null;
|
|
2344
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex gap-4", children: meta.metadata.map((item, index) => item.value && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "text-sm", children: [
|
|
2345
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
2346
|
-
item.label,
|
|
2347
|
-
" "
|
|
2348
|
-
] }),
|
|
2349
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: item.value })
|
|
2350
|
-
] }, index)) });
|
|
2351
|
-
};
|
|
2352
|
-
const renderStatus = () => {
|
|
2353
|
-
if (!meta.status) return null;
|
|
2354
|
-
const colorClasses = {
|
|
2355
|
-
success: "bg-green-100 text-green-800",
|
|
2356
|
-
warning: "bg-yellow-100 text-yellow-800",
|
|
2357
|
-
critical: "bg-red-100 text-red-800",
|
|
2358
|
-
info: "bg-blue-100 text-blue-800",
|
|
2359
|
-
default: "bg-gray-100 text-gray-800"
|
|
2360
|
-
};
|
|
2361
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: cn(
|
|
2362
|
-
"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",
|
|
2363
|
-
colorClasses[meta.status.color]
|
|
2364
|
-
), children: meta.status.content });
|
|
2365
|
-
};
|
|
2366
|
-
const reservedColumn = {
|
|
2367
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-2 items-center", children: [
|
|
2368
|
-
renderBackAction(),
|
|
2369
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-2 w-max", children: [
|
|
2370
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h1", { className: "text-2xl font-bold tracking-tight", children: meta.title }),
|
|
2371
|
-
renderStatus(),
|
|
2372
|
-
meta.description && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground", children: meta.description }),
|
|
2373
|
-
renderMetadata(),
|
|
2374
|
-
meta.breadcrumbs && meta.breadcrumbs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex items-center text-sm text-muted-foreground", children: meta.breadcrumbs.map((crumb, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center", children: [
|
|
2375
|
-
crumb.href ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "hover:text-primary hover:underline", children: crumb.label }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: crumb.label }),
|
|
2376
|
-
index < meta.breadcrumbs.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react16.ChevronRight, { className: "mx-2 h-4 w-4" })
|
|
2377
|
-
] }, index)) })
|
|
2378
|
-
] })
|
|
2379
|
-
] }),
|
|
2380
|
-
align: "left",
|
|
2381
|
-
width: "fill"
|
|
2382
|
-
};
|
|
2383
|
-
const actionsColumn = {
|
|
2384
|
-
content: meta.primaryActions,
|
|
2385
|
-
align: "right",
|
|
2386
|
-
width: "auto"
|
|
2387
|
-
};
|
|
2388
|
-
const allColumns = [
|
|
2389
|
-
reservedColumn,
|
|
2390
|
-
...columns.filter((col) => col !== void 0),
|
|
2391
|
-
actionsColumn
|
|
2392
|
-
];
|
|
2393
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: cn("flex items-center w-full gap-4 p-2", className), children: allColumns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2394
|
-
"div",
|
|
2395
|
-
{
|
|
2396
|
-
className: cn(
|
|
2397
|
-
"flex items-center h-full",
|
|
2398
|
-
column.className,
|
|
2399
|
-
{
|
|
2400
|
-
"justify-start": column.align === "left",
|
|
2401
|
-
"justify-center": column.align === "center",
|
|
2402
|
-
"justify-end": column.align === "right",
|
|
2403
|
-
"flex-1": column.width === "fill"
|
|
2404
|
-
}
|
|
2405
|
-
),
|
|
2406
|
-
children: column.content
|
|
2407
|
-
},
|
|
2408
|
-
index
|
|
2409
|
-
)) });
|
|
2410
|
-
};
|
|
2411
|
-
|
|
2412
|
-
// src/components/layouts/app-content.tsx
|
|
2413
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
2414
|
-
|
|
2415
|
-
// src/components/ui/sheet.tsx
|
|
2416
|
-
var import_radix_ui11 = require("radix-ui");
|
|
2417
|
-
var import_lucide_react17 = require("lucide-react");
|
|
2418
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2419
|
-
function Sheet({ ...props }) {
|
|
2420
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_radix_ui11.Dialog.Root, { "data-slot": "sheet", ...props });
|
|
2421
|
-
}
|
|
2422
|
-
function SheetTrigger({
|
|
2423
|
-
...props
|
|
2424
|
-
}) {
|
|
2425
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_radix_ui11.Dialog.Trigger, { "data-slot": "sheet-trigger", ...props });
|
|
2426
|
-
}
|
|
2427
|
-
function SheetPortal({
|
|
2428
|
-
...props
|
|
2429
|
-
}) {
|
|
2430
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_radix_ui11.Dialog.Portal, { "data-slot": "sheet-portal", ...props });
|
|
2431
|
-
}
|
|
2432
|
-
function SheetOverlay({
|
|
2433
|
-
className,
|
|
2434
|
-
...props
|
|
2435
|
-
}) {
|
|
2436
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2437
|
-
import_radix_ui11.Dialog.Overlay,
|
|
2438
|
-
{
|
|
2439
|
-
"data-slot": "sheet-overlay",
|
|
2440
|
-
className: cn(
|
|
2441
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
|
2442
|
-
className
|
|
2443
|
-
),
|
|
2444
|
-
...props
|
|
2445
|
-
}
|
|
2446
|
-
);
|
|
2447
|
-
}
|
|
2448
|
-
function SheetContent({
|
|
2449
|
-
className,
|
|
2450
|
-
children,
|
|
2451
|
-
side = "right",
|
|
2452
|
-
...props
|
|
2453
|
-
}) {
|
|
2454
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(SheetPortal, { children: [
|
|
2455
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SheetOverlay, {}),
|
|
2456
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2457
|
-
import_radix_ui11.Dialog.Content,
|
|
2458
|
-
{
|
|
2459
|
-
"data-slot": "sheet-content",
|
|
2460
|
-
className: cn(
|
|
2461
|
-
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
2462
|
-
side === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
|
2463
|
-
side === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
|
|
2464
|
-
side === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
2465
|
-
side === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
|
2466
|
-
className
|
|
2467
|
-
),
|
|
2468
|
-
...props,
|
|
2469
|
-
children: [
|
|
2470
|
-
children,
|
|
2471
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_radix_ui11.Dialog.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
|
|
2472
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react17.XIcon, { className: "size-4" }),
|
|
2473
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "sr-only", children: "Close" })
|
|
2474
|
-
] })
|
|
2475
|
-
]
|
|
2476
|
-
}
|
|
2477
|
-
)
|
|
2478
|
-
] });
|
|
2479
|
-
}
|
|
2480
|
-
|
|
2481
|
-
// src/components/layouts/app-content.tsx
|
|
2482
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2483
|
-
var AppContentContext = (0, import_react3.createContext)(false);
|
|
2484
|
-
var splitRatioClasses = {
|
|
2485
|
-
"one-half": ["w-1/2", "w-1/2"],
|
|
2486
|
-
"one-third": ["w-1/3", "w-2/3"],
|
|
2487
|
-
"two-third": ["w-2/3", "w-1/3"],
|
|
2488
|
-
"one-fourth": ["w-1/4", "w-3/4"],
|
|
2489
|
-
"three-fourth": ["w-3/4", "w-1/4"],
|
|
2490
|
-
"one-fifth": ["w-1/5", "w-4/5"],
|
|
2491
|
-
"four-fifth": ["w-4/5", "w-1/5"]
|
|
2492
|
-
};
|
|
2493
|
-
var paddingClasses2 = {
|
|
2494
|
-
none: "p-0",
|
|
2495
|
-
tight: "p-2",
|
|
2496
|
-
default: "p-4",
|
|
2497
|
-
loose: "p-6"
|
|
2498
|
-
};
|
|
2499
|
-
var getContainerSheetClasses = (side, width) => {
|
|
2500
|
-
const [contentWidth, sheetWidth] = splitRatioClasses[width];
|
|
2501
|
-
return {
|
|
2502
|
-
container: "inset-y-0 z-50 transition-all duration-500 ease-in-out",
|
|
2503
|
-
content: cn(
|
|
2504
|
-
"h-full bg-background transition-all duration-500 ease-in-out",
|
|
2505
|
-
side === "right" ? "border-l" : "border-r"
|
|
2506
|
-
),
|
|
2507
|
-
transform: side === "right" ? "translate-x-full" : "-translate-x-full",
|
|
2508
|
-
transformOpen: "translate-x-0",
|
|
2509
|
-
contentPushClass: side === "right" ? contentWidth : sheetWidth,
|
|
2510
|
-
sheetPushClass: side === "right" ? sheetWidth : contentWidth
|
|
2511
|
-
};
|
|
2512
|
-
};
|
|
2513
|
-
var baseClasses = "flex flex-col overflow-hidden rounded-2xl relative";
|
|
2514
|
-
var variantClasses = {
|
|
2515
|
-
default: "bg-background",
|
|
2516
|
-
card: "bg-background shadow-sm border",
|
|
2517
|
-
border: "bg-background border-2",
|
|
2518
|
-
transparent: "bg-transparent"
|
|
2519
|
-
};
|
|
2520
|
-
var AppContent = (props) => {
|
|
2521
|
-
const {
|
|
2522
|
-
children,
|
|
2523
|
-
className,
|
|
2524
|
-
variant = "default",
|
|
2525
|
-
layout = "full",
|
|
2526
|
-
header,
|
|
2527
|
-
footer,
|
|
2528
|
-
headerClassName,
|
|
2529
|
-
footerClassName,
|
|
2530
|
-
parentContainer = false,
|
|
2531
|
-
padding = parentContainer ? "none" : "tight"
|
|
2532
|
-
} = props;
|
|
2533
|
-
const isNested = (0, import_react3.useContext)(AppContentContext);
|
|
2534
|
-
const [internalSheetOpen, setInternalSheetOpen] = (0, import_react3.useState)(false);
|
|
2535
|
-
const contentWrapper = import_react3.default.useCallback(
|
|
2536
|
-
(content) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(
|
|
2537
|
-
"flex-1 overflow-auto h-full no-scrollbar",
|
|
2538
|
-
parentContainer && "flex",
|
|
2539
|
-
!parentContainer && paddingClasses2[padding]
|
|
2540
|
-
), children: content }),
|
|
2541
|
-
[padding, parentContainer]
|
|
2542
|
-
);
|
|
2543
|
-
const renderContent = () => {
|
|
2544
|
-
switch (layout) {
|
|
2545
|
-
case "split": {
|
|
2546
|
-
const { splitRatio = "three-fourth", reverse = false } = props;
|
|
2547
|
-
if (!Array.isArray(children) || children.length !== 2) {
|
|
2548
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex items-center justify-center h-full text-red-500", children: 'Error: AppContent with layout="split" requires exactly 2 children' });
|
|
2549
|
-
}
|
|
2550
|
-
const [leftClass, rightClass] = splitRatioClasses[splitRatio];
|
|
2551
|
-
const [firstChild, secondChild] = reverse ? [children[1], children[0]] : [children[0], children[1]];
|
|
2552
|
-
const [firstClass, secondClass] = reverse ? [rightClass, leftClass] : [leftClass, rightClass];
|
|
2553
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex h-full gap-2", children: [
|
|
2554
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(firstClass, "overflow-auto"), children: contentWrapper(firstChild) }),
|
|
2555
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(secondClass, "overflow-auto"), children: contentWrapper(secondChild) })
|
|
2556
|
-
] });
|
|
2557
|
-
}
|
|
2558
|
-
case "with-sheet": {
|
|
2559
|
-
const {
|
|
2560
|
-
sheetContent,
|
|
2561
|
-
sheetWidth = "four-fifth",
|
|
2562
|
-
sheetSide = "right",
|
|
2563
|
-
sheetMode = "container",
|
|
2564
|
-
sheetTrigger,
|
|
2565
|
-
sheetClassName,
|
|
2566
|
-
isSheetOpen,
|
|
2567
|
-
onSheetOpenChange,
|
|
2568
|
-
showSheetOverlay = true,
|
|
2569
|
-
disableOverlay = true
|
|
2570
|
-
} = props;
|
|
2571
|
-
const isControlled = isSheetOpen !== void 0;
|
|
2572
|
-
const sheetOpen = isControlled ? isSheetOpen : internalSheetOpen;
|
|
2573
|
-
const setSheetOpen = isControlled ? onSheetOpenChange : setInternalSheetOpen;
|
|
2574
|
-
if (sheetMode === "container") {
|
|
2575
|
-
const sheetClasses = getContainerSheetClasses(sheetSide, sheetWidth);
|
|
2576
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn(
|
|
2577
|
-
"flex relative flex-1 overflow-hidden",
|
|
2578
|
-
sheetOpen && disableOverlay && ["left", "right"].includes(sheetSide)
|
|
2579
|
-
), children: [
|
|
2580
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn(
|
|
2581
|
-
"h-full overflow-auto transition-all duration-500",
|
|
2582
|
-
sheetOpen && disableOverlay && ["left", "right"].includes(sheetSide) ? sheetClasses.contentPushClass : "w-full",
|
|
2583
|
-
sheetOpen && disableOverlay && "overflow-y-auto overflow-x-hidden"
|
|
2584
|
-
), children: [
|
|
2585
|
-
sheetTrigger && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { onClick: () => setSheetOpen?.(!sheetOpen), children: sheetTrigger }),
|
|
2586
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn("h-full", !parentContainer && paddingClasses2[padding]), children })
|
|
2587
|
-
] }),
|
|
2588
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2589
|
-
"div",
|
|
2590
|
-
{
|
|
2591
|
-
className: cn(
|
|
2592
|
-
sheetClasses.container,
|
|
2593
|
-
"transition-all duration-500 ease-in-out",
|
|
2594
|
-
sheetOpen && disableOverlay && ["left", "right"].includes(sheetSide) ? cn(sheetClasses.sheetPushClass, "overflow-y-auto") : sheetOpen ? sheetClasses.transformOpen : cn(sheetClasses.transform, "hidden"),
|
|
2595
|
-
"overflow-y-auto"
|
|
2596
|
-
),
|
|
2597
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: cn(sheetClasses.content, sheetClassName, "h-full"), children: sheetContent })
|
|
2598
|
-
}
|
|
2599
|
-
),
|
|
2600
|
-
sheetOpen && showSheetOverlay && !disableOverlay && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2601
|
-
"div",
|
|
2602
|
-
{
|
|
2603
|
-
className: cn(
|
|
2604
|
-
"absolute inset-0 bg-secondary/20 z-40",
|
|
2605
|
-
"transition-opacity duration-500 ease-in-out",
|
|
2606
|
-
"opacity-0",
|
|
2607
|
-
sheetOpen ? "opacity-100" : "opacity-0"
|
|
2608
|
-
),
|
|
2609
|
-
onClick: () => setSheetOpen?.(false)
|
|
2610
|
-
}
|
|
2611
|
-
)
|
|
2612
|
-
] });
|
|
2613
|
-
}
|
|
2614
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Sheet, { open: sheetOpen, onOpenChange: setSheetOpen, children: [
|
|
2615
|
-
sheetTrigger && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SheetTrigger, { asChild: true, children: sheetTrigger }),
|
|
2616
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(SheetPortal, { children: [
|
|
2617
|
-
showSheetOverlay && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(SheetOverlay, { className: "fixed inset-0 bg-secondary/50 z-50" }),
|
|
2618
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2619
|
-
SheetContent,
|
|
2620
|
-
{
|
|
2621
|
-
side: sheetSide,
|
|
2622
|
-
className: cn(
|
|
2623
|
-
"fixed bg-background border",
|
|
2624
|
-
"transition-all duration-500 ease-in-out",
|
|
2625
|
-
splitRatioClasses[sheetWidth][1],
|
|
2626
|
-
sheetClassName
|
|
2627
|
-
),
|
|
2628
|
-
children: sheetContent
|
|
2629
|
-
}
|
|
2630
|
-
)
|
|
2631
|
-
] })
|
|
2632
|
-
] });
|
|
2633
|
-
}
|
|
2634
|
-
default:
|
|
2635
|
-
return contentWrapper(children);
|
|
2636
|
-
}
|
|
2637
|
-
};
|
|
2638
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppContentContext.Provider, { value: true, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: cn(
|
|
2639
|
-
baseClasses,
|
|
2640
|
-
variantClasses[variant],
|
|
2641
|
-
paddingClasses2[padding],
|
|
2642
|
-
isNested && "flex-1",
|
|
2643
|
-
parentContainer && "h-full",
|
|
2644
|
-
!parentContainer && "rounded-2xl",
|
|
2645
|
-
className
|
|
2646
|
-
), children: [
|
|
2647
|
-
header && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2648
|
-
"div",
|
|
2649
|
-
{
|
|
2650
|
-
className: cn(
|
|
2651
|
-
"border-b",
|
|
2652
|
-
headerClassName,
|
|
2653
|
-
variant === "card" && !parentContainer && "rounded-t-2xl",
|
|
2654
|
-
variant === "border" && "border-b-2",
|
|
2655
|
-
paddingClasses2[padding]
|
|
2656
|
-
),
|
|
2657
|
-
children: header
|
|
2658
|
-
}
|
|
2659
|
-
),
|
|
2660
|
-
renderContent(),
|
|
2661
|
-
footer && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2662
|
-
"div",
|
|
2663
|
-
{
|
|
2664
|
-
className: cn(
|
|
2665
|
-
"border-t",
|
|
2666
|
-
footerClassName,
|
|
2667
|
-
variant === "card" && !parentContainer && "rounded-b-2xl",
|
|
2668
|
-
variant === "border" && "border-t-2",
|
|
2669
|
-
paddingClasses2[padding]
|
|
2670
|
-
),
|
|
2671
|
-
children: footer
|
|
2672
|
-
}
|
|
2673
|
-
)
|
|
2674
|
-
] }) });
|
|
2675
|
-
};
|
|
2676
|
-
|
|
2677
|
-
// src/components/layouts/app-footer.tsx
|
|
2678
|
-
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2679
|
-
var AppFooter = ({
|
|
2680
|
-
className,
|
|
2681
|
-
columns = [],
|
|
2682
|
-
meta = { title: "" }
|
|
2683
|
-
}) => {
|
|
2684
|
-
const actionsColumn = {
|
|
2685
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex items-center gap-4 p-2", children: meta.secondaryActions }),
|
|
2686
|
-
align: "right",
|
|
2687
|
-
width: "fill"
|
|
2688
|
-
};
|
|
2689
|
-
const allColumns = [
|
|
2690
|
-
...columns.filter((col) => col !== void 0),
|
|
2691
|
-
actionsColumn
|
|
2692
|
-
];
|
|
2693
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: cn("flex items-center w-full gap-4", className), children: allColumns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2694
|
-
"div",
|
|
2695
|
-
{
|
|
2696
|
-
className: cn(
|
|
2697
|
-
"flex items-center h-full",
|
|
2698
|
-
column.className,
|
|
2699
|
-
{
|
|
2700
|
-
"justify-start": column.align === "left",
|
|
2701
|
-
"justify-center": column.align === "center",
|
|
2702
|
-
"justify-end": column.align === "right",
|
|
2703
|
-
"flex-1": column.width === "fill"
|
|
2704
|
-
}
|
|
2705
|
-
),
|
|
2706
|
-
children: column.content
|
|
2707
|
-
},
|
|
2708
|
-
index
|
|
2709
|
-
)) });
|
|
2710
|
-
};
|
|
2711
|
-
|
|
2712
|
-
// src/components/layouts/factories.tsx
|
|
2713
|
-
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2714
|
-
function createLayoutComponents({
|
|
2715
|
-
useTypedAppMeta
|
|
2716
|
-
}) {
|
|
2717
|
-
const AppHeader2 = (props) => {
|
|
2718
|
-
const { meta } = useTypedAppMeta();
|
|
2719
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AppHeader, { ...props, meta });
|
|
2720
|
-
};
|
|
2721
|
-
const AppFooter2 = (props) => {
|
|
2722
|
-
const { meta } = useTypedAppMeta();
|
|
2723
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AppFooter, { ...props, meta });
|
|
2724
|
-
};
|
|
2725
|
-
const AppContent2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AppContent, { ...props });
|
|
2726
|
-
const AppContainer2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AppContainer, { ...props });
|
|
2727
|
-
return {
|
|
2728
|
-
AppHeader: AppHeader2,
|
|
2729
|
-
AppFooter: AppFooter2,
|
|
2730
|
-
AppContent: AppContent2,
|
|
2731
|
-
AppContainer: AppContainer2
|
|
2732
|
-
};
|
|
2733
|
-
}
|
|
2734
|
-
|
|
2735
|
-
// src/context/app-meta/context.tsx
|
|
2736
|
-
var import_react4 = require("react");
|
|
2737
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2738
|
-
var AppMetaContext = (0, import_react4.createContext)(void 0);
|
|
2739
|
-
var AppMetaProvider = ({ children }) => {
|
|
2740
|
-
const [meta, setMetaState] = (0, import_react4.useState)({
|
|
2741
|
-
title: "",
|
|
2742
|
-
description: "",
|
|
2743
|
-
breadcrumbs: []
|
|
2744
|
-
});
|
|
2745
|
-
const setMeta = (0, import_react4.useCallback)((partialMeta) => {
|
|
2746
|
-
setMetaState((prev) => {
|
|
2747
|
-
const hasChanges = Object.keys(partialMeta).some(
|
|
2748
|
-
(key) => JSON.stringify(prev[key]) !== JSON.stringify(partialMeta[key])
|
|
2749
|
-
);
|
|
2750
|
-
return hasChanges ? { ...prev, ...partialMeta } : prev;
|
|
2751
|
-
});
|
|
2752
|
-
}, []);
|
|
2753
|
-
const resetMeta = (0, import_react4.useCallback)(() => {
|
|
2754
|
-
setMetaState((prev) => prev.title === "" && prev.description === "" && (prev.breadcrumbs?.length ?? 0) === 0 ? prev : {
|
|
2755
|
-
title: "",
|
|
2756
|
-
description: "",
|
|
2757
|
-
breadcrumbs: []
|
|
2758
|
-
});
|
|
2759
|
-
}, []);
|
|
2760
|
-
const contextValue = (0, import_react4.useMemo)(() => ({
|
|
2761
|
-
meta,
|
|
2762
|
-
setMeta,
|
|
2763
|
-
resetMeta
|
|
2764
|
-
}), [meta, setMeta, resetMeta]);
|
|
2765
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(AppMetaContext.Provider, { value: contextValue, children });
|
|
2766
|
-
};
|
|
2767
|
-
function createTypedAppMetaContext() {
|
|
2768
|
-
const TypedAppMetaContext = (0, import_react4.createContext)(void 0);
|
|
2769
|
-
const TypedAppMetaProvider = ({ children }) => {
|
|
2770
|
-
const [meta, setMetaState] = (0, import_react4.useState)({
|
|
2771
|
-
title: "",
|
|
2772
|
-
description: "",
|
|
2773
|
-
breadcrumbs: []
|
|
2774
|
-
});
|
|
2775
|
-
const setMeta = (0, import_react4.useCallback)((partialMeta) => {
|
|
2776
|
-
setMetaState((prev) => {
|
|
2777
|
-
const hasChanges = Object.keys(partialMeta).some((key) => {
|
|
2778
|
-
const prevValue = prev[key];
|
|
2779
|
-
const newValue = partialMeta[key];
|
|
2780
|
-
return JSON.stringify(prevValue) !== JSON.stringify(newValue);
|
|
2781
|
-
});
|
|
2782
|
-
return hasChanges ? { ...prev, ...partialMeta } : prev;
|
|
2783
|
-
});
|
|
2784
|
-
}, []);
|
|
2785
|
-
const resetMeta = (0, import_react4.useCallback)(() => {
|
|
2786
|
-
setMetaState((prev) => prev.title === "" && prev.description === "" && (prev.breadcrumbs?.length ?? 0) === 0 ? prev : {
|
|
2787
|
-
title: "",
|
|
2788
|
-
description: "",
|
|
2789
|
-
breadcrumbs: []
|
|
2790
|
-
});
|
|
2791
|
-
}, []);
|
|
2792
|
-
const contextValue = (0, import_react4.useMemo)(() => ({
|
|
2793
|
-
meta,
|
|
2794
|
-
setMeta,
|
|
2795
|
-
resetMeta
|
|
2796
|
-
}), [meta, setMeta, resetMeta]);
|
|
2797
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TypedAppMetaContext.Provider, { value: contextValue, children });
|
|
2798
|
-
};
|
|
2799
|
-
const useTypedAppMeta = () => {
|
|
2800
|
-
const context = (0, import_react4.useContext)(TypedAppMetaContext);
|
|
2801
|
-
if (!context) {
|
|
2802
|
-
throw new Error("useTypedAppMeta must be used within a TypedAppMetaProvider");
|
|
2803
|
-
}
|
|
2804
|
-
return context;
|
|
2805
|
-
};
|
|
2806
|
-
return { TypedAppMetaProvider, useTypedAppMeta, TypedAppMetaContext };
|
|
2807
|
-
}
|
|
2808
|
-
|
|
2809
|
-
// src/context/app-meta/hooks.ts
|
|
2810
|
-
var import_react5 = require("react");
|
|
2811
|
-
function createPageTemplateHook({
|
|
2812
|
-
useTypedAppMeta
|
|
2813
|
-
}) {
|
|
2814
|
-
function usePageTemplate(options) {
|
|
2815
|
-
const { setMeta, resetMeta } = useTypedAppMeta();
|
|
2816
|
-
const backAction = (0, import_react5.useMemo)(() => {
|
|
2817
|
-
if (!options.backAction) return void 0;
|
|
2818
|
-
return {
|
|
2819
|
-
...options.backAction,
|
|
2820
|
-
onClick: options.backAction.onClick
|
|
2821
|
-
};
|
|
2822
|
-
}, [options.backAction?.content, options.backAction?.href, options.backAction?.onClick?.toString()]);
|
|
2823
|
-
const metadata = (0, import_react5.useMemo)(() => options.metadata, [JSON.stringify(options.metadata)]);
|
|
2824
|
-
const stableOptions = (0, import_react5.useMemo)(() => ({
|
|
2825
|
-
...options,
|
|
2826
|
-
backAction,
|
|
2827
|
-
metadata
|
|
2828
|
-
}), [
|
|
2829
|
-
options.title,
|
|
2830
|
-
options.description,
|
|
2831
|
-
options.breadcrumbs,
|
|
2832
|
-
options.primaryActions,
|
|
2833
|
-
options.secondaryActions,
|
|
2834
|
-
options.pagination,
|
|
2835
|
-
options.status,
|
|
2836
|
-
backAction,
|
|
2837
|
-
metadata
|
|
2838
|
-
]);
|
|
2839
|
-
(0, import_react5.useEffect)(() => {
|
|
2840
|
-
setMeta(stableOptions);
|
|
2841
|
-
return () => resetMeta();
|
|
2842
|
-
}, [stableOptions, setMeta, resetMeta]);
|
|
2843
|
-
}
|
|
2844
|
-
return { usePageTemplate };
|
|
2845
|
-
}
|
|
2846
|
-
|
|
2847
|
-
// src/components/general.tsx
|
|
2848
|
-
var import_react6 = require("react");
|
|
2849
|
-
var import_lucide_react18 = require("lucide-react");
|
|
2850
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2851
|
-
var GeneralHelper = class {
|
|
2852
|
-
static currencyFormatter = new Intl.NumberFormat("en-IN", {
|
|
2853
|
-
style: "currency",
|
|
2854
|
-
currency: "INR",
|
|
2855
|
-
maximumFractionDigits: 2
|
|
2856
|
-
});
|
|
2857
|
-
static compactFormatter = new Intl.NumberFormat("en-IN", {
|
|
2858
|
-
style: "currency",
|
|
2859
|
-
currency: "INR",
|
|
2860
|
-
notation: "compact",
|
|
2861
|
-
maximumFractionDigits: 1
|
|
2862
|
-
});
|
|
2863
|
-
static MONTH_NAMES_SHORT = [
|
|
2864
|
-
"Jan",
|
|
2865
|
-
"Feb",
|
|
2866
|
-
"Mar",
|
|
2867
|
-
"Apr",
|
|
2868
|
-
"May",
|
|
2869
|
-
"Jun",
|
|
2870
|
-
"Jul",
|
|
2871
|
-
"Aug",
|
|
2872
|
-
"Sep",
|
|
2873
|
-
"Oct",
|
|
2874
|
-
"Nov",
|
|
2875
|
-
"Dec"
|
|
2876
|
-
];
|
|
2877
|
-
/**
|
|
2878
|
-
* Copies text to clipboard
|
|
2879
|
-
* @param text Text to copy
|
|
2880
|
-
* @returns Promise that resolves when copy is complete
|
|
2881
|
-
*/
|
|
2882
|
-
static async copyToClipboard(text) {
|
|
2883
|
-
if (!text) return;
|
|
2884
|
-
try {
|
|
2885
|
-
await navigator.clipboard.writeText(text);
|
|
2886
|
-
} catch (error) {
|
|
2887
|
-
console.error("Failed to copy text:", error);
|
|
2888
|
-
throw error;
|
|
2889
|
-
}
|
|
2890
|
-
}
|
|
2891
|
-
/**
|
|
2892
|
-
* React component for copy to clipboard functionality
|
|
2893
|
-
*/
|
|
2894
|
-
static CopyToClipboard = ({
|
|
2895
|
-
text,
|
|
2896
|
-
children,
|
|
2897
|
-
className,
|
|
2898
|
-
size = "icon",
|
|
2899
|
-
variant = "ghost"
|
|
2900
|
-
}) => {
|
|
2901
|
-
const [isCopied, setIsCopied] = (0, import_react6.useState)(false);
|
|
2902
|
-
const [isLoading, setIsLoading] = (0, import_react6.useState)(false);
|
|
2903
|
-
const handleCopy = async () => {
|
|
2904
|
-
if (!text || isLoading) return;
|
|
2905
|
-
setIsLoading(true);
|
|
2906
|
-
try {
|
|
2907
|
-
await this.copyToClipboard(text);
|
|
2908
|
-
setIsCopied(true);
|
|
2909
|
-
setTimeout(() => setIsCopied(false), 2e3);
|
|
2910
|
-
} catch (error) {
|
|
2911
|
-
console.error("Failed to copy text:", error);
|
|
2912
|
-
} finally {
|
|
2913
|
-
setIsLoading(false);
|
|
2914
|
-
}
|
|
2915
|
-
};
|
|
2916
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Tooltip, { children: [
|
|
2917
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2918
|
-
Button,
|
|
2919
|
-
{
|
|
2920
|
-
variant,
|
|
2921
|
-
size,
|
|
2922
|
-
className: cn(
|
|
2923
|
-
size === "icon" && "size-6",
|
|
2924
|
-
className
|
|
2925
|
-
),
|
|
2926
|
-
onClick: handleCopy,
|
|
2927
|
-
disabled: isLoading || !text,
|
|
2928
|
-
children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.Loader2Icon, { className: "animate-spin" }) : isCopied ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.Check, { className: "h-3 w-3" }) : children ? children : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_lucide_react18.Copy, { className: "h-3 w-3" })
|
|
2929
|
-
}
|
|
2930
|
-
) }),
|
|
2931
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipContent, { children: isCopied ? "Copied!" : isLoading ? "Copying..." : "Copy to clipboard" })
|
|
2932
|
-
] });
|
|
2933
|
-
};
|
|
2934
|
-
/**
|
|
2935
|
-
* Formats a number as Indian Rupees (INR)
|
|
2936
|
-
* @param amount Amount to format
|
|
2937
|
-
* @param options Formatting options
|
|
2938
|
-
* @returns Formatted currency string
|
|
2939
|
-
*/
|
|
2940
|
-
static formatINR(amount, options = {}) {
|
|
2941
|
-
const { prefix = "", suffix = "", withSymbol = true, compact = false } = options;
|
|
2942
|
-
if (typeof amount !== "number" || isNaN(amount)) {
|
|
2943
|
-
return `${prefix}${withSymbol ? "\u20B9 " : ""}0.00${suffix}`;
|
|
2944
|
-
}
|
|
2945
|
-
const isNegative = amount < 0;
|
|
2946
|
-
const absoluteAmount = Math.abs(amount);
|
|
2947
|
-
const formatter = compact && absoluteAmount >= 1e5 ? this.compactFormatter : this.currencyFormatter;
|
|
2948
|
-
const formatted = formatter.format(absoluteAmount).replace("\u20B9", "");
|
|
2949
|
-
return `${prefix}${isNegative ? "- " : ""}${withSymbol ? "\u20B9 " : ""}${formatted}${suffix}`;
|
|
2950
|
-
}
|
|
2951
|
-
/**
|
|
2952
|
-
* Formats a date according to specified options
|
|
2953
|
-
* @param input Date input (string, number, or Date object)
|
|
2954
|
-
* @param options Formatting options
|
|
2955
|
-
* @returns Formatted date string
|
|
2956
|
-
*/
|
|
2957
|
-
static formatDate(input, options = {}) {
|
|
2958
|
-
const { format = "dd-mm-yyyy", separator = "-" } = options;
|
|
2959
|
-
const dateObj = new Date(input);
|
|
2960
|
-
if (isNaN(dateObj.getTime())) return "";
|
|
2961
|
-
const dd = String(dateObj.getDate()).padStart(2, "0");
|
|
2962
|
-
const mm = String(dateObj.getMonth() + 1).padStart(2, "0");
|
|
2963
|
-
const mmm = this.MONTH_NAMES_SHORT[dateObj.getMonth()];
|
|
2964
|
-
const yyyy = dateObj.getFullYear();
|
|
2965
|
-
switch (format) {
|
|
2966
|
-
case "dd-mmm-yyyy":
|
|
2967
|
-
return `${dd}${separator}${mmm}${separator}${yyyy}`;
|
|
2968
|
-
case "iso":
|
|
2969
|
-
return dateObj.toISOString().split("T")[0];
|
|
2970
|
-
case "long":
|
|
2971
|
-
return dateObj.toLocaleDateString("en-IN", {
|
|
2972
|
-
year: "numeric",
|
|
2973
|
-
month: "long",
|
|
2974
|
-
day: "numeric"
|
|
2975
|
-
});
|
|
2976
|
-
case "short":
|
|
2977
|
-
return dateObj.toLocaleDateString("en-IN");
|
|
2978
|
-
default:
|
|
2979
|
-
return `${dd}${separator}${mm}${separator}${yyyy}`;
|
|
2980
|
-
}
|
|
2981
|
-
}
|
|
2982
|
-
static toProperCase(text) {
|
|
2983
|
-
if (!text) return "";
|
|
2984
|
-
return text.toLowerCase().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
2985
|
-
}
|
|
2986
|
-
/**
|
|
2987
|
-
* Advanced proper case conversion that handles hyphenated words and apostrophes
|
|
2988
|
-
* @param text Text to convert
|
|
2989
|
-
* @returns Text in proper case with special handling
|
|
2990
|
-
*/
|
|
2991
|
-
static toProperCaseAdvanced(text) {
|
|
2992
|
-
if (!text) return "";
|
|
2993
|
-
return text.toLowerCase().split(/(\s+|['-])/).map((part, index, array) => {
|
|
2994
|
-
if (["-", "'", " "].includes(part) || index > 0 && ["-", "'"].includes(array[index - 1])) {
|
|
2995
|
-
return part;
|
|
2996
|
-
}
|
|
2997
|
-
return part.charAt(0).toUpperCase() + part.slice(1);
|
|
2998
|
-
}).join("");
|
|
2999
|
-
}
|
|
3000
|
-
static StatusBadge = ({
|
|
3001
|
-
status,
|
|
3002
|
-
className,
|
|
3003
|
-
showDot = true,
|
|
3004
|
-
capitalize = true,
|
|
3005
|
-
size = "md",
|
|
3006
|
-
variant = "outline",
|
|
3007
|
-
customColors,
|
|
3008
|
-
icon,
|
|
3009
|
-
trueMessage = "active",
|
|
3010
|
-
falseMessage = "inactive"
|
|
3011
|
-
}) => {
|
|
3012
|
-
const normalizedStatus = typeof status === "boolean" ? status ? trueMessage : falseMessage : typeof status === "number" ? status > 0 ? trueMessage : falseMessage : status.toLowerCase();
|
|
3013
|
-
const statusConfig = {
|
|
3014
|
-
active: {
|
|
3015
|
-
label: "active",
|
|
3016
|
-
solid: {
|
|
3017
|
-
bg: "bg-emerald-500",
|
|
3018
|
-
text: "text-white",
|
|
3019
|
-
border: "border-emerald-600",
|
|
3020
|
-
dot: "bg-white"
|
|
3021
|
-
},
|
|
3022
|
-
outline: {
|
|
3023
|
-
bg: "bg-emerald-50",
|
|
3024
|
-
text: "text-emerald-700",
|
|
3025
|
-
border: "border-emerald-100",
|
|
3026
|
-
dot: "bg-emerald-500"
|
|
3027
|
-
},
|
|
3028
|
-
subtle: {
|
|
3029
|
-
bg: "bg-emerald-50",
|
|
3030
|
-
text: "text-emerald-700",
|
|
3031
|
-
border: "border-transparent",
|
|
3032
|
-
dot: "bg-emerald-500"
|
|
3033
|
-
}
|
|
3034
|
-
},
|
|
3035
|
-
pending: {
|
|
3036
|
-
label: "pending",
|
|
3037
|
-
solid: {
|
|
3038
|
-
bg: "bg-amber-500",
|
|
3039
|
-
text: "text-white",
|
|
3040
|
-
border: "border-amber-600",
|
|
3041
|
-
dot: "bg-white"
|
|
3042
|
-
},
|
|
3043
|
-
outline: {
|
|
3044
|
-
bg: "bg-amber-50",
|
|
3045
|
-
text: "text-amber-700",
|
|
3046
|
-
border: "border-amber-100",
|
|
3047
|
-
dot: "bg-amber-500"
|
|
3048
|
-
},
|
|
3049
|
-
subtle: {
|
|
3050
|
-
bg: "bg-amber-50",
|
|
3051
|
-
text: "text-amber-700",
|
|
3052
|
-
border: "border-transparent",
|
|
3053
|
-
dot: "bg-amber-500"
|
|
3054
|
-
}
|
|
3055
|
-
},
|
|
3056
|
-
inactive: {
|
|
3057
|
-
label: "inactive",
|
|
3058
|
-
solid: {
|
|
3059
|
-
bg: "bg-rose-500",
|
|
3060
|
-
text: "text-white",
|
|
3061
|
-
border: "border-rose-600",
|
|
3062
|
-
dot: "bg-white"
|
|
3063
|
-
},
|
|
3064
|
-
outline: {
|
|
3065
|
-
bg: "bg-rose-50",
|
|
3066
|
-
text: "text-rose-700",
|
|
3067
|
-
border: "border-rose-100",
|
|
3068
|
-
dot: "bg-rose-500"
|
|
3069
|
-
},
|
|
3070
|
-
subtle: {
|
|
3071
|
-
bg: "bg-rose-50",
|
|
3072
|
-
text: "text-rose-700",
|
|
3073
|
-
border: "border-transparent",
|
|
3074
|
-
dot: "bg-rose-500"
|
|
3075
|
-
}
|
|
3076
|
-
},
|
|
3077
|
-
draft: {
|
|
3078
|
-
label: "draft",
|
|
3079
|
-
solid: {
|
|
3080
|
-
bg: "bg-gray-500",
|
|
3081
|
-
text: "text-white",
|
|
3082
|
-
border: "border-gray-600",
|
|
3083
|
-
dot: "bg-white"
|
|
3084
|
-
},
|
|
3085
|
-
outline: {
|
|
3086
|
-
bg: "bg-gray-50",
|
|
3087
|
-
text: "text-gray-700",
|
|
3088
|
-
border: "border-gray-100",
|
|
3089
|
-
dot: "bg-gray-500"
|
|
3090
|
-
},
|
|
3091
|
-
subtle: {
|
|
3092
|
-
bg: "bg-gray-50",
|
|
3093
|
-
text: "text-gray-700",
|
|
3094
|
-
border: "border-transparent",
|
|
3095
|
-
dot: "bg-gray-500"
|
|
3096
|
-
}
|
|
3097
|
-
},
|
|
3098
|
-
completed: {
|
|
3099
|
-
label: "completed",
|
|
3100
|
-
solid: {
|
|
3101
|
-
bg: "bg-indigo-500",
|
|
3102
|
-
text: "text-white",
|
|
3103
|
-
border: "border-indigo-600",
|
|
3104
|
-
dot: "bg-white"
|
|
3105
|
-
},
|
|
3106
|
-
outline: {
|
|
3107
|
-
bg: "bg-indigo-50",
|
|
3108
|
-
text: "text-indigo-700",
|
|
3109
|
-
border: "border-indigo-100",
|
|
3110
|
-
dot: "bg-indigo-500"
|
|
3111
|
-
},
|
|
3112
|
-
subtle: {
|
|
3113
|
-
bg: "bg-indigo-50",
|
|
3114
|
-
text: "text-indigo-700",
|
|
3115
|
-
border: "border-transparent",
|
|
3116
|
-
dot: "bg-indigo-500"
|
|
3117
|
-
}
|
|
3118
|
-
}
|
|
3119
|
-
};
|
|
3120
|
-
const config = statusConfig[normalizedStatus.toLowerCase()] || statusConfig.inactive;
|
|
3121
|
-
const colors = customColors || config[variant];
|
|
3122
|
-
const sizeClasses = {
|
|
3123
|
-
sm: "text-xs px-2 py-0.5",
|
|
3124
|
-
md: "text-xs px-2.5 py-0.5",
|
|
3125
|
-
lg: "text-sm px-3 py-1"
|
|
3126
|
-
};
|
|
3127
|
-
const displayText = capitalize ? normalizedStatus.charAt(0).toUpperCase() + normalizedStatus.slice(1) : normalizedStatus;
|
|
3128
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
3129
|
-
"span",
|
|
3130
|
-
{
|
|
3131
|
-
className: cn(
|
|
3132
|
-
"inline-flex items-center gap-1.5 rounded-full border font-medium",
|
|
3133
|
-
colors.bg,
|
|
3134
|
-
colors.text,
|
|
3135
|
-
colors.border,
|
|
3136
|
-
sizeClasses[size],
|
|
3137
|
-
className
|
|
3138
|
-
),
|
|
3139
|
-
children: [
|
|
3140
|
-
showDot && (icon ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "flex items-center", children: icon }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3141
|
-
"span",
|
|
3142
|
-
{
|
|
3143
|
-
className: cn("size-2 rounded-full", colors.dot),
|
|
3144
|
-
"aria-hidden": "true"
|
|
3145
|
-
}
|
|
3146
|
-
)),
|
|
3147
|
-
displayText
|
|
3148
|
-
]
|
|
3149
|
-
}
|
|
3150
|
-
) });
|
|
3151
|
-
};
|
|
3152
|
-
};
|
|
3153
|
-
|
|
3154
|
-
// src/components/core/error.tsx
|
|
3155
|
-
var import_lucide_react19 = require("lucide-react");
|
|
3156
|
-
var import_react_router2 = require("react-router");
|
|
3157
|
-
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3158
|
-
|
|
3159
|
-
// src/components/core/event-success.tsx
|
|
3160
|
-
var import_framer_motion3 = require("framer-motion");
|
|
3161
|
-
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3162
|
-
function Checkmark({ size = 100, strokeWidth = 2, color = "currentColor", className = "" }) {
|
|
3163
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
3164
|
-
import_framer_motion3.motion.svg,
|
|
3165
|
-
{
|
|
3166
|
-
width: size,
|
|
3167
|
-
height: size,
|
|
3168
|
-
viewBox: "0 0 100 100",
|
|
3169
|
-
initial: "hidden",
|
|
3170
|
-
animate: "visible",
|
|
3171
|
-
className,
|
|
3172
|
-
children: [
|
|
3173
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("title", { children: "Animated Checkmark" }),
|
|
3174
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3175
|
-
import_framer_motion3.motion.circle,
|
|
3176
|
-
{
|
|
3177
|
-
cx: "50",
|
|
3178
|
-
cy: "50",
|
|
3179
|
-
r: "40",
|
|
3180
|
-
stroke: color,
|
|
3181
|
-
custom: 0,
|
|
3182
|
-
style: {
|
|
3183
|
-
strokeWidth,
|
|
3184
|
-
strokeLinecap: "round",
|
|
3185
|
-
fill: "transparent"
|
|
3186
|
-
}
|
|
3187
|
-
}
|
|
3188
|
-
),
|
|
3189
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3190
|
-
import_framer_motion3.motion.path,
|
|
3191
|
-
{
|
|
3192
|
-
d: "M30 50L45 65L70 35",
|
|
3193
|
-
stroke: color,
|
|
3194
|
-
custom: 1,
|
|
3195
|
-
style: {
|
|
3196
|
-
strokeWidth,
|
|
3197
|
-
strokeLinecap: "round",
|
|
3198
|
-
strokeLinejoin: "round",
|
|
3199
|
-
fill: "transparent"
|
|
3200
|
-
}
|
|
3201
|
-
}
|
|
3202
|
-
)
|
|
3203
|
-
]
|
|
3204
|
-
}
|
|
3205
|
-
);
|
|
3206
|
-
}
|
|
3207
|
-
|
|
3208
|
-
// src/components/core/loader.tsx
|
|
3209
|
-
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3210
|
-
|
|
3211
|
-
// src/components/core/notfound.tsx
|
|
3212
|
-
var import_react_router3 = require("react-router");
|
|
3213
|
-
var import_lucide_react20 = require("lucide-react");
|
|
3214
|
-
var import_react_router4 = require("react-router");
|
|
3215
|
-
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3216
|
-
|
|
3217
|
-
// src/components/core/offline-content.tsx
|
|
3218
|
-
var import_lucide_react21 = require("lucide-react");
|
|
3219
|
-
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3220
|
-
|
|
3221
|
-
// src/components/core/unauthorized.tsx
|
|
3222
|
-
var import_lucide_react22 = require("lucide-react");
|
|
3223
|
-
var import_react_router5 = require("react-router");
|
|
3224
|
-
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3225
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
3226
|
-
0 && (module.exports = {
|
|
3227
|
-
AppMetaProvider,
|
|
3228
|
-
Checkmark,
|
|
3229
|
-
DataTable,
|
|
3230
|
-
DataTableActionBar,
|
|
3231
|
-
DataTableActionBarAction,
|
|
3232
|
-
DataTableActionBarSelection,
|
|
3233
|
-
DataTemplate,
|
|
3234
|
-
DataTemplateActionBar,
|
|
3235
|
-
DataTemplateActionBarAction,
|
|
3236
|
-
DataTemplateActionBarSelection,
|
|
3237
|
-
GeneralHelper,
|
|
3238
|
-
createLayoutComponents,
|
|
3239
|
-
createPageTemplateHook,
|
|
3240
|
-
createTypedAppMetaContext
|
|
3241
|
-
});
|
|
1
|
+
"use client"
|
|
2
|
+
"use strict";var ga=Object.create;var kt=Object.defineProperty;var fa=Object.getOwnPropertyDescriptor;var ba=Object.getOwnPropertyNames;var va=Object.getPrototypeOf,ha=Object.prototype.hasOwnProperty;var xa=(e,t)=>{for(var o in t)kt(e,o,{get:t[o],enumerable:!0})},ho=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ba(t))!ha.call(e,s)&&s!==o&&kt(e,s,{get:()=>t[s],enumerable:!(n=fa(t,s))||n.enumerable});return e};var ut=(e,t,o)=>(o=e!=null?ga(va(e)):{},ho(t||!e||!e.__esModule?kt(o,"default",{value:e,enumerable:!0}):o,e)),Ca=e=>ho(kt({},"__esModule",{value:!0}),e);var Ga={};xa(Ga,{AppMetaProvider:()=>ra,CurrencyTransfer:()=>uo,DataTable:()=>Xt,DataTableActionBar:()=>Kt,DataTableActionBarAction:()=>Yt,DataTableActionBarSelection:()=>Zt,DataTemplate:()=>oo,DataTemplateActionBar:()=>ao,DataTemplateActionBarAction:()=>no,DataTemplateActionBarSelection:()=>ro,ErrorComponent:()=>po,GeneralHelper:()=>Vt,Loader:()=>go,NotFound:()=>fo,OfflineUI:()=>bo,Unauthorized:()=>vo,createLayoutComponents:()=>na,createPageTemplateHook:()=>sa,createTypedAppMetaContext:()=>ia});module.exports=Ca(Ga);var ne=require("@tanstack/react-table"),K=require("lucide-react");var yo=require("radix-ui"),wo=require("class-variance-authority");var xo=require("clsx"),Co=require("tailwind-merge");function a(...e){return(0,Co.twMerge)((0,xo.clsx)(e))}var No=require("react/jsx-runtime"),ya=(0,wo.cva)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function v({className:e,variant:t,size:o,asChild:n=!1,...s}){let i=n?yo.Slot.Slot:"button";return(0,No.jsx)(i,{"data-slot":"button",className:a(ya({variant:t,size:o,className:e}),"transition-none"),...s})}var Ae=require("react/jsx-runtime");function jt({className:e,...t}){return(0,Ae.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-auto max-h-full",children:(0,Ae.jsx)("table",{"data-slot":"table",className:a("w-full caption-bottom text-sm",e),...t})})}function Po({className:e,...t}){return(0,Ae.jsx)("thead",{"data-slot":"table-header",className:a("[&_tr]:border-b",e),...t})}function To({className:e,...t}){return(0,Ae.jsx)("tbody",{"data-slot":"table-body",className:a("[&_tr:last-child]:border-0",e),...t})}function So({className:e,...t}){return(0,Ae.jsx)("tfoot",{"data-slot":"table-footer",className:a("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function gt({className:e,...t}){return(0,Ae.jsx)("tr",{"data-slot":"table-row",className:a("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Do({className:e,...t}){return(0,Ae.jsx)("th",{"data-slot":"table-head",className:a("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap",e),...t})}function Rt({className:e,...t}){return(0,Ae.jsx)("td",{"data-slot":"table-cell",className:a("p-2 align-middle whitespace-nowrap",e),...t})}var $t=require("react/jsx-runtime");function he({className:e,...t}){return(0,$t.jsx)("div",{"data-slot":"card",className:a("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function xe({className:e,...t}){return(0,$t.jsx)("div",{"data-slot":"card-content",className:a("px-6",e),...t})}var Ke=require("radix-ui");var ze=require("react/jsx-runtime");function Ye({delayDuration:e=0,...t}){return(0,ze.jsx)(Ke.Tooltip.Provider,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Oe({...e}){return(0,ze.jsx)(Ye,{children:(0,ze.jsx)(Ke.Tooltip.Root,{"data-slot":"tooltip",...e})})}function Ve({...e}){return(0,ze.jsx)(Ke.Tooltip.Trigger,{"data-slot":"tooltip-trigger",...e})}function _e({className:e,sideOffset:t=0,children:o,...n}){return(0,ze.jsx)(Ke.Tooltip.Portal,{children:(0,ze.jsxs)(Ke.Tooltip.Content,{"data-slot":"tooltip-content",sideOffset:t,className:a("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...n,children:[o,(0,ze.jsx)(Ke.Tooltip.Arrow,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}var J=require("lucide-react");var ko=require("react/jsx-runtime");function rt({className:e,type:t,...o}){return(0,ko.jsx)("input",{type:t,"data-slot":"input",className:a("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...o})}var se=require("radix-ui"),Ze=require("lucide-react");var U=require("react/jsx-runtime");function Ge({...e}){return(0,U.jsx)(se.Select.Root,{"data-slot":"select",...e})}function He({...e}){return(0,U.jsx)(se.Select.Value,{"data-slot":"select-value",...e})}function Ee({className:e,size:t="default",children:o,...n}){return(0,U.jsxs)(se.Select.Trigger,{"data-slot":"select-trigger","data-size":t,className:a("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[o,(0,U.jsx)(se.Select.Icon,{asChild:!0,children:(0,U.jsx)(Ze.ChevronDownIcon,{className:"size-4 opacity-50"})})]})}function je({className:e,children:t,position:o="popper",...n}){return(0,U.jsx)(se.Select.Portal,{children:(0,U.jsxs)(se.Select.Content,{"data-slot":"select-content",className:a("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",o==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:o,...n,children:[(0,U.jsx)(wa,{}),(0,U.jsx)(se.Select.Viewport,{className:a("p-1",o==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),(0,U.jsx)(Na,{})]})})}function Ce({className:e,children:t,...o}){return(0,U.jsxs)(se.Select.Item,{"data-slot":"select-item",className:a("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...o,children:[(0,U.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,U.jsx)(se.Select.ItemIndicator,{children:(0,U.jsx)(Ze.CheckIcon,{className:"size-4"})})}),(0,U.jsx)(se.Select.ItemText,{children:t})]})}function wa({className:e,...t}){return(0,U.jsx)(se.Select.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:a("flex cursor-default items-center justify-center py-1",e),...t,children:(0,U.jsx)(Ze.ChevronUpIcon,{className:"size-4"})})}function Na({className:e,...t}){return(0,U.jsx)(se.Select.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:a("flex cursor-default items-center justify-center py-1",e),...t,children:(0,U.jsx)(Ze.ChevronDownIcon,{className:"size-4"})})}var ue=require("radix-ui"),Mt=require("lucide-react");var ae=require("react/jsx-runtime");function ye({...e}){return(0,ae.jsx)(ue.DropdownMenu.Root,{"data-slot":"dropdown-menu",...e})}function we({...e}){return(0,ae.jsx)(ue.DropdownMenu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}function Ne({className:e,sideOffset:t=4,...o}){return(0,ae.jsx)(ue.DropdownMenu.Portal,{children:(0,ae.jsx)(ue.DropdownMenu.Content,{"data-slot":"dropdown-menu-content",sideOffset:t,className:a("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) rounded-md border p-1 shadow-md",e),...o})})}function Ut({...e}){return(0,ae.jsx)(ue.DropdownMenu.Group,{"data-slot":"dropdown-menu-group",...e})}function X({className:e,inset:t,variant:o="default",...n}){return(0,ae.jsx)(ue.DropdownMenu.Item,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":o,className:a("cursor-pointer focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}function At({className:e,children:t,checked:o,...n}){return(0,ae.jsxs)(ue.DropdownMenu.CheckboxItem,{"data-slot":"dropdown-menu-checkbox-item",className:a("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),checked:o,...n,children:[(0,ae.jsx)("span",{className:"pointer-events-none absolute left-2 flex size-3.5 items-center justify-center",children:(0,ae.jsx)(ue.DropdownMenu.ItemIndicator,{children:(0,ae.jsx)(Mt.CheckIcon,{className:"size-4"})})}),t]})}function le({className:e,inset:t,...o}){return(0,ae.jsx)(ue.DropdownMenu.Label,{"data-slot":"dropdown-menu-label","data-inset":t,className:a("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8",e),...o})}function de({className:e,...t}){return(0,ae.jsx)(ue.DropdownMenu.Separator,{"data-slot":"dropdown-menu-separator",className:a("bg-border -mx-1 my-1 h-px",e),...t})}var c=require("react/jsx-runtime");function Wt({table:e,filters:t=[],globalFilter:o,onGlobalFilterChange:n,enableGlobalFilter:s=!0,onExport:i,onRefresh:p,loading:C=!1,enableColumnVisibility:y=!0,data:f,onClearSorting:u,onClearFilters:T,enableColumnPinning:_=!1}){let z=()=>e.getAllLeafColumns().filter(m=>m.getCanHide?.()!==!1),A=()=>e.getAllColumns().filter(m=>!e.getAllLeafColumns().includes(m)&&m.columns?.length&&m.columns.some(b=>b.getCanHide?.()!==!1)),k=()=>{let m=new Set(A().flatMap(b=>b.columns?.filter(j=>j.getCanHide?.()!==!1).map(j=>j.id)||[]));return z().filter(b=>!m.has(b.id))},B=(m,b)=>b&&m.startsWith(`${b}.`)?m.replace(`${b}.`,"").split("_").map(h=>h.slice(1)).join(" "):m.split("_").map(j=>j.charAt(0).toUpperCase()+j.slice(1)).join(" ");return(0,c.jsx)("div",{className:"rounded-xl",children:(0,c.jsx)("div",{className:"px-2",children:(0,c.jsx)("div",{className:"flex flex-col gap-6",children:(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,c.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,c.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,c.jsx)(J.Filter,{className:"h-4 w-4"})}),t.map(m=>(0,c.jsx)("div",{className:a("relative min-w-[150px]",m.width),children:m.type==="select"?(0,c.jsxs)(Ge,{value:e.getColumn(m.key)?.getFilterValue()??"",onValueChange:b=>e.getColumn(m.key)?.setFilterValue(b==="all"?"":b),children:[m.icon&&(0,c.jsx)("span",{children:(0,c.jsx)(m.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),(0,c.jsx)(Ee,{className:a("h-9 rounded-lg w-full",m.icon&&"pl-9"),children:(0,c.jsx)(He,{placeholder:m.placeholder})}),(0,c.jsxs)(je,{className:"rounded-lg",children:[(0,c.jsx)(Ce,{value:"all",children:"All"}),m.options?.map(b=>(0,c.jsx)(Ce,{value:b.value,children:b.label},b.label))]})]}):(0,c.jsxs)("div",{className:"relative",children:[m.icon&&(0,c.jsx)("span",{children:(0,c.jsx)(m.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"})}),(0,c.jsx)(rt,{placeholder:m.placeholder,value:e.getColumn(m.key)?.getFilterValue()??"",onChange:b=>e.getColumn(m.key)?.setFilterValue(b.target.value),className:a("h-9 rounded-lg",m.icon&&"pl-9"),type:m.type==="number"?"number":m.type==="date"?"date":"text"})]})},m.key))]})}),(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[s&&(0,c.jsxs)("div",{className:"relative",children:[(0,c.jsx)(J.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,c.jsx)(rt,{placeholder:"Global search...",value:o??"",onChange:m=>n(m.target.value),className:"pl-9 max-w-max"})]}),i&&(0,c.jsxs)(v,{variant:"outline",size:"sm",onClick:()=>i(f),className:"rounded-lg",children:[(0,c.jsx)(J.Download,{className:"mr-2 h-4 w-4"}),"Export"]}),y&&(0,c.jsxs)(ye,{children:[(0,c.jsx)(we,{asChild:!0,children:(0,c.jsxs)(v,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[(0,c.jsx)("span",{children:"Columns"}),(0,c.jsx)(J.ChevronDown,{className:"h-4 w-4 opacity-50"})]})}),(0,c.jsxs)(Ne,{align:"end",className:"w-[220px] rounded-lg max-h-[400px] overflow-y-auto",children:[(0,c.jsx)(le,{className:"px-4 py-2 text-sm font-medium",children:"Toggle Columns"}),(0,c.jsx)(de,{}),k().length>0&&(0,c.jsxs)(Ut,{children:[(0,c.jsx)(le,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:"General"}),k().map(m=>(0,c.jsx)(At,{className:"text-sm",checked:m.getIsVisible(),onCheckedChange:b=>m.toggleVisibility(!!b),children:B(m.id)},m.id))]}),A().map(m=>(0,c.jsxs)(Ut,{children:[(0,c.jsx)(de,{}),(0,c.jsx)(le,{className:"px-4 py-1.5 text-sm font-medium text-muted-foreground",children:m.id}),m.columns?.filter(b=>b.getCanHide?.()!==!1).map(b=>(0,c.jsx)(At,{className:"text-sm",checked:b.getIsVisible(),onCheckedChange:j=>b.toggleVisibility(!!j),children:B(b.id,m.id)},b.id))]},m.id))]})]}),(0,c.jsxs)(ye,{children:[(0,c.jsx)(we,{asChild:!0,children:(0,c.jsx)(v,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,c.jsx)(J.Settings2,{className:"h-4 w-4"})})}),(0,c.jsxs)(Ne,{align:"end",className:"w-[200px] rounded-lg",children:[(0,c.jsx)(le,{children:"Table Settings"}),(0,c.jsx)(de,{}),(0,c.jsxs)(X,{onClick:u,children:[(0,c.jsx)(J.ArrowUpDown,{className:"mr-2 h-4 w-4"}),"Clear All Sorting"]}),(0,c.jsxs)(X,{onClick:T,children:[(0,c.jsx)(J.Filter,{className:"mr-2 h-4 w-4"}),"Clear All Filters"]}),_&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(de,{}),(0,c.jsx)(le,{children:"Column Pinning"}),(0,c.jsxs)(X,{onClick:()=>e.setColumnPinning({left:[],right:[]}),children:[(0,c.jsx)(J.PinOff,{className:"mr-2 h-4 w-4"}),"Reset All Pinning"]}),(0,c.jsxs)(X,{onClick:()=>{let m=z().filter(b=>b.getCanPin?.()!==!1).map(b=>b.id);e.setColumnPinning({left:m,right:[]})},children:[(0,c.jsx)(J.Pin,{className:"mr-2 h-4 w-4 rotate-90"}),"Pin All Left"]}),(0,c.jsxs)(X,{onClick:()=>{let m=z().filter(b=>b.getCanPin?.()!==!1).map(b=>b.id);e.setColumnPinning({left:[],right:m})},children:[(0,c.jsx)(J.Pin,{className:"mr-2 h-4 w-4 -rotate-90"}),"Pin All Right"]})]})]})]}),p&&(0,c.jsx)(v,{variant:"outline",size:"sm",onClick:p,disabled:C,className:"rounded-lg",children:(0,c.jsx)(J.RefreshCw,{className:a("h-4 w-4",C&&"animate-spin")})})]})]})})})})}var G=require("react/jsx-runtime");function Jt({table:e,config:t}){return t.enabled?(0,G.jsx)("div",{className:"rounded-xl",children:(0,G.jsx)("div",{children:(0,G.jsxs)("div",{className:"flex items-center justify-between",children:[(0,G.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:t.showInfo!==!1&&(0,G.jsxs)("span",{children:["Showing ",e.getState().pagination.pageIndex*e.getState().pagination.pageSize+1," to"," ",Math.min((e.getState().pagination.pageIndex+1)*e.getState().pagination.pageSize,e.getFilteredRowModel().rows.length)," ","of ",e.getFilteredRowModel().rows.length," entries"]})}),(0,G.jsxs)("div",{className:"flex items-center gap-4",children:[t.pageSizeOptions&&(0,G.jsxs)("div",{className:"flex items-center gap-2",children:[(0,G.jsx)("span",{className:"text-sm font-medium",children:"Rows per page:"}),(0,G.jsxs)(Ge,{value:`${e.getState().pagination.pageSize}`,onValueChange:o=>e.setPageSize(Number(o)),children:[(0,G.jsx)(Ee,{className:"h-9 w-[70px] rounded-lg",children:(0,G.jsx)(He,{})}),(0,G.jsx)(je,{side:"top",className:"rounded-lg",children:t.pageSizeOptions.map(o=>(0,G.jsx)(Ce,{value:`${o}`,children:o},o))})]})]}),(0,G.jsxs)("div",{className:"flex items-center gap-2",children:[(0,G.jsx)(v,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"First"}),(0,G.jsx)(v,{variant:"outline",size:"sm",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),className:"rounded-lg",children:"Previous"}),t.showPageNumbers&&(0,G.jsx)("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,e.getPageCount())},(o,n)=>{let s=e.getState().pagination.pageIndex,i=s-2+n+1;return i<1||i>e.getPageCount()?null:(0,G.jsx)(v,{variant:i===s+1?"default":"outline",size:"sm",className:"size-8 p-0 rounded-lg",onClick:()=>e.setPageIndex(i-1),children:i},i)})}),(0,G.jsx)(v,{variant:"outline",size:"sm",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Next"}),(0,G.jsx)(v,{variant:"outline",size:"sm",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),className:"rounded-lg",children:"Last"})]})]})]})})}):null}var Ro=require("radix-ui"),Mo=require("class-variance-authority");var zo=require("react/jsx-runtime"),Pa=(0,Mo.cva)("inline-flex cursor-pointer items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{sm:"h-7 px-0 min-w-7",default:"h-8 px-1 min-w-8",lg:"h-9 px-2 min-w-10"},bg:{enabled:"data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",disabled:""}},defaultVariants:{variant:"default",size:"default",bg:"enabled"}});function Ao({className:e,variant:t,size:o,noBg:n,...s}){return(0,zo.jsx)(Ro.Toggle.Root,{"data-slot":"toggle",className:a(Pa({className:e,variant:t,size:o,bg:n?"disabled":"enabled"})),...s})}var qt=require("radix-ui"),Io=require("lucide-react");var zt=require("react/jsx-runtime");function ft({className:e,...t}){return(0,zt.jsx)(qt.Checkbox.Root,{"data-slot":"checkbox",className:a("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:(0,zt.jsx)(qt.Checkbox.Indicator,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:(0,zt.jsx)(Io.CheckIcon,{className:"size-3.5"})})})}var Z=require("react"),r=require("react/jsx-runtime");function Xt({data:e,columns:t,filters:o=[],pagination:n={enabled:!1},settings:s={},header:i,footer:p,className:C="",maxHeight:y="600px",loading:f=!1,error:u,emptyMessage:T="No data available",onRowSelectionChange:_,onExport:z,onRefresh:A,onTableReady:k,children:B}){let[m,b]=(0,Z.useState)([]),[j,h]=(0,Z.useState)([]),[F,Ie]=(0,Z.useState)({}),[Be,fe]=(0,Z.useState)({}),[be,Se]=(0,Z.useState)(""),[oe,Fe]=(0,Z.useState)([]),[re,qe]=(0,Z.useState)(s.enableColumnPinning?{left:[],right:[]}:{}),{enableSorting:tt=!0,enableFiltering:De=!0,enableGlobalFilter:ct=!0,enableColumnVisibility:ve=!0,enableRowSelection:ee=!0,stickyHeader:Xe=!0,toolbar:Ct=!1,showSerialNumbers:Y=!0,fixedCheckboxColumn:ke=!0,striped:ot=!0,hoverable:at=!0,compact:Re=!0,bordered:yt=!0,fullHeight:wt=!1,enableColumnResizing:Ht=!1,enableColumnPinning:R=!0,hideHeader:Nt=!1}=s,mt=(0,Z.useMemo)(()=>{let S=[...t],W=M=>M.map(d=>{if(d.id==="select"||d.id==="serialNumber")return d;let x={...d,enablePinning:!0};return d.columns&&(x.columns=W(d.columns)),x}),l=W(S);if(ee){let M={id:"select",header:({table:d})=>(0,r.jsx)(ft,{checked:d.getIsAllPageRowsSelected()||d.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:x=>d.toggleAllPageRowsSelected(!!x),"aria-label":"Select all"}),cell:({row:d})=>(0,r.jsx)("div",{className:a("flex items-center justify-center"),children:(0,r.jsx)(ft,{checked:d.getIsSelected(),onCheckedChange:x=>d.toggleSelected(!!x),"aria-label":"Select row"})}),enableSorting:!1,enableHiding:!1,enablePinning:!0,headerAlign:"center",size:10};l.unshift(M)}if(Y){let M={id:"serialNumber",header:"No.",cell:({row:d})=>(0,r.jsx)("div",{className:"text-center font-medium text-muted-foreground",children:d.index+1}),enableSorting:!0,enableHiding:!1,enablePinning:!0,size:60,headerAlign:"center"};l.unshift(M)}return l},[t,Y,ee,ke]),$=(0,ne.useReactTable)({data:e,columns:mt,onSortingChange:tt?b:void 0,onColumnFiltersChange:De?h:void 0,onGlobalFilterChange:ct?Se:void 0,getCoreRowModel:(0,ne.getCoreRowModel)(),getPaginationRowModel:n.enabled?(0,ne.getPaginationRowModel)():void 0,getSortedRowModel:tt?(0,ne.getSortedRowModel)():void 0,getFilteredRowModel:De?(0,ne.getFilteredRowModel)():void 0,onColumnVisibilityChange:ve?Ie:void 0,onRowSelectionChange:ee?fe:void 0,onColumnOrderChange:Fe,onColumnPinningChange:R?qe:void 0,state:{sorting:tt?m:void 0,columnFilters:De?j:void 0,columnVisibility:ve?F:void 0,rowSelection:ee?Be:{},globalFilter:be,columnOrder:oe,columnPinning:R?re:{}},initialState:{pagination:n.enabled?{pageSize:n.pageSize||10}:void 0,columnPinning:R?{left:[...Y?["serialNumber"]:[],...ee?["select"]:[]],right:[]}:void 0},enableRowSelection:ee,enableColumnResizing:Ht,enableColumnPinning:R,columnResizeMode:"onChange"});(0,Z.useEffect)(()=>{k&&k($)},[$,k]),(0,Z.useEffect)(()=>{if(ee&&_){let S=$.getFilteredSelectedRowModel().rows.map(W=>W.original);_(S)}},[Be,ee,_,$]);let Pt=(0,Z.useCallback)(()=>{b([])},[]),Et=(0,Z.useCallback)(()=>{h([]),Se("")},[]),Tt=(S,W)=>{if(!R)return;let l=[...Y?["serialNumber"]:[],...ee&&ke?["select"]:[]],M={left:[...(re.left??[]).filter(d=>l.includes(d))],right:[...re.right??[]]};W===!1?(M.left=M.left.filter(d=>d!==S),M.right=M.right.filter(d=>d!==S)):W==="right"?(M.left=M.left.filter(d=>d!==S),M.right.includes(S)||M.right.push(S)):W==="left"&&(M.right=M.right.filter(d=>d!==S),!M.left.includes(S)&&!l.includes(S)&&M.left.push(S)),$.setColumnPinning(M)},St=()=>(0,r.jsx)(Po,{className:a(Xe&&"sticky top-0 bg-sidebar z-20"),children:$.getHeaderGroups().map((S,W)=>(0,r.jsx)(gt,{className:"hover:bg-transparent",children:S.headers.map((l,M)=>{let d=l.depth===0&&l.colSpan>1,x=R&&(l.column.getIsPinned()==="left"||l.column.id==="serialNumber"||l.column.id==="select"&&ee),w=R&&l.column.getIsPinned()==="right",q=l.column.getCanSort(),te=R&&l.column.columnDef.enablePinning!==!1,ie=l.column.id==="serialNumber",Me=l.column.id==="select",Le=ie||Me&&ke,nt=l.column.columnDef.headerAlign||"left",ua={left:"justify-start",center:"justify-center",right:"justify-end"}[nt];return(0,r.jsxs)(Do,{colSpan:l.colSpan,className:a("font-semibold text-foreground bg-sidebar group px-0",!Re&&"py-2",yt&&M<S.headers.length-1&&"border-r","relative",x&&"sticky left-0 z-15 bg-sidebar",w&&"sticky right-0 z-15 bg-sidebar",(ie||Me)&&"sticky left-0 z-15 bg-sidebar",d?"text-center":"text-left"),style:{width:l.getSize()!==150?l.getSize():"auto",minWidth:l.getSize()!==150?l.getSize():"auto",...x&&{left:ie?0:Me?Y&&$.getColumn("serialNumber")?.getSize()||0:Dt(l.column)},...w&&{right:pt(l.column)},...ie&&{left:0}},children:[d?(0,r.jsx)("div",{className:"flex items-center justify-center",children:(0,ne.flexRender)(l.column.columnDef.header,l.getContext())}):(0,r.jsxs)("div",{className:a("relative flex items-center w-full px-2",ua),children:[(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[q&&nt==="right"&&(0,r.jsx)("span",{className:"ml-1 order-2",children:l.column.getIsSorted()&&{asc:(0,r.jsx)(K.ChevronUp,{className:"h-4 w-4"}),desc:(0,r.jsx)(K.ChevronDown,{className:"h-4 w-4"})}[l.column.getIsSorted()]}),l.isPlaceholder?null:(0,ne.flexRender)(l.column.columnDef.header,l.getContext()),q&&nt!=="right"&&l.column.getIsSorted()&&(0,r.jsx)("span",{className:"ml-1 order-2",children:l.column.getIsSorted()&&{asc:(0,r.jsx)(K.ChevronUp,{className:"h-4 w-4"}),desc:(0,r.jsx)(K.ChevronDown,{className:"h-4 w-4"})}[l.column.getIsSorted()]})]}),(q||te&&!Le)&&(0,r.jsxs)(ye,{children:[(0,r.jsx)(we,{asChild:!0,className:a("absolute",nt==="left"&&"right-1",nt==="center"&&"right-1",nt==="right"&&"left-1"),children:(0,r.jsx)(Ao,{variant:"default",size:"sm",noBg:!0,tabIndex:-1,className:"opacity-0 group-hover:opacity-70 hover:opacity-100 data-[state=open]:opacity-100",children:(0,r.jsx)(K.MoreHorizontal,{className:"h-4 w-4"})})}),(0,r.jsxs)(Ne,{align:"end",className:"w-48",children:[q&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le,{children:"Sorting"}),(0,r.jsxs)(X,{onClick:()=>l.column.toggleSorting(!1),children:[(0,r.jsx)(K.ChevronUp,{className:"mr-2 h-4 w-4"}),"Sort Ascending"]}),(0,r.jsxs)(X,{onClick:()=>l.column.toggleSorting(!0),children:[(0,r.jsx)(K.ChevronDown,{className:"mr-2 h-4 w-4"}),"Sort Descending"]}),(0,r.jsxs)(X,{onClick:()=>l.column.clearSorting(),disabled:!l.column.getIsSorted(),children:[(0,r.jsx)(K.ChevronsUpDown,{className:"mr-2 h-4 w-4"}),"Clear Sort"]}),(0,r.jsx)(de,{})]}),te&&!Le&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(le,{children:"Pin Column"}),(0,r.jsxs)(X,{onClick:()=>Tt(l.column.id,"right"),disabled:l.column.getIsPinned()==="right",children:[(0,r.jsx)(K.MoveRightIcon,{}),"Pin Right"]}),(0,r.jsxs)(X,{onClick:()=>Tt(l.column.id,!1),disabled:!l.column.getIsPinned(),children:[(0,r.jsx)(K.PinOffIcon,{}),"Unpin"]})]})]})]})]}),Ht&&l.column.getCanResize()&&!d&&l.colSpan===1&&(0,r.jsx)("div",{className:"absolute right-0 top-0 h-full w-1 bg-border hover:bg-primary cursor-col-resize opacity-0 hover:opacity-100 transition-opacity",onMouseDown:l.getResizeHandler()})]},l.id)})},S.id))}),Dt=S=>{if(!R)return;let W=0,l=$.getLeftHeaderGroups()[0]?.headers||[],M=[...Y?["serialNumber"]:[],...ee?["select"]:[]];for(let d of l){if(d.id===S.id)break;if(M.includes(d.id)){let x=$.getColumn(d.id);x&&(W+=x.getSize())}}return W},pt=S=>{if(!R)return;let W=$.getState().columnPinning.right||[],l=W.indexOf(S.id);if(l===-1)return;let M=0;for(let d=l+1;d<W.length;d++){let x=$.getColumn(W[d]);x&&(M+=x.getSize())}return M};return u?(0,r.jsx)(he,{className:"w-full rounded-xl shadow-sm",children:(0,r.jsx)(xe,{className:"flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:u}),A&&(0,r.jsxs)(v,{variant:"outline",size:"sm",onClick:A,className:"rounded-lg",children:[(0,r.jsx)(K.Loader2,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):(0,r.jsx)(Ye,{children:(0,r.jsxs)("div",{className:a("w-full space-y-2 flex flex-col h-full",C),children:[i&&(0,r.jsx)(he,{className:"rounded-2xl py-2 sticky top-0 z-20",children:(0,r.jsx)(xe,{className:"px-2",children:i})}),Ct&&(0,r.jsx)(Wt,{table:$,filters:o,globalFilter:be,onGlobalFilterChange:Se,enableGlobalFilter:ct,onExport:z,onRefresh:A,loading:f,enableColumnVisibility:ve,enableColumnPinning:R,data:e,onClearSorting:Pt,onClearFilters:Et}),(0,r.jsx)(he,{className:a("shadow-sm overflow-auto py-0",wt&&"flex-1"),children:(0,r.jsx)(xe,{className:"p-0 h-full",children:(0,r.jsxs)("div",{className:"relative flex flex-col h-full justify-between",children:[f&&(0,r.jsx)("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-xl",children:(0,r.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[(0,r.jsx)(K.Loader2,{className:"size-5 animate-spin text-primary"}),(0,r.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),(0,r.jsx)("div",{className:"relative rounded-t-xl overflow-auto border-b",children:(0,r.jsxs)(jt,{className:"border-collapse w-full",children:[!Nt&&St(),(0,r.jsx)(To,{children:$.getRowModel().rows?.length?$.getRowModel().rows.map((S,W)=>(0,r.jsx)(gt,{"data-state":S.getIsSelected()&&"selected",className:a(at&&"hover:bg-muted/50",ot&&W%2===0&&"bg-muted/20",S.getIsSelected()&&"bg-muted","border-b last:border-b-0"),children:S.getVisibleCells().map((l,M)=>{let d=R&&(l.column.getIsPinned()==="left"||l.column.id==="serialNumber"||l.column.id==="select"&&ee),x=R&&l.column.getIsPinned()==="right",w=l.column.id==="serialNumber",q=l.column.id==="select",te=w||q&&ke;return(0,r.jsx)(Rt,{className:a(Re?"py-2":"py-4",yt&&M<S.getVisibleCells().length&&"border-r",d&&"sticky left-0 z-10 bg-sidebar/97",x&&"sticky right-0 z-10 bg-sidebar/97",w&&"sticky left-0 z-10 bg-sidebar/97","p-1"),style:{width:l.column.getSize()!==150?l.column.getSize():"auto",minWidth:l.column.getSize()!==150?l.column.getSize():"auto",...d&&{left:w?0:q?Y&&$.getColumn("serialNumber")?.getSize()||0:Dt(l.column)},...x&&{right:pt(l.column)},...w&&{left:0}},children:(0,ne.flexRender)(l.column.columnDef.cell,l.getContext())},l.id)})},S.id)):(0,r.jsx)(gt,{children:(0,r.jsx)(Rt,{colSpan:mt.length,className:"h-32 text-center border-0",children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,r.jsx)("div",{className:"text-muted-foreground text-5xl",children:"\u{1F4CB}"}),(0,r.jsx)("p",{className:"text-muted-foreground font-medium",children:T})]})})})})]})}),p&&(0,r.jsx)("div",{className:"sticky bottom-0 bg-sidebar w-full z-20",style:{width:"100%",minWidth:"fit-content"},children:(0,r.jsx)(jt,{children:(0,r.jsx)(So,{children:(0,r.jsx)(gt,{className:"bg-sidebar",children:(0,r.jsx)(Rt,{colSpan:mt.length,className:"p-2",children:p})})})})})]})})}),(0,r.jsx)(Jt,{table:$,config:n}),B&&B($)]})})}var Bo=require("radix-ui");var Fo=require("react/jsx-runtime");function bt({className:e,orientation:t="horizontal",decorative:o=!0,...n}){return(0,Fo.jsx)(Bo.Separator.Root,{"data-slot":"separator-root",decorative:o,orientation:t,className:a("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...n})}var It=require("lucide-react"),Bt=require("framer-motion"),$e=ut(require("react"),1),Lo=ut(require("react-dom"),1),H=require("react/jsx-runtime");function Kt({table:e,visible:t,container:o,children:n,className:s,...i}){let[p,C]=$e.useState(!1);$e.useLayoutEffect(()=>{C(!0)},[]),$e.useEffect(()=>{function u(T){T.key==="Escape"&&e&&e.toggleAllRowsSelected(!1)}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[e]);let y=o??(p?globalThis.document?.body:null);if(!y||!e)return null;let f=t??e.getFilteredSelectedRowModel().rows.length>0;return Lo.createPortal((0,H.jsx)(Bt.AnimatePresence,{children:f&&(0,H.jsx)(Bt.motion.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:a("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-5 ring-primary/5",s),...i,children:(0,H.jsxs)(Ye,{children:["1",n]})})}),y)}function Yt({size:e="sm",tooltip:t,isPending:o,disabled:n,className:s,children:i,...p}){let C=(0,H.jsx)(v,{variant:"secondary",size:e,className:a("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",s),disabled:n||o,...p,children:o?(0,H.jsx)(It.Loader,{className:"animate-spin"}):i});return t?(0,H.jsxs)(Oe,{children:[(0,H.jsx)(Ve,{asChild:!0,children:C}),(0,H.jsx)(_e,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,H.jsx)("p",{children:t})})]}):C}function Zt({table:e}){let t=$e.useCallback(()=>{e&&e.toggleAllRowsSelected(!1)},[e]);return e?(0,H.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,H.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[e.getFilteredSelectedRowModel().rows.length," selected"]}),(0,H.jsx)(bt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,H.jsxs)(Oe,{children:[(0,H.jsx)(Ve,{asChild:!0,children:(0,H.jsx)(v,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,H.jsx)(It.X,{className:"size-3.5"})})}),(0,H.jsxs)(_e,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foregroun bg-secondary [&>span]:hidden",children:[(0,H.jsx)("p",{children:"Clear selection"}),(0,H.jsx)("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:(0,H.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]}):null}var Oo=require("lucide-react");var Vo=require("react/jsx-runtime");var _o=require("lucide-react");var Go=require("react/jsx-runtime");var Ta=require("radix-ui"),Ho=require("class-variance-authority");var Sa=require("react/jsx-runtime"),jn=(0,Ho.cva)("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});var Ra=require("cmdk"),Ma=require("lucide-react");var Da=require("radix-ui"),ka=require("lucide-react");var Eo=require("react/jsx-runtime");var jo=require("react/jsx-runtime");var Aa=require("radix-ui");var za=require("react/jsx-runtime");var $o=require("lucide-react"),Qt=require("react/jsx-runtime");var I=require("react"),to=require("lucide-react");var me=require("lucide-react");var g=require("react/jsx-runtime");function eo({fields:e,filters:t,globalFilter:o,onGlobalFilterChange:n,fieldFilters:s,onFieldFilterChange:i,sortField:p,sortDirection:C,onSortChange:y,selectedCount:f,totalCount:u,visibleCount:T,onExport:_,onRefresh:z,loading:A,onClearFilters:k,onClearSorting:B}){let m=e.filter(h=>h.sortable),b=Object.values(s).some(h=>h!=null&&h!=="")||o!=="",j=p!=="";return(0,g.jsx)("div",{className:"rounded-xl p-0.5",children:(0,g.jsx)("div",{className:"px-2",children:(0,g.jsx)("div",{className:"flex flex-col gap-6",children:(0,g.jsxs)("div",{className:"flex items-center justify-between",children:[(0,g.jsx)("div",{className:"flex items-center gap-3",children:t.length>0&&(0,g.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,g.jsx)("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:(0,g.jsx)(me.Filter,{className:"h-4 w-4"})}),t.map(h=>(0,g.jsx)("div",{className:"relative min-w-[150px]",children:h.type==="select"?(0,g.jsxs)(Ge,{value:s[h.key]||"all",onValueChange:F=>i(h.key,F),children:[h.icon&&(0,g.jsx)(h.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,g.jsx)(Ee,{className:a("h-9 rounded-lg w-full",h.icon&&"pl-9"),children:(0,g.jsx)(He,{placeholder:h.placeholder||"Select..."})}),(0,g.jsxs)(je,{className:"rounded-lg",children:[(0,g.jsx)(Ce,{value:"all",children:"All"}),h.options?.map(F=>(0,g.jsx)(Ce,{value:F.value,children:F.label},F.value))]})]}):(0,g.jsxs)("div",{className:"relative",children:[h.icon&&(0,g.jsx)(h.icon,{className:"size-4 absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,g.jsx)(rt,{type:h.type,placeholder:h.placeholder,value:s[h.key]||"",onChange:F=>i(h.key,F.target.value),className:a("h-9 rounded-lg",h.icon&&"pl-9")})]})},String(h.key)))]})}),(0,g.jsxs)("div",{className:"flex items-center gap-2",children:[(0,g.jsxs)("div",{className:"relative",children:[(0,g.jsx)(me.Search,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),(0,g.jsx)(rt,{placeholder:"Global search...",value:o,onChange:h=>n(h.target.value),className:"pl-9 h-9 rounded-lg max-w-max"})]}),m.length>0&&(0,g.jsxs)(ye,{children:[(0,g.jsx)(we,{asChild:!0,children:(0,g.jsxs)(v,{variant:"outline",size:"sm",className:"rounded-lg gap-1",children:[(0,g.jsx)("span",{children:"Sort"}),(0,g.jsx)(me.ChevronDown,{className:"h-4 w-4 opacity-50"})]})}),(0,g.jsxs)(Ne,{align:"end",className:"w-[200px] rounded-lg",children:[(0,g.jsx)(le,{children:"Sort By"}),(0,g.jsx)(de,{}),m.map(h=>(0,g.jsxs)("div",{children:[(0,g.jsxs)(X,{onClick:()=>y(h.key,"asc"),children:[h.label," (A-Z)"]}),(0,g.jsxs)(X,{onClick:()=>y(h.key,"desc"),children:[h.label," (Z-A)"]})]},String(h.key))),j&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(de,{}),(0,g.jsx)(X,{onClick:B,children:"Clear All Sorting"})]})]})]}),(0,g.jsxs)(ye,{children:[(0,g.jsx)(we,{asChild:!0,children:(0,g.jsx)(v,{variant:"outline",size:"sm",className:"rounded-lg",children:(0,g.jsx)(me.Settings2,{className:"h-4 w-4"})})}),(0,g.jsxs)(Ne,{align:"end",className:"w-[200px] rounded-lg",children:[(0,g.jsx)(le,{children:"Table Settings"}),(0,g.jsx)(de,{}),(0,g.jsx)(X,{onClick:B,children:"Clear All Sorting"}),(0,g.jsx)(X,{onClick:k,children:"Clear All Filters"})]})]}),_&&(0,g.jsxs)(v,{variant:"outline",size:"sm",onClick:_,className:"rounded-lg",children:[(0,g.jsx)(me.Download,{className:"mr-2 h-4 w-4"}),"Export"]}),z&&(0,g.jsx)(v,{variant:"outline",size:"sm",onClick:z,disabled:A,className:"rounded-lg",children:(0,g.jsx)(me.RefreshCw,{className:a("h-4 w-4",A&&"animate-spin")})})]})]})})})})}var Ue=require("lucide-react");var P=require("react/jsx-runtime");function Uo({currentPage:e,totalPages:t,pageSize:o,totalItems:n,onPageChange:s,onPageSizeChange:i,config:p}){if(!p.enabled)return null;let C=p.pageSizeOptions||[10,20,50,100],y=(e-1)*o+1,f=Math.min(e*o,n),u=e>1,T=e<t,_=()=>{let A=[],k=[];for(let B=Math.max(2,e-2);B<=Math.min(t-1,e+2);B++)A.push(B);return e-2>2?k.push(1,"..."):k.push(1),k.push(...A),e+2<t-1?k.push("...",t):t>1&&k.push(t),k};return(0,P.jsx)("div",{className:"rounded-xl",children:(0,P.jsxs)("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4",children:[(0,P.jsx)("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:p.showInfo!==!1&&(0,P.jsxs)("span",{children:["Showing ",y," to ",f," of ",n," entries"]})}),(0,P.jsxs)("div",{className:"flex flex-col sm:flex-row items-center gap-4",children:[C&&(0,P.jsxs)("div",{className:"flex items-center gap-2",children:[(0,P.jsx)("span",{className:"text-sm font-medium whitespace-nowrap",children:"Page size:"}),(0,P.jsxs)(Ge,{value:`${o}`,onValueChange:z=>i(Number(z)),children:[(0,P.jsx)(Ee,{className:"h-9 w-[70px] rounded-lg",children:(0,P.jsx)(He,{})}),(0,P.jsx)(je,{side:"top",className:"rounded-lg",children:C.map(z=>(0,P.jsx)(Ce,{value:`${z}`,children:z},z))})]})]}),(0,P.jsxs)("div",{className:"flex items-center gap-2",children:[(0,P.jsxs)(v,{variant:"outline",size:"sm",onClick:()=>s(1),disabled:!u,className:"hidden sm:flex rounded-lg",children:[(0,P.jsx)(Ue.ChevronsLeft,{className:"h-4 w-4"}),(0,P.jsx)("span",{className:"sr-only",children:"Go to first page"})]}),(0,P.jsxs)(v,{variant:"outline",size:"sm",onClick:()=>s(e-1),disabled:!u,className:"rounded-lg",children:[(0,P.jsx)(Ue.ChevronLeft,{className:"h-4 w-4 sm:mr-2"}),(0,P.jsx)("span",{className:"hidden sm:inline",children:"Previous"}),(0,P.jsx)("span",{className:"sr-only sm:hidden",children:"Go to previous page"})]}),p.showPageNumbers&&t>1&&(0,P.jsx)("div",{className:"hidden sm:flex items-center gap-1",children:_().map((z,A)=>{if(z==="...")return(0,P.jsx)("span",{className:"px-2 py-1 text-sm text-muted-foreground",children:"..."},`dots-${A}`);let k=z;return(0,P.jsx)(v,{variant:k===e?"default":"outline",size:"sm",className:"w-9 h-9 p-0 rounded-lg",onClick:()=>s(k),children:k},k)})}),(0,P.jsxs)("div",{className:"sm:hidden flex items-center gap-2 px-3 py-1 text-sm font-medium bg-muted rounded-lg",children:[e," of ",t]}),(0,P.jsxs)(v,{variant:"outline",size:"sm",onClick:()=>s(e+1),disabled:!T,className:"rounded-lg",children:[(0,P.jsx)("span",{className:"hidden sm:inline",children:"Next"}),(0,P.jsx)(Ue.ChevronRight,{className:"h-4 w-4 sm:ml-2"}),(0,P.jsx)("span",{className:"sr-only sm:hidden",children:"Go to next page"})]}),(0,P.jsxs)(v,{variant:"outline",size:"sm",onClick:()=>s(t),disabled:!T,className:"hidden sm:flex rounded-lg",children:[(0,P.jsx)(Ue.ChevronsRight,{className:"h-4 w-4"}),(0,P.jsx)("span",{className:"sr-only",children:"Go to last page"})]})]})]})]})})}var D=require("react/jsx-runtime");function oo({data:e,template:t,fields:o=[],filters:n=[],pagination:s={enabled:!1},settings:i={},header:p,footer:C,className:y="",loading:f=!1,error:u,emptyMessage:T="No items found",emptyIcon:_,onSelectionChange:z,onExport:A,onRefresh:k,onTemplateReady:B,children:m}){let{enableSorting:b=!0,enableFiltering:j=!0,enableGlobalSearch:h=!0,enableSelection:F=!1,enableExport:Ie=!1,toolbar:Be=!0,selectionMode:fe="multiple",gridCols:be={default:3,sm:1,md:2,lg:3,xl:4,"2xl":6},gap:Se=4,aspectRatio:oe="auto",minCardWidth:Fe=350,maxCardWidth:re=350}=i,[qe,tt]=(0,I.useState)(""),[De,ct]=(0,I.useState)({}),[ve,ee]=(0,I.useState)(""),[Xe,Ct]=(0,I.useState)("asc"),[Y,ke]=(0,I.useState)(new Set),[ot,at]=(0,I.useState)(1),[Re,yt]=(0,I.useState)(s.pageSize||12),[wt,Ht]=(0,I.useState)(be.default),R=(0,I.useMemo)(()=>{let d=[...e];if(h&&qe){let x=o.filter(w=>w.searchable!==!1);d=d.filter(w=>x.some(q=>w[q.key]?.toString().toLowerCase().includes(qe.toLowerCase())))}if(j&&Object.keys(De).forEach(x=>{let w=De[x];if(w!=null&&w!==""){let q=o.find(te=>te.key===x);q&&(d=d.filter(te=>{let ie=te[x];return q.type==="boolean"?ie===(w==="true"):q.type==="number"?ie===Number(w):ie?.toString().toLowerCase().includes(String(w).toLowerCase())}))}}),b&&ve){let x=o.find(w=>w.key===ve);x&&d.sort((w,q)=>{let te=w[ve],ie=q[ve];if(x.type==="number")return Xe==="asc"?Number(te)-Number(ie):Number(ie)-Number(te);if(x.type==="date"){let Me=new Date(te),Le=new Date(ie);return Xe==="asc"?Me.getTime()-Le.getTime():Le.getTime()-Me.getTime()}else{let Me=String(te).toLowerCase(),Le=String(ie).toLowerCase();return Xe==="asc"?Me.localeCompare(Le):Le.localeCompare(Me)}})}return d},[e,qe,De,ve,Xe,o,h,j,b]),Nt=(0,I.useMemo)(()=>{if(!s.enabled)return R;let d=(ot-1)*Re,x=d+Re;return R.slice(d,x)},[R,ot,Re,s.enabled]),mt=Math.ceil(R.length/Re),$=(0,I.useCallback)(d=>{F&&ke(x=>{let w=new Set(x);return fe==="single"?(w.clear(),w.add(d)):w.has(d)?w.delete(d):w.add(d),w})},[F,fe]),Pt=(0,I.useCallback)(()=>{!F||fe==="single"||(Y.size===R.length?ke(new Set):ke(new Set(R.map((d,x)=>x))))},[F,fe,Y.size,R.length]),Et=(0,I.useCallback)((d,x)=>{ct(w=>({...w,[d]:x})),at(1)},[]),Tt=(0,I.useCallback)((d,x)=>{ee(d),Ct(x)},[]),St=(0,I.useCallback)(()=>{tt(""),ct({}),at(1)},[]),Dt=(0,I.useCallback)(()=>{ee(""),Ct("asc")},[]),pt=(0,I.useMemo)(()=>({getSelectedItems:()=>Array.from(Y).map(d=>R[d]),clearSelection:()=>ke(new Set),selectAll:Pt,getFilteredData:()=>R,getTotalCount:()=>e.length,getVisibleCount:()=>R.length,refresh:()=>k?.(),exportData:()=>A?.(R)}),[Y,R,e.length,Pt,k,A]),S=(0,I.useRef)(null);S.current=pt,(0,I.useEffect)(()=>{B&&S.current&&B(S.current)},[]),(0,I.useEffect)(()=>{if(F&&z){let d=Array.from(Y).map(x=>R[x]);z(d)}},[Y]);let W=a("w-full","overflow-hidden",y),l=a("grid",`gap-${Se}`,"w-full","mx-auto","items-start"),M={gridTemplateColumns:wt===0?`repeat(auto-fill, minmax(clamp(${Fe}px, 30%, ${re}px), 1fr))`:`repeat(auto-fill, minmax(clamp(${Fe}px, calc(100%/${wt} - ${Se*4}px), ${re}px), 1fr))`,justifyItems:"center",alignItems:"stretch",gridAutoRows:"1fr",gridAutoFlow:"dense"};return u?(0,D.jsx)(he,{className:"w-full",children:(0,D.jsx)(xe,{className:"flex items-center justify-center py-12",children:(0,D.jsxs)("div",{className:"text-center",children:[(0,D.jsx)("div",{className:"text-red-500 mb-3 text-2xl",children:"\u26A0\uFE0F"}),(0,D.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:u}),k&&(0,D.jsxs)(v,{variant:"outline",size:"sm",onClick:k,children:[(0,D.jsx)(to.Loader2,{className:"mr-2 h-4 w-4"}),"Try Again"]})]})})}):(0,D.jsxs)("div",{className:a("w-full flex gap-2 flex-col h-full",W),children:[p&&(0,D.jsx)(he,{className:"shadow-sm border-0 py-0 text-xl font-bold",children:(0,D.jsx)(xe,{className:"p-2",children:p})}),Be&&(0,D.jsx)(eo,{fields:o,filters:n,globalFilter:qe,onGlobalFilterChange:tt,fieldFilters:De,onFieldFilterChange:Et,sortField:ve,sortDirection:Xe,onSortChange:Tt,selectedCount:Y.size,totalCount:e.length,visibleCount:R.length,onExport:Ie?()=>A?.(R):void 0,onRefresh:k,loading:f,onClearFilters:St,onClearSorting:Dt}),(0,D.jsx)(he,{className:"border-0 overflow-auto shadow-none py-0 p-2 flex-1",children:(0,D.jsx)(xe,{className:"px-0",children:(0,D.jsxs)("div",{className:"relative",children:[f&&(0,D.jsx)("div",{className:"absolute inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center rounded-lg",children:(0,D.jsxs)("div",{className:"flex items-center gap-3 bg-background/90 px-4 py-3 rounded-lg shadow-sm",children:[(0,D.jsx)(to.Loader2,{className:"size-5 animate-spin text-primary"}),(0,D.jsx)("span",{className:"text-sm font-medium text-muted-foreground",children:"Loading..."})]})}),Nt.length>0?(0,D.jsx)("div",{className:a(l),style:M,children:Nt.map((d,x)=>{let w=s.enabled?(ot-1)*Re+x:x,q=Y.has(w);return(0,D.jsxs)("div",{className:a("relative h-full w-full flex flex-col","transition-all duration-200 overflow-hidden","rounded-2xl","border border-border/20 hover:border-border/50",oe==="square"?"aspect-square":"",oe==="video"?"aspect-video":"",F?"cursor-pointer":"",q?"ring-2 ring-primary":""),onClick:()=>F&&$(w),children:[F&&fe==="multiple"&&(0,D.jsx)("div",{className:"absolute top-2 right-2 z-10",children:(0,D.jsx)(ft,{checked:q,onCheckedChange:()=>$(w),className:"bg-background/80 backdrop-blur-sm",onClick:te=>te.stopPropagation()})}),t(d,x,q,()=>$(w))]},w)})}):(0,D.jsxs)("div",{className:"flex flex-col gap-4 items-center justify-center py-12 text-center",children:[(0,D.jsx)("div",{className:"text-6xl",children:_||"\u{1F4CB}"}),(0,D.jsx)("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:T}),(qe||Object.values(De).some(d=>d))&&(0,D.jsx)(v,{variant:"outline",onClick:St,children:"Clear Filters"})]})]})})}),s.enabled&&(0,D.jsx)("div",{className:"pb-1",children:(0,D.jsx)(Uo,{currentPage:ot,totalPages:mt,pageSize:Re,totalItems:R.length,onPageChange:at,onPageSizeChange:d=>{yt(d),at(1)},config:s})}),C&&(0,D.jsx)("div",{className:"p-2 m-0.5",children:C}),m&&m(pt)]})}var Ft=require("lucide-react"),Lt=require("framer-motion"),We=ut(require("react"),1),Wo=ut(require("react-dom"),1),E=require("react/jsx-runtime");function ao({controller:e,visible:t,container:o,children:n,className:s,...i}){let[p,C]=We.useState(!1);We.useLayoutEffect(()=>{C(!0)},[]),We.useEffect(()=>{function T(_){_.key==="Escape"&&e&&e.clearSelection()}return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[e]);let y=o??(p?globalThis.document?.body:null);if(!y||!e)return null;let f=e.getSelectedItems(),u=t??f.length>0;return Wo.createPortal((0,E.jsx)(Lt.AnimatePresence,{children:u&&(0,E.jsx)(Lt.motion.div,{role:"toolbar","aria-orientation":"horizontal",initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.3,ease:"easeInOut"},className:a("fixed inset-x-0 bottom-6 z-50 mx-auto flex w-fit flex-wrap items-center justify-center gap-2 rounded-xl border bg-primary/10 backdrop-blur-sm p-3 text-foreground ring-8 ring-primary/5",s),...i,children:(0,E.jsx)(Ye,{children:n})})}),y)}function no({size:e="sm",variant:t="secondary",tooltip:o,isPending:n,disabled:s,className:i,children:p,onClick:C,...y}){let f=(0,E.jsx)(v,{variant:t,size:e,className:a("gap-1.5 rounded-lg border border-secondary bg-secondary/50 hover:bg-secondary/70 transition-all duration-200",e==="icon"?"size-8":"h-8 px-3",i),disabled:s||n,onClick:C,...y,children:n?(0,E.jsx)(Ft.Loader,{className:"animate-spin"}):p});return o?(0,E.jsxs)(Oe,{children:[(0,E.jsx)(Ve,{asChild:!0,children:f}),(0,E.jsx)(_e,{sideOffset:8,className:"rounded-lg border font-semibold text-foreground bg-secondary [&>span]:hidden",children:(0,E.jsx)("p",{children:o})})]}):f}function ro({controller:e}){let t=We.useCallback(()=>{e&&e.clearSelection()},[e]);if(!e)return null;let o=e.getSelectedItems();return(0,E.jsxs)("div",{className:"flex h-8 items-center rounded-lg border bg-muted/50 pr-1 pl-3",children:[(0,E.jsxs)("span",{className:"whitespace-nowrap text-sm font-medium",children:[o.length," selected"]}),(0,E.jsx)(bt,{orientation:"vertical",className:"mr-2 ml-3 data-[orientation=vertical]:h-4"}),(0,E.jsxs)(Oe,{children:[(0,E.jsx)(Ve,{asChild:!0,children:(0,E.jsx)(v,{variant:"ghost",size:"icon",className:"size-6 rounded-md",onClick:t,children:(0,E.jsx)(Ft.X,{className:"size-3.5"})})}),(0,E.jsxs)(_e,{sideOffset:10,className:"flex items-center gap-2 rounded-lg border px-3 py-2 font-semibold text-foreground bg-secondary [&>span]:hidden",children:[(0,E.jsx)("p",{children:"Clear selection"}),(0,E.jsx)("kbd",{className:"select-none rounded border bg-primary/50 px-2 py-1 font-mono font-normal text-[0.7rem] text-foreground shadow-sm",children:(0,E.jsx)("abbr",{title:"Escape",className:"no-underline",children:"Esc"})})]})]})]})}var qo=require("react/jsx-runtime"),Ia={none:"gap-0",tight:"gap-2",default:"gap-4",loose:"gap-6","extra-loose":"gap-8"},Ba={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},Jo=({children:e,className:t,spacing:o="tight",padding:n="none"})=>(0,qo.jsx)("div",{className:a("flex flex-col h-full",Ia[o],Ba[n],t),children:e});var vt=require("lucide-react");var Xo=require("react-router"),L=require("react/jsx-runtime"),Ko=({className:e,columns:t=[],showBackButton:o=!0,meta:n={title:""}})=>{let s=()=>{if(!n.backAction||!o)return null;let u={variant:"secondary",size:"icon",className:"hover:bg-primary/20 inline-flex"};return n.backAction.href?(0,L.jsx)(Xo.NavLink,{to:n.backAction.href,children:(0,L.jsxs)(v,{...u,children:[(0,L.jsx)(vt.ArrowLeftIcon,{className:"size-6"}),n.backAction.content]})}):(0,L.jsxs)(v,{...u,onClick:n.backAction.onClick,children:[(0,L.jsx)(vt.ArrowLeftIcon,{className:"size-6"}),n.backAction.content]})},i=()=>!n.metadata||n.metadata.length===0?null:(0,L.jsx)("div",{className:"flex gap-4",children:n.metadata.map((u,T)=>u.value&&(0,L.jsxs)("div",{className:"text-sm",children:[(0,L.jsxs)("span",{className:"text-muted-foreground",children:[u.label," "]}),(0,L.jsx)("span",{children:u.value})]},T))}),p=()=>n.status?(0,L.jsx)("span",{className:a("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",{success:"bg-green-100 text-green-800",warning:"bg-yellow-100 text-yellow-800",critical:"bg-red-100 text-red-800",info:"bg-blue-100 text-blue-800",default:"bg-gray-100 text-gray-800"}[n.status.color]),children:n.status.content}):null,C={content:(0,L.jsxs)("div",{className:"flex gap-2 items-center",children:[s(),(0,L.jsxs)("div",{className:"flex flex-col gap-2 w-max",children:[(0,L.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:n.title}),p(),n.description&&(0,L.jsx)("p",{className:"text-muted-foreground",children:n.description}),i(),n.breadcrumbs&&n.breadcrumbs.length>0&&(0,L.jsx)("div",{className:"flex items-center text-sm text-muted-foreground",children:n.breadcrumbs.map((u,T)=>(0,L.jsxs)("div",{className:"flex items-center",children:[u.href?(0,L.jsx)("span",{className:"hover:text-primary hover:underline",children:u.label}):(0,L.jsx)("span",{children:u.label}),T<n.breadcrumbs.length-1&&(0,L.jsx)(vt.ChevronRight,{className:"mx-2 h-4 w-4"})]},T))})]})]}),align:"left",width:"fill"},y={content:n.primaryActions,align:"right",width:"auto"},f=[C,...t.filter(u=>u!==void 0),y];return(0,L.jsx)("div",{className:a("flex items-center w-full gap-4 p-2",e),children:f.map((u,T)=>(0,L.jsx)("div",{className:a("flex items-center h-full",u.className,{"justify-start":u.align==="left","justify-center":u.align==="center","justify-end":u.align==="right","flex-1":u.width==="fill"}),children:u.content},T))})};var Je=ut(require("react"),1);var Qe=require("radix-ui"),Yo=require("lucide-react");var pe=require("react/jsx-runtime");function Zo({...e}){return(0,pe.jsx)(Qe.Dialog.Root,{"data-slot":"sheet",...e})}function Qo({...e}){return(0,pe.jsx)(Qe.Dialog.Trigger,{"data-slot":"sheet-trigger",...e})}function io({...e}){return(0,pe.jsx)(Qe.Dialog.Portal,{"data-slot":"sheet-portal",...e})}function so({className:e,...t}){return(0,pe.jsx)(Qe.Dialog.Overlay,{"data-slot":"sheet-overlay",className:a("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function ea({className:e,children:t,side:o="right",...n}){return(0,pe.jsxs)(io,{children:[(0,pe.jsx)(so,{}),(0,pe.jsxs)(Qe.Dialog.Content,{"data-slot":"sheet-content",className:a("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",o==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",o==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",o==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",o==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...n,children:[t,(0,pe.jsxs)(Qe.Dialog.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[(0,pe.jsx)(Yo.XIcon,{className:"size-4"}),(0,pe.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}var O=require("react/jsx-runtime"),ta=(0,Je.createContext)(!1),lo={"one-half":["w-1/2","w-1/2"],"one-third":["w-1/3","w-2/3"],"two-third":["w-2/3","w-1/3"],"one-fourth":["w-1/4","w-3/4"],"three-fourth":["w-3/4","w-1/4"],"one-fifth":["w-1/5","w-4/5"],"four-fifth":["w-4/5","w-1/5"]},ht={none:"p-0",tight:"p-2",default:"p-4",loose:"p-6"},Fa=(e,t)=>{let[o,n]=lo[t];return{container:"inset-y-0 z-50 transition-all duration-500 ease-in-out",content:a("h-full bg-background transition-all duration-500 ease-in-out",e==="right"?"border-l":"border-r"),transform:e==="right"?"translate-x-full":"-translate-x-full",transformOpen:"translate-x-0",contentPushClass:e==="right"?o:n,sheetPushClass:e==="right"?n:o}},La="flex flex-col overflow-hidden rounded-2xl relative",Oa={default:"bg-background",card:"bg-background shadow-sm border",border:"bg-background border-2",transparent:"bg-transparent"},oa=e=>{let{children:t,className:o,variant:n="default",layout:s="full",header:i,footer:p,headerClassName:C,footerClassName:y,parentContainer:f=!1,padding:u=f?"none":"tight"}=e,T=(0,Je.useContext)(ta),[_,z]=(0,Je.useState)(!1),A=Je.default.useCallback(B=>(0,O.jsx)("div",{className:a("flex-1 overflow-auto h-full no-scrollbar",f&&"flex",!f&&ht[u]),children:B}),[u,f]),k=()=>{switch(s){case"split":{let{splitRatio:B="three-fourth",reverse:m=!1}=e;if(!Array.isArray(t)||t.length!==2)return(0,O.jsx)("div",{className:"flex items-center justify-center h-full text-red-500",children:'Error: AppContent with layout="split" requires exactly 2 children'});let[b,j]=lo[B],[h,F]=m?[t[1],t[0]]:[t[0],t[1]],[Ie,Be]=m?[j,b]:[b,j];return(0,O.jsxs)("div",{className:"flex h-full gap-2",children:[(0,O.jsx)("div",{className:a(Ie,"overflow-auto"),children:A(h)}),(0,O.jsx)("div",{className:a(Be,"overflow-auto"),children:A(F)})]})}case"with-sheet":{let{sheetContent:B,sheetWidth:m="four-fifth",sheetSide:b="right",sheetMode:j="container",sheetTrigger:h,sheetClassName:F,isSheetOpen:Ie,onSheetOpenChange:Be,showSheetOverlay:fe=!0,disableOverlay:be=!0}=e,Se=Ie!==void 0,oe=Se?Ie:_,Fe=Se?Be:z;if(j==="container"){let re=Fa(b,m);return(0,O.jsxs)("div",{className:a("flex relative flex-1 overflow-hidden",oe&&be&&["left","right"].includes(b)),children:[(0,O.jsxs)("div",{className:a("h-full overflow-auto transition-all duration-500",oe&&be&&["left","right"].includes(b)?re.contentPushClass:"w-full",oe&&be&&"overflow-y-auto overflow-x-hidden"),children:[h&&(0,O.jsx)("div",{onClick:()=>Fe?.(!oe),children:h}),(0,O.jsx)("div",{className:a("h-full",!f&&ht[u]),children:t})]}),(0,O.jsx)("div",{className:a(re.container,"transition-all duration-500 ease-in-out",oe&&be&&["left","right"].includes(b)?a(re.sheetPushClass,"overflow-y-auto"):oe?re.transformOpen:a(re.transform,"hidden"),"overflow-y-auto"),children:(0,O.jsx)("div",{className:a(re.content,F,"h-full"),children:B})}),oe&&fe&&!be&&(0,O.jsx)("div",{className:a("absolute inset-0 bg-secondary/20 z-40","transition-opacity duration-500 ease-in-out","opacity-0",oe?"opacity-100":"opacity-0"),onClick:()=>Fe?.(!1)})]})}return(0,O.jsxs)(Zo,{open:oe,onOpenChange:Fe,children:[h&&(0,O.jsx)(Qo,{asChild:!0,children:h}),(0,O.jsxs)(io,{children:[fe&&(0,O.jsx)(so,{className:"fixed inset-0 bg-secondary/50 z-50"}),(0,O.jsx)(ea,{side:b,className:a("fixed bg-background border","transition-all duration-500 ease-in-out",lo[m][1],F),children:B})]})]})}default:return A(t)}};return(0,O.jsx)(ta.Provider,{value:!0,children:(0,O.jsxs)("div",{className:a(La,Oa[n],ht[u],T&&"flex-1",f&&"h-full",!f&&"rounded-2xl",o),children:[i&&(0,O.jsx)("div",{className:a("border-b",C,n==="card"&&!f&&"rounded-t-2xl",n==="border"&&"border-b-2",ht[u]),children:i}),k(),p&&(0,O.jsx)("div",{className:a("border-t",y,n==="card"&&!f&&"rounded-b-2xl",n==="border"&&"border-t-2",ht[u]),children:p})]})})};var Ot=require("react/jsx-runtime"),aa=({className:e,columns:t=[],meta:o={title:""}})=>{let n={content:(0,Ot.jsx)("div",{className:"flex items-center gap-4 p-2",children:o.secondaryActions}),align:"right",width:"fill"},s=[...t.filter(i=>i!==void 0),n];return(0,Ot.jsx)("div",{className:a("flex items-center w-full gap-4",e),children:s.map((i,p)=>(0,Ot.jsx)("div",{className:a("flex items-center h-full",i.className,{"justify-start":i.align==="left","justify-center":i.align==="center","justify-end":i.align==="right","flex-1":i.width==="fill"}),children:i.content},p))})};var xt=require("react/jsx-runtime");function na({useTypedAppMeta:e}){return{AppHeader:i=>{let{meta:p}=e();return(0,xt.jsx)(Ko,{...i,meta:p})},AppFooter:i=>{let{meta:p}=e();return(0,xt.jsx)(aa,{...i,meta:p})},AppContent:i=>(0,xt.jsx)(oa,{...i}),AppContainer:i=>(0,xt.jsx)(Jo,{...i})}}var Q=require("react"),co=require("react/jsx-runtime"),Va=(0,Q.createContext)(void 0),ra=({children:e})=>{let[t,o]=(0,Q.useState)({title:"",description:"",breadcrumbs:[]}),n=(0,Q.useCallback)(p=>{o(C=>Object.keys(p).some(f=>JSON.stringify(C[f])!==JSON.stringify(p[f]))?{...C,...p}:C)},[]),s=(0,Q.useCallback)(()=>{o(p=>p.title===""&&p.description===""&&(p.breadcrumbs?.length??0)===0?p:{title:"",description:"",breadcrumbs:[]})},[]),i=(0,Q.useMemo)(()=>({meta:t,setMeta:n,resetMeta:s}),[t,n,s]);return(0,co.jsx)(Va.Provider,{value:i,children:e})};function ia(){let e=(0,Q.createContext)(void 0);return{TypedAppMetaProvider:({children:n})=>{let[s,i]=(0,Q.useState)({title:"",description:"",breadcrumbs:[]}),p=(0,Q.useCallback)(f=>{i(u=>Object.keys(f).some(_=>{let z=u[_],A=f[_];return JSON.stringify(z)!==JSON.stringify(A)})?{...u,...f}:u)},[]),C=(0,Q.useCallback)(()=>{i(f=>f.title===""&&f.description===""&&(f.breadcrumbs?.length??0)===0?f:{title:"",description:"",breadcrumbs:[]})},[]),y=(0,Q.useMemo)(()=>({meta:s,setMeta:p,resetMeta:C}),[s,p,C]);return(0,co.jsx)(e.Provider,{value:y,children:n})},useTypedAppMeta:()=>{let n=(0,Q.useContext)(e);if(!n)throw new Error("useTypedAppMeta must be used within a TypedAppMetaProvider");return n},TypedAppMetaContext:e}}var it=require("react");function sa({useTypedAppMeta:e}){function t(o){let{setMeta:n,resetMeta:s}=e(),i=(0,it.useMemo)(()=>{if(o.backAction)return{...o.backAction,onClick:o.backAction.onClick}},[o.backAction?.content,o.backAction?.href,o.backAction?.onClick?.toString()]),p=(0,it.useMemo)(()=>o.metadata,[JSON.stringify(o.metadata)]),C=(0,it.useMemo)(()=>({...o,backAction:i,metadata:p}),[o.title,o.description,o.breadcrumbs,o.primaryActions,o.secondaryActions,o.pagination,o.status,i,p]);(0,it.useEffect)(()=>(n(C),()=>s()),[C,n,s])}return{usePageTemplate:t}}var mo=require("react"),st=require("lucide-react");var ce=require("react/jsx-runtime"),Vt=class{static currencyFormatter=new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",maximumFractionDigits:2});static compactFormatter=new Intl.NumberFormat("en-IN",{style:"currency",currency:"INR",notation:"compact",maximumFractionDigits:1});static MONTH_NAMES_SHORT=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];static async copyToClipboard(t){if(t)try{await navigator.clipboard.writeText(t)}catch(o){throw console.error("Failed to copy text:",o),o}}static CopyToClipboard=({text:t,children:o,className:n,size:s="icon",variant:i="ghost"})=>{let[p,C]=(0,mo.useState)(!1),[y,f]=(0,mo.useState)(!1),u=async()=>{if(!(!t||y)){f(!0);try{await this.copyToClipboard(t),C(!0),setTimeout(()=>C(!1),2e3)}catch(T){console.error("Failed to copy text:",T)}finally{f(!1)}}};return(0,ce.jsxs)(Oe,{children:[(0,ce.jsx)(Ve,{asChild:!0,children:(0,ce.jsx)(v,{variant:i,size:s,className:a(s==="icon"&&"size-6",n),onClick:u,disabled:y||!t,children:y?(0,ce.jsx)(st.Loader2Icon,{className:"animate-spin"}):p?(0,ce.jsx)(st.Check,{className:"h-3 w-3"}):o||(0,ce.jsx)(st.Copy,{className:"h-3 w-3"})})}),(0,ce.jsx)(_e,{children:p?"Copied!":y?"Copying...":"Copy to clipboard"})]})};static formatINR(t,o={}){let{prefix:n="",suffix:s="",withSymbol:i=!0,compact:p=!1}=o;if(typeof t!="number"||isNaN(t))return`${n}${i?"\u20B9 ":""}0.00${s}`;let C=t<0,y=Math.abs(t),u=(p&&y>=1e5?this.compactFormatter:this.currencyFormatter).format(y).replace("\u20B9","");return`${n}${C?"- ":""}${i?"\u20B9 ":""}${u}${s}`}static formatDate(t,o={}){let{format:n="dd-mm-yyyy",separator:s="-"}=o,i=new Date(t);if(isNaN(i.getTime()))return"";let p=String(i.getDate()).padStart(2,"0"),C=String(i.getMonth()+1).padStart(2,"0"),y=this.MONTH_NAMES_SHORT[i.getMonth()],f=i.getFullYear();switch(n){case"dd-mmm-yyyy":return`${p}${s}${y}${s}${f}`;case"iso":return i.toISOString().split("T")[0];case"long":return i.toLocaleDateString("en-IN",{year:"numeric",month:"long",day:"numeric"});case"short":return i.toLocaleDateString("en-IN");default:return`${p}${s}${C}${s}${f}`}}static toProperCase(t){return t?t.toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "):""}static toProperCaseAdvanced(t){return t?t.toLowerCase().split(/(\s+|['-])/).map((o,n,s)=>["-","'"," "].includes(o)||n>0&&["-","'"].includes(s[n-1])?o:o.charAt(0).toUpperCase()+o.slice(1)).join(""):""}static StatusBadge=({status:t,className:o,showDot:n=!0,capitalize:s=!0,size:i="md",variant:p="outline",customColors:C,icon:y,trueMessage:f="active",falseMessage:u="inactive"})=>{let T=typeof t=="boolean"?t?f:u:typeof t=="number"?t>0?f:u:t.toLowerCase(),_={active:{label:"active",solid:{bg:"bg-emerald-500",text:"text-white",border:"border-emerald-600",dot:"bg-white"},outline:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-emerald-100",dot:"bg-emerald-500"},subtle:{bg:"bg-emerald-50",text:"text-emerald-700",border:"border-transparent",dot:"bg-emerald-500"}},pending:{label:"pending",solid:{bg:"bg-amber-500",text:"text-white",border:"border-amber-600",dot:"bg-white"},outline:{bg:"bg-amber-50",text:"text-amber-700",border:"border-amber-100",dot:"bg-amber-500"},subtle:{bg:"bg-amber-50",text:"text-amber-700",border:"border-transparent",dot:"bg-amber-500"}},inactive:{label:"inactive",solid:{bg:"bg-rose-500",text:"text-white",border:"border-rose-600",dot:"bg-white"},outline:{bg:"bg-rose-50",text:"text-rose-700",border:"border-rose-100",dot:"bg-rose-500"},subtle:{bg:"bg-rose-50",text:"text-rose-700",border:"border-transparent",dot:"bg-rose-500"}},draft:{label:"draft",solid:{bg:"bg-gray-500",text:"text-white",border:"border-gray-600",dot:"bg-white"},outline:{bg:"bg-gray-50",text:"text-gray-700",border:"border-gray-100",dot:"bg-gray-500"},subtle:{bg:"bg-gray-50",text:"text-gray-700",border:"border-transparent",dot:"bg-gray-500"}},completed:{label:"completed",solid:{bg:"bg-indigo-500",text:"text-white",border:"border-indigo-600",dot:"bg-white"},outline:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-indigo-100",dot:"bg-indigo-500"},subtle:{bg:"bg-indigo-50",text:"text-indigo-700",border:"border-transparent",dot:"bg-indigo-500"}}},z=_[T.toLowerCase()]||_.inactive,A=C||z[p],k={sm:"text-xs px-2 py-0.5",md:"text-xs px-2.5 py-0.5",lg:"text-sm px-3 py-1"},B=s?T.charAt(0).toUpperCase()+T.slice(1):T;return(0,ce.jsx)("div",{className:"flex justify-center",children:(0,ce.jsxs)("span",{className:a("inline-flex items-center gap-1.5 rounded-full border font-medium",A.bg,A.text,A.border,k[i],o),children:[n&&(y?(0,ce.jsx)("span",{className:"flex items-center",children:y}):(0,ce.jsx)("span",{className:a("size-2 rounded-full",A.dot),"aria-hidden":"true"})),B]})})}};var la=require("lucide-react"),lt=require("react-router"),V=require("react/jsx-runtime"),po=()=>{let e=(0,lt.useRouteError)(),t=(0,lt.useNavigate)();return(0,V.jsx)("div",{className:"rounded-2xl flex justify-center items-center h-full bg-sidebar px-4",children:(0,V.jsxs)("div",{className:"flex flex-col items-center space-y-4 text-center",children:[(0,V.jsx)(la.AlertTriangleIcon,{className:"h-16 w-16 text-destructive"}),(0,lt.isRouteErrorResponse)(e)?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)("h2",{className:"text-3xl font-semibold text-destructive",children:["Error ",e.status,": ",e.statusText]}),typeof e.data=="string"?(0,V.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data}):e.data?.message&&(0,V.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.data.message})]}):e instanceof Error?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("h2",{className:"text-3xl font-semibold text-destructive",children:"Unexpected Error"}),(0,V.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:e.message}),e.stack&&(0,V.jsxs)("details",{className:"mt-2 text-sm text-muted-foreground max-w-4xl text-left",children:[(0,V.jsx)("summary",{className:"cursor-pointer underline",children:"Stack Trace"}),(0,V.jsx)("pre",{className:"whitespace-pre-wrap",children:e.stack})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("h2",{className:"text-3xl font-semibold text-destructive",children:"Unknown Error"}),(0,V.jsx)("pre",{className:"text-lg text-muted-foreground whitespace-pre-wrap max-w-4xl text-left",children:typeof e=="string"?e:JSON.stringify(e,null,2)})]}),(0,V.jsx)(v,{variant:"outline",onClick:()=>t(-1),children:"Go Back"})]})})};var Pe=require("framer-motion");var N=require("react/jsx-runtime");function _a({size:e=100,strokeWidth:t=2,color:o="currentColor",className:n=""}){return(0,N.jsxs)(Pe.motion.svg,{width:e,height:e,viewBox:"0 0 100 100",initial:"hidden",animate:"visible",className:n,children:[(0,N.jsx)("title",{children:"Animated Checkmark"}),(0,N.jsx)(Pe.motion.circle,{cx:"50",cy:"50",r:"40",stroke:o,custom:0,style:{strokeWidth:t,strokeLinecap:"round",fill:"transparent"}}),(0,N.jsx)(Pe.motion.path,{d:"M30 50L45 65L70 35",stroke:o,custom:1,style:{strokeWidth:t,strokeLinecap:"round",strokeLinejoin:"round",fill:"transparent"}})]})}function uo(){return(0,N.jsx)(he,{className:"w-full max-w-sm mx-auto p-6 min-h-[300px] flex flex-col justify-center bg-background",children:(0,N.jsxs)(xe,{className:"space-y-4 flex flex-col items-center justify-center",children:[(0,N.jsx)(Pe.motion.div,{className:"flex justify-center",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.4,ease:[.4,0,.2,1],scale:{type:"spring",damping:15,stiffness:200}},children:(0,N.jsxs)("div",{className:"relative",children:[(0,N.jsx)(Pe.motion.div,{className:"absolute inset-0 bg-primary/5 rounded-full",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{delay:.2,duration:.8,ease:"circOut"}}),(0,N.jsx)(_a,{size:80,strokeWidth:4,color:"rgb(16 185 129)",className:"relative z-10 dark:drop-shadow-[0_0_10px_rgba(0,0,0,0.1)]"})]})}),(0,N.jsxs)(Pe.motion.div,{className:"space-y-2 text-center w-full",initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.2,duration:.6,ease:[.4,0,.2,1]},children:[(0,N.jsx)(Pe.motion.h2,{className:"text-lg text-zinc-100 dark:text-zinc-900 tracking-tighter font-semibold uppercase",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{delay:1,duration:.4},children:"Transfer Successful"}),(0,N.jsx)("div",{className:"flex items-center gap-4",children:(0,N.jsx)(Pe.motion.div,{className:"flex-1 bg-zinc-800/50 dark:bg-zinc-50/50 rounded-xl p-3 border border-zinc-700/50 dark:border-zinc-200/50 backdrop-blur-md",initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{delay:1.2,duration:.4,ease:[.4,0,.2,1]},children:(0,N.jsxs)("div",{className:"flex flex-col items-start gap-2",children:[(0,N.jsxs)("div",{className:"space-y-1.5",children:[(0,N.jsxs)("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[(0,N.jsxs)("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,N.jsx)("title",{children:"From"}),(0,N.jsx)("path",{d:"M12 19V5M5 12l7-7 7 7"})]}),"From"]}),(0,N.jsxs)("div",{className:"flex items-center gap-2.5 group transition-all",children:[(0,N.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"$"}),(0,N.jsx)("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"500.00 USD"})]})]}),(0,N.jsx)("div",{className:"w-full h-px bg-gradient-to-r from-transparent via-zinc-700 dark:via-zinc-300 to-transparent"}),(0,N.jsxs)("div",{className:"space-y-1.5",children:[(0,N.jsxs)("span",{className:"text-xs font-medium text-secondary-foreground flex items-center gap-1.5",children:[(0,N.jsxs)("svg",{className:"w-3 h-3",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,N.jsx)("title",{children:"To"}),(0,N.jsx)("path",{d:"M12 5v14M5 12l7 7 7-7"})]}),"To"]}),(0,N.jsxs)("div",{className:"flex items-center gap-2.5 group transition-all",children:[(0,N.jsx)("span",{className:"inline-flex items-center justify-center w-7 h-7 rounded-lg bg-zinc-900 dark:bg-white shadow-lg border border-zinc-700 dark:border-zinc-300 text-sm font-medium text-zinc-100 dark:text-zinc-900 group-hover:scale-105 transition-transform",children:"\u20AC"}),(0,N.jsx)("span",{className:"font-medium text-zinc-100 dark:text-zinc-900 tracking-tight",children:"460.00 EUR"})]})]})]})})}),(0,N.jsx)(Pe.motion.div,{className:"w-full text-xs text-secondary-foreground mt-2 text-center",initial:{opacity:0},animate:{opacity:1},transition:{delay:1.4,duration:.4},children:"Exchange Rate: 1 USD = 0.92 EUR"})]})]})})}var et=require("react/jsx-runtime"),go=()=>(0,et.jsx)("div",{className:"rounded-2xl flex justify-center items-center h-full bg-transparent",children:(0,et.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,et.jsx)("div",{className:"animate-spin rounded-full border-t-4 border-ring h-16 w-16 mb-4"}),(0,et.jsx)("h2",{className:"text-xl font-semibold text-muted-foreground",children:"Loading, please wait..."}),(0,et.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your content is on its way."})]})});var da=require("react-router");var ca=require("lucide-react"),_t=require("react-router"),ge=require("react/jsx-runtime"),fo=()=>{let e=(0,da.useLocation)(),t=(0,_t.useNavigate)(),o=()=>{window.history.length>2?t(-1):t("/")};return(0,ge.jsxs)("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[(0,ge.jsx)(ca.GhostIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,ge.jsx)("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Page Not Found"}),(0,ge.jsxs)("p",{className:"text-xl mb-4",children:["The page ",(0,ge.jsx)("code",{className:"px-1 py-0.5 rounded bg-muted text-foreground",children:e.pathname})," doesn't exist or has been moved."]}),(0,ge.jsxs)("div",{className:"flex space-x-4",children:[(0,ge.jsx)(v,{variant:"outline",onClick:o,children:"Go Back"}),(0,ge.jsx)(v,{variant:"ghost",children:(0,ge.jsx)(_t.NavLink,{to:"/",children:"Return Home"})})]})]})};var ma=require("lucide-react"),dt=require("react/jsx-runtime"),bo=()=>(0,dt.jsxs)("div",{className:"rounded-2xl flex flex-col items-center justify-center h-screen p-6 text-center text-muted-foreground bg-background select-none",children:[(0,dt.jsx)(ma.WifiOffIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,dt.jsx)("h1",{className:"text-3xl font-bold text-destructive mb-2",children:"You're offline"}),(0,dt.jsx)("p",{className:"text-xl max-w-md",children:"We couldn't connect to the server."})]});var pa=require("lucide-react");var Gt=require("react-router"),Te=require("react/jsx-runtime"),vo=()=>{let e=(0,Gt.useNavigate)();return(0,Te.jsxs)("div",{className:"rounded-2xl flex flex-col items-center justify-center h-full p-6 text-center bg-sidebar text-muted-foreground select-none",children:[(0,Te.jsx)(pa.ShieldOffIcon,{className:"h-15 w-15 text-destructive mb-4"}),(0,Te.jsx)("h1",{className:"text-2xl font-bold text-destructive mb-2",children:"Access Denied"}),(0,Te.jsx)("p",{className:"text-xl mb-4",children:"You don't have permission to view this page. Please sign in with an authorized account or contact your administrator."}),(0,Te.jsxs)("div",{className:"flex space-x-4",children:[(0,Te.jsx)(v,{variant:"outline",onClick:()=>{window.history.length>2?e(-1):e("/")},children:"Go Back"}),(0,Te.jsx)(v,{variant:"ghost",children:(0,Te.jsx)(Gt.NavLink,{to:"/",children:"Go to Home"})})]})]})};0&&(module.exports={AppMetaProvider,CurrencyTransfer,DataTable,DataTableActionBar,DataTableActionBarAction,DataTableActionBarSelection,DataTemplate,DataTemplateActionBar,DataTemplateActionBarAction,DataTemplateActionBarSelection,ErrorComponent,GeneralHelper,Loader,NotFound,OfflineUI,Unauthorized,createLayoutComponents,createPageTemplateHook,createTypedAppMetaContext});
|
|
3242
3
|
//# sourceMappingURL=index.cjs.map
|