@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.
Files changed (100) hide show
  1. package/dist/export/client/index.js +1 -73
  2. package/dist/export/client/pages/index.js +8 -0
  3. package/dist/src/client/interfaces/components/shadcn/sidebar.js +1 -1
  4. package/dist/src/client/interfaces/styles/constants.js +1 -3
  5. package/dist/types/export/client/components/index.d.ts +2 -0
  6. package/dist/types/export/client/components/index.d.ts.map +1 -0
  7. package/dist/types/export/client/index.d.ts +1 -1
  8. package/dist/types/export/client/index.d.ts.map +1 -1
  9. package/dist/types/export/client/pages/index.d.ts +2 -0
  10. package/dist/types/export/client/pages/index.d.ts.map +1 -0
  11. package/dist/types/src/client/index.d.ts +1 -1
  12. package/dist/types/src/client/index.d.ts.map +1 -1
  13. package/dist/types/src/client/interfaces/index.d.ts +0 -2
  14. package/dist/types/src/client/interfaces/index.d.ts.map +1 -1
  15. package/package.json +11 -1
  16. package/dist/src/client/applications/ui/use-parent-pathname.js +0 -10
  17. package/dist/src/client/interfaces/components/admin-initializer.js +0 -29
  18. package/dist/src/client/interfaces/components/resources/file/file-card.js +0 -87
  19. package/dist/src/client/interfaces/components/resources/file/file-list.js +0 -159
  20. package/dist/src/client/interfaces/components/resources/file/is-locked-buttons.js +0 -71
  21. package/dist/src/client/interfaces/components/resources/file/type-buttons.js +0 -62
  22. package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/list-cards-container.js +0 -96
  23. package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/page-size-selector.js +0 -63
  24. package/dist/src/client/interfaces/components/ui/blocks/list-cards-container/pagination.js +0 -94
  25. package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header-title.js +0 -26
  26. package/dist/src/client/interfaces/components/ui/blocks/page-header/page-header.js +0 -74
  27. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch-create.js +0 -33
  28. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/batch.js +0 -39
  29. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/create.js +0 -33
  30. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/edit.js +0 -33
  31. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/index.js +0 -48
  32. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/show.js +0 -61
  33. package/dist/src/client/interfaces/components/ui/blocks/page-header/presets/trash.js +0 -39
  34. package/dist/src/client/interfaces/components/ui/buttons/return-button.js +0 -61
  35. package/dist/src/client/interfaces/components/ui/cards/action-buttons-card.js +0 -82
  36. package/dist/src/client/interfaces/components/ui/cards/resource-card/card-status-bar.js +0 -51
  37. package/dist/src/client/interfaces/components/ui/cards/resource-card/card-text-content.js +0 -38
  38. package/dist/src/client/interfaces/components/ui/cards/resource-card/resource-card.js +0 -77
  39. package/dist/src/client/interfaces/components/ui/display/array-list.js +0 -69
  40. package/dist/src/client/interfaces/components/ui/display/badge.js +0 -41
  41. package/dist/src/client/interfaces/components/ui/display/html-display.js +0 -32
  42. package/dist/src/client/interfaces/components/ui/display/object-array-list.js +0 -75
  43. package/dist/src/client/interfaces/components/ui/features/accordion/accordion-container.js +0 -31
  44. package/dist/src/client/interfaces/components/ui/features/accordion/accordion-header.js +0 -34
  45. package/dist/src/client/interfaces/components/ui/features/accordion/accordion.js +0 -81
  46. package/dist/src/client/interfaces/components/ui/features/expandable-list/expand-bar.js +0 -39
  47. package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list-content.js +0 -49
  48. package/dist/src/client/interfaces/components/ui/features/expandable-list/expandable-list.js +0 -53
  49. package/dist/src/client/interfaces/components/ui/features/external-link.js +0 -15
  50. package/dist/src/client/interfaces/components/ui/features/file/file-info/file-info.js +0 -118
  51. package/dist/src/client/interfaces/components/ui/features/file/file-info/file-name.js +0 -48
  52. package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-container.js +0 -74
  53. package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker-placeholder.js +0 -48
  54. package/dist/src/client/interfaces/components/ui/features/file/file-picker/file-picker.js +0 -109
  55. package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-list.js +0 -85
  56. package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview-meta.js +0 -40
  57. package/dist/src/client/interfaces/components/ui/features/file/file-preview/file-preview.js +0 -113
  58. package/dist/src/client/interfaces/components/ui/features/file/uploader.js +0 -101
  59. package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-body.js +0 -112
  60. package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal-trigger.js +0 -97
  61. package/dist/src/client/interfaces/components/ui/features/pick-modal/pick-modal.js +0 -77
  62. package/dist/src/client/interfaces/components/ui/features/smart-image.js +0 -57
  63. package/dist/src/client/interfaces/components/ui/features/tick.js +0 -27
  64. package/dist/src/client/interfaces/components/ui/form/containers/fields-container.js +0 -24
  65. package/dist/src/client/interfaces/components/ui/form/containers/main-fields.js +0 -25
  66. package/dist/src/client/interfaces/components/ui/form/containers/side-fields.js +0 -24
  67. package/dist/src/client/interfaces/components/ui/form/control-fields/built-in-fields.js +0 -9
  68. package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-display.js +0 -112
  69. package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields-input.js +0 -158
  70. package/dist/src/client/interfaces/components/ui/form/control-fields/control-fields.js +0 -59
  71. package/dist/src/client/interfaces/components/ui/form/field-body.js +0 -79
  72. package/dist/src/client/interfaces/components/ui/form/index-field.js +0 -87
  73. package/dist/src/client/interfaces/components/ui/form/slug-field.js +0 -82
  74. package/dist/src/client/interfaces/components/ui/inputs/array-input.js +0 -110
  75. package/dist/src/client/interfaces/components/ui/inputs/checkbox.js +0 -93
  76. package/dist/src/client/interfaces/components/ui/inputs/editor/base/base-editor.js +0 -143
  77. package/dist/src/client/interfaces/components/ui/inputs/editor/base/built-in-plugins.js +0 -71
  78. package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/heading.config.js +0 -41
  79. package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/image.config.js +0 -32
  80. package/dist/src/client/interfaces/components/ui/inputs/editor/base/configs/table.config.js +0 -15
  81. package/dist/src/client/interfaces/components/ui/inputs/editor/editor.js +0 -112
  82. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/asset-manager.js +0 -24
  83. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/asset-manager/use-control-asset-mamager.js +0 -26
  84. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/file-repository/upload-adapter.js +0 -84
  85. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/icons.js +0 -17
  86. package/dist/src/client/interfaces/components/ui/inputs/editor/plugins/word-count-display/word-count-display.js +0 -81
  87. package/dist/src/client/interfaces/components/ui/inputs/editor/use-init-editor/use-init-editor.js +0 -50
  88. package/dist/src/client/interfaces/components/ui/inputs/search-input.js +0 -61
  89. package/dist/src/client/interfaces/components/ui/inputs/select.js +0 -69
  90. package/dist/src/client/interfaces/components/ui/inputs/textarea.js +0 -62
  91. package/dist/src/client/interfaces/components/ui/layouts/content-container.js +0 -38
  92. package/dist/src/client/interfaces/components/ui/layouts/navbar/i18n-selector.js +0 -42
  93. package/dist/src/client/interfaces/components/ui/layouts/navbar/nav-user.js +0 -106
  94. package/dist/src/client/interfaces/components/ui/layouts/navbar/navbar.js +0 -84
  95. package/dist/src/client/interfaces/components/ui/layouts/navbar/sign-out-button.js +0 -58
  96. package/dist/src/client/interfaces/components/ui/layouts/navbar/theme-selector.js +0 -51
  97. package/dist/src/client/interfaces/components/ui/layouts/sidebar/nav-main.js +0 -99
  98. package/dist/src/constants/file.js +0 -27
  99. package/dist/src/shared/list-items.js +0 -3
  100. package/dist/src/shared/utils/debounce.js +0 -14
@@ -1,84 +0,0 @@
1
- import { toast } from 'sonner';
2
- import '../../../../../../../../constants/paths/auth.js';
3
- import '../../../../../../../../constants/paths/main.js';
4
- import '../../../../../../../../constants/paths/resources.js';
5
- import { CACHE_KEYS } from '../../../../../../../../constants/cache-keys.js';
6
- import '../../../../../../../../constants/redirect-paths.js';
7
- import '../../../../../../../../domain/resources/admin/constants.js';
8
- import { SIMPLE_UPLOAD_FOLDER_KEY } from '../../../../../../../../domain/resources/constants.js';
9
- import 'mime-types';
10
- import { getMediaInfo } from '../../../../../../../../shared/blob-file/get-media-info/get-media-info.js';
11
- import { joinUrl } from '../../../../../../../../shared/utils/join-url.js';
12
-
13
- function createUploadAdapter({
14
- fileUploadApi,
15
- buildTranslations,
16
- logger,
17
- storageUrl
18
- }) {
19
- return class UploadAdapter {
20
- constructor(loader, execute, queryClient) {
21
- this.loader = loader;
22
- this.execute = execute;
23
- this.queryClient = queryClient;
24
- }
25
- async upload() {
26
- try {
27
- const blobFile = await this.loader.file;
28
- if (!blobFile || !(blobFile instanceof Blob)) {
29
- throw new Error("Invalid file provided by loader.");
30
- }
31
- if (!blobFile.type.startsWith("image/")) {
32
- throw new Error("Images Only");
33
- }
34
- const mediaInfo = await getMediaInfo(blobFile);
35
- const response = await fileUploadApi({
36
- blobFile,
37
- folderKey: SIMPLE_UPLOAD_FOLDER_KEY,
38
- folder: null
39
- });
40
- let key = "", checksum = "";
41
- if (response.success) {
42
- key = response.data?.key || "";
43
- checksum = response.data?.checksum || "";
44
- }
45
- const { name, size, type } = blobFile;
46
- const result = await this.execute({
47
- key,
48
- checksum,
49
- fileMeta: { name, size, type },
50
- folderKey: SIMPLE_UPLOAD_FOLDER_KEY,
51
- folder: null,
52
- width: mediaInfo.width,
53
- height: mediaInfo.height,
54
- translations: buildTranslations([
55
- { key: "name", value: null },
56
- { key: "alt", value: null }
57
- ])
58
- });
59
- if (result) {
60
- await this.queryClient.invalidateQueries({
61
- queryKey: [CACHE_KEYS.findListCards("file")]
62
- });
63
- const id = result.file.id;
64
- return { default: joinUrl(storageUrl, `${key}?id=${id}`) };
65
- } else {
66
- return { default: "" };
67
- }
68
- } catch (error) {
69
- if (error instanceof Error) {
70
- toast.error(error.message, {
71
- position: "bottom-left",
72
- duration: 4e3
73
- });
74
- }
75
- return { default: "" };
76
- }
77
- }
78
- abort() {
79
- logger.debug("Image upload cancelled.");
80
- }
81
- };
82
- }
83
-
84
- export { createUploadAdapter };
@@ -1,17 +0,0 @@
1
- const HTML_ICON = `
2
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640">
3
- <path d="M392.8 65.2C375.8 60.3 358.1 70.2 353.2 87.2L225.2 535.2C220.3 552.2 230.2 569.9 247.2 574.8C264.2 579.7 281.9 569.8 286.8 552.8L414.8 104.8C419.7 87.8 409.8 70.1 392.8 65.2zM457.4 201.3C444.9 213.8 444.9 234.1 457.4 246.6L530.8 320L457.4 393.4C444.9 405.9 444.9 426.2 457.4 438.7C469.9 451.2 490.2 451.2 502.7 438.7L598.7 342.7C611.2 330.2 611.2 309.9 598.7 297.4L502.7 201.4C490.2 188.9 469.9 188.9 457.4 201.4zM182.7 201.3C170.2 188.8 149.9 188.8 137.4 201.3L41.4 297.3C28.9 309.8 28.9 330.1 41.4 342.6L137.4 438.6C149.9 451.1 170.2 451.1 182.7 438.6C195.2 426.1 195.2 405.8 182.7 393.3L109.3 320L182.6 246.6C195.1 234.1 195.1 213.8 182.6 201.3z"/>
4
- </svg>
5
- `;
6
- const CHARACTERS_ICON = `
7
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640">
8
- <path d="M349.1 114.7C343.9 103.3 332.5 96 320 96C307.5 96 296.1 103.3 290.9 114.7L123.5 480L112 480C94.3 480 80 494.3 80 512C80 529.7 94.3 544 112 544L200 544C217.7 544 232 529.7 232 512C232 494.3 217.7 480 200 480L193.9 480L215.9 432L424.2 432L446.2 480L440.1 480C422.4 480 408.1 494.3 408.1 512C408.1 529.7 422.4 544 440.1 544L528.1 544C545.8 544 560.1 529.7 560.1 512C560.1 494.3 545.8 480 528.1 480L516.6 480L349.2 114.7zM394.8 368L245.2 368L320 204.8L394.8 368z"/>
9
- </svg>
10
- `;
11
- const WORDS_ICON = `
12
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640">
13
- <path d="M192 112L304 112L304 200C304 239.8 336.2 272 376 272L464 272L464 512C464 520.8 456.8 528 448 528L192 528C183.2 528 176 520.8 176 512L176 128C176 119.2 183.2 112 192 112zM352 131.9L444.1 224L376 224C362.7 224 352 213.3 352 200L352 131.9zM192 64C156.7 64 128 92.7 128 128L128 512C128 547.3 156.7 576 192 576L448 576C483.3 576 512 547.3 512 512L512 250.5C512 233.5 505.3 217.2 493.3 205.2L370.7 82.7C358.7 70.7 342.5 64 325.5 64L192 64zM263.3 338.2C260.1 325.3 247.1 317.5 234.2 320.7C221.3 323.9 213.5 337 216.7 349.8L248.7 477.8C251.2 488 260.1 495.3 270.6 495.9C281.1 496.5 290.7 490.2 294.4 480.4L319.9 412.3L345.4 480.4C349.1 490.2 358.7 496.5 369.2 495.9C379.7 495.3 388.6 488 391.1 477.8L423.1 349.8C426.3 336.9 418.5 323.9 405.6 320.7C392.7 317.5 379.7 325.3 376.5 338.2L363.2 391.4L342.3 335.6C339 326.2 330 320 320 320C310 320 301 326.2 297.5 335.6L276.6 391.4L263.3 338.2z"/>
14
- </svg>
15
- `;
16
-
17
- export { CHARACTERS_ICON, HTML_ICON, WORDS_ICON };
@@ -1,81 +0,0 @@
1
- import { Plugin, ButtonView } from 'ckeditor5';
2
- import 'mime-types';
3
- import { debounce } from '../../../../../../../../shared/utils/debounce.js';
4
- import { HTML_ICON, CHARACTERS_ICON, WORDS_ICON } from './icons.js';
5
-
6
- const WORD_COUNT = "WordCount";
7
- const WORD_COUNT_DISPLAY_PLUGIN_NAME = {
8
- default: "word-count-display",
9
- // CSS Class
10
- characters: "word-count-display-characters",
11
- // Plugin Name, CSS Class
12
- words: "word-count-display-words",
13
- // Plugin Name, CSS Class
14
- html: "word-count-display-html"
15
- // Plugin Name, CSS Class
16
- };
17
- class WordCountButtons extends Plugin {
18
- init() {
19
- const editor = this.editor;
20
- const wordCountPlugin = editor.plugins.get(WORD_COUNT);
21
- editor.ui.componentFactory.add(
22
- WORD_COUNT_DISPLAY_PLUGIN_NAME.html,
23
- (locale) => {
24
- const button = new ButtonView(locale);
25
- button.set({
26
- icon: HTML_ICON,
27
- label: `${editor.getData()?.length}`,
28
- tooltip: true,
29
- withText: true,
30
- isEnabled: false,
31
- class: `${WORD_COUNT_DISPLAY_PLUGIN_NAME.default} ${WORD_COUNT_DISPLAY_PLUGIN_NAME.html}`
32
- });
33
- const update = debounce(
34
- () => button.label = `${editor.getData()?.length}`
35
- );
36
- editor.model.document.on("change:data", update);
37
- return button;
38
- }
39
- );
40
- editor.ui.componentFactory.add(
41
- WORD_COUNT_DISPLAY_PLUGIN_NAME.characters,
42
- (locale) => {
43
- const button = new ButtonView(locale);
44
- button.set({
45
- icon: CHARACTERS_ICON,
46
- label: `${wordCountPlugin.characters}`,
47
- tooltip: true,
48
- withText: true,
49
- isEnabled: false,
50
- class: `${WORD_COUNT_DISPLAY_PLUGIN_NAME.default} ${WORD_COUNT_DISPLAY_PLUGIN_NAME.characters}`
51
- });
52
- const update = debounce(
53
- () => button.label = `${wordCountPlugin.characters}`
54
- );
55
- wordCountPlugin.on("change:characters", update);
56
- return button;
57
- }
58
- );
59
- editor.ui.componentFactory.add(
60
- WORD_COUNT_DISPLAY_PLUGIN_NAME.words,
61
- (locale) => {
62
- const button = new ButtonView(locale);
63
- button.set({
64
- icon: WORDS_ICON,
65
- label: `${wordCountPlugin.words}`,
66
- tooltip: true,
67
- withText: true,
68
- isEnabled: false,
69
- class: `${WORD_COUNT_DISPLAY_PLUGIN_NAME.default} ${WORD_COUNT_DISPLAY_PLUGIN_NAME.words}`
70
- });
71
- const update = debounce(
72
- () => button.label = `${wordCountPlugin.words}`
73
- );
74
- wordCountPlugin.on("change:words", update);
75
- return button;
76
- }
77
- );
78
- }
79
- }
80
-
81
- export { WORD_COUNT_DISPLAY_PLUGIN_NAME, WordCountButtons as default };
@@ -1,50 +0,0 @@
1
- import { FileRepository } from 'ckeditor5';
2
- import { useRef, useEffect } from 'react';
3
- import 'mime-types';
4
- import { debounce } from '../../../../../../../shared/utils/debounce.js';
5
- import { BaseEditor } from '../base/base-editor.js';
6
- import { OPEN_ASSET_MANAGER_KEY } from '../plugins/asset-manager/asset-manager.js';
7
- import 'intor/react';
8
-
9
- const DOCUMENT_EVENTS = {
10
- CHANGE: "change"};
11
- const useInitEditor = ({
12
- enabled = true,
13
- containerRef,
14
- locale,
15
- value,
16
- onEditorChange,
17
- createUploadAdapter,
18
- openAssetManager
19
- }) => {
20
- const editorRef = useRef(null);
21
- useEffect(() => {
22
- if (!enabled || !containerRef.current) return;
23
- BaseEditor.create(containerRef.current, {
24
- ...BaseEditor.defaultConfig,
25
- language: locale,
26
- initialData: value
27
- }).then((editor) => {
28
- editorRef.current = editor;
29
- const debouncedChange = debounce(
30
- () => onEditorChange?.(editor.getData())
31
- );
32
- editor.model.document.on(DOCUMENT_EVENTS.CHANGE, debouncedChange);
33
- editor.plugins.get(FileRepository.pluginName).createUploadAdapter = createUploadAdapter;
34
- editor.config.set(OPEN_ASSET_MANAGER_KEY, openAssetManager);
35
- return () => {
36
- editor.model.document.off(DOCUMENT_EVENTS.CHANGE, debouncedChange);
37
- debouncedChange.clear();
38
- };
39
- }).catch((error) => {
40
- console.error("CKEditor init error:", error);
41
- });
42
- return () => {
43
- void editorRef.current?.destroy();
44
- editorRef.current = null;
45
- };
46
- }, [enabled, containerRef]);
47
- return editorRef;
48
- };
49
-
50
- export { useInitEditor };
@@ -1,61 +0,0 @@
1
- "use client";
2
- import { jsx } from 'react/jsx-runtime';
3
- import { useTranslator } from 'intor/react';
4
- import { Search } from 'lucide-react';
5
- import { useRef, useState } from 'react';
6
- import '@radix-ui/react-avatar';
7
- import 'ua-parser-js';
8
- import 'clsx';
9
- import 'tailwind-merge';
10
- import 'next/navigation';
11
- import '../../shadcn/badge.js';
12
- import '../../shadcn/button.js';
13
- import '@radix-ui/react-collapsible';
14
- import '@radix-ui/react-dialog';
15
- import '@radix-ui/react-dropdown-menu';
16
- import { InputGroupAddon } from '../../shadcn/input-group.js';
17
- import '@radix-ui/react-label';
18
- import '@radix-ui/react-select';
19
- import '@radix-ui/react-separator';
20
- import '../../shadcn/sidebar.js';
21
- import { Spinner } from '../../shadcn/spinner.js';
22
- import '@radix-ui/react-tooltip';
23
- import { Input } from './input.js';
24
-
25
- function SearchInput({
26
- searchString = "",
27
- setSearchString,
28
- isLoading = false,
29
- isDisabled = false,
30
- ...props
31
- }) {
32
- const { t } = useTranslator();
33
- const isComposingRef = useRef(false);
34
- const [inputValue, setInputValue] = useState(searchString);
35
- const handleCompositionEnd = (e) => {
36
- isComposingRef.current = false;
37
- setInputValue(e.currentTarget.value);
38
- setSearchString(e.currentTarget.value);
39
- };
40
- const handleChange = (e) => {
41
- setInputValue(e.target.value);
42
- if (!isComposingRef.current) setSearchString(e.target.value);
43
- };
44
- return /* @__PURE__ */ jsx("div", { className: "relative size-full", children: /* @__PURE__ */ jsx(
45
- Input,
46
- {
47
- isDisabled,
48
- placeholder: isLoading ? "" : t("ui.search.text"),
49
- autoComplete: "off",
50
- value: inputValue,
51
- onChange: handleChange,
52
- onCompositionStart: () => isComposingRef.current = true,
53
- onCompositionEnd: handleCompositionEnd,
54
- className: "w-full pr-9",
55
- ...props,
56
- children: /* @__PURE__ */ jsx(InputGroupAddon, { align: "inline-end", children: isLoading ? /* @__PURE__ */ jsx(Spinner, {}) : /* @__PURE__ */ jsx(Search, {}) })
57
- }
58
- ) });
59
- }
60
-
61
- export { SearchInput };
@@ -1,69 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } 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 { SelectItem, Select as Select$1, SelectTrigger, SelectValue, SelectContent, SelectGroup, SelectLabel } from '../../shadcn/select.js';
17
- import '@radix-ui/react-separator';
18
- import '../../shadcn/sidebar.js';
19
- import '@radix-ui/react-tooltip';
20
-
21
- function Select({
22
- // form context
23
- fieldName,
24
- setFormData,
25
- // ui states
26
- isDisabled = false,
27
- isLoading = false,
28
- // base
29
- placeholder,
30
- label,
31
- className,
32
- children,
33
- ...props
34
- }) {
35
- return /* @__PURE__ */ jsxs(
36
- Select$1,
37
- {
38
- onValueChange: (value) => {
39
- if (!setFormData || !fieldName) return;
40
- setFormData((p) => ({ ...p, [fieldName]: value }));
41
- },
42
- disabled: isDisabled || isLoading,
43
- ...props,
44
- children: [
45
- /* @__PURE__ */ jsx(
46
- SelectTrigger,
47
- {
48
- className: cn("w-full", className),
49
- disabled: isDisabled || isLoading,
50
- children: /* @__PURE__ */ jsx(SelectValue, { placeholder })
51
- }
52
- ),
53
- /* @__PURE__ */ jsx(SelectContent, { children: /* @__PURE__ */ jsxs(SelectGroup, { children: [
54
- label && /* @__PURE__ */ jsx(SelectLabel, { children: label }),
55
- children
56
- ] }) })
57
- ]
58
- }
59
- );
60
- }
61
- function Option({
62
- value,
63
- isDisabled = false,
64
- children
65
- }) {
66
- return /* @__PURE__ */ jsx(SelectItem, { value, disabled: isDisabled, children });
67
- }
68
-
69
- export { Option, Select };
@@ -1,62 +0,0 @@
1
- "use client";
2
- import { jsx, Fragment } from 'react/jsx-runtime';
3
- import { useRef, useEffect } from 'react';
4
- import '@radix-ui/react-avatar';
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 { InputGroup, InputGroupAddon } from '../../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 { Spinner } from '../../shadcn/spinner.js';
21
- import { Textarea as Textarea$1 } from '../../shadcn/textarea.js';
22
- import '@radix-ui/react-tooltip';
23
-
24
- function Textarea({
25
- // form context
26
- fieldName,
27
- setFormData,
28
- // ui states
29
- isLoading = false,
30
- isDisabled = false,
31
- isError = false,
32
- // base
33
- ...props
34
- }) {
35
- isDisabled = isDisabled || isLoading;
36
- const textareaRef = useRef(null);
37
- const resetHeight = (element) => {
38
- element.style.height = "40px";
39
- element.style.height = `${element.scrollHeight + 2}px`;
40
- };
41
- useEffect(() => {
42
- if (!textareaRef.current) return;
43
- resetHeight(textareaRef.current);
44
- }, [props.value, isLoading]);
45
- return /* @__PURE__ */ jsx(Fragment, { children: isLoading ? /* @__PURE__ */ jsx(InputGroup, { "data-disabled": isDisabled, className: "h-10", children: /* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(Spinner, {}) }) }) : /* @__PURE__ */ jsx(
46
- Textarea$1,
47
- {
48
- ref: textareaRef,
49
- disabled: isDisabled,
50
- "aria-invalid": isError,
51
- value: isLoading ? "" : props.value,
52
- onChange: (e) => {
53
- resetHeight(e.target);
54
- if (!setFormData || !fieldName) return;
55
- setFormData((p) => ({ ...p, [fieldName]: e.target.value }));
56
- },
57
- ...props
58
- }
59
- ) });
60
- }
61
-
62
- export { Textarea };
@@ -1,38 +0,0 @@
1
- "use client";
2
- import { jsx } from 'react/jsx-runtime';
3
- import { useTranslator } from 'intor/react';
4
- import 'react';
5
- import 'ua-parser-js';
6
- import { cn } from '../../../../applications/shadcn/utils.js';
7
- import 'next/navigation';
8
- import { NAVBAR_HEIGHT, PAGE_HEADER_HEIGHT } from '../../../styles/constants.js';
9
-
10
- function ContentContainer({
11
- className = "",
12
- children,
13
- isNotFound = false,
14
- isFixHeight,
15
- ...props
16
- }) {
17
- const { t } = useTranslator();
18
- const ABOVE_HEIGHT = NAVBAR_HEIGHT + PAGE_HEADER_HEIGHT;
19
- return /* @__PURE__ */ jsx(
20
- "div",
21
- {
22
- style: {
23
- height: isFixHeight ? `calc(100vh - ${ABOVE_HEIGHT}px)` : "auto"
24
- },
25
- className: cn(
26
- className,
27
- "relative",
28
- "flex flex-col gap-4",
29
- "px-6 pt-6",
30
- isFixHeight ? "pb-6" : "flex-1 pb-64"
31
- ),
32
- ...props,
33
- children: isNotFound ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: t("ui.no-data.text") }) : children
34
- }
35
- );
36
- }
37
-
38
- export { ContentContainer };
@@ -1,42 +0,0 @@
1
- "use client";
2
- import { jsxs, jsx } from 'react/jsx-runtime';
3
- import { Link } from 'intor/next';
4
- import { Languages } from 'lucide-react';
5
- import '@radix-ui/react-avatar';
6
- import 'react';
7
- import 'ua-parser-js';
8
- import 'clsx';
9
- import 'tailwind-merge';
10
- import 'next/navigation';
11
- import '../../../shadcn/badge.js';
12
- import '../../../shadcn/button.js';
13
- import '@radix-ui/react-collapsible';
14
- import '@radix-ui/react-dialog';
15
- import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from '../../../shadcn/dropdown-menu.js';
16
- import '../../../shadcn/input-group.js';
17
- import '@radix-ui/react-label';
18
- import '@radix-ui/react-select';
19
- import '@radix-ui/react-separator';
20
- import '../../../shadcn/sidebar.js';
21
- import '@radix-ui/react-tooltip';
22
- import { Button } from '../../buttons/button.js';
23
- import 'intor/react';
24
-
25
- function createI18nSelector({
26
- enabled,
27
- locales,
28
- localeDisplay
29
- }) {
30
- return function I18nSelector() {
31
- if (!enabled) return null;
32
- return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
33
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { variant: "outline", size: "icon", children: [
34
- /* @__PURE__ */ jsx(Languages, {}),
35
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Switch Languages" })
36
- ] }) }),
37
- /* @__PURE__ */ jsx(DropdownMenuContent, { align: "end", children: locales.map((locale) => /* @__PURE__ */ jsx(Link, { locale, children: /* @__PURE__ */ jsx(DropdownMenuItem, { children: localeDisplay[locale] }) }, locale)) })
38
- ] });
39
- };
40
- }
41
-
42
- export { createI18nSelector };
@@ -1,106 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from 'react/jsx-runtime';
3
- import { useTranslator } from 'intor/react';
4
- import { UserCircle, ChevronsUpDown, PenLine } from 'lucide-react';
5
- import Link from 'next/link';
6
- import { PATHS } from '../../../../../../constants/paths/index.js';
7
- import '../../../../../../constants/redirect-paths.js';
8
- import 'mime-types';
9
- import { findTranslation } from '../../../../../../shared/translation/find-translation.js';
10
- import { joinUrl } from '../../../../../../shared/utils/join-url.js';
11
- import { Avatar, AvatarImage, AvatarFallback } from '../../../shadcn/avatar.js';
12
- import '../../../shadcn/badge.js';
13
- import '../../../shadcn/button.js';
14
- import 'react';
15
- import 'ua-parser-js';
16
- import 'clsx';
17
- import 'tailwind-merge';
18
- import 'next/navigation';
19
- import '@radix-ui/react-collapsible';
20
- import '@radix-ui/react-dialog';
21
- import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup, DropdownMenuItem } from '../../../shadcn/dropdown-menu.js';
22
- import '../../../shadcn/input-group.js';
23
- import '@radix-ui/react-label';
24
- import '@radix-ui/react-select';
25
- import '@radix-ui/react-separator';
26
- import { SidebarMenu, SidebarMenuItem, SidebarMenuButton } from '../../../shadcn/sidebar.js';
27
- import { Spinner } from '../../../shadcn/spinner.js';
28
- import '@radix-ui/react-tooltip';
29
- import { Button } from '../../buttons/button.js';
30
-
31
- function NavUser({
32
- storageUrl,
33
- admin,
34
- isLoading = false,
35
- SignOutButton
36
- }) {
37
- const { t, locale } = useTranslator();
38
- const { name } = findTranslation(admin?.translations, locale);
39
- if (isLoading)
40
- return /* @__PURE__ */ jsx(Button, { variant: "outline", size: "icon", disabled: true, className: "w-64", children: /* @__PURE__ */ jsx(Spinner, {}) });
41
- if (!admin)
42
- return /* @__PURE__ */ jsx(Button, { variant: "outline", size: "icon", disabled: true, className: "w-64", children: /* @__PURE__ */ jsx(UserCircle, { className: "size-4" }) });
43
- return /* @__PURE__ */ jsx(SidebarMenu, { className: "w-64", children: /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [
44
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
45
- SidebarMenuButton,
46
- {
47
- size: "lg",
48
- className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
49
- disabled: isLoading,
50
- children: [
51
- /* @__PURE__ */ jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [
52
- admin.avatarImage?.key && /* @__PURE__ */ jsx(
53
- AvatarImage,
54
- {
55
- src: joinUrl(storageUrl, admin.avatarImage?.key),
56
- alt: name ?? ""
57
- }
58
- ),
59
- /* @__PURE__ */ jsx(AvatarFallback, { className: "rounded-lg" })
60
- ] }),
61
- /* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
62
- /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: name }),
63
- /* @__PURE__ */ jsx("span", { className: "truncate text-xs", children: admin.email })
64
- ] }),
65
- /* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-auto size-4" })
66
- ]
67
- }
68
- ) }),
69
- /* @__PURE__ */ jsxs(
70
- DropdownMenuContent,
71
- {
72
- className: "w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",
73
- side: "bottom",
74
- align: "end",
75
- sideOffset: 4,
76
- children: [
77
- /* @__PURE__ */ jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
78
- /* @__PURE__ */ jsxs(Avatar, { className: "h-8 w-8 rounded-lg", children: [
79
- admin.avatarImage?.key && /* @__PURE__ */ jsx(
80
- AvatarImage,
81
- {
82
- src: joinUrl(storageUrl, admin.avatarImage?.key),
83
- alt: name ?? ""
84
- }
85
- ),
86
- /* @__PURE__ */ jsx(AvatarFallback, { className: "rounded-lg" })
87
- ] }),
88
- /* @__PURE__ */ jsxs("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
89
- /* @__PURE__ */ jsx("span", { className: "truncate font-medium", children: name }),
90
- /* @__PURE__ */ jsx("span", { className: "truncate text-xs", children: admin.email })
91
- ] })
92
- ] }) }),
93
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
94
- /* @__PURE__ */ jsx(DropdownMenuGroup, { children: /* @__PURE__ */ jsx(Link, { href: PATHS.auth.changePassword.path, children: /* @__PURE__ */ jsxs(DropdownMenuItem, { children: [
95
- /* @__PURE__ */ jsx(PenLine, {}),
96
- t("auth.change-password.text")
97
- ] }) }) }),
98
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
99
- SignOutButton
100
- ]
101
- }
102
- )
103
- ] }) }) });
104
- }
105
-
106
- export { NavUser };