lecom-ui 5.2.59 → 5.2.61

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.
@@ -0,0 +1,169 @@
1
+ import * as React from 'react';
2
+ import { useFormContext, Controller } from 'react-hook-form';
3
+ import { cn } from '../../lib/utils.js';
4
+ import { Button } from '../Button/Button.js';
5
+
6
+ function DividerLine({
7
+ dashed,
8
+ plain,
9
+ isGroupDivider,
10
+ isActive,
11
+ className,
12
+ style
13
+ }) {
14
+ return /* @__PURE__ */ React.createElement(
15
+ "div",
16
+ {
17
+ className: cn(
18
+ "w-full",
19
+ isGroupDivider ? "my-4" : "my-2",
20
+ isActive ? "opacity-100" : "opacity-50",
21
+ className
22
+ ),
23
+ style
24
+ },
25
+ /* @__PURE__ */ React.createElement(
26
+ "div",
27
+ {
28
+ className: cn(
29
+ "w-full",
30
+ dashed ? "border-dashed" : "border-solid",
31
+ plain ? "border-gray-200" : "border-gray-300",
32
+ "border-t"
33
+ )
34
+ }
35
+ )
36
+ );
37
+ }
38
+ function OptionButtons({
39
+ value,
40
+ onChange,
41
+ isActive,
42
+ plain,
43
+ optionLabels,
44
+ ButtonComponent,
45
+ buttonSize
46
+ }) {
47
+ const [labelAnd, labelOr] = optionLabels;
48
+ const Btn = ButtonComponent;
49
+ return /* @__PURE__ */ React.createElement(
50
+ "div",
51
+ {
52
+ className: cn(
53
+ "relative z-10 inline-flex overflow-hidden",
54
+ plain ? "bg-white" : "rounded-md border border-gray-300 bg-white shadow-sm"
55
+ )
56
+ },
57
+ /* @__PURE__ */ React.createElement(
58
+ Btn,
59
+ {
60
+ variant: "ghost",
61
+ color: "grey",
62
+ size: buttonSize,
63
+ onClick: () => onChange("AND"),
64
+ disabled: !isActive,
65
+ className: cn(
66
+ "px-4 py-1 text-sm transition !rounded-none",
67
+ value === "AND" ? "bg-blue-600 text-white hover:bg-blue-500" : "bg-white text-gray-700 hover:bg-blue-50"
68
+ )
69
+ },
70
+ labelAnd
71
+ ),
72
+ /* @__PURE__ */ React.createElement(
73
+ Btn,
74
+ {
75
+ variant: "ghost",
76
+ color: "grey",
77
+ size: buttonSize,
78
+ onClick: () => onChange("OR"),
79
+ disabled: !isActive,
80
+ className: cn(
81
+ "px-4 py-1 text-sm transition !rounded-none",
82
+ value === "OR" ? "bg-blue-600 text-white hover:bg-blue-500" : "bg-white text-gray-700 hover:bg-blue-50"
83
+ )
84
+ },
85
+ labelOr
86
+ )
87
+ );
88
+ }
89
+ function CustomDivider({
90
+ name,
91
+ control,
92
+ isActive = true,
93
+ isGroupDivider = false,
94
+ orientation = "center",
95
+ dashed = false,
96
+ plain = false,
97
+ lineOnly = false,
98
+ optionLabels = ["E", "OU"],
99
+ ButtonComponent = Button,
100
+ buttonSize = "medium",
101
+ className,
102
+ style
103
+ }) {
104
+ if (lineOnly) {
105
+ return /* @__PURE__ */ React.createElement(
106
+ DividerLine,
107
+ {
108
+ dashed,
109
+ plain,
110
+ isGroupDivider,
111
+ isActive,
112
+ className,
113
+ style
114
+ }
115
+ );
116
+ }
117
+ const formContext = useFormContext();
118
+ const controlToUse = control ?? formContext.control;
119
+ const justifyMap = {
120
+ left: "justify-start",
121
+ center: "justify-center",
122
+ right: "justify-end"
123
+ };
124
+ return /* @__PURE__ */ React.createElement(
125
+ "div",
126
+ {
127
+ className: cn(
128
+ "relative w-full flex items-center",
129
+ isGroupDivider ? "my-4" : "my-2",
130
+ isActive ? "opacity-100" : "opacity-50",
131
+ justifyMap[orientation],
132
+ className
133
+ ),
134
+ style
135
+ },
136
+ /* @__PURE__ */ React.createElement(
137
+ "div",
138
+ {
139
+ className: cn(
140
+ "absolute inset-x-0",
141
+ dashed ? "border-dashed" : "border-solid",
142
+ plain ? "border-gray-200" : "border-gray-300",
143
+ "border-t"
144
+ )
145
+ }
146
+ ),
147
+ /* @__PURE__ */ React.createElement(
148
+ Controller,
149
+ {
150
+ name,
151
+ control: controlToUse,
152
+ render: ({ field: { value, onChange } }) => /* @__PURE__ */ React.createElement(
153
+ OptionButtons,
154
+ {
155
+ value,
156
+ onChange,
157
+ isActive,
158
+ plain,
159
+ optionLabels,
160
+ ButtonComponent,
161
+ buttonSize
162
+ }
163
+ )
164
+ }
165
+ )
166
+ );
167
+ }
168
+
169
+ export { CustomDivider };
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';
19
19
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
20
20
  import * as _radix_ui_react_slot from '@radix-ui/react-slot';
21
21
  import * as react_hook_form from 'react-hook-form';
22
- import { FieldValues, FieldPath, ControllerProps } from 'react-hook-form';
22
+ import { FieldValues, FieldPath, ControllerProps, Control } from 'react-hook-form';
23
23
  export { useForm } from 'react-hook-form';
24
24
  import * as LabelPrimitive from '@radix-ui/react-label';
25
25
  import { CustomStyles as CustomStyles$2 } from '@/components/Button';
@@ -1122,5 +1122,25 @@ type ComboboxProps = {
1122
1122
  };
1123
1123
  declare function Combobox({ options, value, onChange, placeholder, disabled, notFoundContent, status, searchTerm, triggerClassName, contentClassName, }: ComboboxProps): React$1.JSX.Element;
1124
1124
 
1125
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, CadastroFacil, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Combobox, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogScroll, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ErrorEmptyDisplay, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, Layout, LogoLecom, LogoLecomBrand, ModoTeste, MultiSelect, Notification, Pagination, PaginationContent, PaginationEllipsis, PaginationFirst, PaginationIndex, PaginationItem, PaginationLast, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, Rpa, SairModoTeste, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Spin, Switch, TOAST_REMOVE_DELAY, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TagInput, Textarea, ToggleGroup, ToggleGroupItem, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, Translations, TypeMessageNotification, Typography, Upload, accordionVariants, buttonVariants, colors, fonts, initializeI18n, inputVariants, notificationVariants, reducer, tagVariants, textareaVariants, toast, typographyVariants, useFormField, useIsMobile, useNotificationToast, usePagination, useSidebar };
1125
+ type Orientation = 'left' | 'center' | 'right';
1126
+ interface CustomDividerProps<T extends FieldValues> {
1127
+ name: FieldPath<T>;
1128
+ control?: Control<T>;
1129
+ isActive?: boolean;
1130
+ isGroupDivider?: boolean;
1131
+ orientation?: Orientation;
1132
+ dashed?: boolean;
1133
+ plain?: boolean;
1134
+ lineOnly?: boolean;
1135
+ optionLabels?: [React$1.ReactNode, React$1.ReactNode];
1136
+ ButtonComponent?: React$1.ComponentType<ButtonProps & {
1137
+ onClick(): void;
1138
+ }>;
1139
+ buttonSize?: ButtonProps['size'];
1140
+ className?: string;
1141
+ style?: React$1.CSSProperties;
1142
+ }
1143
+ declare function CustomDivider<T extends FieldValues>({ name, control, isActive, isGroupDivider, orientation, dashed, plain, lineOnly, optionLabels, ButtonComponent, buttonSize, className, style, }: CustomDividerProps<T>): React$1.JSX.Element;
1144
+
1145
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, CadastroFacil, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, Checkbox, Combobox, CustomDivider, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogScroll, DialogTitle, DialogTrigger, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ErrorEmptyDisplay, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, Layout, LogoLecom, LogoLecomBrand, ModoTeste, MultiSelect, Notification, Pagination, PaginationContent, PaginationEllipsis, PaginationFirst, PaginationIndex, PaginationItem, PaginationLast, PaginationNext, PaginationPrevious, Popover, PopoverContent, PopoverTrigger, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, Rpa, SairModoTeste, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Spin, Switch, TOAST_REMOVE_DELAY, Tabs, TabsContent, TabsList, TabsTrigger, Tag, TagInput, Textarea, ToggleGroup, ToggleGroupItem, Tooltip, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipTrigger, Translations, TypeMessageNotification, Typography, Upload, accordionVariants, buttonVariants, colors, fonts, initializeI18n, inputVariants, notificationVariants, reducer, tagVariants, textareaVariants, toast, typographyVariants, useFormField, useIsMobile, useNotificationToast, usePagination, useSidebar };
1126
1146
  export type { BgColor, BuildCellSelect, BuildColumns, BuildHeaderSelect, ButtonProps, CadastroFacilProps, CalloutNotificationProps, ChartConfig, CheckboxProps, CheckedCell, CheckedCellChange, CheckedHeader, CheckedHeaderChange, Color, ColorToken, Column, ColumnRender, ColumnSort, ColumnSortClient, ColumnTitle, ComboboxGroup, ComboboxOption, CustomStyles$1 as CustomStyles, DataTableProps, DialogContentProps, ErrorEmptyDisplayProps, File, FillColor, Fonts, Header, HeaderProps, InlineNotificationProps, InputProps, LayoutProps, LogoLecomBrandProps, LogoLecomProps, Meta, ModoTesteProps, NotificationProps, PaginationProps, Row, RpaProps, SideBarProps, SpinProps, TableProps, TagItem, TagProps, TextColor, TextareaProps, ToastNotificationProps, ToasterToast, TooltipContentProps, TypographyProps, UploadProps, UsePaginationItem };
package/dist/index.js CHANGED
@@ -46,6 +46,7 @@ export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, Dr
46
46
  export { TagInput } from './components/TagInput/TagInput.js';
47
47
  export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger } from './components/Sheet/Sheet.js';
48
48
  export { Combobox } from './components/Combobox/Combobox.js';
49
+ export { CustomDivider } from './components/CustomDivider/CustomDivider.js';
49
50
  export { Bar, BarChart, CartesianGrid, Label, LabelList, XAxis, YAxis } from 'recharts';
50
51
  export { z as zod } from 'zod';
51
52
  export { zodResolver } from '@hookform/resolvers/zod';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lecom-ui",
3
- "version": "5.2.59",
3
+ "version": "5.2.61",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",