@mezzanine-ui/react 0.10.4 → 0.11.1
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/AccordionSummary.d.ts +2 -3
- package/Accordion/AccordionSummary.js +6 -6
- package/AppBar/AppBar.d.ts +2 -2
- package/DateRangePicker/useDateRangePickerValue.d.ts +2 -1
- package/Navigation/Navigation.d.ts +1 -1
- package/Navigation/Navigation.js +40 -33
- package/Notification/Notification.js +1 -1
- package/Notifier/createNotifier.js +13 -11
- package/Picker/usePickerValue.d.ts +1 -1
- package/Picker/useRangePickerValue.d.ts +1 -1
- package/Select/Select.d.ts +2 -1
- package/Select/Select.js +2 -2
- package/Select/useSelectTriggerTags.js +1 -1
- package/Table/useTableScroll.d.ts +2 -2
- package/Tooltip/Tooltip.d.ts +1 -1
- package/Transition/Transition.d.ts +11 -11
- package/Upload/UploadPictureBlock.js +3 -1
- package/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/package.json +23 -23
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { IconDefinition } from '@mezzanine-ui/icons';
|
|
3
2
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
3
|
export interface AccordionSummaryProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
5
4
|
/**
|
|
@@ -7,9 +6,9 @@ export interface AccordionSummaryProps extends NativeElementPropsWithoutKeyAndRe
|
|
|
7
6
|
*/
|
|
8
7
|
iconClassName?: string;
|
|
9
8
|
/**
|
|
10
|
-
* custom prefix icon when `suffixActions` prop is given
|
|
9
|
+
* custom prefix icon element when `suffixActions` prop is given
|
|
11
10
|
*/
|
|
12
|
-
prefixIcon?:
|
|
11
|
+
prefixIcon?: JSX.Element;
|
|
13
12
|
/**
|
|
14
13
|
* custom suffix actions
|
|
15
14
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef, useContext, useMemo } from 'react';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, useCallback, useMemo } from 'react';
|
|
3
3
|
import { ChevronDownIcon } from '@mezzanine-ui/icons';
|
|
4
4
|
import { accordionClasses } from '@mezzanine-ui/core/accordion';
|
|
5
5
|
import { AccordionControlContext } from './AccordionControlContext.js';
|
|
@@ -9,12 +9,12 @@ import cx from 'clsx';
|
|
|
9
9
|
const AccordionSummary = forwardRef(function AccordionSummary(props, ref) {
|
|
10
10
|
const { className, children, iconClassName: iconClassNameProp, prefixIcon, suffixActions, ...rest } = props;
|
|
11
11
|
const { detailsId, disabled, expanded, toggleExpanded, } = useContext(AccordionControlContext) || {};
|
|
12
|
-
const onToggle = (e) => {
|
|
12
|
+
const onToggle = useCallback((e) => {
|
|
13
13
|
e.stopPropagation();
|
|
14
14
|
if (typeof toggleExpanded === 'function' && !disabled) {
|
|
15
15
|
toggleExpanded(!expanded);
|
|
16
16
|
}
|
|
17
|
-
};
|
|
17
|
+
}, [disabled, expanded, toggleExpanded]);
|
|
18
18
|
const onKeyDown = (e) => {
|
|
19
19
|
switch (e.code) {
|
|
20
20
|
case 'Enter':
|
|
@@ -34,13 +34,13 @@ const AccordionSummary = forwardRef(function AccordionSummary(props, ref) {
|
|
|
34
34
|
}
|
|
35
35
|
return result;
|
|
36
36
|
}, [detailsId, expanded]);
|
|
37
|
-
const DefaultIcon = (iconProps) => {
|
|
37
|
+
const DefaultIcon = useCallback((iconProps) => {
|
|
38
38
|
const { className: iconClassNames = '' } = iconProps;
|
|
39
39
|
return (jsx(Icon, { color: disabled ? 'disabled' : 'primary', className: cx(accordionClasses.summaryIcon, {
|
|
40
40
|
[accordionClasses.summaryIconExpanded]: expanded,
|
|
41
41
|
[accordionClasses.summaryIconDisabled]: disabled,
|
|
42
42
|
}, iconClassNames, iconClassNameProp), icon: ChevronDownIcon, onClick: onToggle, onMouseDown: (evt) => evt.preventDefault(), role: "button" }));
|
|
43
|
-
};
|
|
43
|
+
}, [disabled, expanded, iconClassNameProp, onToggle]);
|
|
44
44
|
return (jsxs("div", { ...rest, ...ariaProps, ref: ref, className: cx(accordionClasses.summary, {
|
|
45
45
|
[accordionClasses.summaryDisabled]: disabled,
|
|
46
46
|
}, className), onClick: onToggle, onKeyDown: onKeyDown, role: "button", tabIndex: 0, children: [jsxs("div", { className: accordionClasses.summaryMainPart, children: [suffixActions ? (prefixIcon || (jsx(DefaultIcon, { className: accordionClasses.summaryMainPartPrefix }))) : null, children] }), suffixActions || (jsx(DefaultIcon, {}))] }));
|
package/AppBar/AppBar.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement, NamedExoticComponent } from 'react';
|
|
1
|
+
import { ReactElement, NamedExoticComponent, ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
2
|
import { AppBarOrientation } from '@mezzanine-ui/core/app-bar';
|
|
3
3
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
4
|
import { AppBarBrandProps } from './AppBarBrand';
|
|
@@ -10,5 +10,5 @@ export interface AppBarProps extends NativeElementPropsWithoutKeyAndRef<'header'
|
|
|
10
10
|
orientation?: AppBarOrientation;
|
|
11
11
|
children?: AppBarChildren;
|
|
12
12
|
}
|
|
13
|
-
declare const AppBar:
|
|
13
|
+
declare const AppBar: ForwardRefExoticComponent<AppBarProps & RefAttributes<HTMLElement>>;
|
|
14
14
|
export default AppBar;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DateType } from '@mezzanine-ui/core/calendar';
|
|
1
2
|
import { RangePickerPickingValue, RangePickerValue } from '@mezzanine-ui/core/picker';
|
|
2
3
|
import { ChangeEventHandler, KeyboardEventHandler } from 'react';
|
|
3
4
|
import { UseRangePickerValueProps } from '../Picker/useRangePickerValue';
|
|
@@ -8,7 +9,7 @@ export declare function useDateRangePickerValue({ format, formats, inputFromRef,
|
|
|
8
9
|
calendarValue: string[] | undefined;
|
|
9
10
|
inputFromValue: string;
|
|
10
11
|
inputToValue: string;
|
|
11
|
-
onCalendarChange: (val?:
|
|
12
|
+
onCalendarChange: (val?: DateType) => void;
|
|
12
13
|
onCalendarHover: import("react").Dispatch<import("react").SetStateAction<string | undefined>> | undefined;
|
|
13
14
|
onChange: (target?: RangePickerPickingValue<string> | undefined) => RangePickerPickingValue<string> | undefined;
|
|
14
15
|
onClear: () => void;
|
|
@@ -3,7 +3,7 @@ import { NavigationOrientation } from '@mezzanine-ui/core/navigation';
|
|
|
3
3
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
4
|
import { NavigationItemProps } from './NavigationItem';
|
|
5
5
|
import { NavigationSubMenuProps } from './NavigationSubMenu';
|
|
6
|
-
export declare type NavigationChild = ReactElement<NavigationItemProps | NavigationSubMenuProps
|
|
6
|
+
export declare type NavigationChild = ReactElement<NavigationItemProps | NavigationSubMenuProps> | null;
|
|
7
7
|
export declare type NavigationChildren = NavigationChild | NavigationChild[];
|
|
8
8
|
export interface NavigationProps extends Omit<NativeElementPropsWithoutKeyAndRef<'ul'>, 'onClick'> {
|
|
9
9
|
/**
|
package/Navigation/Navigation.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, Children, cloneElement } from 'react';
|
|
2
|
+
import { forwardRef, useCallback, Children, cloneElement, useMemo } from 'react';
|
|
3
3
|
import { navigationClasses } from '@mezzanine-ui/core/navigation';
|
|
4
4
|
import NavigationItem from './NavigationItem.js';
|
|
5
5
|
import NavigationSubMenu from './NavigationSubMenu.js';
|
|
@@ -8,41 +8,48 @@ import cx from 'clsx';
|
|
|
8
8
|
|
|
9
9
|
const Navigation = forwardRef((props, ref) => {
|
|
10
10
|
const { activeKey, children = [], className, onClick, orientation = 'horizontal', ...rest } = props;
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
11
|
+
const renderItemChildren = useCallback((parsedChildren) => (Children.map(parsedChildren, (child) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
if (child) {
|
|
14
|
+
switch (child.type) {
|
|
15
|
+
case NavigationItem: {
|
|
16
|
+
const itemChild = child;
|
|
17
|
+
return cloneElement(itemChild, {
|
|
18
|
+
active: itemChild.props.active || activeKey === itemChild.key,
|
|
19
|
+
eventKey: itemChild.key,
|
|
20
|
+
onClick: itemChild.props.onClick || onClick,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
case NavigationSubMenu: {
|
|
24
|
+
const subMenuChild = child;
|
|
25
|
+
const subMenuChildren = child.props.children;
|
|
26
|
+
let subMenuActive = false;
|
|
27
|
+
const groupChildren = Children
|
|
28
|
+
.map(subMenuChildren, (groupChild) => {
|
|
29
|
+
const active = activeKey === groupChild.key || groupChild.props.active;
|
|
30
|
+
if (active) {
|
|
31
|
+
subMenuActive = true;
|
|
32
|
+
}
|
|
33
|
+
return cloneElement(groupChild, {
|
|
34
|
+
active,
|
|
35
|
+
eventKey: groupChild.key,
|
|
36
|
+
onClick: groupChild.props.onClick || onClick,
|
|
37
|
+
});
|
|
35
38
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
39
|
+
return cloneElement(subMenuChild, {
|
|
40
|
+
active: subMenuChild.props.active || subMenuActive,
|
|
41
|
+
}, groupChildren);
|
|
42
|
+
}
|
|
43
|
+
default:
|
|
44
|
+
return renderItemChildren(((_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []));
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
return null;
|
|
48
|
+
})), [activeKey, onClick]);
|
|
49
|
+
const context = useMemo(() => ({
|
|
50
|
+
orientation,
|
|
51
|
+
}), [orientation]);
|
|
52
|
+
return (jsx("ul", { ...rest, ref: ref, className: cx(navigationClasses.host, navigationClasses[orientation], className), children: jsx(NavigationContext.Provider, { value: context, children: renderItemChildren(children) }) }));
|
|
46
53
|
});
|
|
47
54
|
var Navigation$1 = Navigation;
|
|
48
55
|
|
|
@@ -18,7 +18,7 @@ import { createNotifier } from '../Notifier/createNotifier.js';
|
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
19
19
|
const NotificationElement = ((props) => {
|
|
20
20
|
const { cancelText, children, confirmText, direction = 'left', duration, onCancel: onCancelProp, onClose: onCloseProp, onConfirm: onConfirmProp, onExited: onExitedProp, reference, severity, title, ...restTransitionProps } = props;
|
|
21
|
-
const targetIcon = severity ? notificationIcons[severity] :
|
|
21
|
+
const targetIcon = severity ? (notificationIcons[severity]) : undefined;
|
|
22
22
|
const [open, setOpen] = useState(true);
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
if (open && duration) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { createRef } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { createRoot } from 'react-dom/client';
|
|
4
4
|
import NotifierManager from './NotifierManager.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -10,22 +10,23 @@ import NotifierManager from './NotifierManager.js';
|
|
|
10
10
|
*/
|
|
11
11
|
function createNotifier(props) {
|
|
12
12
|
const { config: configProp, render: renderNotifier, setRoot, duration, maxCount, ...restNotifierProps } = props;
|
|
13
|
-
const
|
|
13
|
+
const container = typeof document === 'undefined' ? null : document.createElement('div');
|
|
14
|
+
const root = container ? createRoot(container) : null;
|
|
14
15
|
const controllerRef = createRef();
|
|
15
16
|
let currentConfig = {
|
|
16
17
|
duration,
|
|
17
18
|
maxCount,
|
|
18
19
|
...configProp,
|
|
19
20
|
};
|
|
20
|
-
if (setRoot &&
|
|
21
|
-
setRoot(
|
|
21
|
+
if (setRoot && container) {
|
|
22
|
+
setRoot(container);
|
|
22
23
|
}
|
|
23
24
|
return {
|
|
24
25
|
add(notifier) {
|
|
25
26
|
var _a, _b;
|
|
26
|
-
if (
|
|
27
|
+
if (container === null)
|
|
27
28
|
return 'NOT_SET';
|
|
28
|
-
document.body.appendChild(
|
|
29
|
+
document.body.appendChild(container);
|
|
29
30
|
const key = (_a = notifier.key) !== null && _a !== void 0 ? _a : Date.now();
|
|
30
31
|
const resolvedNotifier = {
|
|
31
32
|
...restNotifierProps,
|
|
@@ -39,7 +40,7 @@ function createNotifier(props) {
|
|
|
39
40
|
controllerRef.current.add(resolvedNotifier);
|
|
40
41
|
}
|
|
41
42
|
else {
|
|
42
|
-
render(
|
|
43
|
+
root === null || root === void 0 ? void 0 : root.render(jsx(NotifierManager, { controllerRef: controllerRef, defaultNotifiers: [resolvedNotifier], maxCount: currentConfig.maxCount, render: renderNotifier }));
|
|
43
44
|
}
|
|
44
45
|
return resolvedNotifier.key;
|
|
45
46
|
},
|
|
@@ -49,11 +50,12 @@ function createNotifier(props) {
|
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
destroy() {
|
|
52
|
-
if (
|
|
53
|
+
if (container === null)
|
|
53
54
|
return;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
// when useEffect(() => () => { root.unmount() }, []), will be show "Rendered more hooks than during the previous render." issue.
|
|
56
|
+
root === null || root === void 0 ? void 0 : root.render(null);
|
|
57
|
+
if (container.parentNode) {
|
|
58
|
+
container.parentNode.removeChild(container);
|
|
57
59
|
}
|
|
58
60
|
},
|
|
59
61
|
config(config) {
|
|
@@ -13,7 +13,7 @@ export declare type UsePickerValueProps = {
|
|
|
13
13
|
export declare function usePickerValue({ defaultValue, format, formats, inputRef, value: valueProp, }: UsePickerValueProps): {
|
|
14
14
|
inputValue: string;
|
|
15
15
|
onBlur: FocusEventHandler<HTMLInputElement>;
|
|
16
|
-
onChange: (val?:
|
|
16
|
+
onChange: (val?: DateType) => void;
|
|
17
17
|
onInputChange: import("react").ChangeEventHandler<HTMLInputElement>;
|
|
18
18
|
onKeyDown: KeyboardEventHandler<HTMLInputElement>;
|
|
19
19
|
value: string | undefined;
|
|
@@ -9,7 +9,7 @@ export interface UseRangePickerValueProps extends Pick<UsePickerValueProps, 'for
|
|
|
9
9
|
export declare function useRangePickerValue({ format, formats, inputFromRef, inputToRef, value: valueProp, }: UseRangePickerValueProps): {
|
|
10
10
|
inputFromValue: string;
|
|
11
11
|
inputToValue: string;
|
|
12
|
-
onChange: (target?: RangePickerPickingValue
|
|
12
|
+
onChange: (target?: RangePickerPickingValue) => RangePickerPickingValue | undefined;
|
|
13
13
|
onFromBlur: import("react").FocusEventHandler<HTMLInputElement>;
|
|
14
14
|
onFromKeyDown: KeyboardEventHandler<HTMLInputElement>;
|
|
15
15
|
onInputFromChange: ChangeEventHandler<HTMLInputElement>;
|
package/Select/Select.d.ts
CHANGED
|
@@ -10,8 +10,9 @@ export interface SelectBaseProps extends Omit<SelectTriggerProps, 'active' | 'in
|
|
|
10
10
|
maxHeight: 'menuMaxHeight';
|
|
11
11
|
role: 'menuRole';
|
|
12
12
|
size: 'menuSize';
|
|
13
|
-
}>, PickRenameMulti<Pick<PopperProps, 'options'>, {
|
|
13
|
+
}>, PickRenameMulti<Pick<PopperProps, 'options' | 'disablePortal'>, {
|
|
14
14
|
options: 'popperOptions';
|
|
15
|
+
disablePortal: 'disablePortal';
|
|
15
16
|
}>, Pick<MenuProps, 'children'> {
|
|
16
17
|
/**
|
|
17
18
|
* The other native props for input element.
|
package/Select/Select.js
CHANGED
|
@@ -16,7 +16,7 @@ const MENU_ID = 'mzn-select-menu-id';
|
|
|
16
16
|
const Select = forwardRef(function Select(props, ref) {
|
|
17
17
|
var _a, _b;
|
|
18
18
|
const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
19
|
-
const { children, className, clearable = false, defaultValue, disabled = disabledFromFormControl || false, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputProps, inputRef, itemsInView = 4, menuMaxHeight, menuRole = 'listbox', menuSize, mode = 'single', onBlur, onChange: onChangeProp, onClear: onClearProp, onFocus, placeholder = '', popperOptions = {}, prefix, renderValue, required = requiredFromFormControl || false, size, suffixActionIcon, value: valueProp, } = props;
|
|
19
|
+
const { children, className, clearable = false, defaultValue, disabled = disabledFromFormControl || false, disablePortal = false, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputProps, inputRef, itemsInView = 4, menuMaxHeight, menuRole = 'listbox', menuSize, mode = 'single', onBlur, onChange: onChangeProp, onClear: onClearProp, onFocus, placeholder = '', popperOptions = {}, prefix, renderValue, required = requiredFromFormControl || false, size, suffixActionIcon, value: valueProp, } = props;
|
|
20
20
|
const [open, toggleOpen] = useState(false);
|
|
21
21
|
const onOpen = () => {
|
|
22
22
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
@@ -110,7 +110,7 @@ const Select = forwardRef(function Select(props, ref) {
|
|
|
110
110
|
onChange,
|
|
111
111
|
value,
|
|
112
112
|
}), [onChange, value]);
|
|
113
|
-
return (jsx(SelectControlContext.Provider, { value: context, children: jsxs("div", { ref: nodeRef, className: cx(selectClasses.host, fullWidth && selectClasses.hostFullWidth), children: [jsx(SelectTrigger, { ref: composedRef, active: open, className: className, clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, inputRef: inputRef, mode: mode, onTagClose: onChange, onClear: onClear, onClick: onClickTextField, onKeyDown: onKeyDownTextField, prefix: prefix, readOnly: true, renderValue: renderValue, required: required, inputProps: resolvedInputProps, size: size, suffixActionIcon: suffixActionIcon, value: value }), jsx(InputTriggerPopper, { ref: popperRef, anchor: controlRef, className: selectClasses.popper,
|
|
113
|
+
return (jsx(SelectControlContext.Provider, { value: context, children: jsxs("div", { ref: nodeRef, className: cx(selectClasses.host, fullWidth && selectClasses.hostFullWidth), children: [jsx(SelectTrigger, { ref: composedRef, active: open, className: className, clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, inputRef: inputRef, mode: mode, onTagClose: onChange, onClear: onClear, onClick: onClickTextField, onKeyDown: onKeyDownTextField, prefix: prefix, readOnly: true, renderValue: renderValue, required: required, inputProps: resolvedInputProps, size: size, suffixActionIcon: suffixActionIcon, value: value }), jsx(InputTriggerPopper, { ref: popperRef, anchor: controlRef, className: selectClasses.popper, disablePortal: disablePortal, open: open, options: popperOptions, sameWidth: true, children: jsx(Menu, { id: MENU_ID, "aria-activedescendant": Array.isArray(value) ? (_b = (_a = value === null || value === void 0 ? void 0 : value[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '' : value === null || value === void 0 ? void 0 : value.id, itemsInView: itemsInView, maxHeight: menuMaxHeight, role: menuRole, size: menuSize, style: { border: 0 }, children: children }) })] }) }));
|
|
114
114
|
});
|
|
115
115
|
var Select$1 = Select;
|
|
116
116
|
|
|
@@ -9,7 +9,7 @@ function calcTakeCount({ tagsWidths, maxWidth, ellipsisTagWidth, setTakeCount, }
|
|
|
9
9
|
const prevTotal = take(tagsWidths, count).reduce((prev, curr) => prev + curr, 0);
|
|
10
10
|
const nowTotal = take(tagsWidths, count + 1).reduce((prev, curr) => prev + curr, 0);
|
|
11
11
|
targetCount = count;
|
|
12
|
-
if (prevTotal
|
|
12
|
+
if (prevTotal <= maxWidth && nowTotal >= maxWidth && maxWidth > 0) {
|
|
13
13
|
if (prevTotal + ellipsisTagWidth > maxWidth) {
|
|
14
14
|
targetCount -= 1;
|
|
15
15
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
2
|
export default function useTableScroll(): readonly [{
|
|
3
3
|
ref: import("react").RefObject<HTMLDivElement>;
|
|
4
4
|
onScroll: () => void;
|
|
5
5
|
}, {
|
|
6
6
|
ref: import("react").RefObject<HTMLDivElement>;
|
|
7
|
-
onMouseDown: ({ target, clientY }:
|
|
7
|
+
onMouseDown: ({ target, clientY }: MouseEvent<HTMLDivElement>) => void;
|
|
8
8
|
onMouseUp: () => void;
|
|
9
9
|
onMouseEnter: () => void;
|
|
10
10
|
onMouseLeave: () => void;
|
package/Tooltip/Tooltip.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement, MouseEventHandler } from 'react';
|
|
2
2
|
import { PopperProps } from '../Popper';
|
|
3
|
-
export interface TooltipProps extends PopperProps {
|
|
3
|
+
export interface TooltipProps extends Omit<PopperProps, 'children'> {
|
|
4
4
|
/**
|
|
5
5
|
* child function that can receive events
|
|
6
6
|
*/
|
|
@@ -18,17 +18,6 @@ export interface TransitionImplementationChildProps {
|
|
|
18
18
|
ref?: Ref<HTMLElement>;
|
|
19
19
|
style?: CSSProperties;
|
|
20
20
|
}
|
|
21
|
-
export interface TransitionImplementationProps extends Omit<TransitionProps, 'addEndListener' | 'children' | 'nodeRef'> {
|
|
22
|
-
children: ReactElement<TransitionImplementationChildProps, NativeElementTag | JSXElementConstructor<TransitionImplementationChildProps>>;
|
|
23
|
-
/**
|
|
24
|
-
* The delay of the transition, in milliseconds
|
|
25
|
-
*/
|
|
26
|
-
delay?: TransitionDelay;
|
|
27
|
-
/**
|
|
28
|
-
* The timing function of the transition
|
|
29
|
-
*/
|
|
30
|
-
easing?: TransitionEasing;
|
|
31
|
-
}
|
|
32
21
|
export interface TransitionProps {
|
|
33
22
|
/**
|
|
34
23
|
* A custom callback for adding custom transition end handler
|
|
@@ -91,6 +80,17 @@ export interface TransitionProps {
|
|
|
91
80
|
*/
|
|
92
81
|
onExited?: TransitionExitHandler;
|
|
93
82
|
}
|
|
83
|
+
export interface TransitionImplementationProps extends Omit<TransitionProps, 'addEndListener' | 'children' | 'nodeRef'> {
|
|
84
|
+
children: ReactElement<TransitionImplementationChildProps, NativeElementTag | JSXElementConstructor<TransitionImplementationChildProps>>;
|
|
85
|
+
/**
|
|
86
|
+
* The delay of the transition, in milliseconds
|
|
87
|
+
*/
|
|
88
|
+
delay?: TransitionDelay;
|
|
89
|
+
/**
|
|
90
|
+
* The timing function of the transition
|
|
91
|
+
*/
|
|
92
|
+
easing?: TransitionEasing;
|
|
93
|
+
}
|
|
94
94
|
/**
|
|
95
95
|
* The react component for `mezzanine` transition.
|
|
96
96
|
*/
|
|
@@ -73,7 +73,9 @@ const UploadPictureBlock = forwardRef(function UploadPictureBlock(props, ref) {
|
|
|
73
73
|
[uploadPictureBlockClasses.loading]: isLoading,
|
|
74
74
|
[uploadPictureBlockClasses.error]: isError,
|
|
75
75
|
[uploadPictureBlockClasses.disabled]: disabled,
|
|
76
|
-
}), style: style, children: [jsx(UploadInput, { ref: inputRef, accept: accept, disabled: disabled, multiple: multiple, onUpload: onUpload }), isError ? (jsxs("div", { className: uploadPictureBlockClasses.group, children: [jsx(Icon, { icon: TimesIcon }), jsx("span", { className: uploadPictureBlockClasses.status, children: "\u4E0A\u50B3\u932F\u8AA4" })] })) : (
|
|
76
|
+
}), style: style, children: [jsx(UploadInput, { ref: inputRef, accept: accept, disabled: disabled, multiple: multiple, onUpload: onUpload }), isError ? (jsxs("div", { className: uploadPictureBlockClasses.group, children: [jsx(Icon, { icon: TimesIcon }), jsx("span", { className: uploadPictureBlockClasses.status, children: "\u4E0A\u50B3\u932F\u8AA4" })] })) : (
|
|
77
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
78
|
+
jsx(Fragment, { children: showImage ? (jsxs(Fragment, { children: [jsx("img", { alt: "", src: (value || previewImage), className: uploadPictureBlockClasses.preview }), isLoading ? (jsxs("div", { className: uploadPictureBlockClasses.group, children: [jsx(Icon, { icon: SpinnerIcon, spin: true }), jsx("span", { className: uploadPictureBlockClasses.status, children: "\u4E0A\u50B3\u4E2D..." })] })) : null] })) : (jsxs("div", { className: uploadPictureBlockClasses.group, children: [jsx(Icon, { icon: UploadIcon }), jsx("span", { className: uploadPictureBlockClasses.status, children: "\u4E0A\u50B3\u5F71\u50CF" })] })) })), !disabled && canDeleteImage && (jsx("div", { className: uploadPictureBlockClasses.delete, children: jsx(Icon, { icon: TrashIcon }) }))] }));
|
|
77
79
|
});
|
|
78
80
|
var UploadPictureBlock$1 = UploadPictureBlock;
|
|
79
81
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLayoutEffect, useEffect } from 'react';
|
|
2
2
|
|
|
3
|
-
const useIsomorphicLayoutEffect = typeof window !== 'undefined' && window.document && window.document.createElement
|
|
3
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' && window.document && !!window.document.createElement
|
|
4
4
|
? useLayoutEffect
|
|
5
5
|
: useEffect;
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mezzanine-ui/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "React components for mezzanine-ui",
|
|
5
5
|
"author": "Mezzanine",
|
|
6
6
|
"repository": {
|
|
@@ -27,36 +27,36 @@
|
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"lodash": "^4.17.21",
|
|
30
|
-
"react": "^
|
|
31
|
-
"react-dom": "^
|
|
30
|
+
"react": "^18.2.0",
|
|
31
|
+
"react-dom": "^18.2.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@mezzanine-ui/core": "^0.
|
|
35
|
-
"@mezzanine-ui/icons": "^0.
|
|
36
|
-
"@mezzanine-ui/system": "^0.
|
|
37
|
-
"@popperjs/core": "^2.
|
|
38
|
-
"@types/react-transition-group": "4.4.
|
|
34
|
+
"@mezzanine-ui/core": "^0.11.1",
|
|
35
|
+
"@mezzanine-ui/icons": "^0.11.1",
|
|
36
|
+
"@mezzanine-ui/system": "^0.11.1",
|
|
37
|
+
"@popperjs/core": "^2.11.5",
|
|
38
|
+
"@types/react-transition-group": "^4.4.5",
|
|
39
39
|
"clsx": "^1.1.1",
|
|
40
40
|
"lodash": "^4.17.21",
|
|
41
|
-
"react-popper": "^2.
|
|
42
|
-
"react-transition-group": "4.4.
|
|
41
|
+
"react-popper": "^2.3.0",
|
|
42
|
+
"react-transition-group": "^4.4.2",
|
|
43
43
|
"tslib": "^2.1.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@storybook/react": "^6.
|
|
47
|
-
"@testing-library/react": "^
|
|
48
|
-
"@testing-library/react-hooks": "^
|
|
49
|
-
"@types/lodash": "^4.14.
|
|
46
|
+
"@storybook/react": "^6.5.9",
|
|
47
|
+
"@testing-library/react": "^13.2.0",
|
|
48
|
+
"@testing-library/react-hooks": "^8.0.0",
|
|
49
|
+
"@types/lodash": "^4.14.182",
|
|
50
50
|
"@types/moment": "^2.13.0",
|
|
51
|
-
"@types/react": "
|
|
52
|
-
"@types/react-dom": "
|
|
53
|
-
"@types/react-test-renderer": "
|
|
54
|
-
"chromatic": "^
|
|
55
|
-
"dayjs": "^1.
|
|
51
|
+
"@types/react": "^18.0.14",
|
|
52
|
+
"@types/react-dom": "^18.0.5",
|
|
53
|
+
"@types/react-test-renderer": "^18.0.0",
|
|
54
|
+
"chromatic": "^6.6.4",
|
|
55
|
+
"dayjs": "^1.11.3",
|
|
56
56
|
"lodash": "^4.17.21",
|
|
57
|
-
"moment": "^2.29.
|
|
58
|
-
"react": "^
|
|
59
|
-
"react-dom": "^
|
|
60
|
-
"react-test-renderer": "^
|
|
57
|
+
"moment": "^2.29.3",
|
|
58
|
+
"react": "^18.2.0",
|
|
59
|
+
"react-dom": "^18.2.0",
|
|
60
|
+
"react-test-renderer": "^18.2.0"
|
|
61
61
|
}
|
|
62
62
|
}
|