tw-react-components 0.0.164 → 0.0.166

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.
Files changed (44) hide show
  1. package/README.md +173 -1
  2. package/index.esm.js +292 -255
  3. package/package.json +1 -1
  4. package/src/components/Badge/index.d.ts +1 -0
  5. package/src/components/Block/index.d.ts +1 -0
  6. package/src/components/Button/index.d.ts +1 -0
  7. package/src/components/Collapsible/index.d.ts +14 -3
  8. package/src/components/DataTable/index.d.ts +2 -1
  9. package/src/components/Dialog/ConfirmDialog.d.ts +1 -0
  10. package/src/components/Dialog/Dialog.d.ts +27 -9
  11. package/src/components/Dialog/FormDialog.d.ts +2 -1
  12. package/src/components/Dialog/ListSorterDialog.d.ts +2 -1
  13. package/src/components/Dialog/PdfViewerDialog.d.ts +1 -0
  14. package/src/components/DropdownMenu/index.d.ts +62 -29
  15. package/src/components/Form/controls/Label.d.ts +1 -0
  16. package/src/components/Form/controls/custom/date-time/DateSelector.d.ts +1 -0
  17. package/src/components/Form/controls/custom/date-time/DaysView.d.ts +1 -0
  18. package/src/components/Form/controls/custom/date-time/MonthsView.d.ts +1 -0
  19. package/src/components/Form/controls/custom/date-time/TimeSelector.d.ts +1 -0
  20. package/src/components/Form/controls/custom/date-time/YearsView.d.ts +1 -0
  21. package/src/components/Form/controls/custom/date-time/index.d.ts +1 -1
  22. package/src/components/Form/controls/custom/file.d.ts +1 -1
  23. package/src/components/Form/controls/custom/select/index.d.ts +2 -2
  24. package/src/components/Form/controls/primitive/BasicInput.d.ts +3 -1
  25. package/src/components/Hint/index.d.ts +7 -3
  26. package/src/components/Layout/index.d.ts +8 -9
  27. package/src/components/List/index.d.ts +34 -20
  28. package/src/components/ListSorter/index.d.ts +2 -1
  29. package/src/components/Navbar/index.d.ts +1 -0
  30. package/src/components/Pagination/index.d.ts +1 -0
  31. package/src/components/Popover/index.d.ts +4 -1
  32. package/src/components/Separator/index.d.ts +4 -1
  33. package/src/components/Sheet/index.d.ts +21 -5
  34. package/src/components/Sidebar/index.d.ts +107 -63
  35. package/src/components/Skeleton/index.d.ts +4 -1
  36. package/src/components/Spinner/index.d.ts +1 -0
  37. package/src/components/Switch/index.d.ts +2 -2
  38. package/src/components/Table/index.d.ts +30 -8
  39. package/src/components/Tabs/index.d.ts +18 -5
  40. package/src/components/ThemeSelector/index.d.ts +1 -0
  41. package/src/components/Tooltip/index.d.ts +1 -0
  42. package/src/helpers/getDisplayDate.d.ts +6 -1
  43. package/src/helpers/getValueFromCookie.d.ts +1 -1
  44. package/src/test-setup.d.ts +1 -0
@@ -1,5 +1,8 @@
1
1
  import { type VariantProps } from 'class-variance-authority';
2
2
  import type { ComponentProps, FC } from 'react';
3
+ import { Button } from '../Button';
4
+ import { BasicInput } from '../Form';
5
+ import { Separator } from '../Separator';
3
6
  import { Tooltip } from '../Tooltip';
4
7
  export declare const SIDEBAR_COOKIE_NAME = "sidebar:state";
5
8
  export declare const SIDEBAR_COOKIE_MAX_AGE: number;
@@ -18,75 +21,116 @@ export type SidebarContext = {
18
21
  };
19
22
  export declare const SidebarContext: import("react").Context<SidebarContext | null>;
20
23
  export declare function useSidebar(): SidebarContext;
21
- export declare const SidebarContextProvider: FC<ComponentProps<'div'> & {
24
+ export type SidebarContextProviderProps = ComponentProps<'div'> & {
22
25
  defaultOpen?: boolean;
23
26
  open?: boolean;
24
27
  onOpenChange?: (open: boolean) => void;
25
- }>;
26
- export declare const Sidebar: FC<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
27
- side?: "left" | "right";
28
- variant?: "sidebar" | "floating" | "inset";
29
- collapsible?: "offcanvas" | "icon" | "none";
30
- }> & {
31
- Content: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
32
- Footer: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
33
- Group: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
34
- GroupAction: FC<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
35
- asChild?: boolean;
36
- }>;
37
- GroupContent: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
38
- GroupLabel: FC<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
39
- asChild?: boolean;
40
- }>;
41
- Header: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
42
- Input: FC<{
43
- inputClassName?: string;
44
- extensionClassName?: string;
45
- type?: import("../Form").InputType;
46
- label?: string;
47
- description?: import("react").ReactNode;
48
- size?: import("..").Size;
49
- hasErrors?: boolean;
50
- clearable?: boolean;
51
- suffixIcon?: FC<ComponentProps<"svg">>;
52
- onClear?: () => void;
53
- onSuffixIconClick?: (event: import("react").MouseEvent<HTMLDivElement>) => void;
54
- } & Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> | import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "id" | "size">>;
55
- Inset: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>>;
56
- Menu: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>>;
57
- MenuAction: FC<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
58
- asChild?: boolean;
59
- showOnHover?: boolean;
60
- }>;
61
- MenuBadge: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
62
- MenuButton: FC<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
63
- asChild?: boolean;
64
- isActive?: boolean;
65
- tooltip?: string | ComponentProps<typeof Tooltip>;
66
- } & VariantProps<(props?: ({
67
- variant?: "default" | "outline" | null | undefined;
68
- size?: "default" | "sm" | "lg" | null | undefined;
69
- } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string>>;
70
- MenuItem: FC<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>>;
71
- MenuSkeleton: FC<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
72
- showIcon?: boolean;
73
- }>;
74
- MenuSub: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>>;
28
+ };
29
+ export declare const SidebarContextProvider: FC<SidebarContextProviderProps>;
30
+ export type SidebarProps = ComponentProps<'div'> & {
31
+ side?: 'left' | 'right';
32
+ variant?: 'sidebar' | 'floating' | 'inset';
33
+ collapsible?: 'offcanvas' | 'icon' | 'none';
34
+ dataTestId?: string;
35
+ };
36
+ export type SidebarTriggerProps = ComponentProps<typeof Button> & {
37
+ dataTestId?: string;
38
+ };
39
+ export type SidebarRailProps = ComponentProps<'button'> & {
40
+ dataTestId?: string;
41
+ };
42
+ export type SidebarInsetProps = ComponentProps<'main'> & {
43
+ dataTestId?: string;
44
+ };
45
+ export type SidebarInputProps = ComponentProps<typeof BasicInput> & {
46
+ dataTestId?: string;
47
+ };
48
+ export type SidebarHeaderProps = ComponentProps<'div'> & {
49
+ dataTestId?: string;
50
+ };
51
+ export type SidebarFooterProps = ComponentProps<'div'> & {
52
+ dataTestId?: string;
53
+ };
54
+ export type SidebarSeparatorProps = ComponentProps<typeof Separator> & {
55
+ dataTestId?: string;
56
+ };
57
+ export type SidebarContentProps = ComponentProps<'div'> & {
58
+ dataTestId?: string;
59
+ };
60
+ export type SidebarGroupProps = ComponentProps<'div'> & {
61
+ dataTestId?: string;
62
+ };
63
+ export type SidebarGroupLabelProps = ComponentProps<'div'> & {
64
+ asChild?: boolean;
65
+ dataTestId?: string;
66
+ };
67
+ export type SidebarGroupActionProps = ComponentProps<'button'> & {
68
+ asChild?: boolean;
69
+ dataTestId?: string;
70
+ };
71
+ export type SidebarGroupContentProps = ComponentProps<'div'> & {
72
+ dataTestId?: string;
73
+ };
74
+ export type SidebarMenuProps = ComponentProps<'ul'> & {
75
+ dataTestId?: string;
76
+ };
77
+ export type SidebarMenuItemProps = ComponentProps<'li'> & {
78
+ dataTestId?: string;
79
+ };
80
+ declare const sidebarMenuButtonVariants: (props?: ({
81
+ variant?: "default" | "outline" | null | undefined;
82
+ size?: "default" | "sm" | "lg" | null | undefined;
83
+ } & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
84
+ export type SidebarMenuButtonProps = ComponentProps<'button'> & {
85
+ asChild?: boolean;
86
+ isActive?: boolean;
87
+ tooltip?: string | ComponentProps<typeof Tooltip>;
88
+ dataTestId?: string;
89
+ } & VariantProps<typeof sidebarMenuButtonVariants>;
90
+ export type SidebarMenuActionProps = ComponentProps<'button'> & {
91
+ asChild?: boolean;
92
+ showOnHover?: boolean;
93
+ dataTestId?: string;
94
+ };
95
+ export type SidebarMenuBadgeProps = ComponentProps<'div'> & {
96
+ dataTestId?: string;
97
+ };
98
+ export type SidebarMenuSkeletonProps = ComponentProps<'div'> & {
99
+ showIcon?: boolean;
100
+ dataTestId?: string;
101
+ };
102
+ export type SidebarMenuSubProps = ComponentProps<'ul'> & {
103
+ dataTestId?: string;
104
+ };
105
+ export type SidebarMenuSubItemProps = ComponentProps<'li'> & {
106
+ dataTestId?: string;
107
+ };
108
+ export declare const Sidebar: FC<SidebarProps> & {
109
+ Content: FC<SidebarContentProps>;
110
+ Footer: FC<SidebarFooterProps>;
111
+ Group: FC<SidebarGroupProps>;
112
+ GroupAction: FC<SidebarGroupActionProps>;
113
+ GroupContent: FC<SidebarGroupContentProps>;
114
+ GroupLabel: FC<SidebarGroupLabelProps>;
115
+ Header: FC<SidebarHeaderProps>;
116
+ Input: FC<SidebarInputProps>;
117
+ Inset: FC<SidebarInsetProps>;
118
+ Menu: FC<SidebarMenuProps>;
119
+ MenuAction: FC<SidebarMenuActionProps>;
120
+ MenuBadge: FC<SidebarMenuBadgeProps>;
121
+ MenuButton: FC<SidebarMenuButtonProps>;
122
+ MenuItem: FC<SidebarMenuItemProps>;
123
+ MenuSkeleton: FC<SidebarMenuSkeletonProps>;
124
+ MenuSub: FC<SidebarMenuSubProps>;
75
125
  MenuSubButton: FC<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
76
126
  asChild?: boolean;
77
127
  size?: "sm" | "md";
78
128
  isActive?: boolean;
129
+ dataTestId?: string;
79
130
  }>;
80
- MenuSubItem: FC<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>>;
81
- Rail: FC<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>>;
82
- Separator: FC<import("@radix-ui/react-separator").SeparatorProps & import("react").RefAttributes<HTMLDivElement>>;
83
- Trigger: FC<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
84
- size?: import("..").Size;
85
- color?: import("..").Color;
86
- variant?: import("../Button").ButtonVariant;
87
- rounded?: boolean;
88
- prefixIcon?: import("lucide-react").LucideIcon;
89
- suffixIcon?: import("lucide-react").LucideIcon;
90
- unstyled?: boolean;
91
- }>;
131
+ MenuSubItem: FC<SidebarMenuSubItemProps>;
132
+ Rail: FC<SidebarRailProps>;
133
+ Separator: FC<SidebarSeparatorProps>;
134
+ Trigger: FC<SidebarTriggerProps>;
92
135
  };
136
+ export {};
@@ -1,2 +1,5 @@
1
1
  import type { FC, HTMLAttributes } from 'react';
2
- export declare const Skeleton: FC<HTMLAttributes<HTMLDivElement>>;
2
+ export type SkeletonProps = HTMLAttributes<HTMLDivElement> & {
3
+ dataTestId?: string;
4
+ };
5
+ export declare const Skeleton: FC<SkeletonProps>;
@@ -2,6 +2,7 @@ import type { FC } from 'react';
2
2
  type Props = {
3
3
  className?: string;
4
4
  fullScreen?: boolean;
5
+ dataTestId?: string;
5
6
  };
6
7
  export declare const Spinner: FC<Props>;
7
8
  export {};
@@ -2,6 +2,6 @@ import * as SwitchPrimitives from '@radix-ui/react-switch';
2
2
  import type { ComponentProps, FC } from 'react';
3
3
  export type SwitchProps = ComponentProps<typeof SwitchPrimitives.Root> & {
4
4
  thumbProps?: ComponentProps<typeof SwitchPrimitives.Thumb>;
5
+ dataTestId?: string;
5
6
  };
6
- declare const Switch: FC<SwitchProps>;
7
- export { Switch };
7
+ export declare const Switch: FC<SwitchProps>;
@@ -1,9 +1,31 @@
1
- import type { FC } from 'react';
2
- export declare const Table: FC<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>> & {
3
- Head: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
4
- HeadCell: FC<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>>;
5
- Body: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
6
- Row: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>>;
7
- Cell: FC<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>>;
8
- Footer: FC<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>>;
1
+ import type { ComponentProps, FC } from 'react';
2
+ type TableProps = ComponentProps<'table'> & {
3
+ dataTestId?: string;
9
4
  };
5
+ type TableHeadProps = ComponentProps<'thead'> & {
6
+ dataTestId?: string;
7
+ };
8
+ type TableHeadCellProps = ComponentProps<'th'> & {
9
+ dataTestId?: string;
10
+ };
11
+ type TableBodyProps = ComponentProps<'tbody'> & {
12
+ dataTestId?: string;
13
+ };
14
+ type TableRowProps = ComponentProps<'tr'> & {
15
+ dataTestId?: string;
16
+ };
17
+ type TableCellProps = ComponentProps<'td'> & {
18
+ dataTestId?: string;
19
+ };
20
+ type TableFooterProps = ComponentProps<'tfoot'> & {
21
+ dataTestId?: string;
22
+ };
23
+ export declare const Table: FC<TableProps> & {
24
+ Head: FC<TableHeadProps>;
25
+ HeadCell: FC<TableHeadCellProps>;
26
+ Body: FC<TableBodyProps>;
27
+ Row: FC<TableRowProps>;
28
+ Cell: FC<TableCellProps>;
29
+ Footer: FC<TableFooterProps>;
30
+ };
31
+ export {};
@@ -1,7 +1,20 @@
1
1
  import * as TabsPrimitive from '@radix-ui/react-tabs';
2
- import type { FC } from 'react';
3
- export declare const Tabs: FC<TabsPrimitive.TabsProps & import("react").RefAttributes<HTMLDivElement>> & {
4
- List: FC<TabsPrimitive.TabsListProps & import("react").RefAttributes<HTMLDivElement>>;
5
- Trigger: FC<TabsPrimitive.TabsTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
6
- Content: import("react").ForwardRefExoticComponent<TabsPrimitive.TabsContentProps & import("react").RefAttributes<HTMLDivElement>>;
2
+ import type { ComponentProps, FC } from 'react';
3
+ type TabsProps = ComponentProps<typeof TabsPrimitive.Root> & {
4
+ dataTestId?: string;
7
5
  };
6
+ type TabsListProps = ComponentProps<typeof TabsPrimitive.List> & {
7
+ dataTestId?: string;
8
+ };
9
+ type TabsTriggerProps = ComponentProps<typeof TabsPrimitive.Trigger> & {
10
+ dataTestId?: string;
11
+ };
12
+ type TabsContentProps = ComponentProps<typeof TabsPrimitive.Content> & {
13
+ dataTestId?: string;
14
+ };
15
+ export declare const Tabs: FC<TabsProps> & {
16
+ List: FC<TabsListProps>;
17
+ Trigger: FC<TabsTriggerProps>;
18
+ Content: FC<TabsContentProps>;
19
+ };
20
+ export {};
@@ -1,6 +1,7 @@
1
1
  import type { FC } from 'react';
2
2
  type Props = {
3
3
  className?: string;
4
+ dataTestId?: string;
4
5
  };
5
6
  export declare const ThemeSelector: FC<Props>;
6
7
  export {};
@@ -5,5 +5,6 @@ export type TooltipProps = PropsWithChildren<{
5
5
  content: ReactNode;
6
6
  asChild?: boolean;
7
7
  placement?: TooltipPrimitive.TooltipContentProps['side'];
8
+ dataTestId?: string;
8
9
  }>;
9
10
  export declare const Tooltip: FC<TooltipProps>;
@@ -1 +1,6 @@
1
- export declare function getDisplayDate(date: Date, format: string, locale?: string): string;
1
+ import 'dayjs/locale/en';
2
+ export declare function getDisplayDate(date: Date, { format, locale, offset, }: {
3
+ format?: string;
4
+ locale?: string;
5
+ offset?: number;
6
+ }): string;
@@ -1 +1 @@
1
- export declare function getValueFromCookie<T extends string | boolean>(key: string, _default: T): T;
1
+ export declare function getValueFromCookie<T extends string | number | boolean>(key: string, _default: T): T;
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';