@onesy/ui-react 1.0.201 → 1.0.203
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/AutoComplete/AutoComplete.d.ts +2 -0
- package/AutoComplete/AutoComplete.js +32 -23
- package/AutoCompleteCountry/AutoCompleteCountry.js +1 -0
- package/AutoCompleteCurrency/AutoCompleteCurrency.js +1 -0
- package/ListItem/ListItem.js +4 -2
- package/MenuItem/MenuItem.js +1 -7
- package/esm/AutoComplete/AutoComplete.js +31 -22
- package/esm/AutoCompleteCountry/AutoCompleteCountry.js +1 -0
- package/esm/AutoCompleteCurrency/AutoCompleteCurrency.js +1 -0
- package/esm/ListItem/ListItem.js +4 -2
- package/esm/MenuItem/MenuItem.js +1 -7
- package/esm/index.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
|
@@ -47,6 +47,7 @@ export declare type IAutoComplete = Omit<ITextField, 'onChange'> & {
|
|
|
47
47
|
selectOnFocus?: boolean;
|
|
48
48
|
clearOnBlur?: boolean;
|
|
49
49
|
noInputValue?: boolean;
|
|
50
|
+
portal?: boolean;
|
|
50
51
|
IconClear?: IElementReference;
|
|
51
52
|
IconDropdown?: IElementReference;
|
|
52
53
|
WrapperProps?: IPropsAny;
|
|
@@ -56,6 +57,7 @@ export declare type IAutoComplete = Omit<ITextField, 'onChange'> & {
|
|
|
56
57
|
IconButtonProps?: IPropsAny;
|
|
57
58
|
InputProps?: IPropsAny;
|
|
58
59
|
IconProps?: IPropsAny;
|
|
60
|
+
TextFieldProps?: IPropsAny;
|
|
59
61
|
};
|
|
60
62
|
declare const AutoComplete: React.FC<IAutoComplete>;
|
|
61
63
|
export default AutoComplete;
|
|
@@ -24,7 +24,7 @@ var _ListSubheader = _interopRequireDefault(require("../ListSubheader"));
|
|
|
24
24
|
var _Line = _interopRequireDefault(require("../Line"));
|
|
25
25
|
var _utils2 = require("../utils");
|
|
26
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
-
const _excluded = ["ref", "tonal", "color", "size", "version", "valueInput", "valueInputDefault", "onChangeInput", "value", "valueDefault", "onChange", "options", "label", "multiple", "prefix", "sufix", "start", "end", "autoWidth", "readOnly", "getLabel", "renderValues", "renderChip", "renderOption", "equal", "equalInput", "filter", "clear", "loading", "autoSelectOnBlur", "blurOnSelect", "noOptions", "noOptionsObject", "startOptionsObject", "noOptionsElement", "startOptionsElement", "endOptionsElement", "endOptionsObject", "openOnFocus", "closeOnSelect", "clearOnEscape", "groupBy", "limit", "openOnInputUpdate", "filterOutSelectedOptions", "selectOnFocus", "clearOnBlur", "clearInputOnSelect", "chip", "fullWidth", "noInputValue", "disabled", "IconClear", "IconDropdown", "WrapperProps", "ChipProps", "ListProps", "MenuProps", "IconButtonProps", "InputProps", "IconProps", "className", "style", "children"];
|
|
27
|
+
const _excluded = ["ref", "tonal", "color", "size", "version", "valueInput", "valueInputDefault", "onChangeInput", "value", "valueDefault", "onChange", "options", "label", "multiple", "prefix", "sufix", "start", "end", "autoWidth", "readOnly", "getLabel", "renderValues", "renderChip", "renderOption", "equal", "equalInput", "filter", "clear", "loading", "autoSelectOnBlur", "blurOnSelect", "noOptions", "noOptionsObject", "startOptionsObject", "noOptionsElement", "startOptionsElement", "endOptionsElement", "endOptionsObject", "openOnFocus", "closeOnSelect", "clearOnEscape", "groupBy", "limit", "openOnInputUpdate", "filterOutSelectedOptions", "selectOnFocus", "clearOnBlur", "clearInputOnSelect", "chip", "fullWidth", "noInputValue", "disabled", "IconClear", "IconDropdown", "WrapperProps", "ChipProps", "ListProps", "MenuProps", "IconButtonProps", "InputProps", "IconProps", "TextFieldProps", "portal", "className", "style", "children"];
|
|
28
28
|
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; }
|
|
29
29
|
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; }
|
|
30
30
|
const useStyle = (0, _styleReact.style)(theme => ({
|
|
@@ -116,7 +116,7 @@ const getText = value => {
|
|
|
116
116
|
};
|
|
117
117
|
const getValue = value => (value === null || value === void 0 ? void 0 : value.value) !== undefined ? value.value : value;
|
|
118
118
|
const AutoComplete = props_ => {
|
|
119
|
-
var _theme$ui, _theme$ui2, _theme$elements, _theme$elements2, _theme$elements3, _theme$elements4, _theme$elements5, _theme$elements6, _theme$elements7, _theme$elements8, _theme$elements9, _theme$elements0;
|
|
119
|
+
var _theme$ui, _theme$ui2, _theme$elements, _theme$elements2, _theme$elements3, _theme$elements4, _theme$elements5, _theme$elements6, _theme$elements7, _theme$elements8, _theme$elements9, _theme$elements0, _props$MenuProps$port, _props$MenuProps, _TextFieldProps$Input, _MenuProps$ListProps, _MenuProps$ListProps2;
|
|
120
120
|
const theme = (0, _styleReact.useOnesyTheme)();
|
|
121
121
|
const l = theme.l;
|
|
122
122
|
const props = _objectSpread(_objectSpread(_objectSpread({}, theme === null || theme === void 0 || (_theme$ui = theme.ui) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.elements) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.all) === null || _theme$ui === void 0 || (_theme$ui = _theme$ui.props) === null || _theme$ui === void 0 ? void 0 : _theme$ui.default), theme === null || theme === void 0 || (_theme$ui2 = theme.ui) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.elements) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.onesyAutoComplete) === null || _theme$ui2 === void 0 || (_theme$ui2 = _theme$ui2.props) === null || _theme$ui2 === void 0 ? void 0 : _theme$ui2.default), props_);
|
|
@@ -192,6 +192,8 @@ const AutoComplete = props_ => {
|
|
|
192
192
|
IconButtonProps,
|
|
193
193
|
InputProps,
|
|
194
194
|
IconProps,
|
|
195
|
+
TextFieldProps,
|
|
196
|
+
portal = (_props$MenuProps$port = (_props$MenuProps = props.MenuProps) === null || _props$MenuProps === void 0 ? void 0 : _props$MenuProps.portal) !== null && _props$MenuProps$port !== void 0 ? _props$MenuProps$port : true,
|
|
195
197
|
className,
|
|
196
198
|
style,
|
|
197
199
|
children: children_
|
|
@@ -228,7 +230,7 @@ const AutoComplete = props_ => {
|
|
|
228
230
|
root: {},
|
|
229
231
|
menu: {}
|
|
230
232
|
};
|
|
231
|
-
if (
|
|
233
|
+
if (portal && autoWidth) {
|
|
232
234
|
var _refs$wrapper$current;
|
|
233
235
|
styles.menu.width = (_refs$wrapper$current = refs.wrapper.current) === null || _refs$wrapper$current === void 0 ? void 0 : _refs$wrapper$current.clientWidth;
|
|
234
236
|
}
|
|
@@ -594,7 +596,7 @@ const AutoComplete = props_ => {
|
|
|
594
596
|
fullWidth: fullWidth
|
|
595
597
|
}, WrapperProps), {}, {
|
|
596
598
|
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('AutoComplete', theme) && ['onesy-AutoComplete-wrapper', fullWidth && 'onesy-full-width'], WrapperProps === null || WrapperProps === void 0 ? void 0 : WrapperProps.className, classes.wrapper]),
|
|
597
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(TextField, _objectSpread(_objectSpread({
|
|
599
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(TextField, _objectSpread(_objectSpread(_objectSpread({
|
|
598
600
|
ref: refs.input,
|
|
599
601
|
rootRef: item_11 => {
|
|
600
602
|
if (ref) {
|
|
@@ -629,21 +631,22 @@ const AutoComplete = props_ => {
|
|
|
629
631
|
"aria-labelledby": label,
|
|
630
632
|
"aria-disabled": disabled,
|
|
631
633
|
fullWidth: fullWidth,
|
|
632
|
-
disabled: disabled
|
|
633
|
-
|
|
634
|
-
|
|
634
|
+
disabled: disabled
|
|
635
|
+
}, TextFieldProps), {}, {
|
|
636
|
+
InputWrapperProps: _objectSpread(_objectSpread({}, TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.InputWrapperProps), {}, {
|
|
637
|
+
className: (0, _styleReact.classNames)([(0, _utils2.staticClassName)('AutoComplete', theme) && ['onesy-AutoComplete-input-wrapper'], TextFieldProps === null || TextFieldProps === void 0 || (_TextFieldProps$Input = TextFieldProps.InputWrapperProps) === null || _TextFieldProps$Input === void 0 ? void 0 : _TextFieldProps$Input.className, classes.inputWrapper, multiple && [classes.multiple, classes[`inputWrapper_multiple_size_${size}`]], chip && classes.chip, open && classes.open, readOnly && classes.readOnly]),
|
|
635
638
|
onMouseDown,
|
|
636
639
|
onMouseUp,
|
|
637
640
|
onClick,
|
|
638
641
|
onKeyDown: onEnterKeyDown
|
|
639
|
-
},
|
|
640
|
-
inputProps: _objectSpread(_objectSpread({
|
|
642
|
+
}),
|
|
643
|
+
inputProps: _objectSpread(_objectSpread(_objectSpread({}, TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.inputProps), {}, {
|
|
641
644
|
disabled: multiple,
|
|
642
645
|
readOnly: multiple
|
|
643
646
|
}, InputProps), {}, {
|
|
644
647
|
className: (0, _styleReact.classNames)([InputProps === null || InputProps === void 0 ? void 0 : InputProps.className, multiple && classes.input_])
|
|
645
648
|
}),
|
|
646
|
-
style: _objectSpread(_objectSpread({}, styles.root), style)
|
|
649
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, styles.root), TextFieldProps === null || TextFieldProps === void 0 ? void 0 : TextFieldProps.style), style)
|
|
647
650
|
}, other), {}, {
|
|
648
651
|
children: [!noInputValue && multiple && !chip && !!value.length && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
649
652
|
ref: refs.value,
|
|
@@ -659,7 +662,9 @@ const AutoComplete = props_ => {
|
|
|
659
662
|
ref: refs.menu,
|
|
660
663
|
open: open && !!(menuItems !== null && menuItems !== void 0 && menuItems.length),
|
|
661
664
|
autoSelectOnBlur: autoSelectOnBlur,
|
|
662
|
-
portal:
|
|
665
|
+
portal: portal,
|
|
666
|
+
includeQueries: ['.onesy-more'],
|
|
667
|
+
includeParentQueries: ['.onesy-more'],
|
|
663
668
|
onClose: () => onClose(false),
|
|
664
669
|
anchorElement: refs.root.current,
|
|
665
670
|
onExited: onExited,
|
|
@@ -667,26 +672,30 @@ const AutoComplete = props_ => {
|
|
|
667
672
|
transformOrigin: "center top",
|
|
668
673
|
transformOriginSwitch: "center bottom",
|
|
669
674
|
maxWidth: "unset",
|
|
670
|
-
|
|
675
|
+
ignoreNonExisting: true
|
|
676
|
+
}, MenuProps), {}, {
|
|
677
|
+
AppendProps: _objectSpread({
|
|
671
678
|
alignment: 'start'
|
|
672
|
-
},
|
|
673
|
-
ModalProps: {
|
|
674
|
-
// focus: !MenuProps.portal
|
|
675
|
-
|
|
679
|
+
}, MenuProps === null || MenuProps === void 0 ? void 0 : MenuProps.AppendProps),
|
|
680
|
+
ModalProps: _objectSpread({
|
|
676
681
|
freezeScroll: false
|
|
677
|
-
},
|
|
678
|
-
ListProps: _objectSpread(_objectSpread({
|
|
682
|
+
}, MenuProps === null || MenuProps === void 0 ? void 0 : MenuProps.ModalProps),
|
|
683
|
+
ListProps: _objectSpread(_objectSpread(_objectSpread({
|
|
679
684
|
menu: true,
|
|
680
685
|
paddingVertical: (0, _utils.is)('function', groupBy) && !!options.length ? 'none' : undefined,
|
|
681
686
|
size,
|
|
682
687
|
role: 'listbox',
|
|
683
688
|
id: refs.ids.list,
|
|
684
689
|
'aria-label': label
|
|
685
|
-
}, ListProps), {}, {
|
|
686
|
-
className: (0, _styleReact.classNames)([ListProps === null || ListProps === void 0 ? void 0 : ListProps.className, classes.list])
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
+
}, MenuProps === null || MenuProps === void 0 ? void 0 : MenuProps.ListProps), ListProps), {}, {
|
|
691
|
+
className: (0, _styleReact.classNames)([MenuProps === null || MenuProps === void 0 || (_MenuProps$ListProps = MenuProps.ListProps) === null || _MenuProps$ListProps === void 0 ? void 0 : _MenuProps$ListProps.className, ListProps === null || ListProps === void 0 ? void 0 : ListProps.className, classes.list]),
|
|
692
|
+
style: _objectSpread(_objectSpread({
|
|
693
|
+
maxHeight: 250,
|
|
694
|
+
overflow: 'hidden auto',
|
|
695
|
+
overscrollBehavior: 'contain'
|
|
696
|
+
}, MenuProps === null || MenuProps === void 0 || (_MenuProps$ListProps2 = MenuProps.ListProps) === null || _MenuProps$ListProps2 === void 0 ? void 0 : _MenuProps$ListProps2.style), ListProps === null || ListProps === void 0 ? void 0 : ListProps.style)
|
|
697
|
+
}),
|
|
698
|
+
style: _objectSpread(_objectSpread({}, styles.menu), MenuProps === null || MenuProps === void 0 ? void 0 : MenuProps.style),
|
|
690
699
|
className: (0, _styleReact.classNames)([MenuProps === null || MenuProps === void 0 ? void 0 : MenuProps.className])
|
|
691
700
|
}))]
|
|
692
701
|
}));
|
|
@@ -66,6 +66,7 @@ const AutoCompleteCountry = props_ => {
|
|
|
66
66
|
return valueInputDefault_ !== undefined ? valueInputDefault_ : (_options$find = options.find(item_0 => item_0.value === (value !== undefined ? value : valueDefault))) === null || _options$find === void 0 ? void 0 : _options$find.name;
|
|
67
67
|
}, []);
|
|
68
68
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(AutoComplete, _objectSpread({
|
|
69
|
+
name: l('Select a country'),
|
|
69
70
|
valueInputDefault: valueInputDefault,
|
|
70
71
|
valueDefault: valueDefault,
|
|
71
72
|
value: value,
|
|
@@ -60,6 +60,7 @@ const AutoCompleteCurrency = props_ => {
|
|
|
60
60
|
return valueInputDefault_ !== undefined ? valueInputDefault_ : (_options$find = options.find(item_0 => item_0.value === (other.value !== undefined ? other.value : other.valueDefault))) === null || _options$find === void 0 ? void 0 : _options$find.name;
|
|
61
61
|
}, []);
|
|
62
62
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(AutoComplete, _objectSpread({
|
|
63
|
+
name: l('Select a currency'),
|
|
63
64
|
valueInputDefault: valueInputDefault,
|
|
64
65
|
options: options,
|
|
65
66
|
size: size,
|
package/ListItem/ListItem.js
CHANGED
|
@@ -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.
|
|
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:
|
|
354
|
+
preselected: preselected,
|
|
353
355
|
pulse: focus,
|
|
354
356
|
selected: selected,
|
|
355
357
|
disabled: disabled
|
package/MenuItem/MenuItem.js
CHANGED
|
@@ -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
|
},
|
|
@@ -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", "size", "version", "valueInput", "valueInputDefault", "onChangeInput", "value", "valueDefault", "onChange", "options", "label", "multiple", "prefix", "sufix", "start", "end", "autoWidth", "readOnly", "getLabel", "renderValues", "renderChip", "renderOption", "equal", "equalInput", "filter", "clear", "loading", "autoSelectOnBlur", "blurOnSelect", "noOptions", "noOptionsObject", "startOptionsObject", "noOptionsElement", "startOptionsElement", "endOptionsElement", "endOptionsObject", "openOnFocus", "closeOnSelect", "clearOnEscape", "groupBy", "limit", "openOnInputUpdate", "filterOutSelectedOptions", "selectOnFocus", "clearOnBlur", "clearInputOnSelect", "chip", "fullWidth", "noInputValue", "disabled", "IconClear", "IconDropdown", "WrapperProps", "ChipProps", "ListProps", "MenuProps", "IconButtonProps", "InputProps", "IconProps", "className", "style", "children"];
|
|
3
|
+
const _excluded = ["ref", "tonal", "color", "size", "version", "valueInput", "valueInputDefault", "onChangeInput", "value", "valueDefault", "onChange", "options", "label", "multiple", "prefix", "sufix", "start", "end", "autoWidth", "readOnly", "getLabel", "renderValues", "renderChip", "renderOption", "equal", "equalInput", "filter", "clear", "loading", "autoSelectOnBlur", "blurOnSelect", "noOptions", "noOptionsObject", "startOptionsObject", "noOptionsElement", "startOptionsElement", "endOptionsElement", "endOptionsObject", "openOnFocus", "closeOnSelect", "clearOnEscape", "groupBy", "limit", "openOnInputUpdate", "filterOutSelectedOptions", "selectOnFocus", "clearOnBlur", "clearInputOnSelect", "chip", "fullWidth", "noInputValue", "disabled", "IconClear", "IconDropdown", "WrapperProps", "ChipProps", "ListProps", "MenuProps", "IconButtonProps", "InputProps", "IconProps", "TextFieldProps", "portal", "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';
|
|
@@ -184,6 +184,8 @@ const AutoComplete = props_ => {
|
|
|
184
184
|
IconButtonProps,
|
|
185
185
|
InputProps,
|
|
186
186
|
IconProps,
|
|
187
|
+
TextFieldProps,
|
|
188
|
+
portal = props.MenuProps?.portal ?? true,
|
|
187
189
|
className,
|
|
188
190
|
style,
|
|
189
191
|
children: children_
|
|
@@ -220,7 +222,7 @@ const AutoComplete = props_ => {
|
|
|
220
222
|
root: {},
|
|
221
223
|
menu: {}
|
|
222
224
|
};
|
|
223
|
-
if (
|
|
225
|
+
if (portal && autoWidth) {
|
|
224
226
|
styles.menu.width = refs.wrapper.current?.clientWidth;
|
|
225
227
|
}
|
|
226
228
|
React.useEffect(() => {
|
|
@@ -574,7 +576,7 @@ const AutoComplete = props_ => {
|
|
|
574
576
|
fullWidth: fullWidth
|
|
575
577
|
}, WrapperProps), {}, {
|
|
576
578
|
className: classNames([staticClassName('AutoComplete', theme) && ['onesy-AutoComplete-wrapper', fullWidth && 'onesy-full-width'], WrapperProps?.className, classes.wrapper]),
|
|
577
|
-
children: [/*#__PURE__*/_jsxs(TextField, _objectSpread(_objectSpread({
|
|
579
|
+
children: [/*#__PURE__*/_jsxs(TextField, _objectSpread(_objectSpread(_objectSpread({
|
|
578
580
|
ref: refs.input,
|
|
579
581
|
rootRef: item_11 => {
|
|
580
582
|
if (ref) {
|
|
@@ -609,21 +611,22 @@ const AutoComplete = props_ => {
|
|
|
609
611
|
"aria-labelledby": label,
|
|
610
612
|
"aria-disabled": disabled,
|
|
611
613
|
fullWidth: fullWidth,
|
|
612
|
-
disabled: disabled
|
|
613
|
-
|
|
614
|
-
|
|
614
|
+
disabled: disabled
|
|
615
|
+
}, TextFieldProps), {}, {
|
|
616
|
+
InputWrapperProps: _objectSpread(_objectSpread({}, TextFieldProps?.InputWrapperProps), {}, {
|
|
617
|
+
className: classNames([staticClassName('AutoComplete', theme) && ['onesy-AutoComplete-input-wrapper'], TextFieldProps?.InputWrapperProps?.className, classes.inputWrapper, multiple && [classes.multiple, classes[`inputWrapper_multiple_size_${size}`]], chip && classes.chip, open && classes.open, readOnly && classes.readOnly]),
|
|
615
618
|
onMouseDown,
|
|
616
619
|
onMouseUp,
|
|
617
620
|
onClick,
|
|
618
621
|
onKeyDown: onEnterKeyDown
|
|
619
|
-
},
|
|
620
|
-
inputProps: _objectSpread(_objectSpread({
|
|
622
|
+
}),
|
|
623
|
+
inputProps: _objectSpread(_objectSpread(_objectSpread({}, TextFieldProps?.inputProps), {}, {
|
|
621
624
|
disabled: multiple,
|
|
622
625
|
readOnly: multiple
|
|
623
626
|
}, InputProps), {}, {
|
|
624
627
|
className: classNames([InputProps?.className, multiple && classes.input_])
|
|
625
628
|
}),
|
|
626
|
-
style: _objectSpread(_objectSpread({}, styles.root), style)
|
|
629
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, styles.root), TextFieldProps?.style), style)
|
|
627
630
|
}, other), {}, {
|
|
628
631
|
children: [!noInputValue && multiple && !chip && !!value.length && /*#__PURE__*/_jsx("div", {
|
|
629
632
|
ref: refs.value,
|
|
@@ -639,7 +642,9 @@ const AutoComplete = props_ => {
|
|
|
639
642
|
ref: refs.menu,
|
|
640
643
|
open: open && !!menuItems?.length,
|
|
641
644
|
autoSelectOnBlur: autoSelectOnBlur,
|
|
642
|
-
portal:
|
|
645
|
+
portal: portal,
|
|
646
|
+
includeQueries: ['.onesy-more'],
|
|
647
|
+
includeParentQueries: ['.onesy-more'],
|
|
643
648
|
onClose: () => onClose(false),
|
|
644
649
|
anchorElement: refs.root.current,
|
|
645
650
|
onExited: onExited,
|
|
@@ -647,26 +652,30 @@ const AutoComplete = props_ => {
|
|
|
647
652
|
transformOrigin: "center top",
|
|
648
653
|
transformOriginSwitch: "center bottom",
|
|
649
654
|
maxWidth: "unset",
|
|
650
|
-
|
|
655
|
+
ignoreNonExisting: true
|
|
656
|
+
}, MenuProps), {}, {
|
|
657
|
+
AppendProps: _objectSpread({
|
|
651
658
|
alignment: 'start'
|
|
652
|
-
},
|
|
653
|
-
ModalProps: {
|
|
654
|
-
// focus: !MenuProps.portal
|
|
655
|
-
|
|
659
|
+
}, MenuProps?.AppendProps),
|
|
660
|
+
ModalProps: _objectSpread({
|
|
656
661
|
freezeScroll: false
|
|
657
|
-
},
|
|
658
|
-
ListProps: _objectSpread(_objectSpread({
|
|
662
|
+
}, MenuProps?.ModalProps),
|
|
663
|
+
ListProps: _objectSpread(_objectSpread(_objectSpread({
|
|
659
664
|
menu: true,
|
|
660
665
|
paddingVertical: is('function', groupBy) && !!options.length ? 'none' : undefined,
|
|
661
666
|
size,
|
|
662
667
|
role: 'listbox',
|
|
663
668
|
id: refs.ids.list,
|
|
664
669
|
'aria-label': label
|
|
665
|
-
}, ListProps), {}, {
|
|
666
|
-
className: classNames([ListProps?.className, classes.list])
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
+
}, MenuProps?.ListProps), ListProps), {}, {
|
|
671
|
+
className: classNames([MenuProps?.ListProps?.className, ListProps?.className, classes.list]),
|
|
672
|
+
style: _objectSpread(_objectSpread({
|
|
673
|
+
maxHeight: 250,
|
|
674
|
+
overflow: 'hidden auto',
|
|
675
|
+
overscrollBehavior: 'contain'
|
|
676
|
+
}, MenuProps?.ListProps?.style), ListProps?.style)
|
|
677
|
+
}),
|
|
678
|
+
style: _objectSpread(_objectSpread({}, styles.menu), MenuProps?.style),
|
|
670
679
|
className: classNames([MenuProps?.className])
|
|
671
680
|
}))]
|
|
672
681
|
}));
|
|
@@ -57,6 +57,7 @@ const AutoCompleteCountry = props_ => {
|
|
|
57
57
|
return valueInputDefault_ !== undefined ? valueInputDefault_ : options.find(item_0 => item_0.value === (value !== undefined ? value : valueDefault))?.name;
|
|
58
58
|
}, []);
|
|
59
59
|
return /*#__PURE__*/_jsx(AutoComplete, _objectSpread({
|
|
60
|
+
name: l('Select a country'),
|
|
60
61
|
valueInputDefault: valueInputDefault,
|
|
61
62
|
valueDefault: valueDefault,
|
|
62
63
|
value: value,
|
|
@@ -51,6 +51,7 @@ const AutoCompleteCurrency = props_ => {
|
|
|
51
51
|
return valueInputDefault_ !== undefined ? valueInputDefault_ : options.find(item_0 => item_0.value === (other.value !== undefined ? other.value : other.valueDefault))?.name;
|
|
52
52
|
}, []);
|
|
53
53
|
return /*#__PURE__*/_jsx(AutoComplete, _objectSpread({
|
|
54
|
+
name: l('Select a currency'),
|
|
54
55
|
valueInputDefault: valueInputDefault,
|
|
55
56
|
options: options,
|
|
56
57
|
size: size,
|
package/esm/ListItem/ListItem.js
CHANGED
|
@@ -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.
|
|
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:
|
|
346
|
+
preselected: preselected,
|
|
345
347
|
pulse: focus,
|
|
346
348
|
selected: selected,
|
|
347
349
|
disabled: disabled
|
package/esm/MenuItem/MenuItem.js
CHANGED
|
@@ -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
package/index.js
CHANGED