@jameskabz/nextcraft-ui 0.6.3 → 0.6.5
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/craft-alert.cjs +69 -0
- package/dist/components/craft-alert.cjs.map +1 -0
- package/dist/components/craft-alert.d.cts +16 -0
- package/dist/components/craft-alert.d.ts +16 -0
- package/dist/components/craft-alert.js +45 -0
- package/dist/components/craft-alert.js.map +1 -0
- package/dist/components/craft-badge.cjs +54 -0
- package/dist/components/craft-badge.cjs.map +1 -0
- package/dist/components/craft-badge.d.cts +12 -0
- package/dist/components/craft-badge.d.ts +12 -0
- package/dist/components/craft-badge.js +30 -0
- package/dist/components/craft-badge.js.map +1 -0
- package/dist/components/craft-button.cjs +66 -0
- package/dist/components/craft-button.cjs.map +1 -0
- package/dist/components/craft-button.d.cts +15 -0
- package/dist/components/craft-button.d.ts +15 -0
- package/dist/components/craft-button.js +42 -0
- package/dist/components/craft-button.js.map +1 -0
- package/dist/components/craft-card.cjs +63 -0
- package/dist/components/craft-card.cjs.map +1 -0
- package/dist/components/craft-card.d.cts +13 -0
- package/dist/components/craft-card.d.ts +13 -0
- package/dist/components/craft-card.js +39 -0
- package/dist/components/craft-card.js.map +1 -0
- package/dist/components/craft-checkbox.cjs +103 -0
- package/dist/components/craft-checkbox.cjs.map +1 -0
- package/dist/components/craft-checkbox.d.cts +16 -0
- package/dist/components/craft-checkbox.d.ts +16 -0
- package/dist/components/craft-checkbox.js +69 -0
- package/dist/components/craft-checkbox.js.map +1 -0
- package/dist/components/craft-command-palette.cjs +134 -0
- package/dist/components/craft-command-palette.cjs.map +1 -0
- package/dist/components/craft-command-palette.d.cts +28 -0
- package/dist/components/craft-command-palette.d.ts +28 -0
- package/dist/components/craft-command-palette.js +100 -0
- package/dist/components/craft-command-palette.js.map +1 -0
- package/dist/components/craft-confirm-dialog.cjs +114 -0
- package/dist/components/craft-confirm-dialog.cjs.map +1 -0
- package/dist/components/craft-confirm-dialog.d.cts +21 -0
- package/dist/components/craft-confirm-dialog.d.ts +21 -0
- package/dist/components/craft-confirm-dialog.js +80 -0
- package/dist/components/craft-confirm-dialog.js.map +1 -0
- package/dist/components/craft-create-edit-drawer.cjs +112 -0
- package/dist/components/craft-create-edit-drawer.cjs.map +1 -0
- package/dist/components/craft-create-edit-drawer.d.cts +28 -0
- package/dist/components/craft-create-edit-drawer.d.ts +28 -0
- package/dist/components/craft-create-edit-drawer.js +78 -0
- package/dist/components/craft-create-edit-drawer.js.map +1 -0
- package/dist/components/craft-currency-input.cjs +68 -0
- package/dist/components/craft-currency-input.cjs.map +1 -0
- package/dist/components/craft-currency-input.d.cts +14 -0
- package/dist/components/craft-currency-input.d.ts +14 -0
- package/dist/components/craft-currency-input.js +34 -0
- package/dist/components/craft-currency-input.js.map +1 -0
- package/dist/components/craft-data-table.cjs +407 -0
- package/dist/components/craft-data-table.cjs.map +1 -0
- package/dist/components/craft-data-table.d.cts +58 -0
- package/dist/components/craft-data-table.d.ts +58 -0
- package/dist/{chunk-ZRV4Y374.js → components/craft-data-table.js} +30 -239
- package/dist/components/craft-data-table.js.map +1 -0
- package/dist/components/craft-date-picker.cjs +226 -0
- package/dist/components/craft-date-picker.cjs.map +1 -0
- package/dist/components/craft-date-picker.d.cts +17 -0
- package/dist/components/craft-date-picker.d.ts +17 -0
- package/dist/components/craft-date-picker.js +192 -0
- package/dist/components/craft-date-picker.js.map +1 -0
- package/dist/components/craft-drawer.cjs +126 -0
- package/dist/components/craft-drawer.cjs.map +1 -0
- package/dist/components/craft-drawer.d.cts +19 -0
- package/dist/components/craft-drawer.d.ts +19 -0
- package/dist/components/craft-drawer.js +92 -0
- package/dist/components/craft-drawer.js.map +1 -0
- package/dist/components/craft-dropdown-menu.cjs +127 -0
- package/dist/components/craft-dropdown-menu.cjs.map +1 -0
- package/dist/components/craft-dropdown-menu.d.cts +28 -0
- package/dist/components/craft-dropdown-menu.d.ts +28 -0
- package/dist/components/craft-dropdown-menu.js +93 -0
- package/dist/components/craft-dropdown-menu.js.map +1 -0
- package/dist/components/craft-empty-state.cjs +58 -0
- package/dist/components/craft-empty-state.cjs.map +1 -0
- package/dist/components/craft-empty-state.d.cts +14 -0
- package/dist/components/craft-empty-state.d.ts +14 -0
- package/dist/components/craft-empty-state.js +34 -0
- package/dist/components/craft-empty-state.js.map +1 -0
- package/dist/components/craft-error-state.cjs +60 -0
- package/dist/components/craft-error-state.cjs.map +1 -0
- package/dist/components/craft-error-state.d.cts +15 -0
- package/dist/components/craft-error-state.d.ts +15 -0
- package/dist/components/craft-error-state.js +36 -0
- package/dist/components/craft-error-state.js.map +1 -0
- package/dist/components/craft-filter-bar.cjs +76 -0
- package/dist/components/craft-filter-bar.cjs.map +1 -0
- package/dist/components/craft-filter-bar.d.cts +18 -0
- package/dist/components/craft-filter-bar.d.ts +18 -0
- package/dist/components/craft-filter-bar.js +52 -0
- package/dist/components/craft-filter-bar.js.map +1 -0
- package/dist/components/craft-form-builder.cjs +330 -0
- package/dist/components/craft-form-builder.cjs.map +1 -0
- package/dist/components/craft-form-builder.d.cts +57 -0
- package/dist/components/craft-form-builder.d.ts +57 -0
- package/dist/components/craft-form-builder.js +301 -0
- package/dist/components/craft-form-builder.js.map +1 -0
- package/dist/components/craft-form-field.cjs +301 -0
- package/dist/components/craft-form-field.cjs.map +1 -0
- package/dist/components/craft-form-field.d.cts +30 -0
- package/dist/components/craft-form-field.d.ts +30 -0
- package/dist/components/craft-form-field.js +280 -0
- package/dist/components/craft-form-field.js.map +1 -0
- package/dist/components/craft-form.cjs +114 -0
- package/dist/components/craft-form.cjs.map +1 -0
- package/dist/components/craft-form.d.cts +27 -0
- package/dist/components/craft-form.d.ts +27 -0
- package/dist/components/craft-form.js +80 -0
- package/dist/components/craft-form.js.map +1 -0
- package/dist/components/craft-icon.cjs +102 -0
- package/dist/components/craft-icon.cjs.map +1 -0
- package/dist/components/craft-icon.d.cts +19 -0
- package/dist/components/craft-icon.d.ts +19 -0
- package/dist/{chunk-FEFH5O5K.js → components/craft-icon.js} +31 -13
- package/dist/components/craft-icon.js.map +1 -0
- package/dist/components/craft-input.cjs +78 -0
- package/dist/components/craft-input.cjs.map +1 -0
- package/dist/components/craft-input.d.cts +19 -0
- package/dist/components/craft-input.d.ts +19 -0
- package/dist/{chunk-7SKDTIEK.js → components/craft-input.js} +5 -10
- package/dist/components/craft-input.js.map +1 -0
- package/dist/components/craft-link.cjs +70 -0
- package/dist/components/craft-link.cjs.map +1 -0
- package/dist/components/craft-link.d.cts +14 -0
- package/dist/components/craft-link.d.ts +14 -0
- package/dist/components/craft-link.js +36 -0
- package/dist/components/craft-link.js.map +1 -0
- package/dist/components/craft-loading-state.cjs +64 -0
- package/dist/components/craft-loading-state.cjs.map +1 -0
- package/dist/components/craft-loading-state.d.cts +13 -0
- package/dist/components/craft-loading-state.d.ts +13 -0
- package/dist/components/craft-loading-state.js +40 -0
- package/dist/components/craft-loading-state.js.map +1 -0
- package/dist/components/craft-modal.cjs +174 -0
- package/dist/components/craft-modal.cjs.map +1 -0
- package/dist/components/craft-modal.d.cts +19 -0
- package/dist/components/craft-modal.d.ts +19 -0
- package/dist/components/craft-modal.js +140 -0
- package/dist/components/craft-modal.js.map +1 -0
- package/dist/components/craft-number-input.cjs +63 -0
- package/dist/components/craft-number-input.cjs.map +1 -0
- package/dist/components/craft-number-input.d.cts +12 -0
- package/dist/components/craft-number-input.d.ts +12 -0
- package/dist/components/craft-number-input.js +29 -0
- package/dist/components/craft-number-input.js.map +1 -0
- package/dist/components/craft-pagination.cjs +130 -0
- package/dist/components/craft-pagination.cjs.map +1 -0
- package/dist/components/craft-pagination.d.cts +19 -0
- package/dist/components/craft-pagination.d.ts +19 -0
- package/dist/components/craft-pagination.js +106 -0
- package/dist/components/craft-pagination.js.map +1 -0
- package/dist/components/craft-popover.cjs +123 -0
- package/dist/components/craft-popover.cjs.map +1 -0
- package/dist/components/craft-popover.d.cts +20 -0
- package/dist/components/craft-popover.d.ts +20 -0
- package/dist/components/craft-popover.js +89 -0
- package/dist/components/craft-popover.js.map +1 -0
- package/dist/components/craft-select.cjs +84 -0
- package/dist/components/craft-select.cjs.map +1 -0
- package/dist/components/craft-select.d.cts +12 -0
- package/dist/components/craft-select.d.ts +12 -0
- package/dist/components/craft-select.js +50 -0
- package/dist/components/craft-select.js.map +1 -0
- package/dist/components/craft-skeleton.cjs +45 -0
- package/dist/components/craft-skeleton.cjs.map +1 -0
- package/dist/components/craft-skeleton.d.cts +10 -0
- package/dist/components/craft-skeleton.d.ts +10 -0
- package/dist/components/craft-skeleton.js +21 -0
- package/dist/components/craft-skeleton.js.map +1 -0
- package/dist/components/craft-stat-card.cjs +67 -0
- package/dist/components/craft-stat-card.cjs.map +1 -0
- package/dist/components/craft-stat-card.d.cts +17 -0
- package/dist/components/craft-stat-card.d.ts +17 -0
- package/dist/components/craft-stat-card.js +43 -0
- package/dist/components/craft-stat-card.js.map +1 -0
- package/dist/components/craft-submit-button.cjs +71 -0
- package/dist/components/craft-submit-button.cjs.map +1 -0
- package/dist/components/craft-submit-button.d.cts +13 -0
- package/dist/components/craft-submit-button.d.ts +13 -0
- package/dist/components/craft-submit-button.js +47 -0
- package/dist/components/craft-submit-button.js.map +1 -0
- package/dist/components/craft-switch.cjs +82 -0
- package/dist/components/craft-switch.cjs.map +1 -0
- package/dist/components/craft-switch.d.cts +14 -0
- package/dist/components/craft-switch.d.ts +14 -0
- package/dist/components/craft-switch.js +48 -0
- package/dist/components/craft-switch.js.map +1 -0
- package/dist/components/craft-table-toolbar.cjs +79 -0
- package/dist/components/craft-table-toolbar.cjs.map +1 -0
- package/dist/components/craft-table-toolbar.d.cts +19 -0
- package/dist/components/craft-table-toolbar.d.ts +19 -0
- package/dist/components/craft-table-toolbar.js +55 -0
- package/dist/components/craft-table-toolbar.js.map +1 -0
- package/dist/components/craft-tabs.cjs +105 -0
- package/dist/components/craft-tabs.cjs.map +1 -0
- package/dist/components/craft-tabs.d.cts +19 -0
- package/dist/components/craft-tabs.d.ts +19 -0
- package/dist/components/craft-tabs.js +71 -0
- package/dist/components/craft-tabs.js.map +1 -0
- package/dist/components/craft-textarea.cjs +69 -0
- package/dist/components/craft-textarea.cjs.map +1 -0
- package/dist/components/craft-textarea.d.cts +12 -0
- package/dist/components/craft-textarea.d.ts +12 -0
- package/dist/components/craft-textarea.js +35 -0
- package/dist/components/craft-textarea.js.map +1 -0
- package/dist/components/craft-toast.cjs +98 -0
- package/dist/components/craft-toast.cjs.map +1 -0
- package/dist/components/craft-toast.d.cts +24 -0
- package/dist/components/craft-toast.d.ts +24 -0
- package/dist/components/craft-toast.js +63 -0
- package/dist/components/craft-toast.js.map +1 -0
- package/dist/components/craft-tooltip.cjs +75 -0
- package/dist/components/craft-tooltip.cjs.map +1 -0
- package/dist/components/craft-tooltip.d.cts +13 -0
- package/dist/components/craft-tooltip.d.ts +13 -0
- package/dist/components/craft-tooltip.js +41 -0
- package/dist/components/craft-tooltip.js.map +1 -0
- package/dist/components/forms/types.cjs +17 -0
- package/dist/components/forms/types.cjs.map +1 -0
- package/dist/components/forms/types.d.cts +7 -0
- package/dist/components/forms/types.d.ts +7 -0
- package/dist/components/forms/types.js +1 -0
- package/dist/components/forms/types.js.map +1 -0
- package/dist/components/glass-card.cjs +64 -0
- package/dist/components/glass-card.cjs.map +1 -0
- package/dist/components/glass-card.d.cts +12 -0
- package/dist/components/glass-card.d.ts +12 -0
- package/dist/components/glass-card.js +40 -0
- package/dist/components/glass-card.js.map +1 -0
- package/dist/components/layout/app-shell.cjs +49 -0
- package/dist/components/layout/app-shell.cjs.map +1 -0
- package/dist/components/layout/app-shell.d.cts +10 -0
- package/dist/components/layout/app-shell.d.ts +10 -0
- package/dist/components/layout/app-shell.js +25 -0
- package/dist/components/layout/app-shell.js.map +1 -0
- package/dist/components/layout/app-template.cjs +104 -0
- package/dist/components/layout/app-template.cjs.map +1 -0
- package/dist/components/layout/app-template.d.cts +19 -0
- package/dist/components/layout/app-template.d.ts +19 -0
- package/dist/components/layout/app-template.js +70 -0
- package/dist/components/layout/app-template.js.map +1 -0
- package/dist/components/layout/auth-layout.cjs +65 -0
- package/dist/components/layout/auth-layout.cjs.map +1 -0
- package/dist/components/layout/auth-layout.d.cts +12 -0
- package/dist/components/layout/auth-layout.d.ts +12 -0
- package/dist/components/layout/auth-layout.js +41 -0
- package/dist/components/layout/auth-layout.js.map +1 -0
- package/dist/components/layout/breadcrumbs.cjs +39 -0
- package/dist/components/layout/breadcrumbs.cjs.map +1 -0
- package/dist/components/layout/breadcrumbs.d.cts +13 -0
- package/dist/components/layout/breadcrumbs.d.ts +13 -0
- package/dist/components/layout/breadcrumbs.js +15 -0
- package/dist/components/layout/breadcrumbs.js.map +1 -0
- package/dist/components/layout/container.cjs +45 -0
- package/dist/components/layout/container.cjs.map +1 -0
- package/dist/components/layout/container.d.cts +9 -0
- package/dist/components/layout/container.d.ts +9 -0
- package/dist/components/layout/container.js +21 -0
- package/dist/components/layout/container.js.map +1 -0
- package/dist/components/layout/grid.cjs +47 -0
- package/dist/components/layout/grid.cjs.map +1 -0
- package/dist/components/layout/grid.d.cts +10 -0
- package/dist/components/layout/grid.d.ts +10 -0
- package/dist/components/layout/grid.js +23 -0
- package/dist/components/layout/grid.js.map +1 -0
- package/dist/components/layout/layout-config.cjs +78 -0
- package/dist/components/layout/layout-config.cjs.map +1 -0
- package/dist/components/layout/layout-config.d.cts +92 -0
- package/dist/components/layout/layout-config.d.ts +92 -0
- package/dist/components/layout/layout-config.js +54 -0
- package/dist/components/layout/layout-config.js.map +1 -0
- package/dist/components/layout/page-header.cjs +52 -0
- package/dist/components/layout/page-header.cjs.map +1 -0
- package/dist/components/layout/page-header.d.cts +11 -0
- package/dist/components/layout/page-header.d.ts +11 -0
- package/dist/components/layout/page-header.js +28 -0
- package/dist/components/layout/page-header.js.map +1 -0
- package/dist/components/layout/sidebar.cjs +64 -0
- package/dist/components/layout/sidebar.cjs.map +1 -0
- package/dist/components/layout/sidebar.d.cts +17 -0
- package/dist/components/layout/sidebar.d.ts +17 -0
- package/dist/components/layout/sidebar.js +40 -0
- package/dist/components/layout/sidebar.js.map +1 -0
- package/dist/components/layout/top-nav.cjs +49 -0
- package/dist/components/layout/top-nav.cjs.map +1 -0
- package/dist/components/layout/top-nav.d.cts +11 -0
- package/dist/components/layout/top-nav.d.ts +11 -0
- package/dist/components/layout/top-nav.js +25 -0
- package/dist/components/layout/top-nav.js.map +1 -0
- package/dist/components/layout/types.cjs +29 -0
- package/dist/components/layout/types.cjs.map +1 -0
- package/dist/components/layout/types.d.cts +12 -0
- package/dist/components/layout/types.d.ts +12 -0
- package/dist/components/layout/types.js +5 -0
- package/dist/components/layout/types.js.map +1 -0
- package/dist/components/table/types.cjs +17 -0
- package/dist/components/table/types.cjs.map +1 -0
- package/dist/components/table/types.d.cts +7 -0
- package/dist/components/table/types.d.ts +7 -0
- package/dist/components/table/types.js +1 -0
- package/dist/components/table/types.js.map +1 -0
- package/dist/components/theme-switcher.cjs +72 -0
- package/dist/components/theme-switcher.cjs.map +1 -0
- package/dist/components/theme-switcher.d.cts +9 -0
- package/dist/components/theme-switcher.d.ts +9 -0
- package/dist/components/theme-switcher.js +48 -0
- package/dist/components/theme-switcher.js.map +1 -0
- package/dist/craft/components.cjs +64 -1779
- package/dist/craft/components.cjs.map +1 -1
- package/dist/craft/components.d.cts +36 -369
- package/dist/craft/components.d.ts +36 -369
- package/dist/craft/components.js +31 -42
- package/dist/craft/components.js.map +1 -1
- package/dist/craft/forms.cjs +6 -1347
- package/dist/craft/forms.cjs.map +1 -1
- package/dist/craft/forms.d.cts +7 -101
- package/dist/craft/forms.d.ts +7 -101
- package/dist/craft/forms.js +3 -8
- package/dist/craft/forms.js.map +1 -1
- package/dist/craft/layout.cjs +20 -374
- package/dist/craft/layout.cjs.map +1 -1
- package/dist/craft/layout.d.cts +12 -170
- package/dist/craft/layout.d.ts +12 -170
- package/dist/craft/layout.js +10 -14
- package/dist/craft/layout.js.map +1 -1
- package/dist/craft/table.cjs +8 -632
- package/dist/craft/table.cjs.map +1 -1
- package/dist/craft/table.d.cts +7 -99
- package/dist/craft/table.d.ts +7 -99
- package/dist/craft/table.js +4 -8
- package/dist/craft/table.js.map +1 -1
- package/dist/craft/theme.cjs +5 -137
- package/dist/craft/theme.cjs.map +1 -1
- package/dist/craft/theme.d.cts +3 -9
- package/dist/craft/theme.d.ts +3 -9
- package/dist/craft/theme.js +2 -6
- package/dist/craft/theme.js.map +1 -1
- package/dist/index.cjs +103 -3426
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -6
- package/dist/index.d.ts +50 -6
- package/dist/index.js +50 -70
- package/dist/index.js.map +1 -1
- package/dist/utils/cn.cjs +31 -0
- package/dist/utils/cn.cjs.map +1 -0
- package/dist/utils/cn.d.cts +3 -0
- package/dist/utils/cn.d.ts +3 -0
- package/dist/{chunk-VQ6T3HIX.js → utils/cn.js} +1 -3
- package/dist/utils/cn.js.map +1 -0
- package/package.json +6 -1
- package/dist/chunk-6F7FN2ZF.js +0 -671
- package/dist/chunk-6F7FN2ZF.js.map +0 -1
- package/dist/chunk-7Q4Z47HT.js +0 -657
- package/dist/chunk-7Q4Z47HT.js.map +0 -1
- package/dist/chunk-7SKDTIEK.js.map +0 -1
- package/dist/chunk-FEFH5O5K.js.map +0 -1
- package/dist/chunk-M2EKVXB6.js +0 -127
- package/dist/chunk-M2EKVXB6.js.map +0 -1
- package/dist/chunk-SBLIF6UU.js +0 -1029
- package/dist/chunk-SBLIF6UU.js.map +0 -1
- package/dist/chunk-VQ6T3HIX.js.map +0 -1
- package/dist/chunk-YVZL4GET.js +0 -328
- package/dist/chunk-YVZL4GET.js.map +0 -1
- package/dist/chunk-ZRV4Y374.js.map +0 -1
package/dist/craft/table.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,641 +15,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
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
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/craft/table.ts
|
|
31
19
|
var table_exports = {};
|
|
32
20
|
__export(table_exports, {
|
|
33
|
-
CraftDataTable: () => CraftDataTable,
|
|
34
|
-
CraftFilterBar: () => CraftFilterBar,
|
|
35
|
-
CraftPagination: () => CraftPagination,
|
|
36
|
-
CraftTableToolbar: () => CraftTableToolbar
|
|
21
|
+
CraftDataTable: () => import_craft_data_table.CraftDataTable,
|
|
22
|
+
CraftFilterBar: () => import_craft_filter_bar.CraftFilterBar,
|
|
23
|
+
CraftPagination: () => import_craft_pagination.CraftPagination,
|
|
24
|
+
CraftTableToolbar: () => import_craft_table_toolbar.CraftTableToolbar
|
|
37
25
|
});
|
|
38
26
|
module.exports = __toCommonJS(table_exports);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
// src/utils/cn.ts
|
|
44
|
-
function cn(...values) {
|
|
45
|
-
return values.filter(Boolean).join(" ");
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// src/components/craft-pagination.tsx
|
|
49
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
|
-
function getPageNumbers(pageIndex, pageCount, maxButtons = 5) {
|
|
51
|
-
if (pageCount <= maxButtons) {
|
|
52
|
-
return Array.from({ length: pageCount }, (_, i) => i);
|
|
53
|
-
}
|
|
54
|
-
const pages = [];
|
|
55
|
-
const start = Math.max(0, pageIndex - 1);
|
|
56
|
-
const end = Math.min(pageCount - 1, pageIndex + 1);
|
|
57
|
-
pages.push(0);
|
|
58
|
-
if (start > 1) pages.push("ellipsis");
|
|
59
|
-
for (let i = start; i <= end; i += 1) {
|
|
60
|
-
if (i !== 0 && i !== pageCount - 1) pages.push(i);
|
|
61
|
-
}
|
|
62
|
-
if (end < pageCount - 2) pages.push("ellipsis");
|
|
63
|
-
pages.push(pageCount - 1);
|
|
64
|
-
return pages;
|
|
65
|
-
}
|
|
66
|
-
function CraftPagination({
|
|
67
|
-
pageIndex,
|
|
68
|
-
pageCount,
|
|
69
|
-
onPageChange,
|
|
70
|
-
canPrevious = pageIndex > 0,
|
|
71
|
-
canNext = pageIndex < pageCount - 1,
|
|
72
|
-
pageSize,
|
|
73
|
-
pageSizeOptions = [10, 20, 50],
|
|
74
|
-
onPageSizeChange,
|
|
75
|
-
tone,
|
|
76
|
-
className
|
|
77
|
-
}) {
|
|
78
|
-
const pages = getPageNumbers(pageIndex, pageCount);
|
|
79
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
80
|
-
"div",
|
|
81
|
-
{
|
|
82
|
-
className: cn(
|
|
83
|
-
"flex flex-wrap items-center justify-between gap-4",
|
|
84
|
-
className
|
|
85
|
-
),
|
|
86
|
-
"data-nc-theme": tone,
|
|
87
|
-
children: [
|
|
88
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
89
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
|
-
"button",
|
|
91
|
-
{
|
|
92
|
-
type: "button",
|
|
93
|
-
className: cn(
|
|
94
|
-
"rounded-xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.12)] px-3 py-2 text-xs text-[rgb(var(--nc-fg))] transition",
|
|
95
|
-
"hover:bg-[rgb(var(--nc-surface)/0.2)]",
|
|
96
|
-
!canPrevious && "opacity-50 cursor-not-allowed"
|
|
97
|
-
),
|
|
98
|
-
onClick: () => onPageChange(Math.max(pageIndex - 1, 0)),
|
|
99
|
-
disabled: !canPrevious,
|
|
100
|
-
children: "Prev"
|
|
101
|
-
}
|
|
102
|
-
),
|
|
103
|
-
pages.map(
|
|
104
|
-
(page, index) => page === "ellipsis" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "px-2 text-[rgb(var(--nc-fg-muted))]", children: "..." }, `ellipsis-${index}`) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
105
|
-
"button",
|
|
106
|
-
{
|
|
107
|
-
type: "button",
|
|
108
|
-
className: cn(
|
|
109
|
-
"rounded-xl border px-3 py-2 text-xs transition",
|
|
110
|
-
page === pageIndex ? "border-[rgb(var(--nc-accent-1)/0.6)] bg-[rgb(var(--nc-accent-1)/0.2)] text-[rgb(var(--nc-fg))]" : "border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.12)] text-[rgb(var(--nc-fg-muted))] hover:text-[rgb(var(--nc-fg))] hover:bg-[rgb(var(--nc-surface)/0.2)]"
|
|
111
|
-
),
|
|
112
|
-
onClick: () => onPageChange(page),
|
|
113
|
-
children: page + 1
|
|
114
|
-
},
|
|
115
|
-
page
|
|
116
|
-
)
|
|
117
|
-
),
|
|
118
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
119
|
-
"button",
|
|
120
|
-
{
|
|
121
|
-
type: "button",
|
|
122
|
-
className: cn(
|
|
123
|
-
"rounded-xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.12)] px-3 py-2 text-xs text-[rgb(var(--nc-fg))] transition",
|
|
124
|
-
"hover:bg-[rgb(var(--nc-surface)/0.2)]",
|
|
125
|
-
!canNext && "opacity-50 cursor-not-allowed"
|
|
126
|
-
),
|
|
127
|
-
onClick: () => onPageChange(Math.min(pageIndex + 1, pageCount - 1)),
|
|
128
|
-
disabled: !canNext,
|
|
129
|
-
children: "Next"
|
|
130
|
-
}
|
|
131
|
-
)
|
|
132
|
-
] }),
|
|
133
|
-
onPageSizeChange && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 text-xs text-[rgb(var(--nc-fg-muted))]", children: [
|
|
134
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Rows" }),
|
|
135
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
136
|
-
"select",
|
|
137
|
-
{
|
|
138
|
-
className: "rounded-xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.12)] px-2 py-1 text-xs text-[rgb(var(--nc-fg))]",
|
|
139
|
-
value: pageSize,
|
|
140
|
-
onChange: (event) => onPageSizeChange(Number(event.target.value)),
|
|
141
|
-
children: pageSizeOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: size, children: size }, size))
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
] })
|
|
145
|
-
]
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// src/components/craft-data-table.tsx
|
|
151
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
152
|
-
function getColumnValue(column, row) {
|
|
153
|
-
if (typeof column.accessor === "function") return column.accessor(row);
|
|
154
|
-
const record = row;
|
|
155
|
-
if (typeof column.accessor === "string") return record[column.accessor];
|
|
156
|
-
return record[column.id];
|
|
157
|
-
}
|
|
158
|
-
function normalizeValue(value) {
|
|
159
|
-
if (value === null || value === void 0) return "";
|
|
160
|
-
if (typeof value === "number") return value;
|
|
161
|
-
if (typeof value === "string") return value.toLowerCase();
|
|
162
|
-
if (value instanceof Date) return value.getTime();
|
|
163
|
-
return String(value).toLowerCase();
|
|
164
|
-
}
|
|
165
|
-
function CraftDataTable({
|
|
166
|
-
data,
|
|
167
|
-
columns,
|
|
168
|
-
tone,
|
|
169
|
-
className,
|
|
170
|
-
loading = false,
|
|
171
|
-
emptyState,
|
|
172
|
-
toolbar,
|
|
173
|
-
enableSorting = true,
|
|
174
|
-
enableFiltering = true,
|
|
175
|
-
enableColumnVisibility = true,
|
|
176
|
-
enableRowSelection = true,
|
|
177
|
-
enablePagination = true,
|
|
178
|
-
showGlobalFilter,
|
|
179
|
-
manualSorting = false,
|
|
180
|
-
manualFiltering = false,
|
|
181
|
-
manualPagination = false,
|
|
182
|
-
sortBy,
|
|
183
|
-
onSortChange,
|
|
184
|
-
filters,
|
|
185
|
-
onFiltersChange,
|
|
186
|
-
globalFilter,
|
|
187
|
-
onGlobalFilterChange,
|
|
188
|
-
columnVisibility,
|
|
189
|
-
onColumnVisibilityChange,
|
|
190
|
-
selectedRowIds,
|
|
191
|
-
onRowSelectionChange,
|
|
192
|
-
getRowId,
|
|
193
|
-
pageIndex,
|
|
194
|
-
pageSize = 10,
|
|
195
|
-
pageCount,
|
|
196
|
-
onPageChange,
|
|
197
|
-
onPageSizeChange
|
|
198
|
-
}) {
|
|
199
|
-
const [internalSort, setInternalSort] = React.useState(null);
|
|
200
|
-
const [internalFilters, setInternalFilters] = React.useState({});
|
|
201
|
-
const [internalGlobalFilter, setInternalGlobalFilter] = React.useState("");
|
|
202
|
-
const [internalVisibility, setInternalVisibility] = React.useState(
|
|
203
|
-
() => columns.reduce((acc, column) => {
|
|
204
|
-
acc[column.id] = !column.hidden;
|
|
205
|
-
return acc;
|
|
206
|
-
}, {})
|
|
207
|
-
);
|
|
208
|
-
const [internalSelection, setInternalSelection] = React.useState({});
|
|
209
|
-
const [internalPageIndex, setInternalPageIndex] = React.useState(0);
|
|
210
|
-
const [showColumns, setShowColumns] = React.useState(false);
|
|
211
|
-
const resolvedSort = sortBy != null ? sortBy : internalSort;
|
|
212
|
-
const resolvedFilters = filters != null ? filters : internalFilters;
|
|
213
|
-
const resolvedGlobalFilter = globalFilter != null ? globalFilter : internalGlobalFilter;
|
|
214
|
-
const resolvedVisibility = columnVisibility != null ? columnVisibility : internalVisibility;
|
|
215
|
-
const resolvedSelection = selectedRowIds != null ? selectedRowIds : internalSelection;
|
|
216
|
-
const resolvedPageIndex = pageIndex != null ? pageIndex : internalPageIndex;
|
|
217
|
-
const setSort = (next) => {
|
|
218
|
-
if (sortBy === void 0) setInternalSort(next);
|
|
219
|
-
onSortChange == null ? void 0 : onSortChange(next);
|
|
220
|
-
};
|
|
221
|
-
const setFilters = (next) => {
|
|
222
|
-
if (filters === void 0) setInternalFilters(next);
|
|
223
|
-
onFiltersChange == null ? void 0 : onFiltersChange(next);
|
|
224
|
-
};
|
|
225
|
-
const setVisibility = (next) => {
|
|
226
|
-
if (columnVisibility === void 0) setInternalVisibility(next);
|
|
227
|
-
onColumnVisibilityChange == null ? void 0 : onColumnVisibilityChange(next);
|
|
228
|
-
};
|
|
229
|
-
const setSelection = (next) => {
|
|
230
|
-
if (selectedRowIds === void 0) setInternalSelection(next);
|
|
231
|
-
onRowSelectionChange == null ? void 0 : onRowSelectionChange(next);
|
|
232
|
-
};
|
|
233
|
-
const setPageIndex = React.useCallback(
|
|
234
|
-
(next) => {
|
|
235
|
-
if (pageIndex === void 0) setInternalPageIndex(next);
|
|
236
|
-
onPageChange == null ? void 0 : onPageChange(next);
|
|
237
|
-
},
|
|
238
|
-
[pageIndex, onPageChange]
|
|
239
|
-
);
|
|
240
|
-
const visibleColumns = columns.filter(
|
|
241
|
-
(column) => resolvedVisibility[column.id] !== false
|
|
242
|
-
);
|
|
243
|
-
const filteredData = React.useMemo(() => {
|
|
244
|
-
if (manualFiltering) return data;
|
|
245
|
-
const globalValue = resolvedGlobalFilter.trim();
|
|
246
|
-
return data.filter((row) => {
|
|
247
|
-
if (globalValue) {
|
|
248
|
-
const matchesGlobal = columns.some((column) => {
|
|
249
|
-
const value = normalizeValue(getColumnValue(column, row));
|
|
250
|
-
return String(value).includes(globalValue.toLowerCase());
|
|
251
|
-
});
|
|
252
|
-
if (!matchesGlobal) return false;
|
|
253
|
-
}
|
|
254
|
-
return Object.entries(resolvedFilters).every(([columnId, value]) => {
|
|
255
|
-
if (!value) return true;
|
|
256
|
-
const column = columns.find((col) => col.id === columnId);
|
|
257
|
-
if (!column) return true;
|
|
258
|
-
const cellValue = normalizeValue(getColumnValue(column, row));
|
|
259
|
-
return String(cellValue).includes(value.toLowerCase());
|
|
260
|
-
});
|
|
261
|
-
});
|
|
262
|
-
}, [columns, data, manualFiltering, resolvedFilters, resolvedGlobalFilter]);
|
|
263
|
-
const sortedData = React.useMemo(() => {
|
|
264
|
-
if (manualSorting || !resolvedSort) return filteredData;
|
|
265
|
-
const column = columns.find((col) => col.id === resolvedSort.id);
|
|
266
|
-
if (!column) return filteredData;
|
|
267
|
-
const sorted = [...filteredData].sort((a, b) => {
|
|
268
|
-
const valueA = normalizeValue(getColumnValue(column, a));
|
|
269
|
-
const valueB = normalizeValue(getColumnValue(column, b));
|
|
270
|
-
if (typeof valueA === "number" && typeof valueB === "number") {
|
|
271
|
-
return valueA - valueB;
|
|
272
|
-
}
|
|
273
|
-
return String(valueA).localeCompare(String(valueB));
|
|
274
|
-
});
|
|
275
|
-
return resolvedSort.desc ? sorted.reverse() : sorted;
|
|
276
|
-
}, [columns, filteredData, manualSorting, resolvedSort]);
|
|
277
|
-
const resolvedPageCount = manualPagination ? Math.max(pageCount != null ? pageCount : 1, 1) : Math.max(Math.ceil(sortedData.length / pageSize), 1);
|
|
278
|
-
React.useEffect(() => {
|
|
279
|
-
if (resolvedPageIndex > resolvedPageCount - 1) {
|
|
280
|
-
setPageIndex(Math.max(resolvedPageCount - 1, 0));
|
|
281
|
-
}
|
|
282
|
-
}, [resolvedPageCount, resolvedPageIndex, setPageIndex]);
|
|
283
|
-
const pagedData = React.useMemo(() => {
|
|
284
|
-
if (!enablePagination || manualPagination) return sortedData;
|
|
285
|
-
const start = resolvedPageIndex * pageSize;
|
|
286
|
-
return sortedData.slice(start, start + pageSize);
|
|
287
|
-
}, [enablePagination, manualPagination, pageSize, resolvedPageIndex, sortedData]);
|
|
288
|
-
const rowIdFor = React.useCallback(
|
|
289
|
-
(row, index) => {
|
|
290
|
-
var _a;
|
|
291
|
-
return (_a = getRowId == null ? void 0 : getRowId(row, index)) != null ? _a : String(index);
|
|
292
|
-
},
|
|
293
|
-
[getRowId]
|
|
294
|
-
);
|
|
295
|
-
const pageStartIndex = enablePagination && !manualPagination ? resolvedPageIndex * pageSize : 0;
|
|
296
|
-
const pageRowIds = pagedData.map(
|
|
297
|
-
(row, index) => rowIdFor(row, pageStartIndex + index)
|
|
298
|
-
);
|
|
299
|
-
const allSelected = pageRowIds.length > 0 && pageRowIds.every((id) => resolvedSelection[id]);
|
|
300
|
-
const someSelected = pageRowIds.some((id) => resolvedSelection[id]);
|
|
301
|
-
const headerCheckboxRef = React.useRef(null);
|
|
302
|
-
React.useEffect(() => {
|
|
303
|
-
if (headerCheckboxRef.current) {
|
|
304
|
-
headerCheckboxRef.current.indeterminate = someSelected && !allSelected;
|
|
305
|
-
}
|
|
306
|
-
}, [someSelected, allSelected]);
|
|
307
|
-
const toggleSort = (column) => {
|
|
308
|
-
if (!enableSorting || column.sortable === false) return;
|
|
309
|
-
const current = resolvedSort;
|
|
310
|
-
if (!current || current.id !== column.id) {
|
|
311
|
-
setSort({ id: column.id, desc: false });
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
if (!current.desc) {
|
|
315
|
-
setSort({ id: column.id, desc: true });
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
setSort(null);
|
|
319
|
-
};
|
|
320
|
-
const emptyContent = emptyState != null ? emptyState : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "text-center text-sm text-[rgb(var(--nc-fg-muted))]", children: "No results found." });
|
|
321
|
-
const resolvedShowGlobalFilter = showGlobalFilter != null ? showGlobalFilter : enableFiltering && !toolbar;
|
|
322
|
-
const setGlobalFilter = (next) => {
|
|
323
|
-
if (globalFilter === void 0) setInternalGlobalFilter(next);
|
|
324
|
-
onGlobalFilterChange == null ? void 0 : onGlobalFilterChange(next);
|
|
325
|
-
};
|
|
326
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: cn("space-y-4", className), "data-nc-theme": tone, children: [
|
|
327
|
-
toolbar,
|
|
328
|
-
resolvedShowGlobalFilter && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex items-center justify-between gap-3 rounded-2xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.12)] px-3 py-2 text-sm text-[rgb(var(--nc-fg))]", children: [
|
|
329
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-xs text-[rgb(var(--nc-fg-muted))]", children: "Global filter" }),
|
|
330
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
331
|
-
"input",
|
|
332
|
-
{
|
|
333
|
-
type: "search",
|
|
334
|
-
value: resolvedGlobalFilter,
|
|
335
|
-
onChange: (event) => setGlobalFilter(event.target.value),
|
|
336
|
-
placeholder: "Search all columns...",
|
|
337
|
-
className: "w-full max-w-xs rounded-xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.18)] px-3 py-2 text-xs text-[rgb(var(--nc-fg))]"
|
|
338
|
-
}
|
|
339
|
-
)
|
|
340
|
-
] }),
|
|
341
|
-
enableColumnVisibility && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "relative flex justify-end", children: [
|
|
342
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
343
|
-
"button",
|
|
344
|
-
{
|
|
345
|
-
type: "button",
|
|
346
|
-
className: "rounded-xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.12)] px-3 py-2 text-xs text-[rgb(var(--nc-fg))] transition hover:bg-[rgb(var(--nc-surface)/0.2)]",
|
|
347
|
-
onClick: () => setShowColumns((prev) => !prev),
|
|
348
|
-
children: "Columns"
|
|
349
|
-
}
|
|
350
|
-
),
|
|
351
|
-
showColumns && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "absolute right-0 top-10 z-20 w-48 rounded-2xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.2)] p-3 shadow-[0_12px_30px_rgba(0,0,0,0.35)] backdrop-blur-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "grid gap-2", children: columns.map((column) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
352
|
-
"label",
|
|
353
|
-
{
|
|
354
|
-
className: "flex items-center gap-2 text-xs text-[rgb(var(--nc-fg))]",
|
|
355
|
-
children: [
|
|
356
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
357
|
-
"input",
|
|
358
|
-
{
|
|
359
|
-
type: "checkbox",
|
|
360
|
-
className: "h-4 w-4 accent-[rgb(var(--nc-accent-1))]",
|
|
361
|
-
checked: resolvedVisibility[column.id] !== false,
|
|
362
|
-
onChange: (event) => setVisibility({
|
|
363
|
-
...resolvedVisibility,
|
|
364
|
-
[column.id]: event.target.checked
|
|
365
|
-
})
|
|
366
|
-
}
|
|
367
|
-
),
|
|
368
|
-
column.header
|
|
369
|
-
]
|
|
370
|
-
},
|
|
371
|
-
column.id
|
|
372
|
-
)) }) })
|
|
373
|
-
] }),
|
|
374
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "overflow-hidden rounded-3xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] shadow-[0_18px_50px_rgba(0,0,0,0.35)] backdrop-blur-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("table", { className: "w-full border-collapse text-left text-sm", children: [
|
|
375
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { className: "bg-[rgb(var(--nc-surface)/0.12)] text-[rgb(var(--nc-fg-muted))]", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { children: [
|
|
376
|
-
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: "w-12 px-4 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
377
|
-
"input",
|
|
378
|
-
{
|
|
379
|
-
ref: headerCheckboxRef,
|
|
380
|
-
type: "checkbox",
|
|
381
|
-
className: "h-4 w-4 accent-[rgb(var(--nc-accent-1))]",
|
|
382
|
-
checked: allSelected,
|
|
383
|
-
onChange: (event) => {
|
|
384
|
-
const next = { ...resolvedSelection };
|
|
385
|
-
pageRowIds.forEach((id) => {
|
|
386
|
-
next[id] = event.target.checked;
|
|
387
|
-
});
|
|
388
|
-
setSelection(next);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
) }),
|
|
392
|
-
visibleColumns.map((column) => {
|
|
393
|
-
var _a;
|
|
394
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
395
|
-
"th",
|
|
396
|
-
{
|
|
397
|
-
className: cn(
|
|
398
|
-
"px-4 py-3 text-xs font-semibold uppercase tracking-[0.2em]",
|
|
399
|
-
column.headerClassName
|
|
400
|
-
),
|
|
401
|
-
style: { width: column.width },
|
|
402
|
-
children: [
|
|
403
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
404
|
-
"button",
|
|
405
|
-
{
|
|
406
|
-
type: "button",
|
|
407
|
-
className: cn(
|
|
408
|
-
"flex items-center gap-2",
|
|
409
|
-
enableSorting && column.sortable !== false ? "cursor-pointer" : "cursor-default"
|
|
410
|
-
),
|
|
411
|
-
onClick: () => toggleSort(column),
|
|
412
|
-
children: [
|
|
413
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: column.header }),
|
|
414
|
-
(resolvedSort == null ? void 0 : resolvedSort.id) === column.id && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "text-[rgb(var(--nc-accent-1))]", children: resolvedSort.desc ? "\u2193" : "\u2191" })
|
|
415
|
-
]
|
|
416
|
-
}
|
|
417
|
-
),
|
|
418
|
-
enableFiltering && column.filterable !== false && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
419
|
-
"input",
|
|
420
|
-
{
|
|
421
|
-
type: "text",
|
|
422
|
-
value: (_a = resolvedFilters[column.id]) != null ? _a : "",
|
|
423
|
-
onChange: (event) => setFilters({
|
|
424
|
-
...resolvedFilters,
|
|
425
|
-
[column.id]: event.target.value
|
|
426
|
-
}),
|
|
427
|
-
placeholder: "Filter",
|
|
428
|
-
className: "mt-2 w-full rounded-xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.18)] px-2 py-1 text-xs text-[rgb(var(--nc-fg))]"
|
|
429
|
-
}
|
|
430
|
-
)
|
|
431
|
-
]
|
|
432
|
-
},
|
|
433
|
-
column.id
|
|
434
|
-
);
|
|
435
|
-
})
|
|
436
|
-
] }) }),
|
|
437
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tbody", { className: "text-[rgb(var(--nc-fg))]", children: [
|
|
438
|
-
loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
439
|
-
"td",
|
|
440
|
-
{
|
|
441
|
-
colSpan: visibleColumns.length + (enableRowSelection ? 1 : 0),
|
|
442
|
-
className: "px-4 py-10 text-center text-sm text-[rgb(var(--nc-fg-muted))]",
|
|
443
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "inline-flex items-center gap-2", children: [
|
|
444
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "h-4 w-4 animate-spin rounded-full border-2 border-[rgb(var(--nc-fg-muted))] border-t-transparent" }),
|
|
445
|
-
"Loading data..."
|
|
446
|
-
] })
|
|
447
|
-
}
|
|
448
|
-
) }),
|
|
449
|
-
!loading && pagedData.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
450
|
-
"td",
|
|
451
|
-
{
|
|
452
|
-
colSpan: visibleColumns.length + (enableRowSelection ? 1 : 0),
|
|
453
|
-
className: "px-4 py-10",
|
|
454
|
-
children: emptyContent
|
|
455
|
-
}
|
|
456
|
-
) }),
|
|
457
|
-
!loading && pagedData.map((row, rowIndex) => {
|
|
458
|
-
const rowId = rowIdFor(row, pageStartIndex + rowIndex);
|
|
459
|
-
const isSelected = resolvedSelection[rowId];
|
|
460
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
461
|
-
"tr",
|
|
462
|
-
{
|
|
463
|
-
className: cn(
|
|
464
|
-
"border-t border-[rgb(var(--nc-border)/0.15)]",
|
|
465
|
-
isSelected && "bg-[rgb(var(--nc-accent-1)/0.08)]"
|
|
466
|
-
),
|
|
467
|
-
children: [
|
|
468
|
-
enableRowSelection && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "px-4 py-4", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
469
|
-
"input",
|
|
470
|
-
{
|
|
471
|
-
type: "checkbox",
|
|
472
|
-
className: "h-4 w-4 accent-[rgb(var(--nc-accent-1))]",
|
|
473
|
-
checked: isSelected,
|
|
474
|
-
onChange: (event) => setSelection({
|
|
475
|
-
...resolvedSelection,
|
|
476
|
-
[rowId]: event.target.checked
|
|
477
|
-
})
|
|
478
|
-
}
|
|
479
|
-
) }),
|
|
480
|
-
visibleColumns.map((column) => {
|
|
481
|
-
var _a;
|
|
482
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
483
|
-
"td",
|
|
484
|
-
{
|
|
485
|
-
className: cn(
|
|
486
|
-
"px-4 py-4",
|
|
487
|
-
column.align === "center" && "text-center",
|
|
488
|
-
column.align === "right" && "text-right",
|
|
489
|
-
column.cellClassName
|
|
490
|
-
),
|
|
491
|
-
children: column.cell ? column.cell(row) : String((_a = getColumnValue(column, row)) != null ? _a : "")
|
|
492
|
-
},
|
|
493
|
-
column.id
|
|
494
|
-
);
|
|
495
|
-
})
|
|
496
|
-
]
|
|
497
|
-
},
|
|
498
|
-
rowId
|
|
499
|
-
);
|
|
500
|
-
})
|
|
501
|
-
] })
|
|
502
|
-
] }) }),
|
|
503
|
-
enablePagination && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
504
|
-
CraftPagination,
|
|
505
|
-
{
|
|
506
|
-
pageIndex: resolvedPageIndex,
|
|
507
|
-
pageCount: resolvedPageCount,
|
|
508
|
-
onPageChange: setPageIndex,
|
|
509
|
-
pageSize,
|
|
510
|
-
onPageSizeChange,
|
|
511
|
-
tone
|
|
512
|
-
}
|
|
513
|
-
)
|
|
514
|
-
] });
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
// src/components/craft-input.tsx
|
|
518
|
-
var React2 = __toESM(require("react"), 1);
|
|
519
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
520
|
-
var inputSizeClasses = {
|
|
521
|
-
sm: "h-10 px-4 text-sm",
|
|
522
|
-
md: "h-12 px-5 text-base",
|
|
523
|
-
lg: "h-14 px-6 text-lg"
|
|
524
|
-
};
|
|
525
|
-
var CraftInput = React2.forwardRef(
|
|
526
|
-
({ className, tone, inputSize = "md", glow = true, icon, ...props }, ref) => {
|
|
527
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "relative w-full", "data-nc-theme": tone, children: [
|
|
528
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "absolute left-4 top-1/2 -translate-y-1/2 text-[rgb(var(--nc-fg-soft))]", children: icon }),
|
|
529
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
530
|
-
"input",
|
|
531
|
-
{
|
|
532
|
-
ref,
|
|
533
|
-
className: cn(
|
|
534
|
-
"w-full rounded-2xl border-2 bg-[rgb(var(--nc-surface)/0.08)] text-[rgb(var(--nc-fg))] backdrop-blur-xl",
|
|
535
|
-
"shadow-[inset_0_2px_8px_rgba(0,0,0,0.3)]",
|
|
536
|
-
"focus:outline-none focus:ring-4",
|
|
537
|
-
"transition-all duration-300",
|
|
538
|
-
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
539
|
-
inputSizeClasses[inputSize],
|
|
540
|
-
"border-[rgb(var(--nc-border)/0.35)]",
|
|
541
|
-
"focus:border-[rgb(var(--nc-accent-1)/0.8)] focus:ring-[rgb(var(--nc-accent-1)/0.3)]",
|
|
542
|
-
"placeholder:text-[rgb(var(--nc-fg-soft))]",
|
|
543
|
-
glow ? "focus:shadow-[0_0_30px_-5px_var(--glow-color)]" : "",
|
|
544
|
-
icon ? "pl-12" : "",
|
|
545
|
-
className
|
|
546
|
-
),
|
|
547
|
-
style: {
|
|
548
|
-
"--glow-color": "rgb(var(--nc-accent-1) / 0.5)"
|
|
549
|
-
},
|
|
550
|
-
...props
|
|
551
|
-
}
|
|
552
|
-
)
|
|
553
|
-
] });
|
|
554
|
-
}
|
|
555
|
-
);
|
|
556
|
-
CraftInput.displayName = "CraftInput";
|
|
557
|
-
|
|
558
|
-
// src/components/craft-filter-bar.tsx
|
|
559
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
560
|
-
function CraftFilterBar({
|
|
561
|
-
title,
|
|
562
|
-
description,
|
|
563
|
-
searchValue,
|
|
564
|
-
onSearchChange,
|
|
565
|
-
searchPlaceholder = "Search...",
|
|
566
|
-
actions,
|
|
567
|
-
filters,
|
|
568
|
-
tone,
|
|
569
|
-
className
|
|
570
|
-
}) {
|
|
571
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
572
|
-
"div",
|
|
573
|
-
{
|
|
574
|
-
className: cn(
|
|
575
|
-
"rounded-3xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.12)] p-4 text-[rgb(var(--nc-fg))] shadow-[0_12px_36px_rgba(0,0,0,0.2)] backdrop-blur-2xl",
|
|
576
|
-
className
|
|
577
|
-
),
|
|
578
|
-
"data-nc-theme": tone,
|
|
579
|
-
children: [
|
|
580
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
|
|
581
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
582
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "text-lg font-semibold", children: title }),
|
|
583
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-sm text-[rgb(var(--nc-fg-muted))]", children: description })
|
|
584
|
-
] }),
|
|
585
|
-
actions && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex items-center gap-3", children: actions })
|
|
586
|
-
] }),
|
|
587
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mt-4 grid gap-4 md:grid-cols-[minmax(0,1fr)_auto]", children: [
|
|
588
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
589
|
-
CraftInput,
|
|
590
|
-
{
|
|
591
|
-
type: "search",
|
|
592
|
-
placeholder: searchPlaceholder,
|
|
593
|
-
value: searchValue != null ? searchValue : "",
|
|
594
|
-
onChange: (event) => onSearchChange == null ? void 0 : onSearchChange(event.target.value),
|
|
595
|
-
tone
|
|
596
|
-
}
|
|
597
|
-
),
|
|
598
|
-
filters && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex flex-wrap items-center gap-3", children: filters })
|
|
599
|
-
] })
|
|
600
|
-
]
|
|
601
|
-
}
|
|
602
|
-
);
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
// src/components/craft-table-toolbar.tsx
|
|
606
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
607
|
-
function CraftTableToolbar({
|
|
608
|
-
title,
|
|
609
|
-
description,
|
|
610
|
-
searchValue,
|
|
611
|
-
onSearchChange,
|
|
612
|
-
searchPlaceholder = "Search table...",
|
|
613
|
-
actions,
|
|
614
|
-
filters,
|
|
615
|
-
bulkActions,
|
|
616
|
-
tone,
|
|
617
|
-
className
|
|
618
|
-
}) {
|
|
619
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
620
|
-
"div",
|
|
621
|
-
{
|
|
622
|
-
className: cn(
|
|
623
|
-
"rounded-3xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.12)] p-4 text-[rgb(var(--nc-fg))] shadow-[0_12px_36px_rgba(0,0,0,0.2)] backdrop-blur-2xl",
|
|
624
|
-
className
|
|
625
|
-
),
|
|
626
|
-
"data-nc-theme": tone,
|
|
627
|
-
children: [
|
|
628
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
|
|
629
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
630
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { className: "text-lg font-semibold", children: title }),
|
|
631
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-sm text-[rgb(var(--nc-fg-muted))]", children: description })
|
|
632
|
-
] }),
|
|
633
|
-
actions && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "flex items-center gap-3", children: actions })
|
|
634
|
-
] }),
|
|
635
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mt-4 grid gap-4 lg:grid-cols-[minmax(0,1fr)_auto]", children: [
|
|
636
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
637
|
-
CraftInput,
|
|
638
|
-
{
|
|
639
|
-
type: "search",
|
|
640
|
-
placeholder: searchPlaceholder,
|
|
641
|
-
value: searchValue != null ? searchValue : "",
|
|
642
|
-
onChange: (event) => onSearchChange == null ? void 0 : onSearchChange(event.target.value),
|
|
643
|
-
tone
|
|
644
|
-
}
|
|
645
|
-
),
|
|
646
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
647
|
-
filters,
|
|
648
|
-
bulkActions
|
|
649
|
-
] })
|
|
650
|
-
] })
|
|
651
|
-
]
|
|
652
|
-
}
|
|
653
|
-
);
|
|
654
|
-
}
|
|
27
|
+
var import_craft_data_table = require("@/components/craft-data-table");
|
|
28
|
+
var import_craft_pagination = require("@/components/craft-pagination");
|
|
29
|
+
var import_craft_filter_bar = require("@/components/craft-filter-bar");
|
|
30
|
+
var import_craft_table_toolbar = require("@/components/craft-table-toolbar");
|
|
655
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
656
32
|
0 && (module.exports = {
|
|
657
33
|
CraftDataTable,
|