@edifice.io/react 2.5.4 → 2.5.5-develop-b2school.20251218111717
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/AppIcon/index.d.ts +1 -0
- package/dist/components/Divider/Divider.d.ts +38 -0
- package/dist/components/Divider/Divider.js +11 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Flex/Flex.js +1 -1
- package/dist/components/Menu/components/MenuButton.d.ts +2 -0
- package/dist/components/Menu/components/MenuButton.js +13 -4
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +59 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +21 -0
- package/dist/components/SegmentedControl/index.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +6 -2
- package/dist/components/Select/Select.js +10 -4
- package/dist/components/index.d.ts +2 -0
- package/dist/editor.js +40 -36
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useInfiniteScroll/index.d.ts +1 -0
- package/dist/hooks/useInfiniteScroll/useInfiniteScroll.d.ts +33 -0
- package/dist/hooks/useInfiniteScroll/useInfiniteScroll.js +20 -0
- package/dist/icons.js +300 -294
- package/dist/index.js +180 -170
- package/dist/modals.js +8 -6
- package/dist/modules/comments/components/Comment.js +4 -2
- package/dist/modules/comments/components/CommentList.js +1 -1
- package/dist/modules/comments/components/DeleteModal.js +14 -8
- package/dist/modules/editor/components/Editor/EditorPreview.d.ts +14 -0
- package/dist/modules/editor/components/Editor/EditorPreview.js +56 -0
- package/dist/modules/editor/components/Editor/EditorPreviewSkeleton.d.ts +8 -0
- package/dist/modules/editor/components/Editor/EditorPreviewSkeleton.js +24 -0
- package/dist/modules/editor/components/Editor/index.d.ts +2 -0
- package/dist/modules/editor/components/Renderer/MediaRenderer.js +2 -2
- package/dist/modules/editor/hooks/useResizeMedia.js +3 -3
- package/dist/modules/icons/components/IconClockAlert.d.ts +7 -0
- package/dist/modules/icons/components/IconClockAlert.js +17 -0
- package/dist/modules/icons/components/IconThumbDown.d.ts +7 -0
- package/dist/modules/icons/components/IconThumbDown.js +12 -0
- package/dist/modules/icons/components/IconThumbUp.d.ts +7 -0
- package/dist/modules/icons/components/IconThumbUp.js +12 -0
- package/dist/modules/icons/components/index.d.ts +3 -0
- package/dist/modules/modals/ShareModal/ShareBookmark.d.ts +1 -1
- package/dist/modules/modals/ShareModal/ShareBookmark.js +5 -2
- package/dist/modules/modals/ShareModal/ShareModal.d.ts +1 -11
- package/dist/modules/modals/ShareModal/ShareModal.js +13 -105
- package/dist/modules/modals/ShareModal/ShareResources.d.ts +174 -0
- package/dist/modules/modals/ShareModal/ShareResources.js +137 -0
- package/dist/modules/modals/ShareModal/hooks/useSearch.d.ts +2 -1
- package/dist/modules/modals/ShareModal/hooks/useSearch.js +3 -2
- package/dist/modules/modals/ShareModal/hooks/useShare.d.ts +12 -5
- package/dist/modules/modals/ShareModal/hooks/useShare.js +20 -13
- package/dist/modules/modals/ShareModal/hooks/useShareBookmark.d.ts +1 -1
- package/dist/modules/modals/ShareModal/hooks/useShareBookmark.js +1 -1
- package/dist/modules/modals/ShareModal/index.d.ts +3 -1
- package/dist/modules/multimedia/FileCard/FileCard.js +1 -1
- package/dist/modules/multimedia/FileCard/FileIcon.js +1 -1
- package/dist/modules/multimedia/Linker/InternalLinker/InternalLinker.js +4 -1
- package/dist/style.css +1 -1
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/react-query/index.d.ts +1 -0
- package/dist/utilities/react-query/react-query-utils.d.ts +21 -0
- package/dist/utilities/react-query/react-query-utils.js +13 -0
- package/package.json +6 -6
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A divider component that renders a horizontal or vertical line to separate content.
|
|
4
|
+
*
|
|
5
|
+
* @param props - The component props
|
|
6
|
+
* @param props.children - Content to be displayed inside the divider
|
|
7
|
+
* @param props.vertical - Whether the divider is vertical. Defaults to false
|
|
8
|
+
* @param props.className - Optional CSS class name for additional styling of the divider
|
|
9
|
+
* @default 'border-gray-500'
|
|
10
|
+
* @param props.style - Optional inline styles for the divider
|
|
11
|
+
*
|
|
12
|
+
* @returns A React component that renders a divider with the specified properties
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* // Basic horizontal divider
|
|
17
|
+
* <Divider />
|
|
18
|
+
*
|
|
19
|
+
* // Divider with text content
|
|
20
|
+
* <Divider>Section Title</Divider>
|
|
21
|
+
*
|
|
22
|
+
* // Vertical divider
|
|
23
|
+
* <Divider vertical />
|
|
24
|
+
*
|
|
25
|
+
* // Custom colored divider
|
|
26
|
+
* <Divider className="border-red-500" />
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare const Divider: {
|
|
30
|
+
({ children, vertical, className, style, }: {
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
vertical?: boolean;
|
|
33
|
+
className?: string;
|
|
34
|
+
style?: React.CSSProperties;
|
|
35
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
displayName: string;
|
|
37
|
+
};
|
|
38
|
+
export default Divider;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Divider as Divider$1 } from "antd";
|
|
3
|
+
const Divider = ({
|
|
4
|
+
children,
|
|
5
|
+
vertical = !1,
|
|
6
|
+
className = "border-gray-500",
|
|
7
|
+
style
|
|
8
|
+
}) => /* @__PURE__ */ jsx(Divider$1, { plain: !0, children, type: vertical ? "vertical" : "horizontal", className, orientation: "center", style });
|
|
9
|
+
export {
|
|
10
|
+
Divider as default
|
|
11
|
+
};
|
|
@@ -13,7 +13,7 @@ const Flex = /* @__PURE__ */ forwardRef(({
|
|
|
13
13
|
children,
|
|
14
14
|
...restProps
|
|
15
15
|
}, ref) => {
|
|
16
|
-
const classes = clsx("d-flex", direction && `flex-${direction}`, fill && "flex-fill", align && `align-items-${align}`, justify && `justify-content-${justify}`, gap && `gap-${gap}`, wrap && `flex-${wrap}`, className);
|
|
16
|
+
const classes = clsx("d-flex", direction && `flex-${direction}`, fill && "flex-fill", align && `align-items-${align}`, justify && `justify-content-${justify}`, gap && `gap-${gap}`, wrap && `flex-${wrap === "reverse" ? "wrap-reverse" : wrap}`, className);
|
|
17
17
|
return /* @__PURE__ */ jsx(Component, { ref, className: classes, ...restProps, children });
|
|
18
18
|
});
|
|
19
19
|
export {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ButtonProps } from '../../Button';
|
|
2
2
|
export type MenuButtonProps = Pick<ButtonProps, 'children' | 'leftIcon' | 'rightIcon' | 'onClick'> & {
|
|
3
3
|
selected: boolean;
|
|
4
|
+
className?: string;
|
|
5
|
+
size?: 'md' | 'lg';
|
|
4
6
|
};
|
|
5
7
|
export declare const MenuButton: (props: Partial<MenuButtonProps>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,13 +8,22 @@ const MenuButton = (props) => {
|
|
|
8
8
|
leftIcon,
|
|
9
9
|
rightIcon,
|
|
10
10
|
onClick,
|
|
11
|
-
children
|
|
11
|
+
children,
|
|
12
|
+
className,
|
|
13
|
+
size
|
|
12
14
|
} = props, {
|
|
13
15
|
childProps
|
|
14
16
|
} = useMenuContext();
|
|
15
|
-
return /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", className: clsx("stack w-100", {
|
|
16
|
-
selected
|
|
17
|
-
|
|
17
|
+
return /* @__PURE__ */ jsx(Button, { variant: "ghost", color: "tertiary", className: clsx("stack w-100 overflow-hidden", {
|
|
18
|
+
selected,
|
|
19
|
+
"menu-button-lg": size === "lg"
|
|
20
|
+
}, className), leftIcon, rightIcon, onClick, ...childProps, style: size === "lg" ? {
|
|
21
|
+
height: "auto"
|
|
22
|
+
} : void 0, children: /* @__PURE__ */ jsx("div", { className: clsx("text-truncate w-100", {
|
|
23
|
+
"text-truncate-2 text-start ms-0": size === "lg"
|
|
24
|
+
}), style: {
|
|
25
|
+
overflowWrap: "break-word"
|
|
26
|
+
}, children }) });
|
|
18
27
|
};
|
|
19
28
|
export {
|
|
20
29
|
MenuButton
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple option for SegmentedControl
|
|
3
|
+
*/
|
|
4
|
+
export interface SegmentedOption {
|
|
5
|
+
/**
|
|
6
|
+
* Option label
|
|
7
|
+
*/
|
|
8
|
+
label: string;
|
|
9
|
+
/**
|
|
10
|
+
* Option value
|
|
11
|
+
*/
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* SegmentedControl component props
|
|
16
|
+
*
|
|
17
|
+
* Minimal interface that only exposes what is necessary.
|
|
18
|
+
* Ant Design implementation is hidden and no Ant Design-specific props are exposed.
|
|
19
|
+
* Standard HTML div attributes are supported (passed through to the underlying DOM element).
|
|
20
|
+
*/
|
|
21
|
+
export interface SegmentedControlProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {
|
|
22
|
+
/**
|
|
23
|
+
* Segmented control options
|
|
24
|
+
*/
|
|
25
|
+
options: SegmentedOption[];
|
|
26
|
+
/**
|
|
27
|
+
* Selected value
|
|
28
|
+
*/
|
|
29
|
+
value?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Callback called when value changes
|
|
32
|
+
*/
|
|
33
|
+
onChange?: (value: string) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* SegmentedControl component
|
|
37
|
+
*
|
|
38
|
+
* Segmented control component for selecting between multiple options.
|
|
39
|
+
*
|
|
40
|
+
* **Note:** This component uses Ant Design's Segmented component internally.
|
|
41
|
+
* Only the props defined in SegmentedControlProps are allowed to prevent
|
|
42
|
+
* dependency on Ant Design-specific features. To replace the implementation,
|
|
43
|
+
* modify the component body below.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <SegmentedControl
|
|
48
|
+
* options={[
|
|
49
|
+
* { label: 'List', value: 'list' },
|
|
50
|
+
* { label: 'Kanban', value: 'kanban' },
|
|
51
|
+
* { label: 'Table', value: 'table' }
|
|
52
|
+
* ]}
|
|
53
|
+
* value={value}
|
|
54
|
+
* onChange={(val) => setValue(val)}
|
|
55
|
+
* />
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
declare const SegmentedControl: import('react').ForwardRefExoticComponent<SegmentedControlProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
59
|
+
export default SegmentedControl;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { Segmented } from "antd";
|
|
4
|
+
const SegmentedControl = /* @__PURE__ */ forwardRef(({
|
|
5
|
+
options,
|
|
6
|
+
value,
|
|
7
|
+
onChange,
|
|
8
|
+
...htmlProps
|
|
9
|
+
}, ref) => {
|
|
10
|
+
const antProps = {
|
|
11
|
+
options,
|
|
12
|
+
value,
|
|
13
|
+
onChange,
|
|
14
|
+
ref,
|
|
15
|
+
...htmlProps
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsx(Segmented, { ...antProps });
|
|
18
|
+
});
|
|
19
|
+
export {
|
|
20
|
+
SegmentedControl as default
|
|
21
|
+
};
|
|
@@ -14,7 +14,7 @@ export interface OptionsType {
|
|
|
14
14
|
*/
|
|
15
15
|
icon?: JSX.Element;
|
|
16
16
|
}
|
|
17
|
-
export interface SelectProps extends Omit<DropdownProps, 'children'>, Omit<DropdownTriggerProps, 'badgeContent'> {
|
|
17
|
+
export interface SelectProps extends Omit<DropdownProps, 'children'>, Omit<DropdownTriggerProps, 'badgeContent' | 'defaultValue'> {
|
|
18
18
|
/**
|
|
19
19
|
* Controlled value
|
|
20
20
|
*/
|
|
@@ -31,13 +31,17 @@ export interface SelectProps extends Omit<DropdownProps, 'children'>, Omit<Dropd
|
|
|
31
31
|
* Callback to get value
|
|
32
32
|
*/
|
|
33
33
|
onValueChange?: (option: OptionsType | string) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Default value
|
|
36
|
+
*/
|
|
37
|
+
defaultValue?: string;
|
|
34
38
|
}
|
|
35
39
|
/**
|
|
36
40
|
*
|
|
37
41
|
* Select component is based on Dropdown Component. It extends `Dropdown` and `Dropdown.Trigger` props `block`, `overflow`, `icon`, `variant`, `size`, `disabled`
|
|
38
42
|
*/
|
|
39
43
|
declare const Select: {
|
|
40
|
-
({ selectedValue, icon, options, overflow, block, variant, size, disabled, placeholderOption, onValueChange, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
({ selectedValue, icon, options, overflow, block, variant, size, disabled, placeholderOption, onValueChange, defaultValue, }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
41
45
|
displayName: string;
|
|
42
46
|
};
|
|
43
47
|
export default Select;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from "react";
|
|
3
3
|
import { useTranslation } from "react-i18next";
|
|
4
|
-
import SelectTrigger from "./SelectTrigger.js";
|
|
5
4
|
import Dropdown from "../Dropdown/Dropdown.js";
|
|
5
|
+
import SelectTrigger from "./SelectTrigger.js";
|
|
6
6
|
const Select = ({
|
|
7
7
|
selectedValue,
|
|
8
8
|
icon,
|
|
@@ -13,7 +13,8 @@ const Select = ({
|
|
|
13
13
|
size,
|
|
14
14
|
disabled,
|
|
15
15
|
placeholderOption,
|
|
16
|
-
onValueChange
|
|
16
|
+
onValueChange,
|
|
17
|
+
defaultValue
|
|
17
18
|
}) => {
|
|
18
19
|
const [localValue, setLocalValue] = useState(), {
|
|
19
20
|
t
|
|
@@ -25,10 +26,15 @@ const Select = ({
|
|
|
25
26
|
const value = typeof localValue == "object" ? localValue.value : localValue;
|
|
26
27
|
onValueChange == null || onValueChange(value);
|
|
27
28
|
}
|
|
28
|
-
}, [localValue])
|
|
29
|
+
}, [localValue]), useEffect(() => {
|
|
30
|
+
if (defaultValue) {
|
|
31
|
+
const foundOption = options.find((option) => (typeof option == "object" ? option.value : option) === defaultValue);
|
|
32
|
+
foundOption !== void 0 && setLocalValue(foundOption);
|
|
33
|
+
}
|
|
34
|
+
}, []);
|
|
29
35
|
const label = typeof localValue == "object" ? localValue.label : localValue, iconChange = typeof localValue == "object" ? localValue.icon : void 0;
|
|
30
36
|
return /* @__PURE__ */ jsxs(Dropdown, { overflow, block, children: [
|
|
31
|
-
/* @__PURE__ */ jsx(SelectTrigger, { icon: iconChange || icon, label: t(label || placeholderOption), variant, size, disabled }),
|
|
37
|
+
/* @__PURE__ */ jsx(SelectTrigger, { icon: iconChange || icon, label: /* @__PURE__ */ jsx("span", { className: "text-truncate", children: t(label || placeholderOption) }), variant, size, disabled }),
|
|
32
38
|
/* @__PURE__ */ jsx(Dropdown.Menu, { role: "listbox", children: options == null ? void 0 : options.map((option) => {
|
|
33
39
|
const value = typeof option == "object" ? option.value : option, label2 = typeof option == "object" ? option.label : option, icon2 = typeof option == "object" ? option.icon : void 0;
|
|
34
40
|
return /* @__PURE__ */ jsx(Dropdown.Item, { type: "action", onClick: () => setLocalValue(option), icon: icon2, children: label2 }, value);
|
|
@@ -12,6 +12,7 @@ export * from './Card';
|
|
|
12
12
|
export * from './Checkbox';
|
|
13
13
|
export * from './ColorPicker';
|
|
14
14
|
export * from './Combobox';
|
|
15
|
+
export * from './Divider';
|
|
15
16
|
export * from './Dropdown';
|
|
16
17
|
export * from './Dropzone';
|
|
17
18
|
export * from './EmptyScreen';
|
|
@@ -34,6 +35,7 @@ export * from './PreventPropagation';
|
|
|
34
35
|
export * from './Radio';
|
|
35
36
|
export * from './RadioCard';
|
|
36
37
|
export * from './SearchBar';
|
|
38
|
+
export * from './SegmentedControl';
|
|
37
39
|
export * from './Select';
|
|
38
40
|
export * from './Skeleton';
|
|
39
41
|
export * from './StackedGroup';
|
package/dist/editor.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import { EditorContent, Editor, useEditor } from "@tiptap/react";
|
|
2
2
|
import { default as default2 } from "@tiptap/starter-kit";
|
|
3
3
|
import { default as default3 } from "./modules/editor/components/Editor/Editor.js";
|
|
4
|
-
import { default as default4 } from "./modules/editor/components/Editor/
|
|
5
|
-
import { default as default5 } from "./modules/editor/components/
|
|
6
|
-
import { default as default6 } from "./modules/editor/components/
|
|
7
|
-
import { default as default7 } from "./modules/editor/components/
|
|
8
|
-
import { default as default8 } from "./modules/editor/components/NodeView/
|
|
9
|
-
import { default as default9 } from "./modules/editor/components/NodeView/
|
|
10
|
-
import { default as default10 } from "./modules/editor/components/NodeView/
|
|
11
|
-
import { default as default11 } from "./modules/editor/components/NodeView/
|
|
12
|
-
import { default as default12 } from "./modules/editor/components/NodeView/
|
|
13
|
-
import { default as default13 } from "./modules/editor/components/NodeView/
|
|
14
|
-
import { default as default14 } from "./modules/editor/components/
|
|
15
|
-
import { default as default15 } from "./modules/editor/components/
|
|
16
|
-
import { default as default16 } from "./modules/editor/components/Renderer/
|
|
17
|
-
import { default as default17 } from "./modules/editor/components/Renderer/
|
|
18
|
-
import { default as default18 } from "./modules/editor/components/Renderer/
|
|
19
|
-
import { default as default19 } from "./modules/editor/components/Renderer/
|
|
20
|
-
import { default as default20 } from "./modules/editor/components/
|
|
21
|
-
import { default as default21 } from "./modules/editor/components/
|
|
4
|
+
import { default as default4 } from "./modules/editor/components/Editor/EditorPreview.js";
|
|
5
|
+
import { default as default5 } from "./modules/editor/components/Editor/EditorPreviewSkeleton.js";
|
|
6
|
+
import { default as default6 } from "./modules/editor/components/Editor/EditorSkeleton.js";
|
|
7
|
+
import { default as default7 } from "./modules/editor/components/BubbleMenuEditImage/BubbleMenuEditImage.js";
|
|
8
|
+
import { default as default8 } from "./modules/editor/components/NodeView/AttachmentNodeView.js";
|
|
9
|
+
import { default as default9 } from "./modules/editor/components/NodeView/AudioNodeView.js";
|
|
10
|
+
import { default as default10 } from "./modules/editor/components/NodeView/ConversationHistoryNodeView.js";
|
|
11
|
+
import { default as default11 } from "./modules/editor/components/NodeView/ImageNodeView.js";
|
|
12
|
+
import { default as default12 } from "./modules/editor/components/NodeView/LinkerNodeView.js";
|
|
13
|
+
import { default as default13 } from "./modules/editor/components/NodeView/VideoNodeView.js";
|
|
14
|
+
import { default as default14 } from "./modules/editor/components/NodeView/InformationPaneNodeView.js";
|
|
15
|
+
import { default as default15 } from "./modules/editor/components/NodeView/IframeNodeView.js";
|
|
16
|
+
import { default as default16 } from "./modules/editor/components/Renderer/AttachmentRenderer.js";
|
|
17
|
+
import { default as default17 } from "./modules/editor/components/Renderer/AudioRenderer.js";
|
|
18
|
+
import { default as default18 } from "./modules/editor/components/Renderer/ConversationHistoryRenderer.js";
|
|
19
|
+
import { default as default19 } from "./modules/editor/components/Renderer/LinkerRenderer.js";
|
|
20
|
+
import { default as default20 } from "./modules/editor/components/Renderer/MediaRenderer.js";
|
|
21
|
+
import { default as default21 } from "./modules/editor/components/Renderer/InformationPaneRenderer.js";
|
|
22
|
+
import { default as default22 } from "./modules/editor/components/Toolbar/TableToolbar.js";
|
|
23
|
+
import { default as default23 } from "./modules/editor/components/Toolbar/LinkToolbar.js";
|
|
22
24
|
import { EditorToolbar } from "./modules/editor/components/EditorToolbar/EditorToolbar.js";
|
|
23
25
|
import { useActionOptions } from "./modules/editor/hooks/useActionOptions.js";
|
|
24
26
|
import { useCommentEditor } from "./modules/editor/hooks/useCommentEditor.js";
|
|
@@ -34,30 +36,32 @@ import { useSpeechSynthetisis } from "./modules/editor/hooks/useSpeechSynthetisi
|
|
|
34
36
|
import { useTipTapEditor } from "./modules/editor/hooks/useTipTapEditor.js";
|
|
35
37
|
import { useCantooEditor } from "./modules/editor/hooks/useCantooEditor.js";
|
|
36
38
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
default8 as AttachmentNodeView,
|
|
40
|
+
default16 as AttachmentRenderer,
|
|
41
|
+
default9 as AudioNodeView,
|
|
42
|
+
default17 as AudioRenderer,
|
|
43
|
+
default7 as BubbleMenuEditImage,
|
|
44
|
+
default10 as ConversationHistoryNodeView,
|
|
45
|
+
default18 as ConversationHistoryRenderer,
|
|
44
46
|
default3 as Editor,
|
|
45
47
|
EditorContent,
|
|
46
48
|
EditorContext,
|
|
47
49
|
Editor as EditorInstance,
|
|
48
|
-
default4 as
|
|
50
|
+
default4 as EditorPreview,
|
|
51
|
+
default5 as EditorPreviewSkeleton,
|
|
52
|
+
default6 as EditorSkeleton,
|
|
49
53
|
EditorToolbar,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
default15 as IframeNodeView,
|
|
55
|
+
default11 as ImageNodeView,
|
|
56
|
+
default14 as InformationPaneNodeView,
|
|
57
|
+
default21 as InformationPaneRenderer,
|
|
58
|
+
default23 as LinkToolbar,
|
|
59
|
+
default12 as LinkerNodeView,
|
|
60
|
+
default19 as LinkerRenderer,
|
|
61
|
+
default20 as MediaRenderer,
|
|
58
62
|
default2 as StarterKit,
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
default22 as TableToolbar,
|
|
64
|
+
default13 as VideoNodeView,
|
|
61
65
|
useActionOptions,
|
|
62
66
|
useCantooEditor,
|
|
63
67
|
useCommentEditor,
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './useHasWorkflow';
|
|
|
15
15
|
export * from './useHover';
|
|
16
16
|
export * from './useHttpErrorToast';
|
|
17
17
|
export * from './useImage';
|
|
18
|
+
export * from './useInfiniteScroll';
|
|
18
19
|
export * from './useIsAdml';
|
|
19
20
|
export * from './useIsAdmc';
|
|
20
21
|
export * from './useIsAdmlcOrAdmc';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as useInfiniteScroll } from './useInfiniteScroll';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A custom React hook that provides infinite scroll functionality using the Intersection Observer API.
|
|
3
|
+
*
|
|
4
|
+
* This hook returns a ref callback that can be attached to a DOM element (typically at the bottom
|
|
5
|
+
* of a scrollable list). When that element becomes visible in the viewport, the provided callback
|
|
6
|
+
* function is executed, allowing you to load more content.
|
|
7
|
+
*
|
|
8
|
+
* @param params - Configuration object for the infinite scroll hook
|
|
9
|
+
* @param params.callback - Function to execute when the observed element intersects with the viewport
|
|
10
|
+
* @param params.options - Optional Intersection Observer configuration options (defaults to { threshold: 0.1 })
|
|
11
|
+
*
|
|
12
|
+
* @returns A ref callback function that should be attached to the target DOM element
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const loadMoreRef = useInfiniteScroll({
|
|
17
|
+
* // Load more data when the element is visible
|
|
18
|
+
* callback: loadMoreItems,
|
|
19
|
+
* options: { threshold: 0.5 } // Trigger when 50% of element is visible
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* return (
|
|
23
|
+
* <div>
|
|
24
|
+
* {items.map(item => <Item key={item.id} {...item} />)}
|
|
25
|
+
* <div ref={loadMoreRef}>Loading...</div>
|
|
26
|
+
* </div>
|
|
27
|
+
* );
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export default function useInfiniteScroll({ callback, options, }: {
|
|
31
|
+
callback: () => void;
|
|
32
|
+
options?: IntersectionObserverInit;
|
|
33
|
+
}): (node: HTMLElement | null) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useRef, useCallback } from "react";
|
|
2
|
+
function useInfiniteScroll({
|
|
3
|
+
callback,
|
|
4
|
+
options = {
|
|
5
|
+
threshold: 0.1
|
|
6
|
+
}
|
|
7
|
+
}) {
|
|
8
|
+
const observerRef = useRef(null);
|
|
9
|
+
return useCallback((node) => {
|
|
10
|
+
if (observerRef.current && (observerRef.current.disconnect(), observerRef.current = null), !node) return;
|
|
11
|
+
const observer = new IntersectionObserver(async (entries) => {
|
|
12
|
+
for (const entry of entries)
|
|
13
|
+
entry.isIntersecting && await callback();
|
|
14
|
+
}, options);
|
|
15
|
+
observer.observe(node), observerRef.current = observer;
|
|
16
|
+
}, [callback, options]);
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
useInfiniteScroll as default
|
|
20
|
+
};
|