@yimingliao/cms 0.0.144 → 0.0.146
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/export/client/index.js +1 -73
- package/dist/export/client/pages/index.js +8 -0
- package/dist/src/client/interfaces/components/shadcn/sidebar.js +1 -1
- package/dist/src/client/interfaces/styles/constants.js +1 -3
- package/dist/types/export/client/components/index.d.ts +2 -0
- package/dist/types/export/client/components/index.d.ts.map +1 -0
- package/dist/types/export/client/index.d.ts +1 -1
- package/dist/types/export/client/index.d.ts.map +1 -1
- package/dist/types/export/client/pages/index.d.ts +2 -0
- package/dist/types/export/client/pages/index.d.ts.map +1 -0
- package/dist/types/src/client/index.d.ts +1 -1
- package/dist/types/src/client/index.d.ts.map +1 -1
- package/dist/types/src/client/interfaces/index.d.ts +0 -2
- package/dist/types/src/client/interfaces/index.d.ts.map +1 -1
- package/package.json +11 -1
- package/dist/src/client/applications/ui/use-parent-pathname.js +0 -10
- package/dist/src/client/interfaces/components/admin-initializer.js +0 -29
- package/dist/src/client/interfaces/components/resources/file/file-card.js +0 -87
- package/dist/src/client/interfaces/components/resources/file/file-list.js +0 -159
- package/dist/src/client/interfaces/components/resources/file/is-locked-buttons.js +0 -71
- package/dist/src/client/interfaces/components/resources/file/type-buttons.js +0 -62
- package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/list-cards-container.js +0 -96
- package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/page-size-selector.js +0 -63
- package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/pagination.js +0 -94
- package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header-title.js +0 -26
- package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header.js +0 -74
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch-create.js +0 -33
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch.js +0 -39
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/create.js +0 -33
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/edit.js +0 -33
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/index.js +0 -48
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/show.js +0 -61
- package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/trash.js +0 -39
- package/dist/src/client/interfaces/components/ui/buttons/return-button.js +0 -61
- package/dist/src/client/interfaces/components/ui/cards/action-buttons-card.js +0 -82
- package/dist/src/client/interfaces/components/ui/cards/resource-card/card-status-bar.js +0 -51
- package/dist/src/client/interfaces/components/ui/cards/resource-card/card-text-content.js +0 -38
- package/dist/src/client/interfaces/components/ui/cards/resource-card/resource-card.js +0 -77
- package/dist/src/client/interfaces/components/ui/display/array-list.js +0 -69
- package/dist/src/client/interfaces/components/ui/display/badge.js +0 -41
- package/dist/src/client/interfaces/components/ui/display/html-display.js +0 -32
- package/dist/src/client/interfaces/components/ui/display/object-array-list.js +0 -75
- package/dist/src/client/interfaces/components/ui/features/accordion/accordion-container.js +0 -31
- package/dist/src/client/interfaces/components/ui/features/accordion/accordion-header.js +0 -34
- package/dist/src/client/interfaces/components/ui/features/accordion/accordion.js +0 -81
- package/dist/src/client/interfaces/components/ui/features/expandable-list/expand-bar.js +0 -39
- package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list-content.js +0 -49
- package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list.js +0 -53
- package/dist/src/client/interfaces/components/ui/features/external-link.js +0 -15
- package/dist/src/client/interfaces/components/ui/features/file/file-info/file-info.js +0 -118
- package/dist/src/client/interfaces/components/ui/features/file/file-info/file-name.js +0 -48
- package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-container.js +0 -74
- package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-placeholder.js +0 -48
- package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker.js +0 -109
- package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-list.js +0 -85
- package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-meta.js +0 -40
- package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview.js +0 -113
- package/dist/src/client/interfaces/components/ui/features/file/uploader.js +0 -101
- package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-body.js +0 -112
- package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-trigger.js +0 -97
- package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal.js +0 -77
- package/dist/src/client/interfaces/components/ui/features/smart-image.js +0 -57
- package/dist/src/client/interfaces/components/ui/features/tick.js +0 -27
- package/dist/src/client/interfaces/components/ui/form/containers/fields-container.js +0 -24
- package/dist/src/client/interfaces/components/ui/form/containers/main-fields.js +0 -25
- package/dist/src/client/interfaces/components/ui/form/containers/side-fields.js +0 -24
- package/dist/src/client/interfaces/components/ui/form/control-fields/built-in-fields.js +0 -9
- package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-display.js +0 -112
- package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-input.js +0 -158
- package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields.js +0 -59
- package/dist/src/client/interfaces/components/ui/form/field-body.js +0 -79
- package/dist/src/client/interfaces/components/ui/form/index-field.js +0 -87
- package/dist/src/client/interfaces/components/ui/form/slug-field.js +0 -82
- package/dist/src/client/interfaces/components/ui/inputs/array-input.js +0 -110
- package/dist/src/client/interfaces/components/ui/inputs/checkbox.js +0 -93
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/base-editor.js +0 -143
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/built-in-plugins.js +0 -71
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/heading.config.js +0 -41
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/image.config.js +0 -32
- package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/table.config.js +0 -15
- package/dist/src/client/interfaces/components/ui/inputs/editor/editor.js +0 -112
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/asset-manager.js +0 -24
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/use-control-asset-mamager.js +0 -26
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/file-repository/upload-adapter.js +0 -84
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/icons.js +0 -17
- package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/word-count-display.js +0 -81
- package/dist/src/client/interfaces/components/ui/inputs/editor/use-init-editor/use-init-editor.js +0 -50
- package/dist/src/client/interfaces/components/ui/inputs/search-input.js +0 -61
- package/dist/src/client/interfaces/components/ui/inputs/select.js +0 -69
- package/dist/src/client/interfaces/components/ui/inputs/textarea.js +0 -62
- package/dist/src/client/interfaces/components/ui/layouts/content-container.js +0 -38
- package/dist/src/client/interfaces/components/ui/layouts/navbar/i18n-selector.js +0 -42
- package/dist/src/client/interfaces/components/ui/layouts/navbar/nav-user.js +0 -106
- package/dist/src/client/interfaces/components/ui/layouts/navbar/navbar.js +0 -84
- package/dist/src/client/interfaces/components/ui/layouts/navbar/sign-out-button.js +0 -58
- package/dist/src/client/interfaces/components/ui/layouts/navbar/theme-selector.js +0 -51
- package/dist/src/client/interfaces/components/ui/layouts/sidebar/nav-main.js +0 -99
- package/dist/src/constants/file.js +0 -27
- package/dist/src/shared/list-items.js +0 -3
- package/dist/src/shared/utils/debounce.js +0 -14
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { CirclePlus, CircleMinus } from 'lucide-react';
|
|
3
|
-
import 'react';
|
|
4
|
-
import 'ua-parser-js';
|
|
5
|
-
import { cn } from '../../../../../applications/shadcn/utils.js';
|
|
6
|
-
import 'next/navigation';
|
|
7
|
-
import '@radix-ui/react-avatar';
|
|
8
|
-
import '../../../shadcn/badge.js';
|
|
9
|
-
import '../../../shadcn/button.js';
|
|
10
|
-
import '@radix-ui/react-collapsible';
|
|
11
|
-
import '@radix-ui/react-dialog';
|
|
12
|
-
import '@radix-ui/react-dropdown-menu';
|
|
13
|
-
import '../../../shadcn/input-group.js';
|
|
14
|
-
import '@radix-ui/react-label';
|
|
15
|
-
import '@radix-ui/react-select';
|
|
16
|
-
import { Separator } from '../../../shadcn/separator.js';
|
|
17
|
-
import '../../../shadcn/sidebar.js';
|
|
18
|
-
import '@radix-ui/react-tooltip';
|
|
19
|
-
|
|
20
|
-
function ExpandBar({ isExpand }) {
|
|
21
|
-
return /* @__PURE__ */ jsxs(
|
|
22
|
-
"div",
|
|
23
|
-
{
|
|
24
|
-
className: cn(
|
|
25
|
-
"w-full",
|
|
26
|
-
"flex-center gap-1",
|
|
27
|
-
"opacity-50 group-hover:opacity-100",
|
|
28
|
-
"transition"
|
|
29
|
-
),
|
|
30
|
-
children: [
|
|
31
|
-
/* @__PURE__ */ jsx(Separator, { className: "my-3 flex-1" }),
|
|
32
|
-
!isExpand ? /* @__PURE__ */ jsx(CirclePlus, { className: "text-base-content size-5 min-w-5" }) : /* @__PURE__ */ jsx(CircleMinus, { className: "text-base-content size-5 min-w-5" }),
|
|
33
|
-
/* @__PURE__ */ jsx(Separator, { className: "my-3 flex-1" })
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { ExpandBar };
|
package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list-content.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useRef, useEffect } from 'react';
|
|
4
|
-
import 'ua-parser-js';
|
|
5
|
-
import { cn } from '../../../../../applications/shadcn/utils.js';
|
|
6
|
-
import 'next/navigation';
|
|
7
|
-
|
|
8
|
-
const COLLAPSED_HEIGHT = 48;
|
|
9
|
-
function ExpandableListContent({
|
|
10
|
-
item,
|
|
11
|
-
items,
|
|
12
|
-
isExpand,
|
|
13
|
-
isDisabled,
|
|
14
|
-
isUnique,
|
|
15
|
-
onOverflowChange,
|
|
16
|
-
children
|
|
17
|
-
}) {
|
|
18
|
-
const containerRef = useRef(null);
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
const el = containerRef.current;
|
|
21
|
-
if (!el) return;
|
|
22
|
-
const height = el.scrollHeight;
|
|
23
|
-
onOverflowChange?.(height > COLLAPSED_HEIGHT);
|
|
24
|
-
if (isDisabled) {
|
|
25
|
-
el.style.maxHeight = "0px";
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
el.style.maxHeight = isExpand ? `${height}px` : `${COLLAPSED_HEIGHT}px`;
|
|
29
|
-
}, [isExpand, isDisabled, items.length, children, onOverflowChange]);
|
|
30
|
-
return /* @__PURE__ */ jsxs(
|
|
31
|
-
"div",
|
|
32
|
-
{
|
|
33
|
-
ref: containerRef,
|
|
34
|
-
className: cn("overflow-hidden", "flex flex-wrap gap-1", "duration-150"),
|
|
35
|
-
children: [
|
|
36
|
-
children,
|
|
37
|
-
items.map((eachItem, idx) => {
|
|
38
|
-
const matched = isUnique && eachItem === item;
|
|
39
|
-
return /* @__PURE__ */ jsxs("span", { children: [
|
|
40
|
-
/* @__PURE__ */ jsx("span", { className: cn(matched && "text-error"), children: eachItem }),
|
|
41
|
-
idx !== items.length - 1 && ","
|
|
42
|
-
] }, `${eachItem}-${idx}`);
|
|
43
|
-
})
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { ExpandableListContent };
|
package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { Archive } from 'lucide-react';
|
|
4
|
-
import { useState } from 'react';
|
|
5
|
-
import 'ua-parser-js';
|
|
6
|
-
import { cn } from '../../../../../applications/shadcn/utils.js';
|
|
7
|
-
import 'next/navigation';
|
|
8
|
-
import { ExpandBar } from './expand-bar.js';
|
|
9
|
-
import { ExpandableListContent } from './expandable-list-content.js';
|
|
10
|
-
|
|
11
|
-
function ExpandableList({
|
|
12
|
-
item,
|
|
13
|
-
items = [],
|
|
14
|
-
isDisabled,
|
|
15
|
-
isUnique
|
|
16
|
-
}) {
|
|
17
|
-
const [isExpand, setIsExpand] = useState(false);
|
|
18
|
-
const [isListOverFlow, setIsListOverFlow] = useState(false);
|
|
19
|
-
return /* @__PURE__ */ jsxs(
|
|
20
|
-
"button",
|
|
21
|
-
{
|
|
22
|
-
type: "button",
|
|
23
|
-
onClick: () => {
|
|
24
|
-
if (!isListOverFlow) return;
|
|
25
|
-
setIsExpand((prev) => !prev);
|
|
26
|
-
},
|
|
27
|
-
className: cn(
|
|
28
|
-
"group flex w-full flex-col gap-1 text-xs text-gray-400",
|
|
29
|
-
!isListOverFlow && "pointer-events-none"
|
|
30
|
-
),
|
|
31
|
-
children: [
|
|
32
|
-
/* @__PURE__ */ jsxs(
|
|
33
|
-
ExpandableListContent,
|
|
34
|
-
{
|
|
35
|
-
item,
|
|
36
|
-
items,
|
|
37
|
-
isExpand,
|
|
38
|
-
isDisabled,
|
|
39
|
-
isUnique,
|
|
40
|
-
onOverflowChange: setIsListOverFlow,
|
|
41
|
-
children: [
|
|
42
|
-
/* @__PURE__ */ jsx(Archive, { className: "size-4" }),
|
|
43
|
-
/* @__PURE__ */ jsx("span", { children: ":" })
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
),
|
|
47
|
-
isListOverFlow && /* @__PURE__ */ jsx(ExpandBar, { isExpand })
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { ExpandableList };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { SquareArrowOutUpRight } from 'lucide-react';
|
|
3
|
-
import { Button } from '../buttons/button.js';
|
|
4
|
-
import 'intor/react';
|
|
5
|
-
import 'next/navigation';
|
|
6
|
-
import 'react';
|
|
7
|
-
import 'ua-parser-js';
|
|
8
|
-
import 'clsx';
|
|
9
|
-
import 'tailwind-merge';
|
|
10
|
-
|
|
11
|
-
function ExternalLink({ href = "" }) {
|
|
12
|
-
return /* @__PURE__ */ jsx(Button, { variant: "outline", size: "icon", href, openNewTab: true, children: /* @__PURE__ */ jsx(SquareArrowOutUpRight, {}) });
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { ExternalLink };
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useTranslator } from 'intor/react';
|
|
4
|
-
import { SquareArrowOutUpRight } from 'lucide-react';
|
|
5
|
-
import Link from 'next/link';
|
|
6
|
-
import '../../../../../../../constants/paths/auth.js';
|
|
7
|
-
import '../../../../../../../constants/paths/main.js';
|
|
8
|
-
import '../../../../../../../constants/paths/resources.js';
|
|
9
|
-
import { NEW_TAB_REL, NEW_TAB_TARGET } from '../../../../../../../constants/anchor.js';
|
|
10
|
-
import '../../../../../../../constants/redirect-paths.js';
|
|
11
|
-
import { mimeToExtension } from '../../../../../../../shared/blob-file/mime-to-extension.js';
|
|
12
|
-
import { classifyFileType } from '../../../../../../../shared/blob-file/classify-file-type.js';
|
|
13
|
-
import { formatFileSize } from '../../../../../../../shared/blob-file/format-file-size.js';
|
|
14
|
-
import 'mime-types';
|
|
15
|
-
import { joinUrl } from '../../../../../../../shared/utils/join-url.js';
|
|
16
|
-
import 'react';
|
|
17
|
-
import 'ua-parser-js';
|
|
18
|
-
import { cn } from '../../../../../../applications/shadcn/utils.js';
|
|
19
|
-
import 'next/navigation';
|
|
20
|
-
import { Button } from '../../../buttons/button.js';
|
|
21
|
-
import { Field } from '../../../form/field.js';
|
|
22
|
-
import { FieldBody } from '../../../form/field-body.js';
|
|
23
|
-
import '@radix-ui/react-avatar';
|
|
24
|
-
import '../../../../shadcn/badge.js';
|
|
25
|
-
import '../../../../shadcn/button.js';
|
|
26
|
-
import '@radix-ui/react-collapsible';
|
|
27
|
-
import '@radix-ui/react-dialog';
|
|
28
|
-
import '@radix-ui/react-dropdown-menu';
|
|
29
|
-
import '../../../../shadcn/input-group.js';
|
|
30
|
-
import '@radix-ui/react-label';
|
|
31
|
-
import '@radix-ui/react-select';
|
|
32
|
-
import '@radix-ui/react-separator';
|
|
33
|
-
import '../../../../shadcn/sidebar.js';
|
|
34
|
-
import '@radix-ui/react-tooltip';
|
|
35
|
-
import { FileName } from './file-name.js';
|
|
36
|
-
|
|
37
|
-
function createFileInfo({
|
|
38
|
-
maxSize,
|
|
39
|
-
storageUrl
|
|
40
|
-
}) {
|
|
41
|
-
return function FileInfo({
|
|
42
|
-
file,
|
|
43
|
-
isExpand = true
|
|
44
|
-
// Use in [File] Batch Create
|
|
45
|
-
}) {
|
|
46
|
-
const { t } = useTranslator();
|
|
47
|
-
const isBlobFile = file instanceof Blob;
|
|
48
|
-
const isOversize = Number(file.size) > maxSize;
|
|
49
|
-
const fileType = isBlobFile ? classifyFileType(file.type, mimeToExtension(file.type)).toLowerCase() : file.type.toLowerCase();
|
|
50
|
-
return /* @__PURE__ */ jsxs(
|
|
51
|
-
"div",
|
|
52
|
-
{
|
|
53
|
-
className: cn(
|
|
54
|
-
"flex flex-col gap-4",
|
|
55
|
-
"overflow-hidden",
|
|
56
|
-
isExpand ? "w-28" : "w-0",
|
|
57
|
-
isExpand ? "ml-4" : "ml-0",
|
|
58
|
-
"transition-[width,margin]"
|
|
59
|
-
),
|
|
60
|
-
children: [
|
|
61
|
-
!isBlobFile && file && /* @__PURE__ */ jsx(Field, { label: t("ui.blob-file.file-info.file-link.text"), children: /* @__PURE__ */ jsx(Button, { variant: "outline", className: "group p-0", children: /* @__PURE__ */ jsx(
|
|
62
|
-
Link,
|
|
63
|
-
{
|
|
64
|
-
href: joinUrl(storageUrl, file.key),
|
|
65
|
-
target: NEW_TAB_TARGET,
|
|
66
|
-
rel: NEW_TAB_REL,
|
|
67
|
-
className: "group flex-center size-full",
|
|
68
|
-
children: /* @__PURE__ */ jsx(SquareArrowOutUpRight, { className: "transition group-hover:scale-110" })
|
|
69
|
-
}
|
|
70
|
-
) }) }),
|
|
71
|
-
/* @__PURE__ */ jsx(FileName, { fileName: isBlobFile ? file.name : file.originalName }),
|
|
72
|
-
/* @__PURE__ */ jsx(Field, { label: t("ui.blob-file.file-info.file-type.text"), children: /* @__PURE__ */ jsx(FieldBody, { children: /* @__PURE__ */ jsx("p", { className: "mx-auto truncate", children: t(`resources.file.file-type.${fileType}.text`) }) }) }),
|
|
73
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
74
|
-
/* @__PURE__ */ jsx(Field, { label: t("ui.blob-file.file-info.file-size.text"), children: /* @__PURE__ */ jsx(FieldBody, { children: /* @__PURE__ */ jsx(
|
|
75
|
-
"p",
|
|
76
|
-
{
|
|
77
|
-
className: cn(
|
|
78
|
-
"mx-auto truncate",
|
|
79
|
-
isOversize && "text-destructive"
|
|
80
|
-
),
|
|
81
|
-
children: formatFileSize(file.size)
|
|
82
|
-
}
|
|
83
|
-
) }) }),
|
|
84
|
-
/* @__PURE__ */ jsx(
|
|
85
|
-
"div",
|
|
86
|
-
{
|
|
87
|
-
className: cn(
|
|
88
|
-
"h-1 w-28",
|
|
89
|
-
"rounded-full",
|
|
90
|
-
"bg-white dark:bg-gray-200",
|
|
91
|
-
"transition"
|
|
92
|
-
),
|
|
93
|
-
children: /* @__PURE__ */ jsx(
|
|
94
|
-
"div",
|
|
95
|
-
{
|
|
96
|
-
className: cn(
|
|
97
|
-
"h-full rounded-full",
|
|
98
|
-
"overflow-hidden",
|
|
99
|
-
"transition"
|
|
100
|
-
),
|
|
101
|
-
style: {
|
|
102
|
-
width: `${Math.min(file.size / maxSize * 100, 100).toFixed(
|
|
103
|
-
2
|
|
104
|
-
)}%`
|
|
105
|
-
},
|
|
106
|
-
children: /* @__PURE__ */ jsx("div", { className: "h-full w-28 bg-linear-to-r from-green-300 via-yellow-400 to-red-500" })
|
|
107
|
-
}
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
)
|
|
111
|
-
] })
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
);
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export { createFileInfo };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useTranslator } from 'intor/react';
|
|
3
|
-
import '@radix-ui/react-avatar';
|
|
4
|
-
import 'react';
|
|
5
|
-
import 'ua-parser-js';
|
|
6
|
-
import 'clsx';
|
|
7
|
-
import 'tailwind-merge';
|
|
8
|
-
import 'next/navigation';
|
|
9
|
-
import '../../../../shadcn/badge.js';
|
|
10
|
-
import '../../../../shadcn/button.js';
|
|
11
|
-
import '@radix-ui/react-collapsible';
|
|
12
|
-
import '@radix-ui/react-dialog';
|
|
13
|
-
import 'lucide-react';
|
|
14
|
-
import '@radix-ui/react-dropdown-menu';
|
|
15
|
-
import '../../../../shadcn/input-group.js';
|
|
16
|
-
import '@radix-ui/react-label';
|
|
17
|
-
import '@radix-ui/react-select';
|
|
18
|
-
import '@radix-ui/react-separator';
|
|
19
|
-
import '../../../../shadcn/sidebar.js';
|
|
20
|
-
import { Tooltip, TooltipTrigger, TooltipContent } from '../../../../shadcn/tooltip.js';
|
|
21
|
-
import { Field } from '../../../form/field.js';
|
|
22
|
-
import { FieldBody } from '../../../form/field-body.js';
|
|
23
|
-
import 'mime-types';
|
|
24
|
-
|
|
25
|
-
const splitFileName = (fileName) => {
|
|
26
|
-
const lastDotIndex = fileName.lastIndexOf(".");
|
|
27
|
-
if (lastDotIndex <= 0) return { name: fileName, ext: "" };
|
|
28
|
-
return {
|
|
29
|
-
name: fileName.slice(0, lastDotIndex),
|
|
30
|
-
ext: fileName.slice(lastDotIndex + 1)
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
function FileName({ fileName }) {
|
|
34
|
-
const { t } = useTranslator();
|
|
35
|
-
const { name, ext } = splitFileName(fileName);
|
|
36
|
-
return /* @__PURE__ */ jsx(Field, { label: t("ui.blob-file.file-info.file-name.text"), children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
37
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(FieldBody, { children: /* @__PURE__ */ jsxs("p", { className: "mx-auto flex truncate", children: [
|
|
38
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: name }),
|
|
39
|
-
ext && /* @__PURE__ */ jsxs("span", { children: [
|
|
40
|
-
".",
|
|
41
|
-
ext
|
|
42
|
-
] })
|
|
43
|
-
] }) }) }),
|
|
44
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: fileName }) })
|
|
45
|
-
] }) });
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { FileName };
|
package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-container.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import 'react';
|
|
4
|
-
import 'ua-parser-js';
|
|
5
|
-
import { cn } from '../../../../../../applications/shadcn/utils.js';
|
|
6
|
-
import 'next/navigation';
|
|
7
|
-
import '@radix-ui/react-avatar';
|
|
8
|
-
import '../../../../shadcn/badge.js';
|
|
9
|
-
import '../../../../shadcn/button.js';
|
|
10
|
-
import '@radix-ui/react-collapsible';
|
|
11
|
-
import '@radix-ui/react-dialog';
|
|
12
|
-
import 'lucide-react';
|
|
13
|
-
import '@radix-ui/react-dropdown-menu';
|
|
14
|
-
import '../../../../shadcn/input-group.js';
|
|
15
|
-
import '@radix-ui/react-label';
|
|
16
|
-
import '@radix-ui/react-select';
|
|
17
|
-
import '@radix-ui/react-separator';
|
|
18
|
-
import '../../../../shadcn/sidebar.js';
|
|
19
|
-
import { Spinner } from '../../../../shadcn/spinner.js';
|
|
20
|
-
import '@radix-ui/react-tooltip';
|
|
21
|
-
import { FilePickerPlaceholder } from './file-picker-placeholder.js';
|
|
22
|
-
|
|
23
|
-
function FilePickerContainer({
|
|
24
|
-
inputRef,
|
|
25
|
-
hasSingleFile = false,
|
|
26
|
-
isDragOver,
|
|
27
|
-
setIsDragOver,
|
|
28
|
-
processFiles,
|
|
29
|
-
// ui states
|
|
30
|
-
isLoading = false,
|
|
31
|
-
isDisabled = false,
|
|
32
|
-
isDisplay = false,
|
|
33
|
-
// base
|
|
34
|
-
className = "",
|
|
35
|
-
children
|
|
36
|
-
}) {
|
|
37
|
-
const handleDrop = (e) => {
|
|
38
|
-
e.preventDefault();
|
|
39
|
-
setIsDragOver(false);
|
|
40
|
-
if (e.dataTransfer.files) void processFiles(e.dataTransfer.files);
|
|
41
|
-
};
|
|
42
|
-
return /* @__PURE__ */ jsx(
|
|
43
|
-
"div",
|
|
44
|
-
{
|
|
45
|
-
className: cn(
|
|
46
|
-
className,
|
|
47
|
-
"relative",
|
|
48
|
-
"flex-center",
|
|
49
|
-
"overflow-hidden",
|
|
50
|
-
"rounded-xl",
|
|
51
|
-
"bg-secondary",
|
|
52
|
-
"border-dashed",
|
|
53
|
-
!isDisplay && "cursor-pointer",
|
|
54
|
-
"transition",
|
|
55
|
-
isDragOver && "opacity-50",
|
|
56
|
-
hasSingleFile || isLoading ? "border-0" : "border-4 hover:opacity-50",
|
|
57
|
-
(isDisabled || isLoading) && "pointer-events-none"
|
|
58
|
-
),
|
|
59
|
-
onClick: () => inputRef.current && inputRef.current.click(),
|
|
60
|
-
onDrop: handleDrop,
|
|
61
|
-
onDragOver: (e) => {
|
|
62
|
-
e.preventDefault();
|
|
63
|
-
setIsDragOver(true);
|
|
64
|
-
},
|
|
65
|
-
onDragLeave: () => setIsDragOver(false),
|
|
66
|
-
children: isLoading ? /* @__PURE__ */ jsx(Spinner, { className: "size-16" }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
67
|
-
!hasSingleFile && /* @__PURE__ */ jsx("div", { className: "absolute size-full", children: /* @__PURE__ */ jsx(FilePickerPlaceholder, {}) }),
|
|
68
|
-
children
|
|
69
|
-
] })
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export { FilePickerContainer };
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useTranslator } from 'intor/react';
|
|
3
|
-
import { Upload } from 'lucide-react';
|
|
4
|
-
import 'react';
|
|
5
|
-
import 'ua-parser-js';
|
|
6
|
-
import { cn } from '../../../../../../applications/shadcn/utils.js';
|
|
7
|
-
import 'next/navigation';
|
|
8
|
-
import 'next/link';
|
|
9
|
-
import '../../../../../../../constants/paths/auth.js';
|
|
10
|
-
import '../../../../../../../constants/paths/main.js';
|
|
11
|
-
import '../../../../../../../constants/paths/resources.js';
|
|
12
|
-
import '../../../../../../../constants/redirect-paths.js';
|
|
13
|
-
import '@radix-ui/react-avatar';
|
|
14
|
-
import '../../../../shadcn/badge.js';
|
|
15
|
-
import '../../../../shadcn/button.js';
|
|
16
|
-
import '@radix-ui/react-collapsible';
|
|
17
|
-
import '@radix-ui/react-dialog';
|
|
18
|
-
import '@radix-ui/react-dropdown-menu';
|
|
19
|
-
import '../../../../shadcn/input-group.js';
|
|
20
|
-
import '@radix-ui/react-label';
|
|
21
|
-
import '@radix-ui/react-select';
|
|
22
|
-
import '@radix-ui/react-separator';
|
|
23
|
-
import '../../../../shadcn/sidebar.js';
|
|
24
|
-
import '@radix-ui/react-tooltip';
|
|
25
|
-
import 'mime-types';
|
|
26
|
-
import { Badge } from '../../../display/badge.js';
|
|
27
|
-
|
|
28
|
-
function FilePickerPlaceholder() {
|
|
29
|
-
const { t } = useTranslator();
|
|
30
|
-
return /* @__PURE__ */ jsxs(
|
|
31
|
-
"div",
|
|
32
|
-
{
|
|
33
|
-
className: cn(
|
|
34
|
-
"relative",
|
|
35
|
-
"size-full",
|
|
36
|
-
"flex-center flex-col gap-4",
|
|
37
|
-
"text-sm"
|
|
38
|
-
),
|
|
39
|
-
children: [
|
|
40
|
-
/* @__PURE__ */ jsx(Upload, {}),
|
|
41
|
-
/* @__PURE__ */ jsx(Badge, { children: t("ui.blob-file.file-picker.select-file.text") }),
|
|
42
|
-
/* @__PURE__ */ jsx("p", { className: "opacity-50", children: t("ui.blob-file.file-picker.drag-hint.text") })
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { FilePickerPlaceholder };
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useRef, useState } from 'react';
|
|
4
|
-
import 'mime-types';
|
|
5
|
-
import { getMediaInfo } from '../../../../../../../shared/blob-file/get-media-info/get-media-info.js';
|
|
6
|
-
import 'ua-parser-js';
|
|
7
|
-
import { cn } from '../../../../../../applications/shadcn/utils.js';
|
|
8
|
-
import 'next/navigation';
|
|
9
|
-
import { FilePickerContainer } from './file-picker-container.js';
|
|
10
|
-
|
|
11
|
-
function createFilePicker({
|
|
12
|
-
FileInfo,
|
|
13
|
-
FilePreview
|
|
14
|
-
}) {
|
|
15
|
-
return function FilePicker({
|
|
16
|
-
// [File] (Prisma Model)
|
|
17
|
-
file,
|
|
18
|
-
// form context
|
|
19
|
-
fieldName,
|
|
20
|
-
formData,
|
|
21
|
-
setFormData,
|
|
22
|
-
// ui states
|
|
23
|
-
isLoading = false,
|
|
24
|
-
isDisabled = false,
|
|
25
|
-
isDisplay = false,
|
|
26
|
-
// base
|
|
27
|
-
className = "",
|
|
28
|
-
...props
|
|
29
|
-
}) {
|
|
30
|
-
const inputRef = useRef(null);
|
|
31
|
-
const [isDragOver, setIsDragOver] = useState(false);
|
|
32
|
-
const [resetKey, setResetKey] = useState(0);
|
|
33
|
-
const fieldValue = formData?.[fieldName ?? ""];
|
|
34
|
-
const isMultiple = Array.isArray(fieldValue);
|
|
35
|
-
const hasSingleBlobFile = !isMultiple && fieldValue;
|
|
36
|
-
const hasSingleFile = Boolean(hasSingleBlobFile || file);
|
|
37
|
-
const processFiles = async (files) => {
|
|
38
|
-
if (!files || files.length === 0 || !setFormData || !fieldName) return;
|
|
39
|
-
const filesWithInfo = await Promise.all(
|
|
40
|
-
[...files].map(async (file2) => {
|
|
41
|
-
const mediaInfo = await getMediaInfo(file2).catch(() => ({
|
|
42
|
-
width: null,
|
|
43
|
-
height: null,
|
|
44
|
-
duration: null
|
|
45
|
-
}));
|
|
46
|
-
return Object.assign(file2, {
|
|
47
|
-
id: crypto.randomUUID(),
|
|
48
|
-
width: mediaInfo.width,
|
|
49
|
-
height: mediaInfo.height,
|
|
50
|
-
duration: mediaInfo.duration
|
|
51
|
-
});
|
|
52
|
-
})
|
|
53
|
-
);
|
|
54
|
-
if (isMultiple) {
|
|
55
|
-
setFormData((p) => ({ ...p, [fieldName]: [...filesWithInfo] }));
|
|
56
|
-
} else {
|
|
57
|
-
setFormData((p) => ({ ...p, [fieldName]: filesWithInfo[0] }));
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(className, "flex w-fit"), children: [
|
|
61
|
-
/* @__PURE__ */ jsxs(
|
|
62
|
-
FilePickerContainer,
|
|
63
|
-
{
|
|
64
|
-
inputRef,
|
|
65
|
-
hasSingleFile,
|
|
66
|
-
isDragOver,
|
|
67
|
-
setIsDragOver,
|
|
68
|
-
processFiles,
|
|
69
|
-
isLoading,
|
|
70
|
-
isDisabled,
|
|
71
|
-
isDisplay,
|
|
72
|
-
className: cn(
|
|
73
|
-
className,
|
|
74
|
-
"max-h-[600px] min-h-[300px] max-w-[600px] min-w-[300px]"
|
|
75
|
-
),
|
|
76
|
-
children: [
|
|
77
|
-
hasSingleFile && /* @__PURE__ */ jsx(
|
|
78
|
-
FilePreview,
|
|
79
|
-
{
|
|
80
|
-
blobFile: fieldValue,
|
|
81
|
-
fileKey: file?.key ?? ""
|
|
82
|
-
}
|
|
83
|
-
),
|
|
84
|
-
/* @__PURE__ */ jsx(
|
|
85
|
-
"input",
|
|
86
|
-
{
|
|
87
|
-
ref: inputRef,
|
|
88
|
-
type: "file",
|
|
89
|
-
multiple: isMultiple,
|
|
90
|
-
hidden: true,
|
|
91
|
-
disabled: isDisabled || isLoading || isDisplay,
|
|
92
|
-
onChange: (e) => {
|
|
93
|
-
if (!e.target.files) return;
|
|
94
|
-
void processFiles(e.target.files);
|
|
95
|
-
setResetKey((p) => p + 1);
|
|
96
|
-
},
|
|
97
|
-
...props
|
|
98
|
-
},
|
|
99
|
-
resetKey
|
|
100
|
-
)
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
),
|
|
104
|
-
hasSingleFile && /* @__PURE__ */ jsx(FileInfo, { file: fieldValue || file })
|
|
105
|
-
] });
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export { createFilePicker };
|
package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-list.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useTranslator } from 'intor/react';
|
|
3
|
-
import { PanelLeftClose, PanelLeftOpen, CircleX } from 'lucide-react';
|
|
4
|
-
import { useState } from 'react';
|
|
5
|
-
import 'ua-parser-js';
|
|
6
|
-
import { cn } from '../../../../../../applications/shadcn/utils.js';
|
|
7
|
-
import 'next/navigation';
|
|
8
|
-
import { Button } from '../../../buttons/button.js';
|
|
9
|
-
|
|
10
|
-
function createFilePreviewList({
|
|
11
|
-
FileInfo,
|
|
12
|
-
FilePreview,
|
|
13
|
-
maxSize
|
|
14
|
-
}) {
|
|
15
|
-
return function FilePreviewList({
|
|
16
|
-
// Form Data
|
|
17
|
-
fieldName,
|
|
18
|
-
formData,
|
|
19
|
-
setFormData,
|
|
20
|
-
// Processing States
|
|
21
|
-
isDisabled = false,
|
|
22
|
-
// Base
|
|
23
|
-
className
|
|
24
|
-
}) {
|
|
25
|
-
const { t } = useTranslator();
|
|
26
|
-
const [isExpand, setIsExpand] = useState(false);
|
|
27
|
-
const raw = formData?.[fieldName ?? ""];
|
|
28
|
-
const blobFiles = Array.isArray(raw) ? raw : [];
|
|
29
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-6", className), children: [
|
|
30
|
-
blobFiles.length > 0 ? /* @__PURE__ */ jsx(
|
|
31
|
-
Button,
|
|
32
|
-
{
|
|
33
|
-
variant: "outline",
|
|
34
|
-
icon: isExpand ? PanelLeftClose : PanelLeftOpen,
|
|
35
|
-
onClick: () => setIsExpand((prev) => !prev),
|
|
36
|
-
className: "w-fit text-sm",
|
|
37
|
-
children: t("ui.blob-file.file-preview-list.file-details.text")
|
|
38
|
-
}
|
|
39
|
-
) : /* @__PURE__ */ jsx("p", { className: "text-xs opacity-50", children: t("ui.blob-file.file-preview-list.no-file-selected.text") }),
|
|
40
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-6", children: blobFiles.map((blobFile) => {
|
|
41
|
-
const isOversize = blobFile.size > maxSize;
|
|
42
|
-
return /* @__PURE__ */ jsxs("div", { className: "relative flex", children: [
|
|
43
|
-
/* @__PURE__ */ jsx(
|
|
44
|
-
FilePreview,
|
|
45
|
-
{
|
|
46
|
-
blobFile,
|
|
47
|
-
className: cn(
|
|
48
|
-
"size-60!",
|
|
49
|
-
isOversize && "border-destructive border-4"
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
),
|
|
53
|
-
/* @__PURE__ */ jsx(FileInfo, { file: blobFile, isExpand }),
|
|
54
|
-
/* @__PURE__ */ jsx(
|
|
55
|
-
"button",
|
|
56
|
-
{
|
|
57
|
-
onClick: () => {
|
|
58
|
-
if (!setFormData || !fieldName) return;
|
|
59
|
-
setFormData((p) => ({
|
|
60
|
-
...p,
|
|
61
|
-
[fieldName]: blobFiles.filter(
|
|
62
|
-
(f) => f.id !== blobFile.id
|
|
63
|
-
)
|
|
64
|
-
}));
|
|
65
|
-
},
|
|
66
|
-
className: cn(
|
|
67
|
-
"absolute! top-2 left-2",
|
|
68
|
-
"z-20",
|
|
69
|
-
"bg-background text-destructive",
|
|
70
|
-
"rounded-full",
|
|
71
|
-
"shadow-xs",
|
|
72
|
-
"hover:scale-110 active:scale-95",
|
|
73
|
-
"duration-200",
|
|
74
|
-
isDisabled && "pointer-events-none"
|
|
75
|
-
),
|
|
76
|
-
children: /* @__PURE__ */ jsx(CircleX, { className: "stroke-2" })
|
|
77
|
-
}
|
|
78
|
-
)
|
|
79
|
-
] }, blobFile.id);
|
|
80
|
-
}) })
|
|
81
|
-
] });
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export { createFilePreviewList };
|