tw-react-components 0.0.167 → 0.0.169
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/index.esm.js +23 -2
- package/package.json +1 -1
- package/src/components/Resizable/index.d.ts +17 -0
- package/src/components/index.d.ts +1 -0
package/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import dayjs from 'dayjs';
|
|
|
5
5
|
import 'dayjs/locale/en.js';
|
|
6
6
|
import advancedFormat from 'dayjs/plugin/advancedFormat.js';
|
|
7
7
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
8
|
-
import { HelpCircle, XIcon, AtSignIcon, EyeIcon, EyeOffIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronDownIcon, CalendarIcon, ClockIcon, CheckIcon, CircleIcon, CloudUploadIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsDownUpIcon, ChevronsUpDownIcon, ArrowUpDownIcon, SortAscIcon, SortDescIcon, MinusIcon, PlusIcon, PanelLeft, MoonIcon, SunIcon, MonitorIcon } from 'lucide-react';
|
|
8
|
+
import { HelpCircle, XIcon, AtSignIcon, EyeIcon, EyeOffIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, ChevronDownIcon, CalendarIcon, ClockIcon, CheckIcon, CircleIcon, CloudUploadIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsDownUpIcon, ChevronsUpDownIcon, ArrowUpDownIcon, SortAscIcon, SortDescIcon, MinusIcon, PlusIcon, PanelLeft, GripVertical, MoonIcon, SunIcon, MonitorIcon } from 'lucide-react';
|
|
9
9
|
import { useMemo, useState, useEffect, useId, useCallback, useRef, createContext, useContext } from 'react';
|
|
10
10
|
import localeData from 'dayjs/plugin/localeData.js';
|
|
11
11
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
@@ -20,6 +20,7 @@ import { CSS } from '@dnd-kit/utilities';
|
|
|
20
20
|
import { Slot } from '@radix-ui/react-slot';
|
|
21
21
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
22
22
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
23
|
+
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
23
24
|
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
24
25
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
25
26
|
|
|
@@ -747,6 +748,8 @@ function useOutsideClick(ref, callback) {
|
|
|
747
748
|
|
|
748
749
|
function usePagination(currentIndex, totalPages) {
|
|
749
750
|
return useMemo(() => {
|
|
751
|
+
if (totalPages === 0)
|
|
752
|
+
return [];
|
|
750
753
|
const result = [];
|
|
751
754
|
result.push(Math.min(currentIndex, totalPages));
|
|
752
755
|
if (totalPages > 7 && currentIndex > 4) {
|
|
@@ -2099,6 +2102,24 @@ const Popover = Object.assign($Popover, {
|
|
|
2099
2102
|
Content: PopoverContent,
|
|
2100
2103
|
});
|
|
2101
2104
|
|
|
2105
|
+
const ResizablePanelGroup = (_a) => {
|
|
2106
|
+
var { className, dataTestId = 'resizable-panel-group' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
2107
|
+
return (jsx(ResizablePrimitive.PanelGroup, Object.assign({ className: cn('flex h-full w-full data-[panel-group-direction=vertical]:flex-col', className), "data-testid": dataTestId }, props)));
|
|
2108
|
+
};
|
|
2109
|
+
const ResizablePanel = (_a) => {
|
|
2110
|
+
var { dataTestId = 'resizable-panel' } = _a, props = __rest(_a, ["dataTestId"]);
|
|
2111
|
+
return (jsx(ResizablePrimitive.Panel, Object.assign({ "data-testid": dataTestId }, props)));
|
|
2112
|
+
};
|
|
2113
|
+
const ResizableHandle = (_a) => {
|
|
2114
|
+
var { withHandle, className, dataTestId = 'resizable-handle' } = _a, props = __rest(_a, ["withHandle", "className", "dataTestId"]);
|
|
2115
|
+
return (jsx(ResizablePrimitive.PanelResizeHandle, Object.assign({ className: cn('bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1', 'data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90', className), "data-testid": dataTestId }, props, { children: withHandle && (jsx("div", { className: "bg-border z-10 flex h-4 w-3 items-center justify-center rounded-sm border", "data-testid": `${dataTestId}-handle`, children: jsx(GripVertical, { className: "h-2.5 w-2.5" }) })) })));
|
|
2116
|
+
};
|
|
2117
|
+
const Resizable = {
|
|
2118
|
+
PanelGroup: ResizablePanelGroup,
|
|
2119
|
+
Panel: ResizablePanel,
|
|
2120
|
+
Handle: ResizableHandle,
|
|
2121
|
+
};
|
|
2122
|
+
|
|
2102
2123
|
const Switch = (_a) => {
|
|
2103
2124
|
var { className } = _a, _b = _a.thumbProps, _c = _b === void 0 ? {} : _b, { className: thumbClassName } = _c, thumbProps = __rest(_c, ["className"]), { dataTestId = 'switch' } = _a, props = __rest(_a, ["className", "thumbProps", "dataTestId"]);
|
|
2104
2125
|
return (jsx(SwitchPrimitives.Root, Object.assign({ className: cn('peer inline-flex h-[calc(1.5rem+6px)] w-[calc(3rem+6px)] shrink-0 cursor-pointer items-center rounded-full border-[3px] border-transparent', 'transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-600 focus-visible:ring-offset-2', 'focus-visible:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-blue-600 data-[state=unchecked]:bg-slate-300', 'dark:focus-visible:ring-slate-200 dark:focus-visible:ring-offset-slate-800 dark:data-[state=checked]:bg-blue-700 dark:data-[state=unchecked]:bg-slate-700', className), "data-testid": dataTestId }, props, { children: jsx(SwitchPrimitives.Thumb, Object.assign({ className: cn('pointer-events-none block h-6 w-6 rounded-full bg-white shadow-lg ring-0 transition-transform', 'data-[state=checked]:translate-x-6 data-[state=unchecked]:translate-x-0 dark:bg-slate-900', thumbClassName), "data-testid": `${dataTestId}-thumb` }, thumbProps)) })));
|
|
@@ -2193,4 +2214,4 @@ const ThemeSelector = ({ className, dataTestId = 'theme-selector' }) => {
|
|
|
2193
2214
|
return (jsxs(DropdownMenu, { children: [jsx(DropdownMenu.Trigger, { asChild: true, dataTestId: `${dataTestId}-trigger`, children: jsx(Button, { prefixIcon: resolvedTheme === 'dark' ? MoonIcon : SunIcon, className: className, variant: "text" }) }), jsxs(DropdownMenu.Content, { dataTestId: `${dataTestId}-content`, children: [jsxs(DropdownMenu.Item, { onClick: () => setTheme('light'), dataTestId: `${dataTestId}-light`, children: [jsx(DropdownMenu.Icon, { icon: SunIcon }), "Light"] }), jsxs(DropdownMenu.Item, { onClick: () => setTheme('dark'), dataTestId: `${dataTestId}-dark`, children: [jsx(DropdownMenu.Icon, { icon: MoonIcon }), "Dark"] }), jsxs(DropdownMenu.Item, { onClick: () => setTheme('system'), dataTestId: `${dataTestId}-system`, children: [jsx(DropdownMenu.Icon, { icon: MonitorIcon }), "System"] })] })] }));
|
|
2194
2215
|
};
|
|
2195
2216
|
|
|
2196
|
-
export { Badge, BasicInput, BasicInputExtension, Block, Button, Card, CheckboxInput, Collapsible, ConfirmDialog, DataTable, DateTimeInput, Dialog, DropdownMenu, EmailInput, FileInput, Flex, FormDialog, FormGroup, FormInputs, Hint, Label, Layout, LayoutContext, LayoutContextProvider, List, ListSorter, ListSorterDialog, Navbar, NumberInput, Pagination, PasswordInput, PdfViewerDialog, Popover, SHOW_IDS_COOKIE_MAX_AGE, SHOW_IDS_COOKIE_NAME, SIDEBAR_COOKIE_MAX_AGE, SIDEBAR_COOKIE_NAME, SIDEBAR_KEYBOARD_SHORTCUT, SIDEBAR_WIDTH, SIDEBAR_WIDTH_ICON, SIDEBAR_WIDTH_MOBILE, SelectInput, Separator, Sheet, Sidebar, SidebarContext, SidebarContextProvider, Skeleton, Spinner, Switch, THEME_COOKIE_MAX_AGE, THEME_COOKIE_NAME, THEME_MEDIA_QUERY, Table, Tabs, TextInput, TextareaInput, ThemeSelector, Tooltip, cn, compareDates, generalComparator, getDisplayDate, getValueFromCookie, isEmpty, resolveTargetObject, useDays, useIsMobile, useLayoutContext, useLongPress, useMonths, useOnSwipe, useOutsideClick, usePagination, useSidebar };
|
|
2217
|
+
export { Badge, BasicInput, BasicInputExtension, Block, Button, Card, CheckboxInput, Collapsible, ConfirmDialog, DataTable, DateTimeInput, Dialog, DropdownMenu, EmailInput, FileInput, Flex, FormDialog, FormGroup, FormInputs, Hint, Label, Layout, LayoutContext, LayoutContextProvider, List, ListSorter, ListSorterDialog, Navbar, NumberInput, Pagination, PasswordInput, PdfViewerDialog, Popover, Resizable, SHOW_IDS_COOKIE_MAX_AGE, SHOW_IDS_COOKIE_NAME, SIDEBAR_COOKIE_MAX_AGE, SIDEBAR_COOKIE_NAME, SIDEBAR_KEYBOARD_SHORTCUT, SIDEBAR_WIDTH, SIDEBAR_WIDTH_ICON, SIDEBAR_WIDTH_MOBILE, SelectInput, Separator, Sheet, Sidebar, SidebarContext, SidebarContextProvider, Skeleton, Spinner, Switch, THEME_COOKIE_MAX_AGE, THEME_COOKIE_NAME, THEME_MEDIA_QUERY, Table, Tabs, TextInput, TextareaInput, ThemeSelector, Tooltip, cn, compareDates, generalComparator, getDisplayDate, getValueFromCookie, isEmpty, resolveTargetObject, useDays, useIsMobile, useLayoutContext, useLongPress, useMonths, useOnSwipe, useOutsideClick, usePagination, useSidebar };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tw-react-components",
|
|
3
3
|
"description": "A set of React components build with TailwindCSS to make a nice dashboard.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.169",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://bacali95.github.io/tw-react-components",
|
|
7
7
|
"type": "module",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import * as ResizablePrimitive from 'react-resizable-panels';
|
|
3
|
+
export type ResizablePanelGroupProps = React.ComponentProps<typeof ResizablePrimitive.PanelGroup> & {
|
|
4
|
+
dataTestId?: string;
|
|
5
|
+
};
|
|
6
|
+
export type ResizablePanelProps = React.ComponentProps<typeof ResizablePrimitive.Panel> & {
|
|
7
|
+
dataTestId?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ResizableHandleProps = React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
|
|
10
|
+
withHandle?: boolean;
|
|
11
|
+
dataTestId?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const Resizable: {
|
|
14
|
+
PanelGroup: FC<ResizablePanelGroupProps>;
|
|
15
|
+
Panel: FC<ResizablePanelProps>;
|
|
16
|
+
Handle: FC<ResizableHandleProps>;
|
|
17
|
+
};
|