@appcorp/shadcn 1.0.10
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/README.md +138 -0
- package/app/layout.d.ts +7 -0
- package/app/layout.js +18 -0
- package/app/page.d.ts +2 -0
- package/app/page.js +16 -0
- package/components/badge.d.ts +9 -0
- package/components/badge.js +82 -0
- package/components/button.d.ts +10 -0
- package/components/button.js +91 -0
- package/components/card.d.ts +9 -0
- package/components/card.js +94 -0
- package/components/carousel.d.ts +19 -0
- package/components/carousel.js +168 -0
- package/components/checkbox.d.ts +9 -0
- package/components/checkbox.js +87 -0
- package/components/combobox.d.ts +70 -0
- package/components/combobox.js +315 -0
- package/components/command.d.ts +18 -0
- package/components/command.js +115 -0
- package/components/context-menu.d.ts +25 -0
- package/components/context-menu.js +148 -0
- package/components/dialog.d.ts +15 -0
- package/components/dialog.js +118 -0
- package/components/drawer.d.ts +13 -0
- package/components/drawer.js +115 -0
- package/components/dropdown-menu.d.ts +25 -0
- package/components/dropdown-menu.js +148 -0
- package/components/enhanced-dropzone.d.ts +21 -0
- package/components/enhanced-dropzone.js +187 -0
- package/components/enhanced-table-footer-action.d.ts +35 -0
- package/components/enhanced-table-footer-action.js +110 -0
- package/components/enhanced-table-footer-page.d.ts +34 -0
- package/components/enhanced-table-footer-page.js +132 -0
- package/components/enhanced-table-footer-pagination.d.ts +38 -0
- package/components/enhanced-table-footer-pagination.js +116 -0
- package/components/enhanced-table-header-action.d.ts +7 -0
- package/components/enhanced-table-header-action.js +21 -0
- package/components/enhanced-table-header-search.d.ts +12 -0
- package/components/enhanced-table-header-search.js +17 -0
- package/components/enhanced-table.d.ts +87 -0
- package/components/enhanced-table.js +221 -0
- package/components/form.d.ts +24 -0
- package/components/form.js +125 -0
- package/components/input.d.ts +8 -0
- package/components/input.js +86 -0
- package/components/label.d.ts +7 -0
- package/components/label.js +68 -0
- package/components/popover.d.ts +7 -0
- package/components/popover.js +82 -0
- package/components/select.d.ts +15 -0
- package/components/select.js +127 -0
- package/components/separator.d.ts +4 -0
- package/components/separator.js +66 -0
- package/components/shadcn-io/color-picker/index.d.ts +43 -0
- package/components/shadcn-io/color-picker/index.js +304 -0
- package/components/shadcn-io/copy-button/index.d.ts +16 -0
- package/components/shadcn-io/copy-button/index.js +121 -0
- package/components/shadcn-io/dropzone/index.d.ts +19 -0
- package/components/shadcn-io/dropzone/index.js +131 -0
- package/components/shadcn-io/gantt/index.d.ts +145 -0
- package/components/shadcn-io/gantt/index.js +767 -0
- package/components/shadcn-io/table/index.d.ts +60 -0
- package/components/shadcn-io/table/index.js +138 -0
- package/components/sonner.d.ts +4 -0
- package/components/sonner.js +54 -0
- package/components/switch.d.ts +9 -0
- package/components/switch.js +89 -0
- package/components/table.d.ts +10 -0
- package/components/table.js +101 -0
- package/components/textarea.d.ts +8 -0
- package/components/textarea.js +86 -0
- package/lib/themes.d.ts +147 -0
- package/lib/themes.js +150 -0
- package/lib/toast-utils.d.ts +44 -0
- package/lib/toast-utils.js +212 -0
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +12 -0
- package/package.json +101 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
+
t[p] = s[p];
|
|
51
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
+
t[p[i]] = s[p[i]];
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
};
|
|
58
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
+
exports.DropdownMenu = DropdownMenu;
|
|
60
|
+
exports.DropdownMenuPortal = DropdownMenuPortal;
|
|
61
|
+
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
62
|
+
exports.DropdownMenuContent = DropdownMenuContent;
|
|
63
|
+
exports.DropdownMenuGroup = DropdownMenuGroup;
|
|
64
|
+
exports.DropdownMenuLabel = DropdownMenuLabel;
|
|
65
|
+
exports.DropdownMenuItem = DropdownMenuItem;
|
|
66
|
+
exports.DropdownMenuCheckboxItem = DropdownMenuCheckboxItem;
|
|
67
|
+
exports.DropdownMenuRadioGroup = DropdownMenuRadioGroup;
|
|
68
|
+
exports.DropdownMenuRadioItem = DropdownMenuRadioItem;
|
|
69
|
+
exports.DropdownMenuSeparator = DropdownMenuSeparator;
|
|
70
|
+
exports.DropdownMenuShortcut = DropdownMenuShortcut;
|
|
71
|
+
exports.DropdownMenuSub = DropdownMenuSub;
|
|
72
|
+
exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
|
|
73
|
+
exports.DropdownMenuSubContent = DropdownMenuSubContent;
|
|
74
|
+
var React = __importStar(require("react"));
|
|
75
|
+
var DropdownMenuPrimitive = __importStar(require("@radix-ui/react-dropdown-menu"));
|
|
76
|
+
var lucide_react_1 = require("lucide-react");
|
|
77
|
+
var utils_1 = require("../lib/utils");
|
|
78
|
+
function DropdownMenu(_a) {
|
|
79
|
+
var props = __rest(_a, []);
|
|
80
|
+
return React.createElement(DropdownMenuPrimitive.Root, __assign({ "data-slot": "dropdown-menu" }, props));
|
|
81
|
+
}
|
|
82
|
+
function DropdownMenuPortal(_a) {
|
|
83
|
+
var props = __rest(_a, []);
|
|
84
|
+
return (React.createElement(DropdownMenuPrimitive.Portal, __assign({ "data-slot": "dropdown-menu-portal" }, props)));
|
|
85
|
+
}
|
|
86
|
+
function DropdownMenuTrigger(_a) {
|
|
87
|
+
var props = __rest(_a, []);
|
|
88
|
+
return (React.createElement(DropdownMenuPrimitive.Trigger, __assign({ "data-slot": "dropdown-menu-trigger" }, props)));
|
|
89
|
+
}
|
|
90
|
+
function DropdownMenuContent(_a) {
|
|
91
|
+
var className = _a.className, _b = _a.sideOffset, sideOffset = _b === void 0 ? 4 : _b, props = __rest(_a, ["className", "sideOffset"]);
|
|
92
|
+
return (React.createElement(DropdownMenuPrimitive.Portal, null,
|
|
93
|
+
React.createElement(DropdownMenuPrimitive.Content, __assign({ "data-slot": "dropdown-menu-content", sideOffset: sideOffset, className: (0, utils_1.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md", className) }, props))));
|
|
94
|
+
}
|
|
95
|
+
function DropdownMenuGroup(_a) {
|
|
96
|
+
var props = __rest(_a, []);
|
|
97
|
+
return (React.createElement(DropdownMenuPrimitive.Group, __assign({ "data-slot": "dropdown-menu-group" }, props)));
|
|
98
|
+
}
|
|
99
|
+
function DropdownMenuItem(_a) {
|
|
100
|
+
var className = _a.className, inset = _a.inset, _b = _a.variant, variant = _b === void 0 ? "default" : _b, props = __rest(_a, ["className", "inset", "variant"]);
|
|
101
|
+
return (React.createElement(DropdownMenuPrimitive.Item, __assign({ "data-slot": "dropdown-menu-item", "data-inset": inset, "data-variant": variant, className: (0, utils_1.cn)("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className) }, props)));
|
|
102
|
+
}
|
|
103
|
+
function DropdownMenuCheckboxItem(_a) {
|
|
104
|
+
var className = _a.className, children = _a.children, checked = _a.checked, props = __rest(_a, ["className", "children", "checked"]);
|
|
105
|
+
return (React.createElement(DropdownMenuPrimitive.CheckboxItem, __assign({ "data-slot": "dropdown-menu-checkbox-item", className: (0, utils_1.cn)("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), checked: checked }, props),
|
|
106
|
+
React.createElement("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center" },
|
|
107
|
+
React.createElement(DropdownMenuPrimitive.ItemIndicator, null,
|
|
108
|
+
React.createElement(lucide_react_1.CheckIcon, { className: "size-4" }))),
|
|
109
|
+
children));
|
|
110
|
+
}
|
|
111
|
+
function DropdownMenuRadioGroup(_a) {
|
|
112
|
+
var props = __rest(_a, []);
|
|
113
|
+
return (React.createElement(DropdownMenuPrimitive.RadioGroup, __assign({ "data-slot": "dropdown-menu-radio-group" }, props)));
|
|
114
|
+
}
|
|
115
|
+
function DropdownMenuRadioItem(_a) {
|
|
116
|
+
var className = _a.className, children = _a.children, props = __rest(_a, ["className", "children"]);
|
|
117
|
+
return (React.createElement(DropdownMenuPrimitive.RadioItem, __assign({ "data-slot": "dropdown-menu-radio-item", className: (0, utils_1.cn)("focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className) }, props),
|
|
118
|
+
React.createElement("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center" },
|
|
119
|
+
React.createElement(DropdownMenuPrimitive.ItemIndicator, null,
|
|
120
|
+
React.createElement(lucide_react_1.CircleIcon, { className: "size-2 fill-current" }))),
|
|
121
|
+
children));
|
|
122
|
+
}
|
|
123
|
+
function DropdownMenuLabel(_a) {
|
|
124
|
+
var className = _a.className, inset = _a.inset, props = __rest(_a, ["className", "inset"]);
|
|
125
|
+
return (React.createElement(DropdownMenuPrimitive.Label, __assign({ "data-slot": "dropdown-menu-label", "data-inset": inset, className: (0, utils_1.cn)("px-2 py-1.5 text-sm font-medium data-[inset]:pl-8", className) }, props)));
|
|
126
|
+
}
|
|
127
|
+
function DropdownMenuSeparator(_a) {
|
|
128
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
129
|
+
return (React.createElement(DropdownMenuPrimitive.Separator, __assign({ "data-slot": "dropdown-menu-separator", className: (0, utils_1.cn)("bg-border -mx-1 my-1 h-px", className) }, props)));
|
|
130
|
+
}
|
|
131
|
+
function DropdownMenuShortcut(_a) {
|
|
132
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
133
|
+
return (React.createElement("span", __assign({ "data-slot": "dropdown-menu-shortcut", className: (0, utils_1.cn)("text-muted-foreground ml-auto text-xs tracking-widest", className) }, props)));
|
|
134
|
+
}
|
|
135
|
+
function DropdownMenuSub(_a) {
|
|
136
|
+
var props = __rest(_a, []);
|
|
137
|
+
return React.createElement(DropdownMenuPrimitive.Sub, __assign({ "data-slot": "dropdown-menu-sub" }, props));
|
|
138
|
+
}
|
|
139
|
+
function DropdownMenuSubTrigger(_a) {
|
|
140
|
+
var className = _a.className, inset = _a.inset, children = _a.children, props = __rest(_a, ["className", "inset", "children"]);
|
|
141
|
+
return (React.createElement(DropdownMenuPrimitive.SubTrigger, __assign({ "data-slot": "dropdown-menu-sub-trigger", "data-inset": inset, className: (0, utils_1.cn)("focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8", className) }, props),
|
|
142
|
+
children,
|
|
143
|
+
React.createElement(lucide_react_1.ChevronRightIcon, { className: "ml-auto size-4" })));
|
|
144
|
+
}
|
|
145
|
+
function DropdownMenuSubContent(_a) {
|
|
146
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
147
|
+
return (React.createElement(DropdownMenuPrimitive.SubContent, __assign({ "data-slot": "dropdown-menu-sub-content", className: (0, utils_1.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg", className) }, props)));
|
|
148
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { DropzoneOptions } from "react-dropzone";
|
|
3
|
+
export type EnhancedDropzoneProps = {
|
|
4
|
+
id?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
info?: string;
|
|
8
|
+
error?: string;
|
|
9
|
+
accept?: DropzoneOptions["accept"] | string[];
|
|
10
|
+
maxFiles?: number;
|
|
11
|
+
maxSize?: number;
|
|
12
|
+
minSize?: number;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Remote image URLs to display as previews */
|
|
15
|
+
value?: string[];
|
|
16
|
+
/** Called when files are selected or removed */
|
|
17
|
+
onChange?: (files: File[]) => void;
|
|
18
|
+
/** Called when a remote URL is removed */
|
|
19
|
+
onRemoveRemote?: (url: string) => void;
|
|
20
|
+
};
|
|
21
|
+
export declare const EnhancedDropzone: React.FC<EnhancedDropzoneProps>;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
48
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
49
|
+
if (ar || !(i in from)) {
|
|
50
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
51
|
+
ar[i] = from[i];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.EnhancedDropzone = void 0;
|
|
58
|
+
var react_1 = __importStar(require("react"));
|
|
59
|
+
var react_dropzone_1 = require("react-dropzone");
|
|
60
|
+
var utils_1 = require("../lib/utils");
|
|
61
|
+
var carousel_1 = require("./carousel");
|
|
62
|
+
var button_1 = require("./button");
|
|
63
|
+
var lucide_react_1 = require("lucide-react");
|
|
64
|
+
var EnhancedDropzone = function (_a) {
|
|
65
|
+
var id = _a.id, label = _a.label, info = _a.info, error = _a.error, accept = _a.accept, _b = _a.maxFiles, maxFiles = _b === void 0 ? 10 : _b, maxSize = _a.maxSize, minSize = _a.minSize, disabled = _a.disabled, _c = _a.value, value = _c === void 0 ? [] : _c, onChange = _a.onChange, onRemoveRemote = _a.onRemoveRemote, className = _a.className;
|
|
66
|
+
// Local files selected by user
|
|
67
|
+
var _d = (0, react_1.useState)([]), localFiles = _d[0], setLocalFiles = _d[1];
|
|
68
|
+
// Track object URLs created for local files
|
|
69
|
+
var localPreviewsRef = (0, react_1.useRef)(new Map());
|
|
70
|
+
// Create object URLs for local files synchronously to avoid loading state
|
|
71
|
+
var createObjectURLs = (0, react_1.useCallback)(function () {
|
|
72
|
+
var map = localPreviewsRef.current;
|
|
73
|
+
// Create URLs for new files
|
|
74
|
+
localFiles.forEach(function (file) {
|
|
75
|
+
if (!map.has(file)) {
|
|
76
|
+
try {
|
|
77
|
+
var url = URL.createObjectURL(file);
|
|
78
|
+
map.set(file, url);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.error("Failed to create object URL:", error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
// Clean up URLs for removed files
|
|
86
|
+
var currentFiles = new Set(localFiles);
|
|
87
|
+
Array.from(map.entries()).forEach(function (_a) {
|
|
88
|
+
var file = _a[0], url = _a[1];
|
|
89
|
+
if (!currentFiles.has(file)) {
|
|
90
|
+
URL.revokeObjectURL(url);
|
|
91
|
+
map.delete(file);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}, [localFiles]);
|
|
95
|
+
// Run synchronously on every render to avoid "loading" flash
|
|
96
|
+
createObjectURLs();
|
|
97
|
+
// Cleanup on unmount
|
|
98
|
+
(0, react_1.useEffect)(function () {
|
|
99
|
+
var map = localPreviewsRef.current;
|
|
100
|
+
return function () {
|
|
101
|
+
Array.from(map.values()).forEach(function (url) {
|
|
102
|
+
URL.revokeObjectURL(url);
|
|
103
|
+
});
|
|
104
|
+
map.clear();
|
|
105
|
+
};
|
|
106
|
+
}, []);
|
|
107
|
+
var dropzoneOptions = {
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
109
|
+
accept: (Array.isArray(accept) ? undefined : accept) || undefined,
|
|
110
|
+
maxFiles: maxFiles,
|
|
111
|
+
maxSize: maxSize,
|
|
112
|
+
minSize: minSize,
|
|
113
|
+
disabled: disabled,
|
|
114
|
+
onDrop: (0, react_1.useCallback)(function (acceptedFiles) {
|
|
115
|
+
setLocalFiles(function (prev) {
|
|
116
|
+
var combined = __spreadArray(__spreadArray([], prev, true), acceptedFiles, true);
|
|
117
|
+
var limited = maxFiles ? combined.slice(0, maxFiles) : combined;
|
|
118
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(limited);
|
|
119
|
+
return limited;
|
|
120
|
+
});
|
|
121
|
+
}, [maxFiles, onChange]),
|
|
122
|
+
};
|
|
123
|
+
var _e = (0, react_dropzone_1.useDropzone)(dropzoneOptions), getRootProps = _e.getRootProps, getInputProps = _e.getInputProps, isDragActive = _e.isDragActive;
|
|
124
|
+
// Remove remote URL
|
|
125
|
+
var handleRemoveRemote = (0, react_1.useCallback)(function (url) {
|
|
126
|
+
onRemoveRemote === null || onRemoveRemote === void 0 ? void 0 : onRemoveRemote(url);
|
|
127
|
+
}, [onRemoveRemote]);
|
|
128
|
+
// Remove local file
|
|
129
|
+
var handleRemoveLocal = (0, react_1.useCallback)(function (index) {
|
|
130
|
+
setLocalFiles(function (prev) {
|
|
131
|
+
var updated = prev.filter(function (_, i) { return i !== index; });
|
|
132
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(updated);
|
|
133
|
+
return updated;
|
|
134
|
+
});
|
|
135
|
+
}, [onChange]);
|
|
136
|
+
// Get all preview URLs (remote + local)
|
|
137
|
+
var allPreviews = __spreadArray(__spreadArray([], value.map(function (url) { return ({ type: "remote", url: url, index: 0 }); }), true), localFiles.map(function (file, index) { return ({
|
|
138
|
+
type: "local",
|
|
139
|
+
url: localPreviewsRef.current.get(file) || "",
|
|
140
|
+
index: index,
|
|
141
|
+
}); }), true);
|
|
142
|
+
return (react_1.default.createElement("div", { className: (0, utils_1.cn)("w-full", className) },
|
|
143
|
+
label && (react_1.default.createElement("label", { className: "mb-2 block text-sm font-medium" }, label)),
|
|
144
|
+
react_1.default.createElement("div", __assign({}, getRootProps(), { className: (0, utils_1.cn)("relative w-full rounded-md border border-dashed p-6 text-center min-h-[280px] flex items-center justify-center", isDragActive && "ring-2 ring-ring ring-offset-2", disabled && "opacity-60 pointer-events-none") }),
|
|
145
|
+
react_1.default.createElement("input", __assign({}, getInputProps(), { id: id })),
|
|
146
|
+
allPreviews.length > 0 ? (react_1.default.createElement("div", { className: "flex flex-col items-center w-full" },
|
|
147
|
+
react_1.default.createElement("div", { className: "relative w-full max-w-md" },
|
|
148
|
+
react_1.default.createElement(carousel_1.Carousel, { className: "w-full" },
|
|
149
|
+
react_1.default.createElement(carousel_1.CarouselPrevious, { type: "button", onClick: function (e) { return e.stopPropagation(); }, onPointerDown: function (e) { return e.stopPropagation(); }, onMouseDown: function (e) { return e.stopPropagation(); } }),
|
|
150
|
+
react_1.default.createElement(carousel_1.CarouselNext, { type: "button", onClick: function (e) { return e.stopPropagation(); }, onPointerDown: function (e) { return e.stopPropagation(); }, onMouseDown: function (e) { return e.stopPropagation(); } }),
|
|
151
|
+
react_1.default.createElement(carousel_1.CarouselContent, { className: "ml-0" }, allPreviews.map(function (preview, idx) { return (react_1.default.createElement(carousel_1.CarouselItem, { key: "".concat(preview.type, "-").concat(preview.url, "-").concat(idx), className: "pl-4" },
|
|
152
|
+
react_1.default.createElement("div", { className: "relative aspect-square w-full max-w-xs mx-auto" }, preview.url ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
153
|
+
react_1.default.createElement("img", { src: preview.url, alt: "Preview ".concat(idx + 1), className: "h-full w-full rounded-lg object-cover", onClick: function (e) { return e.stopPropagation(); } }),
|
|
154
|
+
react_1.default.createElement(button_1.Button, { type: "button", size: "icon", variant: "destructive", onClick: function (e) {
|
|
155
|
+
e.stopPropagation();
|
|
156
|
+
if (preview.type === "remote") {
|
|
157
|
+
handleRemoveRemote(preview.url);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
handleRemoveLocal(preview.index);
|
|
161
|
+
}
|
|
162
|
+
}, className: "absolute right-2 top-2 h-8 w-8 rounded-full", "aria-label": "Remove image" },
|
|
163
|
+
react_1.default.createElement(lucide_react_1.XIcon, { className: "h-4 w-4" })))) : (react_1.default.createElement("div", { className: "flex h-full w-full items-center justify-center rounded-lg bg-muted text-muted-foreground" },
|
|
164
|
+
react_1.default.createElement("span", { className: "text-sm" }, "Loading...")))))); })))),
|
|
165
|
+
react_1.default.createElement("p", { className: "mt-4 text-sm font-medium text-muted-foreground" },
|
|
166
|
+
allPreviews.length,
|
|
167
|
+
" image",
|
|
168
|
+
allPreviews.length !== 1 ? "s" : "",
|
|
169
|
+
" ",
|
|
170
|
+
"selected"))) : (react_1.default.createElement("div", { className: "flex flex-col items-center justify-center gap-2" },
|
|
171
|
+
react_1.default.createElement("div", { className: "flex h-12 w-12 items-center justify-center rounded-lg bg-muted text-muted-foreground" },
|
|
172
|
+
react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-image" },
|
|
173
|
+
react_1.default.createElement("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2" }),
|
|
174
|
+
react_1.default.createElement("circle", { cx: "9", cy: "9", r: "2" }),
|
|
175
|
+
react_1.default.createElement("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" }))),
|
|
176
|
+
react_1.default.createElement("div", { className: "space-y-1 text-center" },
|
|
177
|
+
react_1.default.createElement("p", { className: "font-medium text-sm" },
|
|
178
|
+
"Upload ",
|
|
179
|
+
maxFiles === 1 ? "an image" : "images"),
|
|
180
|
+
react_1.default.createElement("p", { className: "text-muted-foreground text-xs" }, "Drag and drop or click to browse"),
|
|
181
|
+
maxFiles > 1 && (react_1.default.createElement("p", { className: "text-muted-foreground text-xs" },
|
|
182
|
+
"Up to ",
|
|
183
|
+
maxFiles,
|
|
184
|
+
" files")))))),
|
|
185
|
+
(error || info) && (react_1.default.createElement("div", { className: "mt-2" }, error ? (react_1.default.createElement("p", { className: "text-xs text-destructive" }, error)) : info ? (react_1.default.createElement("p", { className: "text-xs text-blue-600 dark:text-blue-400" }, info)) : null))));
|
|
186
|
+
};
|
|
187
|
+
exports.EnhancedDropzone = EnhancedDropzone;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Table Footer Action Component
|
|
3
|
+
*
|
|
4
|
+
* Navigation buttons for table pagination with RTL/LTR support.
|
|
5
|
+
* Automatically adjusts arrow directions and button order based on locale.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - RTL/LTR arrow direction adjustment
|
|
9
|
+
* - Button order reversal for RTL layouts
|
|
10
|
+
* - Accessibility attributes
|
|
11
|
+
* - Internationalized aria labels
|
|
12
|
+
* - Disabled state handling
|
|
13
|
+
* - Loading state support
|
|
14
|
+
*/
|
|
15
|
+
import { FC } from "react";
|
|
16
|
+
interface EnhancedTableFooterActionProps {
|
|
17
|
+
/** Handler for next page navigation */
|
|
18
|
+
handleNextOnClick: () => void;
|
|
19
|
+
/** Handler for previous page navigation */
|
|
20
|
+
handlePreviousOnClick: () => void;
|
|
21
|
+
/** Whether next button should be disabled */
|
|
22
|
+
isNextDisabled?: boolean;
|
|
23
|
+
/** Whether previous button should be disabled */
|
|
24
|
+
isPreviousDisabled?: boolean;
|
|
25
|
+
/** Loading state indicator */
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
/** RTL layout flag */
|
|
28
|
+
isRTL?: boolean;
|
|
29
|
+
/** Label for previous page button */
|
|
30
|
+
previousPageLabel?: string;
|
|
31
|
+
/** Label for next page button */
|
|
32
|
+
nextPageLabel?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare const EnhancedTableFooterAction: FC<EnhancedTableFooterActionProps>;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Enhanced Table Footer Action Component
|
|
4
|
+
*
|
|
5
|
+
* Navigation buttons for table pagination with RTL/LTR support.
|
|
6
|
+
* Automatically adjusts arrow directions and button order based on locale.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - RTL/LTR arrow direction adjustment
|
|
10
|
+
* - Button order reversal for RTL layouts
|
|
11
|
+
* - Accessibility attributes
|
|
12
|
+
* - Internationalized aria labels
|
|
13
|
+
* - Disabled state handling
|
|
14
|
+
* - Loading state support
|
|
15
|
+
*/
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.EnhancedTableFooterAction = void 0;
|
|
21
|
+
var react_1 = __importDefault(require("react"));
|
|
22
|
+
var lucide_react_1 = require("lucide-react");
|
|
23
|
+
var button_1 = require("./button");
|
|
24
|
+
var EnhancedTableFooterAction = function (_a) {
|
|
25
|
+
var handleNextOnClick = _a.handleNextOnClick, handlePreviousOnClick = _a.handlePreviousOnClick, isNextDisabled = _a.isNextDisabled, isPreviousDisabled = _a.isPreviousDisabled, _b = _a.isRTL, isRTL = _b === void 0 ? false : _b, loading = _a.loading, _c = _a.nextPageLabel, nextPageLabel = _c === void 0 ? "Next page" : _c, _d = _a.previousPageLabel, previousPageLabel = _d === void 0 ? "Previous page" : _d;
|
|
26
|
+
// In RTL, arrows should be swapped:
|
|
27
|
+
// Previous should show → (ChevronRight) as it goes to the right in RTL reading order
|
|
28
|
+
// Next should show ← (ChevronLeft) as it goes to the left in RTL reading order
|
|
29
|
+
var PreviousIcon = isRTL ? lucide_react_1.ChevronRight : lucide_react_1.ChevronLeft;
|
|
30
|
+
var NextIcon = isRTL ? lucide_react_1.ChevronLeft : lucide_react_1.ChevronRight;
|
|
31
|
+
return (react_1.default.createElement("div", { className: "flex gap-1 ".concat(isRTL ? "flex-row-reverse" : "") },
|
|
32
|
+
react_1.default.createElement(button_1.Button, { variant: "outline", size: "icon", onClick: handlePreviousOnClick, disabled: isPreviousDisabled || loading, "aria-label": previousPageLabel, title: previousPageLabel, className: "".concat(isRTL ? "rotate-180" : "") },
|
|
33
|
+
react_1.default.createElement(PreviousIcon, { className: "h-4 w-4" })),
|
|
34
|
+
react_1.default.createElement(button_1.Button, { variant: "outline", size: "icon", onClick: handleNextOnClick, disabled: isNextDisabled || loading, "aria-label": nextPageLabel, title: nextPageLabel, className: "".concat(isRTL ? "rotate-180" : "") },
|
|
35
|
+
react_1.default.createElement(NextIcon, { className: "h-4 w-4" }))));
|
|
36
|
+
};
|
|
37
|
+
exports.EnhancedTableFooterAction = EnhancedTableFooterAction;
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// USAGE EXAMPLES
|
|
40
|
+
// ============================================================================
|
|
41
|
+
/*
|
|
42
|
+
Example 1: Basic usage with automatic i18n and RTL support
|
|
43
|
+
<EnhancedTableFooterAction
|
|
44
|
+
handlePreviousOnClick={() => setCurrentPage(prev => prev - 1)}
|
|
45
|
+
handleNextOnClick={() => setCurrentPage(prev => prev + 1)}
|
|
46
|
+
isPreviousDisabled={currentPage === 1}
|
|
47
|
+
isNextDisabled={currentPage === totalPages}
|
|
48
|
+
loading={false}
|
|
49
|
+
/>
|
|
50
|
+
|
|
51
|
+
Example 2: With custom aria labels
|
|
52
|
+
<EnhancedTableFooterAction
|
|
53
|
+
handlePreviousOnClick={handlePrevious}
|
|
54
|
+
handleNextOnClick={handleNext}
|
|
55
|
+
isPreviousDisabled={isPreviousDisabled}
|
|
56
|
+
isNextDisabled={isNextDisabled}
|
|
57
|
+
loading={isLoading}
|
|
58
|
+
ariaLabels={{
|
|
59
|
+
previous: "Go to previous page",
|
|
60
|
+
next: "Go to next page"
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
Example 3: Loading state
|
|
65
|
+
<EnhancedTableFooterAction
|
|
66
|
+
handlePreviousOnClick={handlePrevious}
|
|
67
|
+
handleNextOnClick={handleNext}
|
|
68
|
+
loading={true} // Both buttons will be disabled
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
RTL Behavior:
|
|
72
|
+
- In LTR languages (English): Previous (←) | Next (→)
|
|
73
|
+
- In RTL languages (Arabic/Urdu): Previous (→) | Next (←)
|
|
74
|
+
- Button order is reversed in RTL: [Next] [Previous]
|
|
75
|
+
- Arrows automatically adjust to reading direction
|
|
76
|
+
*/
|
|
77
|
+
// ============================================================================
|
|
78
|
+
// COMPONENT ENHANCEMENTS SUMMARY
|
|
79
|
+
// ============================================================================
|
|
80
|
+
/*
|
|
81
|
+
Enhancements Applied:
|
|
82
|
+
|
|
83
|
+
1. **RTL/LTR Layout Support**
|
|
84
|
+
- Automatic arrow direction adjustment based on locale
|
|
85
|
+
- Button order reversal for RTL layouts (flex-row-reverse)
|
|
86
|
+
- Direction-aware icon selection (ChevronLeft/Right swap)
|
|
87
|
+
- Proper navigation flow for both reading directions
|
|
88
|
+
|
|
89
|
+
2. **Internationalization (i18n)**
|
|
90
|
+
- Translation support using next-intl
|
|
91
|
+
- Fallback aria labels for accessibility
|
|
92
|
+
- Custom aria label override capability
|
|
93
|
+
- Tooltip support with title attributes
|
|
94
|
+
|
|
95
|
+
3. **Accessibility Improvements**
|
|
96
|
+
- ARIA labels for screen readers
|
|
97
|
+
- Title attributes for tooltips
|
|
98
|
+
- Proper button semantics
|
|
99
|
+
- Keyboard navigation support
|
|
100
|
+
|
|
101
|
+
4. **Visual Consistency**
|
|
102
|
+
- Maintains button spacing and alignment
|
|
103
|
+
- Consistent with existing table footer components
|
|
104
|
+
- Proper disabled state handling
|
|
105
|
+
- Loading state support
|
|
106
|
+
|
|
107
|
+
Translation Keys Added:
|
|
108
|
+
- common.previousPage: "Previous page" / "پچھلا صفحہ"
|
|
109
|
+
- common.nextPage: "Next page" / "اگلا صفحہ"
|
|
110
|
+
*/
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced Table Footer Page Component
|
|
3
|
+
*
|
|
4
|
+
* Displays pagination information with internationalization and RTL/LTR support.
|
|
5
|
+
* Automatically adapts text direction and order based on locale.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Full i18n support with fallback text
|
|
9
|
+
* - RTL/LTR layout adaptation
|
|
10
|
+
* - Loading state indicator
|
|
11
|
+
* - Accessibility attributes
|
|
12
|
+
* - Custom translation overrides
|
|
13
|
+
*/
|
|
14
|
+
import { FC } from "react";
|
|
15
|
+
interface EnhancedTableFooterPageProps {
|
|
16
|
+
/** Current active page number */
|
|
17
|
+
currentPage: number;
|
|
18
|
+
/** Loading state indicator */
|
|
19
|
+
loading: boolean;
|
|
20
|
+
/** Total number of pages available */
|
|
21
|
+
totalPages: number;
|
|
22
|
+
/** RTL layout flag */
|
|
23
|
+
isRTL?: boolean;
|
|
24
|
+
/** Label for "Page" text */
|
|
25
|
+
pageLabel?: string;
|
|
26
|
+
/** Label for "of" text */
|
|
27
|
+
ofLabel?: string;
|
|
28
|
+
/** Label for loading state */
|
|
29
|
+
loadingLabel?: string;
|
|
30
|
+
/** Optional CSS classes for custom styling */
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const EnhancedTableFooterPage: FC<EnhancedTableFooterPageProps>;
|
|
34
|
+
export {};
|