@addsign/moje-agenda-shared-lib 2.0.0 → 2.0.3
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/dist/Dialog-CLPZ1Y00.js +422 -0
- package/dist/Dialog-CLPZ1Y00.js.map +1 -0
- package/dist/Dialog-IPFWYptw.js +421 -0
- package/dist/Dialog-IPFWYptw.js.map +1 -0
- package/dist/assets/style.css +25 -6
- package/dist/components/datatable/DataTable.js +5 -2
- package/dist/components/datatable/DataTable.js.map +1 -1
- package/dist/components/datatable/DataTableServer.js +5 -2
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBar.js +5 -2
- package/dist/components/form/AutocompleteSearchBar.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBarServer.js +5 -2
- package/dist/components/form/AutocompleteSearchBarServer.js.map +1 -1
- package/dist/components/form/FileInput.js +6 -3
- package/dist/components/form/FileInput.js.map +1 -1
- package/dist/components/form/FileInputMultiple.js +6 -3
- package/dist/components/form/FileInputMultiple.js.map +1 -1
- package/dist/components/form/FormField.js +5 -2
- package/dist/components/form/FormField.js.map +1 -1
- package/dist/components/form/PositionsSelectorSingle.js +5 -2
- package/dist/components/form/PositionsSelectorSingle.js.map +1 -1
- package/dist/components/form/SelectField.js +5 -2
- package/dist/components/form/SelectField.js.map +1 -1
- package/dist/components/profiles/ProfileOverview.js +5 -2
- package/dist/components/profiles/ProfileOverview.js.map +1 -1
- package/dist/components/ui/Combobox.d.ts +14 -1
- package/dist/components/ui/Combobox.js +122 -98
- package/dist/components/ui/Combobox.js.map +1 -1
- package/dist/components/ui/Dialog.js +1 -1
- package/dist/components/ui/ScrollArea.js +3 -3
- package/dist/components/ui/button.js +4 -4
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/command.js +3 -3
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/form.js +1 -1
- package/dist/components/ui/input.d.ts +5 -1
- package/dist/components/ui/input.js +92 -13
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/label.js +1 -1
- package/dist/components/ui/popover.js +6 -5
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/radioGroup.js +4 -4
- package/dist/components/ui/select.d.ts +3 -1
- package/dist/components/ui/select.js +10 -35
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +48 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +509 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/index-B3cR4C4Z.js +2203 -0
- package/dist/index-B3cR4C4Z.js.map +1 -0
- package/dist/index-B761_inZ.js +28884 -0
- package/dist/index-B761_inZ.js.map +1 -0
- package/dist/index-BF3Kkq7m.js +2212 -0
- package/dist/index-BF3Kkq7m.js.map +1 -0
- package/dist/index-BULFV6Qz.js +2266 -0
- package/dist/index-BULFV6Qz.js.map +1 -0
- package/dist/index-Bjw9JvWH.js +131 -0
- package/dist/index-Bjw9JvWH.js.map +1 -0
- package/dist/index-Bm-YZac9.js +28864 -0
- package/dist/index-Bm-YZac9.js.map +1 -0
- package/dist/index-BzZGaGRV.js +230 -0
- package/dist/index-BzZGaGRV.js.map +1 -0
- package/dist/index-C4pkvuV-.js +1395 -0
- package/dist/index-C4pkvuV-.js.map +1 -0
- package/dist/index-C59RTYp9.js +140 -0
- package/dist/index-C59RTYp9.js.map +1 -0
- package/dist/index-D8AkGh-j.js +1173 -0
- package/dist/index-D8AkGh-j.js.map +1 -0
- package/dist/index-D9mvqz1C.js +97 -0
- package/dist/index-D9mvqz1C.js.map +1 -0
- package/dist/index-M6rMtqtn.js +2203 -0
- package/dist/index-M6rMtqtn.js.map +1 -0
- package/dist/index-cCT-Qkr7.js +36 -0
- package/dist/index-cCT-Qkr7.js.map +1 -0
- package/dist/index.es-XWsfbnWC.js +9628 -0
- package/dist/index.es-XWsfbnWC.js.map +1 -0
- package/dist/jspdf.plugin.autotable-DXW3wQb-.js +11475 -0
- package/dist/jspdf.plugin.autotable-DXW3wQb-.js.map +1 -0
- package/dist/main.d.ts +4 -0
- package/dist/main.js +23 -5
- package/dist/main.js.map +1 -1
- package/lib/components/ui/Combobox.tsx +159 -102
- package/lib/components/ui/button.tsx +3 -3
- package/lib/components/ui/command.tsx +1 -1
- package/lib/components/ui/input.tsx +96 -10
- package/lib/components/ui/select.tsx +9 -5
- package/lib/components/ui/separator.tsx +29 -0
- package/lib/components/ui/tooltip.tsx +28 -0
- package/lib/main.ts +4 -0
- package/package.json +3 -1
package/dist/main.d.ts
CHANGED
|
@@ -38,6 +38,10 @@ export * from './components/ui/form.tsx';
|
|
|
38
38
|
export * from './components/ui/radioGroup.tsx';
|
|
39
39
|
export * from './components/ui/command.tsx';
|
|
40
40
|
export * from './components/ui/Combobox.tsx';
|
|
41
|
+
export * from './components/ui/select.tsx';
|
|
42
|
+
export * from './components/ui/tooltip.tsx';
|
|
43
|
+
export * from './components/ui/separator.tsx';
|
|
44
|
+
export { Button as ButtonCN, buttonVariants } from './components/ui/button.tsx';
|
|
41
45
|
export { Calendar as CalendarCn } from './components/ui/Calendar.tsx';
|
|
42
46
|
export { default as DateTimePicker } from './components/ui/DateTimePicker.tsx';
|
|
43
47
|
export { default as DatePicker } from './components/ui/DatePicker.tsx';
|
package/dist/main.js
CHANGED
|
@@ -30,16 +30,17 @@ import { handleErrors } from "./utils/handleErrors.js";
|
|
|
30
30
|
import { hasRightInModule } from "./utils/hasRightInModule.js";
|
|
31
31
|
import { hasRole } from "./utils/hasRole.js";
|
|
32
32
|
import { EApproverRoles, EApproverTypes, EDecisionsTranslations, EEntity, Eagendy, Eassignments, Estavy } from "./types.js";
|
|
33
|
-
import { D, c, e, i, g, f, b, a, h, d } from "./Dialog-
|
|
33
|
+
import { D, c, e, i, g, f, b, a, h, d } from "./Dialog-CLPZ1Y00.js";
|
|
34
34
|
import { ScrollArea, ScrollBar } from "./components/ui/ScrollArea.js";
|
|
35
35
|
import { Input } from "./components/ui/input.js";
|
|
36
36
|
import { Form, FormControl, FormDescription, FormFieldCN, FormItem, FormLabel, FormMessage, useFormField } from "./components/ui/form.js";
|
|
37
37
|
import { RadioGroupCN, RadioGroupItem } from "./components/ui/radioGroup.js";
|
|
38
38
|
import { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from "./components/ui/command.js";
|
|
39
|
-
import "
|
|
40
|
-
import "
|
|
41
|
-
import "./components/ui/
|
|
42
|
-
import "./components/ui/
|
|
39
|
+
import "./components/ui/Combobox.js";
|
|
40
|
+
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "./components/ui/select.js";
|
|
41
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/ui/tooltip.js";
|
|
42
|
+
import { Separator } from "./components/ui/separator.js";
|
|
43
|
+
import { Button, buttonVariants } from "./components/ui/button.js";
|
|
43
44
|
import { C } from "./Calendar-DWT4e7Th.js";
|
|
44
45
|
import { default as default22 } from "./components/ui/DateTimePicker.js";
|
|
45
46
|
import { default as default23 } from "./components/ui/DatePicker.js";
|
|
@@ -47,6 +48,7 @@ export {
|
|
|
47
48
|
default3 as AutocompleteSearchBar,
|
|
48
49
|
default4 as AutocompleteSearchBarServer,
|
|
49
50
|
default2 as Button,
|
|
51
|
+
Button as ButtonCN,
|
|
50
52
|
default15 as Calendar,
|
|
51
53
|
C as CalendarCn,
|
|
52
54
|
Command,
|
|
@@ -107,9 +109,25 @@ export {
|
|
|
107
109
|
ScrollArea,
|
|
108
110
|
ScrollBar,
|
|
109
111
|
default11 as SectionTitle,
|
|
112
|
+
Select,
|
|
113
|
+
SelectContent,
|
|
110
114
|
default7 as SelectField,
|
|
115
|
+
SelectGroup,
|
|
116
|
+
SelectItem,
|
|
117
|
+
SelectLabel,
|
|
118
|
+
SelectScrollDownButton,
|
|
119
|
+
SelectScrollUpButton,
|
|
120
|
+
SelectSeparator,
|
|
121
|
+
SelectTrigger,
|
|
122
|
+
SelectValue,
|
|
123
|
+
Separator,
|
|
111
124
|
default13 as Spinner,
|
|
112
125
|
default20 as SpinnerIcon,
|
|
126
|
+
Tooltip,
|
|
127
|
+
TooltipContent,
|
|
128
|
+
TooltipProvider,
|
|
129
|
+
TooltipTrigger,
|
|
130
|
+
buttonVariants,
|
|
113
131
|
getFullName,
|
|
114
132
|
getFullNameList,
|
|
115
133
|
getFullNameListPositionWithEmployee,
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { Check, ChevronsUpDown, Plus } from "lucide-react";
|
|
4
|
+
import { Check, ChevronsUpDown, Plus, X } from "lucide-react";
|
|
5
5
|
|
|
6
6
|
import { cn } from "../../utils/utils";
|
|
7
7
|
import { Button } from "./button";
|
|
@@ -14,109 +14,166 @@ import {
|
|
|
14
14
|
CommandList,
|
|
15
15
|
} from "./command";
|
|
16
16
|
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
|
|
17
|
+
import { IOptionItem } from "../../types";
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
value: "nuxt.js",
|
|
29
|
-
label: "Nuxt.js",
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
value: "remix",
|
|
33
|
-
label: "Remix",
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
value: "astro",
|
|
37
|
-
label: "Astro",
|
|
38
|
-
},
|
|
39
|
-
];
|
|
19
|
+
interface ComboboxProps {
|
|
20
|
+
value?: string;
|
|
21
|
+
onChange?: (value: string | undefined) => void;
|
|
22
|
+
className?: string;
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
placeholderSearch?: string;
|
|
25
|
+
clearable?: boolean;
|
|
26
|
+
options?: IOptionItem[];
|
|
27
|
+
allowAddNew?: boolean;
|
|
28
|
+
}
|
|
40
29
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
const Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(
|
|
31
|
+
(
|
|
32
|
+
{
|
|
33
|
+
value: propValue,
|
|
34
|
+
onChange: propOnChange,
|
|
35
|
+
className,
|
|
36
|
+
placeholder,
|
|
37
|
+
placeholderSearch = "Vyhledejte položku",
|
|
38
|
+
clearable = false,
|
|
39
|
+
options = [],
|
|
40
|
+
allowAddNew = false,
|
|
41
|
+
},
|
|
42
|
+
ref
|
|
43
|
+
) => {
|
|
44
|
+
const [open, setOpen] = React.useState(false);
|
|
45
|
+
const [value, setValue] = React.useState(propValue || "");
|
|
46
|
+
const [inputValue, setInputValue] = React.useState("");
|
|
47
|
+
const [frameworks, setFrameworks] = React.useState<IOptionItem[]>(options);
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
inputValue &&
|
|
51
|
-
!frameworks.some((f) => f.value === inputValue.toLowerCase())
|
|
52
|
-
) {
|
|
53
|
-
const newFramework = {
|
|
54
|
-
value: inputValue.toLowerCase(),
|
|
55
|
-
label: inputValue,
|
|
56
|
-
};
|
|
57
|
-
setFrameworks([...frameworks, newFramework]);
|
|
58
|
-
setValue(newFramework.value);
|
|
49
|
+
React.useEffect(() => {
|
|
50
|
+
if (propValue !== undefined) {
|
|
51
|
+
setValue(propValue);
|
|
59
52
|
}
|
|
60
|
-
}
|
|
61
|
-
setValue(currentValue === value ? "" : currentValue);
|
|
62
|
-
}
|
|
63
|
-
setOpen(false);
|
|
64
|
-
};
|
|
53
|
+
}, [propValue]);
|
|
65
54
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
55
|
+
React.useEffect(() => {
|
|
56
|
+
setFrameworks(options);
|
|
57
|
+
}, [options]);
|
|
58
|
+
|
|
59
|
+
const handleSelect = (currentValue: string) => {
|
|
60
|
+
if (currentValue === "add-custom") {
|
|
61
|
+
if (
|
|
62
|
+
inputValue &&
|
|
63
|
+
!frameworks.some((f) => f.value === inputValue.toLowerCase())
|
|
64
|
+
) {
|
|
65
|
+
const newFramework = {
|
|
66
|
+
value: inputValue.toLowerCase(),
|
|
67
|
+
label: inputValue,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
setFrameworks([...frameworks, newFramework]);
|
|
71
|
+
updateValue(newFramework.value);
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
updateValue(currentValue === value ? "" : currentValue);
|
|
75
|
+
}
|
|
76
|
+
setOpen(false);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const updateValue = (newValue: string) => {
|
|
80
|
+
setValue(newValue);
|
|
81
|
+
propOnChange?.(newValue || undefined);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const handleClear = (e: React.MouseEvent) => {
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
updateValue("");
|
|
87
|
+
setInputValue("");
|
|
88
|
+
setOpen(false);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
value;
|
|
92
|
+
return (
|
|
93
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
94
|
+
<div className="relative w-full">
|
|
95
|
+
<PopoverTrigger asChild>
|
|
96
|
+
<Button
|
|
97
|
+
ref={ref}
|
|
98
|
+
type="button"
|
|
99
|
+
variant="outline"
|
|
100
|
+
role="combobox"
|
|
101
|
+
aria-expanded={open}
|
|
102
|
+
className={cn("w-full justify-between", className)}
|
|
103
|
+
>
|
|
104
|
+
<span className="flex-1 text-left truncate mr-2 font-normal">
|
|
105
|
+
{value ? (
|
|
106
|
+
frameworks.find((framework) => framework.value === value)
|
|
107
|
+
?.label
|
|
108
|
+
) : (
|
|
109
|
+
<span className="text-muted-foreground font-normal">
|
|
110
|
+
{placeholder}
|
|
111
|
+
</span>
|
|
112
|
+
)}
|
|
113
|
+
</span>
|
|
114
|
+
|
|
115
|
+
<ChevronsUpDown className="h-4 w-4 shrink-0 opacity-50 ml-6" />
|
|
116
|
+
</Button>
|
|
117
|
+
</PopoverTrigger>
|
|
118
|
+
{clearable && value && (
|
|
119
|
+
<Button
|
|
120
|
+
type="button"
|
|
121
|
+
variant="ghost"
|
|
122
|
+
size="sm"
|
|
123
|
+
className="absolute right-6 top-0 h-full px-1 py-2 hover:bg-transparent"
|
|
124
|
+
onClick={handleClear}
|
|
125
|
+
>
|
|
126
|
+
<X className="h-4 w-4 shrink-0 opacity-50 hover:opacity-100" />
|
|
127
|
+
</Button>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
<PopoverContent className="min-w-[200px] w-full p-0">
|
|
131
|
+
<Command>
|
|
132
|
+
<CommandInput
|
|
133
|
+
placeholder={placeholderSearch}
|
|
134
|
+
className="h-9"
|
|
135
|
+
value={inputValue}
|
|
136
|
+
onValueChange={setInputValue}
|
|
137
|
+
/>
|
|
138
|
+
<CommandList>
|
|
139
|
+
<CommandEmpty>
|
|
140
|
+
{allowAddNew && (
|
|
141
|
+
<Button
|
|
142
|
+
variant="ghost"
|
|
143
|
+
className="w-full justify-start"
|
|
144
|
+
onClick={() => handleSelect("add-custom")}
|
|
145
|
+
>
|
|
146
|
+
<Plus className="mr-2 h-4 w-4" />
|
|
147
|
+
Přidat "{inputValue}"
|
|
148
|
+
</Button>
|
|
149
|
+
)}
|
|
150
|
+
</CommandEmpty>
|
|
151
|
+
|
|
152
|
+
<CommandGroup>
|
|
153
|
+
{frameworks.map((framework) => (
|
|
154
|
+
<CommandItem
|
|
155
|
+
key={framework.value}
|
|
156
|
+
value={framework.value as string}
|
|
157
|
+
onSelect={handleSelect}
|
|
158
|
+
>
|
|
159
|
+
{framework.label}
|
|
160
|
+
<Check
|
|
161
|
+
className={cn(
|
|
162
|
+
"ml-auto h-4 w-4",
|
|
163
|
+
value === framework.value ? "opacity-100" : "opacity-0"
|
|
164
|
+
)}
|
|
165
|
+
/>
|
|
166
|
+
</CommandItem>
|
|
167
|
+
))}
|
|
168
|
+
</CommandGroup>
|
|
169
|
+
</CommandList>
|
|
170
|
+
</Command>
|
|
171
|
+
</PopoverContent>
|
|
172
|
+
</Popover>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
Combobox.displayName = "Combobox";
|
|
178
|
+
|
|
179
|
+
export default Combobox;
|
|
@@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
5
5
|
import { cn } from "../../utils/utils";
|
|
6
6
|
|
|
7
7
|
const buttonVariants = cva(
|
|
8
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-
|
|
8
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-ring transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
@@ -20,8 +20,8 @@ const buttonVariants = cva(
|
|
|
20
20
|
link: "text-primary underline-offset-4 hover:underline",
|
|
21
21
|
},
|
|
22
22
|
size: {
|
|
23
|
-
default: "h-10 px-
|
|
24
|
-
sm: "h-9 rounded-md px-
|
|
23
|
+
default: "h-10 px-2 py-2",
|
|
24
|
+
sm: "h-9 rounded-md px-2",
|
|
25
25
|
lg: "h-11 rounded-md px-8",
|
|
26
26
|
icon: "h-10 w-10",
|
|
27
27
|
},
|
|
@@ -1,19 +1,105 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
|
|
3
3
|
import { cn } from "../..//utils/utils";
|
|
4
|
+
import { Button } from "./button";
|
|
5
|
+
import { LoaderCircleIcon, X } from "lucide-react";
|
|
6
|
+
import SpinnerIcon from "../SpinnerIcon";
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
interface IInputProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
9
|
+
debounceTimeout?: number;
|
|
10
|
+
clearable?: boolean;
|
|
11
|
+
}
|
|
12
|
+
const Input = React.forwardRef<HTMLInputElement, IInputProps>(
|
|
13
|
+
(
|
|
14
|
+
{
|
|
15
|
+
className,
|
|
16
|
+
type,
|
|
17
|
+
value: propValue,
|
|
18
|
+
onChange,
|
|
19
|
+
clearable = false,
|
|
20
|
+
debounceTimeout,
|
|
21
|
+
...props
|
|
22
|
+
},
|
|
23
|
+
ref
|
|
24
|
+
) => {
|
|
25
|
+
const [internalValue, setInternalValue] = React.useState(propValue || "");
|
|
26
|
+
const debounceTimeoutRef = React.useRef<NodeJS.Timeout | null>(null); // Ref to hold the debounce timeout
|
|
27
|
+
const [inputIsChanging, setInputIsChanging] = React.useState(false);
|
|
28
|
+
React.useEffect(() => {
|
|
29
|
+
setInternalValue(propValue ?? "");
|
|
30
|
+
}, [propValue]);
|
|
31
|
+
|
|
32
|
+
const handleDebouncedChange = React.useCallback(
|
|
33
|
+
(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
34
|
+
const { value } = e.target;
|
|
35
|
+
setInternalValue(value); // Update local state
|
|
36
|
+
setInputIsChanging(true);
|
|
37
|
+
|
|
38
|
+
if (debounceTimeout) {
|
|
39
|
+
// Clear any previous debounce timeout
|
|
40
|
+
if (debounceTimeoutRef.current)
|
|
41
|
+
clearTimeout(debounceTimeoutRef.current);
|
|
42
|
+
|
|
43
|
+
// Set a new debounce timeout
|
|
44
|
+
debounceTimeoutRef.current = setTimeout(() => {
|
|
45
|
+
const newValue: string = e.target.value;
|
|
46
|
+
setInternalValue(newValue);
|
|
47
|
+
onChange?.(e);
|
|
48
|
+
setInputIsChanging(false);
|
|
49
|
+
}, debounceTimeout);
|
|
50
|
+
} else {
|
|
51
|
+
const newValue = e.target.value;
|
|
52
|
+
setInternalValue(newValue);
|
|
53
|
+
onChange?.(e);
|
|
54
|
+
setInputIsChanging(false);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
[debounceTimeout, debounceTimeoutRef, onChange, setInternalValue]
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
const handleClear = () => {
|
|
61
|
+
setInternalValue("");
|
|
62
|
+
onChange?.({
|
|
63
|
+
target: { value: "" },
|
|
64
|
+
} as React.ChangeEvent<HTMLInputElement>);
|
|
65
|
+
};
|
|
7
66
|
return (
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
67
|
+
<div className="relative w-full">
|
|
68
|
+
<input
|
|
69
|
+
type={type}
|
|
70
|
+
value={internalValue}
|
|
71
|
+
onChange={handleDebouncedChange}
|
|
72
|
+
className={cn(
|
|
73
|
+
"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 " +
|
|
74
|
+
(clearable && !!internalValue ? " pr-10 " : " pr-3 ") +
|
|
75
|
+
" text-base ring-offset-ring file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-80 disabled:border-opacity-100 md:text-sm",
|
|
76
|
+
className
|
|
77
|
+
)}
|
|
78
|
+
ref={ref}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
|
|
82
|
+
{inputIsChanging === true && (
|
|
83
|
+
<div className="absolute right-0 top-0 h-full px-2 py-2 hover:bg-transparent text-muted-foreground">
|
|
84
|
+
<SpinnerIcon
|
|
85
|
+
icon={
|
|
86
|
+
<LoaderCircleIcon size={25} className="text-muted-foreground" />
|
|
87
|
+
}
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
)}
|
|
91
|
+
{!!internalValue && clearable && (
|
|
92
|
+
<Button
|
|
93
|
+
variant="ghost"
|
|
94
|
+
size="icon"
|
|
95
|
+
className="absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent"
|
|
96
|
+
onClick={handleClear}
|
|
97
|
+
>
|
|
98
|
+
<X className="h-4 w-4 text-muted-foreground" />
|
|
99
|
+
<span className="sr-only">Clear input</span>
|
|
100
|
+
</Button>
|
|
13
101
|
)}
|
|
14
|
-
|
|
15
|
-
{...props}
|
|
16
|
-
/>
|
|
102
|
+
</div>
|
|
17
103
|
);
|
|
18
104
|
}
|
|
19
105
|
);
|
|
@@ -9,22 +9,26 @@ const Select = SelectPrimitive.Root;
|
|
|
9
9
|
const SelectGroup = SelectPrimitive.Group;
|
|
10
10
|
|
|
11
11
|
const SelectValue = SelectPrimitive.Value;
|
|
12
|
-
|
|
12
|
+
type SelectTriggerProps = React.ComponentPropsWithoutRef<
|
|
13
|
+
typeof SelectPrimitive.Trigger
|
|
14
|
+
> & {
|
|
15
|
+
iconClassName?: string;
|
|
16
|
+
};
|
|
13
17
|
const SelectTrigger = React.forwardRef<
|
|
14
18
|
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
|
15
|
-
|
|
16
|
-
>(({ className, children, ...props }, ref) => (
|
|
19
|
+
SelectTriggerProps
|
|
20
|
+
>(({ className, children, iconClassName, ...props }, ref) => (
|
|
17
21
|
<SelectPrimitive.Trigger
|
|
18
22
|
ref={ref}
|
|
19
23
|
className={cn(
|
|
20
|
-
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-
|
|
24
|
+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-ring placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
|
21
25
|
className
|
|
22
26
|
)}
|
|
23
27
|
{...props}
|
|
24
28
|
>
|
|
25
29
|
{children}
|
|
26
30
|
<SelectPrimitive.Icon asChild>
|
|
27
|
-
<ChevronDown className="h-4 w-4 opacity-50" />
|
|
31
|
+
<ChevronDown className={cn("h-4 w-4 opacity-50 ", iconClassName)} />
|
|
28
32
|
</SelectPrimitive.Icon>
|
|
29
33
|
</SelectPrimitive.Trigger>
|
|
30
34
|
));
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../utils/utils";
|
|
5
|
+
|
|
6
|
+
const Separator = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SeparatorPrimitive.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
|
|
9
|
+
>(
|
|
10
|
+
(
|
|
11
|
+
{ className, orientation = "horizontal", decorative = true, ...props },
|
|
12
|
+
ref
|
|
13
|
+
) => (
|
|
14
|
+
<SeparatorPrimitive.Root
|
|
15
|
+
ref={ref}
|
|
16
|
+
decorative={decorative}
|
|
17
|
+
orientation={orientation}
|
|
18
|
+
className={cn(
|
|
19
|
+
"shrink-0 bg-border",
|
|
20
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
28
|
+
|
|
29
|
+
export { Separator };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../utils/utils";
|
|
5
|
+
|
|
6
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
7
|
+
|
|
8
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
9
|
+
|
|
10
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
11
|
+
|
|
12
|
+
const TooltipContent = React.forwardRef<
|
|
13
|
+
React.ElementRef<typeof TooltipPrimitive.Content>,
|
|
14
|
+
React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
|
|
15
|
+
>(({ className, sideOffset = 4, ...props }, ref) => (
|
|
16
|
+
<TooltipPrimitive.Content
|
|
17
|
+
ref={ref}
|
|
18
|
+
sideOffset={sideOffset}
|
|
19
|
+
className={cn(
|
|
20
|
+
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",
|
|
21
|
+
className
|
|
22
|
+
)}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
));
|
|
26
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
27
|
+
|
|
28
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
|
package/lib/main.ts
CHANGED
|
@@ -56,6 +56,10 @@ export * from "./components/ui/form.tsx";
|
|
|
56
56
|
export * from "./components/ui/radioGroup.tsx";
|
|
57
57
|
export * from "./components/ui/command.tsx";
|
|
58
58
|
export * from "./components/ui/Combobox.tsx";
|
|
59
|
+
export * from "./components/ui/select.tsx";
|
|
60
|
+
export * from "./components/ui/tooltip.tsx";
|
|
61
|
+
export * from "./components/ui/separator.tsx";
|
|
62
|
+
export { Button as ButtonCN, buttonVariants } from "./components/ui/button.tsx";
|
|
59
63
|
|
|
60
64
|
|
|
61
65
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@addsign/moje-agenda-shared-lib",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"types": "dist/main.d.ts",
|
|
@@ -69,7 +69,9 @@
|
|
|
69
69
|
"@radix-ui/react-radio-group": "^1.2.1",
|
|
70
70
|
"@radix-ui/react-scroll-area": "^1.2.0",
|
|
71
71
|
"@radix-ui/react-select": "^2.1.2",
|
|
72
|
+
"@radix-ui/react-separator": "^1.1.0",
|
|
72
73
|
"@radix-ui/react-slot": "^1.1.0",
|
|
74
|
+
"@radix-ui/react-tooltip": "^1.1.4",
|
|
73
75
|
"@types/date-fns": "^2.6.3",
|
|
74
76
|
"axios": "^1.7.2",
|
|
75
77
|
"class-variance-authority": "^0.7.0",
|