defuss-shadcn 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +44 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +17 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +44 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/dist/index.cjs
CHANGED
|
@@ -4225,13 +4225,16 @@ const DropArea = ({
|
|
|
4225
4225
|
size = "md",
|
|
4226
4226
|
children,
|
|
4227
4227
|
style,
|
|
4228
|
+
accept,
|
|
4228
4229
|
ref = defuss.createRef(),
|
|
4229
4230
|
onDrop,
|
|
4230
4231
|
onDragEnter,
|
|
4231
4232
|
onDragLeave,
|
|
4233
|
+
onFileSelect,
|
|
4232
4234
|
...props
|
|
4233
4235
|
}) => {
|
|
4234
4236
|
const dropAreaRef = ref || defuss.createRef();
|
|
4237
|
+
const fileInputRef = defuss.createRef();
|
|
4235
4238
|
const attachNativeDragHandlers = () => {
|
|
4236
4239
|
const el = dropAreaRef.current;
|
|
4237
4240
|
if (!el) return;
|
|
@@ -4248,28 +4251,55 @@ const DropArea = ({
|
|
|
4248
4251
|
el.addEventListener("drop", (e) => {
|
|
4249
4252
|
e.preventDefault();
|
|
4250
4253
|
onDrop?.(e);
|
|
4254
|
+
if (e.dataTransfer?.files?.length) {
|
|
4255
|
+
onFileSelect?.(e.dataTransfer.files);
|
|
4256
|
+
}
|
|
4257
|
+
});
|
|
4258
|
+
el.addEventListener("click", (e) => {
|
|
4259
|
+
const target = e.target;
|
|
4260
|
+
if (target.closest("button, a, input, select, textarea")) return;
|
|
4261
|
+
fileInputRef.current?.click();
|
|
4251
4262
|
});
|
|
4252
4263
|
};
|
|
4253
|
-
|
|
4264
|
+
const handleFileInput = () => {
|
|
4265
|
+
const files = fileInputRef.current?.files;
|
|
4266
|
+
if (files?.length) {
|
|
4267
|
+
onFileSelect?.(files);
|
|
4268
|
+
}
|
|
4269
|
+
};
|
|
4270
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4254
4271
|
"div",
|
|
4255
4272
|
{
|
|
4256
4273
|
role: "button",
|
|
4257
4274
|
ref: dropAreaRef,
|
|
4258
4275
|
"data-slot": "drop-area",
|
|
4259
4276
|
class: cn(
|
|
4260
|
-
"text-muted-foreground flex flex-col items-center justify-center rounded-lg border-0 transition-colors hover:bg-muted/50",
|
|
4277
|
+
"text-muted-foreground flex flex-col items-center justify-center rounded-lg border-0 transition-colors hover:bg-muted/50 p-6",
|
|
4261
4278
|
sizeStyles[size],
|
|
4262
4279
|
className
|
|
4263
4280
|
),
|
|
4264
4281
|
style: {
|
|
4265
4282
|
border: "1px dashed var(--color-border)",
|
|
4266
4283
|
borderRadius: "var(--radius-lg)",
|
|
4267
|
-
cursor: "
|
|
4284
|
+
cursor: "pointer",
|
|
4268
4285
|
...style
|
|
4269
4286
|
},
|
|
4270
4287
|
...props,
|
|
4271
4288
|
onMount: attachNativeDragHandlers,
|
|
4272
|
-
children
|
|
4289
|
+
children: [
|
|
4290
|
+
children,
|
|
4291
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4292
|
+
"input",
|
|
4293
|
+
{
|
|
4294
|
+
ref: fileInputRef,
|
|
4295
|
+
type: "file",
|
|
4296
|
+
accept,
|
|
4297
|
+
class: "hidden",
|
|
4298
|
+
onChange: handleFileInput,
|
|
4299
|
+
tabIndex: -1
|
|
4300
|
+
}
|
|
4301
|
+
)
|
|
4302
|
+
]
|
|
4273
4303
|
}
|
|
4274
4304
|
);
|
|
4275
4305
|
};
|
|
@@ -5247,18 +5277,22 @@ const DataTable = ({
|
|
|
5247
5277
|
className,
|
|
5248
5278
|
entries,
|
|
5249
5279
|
columns,
|
|
5250
|
-
|
|
5251
|
-
|
|
5280
|
+
dataview,
|
|
5281
|
+
sortField: sortFieldProp,
|
|
5282
|
+
sortDirection: sortDirectionProp,
|
|
5252
5283
|
onSort,
|
|
5253
5284
|
onRowClick,
|
|
5254
5285
|
renderActions,
|
|
5255
5286
|
renderActionsHeader,
|
|
5256
|
-
idField
|
|
5287
|
+
idField: idFieldProp,
|
|
5257
5288
|
emptyMessage = "No results found.",
|
|
5258
5289
|
ref = defuss.createRef(),
|
|
5259
5290
|
...props
|
|
5260
5291
|
}) => {
|
|
5261
5292
|
const tableRef = ref || defuss.createRef();
|
|
5293
|
+
const sortField = sortFieldProp ?? dataview?.sorters[0]?.field;
|
|
5294
|
+
const sortDirection = sortDirectionProp ?? dataview?.sorters[0]?.direction ?? "asc";
|
|
5295
|
+
const idField = idFieldProp ?? dataview?.idField ?? "id";
|
|
5262
5296
|
const handleClick = (e) => {
|
|
5263
5297
|
if (!allowClick$1(e)) return;
|
|
5264
5298
|
const target = e.target;
|
|
@@ -5819,7 +5853,8 @@ const allowClick = createClickGuard();
|
|
|
5819
5853
|
const TreeView = ({
|
|
5820
5854
|
className,
|
|
5821
5855
|
entries,
|
|
5822
|
-
|
|
5856
|
+
dataview,
|
|
5857
|
+
idField: idFieldProp,
|
|
5823
5858
|
nameField = "name",
|
|
5824
5859
|
onNodeToggle,
|
|
5825
5860
|
onNodeSelect,
|
|
@@ -5831,6 +5866,7 @@ const TreeView = ({
|
|
|
5831
5866
|
...props
|
|
5832
5867
|
}) => {
|
|
5833
5868
|
const treeRef = ref || defuss.createRef();
|
|
5869
|
+
const idField = idFieldProp ?? dataview?.tree?.idField ?? dataview?.idField ?? "id";
|
|
5834
5870
|
const handleClick = (e) => {
|
|
5835
5871
|
if (!allowClick(e)) return;
|
|
5836
5872
|
const target = e.target;
|