lecom-ui 5.2.12 → 5.2.13
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 +1 -1
- package/dist/badge.js +26 -0
- package/dist/button-dropdown.js +117 -0
- package/dist/button.js +104 -0
- package/dist/calendar.js +62 -0
- package/dist/card.js +56 -0
- package/dist/checkbox.js +55 -0
- package/dist/collapse.js +60 -0
- package/dist/collapsible.js +7 -0
- package/dist/command.js +107 -0
- package/dist/data-table/data-table.js +490 -0
- package/dist/date-picker.js +92 -0
- package/dist/dialog.js +95 -0
- package/dist/dropdown-menu.js +138 -0
- package/dist/fonts/Montserrat-Bold.otf +0 -0
- package/dist/fonts/Montserrat-Medium.otf +0 -0
- package/dist/fonts/Montserrat-Regular.otf +0 -0
- package/dist/fonts/Roboto-Bold.otf +0 -0
- package/dist/fonts/Roboto-Light.otf +0 -0
- package/dist/fonts/Roboto-Medium.otf +0 -0
- package/dist/fonts/Roboto-Regular.otf +0 -0
- package/dist/form.js +102 -0
- package/dist/header.js +90 -0
- package/dist/hook/useDebounce.js +16 -0
- package/dist/icon-handler.js +72 -0
- package/dist/icons/brandModules.js +27 -0
- package/dist/icons/companyLogo.js +61 -0
- package/dist/icons/createUseAuxiliary.js +107 -0
- package/dist/icons/footerInfo.js +25 -0
- package/dist/icons/logo_lecom.svg.js +3 -0
- package/dist/icons/newUpdate.js +23 -0
- package/dist/icons/robertyRPA.js +30 -0
- package/dist/ilustrations/access_denied.js +252 -0
- package/dist/ilustrations/page_not_found.js +188 -0
- package/dist/input.js +42 -0
- package/dist/label.js +20 -0
- package/dist/modal.js +27 -0
- package/dist/pagination.js +474 -0
- package/dist/plugin/extend.js +78 -78
- package/dist/plugin/extend.ts +78 -0
- package/dist/plugin/fontFaces.js +172 -172
- package/dist/plugin/fontFaces.ts +172 -0
- package/dist/plugin/general.js +12 -12
- package/dist/plugin/general.ts +12 -0
- package/dist/plugin/pluginDev.cjs +5 -5
- package/dist/plugin/pluginDev.js +5 -0
- package/dist/plugin/pluginNext.cjs +5 -5
- package/dist/plugin/pluginNext.js +5 -0
- package/dist/plugin/pluginNextTurbo.cjs +5 -5
- package/dist/plugin/pluginVite.cjs +5 -5
- package/dist/plugin/pluginVite.js +5 -0
- package/dist/plugin/template.js +31 -31
- package/dist/plugin/template.ts +31 -0
- package/dist/plugin/typographies.js +152 -152
- package/dist/plugin/typographies.ts +152 -0
- package/dist/plugin/varsTheme.js +79 -79
- package/dist/plugin/varsTheme.ts +79 -0
- package/dist/plugin.cjs +298 -0
- package/dist/popover.js +24 -0
- package/dist/radio-group.js +74 -0
- package/dist/range-picker.js +99 -0
- package/dist/scroll-area.js +37 -0
- package/dist/search-bar.js +151 -0
- package/dist/select.js +156 -0
- package/dist/separator.js +24 -0
- package/dist/sheet.js +106 -0
- package/dist/sidebar.js +188 -0
- package/dist/skeleton.js +17 -0
- package/dist/slider.js +23 -0
- package/dist/status-screen.js +71 -0
- package/dist/switch.js +27 -0
- package/dist/table.js +83 -0
- package/dist/tabs.js +44 -0
- package/dist/tag.js +33 -0
- package/dist/textarea.js +22 -0
- package/dist/toast.js +105 -0
- package/dist/toaster.js +23 -0
- package/dist/tooltip.js +133 -0
- package/dist/use-toast.js +121 -0
- package/package.json +1 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { parse, isValid, format } from 'date-fns';
|
|
4
|
+
import { ptBR } from 'date-fns/locale';
|
|
5
|
+
import { Calendar } from 'lucide-react';
|
|
6
|
+
import { cn } from './lib/utils.js';
|
|
7
|
+
import { Calendar as Calendar$1 } from './calendar.js';
|
|
8
|
+
import { Input } from './input.js';
|
|
9
|
+
import { Popover, PopoverTrigger, PopoverContent } from './popover.js';
|
|
10
|
+
|
|
11
|
+
function RangePicker({
|
|
12
|
+
selected,
|
|
13
|
+
onSelect,
|
|
14
|
+
format: format$1 = "dd/MM/yyyy",
|
|
15
|
+
placeholder = "",
|
|
16
|
+
className = "",
|
|
17
|
+
...props
|
|
18
|
+
}) {
|
|
19
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
20
|
+
const [inputValue, setInputValue] = useState("");
|
|
21
|
+
const handleInputChange = (e) => {
|
|
22
|
+
setInputValue(e.currentTarget.value);
|
|
23
|
+
const range = (e.currentTarget.value || "").split(" - ");
|
|
24
|
+
const from = range[0];
|
|
25
|
+
const to = range[1];
|
|
26
|
+
const date = {
|
|
27
|
+
from: parse(from, format$1, /* @__PURE__ */ new Date()),
|
|
28
|
+
to: parse(to, format$1, /* @__PURE__ */ new Date())
|
|
29
|
+
};
|
|
30
|
+
if (isValid(date.from) && isValid(date.to) && typeof onSelect === "function") ;
|
|
31
|
+
};
|
|
32
|
+
const handleSelect = (range) => {
|
|
33
|
+
if (range?.from && range.to) {
|
|
34
|
+
setInputValue(
|
|
35
|
+
`${format(range.from, format$1)} - ${format(range.to, format$1)}`
|
|
36
|
+
);
|
|
37
|
+
setIsOpen(false);
|
|
38
|
+
} else {
|
|
39
|
+
setInputValue("");
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return /* @__PURE__ */ jsxs(
|
|
43
|
+
Popover,
|
|
44
|
+
{
|
|
45
|
+
open: isOpen,
|
|
46
|
+
onOpenChange: (open) => {
|
|
47
|
+
setIsOpen(open);
|
|
48
|
+
},
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
PopoverTrigger,
|
|
52
|
+
{
|
|
53
|
+
onClick: (e) => {
|
|
54
|
+
if (isOpen) {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
59
|
+
/* @__PURE__ */ jsx(Calendar, { className: "w-4 h-4 absolute right-[10px] top-[10px]" }),
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
Input,
|
|
62
|
+
{
|
|
63
|
+
placeholder,
|
|
64
|
+
value: inputValue,
|
|
65
|
+
onChange: handleInputChange,
|
|
66
|
+
className: cn("pr-8", className)
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] })
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
PopoverContent,
|
|
74
|
+
{
|
|
75
|
+
className: "w-auto p-0",
|
|
76
|
+
align: "start",
|
|
77
|
+
onOpenAutoFocus: (e) => {
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
},
|
|
80
|
+
children: /* @__PURE__ */ jsx(
|
|
81
|
+
Calendar$1,
|
|
82
|
+
{
|
|
83
|
+
mode: "range",
|
|
84
|
+
locale: ptBR,
|
|
85
|
+
selected,
|
|
86
|
+
onSelect: handleSelect,
|
|
87
|
+
numberOfMonths: 2,
|
|
88
|
+
...props
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
RangePicker.displayName = "RangePicker";
|
|
98
|
+
|
|
99
|
+
export { RangePicker };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
4
|
+
import { cn } from './lib/utils.js';
|
|
5
|
+
|
|
6
|
+
const ScrollArea = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
7
|
+
ScrollAreaPrimitive.Root,
|
|
8
|
+
{
|
|
9
|
+
ref,
|
|
10
|
+
className: cn("relative overflow-hidden", className),
|
|
11
|
+
...props,
|
|
12
|
+
children: [
|
|
13
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
|
|
14
|
+
/* @__PURE__ */ jsx(ScrollBar, {}),
|
|
15
|
+
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
));
|
|
19
|
+
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
|
|
20
|
+
const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
21
|
+
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
22
|
+
{
|
|
23
|
+
ref,
|
|
24
|
+
orientation,
|
|
25
|
+
className: cn(
|
|
26
|
+
"flex touch-none select-none transition-colors",
|
|
27
|
+
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
28
|
+
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
...props,
|
|
32
|
+
children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
33
|
+
}
|
|
34
|
+
));
|
|
35
|
+
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
36
|
+
|
|
37
|
+
export { ScrollArea, ScrollBar };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useState, useEffect } from 'react';
|
|
3
|
+
import { X, Loader, Search } from 'lucide-react';
|
|
4
|
+
import { useDebounce } from './hook/useDebounce.js';
|
|
5
|
+
import { cn } from './lib/utils.js';
|
|
6
|
+
import { Input } from './input.js';
|
|
7
|
+
|
|
8
|
+
const variantButtonClasses = {
|
|
9
|
+
"rounded-right": "border-r rounded-l",
|
|
10
|
+
"rounded-left": "border-l rounded-r"
|
|
11
|
+
};
|
|
12
|
+
const SearchBar = forwardRef((props, ref) => {
|
|
13
|
+
const {
|
|
14
|
+
onKeyPressSearch,
|
|
15
|
+
onChangeSearch,
|
|
16
|
+
className,
|
|
17
|
+
variant = "default",
|
|
18
|
+
size = "default",
|
|
19
|
+
pressButton = false,
|
|
20
|
+
disabled = false,
|
|
21
|
+
side = "right",
|
|
22
|
+
placeholder,
|
|
23
|
+
classNameIcon,
|
|
24
|
+
iconFill = "#7A7A7A",
|
|
25
|
+
defaultValue = "",
|
|
26
|
+
allowClear = false,
|
|
27
|
+
loading = false,
|
|
28
|
+
addonAfter,
|
|
29
|
+
addonBefore,
|
|
30
|
+
...restProps
|
|
31
|
+
} = props;
|
|
32
|
+
const [query, setQuery] = useState(defaultValue);
|
|
33
|
+
const debouncedValue = useDebounce(query, query.length > 0 ? 600 : 0);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
setQuery(defaultValue);
|
|
36
|
+
}, [defaultValue]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (onChangeSearch && (debouncedValue.length >= 3 || debouncedValue.length === 0)) {
|
|
39
|
+
const event = {
|
|
40
|
+
target: { value: debouncedValue }
|
|
41
|
+
};
|
|
42
|
+
onChangeSearch(event);
|
|
43
|
+
}
|
|
44
|
+
}, [debouncedValue, onChangeSearch]);
|
|
45
|
+
const handleSearchChange = (e) => {
|
|
46
|
+
const { value } = e.target;
|
|
47
|
+
setQuery(value);
|
|
48
|
+
if (onKeyPressSearch) {
|
|
49
|
+
onKeyPressSearch(value.trim().toLowerCase());
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const handleKeyPress = (event) => {
|
|
53
|
+
if (event.key === "Enter") {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
if (onKeyPressSearch) {
|
|
56
|
+
onKeyPressSearch(query.trim().toLowerCase());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const handleSearch = () => {
|
|
61
|
+
if (onKeyPressSearch) {
|
|
62
|
+
onKeyPressSearch(query.trim().toLowerCase());
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const clearSearch = () => {
|
|
66
|
+
setQuery("");
|
|
67
|
+
if (onChangeSearch) {
|
|
68
|
+
const event = { target: { value: "" } };
|
|
69
|
+
onChangeSearch(event);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */ jsxs(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
className: `flex items-center w-full border border-gray-300 rounded-lg`,
|
|
76
|
+
children: [
|
|
77
|
+
addonBefore && /* @__PURE__ */ jsx("div", { className: "flex items-center px-2 ", children: addonBefore }),
|
|
78
|
+
/* @__PURE__ */ jsxs("div", { className: `relative flex-grow`, children: [
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
Input,
|
|
81
|
+
{
|
|
82
|
+
...restProps,
|
|
83
|
+
ref,
|
|
84
|
+
type: "text",
|
|
85
|
+
placeholder,
|
|
86
|
+
value: query,
|
|
87
|
+
onChange: handleSearchChange,
|
|
88
|
+
onKeyDown: handleKeyPress,
|
|
89
|
+
variant,
|
|
90
|
+
size,
|
|
91
|
+
disabled: disabled || loading,
|
|
92
|
+
className: cn(
|
|
93
|
+
`text-[#262626] placeholder:text-[#C5C0BF] focus:border-transparent focus:shadow-brand-blue`,
|
|
94
|
+
{
|
|
95
|
+
"pl-14 pr-10": side === "left" && pressButton,
|
|
96
|
+
"pl-12 pr-10": side === "left" && !pressButton,
|
|
97
|
+
"pr-16": side === "right" && !pressButton,
|
|
98
|
+
"pr-20": side === "right" && pressButton
|
|
99
|
+
},
|
|
100
|
+
className
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
allowClear && query.length > 0 && !loading && /* @__PURE__ */ jsx(
|
|
105
|
+
"span",
|
|
106
|
+
{
|
|
107
|
+
className: cn(
|
|
108
|
+
"absolute flex items-center justify-center top-1/2 transform -translate-y-1/2 h-full",
|
|
109
|
+
{
|
|
110
|
+
"right-10": side === "right" && !pressButton,
|
|
111
|
+
"right-14": side === "right" && pressButton,
|
|
112
|
+
"right-4": side === "left"
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
onClick: clearSearch,
|
|
116
|
+
style: { zIndex: 2 },
|
|
117
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
/* @__PURE__ */ jsx(
|
|
121
|
+
"span",
|
|
122
|
+
{
|
|
123
|
+
className: cn(
|
|
124
|
+
`absolute flex items-center justify-center top-1/2 transform -translate-y-1/2 h-full px-3 ${pressButton && `${side === "left" ? variantButtonClasses["rounded-right"] : variantButtonClasses["rounded-left"]}`}`,
|
|
125
|
+
{
|
|
126
|
+
"left-0": side === "left",
|
|
127
|
+
"right-0": side === "right" && !loading,
|
|
128
|
+
"cursor-pointer": pressButton,
|
|
129
|
+
"cursor-default": !pressButton
|
|
130
|
+
},
|
|
131
|
+
pressButton && classNameIcon
|
|
132
|
+
),
|
|
133
|
+
children: loading ? /* @__PURE__ */ jsx(Loader, { className: "animate-spin h-5 w-5" }) : typeof pressButton !== "boolean" ? /* @__PURE__ */ jsx("span", { className: "truncate", style: { maxWidth: "15ch" }, children: pressButton }) : /* @__PURE__ */ jsx(
|
|
134
|
+
Search,
|
|
135
|
+
{
|
|
136
|
+
onClick: handleSearch,
|
|
137
|
+
style: { color: pressButton && iconFill ? iconFill : void 0 },
|
|
138
|
+
className: "h-5 w-5 text-gray-scale48"
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
] }),
|
|
144
|
+
addonAfter && /* @__PURE__ */ jsx("div", { className: "flex items-center px-2", children: addonAfter })
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
SearchBar.displayName = "SearchBar";
|
|
150
|
+
|
|
151
|
+
export { SearchBar };
|
package/dist/select.js
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { CaretSortIcon, ChevronUpIcon, ChevronDownIcon, CheckIcon } from '@radix-ui/react-icons';
|
|
4
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
5
|
+
import { Database } from 'lucide-react';
|
|
6
|
+
import { cn } from './lib/utils.js';
|
|
7
|
+
import { Input } from './input.js';
|
|
8
|
+
|
|
9
|
+
const Select = SelectPrimitive.Root;
|
|
10
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
11
|
+
const SelectValue = SelectPrimitive.Value;
|
|
12
|
+
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
|
|
13
|
+
SelectPrimitive.Trigger,
|
|
14
|
+
{
|
|
15
|
+
ref,
|
|
16
|
+
className: cn(
|
|
17
|
+
"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
18
|
+
className
|
|
19
|
+
),
|
|
20
|
+
...props,
|
|
21
|
+
children: [
|
|
22
|
+
children,
|
|
23
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(CaretSortIcon, { className: "h-4 w-4 opacity-50" }) })
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
));
|
|
27
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
28
|
+
const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
29
|
+
SelectPrimitive.ScrollUpButton,
|
|
30
|
+
{
|
|
31
|
+
ref,
|
|
32
|
+
className: cn(
|
|
33
|
+
"flex cursor-default items-center justify-center py-1",
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
...props,
|
|
37
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, {})
|
|
38
|
+
}
|
|
39
|
+
));
|
|
40
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
41
|
+
const SelectScrollDownButton = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
42
|
+
SelectPrimitive.ScrollDownButton,
|
|
43
|
+
{
|
|
44
|
+
ref,
|
|
45
|
+
className: cn(
|
|
46
|
+
"flex cursor-default items-center justify-center py-1",
|
|
47
|
+
className
|
|
48
|
+
),
|
|
49
|
+
...props,
|
|
50
|
+
children: /* @__PURE__ */ jsx(ChevronDownIcon, {})
|
|
51
|
+
}
|
|
52
|
+
));
|
|
53
|
+
SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
|
|
54
|
+
const SelectContent = React.forwardRef(
|
|
55
|
+
({ className, children, position = "popper", isSearch = false, ...props }, ref) => {
|
|
56
|
+
const [search, setSearch] = React.useState("");
|
|
57
|
+
const [filteredChildren, setFilteredChildren] = React.useState([children]);
|
|
58
|
+
const inputRef = React.useRef(null);
|
|
59
|
+
React.useEffect(() => {
|
|
60
|
+
const filtered = React.Children.toArray(children).filter((child) => {
|
|
61
|
+
if (React.isValidElement(child) && child.props.children) {
|
|
62
|
+
return child.props.children.toLowerCase().includes(search.toLowerCase());
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
});
|
|
66
|
+
setFilteredChildren(filtered);
|
|
67
|
+
}, [search, children]);
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
if (inputRef.current) {
|
|
70
|
+
inputRef.current.focus();
|
|
71
|
+
}
|
|
72
|
+
}, [search, filteredChildren]);
|
|
73
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
74
|
+
SelectPrimitive.Content,
|
|
75
|
+
{
|
|
76
|
+
ref,
|
|
77
|
+
className: cn(
|
|
78
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
79
|
+
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
80
|
+
className
|
|
81
|
+
),
|
|
82
|
+
position,
|
|
83
|
+
...props,
|
|
84
|
+
children: [
|
|
85
|
+
isSearch && /* @__PURE__ */ jsx("div", { className: "p-2", children: /* @__PURE__ */ jsx(
|
|
86
|
+
Input,
|
|
87
|
+
{
|
|
88
|
+
type: "text",
|
|
89
|
+
ref: inputRef,
|
|
90
|
+
placeholder: "Search...",
|
|
91
|
+
className: "w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-ring",
|
|
92
|
+
value: search,
|
|
93
|
+
onChange: (e) => setSearch(e.target.value)
|
|
94
|
+
}
|
|
95
|
+
) }),
|
|
96
|
+
/* @__PURE__ */ jsx(SelectScrollUpButton, {}),
|
|
97
|
+
filteredChildren.length > 0 ? /* @__PURE__ */ jsx(
|
|
98
|
+
SelectPrimitive.Viewport,
|
|
99
|
+
{
|
|
100
|
+
className: cn(
|
|
101
|
+
"p-1",
|
|
102
|
+
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
|
103
|
+
),
|
|
104
|
+
children: React.Children.toArray(
|
|
105
|
+
filteredChildren
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
) : /* @__PURE__ */ jsxs(SelectPrimitive.Viewport, { className: "flex flex-col items-center gap-2 p-3 text-gray-400", children: [
|
|
109
|
+
/* @__PURE__ */ jsx(Database, { className: "w-5 h-5" }),
|
|
110
|
+
"No Data"
|
|
111
|
+
] }),
|
|
112
|
+
/* @__PURE__ */ jsx(SelectScrollDownButton, {})
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
) });
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
119
|
+
const SelectLabel = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
120
|
+
SelectPrimitive.Label,
|
|
121
|
+
{
|
|
122
|
+
ref,
|
|
123
|
+
className: cn("px-2 py-1.5 text-sm font-semibold", className),
|
|
124
|
+
...props
|
|
125
|
+
}
|
|
126
|
+
));
|
|
127
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
128
|
+
const SelectItem = React.forwardRef(({ className, children, ...props }, ref) => {
|
|
129
|
+
return /* @__PURE__ */ jsxs(
|
|
130
|
+
SelectPrimitive.Item,
|
|
131
|
+
{
|
|
132
|
+
ref,
|
|
133
|
+
className: cn(
|
|
134
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
135
|
+
className
|
|
136
|
+
),
|
|
137
|
+
...props,
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "h-4 w-4" }) }) }),
|
|
140
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
});
|
|
145
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
146
|
+
const SelectSeparator = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
147
|
+
SelectPrimitive.Separator,
|
|
148
|
+
{
|
|
149
|
+
ref,
|
|
150
|
+
className: cn("-mx-1 my-1 h-px bg-muted", className),
|
|
151
|
+
...props
|
|
152
|
+
}
|
|
153
|
+
));
|
|
154
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
155
|
+
|
|
156
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
4
|
+
import { cn } from './lib/utils.js';
|
|
5
|
+
|
|
6
|
+
const Separator = React.forwardRef(
|
|
7
|
+
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
8
|
+
SeparatorPrimitive.Root,
|
|
9
|
+
{
|
|
10
|
+
ref,
|
|
11
|
+
decorative,
|
|
12
|
+
orientation,
|
|
13
|
+
className: cn(
|
|
14
|
+
"shrink-0 bg-border",
|
|
15
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
16
|
+
className
|
|
17
|
+
),
|
|
18
|
+
...props
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
);
|
|
22
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
23
|
+
|
|
24
|
+
export { Separator };
|
package/dist/sheet.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
+
import { Cross2Icon } from '@radix-ui/react-icons';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
6
|
+
import { cn } from './lib/utils.js';
|
|
7
|
+
|
|
8
|
+
const Sheet = DialogPrimitive.Root;
|
|
9
|
+
const SheetTrigger = DialogPrimitive.Trigger;
|
|
10
|
+
const SheetClose = DialogPrimitive.Close;
|
|
11
|
+
const SheetPortal = DialogPrimitive.Portal;
|
|
12
|
+
const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
13
|
+
DialogPrimitive.Overlay,
|
|
14
|
+
{
|
|
15
|
+
className: cn(
|
|
16
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
17
|
+
className
|
|
18
|
+
),
|
|
19
|
+
...props,
|
|
20
|
+
ref
|
|
21
|
+
}
|
|
22
|
+
));
|
|
23
|
+
SheetOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
24
|
+
const sheetVariants = cva(
|
|
25
|
+
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
26
|
+
{
|
|
27
|
+
variants: {
|
|
28
|
+
side: {
|
|
29
|
+
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
30
|
+
bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
31
|
+
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
32
|
+
right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
side: "right"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
const SheetContent = React.forwardRef(({ side = "right", className, children, ...props }, ref) => /* @__PURE__ */ jsxs(SheetPortal, { children: [
|
|
41
|
+
/* @__PURE__ */ jsx(SheetOverlay, {}),
|
|
42
|
+
/* @__PURE__ */ jsxs(
|
|
43
|
+
DialogPrimitive.Content,
|
|
44
|
+
{
|
|
45
|
+
ref,
|
|
46
|
+
className: cn(sheetVariants({ side }), className),
|
|
47
|
+
...props,
|
|
48
|
+
children: [
|
|
49
|
+
children,
|
|
50
|
+
/* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
|
|
51
|
+
/* @__PURE__ */ jsx(Cross2Icon, { className: "h-4 w-4" }),
|
|
52
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
53
|
+
] })
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] }));
|
|
58
|
+
SheetContent.displayName = DialogPrimitive.Content.displayName;
|
|
59
|
+
const SheetHeader = ({
|
|
60
|
+
className,
|
|
61
|
+
...props
|
|
62
|
+
}) => /* @__PURE__ */ jsx(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: cn(
|
|
66
|
+
"flex flex-col space-y-2 text-center sm:text-left",
|
|
67
|
+
className
|
|
68
|
+
),
|
|
69
|
+
...props
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
SheetHeader.displayName = "SheetHeader";
|
|
73
|
+
const SheetFooter = ({
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
}) => /* @__PURE__ */ jsx(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: cn(
|
|
80
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
81
|
+
className
|
|
82
|
+
),
|
|
83
|
+
...props
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
SheetFooter.displayName = "SheetFooter";
|
|
87
|
+
const SheetTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
88
|
+
DialogPrimitive.Title,
|
|
89
|
+
{
|
|
90
|
+
ref,
|
|
91
|
+
className: cn("text-lg font-semibold text-foreground", className),
|
|
92
|
+
...props
|
|
93
|
+
}
|
|
94
|
+
));
|
|
95
|
+
SheetTitle.displayName = DialogPrimitive.Title.displayName;
|
|
96
|
+
const SheetDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
97
|
+
DialogPrimitive.Description,
|
|
98
|
+
{
|
|
99
|
+
ref,
|
|
100
|
+
className: cn("text-sm text-muted-foreground", className),
|
|
101
|
+
...props
|
|
102
|
+
}
|
|
103
|
+
));
|
|
104
|
+
SheetDescription.displayName = DialogPrimitive.Description.displayName;
|
|
105
|
+
|
|
106
|
+
export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger };
|