@schedule-x/react 2.13.3 → 2.14.1

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/index.cjs CHANGED
@@ -61,6 +61,18 @@ function useNextCalendarApp(config, plugins) {
61
61
  return calendarApp;
62
62
  }
63
63
 
64
+ const usePlugin = (plugin) => {
65
+ if ('undefined' === typeof window) {
66
+ throw new Error('usePlugin can only be used in the browser. You need to wrap all logic for the calendar in a client side component.');
67
+ }
68
+ const [pluginInstance, setPluginInstance] = react.useState();
69
+ react.useEffect(() => {
70
+ setPluginInstance(plugin);
71
+ }, []);
72
+ return pluginInstance;
73
+ };
74
+
64
75
  exports.ScheduleXCalendar = ScheduleXCalendar;
65
76
  exports.useCalendarApp = useCalendarApp;
66
77
  exports.useNextCalendarApp = useNextCalendarApp;
78
+ exports.usePlugin = usePlugin;
package/dist/index.cjs.js CHANGED
@@ -61,6 +61,18 @@ function useNextCalendarApp(config, plugins) {
61
61
  return calendarApp;
62
62
  }
63
63
 
64
+ const usePlugin = (plugin) => {
65
+ if ('undefined' === typeof window) {
66
+ throw new Error('usePlugin can only be used in the browser. You need to wrap all logic for the calendar in a client side component.');
67
+ }
68
+ const [pluginInstance, setPluginInstance] = react.useState();
69
+ react.useEffect(() => {
70
+ setPluginInstance(plugin);
71
+ }, []);
72
+ return pluginInstance;
73
+ };
74
+
64
75
  exports.ScheduleXCalendar = ScheduleXCalendar;
65
76
  exports.useCalendarApp = useCalendarApp;
66
77
  exports.useNextCalendarApp = useNextCalendarApp;
78
+ exports.usePlugin = usePlugin;
package/dist/index.js CHANGED
@@ -59,4 +59,15 @@ function useNextCalendarApp(config, plugins) {
59
59
  return calendarApp;
60
60
  }
61
61
 
62
- export { ScheduleXCalendar, useCalendarApp, useNextCalendarApp };
62
+ const usePlugin = (plugin) => {
63
+ if ('undefined' === typeof window) {
64
+ throw new Error('usePlugin can only be used in the browser. You need to wrap all logic for the calendar in a client side component.');
65
+ }
66
+ const [pluginInstance, setPluginInstance] = useState();
67
+ useEffect(() => {
68
+ setPluginInstance(plugin);
69
+ }, []);
70
+ return pluginInstance;
71
+ };
72
+
73
+ export { ScheduleXCalendar, useCalendarApp, useNextCalendarApp, usePlugin };
@@ -1,3 +1,4 @@
1
1
  export { ScheduleXCalendar } from './schedule-x-calendar.d.ts';
2
2
  export { useCalendarApp, useNextCalendarApp } from './use-calendar-app.d.ts';
3
+ export { usePlugin } from './use-plugin.ts';
3
4
 
@@ -0,0 +1,2 @@
1
+ import { PluginBase } from '@schedule-x/shared';
2
+ export declare const usePlugin: <Plugin extends PluginBase<string>>(plugin: Plugin) => Plugin;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "main": "dist/index.cjs",
16
16
  "module": "dist/index.js",
17
17
  "types": "dist/types/index.d.ts",
18
- "version": "2.13.3",
18
+ "version": "2.14.1",
19
19
  "type": "module",
20
20
  "files": [
21
21
  "dist"
@@ -25,13 +25,13 @@
25
25
  "build": "rollup -c && npm run build:dts",
26
26
  "build:dts": "node scripts/build-declarations.mjs",
27
27
  "test": "./node_modules/.bin/cypress run",
28
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 5",
28
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 10",
29
29
  "preview": "vite preview",
30
30
  "format": "prettier --write .",
31
31
  "build:publish": "npm run build && npm publish"
32
32
  },
33
33
  "peerDependencies": {
34
- "@schedule-x/calendar": "^2.14.1",
34
+ "@schedule-x/calendar": "^2.15.1",
35
35
  "react": "^16.7.0 || ^17 || ^18 || ^19",
36
36
  "react-dom": "^16.7.0 || ^17 || ^18 || ^19"
37
37
  },
@@ -40,15 +40,15 @@
40
40
  "@rollup/plugin-commonjs": "^28.0.0",
41
41
  "@rollup/plugin-node-resolve": "^16.0.0",
42
42
  "@rollup/plugin-typescript": "^11.1.5",
43
- "@schedule-x/calendar-controls": "^2.14.1",
44
- "@schedule-x/drag-and-drop": "^2.14.1",
45
- "@schedule-x/e2e-testing": "^2.14.1",
46
- "@schedule-x/eslint-config": "^2.14.1",
47
- "@schedule-x/event-modal": "^2.14.1",
48
- "@schedule-x/events-service": "^2.14.1",
49
- "@schedule-x/prettier-config": "^2.14.1",
50
- "@schedule-x/shared": "^2.14.1",
51
- "@schedule-x/theme-default": "^2.0.0",
43
+ "@schedule-x/calendar-controls": "^2.15.1",
44
+ "@schedule-x/drag-and-drop": "^2.15.1",
45
+ "@schedule-x/e2e-testing": "^2.15.1",
46
+ "@schedule-x/eslint-config": "^2.15.1",
47
+ "@schedule-x/event-modal": "^2.15.1",
48
+ "@schedule-x/events-service": "^2.15.1",
49
+ "@schedule-x/prettier-config": "^2.15.1",
50
+ "@schedule-x/shared": "^2.15.1",
51
+ "@schedule-x/theme-default": "^2.15.1",
52
52
  "@semantic-release/changelog": "^6.0.3",
53
53
  "@semantic-release/git": "^10.0.1",
54
54
  "@types/react": "^18.2.43",