@yimingliao/cms 0.0.145 → 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.
Files changed (97) hide show
  1. package/dist/export/client/index.js +1 -71
  2. package/dist/src/client/interfaces/components/shadcn/sidebar.js +1 -1
  3. package/dist/src/client/interfaces/styles/constants.js +1 -3
  4. package/dist/types/export/client/components/index.d.ts +2 -0
  5. package/dist/types/export/client/components/index.d.ts.map +1 -0
  6. package/dist/types/export/client/index.d.ts +1 -1
  7. package/dist/types/export/client/index.d.ts.map +1 -1
  8. package/dist/types/src/client/index.d.ts +1 -1
  9. package/dist/types/src/client/index.d.ts.map +1 -1
  10. package/dist/types/src/client/interfaces/index.d.ts +0 -2
  11. package/dist/types/src/client/interfaces/index.d.ts.map +1 -1
  12. package/package.json +6 -1
  13. package/dist/src/client/applications/ui/use-parent-pathname.js +0 -10
  14. package/dist/src/client/interfaces/components/admin-initializer.js +0 -29
  15. package/dist/src/client/interfaces/components/resources/file/file-card.js +0 -87
  16. package/dist/src/client/interfaces/components/resources/file/file-list.js +0 -159
  17. package/dist/src/client/interfaces/components/resources/file/is-locked-buttons.js +0 -71
  18. package/dist/src/client/interfaces/components/resources/file/type-buttons.js +0 -62
  19. package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/list-cards-container.js +0 -96
  20. package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/page-size-selector.js +0 -63
  21. package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/pagination.js +0 -94
  22. package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header-title.js +0 -26
  23. package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header.js +0 -74
  24. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch-create.js +0 -33
  25. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch.js +0 -39
  26. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/create.js +0 -33
  27. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/edit.js +0 -33
  28. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/index.js +0 -48
  29. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/show.js +0 -61
  30. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/trash.js +0 -39
  31. package/dist/src/client/interfaces/components/ui/buttons/return-button.js +0 -61
  32. package/dist/src/client/interfaces/components/ui/cards/action-buttons-card.js +0 -82
  33. package/dist/src/client/interfaces/components/ui/cards/resource-card/card-status-bar.js +0 -51
  34. package/dist/src/client/interfaces/components/ui/cards/resource-card/card-text-content.js +0 -38
  35. package/dist/src/client/interfaces/components/ui/cards/resource-card/resource-card.js +0 -77
  36. package/dist/src/client/interfaces/components/ui/display/array-list.js +0 -69
  37. package/dist/src/client/interfaces/components/ui/display/badge.js +0 -41
  38. package/dist/src/client/interfaces/components/ui/display/html-display.js +0 -32
  39. package/dist/src/client/interfaces/components/ui/display/object-array-list.js +0 -75
  40. package/dist/src/client/interfaces/components/ui/features/accordion/accordion-container.js +0 -31
  41. package/dist/src/client/interfaces/components/ui/features/accordion/accordion-header.js +0 -34
  42. package/dist/src/client/interfaces/components/ui/features/accordion/accordion.js +0 -81
  43. package/dist/src/client/interfaces/components/ui/features/expandable-list/expand-bar.js +0 -39
  44. package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list-content.js +0 -49
  45. package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list.js +0 -53
  46. package/dist/src/client/interfaces/components/ui/features/external-link.js +0 -15
  47. package/dist/src/client/interfaces/components/ui/features/file/file-info/file-info.js +0 -118
  48. package/dist/src/client/interfaces/components/ui/features/file/file-info/file-name.js +0 -48
  49. package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-container.js +0 -74
  50. package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-placeholder.js +0 -48
  51. package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker.js +0 -109
  52. package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-list.js +0 -85
  53. package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-meta.js +0 -40
  54. package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview.js +0 -113
  55. package/dist/src/client/interfaces/components/ui/features/file/uploader.js +0 -101
  56. package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-body.js +0 -112
  57. package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-trigger.js +0 -97
  58. package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal.js +0 -77
  59. package/dist/src/client/interfaces/components/ui/features/smart-image.js +0 -57
  60. package/dist/src/client/interfaces/components/ui/features/tick.js +0 -27
  61. package/dist/src/client/interfaces/components/ui/form/containers/fields-container.js +0 -24
  62. package/dist/src/client/interfaces/components/ui/form/containers/main-fields.js +0 -25
  63. package/dist/src/client/interfaces/components/ui/form/containers/side-fields.js +0 -24
  64. package/dist/src/client/interfaces/components/ui/form/control-fields/built-in-fields.js +0 -9
  65. package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-display.js +0 -112
  66. package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-input.js +0 -158
  67. package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields.js +0 -59
  68. package/dist/src/client/interfaces/components/ui/form/field-body.js +0 -79
  69. package/dist/src/client/interfaces/components/ui/form/index-field.js +0 -87
  70. package/dist/src/client/interfaces/components/ui/form/slug-field.js +0 -82
  71. package/dist/src/client/interfaces/components/ui/inputs/array-input.js +0 -110
  72. package/dist/src/client/interfaces/components/ui/inputs/checkbox.js +0 -93
  73. package/dist/src/client/interfaces/components/ui/inputs/editor/base/base-editor.js +0 -143
  74. package/dist/src/client/interfaces/components/ui/inputs/editor/base/built-in-plugins.js +0 -71
  75. package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/heading.config.js +0 -41
  76. package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/image.config.js +0 -32
  77. package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/table.config.js +0 -15
  78. package/dist/src/client/interfaces/components/ui/inputs/editor/editor.js +0 -112
  79. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/asset-manager.js +0 -24
  80. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/use-control-asset-mamager.js +0 -26
  81. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/file-repository/upload-adapter.js +0 -84
  82. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/icons.js +0 -17
  83. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/word-count-display.js +0 -81
  84. package/dist/src/client/interfaces/components/ui/inputs/editor/use-init-editor/use-init-editor.js +0 -50
  85. package/dist/src/client/interfaces/components/ui/inputs/search-input.js +0 -61
  86. package/dist/src/client/interfaces/components/ui/inputs/select.js +0 -69
  87. package/dist/src/client/interfaces/components/ui/inputs/textarea.js +0 -62
  88. package/dist/src/client/interfaces/components/ui/layouts/content-container.js +0 -38
  89. package/dist/src/client/interfaces/components/ui/layouts/navbar/i18n-selector.js +0 -42
  90. package/dist/src/client/interfaces/components/ui/layouts/navbar/nav-user.js +0 -106
  91. package/dist/src/client/interfaces/components/ui/layouts/navbar/navbar.js +0 -84
  92. package/dist/src/client/interfaces/components/ui/layouts/navbar/sign-out-button.js +0 -58
  93. package/dist/src/client/interfaces/components/ui/layouts/navbar/theme-selector.js +0 -51
  94. package/dist/src/client/interfaces/components/ui/layouts/sidebar/nav-main.js +0 -99
  95. package/dist/src/constants/file.js +0 -27
  96. package/dist/src/shared/list-items.js +0 -3
  97. package/dist/src/shared/utils/debounce.js +0 -14
@@ -1,61 +0,0 @@
1
- "use client";
2
- import { jsx } from 'react/jsx-runtime';
3
- import { useTranslator } from 'intor/react';
4
- import { Undo2 } from 'lucide-react';
5
- import { useRouter } from 'next/navigation';
6
- import 'react';
7
- import 'ua-parser-js';
8
- import 'clsx';
9
- import 'tailwind-merge';
10
- import { useParentPathname } from '../../../../applications/ui/use-parent-pathname.js';
11
- import { isConfirm } from '../../../../applications/ui/is-confirm.js';
12
- import { Button } from './button.js';
13
-
14
- function ReturnButton({
15
- icon,
16
- useIcon = true,
17
- // use in create/edit page
18
- useConfirm = false,
19
- // navigation
20
- href,
21
- replace = false,
22
- pushToParent = false,
23
- replaceParent = false,
24
- // base
25
- className,
26
- children,
27
- ...props
28
- }) {
29
- const { t } = useTranslator();
30
- const router = useRouter();
31
- const parentPath = useParentPathname();
32
- const handelClick = () => {
33
- if (useConfirm) {
34
- if (!isConfirm(t)) return;
35
- }
36
- if (href) {
37
- return replace ? router.replace(href) : router.push(href);
38
- }
39
- if (replaceParent) {
40
- return router.replace(parentPath);
41
- }
42
- if (pushToParent) {
43
- return router.push(parentPath);
44
- }
45
- router.back();
46
- };
47
- return /* @__PURE__ */ jsx(
48
- Button,
49
- {
50
- variant: "outline",
51
- size: "sm",
52
- icon: useIcon ? icon || Undo2 : void 0,
53
- onClick: handelClick,
54
- className,
55
- ...props,
56
- children: children ?? t("ui.button.return.text")
57
- }
58
- );
59
- }
60
-
61
- export { ReturnButton };
@@ -1,82 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { useTranslator } from 'intor/react';
4
- import '@radix-ui/react-avatar';
5
- import 'react';
6
- import 'ua-parser-js';
7
- import 'clsx';
8
- import 'tailwind-merge';
9
- import 'next/navigation';
10
- import '../../shadcn/badge.js';
11
- import '../../shadcn/button.js';
12
- import { Card } from '../../shadcn/card.js';
13
- import '@radix-ui/react-collapsible';
14
- import '@radix-ui/react-dialog';
15
- import 'lucide-react';
16
- import '@radix-ui/react-dropdown-menu';
17
- import '../../shadcn/input-group.js';
18
- import '@radix-ui/react-label';
19
- import '@radix-ui/react-select';
20
- import '@radix-ui/react-separator';
21
- import '../../shadcn/sidebar.js';
22
- import '@radix-ui/react-tooltip';
23
- import { Button } from '../buttons/button.js';
24
- import { ReturnButton } from '../buttons/return-button.js';
25
-
26
- function ActionButtonsCard({
27
- action = "create",
28
- // button props
29
- cancelButtonProps,
30
- actionButtonProps,
31
- // ui states
32
- isProcessing = false,
33
- isInitializing = false
34
- }) {
35
- const { t } = useTranslator();
36
- let type = "submit";
37
- let variant = "success";
38
- let children = t("ui.button.create.text");
39
- switch (action) {
40
- case "update": {
41
- variant = "warning";
42
- children = t("ui.button.update.text");
43
- break;
44
- }
45
- case "confirm": {
46
- type = "button";
47
- children = t("ui.button.confirm.text");
48
- break;
49
- }
50
- }
51
- return /* @__PURE__ */ jsx(Card, { className: "p-6", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
52
- /* @__PURE__ */ jsx(
53
- ReturnButton,
54
- {
55
- type: "button",
56
- size: "lg",
57
- isDisabled: isInitializing,
58
- useConfirm: true,
59
- useIcon: false,
60
- replaceParent: true,
61
- className: "min-w-[128px]",
62
- ...cancelButtonProps,
63
- children: t("ui.button.cancel.text")
64
- }
65
- ),
66
- /* @__PURE__ */ jsx(
67
- Button,
68
- {
69
- type,
70
- size: "lg",
71
- variant,
72
- isLoading: isProcessing,
73
- isDisabled: isInitializing,
74
- className: "min-w-[126px]",
75
- ...actionButtonProps,
76
- children
77
- }
78
- )
79
- ] }) });
80
- }
81
-
82
- export { ActionButtonsCard };
@@ -1,51 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import 'react';
3
- import 'ua-parser-js';
4
- import { cn } from '../../../../../applications/shadcn/utils.js';
5
- import 'next/navigation';
6
- import 'next/link';
7
- import '../../../../../../constants/paths/auth.js';
8
- import '../../../../../../constants/paths/main.js';
9
- import '../../../../../../constants/paths/resources.js';
10
- import '../../../../../../constants/redirect-paths.js';
11
- import '@radix-ui/react-avatar';
12
- import '../../../shadcn/badge.js';
13
- import '../../../shadcn/button.js';
14
- import '@radix-ui/react-collapsible';
15
- import '@radix-ui/react-dialog';
16
- import 'lucide-react';
17
- import '@radix-ui/react-dropdown-menu';
18
- import '../../../shadcn/input-group.js';
19
- import '@radix-ui/react-label';
20
- import '@radix-ui/react-select';
21
- import '@radix-ui/react-separator';
22
- import '../../../shadcn/sidebar.js';
23
- import '@radix-ui/react-tooltip';
24
- import 'intor/react';
25
- import 'mime-types';
26
- import { Badge } from '../../display/badge.js';
27
-
28
- function CardStatusBar({
29
- badge,
30
- className,
31
- children
32
- }) {
33
- return /* @__PURE__ */ jsx("div", { className: cn("h-10", "relative z-10", "bg-background"), children: /* @__PURE__ */ jsxs(
34
- "div",
35
- {
36
- className: cn(
37
- className,
38
- "size-full",
39
- "flex items-center gap-1",
40
- "px-4 py-1",
41
- "bg-background group-hover:bg-accent/50 transition"
42
- ),
43
- children: [
44
- children,
45
- badge && /* @__PURE__ */ jsx("div", { className: "absolute top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%]", children: /* @__PURE__ */ jsx(Badge, { variant: "secondary", className: "h-6 w-20", children: badge }) })
46
- ]
47
- }
48
- ) });
49
- }
50
-
51
- export { CardStatusBar };
@@ -1,38 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import 'react';
3
- import 'ua-parser-js';
4
- import { cn } from '../../../../../applications/shadcn/utils.js';
5
- import 'next/navigation';
6
- import '@radix-ui/react-avatar';
7
- import '../../../shadcn/badge.js';
8
- import '../../../shadcn/button.js';
9
- import '@radix-ui/react-collapsible';
10
- import '@radix-ui/react-dialog';
11
- import 'lucide-react';
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 CardTextContent({ title, children }) {
21
- return /* @__PURE__ */ jsx("div", { className: cn("relative z-10 h-fit", "mt-auto", "bg-background"), children: /* @__PURE__ */ jsxs(
22
- "div",
23
- {
24
- className: cn(
25
- "flex flex-col",
26
- "bg-background group-hover:bg-accent/50 transition"
27
- ),
28
- children: [
29
- /* @__PURE__ */ jsx(Separator, {}),
30
- /* @__PURE__ */ jsx("div", { className: cn("h-10", "px-4", "flex items-center"), children: /* @__PURE__ */ jsx("p", { className: "truncate", children: title }) }),
31
- children && /* @__PURE__ */ jsx(Separator, {}),
32
- children && /* @__PURE__ */ jsx("div", { className: cn("px-4 py-2", "text-sm"), children })
33
- ]
34
- }
35
- ) });
36
- }
37
-
38
- export { CardTextContent };
@@ -1,77 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import Link from 'next/link';
3
- import '../../../../../../constants/paths/auth.js';
4
- import '../../../../../../constants/paths/main.js';
5
- import '../../../../../../constants/paths/resources.js';
6
- import { NEW_TAB_REL, NEW_TAB_TARGET } from '../../../../../../constants/anchor.js';
7
- import '../../../../../../constants/redirect-paths.js';
8
- import 'react';
9
- import 'ua-parser-js';
10
- import { cn } from '../../../../../applications/shadcn/utils.js';
11
- import 'next/navigation';
12
- import '@radix-ui/react-avatar';
13
- import '../../../shadcn/badge.js';
14
- import '../../../shadcn/button.js';
15
- import { Card } from '../../../shadcn/card.js';
16
- import '@radix-ui/react-collapsible';
17
- import '@radix-ui/react-dialog';
18
- import 'lucide-react';
19
- import '@radix-ui/react-dropdown-menu';
20
- import '../../../shadcn/input-group.js';
21
- import '@radix-ui/react-label';
22
- import '@radix-ui/react-select';
23
- import { Separator } from '../../../shadcn/separator.js';
24
- import '../../../shadcn/sidebar.js';
25
- import '@radix-ui/react-tooltip';
26
- import { CardStatusBar } from './card-status-bar.js';
27
- import { CardTextContent } from './card-text-content.js';
28
-
29
- function ResourceCard({
30
- // link
31
- href = "",
32
- openNewTab = false,
33
- anchorProps,
34
- // card
35
- cardStatusBarProps,
36
- cardTextContentProps,
37
- // base
38
- className = "",
39
- style,
40
- children
41
- }) {
42
- return /* @__PURE__ */ jsx(
43
- Link,
44
- {
45
- href: href ?? "",
46
- target: openNewTab ? NEW_TAB_TARGET : void 0,
47
- rel: openNewTab ? NEW_TAB_REL : void 0,
48
- onClick: (e) => e.stopPropagation(),
49
- ...anchorProps,
50
- children: /* @__PURE__ */ jsxs(
51
- Card,
52
- {
53
- className: cn(
54
- "gap-0 p-0",
55
- // reset
56
- "group",
57
- "hover:bg-accent/50 transition-colors duration-100",
58
- // button-hover like
59
- "relative size-full",
60
- "flex flex-col",
61
- "overflow-hidden",
62
- className
63
- ),
64
- style,
65
- children: [
66
- /* @__PURE__ */ jsx(CardStatusBar, { ...cardStatusBarProps }),
67
- children,
68
- children && /* @__PURE__ */ jsx(Separator, {}),
69
- /* @__PURE__ */ jsx(CardTextContent, { ...cardTextContentProps })
70
- ]
71
- }
72
- )
73
- }
74
- );
75
- }
76
-
77
- export { ResourceCard };
@@ -1,69 +0,0 @@
1
- "use client";
2
- import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
- import Link from 'next/link';
4
- import { useState } from 'react';
5
- import '../../../../../constants/paths/auth.js';
6
- import '../../../../../constants/paths/main.js';
7
- import '../../../../../constants/paths/resources.js';
8
- import { NEW_TAB_REL, NEW_TAB_TARGET } from '../../../../../constants/anchor.js';
9
- import '../../../../../constants/redirect-paths.js';
10
- import 'ua-parser-js';
11
- import { cn } from '../../../../applications/shadcn/utils.js';
12
- import 'next/navigation';
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 'lucide-react';
19
- import '@radix-ui/react-dropdown-menu';
20
- import '../../shadcn/input-group.js';
21
- import '@radix-ui/react-label';
22
- import '@radix-ui/react-select';
23
- import { Separator } from '../../shadcn/separator.js';
24
- import '../../shadcn/sidebar.js';
25
- import '@radix-ui/react-tooltip';
26
- import { FieldBody } from '../form/field-body.js';
27
- import 'mime-types';
28
- import 'intor/react';
29
-
30
- function ArrayList({ values, isLink, isLoading }) {
31
- const [expandedIndex, setExpandedIndex] = useState(null);
32
- const toggle = (i) => setExpandedIndex((p) => p === i ? null : i);
33
- const items = values?.filter((v) => typeof v === "string") ?? [];
34
- if (items.length === 0) return /* @__PURE__ */ jsx(FieldBody, { isEmpty: true });
35
- return /* @__PURE__ */ jsx(Fragment, { children: items.map((value, index) => {
36
- const expanded = expandedIndex === index;
37
- return /* @__PURE__ */ jsxs(
38
- FieldBody,
39
- {
40
- isLoading,
41
- className: cn(expanded ? "cursor-zoom-out" : "cursor-zoom-in"),
42
- onClick: () => toggle(index),
43
- children: [
44
- /* @__PURE__ */ jsxs("div", { className: "flex-center absolute top-0 left-0 z-10 h-full", children: [
45
- /* @__PURE__ */ jsx("span", { className: "min-w-10 px-2 text-center text-sm opacity-50", children: index + 1 }),
46
- /* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "py-2" })
47
- ] }),
48
- isLink ? /* @__PURE__ */ jsx(
49
- Link,
50
- {
51
- href: value,
52
- target: NEW_TAB_TARGET,
53
- rel: NEW_TAB_REL,
54
- className: cn(
55
- "ml-11 text-blue-500/80 underline underline-offset-2",
56
- !expanded && "line-clamp-1"
57
- ),
58
- onClick: (e) => e.stopPropagation(),
59
- children: value
60
- }
61
- ) : /* @__PURE__ */ jsx("p", { className: cn("ml-11", !expanded && "line-clamp-1"), children: value })
62
- ]
63
- },
64
- `${value}-${index}`
65
- );
66
- }) });
67
- }
68
-
69
- export { ArrayList };
@@ -1,41 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import 'react';
3
- import 'ua-parser-js';
4
- import { cn } from '../../../../applications/shadcn/utils.js';
5
- import 'next/navigation';
6
- import '@radix-ui/react-avatar';
7
- import { Badge as Badge$1 } from '../../shadcn/badge.js';
8
- import '../../shadcn/button.js';
9
- import '@radix-ui/react-collapsible';
10
- import '@radix-ui/react-dialog';
11
- import 'lucide-react';
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 '@radix-ui/react-separator';
17
- import '../../shadcn/sidebar.js';
18
- import { Spinner } from '../../shadcn/spinner.js';
19
- import '@radix-ui/react-tooltip';
20
-
21
- function Badge({
22
- // Processing States
23
- isLoading = false,
24
- // Base
25
- variant = "secondary",
26
- className,
27
- children,
28
- ...props
29
- }) {
30
- return /* @__PURE__ */ jsx(
31
- Badge$1,
32
- {
33
- variant,
34
- className: cn("h-6 w-20", className),
35
- ...props,
36
- children: /* @__PURE__ */ jsx("span", { className: "truncate", children: isLoading ? /* @__PURE__ */ jsx(Spinner, {}) : children })
37
- }
38
- );
39
- }
40
-
41
- export { Badge };
@@ -1,32 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import 'react';
3
- import 'ua-parser-js';
4
- import { cn } from '../../../../applications/shadcn/utils.js';
5
- import 'next/navigation';
6
-
7
- function HtmlDisplay({
8
- html = "",
9
- textOnly,
10
- className = "",
11
- ...props
12
- }) {
13
- const content = textOnly ? normalizeHtmlText(html) : html ?? "";
14
- return /* @__PURE__ */ jsx(
15
- "div",
16
- {
17
- className: cn(
18
- className,
19
- "ck ck-content"
20
- // CKEditor styles prefix: .ck (ckeditor.css)
21
- ),
22
- dangerouslySetInnerHTML: { __html: content },
23
- ...props
24
- }
25
- );
26
- }
27
- function normalizeHtmlText(html) {
28
- if (!html) return "";
29
- return html.replace(/<br\s*\/?>/gi, " ").replace(/<[^>]+>/g, "").replace(/\r?\n|\r/g, " ").replace(/\s{2,}/g, " ").trim();
30
- }
31
-
32
- export { HtmlDisplay };
@@ -1,75 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import Link from 'next/link';
4
- import { useState } from 'react';
5
- import '../../../../../constants/paths/auth.js';
6
- import '../../../../../constants/paths/main.js';
7
- import '../../../../../constants/paths/resources.js';
8
- import { NEW_TAB_REL, NEW_TAB_TARGET } from '../../../../../constants/anchor.js';
9
- import '../../../../../constants/redirect-paths.js';
10
- import 'ua-parser-js';
11
- import { cn } from '../../../../applications/shadcn/utils.js';
12
- import 'next/navigation';
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 'lucide-react';
19
- import '@radix-ui/react-dropdown-menu';
20
- import '../../shadcn/input-group.js';
21
- import '@radix-ui/react-label';
22
- import '@radix-ui/react-select';
23
- import { Separator } from '../../shadcn/separator.js';
24
- import '../../shadcn/sidebar.js';
25
- import '@radix-ui/react-tooltip';
26
- import { FieldBody } from '../form/field-body.js';
27
- import 'mime-types';
28
- import 'intor/react';
29
-
30
- function ObjectArrayList({
31
- items,
32
- fields,
33
- isLoading
34
- }) {
35
- const [expandedIndex, setExpandedIndex] = useState(null);
36
- const toggle = (i) => setExpandedIndex((p) => p === i ? null : i);
37
- const validItems = items?.filter(
38
- (item) => typeof item === "object" && item !== null && Object.values(item).every((v) => typeof v === "string")
39
- ) ?? [];
40
- if (!fields?.length || validItems.length === 0) return /* @__PURE__ */ jsx(FieldBody, { isEmpty: true });
41
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: validItems.map((item, index) => {
42
- const expanded = expandedIndex === index;
43
- return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: fields.map((field) => /* @__PURE__ */ jsxs(
44
- FieldBody,
45
- {
46
- isLoading,
47
- className: cn(expanded ? "cursor-zoom-out" : "cursor-zoom-in"),
48
- onClick: () => toggle(index),
49
- children: [
50
- /* @__PURE__ */ jsxs("div", { className: "flex-center absolute top-0 left-0 z-10 h-full", children: [
51
- /* @__PURE__ */ jsx("span", { className: "min-w-10 px-2 text-center text-sm opacity-50", children: index + 1 }),
52
- /* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "py-2" })
53
- ] }),
54
- field.isLink ? /* @__PURE__ */ jsx(
55
- Link,
56
- {
57
- href: item[field.key] ?? "",
58
- target: NEW_TAB_TARGET,
59
- rel: NEW_TAB_REL,
60
- className: cn(
61
- "ml-11 text-blue-500/80 underline underline-offset-2",
62
- !expanded && "line-clamp-1"
63
- ),
64
- onClick: (e) => e.stopPropagation(),
65
- children: item[field.key]
66
- }
67
- ) : /* @__PURE__ */ jsx("p", { className: cn("ml-11", !expanded && "line-clamp-1"), children: item[field.key] })
68
- ]
69
- },
70
- field.key
71
- )) }, index);
72
- }) });
73
- }
74
-
75
- export { ObjectArrayList };
@@ -1,31 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import '@radix-ui/react-avatar';
3
- import 'react';
4
- import 'ua-parser-js';
5
- import 'clsx';
6
- import 'tailwind-merge';
7
- import 'next/navigation';
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 { Separator } from '../../../shadcn/separator.js';
18
- import '../../../shadcn/sidebar.js';
19
- import '@radix-ui/react-tooltip';
20
-
21
- function AccordionContainer({
22
- children,
23
- ...props
24
- }) {
25
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", ...props, children: [
26
- /* @__PURE__ */ jsx(Separator, { className: "my-4" }),
27
- children
28
- ] });
29
- }
30
-
31
- export { AccordionContainer };
@@ -1,34 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useTranslator } from 'intor/react';
3
- import 'react';
4
- import 'ua-parser-js';
5
- import { cn } from '../../../../../applications/shadcn/utils.js';
6
- import 'next/navigation';
7
-
8
- function AccordionHeader({
9
- isRelated = false,
10
- count,
11
- children
12
- }) {
13
- const { t } = useTranslator();
14
- return /* @__PURE__ */ jsxs("div", { className: "flex h-full items-center gap-3 font-medium", children: [
15
- count !== void 0 && /* @__PURE__ */ jsx(
16
- "div",
17
- {
18
- className: cn(
19
- "flex-center",
20
- "h-5 rounded-full px-3",
21
- "bg-primary-foreground",
22
- "shadow-xs"
23
- ),
24
- children: /* @__PURE__ */ jsx("p", { className: "text-xs", children: count })
25
- }
26
- ),
27
- /* @__PURE__ */ jsxs("p", { className: cn("text-sm", "font-500"), children: [
28
- isRelated && t("resources.related.text"),
29
- children
30
- ] })
31
- ] });
32
- }
33
-
34
- export { AccordionHeader as default };
@@ -1,81 +0,0 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { CircleChevronDown } from 'lucide-react';
3
- import { useState, useRef, useEffect } from 'react';
4
- import 'ua-parser-js';
5
- import { cn } from '../../../../../applications/shadcn/utils.js';
6
- import 'next/navigation';
7
- import AccordionHeader from './accordion-header.js';
8
-
9
- function Accordion({
10
- initialOpen = false,
11
- deps,
12
- // children
13
- children,
14
- accordionHeaderProps,
15
- // base
16
- hasBorder,
17
- className,
18
- ...props
19
- }) {
20
- const [isOpen, setIsOpen] = useState(initialOpen);
21
- const containerRef = useRef(null);
22
- useEffect(() => {
23
- const el = containerRef.current;
24
- if (el) el.style.maxHeight = initialOpen ? `${el.scrollHeight}px` : "0";
25
- }, [initialOpen]);
26
- useEffect(() => {
27
- const el = containerRef.current;
28
- if (el) el.style.maxHeight = isOpen ? `${el.scrollHeight}px` : "0";
29
- }, [isOpen, deps]);
30
- return /* @__PURE__ */ jsxs(
31
- "section",
32
- {
33
- className: cn(
34
- className,
35
- "rounded-lg",
36
- hasBorder && "border-secondary overflow-hidden border-2"
37
- ),
38
- ...props,
39
- children: [
40
- /* @__PURE__ */ jsxs(
41
- "div",
42
- {
43
- onClick: () => setIsOpen((prev) => !prev),
44
- className: cn(
45
- "h-9 w-full",
46
- "flex items-center justify-between",
47
- "px-3",
48
- "bg-secondary",
49
- "cursor-pointer",
50
- hasBorder ? "" : "border-secondary rounded-lg border",
51
- "transition"
52
- ),
53
- children: [
54
- accordionHeaderProps && /* @__PURE__ */ jsx(AccordionHeader, { ...accordionHeaderProps }),
55
- /* @__PURE__ */ jsx(
56
- "div",
57
- {
58
- className: cn("opacity-50", !isOpen && "-rotate-90", "transition"),
59
- children: /* @__PURE__ */ jsx(CircleChevronDown, { className: "size-5" })
60
- }
61
- )
62
- ]
63
- }
64
- ),
65
- /* @__PURE__ */ jsx(
66
- "div",
67
- {
68
- className: cn(
69
- "transition-[max-height] duration-300",
70
- "overflow-hidden"
71
- ),
72
- ref: containerRef,
73
- children: /* @__PURE__ */ jsx("div", { className: "p-6", children })
74
- }
75
- )
76
- ]
77
- }
78
- );
79
- }
80
-
81
- export { Accordion };