@myunisoft/design-system 1.3.1-REV-157 → 1.3.1-rev157-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Autocomplete/Autocomplete/example-usage.d.ts +4 -0
- package/dist/components/DocumentComposer/hooks/useDragVisualFeedback.d.ts +1 -1
- package/dist/components/DocumentComposer/types/props.d.ts +6 -2
- package/dist/components/DocumentComposer/types.d.ts +56 -0
- package/dist/index.js +2 -2
- package/package.json +115 -121
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const BasicExample: () => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const CustomOptionExample: () => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const ProductExample: () => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export { BasicExample, CustomOptionExample, ProductExample };
|
|
@@ -3,7 +3,7 @@ import type { DocumentSection } from '../types';
|
|
|
3
3
|
type UseDragVisualFeedbackParams = {
|
|
4
4
|
containerRef: RefObject<HTMLDivElement | null>;
|
|
5
5
|
getSectionById: (sectionId: string) => DocumentSection | null;
|
|
6
|
-
isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection | null) => boolean;
|
|
6
|
+
isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection | null, newIndex: number, isNesting: boolean) => boolean;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
9
|
* Provides visual feedback during drag-and-drop by graying out invalid drop targets.
|
|
@@ -42,9 +42,13 @@ export type DocumentComposerCustomProps = {
|
|
|
42
42
|
renderSectionIcon?: (section: DocumentSection) => ReactNode;
|
|
43
43
|
/**
|
|
44
44
|
* Determines valid drop targets during drag. Invalid targets are greyed out.
|
|
45
|
-
* `targetSection` is `null` when dropping at root level.
|
|
45
|
+
* `targetSection` is `null` when dropping at root level.
|
|
46
|
+
* `newIndex` is the position where the item would be inserted in the target's children.
|
|
47
|
+
* `isNesting` is `true` when the section is being moved to a new parent (dropped "on" a section),
|
|
48
|
+
* `false` when reordering within the same parent.
|
|
49
|
+
* Defaults to `() => true`.
|
|
46
50
|
*/
|
|
47
|
-
isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection | null) => boolean;
|
|
51
|
+
isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection | null, newIndex: number, isNesting: boolean) => boolean;
|
|
48
52
|
sectionContent?: SectionContent;
|
|
49
53
|
isLoadingSectionContent?: boolean;
|
|
50
54
|
selectedSectionId?: string | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ItemPositionParams } from './Treeview/types';
|
|
2
|
+
export type DocumentSection = {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
visible: boolean;
|
|
6
|
+
parentId: string | null;
|
|
7
|
+
sections?: DocumentSection[] | null;
|
|
8
|
+
};
|
|
9
|
+
export type DocumentComposerLabels = {
|
|
10
|
+
/** Label for the "Create section" button */
|
|
11
|
+
createSection?: string;
|
|
12
|
+
/** Label for the "Rename" menu item */
|
|
13
|
+
rename?: string;
|
|
14
|
+
/** Label for the "Delete" menu item */
|
|
15
|
+
delete?: string;
|
|
16
|
+
/** Label for the "Create subsection" menu item */
|
|
17
|
+
createSubsection?: string;
|
|
18
|
+
/** Tooltip for hidden item */
|
|
19
|
+
hiddenItemTooltip?: string;
|
|
20
|
+
};
|
|
21
|
+
export type DocumentComposerCustomProps = {
|
|
22
|
+
/** Content displayed when there are no sections */
|
|
23
|
+
noSectionsPlaceholder?: string | React.ReactNode;
|
|
24
|
+
/** Show a loading state that prevents rendering the sections */
|
|
25
|
+
isLoading?: boolean;
|
|
26
|
+
/** Returns whether section title can be edited (double-click + "Renommer" menu). Defaults to `() => true`. */
|
|
27
|
+
getSectionTitleChangePermission?: (section: DocumentSection) => boolean;
|
|
28
|
+
/** Returns whether section can be deleted ("Supprimer" menu). Defaults to `() => true`. */
|
|
29
|
+
getSectionDeletePermission?: (section: DocumentSection) => boolean;
|
|
30
|
+
/** Returns whether section can be reordered via drag & drop. Defaults to `() => true`. */
|
|
31
|
+
getSectionOrderChangePermission?: (section: DocumentSection) => boolean;
|
|
32
|
+
/** Returns whether a section can be created under this section. Defaults to `() => true`. */
|
|
33
|
+
getSectionCreatePermission?: (section: DocumentSection) => boolean;
|
|
34
|
+
/** Returns whether section visibility can be toggled. Defaults to `() => true`. */
|
|
35
|
+
getSectionVisibilityChangePermission?: (section: DocumentSection) => boolean;
|
|
36
|
+
/** Tooltip text displayed when hovering a hidden section label (visible: false) */
|
|
37
|
+
hiddenSectionTooltip?: string;
|
|
38
|
+
/** Tooltip text displayed when hovering the visibility icon of a visible section */
|
|
39
|
+
visibleIconTooltip?: string;
|
|
40
|
+
/** Tooltip text displayed when hovering the visibility icon of a hidden section */
|
|
41
|
+
hiddenIconTooltip?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Determines if `targetSection` is a valid drop location for `draggedSection`.
|
|
44
|
+
* When provided, invalid targets are visually greyed out during drag.
|
|
45
|
+
* Defaults to () => true (all targets valid).
|
|
46
|
+
* @param targetSection - The parent section where the item would be dropped, or `null` if dropping at root level.
|
|
47
|
+
*/
|
|
48
|
+
isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection | null) => boolean;
|
|
49
|
+
};
|
|
50
|
+
export type DocumentComposerCallbacks = {
|
|
51
|
+
onSectionOrderChange?: (params: ItemPositionParams) => void;
|
|
52
|
+
onSectionTitleChange?: (sectionId: string, newTitle: string) => void;
|
|
53
|
+
onSectionDelete?: (sectionId: string) => void;
|
|
54
|
+
onSectionVisibilityChange?: (sectionId: string, visible: boolean) => void;
|
|
55
|
+
onSectionCreate?: (parentId: string | null, title: string) => string | Promise<string>;
|
|
56
|
+
};
|