@mezzanine-ui/react 0.10.3 → 0.11.0

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.
@@ -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?: IconDefinition;
11
+ prefixIcon?: JSX.Element;
13
12
  /**
14
13
  * custom suffix actions
15
14
  */
@@ -1,5 +1,5 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
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, {}))] }));
@@ -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: import("react").ForwardRefExoticComponent<AppBarProps & import("react").RefAttributes<HTMLElement>>;
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?: string | undefined) => void;
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;
@@ -38,7 +38,7 @@ const { add, config, destroy, remove, } = createNotifier({
38
38
  duration: 3000,
39
39
  render: (message) => jsx(Message, { ...message }),
40
40
  setRoot: (root) => {
41
- root.setAttribute('class', messageClasses.root);
41
+ root === null || root === void 0 ? void 0 : root.setAttribute('class', messageClasses.root);
42
42
  },
43
43
  });
44
44
  Message.add = add;
@@ -50,5 +50,5 @@ export interface Notification extends FC<NotificationData>, Notifier<Notificatio
50
50
  * Use the API from the Notification instance such as `Notification.success` and `Notification.error`
51
51
  * to display a notification globally.
52
52
  */
53
- declare const Notification: Notification;
54
- export default Notification;
53
+ declare const NotificationElement: Notification;
54
+ export default NotificationElement;
@@ -16,9 +16,9 @@ import { createNotifier } from '../Notifier/createNotifier.js';
16
16
  * to display a notification globally.
17
17
  */
18
18
  // eslint-disable-next-line @typescript-eslint/no-redeclare
19
- const Notification = ((props) => {
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] : severity;
21
+ const targetIcon = severity ? (notificationIcons[severity]) : undefined;
22
22
  const [open, setOpen] = useState(true);
23
23
  useEffect(() => {
24
24
  if (open && duration) {
@@ -48,27 +48,27 @@ const Notification = ((props) => {
48
48
  if (onExitedProp) {
49
49
  onExitedProp(node);
50
50
  }
51
- Notification.remove(reference);
51
+ NotificationElement.remove(reference);
52
52
  };
53
53
  return (jsx(SlideFade, { in: open, appear: true, onExited: onExited, direction: direction, ...restTransitionProps, children: jsxs("div", { className: cx(notificationClasses.host, severity ? notificationClasses.severity(severity) : undefined), children: [targetIcon ? (jsx("div", { className: notificationClasses.iconContainer, children: jsx(Icon, { icon: targetIcon, className: notificationClasses.severityIcon }) })) : null, jsxs("div", { className: notificationClasses.body, children: [jsx("h4", { className: notificationClasses.title, children: title }), jsx("div", { className: notificationClasses.content, children: children }), onConfirm && !severity ? (jsxs(ButtonGroup, { className: notificationClasses.action, children: [jsx(Button, { variant: "contained", onClick: onConfirm, children: confirmText }), jsx(Button, { variant: "outlined", onClick: onCancel || onClose, children: cancelText })] })) : null] }), jsx(Icon, { icon: TimesIcon, className: notificationClasses.closeIcon, onClick: onClose })] }) }));
54
54
  });
55
55
  const { add, config, destroy, remove, } = createNotifier({
56
56
  duration: false,
57
- render: (notif) => jsx(Notification, { ...notif }),
57
+ render: (notif) => jsx(NotificationElement, { ...notif }),
58
58
  setRoot: (root) => {
59
- root.setAttribute('class', notificationClasses.root);
59
+ root === null || root === void 0 ? void 0 : root.setAttribute('class', notificationClasses.root);
60
60
  },
61
61
  });
62
- Notification.add = add;
63
- Notification.config = config;
64
- Notification.destroy = destroy;
65
- Notification.remove = remove;
62
+ NotificationElement.add = add;
63
+ NotificationElement.config = config;
64
+ NotificationElement.destroy = destroy;
65
+ NotificationElement.remove = remove;
66
66
  ['success', 'warning', 'error', 'info'].forEach((severity) => {
67
- Notification[severity] = (props) => Notification.add({
67
+ NotificationElement[severity] = (props) => NotificationElement.add({
68
68
  ...props,
69
69
  severity,
70
70
  });
71
71
  });
72
- var Notification$1 = Notification;
72
+ var NotificationElement$1 = NotificationElement;
73
73
 
74
- export { Notification$1 as default };
74
+ export { NotificationElement$1 as default };
@@ -1,6 +1,6 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { createRef } from 'react';
3
- import { render, unmountComponentAtNode } from 'react-dom';
3
+ import { createRoot } from 'react-dom/client';
4
4
  import NotifierManager from './NotifierManager.js';
5
5
 
6
6
  /**
@@ -10,20 +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 root = document.createElement('div');
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(root);
21
+ if (setRoot && container) {
22
+ setRoot(container);
22
23
  }
23
24
  return {
24
25
  add(notifier) {
25
26
  var _a, _b;
26
- document.body.appendChild(root);
27
+ if (container === null)
28
+ return 'NOT_SET';
29
+ document.body.appendChild(container);
27
30
  const key = (_a = notifier.key) !== null && _a !== void 0 ? _a : Date.now();
28
31
  const resolvedNotifier = {
29
32
  ...restNotifierProps,
@@ -37,7 +40,7 @@ function createNotifier(props) {
37
40
  controllerRef.current.add(resolvedNotifier);
38
41
  }
39
42
  else {
40
- render((jsx(NotifierManager, { controllerRef: controllerRef, defaultNotifiers: [resolvedNotifier], maxCount: currentConfig.maxCount, render: renderNotifier })), root);
43
+ root === null || root === void 0 ? void 0 : root.render(jsx(NotifierManager, { controllerRef: controllerRef, defaultNotifiers: [resolvedNotifier], maxCount: currentConfig.maxCount, render: renderNotifier }));
41
44
  }
42
45
  return resolvedNotifier.key;
43
46
  },
@@ -47,9 +50,12 @@ function createNotifier(props) {
47
50
  }
48
51
  },
49
52
  destroy() {
50
- unmountComponentAtNode(root);
51
- if (root.parentNode) {
52
- root.parentNode.removeChild(root);
53
+ if (container === null)
54
+ return;
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);
53
59
  }
54
60
  },
55
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?: string | undefined) => void;
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<string> | undefined) => RangePickerPickingValue | undefined;
12
+ onChange: (target?: RangePickerPickingValue) => RangePickerPickingValue | undefined;
13
13
  onFromBlur: import("react").FocusEventHandler<HTMLInputElement>;
14
14
  onFromKeyDown: KeyboardEventHandler<HTMLInputElement>;
15
15
  onInputFromChange: ChangeEventHandler<HTMLInputElement>;
@@ -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, open: open, sameWidth: true, options: popperOptions, 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 }) })] }) }));
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 < maxWidth && nowTotal > maxWidth) {
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
- /// <reference types="react" />
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 }: any) => void;
7
+ onMouseDown: ({ target, clientY }: MouseEvent<HTMLDivElement>) => void;
8
8
  onMouseUp: () => void;
9
9
  onMouseEnter: () => void;
10
10
  onMouseLeave: () => void;
@@ -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" })] })) : (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 }) }))] }));
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.10.3",
3
+ "version": "0.11.0",
4
4
  "description": "React components for mezzanine-ui",
5
5
  "author": "Mezzanine",
6
6
  "repository": {
@@ -27,35 +27,36 @@
27
27
  },
28
28
  "peerDependencies": {
29
29
  "lodash": "^4.17.21",
30
- "react": "^17.0.2",
31
- "react-dom": "^17.0.2"
30
+ "react": "^18.2.0",
31
+ "react-dom": "^18.2.0"
32
32
  },
33
33
  "dependencies": {
34
- "@mezzanine-ui/core": "^0.10.2",
34
+ "@mezzanine-ui/core": "^0.10.5",
35
35
  "@mezzanine-ui/icons": "^0.10.2",
36
36
  "@mezzanine-ui/system": "^0.7.0",
37
- "@popperjs/core": "^2.9.2",
38
- "@types/react-transition-group": "4.4.1",
37
+ "@popperjs/core": "^2.11.5",
38
+ "@types/react-transition-group": "^4.4.5",
39
39
  "clsx": "^1.1.1",
40
- "react-popper": "^2.2.5",
41
- "react-transition-group": "4.4.1",
40
+ "lodash": "^4.17.21",
41
+ "react-popper": "^2.3.0",
42
+ "react-transition-group": "^4.4.2",
42
43
  "tslib": "^2.1.0"
43
44
  },
44
45
  "devDependencies": {
45
- "@storybook/react": "^6.4.19",
46
- "@testing-library/react": "^11.2.5",
47
- "@testing-library/react-hooks": "^5.1.0",
48
- "@types/lodash": "^4.14.168",
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",
49
50
  "@types/moment": "^2.13.0",
50
- "@types/react": "^17.0.43",
51
- "@types/react-dom": "^17.0.14",
52
- "@types/react-test-renderer": "^17.0.1",
53
- "chromatic": "^5.10.1",
54
- "dayjs": "^1.10.7",
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",
55
56
  "lodash": "^4.17.21",
56
- "moment": "^2.29.1",
57
- "react": "^17.0.2",
58
- "react-dom": "^17.0.2",
59
- "react-test-renderer": "^17.0.2"
57
+ "moment": "^2.29.3",
58
+ "react": "^18.2.0",
59
+ "react-dom": "^18.2.0",
60
+ "react-test-renderer": "^18.2.0"
60
61
  }
61
62
  }