@yimingliao/cms 0.0.146 → 0.0.147

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 (89) hide show
  1. package/dist/export/client/components/index.js +69 -0
  2. package/dist/src/client/applications/ui/use-parent-pathname.js +10 -0
  3. package/dist/src/client/interfaces/components/admin-initializer.js +29 -0
  4. package/dist/src/client/interfaces/components/resources/file/file-card.js +87 -0
  5. package/dist/src/client/interfaces/components/resources/file/file-list.js +159 -0
  6. package/dist/src/client/interfaces/components/resources/file/is-locked-buttons.js +71 -0
  7. package/dist/src/client/interfaces/components/resources/file/type-buttons.js +62 -0
  8. package/dist/src/client/interfaces/components/shadcn/sidebar.js +1 -1
  9. package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/list-cards-container.js +96 -0
  10. package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/page-size-selector.js +63 -0
  11. package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/pagination.js +94 -0
  12. package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header-title.js +26 -0
  13. package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header.js +74 -0
  14. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch-create.js +33 -0
  15. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch.js +39 -0
  16. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/create.js +33 -0
  17. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/edit.js +33 -0
  18. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/index.js +48 -0
  19. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/show.js +61 -0
  20. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/trash.js +39 -0
  21. package/dist/src/client/interfaces/components/ui/buttons/return-button.js +61 -0
  22. package/dist/src/client/interfaces/components/ui/cards/action-buttons-card.js +82 -0
  23. package/dist/src/client/interfaces/components/ui/cards/resource-card/card-status-bar.js +51 -0
  24. package/dist/src/client/interfaces/components/ui/cards/resource-card/card-text-content.js +38 -0
  25. package/dist/src/client/interfaces/components/ui/cards/resource-card/resource-card.js +77 -0
  26. package/dist/src/client/interfaces/components/ui/display/array-list.js +69 -0
  27. package/dist/src/client/interfaces/components/ui/display/badge.js +41 -0
  28. package/dist/src/client/interfaces/components/ui/display/html-display.js +32 -0
  29. package/dist/src/client/interfaces/components/ui/display/object-array-list.js +75 -0
  30. package/dist/src/client/interfaces/components/ui/features/accordion/accordion-container.js +31 -0
  31. package/dist/src/client/interfaces/components/ui/features/accordion/accordion-header.js +34 -0
  32. package/dist/src/client/interfaces/components/ui/features/accordion/accordion.js +81 -0
  33. package/dist/src/client/interfaces/components/ui/features/expandable-list/expand-bar.js +39 -0
  34. package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list-content.js +49 -0
  35. package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list.js +53 -0
  36. package/dist/src/client/interfaces/components/ui/features/external-link.js +15 -0
  37. package/dist/src/client/interfaces/components/ui/features/file/file-info/file-info.js +118 -0
  38. package/dist/src/client/interfaces/components/ui/features/file/file-info/file-name.js +48 -0
  39. package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-container.js +74 -0
  40. package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-placeholder.js +48 -0
  41. package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker.js +109 -0
  42. package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-list.js +85 -0
  43. package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-meta.js +40 -0
  44. package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview.js +113 -0
  45. package/dist/src/client/interfaces/components/ui/features/file/uploader.js +101 -0
  46. package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-body.js +112 -0
  47. package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-trigger.js +97 -0
  48. package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal.js +77 -0
  49. package/dist/src/client/interfaces/components/ui/features/smart-image.js +57 -0
  50. package/dist/src/client/interfaces/components/ui/features/tick.js +27 -0
  51. package/dist/src/client/interfaces/components/ui/form/containers/fields-container.js +24 -0
  52. package/dist/src/client/interfaces/components/ui/form/containers/main-fields.js +25 -0
  53. package/dist/src/client/interfaces/components/ui/form/containers/side-fields.js +24 -0
  54. package/dist/src/client/interfaces/components/ui/form/control-fields/built-in-fields.js +9 -0
  55. package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-display.js +112 -0
  56. package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-input.js +158 -0
  57. package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields.js +59 -0
  58. package/dist/src/client/interfaces/components/ui/form/field-body.js +79 -0
  59. package/dist/src/client/interfaces/components/ui/form/index-field.js +87 -0
  60. package/dist/src/client/interfaces/components/ui/form/slug-field.js +82 -0
  61. package/dist/src/client/interfaces/components/ui/inputs/array-input.js +110 -0
  62. package/dist/src/client/interfaces/components/ui/inputs/checkbox.js +93 -0
  63. package/dist/src/client/interfaces/components/ui/inputs/editor/base/base-editor.js +143 -0
  64. package/dist/src/client/interfaces/components/ui/inputs/editor/base/built-in-plugins.js +71 -0
  65. package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/heading.config.js +41 -0
  66. package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/image.config.js +32 -0
  67. package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/table.config.js +15 -0
  68. package/dist/src/client/interfaces/components/ui/inputs/editor/editor.js +112 -0
  69. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/asset-manager.js +24 -0
  70. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/use-control-asset-mamager.js +26 -0
  71. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/file-repository/upload-adapter.js +84 -0
  72. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/icons.js +17 -0
  73. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/word-count-display.js +81 -0
  74. package/dist/src/client/interfaces/components/ui/inputs/editor/use-init-editor/use-init-editor.js +50 -0
  75. package/dist/src/client/interfaces/components/ui/inputs/search-input.js +61 -0
  76. package/dist/src/client/interfaces/components/ui/inputs/select.js +69 -0
  77. package/dist/src/client/interfaces/components/ui/inputs/textarea.js +62 -0
  78. package/dist/src/client/interfaces/components/ui/layouts/content-container.js +38 -0
  79. package/dist/src/client/interfaces/components/ui/layouts/navbar/i18n-selector.js +42 -0
  80. package/dist/src/client/interfaces/components/ui/layouts/navbar/nav-user.js +106 -0
  81. package/dist/src/client/interfaces/components/ui/layouts/navbar/navbar.js +84 -0
  82. package/dist/src/client/interfaces/components/ui/layouts/navbar/sign-out-button.js +58 -0
  83. package/dist/src/client/interfaces/components/ui/layouts/navbar/theme-selector.js +51 -0
  84. package/dist/src/client/interfaces/components/ui/layouts/sidebar/nav-main.js +99 -0
  85. package/dist/src/client/interfaces/styles/constants.js +3 -1
  86. package/dist/src/constants/file.js +27 -0
  87. package/dist/src/shared/list-items.js +3 -0
  88. package/dist/src/shared/utils/debounce.js +14 -0
  89. package/package.json +1 -1
@@ -0,0 +1,51 @@
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 };
@@ -0,0 +1,38 @@
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 };
@@ -0,0 +1,77 @@
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 };
@@ -0,0 +1,69 @@
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 };
@@ -0,0 +1,41 @@
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 };
@@ -0,0 +1,32 @@
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 };
@@ -0,0 +1,75 @@
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 };
@@ -0,0 +1,31 @@
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 };
@@ -0,0 +1,34 @@
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 };
@@ -0,0 +1,81 @@
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 };
@@ -0,0 +1,39 @@
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 };
@@ -0,0 +1,49 @@
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 };