@mezzanine-ui/react 0.9.2 → 0.10.2
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/Accordion/Accordion.js +5 -4
- package/Accordion/AccordionDetails.js +2 -2
- package/Accordion/AccordionSummary.js +3 -4
- package/Alert/Alert.js +1 -3
- package/AppBar/AppBar.js +1 -1
- package/AppBar/AppBarBrand.d.ts +1 -1
- package/AppBar/AppBarBrand.js +1 -1
- package/AppBar/AppBarMain.d.ts +1 -1
- package/AppBar/AppBarMain.js +1 -1
- package/AppBar/AppBarSupport.d.ts +1 -1
- package/AppBar/AppBarSupport.js +1 -1
- package/Badge/Badge.js +2 -2
- package/Badge/BadgeContainer.d.ts +1 -1
- package/Badge/BadgeContainer.js +1 -1
- package/Button/Button.d.ts +2 -2
- package/Button/Button.js +7 -5
- package/Button/ButtonGroup.js +7 -5
- package/Button/IconButton.d.ts +3 -3
- package/Button/IconButton.js +1 -1
- package/Calendar/Calendar.js +9 -10
- package/Calendar/CalendarCell.js +2 -2
- package/Calendar/CalendarContext.d.ts +3 -3
- package/Calendar/CalendarContext.js +20 -12
- package/Calendar/CalendarControls.js +3 -3
- package/Calendar/CalendarDayOfWeek.js +1 -1
- package/Calendar/CalendarDays.js +4 -5
- package/Calendar/CalendarMonths.js +4 -4
- package/Calendar/CalendarWeeks.js +4 -5
- package/Calendar/CalendarYears.js +4 -4
- package/Calendar/useCalendarControls.d.ts +2 -3
- package/Card/Card.js +5 -5
- package/Card/CardActions.js +1 -2
- package/Checkbox/CheckAll.js +2 -2
- package/Checkbox/Checkbox.js +5 -3
- package/Checkbox/CheckboxGroup.js +5 -5
- package/ConfirmActions/ConfirmActions.js +1 -2
- package/DatePicker/DatePicker.js +2 -3
- package/DatePicker/DatePickerCalendar.js +1 -1
- package/DateRangePicker/DateRangePicker.js +2 -3
- package/DateRangePicker/DateRangePickerCalendar.js +3 -4
- package/DateRangePicker/useDateRangeCalendarControls.d.ts +1 -2
- package/DateRangePicker/useDateRangePickerValue.d.ts +12 -13
- package/DateTimePicker/DateTimePicker.js +2 -3
- package/DateTimePicker/DateTimePickerPanel.js +1 -3
- package/Drawer/Drawer.js +1 -1
- package/Dropdown/Dropdown.d.ts +1 -1
- package/Dropdown/Dropdown.js +2 -2
- package/Empty/Empty.js +3 -4
- package/Form/FormField.js +2 -2
- package/Form/FormLabel.js +1 -2
- package/Form/FormMessage.d.ts +1 -1
- package/Form/FormMessage.js +1 -1
- package/Form/useAutoCompleteValueControl.d.ts +30 -11
- package/Form/useAutoCompleteValueControl.js +71 -31
- package/Form/useInputWithTagsModeValue.js +2 -1
- package/Form/useSelectValueControl.d.ts +1 -1
- package/Icon/Icon.d.ts +4 -0
- package/Icon/Icon.js +4 -4
- package/Input/Input.d.ts +1 -1
- package/Input/Input.js +5 -4
- package/Loading/Loading.js +4 -5
- package/Menu/Menu.js +5 -3
- package/Menu/MenuDivider.d.ts +1 -1
- package/Menu/MenuDivider.js +1 -1
- package/Menu/MenuItem.js +2 -3
- package/Menu/MenuItemGroup.js +1 -2
- package/Message/Message.js +2 -3
- package/Modal/Modal.js +5 -5
- package/Modal/ModalActions.js +1 -1
- package/Modal/ModalBody.d.ts +1 -1
- package/Modal/ModalBody.js +1 -1
- package/Modal/ModalFooter.d.ts +1 -1
- package/Modal/ModalFooter.js +1 -1
- package/Modal/ModalHeader.js +2 -3
- package/Modal/useModalContainer.js +1 -1
- package/Navigation/Navigation.js +2 -2
- package/Navigation/NavigationItem.js +1 -1
- package/Navigation/NavigationSubMenu.js +3 -5
- package/Notification/Notification.js +2 -7
- package/Notifier/NotifierManager.js +1 -1
- package/Notifier/createNotifier.js +1 -1
- package/Overlay/Overlay.js +3 -3
- package/PageFooter/PageFooter.js +1 -2
- package/Pagination/Pagination.js +2 -3
- package/Pagination/PaginationItem.js +4 -4
- package/Pagination/PaginationJumper.js +2 -4
- package/Picker/PickerTrigger.d.ts +1 -1
- package/Picker/PickerTrigger.js +2 -2
- package/Picker/RangePickerTrigger.d.ts +1 -1
- package/Picker/RangePickerTrigger.js +2 -4
- package/Picker/usePickerInputValue.d.ts +2 -2
- package/Picker/usePickerValue.d.ts +6 -7
- package/Picker/useRangePickerValue.d.ts +9 -10
- package/Popconfirm/Popconfirm.js +1 -1
- package/Popover/Popover.js +2 -3
- package/Popper/Popper.js +2 -2
- package/Portal/Portal.js +1 -1
- package/Progress/Progress.js +9 -9
- package/Provider/ConfigProvider.d.ts +8 -0
- package/Provider/ConfigProvider.js +13 -0
- package/Provider/context.d.ts +6 -0
- package/Provider/context.js +7 -0
- package/Provider/index.d.ts +4 -0
- package/Provider/index.js +2 -0
- package/Radio/Radio.js +5 -3
- package/Radio/RadioGroup.js +5 -5
- package/Select/AutoComplete.d.ts +40 -14
- package/Select/AutoComplete.js +37 -28
- package/Select/Option.js +2 -2
- package/Select/Select.d.ts +2 -51
- package/Select/Select.js +15 -49
- package/Select/SelectTrigger.d.ts +8 -1
- package/Select/SelectTrigger.js +8 -12
- package/Select/SelectTriggerTags.d.ts +19 -0
- package/Select/SelectTriggerTags.js +33 -0
- package/Select/TreeSelect.js +3 -4
- package/Select/index.d.ts +1 -0
- package/Select/index.js +1 -0
- package/Select/useSelectTriggerTags.d.ts +19 -0
- package/Select/useSelectTriggerTags.js +61 -0
- package/Skeleton/Skeleton.js +1 -1
- package/Slider/Slider.d.ts +1 -1
- package/Slider/Slider.js +7 -11
- package/Stepper/Step.js +2 -2
- package/Stepper/Stepper.js +1 -1
- package/Switch/Switch.js +2 -3
- package/Table/Table.d.ts +1 -1
- package/Table/Table.js +3 -10
- package/Table/TableBody.js +2 -4
- package/Table/TableBodyRow.js +4 -7
- package/Table/TableCell.js +3 -3
- package/Table/TableExpandedTable.js +5 -6
- package/Table/TableHeader.d.ts +2 -1
- package/Table/TableHeader.js +3 -6
- package/Table/editable/TableEditRenderWrapper.js +2 -2
- package/Table/expandable/TableExpandable.js +2 -2
- package/Table/pagination/TablePagination.js +1 -2
- package/Table/refresh/TableRefresh.js +1 -1
- package/Table/rowSelection/TableRowSelection.js +5 -6
- package/Table/sorting/TableSortingIcon.js +2 -2
- package/Table/sorting/useTableSorting.d.ts +2 -2
- package/Table/useTableScroll.d.ts +178 -178
- package/Tabs/Tab.js +2 -2
- package/Tabs/TabPane.js +1 -1
- package/Tabs/Tabs.js +1 -3
- package/Tag/Tag.js +7 -6
- package/TextField/TextField.js +7 -5
- package/TextField/useTextFieldControl.d.ts +2 -2
- package/Textarea/Textarea.d.ts +1 -1
- package/Textarea/Textarea.js +5 -4
- package/TimePanel/TimePanel.js +1 -4
- package/TimePanel/TimePanelAction.js +1 -1
- package/TimePanel/TimePanelColumn.js +2 -5
- package/TimePicker/TimePicker.js +2 -3
- package/TimePicker/TimePickerPanel.js +1 -1
- package/Tooltip/Tooltip.js +3 -3
- package/Transition/Collapse.js +3 -2
- package/Transition/Fade.js +2 -2
- package/Transition/Grow.js +3 -2
- package/Transition/SlideFade.js +2 -2
- package/Transition/Transition.js +2 -2
- package/Transition/Zoom.js +2 -2
- package/Tree/Tree.js +1 -1
- package/Tree/TreeNode.js +9 -9
- package/Tree/TreeNodeList.js +5 -4
- package/Tree/getTreeNodeEntities.js +6 -3
- package/Typography/Typography.d.ts +2 -2
- package/Typography/Typography.js +2 -2
- package/Upload/UploadButton.js +2 -2
- package/Upload/UploadInput.js +1 -1
- package/Upload/UploadPicture.js +1 -1
- package/Upload/UploadPictureBlock.js +2 -8
- package/Upload/UploadPictureWall.d.ts +1 -1
- package/Upload/UploadPictureWall.js +1 -2
- package/Upload/UploadPictureWallItem.js +1 -1
- package/Upload/UploadResult.d.ts +19 -0
- package/Upload/UploadResult.js +6 -7
- package/_internal/InputCheck/InputCheck.js +2 -3
- package/_internal/InputCheck/InputCheckGroup.js +1 -1
- package/_internal/InputTriggerPopper/InputTriggerPopper.js +2 -2
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.js +1 -1
- package/index.d.ts +3 -1
- package/index.js +3 -0
- package/package.json +12 -12
package/Form/FormMessage.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export declare type FormMessageProps = NativeElementPropsWithoutKeyAndRef<'span'
|
|
|
4
4
|
/**
|
|
5
5
|
* The react component for `mezzanine` form message.
|
|
6
6
|
*/
|
|
7
|
-
declare const FormMessage: import("react").ForwardRefExoticComponent<
|
|
7
|
+
declare const FormMessage: import("react").ForwardRefExoticComponent<FormMessageProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
8
8
|
export default FormMessage;
|
package/Form/FormMessage.js
CHANGED
|
@@ -12,7 +12,7 @@ const FormMessage = forwardRef(function FormMessage(props, ref) {
|
|
|
12
12
|
const { children, className, ...rest } = props;
|
|
13
13
|
const { severity } = useContext(FormControlContext) || {};
|
|
14
14
|
const icon = severity ? formMessageIcons[severity] : null;
|
|
15
|
-
return (jsxs("span",
|
|
15
|
+
return (jsxs("span", { ...rest, ref: ref, className: cx(formFieldClasses.message, className), children: [icon && (jsx(Icon, { className: formFieldClasses.severityIcon, icon: icon })), children] }));
|
|
16
16
|
});
|
|
17
17
|
var FormMessage$1 = FormMessage;
|
|
18
18
|
|
|
@@ -1,23 +1,42 @@
|
|
|
1
1
|
import { Dispatch, MouseEvent, SetStateAction } from 'react';
|
|
2
2
|
import { SelectValue } from '../Select/typings';
|
|
3
|
-
export interface
|
|
4
|
-
defaultValue?: string;
|
|
3
|
+
export interface UseAutoCompleteBaseValueControl {
|
|
5
4
|
disabledOptionsFilter: boolean;
|
|
6
|
-
onChange?(
|
|
5
|
+
onChange?(newOptions: SelectValue[] | SelectValue | null): any;
|
|
7
6
|
onClear?(e: MouseEvent<Element>): void;
|
|
8
7
|
onClose?(): void;
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
onSearch?(input: string): any;
|
|
9
|
+
options: SelectValue[];
|
|
11
10
|
}
|
|
12
|
-
export
|
|
11
|
+
export declare type UseAutoCompleteMultipleValueControl = UseAutoCompleteBaseValueControl & {
|
|
12
|
+
defaultValue?: SelectValue[];
|
|
13
|
+
mode: 'multiple';
|
|
14
|
+
onChange?(newOptions: SelectValue[]): any;
|
|
15
|
+
value?: SelectValue[];
|
|
16
|
+
};
|
|
17
|
+
export declare type UseAutoCompleteSingleValueControl = UseAutoCompleteBaseValueControl & {
|
|
18
|
+
defaultValue?: SelectValue;
|
|
19
|
+
mode: 'single';
|
|
20
|
+
onChange?(newOption: SelectValue | null): any;
|
|
21
|
+
value?: SelectValue | null;
|
|
22
|
+
};
|
|
23
|
+
export declare type UseAutoCompleteValueControl = UseAutoCompleteMultipleValueControl | UseAutoCompleteSingleValueControl;
|
|
24
|
+
export interface AutoCompleteBaseValueControl {
|
|
13
25
|
focused: boolean;
|
|
14
|
-
onChange: (v: SelectValue | null) => SelectValue[];
|
|
15
26
|
onClear(e: MouseEvent<Element>): void;
|
|
16
27
|
onFocus: (f: boolean) => void;
|
|
17
|
-
options:
|
|
28
|
+
options: SelectValue[];
|
|
18
29
|
searchText: string;
|
|
30
|
+
selectedOptions: SelectValue[];
|
|
19
31
|
setSearchText: Dispatch<SetStateAction<string>>;
|
|
20
|
-
|
|
21
|
-
value: SelectValue | null;
|
|
32
|
+
unselectedOptions: SelectValue[];
|
|
22
33
|
}
|
|
23
|
-
export declare
|
|
34
|
+
export declare type AutoCompleteMultipleValueControl = AutoCompleteBaseValueControl & {
|
|
35
|
+
onChange: (v: SelectValue | null) => SelectValue[];
|
|
36
|
+
value: SelectValue[];
|
|
37
|
+
};
|
|
38
|
+
export declare type AutoCompleteSingleValueControl = AutoCompleteBaseValueControl & {
|
|
39
|
+
onChange: (v: SelectValue | null) => SelectValue | null;
|
|
40
|
+
value: SelectValue | null;
|
|
41
|
+
};
|
|
42
|
+
export declare const useAutoCompleteValueControl: (props: UseAutoCompleteValueControl) => AutoCompleteMultipleValueControl | AutoCompleteSingleValueControl;
|
|
@@ -1,62 +1,102 @@
|
|
|
1
1
|
import { useState, useCallback } from 'react';
|
|
2
|
+
import compact from 'lodash/compact';
|
|
3
|
+
import isEqual from 'lodash/isEqual';
|
|
4
|
+
import differenceBy from 'lodash/differenceBy';
|
|
2
5
|
import { useControlValueState } from './useControlValueState.js';
|
|
3
6
|
|
|
4
|
-
const equalityFn = (a, b) => a
|
|
5
|
-
function
|
|
6
|
-
const { defaultValue
|
|
7
|
+
const equalityFn = (a, b) => isEqual(a, b);
|
|
8
|
+
function useAutoCompleteBaseValueControl(props) {
|
|
9
|
+
const { defaultValue, disabledOptionsFilter, mode, onChange, onClear: onClearProp, onClose, onSearch, options: optionsProp, value: valueProp, } = props;
|
|
7
10
|
const [value, setValue] = useControlValueState({
|
|
8
|
-
defaultValue,
|
|
11
|
+
defaultValue: defaultValue || (mode === 'multiple' ? [] : null),
|
|
9
12
|
equalityFn,
|
|
10
13
|
value: valueProp,
|
|
11
14
|
});
|
|
12
15
|
const [searchText, setSearchText] = useState('');
|
|
13
16
|
const [focused, setFocused] = useState(false);
|
|
14
|
-
const onChangeValue = useCallback((text) => {
|
|
15
|
-
setValue(text);
|
|
16
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(text);
|
|
17
|
-
}, [setValue, onChange]);
|
|
18
17
|
const onFocus = useCallback((focus) => {
|
|
19
18
|
setFocused(focus);
|
|
20
|
-
|
|
21
|
-
if (!focus) {
|
|
22
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
23
|
-
}
|
|
24
|
-
}, [
|
|
25
|
-
value,
|
|
26
|
-
onChange,
|
|
27
|
-
]);
|
|
28
|
-
const getCurrentInputValue = () => (value ? {
|
|
29
|
-
id: value,
|
|
30
|
-
name: value,
|
|
31
|
-
} : null);
|
|
19
|
+
}, []);
|
|
32
20
|
const options = disabledOptionsFilter
|
|
33
21
|
? optionsProp
|
|
34
|
-
: optionsProp.filter((option) =>
|
|
22
|
+
: optionsProp.filter((option) => !!option.name.includes(searchText));
|
|
23
|
+
const selectedOptions = mode === 'multiple'
|
|
24
|
+
? value : compact([value]);
|
|
25
|
+
const unselectedOptions = differenceBy(options, selectedOptions, 'id');
|
|
35
26
|
return {
|
|
36
27
|
focused,
|
|
37
28
|
onChange: (chooseOption) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
var _a;
|
|
30
|
+
if (!chooseOption) {
|
|
31
|
+
if (mode === 'multiple') {
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
let newValue = mode === 'multiple' ? [] : null;
|
|
37
|
+
switch (mode) {
|
|
38
|
+
case 'multiple': {
|
|
39
|
+
const existedValueIdx = ((_a = value) !== null && _a !== void 0 ? _a : []).findIndex((v) => v.id === chooseOption.id);
|
|
40
|
+
if (~existedValueIdx) {
|
|
41
|
+
newValue = [
|
|
42
|
+
...value.slice(0, existedValueIdx),
|
|
43
|
+
...value.slice(existedValueIdx + 1),
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
newValue = [
|
|
48
|
+
...value,
|
|
49
|
+
chooseOption,
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
if (typeof onChange === 'function')
|
|
53
|
+
onChange(newValue);
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
default: {
|
|
57
|
+
newValue = chooseOption;
|
|
58
|
+
if (typeof onClose === 'function')
|
|
59
|
+
onClose();
|
|
60
|
+
if (typeof onChange === 'function')
|
|
61
|
+
onChange(newValue);
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
setValue(newValue);
|
|
66
|
+
return newValue;
|
|
44
67
|
},
|
|
45
68
|
onClear: (e) => {
|
|
46
69
|
e.stopPropagation();
|
|
47
|
-
|
|
70
|
+
if (mode === 'multiple') {
|
|
71
|
+
setValue([]);
|
|
72
|
+
onChange === null || onChange === void 0 ? void 0 : onChange([]);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
setValue(null);
|
|
76
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(null);
|
|
77
|
+
}
|
|
48
78
|
setSearchText('');
|
|
49
79
|
if (typeof onClearProp === 'function') {
|
|
50
80
|
onClearProp(e);
|
|
51
81
|
}
|
|
82
|
+
if (typeof onSearch === 'function') {
|
|
83
|
+
onSearch('');
|
|
84
|
+
}
|
|
52
85
|
},
|
|
53
86
|
onFocus,
|
|
54
87
|
options,
|
|
55
88
|
searchText,
|
|
89
|
+
selectedOptions,
|
|
56
90
|
setSearchText,
|
|
57
|
-
|
|
58
|
-
value
|
|
91
|
+
unselectedOptions,
|
|
92
|
+
value,
|
|
59
93
|
};
|
|
60
|
-
}
|
|
94
|
+
}
|
|
95
|
+
const useAutoCompleteValueControl = (props) => {
|
|
96
|
+
if (props.mode === 'multiple') {
|
|
97
|
+
return useAutoCompleteBaseValueControl(props);
|
|
98
|
+
}
|
|
99
|
+
return useAutoCompleteBaseValueControl(props);
|
|
100
|
+
};
|
|
61
101
|
|
|
62
102
|
export { useAutoCompleteValueControl };
|
|
@@ -56,7 +56,8 @@ function useInputWithTagsModeValue(props) {
|
|
|
56
56
|
if (!canActive)
|
|
57
57
|
return;
|
|
58
58
|
const element = ref.current;
|
|
59
|
-
if (element &&
|
|
59
|
+
if (element &&
|
|
60
|
+
(element === null || element === void 0 ? void 0 : element.value) &&
|
|
60
61
|
(e.key === 'Enter' || e.code === 'Enter') &&
|
|
61
62
|
!e.nativeEvent.isComposing &&
|
|
62
63
|
!tagsWillOverflow()) {
|
|
@@ -30,4 +30,4 @@ export declare type SelectSingleValueControl = SelectBaseValueControl & {
|
|
|
30
30
|
value: SelectValue | null;
|
|
31
31
|
};
|
|
32
32
|
export declare type SelectValueControl = SelectMultipleValueControl | SelectSingleValueControl;
|
|
33
|
-
export declare const useSelectValueControl: (props: UseSelectValueControl) =>
|
|
33
|
+
export declare const useSelectValueControl: (props: UseSelectValueControl) => SelectMultipleValueControl | SelectSingleValueControl;
|
package/Icon/Icon.d.ts
CHANGED
package/Icon/Icon.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { toIconCssVars, iconClasses } from '@mezzanine-ui/core/icon';
|
|
4
4
|
import cx from 'clsx';
|
|
@@ -7,7 +7,7 @@ import cx from 'clsx';
|
|
|
7
7
|
* The react component for `mezzanine` icon.
|
|
8
8
|
*/
|
|
9
9
|
const Icon = forwardRef(function Icon(props, ref) {
|
|
10
|
-
const { className, color, icon, size, spin = false, style: styleProp, ...rest } = props;
|
|
10
|
+
const { className, color, icon, size, spin = false, style: styleProp, title, ...rest } = props;
|
|
11
11
|
const { definition } = icon;
|
|
12
12
|
const cssVars = toIconCssVars({ color, size });
|
|
13
13
|
const style = {
|
|
@@ -15,11 +15,11 @@ const Icon = forwardRef(function Icon(props, ref) {
|
|
|
15
15
|
...cssVars,
|
|
16
16
|
...styleProp,
|
|
17
17
|
};
|
|
18
|
-
return (jsx("i",
|
|
18
|
+
return (jsx("i", { ...rest, ref: ref, className: cx(iconClasses.host, {
|
|
19
19
|
[iconClasses.color]: color,
|
|
20
20
|
[iconClasses.spin]: spin,
|
|
21
21
|
[iconClasses.size]: size,
|
|
22
|
-
}, className), "data-icon-name": icon.name, style: style
|
|
22
|
+
}, className), "data-icon-name": icon.name, style: style, children: jsxs("svg", { ...definition.svg, focusable: false, children: [title || definition.title ? (jsx("title", { children: title || definition.title })) : null, jsx("path", { ...definition.path })] }) }));
|
|
23
23
|
});
|
|
24
24
|
var Icon$1 = Icon;
|
|
25
25
|
|
package/Input/Input.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { InputSize } from '@mezzanine-ui/core/input';
|
|
|
3
3
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
4
|
import type { TagsType } from '../Form/useInputWithTagsModeValue';
|
|
5
5
|
import { TextFieldProps } from '../TextField';
|
|
6
|
-
export interface InputProps extends Omit<TextFieldProps, 'active' | 'children' | 'onClear' | 'onKeyDown'> {
|
|
6
|
+
export interface InputProps extends Omit<TextFieldProps, 'active' | 'children' | 'onClear' | 'onKeyDown' | 'suffixActionIcon'> {
|
|
7
7
|
/**
|
|
8
8
|
* The default value of input.
|
|
9
9
|
*/
|
package/Input/Input.js
CHANGED
|
@@ -5,6 +5,7 @@ import { selectClasses } from '@mezzanine-ui/core/select';
|
|
|
5
5
|
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
6
6
|
import { useInputWithClearControlValue } from '../Form/useInputWithClearControlValue.js';
|
|
7
7
|
import { useInputWithTagsModeValue } from '../Form/useInputWithTagsModeValue.js';
|
|
8
|
+
import { MezzanineConfig } from '../Provider/context.js';
|
|
8
9
|
import TextField from '../TextField/TextField.js';
|
|
9
10
|
import Tag from '../Tag/Tag.js';
|
|
10
11
|
import { FormControlContext } from '../Form/FormControlContext.js';
|
|
@@ -14,8 +15,9 @@ import cx from 'clsx';
|
|
|
14
15
|
* The react component for `mezzanine` input.
|
|
15
16
|
*/
|
|
16
17
|
const Input = forwardRef(function Input(props, ref) {
|
|
18
|
+
const { size: globalSize, } = useContext(MezzanineConfig);
|
|
17
19
|
const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
18
|
-
const { className, clearable = false, defaultValue, disabled = disabledFromFormControl || false, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputProps, inputRef: inputRefProp, mode = 'default', onChange: onChangeProp, placeholder, prefix, readOnly = false, required = requiredFromFormControl || false, size =
|
|
20
|
+
const { className, clearable = false, defaultValue, disabled = disabledFromFormControl || false, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputProps, inputRef: inputRefProp, mode = 'default', onChange: onChangeProp, placeholder, prefix, readOnly = false, required = requiredFromFormControl || false, size = globalSize, suffix, tagsProps, value: valueProp, } = props;
|
|
19
21
|
const { initialTagsValue, inputPosition = 'bottom', maxTagsLength, onTagsChange, } = tagsProps || {};
|
|
20
22
|
const tagsMode = mode === 'tags';
|
|
21
23
|
const inputRef = useRef(null);
|
|
@@ -41,11 +43,10 @@ const Input = forwardRef(function Input(props, ref) {
|
|
|
41
43
|
: inputProps === null || inputProps === void 0 ? void 0 : inputProps.maxLength);
|
|
42
44
|
const active = !!value;
|
|
43
45
|
const mountInput = !tagsMode || !tagsReachedMax;
|
|
44
|
-
return (jsxs(TextField,
|
|
46
|
+
return (jsxs(TextField, { ref: ref, active: active, className: cx(inputClasses.host, tagsMode && inputClasses.tagsMode, inputPosition === 'top' && inputClasses.tagsModeInputOnTop, className), clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, onClear: tagsMode ? tagsModeOnClear : onClear, prefix: mountInput ? prefix : undefined, suffix: mountInput ? suffix : undefined, size: size, children: [tagsMode && (jsx("div", { className: selectClasses.triggerTags, children: tags.map((tag) => (jsx(Tag, { closable: true, disabled: disabled, size: size, onClose: (e) => {
|
|
45
47
|
e.stopPropagation();
|
|
46
48
|
tagsModeOnRemove(tag);
|
|
47
|
-
}
|
|
48
|
-
mountInput && (jsx("input", Object.assign({}, inputProps, { "aria-disabled": disabled, "aria-multiline": false, "aria-readonly": readOnly, "aria-required": required, disabled: disabled, maxLength: maxLength(), onChange: tagsMode ? tagsModeOnChange : onChange, onKeyDown: tagsMode ? onKeyDown : inputProps === null || inputProps === void 0 ? void 0 : inputProps.onKeyDown, placeholder: placeholder, readOnly: readOnly, ref: composedInputRef, required: required, value: tagsMode ? undefined : value }), void 0))] }), void 0));
|
|
49
|
+
}, children: tag }, tag))) })), mountInput && (jsx("input", { ...inputProps, "aria-disabled": disabled, "aria-multiline": false, "aria-readonly": readOnly, "aria-required": required, disabled: disabled, maxLength: maxLength(), onChange: tagsMode ? tagsModeOnChange : onChange, onKeyDown: tagsMode ? onKeyDown : inputProps === null || inputProps === void 0 ? void 0 : inputProps.onKeyDown, placeholder: placeholder, readOnly: readOnly, ref: composedInputRef, required: required, value: tagsMode ? undefined : value }))] }));
|
|
49
50
|
});
|
|
50
51
|
var Input$1 = Input;
|
|
51
52
|
|
package/Loading/Loading.js
CHANGED
|
@@ -13,14 +13,13 @@ const Loading = forwardRef(function Loading(props, ref) {
|
|
|
13
13
|
const { className: iconClassName, color: iconColor, ...iconPropsRest } = iconProps;
|
|
14
14
|
const isNestedPattern = typeof children !== 'undefined';
|
|
15
15
|
const composedHostRef = useComposeRefs([ref, hostRef]);
|
|
16
|
-
const spinElement = loading ? (jsxs("div",
|
|
16
|
+
const spinElement = loading ? (jsxs("div", { ref: isNestedPattern ? null : ref, className: cx(iconClasses.spin, {
|
|
17
17
|
[iconClasses.stretch]: stretch,
|
|
18
|
-
})
|
|
19
|
-
tip ? (jsx("span", Object.assign({ className: cx(iconClasses.tip, tipClassName) }, { children: tip }), void 0)) : null] }), void 0)) : null;
|
|
18
|
+
}), children: [jsx(Icon, { ...iconPropsRest, className: cx(iconClasses.icon, iconClassName), color: iconColor || 'primary', icon: SpinnerIcon, spin: true }), tip ? (jsx("span", { className: cx(iconClasses.tip, tipClassName), children: tip })) : null] })) : null;
|
|
20
19
|
if (isNestedPattern) {
|
|
21
|
-
return (jsxs("div",
|
|
20
|
+
return (jsxs("div", { ref: composedHostRef, className: cx(iconClasses.host, {
|
|
22
21
|
[iconClasses.stretch]: stretch,
|
|
23
|
-
}, className)
|
|
22
|
+
}, className), children: [jsx(Overlay, { ...overlayProps, container: hostRef, onSurface: true, open: loading, children: spinElement }), children] }));
|
|
24
23
|
}
|
|
25
24
|
return spinElement;
|
|
26
25
|
});
|
package/Menu/Menu.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef } from 'react';
|
|
2
|
+
import { forwardRef, useContext } from 'react';
|
|
3
3
|
import { toMenuCssVars, menuClasses } from '@mezzanine-ui/core/menu';
|
|
4
|
+
import { MezzanineConfig } from '../Provider/context.js';
|
|
4
5
|
import cx from 'clsx';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* The react component for `mezzanine` menu.
|
|
8
9
|
*/
|
|
9
10
|
const Menu = forwardRef(function Menu(props, ref) {
|
|
10
|
-
const {
|
|
11
|
+
const { size: globalSize, } = useContext(MezzanineConfig);
|
|
12
|
+
const { children, className, itemsInView = 4, maxHeight, role = 'menu', size = globalSize, style: styleProp, ...rest } = props;
|
|
11
13
|
const cssVars = toMenuCssVars({
|
|
12
14
|
itemsInView,
|
|
13
15
|
maxHeight,
|
|
@@ -16,7 +18,7 @@ const Menu = forwardRef(function Menu(props, ref) {
|
|
|
16
18
|
...cssVars,
|
|
17
19
|
...styleProp,
|
|
18
20
|
};
|
|
19
|
-
return (jsx("ul",
|
|
21
|
+
return (jsx("ul", { ...rest, ref: ref, className: cx(menuClasses.host, menuClasses.size(size), className), role: role, style: style, children: children }));
|
|
20
22
|
});
|
|
21
23
|
var Menu$1 = Menu;
|
|
22
24
|
|
package/Menu/MenuDivider.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export declare type MenuDividerProps = NativeElementPropsWithoutKeyAndRef<'hr'>;
|
|
|
4
4
|
/**
|
|
5
5
|
* The react component for `mezzanine` menu divider.
|
|
6
6
|
*/
|
|
7
|
-
declare const MenuDivider: import("react").ForwardRefExoticComponent<
|
|
7
|
+
declare const MenuDivider: import("react").ForwardRefExoticComponent<MenuDividerProps & import("react").RefAttributes<HTMLHRElement>>;
|
|
8
8
|
export default MenuDivider;
|
package/Menu/MenuDivider.js
CHANGED
|
@@ -8,7 +8,7 @@ import cx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
const MenuDivider = forwardRef(function MenuDivider(props, ref) {
|
|
10
10
|
const { className, ...rest } = props;
|
|
11
|
-
return (jsx("hr",
|
|
11
|
+
return (jsx("hr", { ...rest, ref: ref, className: cx(menuDividerClasses.host, className) }));
|
|
12
12
|
});
|
|
13
13
|
var MenuDivider$1 = MenuDivider;
|
|
14
14
|
|
package/Menu/MenuItem.js
CHANGED
|
@@ -12,15 +12,14 @@ const MenuItem = forwardRef(function MenuItem(props, ref) {
|
|
|
12
12
|
const { active = false, children, className, disabled = false, onClick, onKeyDown = () => { }, role = 'menuitem', ...rest } = props;
|
|
13
13
|
return (
|
|
14
14
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
15
|
-
jsxs("li",
|
|
15
|
+
jsxs("li", { ...rest, ref: ref, "aria-disabled": disabled, className: cx(menuItemClasses.host, {
|
|
16
16
|
[menuItemClasses.active]: active,
|
|
17
17
|
[menuItemClasses.disabled]: disabled,
|
|
18
18
|
}, className), onClick: (event) => {
|
|
19
19
|
if (!disabled && onClick) {
|
|
20
20
|
onClick(event);
|
|
21
21
|
}
|
|
22
|
-
}, onKeyDown: onKeyDown, role: role
|
|
23
|
-
active && jsx(Icon, { className: menuItemClasses.activeIcon, icon: CheckIcon }, void 0)] }), void 0));
|
|
22
|
+
}, onKeyDown: onKeyDown, role: role, children: [jsx("div", { className: menuItemClasses.label, children: children }), active && jsx(Icon, { className: menuItemClasses.activeIcon, icon: CheckIcon })] }));
|
|
24
23
|
});
|
|
25
24
|
var MenuItem$1 = MenuItem;
|
|
26
25
|
|
package/Menu/MenuItemGroup.js
CHANGED
|
@@ -8,8 +8,7 @@ import cx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
const MenuItemGroup = forwardRef(function MenuItemGroup(props, ref) {
|
|
10
10
|
const { children, className, label, ...rest } = props;
|
|
11
|
-
return (jsxs("li",
|
|
12
|
-
jsx("ul", Object.assign({ className: menuItemGroupClasses.items }, { children: children }), void 0)] }), void 0));
|
|
11
|
+
return (jsxs("li", { ref: ref, ...rest, className: cx(menuItemGroupClasses.host, className), children: [jsx("span", { className: menuItemGroupClasses.label, children: label }), jsx("ul", { className: menuItemGroupClasses.items, children: children })] }));
|
|
13
12
|
});
|
|
14
13
|
var MenuItemGroup$1 = MenuItemGroup;
|
|
15
14
|
|
package/Message/Message.js
CHANGED
|
@@ -32,12 +32,11 @@ const Message = ((props) => {
|
|
|
32
32
|
if (reference)
|
|
33
33
|
Message.remove(reference);
|
|
34
34
|
};
|
|
35
|
-
return (jsx(SlideFade,
|
|
36
|
-
jsx("span", Object.assign({ className: messageClasses.content }, { children: children }), void 0)] }), void 0) }), void 0));
|
|
35
|
+
return (jsx(SlideFade, { in: open, appear: true, onExited: onExited, ...restTransitionProps, children: jsxs("div", { className: cx(messageClasses.host, severity ? messageClasses.severity(severity) : ''), children: [icon ? (jsx(Icon, { className: messageClasses.icon, icon: icon })) : null, jsx("span", { className: messageClasses.content, children: children })] }) }));
|
|
37
36
|
});
|
|
38
37
|
const { add, config, destroy, remove, } = createNotifier({
|
|
39
38
|
duration: 3000,
|
|
40
|
-
render: (message) => jsx(Message,
|
|
39
|
+
render: (message) => jsx(Message, { ...message }),
|
|
41
40
|
setRoot: (root) => {
|
|
42
41
|
root.setAttribute('class', messageClasses.root);
|
|
43
42
|
},
|
package/Modal/Modal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { modalClasses } from '@mezzanine-ui/core/modal';
|
|
3
3
|
import { TimesIcon } from '@mezzanine-ui/icons';
|
|
4
|
-
import { forwardRef } from 'react';
|
|
4
|
+
import { forwardRef, useMemo } from 'react';
|
|
5
5
|
import { ModalControlContext } from './ModalControl.js';
|
|
6
6
|
import useModalContainer from './useModalContainer.js';
|
|
7
7
|
import Icon from '../Icon/Icon.js';
|
|
@@ -12,15 +12,15 @@ import cx from 'clsx';
|
|
|
12
12
|
*/
|
|
13
13
|
const Modal = forwardRef(function Modal(props, ref) {
|
|
14
14
|
const { children, className, container, disableCloseOnBackdropClick = false, disableCloseOnEscapeKeyDown = false, disablePortal = false, fullScreen = false, hideBackdrop = false, hideCloseIcon = false, invisibleBackdrop = false, loading = false, onBackdropClick, onClose, open, severity = 'info', size = 'medium', ...rest } = props;
|
|
15
|
-
const modalControl = {
|
|
15
|
+
const modalControl = useMemo(() => ({
|
|
16
16
|
loading,
|
|
17
17
|
severity,
|
|
18
|
-
};
|
|
18
|
+
}), [loading, severity]);
|
|
19
19
|
const { Container: ModalContainer } = useModalContainer();
|
|
20
|
-
return (jsx(ModalControlContext.Provider,
|
|
20
|
+
return (jsx(ModalControlContext.Provider, { value: modalControl, children: jsx(ModalContainer, { className: modalClasses.overlay, container: container, direction: "down", disableCloseOnBackdropClick: disableCloseOnBackdropClick, disableCloseOnEscapeKeyDown: disableCloseOnEscapeKeyDown, disablePortal: disablePortal, hideBackdrop: hideBackdrop, invisibleBackdrop: invisibleBackdrop, onBackdropClick: onBackdropClick, onClose: onClose, open: open, ref: ref, children: jsxs("div", { ...rest, className: cx(modalClasses.host, modalClasses.severity(severity), modalClasses.size(size), {
|
|
21
21
|
[modalClasses.fullScreen]: fullScreen,
|
|
22
22
|
[modalClasses.withCloseIcon]: !hideCloseIcon,
|
|
23
|
-
}, className), role: "dialog"
|
|
23
|
+
}, className), role: "dialog", children: [children, !hideCloseIcon && (jsx(Icon, { className: modalClasses.closeIcon, icon: TimesIcon, onClick: onClose }))] }) }) }));
|
|
24
24
|
});
|
|
25
25
|
var Modal$1 = Modal;
|
|
26
26
|
|
package/Modal/ModalActions.js
CHANGED
|
@@ -12,7 +12,7 @@ const ModalActions = forwardRef(function ModalActions(props, ref) {
|
|
|
12
12
|
const { cancelButtonProps, cancelText, children, confirmButtonProps, confirmText, hideCancelButton, hideConfirmButton, onCancel, onConfirm, ...rest } = props;
|
|
13
13
|
const { loading, severity, } = useContext(ModalControlContext);
|
|
14
14
|
const danger = severity === 'error';
|
|
15
|
-
return (jsxs(ModalFooter,
|
|
15
|
+
return (jsxs(ModalFooter, { ...rest, ref: ref, children: [children, jsx(ConfirmActions, { cancelButtonProps: cancelButtonProps, cancelText: cancelText, className: modalClasses.actions, confirmButtonProps: confirmButtonProps, confirmText: confirmText, danger: danger, hideCancelButton: hideCancelButton, hideConfirmButton: hideConfirmButton, loading: loading, onCancel: onCancel, onConfirm: onConfirm })] }));
|
|
16
16
|
});
|
|
17
17
|
var ModalActions$1 = ModalActions;
|
|
18
18
|
|
package/Modal/ModalBody.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export declare type ModalBodyProps = NativeElementPropsWithoutKeyAndRef<'div'>;
|
|
|
4
4
|
/**
|
|
5
5
|
* The react component for `mezzanine` modal body.
|
|
6
6
|
*/
|
|
7
|
-
declare const ModalBody: import("react").ForwardRefExoticComponent<
|
|
7
|
+
declare const ModalBody: import("react").ForwardRefExoticComponent<ModalBodyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
8
|
export default ModalBody;
|
package/Modal/ModalBody.js
CHANGED
|
@@ -8,7 +8,7 @@ import cx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
const ModalBody = forwardRef(function ModalBody(props, ref) {
|
|
10
10
|
const { children, className, ...rest } = props;
|
|
11
|
-
return (jsx("div",
|
|
11
|
+
return (jsx("div", { ...rest, ref: ref, className: cx(modalClasses.body, className), children: children }));
|
|
12
12
|
});
|
|
13
13
|
var ModalBody$1 = ModalBody;
|
|
14
14
|
|
package/Modal/ModalFooter.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export declare type ModalFooterProps = NativeElementPropsWithoutKeyAndRef<'div'>
|
|
|
4
4
|
/**
|
|
5
5
|
* The react component for `mezzanine` modal footer.
|
|
6
6
|
*/
|
|
7
|
-
declare const ModalFooter: import("react").ForwardRefExoticComponent<
|
|
7
|
+
declare const ModalFooter: import("react").ForwardRefExoticComponent<ModalFooterProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
8
|
export default ModalFooter;
|
package/Modal/ModalFooter.js
CHANGED
|
@@ -8,7 +8,7 @@ import cx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
const ModalFooter = forwardRef(function ModalFooter(props, ref) {
|
|
10
10
|
const { children, className, ...rest } = props;
|
|
11
|
-
return (jsx("div",
|
|
11
|
+
return (jsx("div", { ...rest, ref: ref, className: cx(modalClasses.footer, className), children: children }));
|
|
12
12
|
});
|
|
13
13
|
var ModalFooter$1 = ModalFooter;
|
|
14
14
|
|
package/Modal/ModalHeader.js
CHANGED
|
@@ -11,10 +11,9 @@ import cx from 'clsx';
|
|
|
11
11
|
const ModalHeader = forwardRef(function ModalHeader(props, ref) {
|
|
12
12
|
const { children, className, showSeverityIcon = false, titleLarge = false, ...rest } = props;
|
|
13
13
|
const { severity } = useContext(ModalControlContext);
|
|
14
|
-
return (jsxs("div",
|
|
15
|
-
jsx("h3", Object.assign({ className: cx(modalClasses.title, {
|
|
14
|
+
return (jsxs("div", { ...rest, ref: ref, className: cx(modalClasses.header, className), children: [showSeverityIcon && (jsx(Icon, { className: modalClasses.severityIcon, icon: modalSeverityIcons[severity] })), jsx("h3", { className: cx(modalClasses.title, {
|
|
16
15
|
[modalClasses.titleLarge]: titleLarge,
|
|
17
|
-
}), title: typeof children === 'string' ? children : undefined
|
|
16
|
+
}), title: typeof children === 'string' ? children : undefined, children: children })] }));
|
|
18
17
|
});
|
|
19
18
|
var ModalHeader$1 = ModalHeader;
|
|
20
19
|
|
|
@@ -15,7 +15,7 @@ const defaultOptions = {
|
|
|
15
15
|
};
|
|
16
16
|
const ModalContainer = forwardRef((props, ref) => {
|
|
17
17
|
const { className = defaultOptions.className, children, container, direction = defaultOptions.direction, disableCloseOnBackdropClick = defaultOptions.disableCloseOnBackdropClick, disableCloseOnEscapeKeyDown = defaultOptions.disableCloseOnEscapeKeyDown, disablePortal = defaultOptions.disablePortal, hideBackdrop = defaultOptions.hideBackdrop, invisibleBackdrop = defaultOptions.invisibleBackdrop, onBackdropClick, onClose, open = defaultOptions.open, } = props;
|
|
18
|
-
return (jsx(SlideFadeOverlay,
|
|
18
|
+
return (jsx(SlideFadeOverlay, { className: className, container: container, direction: direction, disableCloseOnBackdropClick: disableCloseOnBackdropClick, disableCloseOnEscapeKeyDown: disableCloseOnEscapeKeyDown, disablePortal: disablePortal, hideBackdrop: hideBackdrop, invisibleBackdrop: invisibleBackdrop, onBackdropClick: onBackdropClick, onClose: onClose, open: open, ref: ref, children: children }));
|
|
19
19
|
});
|
|
20
20
|
function useModalContainer() {
|
|
21
21
|
return {
|
package/Navigation/Navigation.js
CHANGED
|
@@ -40,9 +40,9 @@ const Navigation = forwardRef((props, ref) => {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
return (jsx("ul",
|
|
43
|
+
return (jsx("ul", { ...rest, ref: ref, className: cx(navigationClasses.host, navigationClasses[orientation], className), children: jsx(NavigationContext.Provider, { value: {
|
|
44
44
|
orientation,
|
|
45
|
-
}
|
|
45
|
+
}, children: ItemChildren }) }));
|
|
46
46
|
});
|
|
47
47
|
var Navigation$1 = Navigation;
|
|
48
48
|
|