@zuzjs/ui 0.7.8 → 0.7.9
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/dist/cjs/comps/Box/index.d.ts +1 -2
- package/dist/cjs/comps/Box/index.js +14 -12
- package/dist/cjs/comps/Button/index.d.ts +1 -1
- package/dist/cjs/comps/Button/types.d.ts +1 -1
- package/dist/cjs/comps/ColorScheme/index.d.ts +3 -2
- package/dist/cjs/comps/ColorScheme/index.js +24 -9
- package/dist/cjs/comps/ColorScheme/types.d.ts +4 -0
- package/dist/cjs/comps/ColorScheme/types.js +1 -0
- package/dist/cjs/comps/ContextMenu/index.js +1 -2
- package/dist/cjs/comps/Crumb/index.d.ts +4 -0
- package/dist/cjs/comps/Crumb/index.js +13 -0
- package/dist/cjs/comps/Crumb/types.d.ts +11 -0
- package/dist/cjs/comps/Crumb/types.js +1 -0
- package/dist/cjs/comps/Drawer/index.js +16 -15
- package/dist/cjs/comps/Form/index.d.ts +3 -59
- package/dist/cjs/comps/Form/types.d.ts +43 -0
- package/dist/cjs/comps/Form/types.js +1 -0
- package/dist/cjs/comps/Icon/index.js +0 -1
- package/dist/cjs/comps/Image/index.js +0 -1
- package/dist/cjs/comps/KeyboardKeys/index.d.ts +8 -0
- package/dist/cjs/comps/KeyboardKeys/index.js +33 -0
- package/dist/cjs/comps/KeyboardKeys/types.d.ts +13 -0
- package/dist/cjs/comps/KeyboardKeys/types.js +51 -0
- package/dist/cjs/comps/Label/index.js +0 -1
- package/dist/cjs/comps/List/index.d.ts +3 -0
- package/dist/cjs/comps/List/index.js +4 -4
- package/dist/cjs/comps/List/item.js +5 -1
- package/dist/cjs/comps/List/types.d.ts +4 -1
- package/dist/cjs/comps/Network/index.js +3 -5
- package/dist/cjs/comps/Pagination/index.js +2 -2
- package/dist/cjs/comps/ScrollView/index.d.ts +5 -0
- package/dist/cjs/comps/ScrollView/index.js +13 -0
- package/dist/cjs/comps/ScrollView/types.d.ts +6 -0
- package/dist/cjs/comps/ScrollView/types.js +1 -0
- package/dist/cjs/comps/Search/index.d.ts +7 -10
- package/dist/cjs/comps/Search/index.js +10 -6
- package/dist/cjs/comps/Search/types.d.ts +12 -0
- package/dist/cjs/comps/Search/types.js +1 -0
- package/dist/cjs/comps/Segmented/index.d.ts +3 -2
- package/dist/cjs/comps/Segmented/index.js +6 -5
- package/dist/cjs/comps/Segmented/item.js +11 -2
- package/dist/cjs/comps/Segmented/types.d.ts +5 -1
- package/dist/cjs/comps/Select/index.d.ts +1 -1
- package/dist/cjs/comps/Select/types.d.ts +1 -1
- package/dist/cjs/comps/Sheet/index.js +8 -5
- package/dist/cjs/comps/Spinner/index.js +1 -2
- package/dist/cjs/comps/TabView/index.d.ts +1 -1
- package/dist/cjs/comps/TabView/types.d.ts +2 -2
- package/dist/cjs/comps/Table/index.js +12 -5
- package/dist/cjs/comps/Table/row.js +3 -2
- package/dist/cjs/comps/Table/types.d.ts +88 -1
- package/dist/cjs/comps/Text/index.d.ts +2 -0
- package/dist/cjs/comps/Text/index.js +4 -2
- package/dist/cjs/comps/TextArea/index.d.ts +2 -0
- package/dist/cjs/comps/TextArea/index.js +3 -4
- package/dist/cjs/comps/Treeview/index.js +3 -2
- package/dist/cjs/comps/Treeview/item.d.ts +1 -1
- package/dist/cjs/comps/Treeview/item.js +5 -4
- package/dist/cjs/comps/Treeview/types.d.ts +1 -1
- package/dist/cjs/comps/VideoPlayer/index.d.ts +2 -0
- package/dist/cjs/comps/VideoPlayer/index.js +7 -0
- package/dist/cjs/comps/index.d.ts +26 -18
- package/dist/cjs/comps/index.js +8 -0
- package/dist/cjs/funs/css.d.ts +3 -3
- package/dist/cjs/funs/css.js +20 -18
- package/dist/cjs/funs/index.d.ts +1 -0
- package/dist/cjs/funs/index.js +10 -0
- package/dist/cjs/funs/stylesheet.js +5 -0
- package/dist/cjs/hooks/index.d.ts +13 -6
- package/dist/cjs/hooks/index.js +14 -7
- package/dist/cjs/hooks/useAnchorPosition.d.ts +1 -2
- package/dist/cjs/hooks/useAnchorPosition.js +1 -0
- package/dist/cjs/hooks/useBase.js +27 -13
- package/dist/cjs/hooks/useCalendar.js +1 -0
- package/dist/cjs/hooks/useColorScheme.js +2 -2
- package/dist/cjs/hooks/useContextMenu.js +1 -0
- package/dist/cjs/hooks/useDB.js +1 -0
- package/dist/cjs/hooks/useDebounce.js +2 -1
- package/dist/cjs/hooks/useDelayed.js +2 -1
- package/dist/cjs/hooks/useDevice.js +1 -0
- package/dist/cjs/hooks/useDimensions.js +2 -1
- package/dist/cjs/hooks/useDom.d.ts +2 -0
- package/dist/cjs/hooks/useDom.js +3 -0
- package/dist/cjs/hooks/useDomMutation.d.ts +3 -0
- package/dist/cjs/hooks/useDomMutation.js +19 -0
- package/dist/cjs/hooks/useDrag.js +2 -1
- package/dist/cjs/hooks/useFileManager.d.ts +2 -0
- package/dist/cjs/hooks/useFileManager.js +3 -0
- package/dist/cjs/hooks/useImage.js +1 -0
- package/dist/cjs/hooks/useIntersectionObserver.js +2 -1
- package/dist/cjs/hooks/useMediaPlayer.d.ts +32 -0
- package/dist/cjs/hooks/useMediaPlayer.js +86 -0
- package/dist/cjs/hooks/useMergedRefs.d.ts +2 -0
- package/dist/cjs/hooks/useMergedRefs.js +14 -0
- package/dist/cjs/hooks/useMutationObserver.d.ts +3 -0
- package/dist/cjs/hooks/useMutationObserver.js +20 -0
- package/dist/cjs/hooks/useNetworkStatus.js +2 -1
- package/dist/cjs/hooks/usePlayer.d.ts +32 -0
- package/dist/cjs/hooks/usePlayer.js +85 -0
- package/dist/cjs/hooks/useResizeObserver.js +2 -1
- package/dist/cjs/hooks/useScrollbar.d.ts +16 -0
- package/dist/cjs/hooks/useScrollbar.js +160 -0
- package/dist/cjs/hooks/useSheet.js +1 -0
- package/dist/cjs/hooks/useShortcuts.d.ts +7 -0
- package/dist/cjs/hooks/useShortcuts.js +29 -0
- package/dist/cjs/hooks/useSlider.d.ts +7 -0
- package/dist/cjs/hooks/useSlider.js +23 -0
- package/dist/cjs/hooks/useTruncateText.d.ts +2 -0
- package/dist/cjs/hooks/useTruncateText.js +17 -0
- package/dist/cjs/hooks/useViewTransition.d.ts +2 -0
- package/dist/cjs/hooks/useViewTransition.js +13 -0
- package/dist/cjs/types/enums.d.ts +1 -0
- package/dist/cjs/types/enums.js +1 -0
- package/dist/cjs/types/index.d.ts +2 -1
- package/dist/cjs/types/interfaces.d.ts +2 -0
- package/dist/css/styles.css +1 -1
- package/dist/esm/comps/Box/index.d.ts +1 -2
- package/dist/esm/comps/Box/index.js +14 -12
- package/dist/esm/comps/Button/index.d.ts +1 -1
- package/dist/esm/comps/Button/types.d.ts +1 -1
- package/dist/esm/comps/ColorScheme/index.d.ts +3 -2
- package/dist/esm/comps/ColorScheme/index.js +24 -9
- package/dist/esm/comps/ColorScheme/types.d.ts +4 -0
- package/dist/esm/comps/ColorScheme/types.js +1 -0
- package/dist/esm/comps/ContextMenu/index.js +1 -2
- package/dist/esm/comps/Crumb/index.d.ts +4 -0
- package/dist/esm/comps/Crumb/index.js +13 -0
- package/dist/esm/comps/Crumb/types.d.ts +11 -0
- package/dist/esm/comps/Crumb/types.js +1 -0
- package/dist/esm/comps/Drawer/index.js +16 -15
- package/dist/esm/comps/Form/index.d.ts +3 -59
- package/dist/esm/comps/Form/types.d.ts +43 -0
- package/dist/esm/comps/Form/types.js +1 -0
- package/dist/esm/comps/Icon/index.js +0 -1
- package/dist/esm/comps/Image/index.js +0 -1
- package/dist/esm/comps/KeyboardKeys/index.d.ts +8 -0
- package/dist/esm/comps/KeyboardKeys/index.js +33 -0
- package/dist/esm/comps/KeyboardKeys/types.d.ts +13 -0
- package/dist/esm/comps/KeyboardKeys/types.js +51 -0
- package/dist/esm/comps/Label/index.js +0 -1
- package/dist/esm/comps/List/index.d.ts +3 -0
- package/dist/esm/comps/List/index.js +4 -4
- package/dist/esm/comps/List/item.js +5 -1
- package/dist/esm/comps/List/types.d.ts +4 -1
- package/dist/esm/comps/Network/index.js +3 -5
- package/dist/esm/comps/Pagination/index.js +2 -2
- package/dist/esm/comps/ScrollView/index.d.ts +5 -0
- package/dist/esm/comps/ScrollView/index.js +13 -0
- package/dist/esm/comps/ScrollView/types.d.ts +6 -0
- package/dist/esm/comps/ScrollView/types.js +1 -0
- package/dist/esm/comps/Search/index.d.ts +7 -10
- package/dist/esm/comps/Search/index.js +10 -6
- package/dist/esm/comps/Search/types.d.ts +12 -0
- package/dist/esm/comps/Search/types.js +1 -0
- package/dist/esm/comps/Segmented/index.d.ts +3 -2
- package/dist/esm/comps/Segmented/index.js +6 -5
- package/dist/esm/comps/Segmented/item.js +11 -2
- package/dist/esm/comps/Segmented/types.d.ts +5 -1
- package/dist/esm/comps/Select/index.d.ts +1 -1
- package/dist/esm/comps/Select/types.d.ts +1 -1
- package/dist/esm/comps/Sheet/index.js +8 -5
- package/dist/esm/comps/Spinner/index.js +1 -2
- package/dist/esm/comps/TabView/index.d.ts +1 -1
- package/dist/esm/comps/TabView/types.d.ts +2 -2
- package/dist/esm/comps/Table/index.js +12 -5
- package/dist/esm/comps/Table/row.js +3 -2
- package/dist/esm/comps/Table/types.d.ts +88 -1
- package/dist/esm/comps/Text/index.d.ts +2 -0
- package/dist/esm/comps/Text/index.js +4 -2
- package/dist/esm/comps/TextArea/index.d.ts +2 -0
- package/dist/esm/comps/TextArea/index.js +3 -4
- package/dist/esm/comps/Treeview/index.js +3 -2
- package/dist/esm/comps/Treeview/item.d.ts +1 -1
- package/dist/esm/comps/Treeview/item.js +5 -4
- package/dist/esm/comps/Treeview/types.d.ts +1 -1
- package/dist/esm/comps/VideoPlayer/index.d.ts +2 -0
- package/dist/esm/comps/VideoPlayer/index.js +7 -0
- package/dist/esm/comps/index.d.ts +26 -18
- package/dist/esm/comps/index.js +8 -0
- package/dist/esm/funs/css.d.ts +3 -3
- package/dist/esm/funs/css.js +20 -18
- package/dist/esm/funs/index.d.ts +1 -0
- package/dist/esm/funs/index.js +10 -0
- package/dist/esm/funs/stylesheet.js +5 -0
- package/dist/esm/hooks/index.d.ts +13 -6
- package/dist/esm/hooks/index.js +14 -7
- package/dist/esm/hooks/useAnchorPosition.d.ts +1 -2
- package/dist/esm/hooks/useAnchorPosition.js +1 -0
- package/dist/esm/hooks/useBase.js +27 -13
- package/dist/esm/hooks/useCalendar.js +1 -0
- package/dist/esm/hooks/useColorScheme.js +2 -2
- package/dist/esm/hooks/useContextMenu.js +1 -0
- package/dist/esm/hooks/useDB.js +1 -0
- package/dist/esm/hooks/useDebounce.js +2 -1
- package/dist/esm/hooks/useDelayed.js +2 -1
- package/dist/esm/hooks/useDevice.js +1 -0
- package/dist/esm/hooks/useDimensions.js +2 -1
- package/dist/esm/hooks/useDom.d.ts +2 -0
- package/dist/esm/hooks/useDom.js +3 -0
- package/dist/esm/hooks/useDomMutation.d.ts +3 -0
- package/dist/esm/hooks/useDomMutation.js +19 -0
- package/dist/esm/hooks/useDrag.js +2 -1
- package/dist/esm/hooks/useFileManager.d.ts +2 -0
- package/dist/esm/hooks/useFileManager.js +3 -0
- package/dist/esm/hooks/useImage.js +1 -0
- package/dist/esm/hooks/useIntersectionObserver.js +2 -1
- package/dist/esm/hooks/useMediaPlayer.d.ts +32 -0
- package/dist/esm/hooks/useMediaPlayer.js +86 -0
- package/dist/esm/hooks/useMergedRefs.d.ts +2 -0
- package/dist/esm/hooks/useMergedRefs.js +14 -0
- package/dist/esm/hooks/useMutationObserver.d.ts +3 -0
- package/dist/esm/hooks/useMutationObserver.js +20 -0
- package/dist/esm/hooks/useNetworkStatus.js +2 -1
- package/dist/esm/hooks/usePlayer.d.ts +32 -0
- package/dist/esm/hooks/usePlayer.js +85 -0
- package/dist/esm/hooks/useResizeObserver.js +2 -1
- package/dist/esm/hooks/useScrollbar.d.ts +16 -0
- package/dist/esm/hooks/useScrollbar.js +160 -0
- package/dist/esm/hooks/useSheet.js +1 -0
- package/dist/esm/hooks/useShortcuts.d.ts +7 -0
- package/dist/esm/hooks/useShortcuts.js +29 -0
- package/dist/esm/hooks/useSlider.d.ts +7 -0
- package/dist/esm/hooks/useSlider.js +23 -0
- package/dist/esm/hooks/useTruncateText.d.ts +2 -0
- package/dist/esm/hooks/useTruncateText.js +17 -0
- package/dist/esm/hooks/useViewTransition.d.ts +2 -0
- package/dist/esm/hooks/useViewTransition.js +13 -0
- package/dist/esm/types/enums.d.ts +1 -0
- package/dist/esm/types/enums.js +1 -0
- package/dist/esm/types/index.d.ts +2 -1
- package/dist/esm/types/interfaces.d.ts +2 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { Props } from "../../types";
|
|
3
2
|
export interface BoxProps extends Partial<Props<`div`>> {
|
|
4
3
|
name?: string;
|
|
5
4
|
}
|
|
6
|
-
declare const Box:
|
|
5
|
+
declare const Box: import("react").ForwardRefExoticComponent<BoxProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
6
|
export default Box;
|
|
@@ -4,18 +4,20 @@ import { useBase } from "../../hooks";
|
|
|
4
4
|
const Box = forwardRef((props, ref) => {
|
|
5
5
|
const { style, withEditor, ...pops } = props;
|
|
6
6
|
const { style: _style, className, rest } = useBase(pops);
|
|
7
|
-
const handleInternalClick = (e) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
return _jsx("div", { ref: ref,
|
|
7
|
+
// const handleInternalClick = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
8
|
+
// // if ( withEditor && isBrowser ) {
|
|
9
|
+
// // // window.dispatchEvent(new CustomEvent(`ZUZ_COMP_SELECTED`, {
|
|
10
|
+
// // // detail: {
|
|
11
|
+
// // // compName: 'Box',
|
|
12
|
+
// // // target: e.target,
|
|
13
|
+
// // // props
|
|
14
|
+
// // // }
|
|
15
|
+
// // // }))
|
|
16
|
+
// // }
|
|
17
|
+
// }
|
|
18
|
+
return _jsx("div", { ref: ref,
|
|
19
|
+
// onClick={handleInternalClick}
|
|
20
|
+
className: `${className} ${withEditor ? `--with-zuz-editor` : ``}`.trim(), style: {
|
|
19
21
|
..._style,
|
|
20
22
|
...(style || {})
|
|
21
23
|
}, ...rest });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Size, SPINNER } from '../../types/enums';
|
|
2
2
|
import { ButtonState } from './types';
|
|
3
3
|
declare const Button: import("react").ForwardRefExoticComponent<import("../..").ZuzProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, keyof import("../..").ZuzProps> & {
|
|
4
|
-
icon?: string;
|
|
4
|
+
icon?: string | null;
|
|
5
5
|
iconSize?: Size;
|
|
6
6
|
withLabel?: boolean;
|
|
7
7
|
spinner?: SPINNER;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ColorScheme } from "../../hooks/useColorScheme";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
declare const ColorScheme: import("react").ForwardRefExoticComponent<Omit<import("..").SegmentProps, "items"> & {
|
|
3
|
+
type?: "switch" | "toggle" | "system";
|
|
4
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
5
|
export default ColorScheme;
|
|
@@ -1,24 +1,39 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useMemo } from "react";
|
|
4
|
-
import { useDelayed } from "../..";
|
|
3
|
+
import { forwardRef, useCallback, useMemo } from "react";
|
|
4
|
+
import { Button, useBase, useDelayed, Variant } from "../..";
|
|
5
5
|
import { useColorScheme } from "../../hooks/useColorScheme";
|
|
6
6
|
import Segmented from "../Segmented";
|
|
7
7
|
import SVGIcons from "../svgicons";
|
|
8
8
|
const ColorScheme = forwardRef((props, ref) => {
|
|
9
|
+
const { type, ...pops } = props;
|
|
9
10
|
const mounted = useDelayed();
|
|
10
11
|
const { colorScheme, setColorScheme } = useColorScheme();
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const loopSchemes = useCallback(() => {
|
|
13
|
+
setColorScheme(colorScheme == `dark` ? `light`
|
|
14
|
+
: colorScheme == `light` ? `system`
|
|
15
|
+
: `dark`);
|
|
16
|
+
}, [colorScheme]);
|
|
17
|
+
const { className, style } = useBase(pops);
|
|
18
|
+
const items = useMemo(() => type == `system` ?
|
|
19
|
+
[
|
|
20
|
+
{ tag: `light`, index: 0, label: "", icon: SVGIcons.colorSchemeLight },
|
|
21
|
+
{ tag: `system`, index: 1, label: "", icon: SVGIcons.colorSchemeSystem },
|
|
22
|
+
{ tag: `dark`, index: 2, label: "", icon: SVGIcons.colorSchemeDark },
|
|
23
|
+
]
|
|
24
|
+
:
|
|
25
|
+
[
|
|
26
|
+
{ tag: `light`, index: 0, label: "", icon: SVGIcons.colorSchemeLight },
|
|
27
|
+
{ tag: `dark`, index: 2, label: "", icon: SVGIcons.colorSchemeDark },
|
|
28
|
+
], []);
|
|
16
29
|
const selected = useMemo(() => [`light`, `system`, `dark`].indexOf(colorScheme), [colorScheme]);
|
|
17
30
|
if (!mounted || selected == -1)
|
|
18
31
|
return null;
|
|
19
|
-
return _jsx(Segmented, { className: `--color-scheme`, onSwitch: ({ tag }) => {
|
|
32
|
+
return type == `system` || type == `switch` ? _jsx(Segmented, { className: `--color-scheme --${type}`, onSwitch: ({ tag }) => {
|
|
20
33
|
setColorScheme(tag);
|
|
21
|
-
}, selected: selected, items: items, ...
|
|
34
|
+
}, selected: selected, items: items, ...pops }) : _jsx(Button, { onClick: loopSchemes, style: style, as: `--color-scheme-switch --${pops.variant || Variant.Small} ${className}`.trim(), children: colorScheme == `system` ? SVGIcons.colorSchemeSystem
|
|
35
|
+
: colorScheme == `light` ? SVGIcons.colorSchemeLight
|
|
36
|
+
: SVGIcons.colorSchemeDark });
|
|
22
37
|
});
|
|
23
38
|
ColorScheme.displayName = `ColorScheme`;
|
|
24
39
|
export default ColorScheme;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,7 +5,6 @@ import { useAnchorPosition, useBase } from "../../hooks";
|
|
|
5
5
|
import { TRANSITION_CURVES } from "../../types/enums";
|
|
6
6
|
import Box from "../Box";
|
|
7
7
|
import MenuItem from "./item";
|
|
8
|
-
// import { dynamicObject } from "../../types";
|
|
9
8
|
const ContextMenu = forwardRef((props, ref) => {
|
|
10
9
|
const { as, offsetX, offsetY, parent, items: _items, ...pops } = props;
|
|
11
10
|
const { className, style, rest } = useBase(pops);
|
|
@@ -30,7 +29,7 @@ const ContextMenu = forwardRef((props, ref) => {
|
|
|
30
29
|
...style,
|
|
31
30
|
top: position.top,
|
|
32
31
|
left: position.left
|
|
33
|
-
},
|
|
32
|
+
}, fx: {
|
|
34
33
|
from: { opacity: 0, y: 20 },
|
|
35
34
|
to: { opacity: 1, y: 0 },
|
|
36
35
|
curve: TRANSITION_CURVES.EaseInOut,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import Box from "../Box";
|
|
4
|
+
import Button from "../Button";
|
|
5
|
+
import Icon from "../Icon";
|
|
6
|
+
import List from "../List";
|
|
7
|
+
import SVGIcons from "../svgicons";
|
|
8
|
+
import Text from "../Text";
|
|
9
|
+
const Crumb = forwardRef((props, ref) => {
|
|
10
|
+
const { items } = props;
|
|
11
|
+
return _jsx(List, { ref: ref, className: `--crumb flex aic`, direction: `rows`, seperator: _jsx(Box, { as: `--crumb-chevron`, children: SVGIcons.chevronRightOutline }), items: items.map((item, index, _items) => _jsxs(Button, { onClick: () => item.action?.(), className: `--crumb-item`, disabled: !_items[index + 1], children: [item.icon && _jsx(Icon, { as: `--crumb-icon`, name: item.icon }), _jsx(Text, { as: `--crumb-label`, children: item.label })] })) });
|
|
12
|
+
});
|
|
13
|
+
export default Crumb;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { useBase, useShortcuts } from "../../hooks";
|
|
5
5
|
import { DRAWER_SIDE, KeyCode, TRANSITION_CURVES } from "../../types/enums";
|
|
6
6
|
import Box from "../Box";
|
|
7
7
|
import Overlay from "../Overlay";
|
|
8
8
|
const Drawer = forwardRef((props, ref) => {
|
|
9
|
-
const {
|
|
9
|
+
const { from, speed, children, prerender, onClose, ...pops } = props;
|
|
10
10
|
const [render, setRender] = useState(undefined == prerender ? true : prerender);
|
|
11
11
|
const [visible, setVisible] = useState(false);
|
|
12
12
|
const divRef = useRef(null);
|
|
13
13
|
const [content, setContent] = useState(children);
|
|
14
|
+
const { className, style, rest } = useBase(pops);
|
|
15
|
+
useShortcuts([
|
|
16
|
+
{ keys: [KeyCode.Escape], callback: () => {
|
|
17
|
+
if (visible) {
|
|
18
|
+
onClose?.();
|
|
19
|
+
setVisible(false);
|
|
20
|
+
}
|
|
21
|
+
} }
|
|
22
|
+
]);
|
|
14
23
|
useEffect(() => {
|
|
15
24
|
setContent(children);
|
|
16
25
|
}, [children]);
|
|
17
|
-
|
|
18
|
-
bindKey(KeyCode.Escape, () => {
|
|
19
|
-
if (visible) {
|
|
20
|
-
onClose?.();
|
|
21
|
-
setVisible(false);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}, []);
|
|
25
|
-
const style = useMemo(() => {
|
|
26
|
+
const _style = useMemo(() => {
|
|
26
27
|
switch (from) {
|
|
27
28
|
case DRAWER_SIDE.Left:
|
|
28
29
|
return { from: { x: `-100vh` }, to: { x: 0 } };
|
|
@@ -52,13 +53,13 @@ const Drawer = forwardRef((props, ref) => {
|
|
|
52
53
|
onClose?.();
|
|
53
54
|
setVisible(false);
|
|
54
55
|
}
|
|
55
|
-
}, when: visible }), _jsxs(Box, { ref: divRef, className: `--drawer flex cols --${from ? from.toLowerCase() : `left`} fixed`, fx: {
|
|
56
|
-
from: { ...
|
|
57
|
-
to: { ...
|
|
56
|
+
}, when: visible }), _jsxs(Box, { ref: divRef, style: style, className: `--drawer flex cols ${className} --${from ? from.toLowerCase() : `left`} fixed`, fx: {
|
|
57
|
+
from: { ..._style.from, opacity: 0 },
|
|
58
|
+
to: { ..._style.to, opacity: 1 },
|
|
58
59
|
when: visible,
|
|
59
60
|
curve: TRANSITION_CURVES.EaseInOut,
|
|
60
61
|
duration: speed || .5,
|
|
61
|
-
}, ...
|
|
62
|
+
}, ...rest, children: [from == DRAWER_SIDE.Top || from == DRAWER_SIDE.Bottom ? _jsx(Box, { className: `--handle` }) : null, render ? content : visible ? content : null] })] });
|
|
62
63
|
});
|
|
63
64
|
Drawer.displayName = `Drawer`;
|
|
64
65
|
export default Drawer;
|
|
@@ -1,48 +1,6 @@
|
|
|
1
1
|
import { dynamicObject } from "../../types";
|
|
2
|
-
import { SPINNER } from "../../types/enums";
|
|
3
|
-
import { BoxProps } from "../Box";
|
|
4
2
|
import { SheetHandler } from "../Sheet";
|
|
5
|
-
|
|
6
|
-
/** Name of form, will be appended to --form-{name} in className
|
|
7
|
-
* whitespace will be replaced with dash (-)
|
|
8
|
-
*/
|
|
9
|
-
name?: string;
|
|
10
|
-
/** The URL to which the form data is submitted */
|
|
11
|
-
action?: string;
|
|
12
|
-
/** List of error messages for form validation */
|
|
13
|
-
errors?: dynamicObject;
|
|
14
|
-
/** Spinner properties for loading indicator */
|
|
15
|
-
spinner?: SPINNER;
|
|
16
|
-
/** Additional data to include with form submission */
|
|
17
|
-
withData?: dynamicObject;
|
|
18
|
-
/** Handler function called before form submission with validated form data */
|
|
19
|
-
beforeSubmit?: (data: FormData | dynamicObject) => void;
|
|
20
|
-
/** Handler function called on form submission with validated form data */
|
|
21
|
-
onSubmit?: (data: FormData | dynamicObject) => void;
|
|
22
|
-
/** Callback triggered upon successful form submission */
|
|
23
|
-
onSuccess?: (data: dynamicObject) => void;
|
|
24
|
-
/** Callback triggered when form submission encounters an error */
|
|
25
|
-
onError?: (error: any) => void;
|
|
26
|
-
/** Cover properties to display loading or processing message */
|
|
27
|
-
cover?: {
|
|
28
|
-
/** Background color of the loading cover */
|
|
29
|
-
color?: string;
|
|
30
|
-
/** Message displayed during loading */
|
|
31
|
-
message?: string;
|
|
32
|
-
} | SheetHandler;
|
|
33
|
-
resetOnSuccess?: boolean;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Exposes control methods for the Form component, such as setting loading states or hiding errors.
|
|
37
|
-
*/
|
|
38
|
-
export interface FormHandler {
|
|
39
|
-
/** Sets the loading state of the form */
|
|
40
|
-
setLoading: (mode: boolean) => void;
|
|
41
|
-
/** Hides any currently displayed error message */
|
|
42
|
-
hideError: () => void;
|
|
43
|
-
/** Resets the form to its initial state */
|
|
44
|
-
init: () => void;
|
|
45
|
-
}
|
|
3
|
+
import { FormHandler } from "./types";
|
|
46
4
|
/**
|
|
47
5
|
* {@link Form} is a controlled component designed to handle form data submission, validation, and display of loading or error states.
|
|
48
6
|
* It allows for optional server-side submission through an action endpoint and customizable success/error handling callbacks.
|
|
@@ -52,32 +10,18 @@ export interface FormHandler {
|
|
|
52
10
|
* @param props - Properties to configure form behavior, validation messages, submission handling, and visual feedback.
|
|
53
11
|
* @param ref - Reference to the {@link FormHandler} interface, exposing methods to control loading and error states from the parent.
|
|
54
12
|
*/
|
|
55
|
-
declare const Form: import("react").ForwardRefExoticComponent<BoxProps & {
|
|
56
|
-
/** Name of form, will be appended to --form-{name} in className
|
|
57
|
-
* whitespace will be replaced with dash (-)
|
|
58
|
-
*/
|
|
13
|
+
declare const Form: import("react").ForwardRefExoticComponent<import("..").BoxProps & {
|
|
59
14
|
name?: string;
|
|
60
|
-
/** The URL to which the form data is submitted */
|
|
61
15
|
action?: string;
|
|
62
|
-
/** List of error messages for form validation */
|
|
63
16
|
errors?: dynamicObject;
|
|
64
|
-
|
|
65
|
-
spinner?: SPINNER;
|
|
66
|
-
/** Additional data to include with form submission */
|
|
17
|
+
spinner?: import("../..").SPINNER;
|
|
67
18
|
withData?: dynamicObject;
|
|
68
|
-
/** Handler function called before form submission with validated form data */
|
|
69
19
|
beforeSubmit?: (data: FormData | dynamicObject) => void;
|
|
70
|
-
/** Handler function called on form submission with validated form data */
|
|
71
20
|
onSubmit?: (data: FormData | dynamicObject) => void;
|
|
72
|
-
/** Callback triggered upon successful form submission */
|
|
73
21
|
onSuccess?: (data: dynamicObject) => void;
|
|
74
|
-
/** Callback triggered when form submission encounters an error */
|
|
75
22
|
onError?: (error: any) => void;
|
|
76
|
-
/** Cover properties to display loading or processing message */
|
|
77
23
|
cover?: {
|
|
78
|
-
/** Background color of the loading cover */
|
|
79
24
|
color?: string;
|
|
80
|
-
/** Message displayed during loading */
|
|
81
25
|
message?: string;
|
|
82
26
|
} | SheetHandler;
|
|
83
27
|
resetOnSuccess?: boolean;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { dynamicObject, SheetHandler, SPINNER } from "../..";
|
|
2
|
+
import { BoxProps } from "../Box";
|
|
3
|
+
export type FormProps = BoxProps & {
|
|
4
|
+
/** Name of form, will be appended to --form-{name} in className
|
|
5
|
+
* whitespace will be replaced with dash (-)
|
|
6
|
+
*/
|
|
7
|
+
name?: string;
|
|
8
|
+
/** The URL to which the form data is submitted */
|
|
9
|
+
action?: string;
|
|
10
|
+
/** List of error messages for form validation */
|
|
11
|
+
errors?: dynamicObject;
|
|
12
|
+
/** Spinner properties for loading indicator */
|
|
13
|
+
spinner?: SPINNER;
|
|
14
|
+
/** Additional data to include with form submission */
|
|
15
|
+
withData?: dynamicObject;
|
|
16
|
+
/** Handler function called before form submission with validated form data */
|
|
17
|
+
beforeSubmit?: (data: FormData | dynamicObject) => void;
|
|
18
|
+
/** Handler function called on form submission with validated form data */
|
|
19
|
+
onSubmit?: (data: FormData | dynamicObject) => void;
|
|
20
|
+
/** Callback triggered upon successful form submission */
|
|
21
|
+
onSuccess?: (data: dynamicObject) => void;
|
|
22
|
+
/** Callback triggered when form submission encounters an error */
|
|
23
|
+
onError?: (error: any) => void;
|
|
24
|
+
/** Cover properties to display loading or processing message */
|
|
25
|
+
cover?: {
|
|
26
|
+
/** Background color of the loading cover */
|
|
27
|
+
color?: string;
|
|
28
|
+
/** Message displayed during loading */
|
|
29
|
+
message?: string;
|
|
30
|
+
} | SheetHandler;
|
|
31
|
+
resetOnSuccess?: boolean;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Exposes control methods for the Form component, such as setting loading states or hiding errors.
|
|
35
|
+
*/
|
|
36
|
+
export interface FormHandler {
|
|
37
|
+
/** Sets the loading state of the form */
|
|
38
|
+
setLoading: (mode: boolean) => void;
|
|
39
|
+
/** Hides any currently displayed error message */
|
|
40
|
+
hideError: () => void;
|
|
41
|
+
/** Resets the form to its initial state */
|
|
42
|
+
init: () => void;
|
|
43
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Variant } from "../../types/enums";
|
|
2
|
+
import { KeyboardKey } from "./types";
|
|
3
|
+
declare const KeyBoardKeys: import("react").ForwardRefExoticComponent<import("..").BoxProps & {
|
|
4
|
+
keys: KeyboardKey | KeyboardKey[] | import("./types").KeyCombination;
|
|
5
|
+
children?: import("react").ReactNode;
|
|
6
|
+
variant?: Variant;
|
|
7
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export default KeyBoardKeys;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo } from "react";
|
|
3
|
+
import { Variant } from "../../types/enums";
|
|
4
|
+
import Box from "../Box";
|
|
5
|
+
import Span from "../Span";
|
|
6
|
+
import { isKeyCombination, KeysLabelMap, KeysMap } from "./types";
|
|
7
|
+
const KeyBoardKeys = forwardRef(({ children, keys, variant }, ref) => {
|
|
8
|
+
const _meta = useMemo(() => {
|
|
9
|
+
if (isKeyCombination(keys)) {
|
|
10
|
+
let c = null;
|
|
11
|
+
let ks = String(keys).split(`+`)
|
|
12
|
+
.reduce((pa, ca, i, nxt) => {
|
|
13
|
+
if (nxt[i + 1]) {
|
|
14
|
+
pa.push(ca);
|
|
15
|
+
}
|
|
16
|
+
else
|
|
17
|
+
c = ca.toUpperCase();
|
|
18
|
+
return pa;
|
|
19
|
+
}, []);
|
|
20
|
+
return {
|
|
21
|
+
keys: ks,
|
|
22
|
+
children: c
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
keys,
|
|
27
|
+
children: String(children).toUpperCase()
|
|
28
|
+
};
|
|
29
|
+
}, [keys]);
|
|
30
|
+
return _jsxs(Box, { as: `--keyboard-keys --${variant || Variant.Small} flex aic`, children: [(Array.isArray(_meta.keys) ? _meta.keys : [_meta.keys]).map((k) => _jsx("abbr", { title: KeysLabelMap[k], children: KeysMap[k] }, k)), _jsx(Span, { children: _meta?.children ?? children })] });
|
|
31
|
+
});
|
|
32
|
+
KeyBoardKeys.displayName = `ZuzUI.KeyboardKeys`;
|
|
33
|
+
export default KeyBoardKeys;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { Variant } from "../../types/enums";
|
|
3
|
+
import { BoxProps } from "../Box";
|
|
4
|
+
export type KeyboardKey = "command" | "shift" | "ctrl" | "option" | "enter" | "delete" | "escape" | "tab" | "capslock" | "up" | "right" | "down" | "left" | "pageup" | "pagedown" | "home" | "end" | "help" | "space" | "fn" | "win" | "alt";
|
|
5
|
+
export type KeyCombination = `${KeyboardKey}+${KeyboardKey | string}`;
|
|
6
|
+
export declare const isKeyCombination: (value: KeyboardKey | KeyboardKey[] | KeyCombination) => value is KeyCombination;
|
|
7
|
+
export declare const KeysMap: Record<KeyboardKey, string>;
|
|
8
|
+
export declare const KeysLabelMap: Record<KeyboardKey, string>;
|
|
9
|
+
export type KeyboardKeyProps = BoxProps & {
|
|
10
|
+
keys: KeyboardKey | KeyboardKey[] | KeyCombination;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
variant?: Variant;
|
|
13
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const isKeyCombination = (value) => {
|
|
2
|
+
return typeof value === "string" && value.includes("+");
|
|
3
|
+
};
|
|
4
|
+
export const KeysMap = {
|
|
5
|
+
command: "⌘",
|
|
6
|
+
shift: "⇧",
|
|
7
|
+
ctrl: "⌃",
|
|
8
|
+
option: "⌥",
|
|
9
|
+
enter: "↵",
|
|
10
|
+
delete: "⌫",
|
|
11
|
+
escape: "⎋",
|
|
12
|
+
tab: "⇥",
|
|
13
|
+
capslock: "⇪",
|
|
14
|
+
up: "↑",
|
|
15
|
+
right: "→",
|
|
16
|
+
down: "↓",
|
|
17
|
+
left: "←",
|
|
18
|
+
pageup: "⇞",
|
|
19
|
+
pagedown: "⇟",
|
|
20
|
+
home: "↖",
|
|
21
|
+
end: "↘",
|
|
22
|
+
help: "?",
|
|
23
|
+
space: "␣",
|
|
24
|
+
fn: "Fn",
|
|
25
|
+
win: "⌘",
|
|
26
|
+
alt: "⌥",
|
|
27
|
+
};
|
|
28
|
+
export const KeysLabelMap = {
|
|
29
|
+
command: "Command",
|
|
30
|
+
shift: "Shift",
|
|
31
|
+
ctrl: "Control",
|
|
32
|
+
option: "Option",
|
|
33
|
+
enter: "Enter",
|
|
34
|
+
delete: "Delete",
|
|
35
|
+
escape: "Escape",
|
|
36
|
+
tab: "Tab",
|
|
37
|
+
capslock: "Caps Lock",
|
|
38
|
+
up: "Up",
|
|
39
|
+
right: "Right",
|
|
40
|
+
down: "Down",
|
|
41
|
+
left: "Left",
|
|
42
|
+
pageup: "Page Up",
|
|
43
|
+
pagedown: "Page Down",
|
|
44
|
+
home: "Home",
|
|
45
|
+
end: "End",
|
|
46
|
+
help: "Help",
|
|
47
|
+
space: "Space",
|
|
48
|
+
fn: "Fn",
|
|
49
|
+
win: "Win",
|
|
50
|
+
alt: "Alt",
|
|
51
|
+
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Size } from "../../types/enums";
|
|
2
2
|
declare const List: import("react").ForwardRefExoticComponent<import("../..").ZuzProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> | Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref">, keyof import("../..").ZuzProps> & {
|
|
3
3
|
size?: Size;
|
|
4
|
+
variant?: import("../..").Variant;
|
|
4
5
|
items: import("./types").ListItem[];
|
|
6
|
+
direction?: "cols" | "rows";
|
|
7
|
+
seperator?: import("react").ReactNode;
|
|
5
8
|
ol?: boolean;
|
|
6
9
|
} & import("react").RefAttributes<HTMLUListElement | HTMLOListElement>>;
|
|
7
10
|
export default List;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createElement, forwardRef } from "react";
|
|
3
3
|
import { useBase } from "../../hooks";
|
|
4
4
|
import { Size } from "../../types/enums";
|
|
5
5
|
import Item from "./item";
|
|
6
6
|
const List = forwardRef((props, ref) => {
|
|
7
|
-
const { items, size, ol, ...pops } = props;
|
|
7
|
+
const { items, size, direction, seperator, ol, ...pops } = props;
|
|
8
8
|
const { className, style, rest } = useBase(pops);
|
|
9
9
|
const Tag = ol == true ? 'ol' : 'ul';
|
|
10
10
|
return createElement(Tag, {
|
|
11
|
-
className: `--list --${size || Size.Small} flex cols ${className}`.trim(),
|
|
11
|
+
className: `--list --${size || Size.Small} flex ${direction ?? `cols`} ${className}`.trim(),
|
|
12
12
|
style, ref,
|
|
13
13
|
...rest,
|
|
14
|
-
children: items.map((item, index) => _jsx(Item, { meta: item }, `list-item-${typeof item == `string` ? String(item) : item.label}-${index}`))
|
|
14
|
+
children: items.map((item, index, _items) => _jsxs(_Fragment, { children: [_jsx(Item, { meta: item }, `list-item-${typeof item == `string` ? String(item) : item.label}-${index}`), seperator && _items[index + 1] ? _jsx("li", { className: `--list-seperator`, children: seperator }) : null] }))
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
17
|
List.displayName = `List`;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isValidElement } from "react";
|
|
2
3
|
import { useBase, useDelayed } from "../../hooks";
|
|
3
4
|
const Item = (props) => {
|
|
4
5
|
const { meta } = props;
|
|
5
6
|
const mounted = useDelayed();
|
|
6
|
-
const { label, ...pops } = meta;
|
|
7
|
+
const { label, ...pops } = isValidElement(meta) ? {} : meta;
|
|
7
8
|
const { className, style, rest } = useBase({
|
|
8
9
|
...pops,
|
|
9
10
|
...(pops.animate ? { animate: {
|
|
@@ -11,6 +12,9 @@ const Item = (props) => {
|
|
|
11
12
|
when: mounted
|
|
12
13
|
} } : {})
|
|
13
14
|
});
|
|
15
|
+
if (isValidElement(meta)) {
|
|
16
|
+
return _jsx("li", { style: style, className: className, children: meta });
|
|
17
|
+
}
|
|
14
18
|
return _jsx("li", { style: style, className: className, ...rest, children: typeof meta == `string` ? meta : label });
|
|
15
19
|
};
|
|
16
20
|
Item.displayName = `ListItem`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { Props } from "../../types";
|
|
3
|
-
import { Size } from "../../types/enums";
|
|
3
|
+
import { Size, Variant } from "../../types/enums";
|
|
4
4
|
import { animationProps } from "../../types/interfaces";
|
|
5
5
|
export type ListItemObject = {
|
|
6
6
|
icon?: ReactNode;
|
|
@@ -13,6 +13,9 @@ export type ListItemObject = {
|
|
|
13
13
|
export type ListItem = Props<`li`> & (ReactNode | ListItemObject);
|
|
14
14
|
export type ListProps = Props<`ul` | `ol`> & {
|
|
15
15
|
size?: Size;
|
|
16
|
+
variant?: Variant;
|
|
16
17
|
items: ListItem[];
|
|
18
|
+
direction?: "cols" | "rows";
|
|
19
|
+
seperator?: ReactNode;
|
|
17
20
|
ol?: boolean;
|
|
18
21
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
3
|
import { useNetworkStatus } from "../../hooks";
|
|
4
4
|
import { ALERT, Size, TRANSITION_CURVES } from "../../types/enums";
|
|
5
5
|
import Box from "../Box";
|
|
@@ -8,9 +8,7 @@ import Text from "../Text";
|
|
|
8
8
|
const NetworkManager = forwardRef((props, ref) => {
|
|
9
9
|
const isOnline = useNetworkStatus();
|
|
10
10
|
const { onlineMessage, offlineMessage, size } = props;
|
|
11
|
-
|
|
12
|
-
}, []);
|
|
13
|
-
return _jsxs(Box, { animate: {
|
|
11
|
+
return _jsxs(Box, { fx: {
|
|
14
12
|
from: { x: `-50%`, y: 200, opacity: 0 },
|
|
15
13
|
to: { x: `-50%`, y: 0, opacity: 1 },
|
|
16
14
|
when: isOnline == false,
|
|
@@ -19,5 +17,5 @@ const NetworkManager = forwardRef((props, ref) => {
|
|
|
19
17
|
delay: 2
|
|
20
18
|
}, className: `--network-manager --${isOnline == true ? `online` : `offline`} --${size || Size.Small} fixed flex`, children: [_jsx(Box, { className: `--ico`, children: isOnline ? SVGIcons[ALERT.Success] : SVGIcons[ALERT.Error] }), _jsx(Text, { as: `--message`, children: isOnline ? onlineMessage || `internet connection restored :)` : offlineMessage || `no internet connection` })] });
|
|
21
19
|
});
|
|
22
|
-
NetworkManager.displayName = `NetWorkManager`;
|
|
20
|
+
NetworkManager.displayName = `ZuzUI.NetWorkManager`;
|
|
23
21
|
export default NetworkManager;
|
|
@@ -7,7 +7,7 @@ import Box from "../Box";
|
|
|
7
7
|
import Button from "../Button";
|
|
8
8
|
import SVGIcons from "../svgicons";
|
|
9
9
|
import { PaginationStyle } from "./types";
|
|
10
|
-
const Pagination = forwardRef((props,
|
|
10
|
+
const Pagination = forwardRef((props, ref) => {
|
|
11
11
|
const { itemCount, itemsPerPage, startPage, pageRange, paginationStyle, breakLabel, prevLabel, nextLabel, hash, loading, seperator, renderOnZeroPageCount, onPageChange, ...pops } = props;
|
|
12
12
|
const _hashKey = useMemo(() => toHash(numberInRange(4, 8)), []);
|
|
13
13
|
const _hash = useCallback((input) => `${toHash(input, hash || 6, _hashKey)}${seperator || ``}${_hashKey}`, [_hashKey]);
|
|
@@ -54,7 +54,7 @@ const Pagination = forwardRef((props, _ref) => {
|
|
|
54
54
|
}, [itemCount, itemsPerPage, _currentPage]);
|
|
55
55
|
if (pages.length <= 1 && ((renderOnZeroPageCount == undefined ? false : renderOnZeroPageCount) === false))
|
|
56
56
|
return null;
|
|
57
|
-
return _jsxs(Box, { as: `--pagination --pgt-${paginationStyle || PaginationStyle.Table} flex aic w:100% jcc ${className}`, children: [_jsx(Box, { as: `flex flex:1 aic --pgt-btns`, children: (pages.length > 1 ? pages : [{ id: 1, label: 1 }, { id: -1, label: _breakLabel }]).map((page, index, items) => _jsx(Button, { disabled: page.id == -1 || getPageValue(_currentPage) == +page.label, className: (`string` == typeof page ? page : page.label) == getPageValue(_currentPage) ? `--current-page` : ``, onClick: (ev) => handlePage(page), children: `string` == typeof page ? page : page.label }, `--pg-${index}-${page.id}`)) }), _jsx(Box, { as: `flex aic jcc flex:1 --pagination-label`, children: [
|
|
57
|
+
return _jsxs(Box, { ref: ref, as: `--pagination --pgt-${paginationStyle || PaginationStyle.Table} flex aic w:100% jcc ${className}`, children: [_jsx(Box, { as: `flex flex:1 aic --pgt-btns`, children: (pages.length > 1 ? pages : [{ id: 1, label: 1 }, { id: -1, label: _breakLabel }]).map((page, index, items) => _jsx(Button, { disabled: page.id == -1 || getPageValue(_currentPage) == +page.label, className: (`string` == typeof page ? page : page.label) == getPageValue(_currentPage) ? `--current-page` : ``, onClick: (ev) => handlePage(page), children: `string` == typeof page ? page : page.label }, `--pg-${index}-${page.id}`)) }), _jsx(Box, { as: `flex aic jcc flex:1 --pagination-label`, children: [
|
|
58
58
|
`Showing ${(getPageValue(_currentPage) - 1) * itemsPerPage + 1} - `,
|
|
59
59
|
`${Math.min(getPageValue(_currentPage) * itemsPerPage, itemCount)} of ${itemCount} items`
|
|
60
60
|
].join(` `) }), _jsxs(Box, { as: `flex aic jce flex:1 --pgt-btns --pgt-nav`, children: [_jsx(Button, { disabled: getPageValue(_currentPage) <= 1, onClick: (ev) => handlePage({ id: hash ? _hash(getPageValue(_currentPage) - 1) : getPageValue(_currentPage) - 1, label: getPageValue(_currentPage) - 1 }), children: SVGIcons.chevronLeftOutline }), _jsx(Button, { disabled: pages.length <= 1 || getPageValue(_currentPage) == getPageValue(pages[pages.length - 1]), onClick: (ev) => handlePage({ id: hash ? _hash(getPageValue(_currentPage) + 1) : getPageValue(_currentPage) + 1, label: getPageValue(_currentPage) + 1 }), children: SVGIcons.chevronRightOutline })] })] });
|