@onesy/ui-react 1.0.201 → 1.0.202

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.
@@ -288,6 +288,7 @@ const ListItem = props_ => {
288
288
  } = useStyle();
289
289
  const [focus, setFocus] = _react.default.useState(focusProps !== undefined ? focusProps : false);
290
290
  const refs = {
291
+ wrapper: _react.default.useRef(undefined),
291
292
  root: _react.default.useRef(undefined),
292
293
  props: _react.default.useRef(undefined),
293
294
  ids: {
@@ -322,7 +323,7 @@ const ListItem = props_ => {
322
323
  if (ref) {
323
324
  if ((0, _utils.is)('function', ref)) ref(item);else if (ref !== null && ref !== void 0 && ref.current) ref.current = item;
324
325
  }
325
- refs.root.current = item;
326
+ refs.wrapper.current = item;
326
327
  },
327
328
  tonal: tonal,
328
329
  color: colorToUse,
@@ -336,6 +337,7 @@ const ListItem = props_ => {
336
337
  style: _objectSpread(_objectSpread({}, styles.wrapper), WrapperProps === null || WrapperProps === void 0 ? void 0 : WrapperProps.style)
337
338
  }, other), {}, {
338
339
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(RootComponent, _objectSpread(_objectSpread({
340
+ ref: refs.root,
339
341
  href: href,
340
342
  tabIndex: tabIndex !== undefined ? tabIndex : button && !(readOnly || disabled) ? 0 : undefined,
341
343
  onClick: onClick,
@@ -349,7 +351,7 @@ const ListItem = props_ => {
349
351
  disabled: disabled,
350
352
  children: [(href || button || interaction) && /*#__PURE__*/(0, _jsxRuntime.jsx)(Interaction, _objectSpread({
351
353
  border: false,
352
- preselected: (InteractionProps === null || InteractionProps === void 0 ? void 0 : InteractionProps.focus) || preselected || undefined,
354
+ preselected: preselected,
353
355
  pulse: focus,
354
356
  selected: selected,
355
357
  disabled: disabled
@@ -203,8 +203,6 @@ const MenuItem = props_ => {
203
203
  setOpenList(false);
204
204
  setHover(false);
205
205
  setFocus(false);
206
-
207
- // if (is('function', onClose_)) onClose_();
208
206
  }
209
207
  };
210
208
  const onCloseMenu = () => {
@@ -212,8 +210,6 @@ const MenuItem = props_ => {
212
210
  setOpenMenu(false);
213
211
  setHover(false);
214
212
  setFocus(false);
215
-
216
- // if (is('function', onClose_)) onClose_();
217
213
  }
218
214
  };
219
215
  ListTransitionComponentProps.in = !!openList;
@@ -241,11 +237,9 @@ const MenuItem = props_ => {
241
237
  onMouseLeave: onMouseLeave,
242
238
  "aria-haspopup": !!menu,
243
239
  "aria-expanded": openMenu,
240
+ button: !!onClick,
244
241
  menuItem: true,
245
242
  className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('MenuItem', theme) && ['onesy-MenuItem-root', `onesy-MenuItem-size-${size}`], classes.root]),
246
- InteractionProps: {
247
- focus
248
- },
249
243
  RootProps: {
250
244
  className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ListItem', theme) && [menu && `onesy-ListItem-menu`, list && `onesy-ListItem-list`, menuItem && `onesy-ListItem-menu-item`, menuOpen && `onesy-ListItem-menu-open`, openMenu && `onesy-ListItem-open-menu`, openList && `onesy-ListItem-open-list`, menuItem && [inset && `onesy-ListItem-menu-item-inset`]]])
251
245
  },
@@ -280,6 +280,7 @@ const ListItem = props_ => {
280
280
  } = useStyle();
281
281
  const [focus, setFocus] = React.useState(focusProps !== undefined ? focusProps : false);
282
282
  const refs = {
283
+ wrapper: React.useRef(undefined),
283
284
  root: React.useRef(undefined),
284
285
  props: React.useRef(undefined),
285
286
  ids: {
@@ -314,7 +315,7 @@ const ListItem = props_ => {
314
315
  if (ref) {
315
316
  if (is('function', ref)) ref(item);else if (ref?.current) ref.current = item;
316
317
  }
317
- refs.root.current = item;
318
+ refs.wrapper.current = item;
318
319
  },
319
320
  tonal: tonal,
320
321
  color: colorToUse,
@@ -328,6 +329,7 @@ const ListItem = props_ => {
328
329
  style: _objectSpread(_objectSpread({}, styles.wrapper), WrapperProps?.style)
329
330
  }, other), {}, {
330
331
  children: [/*#__PURE__*/_jsxs(RootComponent, _objectSpread(_objectSpread({
332
+ ref: refs.root,
331
333
  href: href,
332
334
  tabIndex: tabIndex !== undefined ? tabIndex : button && !(readOnly || disabled) ? 0 : undefined,
333
335
  onClick: onClick,
@@ -341,7 +343,7 @@ const ListItem = props_ => {
341
343
  disabled: disabled,
342
344
  children: [(href || button || interaction) && /*#__PURE__*/_jsx(Interaction, _objectSpread({
343
345
  border: false,
344
- preselected: InteractionProps?.focus || preselected || undefined,
346
+ preselected: preselected,
345
347
  pulse: focus,
346
348
  selected: selected,
347
349
  disabled: disabled
@@ -194,8 +194,6 @@ const MenuItem = props_ => {
194
194
  setOpenList(false);
195
195
  setHover(false);
196
196
  setFocus(false);
197
-
198
- // if (is('function', onClose_)) onClose_();
199
197
  }
200
198
  };
201
199
  const onCloseMenu = () => {
@@ -203,8 +201,6 @@ const MenuItem = props_ => {
203
201
  setOpenMenu(false);
204
202
  setHover(false);
205
203
  setFocus(false);
206
-
207
- // if (is('function', onClose_)) onClose_();
208
204
  }
209
205
  };
210
206
  ListTransitionComponentProps.in = !!openList;
@@ -232,11 +228,9 @@ const MenuItem = props_ => {
232
228
  onMouseLeave: onMouseLeave,
233
229
  "aria-haspopup": !!menu,
234
230
  "aria-expanded": openMenu,
231
+ button: !!onClick,
235
232
  menuItem: true,
236
233
  className: classNames([staticClassName('MenuItem', theme) && ['onesy-MenuItem-root', `onesy-MenuItem-size-${size}`], classes.root]),
237
- InteractionProps: {
238
- focus
239
- },
240
234
  RootProps: {
241
235
  className: classNames([staticClassName('ListItem', theme) && [menu && `onesy-ListItem-menu`, list && `onesy-ListItem-list`, menuItem && `onesy-ListItem-menu-item`, menuOpen && `onesy-ListItem-menu-open`, openMenu && `onesy-ListItem-open-menu`, openList && `onesy-ListItem-open-list`, menuItem && [inset && `onesy-ListItem-menu-item-inset`]]])
242
236
  },
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license UiReact v1.0.200
1
+ /** @license UiReact v1.0.201
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license UiReact v1.0.200
1
+ /** @license UiReact v1.0.201
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onesy/ui-react",
3
- "version": "1.0.201",
3
+ "version": "1.0.202",
4
4
  "description": "UI for React",
5
5
  "repository": "https://github.com/onesy-me/onesy.git",
6
6
  "author": "Lazar Erić <lazareric1@proton.me>",