@mezzanine-ui/react 0.14.9 → 0.15.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.
- package/Accordion/Accordion.js +2 -1
- package/Accordion/AccordionDetails.js +1 -1
- package/Accordion/AccordionSummary.js +4 -2
- package/Accordion/index.d.ts +1 -1
- package/Alert/index.d.ts +2 -2
- package/AppBar/AppBar.js +1 -3
- package/AppBar/index.d.ts +4 -4
- package/Badge/index.d.ts +1 -1
- package/Button/Button.js +1 -1
- package/Button/ButtonGroup.js +1 -1
- package/Button/IconButton.js +1 -1
- package/Button/index.d.ts +2 -2
- package/Calendar/Calendar.js +9 -1
- package/Calendar/CalendarContext.js +3 -3
- package/Calendar/CalendarDays.js +12 -5
- package/Calendar/CalendarMonths.js +13 -3
- package/Calendar/CalendarWeeks.js +16 -8
- package/Calendar/CalendarYears.js +15 -4
- package/Calendar/index.d.ts +7 -7
- package/Calendar/useCalendarControlModifiers.js +4 -13
- package/Calendar/useCalendarControls.js +1 -1
- package/Calendar/useCalendarModeStack.js +1 -1
- package/Card/Card.d.ts +1 -1
- package/Card/Card.js +5 -5
- package/Card/CardActions.js +1 -1
- package/Card/index.d.ts +2 -2
- package/Checkbox/CheckAll.js +1 -1
- package/Checkbox/Checkbox.js +4 -4
- package/Checkbox/CheckboxGroup.js +3 -1
- package/Checkbox/index.d.ts +3 -3
- package/ConfirmActions/ConfirmActions.js +1 -1
- package/ConfirmActions/index.d.ts +1 -1
- package/DatePicker/DatePicker.js +3 -7
- package/DatePicker/DatePickerCalendar.js +6 -2
- package/DatePicker/index.d.ts +1 -1
- package/DateRangePicker/DateRangePicker.js +7 -10
- package/DateRangePicker/DateRangePickerCalendar.js +9 -3
- package/DateRangePicker/index.d.ts +2 -2
- package/DateRangePicker/useDateRangeCalendarControls.js +6 -18
- package/DateRangePicker/useDateRangePickerValue.js +1 -1
- package/DateTimePicker/DateTimePicker.js +2 -2
- package/DateTimePicker/index.d.ts +1 -1
- package/Drawer/index.d.ts +1 -1
- package/Dropdown/Dropdown.js +2 -10
- package/Dropdown/index.d.ts +1 -1
- package/Empty/index.d.ts +1 -1
- package/Form/FormMessage.js +1 -1
- package/Form/useAutoCompleteValueControl.js +4 -8
- package/Form/useCheckboxControlValue.d.ts +1 -1
- package/Form/useControlValueState.js +1 -1
- package/Form/useCustomControlValue.d.ts +1 -1
- package/Form/useInputControlValue.d.ts +1 -1
- package/Form/useInputControlValue.js +1 -1
- package/Form/useInputWithClearControlValue.d.ts +1 -1
- package/Form/useInputWithClearControlValue.js +2 -6
- package/Form/useInputWithTagsModeValue.js +5 -8
- package/Form/useRadioControlValue.d.ts +1 -1
- package/Form/useSelectValueControl.js +1 -4
- package/Form/useSwitchControlValue.d.ts +1 -1
- package/Icon/index.d.ts +1 -1
- package/Input/Input.d.ts +4 -4
- package/Input/Input.js +3 -3
- package/Input/index.d.ts +1 -1
- package/Loading/index.d.ts +1 -1
- package/Menu/Menu.js +1 -1
- package/Menu/MenuDivider.js +1 -1
- package/Menu/index.d.ts +1 -1
- package/Message/Message.d.ts +1 -1
- package/Message/Message.js +19 -9
- package/Message/index.d.ts +2 -2
- package/Modal/ModalActions.js +1 -1
- package/Modal/index.d.ts +7 -7
- package/Navigation/Navigation.js +3 -4
- package/Navigation/NavigationItem.js +2 -2
- package/Navigation/NavigationSubMenu.js +4 -7
- package/Navigation/index.d.ts +1 -1
- package/Notification/Notification.js +14 -10
- package/Notification/index.d.ts +2 -2
- package/Notifier/NotifierManager.js +1 -1
- package/Overlay/index.d.ts +1 -1
- package/Pagination/Pagination.d.ts +2 -2
- package/Pagination/PaginationJumper.js +1 -1
- package/Pagination/PaginationPageSize.js +6 -4
- package/Pagination/index.d.ts +4 -4
- package/Pagination/usePagination.js +20 -7
- package/Picker/PickerTrigger.d.ts +3 -3
- package/Picker/index.d.ts +3 -3
- package/Picker/usePickerValue.js +7 -3
- package/Popconfirm/Popconfirm.js +1 -1
- package/Popconfirm/index.d.ts +1 -1
- package/Popover/Popover.js +1 -6
- package/Popover/index.d.ts +1 -1
- package/Popper/Popper.js +1 -1
- package/Portal/Portal.js +2 -4
- package/Portal/index.d.ts +1 -1
- package/Progress/Progress.js +7 -5
- package/Progress/index.d.ts +1 -1
- package/Provider/ConfigProvider.js +1 -1
- package/Provider/index.d.ts +4 -4
- package/Radio/Radio.js +4 -4
- package/Radio/RadioGroup.js +2 -1
- package/Radio/index.d.ts +2 -2
- package/Select/AutoComplete.js +4 -8
- package/Select/Option.js +1 -1
- package/Select/Select.js +3 -7
- package/Select/SelectTriggerTags.js +1 -1
- package/Select/TreeSelect.js +1 -4
- package/Select/index.d.ts +5 -5
- package/Select/useSelectTriggerTags.js +1 -1
- package/Skeleton/Skeleton.js +5 -1
- package/Slider/Slider.js +13 -9
- package/Slider/useSlider.js +57 -50
- package/Stepper/Step.js +4 -2
- package/Stepper/index.d.ts +2 -2
- package/Switch/Switch.js +1 -1
- package/Switch/index.d.ts +1 -1
- package/Table/Table.d.ts +25 -25
- package/Table/Table.js +52 -49
- package/Table/TableBody.js +12 -6
- package/Table/TableBodyRow.js +22 -22
- package/Table/TableCell.js +3 -2
- package/Table/TableExpandedTable.js +9 -7
- package/Table/TableHeader.js +11 -9
- package/Table/draggable/useTableDraggable.js +2 -1
- package/Table/editable/TableEditRenderWrapper.js +2 -2
- package/Table/index.d.ts +5 -5
- package/Table/pagination/TablePagination.js +2 -2
- package/Table/pagination/useTablePagination.d.ts +1 -1
- package/Table/pagination/useTablePagination.js +2 -2
- package/Table/refresh/TableRefresh.js +2 -5
- package/Table/rowSelection/TableRowSelection.js +12 -9
- package/Table/rowSelection/useTableRowSelection.d.ts +1 -1
- package/Table/rowSelection/useTableRowSelection.js +3 -5
- package/Table/sorting/TableSortingIcon.js +2 -2
- package/Table/sorting/useTableSorting.d.ts +1 -1
- package/Table/sorting/useTableSorting.js +11 -5
- package/Table/useTableFetchMore.d.ts +1 -1
- package/Table/useTableFetchMore.js +1 -1
- package/Table/useTableLoading.d.ts +1 -1
- package/Table/useTableLoading.js +1 -1
- package/Table/useTableScroll.js +33 -19
- package/Tabs/index.d.ts +3 -3
- package/Tag/Tag.js +1 -1
- package/Tag/index.d.ts +2 -2
- package/TextField/TextField.js +8 -7
- package/TextField/index.d.ts +1 -1
- package/TextField/useTextFieldControl.js +1 -1
- package/Textarea/Textarea.js +2 -2
- package/TimePanel/index.d.ts +1 -1
- package/TimePicker/TimePicker.js +2 -2
- package/TimePicker/index.d.ts +1 -1
- package/Tooltip/Tooltip.d.ts +1 -1
- package/Tooltip/Tooltip.js +6 -5
- package/Tooltip/index.d.ts +1 -1
- package/Tooltip/useDelayMouseEnterLeave.js +1 -1
- package/Transition/Collapse.js +3 -1
- package/Transition/Fade.js +9 -8
- package/Transition/Grow.js +16 -12
- package/Transition/SlideFade.js +9 -8
- package/Transition/Zoom.js +9 -8
- package/Transition/getTransitionStyleProps.js +1 -1
- package/Transition/index.d.ts +4 -4
- package/Transition/useSetNodeTransition.d.ts +4 -1
- package/Transition/useSetNodeTransition.js +1 -1
- package/Tree/Tree.js +12 -4
- package/Tree/TreeNode.js +17 -11
- package/Tree/TreeNodeList.js +1 -3
- package/Tree/getTreeNodeEntities.js +9 -6
- package/Tree/index.d.ts +2 -2
- package/Tree/traverseTree.js +1 -1
- package/Typography/Typography.js +1 -3
- package/Typography/index.d.ts +1 -1
- package/Upload/UploadInput.js +1 -1
- package/Upload/UploadPicture.d.ts +11 -11
- package/Upload/UploadPictureBlock.js +2 -2
- package/Upload/UploadPictureWall.d.ts +14 -14
- package/Upload/UploadPictureWall.js +17 -5
- package/Upload/UploadResult.js +2 -2
- package/Upload/index.d.ts +3 -3
- package/_internal/InputCheck/InputCheck.js +1 -1
- package/_internal/InputCheck/index.d.ts +1 -1
- package/_internal/InputTriggerPopper/index.d.ts +1 -1
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.js +3 -8
- package/_internal/SlideFadeOverlay/index.d.ts +1 -1
- package/hooks/useIsomorphicLayoutEffect.js +3 -1
- package/index.d.ts +19 -18
- package/index.js +1 -0
- package/package.json +7 -7
- package/utils/get-scrollbar-width.d.ts +1 -0
- package/utils/get-scrollbar-width.js +27 -0
- package/utils/scroll-lock.js +7 -3
package/Transition/Fade.js
CHANGED
|
@@ -71,14 +71,15 @@ const Fade = forwardRef(function Fade(props, ref) {
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
};
|
|
74
|
-
return (jsx(Transition, { ...transitionProps, children: children &&
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
return (jsx(Transition, { ...transitionProps, children: children &&
|
|
75
|
+
((state) => cloneElement(children, {
|
|
76
|
+
...children.props,
|
|
77
|
+
ref: composedNodeRef,
|
|
78
|
+
style: {
|
|
79
|
+
...getStyle(state, inProp),
|
|
80
|
+
...children.props.style,
|
|
81
|
+
},
|
|
82
|
+
})) }));
|
|
82
83
|
});
|
|
83
84
|
var Fade$1 = Fade;
|
|
84
85
|
|
package/Transition/Grow.js
CHANGED
|
@@ -46,14 +46,17 @@ const Grow = forwardRef(function Grow(props, ref) {
|
|
|
46
46
|
easing,
|
|
47
47
|
properties: [
|
|
48
48
|
'opacity',
|
|
49
|
-
[
|
|
49
|
+
[
|
|
50
|
+
'transform',
|
|
51
|
+
(transitionProps, mode) => {
|
|
50
52
|
const { delay: delayProp, duration: durationProp } = transitionProps;
|
|
51
53
|
return {
|
|
52
54
|
...transitionProps,
|
|
53
55
|
delay: mode === 'exit' ? delayProp || durationProp * 0.333 : delayProp,
|
|
54
56
|
duration: durationProp * 0.666,
|
|
55
57
|
};
|
|
56
|
-
}
|
|
58
|
+
},
|
|
59
|
+
],
|
|
57
60
|
],
|
|
58
61
|
resolveAutoDuration: () => {
|
|
59
62
|
var _a, _b;
|
|
@@ -98,16 +101,17 @@ const Grow = forwardRef(function Grow(props, ref) {
|
|
|
98
101
|
},
|
|
99
102
|
/* eslint-enable no-param-reassign */
|
|
100
103
|
};
|
|
101
|
-
return (jsx(Transition, { ...transitionProps, children: children &&
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
return (jsx(Transition, { ...transitionProps, children: children &&
|
|
105
|
+
((state) => cloneElement(children, {
|
|
106
|
+
...children.props,
|
|
107
|
+
ref: composedNodeRef,
|
|
108
|
+
style: {
|
|
109
|
+
visibility: state === 'exited' && !inProp ? 'hidden' : undefined,
|
|
110
|
+
...getStyle(state),
|
|
111
|
+
transformOrigin,
|
|
112
|
+
...children.props.style,
|
|
113
|
+
},
|
|
114
|
+
})) }));
|
|
111
115
|
});
|
|
112
116
|
var Grow$1 = Grow;
|
|
113
117
|
|
package/Transition/SlideFade.js
CHANGED
|
@@ -80,14 +80,15 @@ const SlideFade = forwardRef(function SlideFade(props, ref) {
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
};
|
|
83
|
-
return (jsx(Transition, { ...transitionProps, children: children &&
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
return (jsx(Transition, { ...transitionProps, children: children &&
|
|
84
|
+
((state) => cloneElement(children, {
|
|
85
|
+
...children.props,
|
|
86
|
+
ref: composedNodeRef,
|
|
87
|
+
style: {
|
|
88
|
+
...getStyle(state, inProp, direction),
|
|
89
|
+
...children.props.style,
|
|
90
|
+
},
|
|
91
|
+
})) }));
|
|
91
92
|
});
|
|
92
93
|
var SlideFade$1 = SlideFade;
|
|
93
94
|
|
package/Transition/Zoom.js
CHANGED
|
@@ -71,14 +71,15 @@ const Zoom = forwardRef(function Zoom(props, ref) {
|
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
};
|
|
74
|
-
return (jsx(Transition, { ...transitionProps, children: children &&
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
return (jsx(Transition, { ...transitionProps, children: children &&
|
|
75
|
+
((state) => cloneElement(children, {
|
|
76
|
+
...children.props,
|
|
77
|
+
ref: composedNodeRef,
|
|
78
|
+
style: {
|
|
79
|
+
...getStyle(state, inProp),
|
|
80
|
+
...children.props.style,
|
|
81
|
+
},
|
|
82
|
+
})) }));
|
|
82
83
|
});
|
|
83
84
|
var Zoom$1 = Zoom;
|
|
84
85
|
|
|
@@ -14,7 +14,7 @@ function getTransitionDelay(mode, delay) {
|
|
|
14
14
|
return typeof delay === 'number' ? delay : delay[mode] || 0;
|
|
15
15
|
}
|
|
16
16
|
function getTransitionStyleProps(mode, props) {
|
|
17
|
-
const { delay, duration, easing, resolveAutoDuration
|
|
17
|
+
const { delay, duration, easing, resolveAutoDuration } = props;
|
|
18
18
|
return {
|
|
19
19
|
delay: getTransitionDelay(mode, delay),
|
|
20
20
|
duration: getTransitionDuration(mode, duration, resolveAutoDuration),
|
package/Transition/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { TransitionState, TransitionMode, TransitionDelay, TransitionDuration, TransitionEasing, TransitionImplementationChildProps, TransitionImplementationProps, TransitionProps, default, } from './Transition';
|
|
2
|
-
export { CollapseProps, default as Collapse
|
|
3
|
-
export { FadeProps, default as Fade
|
|
4
|
-
export { GrowProps, default as Grow
|
|
2
|
+
export { CollapseProps, default as Collapse } from './Collapse';
|
|
3
|
+
export { FadeProps, default as Fade } from './Fade';
|
|
4
|
+
export { GrowProps, default as Grow } from './Grow';
|
|
5
5
|
export { SlideFadeDirection, SlideFadeProps, default as SlideFade, } from './SlideFade';
|
|
6
|
-
export { ZoomProps, default as Zoom
|
|
6
|
+
export { ZoomProps, default as Zoom } from './Zoom';
|
|
@@ -2,6 +2,9 @@ import { CSSProperties } from 'react';
|
|
|
2
2
|
import { TransitionMode } from './Transition';
|
|
3
3
|
import { GetTransitionStyleProps, TransitionStyleProps } from './getTransitionStyleProps';
|
|
4
4
|
export interface UseSetNodeTransitionProps extends GetTransitionStyleProps {
|
|
5
|
-
properties: (string | [
|
|
5
|
+
properties: (string | [
|
|
6
|
+
string,
|
|
7
|
+
(props: TransitionStyleProps, mode: TransitionMode) => TransitionStyleProps
|
|
8
|
+
])[];
|
|
6
9
|
}
|
|
7
10
|
export declare function useSetNodeTransition(props: UseSetNodeTransitionProps, style?: CSSProperties): readonly [(node: HTMLElement, mode: TransitionMode) => void, (node: HTMLElement) => void];
|
|
@@ -17,7 +17,7 @@ function useSetNodeTransition(props, style) {
|
|
|
17
17
|
[property] = propertyOrConfig;
|
|
18
18
|
resolvedTransitionProps = overrideTransitionProps(resolvedTransitionProps, mode);
|
|
19
19
|
}
|
|
20
|
-
const { delay, duration, timingFunction
|
|
20
|
+
const { delay, duration, timingFunction } = resolvedTransitionProps;
|
|
21
21
|
return `${property} ${duration}ms ${timingFunction} ${delay}ms`;
|
|
22
22
|
})
|
|
23
23
|
.join(',');
|
package/Tree/Tree.js
CHANGED
|
@@ -16,8 +16,10 @@ import cx from 'clsx';
|
|
|
16
16
|
*/
|
|
17
17
|
const Tree = forwardRef(function Tree(props, ref) {
|
|
18
18
|
const { className, defaultExpandAll, disabledValues, expandControllerRef, expandedValues: expandedValuesProp, includeNodeValue, multiple, nodes, onExpand: onExpandProp, onSelect: onSelectProp, selectMethod = 'toggle', selectable, size, treeNodeListProps, treeNodeProps, treeNodeRefs, values, ...restRootProp } = props;
|
|
19
|
-
const selectedValues = values
|
|
20
|
-
|
|
19
|
+
const selectedValues = values
|
|
20
|
+
? castArray(values)
|
|
21
|
+
: undefined;
|
|
22
|
+
const { expandedValues, onExpand, setExpandedValues } = useTreeExpandedValue({
|
|
21
23
|
nodes,
|
|
22
24
|
defaultExpandAll,
|
|
23
25
|
expandedValues: expandedValuesProp,
|
|
@@ -61,7 +63,10 @@ const Tree = forwardRef(function Tree(props, ref) {
|
|
|
61
63
|
setExpandedValues(expandedValues.filter((v) => v !== value));
|
|
62
64
|
};
|
|
63
65
|
const collapseAll = () => {
|
|
64
|
-
const allNodeValues = nodes.reduce((acc, currentNode) => [
|
|
66
|
+
const allNodeValues = nodes.reduce((acc, currentNode) => [
|
|
67
|
+
...acc,
|
|
68
|
+
...getAllExpandSiblingValues(currentNode.value),
|
|
69
|
+
], []);
|
|
65
70
|
const uniqAllNodeValues = uniq(allNodeValues);
|
|
66
71
|
const newExpandedValues = without(expandedValues, ...uniqAllNodeValues);
|
|
67
72
|
setExpandedValues(newExpandedValues);
|
|
@@ -75,7 +80,10 @@ const Tree = forwardRef(function Tree(props, ref) {
|
|
|
75
80
|
setExpandedValues(uniq([...expandedValues, value]));
|
|
76
81
|
};
|
|
77
82
|
const expandAll = () => {
|
|
78
|
-
const allNodeValues = nodes.reduce((acc, currentNode) => [
|
|
83
|
+
const allNodeValues = nodes.reduce((acc, currentNode) => [
|
|
84
|
+
...acc,
|
|
85
|
+
...getAllExpandSiblingValues(currentNode.value),
|
|
86
|
+
], []);
|
|
79
87
|
const newExpandedValues = uniq([...expandedValues, ...allNodeValues]);
|
|
80
88
|
setExpandedValues(newExpandedValues);
|
|
81
89
|
};
|
package/Tree/TreeNode.js
CHANGED
|
@@ -14,7 +14,7 @@ import cx from 'clsx';
|
|
|
14
14
|
* The react component for `mezzanine` tree node.
|
|
15
15
|
*/
|
|
16
16
|
const TreeNode = forwardRef(function TreeNode(props, ref) {
|
|
17
|
-
const { size: globalSize
|
|
17
|
+
const { size: globalSize } = useContext(MezzanineConfig);
|
|
18
18
|
const { children, className, disabled, dynamicNodesFetching, expanded, indeterminate, label, multiple = false, onExpand: onExpandProp, onSelect: onSelectProp, selectable = false, selected, size = globalSize, value, ...restRootProps } = props;
|
|
19
19
|
const variant = useMemo(() => {
|
|
20
20
|
if (size === 'small') {
|
|
@@ -25,19 +25,25 @@ const TreeNode = forwardRef(function TreeNode(props, ref) {
|
|
|
25
25
|
}
|
|
26
26
|
return 'input2';
|
|
27
27
|
}, [size]);
|
|
28
|
-
const onExpand = onExpandProp
|
|
29
|
-
|
|
28
|
+
const onExpand = onExpandProp
|
|
29
|
+
? () => {
|
|
30
|
+
onExpandProp(value);
|
|
31
|
+
}
|
|
32
|
+
: undefined;
|
|
33
|
+
const onSelect = selectable && onSelectProp && !disabled
|
|
34
|
+
? () => {
|
|
35
|
+
onSelectProp(value);
|
|
36
|
+
}
|
|
37
|
+
: undefined;
|
|
30
38
|
const mayHaveChildren = children || dynamicNodesFetching;
|
|
31
39
|
return (jsxs("li", { ref: ref, ...restRootProps, className: cx(treeClasses.node, treeClasses.nodeSize(size), className), children: [jsxs("div", { className: treeClasses.nodeStem, children: [mayHaveChildren ? (jsx(Icon, { icon: CaretRightIcon, className: cx(treeClasses.nodeCaret, {
|
|
32
40
|
[treeClasses.nodeCaretExpanded]: expanded,
|
|
33
|
-
}), role: "button", onClick: onExpand })) : (jsx("div", {})), multiple
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
[treeClasses.nodeLabelDisabled]: disabled,
|
|
40
|
-
}), children: label }))] }), mayHaveChildren && (jsx(Collapse, { in: expanded, appear: false, children: children || jsx(Loading, { loading: true, iconProps: { size: 16 } }) }))] }));
|
|
41
|
+
}), role: "button", onClick: onExpand })) : (jsx("div", {})), multiple ? (jsx(Checkbox, { checked: !!selected, disabled: disabled, indeterminate: indeterminate, onChange: onSelect, size: size, value: `${value}`, children: label })) : (jsx(Typography, { component: "span", variant: variant, onClick: onSelect, className: cx(treeClasses.nodeLabel, {
|
|
42
|
+
[treeClasses.nodeLabelSelectable]: !children && selectable,
|
|
43
|
+
[treeClasses.nodeLabelIndeterminate]: indeterminate,
|
|
44
|
+
[treeClasses.nodeLabelActive]: selected,
|
|
45
|
+
[treeClasses.nodeLabelDisabled]: disabled,
|
|
46
|
+
}), children: label }))] }), mayHaveChildren && (jsx(Collapse, { in: expanded, appear: false, children: children || jsx(Loading, { loading: true, iconProps: { size: 16 } }) }))] }));
|
|
41
47
|
});
|
|
42
48
|
var TreeNode$1 = TreeNode;
|
|
43
49
|
|
package/Tree/TreeNodeList.js
CHANGED
|
@@ -21,9 +21,7 @@ const TreeNodeList = forwardRef((props, ref) => {
|
|
|
21
21
|
return null;
|
|
22
22
|
return (jsx("ul", { ...restRootProp, ref: ref, className: cx(treeClasses.nodeList, treeClasses.nodeListSize(size), className), children: nodes.map((node) => {
|
|
23
23
|
const { value, nodes: siblingNodes, ...restNodeProps } = node;
|
|
24
|
-
return (jsx(TreeNode, { ref: getNodeRefHandler === null || getNodeRefHandler === void 0 ? void 0 : getNodeRefHandler(value), ...treeNodeProps, multiple: multiple, onExpand: onExpand, onSelect: onSelect, selectable: selectable, size: size, value: value, ...restNodeProps, children: (siblingNodes === null || siblingNodes === void 0 ? void 0 : siblingNodes.length)
|
|
25
|
-
? (jsx(TreeNodeList, { ...restRootProp, className: className, multiple: multiple, nodes: siblingNodes, onExpand: onExpand, onSelect: onSelect, selectable: selectable, size: size, treeNodeRefs: treeNodeRefs }))
|
|
26
|
-
: undefined }, value));
|
|
24
|
+
return (jsx(TreeNode, { ref: getNodeRefHandler === null || getNodeRefHandler === void 0 ? void 0 : getNodeRefHandler(value), ...treeNodeProps, multiple: multiple, onExpand: onExpand, onSelect: onSelect, selectable: selectable, size: size, value: value, ...restNodeProps, children: (siblingNodes === null || siblingNodes === void 0 ? void 0 : siblingNodes.length) ? (jsx(TreeNodeList, { ...restRootProp, className: className, multiple: multiple, nodes: siblingNodes, onExpand: onExpand, onSelect: onSelect, selectable: selectable, size: size, treeNodeRefs: treeNodeRefs })) : undefined }, value));
|
|
27
25
|
}) }));
|
|
28
26
|
});
|
|
29
27
|
var TreeNodeList$1 = TreeNodeList;
|
|
@@ -12,7 +12,7 @@ function getTreeNodeEntities({ disabledValues, expandedValues, includeNodeValue
|
|
|
12
12
|
? new Map(disabledValues.map((val) => [val, true]))
|
|
13
13
|
: undefined;
|
|
14
14
|
function getTreeEntity(node, parentDisabled) {
|
|
15
|
-
const { nodes: currentSiblings, value
|
|
15
|
+
const { nodes: currentSiblings, value } = node;
|
|
16
16
|
const selected = selectedValueMap === null || selectedValueMap === void 0 ? void 0 : selectedValueMap.get(value);
|
|
17
17
|
const expanded = expandedValueMap === null || expandedValueMap === void 0 ? void 0 : expandedValueMap.get(value);
|
|
18
18
|
const disabled = disabledValueMap === null || disabledValueMap === void 0 ? void 0 : disabledValueMap.get(value);
|
|
@@ -33,8 +33,7 @@ function getTreeNodeEntities({ disabledValues, expandedValues, includeNodeValue
|
|
|
33
33
|
const { anyIndeterminate, directSiblings, disabledValues: siblingDisabledValues, selectedValues: siblingSelectedValues, siblingNodes, siblings: siblingEntities, values: siblingValues, } = currentSiblings.reduce((acc, sibling) => {
|
|
34
34
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
35
35
|
const siblingEntity = getTreeEntity(sibling, parentDisabled || disabled);
|
|
36
|
-
const currentAnyIndeterminate =
|
|
37
|
-
acc.anyIndeterminate);
|
|
36
|
+
const currentAnyIndeterminate = siblingEntity.node.indeterminate || acc.anyIndeterminate;
|
|
38
37
|
return {
|
|
39
38
|
anyIndeterminate: currentAnyIndeterminate,
|
|
40
39
|
directSiblings: [...acc.directSiblings, siblingEntity.node.value],
|
|
@@ -63,7 +62,8 @@ function getTreeNodeEntities({ disabledValues, expandedValues, includeNodeValue
|
|
|
63
62
|
if (includeNodeValue) {
|
|
64
63
|
entity.values.push(value);
|
|
65
64
|
}
|
|
66
|
-
const shouldDisabled = siblingDisabledValues.length &&
|
|
65
|
+
const shouldDisabled = siblingDisabledValues.length &&
|
|
66
|
+
!xor(siblingDisabledValues, directSiblings).length;
|
|
67
67
|
if (!disabled && shouldDisabled) {
|
|
68
68
|
entity.node.disabled = true;
|
|
69
69
|
}
|
|
@@ -74,9 +74,12 @@ function getTreeNodeEntities({ disabledValues, expandedValues, includeNodeValue
|
|
|
74
74
|
entities.set(entity.node.value, entity);
|
|
75
75
|
return entity;
|
|
76
76
|
}
|
|
77
|
-
const allDirectSiblingChecked = !!(siblingSelectedValues.length &&
|
|
77
|
+
const allDirectSiblingChecked = !!(siblingSelectedValues.length &&
|
|
78
|
+
!xor(siblingSelectedValues, directSiblings).length);
|
|
78
79
|
entity.node.selected = allDirectSiblingChecked;
|
|
79
|
-
entity.node.indeterminate = allDirectSiblingChecked
|
|
80
|
+
entity.node.indeterminate = allDirectSiblingChecked
|
|
81
|
+
? false
|
|
82
|
+
: !!siblingSelectedValues.length;
|
|
80
83
|
entities.set(entity.node.value, entity);
|
|
81
84
|
return entity;
|
|
82
85
|
}
|
package/Tree/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * from './typings';
|
|
2
2
|
export { uniqueArray, toggleValue, toggleValueWithStatusControl, } from './toggleValue';
|
|
3
|
-
export { traverseTree
|
|
3
|
+
export { traverseTree } from './traverseTree';
|
|
4
4
|
export { UseTreeExpandedValueProps, useTreeExpandedValue, } from './useTreeExpandedValue';
|
|
5
5
|
export { GetTreeNodeEntitiesProps, getTreeNodeEntities, } from './getTreeNodeEntities';
|
|
6
6
|
export { TreeNodeElementProps, TreeNodeProps, default as TreeNode, } from './TreeNode';
|
|
7
7
|
export { TreeNodeListElementProps, TreeNodeListProps, default as TreeNodeList, } from './TreeNodeList';
|
|
8
|
-
export { TreeProps, default
|
|
8
|
+
export { TreeProps, default } from './Tree';
|
package/Tree/traverseTree.js
CHANGED
package/Typography/Typography.js
CHANGED
|
@@ -28,9 +28,7 @@ const Typography = forwardRef(function Typography(props, ref) {
|
|
|
28
28
|
...cssVars,
|
|
29
29
|
...styleProp,
|
|
30
30
|
};
|
|
31
|
-
const title = ellipsis && typeof children === 'string'
|
|
32
|
-
? children
|
|
33
|
-
: undefined;
|
|
31
|
+
const title = ellipsis && typeof children === 'string' ? children : undefined;
|
|
34
32
|
return (jsx(Component, { ...rest, ref: ref, className: cx(typographyClasses.variant(variant), {
|
|
35
33
|
[typographyClasses.align]: align,
|
|
36
34
|
[typographyClasses.color]: color,
|
package/Typography/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementRef, PropsWithoutRef, ReactElement, RefAttributes } from 'react';
|
|
2
2
|
import { TypographyComponent, TypographyProps } from './Typography';
|
|
3
3
|
export type { TypographyAlign, TypographyColor, TypographyDisplay, TypographyVariant, TypographyWeight, } from '@mezzanine-ui/core/typography';
|
|
4
|
-
export type { TypographyComponent, TypographyProps
|
|
4
|
+
export type { TypographyComponent, TypographyProps };
|
|
5
5
|
/**
|
|
6
6
|
* @remark
|
|
7
7
|
* Add type alias here for parsable to react docgen typescript.
|
package/Upload/UploadInput.js
CHANGED
|
@@ -3,7 +3,7 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import { uploadInputClasses } from '@mezzanine-ui/core/upload';
|
|
4
4
|
|
|
5
5
|
const UploadInput = forwardRef((props, ref) => {
|
|
6
|
-
const { accept, disabled = false, multiple = false, onUpload
|
|
6
|
+
const { accept, disabled = false, multiple = false, onUpload } = props;
|
|
7
7
|
return (jsx("input", { ref: ref, accept: accept, "aria-disabled": disabled, className: uploadInputClasses.host, disabled: disabled, multiple: multiple, onClick: (event) => {
|
|
8
8
|
// eslint-disable-next-line no-param-reassign
|
|
9
9
|
event.currentTarget.value = '';
|
|
@@ -24,25 +24,25 @@ export interface UploadPictureProps extends Pick<UploadPictureBlockProps, 'defau
|
|
|
24
24
|
*/
|
|
25
25
|
disabled?: boolean;
|
|
26
26
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
* Fired after value changed.
|
|
28
|
+
*/
|
|
29
29
|
onChange?: (url: string) => void;
|
|
30
30
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
* Fired after user delete image.
|
|
32
|
+
*/
|
|
33
33
|
onDelete?: () => void;
|
|
34
34
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
* Fired after user upload image failed.
|
|
36
|
+
*/
|
|
37
37
|
onError?: (file: File) => void;
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
* Fired when user upload image, need to return Promise<string>.
|
|
40
|
+
* Arg1 is target file, arg2 `setProgress` can set the progress of uploading.
|
|
41
|
+
*/
|
|
42
42
|
onUpload?: (file: File, setProgress: (progress: number) => void) => Promise<string>;
|
|
43
43
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
* Fired after user upload image success.
|
|
45
|
+
*/
|
|
46
46
|
onUploadSuccess?: (file: File, url: string) => void;
|
|
47
47
|
}
|
|
48
48
|
declare const UploadPicture: import("react").ForwardRefExoticComponent<UploadPictureProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -59,8 +59,8 @@ const UploadPictureBlock = forwardRef(function UploadPictureBlock(props, ref) {
|
|
|
59
59
|
const style = {
|
|
60
60
|
...cssVars,
|
|
61
61
|
};
|
|
62
|
-
const showImage = useMemo(() => (
|
|
63
|
-
const canDeleteImage = useMemo(() => (
|
|
62
|
+
const showImage = useMemo(() => (value || previewImage) && !isError, [previewImage, value, isError]);
|
|
63
|
+
const canDeleteImage = useMemo(() => (showImage || isError) && !isLoading, [showImage, isError, isLoading]);
|
|
64
64
|
return (jsxs("button", { ref: ref, type: "button", "aria-disabled": disabled, disabled: disabled, onClick: (event) => {
|
|
65
65
|
var _a;
|
|
66
66
|
if (!showImage && !isError) {
|
|
@@ -38,28 +38,28 @@ export interface UploadPictureWallBaseProps extends Pick<UploadPictureWallItemPr
|
|
|
38
38
|
*/
|
|
39
39
|
multiple?: boolean;
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
* Fired after values changed.
|
|
42
|
+
*/
|
|
43
43
|
onChange?: (urls: string[]) => void;
|
|
44
44
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
* Fired after user delete image.
|
|
46
|
+
*/
|
|
47
47
|
onDelete?: (urls: string[]) => void;
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
* Fired after user upload images failed.
|
|
50
|
+
*/
|
|
51
51
|
onError?: (files: File | File[]) => void;
|
|
52
52
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
* Fired after user upload images success.
|
|
54
|
+
*/
|
|
55
55
|
onUploadSuccess?: (files: File | File[], urls: string | string[]) => void;
|
|
56
56
|
}
|
|
57
57
|
export interface UploadPictureWallSingleUploadProps extends UploadPictureWallBaseProps {
|
|
58
58
|
onMultiUpload?: undefined;
|
|
59
59
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
* Fired when user upload image, need to return Promise<string>.
|
|
61
|
+
* Arg1 is target file, arg2 `setProgress` can set the progress of uploading.
|
|
62
|
+
*/
|
|
63
63
|
onUpload?: (file: File, setProgress: (progress: number) => void) => Promise<string>;
|
|
64
64
|
/**
|
|
65
65
|
* Whether the uploading which is parallel, only enabled when `onUpload` is given .
|
|
@@ -69,9 +69,9 @@ export interface UploadPictureWallSingleUploadProps extends UploadPictureWallBas
|
|
|
69
69
|
}
|
|
70
70
|
export interface UploadPictureWallMultiUploadProps extends UploadPictureWallBaseProps {
|
|
71
71
|
/**
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
* Fired when user upload images, need to return Promise<string[]>.
|
|
73
|
+
* Arg1 is target files, arg2 `setProgress` can set the progress of uploading.
|
|
74
|
+
*/
|
|
75
75
|
onMultiUpload?: (files: File[], setProgress: (progress: number) => void) => Promise<string[]>;
|
|
76
76
|
onUpload?: undefined;
|
|
77
77
|
parallel?: undefined;
|
|
@@ -10,7 +10,9 @@ import cx from 'clsx';
|
|
|
10
10
|
|
|
11
11
|
const UploadPictureWall = forwardRef(function UploadPictureWall(props, ref) {
|
|
12
12
|
const { accept = 'image/*', className, controllerRef, defaultValues, defaultUploadErrorLabel, defaultUploadingLabel, defaultUploadLabel, disabled = false, fileHost = '', maxLength, multiple = true, onChange, onDelete, onError, onMultiUpload, onUpload, onUploadSuccess, parallel = false, style, } = props;
|
|
13
|
-
const [uploadPictureImageLoaders, setUploadPictureImageLoader] = useState(defaultValues
|
|
13
|
+
const [uploadPictureImageLoaders, setUploadPictureImageLoader] = useState(defaultValues
|
|
14
|
+
? compact(defaultValues).map((value) => new ImageUploader(undefined, value))
|
|
15
|
+
: []);
|
|
14
16
|
const [needUploadImageLoaders, setNeedUploadImageLoaders] = useState([]);
|
|
15
17
|
const [needUploadImageLoaderSets, setNeedUploadImageLoaderSets] = useState([]);
|
|
16
18
|
const [values, setValues] = useState(compact(defaultValues) || []);
|
|
@@ -24,8 +26,8 @@ const UploadPictureWall = forwardRef(function UploadPictureWall(props, ref) {
|
|
|
24
26
|
}
|
|
25
27
|
}, [onChange, prevValues, values]);
|
|
26
28
|
useEffect(() => {
|
|
27
|
-
if (prevNeedUploadImageLoadersLength > needUploadImageLoaders.length
|
|
28
|
-
|
|
29
|
+
if (prevNeedUploadImageLoadersLength > needUploadImageLoaders.length ||
|
|
30
|
+
prevNeedUploadImageLoaderSetsLength > needUploadImageLoaderSets.length) {
|
|
29
31
|
setValues(compact(uploadPictureImageLoaders.map((loader) => loader.getUrl())));
|
|
30
32
|
}
|
|
31
33
|
}, [
|
|
@@ -72,7 +74,9 @@ const UploadPictureWall = forwardRef(function UploadPictureWall(props, ref) {
|
|
|
72
74
|
useEffect(() => {
|
|
73
75
|
if (needUploadImageLoaders.length && onUpload) {
|
|
74
76
|
const imageLoader = needUploadImageLoaders[0];
|
|
75
|
-
if (imageLoader &&
|
|
77
|
+
if (imageLoader &&
|
|
78
|
+
imageLoader.getFile() &&
|
|
79
|
+
!imageLoader.getIsLoading()) {
|
|
76
80
|
const setProgress = (progress) => imageLoader.setPercentage(progress);
|
|
77
81
|
imageLoader.setLoadingStatus(true);
|
|
78
82
|
onUpload(imageLoader.getFile(), setProgress)
|
|
@@ -136,7 +140,15 @@ const UploadPictureWall = forwardRef(function UploadPictureWall(props, ref) {
|
|
|
136
140
|
}
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
|
-
}, [
|
|
143
|
+
}, [
|
|
144
|
+
onError,
|
|
145
|
+
onMultiUpload,
|
|
146
|
+
onUpload,
|
|
147
|
+
onUploadSuccess,
|
|
148
|
+
parallel,
|
|
149
|
+
maxLength,
|
|
150
|
+
loaderList,
|
|
151
|
+
]);
|
|
140
152
|
const onImageDelete = useCallback((uid) => {
|
|
141
153
|
setUploadPictureImageLoader((ups) => ups.filter((up) => up.getUid() !== uid));
|
|
142
154
|
setNeedUploadImageLoaders((nUps) => nUps.filter((nUp) => nUp.getUid() !== uid));
|
package/Upload/UploadResult.js
CHANGED
|
@@ -10,7 +10,7 @@ import cx from 'clsx';
|
|
|
10
10
|
* The react component for `mezzanine` upload result.
|
|
11
11
|
*/
|
|
12
12
|
const UploadResult = forwardRef(function UploadResult(props, ref) {
|
|
13
|
-
const { size: globalSize
|
|
13
|
+
const { size: globalSize } = useContext(MezzanineConfig);
|
|
14
14
|
const { className, name, onDelete, onDownload, percentage, size = globalSize, status, style: styleProp, ...rest } = props;
|
|
15
15
|
const done = status === 'done';
|
|
16
16
|
const error = status === 'error';
|
|
@@ -23,7 +23,7 @@ const UploadResult = forwardRef(function UploadResult(props, ref) {
|
|
|
23
23
|
return (jsxs("div", { ...rest, ref: ref, className: cx(uploadResultClasses.host, uploadResultClasses.size(size), {
|
|
24
24
|
[uploadResultClasses.error]: error,
|
|
25
25
|
[uploadResultClasses.loading]: loading,
|
|
26
|
-
}, className), style: style, children: [jsx("span", { className: uploadResultClasses.name, children: name }), jsxs("div", { className: uploadResultClasses.actions, children: [loading &&
|
|
26
|
+
}, className), style: style, children: [jsx("span", { className: uploadResultClasses.name, children: name }), jsxs("div", { className: uploadResultClasses.actions, children: [loading && jsx(Icon, { icon: SpinnerIcon, spin: true }), done && (jsx(Icon, { icon: DownloadIcon, onClick: onDownload, role: "button" })), (done || error) && (jsx(Icon, { icon: TimesIcon, onClick: onDelete, role: "button" }))] })] }));
|
|
27
27
|
});
|
|
28
28
|
var UploadResult$1 = UploadResult;
|
|
29
29
|
|
package/Upload/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { UploadResultSize, UploadResultStatus, } from '@mezzanine-ui/core/upload';
|
|
2
2
|
export { UploadButtonProps, default as UploadButton } from './UploadButton';
|
|
3
|
-
export { UploadPictureControl, UploadPictureProps, default as UploadPicture } from './UploadPicture';
|
|
4
|
-
export { UploadPictureBlockProps, default as UploadPictureBlock } from './UploadPictureBlock';
|
|
5
|
-
export { UploadPictureWallControl, UploadPictureWallProps, default as UploadPictureWall } from './UploadPictureWall';
|
|
3
|
+
export { UploadPictureControl, UploadPictureProps, default as UploadPicture, } from './UploadPicture';
|
|
4
|
+
export { UploadPictureBlockProps, default as UploadPictureBlock, } from './UploadPictureBlock';
|
|
5
|
+
export { UploadPictureWallControl, UploadPictureWallProps, default as UploadPictureWall, } from './UploadPictureWall';
|
|
6
6
|
export { UploadResultProps, default as UploadResult } from './UploadResult';
|
|
@@ -12,7 +12,7 @@ const InputCheck = forwardRef(function InputCheck(props, ref) {
|
|
|
12
12
|
[inputCheckClasses.disabled]: disabled,
|
|
13
13
|
[inputCheckClasses.error]: error,
|
|
14
14
|
[inputCheckClasses.withLabel]: !!children,
|
|
15
|
-
}, className), htmlFor: htmlFor, children: [jsx("span", { className: inputCheckClasses.control, children: control }), children &&
|
|
15
|
+
}, className), htmlFor: htmlFor, children: [jsx("span", { className: inputCheckClasses.control, children: control }), children && jsx("span", { className: inputCheckClasses.label, children: children })] }));
|
|
16
16
|
});
|
|
17
17
|
var InputCheck$1 = InputCheck;
|
|
18
18
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { InputCheckSize, InputCheckGroupOrientation, } from '@mezzanine-ui/core/_internal/input-check';
|
|
2
|
-
export { InputCheckProps, default
|
|
2
|
+
export { InputCheckProps, default } from './InputCheck';
|
|
3
3
|
export { InputCheckGroupProps, default as InputCheckGroup, } from './InputCheckGroup';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { InputTriggerPopperProps, default
|
|
1
|
+
export { InputTriggerPopperProps, default } from './InputTriggerPopper';
|
|
@@ -28,12 +28,7 @@ const SlideFadeOverlay = forwardRef(function SlideFadeOverlay(props, ref) {
|
|
|
28
28
|
onClose();
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
}, [
|
|
32
|
-
disableCloseOnEscapeKeyDown,
|
|
33
|
-
checkIsOnTheTop,
|
|
34
|
-
open,
|
|
35
|
-
onClose,
|
|
36
|
-
]);
|
|
31
|
+
}, [disableCloseOnEscapeKeyDown, checkIsOnTheTop, open, onClose]);
|
|
37
32
|
/** lock body scroll */
|
|
38
33
|
useEffect(() => {
|
|
39
34
|
if (open) {
|
|
@@ -52,9 +47,9 @@ const SlideFadeOverlay = forwardRef(function SlideFadeOverlay(props, ref) {
|
|
|
52
47
|
if (!open && exited) {
|
|
53
48
|
checkAndAllowScroll();
|
|
54
49
|
}
|
|
55
|
-
return (
|
|
50
|
+
return () => {
|
|
56
51
|
requestAnimationFrame(checkAndAllowScroll);
|
|
57
|
-
}
|
|
52
|
+
};
|
|
58
53
|
}, [open, exited]);
|
|
59
54
|
if (!open && exited) {
|
|
60
55
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { SlideFadeOverlayProps, default
|
|
1
|
+
export { SlideFadeOverlayProps, default } from './SlideFadeOverlay';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useLayoutEffect, useEffect } from 'react';
|
|
2
2
|
|
|
3
|
-
const useIsomorphicLayoutEffect = typeof window !== 'undefined' &&
|
|
3
|
+
const useIsomorphicLayoutEffect = typeof window !== 'undefined' &&
|
|
4
|
+
window.document &&
|
|
5
|
+
!!window.document.createElement
|
|
4
6
|
? useLayoutEffect
|
|
5
7
|
: useEffect;
|
|
6
8
|
|