@inf-monkeys-tech/monkeys-design 1.0.99 → 1.0.100
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/data-explorer/index.d.mts +3 -3
- package/dist/components/data-explorer/index.d.ts +3 -3
- package/dist/components/data-explorer/index.js +296 -70
- package/dist/components/data-explorer/index.js.map +1 -1
- package/dist/components/data-explorer/index.mjs +226 -2
- package/dist/components/data-explorer/index.mjs.map +1 -1
- package/dist/components/navigation-sidebar/index.d.mts +1 -1
- package/dist/components/navigation-sidebar/index.d.ts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +225 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +225 -2
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +1 -1
- package/dist/provider/index.d.ts +1 -1
- package/dist/styles.css +1 -1
- package/dist/{theme-0fef4f282e64.d.mts → theme-ba08de180df9.d.ts} +4 -2
- package/dist/{theme-169054c0dfb4.d.ts → theme-bfef5a689024.d.mts} +4 -2
- package/dist/{types-e36d6f4b3ca8.d.mts → types-cc1ff9de4c79.d.mts} +47 -1
- package/dist/{types-e36d6f4b3ca8.d.ts → types-cc1ff9de4c79.d.ts} +47 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as DropdownMenu4 from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
import { forwardRef, useState, useContext, useMemo, createContext, useRef, useEffect, useCallback, Fragment as Fragment$1, useLayoutEffect } from 'react';
|
|
3
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
5
|
import { twMerge } from 'tailwind-merge';
|
|
@@ -6,8 +7,8 @@ import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, close
|
|
|
6
7
|
import { sortableKeyboardCoordinates, SortableContext, verticalListSortingStrategy, useSortable, defaultAnimateLayoutChanges } from '@dnd-kit/sortable';
|
|
7
8
|
import { CSS } from '@dnd-kit/utilities';
|
|
8
9
|
import { createPortal } from 'react-dom';
|
|
10
|
+
import { Loader2, ChevronDown, Search, Check, X, UploadCloud, Image, Video, Music2, FileText } from 'lucide-react';
|
|
9
11
|
import * as Popover from '@radix-ui/react-popover';
|
|
10
|
-
import { ChevronDown, Search, Loader2, Check, X } from 'lucide-react';
|
|
11
12
|
|
|
12
13
|
// src/components/data-explorer/DataExplorerToolbarActions.tsx
|
|
13
14
|
|
|
@@ -6111,6 +6112,145 @@ function DataExplorerImagePreview({
|
|
|
6111
6112
|
}
|
|
6112
6113
|
);
|
|
6113
6114
|
}
|
|
6115
|
+
var mediaPreviewFrameClassName = ({
|
|
6116
|
+
aspectRatio = "square",
|
|
6117
|
+
maxSquareHeight = true,
|
|
6118
|
+
className
|
|
6119
|
+
} = {}) => cn2(
|
|
6120
|
+
"w-full overflow-hidden bg-muted",
|
|
6121
|
+
(aspectRatio === "square" || aspectRatio === "1:1") && "aspect-square",
|
|
6122
|
+
(aspectRatio === "square" || aspectRatio === "1:1") && maxSquareHeight && "max-h-[300px]",
|
|
6123
|
+
aspectRatio === "4:3" && "aspect-[4/3]",
|
|
6124
|
+
aspectRatio === "3:4" && "aspect-[3/4]",
|
|
6125
|
+
(aspectRatio === "video" || aspectRatio === "16:9") && "aspect-video",
|
|
6126
|
+
aspectRatio === "9:16" && "aspect-[9/16]",
|
|
6127
|
+
className
|
|
6128
|
+
);
|
|
6129
|
+
var MediaPreviewFrame = React.forwardRef(
|
|
6130
|
+
({ aspectRatio = "square", maxSquareHeight = true, className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: mediaPreviewFrameClassName({ aspectRatio, maxSquareHeight, className }), ...props })
|
|
6131
|
+
);
|
|
6132
|
+
MediaPreviewFrame.displayName = "MediaPreviewFrame";
|
|
6133
|
+
var MediaPreviewImage = React.forwardRef(
|
|
6134
|
+
({ fit = "contain", className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
6135
|
+
"img",
|
|
6136
|
+
{
|
|
6137
|
+
ref,
|
|
6138
|
+
className: cn2("block size-full", fit === "contain" ? "object-contain" : "object-cover", className),
|
|
6139
|
+
...props
|
|
6140
|
+
}
|
|
6141
|
+
)
|
|
6142
|
+
);
|
|
6143
|
+
MediaPreviewImage.displayName = "MediaPreviewImage";
|
|
6144
|
+
function PreviewIcon({ kind }) {
|
|
6145
|
+
const Icon = kind === "image" ? Image : kind === "video" ? Video : kind === "audio" ? Music2 : FileText;
|
|
6146
|
+
return /* @__PURE__ */ jsx(Icon, { className: "h-6 w-6", "aria-hidden": "true" });
|
|
6147
|
+
}
|
|
6148
|
+
function DataExplorerMediaPreview({
|
|
6149
|
+
src,
|
|
6150
|
+
kind = "image",
|
|
6151
|
+
alt = "Preview",
|
|
6152
|
+
title,
|
|
6153
|
+
aspectRatio = "auto",
|
|
6154
|
+
fit = "contain",
|
|
6155
|
+
controls = true,
|
|
6156
|
+
loading = false,
|
|
6157
|
+
empty = "No preview available",
|
|
6158
|
+
error = "Preview is unavailable right now.",
|
|
6159
|
+
className,
|
|
6160
|
+
classNames,
|
|
6161
|
+
onLoad,
|
|
6162
|
+
onError
|
|
6163
|
+
}) {
|
|
6164
|
+
const [hasError, setHasError] = useState(false);
|
|
6165
|
+
const resolvedSrc = typeof src === "string" ? src.trim() : "";
|
|
6166
|
+
useEffect(() => {
|
|
6167
|
+
setHasError(false);
|
|
6168
|
+
}, [resolvedSrc, kind]);
|
|
6169
|
+
const renderPlaceholder = (content, placeholderClassName) => /* @__PURE__ */ jsx(
|
|
6170
|
+
"div",
|
|
6171
|
+
{
|
|
6172
|
+
className: cn(
|
|
6173
|
+
"flex min-h-24 flex-col items-center justify-center gap-2 bg-muted/30 p-4 text-center text-sm text-muted-foreground",
|
|
6174
|
+
classNames?.placeholder,
|
|
6175
|
+
placeholderClassName
|
|
6176
|
+
),
|
|
6177
|
+
role: loading ? "status" : "img",
|
|
6178
|
+
"aria-label": typeof content === "string" ? content : void 0,
|
|
6179
|
+
children: content
|
|
6180
|
+
}
|
|
6181
|
+
);
|
|
6182
|
+
if (loading) {
|
|
6183
|
+
return /* @__PURE__ */ jsx("div", { className: cn("min-w-0 overflow-hidden", classNames?.root, className), "aria-busy": "true", children: /* @__PURE__ */ jsxs(
|
|
6184
|
+
"div",
|
|
6185
|
+
{
|
|
6186
|
+
className: cn(
|
|
6187
|
+
"flex min-h-24 flex-col items-center justify-center gap-2 bg-muted/30 p-4 text-sm text-muted-foreground",
|
|
6188
|
+
classNames?.loading
|
|
6189
|
+
),
|
|
6190
|
+
children: [
|
|
6191
|
+
/* @__PURE__ */ jsx(Loader2, { className: "h-5 w-5 animate-spin", "aria-hidden": "true" }),
|
|
6192
|
+
title || "Loading preview..."
|
|
6193
|
+
]
|
|
6194
|
+
}
|
|
6195
|
+
) });
|
|
6196
|
+
}
|
|
6197
|
+
if (!resolvedSrc || hasError) {
|
|
6198
|
+
return /* @__PURE__ */ jsx("div", { className: cn("min-w-0 overflow-hidden", classNames?.root, className), children: renderPlaceholder(
|
|
6199
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6200
|
+
/* @__PURE__ */ jsx(PreviewIcon, { kind }),
|
|
6201
|
+
/* @__PURE__ */ jsx("span", { className: cn("max-w-full truncate", hasError ? classNames?.error : void 0), children: hasError ? error : empty }),
|
|
6202
|
+
title ? /* @__PURE__ */ jsx("span", { className: "max-w-full truncate text-xs", children: title }) : null
|
|
6203
|
+
] })
|
|
6204
|
+
) });
|
|
6205
|
+
}
|
|
6206
|
+
const handleError = () => {
|
|
6207
|
+
setHasError(true);
|
|
6208
|
+
onError?.();
|
|
6209
|
+
};
|
|
6210
|
+
const media = kind === "image" ? /* @__PURE__ */ jsx(
|
|
6211
|
+
MediaPreviewImage,
|
|
6212
|
+
{
|
|
6213
|
+
src: resolvedSrc,
|
|
6214
|
+
alt,
|
|
6215
|
+
fit,
|
|
6216
|
+
className: classNames?.media,
|
|
6217
|
+
loading: "lazy",
|
|
6218
|
+
decoding: "async",
|
|
6219
|
+
draggable: false,
|
|
6220
|
+
onLoad,
|
|
6221
|
+
onError: handleError
|
|
6222
|
+
}
|
|
6223
|
+
) : kind === "video" ? /* @__PURE__ */ jsx(
|
|
6224
|
+
"video",
|
|
6225
|
+
{
|
|
6226
|
+
src: resolvedSrc,
|
|
6227
|
+
className: cn("block h-auto w-full", fit === "cover" ? "object-cover" : "object-contain", classNames?.media),
|
|
6228
|
+
controls,
|
|
6229
|
+
preload: "metadata",
|
|
6230
|
+
onLoadedData: onLoad,
|
|
6231
|
+
onError: handleError
|
|
6232
|
+
}
|
|
6233
|
+
) : kind === "audio" ? /* @__PURE__ */ jsx(
|
|
6234
|
+
"audio",
|
|
6235
|
+
{
|
|
6236
|
+
src: resolvedSrc,
|
|
6237
|
+
className: cn("w-full", classNames?.media),
|
|
6238
|
+
controls,
|
|
6239
|
+
preload: "metadata",
|
|
6240
|
+
onCanPlay: onLoad,
|
|
6241
|
+
onError: handleError
|
|
6242
|
+
}
|
|
6243
|
+
) : renderPlaceholder(
|
|
6244
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6245
|
+
/* @__PURE__ */ jsx(PreviewIcon, { kind: "file" }),
|
|
6246
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-full truncate", children: title || resolvedSrc })
|
|
6247
|
+
] })
|
|
6248
|
+
);
|
|
6249
|
+
if (kind === "image") {
|
|
6250
|
+
return /* @__PURE__ */ jsx(MediaPreviewFrame, { aspectRatio, className: cn(classNames?.root, className), children: media });
|
|
6251
|
+
}
|
|
6252
|
+
return /* @__PURE__ */ jsx("div", { className: cn("min-w-0 overflow-hidden", classNames?.root, className), children: media });
|
|
6253
|
+
}
|
|
6114
6254
|
function DataExplorerPage({
|
|
6115
6255
|
sidebar,
|
|
6116
6256
|
tree,
|
|
@@ -6602,6 +6742,90 @@ function DataExplorerRecordPicker({
|
|
|
6602
6742
|
] }, option.value)) }) : null
|
|
6603
6743
|
] });
|
|
6604
6744
|
}
|
|
6745
|
+
function DataExplorerUploadSurface({
|
|
6746
|
+
accept,
|
|
6747
|
+
multiple = false,
|
|
6748
|
+
disabled = false,
|
|
6749
|
+
busy = false,
|
|
6750
|
+
title = "Upload files",
|
|
6751
|
+
description,
|
|
6752
|
+
hint,
|
|
6753
|
+
busyLabel = "Uploading...",
|
|
6754
|
+
icon,
|
|
6755
|
+
className,
|
|
6756
|
+
classNames,
|
|
6757
|
+
onFilesSelected
|
|
6758
|
+
}) {
|
|
6759
|
+
const inputRef = useRef(null);
|
|
6760
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
6761
|
+
const emitFiles = (files) => {
|
|
6762
|
+
if (disabled || busy) return;
|
|
6763
|
+
const selected = Array.from(files);
|
|
6764
|
+
if (selected.length > 0) onFilesSelected?.(selected);
|
|
6765
|
+
};
|
|
6766
|
+
const handleDrop = (event) => {
|
|
6767
|
+
event.preventDefault();
|
|
6768
|
+
setIsDragging(false);
|
|
6769
|
+
emitFiles(event.dataTransfer.files);
|
|
6770
|
+
};
|
|
6771
|
+
const renderText = (value, fallbackClassName, slot) => value ? /* @__PURE__ */ jsx("span", { "data-slot": slot, className: cn(fallbackClassName), children: value }) : null;
|
|
6772
|
+
return /* @__PURE__ */ jsxs(
|
|
6773
|
+
"div",
|
|
6774
|
+
{
|
|
6775
|
+
"data-monkeys-component": "data-explorer-upload-surface",
|
|
6776
|
+
"data-state": busy ? "busy" : isDragging ? "dragging" : "idle",
|
|
6777
|
+
className: cn(
|
|
6778
|
+
"rounded-[var(--radius)] border border-dashed border-border bg-muted/20 p-6 text-center transition-colors",
|
|
6779
|
+
isDragging && "border-primary/60 bg-primary/5",
|
|
6780
|
+
(disabled || busy) && "pointer-events-none opacity-60",
|
|
6781
|
+
classNames?.root,
|
|
6782
|
+
className
|
|
6783
|
+
),
|
|
6784
|
+
onDragEnter: (event) => {
|
|
6785
|
+
event.preventDefault();
|
|
6786
|
+
if (!disabled && !busy) setIsDragging(true);
|
|
6787
|
+
},
|
|
6788
|
+
onDragOver: (event) => event.preventDefault(),
|
|
6789
|
+
onDragLeave: (event) => {
|
|
6790
|
+
event.preventDefault();
|
|
6791
|
+
if (event.currentTarget === event.target) setIsDragging(false);
|
|
6792
|
+
},
|
|
6793
|
+
onDrop: handleDrop,
|
|
6794
|
+
children: [
|
|
6795
|
+
/* @__PURE__ */ jsx(
|
|
6796
|
+
"input",
|
|
6797
|
+
{
|
|
6798
|
+
ref: inputRef,
|
|
6799
|
+
className: "sr-only",
|
|
6800
|
+
type: "file",
|
|
6801
|
+
accept,
|
|
6802
|
+
multiple,
|
|
6803
|
+
disabled: disabled || busy,
|
|
6804
|
+
onChange: (event) => {
|
|
6805
|
+
emitFiles(event.target.files ?? []);
|
|
6806
|
+
event.target.value = "";
|
|
6807
|
+
}
|
|
6808
|
+
}
|
|
6809
|
+
),
|
|
6810
|
+
/* @__PURE__ */ jsxs(
|
|
6811
|
+
"button",
|
|
6812
|
+
{
|
|
6813
|
+
type: "button",
|
|
6814
|
+
className: cn("mx-auto flex min-w-0 flex-col items-center gap-2 text-center", classNames?.button),
|
|
6815
|
+
disabled: disabled || busy,
|
|
6816
|
+
onClick: () => inputRef.current?.click(),
|
|
6817
|
+
children: [
|
|
6818
|
+
/* @__PURE__ */ jsx("span", { className: cn("text-muted-foreground", classNames?.icon), children: busy ? /* @__PURE__ */ jsx("span", { className: "inline-block h-7 w-7 animate-spin rounded-full border-2 border-primary/25 border-t-primary", "aria-hidden": "true" }) : icon ?? /* @__PURE__ */ jsx(UploadCloud, { className: "h-7 w-7", "aria-hidden": "true" }) }),
|
|
6819
|
+
renderText(busy ? busyLabel : title, "text-sm font-semibold text-foreground", "title"),
|
|
6820
|
+
renderText(description, "max-w-xl text-xs leading-5 text-muted-foreground", "description"),
|
|
6821
|
+
renderText(hint, "max-w-xl text-xs leading-5 text-muted-foreground", "hint")
|
|
6822
|
+
]
|
|
6823
|
+
}
|
|
6824
|
+
)
|
|
6825
|
+
]
|
|
6826
|
+
}
|
|
6827
|
+
);
|
|
6828
|
+
}
|
|
6605
6829
|
function DefaultSearchIcon() {
|
|
6606
6830
|
return /* @__PURE__ */ jsxs(
|
|
6607
6831
|
"svg",
|
|
@@ -7684,6 +7908,6 @@ function DataExplorerViewShell({
|
|
|
7684
7908
|
);
|
|
7685
7909
|
}
|
|
7686
7910
|
|
|
7687
|
-
export { DataExplorerActionBar, DataExplorerButton, DataExplorerCheckbox, DataExplorerCollectionFooter, DataExplorerDetailField, DataExplorerDetailSection, DataExplorerDetailShell, DataExplorerDisplayActionMenu, DataExplorerDisplayCard, DataExplorerDisplayCollectionView, DataExplorerDisplayListItem, DataExplorerDisplayMedia, DataExplorerDraggableTree, DataExplorerFilterBar, DataExplorerImagePreview, DataExplorerPage, DataExplorerRecordCard, DataExplorerRecordPicker, DataExplorerSelect, DataExplorerSplitButton, DataExplorerToolbarActions, DataExplorerToolbarShell, DataExplorerTree, DataExplorerTreeShell, DataExplorerView, DataExplorerViewCollection, DataExplorerViewItem, DataExplorerViewItemShell, DataExplorerViewShell, DataExplorerViewTree, getDataExplorerActionToneClassName, getDataExplorerMenuItemToneClassName, resolveDataExplorerAppearance };
|
|
7911
|
+
export { DataExplorerActionBar, DataExplorerButton, DataExplorerCheckbox, DataExplorerCollectionFooter, DataExplorerDetailField, DataExplorerDetailSection, DataExplorerDetailShell, DataExplorerDisplayActionMenu, DataExplorerDisplayCard, DataExplorerDisplayCollectionView, DataExplorerDisplayListItem, DataExplorerDisplayMedia, DataExplorerDraggableTree, DataExplorerFilterBar, DataExplorerImagePreview, DataExplorerMediaPreview, DataExplorerPage, DataExplorerRecordCard, DataExplorerRecordPicker, DataExplorerSelect, DataExplorerSplitButton, DataExplorerToolbarActions, DataExplorerToolbarShell, DataExplorerTree, DataExplorerTreeShell, DataExplorerUploadSurface, DataExplorerView, DataExplorerViewCollection, DataExplorerViewItem, DataExplorerViewItemShell, DataExplorerViewShell, DataExplorerViewTree, getDataExplorerActionToneClassName, getDataExplorerMenuItemToneClassName, resolveDataExplorerAppearance };
|
|
7688
7912
|
//# sourceMappingURL=index.mjs.map
|
|
7689
7913
|
//# sourceMappingURL=index.mjs.map
|