@mezzanine-ui/react 0.11.2 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AppBar/AppBar.d.ts +2 -2
- package/AppBar/AppBarBrand.d.ts +1 -1
- package/AppBar/AppBarMain.d.ts +1 -1
- package/AppBar/AppBarSupport.d.ts +1 -1
- package/Badge/BadgeContainer.d.ts +1 -1
- package/Button/Button.d.ts +1 -1
- package/Button/ButtonGroup.d.ts +1 -1
- package/Button/IconButton.d.ts +1 -1
- package/Button/index.d.ts +2 -2
- package/Button/typings.d.ts +1 -1
- package/Calendar/CalendarContext.d.ts +1 -1
- package/Calendar/useCalendarControlModifiers.d.ts +2 -2
- package/Form/FormMessage.d.ts +1 -1
- package/Form/typings.d.ts +1 -1
- package/Form/useAutoCompleteValueControl.d.ts +5 -5
- package/Form/useInputWithTagsModeValue.d.ts +1 -1
- package/Form/useSelectValueControl.d.ts +6 -6
- package/Menu/MenuDivider.d.ts +1 -1
- package/Message/Message.d.ts +1 -1
- package/Modal/ModalBody.d.ts +1 -1
- package/Modal/ModalFooter.d.ts +1 -1
- package/Navigation/Navigation.d.ts +2 -2
- package/Navigation/NavigationSubMenu.d.ts +7 -2
- package/Navigation/NavigationSubMenu.js +2 -2
- package/Notifier/typings.d.ts +1 -1
- package/Pagination/Pagination.d.ts +30 -3
- package/Pagination/Pagination.js +3 -2
- package/Pagination/PaginationItem.d.ts +1 -1
- package/Pagination/PaginationJumper.d.ts +1 -1
- package/Pagination/PaginationPageSize.d.ts +38 -0
- package/Pagination/PaginationPageSize.js +19 -0
- package/Pagination/index.d.ts +1 -0
- package/Pagination/index.js +1 -0
- package/Pagination/usePagination.js +1 -1
- package/Picker/usePickerValue.d.ts +1 -1
- package/Popper/Popper.d.ts +2 -2
- package/Select/AutoComplete.d.ts +3 -3
- package/Select/Select.d.ts +3 -3
- package/Select/SelectTrigger.d.ts +5 -5
- package/Select/SelectTrigger.js +4 -1
- package/Slider/Slider.d.ts +4 -4
- package/Table/Table.d.ts +6 -4
- package/Table/Table.js +13 -13
- package/Table/TableBodyRow.js +3 -3
- package/Table/TableContext.d.ts +5 -3
- package/Table/TableExpandedTable.js +1 -1
- package/Table/pagination/TablePagination.js +3 -2
- package/Table/sorting/useTableSorting.d.ts +1 -1
- package/Table/useTableScroll.d.ts +3 -0
- package/Tabs/Tabs.d.ts +1 -1
- package/TextField/TextField.js +4 -1
- package/Transition/Fade.d.ts +1 -1
- package/Transition/SlideFade.d.ts +1 -1
- package/Transition/Transition.d.ts +6 -6
- package/Transition/Zoom.d.ts +1 -1
- package/Tree/TreeNode.d.ts +1 -1
- package/Tree/TreeNodeList.d.ts +1 -1
- package/Tree/typings.d.ts +7 -7
- package/Typography/Typography.d.ts +2 -2
- package/Typography/index.d.ts +1 -1
- package/Upload/UploadPicture.d.ts +1 -1
- package/Upload/UploadPictureBlock.d.ts +1 -0
- package/Upload/UploadPictureBlock.js +2 -2
- package/Upload/UploadPictureWall.d.ts +7 -2
- package/Upload/UploadPictureWall.js +2 -2
- package/Upload/UploadPictureWallItem.d.ts +1 -0
- package/Upload/UploadPictureWallItem.js +2 -2
- package/hooks/useClickAway.d.ts +3 -3
- package/hooks/useDocumentEscapeKeyDown.d.ts +1 -1
- package/hooks/useDocumentEvents.d.ts +1 -1
- package/hooks/useDocumentTabKeyDown.d.ts +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -0
- package/package.json +17 -17
- package/utils/composeRefs.d.ts +2 -2
- package/utils/general.d.ts +2 -2
- package/utils/getElement.d.ts +1 -1
- package/utils/jsx-types.d.ts +5 -5
package/AppBar/AppBar.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
|
4
4
|
import { AppBarBrandProps } from './AppBarBrand';
|
|
5
5
|
import { AppBarMainProps } from './AppBarMain';
|
|
6
6
|
import { AppBarSupportProps } from './AppBarSupport';
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export type AppBarChild = ReactElement<AppBarBrandProps | AppBarMainProps | AppBarSupportProps, NamedExoticComponent>;
|
|
8
|
+
export type AppBarChildren = AppBarChild | AppBarChild[];
|
|
9
9
|
export interface AppBarProps extends NativeElementPropsWithoutKeyAndRef<'header'> {
|
|
10
10
|
orientation?: AppBarOrientation;
|
|
11
11
|
children?: AppBarChildren;
|
package/AppBar/AppBarBrand.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
-
export
|
|
3
|
+
export type AppBarBrandProps = NativeElementPropsWithoutKeyAndRef<'div'>;
|
|
4
4
|
declare const AppBarBrand: import("react").ForwardRefExoticComponent<AppBarBrandProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export default AppBarBrand;
|
package/AppBar/AppBarMain.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
-
export
|
|
3
|
+
export type AppBarMainProps = NativeElementPropsWithoutKeyAndRef<'div'>;
|
|
4
4
|
declare const AppBarMain: import("react").ForwardRefExoticComponent<AppBarMainProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export default AppBarMain;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
-
export
|
|
3
|
+
export type AppBarSupportProps = NativeElementPropsWithoutKeyAndRef<'div'>;
|
|
4
4
|
declare const AppBarSupport: import("react").ForwardRefExoticComponent<AppBarSupportProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export default AppBarSupport;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
-
export
|
|
3
|
+
export type BadgeContainerProps = NativeElementPropsWithoutKeyAndRef<'span'>;
|
|
4
4
|
/**
|
|
5
5
|
* The react component for `mezzanine` badge container.
|
|
6
6
|
*/
|
package/Button/Button.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ComponentOverridableForwardRefComponentPropsFactory } from '../utils/jsx-types';
|
|
3
3
|
import { ButtonComponent, ButtonPropsBase } from './typings';
|
|
4
|
-
export
|
|
4
|
+
export type ButtonProps<C extends ButtonComponent = 'button'> = ComponentOverridableForwardRefComponentPropsFactory<ButtonComponent, C, ButtonPropsBase>;
|
|
5
5
|
/**
|
|
6
6
|
* The react component for `mezzanine` button.
|
|
7
7
|
*/
|
package/Button/ButtonGroup.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ButtonColor, ButtonGroupOrientation, ButtonGroupSpacing, ButtonSize, Bu
|
|
|
3
3
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
4
|
import { ButtonProps } from './Button';
|
|
5
5
|
import { IconButtonProps } from './IconButton';
|
|
6
|
-
export
|
|
6
|
+
export type ButtonGroupChild = ReactElement<ButtonProps | IconButtonProps> | null | undefined | false;
|
|
7
7
|
export interface ButtonGroupProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
8
8
|
/**
|
|
9
9
|
* If `true`, all buttons will not have spacing between each others.
|
package/Button/IconButton.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ComponentOverridableForwardRefComponentPropsFactory } from '../utils/jsx-types';
|
|
3
3
|
import { ButtonComponent, ButtonPropsBase } from './typings';
|
|
4
|
-
export
|
|
4
|
+
export type IconButtonProps<C extends ButtonComponent = 'button'> = ComponentOverridableForwardRefComponentPropsFactory<ButtonComponent, C, Omit<ButtonPropsBase, 'prefix' | 'suffix'> & {
|
|
5
5
|
/**
|
|
6
6
|
* The icon element.
|
|
7
7
|
*/
|
package/Button/index.d.ts
CHANGED
|
@@ -9,12 +9,12 @@ export type { ButtonComponent, ButtonProps, ButtonPropsBase, IconButtonProps, };
|
|
|
9
9
|
* @remark
|
|
10
10
|
* Add type alias here for parsable to react docgen typescript.
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
type GenericIconButton = <C extends ButtonComponent = 'button'>(props: PropsWithoutRef<IconButtonProps<C>> & RefAttributes<ElementRef<C>>) => ReactElement;
|
|
13
13
|
export declare const IconButton: GenericIconButton;
|
|
14
14
|
/**
|
|
15
15
|
* @remark
|
|
16
16
|
* Add type alias here for parsable to react docgen typescript.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
type GenericButton = <C extends ButtonComponent = 'button'>(props: PropsWithoutRef<ButtonProps<C>> & RefAttributes<ElementRef<C>>) => ReactElement;
|
|
19
19
|
declare const _default: GenericButton;
|
|
20
20
|
export default _default;
|
package/Button/typings.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSXElementConstructor, ReactNode } from 'react';
|
|
2
2
|
import { ButtonColor, ButtonSize, ButtonVariant } from '@mezzanine-ui/core/button';
|
|
3
|
-
export
|
|
3
|
+
export type ButtonComponent = 'button' | 'a' | JSXElementConstructor<any>;
|
|
4
4
|
export interface ButtonPropsBase {
|
|
5
5
|
/**
|
|
6
6
|
* The color name provided by palette.
|
|
@@ -7,7 +7,7 @@ export interface CalendarConfigs extends CalendarMethods {
|
|
|
7
7
|
displayWeekDayLocale: string;
|
|
8
8
|
valueLocale: string;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type CalendarConfigProviderProps = {
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
defaultDateFormat?: string;
|
|
13
13
|
defaultTimeFormat?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CalendarMode, DateType } from '@mezzanine-ui/core/calendar';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type CalendarControlModifier = (value: DateType) => DateType;
|
|
3
|
+
export type UseCalendarControlModifiersResult = Record<CalendarMode, [
|
|
4
4
|
CalendarControlModifier,
|
|
5
5
|
CalendarControlModifier
|
|
6
6
|
]>;
|
package/Form/FormMessage.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
-
export
|
|
3
|
+
export type FormMessageProps = NativeElementPropsWithoutKeyAndRef<'span'>;
|
|
4
4
|
/**
|
|
5
5
|
* The react component for `mezzanine` form message.
|
|
6
6
|
*/
|
package/Form/typings.d.ts
CHANGED
|
@@ -8,19 +8,19 @@ export interface UseAutoCompleteBaseValueControl {
|
|
|
8
8
|
onSearch?(input: string): any;
|
|
9
9
|
options: SelectValue[];
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export type UseAutoCompleteMultipleValueControl = UseAutoCompleteBaseValueControl & {
|
|
12
12
|
defaultValue?: SelectValue[];
|
|
13
13
|
mode: 'multiple';
|
|
14
14
|
onChange?(newOptions: SelectValue[]): any;
|
|
15
15
|
value?: SelectValue[];
|
|
16
16
|
};
|
|
17
|
-
export
|
|
17
|
+
export type UseAutoCompleteSingleValueControl = UseAutoCompleteBaseValueControl & {
|
|
18
18
|
defaultValue?: SelectValue;
|
|
19
19
|
mode: 'single';
|
|
20
20
|
onChange?(newOption: SelectValue | null): any;
|
|
21
21
|
value?: SelectValue | null;
|
|
22
22
|
};
|
|
23
|
-
export
|
|
23
|
+
export type UseAutoCompleteValueControl = UseAutoCompleteMultipleValueControl | UseAutoCompleteSingleValueControl;
|
|
24
24
|
export interface AutoCompleteBaseValueControl {
|
|
25
25
|
focused: boolean;
|
|
26
26
|
onClear(e: MouseEvent<Element>): void;
|
|
@@ -31,11 +31,11 @@ export interface AutoCompleteBaseValueControl {
|
|
|
31
31
|
setSearchText: Dispatch<SetStateAction<string>>;
|
|
32
32
|
unselectedOptions: SelectValue[];
|
|
33
33
|
}
|
|
34
|
-
export
|
|
34
|
+
export type AutoCompleteMultipleValueControl = AutoCompleteBaseValueControl & {
|
|
35
35
|
onChange: (v: SelectValue | null) => SelectValue[];
|
|
36
36
|
value: SelectValue[];
|
|
37
37
|
};
|
|
38
|
-
export
|
|
38
|
+
export type AutoCompleteSingleValueControl = AutoCompleteBaseValueControl & {
|
|
39
39
|
onChange: (v: SelectValue | null) => SelectValue | null;
|
|
40
40
|
value: SelectValue | null;
|
|
41
41
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChangeEvent, KeyboardEvent, RefObject } from 'react';
|
|
2
2
|
import { UseInputControlValueProps } from './useInputControlValue';
|
|
3
|
-
export
|
|
3
|
+
export type TagsType = string[] | number[];
|
|
4
4
|
export interface UseInputWithTagsModeValueProps<E extends HTMLInputElement | HTMLTextAreaElement> extends UseInputControlValueProps<E> {
|
|
5
5
|
/**
|
|
6
6
|
* The value of initial tags
|
|
@@ -5,29 +5,29 @@ export interface UseSelectBaseValueControl {
|
|
|
5
5
|
onChange?(newOptions: SelectValue[] | SelectValue): any;
|
|
6
6
|
onClose?(): void;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type UseSelectMultipleValueControl = UseSelectBaseValueControl & {
|
|
9
9
|
defaultValue?: SelectValue[];
|
|
10
10
|
mode: 'multiple';
|
|
11
11
|
onChange?(newOptions: SelectValue[]): any;
|
|
12
12
|
value?: SelectValue[];
|
|
13
13
|
};
|
|
14
|
-
export
|
|
14
|
+
export type UseSelectSingleValueControl = UseSelectBaseValueControl & {
|
|
15
15
|
defaultValue?: SelectValue;
|
|
16
16
|
mode: 'single';
|
|
17
17
|
onChange?(newOption: SelectValue): any;
|
|
18
18
|
value?: SelectValue | null;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type UseSelectValueControl = UseSelectMultipleValueControl | UseSelectSingleValueControl;
|
|
21
21
|
export interface SelectBaseValueControl {
|
|
22
22
|
onClear(e: MouseEvent<Element>): void;
|
|
23
23
|
}
|
|
24
|
-
export
|
|
24
|
+
export type SelectMultipleValueControl = SelectBaseValueControl & {
|
|
25
25
|
onChange: (v: SelectValue | null) => SelectValue[];
|
|
26
26
|
value: SelectValue[];
|
|
27
27
|
};
|
|
28
|
-
export
|
|
28
|
+
export type SelectSingleValueControl = SelectBaseValueControl & {
|
|
29
29
|
onChange: (v: SelectValue | null) => SelectValue | null;
|
|
30
30
|
value: SelectValue | null;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type SelectValueControl = SelectMultipleValueControl | SelectSingleValueControl;
|
|
33
33
|
export declare const useSelectValueControl: (props: UseSelectValueControl) => SelectMultipleValueControl | SelectSingleValueControl;
|
package/Menu/MenuDivider.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
-
export
|
|
3
|
+
export type MenuDividerProps = NativeElementPropsWithoutKeyAndRef<'hr'>;
|
|
4
4
|
/**
|
|
5
5
|
* The react component for `mezzanine` menu divider.
|
|
6
6
|
*/
|
package/Message/Message.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface MessageData extends Omit<NotifierData, 'onClose'>, MessageConfi
|
|
|
25
25
|
*/
|
|
26
26
|
severity?: MessageSeverity;
|
|
27
27
|
}
|
|
28
|
-
export
|
|
28
|
+
export type MessageType = FC<MessageData> & Notifier<MessageData, MessageConfigProps> & (Record<string, (message: MessageData['children'], props?: Omit<MessageData, 'children' | 'severity' | 'icon'>) => Key>);
|
|
29
29
|
/**
|
|
30
30
|
* The react component for `mezzanine` message.
|
|
31
31
|
*
|
package/Modal/ModalBody.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
-
export
|
|
3
|
+
export type ModalBodyProps = NativeElementPropsWithoutKeyAndRef<'div'>;
|
|
4
4
|
/**
|
|
5
5
|
* The react component for `mezzanine` modal body.
|
|
6
6
|
*/
|
package/Modal/ModalFooter.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
-
export
|
|
3
|
+
export type ModalFooterProps = NativeElementPropsWithoutKeyAndRef<'div'>;
|
|
4
4
|
/**
|
|
5
5
|
* The react component for `mezzanine` modal footer.
|
|
6
6
|
*/
|
|
@@ -3,8 +3,8 @@ import { NavigationOrientation } from '@mezzanine-ui/core/navigation';
|
|
|
3
3
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
4
4
|
import { NavigationItemProps } from './NavigationItem';
|
|
5
5
|
import { NavigationSubMenuProps } from './NavigationSubMenu';
|
|
6
|
-
export
|
|
7
|
-
export
|
|
6
|
+
export type NavigationChild = ReactElement<NavigationItemProps | NavigationSubMenuProps> | null;
|
|
7
|
+
export type NavigationChildren = NavigationChild | NavigationChild[];
|
|
8
8
|
export interface NavigationProps extends Omit<NativeElementPropsWithoutKeyAndRef<'ul'>, 'onClick'> {
|
|
9
9
|
/**
|
|
10
10
|
* Current active key.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { NavigationItemProps } from './NavigationItem';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
3
|
+
export type NavigationSubMenuChild = ReactElement<NavigationItemProps>;
|
|
4
|
+
export type NavigationSubMenuChildren = NavigationSubMenuChild | NavigationSubMenuChild[];
|
|
5
5
|
export interface NavigationSubMenuProps extends Omit<NavigationItemProps, 'onClick' | 'eventKey' | 'key'> {
|
|
6
6
|
/**
|
|
7
7
|
* Strict children with `NavigationItem`.
|
|
@@ -12,6 +12,11 @@ export interface NavigationSubMenuProps extends Omit<NavigationItemProps, 'onCli
|
|
|
12
12
|
* Set display title for sub-menu item.
|
|
13
13
|
*/
|
|
14
14
|
title?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Open menu as default
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
defaultOpen?: boolean;
|
|
15
20
|
}
|
|
16
21
|
declare const NavigationSubMenu: import("react").ForwardRefExoticComponent<NavigationSubMenuProps & import("react").RefAttributes<HTMLLIElement>>;
|
|
17
22
|
export default NavigationSubMenu;
|
|
@@ -37,8 +37,8 @@ const popperOptions = {
|
|
|
37
37
|
],
|
|
38
38
|
};
|
|
39
39
|
const NavigationSubMenu = forwardRef((props, ref) => {
|
|
40
|
-
const { className, children = [],
|
|
41
|
-
const [open, setOpen] = useState(
|
|
40
|
+
const { active, className, children = [], defaultOpen = false, icon, title, ...rest } = props;
|
|
41
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
42
42
|
const nodeRef = useRef(null);
|
|
43
43
|
const composedNodeRef = useComposeRefs([ref, nodeRef]);
|
|
44
44
|
const { orientation, } = useContext(NavigationContext);
|
package/Notifier/typings.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface NotifierData extends Pick<NotifierConfig, 'duration'> {
|
|
|
16
16
|
*/
|
|
17
17
|
onClose?: (key: Key) => void;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
19
|
+
export type RenderNotifier<N extends NotifierData> = (notifier: N) => ReactNode;
|
|
20
20
|
export interface Notifier<N extends NotifierData, C extends NotifierConfig = NotifierConfig> {
|
|
21
21
|
add: (notifier: N & {
|
|
22
22
|
key?: Key;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DetailedHTMLProps, HTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { PaginationItemProps } from './PaginationItem';
|
|
3
|
+
import { PaginationPageSizeProps } from './PaginationPageSize';
|
|
3
4
|
export interface PaginationProps extends Omit<DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>, 'onChange'> {
|
|
4
5
|
/**
|
|
5
6
|
* Number of always visible pages at the beginning and end.
|
|
@@ -51,15 +52,41 @@ export interface PaginationProps extends Omit<DetailedHTMLProps<HTMLAttributes<H
|
|
|
51
52
|
* @param {number} page The page active.
|
|
52
53
|
*/
|
|
53
54
|
onChange?: (page: number) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Callback fired when the page size is changed
|
|
57
|
+
*
|
|
58
|
+
* @param {number} pageSize
|
|
59
|
+
*/
|
|
60
|
+
onChangePageSize?: PaginationPageSizeProps['onChange'];
|
|
54
61
|
/**
|
|
55
62
|
* Number of data per page
|
|
56
|
-
* @default
|
|
63
|
+
* @default 10
|
|
64
|
+
*/
|
|
65
|
+
pageSize?: PaginationPageSizeProps['value'];
|
|
66
|
+
/**
|
|
67
|
+
* Label display before page size selector
|
|
68
|
+
*/
|
|
69
|
+
pageSizeLabel?: PaginationPageSizeProps['label'];
|
|
70
|
+
/**
|
|
71
|
+
* Page size options to render
|
|
57
72
|
*/
|
|
58
|
-
|
|
73
|
+
pageSizeOptions?: PaginationPageSizeProps['options'];
|
|
74
|
+
/**
|
|
75
|
+
* Page size unit after `select`
|
|
76
|
+
*/
|
|
77
|
+
pageSizeUnit?: PaginationPageSizeProps['unit'];
|
|
78
|
+
/**
|
|
79
|
+
* Render custom page size option name
|
|
80
|
+
*/
|
|
81
|
+
renderPageSizeOptionName?: PaginationPageSizeProps['renderOptionName'];
|
|
59
82
|
/**
|
|
60
83
|
* Show jumper or not.
|
|
61
84
|
*/
|
|
62
85
|
showJumper?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Ship page size or not
|
|
88
|
+
*/
|
|
89
|
+
showPageSizeOptions?: boolean;
|
|
63
90
|
/**
|
|
64
91
|
* Number of always visible pages before and after the current page.
|
|
65
92
|
* @default 1
|
|
@@ -74,5 +101,5 @@ export interface PaginationProps extends Omit<DetailedHTMLProps<HTMLAttributes<H
|
|
|
74
101
|
/**
|
|
75
102
|
* The react component for `mezzanine` pagination.
|
|
76
103
|
*/
|
|
77
|
-
declare const Pagination: import("react").ForwardRefExoticComponent<Pick<PaginationProps, "onChange" | "key" | "defaultChecked" | "defaultValue" | "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" | "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" | "boundaryCount" | "buttonText" | "current" | "disabled" | "hideNextButton" | "hidePreviousButton" | "hintText" | "inputPlaceholder" | "itemRender" | "pageSize" | "showJumper" | "siblingCount" | "total"> & import("react").RefAttributes<HTMLElement>>;
|
|
104
|
+
declare const Pagination: import("react").ForwardRefExoticComponent<Pick<PaginationProps, "onChange" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "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" | "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" | "onResize" | "onResizeCapture" | "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" | "boundaryCount" | "buttonText" | "current" | "disabled" | "hideNextButton" | "hidePreviousButton" | "hintText" | "inputPlaceholder" | "itemRender" | "onChangePageSize" | "pageSize" | "pageSizeLabel" | "pageSizeOptions" | "pageSizeUnit" | "renderPageSizeOptionName" | "showJumper" | "showPageSizeOptions" | "siblingCount" | "total"> & import("react").RefAttributes<HTMLElement>>;
|
|
78
105
|
export default Pagination;
|
package/Pagination/Pagination.js
CHANGED
|
@@ -3,6 +3,7 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import { paginationClasses } from '@mezzanine-ui/core/pagination';
|
|
4
4
|
import PaginationItem from './PaginationItem.js';
|
|
5
5
|
import PaginationJumper from './PaginationJumper.js';
|
|
6
|
+
import PaginationPageSize from './PaginationPageSize.js';
|
|
6
7
|
import { usePagination } from './usePagination.js';
|
|
7
8
|
import cx from 'clsx';
|
|
8
9
|
|
|
@@ -10,7 +11,7 @@ import cx from 'clsx';
|
|
|
10
11
|
* The react component for `mezzanine` pagination.
|
|
11
12
|
*/
|
|
12
13
|
const Pagination = forwardRef((props, ref) => {
|
|
13
|
-
const { className, boundaryCount = 1, buttonText, current = 1, disabled = false, hideNextButton = false, hidePreviousButton = false, hintText, inputPlaceholder, itemRender = (item) => jsx(PaginationItem, { ...item }), onChange, pageSize =
|
|
14
|
+
const { className, boundaryCount = 1, buttonText, current = 1, disabled = false, hideNextButton = false, hidePreviousButton = false, hintText, inputPlaceholder, itemRender = (item) => jsx(PaginationItem, { ...item }), onChange, onChangePageSize, pageSize = 10, pageSizeLabel, pageSizeOptions, pageSizeUnit, renderPageSizeOptionName, showJumper = false, showPageSizeOptions = false, siblingCount = 1, total = 0, ...rest } = props;
|
|
14
15
|
const { items } = usePagination({
|
|
15
16
|
boundaryCount,
|
|
16
17
|
current,
|
|
@@ -22,7 +23,7 @@ const Pagination = forwardRef((props, ref) => {
|
|
|
22
23
|
siblingCount,
|
|
23
24
|
total,
|
|
24
25
|
});
|
|
25
|
-
return (jsx("nav", { ...rest, ref: ref, "aria-label": "pagination navigation", className: cx(paginationClasses.host, className), children: jsxs("ul", { className: paginationClasses.container, children: [items.map((item, index) => (jsx("li", { className: paginationClasses.item, children: itemRender(item) }, index))), showJumper && (jsx("li", { className: paginationClasses.jumper, children: jsx(PaginationJumper, { buttonText: buttonText, disabled: disabled, hintText: hintText, inputPlaceholder: inputPlaceholder, onChange: onChange, pageSize: pageSize, total: total }) }))] }) }));
|
|
26
|
+
return (jsx("nav", { ...rest, ref: ref, "aria-label": "pagination navigation", className: cx(paginationClasses.host, className), children: jsxs("ul", { className: paginationClasses.container, children: [showPageSizeOptions && (jsx("li", { className: paginationClasses.pageSize, children: jsx(PaginationPageSize, { disabled: disabled, label: pageSizeLabel, onChange: onChangePageSize, options: pageSizeOptions, renderOptionName: renderPageSizeOptionName, unit: pageSizeUnit, value: pageSize }) })), items.map((item, index) => (jsx("li", { className: paginationClasses.item, children: itemRender(item) }, index))), showJumper && (jsx("li", { className: paginationClasses.jumper, children: jsx(PaginationJumper, { buttonText: buttonText, disabled: disabled, hintText: hintText, inputPlaceholder: inputPlaceholder, onChange: onChange, pageSize: pageSize, total: total }) }))] }) }));
|
|
26
27
|
});
|
|
27
28
|
var Pagination$1 = Pagination;
|
|
28
29
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
2
2
|
import { PaginationItemType } from '@mezzanine-ui/core/pagination';
|
|
3
|
-
export
|
|
3
|
+
export type PaginationItemElement = HTMLButtonElement | HTMLDivElement;
|
|
4
4
|
export interface PaginationItemProps extends Omit<DetailedHTMLProps<HTMLAttributes<PaginationItemElement>, PaginationItemElement>, 'ref'> {
|
|
5
5
|
/**
|
|
6
6
|
* If `true`, the pagination item is active.
|
|
@@ -34,5 +34,5 @@ export interface PaginationJumperProps extends Omit<DetailedHTMLProps<HTMLAttrib
|
|
|
34
34
|
*/
|
|
35
35
|
total?: number;
|
|
36
36
|
}
|
|
37
|
-
declare const PaginationJumper: import("react").ForwardRefExoticComponent<Pick<PaginationJumperProps, "onChange" | "key" | "defaultChecked" | "defaultValue" | "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" | "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" | "buttonText" | "disabled" | "hintText" | "inputPlaceholder" | "pageSize" | "total"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
37
|
+
declare const PaginationJumper: import("react").ForwardRefExoticComponent<Pick<PaginationJumperProps, "onChange" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "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" | "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" | "onResize" | "onResizeCapture" | "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" | "buttonText" | "disabled" | "hintText" | "inputPlaceholder" | "pageSize" | "total"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
38
38
|
export default PaginationJumper;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
2
|
+
export interface PaginationPageSizeProps extends Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onChange'> {
|
|
3
|
+
/**
|
|
4
|
+
* If `true`, the pagination page size fields is disabled.
|
|
5
|
+
* @default false
|
|
6
|
+
*/
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Label display before `select`
|
|
10
|
+
*/
|
|
11
|
+
label?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Callback fired when the page size is changed.
|
|
14
|
+
*
|
|
15
|
+
* @param {number} pageSize The page active.
|
|
16
|
+
*/
|
|
17
|
+
onChange?: (pageSize: number) => void;
|
|
18
|
+
/**
|
|
19
|
+
* options for `select` to use
|
|
20
|
+
* @default [10, 20, 50, 100]
|
|
21
|
+
*/
|
|
22
|
+
options?: number[];
|
|
23
|
+
/**
|
|
24
|
+
* Callback to custom render option name
|
|
25
|
+
* @default (p) => `${p}`
|
|
26
|
+
*/
|
|
27
|
+
renderOptionName?: (pageSize: number) => string;
|
|
28
|
+
/**
|
|
29
|
+
* unit display after `select`
|
|
30
|
+
*/
|
|
31
|
+
unit?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Current page size value
|
|
34
|
+
*/
|
|
35
|
+
value?: number;
|
|
36
|
+
}
|
|
37
|
+
declare const PaginationPageSize: import("react").ForwardRefExoticComponent<Pick<PaginationPageSizeProps, "onChange" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "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" | "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" | "onResize" | "onResizeCapture" | "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" | "disabled" | "label" | "options" | "renderOptionName" | "unit" | "value"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
38
|
+
export default PaginationPageSize;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useMemo } from 'react';
|
|
3
|
+
import { paginationPageSizeClasses } from '@mezzanine-ui/core/pagination';
|
|
4
|
+
import Typography from '../Typography/Typography.js';
|
|
5
|
+
import Select from '../Select/Select.js';
|
|
6
|
+
import Option from '../Select/Option.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
const PaginationPageSize = forwardRef((props, ref) => {
|
|
10
|
+
const { className, disabled = false, label, onChange, options = [10, 20, 50, 100], renderOptionName = (p) => `${p}`, unit, value, ...rest } = props;
|
|
11
|
+
const currentValue = useMemo(() => (value ? ({
|
|
12
|
+
id: `${value}`,
|
|
13
|
+
name: renderOptionName(value),
|
|
14
|
+
}) : undefined), [value, renderOptionName]);
|
|
15
|
+
return (jsxs("div", { ...rest, ref: ref, className: cx(paginationPageSizeClasses.host, className), children: [label ? (jsx(Typography, { color: "text-secondary", component: "div", ellipsis: true, variant: "button3", children: label })) : null, jsx(Select, { disabled: disabled, value: currentValue, onChange: (nextSelection) => onChange === null || onChange === void 0 ? void 0 : onChange(Number(nextSelection.id)), className: paginationPageSizeClasses.select, children: options.map((opt) => (jsx(Option, { value: `${opt}`, children: renderOptionName(opt) }, opt))) }), unit ? (jsx(Typography, { color: "text-secondary", component: "div", ellipsis: true, variant: "button3", children: unit })) : null] }));
|
|
16
|
+
});
|
|
17
|
+
var PaginationPageSize$1 = PaginationPageSize;
|
|
18
|
+
|
|
19
|
+
export { PaginationPageSize$1 as default };
|
package/Pagination/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export type { PaginationItemType, } from '@mezzanine-ui/core/pagination';
|
|
|
2
2
|
export { PaginationProps, default } from './Pagination';
|
|
3
3
|
export { PaginationItemProps, default as PaginationItem } from './PaginationItem';
|
|
4
4
|
export { PaginationJumperProps, default as PaginationJumper } from './PaginationJumper';
|
|
5
|
+
export { PaginationPageSizeProps, default as PaginationPageSize } from './PaginationPageSize';
|
|
5
6
|
export { usePagination } from './usePagination';
|
package/Pagination/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default } from './Pagination.js';
|
|
2
2
|
export { default as PaginationItem } from './PaginationItem.js';
|
|
3
3
|
export { default as PaginationJumper } from './PaginationJumper.js';
|
|
4
|
+
export { default as PaginationPageSize } from './PaginationPageSize.js';
|
|
4
5
|
export { usePagination } from './usePagination.js';
|
|
@@ -5,7 +5,7 @@ const range = (start, end) => {
|
|
|
5
5
|
return Array.from({ length }, (_, i) => start + i);
|
|
6
6
|
};
|
|
7
7
|
function usePagination(props = {}) {
|
|
8
|
-
const { boundaryCount = 1, current = 1, disabled = false, hideNextButton = false, hidePreviousButton = false, pageSize =
|
|
8
|
+
const { boundaryCount = 1, current = 1, disabled = false, hideNextButton = false, hidePreviousButton = false, pageSize = 10, onChange: handleChange, siblingCount = 1, total = 0, } = props;
|
|
9
9
|
const totalPages = (total ? Math.ceil(total / pageSize) : 1);
|
|
10
10
|
const itemList = useMemo(() => {
|
|
11
11
|
const startPages = range(1, Math.min(boundaryCount, totalPages));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DateType } from '@mezzanine-ui/core/calendar';
|
|
2
2
|
import { FocusEventHandler, KeyboardEventHandler, RefObject } from 'react';
|
|
3
|
-
export
|
|
3
|
+
export type UsePickerValueProps = {
|
|
4
4
|
defaultValue?: DateType;
|
|
5
5
|
format: string;
|
|
6
6
|
formats: string[];
|
package/Popper/Popper.d.ts
CHANGED
|
@@ -5,10 +5,10 @@ import { ElementGetter } from '../utils/getElement';
|
|
|
5
5
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
6
6
|
import { PortalProps } from '../Portal';
|
|
7
7
|
export type { Placement as PopperPlacement, PositioningStrategy as PopperPositionStrategy, } from '@popperjs/core';
|
|
8
|
-
export
|
|
8
|
+
export type PopperOptions<Modifiers> = Omit<Partial<_PopperOptions>, 'modifiers'> & {
|
|
9
9
|
modifiers?: ReadonlyArray<Modifier<Modifiers>>;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type PopperController = ReturnType<typeof usePopper>;
|
|
12
12
|
export interface PopperProps extends Pick<PortalProps, 'container' | 'disablePortal'>, NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
13
13
|
/**
|
|
14
14
|
* The ref of trigger Element.
|