@mezzanine-ui/react 0.9.2 → 0.10.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 +5 -4
- package/Accordion/AccordionDetails.js +2 -2
- package/Accordion/AccordionSummary.js +3 -4
- package/Alert/Alert.js +1 -3
- package/AppBar/AppBar.js +1 -1
- package/AppBar/AppBarBrand.d.ts +1 -1
- package/AppBar/AppBarBrand.js +1 -1
- package/AppBar/AppBarMain.d.ts +1 -1
- package/AppBar/AppBarMain.js +1 -1
- package/AppBar/AppBarSupport.d.ts +1 -1
- package/AppBar/AppBarSupport.js +1 -1
- package/Badge/Badge.js +2 -2
- package/Badge/BadgeContainer.d.ts +1 -1
- package/Badge/BadgeContainer.js +1 -1
- package/Button/Button.d.ts +2 -2
- package/Button/Button.js +3 -3
- package/Button/ButtonGroup.js +3 -3
- package/Button/IconButton.d.ts +3 -3
- package/Button/IconButton.js +1 -1
- package/Calendar/Calendar.js +9 -10
- package/Calendar/CalendarCell.js +2 -2
- package/Calendar/CalendarContext.d.ts +3 -3
- package/Calendar/CalendarContext.js +20 -12
- package/Calendar/CalendarControls.js +3 -3
- package/Calendar/CalendarDayOfWeek.js +1 -1
- package/Calendar/CalendarDays.js +4 -5
- package/Calendar/CalendarMonths.js +4 -4
- package/Calendar/CalendarWeeks.js +4 -5
- package/Calendar/CalendarYears.js +4 -4
- package/Calendar/useCalendarControls.d.ts +2 -3
- package/Card/Card.js +5 -5
- package/Card/CardActions.js +1 -2
- package/Checkbox/CheckAll.js +2 -2
- package/Checkbox/Checkbox.js +2 -2
- package/Checkbox/CheckboxGroup.js +2 -2
- package/ConfirmActions/ConfirmActions.js +1 -2
- package/DatePicker/DatePicker.js +2 -3
- package/DatePicker/DatePickerCalendar.js +1 -1
- package/DateRangePicker/DateRangePicker.js +2 -3
- package/DateRangePicker/DateRangePickerCalendar.js +3 -4
- package/DateRangePicker/useDateRangeCalendarControls.d.ts +1 -2
- package/DateRangePicker/useDateRangePickerValue.d.ts +12 -13
- package/DateTimePicker/DateTimePicker.js +2 -3
- package/DateTimePicker/DateTimePickerPanel.js +1 -3
- package/Drawer/Drawer.js +1 -1
- package/Dropdown/Dropdown.js +2 -2
- package/Empty/Empty.js +3 -4
- package/Form/FormField.js +2 -2
- package/Form/FormLabel.js +1 -2
- package/Form/FormMessage.d.ts +1 -1
- package/Form/FormMessage.js +1 -1
- package/Form/useAutoCompleteValueControl.d.ts +30 -11
- package/Form/useAutoCompleteValueControl.js +71 -31
- package/Form/useInputWithTagsModeValue.js +2 -1
- package/Form/useSelectValueControl.d.ts +1 -1
- package/Icon/Icon.js +2 -2
- package/Input/Input.js +2 -3
- package/Loading/Loading.js +4 -5
- package/Menu/Menu.js +1 -1
- package/Menu/MenuDivider.d.ts +1 -1
- package/Menu/MenuDivider.js +1 -1
- package/Menu/MenuItem.js +2 -3
- package/Menu/MenuItemGroup.js +1 -2
- package/Message/Message.js +2 -3
- package/Modal/Modal.js +2 -2
- package/Modal/ModalActions.js +1 -1
- package/Modal/ModalBody.d.ts +1 -1
- package/Modal/ModalBody.js +1 -1
- package/Modal/ModalFooter.d.ts +1 -1
- package/Modal/ModalFooter.js +1 -1
- package/Modal/ModalHeader.js +2 -3
- package/Modal/useModalContainer.js +1 -1
- package/Navigation/Navigation.js +2 -2
- package/Navigation/NavigationItem.js +1 -1
- package/Navigation/NavigationSubMenu.js +3 -5
- package/Notification/Notification.js +2 -7
- package/Notifier/NotifierManager.js +1 -1
- package/Notifier/createNotifier.js +1 -1
- package/Overlay/Overlay.js +3 -3
- package/PageFooter/PageFooter.js +1 -2
- package/Pagination/Pagination.js +2 -3
- package/Pagination/PaginationItem.js +4 -4
- package/Pagination/PaginationJumper.js +2 -4
- package/Picker/PickerTrigger.js +1 -1
- package/Picker/RangePickerTrigger.js +1 -3
- package/Picker/usePickerInputValue.d.ts +2 -2
- package/Picker/usePickerValue.d.ts +6 -7
- package/Picker/useRangePickerValue.d.ts +9 -10
- package/Popconfirm/Popconfirm.js +1 -1
- package/Popover/Popover.js +2 -3
- package/Popper/Popper.js +2 -2
- package/Portal/Portal.js +1 -1
- package/Progress/Progress.js +5 -7
- package/Radio/Radio.js +2 -2
- package/Radio/RadioGroup.js +2 -2
- package/Select/AutoComplete.d.ts +40 -13
- package/Select/AutoComplete.js +37 -28
- package/Select/Option.js +2 -2
- package/Select/Select.d.ts +2 -50
- package/Select/Select.js +15 -49
- package/Select/SelectTrigger.d.ts +8 -1
- package/Select/SelectTrigger.js +8 -12
- package/Select/SelectTriggerTags.d.ts +19 -0
- package/Select/SelectTriggerTags.js +33 -0
- package/Select/TreeSelect.js +2 -3
- package/Select/index.d.ts +1 -0
- package/Select/index.js +1 -0
- package/Select/useSelectTriggerTags.d.ts +19 -0
- package/Select/useSelectTriggerTags.js +61 -0
- package/Skeleton/Skeleton.js +1 -1
- package/Slider/Slider.d.ts +1 -1
- package/Slider/Slider.js +7 -11
- package/Stepper/Step.js +2 -2
- package/Stepper/Stepper.js +1 -1
- package/Switch/Switch.js +2 -3
- package/Table/Table.d.ts +1 -1
- package/Table/Table.js +3 -10
- package/Table/TableBody.js +2 -4
- package/Table/TableBodyRow.js +4 -7
- package/Table/TableCell.js +3 -3
- package/Table/TableExpandedTable.js +5 -6
- package/Table/TableHeader.d.ts +2 -1
- package/Table/TableHeader.js +3 -6
- package/Table/editable/TableEditRenderWrapper.js +2 -2
- package/Table/expandable/TableExpandable.js +2 -2
- package/Table/pagination/TablePagination.js +1 -2
- package/Table/refresh/TableRefresh.js +1 -1
- package/Table/rowSelection/TableRowSelection.js +5 -6
- package/Table/sorting/TableSortingIcon.js +2 -2
- package/Table/sorting/useTableSorting.d.ts +2 -2
- package/Table/useTableScroll.d.ts +178 -178
- package/Tabs/Tab.js +2 -2
- package/Tabs/TabPane.js +1 -1
- package/Tabs/Tabs.js +1 -3
- package/Tag/Tag.js +3 -4
- package/TextField/TextField.js +3 -3
- package/TextField/useTextFieldControl.d.ts +2 -2
- package/Textarea/Textarea.js +2 -3
- package/TimePanel/TimePanel.js +1 -4
- package/TimePanel/TimePanelAction.js +1 -1
- package/TimePanel/TimePanelColumn.js +2 -5
- package/TimePicker/TimePicker.js +2 -3
- package/TimePicker/TimePickerPanel.js +1 -1
- package/Tooltip/Tooltip.js +3 -3
- package/Transition/Collapse.js +3 -2
- package/Transition/Fade.js +2 -2
- package/Transition/Grow.js +3 -2
- package/Transition/SlideFade.js +2 -2
- package/Transition/Transition.js +2 -2
- package/Transition/Zoom.js +2 -2
- package/Tree/Tree.js +1 -1
- package/Tree/TreeNode.js +5 -7
- package/Tree/TreeNodeList.js +5 -4
- package/Tree/getTreeNodeEntities.js +6 -3
- package/Typography/Typography.d.ts +2 -2
- package/Typography/Typography.js +2 -2
- package/Upload/UploadButton.js +2 -2
- package/Upload/UploadInput.js +1 -1
- package/Upload/UploadPicture.js +1 -1
- package/Upload/UploadPictureBlock.js +2 -8
- package/Upload/UploadPictureWall.d.ts +1 -1
- package/Upload/UploadPictureWall.js +1 -2
- package/Upload/UploadPictureWallItem.js +1 -1
- package/Upload/UploadResult.js +2 -5
- package/_internal/InputCheck/InputCheck.js +2 -3
- package/_internal/InputCheck/InputCheckGroup.js +1 -1
- package/_internal/InputTriggerPopper/InputTriggerPopper.js +2 -2
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -0
- package/package.json +3 -3
|
@@ -38,15 +38,13 @@ const PaginationJumper = forwardRef((props, ref) => {
|
|
|
38
38
|
handleClick();
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
return (jsxs("div",
|
|
42
|
-
jsx(Input, { disabled: disabled, error: error, onChange: (e) => {
|
|
41
|
+
return (jsxs("div", { ...rest, ref: ref, className: cx(paginationJumperClasses.host, className), children: [jsx(Typography, { color: disabled ? 'text-disabled' : 'text-primary', component: "div", ellipsis: true, variant: "input2", children: hintText }), jsx(Input, { disabled: disabled, error: error, onChange: (e) => {
|
|
43
42
|
setValue(e.target.value);
|
|
44
43
|
}, placeholder: inputPlaceholder, inputProps: {
|
|
45
44
|
type: 'number',
|
|
46
45
|
className: paginationJumperClasses.input,
|
|
47
46
|
onKeyDown: handleKeyDown,
|
|
48
|
-
}, value: value },
|
|
49
|
-
jsx(Button, Object.assign({ disabled: disabled, onClick: handleClick }, { children: buttonText }), void 0)] }), void 0));
|
|
47
|
+
}, value: value }), jsx(Button, { disabled: disabled, onClick: handleClick, children: buttonText })] }));
|
|
50
48
|
});
|
|
51
49
|
var PaginationJumper$1 = PaginationJumper;
|
|
52
50
|
|
package/Picker/PickerTrigger.js
CHANGED
|
@@ -9,7 +9,7 @@ import cx from 'clsx';
|
|
|
9
9
|
*/
|
|
10
10
|
const PickerTrigger = forwardRef(function PickerTrigger(props, ref) {
|
|
11
11
|
const { className, disabled, inputProps, inputRef, onChange, placeholder, readOnly, required, value, ...restTextFieldProps } = props;
|
|
12
|
-
return (jsx(TextField,
|
|
12
|
+
return (jsx(TextField, { ...restTextFieldProps, ref: ref, active: !!value, className: cx(pickerClasses.host, className), disabled: disabled, children: jsx("input", { ...inputProps, ref: inputRef, "aria-disabled": disabled, "aria-multiline": false, "aria-readonly": readOnly, "aria-required": required, disabled: disabled, onChange: onChange, placeholder: placeholder, readOnly: readOnly, required: required, value: value }) }));
|
|
13
13
|
});
|
|
14
14
|
var PickerTrigger$1 = PickerTrigger;
|
|
15
15
|
|
|
@@ -11,9 +11,7 @@ import cx from 'clsx';
|
|
|
11
11
|
*/
|
|
12
12
|
const RangePickerTrigger = forwardRef(function DateRangePickerTrigger(props, ref) {
|
|
13
13
|
const { className, disabled, inputFromPlaceholder, inputFromProps, inputFromRef, inputFromValue, inputToPlaceholder, inputToProps, inputToRef, inputToValue, onIconClick, onInputFromChange, onInputToChange, readOnly, required, ...restTextFieldProps } = props;
|
|
14
|
-
return (jsxs(TextField,
|
|
15
|
-
jsx(Icon, { icon: ArrowRightIcon, className: pickerClasses.arrowIcon }, void 0),
|
|
16
|
-
jsx("input", Object.assign({}, inputToProps, { ref: inputToRef, "aria-disabled": disabled, "aria-multiline": false, "aria-readonly": readOnly, "aria-required": required, disabled: disabled, onChange: onInputToChange, placeholder: inputToPlaceholder, readOnly: readOnly, required: required, value: inputToValue }), void 0)] }), void 0));
|
|
14
|
+
return (jsxs(TextField, { ...restTextFieldProps, ref: ref, active: !!inputFromValue || !!inputToValue, className: cx(pickerClasses.host, className), disabled: disabled, children: [jsx("input", { ...inputFromProps, ref: inputFromRef, "aria-disabled": disabled, "aria-multiline": false, "aria-readonly": readOnly, "aria-required": required, disabled: disabled, onChange: onInputFromChange, placeholder: inputFromPlaceholder, readOnly: readOnly, required: required, value: inputFromValue }), jsx(Icon, { icon: ArrowRightIcon, className: pickerClasses.arrowIcon }), jsx("input", { ...inputToProps, ref: inputToRef, "aria-disabled": disabled, "aria-multiline": false, "aria-readonly": readOnly, "aria-required": required, disabled: disabled, onChange: onInputToChange, placeholder: inputToPlaceholder, readOnly: readOnly, required: required, value: inputToValue })] }));
|
|
17
15
|
});
|
|
18
16
|
var RangePickerTrigger$1 = RangePickerTrigger;
|
|
19
17
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { ChangeEventHandler } from 'react';
|
|
2
2
|
export interface UsePickerInputValueProps {
|
|
3
3
|
defaultValue?: string;
|
|
4
4
|
initialValue?: string;
|
|
@@ -6,7 +6,7 @@ export interface UsePickerInputValueProps {
|
|
|
6
6
|
}
|
|
7
7
|
export declare function usePickerInputValue(props?: UsePickerInputValueProps): {
|
|
8
8
|
inputValue: string;
|
|
9
|
-
inputChangeHandler:
|
|
9
|
+
inputChangeHandler: ChangeEventHandler<HTMLInputElement>;
|
|
10
10
|
onChange: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
11
11
|
};
|
|
12
12
|
export default usePickerInputValue;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="moment" />
|
|
2
1
|
import { DateType } from '@mezzanine-ui/core/calendar';
|
|
3
|
-
import { RefObject } from 'react';
|
|
2
|
+
import { FocusEventHandler, KeyboardEventHandler, RefObject } from 'react';
|
|
4
3
|
export declare type UsePickerValueProps = {
|
|
5
4
|
defaultValue?: DateType;
|
|
6
5
|
format: string;
|
|
@@ -13,9 +12,9 @@ export declare type UsePickerValueProps = {
|
|
|
13
12
|
*/
|
|
14
13
|
export declare function usePickerValue({ defaultValue, format, formats, inputRef, value: valueProp, }: UsePickerValueProps): {
|
|
15
14
|
inputValue: string;
|
|
16
|
-
onBlur:
|
|
17
|
-
onChange: (val?:
|
|
18
|
-
onInputChange:
|
|
19
|
-
onKeyDown:
|
|
20
|
-
value:
|
|
15
|
+
onBlur: FocusEventHandler<HTMLInputElement>;
|
|
16
|
+
onChange: (val?: string | undefined) => void;
|
|
17
|
+
onInputChange: import("react").ChangeEventHandler<HTMLInputElement>;
|
|
18
|
+
onKeyDown: KeyboardEventHandler<HTMLInputElement>;
|
|
19
|
+
value: string | undefined;
|
|
21
20
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="moment" />
|
|
2
1
|
import { RangePickerPickingValue, RangePickerValue } from '@mezzanine-ui/core/picker';
|
|
3
|
-
import { RefObject } from 'react';
|
|
2
|
+
import { ChangeEventHandler, KeyboardEventHandler, RefObject } from 'react';
|
|
4
3
|
import { UsePickerValueProps } from './usePickerValue';
|
|
5
4
|
export interface UseRangePickerValueProps extends Pick<UsePickerValueProps, 'format' | 'formats'> {
|
|
6
5
|
inputFromRef: RefObject<HTMLInputElement>;
|
|
@@ -10,12 +9,12 @@ export interface UseRangePickerValueProps extends Pick<UsePickerValueProps, 'for
|
|
|
10
9
|
export declare function useRangePickerValue({ format, formats, inputFromRef, inputToRef, value: valueProp, }: UseRangePickerValueProps): {
|
|
11
10
|
inputFromValue: string;
|
|
12
11
|
inputToValue: string;
|
|
13
|
-
onChange: (target?:
|
|
14
|
-
onFromBlur:
|
|
15
|
-
onFromKeyDown:
|
|
16
|
-
onInputFromChange:
|
|
17
|
-
onInputToChange:
|
|
18
|
-
onToBlur:
|
|
19
|
-
onToKeyDown:
|
|
20
|
-
value: RangePickerPickingValue
|
|
12
|
+
onChange: (target?: RangePickerPickingValue<string> | undefined) => RangePickerPickingValue | undefined;
|
|
13
|
+
onFromBlur: import("react").FocusEventHandler<HTMLInputElement>;
|
|
14
|
+
onFromKeyDown: KeyboardEventHandler<HTMLInputElement>;
|
|
15
|
+
onInputFromChange: ChangeEventHandler<HTMLInputElement>;
|
|
16
|
+
onInputToChange: ChangeEventHandler<HTMLInputElement>;
|
|
17
|
+
onToBlur: import("react").FocusEventHandler<HTMLInputElement>;
|
|
18
|
+
onToKeyDown: KeyboardEventHandler<HTMLInputElement>;
|
|
19
|
+
value: RangePickerPickingValue<string>;
|
|
21
20
|
};
|
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,
|
|
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/Popover/Popover.js
CHANGED
|
@@ -35,11 +35,10 @@ const Popover = forwardRef(function Popover(props, ref) {
|
|
|
35
35
|
onClose,
|
|
36
36
|
popoverRef,
|
|
37
37
|
]);
|
|
38
|
-
return (jsxs(Popper,
|
|
38
|
+
return (jsxs(Popper, { ...rest, ref: composedRef, className: cx(popoverClasses.host, className), open: open, options: {
|
|
39
39
|
...options,
|
|
40
40
|
modifiers: [offsetModifier, ...modifiers],
|
|
41
|
-
}
|
|
42
|
-
children && jsx("div", Object.assign({ className: popoverClasses.content }, { children: children }), void 0)] }), void 0));
|
|
41
|
+
}, children: [title && jsx("div", { className: popoverClasses.title, children: title }), children && jsx("div", { className: popoverClasses.content, children: children })] }));
|
|
43
42
|
});
|
|
44
43
|
var Popover$1 = Popover;
|
|
45
44
|
|
package/Popper/Popper.js
CHANGED
|
@@ -21,10 +21,10 @@ const Popper = forwardRef(function Popper(props, ref) {
|
|
|
21
21
|
if (!open) {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
|
-
return (jsx(Portal,
|
|
24
|
+
return (jsx(Portal, { container: container, disablePortal: disablePortal, children: jsx("div", { ...rest, ref: composedRef, style: {
|
|
25
25
|
...style,
|
|
26
26
|
...styles.popper,
|
|
27
|
-
}
|
|
27
|
+
}, ...attributes.popper, children: children }) }));
|
|
28
28
|
});
|
|
29
29
|
var Popper$1 = Popper;
|
|
30
30
|
|
package/Portal/Portal.js
CHANGED
|
@@ -14,7 +14,7 @@ const Portal = (props) => {
|
|
|
14
14
|
}
|
|
15
15
|
}, [container, disablePortal]);
|
|
16
16
|
if (disablePortal || !portalElement) {
|
|
17
|
-
return jsx(Fragment, { children: children }
|
|
17
|
+
return jsx(Fragment, { children: children });
|
|
18
18
|
}
|
|
19
19
|
return createPortal(children, portalElement);
|
|
20
20
|
};
|
package/Progress/Progress.js
CHANGED
|
@@ -14,19 +14,17 @@ const Progress = forwardRef(function Progress(props, ref) {
|
|
|
14
14
|
const percentLimited = Math.max(0, Math.min(100, percent));
|
|
15
15
|
const defaultSuccessIcon = type === ProgressTypes.line ? CheckCircleFilledIcon : CheckIcon;
|
|
16
16
|
const defaultErrorIcon = type === ProgressTypes.line ? TimesCircleFilledIcon : TimesIcon;
|
|
17
|
-
const renderInfo = (variant) => (jsx("div",
|
|
18
|
-
? /** percent text */ (jsx(Typography,
|
|
19
|
-
|
|
20
|
-
const renderLine = () => (jsxs(Fragment, { children: [jsx("div", Object.assign({ className: progressClasses.lineBg }, { children: jsx("div", { style: { width: `${percentLimited}%` } }, void 0) }), void 0), showInfo && renderInfo('input3')] }, void 0));
|
|
17
|
+
const renderInfo = (variant) => (jsx("div", { className: progressClasses.info, children: status === ProgressStatuses.normal
|
|
18
|
+
? /** 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 }))] })) }));
|
|
19
|
+
const renderLine = () => (jsxs(Fragment, { children: [jsx("div", { className: progressClasses.lineBg, children: jsx("div", { style: { width: `${percentLimited}%` } }) }), showInfo && renderInfo('input3')] }));
|
|
21
20
|
const renderCircle = () => {
|
|
22
21
|
const { size: circleSize = 80, strokeWidth = 8, } = circleProps || {};
|
|
23
22
|
const radius = (circleSize - strokeWidth) / 2;
|
|
24
23
|
const progressLength = percent > 0 ? percent * radius * Math.PI * 0.02 : 0.00001;
|
|
25
24
|
const circleXY = circleSize / 2;
|
|
26
|
-
return (jsxs(Fragment, { children: [jsxs("svg",
|
|
27
|
-
jsx("circle", { className: progressClasses.circleFiller, cx: circleXY, cy: circleXY, r: radius, strokeWidth: strokeWidth, strokeDasharray: `${progressLength.toString()} 999` }, void 0)] }), void 0), showInfo && renderInfo('button3')] }, void 0));
|
|
25
|
+
return (jsxs(Fragment, { children: [jsxs("svg", { style: { boxSizing: 'border-box' }, height: circleSize, width: circleSize, children: [jsx("circle", { className: progressClasses.circleBg, cx: circleXY, cy: circleXY, r: radius, strokeWidth: strokeWidth }), jsx("circle", { className: progressClasses.circleFiller, cx: circleXY, cy: circleXY, r: radius, strokeWidth: strokeWidth, strokeDasharray: `${progressLength.toString()} 999` })] }), showInfo && renderInfo('button3')] }));
|
|
28
26
|
};
|
|
29
|
-
return (jsxs("div",
|
|
27
|
+
return (jsxs("div", { ref: ref, className: cx(progressClasses.host, className, status === ProgressStatuses.success && progressClasses.success, status === ProgressStatuses.error && progressClasses.error, type === ProgressTypes.line && progressClasses.lineVariant, type === ProgressTypes.circle && progressClasses.circleVariant, progressClasses.size(size)), ...rest, children: [type === ProgressTypes.line && renderLine(), type === ProgressTypes.circle && renderCircle()] }));
|
|
30
28
|
});
|
|
31
29
|
var Progress$1 = Progress;
|
|
32
30
|
|
package/Radio/Radio.js
CHANGED
|
@@ -23,9 +23,9 @@ const Radio = forwardRef(function Radio(props, ref) {
|
|
|
23
23
|
radioGroup,
|
|
24
24
|
value,
|
|
25
25
|
});
|
|
26
|
-
return (jsx(InputCheck,
|
|
26
|
+
return (jsx(InputCheck, { ...rest, ref: ref, control: (jsx("span", { className: cx(radioClasses.host, {
|
|
27
27
|
[radioClasses.checked]: checked,
|
|
28
|
-
})
|
|
28
|
+
}), 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 }));
|
|
29
29
|
});
|
|
30
30
|
var Radio$1 = Radio;
|
|
31
31
|
|
package/Radio/RadioGroup.js
CHANGED
|
@@ -22,8 +22,8 @@ const RadioGroup = forwardRef(function RadioGroup(props, ref) {
|
|
|
22
22
|
size,
|
|
23
23
|
value,
|
|
24
24
|
};
|
|
25
|
-
const children = childrenProp || options.map((option) => (jsx(Radio,
|
|
26
|
-
return (jsx(RadioGroupContext.Provider,
|
|
25
|
+
const children = childrenProp || options.map((option) => (jsx(Radio, { disabled: option.disabled, value: option.value, children: option.label }, option.value)));
|
|
26
|
+
return (jsx(RadioGroupContext.Provider, { value: context, children: jsx(InputCheckGroup, { ...rest, ref: ref, role: "radiogroup", children: children }) }));
|
|
27
27
|
});
|
|
28
28
|
var RadioGroup$1 = RadioGroup;
|
|
29
29
|
|
package/Select/AutoComplete.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SelectInputSize } from '@mezzanine-ui/core/select';
|
|
3
|
+
import { SelectValue } from './typings';
|
|
3
4
|
import { MenuProps } from '../Menu';
|
|
4
5
|
import { PopperProps } from '../Popper';
|
|
5
6
|
import { PickRenameMulti } from '../utils/general';
|
|
6
7
|
import { SelectTriggerProps, SelectTriggerInputProps } from './SelectTrigger';
|
|
7
|
-
export interface
|
|
8
|
+
export interface AutoCompleteBaseProps extends Omit<SelectTriggerProps, 'active' | 'clearable' | 'forceHideSuffixActionIcon' | 'mode' | 'onClick' | 'onKeyDown' | 'onChange' | 'renderValue' | 'inputProps' | 'suffixActionIcon' | 'value'>, PickRenameMulti<Pick<MenuProps, 'itemsInView' | 'maxHeight' | 'role' | 'size'>, {
|
|
8
9
|
maxHeight: 'menuMaxHeight';
|
|
9
10
|
role: 'menuRole';
|
|
10
11
|
size: 'menuSize';
|
|
@@ -16,10 +17,6 @@ export interface AutoCompleteProps extends Omit<SelectTriggerProps, 'active' | '
|
|
|
16
17
|
* @default false
|
|
17
18
|
*/
|
|
18
19
|
addable?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* The default selection
|
|
21
|
-
*/
|
|
22
|
-
defaultValue?: string;
|
|
23
20
|
/**
|
|
24
21
|
* Should the filter rules be disabled (If you need to control options filter by yourself)
|
|
25
22
|
* @default false
|
|
@@ -29,15 +26,11 @@ export interface AutoCompleteProps extends Omit<SelectTriggerProps, 'active' | '
|
|
|
29
26
|
* The other native props for input element.
|
|
30
27
|
*/
|
|
31
28
|
inputProps?: Omit<SelectTriggerInputProps, 'onChange' | 'placeholder' | 'role' | 'value' | `aria-${'controls' | 'expanded' | 'owns'}`>;
|
|
32
|
-
/**
|
|
33
|
-
* The change event handler of input element.
|
|
34
|
-
*/
|
|
35
|
-
onChange?(text: string): any;
|
|
36
29
|
/**
|
|
37
30
|
* insert callback whenever insert icon is clicked
|
|
38
31
|
* return `true` when insert is successfully
|
|
39
32
|
*/
|
|
40
|
-
onInsert?(text: string):
|
|
33
|
+
onInsert?(text: string): SelectValue;
|
|
41
34
|
/**
|
|
42
35
|
* The search event handler
|
|
43
36
|
*/
|
|
@@ -45,7 +38,7 @@ export interface AutoCompleteProps extends Omit<SelectTriggerProps, 'active' | '
|
|
|
45
38
|
/**
|
|
46
39
|
* The options that mapped autocomplete options
|
|
47
40
|
*/
|
|
48
|
-
options:
|
|
41
|
+
options: SelectValue[];
|
|
49
42
|
/**
|
|
50
43
|
* select input placeholder
|
|
51
44
|
*/
|
|
@@ -60,12 +53,46 @@ export interface AutoCompleteProps extends Omit<SelectTriggerProps, 'active' | '
|
|
|
60
53
|
* @default 'medium'
|
|
61
54
|
*/
|
|
62
55
|
size?: SelectInputSize;
|
|
56
|
+
}
|
|
57
|
+
export declare type AutoCompleteMultipleProps = AutoCompleteBaseProps & {
|
|
58
|
+
/**
|
|
59
|
+
* The default selection
|
|
60
|
+
*/
|
|
61
|
+
defaultValue?: SelectValue[];
|
|
62
|
+
/**
|
|
63
|
+
* Controls the layout of trigger.
|
|
64
|
+
*/
|
|
65
|
+
mode: 'multiple';
|
|
66
|
+
/**
|
|
67
|
+
* The change event handler of input element.
|
|
68
|
+
*/
|
|
69
|
+
onChange?(newOptions: SelectValue[]): any;
|
|
63
70
|
/**
|
|
64
71
|
* The value of selection.
|
|
65
72
|
* @default undefined
|
|
66
73
|
*/
|
|
67
|
-
value?:
|
|
68
|
-
}
|
|
74
|
+
value?: SelectValue[];
|
|
75
|
+
};
|
|
76
|
+
export declare type AutoCompleteSingleProps = AutoCompleteBaseProps & {
|
|
77
|
+
/**
|
|
78
|
+
* The default selection
|
|
79
|
+
*/
|
|
80
|
+
defaultValue?: SelectValue;
|
|
81
|
+
/**
|
|
82
|
+
* Controls the layout of trigger.
|
|
83
|
+
*/
|
|
84
|
+
mode?: 'single';
|
|
85
|
+
/**
|
|
86
|
+
* The change event handler of input element.
|
|
87
|
+
*/
|
|
88
|
+
onChange?(newOptions: SelectValue): any;
|
|
89
|
+
/**
|
|
90
|
+
* The value of selection.
|
|
91
|
+
* @default undefined
|
|
92
|
+
*/
|
|
93
|
+
value?: SelectValue | null;
|
|
94
|
+
};
|
|
95
|
+
export declare type AutoCompleteProps = AutoCompleteMultipleProps | AutoCompleteSingleProps;
|
|
69
96
|
/**
|
|
70
97
|
* The AutoComplete component for react. <br />
|
|
71
98
|
* Note that if you need search for ONLY given options, not included your typings,
|
package/Select/AutoComplete.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, useContext, useState, useRef } from 'react';
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useContext, useState, useRef, useMemo } from 'react';
|
|
3
3
|
import { selectClasses } from '@mezzanine-ui/core/select';
|
|
4
4
|
import { PlusIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import isArray from 'lodash/isArray';
|
|
5
6
|
import { useComposeRefs } from '../hooks/useComposeRefs.js';
|
|
6
7
|
import Option from './Option.js';
|
|
7
8
|
import { SelectControlContext } from './SelectControlContext.js';
|
|
@@ -10,7 +11,6 @@ import { useClickAway } from '../hooks/useClickAway.js';
|
|
|
10
11
|
import SelectTrigger from './SelectTrigger.js';
|
|
11
12
|
import InputTriggerPopper from '../_internal/InputTriggerPopper/InputTriggerPopper.js';
|
|
12
13
|
import Menu from '../Menu/Menu.js';
|
|
13
|
-
import Empty from '../Empty/Empty.js';
|
|
14
14
|
import Icon from '../Icon/Icon.js';
|
|
15
15
|
import { FormControlContext } from '../Form/FormControlContext.js';
|
|
16
16
|
import cx from 'clsx';
|
|
@@ -22,16 +22,18 @@ const MENU_ID = 'mzn-select-autocomplete-menu-id';
|
|
|
22
22
|
* should considering using the `Select` component with `onSearch` prop.
|
|
23
23
|
*/
|
|
24
24
|
const AutoComplete = forwardRef(function Select(props, ref) {
|
|
25
|
-
var _a;
|
|
25
|
+
var _a, _b;
|
|
26
26
|
const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
|
|
27
|
-
const { addable = false, className, disabled = disabledFromFormControl || false, disabledOptionsFilter = false, defaultValue, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputRef, inputProps, itemsInView = 4, menuMaxHeight, menuRole = 'listbox', menuSize = 'medium', onChange: onChangeProp, onClear: onClearProp, onInsert, onSearch, options: optionsProp, popperOptions = {}, placeholder = '', prefix, required = requiredFromFormControl || false, size = 'medium', value: valueProp, } = props;
|
|
27
|
+
const { addable = false, className, disabled = disabledFromFormControl || false, disabledOptionsFilter = false, defaultValue, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputRef, inputProps, itemsInView = 4, menuMaxHeight, menuRole = 'listbox', menuSize = 'medium', mode = 'single', onChange: onChangeProp, onClear: onClearProp, onInsert, onSearch, options: optionsProp, popperOptions = {}, placeholder = '', prefix, required = requiredFromFormControl || false, size = 'medium', value: valueProp, } = props;
|
|
28
28
|
const [open, toggleOpen] = useState(false);
|
|
29
|
-
const { focused, onFocus, onChange, onClear, options, searchText, setSearchText,
|
|
29
|
+
const { focused, onFocus, onChange, onClear, options, searchText, selectedOptions, setSearchText, unselectedOptions, value, } = useAutoCompleteValueControl({
|
|
30
30
|
defaultValue,
|
|
31
31
|
disabledOptionsFilter,
|
|
32
|
+
mode,
|
|
32
33
|
onChange: onChangeProp,
|
|
33
34
|
onClear: onClearProp,
|
|
34
35
|
onClose: () => toggleOpen(false),
|
|
36
|
+
onSearch,
|
|
35
37
|
options: optionsProp,
|
|
36
38
|
value: valueProp,
|
|
37
39
|
});
|
|
@@ -41,6 +43,7 @@ const AutoComplete = forwardRef(function Select(props, ref) {
|
|
|
41
43
|
const controlRef = useRef(null);
|
|
42
44
|
const popperRef = useRef(null);
|
|
43
45
|
const composedRef = useComposeRefs([ref, controlRef]);
|
|
46
|
+
const renderValue = focused ? () => searchText : undefined;
|
|
44
47
|
useClickAway(() => {
|
|
45
48
|
if (!open || focused)
|
|
46
49
|
return;
|
|
@@ -53,11 +56,17 @@ const AutoComplete = forwardRef(function Select(props, ref) {
|
|
|
53
56
|
open,
|
|
54
57
|
toggleOpen,
|
|
55
58
|
]);
|
|
59
|
+
function getPlaceholder() {
|
|
60
|
+
if (focused && value && !isArray(value)) {
|
|
61
|
+
return value.name;
|
|
62
|
+
}
|
|
63
|
+
return placeholder;
|
|
64
|
+
}
|
|
56
65
|
/** Trigger input props */
|
|
57
66
|
const onSearchInputChange = (e) => {
|
|
58
67
|
/** should sync both search input and value */
|
|
59
68
|
setSearchText(e.target.value);
|
|
60
|
-
|
|
69
|
+
setInsertText(e.target.value);
|
|
61
70
|
/** return current value to onSearch */
|
|
62
71
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(e.target.value);
|
|
63
72
|
};
|
|
@@ -73,6 +82,9 @@ const AutoComplete = forwardRef(function Select(props, ref) {
|
|
|
73
82
|
onFocus(false);
|
|
74
83
|
(_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(inputProps, e);
|
|
75
84
|
};
|
|
85
|
+
const onClickSuffixActionIcon = () => {
|
|
86
|
+
toggleOpen((prev) => !prev);
|
|
87
|
+
};
|
|
76
88
|
const resolvedInputProps = {
|
|
77
89
|
...inputProps,
|
|
78
90
|
'aria-controls': MENU_ID,
|
|
@@ -81,30 +93,27 @@ const AutoComplete = forwardRef(function Select(props, ref) {
|
|
|
81
93
|
onBlur: onSearchInputBlur,
|
|
82
94
|
onChange: onSearchInputChange,
|
|
83
95
|
onFocus: onSearchInputFocus,
|
|
84
|
-
placeholder,
|
|
96
|
+
placeholder: getPlaceholder(),
|
|
85
97
|
role: 'combobox',
|
|
86
98
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
99
|
+
const searchTextExistWithoutOption = !!searchText && options.find((option) => option.name === searchText) === undefined;
|
|
100
|
+
const context = useMemo(() => ({
|
|
101
|
+
onChange,
|
|
102
|
+
value,
|
|
103
|
+
}), [onChange, value]);
|
|
104
|
+
return (jsx(SelectControlContext.Provider, { value: context, children: jsxs("div", { ref: nodeRef, className: cx(selectClasses.host, {
|
|
91
105
|
[selectClasses.hostFullWidth]: fullWidth,
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (insertSuccess) {
|
|
104
|
-
setInsertText('');
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
} }, void 0)] }), void 0)) : null] }), void 0)] }), void 0) }), void 0));
|
|
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) => {
|
|
107
|
+
var _a;
|
|
108
|
+
e.stopPropagation();
|
|
109
|
+
if (insertText) {
|
|
110
|
+
const newOption = (_a = onInsert === null || onInsert === void 0 ? void 0 : onInsert(insertText)) !== null && _a !== void 0 ? _a : null;
|
|
111
|
+
if (newOption) {
|
|
112
|
+
setInsertText('');
|
|
113
|
+
onChange(newOption);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}, children: [jsx("p", { children: insertText }), jsx(Icon, { className: selectClasses.autoCompleteIcon, icon: PlusIcon })] })) : null] })] }) }));
|
|
108
117
|
});
|
|
109
118
|
var AutoComplete$1 = AutoComplete;
|
|
110
119
|
|
package/Select/Option.js
CHANGED
|
@@ -35,10 +35,10 @@ const Option = forwardRef(function Option(props, ref) {
|
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
return (jsx(MenuItem,
|
|
38
|
+
return (jsx(MenuItem, { ...rest, ref: ref, active: active, "aria-selected": active, id: value, onClick: (evt) => {
|
|
39
39
|
evt.stopPropagation();
|
|
40
40
|
onSelect();
|
|
41
|
-
}, onKeyDown: onKeyDown, role: role, tabIndex: 0
|
|
41
|
+
}, onKeyDown: onKeyDown, role: role, tabIndex: 0, children: children }));
|
|
42
42
|
});
|
|
43
43
|
var Option$1 = Option;
|
|
44
44
|
|
package/Select/Select.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { PopperProps } from '../Popper';
|
|
|
6
6
|
import { SelectValue } from './typings';
|
|
7
7
|
import { PickRenameMulti } from '../utils/general';
|
|
8
8
|
import { SelectTriggerProps, SelectTriggerInputProps } from './SelectTrigger';
|
|
9
|
-
export interface SelectBaseProps extends Omit<SelectTriggerProps, 'active' | 'inputProps' | 'mode' | 'onBlur' | 'onChange' | 'onClick' | 'onFocus' | 'onKeyDown' | 'renderValue' | 'value'>, FormElementFocusHandlers, PickRenameMulti<Pick<MenuProps, 'itemsInView' | 'maxHeight' | 'role' | 'size'>, {
|
|
9
|
+
export interface SelectBaseProps extends Omit<SelectTriggerProps, 'active' | 'inputProps' | 'mode' | 'onBlur' | 'onChange' | 'onClick' | 'onFocus' | 'onKeyDown' | 'readOnly' | 'renderValue' | 'value'>, FormElementFocusHandlers, PickRenameMulti<Pick<MenuProps, 'itemsInView' | 'maxHeight' | 'role' | 'size'>, {
|
|
10
10
|
maxHeight: 'menuMaxHeight';
|
|
11
11
|
role: 'menuRole';
|
|
12
12
|
size: 'menuSize';
|
|
@@ -17,10 +17,6 @@ export interface SelectBaseProps extends Omit<SelectTriggerProps, 'active' | 'in
|
|
|
17
17
|
* The other native props for input element.
|
|
18
18
|
*/
|
|
19
19
|
inputProps?: Omit<SelectTriggerInputProps, 'onBlur' | 'onChange' | 'onFocus' | 'placeholder' | 'role' | 'value' | `aria-${'controls' | 'expanded' | 'owns'}`>;
|
|
20
|
-
/**
|
|
21
|
-
* The search event handler, this prop won't work when mode is `multiple`
|
|
22
|
-
*/
|
|
23
|
-
onSearch?(input: string): any;
|
|
24
20
|
/**
|
|
25
21
|
* select input placeholder
|
|
26
22
|
*/
|
|
@@ -87,49 +83,5 @@ export declare type SelectSingleProps = SelectBaseProps & {
|
|
|
87
83
|
value?: SelectValue | null;
|
|
88
84
|
};
|
|
89
85
|
export declare type SelectProps = SelectMultipleProps | SelectSingleProps;
|
|
90
|
-
declare const Select: import("react").ForwardRefExoticComponent<
|
|
91
|
-
/**
|
|
92
|
-
* The default selection
|
|
93
|
-
*/
|
|
94
|
-
defaultValue?: SelectValue[] | undefined;
|
|
95
|
-
/**
|
|
96
|
-
* Controls the layout of trigger.
|
|
97
|
-
*/
|
|
98
|
-
mode: 'multiple';
|
|
99
|
-
/**
|
|
100
|
-
* The change event handler of input element.
|
|
101
|
-
*/
|
|
102
|
-
onChange?(newOptions: SelectValue[]): any;
|
|
103
|
-
/**
|
|
104
|
-
* To customize rendering select input value
|
|
105
|
-
*/
|
|
106
|
-
renderValue?(values: SelectValue[]): string;
|
|
107
|
-
/**
|
|
108
|
-
* The value of selection.
|
|
109
|
-
* @default undefined
|
|
110
|
-
*/
|
|
111
|
-
value?: SelectValue[] | undefined;
|
|
112
|
-
} & import("react").RefAttributes<HTMLDivElement>) | (SelectBaseProps & {
|
|
113
|
-
/**
|
|
114
|
-
* The default selection
|
|
115
|
-
*/
|
|
116
|
-
defaultValue?: SelectValue | undefined;
|
|
117
|
-
/**
|
|
118
|
-
* Controls the layout of trigger.
|
|
119
|
-
*/
|
|
120
|
-
mode?: "single" | undefined;
|
|
121
|
-
/**
|
|
122
|
-
* The change event handler of input element.
|
|
123
|
-
*/
|
|
124
|
-
onChange?(newOptions: SelectValue): any;
|
|
125
|
-
/**
|
|
126
|
-
* To customize rendering select input value
|
|
127
|
-
*/
|
|
128
|
-
renderValue?(values: SelectValue | null): string;
|
|
129
|
-
/**
|
|
130
|
-
* The value of selection.
|
|
131
|
-
* @default undefined
|
|
132
|
-
*/
|
|
133
|
-
value?: SelectValue | null | undefined;
|
|
134
|
-
} & import("react").RefAttributes<HTMLDivElement>)>;
|
|
86
|
+
declare const Select: import("react").ForwardRefExoticComponent<SelectProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
135
87
|
export default Select;
|