@goodhood-web/nebenan-base 3.6.0-development.2 → 3.6.0-development.3

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 (36) hide show
  1. package/index.d.ts +5 -1
  2. package/index.js +116 -104
  3. package/index.mjs +25317 -17308
  4. package/lib/MultiImageCropper/MultiImageCropper.d.ts +3 -0
  5. package/lib/MultiImageCropper/MultiImageCropper.types.d.ts +14 -0
  6. package/lib/MultiImageCropper/components/ImageCropperPanel/ImageCropperPanel.d.ts +13 -0
  7. package/lib/MultiImageCropper/components/ImageThumbnailGrid/ImageThumbnailGrid.d.ts +12 -0
  8. package/lib/MultiImageCropper/hooks/useImageLoader.d.ts +5 -0
  9. package/lib/MultiImageCropper/util.d.ts +3 -0
  10. package/lib/RichTextArea/ImageUpload/ImageUpload.d.ts +7 -0
  11. package/lib/RichTextArea/ImagesPreview/ImagesPreview.d.ts +7 -0
  12. package/lib/RichTextArea/RichTextArea.d.ts +2 -0
  13. package/lib/RichTextArea/RichTextArea.types.d.ts +63 -0
  14. package/lib/RichTextArea/components/POI/POIPreview.d.ts +7 -0
  15. package/lib/RichTextArea/components/POI/POIRecommendation.d.ts +3 -0
  16. package/lib/RichTextArea/components/POI/POIRecommendation.types.d.ts +11 -0
  17. package/lib/RichTextArea/components/POI/components/SheetComponents/SheetComponents.d.ts +4 -0
  18. package/lib/RichTextArea/components/POI/components/SheetComponents/SheetComponents.types.d.ts +21 -0
  19. package/lib/RichTextArea/components/POI/components/Suggestions/Suggestions.d.ts +3 -0
  20. package/lib/RichTextArea/components/POI/components/Suggestions/Suggestions.types.d.ts +10 -0
  21. package/lib/RichTextArea/components/POI/network.d.ts +3 -0
  22. package/lib/RichTextArea/components/POI/useBusinessProfile.d.ts +5 -0
  23. package/lib/RichTextArea/components/POI/utils.d.ts +10 -0
  24. package/lib/RichTextArea/constants.d.ts +11 -0
  25. package/lib/RichTextArea/lexical/LexicalImagesPreview.d.ts +7 -0
  26. package/lib/RichTextArea/lexical/nodes/MentionNode.d.ts +29 -0
  27. package/lib/RichTextArea/lexical/plugins/CharacterLimitPlugin.d.ts +6 -0
  28. package/lib/RichTextArea/lexical/plugins/LinkPlugin.d.ts +1 -0
  29. package/lib/RichTextArea/lexical/plugins/MentionPlugin.d.ts +7 -0
  30. package/lib/RichTextArea/lexical/plugins/ValueConverterPlugin.d.ts +7 -0
  31. package/lib/RichTextArea/lexical/utils.d.ts +14 -0
  32. package/lib/RichTextArea/useImageUpload.d.ts +11 -0
  33. package/lib/RichTextArea/useUrlMetaData.d.ts +15 -0
  34. package/lib/RichTextArea/utils.d.ts +3 -0
  35. package/package.json +1 -1
  36. package/style.css +1 -1
@@ -0,0 +1,3 @@
1
+ import { MultiImageCropperProps } from './MultiImageCropper.types';
2
+ declare const MultiImageCropper: ({ aspectRatio, imageFiles, setImageFiles, setOpenCropper, translations: t, }: MultiImageCropperProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default MultiImageCropper;
@@ -0,0 +1,14 @@
1
+ import { ImageFile } from '../RichTextArea/RichTextArea.types';
2
+ export type MultiImageCropperProps = {
3
+ aspectRatio?: number;
4
+ imageFiles: ImageFile[];
5
+ setImageFiles: (imageFiles: ImageFile[]) => void;
6
+ setOpenCropper: (openCropper: boolean) => void;
7
+ translations?: {
8
+ close: string;
9
+ crop: string;
10
+ rotate: string;
11
+ title: string;
12
+ };
13
+ };
14
+ export type SelectedImageRef = React.MutableRefObject<ImageFile | null>;
@@ -0,0 +1,13 @@
1
+ import { CropperRef } from 'react-advanced-cropper';
2
+ import { MultiImageCropperProps } from '../../MultiImageCropper.types';
3
+ type ImageCropperPanelProps = {
4
+ aspectRatio: number;
5
+ cropperRef: React.RefObject<CropperRef>;
6
+ handleCrop: () => void;
7
+ handleReset: () => void;
8
+ imageSrc: string;
9
+ rotate: () => void;
10
+ t: Required<MultiImageCropperProps>['translations'];
11
+ };
12
+ declare const ImageCropperPanel: ({ aspectRatio, cropperRef, handleCrop, handleReset, imageSrc, rotate, t, }: ImageCropperPanelProps) => import("react/jsx-runtime").JSX.Element;
13
+ export default ImageCropperPanel;
@@ -0,0 +1,12 @@
1
+ import { ImageFile } from '../../../RichTextArea/RichTextArea.types';
2
+ type ImageThumbnailGridProps = {
3
+ handleDeleteImg: (id: string) => void;
4
+ imageFiles: ImageFile[];
5
+ loadImage: (file: File) => void;
6
+ selectedImg: ImageFile | null;
7
+ setImageFiles: (files: ImageFile[]) => void;
8
+ setSelectedImg: (file: ImageFile) => void;
9
+ uploadingImages?: Set<string>;
10
+ };
11
+ declare const ImageThumbnailGrid: ({ handleDeleteImg, imageFiles, loadImage, selectedImg, setImageFiles, setSelectedImg, uploadingImages, }: ImageThumbnailGridProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default ImageThumbnailGrid;
@@ -0,0 +1,5 @@
1
+ export declare const useImageLoader: () => {
2
+ imageSrc: string;
3
+ imgType: import('react').MutableRefObject<string>;
4
+ loadImage: (imageFile: File) => void;
5
+ };
@@ -0,0 +1,3 @@
1
+ import { ImageFile } from '../RichTextArea/RichTextArea.types';
2
+ export declare const getFilteredImageFiles: (files: ImageFile[], id: string) => ImageFile[];
3
+ export declare const getUpdatedImageFiles: (files: ImageFile[], id: string, updatedImage: ImageFile) => ImageFile[];
@@ -0,0 +1,7 @@
1
+ import { ImageFile } from '../RichTextArea.types';
2
+ type ImageUploadProps = {
3
+ imageFiles: ImageFile[];
4
+ setImageFiles: (files: ImageFile[]) => void;
5
+ };
6
+ declare const ImageUpload: ({ imageFiles, setImageFiles }: ImageUploadProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default ImageUpload;
@@ -0,0 +1,7 @@
1
+ import { ImageFile } from '../RichTextArea.types';
2
+ type ImagesPreviewProps = {
3
+ imageFiles: ImageFile[];
4
+ setImageFiles: (files: ImageFile[]) => void;
5
+ };
6
+ declare const ImagesPreview: ({ imageFiles, setImageFiles }: ImagesPreviewProps) => import("react/jsx-runtime").JSX.Element | null;
7
+ export default ImagesPreview;
@@ -0,0 +1,2 @@
1
+ import { RichTextAreaProps } from './RichTextArea.types';
2
+ export default function RichTextArea({ ariaDescribedby, attachment, charLimit, colorScheme, disabled, errorText, hintText, hoodId, label, onBlur, onChange, onFocus, onImageClick, onPoiClick, onPoiDismiss, reachedHoodIds, showInputHints, size, value, }: RichTextAreaProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,63 @@
1
+ import { FocusEvent } from 'react';
2
+ export type AttachmentType = 'image' | 'poi';
3
+ export type AttachmentConfig = {
4
+ ariaLabel: string;
5
+ onClick?: () => void;
6
+ type: AttachmentType;
7
+ };
8
+ export type RichTextAreaProps = {
9
+ ariaDescribedby?: string;
10
+ attachment?: AttachmentConfig[];
11
+ charLimit?: number;
12
+ colorScheme?: 'outline' | 'filled';
13
+ disabled?: boolean;
14
+ errorText?: string;
15
+ hintText?: string;
16
+ hoodId?: number;
17
+ id?: string;
18
+ label?: string;
19
+ name?: string;
20
+ onBlur?: (event: FocusEvent<HTMLDivElement>) => void;
21
+ onChange: (value: RichTextAreaValueType) => void;
22
+ onFocus?: (event: FocusEvent<HTMLDivElement>) => void;
23
+ onImageClick?: () => void;
24
+ onPoiClick?: boolean;
25
+ onPoiDismiss?: () => void;
26
+ reachedHoodIds?: number[];
27
+ showInputHints?: boolean;
28
+ size?: 'medium' | 'large';
29
+ value: RichTextAreaValueType;
30
+ };
31
+ export type CoreV3Embed = {
32
+ gid: string;
33
+ indices?: number[] | null;
34
+ role: 'mention' | 'link' | 'profile';
35
+ };
36
+ export type CoreV3EmbedWithDetails = CoreV3Embed & {
37
+ cta_url?: string;
38
+ description?: string | null;
39
+ image_url?: string | null;
40
+ recommendations_count?: number;
41
+ title?: string;
42
+ };
43
+ export type EmbeddableType = CoreV3Embed | CoreV3EmbedWithDetails;
44
+ export type ContentEmbeddable = CoreV3Embed | CoreV3EmbedWithDetails;
45
+ export type RichTextAreaValueType = {
46
+ attachments?: {
47
+ images?: ImageFile[];
48
+ };
49
+ body: string;
50
+ embeddables: EmbeddableType[] | [];
51
+ };
52
+ export type ImageFile = {
53
+ croppedImg: File;
54
+ id: string;
55
+ originalImg: File;
56
+ signedId?: string;
57
+ };
58
+ export type CoreV3PostInput = {
59
+ body: string;
60
+ embeds?: CoreV3Embed[] | null;
61
+ images?: string[] | null;
62
+ };
63
+ export declare const toCoreV3Format: (value: RichTextAreaValueType) => CoreV3PostInput;
@@ -0,0 +1,7 @@
1
+ import { CoreV3Embed } from '../../RichTextArea.types';
2
+ interface POIPreviewProps {
3
+ embed: CoreV3Embed;
4
+ onDelete: () => void;
5
+ }
6
+ export declare const POIPreview: ({ embed, onDelete }: POIPreviewProps) => import("react/jsx-runtime").JSX.Element | null;
7
+ export {};
@@ -0,0 +1,3 @@
1
+ import { POIRecommendationProps } from './POIRecommendation.types';
2
+ declare const POIRecommendation: ({ onDismiss, onSelect, openSheet, value, }: POIRecommendationProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default POIRecommendation;
@@ -0,0 +1,11 @@
1
+ import { RichTextAreaValueType } from '../../RichTextArea.types';
2
+ export type POIRecommendationProps = {
3
+ onDismiss: () => void;
4
+ onSelect: (value: RichTextAreaValueType) => void;
5
+ openSheet: boolean;
6
+ value: RichTextAreaValueType;
7
+ };
8
+ export type POICategory = {
9
+ key: string;
10
+ label: string;
11
+ };
@@ -0,0 +1,4 @@
1
+ import { ContentProps, FooterProps, HeaderProps } from './SheetComponents.types';
2
+ export declare const Footer: ({ onDismiss }: FooterProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ export declare const Header: ({ onDismiss, setQuery }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
4
+ export declare const Content: ({ onChange, pois, query, setPois, setQuery, value, }: ContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { Poi } from '../../../../../../../../api/src/lib/core_v2';
3
+ import { RichTextAreaValueType } from '../../../../RichTextArea.types';
4
+ export type HeaderProps = {
5
+ onDismiss: () => void;
6
+ setQuery: Dispatch<SetStateAction<string>>;
7
+ };
8
+ export type FooterProps = {
9
+ onDismiss: () => void;
10
+ };
11
+ export type ContentProps = {
12
+ onChange: (value: RichTextAreaValueType) => void;
13
+ pois: Poi[] | null;
14
+ query: string;
15
+ setPois: Dispatch<SetStateAction<Poi[] | null>>;
16
+ setQuery: Dispatch<SetStateAction<string>>;
17
+ value: RichTextAreaValueType;
18
+ };
19
+ export type SearchInputProps = {
20
+ setQuery: Dispatch<SetStateAction<string>>;
21
+ };
@@ -0,0 +1,3 @@
1
+ import { SuggestionsProps } from './Suggestions.types';
2
+ declare const POISuggestions: ({ onChange, pois, value }: SuggestionsProps) => import("react/jsx-runtime").JSX.Element | null;
3
+ export default POISuggestions;
@@ -0,0 +1,10 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ import { Poi } from '../../../../../../../../api/src/lib/core_v2';
3
+ import { RichTextAreaValueType } from '../../../../RichTextArea.types';
4
+ export type SuggestionsProps = {
5
+ onChange: (value: RichTextAreaValueType) => void;
6
+ pois: Poi[] | null;
7
+ query: string;
8
+ setPois: Dispatch<SetStateAction<Poi[] | null>>;
9
+ value: RichTextAreaValueType;
10
+ };
@@ -0,0 +1,3 @@
1
+ export declare const fetchBusinessProfile: (id: number) => Promise<import('../../../../../../api/src/lib/types/newsFeeds').LinkedBusinessProfile>;
2
+ export declare const fetchProfile: () => Promise<import('../../../../../../api/src/lib/core_v2').ProfileResponse>;
3
+ export declare const fetchPOIs: (searchQuery: string) => Promise<import('../../../../../../api/src/lib/core_v2').Poi[]>;
@@ -0,0 +1,5 @@
1
+ import { LinkedBusinessProfile } from '../../../../../../api/src/lib/types/newsFeeds';
2
+ export declare const useBusinessProfiles: (id: number) => {
3
+ poi: LinkedBusinessProfile | null;
4
+ poiError: string | null;
5
+ };
@@ -0,0 +1,10 @@
1
+ import { Poi } from '../../../../../../api/src/lib/core_v2';
2
+ import { ProfileResponse } from '../../../../../../api/src/lib/core_v2/types';
3
+ import { LinkedBusinessProfile } from '../../../../../../api/src/lib/types/newsFeeds';
4
+ import { POICategory } from './POIRecommendation.types';
5
+ export declare const formatAddressFull: (item: Poi | LinkedBusinessProfile, joiner?: string) => string;
6
+ export declare const getLikedProp: (object_type: string) => "recommends_unclaimed_profile_ids" | "recommends_organization_profile_ids" | "recommends_business_profile_ids" | undefined;
7
+ export declare const hasLiked: (profile: ProfileResponse, poi: Poi) => boolean;
8
+ export declare const getItemCategoryLabel: (categories_labels?: POICategory[], subcategories_labels?: POICategory[]) => string | null;
9
+ export declare const getPoiPlaceholderIconName: (type: string) => "business" | "special_place" | "organisation";
10
+ export declare const generateBadgeType: (badges: string[]) => "commercial_supporter" | "organization_supporter";
@@ -0,0 +1,11 @@
1
+ export declare const POI_CATEGORY_ORGANIZATION = "org";
2
+ export declare const POI_CATEGORY_BUSINESS = "biz";
3
+ export declare const BADGE_ORGANIZATION_SPONSOR = "organization_supporter";
4
+ export declare const BADGE_COMMERCIAL_SPONSOR = "commercial_supporter";
5
+ export declare const DISPLAY_ADDRESS_ORDER = "street,house_number,zip_code,city";
6
+ export declare const POI_TYPE_UNCLAIMED = "unclaimed_profile";
7
+ export declare const POI_TYPE_ORGANIZATION = "organization_profile";
8
+ export declare const POI_TYPE_BUSINESS = "business_profile";
9
+ export declare const POI_SUBCATEGORY_ORGANIZATION_OTHER = "other";
10
+ export declare const POI_SUBCATEGORY_BUSINESS_OTHER = "other";
11
+ export declare const POI_SUBCATEGORY_SPECIAL_OTHER = "other";
@@ -0,0 +1,7 @@
1
+ import { ImageFile } from '../RichTextArea.types';
2
+ type LexicalImagesPreviewProps = {
3
+ imageFiles: ImageFile[];
4
+ setImageFiles: (files: ImageFile[]) => void;
5
+ };
6
+ declare const LexicalImagesPreview: ({ imageFiles, setImageFiles, }: LexicalImagesPreviewProps) => import("react/jsx-runtime").JSX.Element | null;
7
+ export default LexicalImagesPreview;
@@ -0,0 +1,29 @@
1
+ import { DOMConversionMap, DOMExportOutput, DecoratorNode, EditorConfig, LexicalEditor, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical';
2
+ export type SerializedMentionNode = Spread<{
3
+ gid: string;
4
+ mentionName: string;
5
+ userId: number;
6
+ }, SerializedLexicalNode>;
7
+ export declare class MentionNode extends DecoratorNode<JSX.Element> {
8
+ __mention: string;
9
+ __userId: number;
10
+ __gid: string;
11
+ static getType(): string;
12
+ static clone(node: MentionNode): MentionNode;
13
+ static importJSON(serializedNode: SerializedMentionNode): MentionNode;
14
+ constructor(config: {
15
+ gid: string;
16
+ mentionName: string;
17
+ userId: number;
18
+ }, key?: NodeKey);
19
+ exportJSON(): SerializedMentionNode;
20
+ createDOM(config: EditorConfig): HTMLElement;
21
+ updateDOM(): false;
22
+ exportDOM(): DOMExportOutput;
23
+ static importDOM(): DOMConversionMap | null;
24
+ getTextContent(): string;
25
+ decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element;
26
+ static isInline(): boolean;
27
+ }
28
+ export declare function $createMentionNode(mentionName: string, userId: number, gid: string): MentionNode;
29
+ export declare function $isMentionNode(node: LexicalNode | null | undefined): node is MentionNode;
@@ -0,0 +1,6 @@
1
+ interface CharacterLimitPluginProps {
2
+ limit?: number;
3
+ onCharacterCountChange?: (count: number) => void;
4
+ }
5
+ export declare function CharacterLimitPlugin({ limit, onCharacterCountChange, }: CharacterLimitPluginProps): import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -0,0 +1 @@
1
+ export declare function LinkPlugin(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ interface MentionPluginProps {
2
+ anchorRef: React.RefObject<HTMLElement>;
3
+ hoodId: number;
4
+ reachedHoodIds: number[];
5
+ }
6
+ export declare function MentionPlugin({ anchorRef, hoodId, reachedHoodIds }: MentionPluginProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { RichTextAreaValueType } from '../../RichTextArea.types';
2
+ interface ValueConverterPluginProps {
3
+ onChange: (value: RichTextAreaValueType) => void;
4
+ value: RichTextAreaValueType;
5
+ }
6
+ export declare function ValueConverterPlugin({ onChange, value }: ValueConverterPluginProps): null;
7
+ export {};
@@ -0,0 +1,14 @@
1
+ import { NeighbourResponse } from '../../../../../api/src/lib/core_v2';
2
+ declare global {
3
+ interface Window {
4
+ __STORYBOOK_MOCK_USERS__?: NeighbourResponse[];
5
+ }
6
+ }
7
+ /**
8
+ * Generate a unique GID for a mention
9
+ */
10
+ export declare function generateGID(userId: number): string;
11
+ /**
12
+ * Fetch neighbours for mention suggestions
13
+ */
14
+ export declare function fetchNeighbours(reachedHoodIds: number[], hoodId: number, query: string): Promise<NeighbourResponse[]>;
@@ -0,0 +1,11 @@
1
+ interface UploadResult {
2
+ signedId: string;
3
+ url: string;
4
+ }
5
+ interface UseImageUploadReturn {
6
+ error: string | null;
7
+ isUploading: boolean;
8
+ uploadImage: (file: File) => Promise<UploadResult | null>;
9
+ }
10
+ export declare const useImageUpload: () => UseImageUploadReturn;
11
+ export {};
@@ -0,0 +1,15 @@
1
+ import { components } from '../../../../api/src/lib/core/generated_types';
2
+ type CoreV3EmbedDetails = components['schemas']['Core_V3_EmbedDetails'];
3
+ type MetaStatus = 'pending' | 'success' | 'error';
4
+ interface MetaCacheEntry {
5
+ data?: CoreV3EmbedDetails;
6
+ error?: unknown;
7
+ status: MetaStatus;
8
+ }
9
+ export declare const useUrlMetaData: () => {
10
+ clearMeta: () => void;
11
+ fetchLinkMetadata: (url: string) => Promise<MetaCacheEntry | null>;
12
+ meta: MetaCacheEntry | null;
13
+ removeMetadata: (url: string) => void;
14
+ };
15
+ export {};
@@ -0,0 +1,3 @@
1
+ import { NeighbourResponse } from '../../../../api/src/lib/core_v2';
2
+ export declare const isShadowUser: (user: NeighbourResponse) => boolean;
3
+ export declare const getShortName: (user: NeighbourResponse) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodhood-web/nebenan-base",
3
- "version": "3.6.0-development.2",
3
+ "version": "3.6.0-development.3",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "repository": "https://github.com/good-hood-gmbh/goodhood-web",