@jameskabz/nextcraft-ui 0.6.6 → 0.6.7
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/components/craft-data-table.js +373 -0
- 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/components/craft-icon.js +67 -0
- 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/components/craft-input.js +44 -0
- 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/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/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/index.cjs +103 -3448
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -746
- package/dist/index.d.ts +54 -746
- package/dist/index.js +50 -3388
- package/dist/index.js.map +1 -1
- package/dist/theme-context-EVI9PfKv.d.cts +22 -0
- package/dist/theme-context-EVI9PfKv.d.ts +22 -0
- 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/utils/cn.js +7 -0
- package/dist/utils/cn.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,82 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 };
|
|
@@ -0,0 +1,14 @@
|
|
|
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 };
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 };
|
|
@@ -0,0 +1,19 @@
|
|
|
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 };
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 };
|
|
@@ -0,0 +1,19 @@
|
|
|
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 };
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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":[]}
|