tw-react-components 0.0.184 → 0.0.187
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -5
- package/index.esm.js +26 -13
- package/package.json +3 -3
- package/src/components/Accordion/index.d.ts +19 -0
- package/src/components/index.d.ts +1 -0
- /package/{index.esm.d.ts → index.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -71,20 +71,17 @@ Add the following import to your main CSS file:
|
|
|
71
71
|
This library provides a wide range of components:
|
|
72
72
|
|
|
73
73
|
- **Layout:** Building blocks for page layouts
|
|
74
|
-
|
|
75
74
|
- `Layout` - Main container for your application
|
|
76
75
|
- `Flex` - Flexible box layout component
|
|
77
76
|
- `Block` - Block-level layout component
|
|
78
77
|
- `Card` - Container with styling and functionality
|
|
79
78
|
|
|
80
79
|
- **Navigation:**
|
|
81
|
-
|
|
82
80
|
- `Navbar` - Top navigation bar
|
|
83
81
|
- `Sidebar` - Side navigation component
|
|
84
82
|
- `Tabs` - Tabbed interface component
|
|
85
83
|
|
|
86
84
|
- **Data Display:**
|
|
87
|
-
|
|
88
85
|
- `Table` - Regular table component
|
|
89
86
|
- `DataTable` - Advanced data table with sorting and filtering
|
|
90
87
|
- `List` - Displaying lists of data
|
|
@@ -92,13 +89,11 @@ This library provides a wide range of components:
|
|
|
92
89
|
- `Badge` - Small status indicator
|
|
93
90
|
|
|
94
91
|
- **Input & Form:**
|
|
95
|
-
|
|
96
92
|
- `Button` - Various button styles
|
|
97
93
|
- `Form` - Form controls and helpers
|
|
98
94
|
- `Switch` - Toggle switch component
|
|
99
95
|
|
|
100
96
|
- **Feedback & Overlay:**
|
|
101
|
-
|
|
102
97
|
- `Dialog` - Modal dialog boxes
|
|
103
98
|
- `Popover` - Content that appears over the UI
|
|
104
99
|
- `Tooltip` - Information shown on hover
|
package/index.esm.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
3
|
+
import { ChevronDownIcon, HelpCircle, XIcon, AtSignIcon, EyeIcon, EyeOffIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, CalendarIcon, ClockIcon, CheckIcon, CircleIcon, CloudUploadIcon, ChevronsLeftIcon, ChevronsRightIcon, ChevronsDownUpIcon, ChevronsUpDownIcon, ArrowUpDownIcon, SortAscIcon, SortDescIcon, MinusIcon, PlusIcon, PanelLeft, GripVertical, MoonIcon, SunIcon, MonitorIcon, X } from 'lucide-react';
|
|
2
4
|
import { clsx } from 'clsx';
|
|
3
5
|
import { twMerge } from 'tailwind-merge';
|
|
4
6
|
import dayjs from 'dayjs';
|
|
5
7
|
import 'dayjs/locale/en.js';
|
|
6
8
|
import advancedFormat from 'dayjs/plugin/advancedFormat.js';
|
|
7
9
|
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, GripVertical, MoonIcon, SunIcon, MonitorIcon, X } from 'lucide-react';
|
|
9
10
|
import { useMemo, useState, useEffect, useId, useCallback, useRef, createContext, useContext } from 'react';
|
|
10
11
|
import localeData from 'dayjs/plugin/localeData.js';
|
|
11
12
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
@@ -143,6 +144,28 @@ function resolveTargetObject(payload, fieldChain, defaultValue) {
|
|
|
143
144
|
return resolveTargetObject(payload[key], rest, defaultValue);
|
|
144
145
|
}
|
|
145
146
|
|
|
147
|
+
const $Accordion = (_a) => {
|
|
148
|
+
var { dataTestId = 'accordion' } = _a, props = __rest(_a, ["dataTestId"]);
|
|
149
|
+
return (jsx(AccordionPrimitive.Root, Object.assign({ "data-testid": dataTestId, "data-slot": "accordion" }, props)));
|
|
150
|
+
};
|
|
151
|
+
const AccordionItem = (_a) => {
|
|
152
|
+
var { className, dataTestId = 'accordion-item' } = _a, props = __rest(_a, ["className", "dataTestId"]);
|
|
153
|
+
return (jsx(AccordionPrimitive.Item, Object.assign({ className: cn('border-b last:border-b-0', className), "data-slot": "accordion-item", "data-testid": dataTestId }, props)));
|
|
154
|
+
};
|
|
155
|
+
const AccordionTrigger = (_a) => {
|
|
156
|
+
var { className, children, dataTestId = 'accordion-trigger' } = _a, props = __rest(_a, ["className", "children", "dataTestId"]);
|
|
157
|
+
return (jsx(AccordionPrimitive.Header, { className: "flex", children: jsxs(AccordionPrimitive.Trigger, Object.assign({ className: cn('focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 cursor-pointer items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180', className), "data-slot": "accordion-trigger", "data-testid": dataTestId }, props, { children: [children, jsx(ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" })] })) }));
|
|
158
|
+
};
|
|
159
|
+
const AccordionContent = (_a) => {
|
|
160
|
+
var { className, children, dataTestId = 'accordion-content' } = _a, props = __rest(_a, ["className", "children", "dataTestId"]);
|
|
161
|
+
return (jsx(AccordionPrimitive.Content, Object.assign({ className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm", "data-slot": "accordion-content", "data-testid": dataTestId }, props, { children: jsx("div", { className: cn('pt-0 pb-4', className), children: children }) })));
|
|
162
|
+
};
|
|
163
|
+
const Accordion = Object.assign($Accordion, {
|
|
164
|
+
Item: AccordionItem,
|
|
165
|
+
Trigger: AccordionTrigger,
|
|
166
|
+
Content: AccordionContent,
|
|
167
|
+
});
|
|
168
|
+
|
|
146
169
|
const Block = (_a) => {
|
|
147
170
|
var { children, className, centered, container, fullWidth, fullHeight, dataTestId = 'block' } = _a, props = __rest(_a, ["children", "className", "centered", "container", "fullWidth", "fullHeight", "dataTestId"]);
|
|
148
171
|
return (jsx("div", Object.assign({ "data-testid": dataTestId, className: cn(centered && 'mx-auto', container && 'container', fullWidth && 'w-full', fullHeight && 'h-full', className) }, props, { children: children })));
|
|
@@ -1964,7 +1987,7 @@ const SidebarContextProvider = (_a) => {
|
|
|
1964
1987
|
var { defaultOpen = true, open: openProp, onOpenChange: setOpenProp, className, style, children } = _a, props = __rest(_a, ["defaultOpen", "open", "onOpenChange", "className", "style", "children"]);
|
|
1965
1988
|
const isMobile = useIsMobile();
|
|
1966
1989
|
const [openMobile, setOpenMobile] = useState(false);
|
|
1967
|
-
|
|
1990
|
+
useRef(typeof document === 'undefined' ? null : document.documentElement);
|
|
1968
1991
|
// This is the internal state of the sidebar.
|
|
1969
1992
|
// We use openProp and setOpenProp for control from outside the component.
|
|
1970
1993
|
const [_open, _setOpen] = useState(getValueFromCookie(SIDEBAR_COOKIE_NAME, defaultOpen));
|
|
@@ -1982,16 +2005,6 @@ const SidebarContextProvider = (_a) => {
|
|
|
1982
2005
|
const toggleSidebar = useCallback(() => {
|
|
1983
2006
|
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
1984
2007
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
1985
|
-
// Add swipe gesture support for opening and closing the sidebar.
|
|
1986
|
-
useOnSwipe(screenRef, (direction) => {
|
|
1987
|
-
const _setOpen = isMobile ? setOpenMobile : setOpen;
|
|
1988
|
-
if (direction === 'right') {
|
|
1989
|
-
_setOpen(true);
|
|
1990
|
-
}
|
|
1991
|
-
else if (direction === 'left') {
|
|
1992
|
-
_setOpen(false);
|
|
1993
|
-
}
|
|
1994
|
-
});
|
|
1995
2008
|
// Adds a keyboard shortcut to toggle the sidebar.
|
|
1996
2009
|
useEffect(() => {
|
|
1997
2010
|
const handleKeyDown = (event) => {
|
|
@@ -2432,4 +2445,4 @@ function Toaster() {
|
|
|
2432
2445
|
}), jsx(Toast.Viewport, {})] }));
|
|
2433
2446
|
}
|
|
2434
2447
|
|
|
2435
|
-
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, Toast, Toaster, Tooltip, cn, compareDates, generalComparator, getDisplayDate, getValueFromCookie, isEmpty, reducer, resolveTargetObject, toast, useDays, useIsMobile, useLayoutContext, useLongPress, useMonths, useOnSwipe, useOutsideClick, usePagination, useSidebar, useToast };
|
|
2448
|
+
export { Accordion, 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, Toast, Toaster, Tooltip, cn, compareDates, generalComparator, getDisplayDate, getValueFromCookie, isEmpty, reducer, resolveTargetObject, toast, useDays, useIsMobile, useLayoutContext, useLongPress, useMonths, useOnSwipe, useOutsideClick, usePagination, useSidebar, useToast };
|
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.187",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://bacali95.github.io/tw-react-components",
|
|
7
7
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
22
|
"import": "./index.esm.js",
|
|
23
|
-
"types": "./index.
|
|
23
|
+
"types": "./index.d.ts"
|
|
24
24
|
},
|
|
25
25
|
"./css": {
|
|
26
26
|
"default": "./index.css"
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
},
|
|
36
36
|
"module": "./index.esm.js",
|
|
37
37
|
"main": "./index.esm.js",
|
|
38
|
-
"types": "./index.
|
|
38
|
+
"types": "./index.d.ts"
|
|
39
39
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
2
|
+
import type { ComponentProps, FC } from 'react';
|
|
3
|
+
export type AccordionProps = ComponentProps<typeof AccordionPrimitive.Root> & {
|
|
4
|
+
dataTestId?: string;
|
|
5
|
+
};
|
|
6
|
+
export type AccordionItemProps = ComponentProps<typeof AccordionPrimitive.Item> & {
|
|
7
|
+
dataTestId?: string;
|
|
8
|
+
};
|
|
9
|
+
export type AccordionTriggerProps = ComponentProps<typeof AccordionPrimitive.Trigger> & {
|
|
10
|
+
dataTestId?: string;
|
|
11
|
+
};
|
|
12
|
+
export type AccordionContentProps = ComponentProps<typeof AccordionPrimitive.Content> & {
|
|
13
|
+
dataTestId?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const Accordion: FC<AccordionProps> & {
|
|
16
|
+
Item: FC<AccordionItemProps>;
|
|
17
|
+
Trigger: FC<AccordionTriggerProps>;
|
|
18
|
+
Content: FC<AccordionContentProps>;
|
|
19
|
+
};
|
|
File without changes
|