@majapisoftwares/ui 4.1.16 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base.css +4 -4
- package/bootstrap/AppProps.d.ts +4 -5
- package/components/Accordion/Accordion.d.ts +1 -1
- package/components/Alert/Alert.d.ts +1 -1
- package/components/Alert/Alert.jsx +19 -19
- package/components/AntiClickjacking/AntiClickjacking.d.ts +1 -0
- package/components/AntiClickjacking/AntiClickjacking.jsx +17 -0
- package/components/AntiClickjacking/index.d.ts +2 -0
- package/components/AntiClickjacking/index.jsx +2 -0
- package/components/Autocomplete/Autocomplete.d.ts +1 -1
- package/components/Autocomplete/Autocomplete.jsx +3 -3
- package/components/Autocomplete/UnstyledAutocomplete.d.ts +2 -2
- package/components/Autocomplete/UnstyledAutocomplete.jsx +23 -24
- package/components/Badge/Badge.d.ts +1 -1
- package/components/Badge/Badge.jsx +9 -9
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Button/Button.d.ts +2 -2
- package/components/Button/Button.jsx +5 -5
- package/components/Carousel/Carousel.d.ts +2 -2
- package/components/Carousel/Carousel.jsx +13 -13
- package/components/Checkbox/Checkbox.d.ts +1 -1
- package/components/Checkbox/Checkbox.jsx +12 -12
- package/components/Code/Code.d.ts +1 -1
- package/components/Code/Code.jsx +15 -15
- package/components/ConfirmationButton/ConfirmationButton.d.ts +3 -3
- package/components/ConfirmationButton/ConfirmationButton.jsx +10 -10
- package/components/ContextMenu/ContextMenu.d.ts +1 -1
- package/components/ContextMenu/ContextMenu.jsx +22 -22
- package/components/DateInput/DateInput.d.ts +1 -1
- package/components/DateInput/DateInput.jsx +1 -1
- package/components/DateInput/DateTimeInput.d.ts +1 -1
- package/components/DateInput/DateTimeInput.jsx +1 -1
- package/components/DateInput/useRefValue.d.ts +1 -1
- package/components/DatePicker/DatePicker.d.ts +3 -3
- package/components/DatePicker/DatePicker.jsx +8 -8
- package/components/DateRangePicker/DateRangePicker.d.ts +2 -2
- package/components/DateRangePicker/DateRangePicker.jsx +8 -8
- package/components/Dialog/Dialog.d.ts +2 -2
- package/components/Dialog/Dialog.jsx +23 -23
- package/components/Dialog/Dialogs.jsx +4 -4
- package/components/Dialog/dialogs.state.d.ts +2 -2
- package/components/Drawer/Drawer.d.ts +1 -1
- package/components/Drawer/Drawer.jsx +41 -41
- package/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/components/DropdownMenu/DropdownMenu.jsx +23 -23
- package/components/ErrorBoundary/ErrorBoundary.d.ts +1 -1
- package/components/ErrorBoundary/ErrorBoundary.jsx +4 -4
- package/components/ErrorPage/ErrorPage.d.ts +1 -1
- package/components/ErrorPage/ErrorPage.jsx +16 -16
- package/components/FileInput/FileInput.d.ts +4 -4
- package/components/FileInput/FileInput.jsx +2 -2
- package/components/FileInput/PreviewFile.d.ts +2 -2
- package/components/FileSelect/FileSelect.d.ts +1 -1
- package/components/FileSelect/FileSelect.jsx +16 -13
- package/components/Footer/Footer.d.ts +1 -1
- package/components/Footer/Footer.jsx +22 -22
- package/components/GridPattern/GridPattern.d.ts +1 -1
- package/components/GridPattern/GridPattern.jsx +7 -7
- package/components/Header/Header.d.ts +1 -1
- package/components/Header/Header.jsx +2 -2
- package/components/ImageInput/ImageInput.d.ts +1 -1
- package/components/Input/Input.d.ts +1 -1
- package/components/Input/Input.jsx +7 -7
- package/components/Input/InputIcon.d.ts +1 -1
- package/components/Input/MultiSelectInput.d.ts +2 -2
- package/components/Input/MultiSelectInput.jsx +15 -15
- package/components/Input/NumericInput.d.ts +3 -3
- package/components/Input/NumericInput.jsx +1 -1
- package/components/Input/PatternInput.d.ts +3 -3
- package/components/Input/PatternInput.jsx +1 -1
- package/components/Input/UnstyledInput.d.ts +1 -1
- package/components/Input/UnstyledInput.jsx +12 -12
- package/components/Input2/InputWrapper.d.ts +1 -1
- package/components/Input2/InputWrapper.jsx +7 -7
- package/components/Link/Link.d.ts +1 -1
- package/components/Magnet/Magnet.d.ts +1 -1
- package/components/Markdown/Markdown.d.ts +1 -1
- package/components/Markdown/Markdown.jsx +2 -2
- package/components/Menu/Menu.d.ts +3 -3
- package/components/Menu/Menu.jsx +19 -19
- package/components/Modal/Modal.d.ts +1 -1
- package/components/Modal/Modal.jsx +26 -26
- package/components/ModeToggle/ModeToggle.d.ts +1 -1
- package/components/ModeToggle/ModeToggle.jsx +3 -3
- package/components/MultiSelect/MultiSelect.d.ts +2 -2
- package/components/MultiSelect/MultiSelect.jsx +2 -2
- package/components/MultiSelect/MultiSelectInput.d.ts +1 -1
- package/components/MultiText/MultiText.d.ts +1 -1
- package/components/MultiText/MultiText.jsx +0 -1
- package/components/NavigationDrawer/NavigationDrawer.d.ts +1 -1
- package/components/NavigationDrawer/NavigationDrawer.jsx +11 -11
- package/components/NavigationDrawer/NavigationItem.d.ts +1 -1
- package/components/NavigationDrawer/NavigationItem.jsx +2 -2
- package/components/NoSsr/NoSsr.d.ts +1 -1
- package/components/Notifications/Notifications.jsx +29 -29
- package/components/Notifications/notifications.state.d.ts +2 -2
- package/components/Notifications/notifications.state.js +1 -1
- package/components/Pagination/Pagination.jsx +15 -15
- package/components/Particles/Particles.jsx +55 -55
- package/components/PictureCropInput/PictureCropInput.d.ts +2 -2
- package/components/PictureCropInput/PictureCropInput.jsx +39 -39
- package/components/PictureCropInput/canvasPreview.d.ts +1 -1
- package/components/Popover/Popover.d.ts +1 -1
- package/components/Popover/Popover.jsx +6 -6
- package/components/Resizable/Resizable.d.ts +1 -1
- package/components/Resizable/Resizable.jsx +4 -4
- package/components/ScrollArea/ScrollArea.d.ts +1 -1
- package/components/ScrollArea/ScrollArea.jsx +11 -11
- package/components/Select/Select.d.ts +1 -1
- package/components/Select/Select.jsx +21 -21
- package/components/Skeleton/Skeleton.d.ts +1 -1
- package/components/Skeleton/Skeleton.jsx +4 -4
- package/components/StarBorder/StarBorder.d.ts +1 -2
- package/components/StarBorder/StarBorder.jsx +1 -1
- package/components/Switch/Switch.d.ts +2 -2
- package/components/Switch/Switch.jsx +9 -9
- package/components/Table/DataTable.d.ts +1 -1
- package/components/Table/DataTable.jsx +54 -54
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.jsx +7 -7
- package/components/Table/TableActionButton.d.ts +2 -2
- package/components/Table/TableActionButton.jsx +3 -3
- package/components/Table/TableBody.d.ts +1 -1
- package/components/Table/TableBody.jsx +4 -4
- package/components/Table/TableCell.d.ts +1 -1
- package/components/Table/TableCell.jsx +4 -4
- package/components/Table/TableFooter.d.ts +1 -1
- package/components/Table/TableFooter.jsx +2 -2
- package/components/Table/TableHead.d.ts +1 -1
- package/components/Table/TableHead.jsx +4 -4
- package/components/Table/TableHeader.d.ts +1 -1
- package/components/Table/TableHeader.jsx +10 -10
- package/components/Table/TableRow.d.ts +1 -1
- package/components/Table/TableRow.jsx +2 -2
- package/components/Tabs/Tabs.d.ts +2 -2
- package/components/Tabs/Tabs.jsx +6 -6
- package/components/TabsSwitcher/Tab.d.ts +1 -1
- package/components/TabsSwitcher/TabsSwitcher.d.ts +1 -1
- package/components/Text/Text.d.ts +1 -1
- package/components/Text/Text.jsx +1 -0
- package/components/Textarea/Textarea.d.ts +2 -2
- package/components/Textarea/Textarea.jsx +1 -1
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.jsx +12 -12
- package/components/VisibilityActivatedButton/VisibilityActivatedButton.d.ts +1 -1
- package/form.d.ts +4 -4
- package/form2.d.ts +1 -1
- package/form2.jsx +1 -0
- package/hooks/useDebounceEffect.d.ts +1 -1
- package/hooks/useDebouncedValue.d.ts +1 -1
- package/hooks/useDebouncedValue.js +1 -1
- package/hooks/useLagRadar.jsx +19 -19
- package/package.json +1 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/types.d.ts +1 -1
- package/types.js +1 -1
- package/utils/UseState.d.ts +2 -3
- package/utils/csvBlobToJson.d.ts +1 -1
- package/utils/csvBlobToJson.js +0 -1
- package/utils/ms.d.ts +1 -1
- package/utils/ms.js +6 -6
- package/utils/recursiveChildrenMap.d.ts +1 -1
- package/utils/smoothScrollToHref.d.ts +1 -1
- package/utils/smoothScrollToHref.js +7 -3
- package/utils/stopPropagation.d.ts +1 -1
- package/utils/xlsxBlobToJson.d.ts +1 -1
- package/utils/xlsxBlobToJson.js +3 -0
|
@@ -61,49 +61,49 @@ export default function DataTable({ title, subtitle, headerContent, data, idAcce
|
|
|
61
61
|
}, [sort]);
|
|
62
62
|
return (<Stack className={clsx({
|
|
63
63
|
"flex flex-1 flex-col": autoHeight,
|
|
64
|
-
}, className)}>
|
|
65
|
-
{(title || subtitle || headerContent) && (<Table.Header title={title} subtitle={subtitle}>
|
|
66
|
-
{headerContent}
|
|
67
|
-
</Table.Header>)}
|
|
68
|
-
<Table autoHeight={autoHeight} className={tableClassName}>
|
|
69
|
-
<Table.Head>
|
|
70
|
-
<Table.Row>
|
|
64
|
+
}, className)}>
|
|
65
|
+
{(title || subtitle || headerContent) && (<Table.Header title={title} subtitle={subtitle}>
|
|
66
|
+
{headerContent}
|
|
67
|
+
</Table.Header>)}
|
|
68
|
+
<Table autoHeight={autoHeight} className={tableClassName}>
|
|
69
|
+
<Table.Head>
|
|
70
|
+
<Table.Row>
|
|
71
71
|
{columns.map((column, i) => {
|
|
72
72
|
const id = column.id ||
|
|
73
73
|
(typeof column.title === "string"
|
|
74
74
|
? column.title
|
|
75
75
|
: i.toString());
|
|
76
76
|
const columnSort = getColumnSort(id);
|
|
77
|
-
return (<Table.Cell key={id} className={column.headerClassName}>
|
|
78
|
-
{column.sortable ? (<span className="group inline-flex cursor-pointer" onClick={handleColumnClick(id)}>
|
|
79
|
-
{column.title}
|
|
77
|
+
return (<Table.Cell key={id} className={column.headerClassName}>
|
|
78
|
+
{column.sortable ? (<span className="group inline-flex cursor-pointer" onClick={handleColumnClick(id)}>
|
|
79
|
+
{column.title}
|
|
80
80
|
<span className={clsx("mb-auto ml-2 flex-none rounded-sm text-zinc-400", {
|
|
81
81
|
"bg-zinc-200 text-zinc-900 group-hover:bg-zinc-300": columnSort?.[1],
|
|
82
82
|
"invisible group-hover:visible group-focus:visible": !columnSort?.[1],
|
|
83
|
-
})}>
|
|
83
|
+
})}>
|
|
84
84
|
<ChevronUpIcon className={clsx("h-5 w-5", {
|
|
85
85
|
"scale-y-flip": columnSort?.[1] === "desc",
|
|
86
|
-
})} aria-hidden="true"/>
|
|
87
|
-
</span>
|
|
88
|
-
</span>) : (column.title)}
|
|
86
|
+
})} aria-hidden="true"/>
|
|
87
|
+
</span>
|
|
88
|
+
</span>) : (column.title)}
|
|
89
89
|
</Table.Cell>);
|
|
90
|
-
})}
|
|
91
|
-
{actions && <Table.Cell />}
|
|
92
|
-
</Table.Row>
|
|
93
|
-
{isLoading && (<tr className="absolute right-3
|
|
94
|
-
<td>
|
|
95
|
-
<Loading className="mt-px"/>
|
|
96
|
-
</td>
|
|
97
|
-
</tr>)}
|
|
98
|
-
</Table.Head>
|
|
99
|
-
<Table.Body>
|
|
90
|
+
})}
|
|
91
|
+
{actions && <Table.Cell />}
|
|
92
|
+
</Table.Row>
|
|
93
|
+
{isLoading && (<tr className="absolute top-2 right-3 rounded-full bg-zinc-50/50 dark:bg-zinc-900/50">
|
|
94
|
+
<td>
|
|
95
|
+
<Loading className="mt-px"/>
|
|
96
|
+
</td>
|
|
97
|
+
</tr>)}
|
|
98
|
+
</Table.Head>
|
|
99
|
+
<Table.Body>
|
|
100
100
|
{data?.map((item) => {
|
|
101
101
|
const RowComponent = rowWrapper || Fragment;
|
|
102
102
|
return (<RowComponent key={item[idAccessor]} {...(RowComponent !== Fragment
|
|
103
103
|
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
104
104
|
{ item: item }
|
|
105
|
-
: {})}>
|
|
106
|
-
<Table.Row onClick={handleRowClick(item)}>
|
|
105
|
+
: {})}>
|
|
106
|
+
<Table.Row onClick={handleRowClick(item)}>
|
|
107
107
|
{columns.map((column, i) => {
|
|
108
108
|
const value = column.accessor
|
|
109
109
|
? item[column.accessor]
|
|
@@ -112,44 +112,44 @@ export default function DataTable({ title, subtitle, headerContent, data, idAcce
|
|
|
112
112
|
(typeof column.title === "string" ? column.title : i)} className={column.cellClassName} title={column.cellClassName?.includes("max-w") &&
|
|
113
113
|
typeof value === "string"
|
|
114
114
|
? value
|
|
115
|
-
: undefined}>
|
|
116
|
-
{value}
|
|
115
|
+
: undefined}>
|
|
116
|
+
{value}
|
|
117
117
|
</Table.Cell>);
|
|
118
|
-
})}
|
|
119
|
-
{actions && (<Table.Cell actions>
|
|
118
|
+
})}
|
|
119
|
+
{actions && (<Table.Cell actions>
|
|
120
120
|
{actions.map((action, i) => {
|
|
121
121
|
const ActionComponent = action.wrapper || Fragment;
|
|
122
122
|
return (<ActionComponent key={i} {...(ActionComponent !== Fragment
|
|
123
123
|
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
124
124
|
{ item: item }
|
|
125
|
-
: {})}>
|
|
125
|
+
: {})}>
|
|
126
126
|
<Table.ActionButton title={action.title} onClick={() => action.onClick?.(item)} href={typeof action.href === "function"
|
|
127
127
|
? action.href?.(item)
|
|
128
|
-
: action.href} target={action.target}>
|
|
129
|
-
{action.icon}
|
|
130
|
-
</Table.ActionButton>
|
|
128
|
+
: action.href} target={action.target}>
|
|
129
|
+
{action.icon}
|
|
130
|
+
</Table.ActionButton>
|
|
131
131
|
</ActionComponent>);
|
|
132
|
-
})}
|
|
133
|
-
</Table.Cell>)}
|
|
134
|
-
</Table.Row>
|
|
132
|
+
})}
|
|
133
|
+
</Table.Cell>)}
|
|
134
|
+
</Table.Row>
|
|
135
135
|
</RowComponent>);
|
|
136
|
-
})}
|
|
137
|
-
{isLoading && !data?.length && (<Table.Row>
|
|
136
|
+
})}
|
|
137
|
+
{isLoading && !data?.length && (<Table.Row>
|
|
138
138
|
{columns.map((column, i) => (<Table.Cell key={column.id ||
|
|
139
|
-
(typeof column.title === "string" ? column.title : i)}>
|
|
140
|
-
<Skeleton className="h-3"/>
|
|
141
|
-
</Table.Cell>))}
|
|
142
|
-
{actions && (<Table.Cell actions>
|
|
143
|
-
<Skeleton className="inline-block h-3 w-6"/>
|
|
144
|
-
</Table.Cell>)}
|
|
145
|
-
</Table.Row>)}
|
|
146
|
-
{!isLoading && !data?.length && (<Table.Row>
|
|
147
|
-
<Table.Cell colSpan={columns.length + (actions ? 1 : 0)}>
|
|
148
|
-
<Text variant="secondary">{noRecordsText}</Text>
|
|
149
|
-
</Table.Cell>
|
|
150
|
-
</Table.Row>)}
|
|
151
|
-
</Table.Body>
|
|
152
|
-
</Table>
|
|
153
|
-
{pagination ? (<Table.FooterWithPagination totalItems={totalItems} itemsPerPage={itemsPerPage} currentPage={currentPage} onChangePage={onChangePage} previousText={previousText} nextText={nextText} showingText={showingText} toText={toText} ofText={ofText} resultsText={resultsText}/>) : undefined}
|
|
139
|
+
(typeof column.title === "string" ? column.title : i)}>
|
|
140
|
+
<Skeleton className="h-3"/>
|
|
141
|
+
</Table.Cell>))}
|
|
142
|
+
{actions && (<Table.Cell actions>
|
|
143
|
+
<Skeleton className="inline-block h-3 w-6"/>
|
|
144
|
+
</Table.Cell>)}
|
|
145
|
+
</Table.Row>)}
|
|
146
|
+
{!isLoading && !data?.length && (<Table.Row>
|
|
147
|
+
<Table.Cell colSpan={columns.length + (actions ? 1 : 0)}>
|
|
148
|
+
<Text variant="secondary">{noRecordsText}</Text>
|
|
149
|
+
</Table.Cell>
|
|
150
|
+
</Table.Row>)}
|
|
151
|
+
</Table.Body>
|
|
152
|
+
</Table>
|
|
153
|
+
{pagination ? (<Table.FooterWithPagination totalItems={totalItems} itemsPerPage={itemsPerPage} currentPage={currentPage} onChangePage={onChangePage} previousText={previousText} nextText={nextText} showingText={showingText} toText={toText} ofText={ofText} resultsText={resultsText}/>) : undefined}
|
|
154
154
|
</Stack>);
|
|
155
155
|
}
|
|
@@ -10,15 +10,15 @@ import TableFooterWithPagination from "./TableFooterWithPagination";
|
|
|
10
10
|
export default function Table({ children, className, hideBorder, autoHeight, }) {
|
|
11
11
|
return (<div className={clsx("overflow-hidden bg-white dark:bg-zinc-800", {
|
|
12
12
|
"relative flex-1": autoHeight,
|
|
13
|
-
"shadow-sm ring-1 ring-black/5 dark:ring-white/10
|
|
14
|
-
}, className)}>
|
|
13
|
+
"shadow-sm ring-1 ring-black/5 md:rounded-lg dark:ring-white/10": !hideBorder,
|
|
14
|
+
}, className)}>
|
|
15
15
|
<div className={clsx("overflow-auto", {
|
|
16
16
|
"absolute inset-0": autoHeight,
|
|
17
|
-
})}>
|
|
18
|
-
<table className={clsx("w-full max-w-full divide-y divide-zinc-300 dark:divide-zinc-600")}>
|
|
19
|
-
{children}
|
|
20
|
-
</table>
|
|
21
|
-
</div>
|
|
17
|
+
})}>
|
|
18
|
+
<table className={clsx("w-full max-w-full divide-y divide-zinc-300 dark:divide-zinc-600")}>
|
|
19
|
+
{children}
|
|
20
|
+
</table>
|
|
21
|
+
</div>
|
|
22
22
|
</div>);
|
|
23
23
|
}
|
|
24
24
|
Table.Row = TableRow;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { ButtonProps } from "../Button/Button";
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ButtonProps } from "../Button/Button";
|
|
3
3
|
export type TableActionButtonProps<T extends HTMLElement = HTMLButtonElement> = {
|
|
4
4
|
title?: ReactNode;
|
|
5
5
|
} & ButtonProps<T>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import clsx from "../../utils/clsx";
|
|
2
2
|
import { cloneElement, } from "react";
|
|
3
|
-
import Button from "../Button/Button";
|
|
3
|
+
import Button, {} from "../Button/Button";
|
|
4
4
|
import Tooltip from "../Tooltip";
|
|
5
5
|
export default function TableActionButton({ children, className, title, onClick, ...props }) {
|
|
6
6
|
const handleClick = (e) => {
|
|
@@ -8,10 +8,10 @@ export default function TableActionButton({ children, className, title, onClick,
|
|
|
8
8
|
onClick?.(e);
|
|
9
9
|
};
|
|
10
10
|
const child = children;
|
|
11
|
-
const button = (<Button icon variant="text" className={clsx("p-1!", className)} onClick={handleClick} {...props}>
|
|
11
|
+
const button = (<Button icon variant="text" className={clsx("p-1!", className)} onClick={handleClick} {...props}>
|
|
12
12
|
{cloneElement(child, {
|
|
13
13
|
className: clsx("h-[20px]! w-[20px]!", child.props.className),
|
|
14
|
-
})}
|
|
14
|
+
})}
|
|
15
15
|
</Button>);
|
|
16
16
|
if (title) {
|
|
17
17
|
return <Tooltip content={title}>{button}</Tooltip>;
|
|
@@ -2,9 +2,9 @@ import { useMemo } from "react";
|
|
|
2
2
|
import TableHeadContext from "./TableHeadContext";
|
|
3
3
|
import clsx from "../../utils/clsx";
|
|
4
4
|
export default function TableBody({ children, className }) {
|
|
5
|
-
return (<TableHeadContext.Provider value={useMemo(() => ({ isHead: false, sticky: false }), [])}>
|
|
6
|
-
<tbody className={clsx("divide-y divide-zinc-200 bg-white dark:divide-zinc-700 dark:bg-zinc-800 [&_tr:last-of-type]:border-b [&_tr:last-of-type]:border-zinc-200 dark:[&_tr:last-of-type]:border-zinc-700", className)}>
|
|
7
|
-
{children}
|
|
8
|
-
</tbody>
|
|
5
|
+
return (<TableHeadContext.Provider value={useMemo(() => ({ isHead: false, sticky: false }), [])}>
|
|
6
|
+
<tbody className={clsx("divide-y divide-zinc-200 bg-white dark:divide-zinc-700 dark:bg-zinc-800 [&_tr:last-of-type]:border-b [&_tr:last-of-type]:border-zinc-200 dark:[&_tr:last-of-type]:border-zinc-700", className)}>
|
|
7
|
+
{children}
|
|
8
|
+
</tbody>
|
|
9
9
|
</TableHeadContext.Provider>);
|
|
10
10
|
}
|
|
@@ -8,11 +8,11 @@ export default function TableCell({ children, className, actions, colSpan, title
|
|
|
8
8
|
"py-0.5 text-right pr-2.5 sm:pr-5": actions,
|
|
9
9
|
});
|
|
10
10
|
if (isHead) {
|
|
11
|
-
return (<th className={clsx(commonClassName, "sticky left-0 bg-zinc-50 py-2 text-left font-semibold text-zinc-900 dark:bg-zinc-900 dark:text-zinc-50", className)} colSpan={colSpan} title={title}>
|
|
12
|
-
{children}
|
|
11
|
+
return (<th className={clsx(commonClassName, "sticky left-0 bg-zinc-50 py-2 text-left font-semibold text-zinc-900 dark:bg-zinc-900 dark:text-zinc-50", className)} colSpan={colSpan} title={title}>
|
|
12
|
+
{children}
|
|
13
13
|
</th>);
|
|
14
14
|
}
|
|
15
|
-
return (<td className={clsx(commonClassName, "whitespace-nowrap text-zinc-500 dark:text-zinc-300", className)} colSpan={colSpan} title={title}>
|
|
16
|
-
{children}
|
|
15
|
+
return (<td className={clsx(commonClassName, "whitespace-nowrap text-zinc-500 dark:text-zinc-300", className)} colSpan={colSpan} title={title}>
|
|
16
|
+
{children}
|
|
17
17
|
</td>);
|
|
18
18
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default function TableFooter({ children }) {
|
|
2
|
-
return (<div className="flex items-center justify-between border border-x-0 border-zinc-200 bg-white p-3 sm:border-x sm:px-5 md:rounded-lg dark:border-white/10 dark:bg-zinc-900">
|
|
3
|
-
{children}
|
|
2
|
+
return (<div className="flex items-center justify-between border border-x-0 border-zinc-200 bg-white p-3 sm:border-x sm:px-5 md:rounded-lg dark:border-white/10 dark:bg-zinc-900">
|
|
3
|
+
{children}
|
|
4
4
|
</div>);
|
|
5
5
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import TableHeadContext from "./TableHeadContext";
|
|
3
3
|
export default function TableHead({ children }) {
|
|
4
|
-
return (<TableHeadContext.Provider value={useMemo(() => ({ isHead: true }), [])}>
|
|
5
|
-
<thead className="sticky top-0 bg-zinc-50 dark:bg-zinc-900">
|
|
6
|
-
{children}
|
|
7
|
-
</thead>
|
|
4
|
+
return (<TableHeadContext.Provider value={useMemo(() => ({ isHead: true }), [])}>
|
|
5
|
+
<thead className="sticky top-0 bg-zinc-50 dark:bg-zinc-900">
|
|
6
|
+
{children}
|
|
7
|
+
</thead>
|
|
8
8
|
</TableHeadContext.Provider>);
|
|
9
9
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import Text from "../Text";
|
|
2
2
|
import Stack from "../Stack";
|
|
3
3
|
export default function TableHeader({ title, subtitle, children, }) {
|
|
4
|
-
return (<div className="px-4 md:px-0">
|
|
5
|
-
<div className="sm:flex sm:items-center">
|
|
6
|
-
{(title || subtitle) && (<Stack className="sm:flex-auto">
|
|
7
|
-
{title && (<Text variant="label" size="lg">
|
|
8
|
-
{title}
|
|
9
|
-
</Text>)}
|
|
10
|
-
{subtitle && <Text variant="secondary">{subtitle}</Text>}
|
|
11
|
-
</Stack>)}
|
|
12
|
-
{children && (<div className="mt-4 sm:
|
|
13
|
-
</div>
|
|
4
|
+
return (<div className="px-4 md:px-0">
|
|
5
|
+
<div className="sm:flex sm:items-center">
|
|
6
|
+
{(title || subtitle) && (<Stack className="sm:flex-auto">
|
|
7
|
+
{title && (<Text variant="label" size="lg">
|
|
8
|
+
{title}
|
|
9
|
+
</Text>)}
|
|
10
|
+
{subtitle && <Text variant="secondary">{subtitle}</Text>}
|
|
11
|
+
</Stack>)}
|
|
12
|
+
{children && (<div className="mt-4 sm:mt-0 sm:ml-16 sm:flex-none">{children}</div>)}
|
|
13
|
+
</div>
|
|
14
14
|
</div>);
|
|
15
15
|
}
|
|
@@ -2,8 +2,8 @@ import clsx from "../../utils/clsx";
|
|
|
2
2
|
function TableRow({ children, onClick, className, ...props }) {
|
|
3
3
|
return (<tr onClick={onClick} className={clsx({
|
|
4
4
|
"group/row cursor-pointer hover:bg-black/5 dark:hover:bg-white/5": !!onClick,
|
|
5
|
-
}, className)} {...props}>
|
|
6
|
-
{children}
|
|
5
|
+
}, className)} {...props}>
|
|
6
|
+
{children}
|
|
7
7
|
</tr>);
|
|
8
8
|
}
|
|
9
9
|
export default TableRow;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { ButtonProps } from "../Button";
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type ButtonProps } from "../Button";
|
|
3
3
|
export default function Tabs({ children, className, }: {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
className?: string;
|
package/components/Tabs/Tabs.jsx
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import clsx from "../../utils/clsx";
|
|
2
|
-
import Button from "../Button";
|
|
2
|
+
import Button, {} from "../Button";
|
|
3
3
|
export default function Tabs({ children, className, }) {
|
|
4
4
|
return <div className={clsx("ui-tabs", className)}>{children}</div>;
|
|
5
5
|
}
|
|
6
6
|
export function Tab({ children, selected, onClick, className, ...props }) {
|
|
7
|
-
return (<div className="relative">
|
|
8
|
-
<Button className={clsx("ui-tabs-tab", className)} data-selected={selected ? "" : undefined} onClick={onClick} variant="custom" {...props}>
|
|
9
|
-
{children}
|
|
10
|
-
</Button>
|
|
11
|
-
{selected && <div className="ui-tabs-indicator"/>}
|
|
7
|
+
return (<div className="relative">
|
|
8
|
+
<Button className={clsx("ui-tabs-tab", className)} data-selected={selected ? "" : undefined} onClick={onClick} variant="custom" {...props}>
|
|
9
|
+
{children}
|
|
10
|
+
</Button>
|
|
11
|
+
{selected && <div className="ui-tabs-indicator"/>}
|
|
12
12
|
</div>);
|
|
13
13
|
}
|
package/components/Text/Text.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InputProps } from "../Input";
|
|
2
|
-
import { TextareaAutosizeProps } from "react-textarea-autosize
|
|
1
|
+
import { type InputProps } from "../Input";
|
|
2
|
+
import type { TextareaAutosizeProps } from "react-textarea-autosize";
|
|
3
3
|
export type TextareaProps = InputProps<false> & Partial<Pick<TextareaAutosizeProps, "maxRows" | "minRows" | "onHeightChange" | "cacheMeasurements">>;
|
|
4
4
|
declare function Textarea(props: TextareaProps): import("react").JSX.Element;
|
|
5
5
|
export default Textarea;
|
|
@@ -4,18 +4,18 @@ function Tooltip({ children, content, side, delayDuration, className, arrowClass
|
|
|
4
4
|
if (!content) {
|
|
5
5
|
return <>{children}</>;
|
|
6
6
|
}
|
|
7
|
-
return (<RTooltip.Provider>
|
|
8
|
-
<RTooltip.Root delayDuration={delayDuration}>
|
|
9
|
-
<RTooltip.Trigger asChild ref={ref}>
|
|
10
|
-
{children}
|
|
11
|
-
</RTooltip.Trigger>
|
|
12
|
-
<RTooltip.Portal>
|
|
13
|
-
<RTooltip.Content className={clsx("z-20 rounded-sm bg-zinc-950 px-2 py-1 text-center text-sm text-zinc-50 shadow-sm", "dark:bg-zinc-50 dark:text-zinc-950", "data-[state=closed]:animate-fade-out data-[state=delayed-open]:data-[side=bottom]:animate-elastic-slide-up-and-fade data-[state=delayed-open]:data-[side=left]:animate-elastic-slide-right-and-fade data-[state=delayed-open]:data-[side=right]:animate-elastic-slide-left-and-fade data-[state=delayed-open]:data-[side=top]:animate-elastic-slide-down-and-fade will-change-[transform,opacity]", className)} sideOffset={5} side={side}>
|
|
14
|
-
{content}
|
|
15
|
-
<RTooltip.Arrow className={clsx("fill-zinc-950 dark:fill-zinc-50", arrowClassName)}/>
|
|
16
|
-
</RTooltip.Content>
|
|
17
|
-
</RTooltip.Portal>
|
|
18
|
-
</RTooltip.Root>
|
|
7
|
+
return (<RTooltip.Provider>
|
|
8
|
+
<RTooltip.Root delayDuration={delayDuration}>
|
|
9
|
+
<RTooltip.Trigger asChild ref={ref}>
|
|
10
|
+
{children}
|
|
11
|
+
</RTooltip.Trigger>
|
|
12
|
+
<RTooltip.Portal>
|
|
13
|
+
<RTooltip.Content className={clsx("z-20 rounded-sm bg-zinc-950 px-2 py-1 text-center text-sm text-zinc-50 shadow-sm", "dark:bg-zinc-50 dark:text-zinc-950", "data-[state=closed]:animate-fade-out data-[state=delayed-open]:data-[side=bottom]:animate-elastic-slide-up-and-fade data-[state=delayed-open]:data-[side=left]:animate-elastic-slide-right-and-fade data-[state=delayed-open]:data-[side=right]:animate-elastic-slide-left-and-fade data-[state=delayed-open]:data-[side=top]:animate-elastic-slide-down-and-fade will-change-[transform,opacity]", className)} sideOffset={5} side={side}>
|
|
14
|
+
{content}
|
|
15
|
+
<RTooltip.Arrow className={clsx("fill-zinc-950 dark:fill-zinc-50", arrowClassName)}/>
|
|
16
|
+
</RTooltip.Content>
|
|
17
|
+
</RTooltip.Portal>
|
|
18
|
+
</RTooltip.Root>
|
|
19
19
|
</RTooltip.Provider>);
|
|
20
20
|
}
|
|
21
21
|
export default Tooltip;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps } from "react";
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
2
|
import Button from "../Button";
|
|
3
3
|
export default function VisibilityActivatedButton({ rootMargin, threshold, root, ...props }: ComponentProps<typeof Button> & {
|
|
4
4
|
root?: Element | Document | null;
|
package/form.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FormEvent } from "react";
|
|
2
|
-
import { ArrayKey, IsTuple, TupleKeys } from "react-hook-form/dist/types/path/common";
|
|
3
|
-
import { Get, PartialDeep, RequiredDeep, WritableDeep } from "type-fest";
|
|
4
|
-
import { DeepPartial } from "redux";
|
|
1
|
+
import { type FormEvent } from "react";
|
|
2
|
+
import type { ArrayKey, IsTuple, TupleKeys } from "react-hook-form/dist/types/path/common";
|
|
3
|
+
import type { Get, PartialDeep, RequiredDeep, WritableDeep } from "type-fest";
|
|
4
|
+
import type { DeepPartial } from "redux";
|
|
5
5
|
type Any = any;
|
|
6
6
|
export type DeepMapValues<T, V> = {
|
|
7
7
|
[K in keyof T]: T[K] extends Array<Any> ? DeepMapValues<T[K][0], V> & V : T[K] extends object ? DeepMapValues<T[K], V> : V;
|
package/form2.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ControllerFieldState, ControllerProps, ControllerRenderProps, FieldPath, FieldValues, UseFormProps, UseFormReturn, UseFormStateReturn } from "react-hook-form";
|
|
1
|
+
import { type ControllerFieldState, type ControllerProps, type ControllerRenderProps, type FieldPath, type FieldValues, type UseFormProps, type UseFormReturn, type UseFormStateReturn } from "react-hook-form";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import React from "react";
|
|
4
4
|
export declare function useForm<TSchema extends z.Schema<any, any>, TFieldValues extends FieldValues = z.infer<TSchema>>({ schema, ...props }: UseFormProps<TFieldValues> & {
|
package/form2.jsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Controller as RHFController, useForm as useRHForm, } from "react-hook-form";
|
|
2
2
|
import { zodResolver } from "@hookform/resolvers/zod";
|
|
3
|
+
import * as z from "zod";
|
|
3
4
|
import React, { useMemo } from "react";
|
|
4
5
|
import { get } from "lodash-es";
|
|
5
6
|
export function useForm({ schema, ...props }) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { DependencyList } from "react";
|
|
1
|
+
import { type DependencyList } from "react";
|
|
2
2
|
export default function useDebounceEffect(fn: () => void, waitTime: number, deps?: DependencyList): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { StringValue } from "ms";
|
|
1
|
+
import { type StringValue } from "ms";
|
|
2
2
|
export default function useDebounce<T = unknown>(value: T, delay: StringValue | number): T;
|
package/hooks/useLagRadar.jsx
CHANGED
|
@@ -19,25 +19,25 @@ function lagRadar(config = {}) {
|
|
|
19
19
|
inset = 3, // circle inset px
|
|
20
20
|
parent = document.body, // DOM node to attach to
|
|
21
21
|
} = config;
|
|
22
|
-
const styles = document.createTextNode(`
|
|
23
|
-
.lagRadar {
|
|
24
|
-
position: fixed;
|
|
25
|
-
bottom: 0.5rem;
|
|
26
|
-
right: 0.5rem;
|
|
27
|
-
}
|
|
28
|
-
.lagRadar {
|
|
29
|
-
pointer-events: none;
|
|
30
|
-
}
|
|
31
|
-
.lagRadar-sweep > * {
|
|
32
|
-
shape-rendering: crispEdges;
|
|
33
|
-
}
|
|
34
|
-
.lagRadar-face {
|
|
35
|
-
fill: transparent;
|
|
36
|
-
}
|
|
37
|
-
.lagRadar-hand {
|
|
38
|
-
stroke-width: 4px;
|
|
39
|
-
stroke-linecap: round;
|
|
40
|
-
}
|
|
22
|
+
const styles = document.createTextNode(`
|
|
23
|
+
.lagRadar {
|
|
24
|
+
position: fixed;
|
|
25
|
+
bottom: 0.5rem;
|
|
26
|
+
right: 0.5rem;
|
|
27
|
+
}
|
|
28
|
+
.lagRadar {
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
31
|
+
.lagRadar-sweep > * {
|
|
32
|
+
shape-rendering: crispEdges;
|
|
33
|
+
}
|
|
34
|
+
.lagRadar-face {
|
|
35
|
+
fill: transparent;
|
|
36
|
+
}
|
|
37
|
+
.lagRadar-hand {
|
|
38
|
+
stroke-width: 4px;
|
|
39
|
+
stroke-linecap: round;
|
|
40
|
+
}
|
|
41
41
|
`);
|
|
42
42
|
function $svg(tag, props = {}, children = []) {
|
|
43
43
|
const el = document.createElementNS("http://www.w3.org/2000/svg", tag);
|