@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.
Files changed (171) hide show
  1. package/Accordion/Accordion.js +5 -4
  2. package/Accordion/AccordionDetails.js +2 -2
  3. package/Accordion/AccordionSummary.js +3 -4
  4. package/Alert/Alert.js +1 -3
  5. package/AppBar/AppBar.js +1 -1
  6. package/AppBar/AppBarBrand.d.ts +1 -1
  7. package/AppBar/AppBarBrand.js +1 -1
  8. package/AppBar/AppBarMain.d.ts +1 -1
  9. package/AppBar/AppBarMain.js +1 -1
  10. package/AppBar/AppBarSupport.d.ts +1 -1
  11. package/AppBar/AppBarSupport.js +1 -1
  12. package/Badge/Badge.js +2 -2
  13. package/Badge/BadgeContainer.d.ts +1 -1
  14. package/Badge/BadgeContainer.js +1 -1
  15. package/Button/Button.d.ts +2 -2
  16. package/Button/Button.js +3 -3
  17. package/Button/ButtonGroup.js +3 -3
  18. package/Button/IconButton.d.ts +3 -3
  19. package/Button/IconButton.js +1 -1
  20. package/Calendar/Calendar.js +9 -10
  21. package/Calendar/CalendarCell.js +2 -2
  22. package/Calendar/CalendarContext.d.ts +3 -3
  23. package/Calendar/CalendarContext.js +20 -12
  24. package/Calendar/CalendarControls.js +3 -3
  25. package/Calendar/CalendarDayOfWeek.js +1 -1
  26. package/Calendar/CalendarDays.js +4 -5
  27. package/Calendar/CalendarMonths.js +4 -4
  28. package/Calendar/CalendarWeeks.js +4 -5
  29. package/Calendar/CalendarYears.js +4 -4
  30. package/Calendar/useCalendarControls.d.ts +2 -3
  31. package/Card/Card.js +5 -5
  32. package/Card/CardActions.js +1 -2
  33. package/Checkbox/CheckAll.js +2 -2
  34. package/Checkbox/Checkbox.js +2 -2
  35. package/Checkbox/CheckboxGroup.js +2 -2
  36. package/ConfirmActions/ConfirmActions.js +1 -2
  37. package/DatePicker/DatePicker.js +2 -3
  38. package/DatePicker/DatePickerCalendar.js +1 -1
  39. package/DateRangePicker/DateRangePicker.js +2 -3
  40. package/DateRangePicker/DateRangePickerCalendar.js +3 -4
  41. package/DateRangePicker/useDateRangeCalendarControls.d.ts +1 -2
  42. package/DateRangePicker/useDateRangePickerValue.d.ts +12 -13
  43. package/DateTimePicker/DateTimePicker.js +2 -3
  44. package/DateTimePicker/DateTimePickerPanel.js +1 -3
  45. package/Drawer/Drawer.js +1 -1
  46. package/Dropdown/Dropdown.js +2 -2
  47. package/Empty/Empty.js +3 -4
  48. package/Form/FormField.js +2 -2
  49. package/Form/FormLabel.js +1 -2
  50. package/Form/FormMessage.d.ts +1 -1
  51. package/Form/FormMessage.js +1 -1
  52. package/Form/useAutoCompleteValueControl.d.ts +30 -11
  53. package/Form/useAutoCompleteValueControl.js +71 -31
  54. package/Form/useInputWithTagsModeValue.js +2 -1
  55. package/Form/useSelectValueControl.d.ts +1 -1
  56. package/Icon/Icon.js +2 -2
  57. package/Input/Input.js +2 -3
  58. package/Loading/Loading.js +4 -5
  59. package/Menu/Menu.js +1 -1
  60. package/Menu/MenuDivider.d.ts +1 -1
  61. package/Menu/MenuDivider.js +1 -1
  62. package/Menu/MenuItem.js +2 -3
  63. package/Menu/MenuItemGroup.js +1 -2
  64. package/Message/Message.js +2 -3
  65. package/Modal/Modal.js +2 -2
  66. package/Modal/ModalActions.js +1 -1
  67. package/Modal/ModalBody.d.ts +1 -1
  68. package/Modal/ModalBody.js +1 -1
  69. package/Modal/ModalFooter.d.ts +1 -1
  70. package/Modal/ModalFooter.js +1 -1
  71. package/Modal/ModalHeader.js +2 -3
  72. package/Modal/useModalContainer.js +1 -1
  73. package/Navigation/Navigation.js +2 -2
  74. package/Navigation/NavigationItem.js +1 -1
  75. package/Navigation/NavigationSubMenu.js +3 -5
  76. package/Notification/Notification.js +2 -7
  77. package/Notifier/NotifierManager.js +1 -1
  78. package/Notifier/createNotifier.js +1 -1
  79. package/Overlay/Overlay.js +3 -3
  80. package/PageFooter/PageFooter.js +1 -2
  81. package/Pagination/Pagination.js +2 -3
  82. package/Pagination/PaginationItem.js +4 -4
  83. package/Pagination/PaginationJumper.js +2 -4
  84. package/Picker/PickerTrigger.js +1 -1
  85. package/Picker/RangePickerTrigger.js +1 -3
  86. package/Picker/usePickerInputValue.d.ts +2 -2
  87. package/Picker/usePickerValue.d.ts +6 -7
  88. package/Picker/useRangePickerValue.d.ts +9 -10
  89. package/Popconfirm/Popconfirm.js +1 -1
  90. package/Popover/Popover.js +2 -3
  91. package/Popper/Popper.js +2 -2
  92. package/Portal/Portal.js +1 -1
  93. package/Progress/Progress.js +5 -7
  94. package/Radio/Radio.js +2 -2
  95. package/Radio/RadioGroup.js +2 -2
  96. package/Select/AutoComplete.d.ts +40 -13
  97. package/Select/AutoComplete.js +37 -28
  98. package/Select/Option.js +2 -2
  99. package/Select/Select.d.ts +2 -50
  100. package/Select/Select.js +15 -49
  101. package/Select/SelectTrigger.d.ts +8 -1
  102. package/Select/SelectTrigger.js +8 -12
  103. package/Select/SelectTriggerTags.d.ts +19 -0
  104. package/Select/SelectTriggerTags.js +33 -0
  105. package/Select/TreeSelect.js +2 -3
  106. package/Select/index.d.ts +1 -0
  107. package/Select/index.js +1 -0
  108. package/Select/useSelectTriggerTags.d.ts +19 -0
  109. package/Select/useSelectTriggerTags.js +61 -0
  110. package/Skeleton/Skeleton.js +1 -1
  111. package/Slider/Slider.d.ts +1 -1
  112. package/Slider/Slider.js +7 -11
  113. package/Stepper/Step.js +2 -2
  114. package/Stepper/Stepper.js +1 -1
  115. package/Switch/Switch.js +2 -3
  116. package/Table/Table.d.ts +1 -1
  117. package/Table/Table.js +3 -10
  118. package/Table/TableBody.js +2 -4
  119. package/Table/TableBodyRow.js +4 -7
  120. package/Table/TableCell.js +3 -3
  121. package/Table/TableExpandedTable.js +5 -6
  122. package/Table/TableHeader.d.ts +2 -1
  123. package/Table/TableHeader.js +3 -6
  124. package/Table/editable/TableEditRenderWrapper.js +2 -2
  125. package/Table/expandable/TableExpandable.js +2 -2
  126. package/Table/pagination/TablePagination.js +1 -2
  127. package/Table/refresh/TableRefresh.js +1 -1
  128. package/Table/rowSelection/TableRowSelection.js +5 -6
  129. package/Table/sorting/TableSortingIcon.js +2 -2
  130. package/Table/sorting/useTableSorting.d.ts +2 -2
  131. package/Table/useTableScroll.d.ts +178 -178
  132. package/Tabs/Tab.js +2 -2
  133. package/Tabs/TabPane.js +1 -1
  134. package/Tabs/Tabs.js +1 -3
  135. package/Tag/Tag.js +3 -4
  136. package/TextField/TextField.js +3 -3
  137. package/TextField/useTextFieldControl.d.ts +2 -2
  138. package/Textarea/Textarea.js +2 -3
  139. package/TimePanel/TimePanel.js +1 -4
  140. package/TimePanel/TimePanelAction.js +1 -1
  141. package/TimePanel/TimePanelColumn.js +2 -5
  142. package/TimePicker/TimePicker.js +2 -3
  143. package/TimePicker/TimePickerPanel.js +1 -1
  144. package/Tooltip/Tooltip.js +3 -3
  145. package/Transition/Collapse.js +3 -2
  146. package/Transition/Fade.js +2 -2
  147. package/Transition/Grow.js +3 -2
  148. package/Transition/SlideFade.js +2 -2
  149. package/Transition/Transition.js +2 -2
  150. package/Transition/Zoom.js +2 -2
  151. package/Tree/Tree.js +1 -1
  152. package/Tree/TreeNode.js +5 -7
  153. package/Tree/TreeNodeList.js +5 -4
  154. package/Tree/getTreeNodeEntities.js +6 -3
  155. package/Typography/Typography.d.ts +2 -2
  156. package/Typography/Typography.js +2 -2
  157. package/Upload/UploadButton.js +2 -2
  158. package/Upload/UploadInput.js +1 -1
  159. package/Upload/UploadPicture.js +1 -1
  160. package/Upload/UploadPictureBlock.js +2 -8
  161. package/Upload/UploadPictureWall.d.ts +1 -1
  162. package/Upload/UploadPictureWall.js +1 -2
  163. package/Upload/UploadPictureWallItem.js +1 -1
  164. package/Upload/UploadResult.js +2 -5
  165. package/_internal/InputCheck/InputCheck.js +2 -3
  166. package/_internal/InputCheck/InputCheckGroup.js +1 -1
  167. package/_internal/InputTriggerPopper/InputTriggerPopper.js +2 -2
  168. package/_internal/SlideFadeOverlay/SlideFadeOverlay.js +1 -1
  169. package/index.d.ts +1 -1
  170. package/index.js +1 -0
  171. package/package.json +3 -3
package/Select/Select.js CHANGED
@@ -1,13 +1,12 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { forwardRef, useContext, useState, useRef, useLayoutEffect } from 'react';
2
+ import { forwardRef, useContext, useState, useRef, useMemo } from 'react';
3
3
  import { selectClasses } from '@mezzanine-ui/core/select';
4
- import { SearchIcon } from '@mezzanine-ui/icons';
4
+ import isArray from 'lodash/isArray';
5
5
  import { useComposeRefs } from '../hooks/useComposeRefs.js';
6
6
  import { SelectControlContext } from './SelectControlContext.js';
7
7
  import { useSelectValueControl } from '../Form/useSelectValueControl.js';
8
8
  import { useClickAway } from '../hooks/useClickAway.js';
9
9
  import SelectTrigger from './SelectTrigger.js';
10
- import Icon from '../Icon/Icon.js';
11
10
  import InputTriggerPopper from '../_internal/InputTriggerPopper/InputTriggerPopper.js';
12
11
  import Menu from '../Menu/Menu.js';
13
12
  import { FormControlContext } from '../Form/FormControlContext.js';
@@ -17,7 +16,7 @@ const MENU_ID = 'mzn-select-menu-id';
17
16
  const Select = forwardRef(function Select(props, ref) {
18
17
  var _a, _b;
19
18
  const { disabled: disabledFromFormControl, fullWidth: fullWidthFromFormControl, required: requiredFromFormControl, severity, } = useContext(FormControlContext) || {};
20
- const { children, className, clearable = false, defaultValue, disabled = disabledFromFormControl || false, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputProps, inputRef, itemsInView = 4, menuMaxHeight, menuRole = 'listbox', menuSize = 'medium', mode = 'single', onBlur, onChange: onChangeProp, onClear: onClearProp, onFocus, onSearch, placeholder = '', popperOptions = {}, prefix, renderValue: renderValueProp, required = requiredFromFormControl || false, size = 'medium', suffixActionIcon: suffixActionIconProp, value: valueProp, } = props;
19
+ const { children, className, clearable = false, defaultValue, disabled = disabledFromFormControl || false, error = severity === 'error' || false, fullWidth = fullWidthFromFormControl || false, inputProps, inputRef, itemsInView = 4, menuMaxHeight, menuRole = 'listbox', menuSize = 'medium', mode = 'single', onBlur, onChange: onChangeProp, onClear: onClearProp, onFocus, placeholder = '', popperOptions = {}, prefix, renderValue, required = requiredFromFormControl || false, size = 'medium', suffixActionIcon, value: valueProp, } = props;
21
20
  const [open, toggleOpen] = useState(false);
22
21
  const onOpen = () => {
23
22
  onFocus === null || onFocus === void 0 ? void 0 : onFocus();
@@ -47,46 +46,28 @@ const Select = forwardRef(function Select(props, ref) {
47
46
  const controlRef = useRef(null);
48
47
  const popperRef = useRef(null);
49
48
  const composedRef = useComposeRefs([ref, controlRef]);
50
- const searchable = typeof onSearch === 'function';
51
- const [searchText, changeSearchText] = useState('');
52
- const [focused, setFocused] = useState(false);
53
- const renderValue = focused && searchable ? () => searchText : renderValueProp;
54
49
  function getPlaceholder() {
55
- if (focused && searchable) {
56
- if (typeof renderValueProp === 'function') {
57
- return renderValueProp(value);
58
- }
59
- if (value) {
60
- return value.name;
61
- }
62
- return placeholder;
50
+ if (typeof renderValue === 'function') {
51
+ return renderValue(value);
52
+ }
53
+ if (value && !isArray(value)) {
54
+ return value.name;
63
55
  }
64
56
  return placeholder;
65
57
  }
66
- useLayoutEffect(() => {
67
- if (!focused) {
68
- changeSearchText('');
69
- if (typeof onSearch === 'function') {
70
- onSearch('');
71
- }
72
- }
73
- }, [focused, onSearch]);
74
58
  useClickAway(() => {
75
- if (!open || focused)
59
+ if (!open)
76
60
  return;
77
61
  return () => {
78
62
  onClose();
79
63
  };
80
64
  }, nodeRef, [
81
- focused,
82
65
  nodeRef,
83
66
  open,
84
67
  toggleOpen,
85
68
  ]);
86
- const suffixActionIcon = suffixActionIconProp || (searchable && open ? (jsx(Icon, { icon: SearchIcon }, void 0)) : undefined);
87
69
  const onClickTextField = () => {
88
- /** when searchable, should open menu when focus */
89
- if (!searchable && !disabled) {
70
+ if (!disabled) {
90
71
  onToggleOpen();
91
72
  }
92
73
  };
@@ -117,34 +98,19 @@ const Select = forwardRef(function Select(props, ref) {
117
98
  }
118
99
  }
119
100
  };
120
- /** Trigger input props */
121
- const onSearchInputChange = searchable ? (e) => {
122
- changeSearchText(e.target.value);
123
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
124
- onSearch(e.target.value);
125
- } : undefined;
126
- const onSearchInputFocus = searchable ? (e) => {
127
- e.stopPropagation();
128
- onToggleOpen();
129
- setFocused(true);
130
- } : undefined;
131
- const onSearchInputBlur = () => setFocused(false);
132
101
  const resolvedInputProps = {
133
102
  ...inputProps,
134
103
  'aria-controls': MENU_ID,
135
104
  'aria-expanded': open,
136
105
  'aria-owns': MENU_ID,
137
- onBlur: onSearchInputBlur,
138
- onChange: onSearchInputChange,
139
- onFocus: onSearchInputFocus,
140
106
  placeholder: getPlaceholder(),
141
107
  role: 'combobox',
142
108
  };
143
- return (jsx(SelectControlContext.Provider, Object.assign({ value: {
144
- onChange,
145
- value,
146
- } }, { children: jsxs("div", Object.assign({ 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: !searchable, required: required, inputProps: resolvedInputProps, size: size, suffixActionIcon: suffixActionIcon, value: value, renderValue: renderValue }, void 0),
147
- jsx(InputTriggerPopper, Object.assign({ ref: popperRef, anchor: controlRef, className: selectClasses.popper, open: open, sameWidth: true, options: popperOptions }, { children: jsx(Menu, Object.assign({ id: MENU_ID, "aria-activedescendant": Array.isArray(value) ? (_b = (_a = value === null || value === void 0 ? void 0 : value[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '' : value === null || value === void 0 ? void 0 : value.id, itemsInView: itemsInView, maxHeight: menuMaxHeight, role: menuRole, size: menuSize, style: { border: 0 } }, { children: children }), void 0) }), void 0)] }), void 0) }), void 0));
109
+ const context = useMemo(() => ({
110
+ onChange,
111
+ value,
112
+ }), [onChange, value]);
113
+ return (jsx(SelectControlContext.Provider, { value: context, children: jsxs("div", { ref: nodeRef, className: cx(selectClasses.host, fullWidth && selectClasses.hostFullWidth), children: [jsx(SelectTrigger, { ref: composedRef, active: open, className: className, clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, inputRef: inputRef, mode: mode, onTagClose: onChange, onClear: onClear, onClick: onClickTextField, onKeyDown: onKeyDownTextField, prefix: prefix, readOnly: true, renderValue: renderValue, required: required, inputProps: resolvedInputProps, size: size, suffixActionIcon: suffixActionIcon, value: value }), jsx(InputTriggerPopper, { ref: popperRef, anchor: controlRef, className: selectClasses.popper, open: open, sameWidth: true, options: popperOptions, children: jsx(Menu, { id: MENU_ID, "aria-activedescendant": Array.isArray(value) ? (_b = (_a = value === null || value === void 0 ? void 0 : value[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '' : value === null || value === void 0 ? void 0 : value.id, itemsInView: itemsInView, maxHeight: menuMaxHeight, role: menuRole, size: menuSize, style: { border: 0 }, children: children }) })] }) }));
148
114
  });
149
115
  var Select$1 = Select;
150
116
 
@@ -8,6 +8,10 @@ export interface SelectTriggerBaseProps extends Omit<TextFieldProps, 'active' |
8
8
  * Controls the chevron icon layout.
9
9
  */
10
10
  active?: boolean;
11
+ /**
12
+ * Tags arg ellipsis or not.
13
+ */
14
+ ellipsis?: boolean;
11
15
  /**
12
16
  * force hide suffixAction icons
13
17
  */
@@ -43,6 +47,9 @@ export interface SelectTriggerBaseProps extends Omit<TextFieldProps, 'active' |
43
47
  * @default false
44
48
  */
45
49
  required?: boolean;
50
+ searchText?: string;
51
+ showTextInputAfterTags?: boolean;
52
+ suffixAction?: VoidFunction;
46
53
  }
47
54
  export declare type SelectTriggerMultipleProps = SelectTriggerBaseProps & {
48
55
  /**
@@ -78,5 +85,5 @@ export declare type SelectTriggerSingleProps = SelectTriggerBaseProps & {
78
85
  };
79
86
  export declare type SelectTriggerComponentProps = SelectTriggerMultipleProps | SelectTriggerSingleProps;
80
87
  export declare type SelectTriggerProps = Omit<SelectTriggerComponentProps, 'innerRef'>;
81
- declare const SelectTrigger: import("react").ForwardRefExoticComponent<Pick<SelectTriggerComponentProps, "disabled" | "placeholder" | "readOnly" | "required" | "size" | "value" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "active" | "clearable" | "error" | "fullWidth" | "onClear" | "suffixActionIcon" | "forceHideSuffixActionIcon" | "inputProps" | "inputRef" | "onTagClose" | "renderValue" | "mode"> & import("react").RefAttributes<HTMLDivElement>>;
88
+ declare const SelectTrigger: import("react").ForwardRefExoticComponent<SelectTriggerProps & import("react").RefAttributes<HTMLDivElement>>;
82
89
  export default SelectTrigger;
@@ -2,14 +2,13 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import { forwardRef } from 'react';
3
3
  import { selectClasses } from '@mezzanine-ui/core/select';
4
4
  import { ChevronDownIcon } from '@mezzanine-ui/icons';
5
+ import SelectTriggerTags from './SelectTriggerTags.js';
5
6
  import Icon from '../Icon/Icon.js';
6
7
  import TextField from '../TextField/TextField.js';
7
- import Tag from '../Tag/Tag.js';
8
8
  import cx from 'clsx';
9
9
 
10
10
  function SelectTriggerComponent(props) {
11
- var _a;
12
- const { active, className, disabled, forceHideSuffixActionIcon, inputProps, innerRef, inputRef, mode, onTagClose, readOnly, renderValue: renderValueProp, required, size, suffixActionIcon: suffixActionIconProp, value, ...restTextFieldProps } = props;
11
+ const { active, className, disabled, ellipsis = false, forceHideSuffixActionIcon, inputProps, innerRef, inputRef, mode, onTagClose, readOnly, renderValue: renderValueProp, required, searchText, size, showTextInputAfterTags = false, suffixAction, suffixActionIcon: suffixActionIconProp, value, ...restTextFieldProps } = props;
13
12
  /** Render value to string for input */
14
13
  const renderValue = () => {
15
14
  if (typeof renderValueProp === 'function') {
@@ -24,28 +23,25 @@ function SelectTriggerComponent(props) {
24
23
  return '';
25
24
  };
26
25
  /** Compute suffix action icon */
27
- const suffixActionIcon = suffixActionIconProp || (jsx(Icon, { icon: ChevronDownIcon, className: cx(selectClasses.triggerSuffixActionIcon, {
26
+ const suffixActionIcon = suffixActionIconProp || (jsx(Icon, { icon: ChevronDownIcon, onClick: suffixAction, className: cx(selectClasses.triggerSuffixActionIcon, {
28
27
  [selectClasses.triggerSuffixActionIconActive]: active,
29
- }) }, void 0));
28
+ }) }));
30
29
  const getTextFieldActive = () => {
31
30
  if (value) {
32
31
  if (Array.isArray(value)) {
33
- return !!(value === null || value === void 0 ? void 0 : value.length);
32
+ return !!value.length;
34
33
  }
35
34
  return !!value;
36
35
  }
37
36
  return false;
38
37
  };
39
- return (jsx(TextField, Object.assign({ ref: innerRef }, restTextFieldProps, { active: getTextFieldActive(), className: cx(selectClasses.trigger, className), disabled: disabled, size: size, suffixActionIcon: forceHideSuffixActionIcon ? undefined : suffixActionIcon }, { children: mode === 'multiple' && ((_a = value) === null || _a === void 0 ? void 0 : _a.length) ? (jsx("div", Object.assign({ className: selectClasses.triggerTags }, { children: value.map((selection) => (jsx(Tag, Object.assign({ closable: true, disabled: disabled, onClose: (e) => {
40
- e.stopPropagation();
41
- onTagClose === null || onTagClose === void 0 ? void 0 : onTagClose(selection);
42
- }, size: size }, { children: selection.name }), selection.id))) }), void 0)) : (jsx("input", Object.assign({}, inputProps, { ref: inputRef, "aria-autocomplete": "list", "aria-disabled": disabled, "aria-haspopup": "listbox", "aria-readonly": readOnly, "aria-required": required, autoComplete: "false", disabled: disabled, readOnly: readOnly, required: required, type: "search", value: renderValue() }), void 0)) }), void 0));
38
+ return (jsx(TextField, { ref: innerRef, ...restTextFieldProps, active: getTextFieldActive(), className: cx(selectClasses.trigger, className), disabled: disabled, size: size, suffixActionIcon: forceHideSuffixActionIcon ? undefined : suffixActionIcon, children: mode === 'multiple' && (value === null || value === void 0 ? void 0 : value.length) ? (jsx(SelectTriggerTags, { disabled: disabled, ellipsis: ellipsis, inputProps: inputProps, inputRef: inputRef, onTagClose: onTagClose, readOnly: readOnly, required: required, searchText: searchText, size: size, showTextInputAfterTags: showTextInputAfterTags, value: value })) : (jsx("input", { ...inputProps, ref: inputRef, "aria-autocomplete": "list", "aria-disabled": disabled, "aria-haspopup": "listbox", "aria-readonly": readOnly, "aria-required": required, autoComplete: "false", disabled: disabled, readOnly: readOnly, required: required, type: "search", value: renderValue() })) }));
43
39
  }
44
40
  const SelectTrigger = forwardRef((props, ref) => {
45
41
  if (props.mode === 'multiple') {
46
- return (jsx(SelectTriggerComponent, Object.assign({}, props, { innerRef: ref }), void 0));
42
+ return (jsx(SelectTriggerComponent, { ...props, innerRef: ref }));
47
43
  }
48
- return (jsx(SelectTriggerComponent, Object.assign({}, props, { innerRef: ref }), void 0));
44
+ return (jsx(SelectTriggerComponent, { ...props, innerRef: ref }));
49
45
  });
50
46
  var SelectTrigger$1 = SelectTrigger;
51
47
 
@@ -0,0 +1,19 @@
1
+ import { Ref } from 'react';
2
+ import { TagSize } from '@mezzanine-ui/core/tag';
3
+ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
4
+ import { SelectValue } from './typings';
5
+ export interface SelectTriggerTagsProps {
6
+ disabled?: boolean;
7
+ ellipsis: boolean;
8
+ inputProps?: Omit<NativeElementPropsWithoutKeyAndRef<'input'>, 'autoComplete' | 'children' | 'defaultValue' | 'disabled' | 'readOnly' | 'required' | 'type' | 'value' | `aria-${'autocomplete' | 'disabled' | 'haspopup' | 'multiline' | 'readonly' | 'required'}`>;
9
+ inputRef?: Ref<HTMLInputElement>;
10
+ onTagClose?: (target: SelectValue) => void;
11
+ readOnly?: boolean;
12
+ required?: boolean;
13
+ searchText?: string;
14
+ size?: TagSize;
15
+ showTextInputAfterTags?: boolean;
16
+ value?: SelectValue[];
17
+ }
18
+ declare const SelectTriggerTags: import("react").ForwardRefExoticComponent<SelectTriggerTagsProps & import("react").RefAttributes<HTMLDivElement>>;
19
+ export default SelectTriggerTags;
@@ -0,0 +1,33 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { forwardRef, useRef } from 'react';
3
+ import { selectClasses } from '@mezzanine-ui/core/select';
4
+ import take from 'lodash/take';
5
+ import { useComposeRefs } from '../hooks/useComposeRefs.js';
6
+ import { useSelectTriggerTags } from './useSelectTriggerTags.js';
7
+ import Tag from '../Tag/Tag.js';
8
+ import cx from 'clsx';
9
+
10
+ const SelectTriggerTags = forwardRef(function SelectTriggerTags(props, ref) {
11
+ const { disabled, ellipsis, inputProps, inputRef, onTagClose, readOnly, required, searchText, size = 'medium', showTextInputAfterTags, value, } = props;
12
+ const controlRef = useRef();
13
+ const composedRef = useComposeRefs([ref, controlRef]);
14
+ const { renderFakeTags, takeCount, } = useSelectTriggerTags({
15
+ controlRef,
16
+ value,
17
+ size,
18
+ });
19
+ return (jsxs("div", { ref: composedRef, className: cx(selectClasses.triggerTagsInputWrapper, {
20
+ [selectClasses.triggerTagsInputWrapperEllipsis]: ellipsis,
21
+ }), children: [jsxs("div", { className: cx(selectClasses.triggerTags, {
22
+ [selectClasses.triggerTagsEllipsis]: ellipsis,
23
+ }), children: [ellipsis ? (jsxs(Fragment, { children: [take(value, takeCount).map((selection) => (jsx(Tag, { closable: true, disabled: disabled, onClose: (e) => {
24
+ e.stopPropagation();
25
+ onTagClose === null || onTagClose === void 0 ? void 0 : onTagClose(selection);
26
+ }, size: size, children: selection.name }, selection.id))), value && value.length > takeCount ? (jsx(Tag, { disabled: disabled, size: size, children: `+${value.length - takeCount <= 99 ? value.length - takeCount : 99}...` })) : null] })) : (value === null || value === void 0 ? void 0 : value.map((selection) => (jsx(Tag, { closable: true, disabled: disabled, onClose: (e) => {
27
+ e.stopPropagation();
28
+ onTagClose === null || onTagClose === void 0 ? void 0 : onTagClose(selection);
29
+ }, size: size, children: selection.name }, selection.id)))), ellipsis ? renderFakeTags() : null] }), showTextInputAfterTags ? (jsx("div", { className: selectClasses.triggerTagsInput, children: jsx("input", { ...inputProps, ref: inputRef, "aria-autocomplete": "list", "aria-disabled": disabled, "aria-haspopup": "listbox", "aria-readonly": readOnly, "aria-required": required, autoComplete: "false", disabled: disabled, readOnly: readOnly, required: required, type: "search", value: searchText }) })) : null] }));
30
+ });
31
+ var SelectTriggerTags$1 = SelectTriggerTags;
32
+
33
+ export { SelectTriggerTags$1 as default };
@@ -187,12 +187,11 @@ const TreeSelect = forwardRef((props, ref) => {
187
187
  const newExpandedValues = toggleValue(value, expandedValues);
188
188
  setExpandedValues(newExpandedValues);
189
189
  };
190
- return (jsxs("div", Object.assign({ ref: nodeRef, className: selectClasses.treeSelect }, { children: [jsx(SelectTrigger, { ref: composedRef, active: open, className: className, clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, inputProps: resolvedInputProps, inputRef: inputRef, mode: mode, onClear: onClear, onClick: onTextFieldClick, onKeyDown: onTextFieldKeydown, onTagClose: onTagClose, prefix: prefix, readOnly: true, renderValue: renderValue, required: required, size: size, suffixActionIcon: suffixActionIcon, value: valueProp }, void 0),
191
- jsx(InputTriggerPopper, Object.assign({ ref: popperRef, anchor: controlRef, className: selectClasses.popper, controllerRef: controllerRef, open: open, options: popperOptions, sameWidth: sameWidth }, { children: jsx(Menu, Object.assign({ itemsInView: itemsInView, maxHeight: menuMaxHeight, role: menuRole, size: menuSize, style: {
190
+ return (jsxs("div", { ref: nodeRef, className: selectClasses.treeSelect, children: [jsx(SelectTrigger, { ref: composedRef, active: open, className: className, clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, inputProps: resolvedInputProps, inputRef: inputRef, mode: mode, onClear: onClear, onClick: onTextFieldClick, onKeyDown: onTextFieldKeydown, onTagClose: onTagClose, prefix: prefix, readOnly: true, renderValue: renderValue, required: required, size: size, suffixActionIcon: suffixActionIcon, value: valueProp }), jsx(InputTriggerPopper, { ref: popperRef, anchor: controlRef, className: selectClasses.popper, controllerRef: controllerRef, open: open, options: popperOptions, sameWidth: sameWidth, children: jsx(Menu, { itemsInView: itemsInView, maxHeight: menuMaxHeight, role: menuRole, size: menuSize, style: {
192
191
  ...restStyle,
193
192
  border: border || 0,
194
193
  width: width || `${panelWidth}px`,
195
- } }, { children: jsx(Tree, Object.assign({}, restTreeProps, { ref: ref, className: cx(selectClasses.tree, treeClassName), disabledValues: disabledValues, expandControllerRef: expandControllerRef, expandedValues: expandedValues, multiple: multiple, nodes: nodes, onExpand: onExpand, onSelect: onSelect, selectMethod: "target", selectable: true, values: selectedValues }), void 0) }), void 0) }), void 0)] }), void 0));
194
+ }, children: jsx(Tree, { ...restTreeProps, ref: ref, className: cx(selectClasses.tree, treeClassName), disabledValues: disabledValues, expandControllerRef: expandControllerRef, expandedValues: expandedValues, multiple: multiple, nodes: nodes, onExpand: onExpand, onSelect: onSelect, selectMethod: "target", selectable: true, values: selectedValues }) }) })] }));
196
195
  });
197
196
  var TreeSelect$1 = TreeSelect;
198
197
 
package/Select/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from './typings';
2
2
  export { SelectControlContext, } from './SelectControlContext';
3
3
  export { SelectTriggerProps, SelectTriggerInputProps, default as SelectTrigger, } from './SelectTrigger';
4
+ export { SelectTriggerTagsProps, default as SelectTriggerTags, } from './SelectTriggerTags';
4
5
  export { SelectProps, default, } from './Select';
5
6
  export { OptionProps, default as Option, } from './Option';
6
7
  export { MenuItemGroupProps as OptionGroupProps, default as OptionGroup, } from '../Menu/MenuItemGroup';
package/Select/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { SelectControlContext } from './SelectControlContext.js';
2
2
  export { default as SelectTrigger } from './SelectTrigger.js';
3
+ export { default as SelectTriggerTags } from './SelectTriggerTags.js';
3
4
  export { default } from './Select.js';
4
5
  export { default as Option } from './Option.js';
5
6
  export { default as OptionGroup } from '../Menu/MenuItemGroup.js';
@@ -0,0 +1,19 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { TagSize } from '@mezzanine-ui/core/tag';
3
+ import { SelectValue } from './typings';
4
+ export interface UseSelectTriggerTagsProps {
5
+ controlRef: MutableRefObject<HTMLDivElement | undefined>;
6
+ size?: TagSize;
7
+ value?: SelectValue[];
8
+ }
9
+ export interface UseSelectTriggerTagsValue {
10
+ renderFakeTags: () => JSX.Element | null;
11
+ takeCount: number;
12
+ }
13
+ export declare function calcTakeCount({ tagsWidths, maxWidth, ellipsisTagWidth, setTakeCount, }: {
14
+ tagsWidths: number[];
15
+ maxWidth: number;
16
+ ellipsisTagWidth: number;
17
+ setTakeCount: (count: number) => void;
18
+ }): void;
19
+ export declare function useSelectTriggerTags(props: UseSelectTriggerTagsProps): UseSelectTriggerTagsValue;
@@ -0,0 +1,61 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useState, useEffect } from 'react';
3
+ import take from 'lodash/take';
4
+ import Tag from '../Tag/Tag.js';
5
+
6
+ function calcTakeCount({ tagsWidths, maxWidth, ellipsisTagWidth, setTakeCount, }) {
7
+ let targetCount = 0;
8
+ for (let count = 0; count <= tagsWidths.length; count += 1) {
9
+ const prevTotal = take(tagsWidths, count).reduce((prev, curr) => prev + curr, 0);
10
+ const nowTotal = take(tagsWidths, count + 1).reduce((prev, curr) => prev + curr, 0);
11
+ targetCount = count;
12
+ if (prevTotal < maxWidth && nowTotal > maxWidth) {
13
+ if (prevTotal + ellipsisTagWidth > maxWidth) {
14
+ targetCount -= 1;
15
+ }
16
+ break;
17
+ }
18
+ }
19
+ setTakeCount(targetCount);
20
+ }
21
+ function useSelectTriggerTags(props) {
22
+ const { controlRef, value, size, } = props;
23
+ const [tagsWidths, setTagsWidths] = useState([]);
24
+ const [takeCount, setTakeCount] = useState(0);
25
+ const mznFakeTagClassName = 'mzn-fake-tag';
26
+ const mznFakeEllipsisTagClassName = 'mzn-fake-ellipsis-tag';
27
+ useEffect(() => {
28
+ var _a, _b, _c;
29
+ const elements = (_a = controlRef.current) === null || _a === void 0 ? void 0 : _a.getElementsByClassName(mznFakeTagClassName);
30
+ const ellipsisTagElement = (_b = controlRef.current) === null || _b === void 0 ? void 0 : _b.getElementsByClassName(mznFakeEllipsisTagClassName)[0];
31
+ if ((elements === null || elements === void 0 ? void 0 : elements.length) && ellipsisTagElement) {
32
+ const tagsWidthsArray = Array.from(elements).map((e) => e.clientWidth);
33
+ const parentWidth = ((_c = controlRef.current) === null || _c === void 0 ? void 0 : _c.clientWidth) || 0;
34
+ const maxWidth = parentWidth * 0.7;
35
+ const ellipsisTagWidth = ellipsisTagElement.clientWidth;
36
+ setTagsWidths(tagsWidthsArray);
37
+ calcTakeCount({
38
+ tagsWidths: tagsWidthsArray,
39
+ maxWidth,
40
+ ellipsisTagWidth,
41
+ setTakeCount,
42
+ });
43
+ }
44
+ }, [value, controlRef]);
45
+ const renderFakeTags = () => {
46
+ if (value && value.length === tagsWidths.length)
47
+ return null;
48
+ return (jsxs("div", { style: {
49
+ position: 'absolute',
50
+ visibility: 'hidden',
51
+ pointerEvents: 'none',
52
+ opacity: 0,
53
+ }, children: [value === null || value === void 0 ? void 0 : value.map((selection) => (jsx(Tag, { className: mznFakeTagClassName, closable: true, disabled: true, size: size, children: selection.name }, selection.id))), jsx(Tag, { disabled: true, className: mznFakeEllipsisTagClassName, size: size, children: "+99..." })] }));
54
+ };
55
+ return {
56
+ renderFakeTags,
57
+ takeCount,
58
+ };
59
+ }
60
+
61
+ export { calcTakeCount, useSelectTriggerTags };
@@ -8,7 +8,7 @@ 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", Object.assign({}, rest, { ref: ref, className: cx(skeletonClasses.host, type === 'circle' && skeletonClasses.circle, className), style: { width: skeletonWidth, height: skeletonHeight, ...skeletonStyle } }, rest), void 0));
11
+ return (jsx("div", { ...rest, ref: ref, className: cx(skeletonClasses.host, type === 'circle' && skeletonClasses.circle, className), style: { width: skeletonWidth, height: skeletonHeight, ...skeletonStyle }, ...rest }));
12
12
  });
13
13
  var Skeleton$1 = Skeleton;
14
14
 
@@ -47,5 +47,5 @@ export declare type SliderProps = Omit<SliderComponentProps, 'innerRef'>;
47
47
  * The outcome will be base on the type of given value.
48
48
  * Notice that slider is a fully controlled component. Property value is always needed.
49
49
  */
50
- declare const Slider: import("react").ForwardRefExoticComponent<Pick<SliderComponentProps, "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "value" | "disabled" | "max" | "min" | "step" | "withInput"> & import("react").RefAttributes<HTMLDivElement>>;
50
+ declare const Slider: import("react").ForwardRefExoticComponent<SliderProps & import("react").RefAttributes<HTMLDivElement>>;
51
51
  export default Slider;
package/Slider/Slider.js CHANGED
@@ -20,9 +20,9 @@ function SliderComponent(props) {
20
20
  ...styleProp,
21
21
  };
22
22
  const shouldHaveInputHandlers = withInput && onChange && !disabled;
23
- const getHandle = (handlerValue, index) => (jsx("div", Object.assign({ className: cx(sliderClasses.handlerPosition, index === 0 && sliderClasses.handlerStartPosition, index === 1 && sliderClasses.handlerEndPosition) }, { children: jsx(Tooltip, Object.assign({ disablePortal: true, options: {
23
+ const getHandle = (handlerValue, index) => (jsx("div", { className: cx(sliderClasses.handlerPosition, index === 0 && sliderClasses.handlerStartPosition, index === 1 && sliderClasses.handlerEndPosition), children: jsx(Tooltip, { disablePortal: true, options: {
24
24
  placement: 'top',
25
- }, title: handlerValue.toString() }, { children: ({ onMouseEnter, onMouseLeave }) => (jsx("div", { className: cx(sliderClasses.handler, index === activeHandleIndex && sliderClasses.handlerActive), "aria-disabled": disabled, "aria-label": `Slider Handler ${index}`, "aria-valuemax": max, "aria-valuemin": min, "aria-valuenow": handlerValue, onFocus: () => { }, onMouseDown: (e) => handlePress(e, index), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onTouchStart: (e) => handlePress(e, index), role: "slider", tabIndex: index }, void 0)) }), void 0) }), void 0));
25
+ }, title: handlerValue.toString(), children: ({ onMouseEnter, onMouseLeave }) => (jsx("div", { className: cx(sliderClasses.handler, index === activeHandleIndex && sliderClasses.handlerActive), "aria-disabled": disabled, "aria-label": `Slider Handler ${index}`, "aria-valuemax": max, "aria-valuemin": min, "aria-valuenow": handlerValue, onFocus: () => { }, onMouseDown: (e) => handlePress(e, index), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onTouchStart: (e) => handlePress(e, index), role: "slider", tabIndex: index })) }) }));
26
26
  const inputSize = Math.max(min.toString().length, max.toString().length);
27
27
  const [startInputValue, setStartInputValue] = useState(() => {
28
28
  if (!isRangeSlider(value)) {
@@ -159,19 +159,15 @@ function SliderComponent(props) {
159
159
  },
160
160
  type: 'number',
161
161
  };
162
- return (jsxs("div", Object.assign({}, rest, { ref: innerRef, className: cx(sliderClasses.host, disabled && sliderClasses.disabled, className), style: style }, { children: [withInput && isRangeSlider(value) ? (jsx(Input, { className: sliderClasses.input, disabled: disabled, onChange: onStartInputChange, value: startInputValue, inputProps: {
162
+ return (jsxs("div", { ...rest, ref: innerRef, className: cx(sliderClasses.host, disabled && sliderClasses.disabled, className), style: style, children: [withInput && isRangeSlider(value) ? (jsx(Input, { className: sliderClasses.input, disabled: disabled, onChange: onStartInputChange, value: startInputValue, inputProps: {
163
163
  ...inputProps,
164
164
  onKeyDown: onStartInputKeydown,
165
165
  onBlur: onStartInputBlur,
166
- } }, void 0)) : null,
167
- jsxs("div", Object.assign({ className: sliderClasses.controls }, { children: [jsx("div", { ref: railRef, className: sliderClasses.rail, role: "presentation", onMouseDown: handleClickTrackOrRail }, void 0),
168
- jsx("div", { className: sliderClasses.track, role: "presentation", onMouseDown: handleClickTrackOrRail }, void 0),
169
- isRangeSlider(value) ? (jsxs(Fragment, { children: [getHandle(value[0], 0), getHandle(value[1], 1)] }, void 0)) : getHandle(value, -1)] }), void 0),
170
- withInput ? (jsx(Input, { className: sliderClasses.input, disabled: disabled, onChange: onEndInputChange, value: endInputValue, inputProps: {
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: {
171
167
  ...inputProps,
172
168
  onKeyDown: onEndInputKeydown,
173
169
  onBlur: onEndInputBlur,
174
- } }, void 0)) : null] }), void 0));
170
+ } })) : null] }));
175
171
  }
176
172
  /**
177
173
  * The react component for `mezzanine` slider.
@@ -180,9 +176,9 @@ function SliderComponent(props) {
180
176
  */
181
177
  const Slider = forwardRef((props, ref) => {
182
178
  if (isRangeSlider(props.value)) {
183
- return (jsx(SliderComponent, Object.assign({}, props, { innerRef: ref }), void 0));
179
+ return (jsx(SliderComponent, { ...props, innerRef: ref }));
184
180
  }
185
- return (jsx(SliderComponent, Object.assign({}, props, { innerRef: ref }), void 0));
181
+ return (jsx(SliderComponent, { ...props, innerRef: ref }));
186
182
  });
187
183
  var Slider$1 = Slider;
188
184
 
package/Stepper/Step.js CHANGED
@@ -12,8 +12,8 @@ import cx from 'clsx';
12
12
  const Step = forwardRef(function Step(props, ref) {
13
13
  const { active, children, className, completed, completedIconProps, disabled, index = -1, title, titleProps, ...rest } = props;
14
14
  /** icon and step number */
15
- const iconRender = (jsx(Typography, Object.assign({ className: stepClasses.iconBackground, variant: "button3" }, { children: completed ? (jsx(Icon, Object.assign({ className: stepClasses.completedIcon, icon: CheckIcon }, completedIconProps), void 0)) : index + 1 }), void 0));
16
- return (jsxs("div", Object.assign({ className: cx(stepClasses.host, disabled && stepClasses.disabled, className), ref: ref }, rest, { children: [iconRender, /** title (optional) */ title && (jsx(Typography, Object.assign({ className: stepClasses.title, variant: "button2" }, titleProps, { children: title }), void 0)), children] }), void 0));
15
+ const iconRender = (jsx(Typography, { className: stepClasses.iconBackground, variant: "button3", children: completed ? (jsx(Icon, { className: stepClasses.completedIcon, icon: CheckIcon, ...completedIconProps })) : index + 1 }));
16
+ return (jsxs("div", { className: cx(stepClasses.host, disabled && stepClasses.disabled, className), ref: ref, ...rest, children: [iconRender, /** title (optional) */ title && (jsx(Typography, { className: stepClasses.title, variant: "button2", ...titleProps, children: title })), children] }));
17
17
  });
18
18
  var Step$1 = Step;
19
19
 
@@ -27,7 +27,7 @@ const Stepper = forwardRef(function Stepper(props, ref) {
27
27
  ...step.props,
28
28
  });
29
29
  });
30
- return (jsx("div", Object.assign({ className: cx(stepperClasses.host, className), ref: ref }, rest, { children: stepsWithState }), void 0));
30
+ return (jsx("div", { className: cx(stepperClasses.host, className), ref: ref, ...rest, children: stepsWithState }));
31
31
  });
32
32
  var Stepper$1 = Stepper;
33
33
 
package/Switch/Switch.js CHANGED
@@ -18,12 +18,11 @@ const Switch = forwardRef(function Switch(props, ref) {
18
18
  onChange: onChangeProp,
19
19
  });
20
20
  const disabled = loading || disabledProp;
21
- return (jsxs("span", Object.assign({ ref: ref }, rest, { className: cx(switchClasses.host, {
21
+ return (jsxs("span", { ref: ref, ...rest, className: cx(switchClasses.host, {
22
22
  [switchClasses.checked]: checked,
23
23
  [switchClasses.disabled]: disabled,
24
24
  [switchClasses.large]: size === 'large',
25
- }, className) }, { children: [jsx("span", Object.assign({ className: switchClasses.control }, { children: loading && jsx(Icon, { icon: SwitchSpinnerIcon, spin: true }, void 0) }), void 0),
26
- jsx("input", Object.assign({}, inputProps, { "aria-checked": checked, "aria-disabled": disabled, checked: checked, className: switchClasses.input, disabled: disabled, onChange: onChange, type: "checkbox" }), void 0)] }), void 0));
25
+ }, className), children: [jsx("span", { className: switchClasses.control, children: loading && jsx(Icon, { icon: SwitchSpinnerIcon, spin: true }) }), jsx("input", { ...inputProps, "aria-checked": checked, "aria-disabled": disabled, checked: checked, className: switchClasses.input, disabled: disabled, onChange: onChange, type: "checkbox" })] }));
27
26
  });
28
27
  var Switch$1 = Switch;
29
28
 
package/Table/Table.d.ts CHANGED
@@ -82,5 +82,5 @@ export interface TableWithPagination<T> extends TableBaseProps<T> {
82
82
  fetchMore?: undefined;
83
83
  }
84
84
  export declare type TableProps<T> = TableWithFetchMore<T> | TableWithPagination<T>;
85
- declare const Table: import("react").ForwardRefExoticComponent<(TableWithFetchMore<Record<string, unknown>> & import("react").RefAttributes<HTMLDivElement>) | (TableWithPagination<Record<string, unknown>> & import("react").RefAttributes<HTMLDivElement>)>;
85
+ declare const Table: import("react").ForwardRefExoticComponent<TableProps<Record<string, unknown>> & import("react").RefAttributes<HTMLDivElement>>;
86
86
  export default Table;
package/Table/Table.js CHANGED
@@ -52,13 +52,9 @@ const Table = forwardRef(function Table(props, ref) {
52
52
  /** Feature refresh */
53
53
  const isRefreshShow = useMemo(() => {
54
54
  var _a;
55
- return ((_a =
55
+ return (
56
56
  /** @default false */
57
- refreshProp === null ||
58
- /** @default false */
59
- refreshProp === void 0 ? void 0 :
60
- /** @default false */
61
- refreshProp.show) !== null && _a !== void 0 ? _a : false);
57
+ (_a = refreshProp === null || refreshProp === void 0 ? void 0 : refreshProp.show) !== null && _a !== void 0 ? _a : false);
62
58
  }, [refreshProp === null || refreshProp === void 0 ? void 0 : refreshProp.show]);
63
59
  /** context */
64
60
  const tableContextValue = useMemo(() => {
@@ -120,10 +116,7 @@ const Table = forwardRef(function Table(props, ref) {
120
116
  const tableComponentContextValue = {
121
117
  bodyCell: (_a = components === null || components === void 0 ? void 0 : components.body) === null || _a === void 0 ? void 0 : _a.cell,
122
118
  };
123
- return (jsx(Loading, Object.assign({ loading: loading, stretch: true, tip: "\u8CC7\u6599\u8F09\u5165\u4E2D..." }, { children: jsx("div", Object.assign({ ref: ref }, rest, { className: cx(tableClasses.host, className), role: "grid" }, { children: jsx(TableContext.Provider, Object.assign({ value: tableContextValue }, { children: jsx(TableDataContext.Provider, Object.assign({ value: tableDataContextValue }, { children: jsxs(TableComponentContext.Provider, Object.assign({ value: tableComponentContextValue }, { children: [isRefreshShow ? (jsx(TableRefresh, { onClick: refreshProp.onClick }, void 0)) : null,
124
- jsx(TableHeader, { className: headerClassName }, void 0),
125
- jsx(TableBody, { ref: bodyRef, className: bodyClassName, rowClassName: bodyRowClassName }, void 0),
126
- paginationProp ? (jsx(TablePagination, { bodyRef: bodyRef }, void 0)) : null] }), void 0) }), void 0) }), void 0) }), void 0) }), void 0));
119
+ return (jsx(Loading, { loading: loading, stretch: true, tip: "\u8CC7\u6599\u8F09\u5165\u4E2D...", children: jsx("div", { ref: ref, ...rest, className: cx(tableClasses.host, className), role: "grid", children: jsx(TableContext.Provider, { value: tableContextValue, children: jsx(TableDataContext.Provider, { value: tableDataContextValue, children: jsxs(TableComponentContext.Provider, { value: tableComponentContextValue, children: [isRefreshShow ? (jsx(TableRefresh, { onClick: refreshProp.onClick })) : null, jsx(TableHeader, { className: headerClassName }), jsx(TableBody, { ref: bodyRef, className: bodyClassName, rowClassName: bodyRowClassName }), paginationProp ? (jsx(TablePagination, { bodyRef: bodyRef })) : null] }) }) }) }) }));
127
120
  });
128
121
  var Table$1 = Table;
129
122
 
@@ -22,15 +22,13 @@ const TableBody = forwardRef(function TableBody(props, ref) {
22
22
  const currentStartCount = (paginationOptions === null || paginationOptions === void 0 ? void 0 : paginationOptions.pageSize) && currentPage ? ((paginationOptions.pageSize) * (currentPage - 1)) : 0;
23
23
  const currentEndCount = (paginationOptions === null || paginationOptions === void 0 ? void 0 : paginationOptions.pageSize) && currentPage && total ? (Math.min(((paginationOptions.pageSize) * currentPage), total)) : 0;
24
24
  const currentDataSource = pagination && !disableAutoSlicing ? (dataSource.slice(currentStartCount, currentEndCount)) : dataSource;
25
- return (jsxs("div", Object.assign({}, rest, { ref: composedRefs, className: cx(tableClasses.body, className), onScroll: tableBody.onScroll, role: "rowgroup" }, { children: [currentDataSource.length ? currentDataSource.map((rowData, index) => (jsx(TableBodyRow, { className: rowClassName, rowData: rowData, rowIndex: index }, (rowData.key || rowData.id)))) : (jsx(Empty, Object.assign({}, restEmptyProps, { className: cx(tableClasses.bodyEmpty, emptyComponentClassName), fullHeight: emptyComponentFullHeight }, { children: emptyComponentChildren }), void 0)),
26
- (fetchMore === null || fetchMore === void 0 ? void 0 : fetchMore.isFetching) ? (jsx("div", Object.assign({ className: tableClasses.bodyFetchMore }, { children: jsx(Loading, { loading: true }, void 0) }), void 0)) : null,
27
- jsx("div", Object.assign({ ref: scrollElement.ref, onMouseDown: scrollElement.onMouseDown, onMouseUp: scrollElement.onMouseUp, onMouseEnter: scrollElement.onMouseEnter, onMouseLeave: scrollElement.onMouseLeave, role: "button", style: scrollElement.style, tabIndex: -1 }, { children: jsx("div", { style: {
25
+ return (jsxs("div", { ...rest, ref: composedRefs, className: cx(tableClasses.body, className), onScroll: tableBody.onScroll, role: "rowgroup", children: [currentDataSource.length ? currentDataSource.map((rowData, index) => (jsx(TableBodyRow, { className: rowClassName, rowData: rowData, rowIndex: index }, (rowData.key || rowData.id)))) : (jsx(Empty, { ...restEmptyProps, className: cx(tableClasses.bodyEmpty, emptyComponentClassName), fullHeight: emptyComponentFullHeight, children: emptyComponentChildren })), (fetchMore === null || fetchMore === void 0 ? void 0 : fetchMore.isFetching) ? (jsx("div", { className: tableClasses.bodyFetchMore, children: jsx(Loading, { loading: true }) })) : null, jsx("div", { ref: scrollElement.ref, onMouseDown: scrollElement.onMouseDown, onMouseUp: scrollElement.onMouseUp, onMouseEnter: scrollElement.onMouseEnter, onMouseLeave: scrollElement.onMouseLeave, role: "button", style: scrollElement.style, tabIndex: -1, children: jsx("div", { style: {
28
26
  width: `${scrollBarSize}px`,
29
27
  height: '100%',
30
28
  borderRadius: '10px',
31
29
  backgroundColor: '#7d7d7d',
32
30
  transition: '0.1s',
33
- } }, void 0) }), void 0)] }), void 0));
31
+ } }) })] }));
34
32
  });
35
33
  var TableBody$1 = TableBody;
36
34