@jameskabz/nextcraft-ui 0.6.5 → 0.6.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/index.cjs +3448 -103
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +746 -54
- package/dist/index.d.ts +746 -54
- package/dist/index.js +3388 -50
- package/dist/index.js.map +1 -1
- package/package.json +1 -26
- package/dist/components/craft-alert.cjs +0 -69
- package/dist/components/craft-alert.cjs.map +0 -1
- package/dist/components/craft-alert.d.cts +0 -16
- package/dist/components/craft-alert.d.ts +0 -16
- package/dist/components/craft-alert.js +0 -45
- package/dist/components/craft-alert.js.map +0 -1
- package/dist/components/craft-badge.cjs +0 -54
- package/dist/components/craft-badge.cjs.map +0 -1
- package/dist/components/craft-badge.d.cts +0 -12
- package/dist/components/craft-badge.d.ts +0 -12
- package/dist/components/craft-badge.js +0 -30
- package/dist/components/craft-badge.js.map +0 -1
- package/dist/components/craft-button.cjs +0 -66
- package/dist/components/craft-button.cjs.map +0 -1
- package/dist/components/craft-button.d.cts +0 -15
- package/dist/components/craft-button.d.ts +0 -15
- package/dist/components/craft-button.js +0 -42
- package/dist/components/craft-button.js.map +0 -1
- package/dist/components/craft-card.cjs +0 -63
- package/dist/components/craft-card.cjs.map +0 -1
- package/dist/components/craft-card.d.cts +0 -13
- package/dist/components/craft-card.d.ts +0 -13
- package/dist/components/craft-card.js +0 -39
- package/dist/components/craft-card.js.map +0 -1
- package/dist/components/craft-checkbox.cjs +0 -103
- package/dist/components/craft-checkbox.cjs.map +0 -1
- package/dist/components/craft-checkbox.d.cts +0 -16
- package/dist/components/craft-checkbox.d.ts +0 -16
- package/dist/components/craft-checkbox.js +0 -69
- package/dist/components/craft-checkbox.js.map +0 -1
- package/dist/components/craft-command-palette.cjs +0 -134
- package/dist/components/craft-command-palette.cjs.map +0 -1
- package/dist/components/craft-command-palette.d.cts +0 -28
- package/dist/components/craft-command-palette.d.ts +0 -28
- package/dist/components/craft-command-palette.js +0 -100
- package/dist/components/craft-command-palette.js.map +0 -1
- package/dist/components/craft-confirm-dialog.cjs +0 -114
- package/dist/components/craft-confirm-dialog.cjs.map +0 -1
- package/dist/components/craft-confirm-dialog.d.cts +0 -21
- package/dist/components/craft-confirm-dialog.d.ts +0 -21
- package/dist/components/craft-confirm-dialog.js +0 -80
- package/dist/components/craft-confirm-dialog.js.map +0 -1
- package/dist/components/craft-create-edit-drawer.cjs +0 -112
- package/dist/components/craft-create-edit-drawer.cjs.map +0 -1
- package/dist/components/craft-create-edit-drawer.d.cts +0 -28
- package/dist/components/craft-create-edit-drawer.d.ts +0 -28
- package/dist/components/craft-create-edit-drawer.js +0 -78
- package/dist/components/craft-create-edit-drawer.js.map +0 -1
- package/dist/components/craft-currency-input.cjs +0 -68
- package/dist/components/craft-currency-input.cjs.map +0 -1
- package/dist/components/craft-currency-input.d.cts +0 -14
- package/dist/components/craft-currency-input.d.ts +0 -14
- package/dist/components/craft-currency-input.js +0 -34
- package/dist/components/craft-currency-input.js.map +0 -1
- package/dist/components/craft-data-table.cjs +0 -407
- package/dist/components/craft-data-table.cjs.map +0 -1
- package/dist/components/craft-data-table.d.cts +0 -58
- package/dist/components/craft-data-table.d.ts +0 -58
- package/dist/components/craft-data-table.js +0 -373
- package/dist/components/craft-data-table.js.map +0 -1
- package/dist/components/craft-date-picker.cjs +0 -226
- package/dist/components/craft-date-picker.cjs.map +0 -1
- package/dist/components/craft-date-picker.d.cts +0 -17
- package/dist/components/craft-date-picker.d.ts +0 -17
- package/dist/components/craft-date-picker.js +0 -192
- package/dist/components/craft-date-picker.js.map +0 -1
- package/dist/components/craft-drawer.cjs +0 -126
- package/dist/components/craft-drawer.cjs.map +0 -1
- package/dist/components/craft-drawer.d.cts +0 -19
- package/dist/components/craft-drawer.d.ts +0 -19
- package/dist/components/craft-drawer.js +0 -92
- package/dist/components/craft-drawer.js.map +0 -1
- package/dist/components/craft-dropdown-menu.cjs +0 -127
- package/dist/components/craft-dropdown-menu.cjs.map +0 -1
- package/dist/components/craft-dropdown-menu.d.cts +0 -28
- package/dist/components/craft-dropdown-menu.d.ts +0 -28
- package/dist/components/craft-dropdown-menu.js +0 -93
- package/dist/components/craft-dropdown-menu.js.map +0 -1
- package/dist/components/craft-empty-state.cjs +0 -58
- package/dist/components/craft-empty-state.cjs.map +0 -1
- package/dist/components/craft-empty-state.d.cts +0 -14
- package/dist/components/craft-empty-state.d.ts +0 -14
- package/dist/components/craft-empty-state.js +0 -34
- package/dist/components/craft-empty-state.js.map +0 -1
- package/dist/components/craft-error-state.cjs +0 -60
- package/dist/components/craft-error-state.cjs.map +0 -1
- package/dist/components/craft-error-state.d.cts +0 -15
- package/dist/components/craft-error-state.d.ts +0 -15
- package/dist/components/craft-error-state.js +0 -36
- package/dist/components/craft-error-state.js.map +0 -1
- package/dist/components/craft-filter-bar.cjs +0 -76
- package/dist/components/craft-filter-bar.cjs.map +0 -1
- package/dist/components/craft-filter-bar.d.cts +0 -18
- package/dist/components/craft-filter-bar.d.ts +0 -18
- package/dist/components/craft-filter-bar.js +0 -52
- package/dist/components/craft-filter-bar.js.map +0 -1
- package/dist/components/craft-form-builder.cjs +0 -330
- package/dist/components/craft-form-builder.cjs.map +0 -1
- package/dist/components/craft-form-builder.d.cts +0 -57
- package/dist/components/craft-form-builder.d.ts +0 -57
- package/dist/components/craft-form-builder.js +0 -301
- package/dist/components/craft-form-builder.js.map +0 -1
- package/dist/components/craft-form-field.cjs +0 -301
- package/dist/components/craft-form-field.cjs.map +0 -1
- package/dist/components/craft-form-field.d.cts +0 -30
- package/dist/components/craft-form-field.d.ts +0 -30
- package/dist/components/craft-form-field.js +0 -280
- package/dist/components/craft-form-field.js.map +0 -1
- package/dist/components/craft-form.cjs +0 -114
- package/dist/components/craft-form.cjs.map +0 -1
- package/dist/components/craft-form.d.cts +0 -27
- package/dist/components/craft-form.d.ts +0 -27
- package/dist/components/craft-form.js +0 -80
- package/dist/components/craft-form.js.map +0 -1
- package/dist/components/craft-icon.cjs +0 -102
- package/dist/components/craft-icon.cjs.map +0 -1
- package/dist/components/craft-icon.d.cts +0 -19
- package/dist/components/craft-icon.d.ts +0 -19
- package/dist/components/craft-icon.js +0 -67
- package/dist/components/craft-icon.js.map +0 -1
- package/dist/components/craft-input.cjs +0 -78
- package/dist/components/craft-input.cjs.map +0 -1
- package/dist/components/craft-input.d.cts +0 -19
- package/dist/components/craft-input.d.ts +0 -19
- package/dist/components/craft-input.js +0 -44
- package/dist/components/craft-input.js.map +0 -1
- package/dist/components/craft-link.cjs +0 -70
- package/dist/components/craft-link.cjs.map +0 -1
- package/dist/components/craft-link.d.cts +0 -14
- package/dist/components/craft-link.d.ts +0 -14
- package/dist/components/craft-link.js +0 -36
- package/dist/components/craft-link.js.map +0 -1
- package/dist/components/craft-loading-state.cjs +0 -64
- package/dist/components/craft-loading-state.cjs.map +0 -1
- package/dist/components/craft-loading-state.d.cts +0 -13
- package/dist/components/craft-loading-state.d.ts +0 -13
- package/dist/components/craft-loading-state.js +0 -40
- package/dist/components/craft-loading-state.js.map +0 -1
- package/dist/components/craft-modal.cjs +0 -174
- package/dist/components/craft-modal.cjs.map +0 -1
- package/dist/components/craft-modal.d.cts +0 -19
- package/dist/components/craft-modal.d.ts +0 -19
- package/dist/components/craft-modal.js +0 -140
- package/dist/components/craft-modal.js.map +0 -1
- package/dist/components/craft-number-input.cjs +0 -63
- package/dist/components/craft-number-input.cjs.map +0 -1
- package/dist/components/craft-number-input.d.cts +0 -12
- package/dist/components/craft-number-input.d.ts +0 -12
- package/dist/components/craft-number-input.js +0 -29
- package/dist/components/craft-number-input.js.map +0 -1
- package/dist/components/craft-pagination.cjs +0 -130
- package/dist/components/craft-pagination.cjs.map +0 -1
- package/dist/components/craft-pagination.d.cts +0 -19
- package/dist/components/craft-pagination.d.ts +0 -19
- package/dist/components/craft-pagination.js +0 -106
- package/dist/components/craft-pagination.js.map +0 -1
- package/dist/components/craft-popover.cjs +0 -123
- package/dist/components/craft-popover.cjs.map +0 -1
- package/dist/components/craft-popover.d.cts +0 -20
- package/dist/components/craft-popover.d.ts +0 -20
- package/dist/components/craft-popover.js +0 -89
- package/dist/components/craft-popover.js.map +0 -1
- package/dist/components/craft-select.cjs +0 -84
- package/dist/components/craft-select.cjs.map +0 -1
- package/dist/components/craft-select.d.cts +0 -12
- package/dist/components/craft-select.d.ts +0 -12
- package/dist/components/craft-select.js +0 -50
- package/dist/components/craft-select.js.map +0 -1
- package/dist/components/craft-skeleton.cjs +0 -45
- package/dist/components/craft-skeleton.cjs.map +0 -1
- package/dist/components/craft-skeleton.d.cts +0 -10
- package/dist/components/craft-skeleton.d.ts +0 -10
- package/dist/components/craft-skeleton.js +0 -21
- package/dist/components/craft-skeleton.js.map +0 -1
- package/dist/components/craft-stat-card.cjs +0 -67
- package/dist/components/craft-stat-card.cjs.map +0 -1
- package/dist/components/craft-stat-card.d.cts +0 -17
- package/dist/components/craft-stat-card.d.ts +0 -17
- package/dist/components/craft-stat-card.js +0 -43
- package/dist/components/craft-stat-card.js.map +0 -1
- package/dist/components/craft-submit-button.cjs +0 -71
- package/dist/components/craft-submit-button.cjs.map +0 -1
- package/dist/components/craft-submit-button.d.cts +0 -13
- package/dist/components/craft-submit-button.d.ts +0 -13
- package/dist/components/craft-submit-button.js +0 -47
- package/dist/components/craft-submit-button.js.map +0 -1
- package/dist/components/craft-switch.cjs +0 -82
- package/dist/components/craft-switch.cjs.map +0 -1
- package/dist/components/craft-switch.d.cts +0 -14
- package/dist/components/craft-switch.d.ts +0 -14
- package/dist/components/craft-switch.js +0 -48
- package/dist/components/craft-switch.js.map +0 -1
- package/dist/components/craft-table-toolbar.cjs +0 -79
- package/dist/components/craft-table-toolbar.cjs.map +0 -1
- package/dist/components/craft-table-toolbar.d.cts +0 -19
- package/dist/components/craft-table-toolbar.d.ts +0 -19
- package/dist/components/craft-table-toolbar.js +0 -55
- package/dist/components/craft-table-toolbar.js.map +0 -1
- package/dist/components/craft-tabs.cjs +0 -105
- package/dist/components/craft-tabs.cjs.map +0 -1
- package/dist/components/craft-tabs.d.cts +0 -19
- package/dist/components/craft-tabs.d.ts +0 -19
- package/dist/components/craft-tabs.js +0 -71
- package/dist/components/craft-tabs.js.map +0 -1
- package/dist/components/craft-textarea.cjs +0 -69
- package/dist/components/craft-textarea.cjs.map +0 -1
- package/dist/components/craft-textarea.d.cts +0 -12
- package/dist/components/craft-textarea.d.ts +0 -12
- package/dist/components/craft-textarea.js +0 -35
- package/dist/components/craft-textarea.js.map +0 -1
- package/dist/components/craft-toast.cjs +0 -98
- package/dist/components/craft-toast.cjs.map +0 -1
- package/dist/components/craft-toast.d.cts +0 -24
- package/dist/components/craft-toast.d.ts +0 -24
- package/dist/components/craft-toast.js +0 -63
- package/dist/components/craft-toast.js.map +0 -1
- package/dist/components/craft-tooltip.cjs +0 -75
- package/dist/components/craft-tooltip.cjs.map +0 -1
- package/dist/components/craft-tooltip.d.cts +0 -13
- package/dist/components/craft-tooltip.d.ts +0 -13
- package/dist/components/craft-tooltip.js +0 -41
- package/dist/components/craft-tooltip.js.map +0 -1
- package/dist/components/forms/types.cjs +0 -17
- package/dist/components/forms/types.cjs.map +0 -1
- package/dist/components/forms/types.d.cts +0 -7
- package/dist/components/forms/types.d.ts +0 -7
- package/dist/components/forms/types.js +0 -1
- package/dist/components/forms/types.js.map +0 -1
- package/dist/components/glass-card.cjs +0 -64
- package/dist/components/glass-card.cjs.map +0 -1
- package/dist/components/glass-card.d.cts +0 -12
- package/dist/components/glass-card.d.ts +0 -12
- package/dist/components/glass-card.js +0 -40
- package/dist/components/glass-card.js.map +0 -1
- package/dist/components/layout/app-shell.cjs +0 -49
- package/dist/components/layout/app-shell.cjs.map +0 -1
- package/dist/components/layout/app-shell.d.cts +0 -10
- package/dist/components/layout/app-shell.d.ts +0 -10
- package/dist/components/layout/app-shell.js +0 -25
- package/dist/components/layout/app-shell.js.map +0 -1
- package/dist/components/layout/app-template.cjs +0 -104
- package/dist/components/layout/app-template.cjs.map +0 -1
- package/dist/components/layout/app-template.d.cts +0 -19
- package/dist/components/layout/app-template.d.ts +0 -19
- package/dist/components/layout/app-template.js +0 -70
- package/dist/components/layout/app-template.js.map +0 -1
- package/dist/components/layout/auth-layout.cjs +0 -65
- package/dist/components/layout/auth-layout.cjs.map +0 -1
- package/dist/components/layout/auth-layout.d.cts +0 -12
- package/dist/components/layout/auth-layout.d.ts +0 -12
- package/dist/components/layout/auth-layout.js +0 -41
- package/dist/components/layout/auth-layout.js.map +0 -1
- package/dist/components/layout/breadcrumbs.cjs +0 -39
- package/dist/components/layout/breadcrumbs.cjs.map +0 -1
- package/dist/components/layout/breadcrumbs.d.cts +0 -13
- package/dist/components/layout/breadcrumbs.d.ts +0 -13
- package/dist/components/layout/breadcrumbs.js +0 -15
- package/dist/components/layout/breadcrumbs.js.map +0 -1
- package/dist/components/layout/container.cjs +0 -45
- package/dist/components/layout/container.cjs.map +0 -1
- package/dist/components/layout/container.d.cts +0 -9
- package/dist/components/layout/container.d.ts +0 -9
- package/dist/components/layout/container.js +0 -21
- package/dist/components/layout/container.js.map +0 -1
- package/dist/components/layout/grid.cjs +0 -47
- package/dist/components/layout/grid.cjs.map +0 -1
- package/dist/components/layout/grid.d.cts +0 -10
- package/dist/components/layout/grid.d.ts +0 -10
- package/dist/components/layout/grid.js +0 -23
- package/dist/components/layout/grid.js.map +0 -1
- package/dist/components/layout/layout-config.cjs +0 -78
- package/dist/components/layout/layout-config.cjs.map +0 -1
- package/dist/components/layout/layout-config.d.cts +0 -92
- package/dist/components/layout/layout-config.d.ts +0 -92
- package/dist/components/layout/layout-config.js +0 -54
- package/dist/components/layout/layout-config.js.map +0 -1
- package/dist/components/layout/page-header.cjs +0 -52
- package/dist/components/layout/page-header.cjs.map +0 -1
- package/dist/components/layout/page-header.d.cts +0 -11
- package/dist/components/layout/page-header.d.ts +0 -11
- package/dist/components/layout/page-header.js +0 -28
- package/dist/components/layout/page-header.js.map +0 -1
- package/dist/components/layout/sidebar.cjs +0 -64
- package/dist/components/layout/sidebar.cjs.map +0 -1
- package/dist/components/layout/sidebar.d.cts +0 -17
- package/dist/components/layout/sidebar.d.ts +0 -17
- package/dist/components/layout/sidebar.js +0 -40
- package/dist/components/layout/sidebar.js.map +0 -1
- package/dist/components/layout/top-nav.cjs +0 -49
- package/dist/components/layout/top-nav.cjs.map +0 -1
- package/dist/components/layout/top-nav.d.cts +0 -11
- package/dist/components/layout/top-nav.d.ts +0 -11
- package/dist/components/layout/top-nav.js +0 -25
- package/dist/components/layout/top-nav.js.map +0 -1
- package/dist/components/layout/types.cjs +0 -29
- package/dist/components/layout/types.cjs.map +0 -1
- package/dist/components/layout/types.d.cts +0 -12
- package/dist/components/layout/types.d.ts +0 -12
- package/dist/components/layout/types.js +0 -5
- package/dist/components/layout/types.js.map +0 -1
- package/dist/components/table/types.cjs +0 -17
- package/dist/components/table/types.cjs.map +0 -1
- package/dist/components/table/types.d.cts +0 -7
- package/dist/components/table/types.d.ts +0 -7
- package/dist/components/table/types.js +0 -1
- package/dist/components/table/types.js.map +0 -1
- package/dist/components/theme-switcher.cjs +0 -72
- package/dist/components/theme-switcher.cjs.map +0 -1
- package/dist/components/theme-switcher.d.cts +0 -9
- package/dist/components/theme-switcher.d.ts +0 -9
- package/dist/components/theme-switcher.js +0 -48
- package/dist/components/theme-switcher.js.map +0 -1
- package/dist/craft/components.cjs +0 -123
- package/dist/craft/components.cjs.map +0 -1
- package/dist/craft/components.d.cts +0 -36
- package/dist/craft/components.d.ts +0 -36
- package/dist/craft/components.js +0 -67
- package/dist/craft/components.js.map +0 -1
- package/dist/craft/forms.cjs +0 -35
- package/dist/craft/forms.cjs.map +0 -1
- package/dist/craft/forms.d.cts +0 -7
- package/dist/craft/forms.d.ts +0 -7
- package/dist/craft/forms.js +0 -9
- package/dist/craft/forms.js.map +0 -1
- package/dist/craft/layout.cjs +0 -56
- package/dist/craft/layout.cjs.map +0 -1
- package/dist/craft/layout.d.cts +0 -12
- package/dist/craft/layout.d.ts +0 -12
- package/dist/craft/layout.js +0 -23
- package/dist/craft/layout.js.map +0 -1
- package/dist/craft/table.cjs +0 -38
- package/dist/craft/table.cjs.map +0 -1
- package/dist/craft/table.d.cts +0 -7
- package/dist/craft/table.d.ts +0 -7
- package/dist/craft/table.js +0 -11
- package/dist/craft/table.js.map +0 -1
- package/dist/craft/theme.cjs +0 -34
- package/dist/craft/theme.cjs.map +0 -1
- package/dist/craft/theme.d.cts +0 -4
- package/dist/craft/theme.d.ts +0 -4
- package/dist/craft/theme.js +0 -8
- package/dist/craft/theme.js.map +0 -1
- package/dist/theme-context-EVI9PfKv.d.cts +0 -22
- package/dist/theme-context-EVI9PfKv.d.ts +0 -22
- package/dist/utils/cn.cjs +0 -31
- package/dist/utils/cn.cjs.map +0 -1
- package/dist/utils/cn.d.cts +0 -3
- package/dist/utils/cn.d.ts +0 -3
- package/dist/utils/cn.js +0 -7
- package/dist/utils/cn.js.map +0 -1
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
var craft_switch_exports = {};
|
|
30
|
-
__export(craft_switch_exports, {
|
|
31
|
-
CraftSwitch: () => CraftSwitch
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(craft_switch_exports);
|
|
34
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
var React = __toESM(require("react"), 1);
|
|
36
|
-
var import_cn = require("@/utils/cn");
|
|
37
|
-
const CraftSwitch = React.forwardRef(
|
|
38
|
-
({ className, tone, label, ...props }, ref) => {
|
|
39
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
40
|
-
"label",
|
|
41
|
-
{
|
|
42
|
-
className: (0, import_cn.cn)(
|
|
43
|
-
"inline-flex items-center gap-3 text-sm text-[rgb(var(--nc-fg))]",
|
|
44
|
-
props.disabled ? "opacity-60" : "cursor-pointer",
|
|
45
|
-
className
|
|
46
|
-
),
|
|
47
|
-
"data-nc-theme": tone,
|
|
48
|
-
children: [
|
|
49
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { ref, type: "checkbox", className: "peer sr-only", ...props }),
|
|
50
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
-
"span",
|
|
52
|
-
{
|
|
53
|
-
className: (0, import_cn.cn)(
|
|
54
|
-
"relative h-6 w-11 rounded-full border-2 border-[rgb(var(--nc-border)/0.35)] bg-[rgb(var(--nc-surface)/0.08)]",
|
|
55
|
-
"transition-all duration-200",
|
|
56
|
-
"peer-focus-visible:ring-2 peer-focus-visible:ring-[rgb(var(--nc-accent-1)/0.5)]",
|
|
57
|
-
"peer-checked:border-[rgb(var(--nc-accent-1)/0.6)] peer-checked:bg-[rgb(var(--nc-accent-1)/0.25)]"
|
|
58
|
-
),
|
|
59
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
-
"span",
|
|
61
|
-
{
|
|
62
|
-
className: (0, import_cn.cn)(
|
|
63
|
-
"absolute left-0.5 top-0.5 h-4 w-4 rounded-full bg-[rgb(var(--nc-surface-muted)/0.9)]",
|
|
64
|
-
"transition-all duration-200",
|
|
65
|
-
"peer-checked:translate-x-5 peer-checked:bg-[rgb(var(--nc-surface-muted))]"
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
),
|
|
71
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: label })
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
CraftSwitch.displayName = "CraftSwitch";
|
|
78
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
79
|
-
0 && (module.exports = {
|
|
80
|
-
CraftSwitch
|
|
81
|
-
});
|
|
82
|
-
//# sourceMappingURL=craft-switch.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/craft-switch.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"@/utils/cn\";\nimport type { ThemeName } from \"@/theme/theme-context\";\n\nexport type CraftSwitchProps = Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n \"type\"\n> & {\n tone?: ThemeName;\n label?: React.ReactNode;\n};\n\nexport const CraftSwitch = React.forwardRef<HTMLInputElement, CraftSwitchProps>(\n ({ className, tone, label, ...props }, ref) => {\n return (\n <label\n className={cn(\n \"inline-flex items-center gap-3 text-sm text-[rgb(var(--nc-fg))]\",\n props.disabled ? \"opacity-60\" : \"cursor-pointer\",\n className\n )}\n data-nc-theme={tone}\n >\n <input ref={ref} type=\"checkbox\" className=\"peer sr-only\" {...props} />\n <span\n className={cn(\n \"relative h-6 w-11 rounded-full border-2 border-[rgb(var(--nc-border)/0.35)] bg-[rgb(var(--nc-surface)/0.08)]\",\n \"transition-all duration-200\",\n \"peer-focus-visible:ring-2 peer-focus-visible:ring-[rgb(var(--nc-accent-1)/0.5)]\",\n \"peer-checked:border-[rgb(var(--nc-accent-1)/0.6)] peer-checked:bg-[rgb(var(--nc-accent-1)/0.25)]\"\n )}\n >\n <span\n className={cn(\n \"absolute left-0.5 top-0.5 h-4 w-4 rounded-full bg-[rgb(var(--nc-surface-muted)/0.9)]\",\n \"transition-all duration-200\",\n \"peer-checked:translate-x-5 peer-checked:bg-[rgb(var(--nc-surface-muted))]\"\n )}\n />\n </span>\n {label && <span>{label}</span>}\n </label>\n );\n }\n);\n\nCraftSwitch.displayName = \"CraftSwitch\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBM;AAhBN,YAAuB;AAEvB,gBAAmB;AAWZ,MAAM,cAAc,MAAM;AAAA,EAC/B,CAAC,EAAE,WAAW,MAAM,OAAO,GAAG,MAAM,GAAG,QAAQ;AAC7C,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAW;AAAA,UACT;AAAA,UACA,MAAM,WAAW,eAAe;AAAA,UAChC;AAAA,QACF;AAAA,QACA,iBAAe;AAAA,QAEf;AAAA,sDAAC,WAAM,KAAU,MAAK,YAAW,WAAU,gBAAgB,GAAG,OAAO;AAAA,UACrE;AAAA,YAAC;AAAA;AAAA,cACC,eAAW;AAAA,gBACT;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,cACF;AAAA,cAEA;AAAA,gBAAC;AAAA;AAAA,kBACC,eAAW;AAAA,oBACT;AAAA,oBACA;AAAA,oBACA;AAAA,kBACF;AAAA;AAAA,cACF;AAAA;AAAA,UACF;AAAA,UACC,SAAS,4CAAC,UAAM,iBAAM;AAAA;AAAA;AAAA,IACzB;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":[]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { a as ThemeName } from '../theme-context-EVI9PfKv.cjs';
|
|
3
|
-
import 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
type CraftSwitchProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> & {
|
|
6
|
-
tone?: ThemeName;
|
|
7
|
-
label?: React.ReactNode;
|
|
8
|
-
};
|
|
9
|
-
declare const CraftSwitch: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> & {
|
|
10
|
-
tone?: ThemeName;
|
|
11
|
-
label?: React.ReactNode;
|
|
12
|
-
} & React.RefAttributes<HTMLInputElement>>;
|
|
13
|
-
|
|
14
|
-
export { CraftSwitch, type CraftSwitchProps };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { a as ThemeName } from '../theme-context-EVI9PfKv.js';
|
|
3
|
-
import 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
type CraftSwitchProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> & {
|
|
6
|
-
tone?: ThemeName;
|
|
7
|
-
label?: React.ReactNode;
|
|
8
|
-
};
|
|
9
|
-
declare const CraftSwitch: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> & {
|
|
10
|
-
tone?: ThemeName;
|
|
11
|
-
label?: React.ReactNode;
|
|
12
|
-
} & React.RefAttributes<HTMLInputElement>>;
|
|
13
|
-
|
|
14
|
-
export { CraftSwitch, type CraftSwitchProps };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { cn } from "@/utils/cn";
|
|
4
|
-
const CraftSwitch = React.forwardRef(
|
|
5
|
-
({ className, tone, label, ...props }, ref) => {
|
|
6
|
-
return /* @__PURE__ */ jsxs(
|
|
7
|
-
"label",
|
|
8
|
-
{
|
|
9
|
-
className: cn(
|
|
10
|
-
"inline-flex items-center gap-3 text-sm text-[rgb(var(--nc-fg))]",
|
|
11
|
-
props.disabled ? "opacity-60" : "cursor-pointer",
|
|
12
|
-
className
|
|
13
|
-
),
|
|
14
|
-
"data-nc-theme": tone,
|
|
15
|
-
children: [
|
|
16
|
-
/* @__PURE__ */ jsx("input", { ref, type: "checkbox", className: "peer sr-only", ...props }),
|
|
17
|
-
/* @__PURE__ */ jsx(
|
|
18
|
-
"span",
|
|
19
|
-
{
|
|
20
|
-
className: cn(
|
|
21
|
-
"relative h-6 w-11 rounded-full border-2 border-[rgb(var(--nc-border)/0.35)] bg-[rgb(var(--nc-surface)/0.08)]",
|
|
22
|
-
"transition-all duration-200",
|
|
23
|
-
"peer-focus-visible:ring-2 peer-focus-visible:ring-[rgb(var(--nc-accent-1)/0.5)]",
|
|
24
|
-
"peer-checked:border-[rgb(var(--nc-accent-1)/0.6)] peer-checked:bg-[rgb(var(--nc-accent-1)/0.25)]"
|
|
25
|
-
),
|
|
26
|
-
children: /* @__PURE__ */ jsx(
|
|
27
|
-
"span",
|
|
28
|
-
{
|
|
29
|
-
className: cn(
|
|
30
|
-
"absolute left-0.5 top-0.5 h-4 w-4 rounded-full bg-[rgb(var(--nc-surface-muted)/0.9)]",
|
|
31
|
-
"transition-all duration-200",
|
|
32
|
-
"peer-checked:translate-x-5 peer-checked:bg-[rgb(var(--nc-surface-muted))]"
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
),
|
|
38
|
-
label && /* @__PURE__ */ jsx("span", { children: label })
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
CraftSwitch.displayName = "CraftSwitch";
|
|
45
|
-
export {
|
|
46
|
-
CraftSwitch
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=craft-switch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/craft-switch.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"@/utils/cn\";\nimport type { ThemeName } from \"@/theme/theme-context\";\n\nexport type CraftSwitchProps = Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n \"type\"\n> & {\n tone?: ThemeName;\n label?: React.ReactNode;\n};\n\nexport const CraftSwitch = React.forwardRef<HTMLInputElement, CraftSwitchProps>(\n ({ className, tone, label, ...props }, ref) => {\n return (\n <label\n className={cn(\n \"inline-flex items-center gap-3 text-sm text-[rgb(var(--nc-fg))]\",\n props.disabled ? \"opacity-60\" : \"cursor-pointer\",\n className\n )}\n data-nc-theme={tone}\n >\n <input ref={ref} type=\"checkbox\" className=\"peer sr-only\" {...props} />\n <span\n className={cn(\n \"relative h-6 w-11 rounded-full border-2 border-[rgb(var(--nc-border)/0.35)] bg-[rgb(var(--nc-surface)/0.08)]\",\n \"transition-all duration-200\",\n \"peer-focus-visible:ring-2 peer-focus-visible:ring-[rgb(var(--nc-accent-1)/0.5)]\",\n \"peer-checked:border-[rgb(var(--nc-accent-1)/0.6)] peer-checked:bg-[rgb(var(--nc-accent-1)/0.25)]\"\n )}\n >\n <span\n className={cn(\n \"absolute left-0.5 top-0.5 h-4 w-4 rounded-full bg-[rgb(var(--nc-surface-muted)/0.9)]\",\n \"transition-all duration-200\",\n \"peer-checked:translate-x-5 peer-checked:bg-[rgb(var(--nc-surface-muted))]\"\n )}\n />\n </span>\n {label && <span>{label}</span>}\n </label>\n );\n }\n);\n\nCraftSwitch.displayName = \"CraftSwitch\";\n"],"mappings":"AAgBM,SAQE,KARF;AAhBN,YAAY,WAAW;AAEvB,SAAS,UAAU;AAWZ,MAAM,cAAc,MAAM;AAAA,EAC/B,CAAC,EAAE,WAAW,MAAM,OAAO,GAAG,MAAM,GAAG,QAAQ;AAC7C,WACE;AAAA,MAAC;AAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,MAAM,WAAW,eAAe;AAAA,UAChC;AAAA,QACF;AAAA,QACA,iBAAe;AAAA,QAEf;AAAA,8BAAC,WAAM,KAAU,MAAK,YAAW,WAAU,gBAAgB,GAAG,OAAO;AAAA,UACrE;AAAA,YAAC;AAAA;AAAA,cACC,WAAW;AAAA,gBACT;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,cACF;AAAA,cAEA;AAAA,gBAAC;AAAA;AAAA,kBACC,WAAW;AAAA,oBACT;AAAA,oBACA;AAAA,oBACA;AAAA,kBACF;AAAA;AAAA,cACF;AAAA;AAAA,UACF;AAAA,UACC,SAAS,oBAAC,UAAM,iBAAM;AAAA;AAAA;AAAA,IACzB;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;","names":[]}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var craft_table_toolbar_exports = {};
|
|
20
|
-
__export(craft_table_toolbar_exports, {
|
|
21
|
-
CraftTableToolbar: () => CraftTableToolbar
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(craft_table_toolbar_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_cn = require("@/utils/cn");
|
|
26
|
-
var import_craft_input = require("@/components/craft-input");
|
|
27
|
-
function CraftTableToolbar({
|
|
28
|
-
title,
|
|
29
|
-
description,
|
|
30
|
-
searchValue,
|
|
31
|
-
onSearchChange,
|
|
32
|
-
searchPlaceholder = "Search table...",
|
|
33
|
-
actions,
|
|
34
|
-
filters,
|
|
35
|
-
bulkActions,
|
|
36
|
-
tone,
|
|
37
|
-
className
|
|
38
|
-
}) {
|
|
39
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
40
|
-
"div",
|
|
41
|
-
{
|
|
42
|
-
className: (0, import_cn.cn)(
|
|
43
|
-
"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",
|
|
44
|
-
className
|
|
45
|
-
),
|
|
46
|
-
"data-nc-theme": tone,
|
|
47
|
-
children: [
|
|
48
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
|
|
49
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
50
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-lg font-semibold", children: title }),
|
|
51
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-[rgb(var(--nc-fg-muted))]", children: description })
|
|
52
|
-
] }),
|
|
53
|
-
actions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex items-center gap-3", children: actions })
|
|
54
|
-
] }),
|
|
55
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mt-4 grid gap-4 lg:grid-cols-[minmax(0,1fr)_auto]", children: [
|
|
56
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
|
-
import_craft_input.CraftInput,
|
|
58
|
-
{
|
|
59
|
-
type: "search",
|
|
60
|
-
placeholder: searchPlaceholder,
|
|
61
|
-
value: searchValue != null ? searchValue : "",
|
|
62
|
-
onChange: (event) => onSearchChange == null ? void 0 : onSearchChange(event.target.value),
|
|
63
|
-
tone
|
|
64
|
-
}
|
|
65
|
-
),
|
|
66
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
67
|
-
filters,
|
|
68
|
-
bulkActions
|
|
69
|
-
] })
|
|
70
|
-
] })
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
-
0 && (module.exports = {
|
|
77
|
-
CraftTableToolbar
|
|
78
|
-
});
|
|
79
|
-
//# sourceMappingURL=craft-table-toolbar.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/craft-table-toolbar.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"@/utils/cn\";\nimport type { ThemeName } from \"@/theme/theme-context\";\nimport { CraftInput } from \"@/components/craft-input\";\n\nexport type CraftTableToolbarProps = {\n title?: React.ReactNode;\n description?: React.ReactNode;\n searchValue?: string;\n onSearchChange?: (value: string) => void;\n searchPlaceholder?: string;\n actions?: React.ReactNode;\n filters?: React.ReactNode;\n bulkActions?: React.ReactNode;\n tone?: ThemeName;\n className?: string;\n};\n\nexport function CraftTableToolbar({\n title,\n description,\n searchValue,\n onSearchChange,\n searchPlaceholder = \"Search table...\",\n actions,\n filters,\n bulkActions,\n tone,\n className,\n}: CraftTableToolbarProps) {\n return (\n <div\n className={cn(\n \"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\",\n className\n )}\n data-nc-theme={tone}\n >\n <div className=\"flex flex-wrap items-center justify-between gap-4\">\n <div>\n {title && <h3 className=\"text-lg font-semibold\">{title}</h3>}\n {description && (\n <p className=\"text-sm text-[rgb(var(--nc-fg-muted))]\">\n {description}\n </p>\n )}\n </div>\n {actions && <div className=\"flex items-center gap-3\">{actions}</div>}\n </div>\n <div className=\"mt-4 grid gap-4 lg:grid-cols-[minmax(0,1fr)_auto]\">\n <CraftInput\n type=\"search\"\n placeholder={searchPlaceholder}\n value={searchValue ?? \"\"}\n onChange={(event) => onSearchChange?.(event.target.value)}\n tone={tone}\n />\n <div className=\"flex flex-wrap items-center gap-3\">\n {filters}\n {bulkActions}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwCQ;AAtCR,gBAAmB;AAEnB,yBAA2B;AAepB,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACA,iBAAe;AAAA,MAEf;AAAA,qDAAC,SAAI,WAAU,qDACb;AAAA,uDAAC,SACE;AAAA,qBAAS,4CAAC,QAAG,WAAU,yBAAyB,iBAAM;AAAA,YACtD,eACC,4CAAC,OAAE,WAAU,0CACV,uBACH;AAAA,aAEJ;AAAA,UACC,WAAW,4CAAC,SAAI,WAAU,2BAA2B,mBAAQ;AAAA,WAChE;AAAA,QACA,6CAAC,SAAI,WAAU,qDACb;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,aAAa;AAAA,cACb,OAAO,oCAAe;AAAA,cACtB,UAAU,CAAC,UAAU,iDAAiB,MAAM,OAAO;AAAA,cACnD;AAAA;AAAA,UACF;AAAA,UACA,6CAAC,SAAI,WAAU,qCACZ;AAAA;AAAA,YACA;AAAA,aACH;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { a as ThemeName } from '../theme-context-EVI9PfKv.cjs';
|
|
4
|
-
|
|
5
|
-
type CraftTableToolbarProps = {
|
|
6
|
-
title?: React.ReactNode;
|
|
7
|
-
description?: React.ReactNode;
|
|
8
|
-
searchValue?: string;
|
|
9
|
-
onSearchChange?: (value: string) => void;
|
|
10
|
-
searchPlaceholder?: string;
|
|
11
|
-
actions?: React.ReactNode;
|
|
12
|
-
filters?: React.ReactNode;
|
|
13
|
-
bulkActions?: React.ReactNode;
|
|
14
|
-
tone?: ThemeName;
|
|
15
|
-
className?: string;
|
|
16
|
-
};
|
|
17
|
-
declare function CraftTableToolbar({ title, description, searchValue, onSearchChange, searchPlaceholder, actions, filters, bulkActions, tone, className, }: CraftTableToolbarProps): react_jsx_runtime.JSX.Element;
|
|
18
|
-
|
|
19
|
-
export { CraftTableToolbar, type CraftTableToolbarProps };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { a as ThemeName } from '../theme-context-EVI9PfKv.js';
|
|
4
|
-
|
|
5
|
-
type CraftTableToolbarProps = {
|
|
6
|
-
title?: React.ReactNode;
|
|
7
|
-
description?: React.ReactNode;
|
|
8
|
-
searchValue?: string;
|
|
9
|
-
onSearchChange?: (value: string) => void;
|
|
10
|
-
searchPlaceholder?: string;
|
|
11
|
-
actions?: React.ReactNode;
|
|
12
|
-
filters?: React.ReactNode;
|
|
13
|
-
bulkActions?: React.ReactNode;
|
|
14
|
-
tone?: ThemeName;
|
|
15
|
-
className?: string;
|
|
16
|
-
};
|
|
17
|
-
declare function CraftTableToolbar({ title, description, searchValue, onSearchChange, searchPlaceholder, actions, filters, bulkActions, tone, className, }: CraftTableToolbarProps): react_jsx_runtime.JSX.Element;
|
|
18
|
-
|
|
19
|
-
export { CraftTableToolbar, type CraftTableToolbarProps };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from "@/utils/cn";
|
|
3
|
-
import { CraftInput } from "@/components/craft-input";
|
|
4
|
-
function CraftTableToolbar({
|
|
5
|
-
title,
|
|
6
|
-
description,
|
|
7
|
-
searchValue,
|
|
8
|
-
onSearchChange,
|
|
9
|
-
searchPlaceholder = "Search table...",
|
|
10
|
-
actions,
|
|
11
|
-
filters,
|
|
12
|
-
bulkActions,
|
|
13
|
-
tone,
|
|
14
|
-
className
|
|
15
|
-
}) {
|
|
16
|
-
return /* @__PURE__ */ jsxs(
|
|
17
|
-
"div",
|
|
18
|
-
{
|
|
19
|
-
className: cn(
|
|
20
|
-
"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",
|
|
21
|
-
className
|
|
22
|
-
),
|
|
23
|
-
"data-nc-theme": tone,
|
|
24
|
-
children: [
|
|
25
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
|
|
26
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
27
|
-
title && /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold", children: title }),
|
|
28
|
-
description && /* @__PURE__ */ jsx("p", { className: "text-sm text-[rgb(var(--nc-fg-muted))]", children: description })
|
|
29
|
-
] }),
|
|
30
|
-
actions && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3", children: actions })
|
|
31
|
-
] }),
|
|
32
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-4 grid gap-4 lg:grid-cols-[minmax(0,1fr)_auto]", children: [
|
|
33
|
-
/* @__PURE__ */ jsx(
|
|
34
|
-
CraftInput,
|
|
35
|
-
{
|
|
36
|
-
type: "search",
|
|
37
|
-
placeholder: searchPlaceholder,
|
|
38
|
-
value: searchValue != null ? searchValue : "",
|
|
39
|
-
onChange: (event) => onSearchChange == null ? void 0 : onSearchChange(event.target.value),
|
|
40
|
-
tone
|
|
41
|
-
}
|
|
42
|
-
),
|
|
43
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
44
|
-
filters,
|
|
45
|
-
bulkActions
|
|
46
|
-
] })
|
|
47
|
-
] })
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
export {
|
|
53
|
-
CraftTableToolbar
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=craft-table-toolbar.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/craft-table-toolbar.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"@/utils/cn\";\nimport type { ThemeName } from \"@/theme/theme-context\";\nimport { CraftInput } from \"@/components/craft-input\";\n\nexport type CraftTableToolbarProps = {\n title?: React.ReactNode;\n description?: React.ReactNode;\n searchValue?: string;\n onSearchChange?: (value: string) => void;\n searchPlaceholder?: string;\n actions?: React.ReactNode;\n filters?: React.ReactNode;\n bulkActions?: React.ReactNode;\n tone?: ThemeName;\n className?: string;\n};\n\nexport function CraftTableToolbar({\n title,\n description,\n searchValue,\n onSearchChange,\n searchPlaceholder = \"Search table...\",\n actions,\n filters,\n bulkActions,\n tone,\n className,\n}: CraftTableToolbarProps) {\n return (\n <div\n className={cn(\n \"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\",\n className\n )}\n data-nc-theme={tone}\n >\n <div className=\"flex flex-wrap items-center justify-between gap-4\">\n <div>\n {title && <h3 className=\"text-lg font-semibold\">{title}</h3>}\n {description && (\n <p className=\"text-sm text-[rgb(var(--nc-fg-muted))]\">\n {description}\n </p>\n )}\n </div>\n {actions && <div className=\"flex items-center gap-3\">{actions}</div>}\n </div>\n <div className=\"mt-4 grid gap-4 lg:grid-cols-[minmax(0,1fr)_auto]\">\n <CraftInput\n type=\"search\"\n placeholder={searchPlaceholder}\n value={searchValue ?? \"\"}\n onChange={(event) => onSearchChange?.(event.target.value)}\n tone={tone}\n />\n <div className=\"flex flex-wrap items-center gap-3\">\n {filters}\n {bulkActions}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":"AAwCQ,SACY,KADZ;AAtCR,SAAS,UAAU;AAEnB,SAAS,kBAAkB;AAepB,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACA,iBAAe;AAAA,MAEf;AAAA,6BAAC,SAAI,WAAU,qDACb;AAAA,+BAAC,SACE;AAAA,qBAAS,oBAAC,QAAG,WAAU,yBAAyB,iBAAM;AAAA,YACtD,eACC,oBAAC,OAAE,WAAU,0CACV,uBACH;AAAA,aAEJ;AAAA,UACC,WAAW,oBAAC,SAAI,WAAU,2BAA2B,mBAAQ;AAAA,WAChE;AAAA,QACA,qBAAC,SAAI,WAAU,qDACb;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,aAAa;AAAA,cACb,OAAO,oCAAe;AAAA,cACtB,UAAU,CAAC,UAAU,iDAAiB,MAAM,OAAO;AAAA,cACnD;AAAA;AAAA,UACF;AAAA,UACA,qBAAC,SAAI,WAAU,qCACZ;AAAA;AAAA,YACA;AAAA,aACH;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
var craft_tabs_exports = {};
|
|
31
|
-
__export(craft_tabs_exports, {
|
|
32
|
-
CraftTabs: () => CraftTabs
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(craft_tabs_exports);
|
|
35
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
-
var React = __toESM(require("react"), 1);
|
|
37
|
-
var import_cn = require("@/utils/cn");
|
|
38
|
-
function CraftTabs({
|
|
39
|
-
value,
|
|
40
|
-
defaultValue,
|
|
41
|
-
onValueChange,
|
|
42
|
-
tone,
|
|
43
|
-
tabs,
|
|
44
|
-
panels,
|
|
45
|
-
className
|
|
46
|
-
}) {
|
|
47
|
-
var _a, _b;
|
|
48
|
-
const fallback = (_b = (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : "";
|
|
49
|
-
const [uncontrolledValue, setUncontrolledValue] = React.useState(
|
|
50
|
-
defaultValue != null ? defaultValue : fallback
|
|
51
|
-
);
|
|
52
|
-
const isControlled = value !== void 0;
|
|
53
|
-
const activeValue = isControlled ? value : uncontrolledValue;
|
|
54
|
-
const setValue = React.useCallback(
|
|
55
|
-
(next) => {
|
|
56
|
-
if (!isControlled) setUncontrolledValue(next);
|
|
57
|
-
onValueChange == null ? void 0 : onValueChange(next);
|
|
58
|
-
},
|
|
59
|
-
[isControlled, onValueChange]
|
|
60
|
-
);
|
|
61
|
-
const onKeyDown = (event) => {
|
|
62
|
-
if (!tabs.length) return;
|
|
63
|
-
const currentIndex = tabs.findIndex((tab) => tab.value === activeValue);
|
|
64
|
-
if (event.key === "ArrowRight") {
|
|
65
|
-
event.preventDefault();
|
|
66
|
-
const next = tabs[(currentIndex + 1) % tabs.length];
|
|
67
|
-
setValue(next.value);
|
|
68
|
-
}
|
|
69
|
-
if (event.key === "ArrowLeft") {
|
|
70
|
-
event.preventDefault();
|
|
71
|
-
const next = tabs[(currentIndex - 1 + tabs.length) % tabs.length];
|
|
72
|
-
setValue(next.value);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_cn.cn)("space-y-4", className), "data-nc-theme": tone, children: [
|
|
76
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
77
|
-
"div",
|
|
78
|
-
{
|
|
79
|
-
className: "inline-flex flex-wrap items-center gap-2 rounded-full border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] p-2",
|
|
80
|
-
role: "tablist",
|
|
81
|
-
onKeyDown,
|
|
82
|
-
children: tabs.map((tab) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
83
|
-
"button",
|
|
84
|
-
{
|
|
85
|
-
role: "tab",
|
|
86
|
-
"aria-selected": activeValue === tab.value,
|
|
87
|
-
onClick: () => setValue(tab.value),
|
|
88
|
-
className: (0, import_cn.cn)(
|
|
89
|
-
"rounded-full px-4 py-2 text-sm font-semibold transition-all",
|
|
90
|
-
activeValue === tab.value ? "bg-[rgb(var(--nc-accent-1)/0.65)] text-white shadow-[0_7px_5px_rgb(var(--nc-accent-1)/0.35)]" : "text-[rgb(var(--nc-fg-muted))] hover:text-[rgb(var(--nc-fg))]"
|
|
91
|
-
),
|
|
92
|
-
children: tab.label
|
|
93
|
-
},
|
|
94
|
-
tab.value
|
|
95
|
-
))
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "rounded-2xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] p-4 text-[rgb(var(--nc-fg))]", children: panels[activeValue] })
|
|
99
|
-
] });
|
|
100
|
-
}
|
|
101
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
102
|
-
0 && (module.exports = {
|
|
103
|
-
CraftTabs
|
|
104
|
-
});
|
|
105
|
-
//# sourceMappingURL=craft-tabs.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/craft-tabs.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/utils/cn\";\nimport type { ThemeName } from \"@/theme/theme-context\";\n\nexport type CraftTabsProps = {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n tone?: ThemeName;\n tabs: Array<{ value: string; label: React.ReactNode }>\n panels: Record<string, React.ReactNode>;\n className?: string;\n};\n\nexport function CraftTabs({\n value,\n defaultValue,\n onValueChange,\n tone,\n tabs,\n panels,\n className,\n}: CraftTabsProps) {\n const fallback = tabs[0]?.value ?? \"\";\n const [uncontrolledValue, setUncontrolledValue] = React.useState(\n defaultValue ?? fallback\n );\n const isControlled = value !== undefined;\n const activeValue = isControlled ? value : uncontrolledValue;\n\n const setValue = React.useCallback(\n (next: string) => {\n if (!isControlled) setUncontrolledValue(next);\n onValueChange?.(next);\n },\n [isControlled, onValueChange]\n );\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!tabs.length) return;\n const currentIndex = tabs.findIndex((tab) => tab.value === activeValue);\n if (event.key === \"ArrowRight\") {\n event.preventDefault();\n const next = tabs[(currentIndex + 1) % tabs.length];\n setValue(next.value);\n }\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n const next = tabs[(currentIndex - 1 + tabs.length) % tabs.length];\n setValue(next.value);\n }\n };\n\n return (\n <div className={cn(\"space-y-4\", className)} data-nc-theme={tone}>\n <div\n className=\"inline-flex flex-wrap items-center gap-2 rounded-full border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] p-2\"\n role=\"tablist\"\n onKeyDown={onKeyDown}\n >\n {tabs.map((tab) => (\n <button\n key={tab.value}\n role=\"tab\"\n aria-selected={activeValue === tab.value}\n onClick={() => setValue(tab.value)}\n className={cn(\n \"rounded-full px-4 py-2 text-sm font-semibold transition-all\",\n activeValue === tab.value\n ? \"bg-[rgb(var(--nc-accent-1)/0.65)] text-white shadow-[0_7px_5px_rgb(var(--nc-accent-1)/0.35)]\"\n : \"text-[rgb(var(--nc-fg-muted))] hover:text-[rgb(var(--nc-fg))]\"\n )}\n >\n {tab.label}\n </button>\n ))}\n </div>\n <div className=\"rounded-2xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] p-4 text-[rgb(var(--nc-fg))]\">\n {panels[activeValue]}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyDI;AAvDJ,YAAuB;AAEvB,gBAAmB;AAaZ,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAmB;AAzBnB;AA0BE,QAAM,YAAW,gBAAK,CAAC,MAAN,mBAAS,UAAT,YAAkB;AACnC,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,MAAM;AAAA,IACtD,sCAAgB;AAAA,EAClB;AACA,QAAM,eAAe,UAAU;AAC/B,QAAM,cAAc,eAAe,QAAQ;AAE3C,QAAM,WAAW,MAAM;AAAA,IACrB,CAAC,SAAiB;AAChB,UAAI,CAAC,aAAc,sBAAqB,IAAI;AAC5C,qDAAgB;AAAA,IAClB;AAAA,IACA,CAAC,cAAc,aAAa;AAAA,EAC9B;AAEA,QAAM,YAAY,CAAC,UAA+C;AAChE,QAAI,CAAC,KAAK,OAAQ;AAClB,UAAM,eAAe,KAAK,UAAU,CAAC,QAAQ,IAAI,UAAU,WAAW;AACtE,QAAI,MAAM,QAAQ,cAAc;AAC9B,YAAM,eAAe;AACrB,YAAM,OAAO,MAAM,eAAe,KAAK,KAAK,MAAM;AAClD,eAAS,KAAK,KAAK;AAAA,IACrB;AACA,QAAI,MAAM,QAAQ,aAAa;AAC7B,YAAM,eAAe;AACrB,YAAM,OAAO,MAAM,eAAe,IAAI,KAAK,UAAU,KAAK,MAAM;AAChE,eAAS,KAAK,KAAK;AAAA,IACrB;AAAA,EACF;AAEA,SACE,6CAAC,SAAI,eAAW,cAAG,aAAa,SAAS,GAAG,iBAAe,MACzD;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,MAAK;AAAA,QACL;AAAA,QAEC,eAAK,IAAI,CAAC,QACT;AAAA,UAAC;AAAA;AAAA,YAEC,MAAK;AAAA,YACL,iBAAe,gBAAgB,IAAI;AAAA,YACnC,SAAS,MAAM,SAAS,IAAI,KAAK;AAAA,YACjC,eAAW;AAAA,cACT;AAAA,cACA,gBAAgB,IAAI,QAChB,iGACA;AAAA,YACN;AAAA,YAEC,cAAI;AAAA;AAAA,UAXA,IAAI;AAAA,QAYX,CACD;AAAA;AAAA,IACH;AAAA,IACA,4CAAC,SAAI,WAAU,uHACZ,iBAAO,WAAW,GACrB;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { a as ThemeName } from '../theme-context-EVI9PfKv.cjs';
|
|
4
|
-
|
|
5
|
-
type CraftTabsProps = {
|
|
6
|
-
value?: string;
|
|
7
|
-
defaultValue?: string;
|
|
8
|
-
onValueChange?: (value: string) => void;
|
|
9
|
-
tone?: ThemeName;
|
|
10
|
-
tabs: Array<{
|
|
11
|
-
value: string;
|
|
12
|
-
label: React.ReactNode;
|
|
13
|
-
}>;
|
|
14
|
-
panels: Record<string, React.ReactNode>;
|
|
15
|
-
className?: string;
|
|
16
|
-
};
|
|
17
|
-
declare function CraftTabs({ value, defaultValue, onValueChange, tone, tabs, panels, className, }: CraftTabsProps): react_jsx_runtime.JSX.Element;
|
|
18
|
-
|
|
19
|
-
export { CraftTabs, type CraftTabsProps };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { a as ThemeName } from '../theme-context-EVI9PfKv.js';
|
|
4
|
-
|
|
5
|
-
type CraftTabsProps = {
|
|
6
|
-
value?: string;
|
|
7
|
-
defaultValue?: string;
|
|
8
|
-
onValueChange?: (value: string) => void;
|
|
9
|
-
tone?: ThemeName;
|
|
10
|
-
tabs: Array<{
|
|
11
|
-
value: string;
|
|
12
|
-
label: React.ReactNode;
|
|
13
|
-
}>;
|
|
14
|
-
panels: Record<string, React.ReactNode>;
|
|
15
|
-
className?: string;
|
|
16
|
-
};
|
|
17
|
-
declare function CraftTabs({ value, defaultValue, onValueChange, tone, tabs, panels, className, }: CraftTabsProps): react_jsx_runtime.JSX.Element;
|
|
18
|
-
|
|
19
|
-
export { CraftTabs, type CraftTabsProps };
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { cn } from "@/utils/cn";
|
|
5
|
-
function CraftTabs({
|
|
6
|
-
value,
|
|
7
|
-
defaultValue,
|
|
8
|
-
onValueChange,
|
|
9
|
-
tone,
|
|
10
|
-
tabs,
|
|
11
|
-
panels,
|
|
12
|
-
className
|
|
13
|
-
}) {
|
|
14
|
-
var _a, _b;
|
|
15
|
-
const fallback = (_b = (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : "";
|
|
16
|
-
const [uncontrolledValue, setUncontrolledValue] = React.useState(
|
|
17
|
-
defaultValue != null ? defaultValue : fallback
|
|
18
|
-
);
|
|
19
|
-
const isControlled = value !== void 0;
|
|
20
|
-
const activeValue = isControlled ? value : uncontrolledValue;
|
|
21
|
-
const setValue = React.useCallback(
|
|
22
|
-
(next) => {
|
|
23
|
-
if (!isControlled) setUncontrolledValue(next);
|
|
24
|
-
onValueChange == null ? void 0 : onValueChange(next);
|
|
25
|
-
},
|
|
26
|
-
[isControlled, onValueChange]
|
|
27
|
-
);
|
|
28
|
-
const onKeyDown = (event) => {
|
|
29
|
-
if (!tabs.length) return;
|
|
30
|
-
const currentIndex = tabs.findIndex((tab) => tab.value === activeValue);
|
|
31
|
-
if (event.key === "ArrowRight") {
|
|
32
|
-
event.preventDefault();
|
|
33
|
-
const next = tabs[(currentIndex + 1) % tabs.length];
|
|
34
|
-
setValue(next.value);
|
|
35
|
-
}
|
|
36
|
-
if (event.key === "ArrowLeft") {
|
|
37
|
-
event.preventDefault();
|
|
38
|
-
const next = tabs[(currentIndex - 1 + tabs.length) % tabs.length];
|
|
39
|
-
setValue(next.value);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-4", className), "data-nc-theme": tone, children: [
|
|
43
|
-
/* @__PURE__ */ jsx(
|
|
44
|
-
"div",
|
|
45
|
-
{
|
|
46
|
-
className: "inline-flex flex-wrap items-center gap-2 rounded-full border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] p-2",
|
|
47
|
-
role: "tablist",
|
|
48
|
-
onKeyDown,
|
|
49
|
-
children: tabs.map((tab) => /* @__PURE__ */ jsx(
|
|
50
|
-
"button",
|
|
51
|
-
{
|
|
52
|
-
role: "tab",
|
|
53
|
-
"aria-selected": activeValue === tab.value,
|
|
54
|
-
onClick: () => setValue(tab.value),
|
|
55
|
-
className: cn(
|
|
56
|
-
"rounded-full px-4 py-2 text-sm font-semibold transition-all",
|
|
57
|
-
activeValue === tab.value ? "bg-[rgb(var(--nc-accent-1)/0.65)] text-white shadow-[0_7px_5px_rgb(var(--nc-accent-1)/0.35)]" : "text-[rgb(var(--nc-fg-muted))] hover:text-[rgb(var(--nc-fg))]"
|
|
58
|
-
),
|
|
59
|
-
children: tab.label
|
|
60
|
-
},
|
|
61
|
-
tab.value
|
|
62
|
-
))
|
|
63
|
-
}
|
|
64
|
-
),
|
|
65
|
-
/* @__PURE__ */ jsx("div", { className: "rounded-2xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] p-4 text-[rgb(var(--nc-fg))]", children: panels[activeValue] })
|
|
66
|
-
] });
|
|
67
|
-
}
|
|
68
|
-
export {
|
|
69
|
-
CraftTabs
|
|
70
|
-
};
|
|
71
|
-
//# sourceMappingURL=craft-tabs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/craft-tabs.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/utils/cn\";\nimport type { ThemeName } from \"@/theme/theme-context\";\n\nexport type CraftTabsProps = {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n tone?: ThemeName;\n tabs: Array<{ value: string; label: React.ReactNode }>\n panels: Record<string, React.ReactNode>;\n className?: string;\n};\n\nexport function CraftTabs({\n value,\n defaultValue,\n onValueChange,\n tone,\n tabs,\n panels,\n className,\n}: CraftTabsProps) {\n const fallback = tabs[0]?.value ?? \"\";\n const [uncontrolledValue, setUncontrolledValue] = React.useState(\n defaultValue ?? fallback\n );\n const isControlled = value !== undefined;\n const activeValue = isControlled ? value : uncontrolledValue;\n\n const setValue = React.useCallback(\n (next: string) => {\n if (!isControlled) setUncontrolledValue(next);\n onValueChange?.(next);\n },\n [isControlled, onValueChange]\n );\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!tabs.length) return;\n const currentIndex = tabs.findIndex((tab) => tab.value === activeValue);\n if (event.key === \"ArrowRight\") {\n event.preventDefault();\n const next = tabs[(currentIndex + 1) % tabs.length];\n setValue(next.value);\n }\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n const next = tabs[(currentIndex - 1 + tabs.length) % tabs.length];\n setValue(next.value);\n }\n };\n\n return (\n <div className={cn(\"space-y-4\", className)} data-nc-theme={tone}>\n <div\n className=\"inline-flex flex-wrap items-center gap-2 rounded-full border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] p-2\"\n role=\"tablist\"\n onKeyDown={onKeyDown}\n >\n {tabs.map((tab) => (\n <button\n key={tab.value}\n role=\"tab\"\n aria-selected={activeValue === tab.value}\n onClick={() => setValue(tab.value)}\n className={cn(\n \"rounded-full px-4 py-2 text-sm font-semibold transition-all\",\n activeValue === tab.value\n ? \"bg-[rgb(var(--nc-accent-1)/0.65)] text-white shadow-[0_7px_5px_rgb(var(--nc-accent-1)/0.35)]\"\n : \"text-[rgb(var(--nc-fg-muted))] hover:text-[rgb(var(--nc-fg))]\"\n )}\n >\n {tab.label}\n </button>\n ))}\n </div>\n <div className=\"rounded-2xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] p-4 text-[rgb(var(--nc-fg))]\">\n {panels[activeValue]}\n </div>\n </div>\n );\n}\n"],"mappings":";AAyDI,SAOM,KAPN;AAvDJ,YAAY,WAAW;AAEvB,SAAS,UAAU;AAaZ,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAmB;AAzBnB;AA0BE,QAAM,YAAW,gBAAK,CAAC,MAAN,mBAAS,UAAT,YAAkB;AACnC,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,MAAM;AAAA,IACtD,sCAAgB;AAAA,EAClB;AACA,QAAM,eAAe,UAAU;AAC/B,QAAM,cAAc,eAAe,QAAQ;AAE3C,QAAM,WAAW,MAAM;AAAA,IACrB,CAAC,SAAiB;AAChB,UAAI,CAAC,aAAc,sBAAqB,IAAI;AAC5C,qDAAgB;AAAA,IAClB;AAAA,IACA,CAAC,cAAc,aAAa;AAAA,EAC9B;AAEA,QAAM,YAAY,CAAC,UAA+C;AAChE,QAAI,CAAC,KAAK,OAAQ;AAClB,UAAM,eAAe,KAAK,UAAU,CAAC,QAAQ,IAAI,UAAU,WAAW;AACtE,QAAI,MAAM,QAAQ,cAAc;AAC9B,YAAM,eAAe;AACrB,YAAM,OAAO,MAAM,eAAe,KAAK,KAAK,MAAM;AAClD,eAAS,KAAK,KAAK;AAAA,IACrB;AACA,QAAI,MAAM,QAAQ,aAAa;AAC7B,YAAM,eAAe;AACrB,YAAM,OAAO,MAAM,eAAe,IAAI,KAAK,UAAU,KAAK,MAAM;AAChE,eAAS,KAAK,KAAK;AAAA,IACrB;AAAA,EACF;AAEA,SACE,qBAAC,SAAI,WAAW,GAAG,aAAa,SAAS,GAAG,iBAAe,MACzD;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,MAAK;AAAA,QACL;AAAA,QAEC,eAAK,IAAI,CAAC,QACT;AAAA,UAAC;AAAA;AAAA,YAEC,MAAK;AAAA,YACL,iBAAe,gBAAgB,IAAI;AAAA,YACnC,SAAS,MAAM,SAAS,IAAI,KAAK;AAAA,YACjC,WAAW;AAAA,cACT;AAAA,cACA,gBAAgB,IAAI,QAChB,iGACA;AAAA,YACN;AAAA,YAEC,cAAI;AAAA;AAAA,UAXA,IAAI;AAAA,QAYX,CACD;AAAA;AAAA,IACH;AAAA,IACA,oBAAC,SAAI,WAAU,uHACZ,iBAAO,WAAW,GACrB;AAAA,KACF;AAEJ;","names":[]}
|