@zuzjs/ui 0.9.6 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/comps/Cover/index.d.ts +3 -1
- package/dist/cjs/comps/Cover/index.js +3 -3
- package/dist/cjs/comps/Password/index.d.ts +1 -1
- package/dist/cjs/comps/Search/index.d.ts +4 -0
- package/dist/cjs/comps/Search/index.js +7 -3
- package/dist/cjs/comps/Search/types.d.ts +5 -0
- package/dist/cjs/comps/Select/index.d.ts +2 -0
- package/dist/cjs/comps/Select/index.js +5 -2
- package/dist/cjs/comps/Select/types.d.ts +3 -1
- package/dist/cjs/comps/Spinner/index.d.ts +3 -1
- package/dist/cjs/comps/Spinner/index.js +11 -4
- package/dist/cjs/funs/stylesheet.js +3 -1
- package/dist/css/styles.css +1 -1
- package/dist/esm/comps/Cover/index.d.ts +3 -1
- package/dist/esm/comps/Cover/index.js +3 -3
- package/dist/esm/comps/Password/index.d.ts +1 -1
- package/dist/esm/comps/Search/index.d.ts +4 -0
- package/dist/esm/comps/Search/index.js +7 -3
- package/dist/esm/comps/Search/types.d.ts +5 -0
- package/dist/esm/comps/Select/index.d.ts +2 -0
- package/dist/esm/comps/Select/index.js +5 -2
- package/dist/esm/comps/Select/types.d.ts +3 -1
- package/dist/esm/comps/Spinner/index.d.ts +3 -1
- package/dist/esm/comps/Spinner/index.js +11 -4
- package/dist/esm/funs/stylesheet.js +3 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { useBase } from "../../hooks";
|
|
5
|
-
import { SPINNER } from "../../types/enums";
|
|
5
|
+
import { SPINNER, Variant } from "../../types/enums";
|
|
6
6
|
import Box from "../Box";
|
|
7
7
|
import Spinner from "../Spinner";
|
|
8
8
|
import Text from "../Text";
|
|
9
9
|
const Cover = forwardRef((props, ref) => {
|
|
10
|
-
const { message, spinner, color, when, hideMessage, ...pops } = props;
|
|
10
|
+
const { message, spinner, spinnerSize, color, when, hideMessage, ...pops } = props;
|
|
11
11
|
const { className, style, rest } = useBase(pops);
|
|
12
12
|
if (`when` in props && props.when == false) {
|
|
13
13
|
return null;
|
|
@@ -15,7 +15,7 @@ const Cover = forwardRef((props, ref) => {
|
|
|
15
15
|
return _jsxs(Box, { className: `--cover flex aic jcc cols abs fillx nope nous ${className}`.trim(), style: {
|
|
16
16
|
...style,
|
|
17
17
|
backgroundColor: `var(--cover-bg)`
|
|
18
|
-
}, ...rest, children: [_jsx(Spinner, { type: spinner || SPINNER.Simple }), !hideMessage && _jsx(Text, { className: `--label`, style: { color: `var(--cover-label)` }, children: message || `loading` })] });
|
|
18
|
+
}, ...rest, children: [_jsx(Spinner, { variant: spinnerSize || Variant.Small, type: spinner || SPINNER.Simple }), !hideMessage && _jsx(Text, { className: `--label`, style: { color: `var(--cover-label)` }, children: message || `loading` })] });
|
|
19
19
|
});
|
|
20
20
|
Cover.displayName = `Zuz.Cover`;
|
|
21
21
|
export default Cover;
|
|
@@ -2,7 +2,7 @@ import { InputProps } from '../Input';
|
|
|
2
2
|
export type PasswordProps = Omit<InputProps, `type` | `numeric`> & {
|
|
3
3
|
strenthMeter?: boolean;
|
|
4
4
|
};
|
|
5
|
-
declare const Password: import("react").ForwardRefExoticComponent<Omit<InputProps, "
|
|
5
|
+
declare const Password: import("react").ForwardRefExoticComponent<Omit<InputProps, "type" | "numeric"> & {
|
|
6
6
|
strenthMeter?: boolean;
|
|
7
7
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
8
8
|
export default Password;
|
|
@@ -13,5 +13,9 @@ declare const Search: import("react").ForwardRefExoticComponent<import("../..").
|
|
|
13
13
|
withStyle?: string;
|
|
14
14
|
shortcut?: import("..").KeyCombination;
|
|
15
15
|
reverse?: boolean;
|
|
16
|
+
searchIcon?: string | import("react").ReactNode;
|
|
17
|
+
hideSearchIcon?: boolean;
|
|
18
|
+
clearIcon?: string | import("react").ReactNode;
|
|
19
|
+
hideClearIcon?: boolean;
|
|
16
20
|
} & import("react").RefAttributes<SearchHandler>>;
|
|
17
21
|
export default Search;
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
3
|
+
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { useBase } from '../../hooks';
|
|
5
5
|
import { Variant } from '../../types/enums';
|
|
6
6
|
import Box from '../Box';
|
|
7
7
|
import Button from '../Button';
|
|
8
|
+
import Icon from '../Icon';
|
|
8
9
|
import Input from '../Input';
|
|
9
10
|
import KeyBoardKeys from '../KeyboardKeys';
|
|
10
11
|
import SVGIcons from '../svgicons';
|
|
11
12
|
const Search = forwardRef((props, ref) => {
|
|
12
|
-
const { fx, animate, withStyle, as, reverse, onChange, onClear, ...pops } = props;
|
|
13
|
+
const { fx, animate, withStyle, as, reverse = false, searchIcon = SVGIcons.search, hideSearchIcon = false, clearIcon = SVGIcons.close, hideClearIcon = false, onChange, onClear, ...pops } = props;
|
|
13
14
|
const { style, className } = useBase({ as: props.as });
|
|
14
15
|
// const { className : searchStyle } = useBase({ as: withStyle || `` } as Props<`div`>)
|
|
15
16
|
const [query, setQuery] = useState(``);
|
|
16
17
|
const innerRef = useRef(null);
|
|
18
|
+
const actionBtn = useMemo(() => _jsx(Button, { tabIndex: -1, onClick: e => handleSubmit(), className: `--send flex aic jcc`, variant: props.variant || Variant.Small, children: query !== `` ?
|
|
19
|
+
!hideClearIcon && (`string` === typeof clearIcon ? _jsx(Icon, { name: clearIcon, as: `--search-action` }) : clearIcon) :
|
|
20
|
+
!hideSearchIcon && (`string` === typeof searchIcon ? _jsx(Icon, { name: searchIcon, as: `--search-action` }) : searchIcon) }), [reverse, searchIcon, hideClearIcon, clearIcon, hideSearchIcon]);
|
|
17
21
|
if (`type` in props) {
|
|
18
22
|
delete props[`type`];
|
|
19
23
|
}
|
|
@@ -38,7 +42,7 @@ const Search = forwardRef((props, ref) => {
|
|
|
38
42
|
value: () => innerRef.current?.value
|
|
39
43
|
}));
|
|
40
44
|
useEffect(() => { }, []);
|
|
41
|
-
return _jsxs(Box, { style: style, className: `--search ${reverse ? `--search-rev` : ``} --${props.variant || Variant.Small} flex aic ${props.as?.includes(`abs`) ? `` : `rel`} ${className}`.trim(), children: [reverse &&
|
|
45
|
+
return _jsxs(Box, { style: style, className: `--search ${reverse ? `--search-rev` : ``} --${props.variant || Variant.Small} flex aic ${props.as?.includes(`abs`) ? `` : `rel`} ${className}`.trim(), children: [reverse && actionBtn, _jsx(Input, { ref: innerRef, onChange: handleChange, className: `--${props.variant || Variant.Small}`, ...pops }), props.shortcut && _jsx(KeyBoardKeys, { keys: props.shortcut, as: `abs` }), !reverse && actionBtn] });
|
|
42
46
|
});
|
|
43
47
|
Search.displayName = `Zuz.Search`;
|
|
44
48
|
export default Search;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
1
2
|
import { KeyCombination } from "../..";
|
|
2
3
|
import { InputProps } from "../Input";
|
|
3
4
|
export type SearchProps = InputProps & {
|
|
@@ -7,6 +8,10 @@ export type SearchProps = InputProps & {
|
|
|
7
8
|
withStyle?: string;
|
|
8
9
|
shortcut?: KeyCombination;
|
|
9
10
|
reverse?: boolean;
|
|
11
|
+
searchIcon?: string | ReactNode;
|
|
12
|
+
hideSearchIcon?: boolean;
|
|
13
|
+
clearIcon?: string | ReactNode;
|
|
14
|
+
hideClearIcon?: boolean;
|
|
10
15
|
};
|
|
11
16
|
export interface SearchHandler {
|
|
12
17
|
focus: () => void;
|
|
@@ -9,5 +9,7 @@ declare const Select: import("react").ForwardRefExoticComponent<Omit<import(".."
|
|
|
9
9
|
onChange?: (v: Option) => void;
|
|
10
10
|
searchPlaceholder?: string;
|
|
11
11
|
maxHeight?: number;
|
|
12
|
+
arrowDownIcon?: string | import("react").ReactNode;
|
|
13
|
+
arrowUpIcon?: string | import("react").ReactNode;
|
|
12
14
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
15
|
export default Select;
|
|
@@ -5,12 +5,13 @@ import { useBase, usePosition } from "../../hooks";
|
|
|
5
5
|
import { Position } from "../../types/enums";
|
|
6
6
|
import Box from "../Box";
|
|
7
7
|
import Button from "../Button";
|
|
8
|
+
import Icon from "../Icon";
|
|
8
9
|
import Input from "../Input";
|
|
9
10
|
import SVGIcons from "../svgicons";
|
|
10
11
|
import Text from "../Text";
|
|
11
12
|
import OptionItem from "./optionItem";
|
|
12
13
|
const Select = forwardRef((props, ref) => {
|
|
13
|
-
const { selected, options, label, name, variant, search: withSearch, searchPlaceholder, maxHeight, onChange, ...pops } = props;
|
|
14
|
+
const { selected, options, label, name, variant, search: withSearch, searchPlaceholder, maxHeight, arrowDownIcon = SVGIcons.arrowDown, arrowUpIcon = SVGIcons.arrowUp, onChange, ...pops } = props;
|
|
14
15
|
const [value, setValue] = useState(selected ?
|
|
15
16
|
typeof selected === `string` ? options.find(fo => fo.value === selected) : selected
|
|
16
17
|
: options[0]);
|
|
@@ -45,7 +46,9 @@ const Select = forwardRef((props, ref) => {
|
|
|
45
46
|
}
|
|
46
47
|
reposition();
|
|
47
48
|
}, [choosing]);
|
|
48
|
-
return _jsxs(Box, { className: `--select ${variant ? `--${variant}` : ``} ${name ? `--${name}` : ``} rel`.trim(), name: _id, children: [_jsxs(Button, { "data-value": value ? `string` == typeof value ? value : value.value : value || `-1`, className: `--selected flex aic rel ${className}`.trim(), withLabel: false, style: style, onClick: (e) => setChoosing(prev => !prev), ...rest, children: [_jsx(Text, { className: `--label`, children: value ? `string` == typeof value ? value : value.label : label || `Choose` }), _jsx(Box, { className: `--svg-arrow rel flex aic jcc`, children: choosing ?
|
|
49
|
+
return _jsxs(Box, { className: `--select ${variant ? `--${variant}` : ``} ${name ? `--${name}` : ``} rel`.trim(), name: _id, children: [_jsxs(Button, { "data-value": value ? `string` == typeof value ? value : value.value : value || `-1`, className: `--selected flex aic rel ${className}`.trim(), withLabel: false, style: style, onClick: (e) => setChoosing(prev => !prev), ...rest, children: [_jsx(Text, { className: `--label`, children: value ? `string` == typeof value ? value : value.label : label || `Choose` }), _jsx(Box, { className: `--svg-arrow rel flex aic jcc`, children: choosing ?
|
|
50
|
+
`string` === typeof arrowUpIcon ? _jsx(Icon, { name: arrowUpIcon, as: `--search-action` }) : arrowUpIcon :
|
|
51
|
+
`string` === typeof arrowDownIcon ? _jsx(Icon, { name: arrowDownIcon, as: `--search-action` }) : arrowDownIcon })] }), _jsxs(Box, { id: _id, className: `--options-list flex cols abs`, "aria-hidden": !choosing, style: {
|
|
49
52
|
maxHeight: maxHeight || `auto`
|
|
50
53
|
}, ref: _pop, fx: {
|
|
51
54
|
from: { y: 5, opacity: 0 },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormEventHandler } from "react";
|
|
1
|
+
import { FormEventHandler, ReactNode } from "react";
|
|
2
2
|
import { FORMVALIDATION, Variant } from "../../types/enums";
|
|
3
3
|
import { BoxProps } from "../Box";
|
|
4
4
|
/**
|
|
@@ -59,4 +59,6 @@ export type SelectProps = Omit<BoxProps, "onChange"> & {
|
|
|
59
59
|
* Max Height
|
|
60
60
|
*/
|
|
61
61
|
maxHeight?: number;
|
|
62
|
+
arrowDownIcon?: string | ReactNode;
|
|
63
|
+
arrowUpIcon?: string | ReactNode;
|
|
62
64
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Size, SPINNER } from "../../types/enums";
|
|
1
|
+
import { Size, SPINNER, Variant } from "../../types/enums";
|
|
2
2
|
import { BoxProps } from "../Box";
|
|
3
3
|
export type SpinnerProps = BoxProps & {
|
|
4
4
|
type?: SPINNER;
|
|
5
5
|
size?: Size | number;
|
|
6
|
+
variant?: Variant | number;
|
|
6
7
|
width?: number;
|
|
7
8
|
color?: string;
|
|
8
9
|
background?: string;
|
|
@@ -12,6 +13,7 @@ export type SpinnerProps = BoxProps & {
|
|
|
12
13
|
declare const Spinner: import("react").ForwardRefExoticComponent<BoxProps & {
|
|
13
14
|
type?: SPINNER;
|
|
14
15
|
size?: Size | number;
|
|
16
|
+
variant?: Variant | number;
|
|
15
17
|
width?: number;
|
|
16
18
|
color?: string;
|
|
17
19
|
background?: string;
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { hexToRgba } from "../../funs";
|
|
4
4
|
import { useBase } from "../../hooks";
|
|
5
|
-
import { Size, SPINNER } from "../../types/enums";
|
|
5
|
+
import { Size, SPINNER, Variant } from "../../types/enums";
|
|
6
6
|
import Box from "../Box";
|
|
7
7
|
const Spinner = forwardRef((props, ref) => {
|
|
8
|
-
const { type, size, width, speed, color, background, foreground, ...pops } = props;
|
|
8
|
+
const { type, size, variant, width, speed, color, background, foreground, ...pops } = props;
|
|
9
9
|
const defaultColor = `#000000`;
|
|
10
10
|
const { className, style, rest } = useBase(pops);
|
|
11
11
|
const build = () => {
|
|
@@ -18,13 +18,20 @@ const Spinner = forwardRef((props, ref) => {
|
|
|
18
18
|
default: 20
|
|
19
19
|
};
|
|
20
20
|
const _size = size ? Object.values(Size).includes(size) ? sizes[size] : size : sizes.default;
|
|
21
|
+
const variants = {
|
|
22
|
+
[Variant.Small]: 20,
|
|
23
|
+
[Variant.Medium]: 30,
|
|
24
|
+
[Variant.Large]: 50,
|
|
25
|
+
default: 20
|
|
26
|
+
};
|
|
27
|
+
const _variant = variant ? Object.values(Variant).includes(variant) ? variants[variant] : variant : variants.default;
|
|
21
28
|
const _animationSetting = {
|
|
22
29
|
animationDuration: `${speed || .6}s`,
|
|
23
30
|
animationTimingFunction: `linear`
|
|
24
31
|
};
|
|
25
32
|
const _props = (type || SPINNER.Simple) == SPINNER.Simple ? {
|
|
26
|
-
width: _size,
|
|
27
|
-
height: _size,
|
|
33
|
+
width: _variant || _size,
|
|
34
|
+
height: _variant || _size,
|
|
28
35
|
border: `${width || 3}px solid ${bg}`,
|
|
29
36
|
borderRadius: `50%`,
|
|
30
37
|
borderTopColor: c,
|
|
@@ -308,11 +308,13 @@ export const cssDirect = {
|
|
|
308
308
|
"translate": "transform: translate(__VALUE__);",
|
|
309
309
|
"translateX": "transform: translateX(__VALUE__);",
|
|
310
310
|
"translateY": "transform: translateY(__VALUE__);",
|
|
311
|
+
"translateZ": "transform: translateZ(__VALUE__);",
|
|
311
312
|
"x": "transform: translateX(__VALUE__);",
|
|
312
313
|
"y": "transform: translateY(__VALUE__);",
|
|
314
|
+
"z": "transform: translateZ(__VALUE__);",
|
|
313
315
|
"rotate": "transform: rotate(__VALUE__);",
|
|
314
316
|
"rotateX": "transform: rotateX(__VALUE__);",
|
|
315
|
-
"rotateY": "transform:
|
|
317
|
+
"rotateY": "transform: rotateY(__VALUE__);",
|
|
316
318
|
"rotateZ": "transform: rotateZ(__VALUE__);",
|
|
317
319
|
"rotate3d": "transform: rotate3d(__X__, __Y__, __Z__, __A__);",
|
|
318
320
|
"scale": "transform: scale(__VALUE__);",
|