@onesy/ui-react 1.0.199 → 1.0.201

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/Button/Button.js CHANGED
@@ -274,15 +274,15 @@ const Button = props_ => {
274
274
  fab,
275
275
  chip,
276
276
  icon,
277
- focus: focus_,
277
+ focus: focusProps,
278
278
  value,
279
279
  noIconRootFontSize,
280
280
  firstLevelChildren,
281
281
  noFontSize,
282
282
  readOnly,
283
283
  disabled: disabled_,
284
- onFocus: onFocus_,
285
- onBlur: onBlur_,
284
+ onFocus: onFocusProps,
285
+ onBlur: onBlurProps,
286
286
  IconWrapperComponent = 'span',
287
287
  InteractionProps = {},
288
288
  IconWrapperProps,
@@ -297,7 +297,7 @@ const Button = props_ => {
297
297
  const {
298
298
  classes
299
299
  } = useStyle();
300
- const [focus, setFocus] = _react.default.useState(focus_ !== undefined ? focus_ : false);
300
+ const [focus, setFocus] = _react.default.useState(focusProps !== undefined ? focusProps : false);
301
301
  const refs = {
302
302
  root: _react.default.useRef(undefined),
303
303
  ids: {
@@ -416,12 +416,12 @@ const Button = props_ => {
416
416
  delete styles.label.color;
417
417
  }
418
418
  const onFocus = event => {
419
- if (focus_ === undefined && event.target === refs.root.current && !disabled) setFocus(true);
420
- if ((0, _utils.is)('function', onFocus_)) onFocus_(event);
419
+ if (focusProps === undefined && event.target === refs.root.current && !disabled) setFocus(true);
420
+ if ((0, _utils.is)('function', onFocusProps)) onFocusProps(event);
421
421
  };
422
422
  const onBlur = event_0 => {
423
- if (focus_ === undefined && !disabled) setFocus(false);
424
- if ((0, _utils.is)('function', onBlur_)) onBlur_(event_0);
423
+ if (focusProps === undefined && !disabled) setFocus(false);
424
+ if ((0, _utils.is)('function', onBlurProps)) onBlurProps(event_0);
425
425
  };
426
426
  const IconElement = selected && iconSelected || children_;
427
427
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Surface, _objectSpread(_objectSpread({
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
  };
@@ -25,6 +25,7 @@ export declare type IListItem = ISurface & {
25
25
  noBackground?: boolean;
26
26
  noOutline?: boolean;
27
27
  fullWidth?: boolean;
28
+ focus?: boolean;
28
29
  value?: any;
29
30
  onClick?: (event: React.MouseEvent<any>) => any;
30
31
  onFocus?: (event: React.FocusEvent<any>) => any;
@@ -15,7 +15,7 @@ var _Interaction = _interopRequireDefault(require("../Interaction"));
15
15
  var _Type = _interopRequireDefault(require("../Type"));
16
16
  var _utils2 = require("../utils");
17
17
  var _jsxRuntime = require("react/jsx-runtime");
18
- const _excluded = ["ref", "tonal", "color", "colorSelected", "inset", "primary", "secondary", "tertiary", "preselected", "selected", "start", "startAlign", "end", "endAlign", "size", "noPadding", "href", "button", "shape", "shapePosition", "menuItem", "footer", "tabIndex", "interaction", "fullWidth", "noOutline", "noBackground", "disabled", "onClick", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "onClose", "RootComponent", "WrapperProps", "RootProps", "InteractionProps", "PrimaryProps", "SecondaryProps", "TertiaryProps", "MainProps", "AsideProps", "AsideStartProps", "AsideEndProps", "Component", "className", "style", "children"];
18
+ const _excluded = ["ref", "tonal", "color", "colorSelected", "inset", "primary", "secondary", "tertiary", "preselected", "selected", "start", "startAlign", "end", "endAlign", "size", "noPadding", "href", "button", "shape", "shapePosition", "menuItem", "footer", "tabIndex", "interaction", "fullWidth", "noOutline", "noBackground", "focus", "readOnly", "disabled", "onClick", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "onClose", "RootComponent", "WrapperProps", "RootProps", "InteractionProps", "PrimaryProps", "SecondaryProps", "TertiaryProps", "MainProps", "AsideProps", "AsideStartProps", "AsideEndProps", "Component", "className", "style", "children"];
19
19
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
20
20
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
21
21
  const useStyle = (0, _styleReact.style)(theme => {
@@ -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')
@@ -256,14 +257,16 @@ const ListItem = props_ => {
256
257
  fullWidth = true,
257
258
  noOutline,
258
259
  noBackground,
260
+ focus: focusProps,
261
+ readOnly,
259
262
  disabled,
260
263
  onClick,
261
- onFocus,
262
- onBlur,
264
+ onFocus: onFocusProps,
265
+ onBlur: onBlurProps,
263
266
  onMouseEnter,
264
267
  onMouseLeave,
265
268
  onClose: onClose_,
266
- RootComponent: RootComponent_ = 'div',
269
+ RootComponent: RootComponentProps,
267
270
  WrapperProps,
268
271
  RootProps,
269
272
  InteractionProps,
@@ -283,6 +286,7 @@ const ListItem = props_ => {
283
286
  const {
284
287
  classes
285
288
  } = useStyle();
289
+ const [focus, setFocus] = _react.default.useState(focusProps !== undefined ? focusProps : false);
286
290
  const refs = {
287
291
  root: _react.default.useRef(undefined),
288
292
  props: _react.default.useRef(undefined),
@@ -292,6 +296,14 @@ const ListItem = props_ => {
292
296
  }
293
297
  };
294
298
  refs.props.current = props;
299
+ const onFocus = event => {
300
+ if (focusProps === undefined && event.target === refs.root.current && !disabled) setFocus(true);
301
+ if ((0, _utils.is)('function', onFocusProps)) onFocusProps(event);
302
+ };
303
+ const onBlur = event_0 => {
304
+ if (focusProps === undefined && !disabled) setFocus(false);
305
+ if ((0, _utils.is)('function', onBlurProps)) onBlurProps(event_0);
306
+ };
295
307
  const styles = {
296
308
  root: {},
297
309
  icon: {
@@ -302,7 +314,7 @@ const ListItem = props_ => {
302
314
  secondary: {},
303
315
  tertiary: {}
304
316
  };
305
- let RootComponent = RootComponent_;
317
+ let RootComponent = RootComponentProps || (button || interaction ? 'button' : 'div');
306
318
  if (href) RootComponent = 'a';
307
319
  const colorToUse = selected ? colorSelected : color;
308
320
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Surface, _objectSpread(_objectSpread(_objectSpread({
@@ -314,7 +326,6 @@ const ListItem = props_ => {
314
326
  },
315
327
  tonal: tonal,
316
328
  color: colorToUse,
317
- tabIndex: tabIndex !== undefined ? tabIndex : button && !disabled ? 0 : undefined,
318
329
  "aria-labelledby": refs.ids.primary,
319
330
  "aria-describedby": refs.ids.secondary,
320
331
  "aria-selected": selected,
@@ -326,18 +337,20 @@ const ListItem = props_ => {
326
337
  }, other), {}, {
327
338
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(RootComponent, _objectSpread(_objectSpread({
328
339
  href: href,
340
+ tabIndex: tabIndex !== undefined ? tabIndex : button && !(readOnly || disabled) ? 0 : undefined,
329
341
  onClick: onClick,
330
342
  onFocus: onFocus,
331
343
  onBlur: onBlur,
332
344
  onMouseEnter: onMouseEnter,
333
345
  onMouseLeave: onMouseLeave
334
346
  }, RootProps), {}, {
335
- className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ListItem', theme) && ['onesy-ListItem-root', `onesy-ListItem-size-${size}`, preselected && `onesy-ListItem-preselected`, selected && `onesy-ListItem-selected`, disabled && `onesy-ListItem-disabled`, inset && !start && `onesy-ListItem-inset`], RootProps === null || RootProps === void 0 ? void 0 : RootProps.className, classes.root, !menuItem && classes[`size_${size}`], classes[`shape_${shape}_position_${shapePosition}`], inset && !start && classes[`inset_size_${size}`], menuItem && [classes[`menuItem_size_${size}`], inset && classes[`menuItem_inset_size_${size}`]], (href || button) && classes.button, noPadding && classes.noPadding, disabled && classes.disabled]),
347
+ className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('ListItem', theme) && ['onesy-ListItem-root', `onesy-ListItem-size-${size}`, preselected && `onesy-ListItem-preselected`, selected && `onesy-ListItem-selected`, readOnly && `onesy-ListItem-readOnly`, disabled && `onesy-ListItem-disabled`, inset && !start && `onesy-ListItem-inset`], RootProps === null || RootProps === void 0 ? void 0 : RootProps.className, classes.root, !menuItem && classes[`size_${size}`], classes[`shape_${shape}_position_${shapePosition}`], inset && !start && classes[`inset_size_${size}`], menuItem && [classes[`menuItem_size_${size}`], inset && classes[`menuItem_inset_size_${size}`]], (href || button) && classes.button, noPadding && classes.noPadding, disabled && classes.disabled]),
336
348
  style: _objectSpread(_objectSpread({}, style), styles.root),
337
349
  disabled: disabled,
338
350
  children: [(href || button || interaction) && /*#__PURE__*/(0, _jsxRuntime.jsx)(Interaction, _objectSpread({
339
351
  border: false,
340
352
  preselected: (InteractionProps === null || InteractionProps === void 0 ? void 0 : InteractionProps.focus) || preselected || undefined,
353
+ pulse: focus,
341
354
  selected: selected,
342
355
  disabled: disabled
343
356
  }, InteractionProps)), start && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", _objectSpread(_objectSpread(_objectSpread({}, AsideProps), AsideStartProps), {}, {
@@ -266,15 +266,15 @@ const Button = props_ => {
266
266
  fab,
267
267
  chip,
268
268
  icon,
269
- focus: focus_,
269
+ focus: focusProps,
270
270
  value,
271
271
  noIconRootFontSize,
272
272
  firstLevelChildren,
273
273
  noFontSize,
274
274
  readOnly,
275
275
  disabled: disabled_,
276
- onFocus: onFocus_,
277
- onBlur: onBlur_,
276
+ onFocus: onFocusProps,
277
+ onBlur: onBlurProps,
278
278
  IconWrapperComponent = 'span',
279
279
  InteractionProps = {},
280
280
  IconWrapperProps,
@@ -289,7 +289,7 @@ const Button = props_ => {
289
289
  const {
290
290
  classes
291
291
  } = useStyle();
292
- const [focus, setFocus] = React.useState(focus_ !== undefined ? focus_ : false);
292
+ const [focus, setFocus] = React.useState(focusProps !== undefined ? focusProps : false);
293
293
  const refs = {
294
294
  root: React.useRef(undefined),
295
295
  ids: {
@@ -408,12 +408,12 @@ const Button = props_ => {
408
408
  delete styles.label.color;
409
409
  }
410
410
  const onFocus = event => {
411
- if (focus_ === undefined && event.target === refs.root.current && !disabled) setFocus(true);
412
- if (is('function', onFocus_)) onFocus_(event);
411
+ if (focusProps === undefined && event.target === refs.root.current && !disabled) setFocus(true);
412
+ if (is('function', onFocusProps)) onFocusProps(event);
413
413
  };
414
414
  const onBlur = event_0 => {
415
- if (focus_ === undefined && !disabled) setFocus(false);
416
- if (is('function', onBlur_)) onBlur_(event_0);
415
+ if (focusProps === undefined && !disabled) setFocus(false);
416
+ if (is('function', onBlurProps)) onBlurProps(event_0);
417
417
  };
418
418
  const IconElement = selected && iconSelected || children_;
419
419
  return /*#__PURE__*/_jsxs(Surface, _objectSpread(_objectSpread({
@@ -1,6 +1,6 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- const _excluded = ["ref", "tonal", "color", "colorSelected", "inset", "primary", "secondary", "tertiary", "preselected", "selected", "start", "startAlign", "end", "endAlign", "size", "noPadding", "href", "button", "shape", "shapePosition", "menuItem", "footer", "tabIndex", "interaction", "fullWidth", "noOutline", "noBackground", "disabled", "onClick", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "onClose", "RootComponent", "WrapperProps", "RootProps", "InteractionProps", "PrimaryProps", "SecondaryProps", "TertiaryProps", "MainProps", "AsideProps", "AsideStartProps", "AsideEndProps", "Component", "className", "style", "children"];
3
+ const _excluded = ["ref", "tonal", "color", "colorSelected", "inset", "primary", "secondary", "tertiary", "preselected", "selected", "start", "startAlign", "end", "endAlign", "size", "noPadding", "href", "button", "shape", "shapePosition", "menuItem", "footer", "tabIndex", "interaction", "fullWidth", "noOutline", "noBackground", "focus", "readOnly", "disabled", "onClick", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "onClose", "RootComponent", "WrapperProps", "RootProps", "InteractionProps", "PrimaryProps", "SecondaryProps", "TertiaryProps", "MainProps", "AsideProps", "AsideStartProps", "AsideEndProps", "Component", "className", "style", "children"];
4
4
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
5
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
6
  import React from 'react';
@@ -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')
@@ -248,14 +249,16 @@ const ListItem = props_ => {
248
249
  fullWidth = true,
249
250
  noOutline,
250
251
  noBackground,
252
+ focus: focusProps,
253
+ readOnly,
251
254
  disabled,
252
255
  onClick,
253
- onFocus,
254
- onBlur,
256
+ onFocus: onFocusProps,
257
+ onBlur: onBlurProps,
255
258
  onMouseEnter,
256
259
  onMouseLeave,
257
260
  onClose: onClose_,
258
- RootComponent: RootComponent_ = 'div',
261
+ RootComponent: RootComponentProps,
259
262
  WrapperProps,
260
263
  RootProps,
261
264
  InteractionProps,
@@ -275,6 +278,7 @@ const ListItem = props_ => {
275
278
  const {
276
279
  classes
277
280
  } = useStyle();
281
+ const [focus, setFocus] = React.useState(focusProps !== undefined ? focusProps : false);
278
282
  const refs = {
279
283
  root: React.useRef(undefined),
280
284
  props: React.useRef(undefined),
@@ -284,6 +288,14 @@ const ListItem = props_ => {
284
288
  }
285
289
  };
286
290
  refs.props.current = props;
291
+ const onFocus = event => {
292
+ if (focusProps === undefined && event.target === refs.root.current && !disabled) setFocus(true);
293
+ if (is('function', onFocusProps)) onFocusProps(event);
294
+ };
295
+ const onBlur = event_0 => {
296
+ if (focusProps === undefined && !disabled) setFocus(false);
297
+ if (is('function', onBlurProps)) onBlurProps(event_0);
298
+ };
287
299
  const styles = {
288
300
  root: {},
289
301
  icon: {
@@ -294,7 +306,7 @@ const ListItem = props_ => {
294
306
  secondary: {},
295
307
  tertiary: {}
296
308
  };
297
- let RootComponent = RootComponent_;
309
+ let RootComponent = RootComponentProps || (button || interaction ? 'button' : 'div');
298
310
  if (href) RootComponent = 'a';
299
311
  const colorToUse = selected ? colorSelected : color;
300
312
  return /*#__PURE__*/_jsxs(Surface, _objectSpread(_objectSpread(_objectSpread({
@@ -306,7 +318,6 @@ const ListItem = props_ => {
306
318
  },
307
319
  tonal: tonal,
308
320
  color: colorToUse,
309
- tabIndex: tabIndex !== undefined ? tabIndex : button && !disabled ? 0 : undefined,
310
321
  "aria-labelledby": refs.ids.primary,
311
322
  "aria-describedby": refs.ids.secondary,
312
323
  "aria-selected": selected,
@@ -318,18 +329,20 @@ const ListItem = props_ => {
318
329
  }, other), {}, {
319
330
  children: [/*#__PURE__*/_jsxs(RootComponent, _objectSpread(_objectSpread({
320
331
  href: href,
332
+ tabIndex: tabIndex !== undefined ? tabIndex : button && !(readOnly || disabled) ? 0 : undefined,
321
333
  onClick: onClick,
322
334
  onFocus: onFocus,
323
335
  onBlur: onBlur,
324
336
  onMouseEnter: onMouseEnter,
325
337
  onMouseLeave: onMouseLeave
326
338
  }, RootProps), {}, {
327
- className: classNames([staticClassName('ListItem', theme) && ['onesy-ListItem-root', `onesy-ListItem-size-${size}`, preselected && `onesy-ListItem-preselected`, selected && `onesy-ListItem-selected`, disabled && `onesy-ListItem-disabled`, inset && !start && `onesy-ListItem-inset`], RootProps?.className, classes.root, !menuItem && classes[`size_${size}`], classes[`shape_${shape}_position_${shapePosition}`], inset && !start && classes[`inset_size_${size}`], menuItem && [classes[`menuItem_size_${size}`], inset && classes[`menuItem_inset_size_${size}`]], (href || button) && classes.button, noPadding && classes.noPadding, disabled && classes.disabled]),
339
+ className: classNames([staticClassName('ListItem', theme) && ['onesy-ListItem-root', `onesy-ListItem-size-${size}`, preselected && `onesy-ListItem-preselected`, selected && `onesy-ListItem-selected`, readOnly && `onesy-ListItem-readOnly`, disabled && `onesy-ListItem-disabled`, inset && !start && `onesy-ListItem-inset`], RootProps?.className, classes.root, !menuItem && classes[`size_${size}`], classes[`shape_${shape}_position_${shapePosition}`], inset && !start && classes[`inset_size_${size}`], menuItem && [classes[`menuItem_size_${size}`], inset && classes[`menuItem_inset_size_${size}`]], (href || button) && classes.button, noPadding && classes.noPadding, disabled && classes.disabled]),
328
340
  style: _objectSpread(_objectSpread({}, style), styles.root),
329
341
  disabled: disabled,
330
342
  children: [(href || button || interaction) && /*#__PURE__*/_jsx(Interaction, _objectSpread({
331
343
  border: false,
332
344
  preselected: InteractionProps?.focus || preselected || undefined,
345
+ pulse: focus,
333
346
  selected: selected,
334
347
  disabled: disabled
335
348
  }, InteractionProps)), start && /*#__PURE__*/_jsx("span", _objectSpread(_objectSpread(_objectSpread({}, AsideProps), AsideStartProps), {}, {
package/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license UiReact v1.0.198
1
+ /** @license UiReact v1.0.200
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.198
1
+ /** @license UiReact v1.0.200
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.199",
3
+ "version": "1.0.201",
4
4
  "description": "UI for React",
5
5
  "repository": "https://github.com/onesy-me/onesy.git",
6
6
  "author": "Lazar Erić <lazareric1@proton.me>",