@rimori/react-client 0.2.7 → 0.3.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.
@@ -121,7 +121,7 @@ const ContextMenu = ({ client }) => {
121
121
  if (!isOpen) {
122
122
  return null;
123
123
  }
124
- return (_jsx("div", { ref: menuRef, className: "fixed bg-gray-400 dark:bg-gray-700 shadow-lg border border-gray-400 rounded-md overflow-hidden dark:text-white z-50", style: { top: position.y, left: position.x }, children: actions.map((action, index) => (_jsx(MenuEntryItem, { icon: action.icon, text: action.text, onClick: () => {
124
+ return (_jsx("div", { ref: menuRef, className: "fixed bg-gray-400 dark:bg-gray-700 shadow-lg border border-gray-400 rounded-md overflow-hidden dark:text-white z-50", style: { top: position.y, left: position.x }, children: actions.map((action, index) => (_jsx(MenuEntryItem, { iconUrl: action.iconUrl, text: action.text, onClick: () => {
125
125
  var _a;
126
126
  setIsOpen(false);
127
127
  (_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();
@@ -129,6 +129,6 @@ const ContextMenu = ({ client }) => {
129
129
  } }, index))) }));
130
130
  };
131
131
  function MenuEntryItem(props) {
132
- return (_jsxs("button", { onClick: props.onClick, className: "px-4 py-2 text-left hover:bg-gray-500 dark:hover:bg-gray-600 w-full flex flex-row", children: [_jsx("span", { className: "flex-grow", children: props.icon }), _jsx("span", { className: "flex-grow", children: props.text })] }));
132
+ return (_jsxs("button", { onClick: props.onClick, className: "px-4 py-2 text-left hover:bg-gray-500 dark:hover:bg-gray-600 w-full flex flex-row", children: [_jsx("span", { className: "flex-grow", children: props.iconUrl && _jsx("img", { src: props.iconUrl, alt: props.text, className: "w-4 h-4 mr-2" }) }), _jsx("span", { className: "flex-grow", children: props.text })] }));
133
133
  }
134
134
  export default ContextMenu;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/react-client",
3
- "version": "0.2.7",
3
+ "version": "0.3.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "peerDependencies": {
21
21
  "react": "^18.0.0",
22
22
  "react-dom": "^18.0.0",
23
- "@rimori/client": "^2.1.7"
23
+ "@rimori/client": "^2.2.0"
24
24
  },
25
25
  "dependencies": {
26
26
  "html2canvas": "1.4.1",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@eslint/js": "^9.37.0",
31
- "@rimori/client": "^2.1.7",
31
+ "@rimori/client": "^2.2.0",
32
32
  "eslint-config-prettier": "^10.1.8",
33
33
  "eslint-plugin-prettier": "^5.5.4",
34
34
  "eslint-plugin-react-hooks": "^7.0.0",
@@ -148,7 +148,7 @@ const ContextMenu = ({ client }: { client: RimoriClient }) => {
148
148
  {actions.map((action, index) => (
149
149
  <MenuEntryItem
150
150
  key={index}
151
- icon={action.icon}
151
+ iconUrl={action.iconUrl}
152
152
  text={action.text}
153
153
  onClick={() => {
154
154
  setIsOpen(false);
@@ -161,13 +161,15 @@ const ContextMenu = ({ client }: { client: RimoriClient }) => {
161
161
  );
162
162
  };
163
163
 
164
- function MenuEntryItem(props: { icon: React.ReactNode; text: string; onClick: () => void }) {
164
+ function MenuEntryItem(props: { iconUrl?: string; text: string; onClick: () => void }) {
165
165
  return (
166
166
  <button
167
167
  onClick={props.onClick}
168
168
  className="px-4 py-2 text-left hover:bg-gray-500 dark:hover:bg-gray-600 w-full flex flex-row"
169
169
  >
170
- <span className="flex-grow">{props.icon}</span>
170
+ <span className="flex-grow">
171
+ {props.iconUrl && <img src={props.iconUrl} alt={props.text} className="w-4 h-4 mr-2" />}
172
+ </span>
171
173
  <span className="flex-grow">{props.text}</span>
172
174
  {/* <span className="text-sm">Ctrl+Shift+xxxx</span> */}
173
175
  </button>