@worknice/whiteboard 0.18.3 → 0.18.5

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.
@@ -2,6 +2,7 @@ import { type ReactNode } from "react";
2
2
  type Option = {
3
3
  id: string;
4
4
  label: string;
5
+ disabled?: boolean;
5
6
  } & ({
6
7
  onClick: (event: React.MouseEvent | React.KeyboardEvent) => void | Promise<void>;
7
8
  type: "onClick";
@@ -75,8 +75,10 @@ const MenuButton = ({ autoFocus = false, disabled = false, id, options, optionGr
75
75
  const renderOption = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((option, index)=>{
76
76
  if ("link" === option.type) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("li", {
77
77
  role: "option",
78
+ "aria-disabled": option.disabled,
78
79
  className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__MenuButton_module_js_872b1a55__["default"].listItem, {
79
- [__WEBPACK_EXTERNAL_MODULE__MenuButton_module_js_872b1a55__["default"].activeListItem]: activeIndex === index
80
+ [__WEBPACK_EXTERNAL_MODULE__MenuButton_module_js_872b1a55__["default"].active]: activeIndex === index,
81
+ [__WEBPACK_EXTERNAL_MODULE__MenuButton_module_js_872b1a55__["default"].disabled]: option.disabled
80
82
  }),
81
83
  ...getItemProps({
82
84
  ref: (node)=>{
@@ -85,16 +87,22 @@ const MenuButton = ({ autoFocus = false, disabled = false, id, options, optionGr
85
87
  }),
86
88
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(NextLink, {
87
89
  href: option.href,
90
+ "aria-disabled": option.disabled,
88
91
  children: option.label
89
92
  })
90
93
  }, option.id);
91
94
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("li", {
92
95
  role: "option",
96
+ "aria-disabled": option.disabled,
93
97
  className: (0, __WEBPACK_EXTERNAL_MODULE_clsx__["default"])(__WEBPACK_EXTERNAL_MODULE__MenuButton_module_js_872b1a55__["default"].listItem, {
94
- [__WEBPACK_EXTERNAL_MODULE__MenuButton_module_js_872b1a55__["default"].activeListItem]: activeIndex === index
98
+ [__WEBPACK_EXTERNAL_MODULE__MenuButton_module_js_872b1a55__["default"].active]: activeIndex === index,
99
+ [__WEBPACK_EXTERNAL_MODULE__MenuButton_module_js_872b1a55__["default"].disabled]: option.disabled
95
100
  }),
96
101
  ...getItemProps({
97
- onClick: "onClick" === option.type ? async (event)=>{
102
+ onClick: "onClick" !== option.type || option.disabled ? ()=>{
103
+ setIsOpen(false);
104
+ setOptionToRender(option);
105
+ } : async (event)=>{
98
106
  setIsOpen(false);
99
107
  try {
100
108
  setLoading(true);
@@ -114,9 +122,6 @@ const MenuButton = ({ autoFocus = false, disabled = false, id, options, optionGr
114
122
  ]);
115
123
  }
116
124
  setLoading(false);
117
- } : ()=>{
118
- setIsOpen(false);
119
- setOptionToRender(option);
120
125
  },
121
126
  ref: (node)=>{
122
127
  optionsRef.current[index] = node;
@@ -7,6 +7,7 @@ const MenuButton_module_rslib_entry_ = {
7
7
  listBox: "listBox-IanUVy",
8
8
  listItemGroupHeader: "listItemGroupHeader-ijzhOF",
9
9
  listItem: "listItem-PEQEDL",
10
- activeListItem: "activeListItem-iAlKFS"
10
+ active: "active-SH4mjY",
11
+ disabled: "disabled-c63Kbb"
11
12
  };
12
13
  export { MenuButton_module_rslib_entry_ as default };
@@ -81,7 +81,13 @@
81
81
  cursor: pointer;
82
82
  }
83
83
 
84
- .activeListItem-iAlKFS {
84
+ .listItem-PEQEDL.active-SH4mjY {
85
85
  background: var(--color-grey-t09);
86
86
  }
87
87
 
88
+ .listItem-PEQEDL.disabled-c63Kbb {
89
+ color: var(--theme-disabled);
90
+ cursor: default;
91
+ pointer-events: none;
92
+ }
93
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@worknice/whiteboard",
3
3
  "description": "",
4
- "version": "0.18.3",
4
+ "version": "0.18.5",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "files": [
@@ -38,7 +38,7 @@
38
38
  "react-markdown": "^10.1.0",
39
39
  "utf8": "^3.0.0",
40
40
  "zod": "^3.22.3",
41
- "@worknice/utils": "^0.6.69"
41
+ "@worknice/utils": "^0.6.71"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@anolilab/semantic-release-pnpm": "^1.1.10",