@onesy/ui-react 1.0.200 → 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.
package/Link/Link.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { IType } from '../Type/Type';
3
3
  export declare type ILink = IType & {
4
- underline?: true | 'hover';
4
+ underline?: boolean | 'hover';
5
5
  href?: string;
6
6
  target?: string;
7
7
  };
@@ -41,7 +41,8 @@ const useStyle = (0, _styleReact.style)(theme => {
41
41
  boxSizing: 'border-box',
42
42
  position: 'relative',
43
43
  display: 'inline-flex',
44
- width: '100%'
44
+ width: '100%',
45
+ textAlign: 'left'
45
46
  },
46
47
  shape_round_position_both: {
47
48
  borderRadius: theme.methods.shape.radius.value(40, 'px')
@@ -265,7 +266,7 @@ const ListItem = props_ => {
265
266
  onMouseEnter,
266
267
  onMouseLeave,
267
268
  onClose: onClose_,
268
- RootComponent: RootComponentProps = 'div',
269
+ RootComponent: RootComponentProps,
269
270
  WrapperProps,
270
271
  RootProps,
271
272
  InteractionProps,
@@ -287,6 +288,7 @@ const ListItem = props_ => {
287
288
  } = useStyle();
288
289
  const [focus, setFocus] = _react.default.useState(focusProps !== undefined ? focusProps : false);
289
290
  const refs = {
291
+ wrapper: _react.default.useRef(undefined),
290
292
  root: _react.default.useRef(undefined),
291
293
  props: _react.default.useRef(undefined),
292
294
  ids: {
@@ -313,7 +315,7 @@ const ListItem = props_ => {
313
315
  secondary: {},
314
316
  tertiary: {}
315
317
  };
316
- let RootComponent = RootComponentProps;
318
+ let RootComponent = RootComponentProps || (button || interaction ? 'button' : 'div');
317
319
  if (href) RootComponent = 'a';
318
320
  const colorToUse = selected ? colorSelected : color;
319
321
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Surface, _objectSpread(_objectSpread(_objectSpread({
@@ -321,7 +323,7 @@ const ListItem = props_ => {
321
323
  if (ref) {
322
324
  if ((0, _utils.is)('function', ref)) ref(item);else if (ref !== null && ref !== void 0 && ref.current) ref.current = item;
323
325
  }
324
- refs.root.current = item;
326
+ refs.wrapper.current = item;
325
327
  },
326
328
  tonal: tonal,
327
329
  color: colorToUse,
@@ -335,6 +337,7 @@ const ListItem = props_ => {
335
337
  style: _objectSpread(_objectSpread({}, styles.wrapper), WrapperProps === null || WrapperProps === void 0 ? void 0 : WrapperProps.style)
336
338
  }, other), {}, {
337
339
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(RootComponent, _objectSpread(_objectSpread({
340
+ ref: refs.root,
338
341
  href: href,
339
342
  tabIndex: tabIndex !== undefined ? tabIndex : button && !(readOnly || disabled) ? 0 : undefined,
340
343
  onClick: onClick,
@@ -348,7 +351,7 @@ const ListItem = props_ => {
348
351
  disabled: disabled,
349
352
  children: [(href || button || interaction) && /*#__PURE__*/(0, _jsxRuntime.jsx)(Interaction, _objectSpread({
350
353
  border: false,
351
- preselected: (InteractionProps === null || InteractionProps === void 0 ? void 0 : InteractionProps.focus) || preselected || undefined,
354
+ preselected: preselected,
352
355
  pulse: focus,
353
356
  selected: selected,
354
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
  },
@@ -34,7 +34,8 @@ const useStyle = styleMethod(theme => {
34
34
  boxSizing: 'border-box',
35
35
  position: 'relative',
36
36
  display: 'inline-flex',
37
- width: '100%'
37
+ width: '100%',
38
+ textAlign: 'left'
38
39
  },
39
40
  shape_round_position_both: {
40
41
  borderRadius: theme.methods.shape.radius.value(40, 'px')
@@ -257,7 +258,7 @@ const ListItem = props_ => {
257
258
  onMouseEnter,
258
259
  onMouseLeave,
259
260
  onClose: onClose_,
260
- RootComponent: RootComponentProps = 'div',
261
+ RootComponent: RootComponentProps,
261
262
  WrapperProps,
262
263
  RootProps,
263
264
  InteractionProps,
@@ -279,6 +280,7 @@ const ListItem = props_ => {
279
280
  } = useStyle();
280
281
  const [focus, setFocus] = React.useState(focusProps !== undefined ? focusProps : false);
281
282
  const refs = {
283
+ wrapper: React.useRef(undefined),
282
284
  root: React.useRef(undefined),
283
285
  props: React.useRef(undefined),
284
286
  ids: {
@@ -305,7 +307,7 @@ const ListItem = props_ => {
305
307
  secondary: {},
306
308
  tertiary: {}
307
309
  };
308
- let RootComponent = RootComponentProps;
310
+ let RootComponent = RootComponentProps || (button || interaction ? 'button' : 'div');
309
311
  if (href) RootComponent = 'a';
310
312
  const colorToUse = selected ? colorSelected : color;
311
313
  return /*#__PURE__*/_jsxs(Surface, _objectSpread(_objectSpread(_objectSpread({
@@ -313,7 +315,7 @@ const ListItem = props_ => {
313
315
  if (ref) {
314
316
  if (is('function', ref)) ref(item);else if (ref?.current) ref.current = item;
315
317
  }
316
- refs.root.current = item;
318
+ refs.wrapper.current = item;
317
319
  },
318
320
  tonal: tonal,
319
321
  color: colorToUse,
@@ -327,6 +329,7 @@ const ListItem = props_ => {
327
329
  style: _objectSpread(_objectSpread({}, styles.wrapper), WrapperProps?.style)
328
330
  }, other), {}, {
329
331
  children: [/*#__PURE__*/_jsxs(RootComponent, _objectSpread(_objectSpread({
332
+ ref: refs.root,
330
333
  href: href,
331
334
  tabIndex: tabIndex !== undefined ? tabIndex : button && !(readOnly || disabled) ? 0 : undefined,
332
335
  onClick: onClick,
@@ -340,7 +343,7 @@ const ListItem = props_ => {
340
343
  disabled: disabled,
341
344
  children: [(href || button || interaction) && /*#__PURE__*/_jsx(Interaction, _objectSpread({
342
345
  border: false,
343
- preselected: InteractionProps?.focus || preselected || undefined,
346
+ preselected: preselected,
344
347
  pulse: focus,
345
348
  selected: selected,
346
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.199
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.199
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.200",
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>",