@onesy/ui-react 1.0.199 → 1.0.200
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 +8 -8
- package/ListItem/ListItem.d.ts +1 -0
- package/ListItem/ListItem.js +19 -7
- package/esm/Button/Button.js +8 -8
- package/esm/ListItem/ListItem.js +19 -7
- package/esm/index.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
package/Button/Button.js
CHANGED
|
@@ -274,15 +274,15 @@ const Button = props_ => {
|
|
|
274
274
|
fab,
|
|
275
275
|
chip,
|
|
276
276
|
icon,
|
|
277
|
-
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:
|
|
285
|
-
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(
|
|
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 (
|
|
420
|
-
if ((0, _utils.is)('function',
|
|
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 (
|
|
424
|
-
if ((0, _utils.is)('function',
|
|
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/ListItem/ListItem.d.ts
CHANGED
package/ListItem/ListItem.js
CHANGED
|
@@ -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 => {
|
|
@@ -256,14 +256,16 @@ const ListItem = props_ => {
|
|
|
256
256
|
fullWidth = true,
|
|
257
257
|
noOutline,
|
|
258
258
|
noBackground,
|
|
259
|
+
focus: focusProps,
|
|
260
|
+
readOnly,
|
|
259
261
|
disabled,
|
|
260
262
|
onClick,
|
|
261
|
-
onFocus,
|
|
262
|
-
onBlur,
|
|
263
|
+
onFocus: onFocusProps,
|
|
264
|
+
onBlur: onBlurProps,
|
|
263
265
|
onMouseEnter,
|
|
264
266
|
onMouseLeave,
|
|
265
267
|
onClose: onClose_,
|
|
266
|
-
RootComponent:
|
|
268
|
+
RootComponent: RootComponentProps = 'div',
|
|
267
269
|
WrapperProps,
|
|
268
270
|
RootProps,
|
|
269
271
|
InteractionProps,
|
|
@@ -283,6 +285,7 @@ const ListItem = props_ => {
|
|
|
283
285
|
const {
|
|
284
286
|
classes
|
|
285
287
|
} = useStyle();
|
|
288
|
+
const [focus, setFocus] = _react.default.useState(focusProps !== undefined ? focusProps : false);
|
|
286
289
|
const refs = {
|
|
287
290
|
root: _react.default.useRef(undefined),
|
|
288
291
|
props: _react.default.useRef(undefined),
|
|
@@ -292,6 +295,14 @@ const ListItem = props_ => {
|
|
|
292
295
|
}
|
|
293
296
|
};
|
|
294
297
|
refs.props.current = props;
|
|
298
|
+
const onFocus = event => {
|
|
299
|
+
if (focusProps === undefined && event.target === refs.root.current && !disabled) setFocus(true);
|
|
300
|
+
if ((0, _utils.is)('function', onFocusProps)) onFocusProps(event);
|
|
301
|
+
};
|
|
302
|
+
const onBlur = event_0 => {
|
|
303
|
+
if (focusProps === undefined && !disabled) setFocus(false);
|
|
304
|
+
if ((0, _utils.is)('function', onBlurProps)) onBlurProps(event_0);
|
|
305
|
+
};
|
|
295
306
|
const styles = {
|
|
296
307
|
root: {},
|
|
297
308
|
icon: {
|
|
@@ -302,7 +313,7 @@ const ListItem = props_ => {
|
|
|
302
313
|
secondary: {},
|
|
303
314
|
tertiary: {}
|
|
304
315
|
};
|
|
305
|
-
let RootComponent =
|
|
316
|
+
let RootComponent = RootComponentProps;
|
|
306
317
|
if (href) RootComponent = 'a';
|
|
307
318
|
const colorToUse = selected ? colorSelected : color;
|
|
308
319
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Surface, _objectSpread(_objectSpread(_objectSpread({
|
|
@@ -314,7 +325,6 @@ const ListItem = props_ => {
|
|
|
314
325
|
},
|
|
315
326
|
tonal: tonal,
|
|
316
327
|
color: colorToUse,
|
|
317
|
-
tabIndex: tabIndex !== undefined ? tabIndex : button && !disabled ? 0 : undefined,
|
|
318
328
|
"aria-labelledby": refs.ids.primary,
|
|
319
329
|
"aria-describedby": refs.ids.secondary,
|
|
320
330
|
"aria-selected": selected,
|
|
@@ -326,18 +336,20 @@ const ListItem = props_ => {
|
|
|
326
336
|
}, other), {}, {
|
|
327
337
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(RootComponent, _objectSpread(_objectSpread({
|
|
328
338
|
href: href,
|
|
339
|
+
tabIndex: tabIndex !== undefined ? tabIndex : button && !(readOnly || disabled) ? 0 : undefined,
|
|
329
340
|
onClick: onClick,
|
|
330
341
|
onFocus: onFocus,
|
|
331
342
|
onBlur: onBlur,
|
|
332
343
|
onMouseEnter: onMouseEnter,
|
|
333
344
|
onMouseLeave: onMouseLeave
|
|
334
345
|
}, 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]),
|
|
346
|
+
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
347
|
style: _objectSpread(_objectSpread({}, style), styles.root),
|
|
337
348
|
disabled: disabled,
|
|
338
349
|
children: [(href || button || interaction) && /*#__PURE__*/(0, _jsxRuntime.jsx)(Interaction, _objectSpread({
|
|
339
350
|
border: false,
|
|
340
351
|
preselected: (InteractionProps === null || InteractionProps === void 0 ? void 0 : InteractionProps.focus) || preselected || undefined,
|
|
352
|
+
pulse: focus,
|
|
341
353
|
selected: selected,
|
|
342
354
|
disabled: disabled
|
|
343
355
|
}, InteractionProps)), start && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", _objectSpread(_objectSpread(_objectSpread({}, AsideProps), AsideStartProps), {}, {
|
package/esm/Button/Button.js
CHANGED
|
@@ -266,15 +266,15 @@ const Button = props_ => {
|
|
|
266
266
|
fab,
|
|
267
267
|
chip,
|
|
268
268
|
icon,
|
|
269
|
-
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:
|
|
277
|
-
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(
|
|
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 (
|
|
412
|
-
if (is('function',
|
|
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 (
|
|
416
|
-
if (is('function',
|
|
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({
|
package/esm/ListItem/ListItem.js
CHANGED
|
@@ -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';
|
|
@@ -248,14 +248,16 @@ const ListItem = props_ => {
|
|
|
248
248
|
fullWidth = true,
|
|
249
249
|
noOutline,
|
|
250
250
|
noBackground,
|
|
251
|
+
focus: focusProps,
|
|
252
|
+
readOnly,
|
|
251
253
|
disabled,
|
|
252
254
|
onClick,
|
|
253
|
-
onFocus,
|
|
254
|
-
onBlur,
|
|
255
|
+
onFocus: onFocusProps,
|
|
256
|
+
onBlur: onBlurProps,
|
|
255
257
|
onMouseEnter,
|
|
256
258
|
onMouseLeave,
|
|
257
259
|
onClose: onClose_,
|
|
258
|
-
RootComponent:
|
|
260
|
+
RootComponent: RootComponentProps = 'div',
|
|
259
261
|
WrapperProps,
|
|
260
262
|
RootProps,
|
|
261
263
|
InteractionProps,
|
|
@@ -275,6 +277,7 @@ const ListItem = props_ => {
|
|
|
275
277
|
const {
|
|
276
278
|
classes
|
|
277
279
|
} = useStyle();
|
|
280
|
+
const [focus, setFocus] = React.useState(focusProps !== undefined ? focusProps : false);
|
|
278
281
|
const refs = {
|
|
279
282
|
root: React.useRef(undefined),
|
|
280
283
|
props: React.useRef(undefined),
|
|
@@ -284,6 +287,14 @@ const ListItem = props_ => {
|
|
|
284
287
|
}
|
|
285
288
|
};
|
|
286
289
|
refs.props.current = props;
|
|
290
|
+
const onFocus = event => {
|
|
291
|
+
if (focusProps === undefined && event.target === refs.root.current && !disabled) setFocus(true);
|
|
292
|
+
if (is('function', onFocusProps)) onFocusProps(event);
|
|
293
|
+
};
|
|
294
|
+
const onBlur = event_0 => {
|
|
295
|
+
if (focusProps === undefined && !disabled) setFocus(false);
|
|
296
|
+
if (is('function', onBlurProps)) onBlurProps(event_0);
|
|
297
|
+
};
|
|
287
298
|
const styles = {
|
|
288
299
|
root: {},
|
|
289
300
|
icon: {
|
|
@@ -294,7 +305,7 @@ const ListItem = props_ => {
|
|
|
294
305
|
secondary: {},
|
|
295
306
|
tertiary: {}
|
|
296
307
|
};
|
|
297
|
-
let RootComponent =
|
|
308
|
+
let RootComponent = RootComponentProps;
|
|
298
309
|
if (href) RootComponent = 'a';
|
|
299
310
|
const colorToUse = selected ? colorSelected : color;
|
|
300
311
|
return /*#__PURE__*/_jsxs(Surface, _objectSpread(_objectSpread(_objectSpread({
|
|
@@ -306,7 +317,6 @@ const ListItem = props_ => {
|
|
|
306
317
|
},
|
|
307
318
|
tonal: tonal,
|
|
308
319
|
color: colorToUse,
|
|
309
|
-
tabIndex: tabIndex !== undefined ? tabIndex : button && !disabled ? 0 : undefined,
|
|
310
320
|
"aria-labelledby": refs.ids.primary,
|
|
311
321
|
"aria-describedby": refs.ids.secondary,
|
|
312
322
|
"aria-selected": selected,
|
|
@@ -318,18 +328,20 @@ const ListItem = props_ => {
|
|
|
318
328
|
}, other), {}, {
|
|
319
329
|
children: [/*#__PURE__*/_jsxs(RootComponent, _objectSpread(_objectSpread({
|
|
320
330
|
href: href,
|
|
331
|
+
tabIndex: tabIndex !== undefined ? tabIndex : button && !(readOnly || disabled) ? 0 : undefined,
|
|
321
332
|
onClick: onClick,
|
|
322
333
|
onFocus: onFocus,
|
|
323
334
|
onBlur: onBlur,
|
|
324
335
|
onMouseEnter: onMouseEnter,
|
|
325
336
|
onMouseLeave: onMouseLeave
|
|
326
337
|
}, 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]),
|
|
338
|
+
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
339
|
style: _objectSpread(_objectSpread({}, style), styles.root),
|
|
329
340
|
disabled: disabled,
|
|
330
341
|
children: [(href || button || interaction) && /*#__PURE__*/_jsx(Interaction, _objectSpread({
|
|
331
342
|
border: false,
|
|
332
343
|
preselected: InteractionProps?.focus || preselected || undefined,
|
|
344
|
+
pulse: focus,
|
|
333
345
|
selected: selected,
|
|
334
346
|
disabled: disabled
|
|
335
347
|
}, InteractionProps)), start && /*#__PURE__*/_jsx("span", _objectSpread(_objectSpread(_objectSpread({}, AsideProps), AsideStartProps), {}, {
|
package/esm/index.js
CHANGED
package/index.js
CHANGED