@mezzanine-ui/react 0.14.10 → 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 +18 -18
- package/index.js +1 -0
- package/package.json +7 -7
- package/utils/get-scrollbar-width.d.ts +1 -1
- package/utils/get-scrollbar-width.js +6 -1
- package/utils/scroll-lock.js +2 -2
|
@@ -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 ?
|
|
21
|
+
const targetIcon = severity ? notificationIcons[severity] : undefined;
|
|
22
22
|
const [open, setOpen] = useState(true);
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
if (open && duration) {
|
|
@@ -36,14 +36,18 @@ const NotificationElement = ((props) => {
|
|
|
36
36
|
onCloseProp(reference);
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
const onConfirm = onConfirmProp
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
const onConfirm = onConfirmProp
|
|
40
|
+
? () => {
|
|
41
|
+
setOpen(false);
|
|
42
|
+
onConfirmProp();
|
|
43
|
+
}
|
|
44
|
+
: undefined;
|
|
45
|
+
const onCancel = onCancelProp
|
|
46
|
+
? () => {
|
|
47
|
+
setOpen(false);
|
|
48
|
+
onCancelProp();
|
|
49
|
+
}
|
|
50
|
+
: undefined;
|
|
47
51
|
const onExited = (node) => {
|
|
48
52
|
if (onExitedProp) {
|
|
49
53
|
onExitedProp(node);
|
|
@@ -52,7 +56,7 @@ const NotificationElement = ((props) => {
|
|
|
52
56
|
};
|
|
53
57
|
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
58
|
});
|
|
55
|
-
const { add, config, destroy, remove
|
|
59
|
+
const { add, config, destroy, remove } = createNotifier({
|
|
56
60
|
duration: false,
|
|
57
61
|
render: (notif) => jsx(NotificationElement, { ...notif }),
|
|
58
62
|
setRoot: (root) => {
|
package/Notification/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { NotificationSeverity
|
|
2
|
-
export { NotificationData, default
|
|
1
|
+
export { NotificationSeverity } from '@mezzanine-ui/core/notification';
|
|
2
|
+
export { NotificationData, default } from './Notification';
|
|
@@ -2,7 +2,7 @@ import { jsx, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useState, useMemo, useImperativeHandle, Fragment as Fragment$1 } from 'react';
|
|
3
3
|
|
|
4
4
|
function NotifierManager(props) {
|
|
5
|
-
const { controllerRef, defaultNotifiers = [], maxCount, render
|
|
5
|
+
const { controllerRef, defaultNotifiers = [], maxCount, render } = props;
|
|
6
6
|
const [notifiers, setNotifiers] = useState(defaultNotifiers);
|
|
7
7
|
const notifiersShouldRendered = typeof maxCount === 'number' && notifiers.length > maxCount
|
|
8
8
|
? notifiers.slice(0, maxCount)
|
package/Overlay/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { OverlayProps, default
|
|
1
|
+
export { OverlayProps, default } from './Overlay';
|
|
@@ -36,8 +36,8 @@ export interface PaginationProps extends Omit<DetailedHTMLProps<HTMLAttributes<H
|
|
|
36
36
|
*/
|
|
37
37
|
hintText?: string;
|
|
38
38
|
/**
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
* The hint displayed in the jumper `input` before the user enters a value.
|
|
40
|
+
*/
|
|
41
41
|
inputPlaceholder?: string;
|
|
42
42
|
/**
|
|
43
43
|
* Render the item.
|
|
@@ -10,7 +10,7 @@ const PaginationJumper = forwardRef((props, ref) => {
|
|
|
10
10
|
const { buttonText, className, disabled = false, hintText, inputPlaceholder, onChange: handleChange, pageSize = 5, total = 0, ...rest } = props;
|
|
11
11
|
const [value, setValue] = useState('');
|
|
12
12
|
const [error, setError] = useState(false);
|
|
13
|
-
const totalPages =
|
|
13
|
+
const totalPages = total ? Math.ceil(total / pageSize) : 1;
|
|
14
14
|
const valueValidator = () => {
|
|
15
15
|
const stringToNumber = +value;
|
|
16
16
|
const validNumber = !!stringToNumber;
|
|
@@ -8,10 +8,12 @@ import cx from 'clsx';
|
|
|
8
8
|
|
|
9
9
|
const PaginationPageSize = forwardRef((props, ref) => {
|
|
10
10
|
const { className, disabled = false, label, onChange, options = [10, 20, 50, 100], renderOptionName = (p) => `${p}`, unit, value, ...rest } = props;
|
|
11
|
-
const currentValue = useMemo(() =>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const currentValue = useMemo(() => value
|
|
12
|
+
? {
|
|
13
|
+
id: `${value}`,
|
|
14
|
+
name: renderOptionName(value),
|
|
15
|
+
}
|
|
16
|
+
: undefined, [value, renderOptionName]);
|
|
15
17
|
return (jsxs("div", { ...rest, ref: ref, className: cx(paginationPageSizeClasses.host, className), children: [label ? (jsx(Typography, { color: "text-secondary", component: "div", ellipsis: true, variant: "button3", children: label })) : null, jsx(Select, { disabled: disabled, value: currentValue, onChange: (nextSelection) => onChange === null || onChange === void 0 ? void 0 : onChange(Number(nextSelection.id)), className: paginationPageSizeClasses.select, children: options.map((opt) => (jsx(Option, { value: `${opt}`, children: renderOptionName(opt) }, opt))) }), unit ? (jsx(Typography, { color: "text-secondary", component: "div", ellipsis: true, variant: "button3", children: unit })) : null] }));
|
|
16
18
|
});
|
|
17
19
|
var PaginationPageSize$1 = PaginationPageSize;
|
package/Pagination/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type { PaginationItemType
|
|
1
|
+
export type { PaginationItemType } from '@mezzanine-ui/core/pagination';
|
|
2
2
|
export { PaginationProps, default } from './Pagination';
|
|
3
|
-
export { PaginationItemProps, default as PaginationItem } from './PaginationItem';
|
|
4
|
-
export { PaginationJumperProps, default as PaginationJumper } from './PaginationJumper';
|
|
5
|
-
export { PaginationPageSizeProps, default as PaginationPageSize } from './PaginationPageSize';
|
|
3
|
+
export { PaginationItemProps, default as PaginationItem, } from './PaginationItem';
|
|
4
|
+
export { PaginationJumperProps, default as PaginationJumper, } from './PaginationJumper';
|
|
5
|
+
export { PaginationPageSizeProps, default as PaginationPageSize, } from './PaginationPageSize';
|
|
6
6
|
export { usePagination } from './usePagination';
|
|
@@ -6,7 +6,7 @@ const range = (start, end) => {
|
|
|
6
6
|
};
|
|
7
7
|
function usePagination(props = {}) {
|
|
8
8
|
const { boundaryCount = 1, current = 1, disabled = false, hideNextButton = false, hidePreviousButton = false, pageSize = 10, onChange: handleChange, siblingCount = 1, total = 0, } = props;
|
|
9
|
-
const totalPages =
|
|
9
|
+
const totalPages = total ? Math.ceil(total / pageSize) : 1;
|
|
10
10
|
const itemList = useMemo(() => {
|
|
11
11
|
const startPages = range(1, Math.min(boundaryCount, totalPages));
|
|
12
12
|
const endPages = range(Math.max(totalPages - boundaryCount + 1, boundaryCount + 1), totalPages);
|
|
@@ -31,7 +31,14 @@ function usePagination(props = {}) {
|
|
|
31
31
|
...endPages,
|
|
32
32
|
...(hideNextButton ? [] : ['next']),
|
|
33
33
|
];
|
|
34
|
-
}, [
|
|
34
|
+
}, [
|
|
35
|
+
boundaryCount,
|
|
36
|
+
current,
|
|
37
|
+
hideNextButton,
|
|
38
|
+
hidePreviousButton,
|
|
39
|
+
siblingCount,
|
|
40
|
+
totalPages,
|
|
41
|
+
]);
|
|
35
42
|
const handleClick = (page) => {
|
|
36
43
|
if (handleChange) {
|
|
37
44
|
handleChange(page);
|
|
@@ -45,7 +52,9 @@ function usePagination(props = {}) {
|
|
|
45
52
|
'aria-disabled': disabled ? true : undefined,
|
|
46
53
|
'aria-label': `Go to ${item} page`,
|
|
47
54
|
disabled,
|
|
48
|
-
onClick: () => {
|
|
55
|
+
onClick: () => {
|
|
56
|
+
handleClick(item);
|
|
57
|
+
},
|
|
49
58
|
page: item,
|
|
50
59
|
type: 'page',
|
|
51
60
|
};
|
|
@@ -53,14 +62,18 @@ function usePagination(props = {}) {
|
|
|
53
62
|
const restItemProps = {
|
|
54
63
|
previous: {
|
|
55
64
|
'aria-label': 'Go to previous Page',
|
|
56
|
-
disabled: disabled ||
|
|
57
|
-
onClick: () => {
|
|
65
|
+
disabled: disabled || current - 1 < 1,
|
|
66
|
+
onClick: () => {
|
|
67
|
+
handleClick(current - 1);
|
|
68
|
+
},
|
|
58
69
|
type: item,
|
|
59
70
|
},
|
|
60
71
|
next: {
|
|
61
72
|
'aria-label': 'Go to next Page',
|
|
62
|
-
disabled: disabled ||
|
|
63
|
-
onClick: () => {
|
|
73
|
+
disabled: disabled || current + 1 > totalPages,
|
|
74
|
+
onClick: () => {
|
|
75
|
+
handleClick(current + 1);
|
|
76
|
+
},
|
|
64
77
|
type: item,
|
|
65
78
|
},
|
|
66
79
|
ellipsis: {
|
|
@@ -20,9 +20,9 @@ export interface PickerTriggerProps extends Omit<TextFieldProps, 'active' | 'chi
|
|
|
20
20
|
*/
|
|
21
21
|
readOnly?: boolean;
|
|
22
22
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
* Whether the input is required.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
26
|
required?: boolean;
|
|
27
27
|
/**
|
|
28
28
|
* The value of the input element.
|
package/Picker/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { useTabKeyClose
|
|
1
|
+
export { useTabKeyClose } from './useTabKeyClose';
|
|
2
2
|
export { UsePickerDocumentEventCloseProps, usePickerDocumentEventClose, } from './usePickerDocumentEventClose';
|
|
3
3
|
export { UsePickerInputValueProps, usePickerInputValue, } from './usePickerInputValue';
|
|
4
|
-
export { UsePickerValueProps, usePickerValue
|
|
4
|
+
export { UsePickerValueProps, usePickerValue } from './usePickerValue';
|
|
5
5
|
export { UseRangePickerValueProps, useRangePickerValue, } from './useRangePickerValue';
|
|
6
|
-
export { PickerTriggerProps, default as PickerTrigger
|
|
6
|
+
export { PickerTriggerProps, default as PickerTrigger } from './PickerTrigger';
|
|
7
7
|
export { RangePickerTriggerProps, default as RangePickerTrigger, } from './RangePickerTrigger';
|
package/Picker/usePickerValue.js
CHANGED
|
@@ -6,8 +6,10 @@ import { usePickerInputValue } from './usePickerInputValue.js';
|
|
|
6
6
|
* This hook keep tracks of an internal value.
|
|
7
7
|
*/
|
|
8
8
|
function usePickerValue({ defaultValue, format, formats, inputRef, value: valueProp, }) {
|
|
9
|
-
const { formatToString, parse, valueLocale
|
|
10
|
-
const inputDefaultValue = defaultValue
|
|
9
|
+
const { formatToString, parse, valueLocale } = useCalendarContext();
|
|
10
|
+
const inputDefaultValue = defaultValue
|
|
11
|
+
? formatToString(valueLocale, defaultValue, format)
|
|
12
|
+
: '';
|
|
11
13
|
const [value, setValue] = useState(valueProp);
|
|
12
14
|
const onChange = (val) => {
|
|
13
15
|
setValue(val);
|
|
@@ -21,7 +23,9 @@ function usePickerValue({ defaultValue, format, formats, inputRef, value: valueP
|
|
|
21
23
|
onChange: onInputChange,
|
|
22
24
|
});
|
|
23
25
|
useEffect(() => {
|
|
24
|
-
const valString = valueProp
|
|
26
|
+
const valString = valueProp
|
|
27
|
+
? formatToString(valueLocale, valueProp, format)
|
|
28
|
+
: '';
|
|
25
29
|
setInputValue(valString);
|
|
26
30
|
onChange(valueProp);
|
|
27
31
|
}, [valueProp]);
|
package/Popconfirm/Popconfirm.js
CHANGED
|
@@ -9,7 +9,7 @@ import cx from 'clsx';
|
|
|
9
9
|
|
|
10
10
|
const Popconfirm = forwardRef(function Popconfirm(props, ref) {
|
|
11
11
|
const { className, container, cancelButtonProps, cancelText, confirmButtonProps, confirmText, icon = ExclamationCircleFilledIcon, onCancel, onConfirm, title, ...rest } = props;
|
|
12
|
-
return (jsx(Popover, { ...rest, ref: ref, className: cx(popConfirmClasses.host, className), title:
|
|
12
|
+
return (jsx(Popover, { ...rest, ref: ref, className: cx(popConfirmClasses.host, className), title: jsxs(Fragment, { children: [jsx(Icon, { className: popConfirmClasses.icon, icon: icon }), title] }), children: jsx(ConfirmActions, { cancelButtonProps: cancelButtonProps, cancelText: cancelText, confirmButtonProps: confirmButtonProps, confirmText: confirmText, onCancel: onCancel, onConfirm: onConfirm, size: "small" }) }));
|
|
13
13
|
});
|
|
14
14
|
var Popconfirm$1 = Popconfirm;
|
|
15
15
|
|
package/Popconfirm/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PopconfirmProps, default
|
|
1
|
+
export { PopconfirmProps, default } from './Popconfirm';
|
package/Popover/Popover.js
CHANGED
|
@@ -29,12 +29,7 @@ const Popover = forwardRef(function Popover(props, ref) {
|
|
|
29
29
|
onClose(event);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
}, popoverRef, [
|
|
33
|
-
open,
|
|
34
|
-
disableClickAway,
|
|
35
|
-
onClose,
|
|
36
|
-
popoverRef,
|
|
37
|
-
]);
|
|
32
|
+
}, popoverRef, [open, disableClickAway, onClose, popoverRef]);
|
|
38
33
|
return (jsxs(Popper, { ...rest, ref: composedRef, className: cx(popoverClasses.host, className), open: open, options: {
|
|
39
34
|
...options,
|
|
40
35
|
modifiers: [offsetModifier, ...modifiers],
|
package/Popover/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PopoverProps, default
|
|
1
|
+
export { PopoverProps, default } from './Popover';
|
package/Popper/Popper.js
CHANGED
|
@@ -10,7 +10,7 @@ const Popper = forwardRef(function Popper(props, ref) {
|
|
|
10
10
|
const [popperEl, setPopperEl] = useState(null);
|
|
11
11
|
const composedRef = useComposeRefs([ref, setPopperEl]);
|
|
12
12
|
const anchorEl = getElement(anchor);
|
|
13
|
-
const { attributes, forceUpdate, state, styles, update
|
|
13
|
+
const { attributes, forceUpdate, state, styles, update } = usePopper(anchorEl, popperEl, options);
|
|
14
14
|
useImperativeHandle(controllerRef, () => ({
|
|
15
15
|
attributes,
|
|
16
16
|
forceUpdate,
|
package/Portal/Portal.js
CHANGED
|
@@ -4,10 +4,8 @@ import { createPortal } from 'react-dom';
|
|
|
4
4
|
import { getElement } from '../utils/getElement.js';
|
|
5
5
|
|
|
6
6
|
const Portal = (props) => {
|
|
7
|
-
const { children, container, disablePortal = false
|
|
8
|
-
const [portalElement, setPortalElement] = useState(() => (
|
|
9
|
-
? null
|
|
10
|
-
: getElement(container)));
|
|
7
|
+
const { children, container, disablePortal = false } = props;
|
|
8
|
+
const [portalElement, setPortalElement] = useState(() => disablePortal ? null : getElement(container));
|
|
11
9
|
useEffect(() => {
|
|
12
10
|
if (!disablePortal) {
|
|
13
11
|
setPortalElement(getElement(container) || document.body);
|
package/Portal/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PortalProps, default
|
|
1
|
+
export { PortalProps, default } from './Portal';
|
package/Progress/Progress.js
CHANGED
|
@@ -11,16 +11,18 @@ import cx from 'clsx';
|
|
|
11
11
|
* The react component for `mezzanine` progress.
|
|
12
12
|
*/
|
|
13
13
|
const Progress = forwardRef(function Progress(props, ref) {
|
|
14
|
-
const { size: globalSize
|
|
15
|
-
const { circleProps, className, errorIconProps, percent = 0, percentProps, showInfo = true, size = globalSize, status = percent < 100
|
|
14
|
+
const { size: globalSize } = useContext(MezzanineConfig);
|
|
15
|
+
const { circleProps, className, errorIconProps, percent = 0, percentProps, showInfo = true, size = globalSize, status = percent < 100
|
|
16
|
+
? ProgressStatuses.normal
|
|
17
|
+
: ProgressStatuses.success, successIconProps, type = ProgressTypes.line, ...rest } = props;
|
|
16
18
|
const percentLimited = Math.max(0, Math.min(100, percent));
|
|
17
19
|
const defaultSuccessIcon = type === ProgressTypes.line ? CheckCircleFilledIcon : CheckIcon;
|
|
18
20
|
const defaultErrorIcon = type === ProgressTypes.line ? TimesCircleFilledIcon : TimesIcon;
|
|
19
|
-
const renderInfo = (variant) => (jsx("div", { className: progressClasses.info, children: status === ProgressStatuses.normal
|
|
20
|
-
|
|
21
|
+
const renderInfo = (variant) => (jsx("div", { className: progressClasses.info, children: status === ProgressStatuses.normal ? (
|
|
22
|
+
/** percent text */ jsx(Typography, { className: progressClasses.infoPercent, variant: variant, ...percentProps, children: `${percentLimited}%` })) : (jsxs(Fragment, { children: [status === ProgressStatuses.success && (jsx(Icon, { className: progressClasses.infoIcon, icon: defaultSuccessIcon, ...successIconProps })), status === ProgressStatuses.error && (jsx(Icon, { className: progressClasses.infoIcon, icon: defaultErrorIcon, ...errorIconProps }))] })) }));
|
|
21
23
|
const renderLine = () => (jsxs(Fragment, { children: [jsx("div", { className: progressClasses.lineBg, children: jsx("div", { style: { width: `${percentLimited}%` } }) }), showInfo && renderInfo('input3')] }));
|
|
22
24
|
const renderCircle = () => {
|
|
23
|
-
const { size: circleSize = 80, strokeWidth = 8
|
|
25
|
+
const { size: circleSize = 80, strokeWidth = 8 } = circleProps || {};
|
|
24
26
|
const radius = (circleSize - strokeWidth) / 2;
|
|
25
27
|
const progressLength = percent > 0 ? percent * radius * Math.PI * 0.02 : 0.00001;
|
|
26
28
|
const circleXY = circleSize / 2;
|
package/Progress/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export type { ProgressType, ProgressTypes, ProgressStatus, ProgressStatuses, } from '@mezzanine-ui/core/progress';
|
|
2
|
-
export { ProgressProps, default
|
|
2
|
+
export { ProgressProps, default } from './Progress';
|
|
@@ -3,7 +3,7 @@ import { useMemo } from 'react';
|
|
|
3
3
|
import { MezzanineConfig } from './context.js';
|
|
4
4
|
|
|
5
5
|
function ConfigProvider(props) {
|
|
6
|
-
const { children, size
|
|
6
|
+
const { children, size } = props;
|
|
7
7
|
const context = useMemo(() => ({
|
|
8
8
|
size: size || 'medium',
|
|
9
9
|
}), [size]);
|
package/Provider/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default
|
|
2
|
-
export type { ConfigProviderProps
|
|
3
|
-
export { MezzanineConfig
|
|
4
|
-
export type { MezzanineConfigContext
|
|
1
|
+
export { default } from './ConfigProvider';
|
|
2
|
+
export type { ConfigProviderProps } from './ConfigProvider';
|
|
3
|
+
export { MezzanineConfig } from './context';
|
|
4
|
+
export type { MezzanineConfigContext } from './context';
|
package/Radio/Radio.js
CHANGED
|
@@ -12,8 +12,8 @@ import cx from 'clsx';
|
|
|
12
12
|
* The react component for `mezzanine` radio.
|
|
13
13
|
*/
|
|
14
14
|
const Radio = forwardRef(function Radio(props, ref) {
|
|
15
|
-
const { size: globalSize
|
|
16
|
-
const { disabled: disabledFromFormControl, severity
|
|
15
|
+
const { size: globalSize } = useContext(MezzanineConfig);
|
|
16
|
+
const { disabled: disabledFromFormControl, severity } = useContext(FormControlContext) || {};
|
|
17
17
|
const radioGroup = useContext(RadioGroupContext);
|
|
18
18
|
const { disabled: disabledFromGroup, name: nameFromGroup, size: sizeFromGroup, } = radioGroup || {};
|
|
19
19
|
const { checked: checkedProp, children, defaultChecked, disabled = (disabledFromGroup !== null && disabledFromGroup !== void 0 ? disabledFromGroup : disabledFromFormControl) || false, error = severity === 'error' || false, inputProps, onChange: onChangeProp, size = sizeFromGroup || globalSize, value, ...rest } = props;
|
|
@@ -25,9 +25,9 @@ const Radio = forwardRef(function Radio(props, ref) {
|
|
|
25
25
|
radioGroup,
|
|
26
26
|
value,
|
|
27
27
|
});
|
|
28
|
-
return (jsx(InputCheck, { ...rest, ref: ref, control:
|
|
28
|
+
return (jsx(InputCheck, { ...rest, ref: ref, control: jsx("span", { className: cx(radioClasses.host, {
|
|
29
29
|
[radioClasses.checked]: checked,
|
|
30
|
-
}), children: jsx("input", { ...restInputProps, "aria-checked": checked, "aria-disabled": disabled, checked: checked, disabled: disabled, id: inputId, onChange: onChange, name: name, type: "radio", value: value }) })
|
|
30
|
+
}), children: jsx("input", { ...restInputProps, "aria-checked": checked, "aria-disabled": disabled, checked: checked, disabled: disabled, id: inputId, onChange: onChange, name: name, type: "radio", value: value }) }), disabled: disabled, error: error, htmlFor: inputId, size: size, children: children }));
|
|
31
31
|
});
|
|
32
32
|
var Radio$1 = Radio;
|
|
33
33
|
|
package/Radio/RadioGroup.js
CHANGED
|
@@ -22,7 +22,8 @@ const RadioGroup = forwardRef(function RadioGroup(props, ref) {
|
|
|
22
22
|
size,
|
|
23
23
|
value,
|
|
24
24
|
}), [disabled, name, onChange, size, value]);
|
|
25
|
-
const children = childrenProp ||
|
|
25
|
+
const children = childrenProp ||
|
|
26
|
+
options.map((option) => (jsx(Radio, { disabled: option.disabled, value: option.value, children: option.label }, option.value)));
|
|
26
27
|
return (jsx(RadioGroupContext.Provider, { value: context, children: jsx(InputCheckGroup, { ...rest, ref: ref, role: "radiogroup", children: children }) }));
|
|
27
28
|
});
|
|
28
29
|
var RadioGroup$1 = RadioGroup;
|
package/Radio/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { RadioSize, RadioGroupOption, RadioGroupOrientation, } from '@mezzanine-ui/core/radio';
|
|
2
|
-
export { RadioProps, default
|
|
3
|
-
export { RadioGroupProps, default as RadioGroup
|
|
2
|
+
export { RadioProps, default } from './Radio';
|
|
3
|
+
export { RadioGroupProps, default as RadioGroup } from './RadioGroup';
|
package/Select/AutoComplete.js
CHANGED
|
@@ -50,12 +50,7 @@ const AutoComplete = forwardRef(function Select(props, ref) {
|
|
|
50
50
|
return () => {
|
|
51
51
|
toggleOpen((prev) => !prev);
|
|
52
52
|
};
|
|
53
|
-
}, nodeRef, [
|
|
54
|
-
focused,
|
|
55
|
-
nodeRef,
|
|
56
|
-
open,
|
|
57
|
-
toggleOpen,
|
|
58
|
-
]);
|
|
53
|
+
}, nodeRef, [focused, nodeRef, open, toggleOpen]);
|
|
59
54
|
function getPlaceholder() {
|
|
60
55
|
if (focused && value && !isArray(value)) {
|
|
61
56
|
return value.name;
|
|
@@ -96,14 +91,15 @@ const AutoComplete = forwardRef(function Select(props, ref) {
|
|
|
96
91
|
placeholder: getPlaceholder(),
|
|
97
92
|
role: 'combobox',
|
|
98
93
|
};
|
|
99
|
-
const searchTextExistWithoutOption = !!searchText &&
|
|
94
|
+
const searchTextExistWithoutOption = !!searchText &&
|
|
95
|
+
options.find((option) => option.name === searchText) === undefined;
|
|
100
96
|
const context = useMemo(() => ({
|
|
101
97
|
onChange,
|
|
102
98
|
value,
|
|
103
99
|
}), [onChange, value]);
|
|
104
100
|
return (jsx(SelectControlContext.Provider, { value: context, children: jsxs("div", { ref: nodeRef, className: cx(selectClasses.host, {
|
|
105
101
|
[selectClasses.hostFullWidth]: fullWidth,
|
|
106
|
-
}), children: [jsx(SelectTrigger, { ref: composedRef, active: open, className: className, clearable: true, disabled: disabled, ellipsis: true, error: error, fullWidth: fullWidth, inputRef: inputRef, mode: mode, onTagClose: onChange, onClear: onClear, prefix: prefix, readOnly: false, required: required, inputProps: resolvedInputProps, searchText: searchText, size: size, showTextInputAfterTags: true, suffixAction: onClickSuffixActionIcon, value: value, renderValue: renderValue }), jsxs(InputTriggerPopper, { ref: popperRef, anchor: controlRef, className: selectClasses.popper, open: open, sameWidth: true, options: popperOptions, children: [options.length ? (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: mode === 'single' ? (jsx(Fragment, { children: options.map((option) => (jsx(Option, { value: option.id, children: option.name }, option.id))) })) : (jsxs(Fragment, { children: [selectedOptions.map((option) => (jsx(Option, { value: option.id, children: option.name }, option.id))), unselectedOptions.map((option) => (jsx(Option, { value: option.id, children: option.name }, option.id)))] })) })) : null, searchTextExistWithoutOption && addable ? (jsxs("button", { type: "button", className: selectClasses.autoComplete, onClick: (e) => {
|
|
102
|
+
}), children: [jsx(SelectTrigger, { ref: composedRef, active: open, className: className, clearable: true, disabled: disabled, ellipsis: true, error: error, fullWidth: fullWidth, inputRef: inputRef, mode: mode, onTagClose: onChange, onClear: onClear, prefix: prefix, readOnly: false, required: required, inputProps: resolvedInputProps, searchText: searchText, size: size, showTextInputAfterTags: true, suffixAction: onClickSuffixActionIcon, value: value, renderValue: renderValue }), jsxs(InputTriggerPopper, { ref: popperRef, anchor: controlRef, className: selectClasses.popper, open: open, sameWidth: true, options: popperOptions, children: [options.length ? (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: mode === 'single' ? (jsx(Fragment, { children: options.map((option) => (jsx(Option, { value: option.id, children: option.name }, option.id))) })) : (jsxs(Fragment, { children: [selectedOptions.map((option) => (jsx(Option, { value: option.id, children: option.name }, option.id))), unselectedOptions.map((option) => (jsx(Option, { value: option.id, children: option.name }, option.id)))] })) })) : null, searchTextExistWithoutOption && addable ? (jsxs("button", { type: "button", className: selectClasses.autoComplete, onClick: (e) => {
|
|
107
103
|
var _a;
|
|
108
104
|
e.stopPropagation();
|
|
109
105
|
if (insertText) {
|
package/Select/Option.js
CHANGED
|
@@ -6,7 +6,7 @@ import MenuItem from '../Menu/MenuItem.js';
|
|
|
6
6
|
const Option = forwardRef(function Option(props, ref) {
|
|
7
7
|
const { active: activeProp, children, role = 'option', value, ...rest } = props;
|
|
8
8
|
const selectControl = useContext(SelectControlContext);
|
|
9
|
-
const { onChange, value: selectedValue
|
|
9
|
+
const { onChange, value: selectedValue } = selectControl || {};
|
|
10
10
|
const getActive = () => {
|
|
11
11
|
if (activeProp) {
|
|
12
12
|
return activeProp;
|
package/Select/Select.js
CHANGED
|
@@ -34,7 +34,7 @@ const Select = forwardRef(function Select(props, ref) {
|
|
|
34
34
|
onOpen();
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
const { onChange, onClear, value
|
|
37
|
+
const { onChange, onClear, value } = useSelectValueControl({
|
|
38
38
|
defaultValue,
|
|
39
39
|
mode,
|
|
40
40
|
onChange: onChangeProp,
|
|
@@ -60,11 +60,7 @@ const Select = forwardRef(function Select(props, ref) {
|
|
|
60
60
|
return () => {
|
|
61
61
|
onClose();
|
|
62
62
|
};
|
|
63
|
-
}, nodeRef, [
|
|
64
|
-
nodeRef,
|
|
65
|
-
open,
|
|
66
|
-
toggleOpen,
|
|
67
|
-
]);
|
|
63
|
+
}, nodeRef, [nodeRef, open, toggleOpen]);
|
|
68
64
|
const onClickTextField = () => {
|
|
69
65
|
if (!disabled) {
|
|
70
66
|
onToggleOpen();
|
|
@@ -121,7 +117,7 @@ const Select = forwardRef(function Select(props, ref) {
|
|
|
121
117
|
onChange,
|
|
122
118
|
value,
|
|
123
119
|
}), [onChange, value]);
|
|
124
|
-
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, { 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, onScroll: onMenuScrollCallback, role: menuRole, size: menuSize, style: { border: 0 }, children: children }) })] }) }));
|
|
120
|
+
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, { 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, onScroll: onMenuScrollCallback, role: menuRole, size: menuSize, style: { border: 0 }, children: children }) })] }) }));
|
|
125
121
|
});
|
|
126
122
|
var Select$1 = Select;
|
|
127
123
|
|
|
@@ -11,7 +11,7 @@ const SelectTriggerTags = forwardRef(function SelectTriggerTags(props, ref) {
|
|
|
11
11
|
const { disabled, ellipsis, inputProps, inputRef, onTagClose, readOnly, required, searchText, size, showTextInputAfterTags, value, } = props;
|
|
12
12
|
const controlRef = useRef();
|
|
13
13
|
const composedRef = useComposeRefs([ref, controlRef]);
|
|
14
|
-
const { renderFakeTags, takeCount
|
|
14
|
+
const { renderFakeTags, takeCount } = useSelectTriggerTags({
|
|
15
15
|
controlRef,
|
|
16
16
|
value,
|
|
17
17
|
size,
|
package/Select/TreeSelect.js
CHANGED
|
@@ -114,10 +114,7 @@ const TreeSelect = forwardRef((props, ref) => {
|
|
|
114
114
|
onClose();
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
|
-
}, controlRef, [
|
|
118
|
-
open,
|
|
119
|
-
toggleOpen,
|
|
120
|
-
]);
|
|
117
|
+
}, controlRef, [open, toggleOpen]);
|
|
121
118
|
/** Trigger input props */
|
|
122
119
|
const resolvedInputProps = {
|
|
123
120
|
...inputProps,
|
package/Select/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from './typings';
|
|
2
|
-
export { SelectControlContext
|
|
2
|
+
export { SelectControlContext } from './SelectControlContext';
|
|
3
3
|
export { SelectTriggerProps, SelectTriggerInputProps, default as SelectTrigger, } from './SelectTrigger';
|
|
4
4
|
export { SelectTriggerTagsProps, default as SelectTriggerTags, } from './SelectTriggerTags';
|
|
5
|
-
export { SelectProps, default
|
|
6
|
-
export { OptionProps, default as Option
|
|
5
|
+
export { SelectProps, default } from './Select';
|
|
6
|
+
export { OptionProps, default as Option } from './Option';
|
|
7
7
|
export { MenuItemGroupProps as OptionGroupProps, default as OptionGroup, } from '../Menu/MenuItemGroup';
|
|
8
|
-
export { TreeSelectProps, default as TreeSelect
|
|
9
|
-
export { AutoCompleteProps, default as AutoComplete
|
|
8
|
+
export { TreeSelectProps, default as TreeSelect } from './TreeSelect';
|
|
9
|
+
export { AutoCompleteProps, default as AutoComplete } from './AutoComplete';
|
|
@@ -19,7 +19,7 @@ function calcTakeCount({ tagsWidths, maxWidth, ellipsisTagWidth, setTakeCount, }
|
|
|
19
19
|
setTakeCount(targetCount);
|
|
20
20
|
}
|
|
21
21
|
function useSelectTriggerTags(props) {
|
|
22
|
-
const { controlRef, value, size
|
|
22
|
+
const { controlRef, value, size } = props;
|
|
23
23
|
const [tagsWidths, setTagsWidths] = useState([]);
|
|
24
24
|
const [takeCount, setTakeCount] = useState(0);
|
|
25
25
|
const mznFakeTagClassName = 'mzn-fake-tag';
|
package/Skeleton/Skeleton.js
CHANGED
|
@@ -8,7 +8,11 @@ import cx from 'clsx';
|
|
|
8
8
|
*/
|
|
9
9
|
const Skeleton = forwardRef(function Skeleton(props, ref) {
|
|
10
10
|
const { className, height: skeletonHeight, style: skeletonStyle, type, width: skeletonWidth, ...rest } = props;
|
|
11
|
-
return (jsx("div", { ...rest, ref: ref, className: cx(skeletonClasses.host, type === 'circle' && skeletonClasses.circle, className), style: {
|
|
11
|
+
return (jsx("div", { ...rest, ref: ref, className: cx(skeletonClasses.host, type === 'circle' && skeletonClasses.circle, className), style: {
|
|
12
|
+
width: skeletonWidth,
|
|
13
|
+
height: skeletonHeight,
|
|
14
|
+
...skeletonStyle,
|
|
15
|
+
}, ...rest }));
|
|
12
16
|
});
|
|
13
17
|
var Skeleton$1 = Skeleton;
|
|
14
18
|
|
package/Slider/Slider.js
CHANGED
|
@@ -71,12 +71,16 @@ function SliderComponent(props) {
|
|
|
71
71
|
}
|
|
72
72
|
return roundToStep(target, step, min, max);
|
|
73
73
|
}
|
|
74
|
-
const onStartInputChange = shouldHaveInputHandlers
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
const onStartInputChange = shouldHaveInputHandlers
|
|
75
|
+
? (e) => {
|
|
76
|
+
setStartInputValue(e.target.value);
|
|
77
|
+
}
|
|
78
|
+
: undefined;
|
|
79
|
+
const onEndInputChange = shouldHaveInputHandlers
|
|
80
|
+
? (e) => {
|
|
81
|
+
setEndInputValue(e.target.value);
|
|
82
|
+
}
|
|
83
|
+
: undefined;
|
|
80
84
|
const onStartInputBlur = shouldHaveInputHandlers && isRangeSlider(value)
|
|
81
85
|
? () => {
|
|
82
86
|
const result = sortSliderValue([
|
|
@@ -163,7 +167,7 @@ function SliderComponent(props) {
|
|
|
163
167
|
...inputProps,
|
|
164
168
|
onKeyDown: onStartInputKeydown,
|
|
165
169
|
onBlur: onStartInputBlur,
|
|
166
|
-
} })) : null, jsxs("div", { className: sliderClasses.controls, children: [jsx("div", { ref: railRef, className: sliderClasses.rail, role: "presentation", onMouseDown: handleClickTrackOrRail }), jsx("div", { className: sliderClasses.track, role: "presentation", onMouseDown: handleClickTrackOrRail }), isRangeSlider(value) ? (jsxs(Fragment, { children: [getHandle(value[0], 0), getHandle(value[1], 1)] })) : getHandle(value, -1)] }), withInput ? (jsx(Input, { className: sliderClasses.input, disabled: disabled, onChange: onEndInputChange, value: endInputValue, inputProps: {
|
|
170
|
+
} })) : null, jsxs("div", { className: sliderClasses.controls, children: [jsx("div", { ref: railRef, className: sliderClasses.rail, role: "presentation", onMouseDown: handleClickTrackOrRail }), jsx("div", { className: sliderClasses.track, role: "presentation", onMouseDown: handleClickTrackOrRail }), isRangeSlider(value) ? (jsxs(Fragment, { children: [getHandle(value[0], 0), getHandle(value[1], 1)] })) : (getHandle(value, -1))] }), withInput ? (jsx(Input, { className: sliderClasses.input, disabled: disabled, onChange: onEndInputChange, value: endInputValue, inputProps: {
|
|
167
171
|
...inputProps,
|
|
168
172
|
onKeyDown: onEndInputKeydown,
|
|
169
173
|
onBlur: onEndInputBlur,
|
|
@@ -176,9 +180,9 @@ function SliderComponent(props) {
|
|
|
176
180
|
*/
|
|
177
181
|
const Slider = forwardRef((props, ref) => {
|
|
178
182
|
if (isRangeSlider(props.value)) {
|
|
179
|
-
return
|
|
183
|
+
return jsx(SliderComponent, { ...props, innerRef: ref });
|
|
180
184
|
}
|
|
181
|
-
return
|
|
185
|
+
return jsx(SliderComponent, { ...props, innerRef: ref });
|
|
182
186
|
});
|
|
183
187
|
var Slider$1 = Slider;
|
|
184
188
|
|