@zuzjs/ui 0.8.0 → 0.8.2
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/README.md +1 -1
- package/dist/cjs/comps/Accordion/index.js +1 -1
- package/dist/cjs/comps/Actionbar/index.js +1 -1
- package/dist/cjs/comps/Alert/index.js +1 -1
- package/dist/cjs/comps/AutoComplete/index.d.ts +1 -1
- package/dist/cjs/comps/AutoComplete/index.js +3 -2
- package/dist/cjs/comps/Avatar/index.js +5 -5
- package/dist/cjs/comps/Box/index.js +1 -1
- package/dist/cjs/comps/Button/index.js +1 -1
- package/dist/cjs/comps/CheckBox/index.d.ts +1 -0
- package/dist/cjs/comps/CheckBox/index.js +1 -1
- package/dist/cjs/comps/CheckBox/types.d.ts +1 -0
- package/dist/cjs/comps/ColorScheme/index.js +1 -1
- package/dist/cjs/comps/ContextMenu/index.d.ts +2 -0
- package/dist/cjs/comps/ContextMenu/index.js +6 -6
- package/dist/cjs/comps/ContextMenu/item.js +1 -1
- package/dist/cjs/comps/ContextMenu/types.d.ts +3 -1
- package/dist/cjs/comps/CookiesConsent/index.js +1 -1
- package/dist/cjs/comps/Cover/index.js +1 -1
- package/dist/cjs/comps/Cropper/index.d.ts +8 -0
- package/dist/cjs/comps/Cropper/index.js +20 -0
- package/dist/cjs/comps/Cropper/types.d.ts +14 -0
- package/dist/cjs/comps/Cropper/types.js +5 -0
- package/dist/cjs/comps/Crumb/index.d.ts +1 -0
- package/dist/cjs/comps/Crumb/index.js +13 -3
- package/dist/cjs/comps/Crumb/types.d.ts +1 -0
- package/dist/cjs/comps/Drawer/index.js +1 -1
- package/dist/cjs/comps/Fab/index.js +1 -1
- package/dist/cjs/comps/Filters/index.js +1 -1
- package/dist/cjs/comps/Form/index.js +22 -6
- package/dist/cjs/comps/Icon/index.js +1 -1
- package/dist/cjs/comps/Image/index.js +1 -1
- package/dist/cjs/comps/Input/index.d.ts +2 -2
- package/dist/cjs/comps/Input/index.js +1 -1
- package/dist/cjs/comps/KeyboardKeys/index.js +1 -1
- package/dist/cjs/comps/Label/index.js +1 -1
- package/dist/cjs/comps/List/index.js +1 -1
- package/dist/cjs/comps/Network/index.js +1 -1
- package/dist/cjs/comps/Overlay/index.js +1 -1
- package/dist/cjs/comps/Pagination/index.js +1 -1
- package/dist/cjs/comps/Password/index.d.ts +6 -2
- package/dist/cjs/comps/Password/index.js +15 -5
- package/dist/cjs/comps/PinInput/index.d.ts +1 -1
- package/dist/cjs/comps/PinInput/index.js +8 -3
- package/dist/cjs/comps/ProgressBar/index.js +2 -2
- package/dist/cjs/comps/Radio/index.js +1 -1
- package/dist/cjs/comps/ScrollView/index.js +1 -1
- package/dist/cjs/comps/Search/index.d.ts +1 -1
- package/dist/cjs/comps/Search/index.js +1 -1
- package/dist/cjs/comps/Segmented/index.js +1 -1
- package/dist/cjs/comps/Select/index.d.ts +1 -0
- package/dist/cjs/comps/Select/index.js +3 -3
- package/dist/cjs/comps/Select/types.d.ts +6 -1
- package/dist/cjs/comps/Sheet/index.js +1 -1
- package/dist/cjs/comps/Sidebar/index.js +1 -1
- package/dist/cjs/comps/Slider/index.js +1 -1
- package/dist/cjs/comps/Span/index.js +1 -1
- package/dist/cjs/comps/Spinner/index.js +1 -1
- package/dist/cjs/comps/Switch/index.d.ts +1 -0
- package/dist/cjs/comps/Switch/index.js +1 -1
- package/dist/cjs/comps/TabView/body.js +1 -1
- package/dist/cjs/comps/TabView/index.js +1 -1
- package/dist/cjs/comps/TabView/tab.js +1 -1
- package/dist/cjs/comps/Table/col.js +1 -1
- package/dist/cjs/comps/Table/index.js +56 -2
- package/dist/cjs/comps/Table/row.js +1 -1
- package/dist/cjs/comps/Text/index.js +1 -1
- package/dist/cjs/comps/TextArea/index.js +1 -1
- package/dist/cjs/comps/TextWheel/index.js +3 -3
- package/dist/cjs/comps/Tooltip/index.js +1 -1
- package/dist/cjs/comps/Treeview/index.js +1 -1
- package/dist/cjs/comps/Treeview/item.js +1 -1
- package/dist/cjs/comps/VideoPlayer/index.js +1 -0
- package/dist/cjs/comps/index.d.ts +2 -0
- package/dist/cjs/comps/index.js +2 -0
- package/dist/cjs/funs/events.d.ts +31 -7
- package/dist/cjs/funs/events.js +57 -19
- package/dist/cjs/funs/index.d.ts +5 -3
- package/dist/cjs/funs/index.js +39 -84
- package/dist/cjs/hooks/index.d.ts +4 -0
- package/dist/cjs/hooks/index.js +4 -0
- package/dist/cjs/hooks/useDB.d.ts +5 -1
- package/dist/cjs/hooks/useDB.js +52 -4
- package/dist/cjs/hooks/useFacebookPixel.d.ts +11 -0
- package/dist/cjs/hooks/useFacebookPixel.js +64 -0
- package/dist/cjs/hooks/useGoogleTagManager.d.ts +9 -0
- package/dist/cjs/hooks/useGoogleTagManager.js +53 -0
- package/dist/cjs/hooks/useImage.js +2 -2
- package/dist/cjs/hooks/useImageCropper.d.ts +10 -0
- package/dist/cjs/hooks/useImageCropper.js +67 -0
- package/dist/cjs/hooks/useUploader.d.ts +46 -0
- package/dist/cjs/hooks/useUploader.js +101 -0
- package/dist/cjs/hooks/useWebSocket.d.ts +2 -2
- package/dist/cjs/hooks/useWebSocket.js +13 -2
- package/dist/cjs/types/index.d.ts +3 -0
- package/dist/css/styles.css +1 -1
- package/dist/esm/comps/Accordion/index.js +1 -1
- package/dist/esm/comps/Actionbar/index.js +1 -1
- package/dist/esm/comps/Alert/index.js +1 -1
- package/dist/esm/comps/AutoComplete/index.d.ts +1 -1
- package/dist/esm/comps/AutoComplete/index.js +3 -2
- package/dist/esm/comps/Avatar/index.js +5 -5
- package/dist/esm/comps/Box/index.js +1 -1
- package/dist/esm/comps/Button/index.js +1 -1
- package/dist/esm/comps/CheckBox/index.d.ts +1 -0
- package/dist/esm/comps/CheckBox/index.js +1 -1
- package/dist/esm/comps/CheckBox/types.d.ts +1 -0
- package/dist/esm/comps/ColorScheme/index.js +1 -1
- package/dist/esm/comps/ContextMenu/index.d.ts +2 -0
- package/dist/esm/comps/ContextMenu/index.js +6 -6
- package/dist/esm/comps/ContextMenu/item.js +1 -1
- package/dist/esm/comps/ContextMenu/types.d.ts +3 -1
- package/dist/esm/comps/CookiesConsent/index.js +1 -1
- package/dist/esm/comps/Cover/index.js +1 -1
- package/dist/esm/comps/Cropper/index.d.ts +8 -0
- package/dist/esm/comps/Cropper/index.js +20 -0
- package/dist/esm/comps/Cropper/types.d.ts +14 -0
- package/dist/esm/comps/Cropper/types.js +5 -0
- package/dist/esm/comps/Crumb/index.d.ts +1 -0
- package/dist/esm/comps/Crumb/index.js +13 -3
- package/dist/esm/comps/Crumb/types.d.ts +1 -0
- package/dist/esm/comps/Drawer/index.js +1 -1
- package/dist/esm/comps/Fab/index.js +1 -1
- package/dist/esm/comps/Filters/index.js +1 -1
- package/dist/esm/comps/Form/index.js +22 -6
- package/dist/esm/comps/Icon/index.js +1 -1
- package/dist/esm/comps/Image/index.js +1 -1
- package/dist/esm/comps/Input/index.d.ts +2 -2
- package/dist/esm/comps/Input/index.js +1 -1
- package/dist/esm/comps/KeyboardKeys/index.js +1 -1
- package/dist/esm/comps/Label/index.js +1 -1
- package/dist/esm/comps/List/index.js +1 -1
- package/dist/esm/comps/Network/index.js +1 -1
- package/dist/esm/comps/Overlay/index.js +1 -1
- package/dist/esm/comps/Pagination/index.js +1 -1
- package/dist/esm/comps/Password/index.d.ts +6 -2
- package/dist/esm/comps/Password/index.js +15 -5
- package/dist/esm/comps/PinInput/index.d.ts +1 -1
- package/dist/esm/comps/PinInput/index.js +8 -3
- package/dist/esm/comps/ProgressBar/index.js +2 -2
- package/dist/esm/comps/Radio/index.js +1 -1
- package/dist/esm/comps/ScrollView/index.js +1 -1
- package/dist/esm/comps/Search/index.d.ts +1 -1
- package/dist/esm/comps/Search/index.js +1 -1
- package/dist/esm/comps/Segmented/index.js +1 -1
- package/dist/esm/comps/Select/index.d.ts +1 -0
- package/dist/esm/comps/Select/index.js +3 -3
- package/dist/esm/comps/Select/types.d.ts +6 -1
- package/dist/esm/comps/Sheet/index.js +1 -1
- package/dist/esm/comps/Sidebar/index.js +1 -1
- package/dist/esm/comps/Slider/index.js +1 -1
- package/dist/esm/comps/Span/index.js +1 -1
- package/dist/esm/comps/Spinner/index.js +1 -1
- package/dist/esm/comps/Switch/index.d.ts +1 -0
- package/dist/esm/comps/Switch/index.js +1 -1
- package/dist/esm/comps/TabView/body.js +1 -1
- package/dist/esm/comps/TabView/index.js +1 -1
- package/dist/esm/comps/TabView/tab.js +1 -1
- package/dist/esm/comps/Table/col.js +1 -1
- package/dist/esm/comps/Table/index.js +56 -2
- package/dist/esm/comps/Table/row.js +1 -1
- package/dist/esm/comps/Text/index.js +1 -1
- package/dist/esm/comps/TextArea/index.js +1 -1
- package/dist/esm/comps/TextWheel/index.js +3 -3
- package/dist/esm/comps/Tooltip/index.js +1 -1
- package/dist/esm/comps/Treeview/index.js +1 -1
- package/dist/esm/comps/Treeview/item.js +1 -1
- package/dist/esm/comps/VideoPlayer/index.js +1 -0
- package/dist/esm/comps/index.d.ts +2 -0
- package/dist/esm/comps/index.js +2 -0
- package/dist/esm/funs/events.d.ts +31 -7
- package/dist/esm/funs/events.js +57 -19
- package/dist/esm/funs/index.d.ts +5 -3
- package/dist/esm/funs/index.js +39 -84
- package/dist/esm/hooks/index.d.ts +4 -0
- package/dist/esm/hooks/index.js +4 -0
- package/dist/esm/hooks/useDB.d.ts +5 -1
- package/dist/esm/hooks/useDB.js +52 -4
- package/dist/esm/hooks/useFacebookPixel.d.ts +11 -0
- package/dist/esm/hooks/useFacebookPixel.js +64 -0
- package/dist/esm/hooks/useGoogleTagManager.d.ts +9 -0
- package/dist/esm/hooks/useGoogleTagManager.js +53 -0
- package/dist/esm/hooks/useImage.js +2 -2
- package/dist/esm/hooks/useImageCropper.d.ts +10 -0
- package/dist/esm/hooks/useImageCropper.js +67 -0
- package/dist/esm/hooks/useUploader.d.ts +46 -0
- package/dist/esm/hooks/useUploader.js +101 -0
- package/dist/esm/hooks/useWebSocket.d.ts +2 -2
- package/dist/esm/hooks/useWebSocket.js +13 -2
- package/dist/esm/types/index.d.ts +3 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,5 +10,5 @@ const Accordion = forwardRef((props, ref) => {
|
|
|
10
10
|
const [visible, setVisible] = useState(false);
|
|
11
11
|
return _jsxs(Box, { className: `--accordion flex cols`, ...rest, children: [_jsxs(Button, { onClick: (e) => setVisible(!visible), className: `--toggle flex aic ${visible ? `--open` : ``}`.trim(), children: [_jsx(Text, { className: `--label flex`, children: title }), _jsx(Box, { className: `--arrow flex`, children: visible ? SVGIcons.arrowUp : SVGIcons.arrowDown })] }), visible && _jsx(Box, { className: `--detail`, children: message })] });
|
|
12
12
|
});
|
|
13
|
-
Accordion.displayName = `Accordion`;
|
|
13
|
+
Accordion.displayName = `Zuz.Accordion`;
|
|
14
14
|
export default Accordion;
|
|
@@ -59,5 +59,5 @@ const ActionBar = forwardRef((props, ref) => {
|
|
|
59
59
|
`${!position || position == Position.Auto ? `rel` : `--${position}`}`
|
|
60
60
|
].join(` `).trim(), ...rest, children: [items.map((item, index) => _jsx(ActionItem, { selected: _selected === item.tag || selected == index, ...item, idx: index }, `actionbar-action-${item.label.toLowerCase().replace(/\s+/g, `-`)}`)), _jsx(Box, { className: `--tip abs`, children: _jsx(Box, { className: `--track flex aic`, children: items.map(({ label }) => _jsx(Box, { className: `--lb`, children: label }, `tool-tip-${label.toLowerCase().replace(/\s+/g, `-`)}`)) }) })] });
|
|
61
61
|
});
|
|
62
|
-
ActionBar.displayName = `ActionBar`;
|
|
62
|
+
ActionBar.displayName = `Zuz.ActionBar`;
|
|
63
63
|
export default ActionBar;
|
|
@@ -10,5 +10,5 @@ const Alert = forwardRef((props, ref) => {
|
|
|
10
10
|
const { className, style, rest } = useBase(pops);
|
|
11
11
|
return _jsxs(Box, { className: `--alert --${(type || ALERT.Info)} flex aic ${className}`.trim(), style: style, ...rest, children: [_jsx(Box, { className: `--icon icon-${icon || `auto-matic`}`, style: iconSize ? { fontSize: iconSize, width: iconSize, height: iconSize } : {}, children: !icon && SVGIcons[type || ALERT.Info] }), _jsxs(Box, { className: `--meta flex cols`, children: [_jsx(Text, { className: `--title ${message ? `--tm` : ``}`, children: title || `Lorem ipsum dolor sit amet, consectetur adipiscing elit.` }), message && _jsx(Text, { className: `--message`, h: 2, children: message })] })] });
|
|
12
12
|
});
|
|
13
|
-
Alert.displayName = `Alert`;
|
|
13
|
+
Alert.displayName = `Zuz.Alert`;
|
|
14
14
|
export default Alert;
|
|
@@ -3,7 +3,7 @@ declare const AutoComplete: import("react").ForwardRefExoticComponent<import("..
|
|
|
3
3
|
numeric?: boolean;
|
|
4
4
|
size?: Size;
|
|
5
5
|
variant?: import("../..").Variant;
|
|
6
|
-
with?: import("../..").FORMVALIDATION
|
|
6
|
+
with?: import("../..").FORMVALIDATION | `${import("../..").FORMVALIDATION}${string}`;
|
|
7
7
|
} & {
|
|
8
8
|
action?: string;
|
|
9
9
|
data?: string[];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { withPost } from "@zuzjs/core";
|
|
3
4
|
import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
import { clamp, isArray, uuid
|
|
5
|
+
import { clamp, isArray, uuid } from "../../funs";
|
|
5
6
|
import { useBase, useDebounce } from "../../hooks";
|
|
6
7
|
import { Size, TRANSITION_CURVES, TRANSITIONS } from "../../types/enums";
|
|
7
8
|
import Box from "../Box";
|
|
@@ -171,5 +172,5 @@ const AutoComplete = forwardRef((props, ref) => {
|
|
|
171
172
|
}
|
|
172
173
|
})) })] });
|
|
173
174
|
});
|
|
174
|
-
AutoComplete.displayName = `AutoComplete`;
|
|
175
|
+
AutoComplete.displayName = `Zuz.AutoComplete`;
|
|
175
176
|
export default AutoComplete;
|
|
@@ -7,9 +7,9 @@ import Box from "../Box";
|
|
|
7
7
|
import Image from "../Image";
|
|
8
8
|
import Text from "../Text";
|
|
9
9
|
const Avatar = forwardRef((props, ref) => {
|
|
10
|
-
const { src, size, variant, type, crossOrigin, referrerPolicy,
|
|
11
|
-
const [img, imgStatus, imgError] = src
|
|
12
|
-
const { className, style, rest } = useBase({
|
|
10
|
+
const { src, size, variant, type, crossOrigin, referrerPolicy, fx, as, alt, color, ...pops } = props;
|
|
11
|
+
const [img, imgStatus, imgError] = useImage(src ?? "", crossOrigin, referrerPolicy);
|
|
12
|
+
const { className, style, rest } = useBase({ fx, as });
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
if (type == AVATAR.Square && !document.getElementById('squareRadiusClipPath')) {
|
|
15
15
|
const svgNS = "http://www.w3.org/2000/svg";
|
|
@@ -27,11 +27,11 @@ const Avatar = forwardRef((props, ref) => {
|
|
|
27
27
|
svg.appendChild(defs);
|
|
28
28
|
document.body.appendChild(svg);
|
|
29
29
|
}
|
|
30
|
-
}, []);
|
|
30
|
+
}, [src]);
|
|
31
31
|
return _jsx(Box, { className: `--avatar --${variant || Size.Small} --${(type || AVATAR.Circle).toLowerCase()} rel flex aic jcc ${className}`.trim(), style: {
|
|
32
32
|
background: color || `var(--primary)`,
|
|
33
33
|
...style,
|
|
34
34
|
}, ...rest, children: src ? _jsx(Image, { src: img, crossOrigin: crossOrigin, referrerPolicy: referrerPolicy, ...pops }) : _jsx(Text, { className: `--avatar-label`, children: (alt ? alt.charAt(0) : `A`).toUpperCase() }) });
|
|
35
35
|
});
|
|
36
|
-
Avatar.displayName = `Avatar`;
|
|
36
|
+
Avatar.displayName = `Zuz.Avatar`;
|
|
37
37
|
export default Avatar;
|
|
@@ -12,5 +12,5 @@ const Button = forwardRef((props, ref) => {
|
|
|
12
12
|
const { style, className, rest } = useBase(pops);
|
|
13
13
|
return _jsxs("button", { className: `--button ${variant ? `--${variant}` : ``} ${size ? `--${size}` : ``} flex aic ${!reset ? `jcc` : ``} ${icon ? `ico-btn` : ``} ${className}`.trim().replace(/\s+/g, ' '), style: style, ref: ref, disabled: state == ButtonState.Loading || props.skeleton?.enabled || disabled, ...rest, children: [state == ButtonState.Loading && _jsx(Spinner, { size: Size.Small, type: spinner || SPINNER.Simple }), (!state || state == ButtonState.Normal) && _jsxs(_Fragment, { children: [icon && _jsx(Icon, { size: iconSize, name: icon }), withLabel === true ? _jsx(Span, { children: children }) : children] })] });
|
|
14
14
|
});
|
|
15
|
-
Button.displayName = `Button`;
|
|
15
|
+
Button.displayName = `Zuz.Button`;
|
|
16
16
|
export default Button;
|
|
@@ -4,6 +4,7 @@ declare const CheckBox: import("react").ForwardRefExoticComponent<import("../.."
|
|
|
4
4
|
type?: CHECKBOX;
|
|
5
5
|
size?: import("../..").Size;
|
|
6
6
|
variant?: Variant;
|
|
7
|
+
checked?: boolean;
|
|
7
8
|
onSwitch?: (checked: boolean, value: string | number | readonly string[]) => void;
|
|
8
9
|
} & import("react").RefAttributes<CheckboxHandler>>;
|
|
9
10
|
export default CheckBox;
|
|
@@ -35,5 +35,5 @@ const ColorScheme = forwardRef((props, ref) => {
|
|
|
35
35
|
: colorScheme == `light` ? SVGIcons.colorSchemeLight
|
|
36
36
|
: SVGIcons.colorSchemeDark });
|
|
37
37
|
});
|
|
38
|
-
ColorScheme.displayName = `ColorScheme`;
|
|
38
|
+
ColorScheme.displayName = `Zuz.ColorScheme`;
|
|
39
39
|
export default ColorScheme;
|
|
@@ -5,5 +5,7 @@ declare const ContextMenu: import("react").ForwardRefExoticComponent<BoxProps &
|
|
|
5
5
|
items?: ContextItem[];
|
|
6
6
|
offsetX?: number;
|
|
7
7
|
offsetY?: number;
|
|
8
|
+
header?: import("react").ReactNode | import("react").FC;
|
|
9
|
+
footer?: import("react").ReactNode | import("react").FC;
|
|
8
10
|
} & import("react").RefAttributes<ContextMenuHandler>>;
|
|
9
11
|
export default ContextMenu;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useImperativeHandle, useRef, useState } from "react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createElement, forwardRef, useImperativeHandle, useRef, useState } from "react";
|
|
4
4
|
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
8
|
const ContextMenu = forwardRef((props, ref) => {
|
|
9
|
-
const { as, offsetX, offsetY, parent, items: _items, ...pops } = props;
|
|
9
|
+
const { as, offsetX, offsetY, parent, items: _items, header, footer, ...pops } = props;
|
|
10
10
|
const { className, style, rest } = useBase(pops);
|
|
11
11
|
const event = useRef(undefined);
|
|
12
12
|
const [visible, setVisible] = useState(false);
|
|
@@ -25,7 +25,7 @@ const ContextMenu = forwardRef((props, ref) => {
|
|
|
25
25
|
},
|
|
26
26
|
hide: (e) => setVisible(false),
|
|
27
27
|
}));
|
|
28
|
-
return
|
|
28
|
+
return _jsxs(Box, { className: `--contextmenu abs flex cols ${className}`.trim(), "aria-hidden": !visible, style: {
|
|
29
29
|
...style,
|
|
30
30
|
top: position.top,
|
|
31
31
|
left: position.left
|
|
@@ -35,7 +35,7 @@ const ContextMenu = forwardRef((props, ref) => {
|
|
|
35
35
|
curve: TRANSITION_CURVES.EaseInOut,
|
|
36
36
|
duration: 0.05,
|
|
37
37
|
when: visible
|
|
38
|
-
}, ref: targetRef, ...rest, children: items.map((item, index) => _jsx(MenuItem, { ...{ ...item, index } }, `context-${item.label.toLowerCase()}-${index}`)) });
|
|
38
|
+
}, ref: targetRef, ...rest, children: [typeof header == `function` ? createElement(header) : header, items.map((item, index) => _jsx(MenuItem, { ...{ ...item, index } }, `context-${item.label.toLowerCase()}-${index}`)), typeof footer == `function` ? createElement(footer) : footer] });
|
|
39
39
|
});
|
|
40
|
-
ContextMenu.displayName = `ContextMenu`;
|
|
40
|
+
ContextMenu.displayName = `Zuz.ContextMenu`;
|
|
41
41
|
export default ContextMenu;
|
|
@@ -6,6 +6,6 @@ import Text from "../Text";
|
|
|
6
6
|
const MenuItem = (props) => {
|
|
7
7
|
const { label, labelColor, icon, iconColor, index, className, onSelect } = props;
|
|
8
8
|
return label == `-` ? _jsx(Box, { className: `--line` })
|
|
9
|
-
: _jsxs(Button, { reset: true, onClick: e => onSelect(), className: `--item ${className || ``}`.trim(), children: [_jsx(Icon, { name: icon, className: `--ico`, style: iconColor ? { color: iconColor } : {} }), _jsx(Text, { className: `--lbl flex aic`, style: labelColor ? { color: labelColor } : {}, children: label })] });
|
|
9
|
+
: _jsxs(Button, { reset: true, onClick: e => onSelect(), className: `--item ${className || ``}`.trim(), children: [_jsx(Box, { as: `--icon`, children: _jsx(Icon, { name: icon, className: `--ico`, style: iconColor ? { color: iconColor } : {} }) }), _jsx(Text, { className: `--lbl flex aic`, style: labelColor ? { color: labelColor } : {}, children: label })] });
|
|
10
10
|
};
|
|
11
11
|
export default MenuItem;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent } from "react";
|
|
1
|
+
import { FC, MouseEvent, ReactNode } from "react";
|
|
2
2
|
import { BoxProps } from "../Box";
|
|
3
3
|
export interface ContextItem {
|
|
4
4
|
label: string;
|
|
@@ -14,6 +14,8 @@ export type ContextMenuProps = BoxProps & {
|
|
|
14
14
|
items?: ContextItem[];
|
|
15
15
|
offsetX?: number;
|
|
16
16
|
offsetY?: number;
|
|
17
|
+
header?: ReactNode | FC;
|
|
18
|
+
footer?: ReactNode | FC;
|
|
17
19
|
};
|
|
18
20
|
export type MenuItemProps = ContextItem & {
|
|
19
21
|
index: number;
|
|
@@ -25,5 +25,5 @@ const CookiesConsent = forwardRef((props, ref) => {
|
|
|
25
25
|
delay: accepted == `accepted` ? 0 : 3
|
|
26
26
|
}, as: `--cookie-consent --${accepted} --${position || Position.Left} flex cols`, children: [_jsx(Text, { as: `--title`, children: title || `This site uses cookies` }), _jsx(Text, { as: `--message`, children: message || `We and selected third parties use cookies (or similar technologies) for technical purposes, to enhance and analyze site usage, to support our marketing efforts` }), _jsxs(Box, { as: `--footer flex aic`, children: [_jsx(Button, { onClick: e => handleAction(1), as: `--accept`, children: acceptLabel || `Accept All` }), _jsx(Button, { onClick: e => handleAction(0), as: `--reject`, children: rejectLabel || `Cancel` })] })] });
|
|
27
27
|
});
|
|
28
|
-
CookiesConsent.displayName = `CookiesConsent`;
|
|
28
|
+
CookiesConsent.displayName = `Zuz.CookiesConsent`;
|
|
29
29
|
export default CookiesConsent;
|
|
@@ -17,5 +17,5 @@ const Cover = forwardRef((props, ref) => {
|
|
|
17
17
|
backgroundColor: `var(--cover-bg)`
|
|
18
18
|
}, ...rest, children: [_jsx(Spinner, { type: spinner || SPINNER.Simple }), !hideMessage && _jsx(Text, { className: `--label`, style: { color: `var(--cover-label)` }, children: message || `loading` })] });
|
|
19
19
|
});
|
|
20
|
-
Cover.displayName = `Cover`;
|
|
20
|
+
Cover.displayName = `Zuz.Cover`;
|
|
21
21
|
export default Cover;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CropHandler, CropShape } from "../..";
|
|
2
|
+
import { BoxProps } from "../Box";
|
|
3
|
+
declare const Cropper: import("react").ForwardRefExoticComponent<BoxProps & {
|
|
4
|
+
src: string;
|
|
5
|
+
shape?: CropShape;
|
|
6
|
+
size?: number;
|
|
7
|
+
} & import("react").RefAttributes<CropHandler>>;
|
|
8
|
+
export default Cropper;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useImperativeHandle } from "react";
|
|
3
|
+
import { CropShape, Slider, useBase, useImageCropper } from "../..";
|
|
4
|
+
import Box from "../Box";
|
|
5
|
+
const Cropper = forwardRef((props, ref) => {
|
|
6
|
+
const { src, shape, size, ...pops } = props;
|
|
7
|
+
const { style, className, rest } = useBase(pops);
|
|
8
|
+
const { canvasRef, crop, setScale, handleMouseDown, handleMouseUp, handleMouseMove } = useImageCropper(src, size || 200, shape || CropShape.Circle);
|
|
9
|
+
useImperativeHandle(ref, () => ({
|
|
10
|
+
getCropped() {
|
|
11
|
+
return crop();
|
|
12
|
+
},
|
|
13
|
+
setScale(scale) {
|
|
14
|
+
setScale(scale);
|
|
15
|
+
}
|
|
16
|
+
}));
|
|
17
|
+
return _jsxs(Box, { as: `--cropper --${shape || CropShape.Circle} ${className}`, style: style, ...rest, children: [_jsx("canvas", { ref: canvasRef, width: size || 200, height: size || 200, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp, onMouseLeave: handleMouseUp, onMouseMove: handleMouseMove }), _jsx(Box, { as: `--cropper-slider`, children: _jsx(Slider, { onChange: num => setScale(num), min: 0, max: 1, step: 0.01, value: 1 }) })] });
|
|
18
|
+
});
|
|
19
|
+
Cropper.displayName = `Zuz.Cropper`;
|
|
20
|
+
export default Cropper;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BoxProps } from "../Box";
|
|
2
|
+
export declare enum CropShape {
|
|
3
|
+
Circle = "circle",
|
|
4
|
+
Square = "square"
|
|
5
|
+
}
|
|
6
|
+
export type CropperProps = BoxProps & {
|
|
7
|
+
src: string;
|
|
8
|
+
shape?: CropShape;
|
|
9
|
+
size?: number;
|
|
10
|
+
};
|
|
11
|
+
export interface CropHandler {
|
|
12
|
+
getCropped: () => string;
|
|
13
|
+
setScale: (scale: number) => void;
|
|
14
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
+
import { forwardRef, useMemo } from "react";
|
|
3
4
|
import Box from "../Box";
|
|
4
5
|
import Button from "../Button";
|
|
5
6
|
import Icon from "../Icon";
|
|
@@ -7,7 +8,16 @@ import List from "../List";
|
|
|
7
8
|
import SVGIcons from "../svgicons";
|
|
8
9
|
import Text from "../Text";
|
|
9
10
|
const Crumb = forwardRef((props, ref) => {
|
|
10
|
-
const { items } = props;
|
|
11
|
-
|
|
11
|
+
const { items: crumbItems, maxItems } = props;
|
|
12
|
+
const canSlice = useMemo(() => maxItems && maxItems > 0 && crumbItems.length > maxItems - 1, [crumbItems, maxItems]);
|
|
13
|
+
const items = canSlice ? [
|
|
14
|
+
...crumbItems.slice(0, 2),
|
|
15
|
+
{ ID: `.`, label: `...`, icon: `ellipsis`, action: () => { } },
|
|
16
|
+
...crumbItems.slice(-maxItems)
|
|
17
|
+
] : crumbItems;
|
|
18
|
+
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) => item.ID == `.` ?
|
|
19
|
+
_jsx(Box, { as: `flex aic gap:3`, children: Array(3).fill(null).map(() => _jsx(Box, { as: `w:4 h:4 bg:$text r:10` })) })
|
|
20
|
+
: _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
21
|
});
|
|
22
|
+
Crumb.displayName = `Zuz.Crumb`;
|
|
13
23
|
export default Crumb;
|
|
@@ -61,5 +61,5 @@ const Drawer = forwardRef((props, ref) => {
|
|
|
61
61
|
duration: speed || .5,
|
|
62
62
|
}, ...rest, children: [from == DRAWER_SIDE.Top || from == DRAWER_SIDE.Bottom ? _jsx(Box, { className: `--handle` }) : null, render ? content : visible ? content : null] })] });
|
|
63
63
|
});
|
|
64
|
-
Drawer.displayName = `Drawer`;
|
|
64
|
+
Drawer.displayName = `Zuz.Drawer`;
|
|
65
65
|
export default Drawer;
|
|
@@ -7,5 +7,5 @@ const Fab = forwardRef((props, ref) => {
|
|
|
7
7
|
const { icon, size, position } = props;
|
|
8
8
|
return _jsx(Button, { className: `--fab fixed --${size || Size.Large} --${position || `bottomright`}`, children: icon || SVGIcons.plus });
|
|
9
9
|
});
|
|
10
|
-
Fab.displayName = `Fab`;
|
|
10
|
+
Fab.displayName = `Zuz.Fab`;
|
|
11
11
|
export default Fab;
|
|
@@ -10,5 +10,5 @@ const Filters = (props) => {
|
|
|
10
10
|
useEffect(() => { }, [names]);
|
|
11
11
|
return _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", version: "1.1", children: _jsx("defs", { children: (names || [FILTER.Gooey]).map(name => filters[name](strength)) }) });
|
|
12
12
|
};
|
|
13
|
-
Filters.displayName = `Filters`;
|
|
13
|
+
Filters.displayName = `Zuz.Filters`;
|
|
14
14
|
export default Filters;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { withPost } from "@zuzjs/core";
|
|
3
4
|
import { forwardRef, startTransition, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
4
|
-
import { addPropsToChildren, isEmail,
|
|
5
|
+
import { addPropsToChildren, isEmail, isEmpty } from "../../funs";
|
|
5
6
|
import { useBase } from "../../hooks";
|
|
6
7
|
import { FORMVALIDATION, SHEET } from "../../types/enums";
|
|
7
8
|
import Box from "../Box";
|
|
@@ -96,13 +97,28 @@ const Form = forwardRef((props, ref) => {
|
|
|
96
97
|
console.log(`Add FORMVALIDATION.Password`);
|
|
97
98
|
return false;
|
|
98
99
|
case FORMVALIDATION.MatchField:
|
|
99
|
-
const [__, field] = el.getAttribute(`with`).split(`@`);
|
|
100
|
+
const [__, field, condition] = el.getAttribute(`with`).split(`@`);
|
|
100
101
|
const _el = document.querySelector(`[name=${field.trim()}]`);
|
|
101
102
|
if (!_el)
|
|
102
103
|
return false;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
switch (condition || `direct-match`) {
|
|
105
|
+
//Self should not empty
|
|
106
|
+
case "if-not-empty":
|
|
107
|
+
if (_el && !isEmpty(_el.value) && _el.value != el.value) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
break;
|
|
111
|
+
case "direct-match":
|
|
112
|
+
if (_el &&
|
|
113
|
+
_el.classList.contains(`--otp`) &&
|
|
114
|
+
el.classList.contains(`--otp`) &&
|
|
115
|
+
_getPinValue(_el) != _getPinValue(el)) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
else if (_el && _el.value != el.value) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
break;
|
|
106
122
|
}
|
|
107
123
|
break;
|
|
108
124
|
default:
|
|
@@ -261,5 +277,5 @@ const Form = forwardRef((props, ref) => {
|
|
|
261
277
|
useEffect(_init, []);
|
|
262
278
|
return _jsxs(Box, { ref: innerRef, style: style, className: `--form flex rel ${className} ${name ? `--form-${name.replace(/\s+/g, `-`)}` : ``}`, propsToRemove: [`withData`, `action`, `onSubmit`, `onSuccess`, `onError`], children: [_jsx(Sheet, { ref: sheet, as: `--sheet-form` }), !isSheetHandler(cover) && _jsx(Cover, { message: cover ? cover.message || undefined : `working`, spinner: spinner, color: cover ? `color` in cover ? cover.color : `#ffffff` : `#ffffff`, when: loading }), buildChildren] });
|
|
263
279
|
});
|
|
264
|
-
Form.displayName = `Form`;
|
|
280
|
+
Form.displayName = `Zuz.Form`;
|
|
265
281
|
export default Form;
|
|
@@ -8,5 +8,5 @@ const Icon = forwardRef((props, ref) => {
|
|
|
8
8
|
const { className, style, rest } = useBase(pops);
|
|
9
9
|
return _jsx("div", { style: style, className: `icon-${name} --icon --${size || Size.Default} ${className}`.trim(), ref: ref, ...rest, children: Array(pathCount || 0).fill(0).map((p, i) => _jsx(Span, { className: `path${i + 1}` }, `${name}-layer-${i}`)) });
|
|
10
10
|
});
|
|
11
|
-
Icon.displayName = `Icon`;
|
|
11
|
+
Icon.displayName = `Zuz.Icon`;
|
|
12
12
|
export default Icon;
|
|
@@ -4,12 +4,12 @@ export type InputProps = Props<`input`> & {
|
|
|
4
4
|
numeric?: boolean;
|
|
5
5
|
size?: Size;
|
|
6
6
|
variant?: Variant;
|
|
7
|
-
with?: FORMVALIDATION
|
|
7
|
+
with?: FORMVALIDATION | `${FORMVALIDATION}${string}`;
|
|
8
8
|
};
|
|
9
9
|
declare const Input: import("react").ForwardRefExoticComponent<import("../..").ZuzProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, keyof import("../..").ZuzProps> & {
|
|
10
10
|
numeric?: boolean;
|
|
11
11
|
size?: Size;
|
|
12
12
|
variant?: Variant;
|
|
13
|
-
with?: FORMVALIDATION
|
|
13
|
+
with?: FORMVALIDATION | `${FORMVALIDATION}${string}`;
|
|
14
14
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
15
15
|
export default Input;
|
|
@@ -12,5 +12,5 @@ const Input = forwardRef((props, ref) => {
|
|
|
12
12
|
};
|
|
13
13
|
return _jsx("input", { className: `--input ${size || variant ? `--${size || variant}` : ``} flex ${className}`.trim(), style: style, onInput: handleInput, ref: ref, ...rest });
|
|
14
14
|
});
|
|
15
|
-
Input.displayName = `Input`;
|
|
15
|
+
Input.displayName = `Zuz.Input`;
|
|
16
16
|
export default Input;
|
|
@@ -29,5 +29,5 @@ const KeyBoardKeys = forwardRef(({ children, keys, variant }, ref) => {
|
|
|
29
29
|
}, [keys]);
|
|
30
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
31
|
});
|
|
32
|
-
KeyBoardKeys.displayName = `
|
|
32
|
+
KeyBoardKeys.displayName = `Zuz.KeyboardKeys`;
|
|
33
33
|
export default KeyBoardKeys;
|
|
@@ -5,5 +5,5 @@ const Label = forwardRef((props, ref) => {
|
|
|
5
5
|
const { style, className, rest } = useBase(props);
|
|
6
6
|
return _jsx("label", { ref: ref, style: style, className: className, ...rest });
|
|
7
7
|
});
|
|
8
|
-
Label.displayName = `Label`;
|
|
8
|
+
Label.displayName = `Zuz.Label`;
|
|
9
9
|
export default Label;
|
|
@@ -14,5 +14,5 @@ const List = forwardRef((props, ref) => {
|
|
|
14
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
|
-
List.displayName = `List`;
|
|
17
|
+
List.displayName = `Zuz.List`;
|
|
18
18
|
export default List;
|
|
@@ -17,5 +17,5 @@ const NetworkManager = forwardRef((props, ref) => {
|
|
|
17
17
|
delay: 2
|
|
18
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` })] });
|
|
19
19
|
});
|
|
20
|
-
NetworkManager.displayName = `
|
|
20
|
+
NetworkManager.displayName = `Zuz.NetWorkManager`;
|
|
21
21
|
export default NetworkManager;
|
|
@@ -59,5 +59,5 @@ const Pagination = forwardRef((props, ref) => {
|
|
|
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 })] })] });
|
|
61
61
|
});
|
|
62
|
-
Pagination.displayName = `Pagination`;
|
|
62
|
+
Pagination.displayName = `Zuz.Pagination`;
|
|
63
63
|
export default Pagination;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { InputProps } from '../Input';
|
|
2
|
-
export type PasswordProps = Omit<InputProps, `type` | `numeric`> & {
|
|
3
|
-
|
|
2
|
+
export type PasswordProps = Omit<InputProps, `type` | `numeric`> & {
|
|
3
|
+
strenthMeter?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const Password: import("react").ForwardRefExoticComponent<Omit<InputProps, "type" | "numeric"> & {
|
|
6
|
+
strenthMeter?: boolean;
|
|
7
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
4
8
|
export default Password;
|
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useState } from 'react';
|
|
4
|
-
import {
|
|
3
|
+
import { forwardRef, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { checkPasswordStrength } from '../../funs';
|
|
5
|
+
import { useBase, useDebounce } from '../../hooks';
|
|
5
6
|
import Box from '../Box';
|
|
6
7
|
import Button from '../Button';
|
|
7
8
|
import Input from '../Input';
|
|
8
9
|
import SVGIcons from '../svgicons';
|
|
10
|
+
import Text from '../Text';
|
|
9
11
|
const Password = forwardRef((props, ref) => {
|
|
10
|
-
const { ...pops } = props;
|
|
12
|
+
const { strenthMeter, onChange, ...pops } = props;
|
|
11
13
|
if (`type` in pops) {
|
|
12
14
|
delete pops[`type`];
|
|
13
15
|
}
|
|
14
16
|
const { style, className, rest } = useBase(pops);
|
|
15
17
|
const [visible, setVisible] = useState(false);
|
|
16
|
-
|
|
18
|
+
const [passw, setPassw] = useState("");
|
|
19
|
+
const strenth = useMemo(() => checkPasswordStrength(passw), [passw]);
|
|
20
|
+
const debounce = useDebounce((ev) => {
|
|
21
|
+
if (strenthMeter)
|
|
22
|
+
setPassw(ev.target.value);
|
|
23
|
+
onChange && onChange(ev);
|
|
24
|
+
}, 100);
|
|
25
|
+
useEffect(() => { }, []);
|
|
26
|
+
return _jsxs(Box, { as: `w:100% flex cols`, children: [_jsxs(Box, { style: style, className: `--password flex aic rel`, children: [_jsx(Input, { ref: ref, type: visible ? 'text' : 'password', className: className, onChange: debounce, ...rest }), _jsx(Button, { tabIndex: -1, onClick: () => setVisible(prev => !prev), className: `--toggle flex aic jcc abs`, children: visible ? SVGIcons.eye : SVGIcons.eyeSlash })] }), strenthMeter && _jsxs(Box, { as: `flex aic --password-meter --pb-score-${strenth.score}`, children: [_jsxs(Box, { as: `--password-bars flex aic`, children: [_jsx(Box, { as: `--pbar ${strenth.score >= 1 ? `--pb-on` : ``}`.trim() }), _jsx(Box, { as: `--pbar ${strenth.score >= 2 ? `--pb-on` : ``}`.trim() }), _jsx(Box, { as: `--pbar ${strenth.score >= 3 ? `--pb-on` : ``}`.trim() }), _jsx(Box, { as: `--pbar ${strenth.score >= 4 ? `--pb-on` : ``}`.trim() }), _jsx(Box, { as: `--pbar ${strenth.score >= 5 ? `--pb-on` : ``}`.trim() })] }), _jsx(Text, { as: `--password-meter-label`, "aria-hidden": true, children: strenth.result })] })] });
|
|
17
27
|
});
|
|
18
|
-
Password.displayName = `Password`;
|
|
28
|
+
Password.displayName = `Zuz.Password`;
|
|
19
29
|
export default Password;
|
|
@@ -8,7 +8,7 @@ declare const PinInput: import("react").ForwardRefExoticComponent<import("../.."
|
|
|
8
8
|
numeric?: boolean;
|
|
9
9
|
size?: import("../..").Size;
|
|
10
10
|
variant?: import("../..").Variant;
|
|
11
|
-
with?: import("../..").FORMVALIDATION
|
|
11
|
+
with?: import("../..").FORMVALIDATION | `${import("../..").FORMVALIDATION}${string}`;
|
|
12
12
|
} & {
|
|
13
13
|
mask?: boolean;
|
|
14
14
|
size?: number;
|
|
@@ -9,6 +9,11 @@ const PinInput = forwardRef((props, ref) => {
|
|
|
9
9
|
const inputs = useRef([]);
|
|
10
10
|
let name = `pinput`;
|
|
11
11
|
let required = false;
|
|
12
|
+
let _with = {};
|
|
13
|
+
if (`with` in pops) {
|
|
14
|
+
_with = { with: pops.with };
|
|
15
|
+
delete pops.with;
|
|
16
|
+
}
|
|
12
17
|
if (`type` in pops) {
|
|
13
18
|
delete pops.type;
|
|
14
19
|
}
|
|
@@ -35,9 +40,9 @@ const PinInput = forwardRef((props, ref) => {
|
|
|
35
40
|
useEffect(() => {
|
|
36
41
|
inputs.current = inputs.current.slice(0, size || length);
|
|
37
42
|
}, [size || length]);
|
|
38
|
-
return _jsx(Box, { name: name, style: style, className: `--otp flex aic rel`, "data-required": required, "data-size": size || length || 4, children: Array(size || length || 4).fill(1).map((a, i) => _jsx(Input, { "data-index": i, ref: (el) => {
|
|
43
|
+
return _jsx(Box, { name: name, style: style, className: `--otp flex aic rel`, "data-required": required, "data-size": size || length || 4, ..._with, children: Array(size || length || 4).fill(1).map((a, i) => _jsx(Input, { autoComplete: "new-password", "data-index": i, ref: (el) => {
|
|
39
44
|
inputs.current[i] = el;
|
|
40
|
-
}, numeric: true, onChange: handleInput, maxLength: 1, placeholder: `0`, type: mask ? `password` : 'text', ...pops }, `pin-${i}`)) });
|
|
45
|
+
}, numeric: true, onChange: handleInput, maxLength: 1, placeholder: mask ? `·` : `0`, type: mask ? `password` : 'text', ...pops }, `pin-${i}`)) });
|
|
41
46
|
});
|
|
42
|
-
PinInput.displayName = `PinInput`;
|
|
47
|
+
PinInput.displayName = `Zuz.PinInput`;
|
|
43
48
|
export default PinInput;
|
|
@@ -15,9 +15,9 @@ const ProgressBar = forwardRef((props, ref) => {
|
|
|
15
15
|
if (progress && bar.current) {
|
|
16
16
|
bar.current.style.width = `${progress * 100}%`;
|
|
17
17
|
}
|
|
18
|
-
}, []);
|
|
18
|
+
}, [progress, bar.current]);
|
|
19
19
|
const { className, style, rest } = useBase(pops);
|
|
20
20
|
return _jsx(Box, { className: `--progress flex rel ${className}`.trim(), style: style, ...rest, children: _jsx(Box, { ref: bar, className: `--bar rel` }) });
|
|
21
21
|
});
|
|
22
|
-
ProgressBar.displayName = `ProgressBar`;
|
|
22
|
+
ProgressBar.displayName = `Zuz.ProgressBar`;
|
|
23
23
|
export default ProgressBar;
|
|
@@ -15,5 +15,5 @@ const Radio = forwardRef((props, _ref) => {
|
|
|
15
15
|
_setChecked(e.target.checked);
|
|
16
16
|
} }), _jsx(Box, { className: `--dot rel`, children: _jsx(Box, { className: `--rod abs abc` }) }), _jsx(Box, { className: `--value`, children: children })] });
|
|
17
17
|
});
|
|
18
|
-
Radio.displayName = `Radio`;
|
|
18
|
+
Radio.displayName = `Zuz.Radio`;
|
|
19
19
|
export default Radio;
|
|
@@ -9,5 +9,5 @@ const ScrollView = forwardRef((props, ref) => {
|
|
|
9
9
|
// useEffect(() => { }, [])
|
|
10
10
|
return _jsxs(Box, { ref: rootRef, className: className.trim(), as: `--scrollview rel`, children: [_jsx(Box, { as: `--scroll-content`, ref: containerRef, style: _style || {}, children: rest.children }), _jsx(Box, { as: `--scroll-track --track-y abs`, children: _jsx(Box, { as: `--scroll-thumb abs`, ref: thumbY, onMouseDown: onScrollY }) }), _jsx(Box, { as: `--scroll-track --track-x abs`, children: _jsx(Box, { as: `--scroll-thumb abs`, ref: thumbX, onMouseDown: onScrollX }) })] });
|
|
11
11
|
});
|
|
12
|
-
ScrollView.displayName = `
|
|
12
|
+
ScrollView.displayName = `Zuz.ScrollView`;
|
|
13
13
|
export default ScrollView;
|
|
@@ -4,7 +4,7 @@ declare const Search: import("react").ForwardRefExoticComponent<import("../..").
|
|
|
4
4
|
numeric?: boolean;
|
|
5
5
|
size?: import("../..").Size;
|
|
6
6
|
variant?: Variant;
|
|
7
|
-
with?: import("../..").FORMVALIDATION
|
|
7
|
+
with?: import("../..").FORMVALIDATION | `${import("../..").FORMVALIDATION}${string}`;
|
|
8
8
|
} & {
|
|
9
9
|
onSubmit?: (value: string) => void;
|
|
10
10
|
onChange?: (value: string) => void;
|