@zuzjs/ui 0.7.6 → 0.7.8
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/Accordion/index.js +2 -1
- package/dist/cjs/comps/Actionbar/index.d.ts +1 -1
- package/dist/cjs/comps/Actionbar/index.js +3 -2
- package/dist/cjs/comps/Alert/index.d.ts +1 -1
- package/dist/cjs/comps/Alert/index.js +1 -0
- package/dist/cjs/comps/AutoComplete/index.js +4 -3
- package/dist/cjs/comps/Avatar/index.js +3 -2
- package/dist/cjs/comps/Box/index.js +1 -1
- package/dist/cjs/comps/Button/index.d.ts +1 -1
- package/dist/cjs/comps/Button/index.js +4 -3
- package/dist/cjs/comps/CheckBox/index.d.ts +2 -2
- package/dist/cjs/comps/CheckBox/index.js +2 -1
- package/dist/cjs/comps/ColorScheme/index.d.ts +1 -1
- package/dist/cjs/comps/ColorScheme/index.js +7 -2
- package/dist/cjs/comps/ContextMenu/index.js +3 -2
- package/dist/cjs/comps/CookiesConsent/index.js +3 -2
- package/dist/cjs/comps/Cover/index.d.ts +1 -1
- package/dist/cjs/comps/Cover/index.js +3 -2
- package/dist/cjs/comps/Drawer/index.d.ts +2 -1
- package/dist/cjs/comps/Drawer/index.js +13 -5
- package/dist/cjs/comps/Drawer/types.d.ts +1 -0
- package/dist/cjs/comps/Editor/Timeline/index.js +4 -3
- package/dist/cjs/comps/Editor/index.js +2 -1
- package/dist/cjs/comps/Fab/index.d.ts +1 -2
- package/dist/cjs/comps/Fab/index.js +2 -1
- package/dist/cjs/comps/Filters/index.d.ts +4 -1
- package/dist/cjs/comps/Filters/index.js +2 -0
- package/dist/cjs/comps/Form/index.d.ts +2 -2
- package/dist/cjs/comps/Form/index.js +5 -7
- package/dist/cjs/comps/Icon/index.d.ts +1 -1
- package/dist/cjs/comps/Icon/index.js +2 -1
- package/dist/cjs/comps/Image/index.js +1 -0
- package/dist/cjs/comps/Input/index.js +1 -0
- package/dist/cjs/comps/Label/index.js +1 -0
- package/dist/cjs/comps/List/index.d.ts +1 -1
- package/dist/cjs/comps/List/index.js +1 -0
- package/dist/cjs/comps/List/item.d.ts +6 -3
- package/dist/cjs/comps/List/item.js +1 -0
- package/dist/cjs/comps/Network/index.js +4 -3
- package/dist/cjs/comps/Overlay/index.js +2 -1
- package/dist/cjs/comps/Pagination/index.d.ts +5 -2
- package/dist/cjs/comps/Pagination/index.js +24 -13
- package/dist/cjs/comps/Pagination/types.d.ts +5 -2
- package/dist/cjs/comps/Password/index.js +2 -1
- package/dist/cjs/comps/PinInput/index.js +2 -1
- package/dist/cjs/comps/ProgressBar/index.d.ts +1 -1
- package/dist/cjs/comps/ProgressBar/index.js +3 -1
- package/dist/cjs/comps/Radio/index.d.ts +2 -2
- package/dist/cjs/comps/Radio/index.js +8 -5
- package/dist/cjs/comps/Radio/types.d.ts +1 -1
- package/dist/cjs/comps/Search/index.d.ts +1 -1
- package/dist/cjs/comps/Search/index.js +3 -2
- package/dist/cjs/comps/Segmented/index.d.ts +2 -2
- package/dist/cjs/comps/Segmented/index.js +4 -4
- package/dist/cjs/comps/Segmented/item.d.ts +4 -1
- package/dist/cjs/comps/Segmented/item.js +8 -15
- package/dist/cjs/comps/Select/index.d.ts +2 -4
- package/dist/cjs/comps/Select/index.js +4 -3
- package/dist/cjs/comps/Select/optionItem.d.ts +4 -1
- package/dist/cjs/comps/Select/optionItem.js +1 -0
- package/dist/cjs/comps/Sheet/index.d.ts +1 -1
- package/dist/cjs/comps/Sheet/index.js +4 -3
- package/dist/cjs/comps/Sidebar/index.js +1 -0
- package/dist/cjs/comps/Slider/index.d.ts +1 -1
- package/dist/cjs/comps/Slider/index.js +3 -2
- package/dist/cjs/comps/Span/index.js +1 -0
- package/dist/cjs/comps/Spinner/index.d.ts +1 -1
- package/dist/cjs/comps/Spinner/index.js +4 -6
- package/dist/cjs/comps/Switch/index.d.ts +1 -1
- package/dist/cjs/comps/Switch/index.js +2 -1
- package/dist/cjs/comps/TabView/body.js +1 -0
- package/dist/cjs/comps/TabView/index.d.ts +1 -2
- package/dist/cjs/comps/TabView/index.js +3 -1
- package/dist/cjs/comps/TabView/tab.d.ts +4 -1
- package/dist/cjs/comps/TabView/tab.js +1 -0
- package/dist/cjs/comps/Table/col.d.ts +10 -6
- package/dist/cjs/comps/Table/col.js +17 -4
- package/dist/cjs/comps/Table/index.js +13 -6
- package/dist/cjs/comps/Table/row.d.ts +4 -1
- package/dist/cjs/comps/Table/row.js +8 -7
- package/dist/cjs/comps/Table/types.d.ts +11 -4
- package/dist/cjs/comps/Text/index.js +1 -1
- package/dist/cjs/comps/TextArea/index.js +1 -0
- package/dist/cjs/comps/TextWheel/index.js +6 -5
- package/dist/cjs/comps/Tooltip/index.d.ts +1 -2
- package/dist/cjs/comps/Tooltip/index.js +2 -1
- package/dist/cjs/comps/Treeview/index.d.ts +1 -2
- package/dist/cjs/comps/Treeview/index.js +2 -1
- package/dist/cjs/comps/Treeview/item.d.ts +3 -2
- package/dist/cjs/comps/Treeview/item.js +11 -7
- package/dist/cjs/comps/Treeview/types.d.ts +6 -2
- package/dist/cjs/funs/index.d.ts +9 -7
- package/dist/cjs/funs/index.js +40 -12
- package/dist/cjs/hooks/index.d.ts +4 -5
- package/dist/cjs/hooks/index.js +2 -2
- package/dist/cjs/hooks/useDelayed.d.ts +17 -0
- package/dist/cjs/hooks/useDelayed.js +25 -0
- package/dist/cjs/index.js +1 -0
- package/dist/css/styles.css +1 -1
- package/dist/esm/comps/Accordion/index.js +2 -1
- package/dist/esm/comps/Actionbar/index.d.ts +1 -1
- package/dist/esm/comps/Actionbar/index.js +3 -2
- package/dist/esm/comps/Alert/index.d.ts +1 -1
- package/dist/esm/comps/Alert/index.js +1 -0
- package/dist/esm/comps/AutoComplete/index.js +4 -3
- package/dist/esm/comps/Avatar/index.js +3 -2
- package/dist/esm/comps/Box/index.js +1 -1
- package/dist/esm/comps/Button/index.d.ts +1 -1
- package/dist/esm/comps/Button/index.js +4 -3
- package/dist/esm/comps/CheckBox/index.d.ts +2 -2
- package/dist/esm/comps/CheckBox/index.js +2 -1
- package/dist/esm/comps/ColorScheme/index.d.ts +1 -1
- package/dist/esm/comps/ColorScheme/index.js +7 -2
- package/dist/esm/comps/ContextMenu/index.js +3 -2
- package/dist/esm/comps/CookiesConsent/index.js +3 -2
- package/dist/esm/comps/Cover/index.d.ts +1 -1
- package/dist/esm/comps/Cover/index.js +3 -2
- package/dist/esm/comps/Drawer/index.d.ts +2 -1
- package/dist/esm/comps/Drawer/index.js +13 -5
- package/dist/esm/comps/Drawer/types.d.ts +1 -0
- package/dist/esm/comps/Editor/Timeline/index.js +4 -3
- package/dist/esm/comps/Editor/index.js +2 -1
- package/dist/esm/comps/Fab/index.d.ts +1 -2
- package/dist/esm/comps/Fab/index.js +2 -1
- package/dist/esm/comps/Filters/index.d.ts +4 -1
- package/dist/esm/comps/Filters/index.js +2 -0
- package/dist/esm/comps/Form/index.d.ts +2 -2
- package/dist/esm/comps/Form/index.js +5 -7
- package/dist/esm/comps/Icon/index.d.ts +1 -1
- package/dist/esm/comps/Icon/index.js +2 -1
- package/dist/esm/comps/Image/index.js +1 -0
- package/dist/esm/comps/Input/index.js +1 -0
- package/dist/esm/comps/Label/index.js +1 -0
- package/dist/esm/comps/List/index.d.ts +1 -1
- package/dist/esm/comps/List/index.js +1 -0
- package/dist/esm/comps/List/item.d.ts +6 -3
- package/dist/esm/comps/List/item.js +1 -0
- package/dist/esm/comps/Network/index.js +4 -3
- package/dist/esm/comps/Overlay/index.js +2 -1
- package/dist/esm/comps/Pagination/index.d.ts +5 -2
- package/dist/esm/comps/Pagination/index.js +24 -13
- package/dist/esm/comps/Pagination/types.d.ts +5 -2
- package/dist/esm/comps/Password/index.js +2 -1
- package/dist/esm/comps/PinInput/index.js +2 -1
- package/dist/esm/comps/ProgressBar/index.d.ts +1 -1
- package/dist/esm/comps/ProgressBar/index.js +3 -1
- package/dist/esm/comps/Radio/index.d.ts +2 -2
- package/dist/esm/comps/Radio/index.js +8 -5
- package/dist/esm/comps/Radio/types.d.ts +1 -1
- package/dist/esm/comps/Search/index.d.ts +1 -1
- package/dist/esm/comps/Search/index.js +3 -2
- package/dist/esm/comps/Segmented/index.d.ts +2 -2
- package/dist/esm/comps/Segmented/index.js +4 -4
- package/dist/esm/comps/Segmented/item.d.ts +4 -1
- package/dist/esm/comps/Segmented/item.js +8 -15
- package/dist/esm/comps/Select/index.d.ts +2 -4
- package/dist/esm/comps/Select/index.js +4 -3
- package/dist/esm/comps/Select/optionItem.d.ts +4 -1
- package/dist/esm/comps/Select/optionItem.js +1 -0
- package/dist/esm/comps/Sheet/index.d.ts +1 -1
- package/dist/esm/comps/Sheet/index.js +4 -3
- package/dist/esm/comps/Sidebar/index.js +1 -0
- package/dist/esm/comps/Slider/index.d.ts +1 -1
- package/dist/esm/comps/Slider/index.js +3 -2
- package/dist/esm/comps/Span/index.js +1 -0
- package/dist/esm/comps/Spinner/index.d.ts +1 -1
- package/dist/esm/comps/Spinner/index.js +4 -6
- package/dist/esm/comps/Switch/index.d.ts +1 -1
- package/dist/esm/comps/Switch/index.js +2 -1
- package/dist/esm/comps/TabView/body.js +1 -0
- package/dist/esm/comps/TabView/index.d.ts +1 -2
- package/dist/esm/comps/TabView/index.js +3 -1
- package/dist/esm/comps/TabView/tab.d.ts +4 -1
- package/dist/esm/comps/TabView/tab.js +1 -0
- package/dist/esm/comps/Table/col.d.ts +10 -6
- package/dist/esm/comps/Table/col.js +17 -4
- package/dist/esm/comps/Table/index.js +13 -6
- package/dist/esm/comps/Table/row.d.ts +4 -1
- package/dist/esm/comps/Table/row.js +8 -7
- package/dist/esm/comps/Table/types.d.ts +11 -4
- package/dist/esm/comps/Text/index.js +1 -1
- package/dist/esm/comps/TextArea/index.js +1 -0
- package/dist/esm/comps/TextWheel/index.js +6 -5
- package/dist/esm/comps/Tooltip/index.d.ts +1 -2
- package/dist/esm/comps/Tooltip/index.js +2 -1
- package/dist/esm/comps/Treeview/index.d.ts +1 -2
- package/dist/esm/comps/Treeview/index.js +2 -1
- package/dist/esm/comps/Treeview/item.d.ts +3 -2
- package/dist/esm/comps/Treeview/item.js +11 -7
- package/dist/esm/comps/Treeview/types.d.ts +6 -2
- package/dist/esm/funs/index.d.ts +9 -7
- package/dist/esm/funs/index.js +40 -12
- package/dist/esm/hooks/index.d.ts +4 -5
- package/dist/esm/hooks/index.js +2 -2
- package/dist/esm/hooks/useDelayed.d.ts +17 -0
- package/dist/esm/hooks/useDelayed.js +25 -0
- package/dist/esm/index.js +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef, useCallback, useMemo, useState } from "react";
|
|
3
|
-
import {
|
|
4
|
+
import { numberInRange, toHash } from "../..";
|
|
4
5
|
import { useBase } from "../../hooks";
|
|
5
6
|
import Box from "../Box";
|
|
6
7
|
import Button from "../Button";
|
|
7
8
|
import SVGIcons from "../svgicons";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
9
|
+
import { PaginationStyle } from "./types";
|
|
10
|
+
const Pagination = forwardRef((props, _ref) => {
|
|
11
|
+
const { itemCount, itemsPerPage, startPage, pageRange, paginationStyle, breakLabel, prevLabel, nextLabel, hash, loading, seperator, renderOnZeroPageCount, onPageChange, ...pops } = props;
|
|
12
|
+
const _hashKey = useMemo(() => toHash(numberInRange(4, 8)), []);
|
|
13
|
+
const _hash = useCallback((input) => `${toHash(input, hash || 6, _hashKey)}${seperator || ``}${_hashKey}`, [_hashKey]);
|
|
11
14
|
const _breakLabel = useMemo(() => breakLabel || `...`, [breakLabel]);
|
|
15
|
+
const [_currentPage, setCurrentPage] = useState({
|
|
16
|
+
id: hash ?
|
|
17
|
+
startPage ? `number` == typeof startPage ? _hash(startPage) : startPage
|
|
18
|
+
: 1 : startPage || 1,
|
|
19
|
+
label: startPage || 1
|
|
20
|
+
});
|
|
12
21
|
/**
|
|
13
22
|
* @internal
|
|
14
23
|
* const _pageType = useMemo(() => startPage ? `number` === startPage, [breakLabel])
|
|
@@ -25,28 +34,30 @@ const Pagination = forwardRef((props, ref) => {
|
|
|
25
34
|
const prevs = Math.max(getPageValue(_currentPage) - (pageRange || 2), 1);
|
|
26
35
|
const nexts = Math.min(getPageValue(_currentPage) + (pageRange || 2), totalPages);
|
|
27
36
|
if (prevs > 1)
|
|
28
|
-
_pages.push(1);
|
|
37
|
+
_pages.push({ id: hash ? _hash(1) : 1, label: 1 });
|
|
29
38
|
if (prevs > 2)
|
|
30
|
-
_pages.push(_breakLabel);
|
|
39
|
+
_pages.push({ id: -1, label: _breakLabel });
|
|
31
40
|
for (let i = prevs; i <= nexts; i++)
|
|
32
|
-
_pages.push(i);
|
|
41
|
+
_pages.push({ id: hash ? _hash(i) : i, label: i });
|
|
33
42
|
if (nexts < totalPages - 1)
|
|
34
|
-
_pages.push(_breakLabel);
|
|
43
|
+
_pages.push({ id: -1, label: _breakLabel });
|
|
35
44
|
if (nexts < totalPages)
|
|
36
|
-
_pages.push(totalPages);
|
|
45
|
+
_pages.push({ id: hash ? _hash(totalPages) : totalPages, label: totalPages });
|
|
37
46
|
return _pages;
|
|
38
47
|
}, [_currentPage]);
|
|
39
|
-
const handlePage = useCallback((
|
|
40
|
-
|
|
48
|
+
const handlePage = useCallback((_newPage) => {
|
|
49
|
+
const newPage = _newPage;
|
|
50
|
+
if (+newPage.label < 1 || +newPage.label > totalPages)
|
|
41
51
|
return;
|
|
42
52
|
setCurrentPage(newPage);
|
|
43
53
|
onPageChange?.(newPage);
|
|
44
54
|
}, [itemCount, itemsPerPage, _currentPage]);
|
|
45
55
|
if (pages.length <= 1 && ((renderOnZeroPageCount == undefined ? false : renderOnZeroPageCount) === false))
|
|
46
56
|
return null;
|
|
47
|
-
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 : [1, _breakLabel]).map((page, index, items) => _jsx(Button, { disabled: page ==
|
|
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: [
|
|
48
58
|
`Showing ${(getPageValue(_currentPage) - 1) * itemsPerPage + 1} - `,
|
|
49
59
|
`${Math.min(getPageValue(_currentPage) * itemsPerPage, itemCount)} of ${itemCount} items`
|
|
50
|
-
].join(` `) }), _jsxs(Box, { as: `flex aic jce flex:1 --pgt-btns --pgt-nav`, children: [_jsx(Button, { disabled: getPageValue(_currentPage) <= 1, onClick: (ev) => handlePage(getPageValue(_currentPage) - 1), children: SVGIcons.chevronLeftOutline }), _jsx(Button, { disabled: pages.length <= 1 || getPageValue(_currentPage) == pages[pages.length - 1], onClick: (ev) => handlePage(getPageValue(_currentPage)
|
|
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 })] })] });
|
|
51
61
|
});
|
|
62
|
+
Pagination.displayName = `Pagination`;
|
|
52
63
|
export default Pagination;
|
|
@@ -8,13 +8,16 @@ export type PaginationPageItem = {
|
|
|
8
8
|
label: string | number;
|
|
9
9
|
};
|
|
10
10
|
export type PaginationPage = number | PaginationPageItem;
|
|
11
|
-
export type PaginationCallback = (page:
|
|
11
|
+
export type PaginationCallback = (page: PaginationPageItem) => void;
|
|
12
12
|
export type PaginationProps = BoxProps & {
|
|
13
13
|
itemCount: number;
|
|
14
14
|
itemsPerPage: number;
|
|
15
|
-
startPage?:
|
|
15
|
+
startPage?: number | string;
|
|
16
16
|
pageRange?: number;
|
|
17
17
|
paginationStyle?: PaginationStyle;
|
|
18
|
+
hash?: number | null;
|
|
19
|
+
seperator?: string;
|
|
20
|
+
loading?: boolean;
|
|
18
21
|
breakLabel?: string;
|
|
19
22
|
nextLabel?: string;
|
|
20
23
|
prevLabel?: string;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useState } from 'react';
|
|
4
4
|
import { useBase } from '../../hooks';
|
|
5
|
-
import Input from '../Input';
|
|
6
5
|
import Box from '../Box';
|
|
7
6
|
import Button from '../Button';
|
|
7
|
+
import Input from '../Input';
|
|
8
8
|
import SVGIcons from '../svgicons';
|
|
9
9
|
const Password = forwardRef((props, ref) => {
|
|
10
10
|
const { ...pops } = props;
|
|
@@ -15,4 +15,5 @@ const Password = forwardRef((props, ref) => {
|
|
|
15
15
|
const [visible, setVisible] = useState(false);
|
|
16
16
|
return _jsxs(Box, { style: style, className: `--password flex aic rel`, children: [_jsx(Input, { ref: ref, type: visible ? 'text' : 'password', className: className, ...rest }), _jsx(Button, { tabIndex: -1, onClick: () => setVisible(prev => !prev), className: `--toggle flex aic jcc abs`, children: visible ? SVGIcons.eye : SVGIcons.eyeSlash })] });
|
|
17
17
|
});
|
|
18
|
+
Password.displayName = `Password`;
|
|
18
19
|
export default Password;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useEffect, useRef } from 'react';
|
|
4
4
|
import { useBase } from '../../hooks';
|
|
5
|
-
import Input from '../Input';
|
|
6
5
|
import Box from '../Box';
|
|
6
|
+
import Input from '../Input';
|
|
7
7
|
const PinInput = forwardRef((props, ref) => {
|
|
8
8
|
const { size, length, mask, ...pops } = props;
|
|
9
9
|
const inputs = useRef([]);
|
|
@@ -39,4 +39,5 @@ const PinInput = forwardRef((props, ref) => {
|
|
|
39
39
|
inputs.current[i] = el;
|
|
40
40
|
}, numeric: true, onChange: handleInput, maxLength: 1, placeholder: `0`, type: mask ? `password` : 'text', ...pops }, `pin-${i}`)) });
|
|
41
41
|
});
|
|
42
|
+
PinInput.displayName = `PinInput`;
|
|
42
43
|
export default PinInput;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
|
|
3
|
-
import Box from "../Box";
|
|
4
4
|
import { useBase } from "../../hooks";
|
|
5
|
+
import Box from "../Box";
|
|
5
6
|
const ProgressBar = forwardRef((props, ref) => {
|
|
6
7
|
const { progress, type, ...pops } = props;
|
|
7
8
|
const bar = useRef(null);
|
|
@@ -18,4 +19,5 @@ const ProgressBar = forwardRef((props, ref) => {
|
|
|
18
19
|
const { className, style, rest } = useBase(pops);
|
|
19
20
|
return _jsx(Box, { className: `--progress flex rel ${className}`.trim(), style: style, ...rest, children: _jsx(Box, { ref: bar, className: `--bar rel` }) });
|
|
20
21
|
});
|
|
22
|
+
ProgressBar.displayName = `ProgressBar`;
|
|
21
23
|
export default ProgressBar;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { RadioHandler } from "./types";
|
|
2
1
|
import { RADIO, Size } from "../../types/enums";
|
|
2
|
+
import { RadioHandler } from "./types";
|
|
3
3
|
declare const Radio: import("react").ForwardRefExoticComponent<import("../..").ZuzProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, keyof import("../..").ZuzProps> & {
|
|
4
4
|
type?: RADIO;
|
|
5
5
|
size?: Size;
|
|
6
|
-
|
|
6
|
+
onSwitch?: (checked: boolean, value: string | number | readonly string[]) => void;
|
|
7
7
|
} & import("react").RefAttributes<RadioHandler>>;
|
|
8
8
|
export default Radio;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef, useRef, useState } from "react";
|
|
3
|
-
import Label from "../Label";
|
|
4
4
|
import { RADIO, Size } from "../../types/enums";
|
|
5
|
-
import Input from "../Input";
|
|
6
5
|
import Box from "../Box";
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import Input from "../Input";
|
|
7
|
+
import Label from "../Label";
|
|
8
|
+
const Radio = forwardRef((props, _ref) => {
|
|
9
|
+
const { children, className, name, required, type, value, size, checked: defaultCheck, onSwitch, ...pops } = props;
|
|
9
10
|
const [checked, _setChecked] = useState(defaultCheck || false);
|
|
10
11
|
const bRef = useRef(null);
|
|
11
12
|
return _jsxs(Label, { className: `${className} --${(type || RADIO.Default).toLowerCase()} --radio${!type || type == RADIO.Default ? `` : `card`} --${size || Size.Default} flex aic rel`.trim(), ...pops, children: [_jsx(Input, { ...{}, ref: bRef, defaultChecked: checked, value: value || `rd`, type: `radio`, className: `abs`, name: name, required: required || false, onChange: (e) => {
|
|
12
|
-
|
|
13
|
+
if (onSwitch)
|
|
14
|
+
onSwitch(e.target.checked, value || `cb`);
|
|
13
15
|
_setChecked(e.target.checked);
|
|
14
16
|
} }), _jsx(Box, { className: `--dot rel`, children: _jsx(Box, { className: `--rod abs abc` }) }), _jsx(Box, { className: `--value`, children: children })] });
|
|
15
17
|
});
|
|
18
|
+
Radio.displayName = `Radio`;
|
|
16
19
|
export default Radio;
|
|
@@ -3,7 +3,7 @@ import { RADIO, Size } from "../../types/enums";
|
|
|
3
3
|
export type RadioProps = Props<"input"> & {
|
|
4
4
|
type?: RADIO;
|
|
5
5
|
size?: Size;
|
|
6
|
-
|
|
6
|
+
onSwitch?: (checked: boolean, value: string | number | readonly string[]) => void;
|
|
7
7
|
};
|
|
8
8
|
export interface RadioHandler {
|
|
9
9
|
setChecked: (mode: boolean, triggerChange?: boolean) => void;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { useBase } from '../../hooks';
|
|
5
|
-
import
|
|
5
|
+
import { Size } from '../../types/enums';
|
|
6
6
|
import Box from '../Box';
|
|
7
7
|
import Button from '../Button';
|
|
8
|
+
import Input from '../Input';
|
|
8
9
|
import SVGIcons from '../svgicons';
|
|
9
|
-
import { Size } from '../../types/enums';
|
|
10
10
|
const Search = forwardRef((props, ref) => {
|
|
11
11
|
const { animate, withStyle, onChange, ...pops } = props;
|
|
12
12
|
const { style } = useBase(pops);
|
|
@@ -34,4 +34,5 @@ const Search = forwardRef((props, ref) => {
|
|
|
34
34
|
useEffect(() => { }, []);
|
|
35
35
|
return _jsxs(Box, { style: style, className: `--search --${props.size || Size.Small} flex aic rel ${searchStyle}`.trim(), children: [_jsx(Input, { ref: innerRef, onChange: handleChange, className: `--${props.size || Size.Small}`, ...pops }), _jsx(Button, { tabIndex: -1, onClick: e => handleSubmit(), className: `--send flex aic jcc abs`, size: props.size || Size.Small, children: query !== `` ? SVGIcons.close : SVGIcons.search })] });
|
|
36
36
|
});
|
|
37
|
+
Search.displayName = `Search`;
|
|
37
38
|
export default Search;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Segment } from "./types";
|
|
2
|
-
import { BoxProps } from "../Box";
|
|
3
1
|
import { Size } from "../../types/enums";
|
|
2
|
+
import { BoxProps } from "../Box";
|
|
3
|
+
import { Segment } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* `SelectTabs` component is a segmented control that allows switching between segments.
|
|
6
6
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { useBase } from "../../hooks";
|
|
4
|
+
import { Size } from "../../types/enums";
|
|
4
5
|
import Box from "../Box";
|
|
5
6
|
import SegmentItem from "./item";
|
|
6
|
-
import { Size } from "../../types/enums";
|
|
7
7
|
/**
|
|
8
8
|
* `SelectTabs` component is a segmented control that allows switching between segments.
|
|
9
9
|
*
|
|
@@ -23,12 +23,11 @@ import { Size } from "../../types/enums";
|
|
|
23
23
|
* <SelectTabs selected={1} items={segments} />
|
|
24
24
|
*/
|
|
25
25
|
const Segmented = forwardRef((props, ref) => {
|
|
26
|
-
const { animate, items, selected, size, onSwitch, ...pops } = props;
|
|
26
|
+
const { animate, fx, items, selected, size, onSwitch, ...pops } = props;
|
|
27
27
|
const [_selected, setSelected] = useState(selected || 0);
|
|
28
28
|
const { className, style, rest } = useBase(pops);
|
|
29
29
|
const _tab = useRef(null);
|
|
30
30
|
const _segmented = useRef(null);
|
|
31
|
-
const [mounted, setMounted] = useState(false);
|
|
32
31
|
/**
|
|
33
32
|
* Handles selection of a segment.
|
|
34
33
|
*
|
|
@@ -54,9 +53,10 @@ const Segmented = forwardRef((props, ref) => {
|
|
|
54
53
|
setSelected(selected);
|
|
55
54
|
}
|
|
56
55
|
}, [selected, _selected]);
|
|
57
|
-
return _jsxs(Box, {
|
|
56
|
+
return _jsxs(Box, { ref: _segmented, "data-selected": _selected, className: `${className} --segmented --${size || Size.Small} flex aic rel`, style: style, ...rest, children: [_jsx(Box, { ref: _tab, className: `--segment-tab abs` }), items.map((item, i) => _jsx(SegmentItem, { onSelect: handleSelect, selected: _selected == i, meta: {
|
|
58
57
|
...item,
|
|
59
58
|
index: i
|
|
60
59
|
} }, `segment-${item.label}-${i}`))] });
|
|
61
60
|
});
|
|
61
|
+
Segmented.displayName = `SelectTabs`;
|
|
62
62
|
export default Segmented;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { SegmentItemProps } from "./types";
|
|
2
|
-
declare const SegmentItem:
|
|
2
|
+
declare const SegmentItem: {
|
|
3
|
+
({ onSelect, meta, selected }: SegmentItemProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
3
6
|
export default SegmentItem;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { useDelayed } from "../..";
|
|
3
4
|
import Box from "../Box";
|
|
4
5
|
import Button from "../Button";
|
|
5
6
|
import Icon from "../Icon";
|
|
@@ -7,32 +8,24 @@ const SegmentItem = ({ onSelect, meta, selected }) => {
|
|
|
7
8
|
const ref = useRef(null);
|
|
8
9
|
const { index, icon, label } = meta;
|
|
9
10
|
const [pos, setPos] = useState({ x: 0, width: 0 });
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (ref.current) {
|
|
11
|
+
const hydrated = useDelayed();
|
|
12
|
+
useLayoutEffect(() => {
|
|
13
|
+
if (hydrated && ref.current) {
|
|
13
14
|
const { width, x } = ref.current.getBoundingClientRect();
|
|
14
15
|
setPos({ x, width });
|
|
15
16
|
if (selected) {
|
|
16
17
|
onSelect(index, width, x, meta, true);
|
|
17
|
-
// setSelected(meta.index)
|
|
18
18
|
}
|
|
19
|
-
// if ( selected && !_initial ){
|
|
20
|
-
// ref.current.click()
|
|
21
|
-
// setInitial(true)
|
|
22
|
-
// }
|
|
23
19
|
}
|
|
24
|
-
|
|
25
|
-
// setInitial(false)
|
|
26
|
-
}, [ref.current]);
|
|
20
|
+
}, [hydrated, ref.current]);
|
|
27
21
|
useEffect(() => {
|
|
28
22
|
if (selected) {
|
|
29
23
|
onSelect(index, pos.width, pos.x, meta, false);
|
|
30
24
|
}
|
|
31
25
|
}, [selected]);
|
|
32
|
-
return _jsxs(Button, { onClick: () => onSelect(index, pos.width, pos.x, meta, false), ref: ref,
|
|
33
|
-
// data-x={pos.x}
|
|
34
|
-
suppressHydrationWarning: true, className: `--segment-item flex aic rel ${selected ? `--segement-active` : ``}`.trim(), children: [icon ?
|
|
26
|
+
return _jsxs(Button, { onClick: () => onSelect(index, pos.width, pos.x, meta, false), ref: ref, className: `--segment-item flex aic rel ${selected ? `--segement-active` : ``}`.trim(), children: [icon ?
|
|
35
27
|
`string` == typeof icon ? _jsx(Icon, { name: icon, as: `--segment-icon` }) : _jsx(Box, { as: `--segment-icon flex aic jcc`, children: icon })
|
|
36
28
|
: null, label && String(label).trim() != `` && _jsx(Box, { className: `--segment-label`, children: label || `Item ${index}` })] });
|
|
37
29
|
};
|
|
30
|
+
SegmentItem.displayName = `SelectTabItem`;
|
|
38
31
|
export default SegmentItem;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { FORMVALIDATION } from "../../types/enums";
|
|
2
|
-
import { BoxProps } from "../Box";
|
|
3
1
|
import { Option } from "./types";
|
|
4
|
-
declare const Select: import("react").ForwardRefExoticComponent<BoxProps & {
|
|
5
|
-
required?: FORMVALIDATION;
|
|
2
|
+
declare const Select: import("react").ForwardRefExoticComponent<import("..").BoxProps & {
|
|
3
|
+
required?: import("../..").FORMVALIDATION;
|
|
6
4
|
options: Option[];
|
|
7
5
|
label?: string;
|
|
8
6
|
selected?: string | Option;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
4
|
-
import SVGIcons from "../svgicons";
|
|
5
|
-
import Box from "../Box";
|
|
6
4
|
import { useBase } from "../../hooks";
|
|
5
|
+
import Box from "../Box";
|
|
7
6
|
import Button from "../Button";
|
|
8
|
-
import Text from "../Text";
|
|
9
7
|
import Input from "../Input";
|
|
8
|
+
import SVGIcons from "../svgicons";
|
|
9
|
+
import Text from "../Text";
|
|
10
10
|
import OptionItem from "./optionItem";
|
|
11
11
|
const Select = forwardRef((props, ref) => {
|
|
12
12
|
const { selected, options, label, name, search: withSearch, searchPlaceholder, onChange, ...pops } = props;
|
|
@@ -58,4 +58,5 @@ const Select = forwardRef((props, ref) => {
|
|
|
58
58
|
}))
|
|
59
59
|
.map((o) => _jsx(OptionItem, { updateValue: updateValue, value: value, o: o }, `option-${(`string` == typeof o ? o : o.label).replace(/\s+/g, `-`)}-${`string` == typeof o ? o : o.value}`))] })] });
|
|
60
60
|
});
|
|
61
|
+
Select.displayName = `Select`;
|
|
61
62
|
export default Select;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { OptionItemProps } from "./types";
|
|
2
|
-
declare const OptionItem:
|
|
2
|
+
declare const OptionItem: {
|
|
3
|
+
({ value, updateValue, o }: OptionItemProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
3
6
|
export default OptionItem;
|
|
@@ -3,4 +3,5 @@ import Button from "../Button";
|
|
|
3
3
|
const OptionItem = ({ value, updateValue, o }) => {
|
|
4
4
|
return _jsx(Button, { onClick: (e) => updateValue(o), className: value && (`string` == typeof o ? o : o.value) == (`string` == typeof value ? value : value.value) ? `selected` : ``, children: `string` == typeof o ? o : o.label });
|
|
5
5
|
};
|
|
6
|
+
OptionItem.displayName = `Option`;
|
|
6
7
|
export default OptionItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { SHEET, SHEET_ACTION_POSITION, SPINNER, TRANSITION_CURVES, TRANSITIONS } from "../../types/enums";
|
|
3
2
|
import { ZuzProps } from "../../types";
|
|
3
|
+
import { SHEET, SHEET_ACTION_POSITION, SPINNER, TRANSITION_CURVES, TRANSITIONS } from "../../types/enums";
|
|
4
4
|
export type SheetProps = ZuzProps & {
|
|
5
5
|
title?: string;
|
|
6
6
|
message?: string | ReactNode;
|
|
@@ -1,11 +1,11 @@
|
|
|
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 { SHEET, SHEET_ACTION_POSITION, TRANSITION_CURVES } from "../../types/enums";
|
|
5
|
-
import Box from "../Box";
|
|
6
|
-
import { useBase } from "../../hooks";
|
|
7
4
|
import { uuid } from "../../funs";
|
|
8
5
|
import { animationTransition } from "../../funs/css";
|
|
6
|
+
import { useBase } from "../../hooks";
|
|
7
|
+
import { SHEET, SHEET_ACTION_POSITION, TRANSITION_CURVES } from "../../types/enums";
|
|
8
|
+
import Box from "../Box";
|
|
9
9
|
import Button from "../Button";
|
|
10
10
|
import Cover from "../Cover";
|
|
11
11
|
import Overlay from "../Overlay";
|
|
@@ -184,4 +184,5 @@ export const isSheetHandler = (src) => {
|
|
|
184
184
|
&& `success` in src
|
|
185
185
|
&& `error` in src;
|
|
186
186
|
};
|
|
187
|
+
Sheet.displayName = `Sheet`;
|
|
187
188
|
export default Sheet;
|
|
@@ -5,4 +5,5 @@ const Sidebar = forwardRef((props, ref) => {
|
|
|
5
5
|
const { layout, logo } = props;
|
|
6
6
|
return _jsxs(Box, { ref: ref, className: `--sidebar --${layout || `2-columns`} flex cols`, children: [_jsx(Box, { as: `--logo`, children: logo }), _jsx(Box, { as: `--nav flex cols` })] });
|
|
7
7
|
});
|
|
8
|
+
Sidebar.displayName = `Sidebar`;
|
|
8
9
|
export default Sidebar;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useEffect, useRef, useState } from "react";
|
|
4
|
-
import Box from "../Box";
|
|
5
|
-
import { SLIDER } from "../../types/enums";
|
|
6
4
|
import { useBase } from "../../hooks";
|
|
5
|
+
import { SLIDER } from "../../types/enums";
|
|
6
|
+
import Box from "../Box";
|
|
7
7
|
import Input from "../Input";
|
|
8
8
|
import Text from "../Text";
|
|
9
9
|
const Slider = forwardRef((props, ref) => {
|
|
@@ -78,4 +78,5 @@ const Slider = forwardRef((props, ref) => {
|
|
|
78
78
|
}, [isDragging]);
|
|
79
79
|
return _jsx(Box, { ref: slider, "data-value": value || 0, className: `--slider --${type || SLIDER.Default} flex rel ${className}`.trim(), style: { ...style }, children: SLIDER.Text === type ? _jsx(_Fragment, { children: _jsx(Text, { ref: text, onMouseDown: handleMouseDown, className: `--slider-text`, children: value || 0 }) }) : _jsxs(_Fragment, { children: [_jsx(Box, { ref: track, className: `--slider-track abs fill` }), _jsx(Box, { ref: knob, className: `--slider-knob abs` }), _jsx(Input, { ref: input, onInput: handleInput, className: `abs fill`, tabIndex: 0, type: type || SLIDER.Default, defaultValue: value || 0, step: step, max: max, min: min })] }) });
|
|
80
80
|
});
|
|
81
|
+
Slider.displayName = `Slider`;
|
|
81
82
|
export default Slider;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
|
-
import Box from "../Box";
|
|
5
|
-
import { Size, SPINNER } from "../../types/enums";
|
|
6
|
-
import { useBase } from "../../hooks";
|
|
7
4
|
import { hexToRgba } from "../../funs";
|
|
5
|
+
import { useBase } from "../../hooks";
|
|
6
|
+
import { Size, SPINNER } from "../../types/enums";
|
|
7
|
+
import Box from "../Box";
|
|
8
8
|
const Spinner = forwardRef((props, ref) => {
|
|
9
9
|
const { type, size, width, speed, color, background, foreground, ...pops } = props;
|
|
10
10
|
const defaultColor = `#000000`;
|
|
@@ -39,13 +39,10 @@ const Spinner = forwardRef((props, ref) => {
|
|
|
39
39
|
switch (type || SPINNER.Simple) {
|
|
40
40
|
case SPINNER.Simple:
|
|
41
41
|
return null;
|
|
42
|
-
break;
|
|
43
42
|
case SPINNER.Wave:
|
|
44
43
|
return _jsxs(_Fragment, { children: [_jsx(Box, { as: `--dot --dot-1` }), _jsx(Box, { as: `--dot --dot-2` }), _jsx(Box, { as: `--dot --dot-3` })] });
|
|
45
|
-
break;
|
|
46
44
|
case SPINNER.Roller:
|
|
47
45
|
return null;
|
|
48
|
-
break;
|
|
49
46
|
}
|
|
50
47
|
};
|
|
51
48
|
return _jsx(Box, { className: `${className} --spinner --${(type || SPINNER.Simple).toLowerCase()} --${size || Size.Default}`.trim(), style: {
|
|
@@ -53,4 +50,5 @@ const Spinner = forwardRef((props, ref) => {
|
|
|
53
50
|
...build()
|
|
54
51
|
}, ...rest, children: child() });
|
|
55
52
|
});
|
|
53
|
+
Spinner.displayName = `Spinner`;
|
|
56
54
|
export default Spinner;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CheckboxHandler } from "../CheckBox/types";
|
|
2
1
|
import { CHECKBOX } from "../../types/enums";
|
|
2
|
+
import { CheckboxHandler } from "../CheckBox/types";
|
|
3
3
|
declare const Switch: import("react").ForwardRefExoticComponent<import("../..").ZuzProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, keyof import("../..").ZuzProps> & {
|
|
4
4
|
type?: CHECKBOX;
|
|
5
5
|
size?: import("../..").Size;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import CheckBox from "../CheckBox";
|
|
4
3
|
import { CHECKBOX } from "../../types/enums";
|
|
4
|
+
import CheckBox from "../CheckBox";
|
|
5
5
|
const Switch = forwardRef((props, ref) => {
|
|
6
6
|
return _jsx(CheckBox, { type: CHECKBOX.Switch, ...props, ref: ref });
|
|
7
7
|
});
|
|
8
|
+
Switch.displayName = `Switch`;
|
|
8
9
|
export default Switch;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Tab, TabViewHandler } from "./types";
|
|
2
|
-
|
|
3
|
-
declare const TabView: import("react").ForwardRefExoticComponent<BoxProps & {
|
|
2
|
+
declare const TabView: import("react").ForwardRefExoticComponent<import("..").BoxProps & {
|
|
4
3
|
onChange?: (tab: Tab, index: number) => void;
|
|
5
4
|
speed?: number;
|
|
6
5
|
variant?: "fixed" | "default";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { SelectTabs } from "../..";
|
|
3
5
|
import { uuid } from "../../funs";
|
|
4
6
|
import { useBase, useResizeObserver } from "../../hooks";
|
|
5
7
|
import Box from "../Box";
|
|
6
|
-
import { SelectTabs } from "../..";
|
|
7
8
|
import TabBody from "./body";
|
|
8
9
|
const TabView = forwardRef((props, ref) => {
|
|
9
10
|
const { tabs: _tabs, speed, prerender, variant, onChange, ...rest } = props;
|
|
@@ -45,4 +46,5 @@ const TabView = forwardRef((props, ref) => {
|
|
|
45
46
|
transition: `all ${speed || 0.3}s ease-in-out 0s`, transform: `translate(-${activeTab * size.width}px, 0)`
|
|
46
47
|
}, children: tabs.map((tab, index) => _jsx(TabBody, { index: index, active: index === activeTab, size: size, render: render, content: tab.body }, `tab-body-${tab.key || index}-${tabViewID}`)) }) })] });
|
|
47
48
|
});
|
|
49
|
+
TabView.displayName = `TabView`;
|
|
48
50
|
export default TabView;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { TabProps } from "./types";
|
|
2
|
-
declare const TabItem:
|
|
2
|
+
declare const TabItem: {
|
|
3
|
+
({ tab, index, activeTab, onClick }: TabProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
displayName: string;
|
|
5
|
+
};
|
|
3
6
|
export default TabItem;
|
|
@@ -6,4 +6,5 @@ const TabItem = ({ tab, index, activeTab, onClick }) => {
|
|
|
6
6
|
const { icon, label } = tab;
|
|
7
7
|
return _jsxs(Button, { onClick: e => onClick(index), className: `--tab jcc ${index === activeTab ? '--active' : ''}`.trim(), children: [icon && (typeof icon === 'string' ? _jsx(Icon, { className: `--icon`, name: icon }) : icon), _jsx(Text, { className: `--label rel`, children: label })] });
|
|
8
8
|
};
|
|
9
|
+
TabItem.displayName = `TabItem`;
|
|
9
10
|
export default TabItem;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { CSSProperties } from "react";
|
|
2
|
-
import type { Column } from "./types";
|
|
3
2
|
import { PubSub } from "../..";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import type { Column } from "./types";
|
|
4
|
+
declare const TColumn: {
|
|
5
|
+
<T>(props: Column<T> & {
|
|
6
|
+
idx: number;
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
pubsub: PubSub;
|
|
9
|
+
sortBy?: string | null;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
9
13
|
export default TColumn;
|
|
@@ -1,10 +1,23 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { SVGIcons } from "../..";
|
|
2
4
|
import Box from "../Box";
|
|
3
5
|
const TColumn = (props) => {
|
|
4
|
-
const { idx, id, as, weight, style, value, render, resize,
|
|
5
|
-
|
|
6
|
+
const { idx, id, as, weight, style, value, render, resize, sortBy, sortable, onSort } = props;
|
|
7
|
+
const [_sort, setSort] = useState(0);
|
|
8
|
+
const _onSort = () => {
|
|
9
|
+
if (sortable) {
|
|
10
|
+
onSort?.(String(id), _sort == 1 ? -1 : 1);
|
|
11
|
+
setSort(prev => prev == 1 ? -1 : 1);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
return _jsxs(Box, { style: {
|
|
6
15
|
flex: weight || 1,
|
|
7
16
|
...style
|
|
8
|
-
}, as: `--col flex aic ${as || ``}`, children: value })
|
|
17
|
+
}, as: `--col flex aic ${as || ``} ${sortable ? `--sortable` : ``}`, onClick: _onSort, children: [_jsx(Box, { children: value }), idx == -1
|
|
18
|
+
&& sortable
|
|
19
|
+
&& sortBy == id
|
|
20
|
+
&& _jsx(Box, { as: `--arrow flex aib`, children: _sort == 1 ? SVGIcons.arrowUp : SVGIcons.arrowDown })] });
|
|
9
21
|
};
|
|
22
|
+
TColumn.displayName = `Column`;
|
|
10
23
|
export default TColumn;
|