@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,127 @@
|
|
|
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_dropdown_menu_exports = {};
|
|
31
|
+
__export(craft_dropdown_menu_exports, {
|
|
32
|
+
CraftDropdownMenu: () => CraftDropdownMenu
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(craft_dropdown_menu_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
|
+
var import_craft_popover = require("../components/craft-popover");
|
|
39
|
+
function CraftDropdownMenu({
|
|
40
|
+
trigger,
|
|
41
|
+
items = [],
|
|
42
|
+
content,
|
|
43
|
+
open,
|
|
44
|
+
defaultOpen = false,
|
|
45
|
+
onOpenChange,
|
|
46
|
+
align = "end",
|
|
47
|
+
tone,
|
|
48
|
+
className,
|
|
49
|
+
menuClassName
|
|
50
|
+
}) {
|
|
51
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
|
|
52
|
+
const isControlled = typeof open === "boolean";
|
|
53
|
+
const isOpen = isControlled ? open : uncontrolledOpen;
|
|
54
|
+
const setOpen = React.useCallback(
|
|
55
|
+
(next) => {
|
|
56
|
+
if (!isControlled) setUncontrolledOpen(next);
|
|
57
|
+
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
58
|
+
},
|
|
59
|
+
[isControlled, onOpenChange]
|
|
60
|
+
);
|
|
61
|
+
const menuContent = content != null ? content : items.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_cn.cn)("space-y-1", menuClassName), role: "menu", children: items.map((item, index) => {
|
|
62
|
+
var _a;
|
|
63
|
+
const key = (_a = item.id) != null ? _a : `${index}-${String(item.label)}`;
|
|
64
|
+
const itemClasses = (0, import_cn.cn)(
|
|
65
|
+
"flex w-full items-start gap-3 rounded-xl px-3 py-2 text-left text-sm transition",
|
|
66
|
+
item.disabled ? "cursor-not-allowed text-[rgb(var(--nc-fg-soft))] opacity-60" : "text-[rgb(var(--nc-fg))] hover:bg-[rgb(var(--nc-surface)/0.12)]"
|
|
67
|
+
);
|
|
68
|
+
const contentNode = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
69
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "mt-0.5", children: item.icon }),
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "flex-1", children: [
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "block font-medium", children: item.label }),
|
|
72
|
+
item.description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "block text-xs text-[rgb(var(--nc-fg-muted))]", children: item.description })
|
|
73
|
+
] })
|
|
74
|
+
] });
|
|
75
|
+
if (item.href) {
|
|
76
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
77
|
+
"a",
|
|
78
|
+
{
|
|
79
|
+
href: item.href,
|
|
80
|
+
className: itemClasses,
|
|
81
|
+
role: "menuitem",
|
|
82
|
+
onClick: () => {
|
|
83
|
+
var _a2;
|
|
84
|
+
if (item.disabled) return;
|
|
85
|
+
(_a2 = item.onSelect) == null ? void 0 : _a2.call(item);
|
|
86
|
+
setOpen(false);
|
|
87
|
+
},
|
|
88
|
+
children: contentNode
|
|
89
|
+
},
|
|
90
|
+
key
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
94
|
+
"button",
|
|
95
|
+
{
|
|
96
|
+
type: "button",
|
|
97
|
+
className: itemClasses,
|
|
98
|
+
role: "menuitem",
|
|
99
|
+
onClick: () => {
|
|
100
|
+
var _a2;
|
|
101
|
+
if (item.disabled) return;
|
|
102
|
+
(_a2 = item.onSelect) == null ? void 0 : _a2.call(item);
|
|
103
|
+
setOpen(false);
|
|
104
|
+
},
|
|
105
|
+
children: contentNode
|
|
106
|
+
},
|
|
107
|
+
key
|
|
108
|
+
);
|
|
109
|
+
}) }) : null;
|
|
110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
111
|
+
import_craft_popover.CraftPopover,
|
|
112
|
+
{
|
|
113
|
+
trigger,
|
|
114
|
+
content: menuContent,
|
|
115
|
+
open: isOpen,
|
|
116
|
+
onOpenChange: setOpen,
|
|
117
|
+
align,
|
|
118
|
+
tone,
|
|
119
|
+
className
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
CraftDropdownMenu
|
|
126
|
+
});
|
|
127
|
+
//# sourceMappingURL=craft-dropdown-menu.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/craft-dropdown-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/utils/cn\";\nimport type { ThemeName } from \"@/theme/theme-context\";\nimport { CraftPopover } from \"@/components/craft-popover\";\n\nexport type CraftDropdownItem = {\n id?: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n icon?: React.ReactNode;\n href?: string;\n onSelect?: () => void;\n disabled?: boolean;\n};\n\nexport type CraftDropdownMenuProps = {\n trigger: React.ReactNode;\n items?: CraftDropdownItem[];\n content?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n align?: \"start\" | \"center\" | \"end\";\n tone?: ThemeName;\n className?: string;\n menuClassName?: string;\n};\n\nexport function CraftDropdownMenu({\n trigger,\n items = [],\n content,\n open,\n defaultOpen = false,\n onOpenChange,\n align = \"end\",\n tone,\n className,\n menuClassName,\n}: CraftDropdownMenuProps) {\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\n const isControlled = typeof open === \"boolean\";\n const isOpen = isControlled ? open : uncontrolledOpen;\n\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (!isControlled) setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange]\n );\n\n const menuContent =\n content ??\n (items.length ? (\n <div className={cn(\"space-y-1\", menuClassName)} role=\"menu\">\n {items.map((item, index) => {\n const key = item.id ?? `${index}-${String(item.label)}`;\n const itemClasses = cn(\n \"flex w-full items-start gap-3 rounded-xl px-3 py-2 text-left text-sm transition\",\n item.disabled\n ? \"cursor-not-allowed text-[rgb(var(--nc-fg-soft))] opacity-60\"\n : \"text-[rgb(var(--nc-fg))] hover:bg-[rgb(var(--nc-surface)/0.12)]\"\n );\n const contentNode = (\n <>\n {item.icon && <span className=\"mt-0.5\">{item.icon}</span>}\n <span className=\"flex-1\">\n <span className=\"block font-medium\">{item.label}</span>\n {item.description && (\n <span className=\"block text-xs text-[rgb(var(--nc-fg-muted))]\">\n {item.description}\n </span>\n )}\n </span>\n </>\n );\n\n if (item.href) {\n return (\n <a\n key={key}\n href={item.href}\n className={itemClasses}\n role=\"menuitem\"\n onClick={() => {\n if (item.disabled) return;\n item.onSelect?.();\n setOpen(false);\n }}\n >\n {contentNode}\n </a>\n );\n }\n\n return (\n <button\n key={key}\n type=\"button\"\n className={itemClasses}\n role=\"menuitem\"\n onClick={() => {\n if (item.disabled) return;\n item.onSelect?.();\n setOpen(false);\n }}\n >\n {contentNode}\n </button>\n );\n })}\n </div>\n ) : null);\n\n return (\n <CraftPopover\n trigger={trigger}\n content={menuContent}\n open={isOpen}\n onOpenChange={setOpen}\n align={align}\n tone={tone}\n className={className}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoEY;AAlEZ,YAAuB;AAEvB,gBAAmB;AAEnB,2BAA6B;AAyBtB,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,MAAM,SAAS,WAAW;AAC1E,QAAM,eAAe,OAAO,SAAS;AACrC,QAAM,SAAS,eAAe,OAAO;AAErC,QAAM,UAAU,MAAM;AAAA,IACpB,CAAC,SAAkB;AACjB,UAAI,CAAC,aAAc,qBAAoB,IAAI;AAC3C,mDAAe;AAAA,IACjB;AAAA,IACA,CAAC,cAAc,YAAY;AAAA,EAC7B;AAEA,QAAM,cACJ,4BACC,MAAM,SACL,4CAAC,SAAI,eAAW,cAAG,aAAa,aAAa,GAAG,MAAK,QAClD,gBAAM,IAAI,CAAC,MAAM,UAAU;AA3DpC;AA4DU,UAAM,OAAM,UAAK,OAAL,YAAW,GAAG,KAAK,IAAI,OAAO,KAAK,KAAK,CAAC;AACrD,UAAM,kBAAc;AAAA,MAClB;AAAA,MACA,KAAK,WACD,gEACA;AAAA,IACN;AACA,UAAM,cACJ,4EACG;AAAA,WAAK,QAAQ,4CAAC,UAAK,WAAU,UAAU,eAAK,MAAK;AAAA,MAClD,6CAAC,UAAK,WAAU,UACd;AAAA,oDAAC,UAAK,WAAU,qBAAqB,eAAK,OAAM;AAAA,QAC/C,KAAK,eACJ,4CAAC,UAAK,WAAU,gDACb,eAAK,aACR;AAAA,SAEJ;AAAA,OACF;AAGF,QAAI,KAAK,MAAM;AACb,aACE;AAAA,QAAC;AAAA;AAAA,UAEC,MAAM,KAAK;AAAA,UACX,WAAW;AAAA,UACX,MAAK;AAAA,UACL,SAAS,MAAM;AAxF/B,gBAAAA;AAyFkB,gBAAI,KAAK,SAAU;AACnB,aAAAA,MAAA,KAAK,aAAL,gBAAAA,IAAA;AACA,oBAAQ,KAAK;AAAA,UACf;AAAA,UAEC;AAAA;AAAA,QAVI;AAAA,MAWP;AAAA,IAEJ;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QAEC,MAAK;AAAA,QACL,WAAW;AAAA,QACX,MAAK;AAAA,QACL,SAAS,MAAM;AAzG7B,cAAAA;AA0GgB,cAAI,KAAK,SAAU;AACnB,WAAAA,MAAA,KAAK,aAAL,gBAAAA,IAAA;AACA,kBAAQ,KAAK;AAAA,QACf;AAAA,QAEC;AAAA;AAAA,MAVI;AAAA,IAWP;AAAA,EAEJ,CAAC,GACH,IACE;AAEN,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,SAAS;AAAA,MACT,MAAM;AAAA,MACN,cAAc;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":["_a"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 CraftDropdownItem = {
|
|
6
|
+
id?: string;
|
|
7
|
+
label: React.ReactNode;
|
|
8
|
+
description?: React.ReactNode;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
href?: string;
|
|
11
|
+
onSelect?: () => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type CraftDropdownMenuProps = {
|
|
15
|
+
trigger: React.ReactNode;
|
|
16
|
+
items?: CraftDropdownItem[];
|
|
17
|
+
content?: React.ReactNode;
|
|
18
|
+
open?: boolean;
|
|
19
|
+
defaultOpen?: boolean;
|
|
20
|
+
onOpenChange?: (open: boolean) => void;
|
|
21
|
+
align?: "start" | "center" | "end";
|
|
22
|
+
tone?: ThemeName;
|
|
23
|
+
className?: string;
|
|
24
|
+
menuClassName?: string;
|
|
25
|
+
};
|
|
26
|
+
declare function CraftDropdownMenu({ trigger, items, content, open, defaultOpen, onOpenChange, align, tone, className, menuClassName, }: CraftDropdownMenuProps): react_jsx_runtime.JSX.Element;
|
|
27
|
+
|
|
28
|
+
export { type CraftDropdownItem, CraftDropdownMenu, type CraftDropdownMenuProps };
|
|
@@ -0,0 +1,28 @@
|
|
|
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 CraftDropdownItem = {
|
|
6
|
+
id?: string;
|
|
7
|
+
label: React.ReactNode;
|
|
8
|
+
description?: React.ReactNode;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
href?: string;
|
|
11
|
+
onSelect?: () => void;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
type CraftDropdownMenuProps = {
|
|
15
|
+
trigger: React.ReactNode;
|
|
16
|
+
items?: CraftDropdownItem[];
|
|
17
|
+
content?: React.ReactNode;
|
|
18
|
+
open?: boolean;
|
|
19
|
+
defaultOpen?: boolean;
|
|
20
|
+
onOpenChange?: (open: boolean) => void;
|
|
21
|
+
align?: "start" | "center" | "end";
|
|
22
|
+
tone?: ThemeName;
|
|
23
|
+
className?: string;
|
|
24
|
+
menuClassName?: string;
|
|
25
|
+
};
|
|
26
|
+
declare function CraftDropdownMenu({ trigger, items, content, open, defaultOpen, onOpenChange, align, tone, className, menuClassName, }: CraftDropdownMenuProps): react_jsx_runtime.JSX.Element;
|
|
27
|
+
|
|
28
|
+
export { type CraftDropdownItem, CraftDropdownMenu, type CraftDropdownMenuProps };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cn } from "../utils/cn";
|
|
5
|
+
import { CraftPopover } from "../components/craft-popover";
|
|
6
|
+
function CraftDropdownMenu({
|
|
7
|
+
trigger,
|
|
8
|
+
items = [],
|
|
9
|
+
content,
|
|
10
|
+
open,
|
|
11
|
+
defaultOpen = false,
|
|
12
|
+
onOpenChange,
|
|
13
|
+
align = "end",
|
|
14
|
+
tone,
|
|
15
|
+
className,
|
|
16
|
+
menuClassName
|
|
17
|
+
}) {
|
|
18
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
|
|
19
|
+
const isControlled = typeof open === "boolean";
|
|
20
|
+
const isOpen = isControlled ? open : uncontrolledOpen;
|
|
21
|
+
const setOpen = React.useCallback(
|
|
22
|
+
(next) => {
|
|
23
|
+
if (!isControlled) setUncontrolledOpen(next);
|
|
24
|
+
onOpenChange == null ? void 0 : onOpenChange(next);
|
|
25
|
+
},
|
|
26
|
+
[isControlled, onOpenChange]
|
|
27
|
+
);
|
|
28
|
+
const menuContent = content != null ? content : items.length ? /* @__PURE__ */ jsx("div", { className: cn("space-y-1", menuClassName), role: "menu", children: items.map((item, index) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const key = (_a = item.id) != null ? _a : `${index}-${String(item.label)}`;
|
|
31
|
+
const itemClasses = cn(
|
|
32
|
+
"flex w-full items-start gap-3 rounded-xl px-3 py-2 text-left text-sm transition",
|
|
33
|
+
item.disabled ? "cursor-not-allowed text-[rgb(var(--nc-fg-soft))] opacity-60" : "text-[rgb(var(--nc-fg))] hover:bg-[rgb(var(--nc-surface)/0.12)]"
|
|
34
|
+
);
|
|
35
|
+
const contentNode = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
36
|
+
item.icon && /* @__PURE__ */ jsx("span", { className: "mt-0.5", children: item.icon }),
|
|
37
|
+
/* @__PURE__ */ jsxs("span", { className: "flex-1", children: [
|
|
38
|
+
/* @__PURE__ */ jsx("span", { className: "block font-medium", children: item.label }),
|
|
39
|
+
item.description && /* @__PURE__ */ jsx("span", { className: "block text-xs text-[rgb(var(--nc-fg-muted))]", children: item.description })
|
|
40
|
+
] })
|
|
41
|
+
] });
|
|
42
|
+
if (item.href) {
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
"a",
|
|
45
|
+
{
|
|
46
|
+
href: item.href,
|
|
47
|
+
className: itemClasses,
|
|
48
|
+
role: "menuitem",
|
|
49
|
+
onClick: () => {
|
|
50
|
+
var _a2;
|
|
51
|
+
if (item.disabled) return;
|
|
52
|
+
(_a2 = item.onSelect) == null ? void 0 : _a2.call(item);
|
|
53
|
+
setOpen(false);
|
|
54
|
+
},
|
|
55
|
+
children: contentNode
|
|
56
|
+
},
|
|
57
|
+
key
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
return /* @__PURE__ */ jsx(
|
|
61
|
+
"button",
|
|
62
|
+
{
|
|
63
|
+
type: "button",
|
|
64
|
+
className: itemClasses,
|
|
65
|
+
role: "menuitem",
|
|
66
|
+
onClick: () => {
|
|
67
|
+
var _a2;
|
|
68
|
+
if (item.disabled) return;
|
|
69
|
+
(_a2 = item.onSelect) == null ? void 0 : _a2.call(item);
|
|
70
|
+
setOpen(false);
|
|
71
|
+
},
|
|
72
|
+
children: contentNode
|
|
73
|
+
},
|
|
74
|
+
key
|
|
75
|
+
);
|
|
76
|
+
}) }) : null;
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
CraftPopover,
|
|
79
|
+
{
|
|
80
|
+
trigger,
|
|
81
|
+
content: menuContent,
|
|
82
|
+
open: isOpen,
|
|
83
|
+
onOpenChange: setOpen,
|
|
84
|
+
align,
|
|
85
|
+
tone,
|
|
86
|
+
className
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
CraftDropdownMenu
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=craft-dropdown-menu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/craft-dropdown-menu.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/utils/cn\";\nimport type { ThemeName } from \"@/theme/theme-context\";\nimport { CraftPopover } from \"@/components/craft-popover\";\n\nexport type CraftDropdownItem = {\n id?: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n icon?: React.ReactNode;\n href?: string;\n onSelect?: () => void;\n disabled?: boolean;\n};\n\nexport type CraftDropdownMenuProps = {\n trigger: React.ReactNode;\n items?: CraftDropdownItem[];\n content?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n align?: \"start\" | \"center\" | \"end\";\n tone?: ThemeName;\n className?: string;\n menuClassName?: string;\n};\n\nexport function CraftDropdownMenu({\n trigger,\n items = [],\n content,\n open,\n defaultOpen = false,\n onOpenChange,\n align = \"end\",\n tone,\n className,\n menuClassName,\n}: CraftDropdownMenuProps) {\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\n const isControlled = typeof open === \"boolean\";\n const isOpen = isControlled ? open : uncontrolledOpen;\n\n const setOpen = React.useCallback(\n (next: boolean) => {\n if (!isControlled) setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [isControlled, onOpenChange]\n );\n\n const menuContent =\n content ??\n (items.length ? (\n <div className={cn(\"space-y-1\", menuClassName)} role=\"menu\">\n {items.map((item, index) => {\n const key = item.id ?? `${index}-${String(item.label)}`;\n const itemClasses = cn(\n \"flex w-full items-start gap-3 rounded-xl px-3 py-2 text-left text-sm transition\",\n item.disabled\n ? \"cursor-not-allowed text-[rgb(var(--nc-fg-soft))] opacity-60\"\n : \"text-[rgb(var(--nc-fg))] hover:bg-[rgb(var(--nc-surface)/0.12)]\"\n );\n const contentNode = (\n <>\n {item.icon && <span className=\"mt-0.5\">{item.icon}</span>}\n <span className=\"flex-1\">\n <span className=\"block font-medium\">{item.label}</span>\n {item.description && (\n <span className=\"block text-xs text-[rgb(var(--nc-fg-muted))]\">\n {item.description}\n </span>\n )}\n </span>\n </>\n );\n\n if (item.href) {\n return (\n <a\n key={key}\n href={item.href}\n className={itemClasses}\n role=\"menuitem\"\n onClick={() => {\n if (item.disabled) return;\n item.onSelect?.();\n setOpen(false);\n }}\n >\n {contentNode}\n </a>\n );\n }\n\n return (\n <button\n key={key}\n type=\"button\"\n className={itemClasses}\n role=\"menuitem\"\n onClick={() => {\n if (item.disabled) return;\n item.onSelect?.();\n setOpen(false);\n }}\n >\n {contentNode}\n </button>\n );\n })}\n </div>\n ) : null);\n\n return (\n <CraftPopover\n trigger={trigger}\n content={menuContent}\n open={isOpen}\n onOpenChange={setOpen}\n align={align}\n tone={tone}\n className={className}\n />\n );\n}\n"],"mappings":";AAoEY,mBACgB,KACd,YAFF;AAlEZ,YAAY,WAAW;AAEvB,SAAS,UAAU;AAEnB,SAAS,oBAAoB;AAyBtB,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA,QAAQ,CAAC;AAAA,EACT;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,MAAM,SAAS,WAAW;AAC1E,QAAM,eAAe,OAAO,SAAS;AACrC,QAAM,SAAS,eAAe,OAAO;AAErC,QAAM,UAAU,MAAM;AAAA,IACpB,CAAC,SAAkB;AACjB,UAAI,CAAC,aAAc,qBAAoB,IAAI;AAC3C,mDAAe;AAAA,IACjB;AAAA,IACA,CAAC,cAAc,YAAY;AAAA,EAC7B;AAEA,QAAM,cACJ,4BACC,MAAM,SACL,oBAAC,SAAI,WAAW,GAAG,aAAa,aAAa,GAAG,MAAK,QAClD,gBAAM,IAAI,CAAC,MAAM,UAAU;AA3DpC;AA4DU,UAAM,OAAM,UAAK,OAAL,YAAW,GAAG,KAAK,IAAI,OAAO,KAAK,KAAK,CAAC;AACrD,UAAM,cAAc;AAAA,MAClB;AAAA,MACA,KAAK,WACD,gEACA;AAAA,IACN;AACA,UAAM,cACJ,iCACG;AAAA,WAAK,QAAQ,oBAAC,UAAK,WAAU,UAAU,eAAK,MAAK;AAAA,MAClD,qBAAC,UAAK,WAAU,UACd;AAAA,4BAAC,UAAK,WAAU,qBAAqB,eAAK,OAAM;AAAA,QAC/C,KAAK,eACJ,oBAAC,UAAK,WAAU,gDACb,eAAK,aACR;AAAA,SAEJ;AAAA,OACF;AAGF,QAAI,KAAK,MAAM;AACb,aACE;AAAA,QAAC;AAAA;AAAA,UAEC,MAAM,KAAK;AAAA,UACX,WAAW;AAAA,UACX,MAAK;AAAA,UACL,SAAS,MAAM;AAxF/B,gBAAAA;AAyFkB,gBAAI,KAAK,SAAU;AACnB,aAAAA,MAAA,KAAK,aAAL,gBAAAA,IAAA;AACA,oBAAQ,KAAK;AAAA,UACf;AAAA,UAEC;AAAA;AAAA,QAVI;AAAA,MAWP;AAAA,IAEJ;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QAEC,MAAK;AAAA,QACL,WAAW;AAAA,QACX,MAAK;AAAA,QACL,SAAS,MAAM;AAzG7B,cAAAA;AA0GgB,cAAI,KAAK,SAAU;AACnB,WAAAA,MAAA,KAAK,aAAL,gBAAAA,IAAA;AACA,kBAAQ,KAAK;AAAA,QACf;AAAA,QAEC;AAAA;AAAA,MAVI;AAAA,IAWP;AAAA,EAEJ,CAAC,GACH,IACE;AAEN,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,SAAS;AAAA,MACT,MAAM;AAAA,MACN,cAAc;AAAA,MACd;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACF;AAEJ;","names":["_a"]}
|
|
@@ -0,0 +1,58 @@
|
|
|
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_empty_state_exports = {};
|
|
20
|
+
__export(craft_empty_state_exports, {
|
|
21
|
+
CraftEmptyState: () => CraftEmptyState
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(craft_empty_state_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_cn = require("../utils/cn");
|
|
26
|
+
function CraftEmptyState({
|
|
27
|
+
className,
|
|
28
|
+
tone,
|
|
29
|
+
title,
|
|
30
|
+
description,
|
|
31
|
+
icon,
|
|
32
|
+
action,
|
|
33
|
+
...props
|
|
34
|
+
}) {
|
|
35
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: (0, import_cn.cn)(
|
|
39
|
+
"rounded-3xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] p-8 text-center text-[rgb(var(--nc-fg))] backdrop-blur-xl",
|
|
40
|
+
"shadow-[0_18px_40px_rgba(0,0,0,0.25)]",
|
|
41
|
+
className
|
|
42
|
+
),
|
|
43
|
+
"data-nc-theme": tone,
|
|
44
|
+
...props,
|
|
45
|
+
children: [
|
|
46
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-[rgb(var(--nc-accent-1)/0.2)] text-[rgb(var(--nc-accent-1))]", children: icon }),
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-xl font-semibold", children: title }),
|
|
48
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mt-2 text-sm text-[rgb(var(--nc-fg-muted))]", children: description }),
|
|
49
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-6 flex justify-center", children: action })
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
CraftEmptyState
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=craft-empty-state.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/craft-empty-state.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"@/utils/cn\";\nimport type { ThemeName } from \"@/theme/theme-context\";\n\nexport type CraftEmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {\n tone?: ThemeName;\n title: string;\n description?: string;\n icon?: React.ReactNode;\n action?: React.ReactNode;\n};\n\nexport function CraftEmptyState({\n className,\n tone,\n title,\n description,\n icon,\n action,\n ...props\n}: CraftEmptyStateProps) {\n return (\n <div\n className={cn(\n \"rounded-3xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] p-8 text-center text-[rgb(var(--nc-fg))] backdrop-blur-xl\",\n \"shadow-[0_18px_40px_rgba(0,0,0,0.25)]\",\n className\n )}\n data-nc-theme={tone}\n {...props}\n >\n {icon && (\n <div className=\"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-[rgb(var(--nc-accent-1)/0.2)] text-[rgb(var(--nc-accent-1))]\">\n {icon}\n </div>\n )}\n <h3 className=\"text-xl font-semibold\">{title}</h3>\n {description && <p className=\"mt-2 text-sm text-[rgb(var(--nc-fg-muted))]\">{description}</p>}\n {action && <div className=\"mt-6 flex justify-center\">{action}</div>}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBI;AArBJ,gBAAmB;AAWZ,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyB;AACvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,iBAAe;AAAA,MACd,GAAG;AAAA,MAEH;AAAA,gBACC,4CAAC,SAAI,WAAU,uIACZ,gBACH;AAAA,QAEF,4CAAC,QAAG,WAAU,yBAAyB,iBAAM;AAAA,QAC5C,eAAe,4CAAC,OAAE,WAAU,+CAA+C,uBAAY;AAAA,QACvF,UAAU,4CAAC,SAAI,WAAU,4BAA4B,kBAAO;AAAA;AAAA;AAAA,EAC/D;AAEJ;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 CraftEmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
tone?: ThemeName;
|
|
7
|
+
title: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
action?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
declare function CraftEmptyState({ className, tone, title, description, icon, action, ...props }: CraftEmptyStateProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { CraftEmptyState, type CraftEmptyStateProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
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 CraftEmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
tone?: ThemeName;
|
|
7
|
+
title: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
action?: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
declare function CraftEmptyState({ className, tone, title, description, icon, action, ...props }: CraftEmptyStateProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { CraftEmptyState, type CraftEmptyStateProps };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../utils/cn";
|
|
3
|
+
function CraftEmptyState({
|
|
4
|
+
className,
|
|
5
|
+
tone,
|
|
6
|
+
title,
|
|
7
|
+
description,
|
|
8
|
+
icon,
|
|
9
|
+
action,
|
|
10
|
+
...props
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
className: cn(
|
|
16
|
+
"rounded-3xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] p-8 text-center text-[rgb(var(--nc-fg))] backdrop-blur-xl",
|
|
17
|
+
"shadow-[0_18px_40px_rgba(0,0,0,0.25)]",
|
|
18
|
+
className
|
|
19
|
+
),
|
|
20
|
+
"data-nc-theme": tone,
|
|
21
|
+
...props,
|
|
22
|
+
children: [
|
|
23
|
+
icon && /* @__PURE__ */ jsx("div", { className: "mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-[rgb(var(--nc-accent-1)/0.2)] text-[rgb(var(--nc-accent-1))]", children: icon }),
|
|
24
|
+
/* @__PURE__ */ jsx("h3", { className: "text-xl font-semibold", children: title }),
|
|
25
|
+
description && /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-[rgb(var(--nc-fg-muted))]", children: description }),
|
|
26
|
+
action && /* @__PURE__ */ jsx("div", { className: "mt-6 flex justify-center", children: action })
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
CraftEmptyState
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=craft-empty-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/craft-empty-state.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"@/utils/cn\";\nimport type { ThemeName } from \"@/theme/theme-context\";\n\nexport type CraftEmptyStateProps = React.HTMLAttributes<HTMLDivElement> & {\n tone?: ThemeName;\n title: string;\n description?: string;\n icon?: React.ReactNode;\n action?: React.ReactNode;\n};\n\nexport function CraftEmptyState({\n className,\n tone,\n title,\n description,\n icon,\n action,\n ...props\n}: CraftEmptyStateProps) {\n return (\n <div\n className={cn(\n \"rounded-3xl border border-[rgb(var(--nc-border)/0.3)] bg-[rgb(var(--nc-surface)/0.08)] p-8 text-center text-[rgb(var(--nc-fg))] backdrop-blur-xl\",\n \"shadow-[0_18px_40px_rgba(0,0,0,0.25)]\",\n className\n )}\n data-nc-theme={tone}\n {...props}\n >\n {icon && (\n <div className=\"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-2xl bg-[rgb(var(--nc-accent-1)/0.2)] text-[rgb(var(--nc-accent-1))]\">\n {icon}\n </div>\n )}\n <h3 className=\"text-xl font-semibold\">{title}</h3>\n {description && <p className=\"mt-2 text-sm text-[rgb(var(--nc-fg-muted))]\">{description}</p>}\n {action && <div className=\"mt-6 flex justify-center\">{action}</div>}\n </div>\n );\n}\n"],"mappings":"AAuBI,SAUI,KAVJ;AArBJ,SAAS,UAAU;AAWZ,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyB;AACvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,iBAAe;AAAA,MACd,GAAG;AAAA,MAEH;AAAA,gBACC,oBAAC,SAAI,WAAU,uIACZ,gBACH;AAAA,QAEF,oBAAC,QAAG,WAAU,yBAAyB,iBAAM;AAAA,QAC5C,eAAe,oBAAC,OAAE,WAAU,+CAA+C,uBAAY;AAAA,QACvF,UAAU,oBAAC,SAAI,WAAU,4BAA4B,kBAAO;AAAA;AAAA;AAAA,EAC/D;AAEJ;","names":[]}
|
|
@@ -0,0 +1,60 @@
|
|
|
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_error_state_exports = {};
|
|
20
|
+
__export(craft_error_state_exports, {
|
|
21
|
+
CraftErrorState: () => CraftErrorState
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(craft_error_state_exports);
|
|
24
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
+
var import_cn = require("../utils/cn");
|
|
26
|
+
var import_craft_button = require("../components/craft-button");
|
|
27
|
+
function CraftErrorState({
|
|
28
|
+
title = "Something went wrong",
|
|
29
|
+
description = "Try again or check your connection.",
|
|
30
|
+
actionLabel = "Retry",
|
|
31
|
+
onAction,
|
|
32
|
+
action,
|
|
33
|
+
tone,
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}) {
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
className: (0, import_cn.cn)(
|
|
41
|
+
"rounded-3xl border border-[rgb(var(--nc-border)/0.35)] bg-[rgb(var(--nc-surface)/0.12)] p-6 text-[rgb(var(--nc-fg))] shadow-[0_12px_30px_rgba(0,0,0,0.25)] backdrop-blur-xl",
|
|
42
|
+
className
|
|
43
|
+
),
|
|
44
|
+
"data-nc-theme": tone,
|
|
45
|
+
...props,
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-lg font-semibold", children: title }),
|
|
49
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-[rgb(var(--nc-fg-muted))]", children: description })
|
|
50
|
+
] }),
|
|
51
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mt-4", children: action != null ? action : onAction && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_craft_button.CraftButton, { size: "sm", onClick: onAction, children: actionLabel }) })
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
CraftErrorState
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=craft-error-state.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/craft-error-state.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"@/utils/cn\";\nimport type { ThemeName } from \"@/theme/theme-context\";\nimport { CraftButton } from \"@/components/craft-button\";\n\nexport type CraftErrorStateProps = React.HTMLAttributes<HTMLDivElement> & {\n title?: React.ReactNode;\n description?: React.ReactNode;\n actionLabel?: React.ReactNode;\n onAction?: () => void;\n action?: React.ReactNode;\n tone?: ThemeName;\n};\n\nexport function CraftErrorState({\n title = \"Something went wrong\",\n description = \"Try again or check your connection.\",\n actionLabel = \"Retry\",\n onAction,\n action,\n tone,\n className,\n ...props\n}: CraftErrorStateProps) {\n return (\n <div\n className={cn(\n \"rounded-3xl border border-[rgb(var(--nc-border)/0.35)] bg-[rgb(var(--nc-surface)/0.12)] p-6 text-[rgb(var(--nc-fg))] shadow-[0_12px_30px_rgba(0,0,0,0.25)] backdrop-blur-xl\",\n className\n )}\n data-nc-theme={tone}\n {...props}\n >\n <div className=\"space-y-2\">\n <h3 className=\"text-lg font-semibold\">{title}</h3>\n <p className=\"text-sm text-[rgb(var(--nc-fg-muted))]\">{description}</p>\n </div>\n <div className=\"mt-4\">\n {action ??\n (onAction && (\n <CraftButton size=\"sm\" onClick={onAction}>\n {actionLabel}\n </CraftButton>\n ))}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkCM;AAhCN,gBAAmB;AAEnB,0BAA4B;AAWrB,SAAS,gBAAgB;AAAA,EAC9B,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyB;AACvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACA,iBAAe;AAAA,MACd,GAAG;AAAA,MAEJ;AAAA,qDAAC,SAAI,WAAU,aACb;AAAA,sDAAC,QAAG,WAAU,yBAAyB,iBAAM;AAAA,UAC7C,4CAAC,OAAE,WAAU,0CAA0C,uBAAY;AAAA,WACrE;AAAA,QACA,4CAAC,SAAI,WAAU,QACZ,oCACE,YACC,4CAAC,mCAAY,MAAK,MAAK,SAAS,UAC7B,uBACH,GAEN;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
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 CraftErrorStateProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
title?: React.ReactNode;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
actionLabel?: React.ReactNode;
|
|
9
|
+
onAction?: () => void;
|
|
10
|
+
action?: React.ReactNode;
|
|
11
|
+
tone?: ThemeName;
|
|
12
|
+
};
|
|
13
|
+
declare function CraftErrorState({ title, description, actionLabel, onAction, action, tone, className, ...props }: CraftErrorStateProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { CraftErrorState, type CraftErrorStateProps };
|
|
@@ -0,0 +1,15 @@
|
|
|
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 CraftErrorStateProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
title?: React.ReactNode;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
actionLabel?: React.ReactNode;
|
|
9
|
+
onAction?: () => void;
|
|
10
|
+
action?: React.ReactNode;
|
|
11
|
+
tone?: ThemeName;
|
|
12
|
+
};
|
|
13
|
+
declare function CraftErrorState({ title, description, actionLabel, onAction, action, tone, className, ...props }: CraftErrorStateProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { CraftErrorState, type CraftErrorStateProps };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../utils/cn";
|
|
3
|
+
import { CraftButton } from "../components/craft-button";
|
|
4
|
+
function CraftErrorState({
|
|
5
|
+
title = "Something went wrong",
|
|
6
|
+
description = "Try again or check your connection.",
|
|
7
|
+
actionLabel = "Retry",
|
|
8
|
+
onAction,
|
|
9
|
+
action,
|
|
10
|
+
tone,
|
|
11
|
+
className,
|
|
12
|
+
...props
|
|
13
|
+
}) {
|
|
14
|
+
return /* @__PURE__ */ jsxs(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
className: cn(
|
|
18
|
+
"rounded-3xl border border-[rgb(var(--nc-border)/0.35)] bg-[rgb(var(--nc-surface)/0.12)] p-6 text-[rgb(var(--nc-fg))] shadow-[0_12px_30px_rgba(0,0,0,0.25)] backdrop-blur-xl",
|
|
19
|
+
className
|
|
20
|
+
),
|
|
21
|
+
"data-nc-theme": tone,
|
|
22
|
+
...props,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
25
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold", children: title }),
|
|
26
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-[rgb(var(--nc-fg-muted))]", children: description })
|
|
27
|
+
] }),
|
|
28
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4", children: action != null ? action : onAction && /* @__PURE__ */ jsx(CraftButton, { size: "sm", onClick: onAction, children: actionLabel }) })
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
CraftErrorState
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=craft-error-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/craft-error-state.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"@/utils/cn\";\nimport type { ThemeName } from \"@/theme/theme-context\";\nimport { CraftButton } from \"@/components/craft-button\";\n\nexport type CraftErrorStateProps = React.HTMLAttributes<HTMLDivElement> & {\n title?: React.ReactNode;\n description?: React.ReactNode;\n actionLabel?: React.ReactNode;\n onAction?: () => void;\n action?: React.ReactNode;\n tone?: ThemeName;\n};\n\nexport function CraftErrorState({\n title = \"Something went wrong\",\n description = \"Try again or check your connection.\",\n actionLabel = \"Retry\",\n onAction,\n action,\n tone,\n className,\n ...props\n}: CraftErrorStateProps) {\n return (\n <div\n className={cn(\n \"rounded-3xl border border-[rgb(var(--nc-border)/0.35)] bg-[rgb(var(--nc-surface)/0.12)] p-6 text-[rgb(var(--nc-fg))] shadow-[0_12px_30px_rgba(0,0,0,0.25)] backdrop-blur-xl\",\n className\n )}\n data-nc-theme={tone}\n {...props}\n >\n <div className=\"space-y-2\">\n <h3 className=\"text-lg font-semibold\">{title}</h3>\n <p className=\"text-sm text-[rgb(var(--nc-fg-muted))]\">{description}</p>\n </div>\n <div className=\"mt-4\">\n {action ??\n (onAction && (\n <CraftButton size=\"sm\" onClick={onAction}>\n {actionLabel}\n </CraftButton>\n ))}\n </div>\n </div>\n );\n}\n"],"mappings":"AAkCM,SACE,KADF;AAhCN,SAAS,UAAU;AAEnB,SAAS,mBAAmB;AAWrB,SAAS,gBAAgB;AAAA,EAC9B,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyB;AACvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACA,iBAAe;AAAA,MACd,GAAG;AAAA,MAEJ;AAAA,6BAAC,SAAI,WAAU,aACb;AAAA,8BAAC,QAAG,WAAU,yBAAyB,iBAAM;AAAA,UAC7C,oBAAC,OAAE,WAAU,0CAA0C,uBAAY;AAAA,WACrE;AAAA,QACA,oBAAC,SAAI,WAAU,QACZ,oCACE,YACC,oBAAC,eAAY,MAAK,MAAK,SAAS,UAC7B,uBACH,GAEN;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|