@weavy/uikit-react 26.0.3 → 27.0.0

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.
@@ -3,7 +3,7 @@
3
3
  import React from "react";
4
4
  import { createComponent, EventName, WebComponentProps } from "@lit/react";
5
5
  import { WY_CHAT_TAGNAME, WyChat as WyChatWC } from "@weavy/uikit-web";
6
- import { WyPreviewOpenEventType } from "@weavy/uikit-web/dist/types/types/files.types.js";
6
+ import { WyPreviewOpenEventType } from "@weavy/uikit-web/dist/types/types/events.types.js";
7
7
 
8
8
  // Creates a React component from a Lit component
9
9
  export const WyChat = createComponent({
@@ -6,7 +6,7 @@ import {
6
6
  WY_COMMENTS_TAGNAME,
7
7
  WyComments as WyCommentsWC,
8
8
  } from "@weavy/uikit-web";
9
- import { WyPreviewOpenEventType } from "@weavy/uikit-web/dist/types/types/files.types.js";
9
+ import { WyPreviewOpenEventType } from "@weavy/uikit-web/dist/types/types/events.types.js";
10
10
 
11
11
  // Creates a React component from a Lit component
12
12
  export const WyComments = createComponent({
@@ -0,0 +1,40 @@
1
+ "use client";
2
+
3
+ import React from "react";
4
+ import { createComponent, EventName, WebComponentProps } from "@lit/react";
5
+ import { WY_COPILOT_TAGNAME, WyCopilot as WyCopilotWC } from "@weavy/uikit-web";
6
+ import {
7
+ WyAppEventType,
8
+ WyMessageEventType,
9
+ WyPreviewOpenEventType,
10
+ } from "@weavy/uikit-web/dist/types/types/events.types.js";
11
+
12
+ // Creates a React component from a Lit component
13
+ export const WyCopilot = createComponent({
14
+ react: React,
15
+ tagName: WY_COPILOT_TAGNAME,
16
+ elementClass: WyCopilotWC,
17
+ events: {
18
+ onWyPreviewOpen:
19
+ "wy-preview-open" satisfies WyPreviewOpenEventType["type"] as EventName<WyPreviewOpenEventType>,
20
+ onWyApp:
21
+ "wy-app" satisfies WyAppEventType["type"] as EventName<WyAppEventType>,
22
+ onWyMessage:
23
+ "wy-message" satisfies WyMessageEventType["type"] as EventName<WyMessageEventType>,
24
+ },
25
+ });
26
+
27
+ declare module "react" {
28
+ // eslint-disable-next-line @typescript-eslint/no-namespace
29
+ namespace JSX {
30
+ interface IntrinsicElements {
31
+ [WY_COPILOT_TAGNAME]: WebComponentProps<WyCopilotWC>;
32
+ }
33
+ }
34
+ }
35
+
36
+ export type {
37
+ WyPreviewOpenEventType,
38
+ WyAppEventType,
39
+ WyMessageEventType,
40
+ };
@@ -3,7 +3,7 @@
3
3
  import React from "react";
4
4
  import { createComponent, EventName, WebComponentProps } from "@lit/react";
5
5
  import { WY_FILES_TAGNAME, WyFiles as WyFilesWC } from "@weavy/uikit-web";
6
- import { WyPreviewOpenEventType } from "@weavy/uikit-web/dist/types/types/files.types.js";
6
+ import { WyPreviewOpenEventType } from "@weavy/uikit-web/dist/types/types/events.types.js";
7
7
 
8
8
  // Creates a React component from a Lit component
9
9
  export const WyFiles = createComponent({
@@ -6,7 +6,7 @@ import {
6
6
  WY_MESSENGER_TAGNAME,
7
7
  WyMessenger as WyMessengerWC,
8
8
  } from "@weavy/uikit-web";
9
- import { WyPreviewOpenEventType } from "@weavy/uikit-web/dist/types/types/files.types.js";
9
+ import { WyPreviewOpenEventType } from "@weavy/uikit-web/dist/types/types/events.types.js";
10
10
 
11
11
  // Creates a React component from a Lit component
12
12
  export const WyMessenger = createComponent({
@@ -3,7 +3,7 @@
3
3
  import React from "react";
4
4
  import { createComponent, EventName, WebComponentProps } from "@lit/react";
5
5
  import { WY_POSTS_TAGNAME, WyPosts as WyPostsWC } from "@weavy/uikit-web";
6
- import { WyPreviewOpenEventType } from "@weavy/uikit-web/dist/types/types/files.types.js";
6
+ import { WyPreviewOpenEventType } from "@weavy/uikit-web/dist/types/types/events.types.js";
7
7
 
8
8
  // Creates a React component from a Lit component
9
9
  export const WyPosts = createComponent({
@@ -1,7 +1,9 @@
1
+ export { Feature } from "@weavy/uikit-web/lib/types/features.types.ts";
1
2
  export * from "./WyChat";
2
3
  export * from "./WyComments";
3
4
  export * from "./WyComponent";
4
5
  export * from "./WyContext";
6
+ export * from "./WyCopilot";
5
7
  export * from "./WyFiles";
6
8
  export * from "./WyMessenger";
7
9
  export * from "./WyNotifications";
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { EventName, createComponent } from "@lit/react";
3
3
  import { WeavyComponents } from "@weavy/uikit-web";
4
- import type { FileOpenEventType } from "@weavy/uikit-web/dist/types/types/files.types.d.ts";
4
+ import type { FileOpenEventType } from "@weavy/uikit-web/dist/types/types/events.types.d.ts";
5
5
 
6
6
  // Creates a React component from a Lit component
7
7
  export const WyAttachment = createComponent({
@@ -12,15 +12,6 @@ export const WyConversation = createComponent({
12
12
  },
13
13
  });
14
14
 
15
- export const WyConversationExtended = createComponent({
16
- react: React,
17
- tagName: "wy-conversation-extended",
18
- elementClass: WeavyComponents.WyConversationExtended,
19
- events: {
20
- onReleaseFocus: "release-focus" as EventName<CustomEvent>,
21
- },
22
- });
23
-
24
15
  export const WyConversationAppbar = createComponent({
25
16
  react: React,
26
17
  tagName: "wy-conversation-appbar",
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import { EventName, createComponent } from "@lit/react";
3
3
  import { WeavyComponents } from "@weavy/uikit-web";
4
+ import type { FileOpenEventType } from "@weavy/uikit-web/dist/types/types/events.types.d.ts";
4
5
  import type {
5
- FileOpenEventType,
6
6
  FileOrderType,
7
7
  FileType,
8
8
  } from "@weavy/uikit-web/dist/types/types/files.types.d.ts";
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { EventName, createComponent } from "@lit/react";
3
3
  import { WeavyComponents } from "@weavy/uikit-web";
4
- import type { FileOpenEventType } from "@weavy/uikit-web/dist/types/types/files.types.d.ts";
4
+ import type { FileOpenEventType } from "@weavy/uikit-web/dist/types/types/events.types.d.ts";
5
5
 
6
6
  // Creates a React component from a Lit component
7
7
  export const WyImageGrid = createComponent({
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { EventName, createComponent } from "@lit/react";
3
3
  import { WeavyComponents } from "@weavy/uikit-web";
4
- import { WyPreviewCloseEventType, WyPreviewOpenEventType } from "@weavy/uikit-web/dist/types/types/files.types.js";
4
+ import { WyPreviewCloseEventType, WyPreviewOpenEventType } from "@weavy/uikit-web/dist/types/types/events.types.js";
5
5
 
6
6
  // Creates a React component from a Lit component
7
7
  export const WyPreview = createComponent({
@@ -11,6 +11,27 @@ import { Context } from "@weavy/uikit-web/dist/types/contexts/index.js";
11
11
  * @param ref { React.RefObject | HTMLElement } - Reference object that needs to be placed in the DOM.
12
12
  * @param context { Context } - The context to use. Defaults to WeavyContext from ukit-web.
13
13
  * @returns Weavy instance
14
+ * @example
15
+ * import React, { useRef } from "react"
16
+ * import { useWeavyContext } from "@weavy/uikit-react"
17
+ *
18
+ * export const MyComponent = () => {
19
+ * const domRef = useRef(null)
20
+ * const weavy = useWeavyContext(domRef)
21
+ *
22
+ * useEffect(() => {
23
+ * if (weavy) {
24
+ * console.log("We got weavy", weavy.version)
25
+ * }
26
+ * }, [weavy])
27
+ *
28
+ * // ...
29
+ * return (
30
+ * <>
31
+ * <span ref={domRef}></span>
32
+ * </>
33
+ * )
34
+ * }
14
35
  */
15
36
  export function useWeavyContext<TContext extends Context<unknown, unknown> = typeof WeavyContext, TElement extends HTMLElement = HTMLElement>(
16
37
  ref: React.RefObject<TElement> | TElement | null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weavy/uikit-react",
3
- "version": "26.0.3",
3
+ "version": "27.0.0",
4
4
  "author": "Weavy",
5
5
  "description": "React components UI-kit for Weavy",
6
6
  "homepage": "https://github.com/weavy/weavy-uikit-react",
@@ -17,15 +17,14 @@
17
17
  "types": "./dist/types/index.d.ts",
18
18
  "exports": {
19
19
  ".": {
20
- "import": "./dist/weavy.mjs",
21
- "require": "./dist/weavy.cjs",
22
20
  "node": {
23
21
  "import": "./dist/weavy.mjs",
24
22
  "require": "./dist/weavy.bundle.js"
25
23
  },
26
- "browser": "./dist/weavy.umd.js",
27
- "default": "./dist/weavy.umd.js",
28
- "types": "./dist/types/index.d.ts"
24
+ "types": "./dist/types/index.d.ts",
25
+ "import": "./dist/weavy.mjs",
26
+ "require": "./dist/weavy.cjs",
27
+ "default": "./dist/weavy.umd.js"
29
28
  }
30
29
  },
31
30
  "scripts": {
@@ -41,37 +40,37 @@
41
40
  },
42
41
  "dependencies": {
43
42
  "@lit/react": "^1.0.7",
44
- "@weavy/uikit-web": "^26.0.3"
43
+ "@weavy/uikit-web": "^27.0.0"
45
44
  },
46
45
  "peerDependencies": {
47
46
  "react": ">=16",
48
47
  "react-dom": ">=16"
49
48
  },
50
49
  "devDependencies": {
51
- "@babel/preset-env": "^7.26.7",
50
+ "@babel/preset-env": "^7.26.9",
52
51
  "@babel/preset-react": "^7.26.3",
53
- "@eslint/js": "^9.19.0",
52
+ "@eslint/js": "^9.23.0",
54
53
  "@rollup/plugin-babel": "^6.0.4",
55
- "@rollup/plugin-node-resolve": "^16.0.0",
56
- "@types/node": "^22.12.0",
57
- "@types/react": "^18.3.18",
54
+ "@rollup/plugin-node-resolve": "^16.0.1",
55
+ "@types/node": "^22.13.12",
56
+ "@types/react": "^18.3.20",
58
57
  "@types/react-dom": "^18.3.5",
59
58
  "@vitejs/plugin-react": "^4.3.4",
60
59
  "dotenv": "^16.4.7",
61
- "eslint": "^9.19.0",
60
+ "eslint": "^9.23.0",
62
61
  "eslint-plugin-react": "^7.37.4",
63
- "eslint-plugin-react-hooks": "^5.1.0",
64
- "eslint-plugin-react-refresh": "^0.4.18",
65
- "globals": "^15.14.0",
62
+ "eslint-plugin-react-hooks": "^5.2.0",
63
+ "eslint-plugin-react-refresh": "^0.4.19",
64
+ "globals": "^16.0.0",
66
65
  "npm-run-all": "^4.1.5",
67
66
  "react": "^18.3.1",
68
67
  "react-dom": "^18.3.1",
69
68
  "rimraf": "^6.0.1",
70
69
  "rollup-preserve-directives": "^1.1.3",
71
- "sass": "^1.83.4",
72
- "typescript": "^5.7.2",
73
- "typescript-eslint": "^8.22.0",
74
- "vite": "^5.4.14",
75
- "vite-plugin-dts": "^4.5.0"
70
+ "sass": "^1.86.0",
71
+ "typescript": "^5.8.2",
72
+ "typescript-eslint": "^8.27.0",
73
+ "vite": "^6.2.3",
74
+ "vite-plugin-dts": "^4.5.3"
76
75
  }
77
76
  }