@kendew-agency/react-feedback-layer 0.4.0-rc.0 → 0.4.0-rc.2
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/README.md +124 -47
- package/dist/index.cjs +180 -134
- package/dist/index.d.cts +15 -16
- package/dist/index.d.ts +15 -16
- package/dist/index.js +189 -142
- package/dist/types.d.cts +477 -4
- package/dist/types.d.ts +477 -4
- package/package.json +2 -1
- package/dist/use-session-events-DFksOgVA.d.cts +0 -464
- package/dist/use-session-events-DFksOgVA.d.ts +0 -464
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { HTMLProps, ReactNode, ElementType, ButtonHTMLAttributes } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { CommentType, CommentState, CommentAction, CommentOverlayProps as CommentOverlayProps$1, CommentContext, User, InitialFeedbackSession, CreateSessionInput, FeedbackSession, SessionType, KnownError, ActiveFeedbackSession, SessionOperationState, SessionEvents } from './types.cjs';
|
|
5
5
|
|
|
6
6
|
interface CommentOverlayProps extends HTMLProps<HTMLDivElement> {
|
|
7
7
|
children: ReactNode;
|
|
@@ -77,7 +77,7 @@ declare const Comment: {
|
|
|
77
77
|
* The root component for a comment, must be used to wrap all other comment components.
|
|
78
78
|
*
|
|
79
79
|
* @param comment as the current comment from the comments array
|
|
80
|
-
* @param defaultDraft as the optional initial value for the comment
|
|
80
|
+
* @param defaultDraft as the optional initial value for the edit state of `Comment.Edit`. It only seeds the draft on mount and does not affect `Comment.Content`. The draft resets to `comment.content` whenever that changes
|
|
81
81
|
* @param withPosition as whether to inject positioning styles from the comment's position. Disable if you want to display the comment in a list. Defaults to true
|
|
82
82
|
*/
|
|
83
83
|
Root: ({ comment, defaultDraft, withPosition, children, ...rest }: CommentRootProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -88,9 +88,9 @@ declare const Comment: {
|
|
|
88
88
|
*/
|
|
89
89
|
Indicator: ({ ...rest }: CommentIndicatorProps) => react_jsx_runtime.JSX.Element | null;
|
|
90
90
|
/**
|
|
91
|
-
* The comment's static
|
|
91
|
+
* The comment's static saved content
|
|
92
92
|
*
|
|
93
|
-
* @description Displays the comment
|
|
93
|
+
* @description Displays the saved `comment.content` as a `<p>` tag. Text typed in `Comment.Edit` is not shown until it is confirmed, so a draft comment renders empty until then
|
|
94
94
|
* @param asChild as whether to use the child as the base element instead of the default `<p>` tag. This allows for more flexibility
|
|
95
95
|
*/
|
|
96
96
|
Content: ({ asChild, ...rest }: CommentContentProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -131,12 +131,13 @@ declare const Comment: {
|
|
|
131
131
|
Reopen: ({ asChild, ...rest }: CommentReopenProps) => react_jsx_runtime.JSX.Element | null;
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
+
declare const commentReducer: (state: CommentState, action: CommentAction) => CommentState;
|
|
134
135
|
/**
|
|
135
136
|
* Comment context provider to provide the comments to the children components
|
|
136
137
|
*
|
|
137
138
|
* @param initialComments as the initial comments from the document
|
|
138
139
|
*/
|
|
139
|
-
declare const CommentContextProvider: ({ children, initialComments, initialOverlayState, currentUser: currentUserProp, subscription, config, projectId, onError, onAdd, onEdit, onDelete, onResolve, onReopen, }: CommentOverlayProps$1) => react_jsx_runtime.JSX.Element;
|
|
140
|
+
declare const CommentContextProvider: ({ children, initialComments, initialOverlayState, currentUser: currentUserProp, subscription, config, projectId, locationId: locationIdProp, onError, onAdd, onEdit, onDelete, onResolve, onReopen, }: CommentOverlayProps$1) => react_jsx_runtime.JSX.Element;
|
|
140
141
|
declare const useComments: () => CommentContext;
|
|
141
142
|
|
|
142
143
|
type CommentScope = {
|
|
@@ -151,7 +152,11 @@ declare function useCommentScope(): CommentScope;
|
|
|
151
152
|
interface SessionButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
152
153
|
asChild?: boolean;
|
|
153
154
|
}
|
|
154
|
-
|
|
155
|
+
interface CreateSessionProps extends SessionButtonProps {
|
|
156
|
+
/** The user creating the session */
|
|
157
|
+
user: User;
|
|
158
|
+
}
|
|
159
|
+
declare const CreateSession: ({ asChild, user, ...rest }: CreateSessionProps) => react_jsx_runtime.JSX.Element;
|
|
155
160
|
declare const ConfirmSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
156
161
|
declare const StartResolving: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
157
162
|
declare const ResolveSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -182,9 +187,10 @@ type FeedbackSessionContextType = {
|
|
|
182
187
|
sessionState: SessionOperationState;
|
|
183
188
|
/** Mirrors the canResolveSession prop */
|
|
184
189
|
canResolve: boolean;
|
|
185
|
-
createSession: (options
|
|
190
|
+
createSession: (options: {
|
|
191
|
+
/** The user creating the session. Required, a missing user is refused */
|
|
192
|
+
user: User;
|
|
186
193
|
type?: SessionType;
|
|
187
|
-
user?: User | null;
|
|
188
194
|
projectId?: string;
|
|
189
195
|
}) => Promise<ActionResult>;
|
|
190
196
|
confirmSession: () => Promise<ActionResult>;
|
|
@@ -195,11 +201,4 @@ type FeedbackSessionContextType = {
|
|
|
195
201
|
declare const FeedbackSessionProvider: ({ children, initialSession, projectId, canResolveSession, onCreateSession, onConfirmSession, onStartResolving, onResolveSession, onError, }: FeedbackSessionProviderProps) => react_jsx_runtime.JSX.Element;
|
|
196
202
|
declare const useFeedbackSession: () => FeedbackSessionContextType;
|
|
197
203
|
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Returns the current user, or null when nobody is signed in.
|
|
201
|
-
* Throws when used outside <UserProvider />.
|
|
202
|
-
*/
|
|
203
|
-
declare const useCurrentUser: () => User | null;
|
|
204
|
-
|
|
205
|
-
export { Comment, CommentContextProvider, CommentOverlay, CommentRenderer, CommentScopeContext, ConfirmSession, CreateSession, type FeedbackSessionContextType, FeedbackSessionProvider, type FeedbackSessionProviderProps, ResolveSession, StartResolving, ToggleOverlayButton, UserProvider, useCommentScope, useComments, useCurrentUser, useFeedbackSession };
|
|
204
|
+
export { Comment, CommentContextProvider, CommentOverlay, CommentRenderer, CommentScopeContext, ConfirmSession, CreateSession, type FeedbackSessionContextType, FeedbackSessionProvider, type FeedbackSessionProviderProps, ResolveSession, StartResolving, ToggleOverlayButton, commentReducer, useCommentScope, useComments, useFeedbackSession };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { HTMLProps, ReactNode, ElementType, ButtonHTMLAttributes } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { CommentType, CommentState, CommentAction, CommentOverlayProps as CommentOverlayProps$1, CommentContext, User, InitialFeedbackSession, CreateSessionInput, FeedbackSession, SessionType, KnownError, ActiveFeedbackSession, SessionOperationState, SessionEvents } from './types.js';
|
|
5
5
|
|
|
6
6
|
interface CommentOverlayProps extends HTMLProps<HTMLDivElement> {
|
|
7
7
|
children: ReactNode;
|
|
@@ -77,7 +77,7 @@ declare const Comment: {
|
|
|
77
77
|
* The root component for a comment, must be used to wrap all other comment components.
|
|
78
78
|
*
|
|
79
79
|
* @param comment as the current comment from the comments array
|
|
80
|
-
* @param defaultDraft as the optional initial value for the comment
|
|
80
|
+
* @param defaultDraft as the optional initial value for the edit state of `Comment.Edit`. It only seeds the draft on mount and does not affect `Comment.Content`. The draft resets to `comment.content` whenever that changes
|
|
81
81
|
* @param withPosition as whether to inject positioning styles from the comment's position. Disable if you want to display the comment in a list. Defaults to true
|
|
82
82
|
*/
|
|
83
83
|
Root: ({ comment, defaultDraft, withPosition, children, ...rest }: CommentRootProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -88,9 +88,9 @@ declare const Comment: {
|
|
|
88
88
|
*/
|
|
89
89
|
Indicator: ({ ...rest }: CommentIndicatorProps) => react_jsx_runtime.JSX.Element | null;
|
|
90
90
|
/**
|
|
91
|
-
* The comment's static
|
|
91
|
+
* The comment's static saved content
|
|
92
92
|
*
|
|
93
|
-
* @description Displays the comment
|
|
93
|
+
* @description Displays the saved `comment.content` as a `<p>` tag. Text typed in `Comment.Edit` is not shown until it is confirmed, so a draft comment renders empty until then
|
|
94
94
|
* @param asChild as whether to use the child as the base element instead of the default `<p>` tag. This allows for more flexibility
|
|
95
95
|
*/
|
|
96
96
|
Content: ({ asChild, ...rest }: CommentContentProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -131,12 +131,13 @@ declare const Comment: {
|
|
|
131
131
|
Reopen: ({ asChild, ...rest }: CommentReopenProps) => react_jsx_runtime.JSX.Element | null;
|
|
132
132
|
};
|
|
133
133
|
|
|
134
|
+
declare const commentReducer: (state: CommentState, action: CommentAction) => CommentState;
|
|
134
135
|
/**
|
|
135
136
|
* Comment context provider to provide the comments to the children components
|
|
136
137
|
*
|
|
137
138
|
* @param initialComments as the initial comments from the document
|
|
138
139
|
*/
|
|
139
|
-
declare const CommentContextProvider: ({ children, initialComments, initialOverlayState, currentUser: currentUserProp, subscription, config, projectId, onError, onAdd, onEdit, onDelete, onResolve, onReopen, }: CommentOverlayProps$1) => react_jsx_runtime.JSX.Element;
|
|
140
|
+
declare const CommentContextProvider: ({ children, initialComments, initialOverlayState, currentUser: currentUserProp, subscription, config, projectId, locationId: locationIdProp, onError, onAdd, onEdit, onDelete, onResolve, onReopen, }: CommentOverlayProps$1) => react_jsx_runtime.JSX.Element;
|
|
140
141
|
declare const useComments: () => CommentContext;
|
|
141
142
|
|
|
142
143
|
type CommentScope = {
|
|
@@ -151,7 +152,11 @@ declare function useCommentScope(): CommentScope;
|
|
|
151
152
|
interface SessionButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
152
153
|
asChild?: boolean;
|
|
153
154
|
}
|
|
154
|
-
|
|
155
|
+
interface CreateSessionProps extends SessionButtonProps {
|
|
156
|
+
/** The user creating the session */
|
|
157
|
+
user: User;
|
|
158
|
+
}
|
|
159
|
+
declare const CreateSession: ({ asChild, user, ...rest }: CreateSessionProps) => react_jsx_runtime.JSX.Element;
|
|
155
160
|
declare const ConfirmSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
156
161
|
declare const StartResolving: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
157
162
|
declare const ResolveSession: ({ asChild, ...rest }: SessionButtonProps) => react_jsx_runtime.JSX.Element;
|
|
@@ -182,9 +187,10 @@ type FeedbackSessionContextType = {
|
|
|
182
187
|
sessionState: SessionOperationState;
|
|
183
188
|
/** Mirrors the canResolveSession prop */
|
|
184
189
|
canResolve: boolean;
|
|
185
|
-
createSession: (options
|
|
190
|
+
createSession: (options: {
|
|
191
|
+
/** The user creating the session. Required, a missing user is refused */
|
|
192
|
+
user: User;
|
|
186
193
|
type?: SessionType;
|
|
187
|
-
user?: User | null;
|
|
188
194
|
projectId?: string;
|
|
189
195
|
}) => Promise<ActionResult>;
|
|
190
196
|
confirmSession: () => Promise<ActionResult>;
|
|
@@ -195,11 +201,4 @@ type FeedbackSessionContextType = {
|
|
|
195
201
|
declare const FeedbackSessionProvider: ({ children, initialSession, projectId, canResolveSession, onCreateSession, onConfirmSession, onStartResolving, onResolveSession, onError, }: FeedbackSessionProviderProps) => react_jsx_runtime.JSX.Element;
|
|
196
202
|
declare const useFeedbackSession: () => FeedbackSessionContextType;
|
|
197
203
|
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Returns the current user, or null when nobody is signed in.
|
|
201
|
-
* Throws when used outside <UserProvider />.
|
|
202
|
-
*/
|
|
203
|
-
declare const useCurrentUser: () => User | null;
|
|
204
|
-
|
|
205
|
-
export { Comment, CommentContextProvider, CommentOverlay, CommentRenderer, CommentScopeContext, ConfirmSession, CreateSession, type FeedbackSessionContextType, FeedbackSessionProvider, type FeedbackSessionProviderProps, ResolveSession, StartResolving, ToggleOverlayButton, UserProvider, useCommentScope, useComments, useCurrentUser, useFeedbackSession };
|
|
204
|
+
export { Comment, CommentContextProvider, CommentOverlay, CommentRenderer, CommentScopeContext, ConfirmSession, CreateSession, type FeedbackSessionContextType, FeedbackSessionProvider, type FeedbackSessionProviderProps, ResolveSession, StartResolving, ToggleOverlayButton, commentReducer, useCommentScope, useComments, useFeedbackSession };
|