@mezzanine-ui/react 1.0.0-rc.5 → 1.0.0-rc.7
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.d.ts +36 -0
- package/Accordion/Accordion.js +37 -1
- package/AlertBanner/AlertBanner.d.ts +30 -1
- package/AlertBanner/AlertBanner.js +56 -12
- package/AutoComplete/AutoComplete.d.ts +75 -11
- package/AutoComplete/AutoComplete.js +145 -25
- package/AutoComplete/AutoCompleteInside.d.ts +54 -0
- package/AutoComplete/AutoCompleteInside.js +17 -0
- package/AutoComplete/useAutoCompleteKeyboard.d.ts +2 -1
- package/AutoComplete/useAutoCompleteKeyboard.js +4 -1
- package/Backdrop/Backdrop.d.ts +33 -1
- package/Backdrop/Backdrop.js +33 -1
- package/Badge/Badge.d.ts +26 -1
- package/Badge/Badge.js +26 -1
- package/Badge/typings.d.ts +15 -0
- package/Breadcrumb/BreadcrumbDropdown.d.ts +1 -1
- package/Breadcrumb/BreadcrumbOverflowMenuDropdown.d.ts +1 -1
- package/Breadcrumb/typings.d.ts +1 -1
- package/Button/Button.d.ts +26 -1
- package/Button/Button.js +33 -5
- package/COMPONENTS.md +267 -0
- package/Calendar/useCalendarControls.d.ts +18 -0
- package/Calendar/useCalendarControls.js +18 -0
- package/Card/FourThumbnailCard.js +1 -1
- package/Card/SingleThumbnailCard.js +1 -1
- package/Checkbox/Checkbox.d.ts +30 -1
- package/Checkbox/Checkbox.js +54 -4
- package/Checkbox/CheckboxGroup.d.ts +39 -1
- package/Checkbox/CheckboxGroup.js +49 -3
- package/Cropper/Cropper.d.ts +2 -2
- package/Cropper/Cropper.js +2 -3
- package/Cropper/CropperElement.js +1 -1
- package/Cropper/utils/cropper-calculations.d.ts +1 -1
- package/Cropper/utils/cropper-calculations.js +16 -14
- package/DatePicker/DatePicker.d.ts +36 -2
- package/DatePicker/DatePicker.js +36 -2
- package/DateRangePicker/useDateRangePickerValue.d.ts +24 -0
- package/DateRangePicker/useDateRangePickerValue.js +24 -0
- package/Description/Description.d.ts +1 -1
- package/Description/Description.js +1 -1
- package/Description/DescriptionTitle.d.ts +6 -1
- package/Description/DescriptionTitle.js +2 -2
- package/Drawer/Drawer.d.ts +78 -33
- package/Drawer/Drawer.js +72 -34
- package/Dropdown/Dropdown.d.ts +63 -1
- package/Dropdown/Dropdown.js +203 -9
- package/Dropdown/DropdownItem.d.ts +26 -2
- package/Dropdown/DropdownItem.js +91 -43
- package/Dropdown/DropdownItemCard.d.ts +3 -2
- package/Dropdown/DropdownItemCard.js +8 -5
- package/Dropdown/DropdownStatus.d.ts +2 -2
- package/Dropdown/DropdownStatus.js +3 -2
- package/Dropdown/dropdownKeydownHandler.d.ts +6 -0
- package/Dropdown/dropdownKeydownHandler.js +14 -7
- package/Empty/icons/EmptyMainInitialDataIcon.js +1 -1
- package/Empty/icons/EmptyMainNotificationIcon.js +1 -1
- package/Empty/icons/EmptyMainResultIcon.js +1 -1
- package/Empty/icons/EmptyMainSystemIcon.js +1 -1
- package/FilterArea/Filter.d.ts +25 -2
- package/FilterArea/Filter.js +43 -2
- package/FilterArea/FilterArea.d.ts +43 -4
- package/FilterArea/FilterArea.js +39 -4
- package/FilterArea/FilterAreaContext.d.ts +6 -0
- package/FilterArea/FilterAreaContext.js +6 -0
- package/FilterArea/FilterLine.d.ts +19 -0
- package/FilterArea/FilterLine.js +19 -0
- package/FilterArea/index.d.ts +2 -2
- package/FilterArea/index.js +1 -1
- package/Form/FormField.d.ts +43 -2
- package/Form/FormField.js +40 -3
- package/Form/typings.d.ts +2 -0
- package/Form/useAutoCompleteValueControl.d.ts +20 -0
- package/Form/useAutoCompleteValueControl.js +20 -0
- package/Form/useCheckboxControlValue.d.ts +19 -0
- package/Form/useCheckboxControlValue.js +19 -0
- package/Form/useControlValueState.d.ts +16 -0
- package/Form/useControlValueState.js +16 -0
- package/Form/useCustomControlValue.d.ts +17 -0
- package/Form/useCustomControlValue.js +17 -0
- package/Form/useInputControlValue.d.ts +19 -0
- package/Form/useInputControlValue.js +19 -0
- package/Form/useInputWithClearControlValue.d.ts +20 -0
- package/Form/useInputWithClearControlValue.js +20 -0
- package/Form/useRadioControlValue.d.ts +19 -0
- package/Form/useRadioControlValue.js +19 -0
- package/Form/useSelectValueControl.d.ts +19 -0
- package/Form/useSelectValueControl.js +19 -0
- package/Form/useSwitchControlValue.d.ts +18 -0
- package/Form/useSwitchControlValue.js +18 -0
- package/Icon/Icon.d.ts +23 -1
- package/Icon/Icon.js +23 -1
- package/Input/Input.d.ts +31 -1
- package/Input/Input.js +31 -1
- package/Input/SpinnerButton/SpinnerButton.js +1 -1
- package/Message/Message.d.ts +56 -6
- package/Message/Message.js +59 -52
- package/Modal/Modal.d.ts +76 -4
- package/Modal/Modal.js +117 -6
- package/Modal/ModalBodyForVerification.js +3 -1
- package/Modal/ModalFooter.d.ts +21 -6
- package/Modal/ModalHeader.d.ts +50 -11
- package/Modal/ModalHeader.js +1 -1
- package/Modal/index.d.ts +1 -1
- package/Navigation/Navigation.js +20 -11
- package/Navigation/NavigationHeader.js +2 -1
- package/Navigation/NavigationIconButton.d.ts +8 -0
- package/Navigation/NavigationIconButton.js +2 -2
- package/Navigation/NavigationOption.js +6 -3
- package/Navigation/NavigationOverflowMenu.js +9 -6
- package/Navigation/NavigationUserMenu.js +3 -1
- package/Navigation/context.d.ts +1 -0
- package/NotificationCenter/NotificationCenter.d.ts +59 -9
- package/NotificationCenter/NotificationCenter.js +150 -54
- package/NotificationCenter/NotificationCenterDrawer.d.ts +56 -6
- package/NotificationCenter/NotificationCenterDrawer.js +6 -8
- package/NotificationCenter/index.d.ts +1 -1
- package/OverflowTooltip/OverflowTooltip.js +46 -5
- package/PageFooter/PageFooter.d.ts +1 -1
- package/PageFooter/PageFooter.js +8 -16
- package/Pagination/Pagination.d.ts +38 -1
- package/Pagination/Pagination.js +38 -1
- package/Pagination/PaginationPageSize.js +1 -1
- package/Pagination/usePagination.d.ts +20 -0
- package/Pagination/usePagination.js +20 -0
- package/Progress/Progress.d.ts +24 -1
- package/Progress/Progress.js +24 -1
- package/README.md +82 -0
- package/Radio/Radio.d.ts +35 -1
- package/Radio/Radio.js +50 -12
- package/Radio/RadioGroup.d.ts +2 -2
- package/Radio/RadioGroupContext.d.ts +3 -2
- package/Section/SectionGroup.d.ts +20 -0
- package/Section/SectionGroup.js +16 -0
- package/Section/index.d.ts +2 -0
- package/Section/index.js +1 -0
- package/Select/Select.d.ts +55 -1
- package/Select/Select.js +37 -2
- package/Select/typings.d.ts +9 -0
- package/{Selection/Selection.d.ts → SelectionCard/SelectionCard.d.ts} +23 -11
- package/{Selection/Selection.js → SelectionCard/SelectionCard.js} +14 -14
- package/SelectionCard/SelectionCardGroup.d.ts +28 -0
- package/SelectionCard/index.d.ts +12 -0
- package/SelectionCard/index.js +5 -0
- package/Separator/Separator.d.ts +19 -1
- package/Separator/Separator.js +19 -1
- package/Slider/Slider.d.ts +11 -0
- package/Slider/useSlider.d.ts +21 -0
- package/Spin/Spin.d.ts +14 -5
- package/Spin/Spin.js +6 -8
- package/Stepper/Stepper.d.ts +34 -1
- package/Stepper/Stepper.js +34 -1
- package/Stepper/useStepper.d.ts +18 -0
- package/Stepper/useStepper.js +18 -0
- package/Tab/Tab.d.ts +33 -1
- package/Tab/Tab.js +33 -1
- package/Table/Table.d.ts +51 -3
- package/Table/Table.js +52 -4
- package/Table/hooks/useTableDataSource.d.ts +4 -4
- package/Table/hooks/useTableDataSource.js +1 -1
- package/Tag/Tag.d.ts +27 -1
- package/Tag/Tag.js +27 -1
- package/Tag/typings.d.ts +28 -0
- package/Textarea/Textarea.d.ts +28 -1
- package/Textarea/Textarea.js +25 -1
- package/TimePicker/TimePicker.js +1 -1
- package/TimeRangePicker/TimeRangePicker.js +1 -1
- package/Toggle/Toggle.d.ts +34 -1
- package/Toggle/Toggle.js +34 -1
- package/Tooltip/Tooltip.d.ts +39 -1
- package/Tooltip/Tooltip.js +39 -1
- package/Tooltip/useDelayMouseEnterLeave.d.ts +17 -0
- package/Tooltip/useDelayMouseEnterLeave.js +17 -0
- package/Typography/Typography.d.ts +23 -1
- package/Typography/Typography.js +23 -1
- package/Upload/Upload.d.ts +13 -7
- package/Upload/Upload.js +55 -20
- package/Upload/UploadItem.d.ts +3 -3
- package/Upload/UploadItem.js +11 -8
- package/Upload/UploadPictureCard.d.ts +5 -0
- package/Upload/UploadPictureCard.js +10 -6
- package/Upload/Uploader.d.ts +32 -31
- package/Upload/Uploader.js +10 -9
- package/hooks/useClickAway.d.ts +16 -0
- package/hooks/useClickAway.js +16 -0
- package/hooks/useComposeRefs.d.ts +15 -0
- package/hooks/useComposeRefs.js +15 -0
- package/hooks/useDocumentEscapeKeyDown.d.ts +15 -0
- package/hooks/useDocumentEscapeKeyDown.js +15 -0
- package/hooks/useDocumentEvents.d.ts +16 -0
- package/hooks/useDocumentEvents.js +16 -0
- package/hooks/useDocumentTabKeyDown.d.ts +15 -0
- package/hooks/useDocumentTabKeyDown.js +15 -0
- package/hooks/useIsomorphicLayoutEffect.d.ts +16 -0
- package/hooks/useIsomorphicLayoutEffect.js +16 -0
- package/hooks/useLastCallback.d.ts +15 -0
- package/hooks/useLastCallback.js +15 -0
- package/hooks/useLastValue.d.ts +18 -0
- package/hooks/useLastValue.js +18 -0
- package/hooks/usePreviousValue.d.ts +14 -0
- package/hooks/usePreviousValue.js +14 -0
- package/hooks/useScrollLock.d.ts +6 -4
- package/hooks/useScrollLock.js +6 -4
- package/hooks/useTopStack.d.ts +17 -0
- package/hooks/useTopStack.js +17 -0
- package/hooks/useWindowWidth.d.ts +14 -0
- package/hooks/useWindowWidth.js +14 -0
- package/index.d.ts +6 -4
- package/index.js +3 -2
- package/llms.txt +200 -0
- package/package.json +5 -4
- package/Selection/SelectionGroup.d.ts +0 -28
- package/Selection/index.d.ts +0 -12
- package/Selection/index.js +0 -5
|
@@ -123,7 +123,45 @@ interface CheckboxGroupChildrenInputProps extends CheckboxGroupBaseProps {
|
|
|
123
123
|
}
|
|
124
124
|
export type CheckboxGroupProps = CheckboxGroupOptionsInputProps | CheckboxGroupChildrenInputProps;
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
126
|
+
* 核取方塊群組元件,用於管理一組具有相同 `name` 的核取方塊。
|
|
127
|
+
*
|
|
128
|
+
* 支援透過 `options` 陣列或 `children` 傳入子元件兩種方式渲染選項,並可透過
|
|
129
|
+
* `layout` 控制水平或垂直排列。啟用 `level` 設定可顯示「全選」控制核取方塊,
|
|
130
|
+
* 勾選狀態會自動計算 indeterminate 中間態;`onChange` 回呼透過 `event.target.values`
|
|
131
|
+
* 提供最新已選取的值陣列。
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```tsx
|
|
135
|
+
* import CheckboxGroup from '@mezzanine-ui/react/CheckboxGroup';
|
|
136
|
+
* import Checkbox from '@mezzanine-ui/react/Checkbox';
|
|
137
|
+
*
|
|
138
|
+
* // 使用 options 陣列
|
|
139
|
+
* <CheckboxGroup
|
|
140
|
+
* name="fruits"
|
|
141
|
+
* defaultValue={['apple']}
|
|
142
|
+
* options={[
|
|
143
|
+
* { label: '蘋果', value: 'apple' },
|
|
144
|
+
* { label: '香蕉', value: 'banana' },
|
|
145
|
+
* { label: '橘子', value: 'orange' },
|
|
146
|
+
* ]}
|
|
147
|
+
* onChange={(e) => console.log(e.target.values)}
|
|
148
|
+
* />
|
|
149
|
+
*
|
|
150
|
+
* // 使用 children 方式,垂直排列
|
|
151
|
+
* <CheckboxGroup name="options" layout="vertical">
|
|
152
|
+
* <Checkbox label="選項一" value="a" />
|
|
153
|
+
* <Checkbox label="選項二" value="b" />
|
|
154
|
+
* </CheckboxGroup>
|
|
155
|
+
*
|
|
156
|
+
* // 啟用全選控制
|
|
157
|
+
* <CheckboxGroup
|
|
158
|
+
* name="items"
|
|
159
|
+
* options={[{ label: '項目 A', value: 'a' }, { label: '項目 B', value: 'b' }]}
|
|
160
|
+
* level={{ active: true, label: '全選' }}
|
|
161
|
+
* />
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @see {@link Checkbox} 單一核取方塊元件
|
|
127
165
|
*/
|
|
128
166
|
declare const CheckboxGroup: import("react").ForwardRefExoticComponent<CheckboxGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
129
167
|
export default CheckboxGroup;
|
|
@@ -23,7 +23,45 @@ const equalityFn = (a, b) => {
|
|
|
23
23
|
return sortedA.every((val, idx) => val === sortedB[idx]);
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* 核取方塊群組元件,用於管理一組具有相同 `name` 的核取方塊。
|
|
27
|
+
*
|
|
28
|
+
* 支援透過 `options` 陣列或 `children` 傳入子元件兩種方式渲染選項,並可透過
|
|
29
|
+
* `layout` 控制水平或垂直排列。啟用 `level` 設定可顯示「全選」控制核取方塊,
|
|
30
|
+
* 勾選狀態會自動計算 indeterminate 中間態;`onChange` 回呼透過 `event.target.values`
|
|
31
|
+
* 提供最新已選取的值陣列。
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* import CheckboxGroup from '@mezzanine-ui/react/CheckboxGroup';
|
|
36
|
+
* import Checkbox from '@mezzanine-ui/react/Checkbox';
|
|
37
|
+
*
|
|
38
|
+
* // 使用 options 陣列
|
|
39
|
+
* <CheckboxGroup
|
|
40
|
+
* name="fruits"
|
|
41
|
+
* defaultValue={['apple']}
|
|
42
|
+
* options={[
|
|
43
|
+
* { label: '蘋果', value: 'apple' },
|
|
44
|
+
* { label: '香蕉', value: 'banana' },
|
|
45
|
+
* { label: '橘子', value: 'orange' },
|
|
46
|
+
* ]}
|
|
47
|
+
* onChange={(e) => console.log(e.target.values)}
|
|
48
|
+
* />
|
|
49
|
+
*
|
|
50
|
+
* // 使用 children 方式,垂直排列
|
|
51
|
+
* <CheckboxGroup name="options" layout="vertical">
|
|
52
|
+
* <Checkbox label="選項一" value="a" />
|
|
53
|
+
* <Checkbox label="選項二" value="b" />
|
|
54
|
+
* </CheckboxGroup>
|
|
55
|
+
*
|
|
56
|
+
* // 啟用全選控制
|
|
57
|
+
* <CheckboxGroup
|
|
58
|
+
* name="items"
|
|
59
|
+
* options={[{ label: '項目 A', value: 'a' }, { label: '項目 B', value: 'b' }]}
|
|
60
|
+
* level={{ active: true, label: '全選' }}
|
|
61
|
+
* />
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @see {@link Checkbox} 單一核取方塊元件
|
|
27
65
|
*/
|
|
28
66
|
const CheckboxGroup = forwardRef(function CheckboxGroup(props, ref) {
|
|
29
67
|
var _a, _b, _c, _d, _e;
|
|
@@ -174,10 +212,18 @@ const CheckboxGroup = forwardRef(function CheckboxGroup(props, ref) {
|
|
|
174
212
|
const syntheticEvent = assignCheckboxGroupValuesToEvent(event, newValue, resolvedName);
|
|
175
213
|
onChangeProp(syntheticEvent);
|
|
176
214
|
}
|
|
177
|
-
}, [
|
|
215
|
+
}, [
|
|
216
|
+
canRenderLevelControl,
|
|
217
|
+
level,
|
|
218
|
+
onChangeProp,
|
|
219
|
+
normalizedOptions,
|
|
220
|
+
resolvedName,
|
|
221
|
+
setValue,
|
|
222
|
+
value,
|
|
223
|
+
]);
|
|
178
224
|
return (jsxs("div", { ...rest, ref: ref, "aria-orientation": ariaOrientation, className: cx(checkboxGroupClasses.host, {
|
|
179
225
|
[checkboxGroupClasses.nested]: isLevelActive,
|
|
180
|
-
}, className), role: role, children: [canRenderLevelControl && !shouldRenderLevelInsideContent && (jsx(Checkbox, { checked: levelChecked, disabled: disabled || (level === null || level === void 0 ? void 0 : level.disabled), id: `${resolvedName}-level-control`, indeterminate: levelIndeterminate, label: (_b = level === null || level === void 0 ? void 0 : level.label) !== null && _b !== void 0 ? _b : '', mode: (_c = level === null || level === void 0 ? void 0 : level.mode) !== null && _c !== void 0 ? _c : 'default', name: `${resolvedName}-level-control`, onChange: handleLevelControlChange })), jsxs("div", { className: cx(checkboxGroupClasses.contentWrapper, checkboxGroupClasses.layout(layout), mode && checkboxGroupClasses.mode(mode)), children: [canRenderLevelControl && shouldRenderLevelInsideContent && (jsxs(Fragment, { children: [jsx(Checkbox, { checked: levelChecked, disabled: disabled || (level === null || level === void 0 ? void 0 : level.disabled), id: `${resolvedName}-level-control`, indeterminate: levelIndeterminate, label: (_d = level === null || level === void 0 ? void 0 : level.label) !== null && _d !== void 0 ? _d : '', mode: (_e = level === null || level === void 0 ? void 0 : level.mode) !== null && _e !== void 0 ? _e : 'default', name: `${resolvedName}-level-control`, onChange: handleLevelControlChange }), isHorizontalLayout && jsx("i", { className: checkboxGroupClasses.levelControlSeparator })] })), jsx(CheckboxGroupContext.Provider, { value: context, children: children })] })] }));
|
|
226
|
+
}, className), role: role, children: [canRenderLevelControl && !shouldRenderLevelInsideContent && (jsx(Checkbox, { checked: levelChecked, disabled: disabled || (level === null || level === void 0 ? void 0 : level.disabled), id: `${resolvedName}-level-control`, indeterminate: levelIndeterminate, label: (_b = level === null || level === void 0 ? void 0 : level.label) !== null && _b !== void 0 ? _b : '', mode: (_c = level === null || level === void 0 ? void 0 : level.mode) !== null && _c !== void 0 ? _c : 'default', name: `${resolvedName}-level-control`, onChange: handleLevelControlChange })), jsxs("div", { className: cx(checkboxGroupClasses.contentWrapper, checkboxGroupClasses.layout(layout), mode && checkboxGroupClasses.mode(mode)), children: [canRenderLevelControl && shouldRenderLevelInsideContent && (jsxs(Fragment, { children: [jsx(Checkbox, { checked: levelChecked, disabled: disabled || (level === null || level === void 0 ? void 0 : level.disabled), id: `${resolvedName}-level-control`, indeterminate: levelIndeterminate, label: (_d = level === null || level === void 0 ? void 0 : level.label) !== null && _d !== void 0 ? _d : '', mode: (_e = level === null || level === void 0 ? void 0 : level.mode) !== null && _e !== void 0 ? _e : 'default', name: `${resolvedName}-level-control`, onChange: handleLevelControlChange }), isHorizontalLayout && (jsx("i", { className: checkboxGroupClasses.levelControlSeparator }))] })), jsx(CheckboxGroupContext.Provider, { value: context, children: children })] })] }));
|
|
181
227
|
});
|
|
182
228
|
|
|
183
229
|
export { assignCheckboxGroupValuesToEvent, CheckboxGroup as default };
|
package/Cropper/Cropper.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ReactElement } from 'react';
|
|
2
|
-
import type { ModalProps } from '../Modal';
|
|
2
|
+
import type { ModalHeaderLayoutProps, ModalProps } from '../Modal';
|
|
3
3
|
import { ComponentOverridableForwardRefComponentPropsFactory } from '../utils/jsx-types';
|
|
4
4
|
import { CropArea, CropperComponent, CropperPropsBase } from './typings';
|
|
5
|
-
export type CropperModalProps = Omit<ModalProps, 'children' | 'modalType' | 'extendedSplitLeftSideContent' | 'extendedSplitRightSideContent' | 'onCancel' | 'onConfirm' | 'showCancelButton' | 'showModalFooter' | 'showModalHeader' | 'confirmText' | 'title'> & {
|
|
5
|
+
export type CropperModalProps = Omit<ModalProps, 'children' | 'modalType' | 'extendedSplitLeftSideContent' | 'extendedSplitRightSideContent' | 'extendedSplitSidebarPosition' | 'onCancel' | 'onConfirm' | 'showCancelButton' | 'showModalFooter' | 'showModalHeader' | 'confirmText' | 'title'> & ModalHeaderLayoutProps & {
|
|
6
6
|
/**
|
|
7
7
|
* The text for the cancel button.
|
|
8
8
|
*/
|
package/Cropper/Cropper.js
CHANGED
|
@@ -47,7 +47,6 @@ const CropperModalComponent = forwardRef(function CropperModal(props, ref) {
|
|
|
47
47
|
? {
|
|
48
48
|
showModalFooter: true,
|
|
49
49
|
confirmText,
|
|
50
|
-
showCancelButton: true,
|
|
51
50
|
cancelText,
|
|
52
51
|
onCancel: handleCancel,
|
|
53
52
|
onConfirm: handleConfirm,
|
|
@@ -97,12 +96,12 @@ const CropperModalNotifier = (props) => {
|
|
|
97
96
|
onConfirm: handleConfirm,
|
|
98
97
|
open: true,
|
|
99
98
|
};
|
|
100
|
-
return
|
|
99
|
+
return jsx(CropperModal, { ...mergedModalProps });
|
|
101
100
|
};
|
|
102
101
|
const cropperModalNotifier = createNotifier({
|
|
103
102
|
render: (notifierProps) => {
|
|
104
103
|
const { key, ...restProps } = notifierProps;
|
|
105
|
-
return
|
|
104
|
+
return jsx(CropperModalNotifier, { ...restProps, notifierKey: key });
|
|
106
105
|
},
|
|
107
106
|
});
|
|
108
107
|
CropperModal.open = (options) => new Promise((resolve) => {
|
|
@@ -883,7 +883,7 @@ const CropperElement = forwardRef(function CropperElement(props, ref) {
|
|
|
883
883
|
return 'grabbing';
|
|
884
884
|
return 'default';
|
|
885
885
|
}, [cropArea, isDragging, isDraggingImage]);
|
|
886
|
-
return (jsxs("div", { className: cropperClasses.element, ref: elementRef, children: [jsx(Component, { ...rest, className: cx(cropperClasses.host, cropperClasses.size(size), className), onMouseDown: handleMouseDown, ref: composedRef, style: { cursor: cursorStyle, width: '100%', ...rest.style }, children: children }), cropArea && tagPosition && (jsxs(Typography, { className: cropperClasses.tag, color: "text-fixed-light", style: {
|
|
886
|
+
return (jsxs("div", { className: cropperClasses.element, ref: elementRef, children: [jsx(Component, { ...rest, className: cx(cropperClasses.host, cropperClasses.size(size), className), onMouseDown: handleMouseDown, ref: composedRef, style: { cursor: cursorStyle, width: '100%', ...rest.style }, children: children }), cropArea && tagPosition && (jsxs(Typography, { className: cropperClasses.tag, color: "text-fixed-light", variant: "label-secondary", style: {
|
|
887
887
|
left: tagPosition.left,
|
|
888
888
|
top: tagPosition.top,
|
|
889
889
|
}, children: [Math.round((tagCropArea || cropArea).width), " \u00D7", ' ', Math.round((tagCropArea || cropArea).height), " px"] })), jsx("div", { className: cropperClasses.controls, children: jsx(Slider, { min: MIN_SCALE, max: MAX_SCALE, step: SCALE_STEP, value: scale, onChange: handleSliderChange, suffixIcon: PlusIcon, prefixIcon: MinusIcon }) })] }));
|
|
@@ -14,7 +14,7 @@ export interface InitialCropAreaResult {
|
|
|
14
14
|
imagePosition: ImagePosition;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Calculate base scale for image to
|
|
17
|
+
* Calculate base scale for image to cover canvas (both dimensions).
|
|
18
18
|
*/
|
|
19
19
|
export declare function getBaseScale(rect: DOMRect, img: HTMLImageElement): number;
|
|
20
20
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Calculate base scale for image to
|
|
2
|
+
* Calculate base scale for image to cover canvas (both dimensions).
|
|
3
3
|
*/
|
|
4
4
|
function getBaseScale(rect, img) {
|
|
5
|
-
if (!rect.height)
|
|
5
|
+
if (!rect.height || !rect.width)
|
|
6
6
|
return 1;
|
|
7
|
-
return img.height / rect.height;
|
|
7
|
+
return Math.min(img.height / rect.height, img.width / rect.width);
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* Calculate base display size of image.
|
|
@@ -25,22 +25,24 @@ function calculateInitialCropArea(img, rect, aspectRatio) {
|
|
|
25
25
|
const baseDisplayHeight = img.height / baseScale;
|
|
26
26
|
const initialOffsetX = (rect.width - baseDisplayWidth) / 2;
|
|
27
27
|
const initialOffsetY = (rect.height - baseDisplayHeight) / 2;
|
|
28
|
-
let initialWidth =
|
|
29
|
-
let initialHeight =
|
|
28
|
+
let initialWidth = rect.width;
|
|
29
|
+
let initialHeight = rect.height;
|
|
30
30
|
if (aspectRatio) {
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const maxWidthByCanvasHeight = rect.height * aspectRatio;
|
|
32
|
+
const maxHeightByCanvasWidth = rect.width / aspectRatio;
|
|
33
|
+
if (maxWidthByCanvasHeight <= rect.width) {
|
|
34
|
+
// Height is the limiting factor → crop fills full canvas height
|
|
35
|
+
initialWidth = maxWidthByCanvasHeight;
|
|
36
|
+
initialHeight = rect.height;
|
|
36
37
|
}
|
|
37
38
|
else {
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
// Width is the limiting factor → crop fills full canvas width
|
|
40
|
+
initialWidth = rect.width;
|
|
41
|
+
initialHeight = maxHeightByCanvasWidth;
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
|
-
const initialX =
|
|
43
|
-
const initialY =
|
|
44
|
+
const initialX = (rect.width - initialWidth) / 2;
|
|
45
|
+
const initialY = (rect.height - initialHeight) / 2;
|
|
44
46
|
return {
|
|
45
47
|
baseDisplayHeight,
|
|
46
48
|
baseDisplayWidth,
|
|
@@ -35,8 +35,42 @@ export interface DatePickerProps extends Omit<DatePickerCalendarProps, 'anchor'
|
|
|
35
35
|
referenceDate?: DateType;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* 日期選擇器元件,透過點擊輸入框或日曆圖示開啟日曆彈出層進行日期選取。
|
|
39
|
+
*
|
|
40
|
+
* 必須搭配 `CalendarContext`(`CalendarConfigProvider`)使用,以提供語系與格式化函式。
|
|
41
|
+
* 支援 `day`、`week`、`month`、`quarter`、`half-year`、`year` 等多種選取模式,
|
|
42
|
+
* 可透過 `isDateDisabled` 等相關 props 限制可選日期範圍,並支援受控(`value`)
|
|
43
|
+
* 與非受控(`defaultValue`)兩種使用方式。
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* import DatePicker from '@mezzanine-ui/react/DatePicker';
|
|
48
|
+
* import CalendarConfigProvider from '@mezzanine-ui/react/CalendarConfigProvider';
|
|
49
|
+
*
|
|
50
|
+
* // 基本用法(需包覆在 CalendarConfigProvider 內)
|
|
51
|
+
* <CalendarConfigProvider methods={...}>
|
|
52
|
+
* <DatePicker onChange={(date) => console.log(date)} />
|
|
53
|
+
* </CalendarConfigProvider>
|
|
54
|
+
*
|
|
55
|
+
* // 受控用法
|
|
56
|
+
* const [date, setDate] = useState<DateType>();
|
|
57
|
+
* <CalendarConfigProvider methods={...}>
|
|
58
|
+
* <DatePicker value={date} onChange={setDate} />
|
|
59
|
+
* </CalendarConfigProvider>
|
|
60
|
+
*
|
|
61
|
+
* // 月份選取模式,禁用過去月份
|
|
62
|
+
* <CalendarConfigProvider methods={...}>
|
|
63
|
+
* <DatePicker
|
|
64
|
+
* mode="month"
|
|
65
|
+
* isMonthDisabled={(iso) => iso < '2024-01'}
|
|
66
|
+
* onChange={setDate}
|
|
67
|
+
* />
|
|
68
|
+
* </CalendarConfigProvider>
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @see {@link DateRangePicker} 日期範圍選擇器元件
|
|
72
|
+
* @see {@link DateTimePicker} 日期時間選擇器元件
|
|
73
|
+
* @see {@link Calendar} 日曆元件
|
|
40
74
|
*/
|
|
41
75
|
declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
42
76
|
export default DatePicker;
|
package/DatePicker/DatePicker.js
CHANGED
|
@@ -14,8 +14,42 @@ import PickerTrigger from '../Picker/PickerTrigger.js';
|
|
|
14
14
|
import cx from 'clsx';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
17
|
+
* 日期選擇器元件,透過點擊輸入框或日曆圖示開啟日曆彈出層進行日期選取。
|
|
18
|
+
*
|
|
19
|
+
* 必須搭配 `CalendarContext`(`CalendarConfigProvider`)使用,以提供語系與格式化函式。
|
|
20
|
+
* 支援 `day`、`week`、`month`、`quarter`、`half-year`、`year` 等多種選取模式,
|
|
21
|
+
* 可透過 `isDateDisabled` 等相關 props 限制可選日期範圍,並支援受控(`value`)
|
|
22
|
+
* 與非受控(`defaultValue`)兩種使用方式。
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* import DatePicker from '@mezzanine-ui/react/DatePicker';
|
|
27
|
+
* import CalendarConfigProvider from '@mezzanine-ui/react/CalendarConfigProvider';
|
|
28
|
+
*
|
|
29
|
+
* // 基本用法(需包覆在 CalendarConfigProvider 內)
|
|
30
|
+
* <CalendarConfigProvider methods={...}>
|
|
31
|
+
* <DatePicker onChange={(date) => console.log(date)} />
|
|
32
|
+
* </CalendarConfigProvider>
|
|
33
|
+
*
|
|
34
|
+
* // 受控用法
|
|
35
|
+
* const [date, setDate] = useState<DateType>();
|
|
36
|
+
* <CalendarConfigProvider methods={...}>
|
|
37
|
+
* <DatePicker value={date} onChange={setDate} />
|
|
38
|
+
* </CalendarConfigProvider>
|
|
39
|
+
*
|
|
40
|
+
* // 月份選取模式,禁用過去月份
|
|
41
|
+
* <CalendarConfigProvider methods={...}>
|
|
42
|
+
* <DatePicker
|
|
43
|
+
* mode="month"
|
|
44
|
+
* isMonthDisabled={(iso) => iso < '2024-01'}
|
|
45
|
+
* onChange={setDate}
|
|
46
|
+
* />
|
|
47
|
+
* </CalendarConfigProvider>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @see {@link DateRangePicker} 日期範圍選擇器元件
|
|
51
|
+
* @see {@link DateTimePicker} 日期時間選擇器元件
|
|
52
|
+
* @see {@link Calendar} 日曆元件
|
|
19
53
|
*/
|
|
20
54
|
const DatePicker = forwardRef(function DatePicker(props, ref) {
|
|
21
55
|
var _a;
|
|
@@ -32,6 +32,30 @@ export interface UseDateRangePickerValueProps {
|
|
|
32
32
|
*/
|
|
33
33
|
value?: RangePickerValue;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* 管理日期區間選取器的值狀態與互動邏輯的 Hook。
|
|
37
|
+
*
|
|
38
|
+
* 協調「起始日期輸入框」、「結束日期輸入框」與「日曆」三者之間的狀態同步,
|
|
39
|
+
* 支援鍵盤輸入、日曆點選、hover 預覽以及清除功能。
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* import { useDateRangePickerValue } from '@mezzanine-ui/react';
|
|
44
|
+
*
|
|
45
|
+
* const {
|
|
46
|
+
* value, calendarValue, inputFromValue, inputToValue,
|
|
47
|
+
* onCalendarChange, onInputFromChange, onInputToChange, onClear,
|
|
48
|
+
* } = useDateRangePickerValue({
|
|
49
|
+
* format: 'YYYY-MM-DD',
|
|
50
|
+
* inputFromRef,
|
|
51
|
+
* inputToRef,
|
|
52
|
+
* value: rangePickerValue,
|
|
53
|
+
* onChange: setRangePickerValue,
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @see {@link DateRangePicker} 搭配的元件
|
|
58
|
+
*/
|
|
35
59
|
export declare function useDateRangePickerValue({ format, hasDisabledDateInRange, inputFromRef: _inputFromRef, inputToRef, mode, onChange: onChangeProp, value: valueProp, }: UseDateRangePickerValueProps): {
|
|
36
60
|
calendarValue: string[] | undefined;
|
|
37
61
|
checkIsInRange: (_date: DateType) => boolean;
|
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
import { useState, useCallback, useMemo } from 'react';
|
|
3
3
|
import { useCalendarContext } from '../Calendar/CalendarContext.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* 管理日期區間選取器的值狀態與互動邏輯的 Hook。
|
|
7
|
+
*
|
|
8
|
+
* 協調「起始日期輸入框」、「結束日期輸入框」與「日曆」三者之間的狀態同步,
|
|
9
|
+
* 支援鍵盤輸入、日曆點選、hover 預覽以及清除功能。
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* import { useDateRangePickerValue } from '@mezzanine-ui/react';
|
|
14
|
+
*
|
|
15
|
+
* const {
|
|
16
|
+
* value, calendarValue, inputFromValue, inputToValue,
|
|
17
|
+
* onCalendarChange, onInputFromChange, onInputToChange, onClear,
|
|
18
|
+
* } = useDateRangePickerValue({
|
|
19
|
+
* format: 'YYYY-MM-DD',
|
|
20
|
+
* inputFromRef,
|
|
21
|
+
* inputToRef,
|
|
22
|
+
* value: rangePickerValue,
|
|
23
|
+
* onChange: setRangePickerValue,
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @see {@link DateRangePicker} 搭配的元件
|
|
28
|
+
*/
|
|
5
29
|
function useDateRangePickerValue({ format, hasDisabledDateInRange, inputFromRef: _inputFromRef, inputToRef, mode, onChange: onChangeProp, value: valueProp, }) {
|
|
6
30
|
var _a, _b;
|
|
7
31
|
const { addDay, formatToString, isBefore, locale } = useCalendarContext();
|
|
@@ -22,7 +22,7 @@ export type DescriptionProps = DistributiveOmit<DescriptionTitleProps, 'classNam
|
|
|
22
22
|
*/
|
|
23
23
|
orientation?: DescriptionOrientation;
|
|
24
24
|
/**
|
|
25
|
-
* Controls the text size of the description content
|
|
25
|
+
* Controls the text size of both the title and the description content
|
|
26
26
|
* @default 'main'
|
|
27
27
|
*/
|
|
28
28
|
size?: DescriptionSize;
|
|
@@ -14,7 +14,7 @@ const Description = forwardRef(function Description(props, ref) {
|
|
|
14
14
|
size: (_a = children.props.size) !== null && _a !== void 0 ? _a : size,
|
|
15
15
|
})
|
|
16
16
|
: children;
|
|
17
|
-
return (jsx(DescriptionContext.Provider, { value: { size }, children: jsxs("div", { className: cx(descriptionClasses.host, descriptionClasses.orientation(orientation), className), ref: ref, children: [jsx(DescriptionTitle, { ...rest, children: title }), injectedChildren] }) }));
|
|
17
|
+
return (jsx(DescriptionContext.Provider, { value: { size }, children: jsxs("div", { className: cx(descriptionClasses.host, descriptionClasses.orientation(orientation), className), ref: ref, children: [jsx(DescriptionTitle, { ...rest, size: size, children: title }), injectedChildren] }) }));
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
export { Description as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IconDefinition } from '@mezzanine-ui/icons';
|
|
2
|
-
import { DescriptionWidthType } from '@mezzanine-ui/core/description';
|
|
2
|
+
import { DescriptionSize, DescriptionWidthType } from '@mezzanine-ui/core/description';
|
|
3
3
|
import { BadgeDotVariant } from '@mezzanine-ui/core/badge';
|
|
4
4
|
import { Placement } from '@floating-ui/react-dom';
|
|
5
5
|
interface DescriptionTitleBaseProps {
|
|
@@ -15,6 +15,11 @@ interface DescriptionTitleBaseProps {
|
|
|
15
15
|
* Title text
|
|
16
16
|
*/
|
|
17
17
|
children: string;
|
|
18
|
+
/**
|
|
19
|
+
* Controls the text size of the title.
|
|
20
|
+
* @default 'main'
|
|
21
|
+
*/
|
|
22
|
+
size?: DescriptionSize;
|
|
18
23
|
/**
|
|
19
24
|
* Controls the layout width behavior of the title
|
|
20
25
|
* @default 'stretch'
|
|
@@ -8,8 +8,8 @@ import Icon from '../Icon/Icon.js';
|
|
|
8
8
|
import cx from 'clsx';
|
|
9
9
|
|
|
10
10
|
const DescriptionTitle = forwardRef(function DescriptionTitle(props, ref) {
|
|
11
|
-
const { badge, className, children, icon, tooltip, tooltipPlacement, widthType = 'stretch', } = props;
|
|
12
|
-
return (jsxs("div", { className: cx(descriptionClasses.titleHost, descriptionClasses.titleWidth(widthType), className), ref: ref, children: [badge ? (jsx(Badge, { variant: badge, text: children, className: descriptionClasses.titleText })) : (jsx("span", { className: descriptionClasses.titleText, children: children })), icon ? (tooltip ? (jsx(Tooltip, { title: tooltip, options: {
|
|
11
|
+
const { badge, className, children, icon, size, tooltip, tooltipPlacement, widthType = 'stretch', } = props;
|
|
12
|
+
return (jsxs("div", { className: cx(descriptionClasses.titleHost, descriptionClasses.titleWidth(widthType), size && descriptionClasses.titleSize(size), className), ref: ref, children: [badge ? (jsx(Badge, { variant: badge, text: children, size: size, className: descriptionClasses.titleText })) : (jsx("span", { className: descriptionClasses.titleText, children: children })), icon ? (tooltip ? (jsx(Tooltip, { title: tooltip, options: {
|
|
13
13
|
placement: tooltipPlacement !== null && tooltipPlacement !== void 0 ? tooltipPlacement : 'top',
|
|
14
14
|
}, children: ({ onMouseEnter, onMouseLeave, ref }) => (jsx(Icon, { ref: ref, icon: icon, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, size: 16 })) })) : (jsx(Icon, { icon: icon, size: 16 }))) : null] }));
|
|
15
15
|
});
|
package/Drawer/Drawer.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ButtonIconType, ButtonSize, ButtonVariant } from '@mezzanine-ui/core/button';
|
|
2
2
|
import { DrawerSize } from '@mezzanine-ui/core/drawer';
|
|
3
|
+
import type { DropdownOption } from '@mezzanine-ui/core/dropdown';
|
|
3
4
|
import { IconDefinition } from '@mezzanine-ui/icons';
|
|
4
|
-
import {
|
|
5
|
-
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
5
|
+
import { type ChangeEventHandler } from 'react';
|
|
6
6
|
import { BackdropProps } from '../Backdrop';
|
|
7
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
7
8
|
export interface DrawerProps extends NativeElementPropsWithoutKeyAndRef<'div'>, Pick<BackdropProps, 'container' | 'disableCloseOnBackdropClick' | 'disablePortal' | 'onBackdropClick' | 'onClose' | 'open'> {
|
|
8
9
|
/**
|
|
9
10
|
* Key prop for forcing content remount when data changes.
|
|
@@ -116,51 +117,62 @@ export interface DrawerProps extends NativeElementPropsWithoutKeyAndRef<'div'>,
|
|
|
116
117
|
*/
|
|
117
118
|
bottomSecondaryActionVariant?: ButtonVariant;
|
|
118
119
|
/**
|
|
119
|
-
* The label of the all radio in
|
|
120
|
+
* The label of the all radio in filter area.
|
|
120
121
|
*/
|
|
121
|
-
|
|
122
|
+
filterAreaAllRadioLabel?: string;
|
|
122
123
|
/**
|
|
123
|
-
* The label of the custom button in
|
|
124
|
+
* The label of the custom button in filter area.
|
|
124
125
|
*/
|
|
125
|
-
|
|
126
|
+
filterAreaCustomButtonLabel?: string;
|
|
126
127
|
/**
|
|
127
|
-
* The default value of the radio group in
|
|
128
|
+
* The default value of the radio group in filter area.
|
|
128
129
|
*/
|
|
129
|
-
|
|
130
|
+
filterAreaDefaultValue?: string;
|
|
130
131
|
/**
|
|
131
|
-
* Whether the
|
|
132
|
+
* Whether the filter area content is empty (for disabling custom button).
|
|
132
133
|
*/
|
|
133
|
-
|
|
134
|
+
filterAreaIsEmpty?: boolean;
|
|
134
135
|
/**
|
|
135
|
-
* The callback function when the custom button is clicked in
|
|
136
|
+
* The callback function when the custom button is clicked in filter area.
|
|
136
137
|
*/
|
|
137
|
-
|
|
138
|
+
filterAreaOnCustomButtonClick?: VoidFunction;
|
|
138
139
|
/**
|
|
139
|
-
* The callback function when the radio group value changes in
|
|
140
|
+
* The callback function when the radio group value changes in filter area.
|
|
140
141
|
*/
|
|
141
|
-
|
|
142
|
+
filterAreaOnRadioChange?: ChangeEventHandler<HTMLInputElement>;
|
|
142
143
|
/**
|
|
143
|
-
* The label of the read radio in
|
|
144
|
+
* The label of the read radio in filter area.
|
|
144
145
|
*/
|
|
145
|
-
|
|
146
|
+
filterAreaReadRadioLabel?: string;
|
|
146
147
|
/**
|
|
147
|
-
* Controls whether to display the
|
|
148
|
+
* Controls whether to display the filter area.
|
|
148
149
|
* @default false
|
|
149
150
|
*/
|
|
150
|
-
|
|
151
|
+
filterAreaShow?: boolean;
|
|
151
152
|
/**
|
|
152
|
-
* Controls whether to display the unread button in
|
|
153
|
+
* Controls whether to display the unread button in filter area.
|
|
153
154
|
* @default false
|
|
154
155
|
*/
|
|
155
|
-
|
|
156
|
+
filterAreaShowUnreadButton?: boolean;
|
|
157
|
+
/**
|
|
158
|
+
* The label of the unread radio in filter area.
|
|
159
|
+
*/
|
|
160
|
+
filterAreaUnreadRadioLabel?: string;
|
|
161
|
+
/**
|
|
162
|
+
* The value of the radio group in filter area.
|
|
163
|
+
*/
|
|
164
|
+
filterAreaValue?: string;
|
|
156
165
|
/**
|
|
157
|
-
*
|
|
166
|
+
* Options for the filter bar dropdown.
|
|
167
|
+
* When non-empty, the right-side filter area button is replaced by a Dropdown
|
|
168
|
+
* triggered by a `DotHorizontalIcon` icon button.
|
|
158
169
|
*/
|
|
159
|
-
|
|
170
|
+
filterAreaOptions?: DropdownOption[];
|
|
160
171
|
/**
|
|
161
|
-
*
|
|
172
|
+
* Callback fired when a filter bar dropdown option is selected.
|
|
173
|
+
* Only used when `filterAreaOptions` is non-empty.
|
|
162
174
|
*/
|
|
163
|
-
|
|
175
|
+
filterAreaOnSelect?: (option: DropdownOption) => void;
|
|
164
176
|
/**
|
|
165
177
|
* Controls whether to disable closing drawer while escape key down.
|
|
166
178
|
* @default false
|
|
@@ -178,18 +190,51 @@ export interface DrawerProps extends NativeElementPropsWithoutKeyAndRef<'div'>,
|
|
|
178
190
|
* Controls whether to display the header area.
|
|
179
191
|
*/
|
|
180
192
|
isHeaderDisplay?: boolean;
|
|
181
|
-
/**
|
|
182
|
-
* Custom render function for the control bar area.
|
|
183
|
-
* The control bar will be rendered between the header and content areas.
|
|
184
|
-
* If provided, this will override the default control bar rendering and control bar-related props.
|
|
185
|
-
* @returns ReactNode - The custom control bar element
|
|
186
|
-
*/
|
|
187
|
-
renderControlBar?: () => React.ReactNode;
|
|
188
193
|
/**
|
|
189
194
|
* Controls the width of the drawer.
|
|
190
195
|
* @default 'medium'
|
|
191
196
|
*/
|
|
192
197
|
size?: DrawerSize;
|
|
193
198
|
}
|
|
194
|
-
|
|
199
|
+
/**
|
|
200
|
+
* 從螢幕右側滑入的抽屜面板元件。
|
|
201
|
+
*
|
|
202
|
+
* 使用 `Backdrop` 作為遮罩層,並以 `Slide` 動畫過渡效果呈現開關狀態。
|
|
203
|
+
* 支援標題列、篩選區域(含分頁 Radio)、底部操作按鈕區域,以及按下 Escape 鍵關閉。
|
|
204
|
+
* 當多個 Drawer 同時開啟時,Escape 鍵只會關閉最上層的 Drawer。
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```tsx
|
|
208
|
+
* import Drawer from '@mezzanine-ui/react/Drawer';
|
|
209
|
+
*
|
|
210
|
+
* // 基本用法
|
|
211
|
+
* <Drawer open={open} onClose={() => setOpen(false)} isHeaderDisplay headerTitle="詳細資料">
|
|
212
|
+
* <p>抽屜內容</p>
|
|
213
|
+
* </Drawer>
|
|
214
|
+
*
|
|
215
|
+
* // 帶有底部操作按鈕
|
|
216
|
+
* <Drawer
|
|
217
|
+
* open={open}
|
|
218
|
+
* onClose={() => setOpen(false)}
|
|
219
|
+
* isHeaderDisplay
|
|
220
|
+
* headerTitle="編輯"
|
|
221
|
+
* isBottomDisplay
|
|
222
|
+
* bottomPrimaryActionText="確認"
|
|
223
|
+
* bottomOnPrimaryActionClick={handleSubmit}
|
|
224
|
+
* bottomSecondaryActionText="取消"
|
|
225
|
+
* bottomOnSecondaryActionClick={() => setOpen(false)}
|
|
226
|
+
* >
|
|
227
|
+
* <form>表單內容</form>
|
|
228
|
+
* </Drawer>
|
|
229
|
+
*
|
|
230
|
+
* // 使用 contentKey 強制重新掛載內容
|
|
231
|
+
* <Drawer open={open} onClose={() => setOpen(false)} contentKey={recordId}>
|
|
232
|
+
* <RecordDetail id={recordId} />
|
|
233
|
+
* </Drawer>
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* @see {@link Modal} 對話框元件
|
|
237
|
+
* @see {@link Backdrop} 遮罩層元件
|
|
238
|
+
*/
|
|
239
|
+
declare const Drawer: import("react").ForwardRefExoticComponent<DrawerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
195
240
|
export default Drawer;
|