@addsign/moje-agenda-shared-lib 2.0.41 → 2.0.42
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/Combination-D2GKeTwa.js +1162 -0
- package/dist/Combination-D2GKeTwa.js.map +1 -0
- package/dist/Dialog-CCrUyF91.js +424 -0
- package/dist/Dialog-CCrUyF91.js.map +1 -0
- package/dist/assets/style.css +61 -8
- package/dist/chevron-down-CfJmko7t.js +14 -0
- package/dist/chevron-down-CfJmko7t.js.map +1 -0
- package/dist/components/Attachments.js +2 -1
- package/dist/components/Attachments.js.map +1 -1
- package/dist/components/ConfirmationModalDialog.js +1 -1
- package/dist/components/ConfirmationModalDialog.js.map +1 -1
- package/dist/components/Modal.js +1 -1
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/datatable/DataTable.js +3 -2
- package/dist/components/datatable/DataTable.js.map +1 -1
- package/dist/components/datatable/DataTableServer.js +35 -9
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBar.js +5 -4
- package/dist/components/form/AutocompleteSearchBar.js.map +1 -1
- package/dist/components/form/AutocompleteSearchBarServer.js +2 -1
- package/dist/components/form/AutocompleteSearchBarServer.js.map +1 -1
- package/dist/components/form/DateRangeField.js +2 -2
- package/dist/components/form/DateRangeField.js.map +1 -1
- package/dist/components/form/FileInput.js +3 -2
- package/dist/components/form/FileInput.js.map +1 -1
- package/dist/components/form/FileInputMultiple.js +3 -2
- package/dist/components/form/FileInputMultiple.js.map +1 -1
- package/dist/components/form/FormField.js +8 -7
- package/dist/components/form/FormField.js.map +1 -1
- package/dist/components/form/InputField.js +3 -2
- package/dist/components/form/InputField.js.map +1 -1
- package/dist/components/form/PositionsSelectorSingle.js +2 -1
- package/dist/components/form/PositionsSelectorSingle.js.map +1 -1
- package/dist/components/form/RadioGroup.js +1 -1
- package/dist/components/form/RadioGroup.js.map +1 -1
- package/dist/components/form/SelectField.js +5 -4
- package/dist/components/form/SelectField.js.map +1 -1
- package/dist/components/layout/Neoptimizovano.js +2 -1
- package/dist/components/layout/Neoptimizovano.js.map +1 -1
- package/dist/components/layout/PageTitle.js +1 -1
- package/dist/components/layout/PageTitle.js.map +1 -1
- package/dist/components/layout/SectionTitle.js +1 -1
- package/dist/components/layout/SectionTitle.js.map +1 -1
- package/dist/components/profiles/ProfileOverview.js +2 -1
- package/dist/components/profiles/ProfileOverview.js.map +1 -1
- package/dist/components/ui/Combobox.js +1 -1
- package/dist/components/ui/DatePicker.js +1 -1
- package/dist/components/ui/DateTimePicker.js +1 -1
- package/dist/components/ui/Dialog.js +1 -1
- package/dist/components/ui/ScrollArea.js +2 -2
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +27 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/checkbox.js +4 -4
- package/dist/components/ui/command.js +2 -2
- package/dist/components/ui/multi-select.d.ts +67 -0
- package/dist/components/ui/multi-select.js +295 -0
- package/dist/components/ui/multi-select.js.map +1 -0
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/radioGroup.js +5 -5
- package/dist/components/ui/select.js +8 -16
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/toast.js +5 -5
- package/dist/components/ui/tooltip.js +6 -6
- package/dist/index-B0wyIFEr.js +47 -0
- package/dist/index-B0wyIFEr.js.map +1 -0
- package/dist/index-BcR8DnnV.js +234 -0
- package/dist/index-BcR8DnnV.js.map +1 -0
- package/dist/index-CK9QfV6i.js +40 -0
- package/dist/index-CK9QfV6i.js.map +1 -0
- package/dist/index-CcNKXchf.js +2203 -0
- package/dist/index-CcNKXchf.js.map +1 -0
- package/dist/index-D75exu1X.js +18 -0
- package/dist/index-D75exu1X.js.map +1 -0
- package/dist/index-DzfDO78K.js +15 -0
- package/dist/index-DzfDO78K.js.map +1 -0
- package/dist/index-NZPkObcw.js +110 -0
- package/dist/index-NZPkObcw.js.map +1 -0
- package/dist/index-qqHvAsVd.js +2266 -0
- package/dist/index-qqHvAsVd.js.map +1 -0
- package/dist/index-wO-IHm1z.js +131 -0
- package/dist/index-wO-IHm1z.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +3 -1
- package/dist/main.js.map +1 -1
- package/dist/popover-CcrzvSk7.js +319 -0
- package/dist/popover-CcrzvSk7.js.map +1 -0
- package/lib/components/ConfirmationModalDialog.tsx +1 -1
- package/lib/components/Modal.tsx +1 -1
- package/lib/components/datatable/DataTable.tsx +1 -1
- package/lib/components/datatable/DataTableServer.tsx +49 -15
- package/lib/components/form/AutocompleteSearchBar.tsx +3 -3
- package/lib/components/form/DateRangeField.tsx +2 -2
- package/lib/components/form/FormField.tsx +6 -6
- package/lib/components/form/InputField.tsx +3 -2
- package/lib/components/form/RadioGroup.tsx +1 -1
- package/lib/components/form/SelectField.tsx +3 -3
- package/lib/components/layout/PageTitle.tsx +19 -19
- package/lib/components/layout/SectionTitle.tsx +1 -1
- package/lib/components/ui/badge.tsx +36 -0
- package/lib/components/ui/multi-select.tsx +365 -0
- package/lib/main.ts +4 -0
- package/package.json +1 -1
|
@@ -114,7 +114,7 @@ export default function InputField({
|
|
|
114
114
|
<textarea
|
|
115
115
|
id={name}
|
|
116
116
|
name={name}
|
|
117
|
-
className="grow shrink basis-0 text-
|
|
117
|
+
className="grow shrink basis-0 text-muted-foreground text-sm font-normal leading-tight focus:border-none outline-none shadow-none
|
|
118
118
|
bg-white "
|
|
119
119
|
disabled={disabled}
|
|
120
120
|
value={inputValue}
|
|
@@ -137,7 +137,8 @@ export default function InputField({
|
|
|
137
137
|
return (
|
|
138
138
|
<>
|
|
139
139
|
<input
|
|
140
|
-
className={`text-
|
|
140
|
+
className={`text-muted-foreground text-sm font-normal leading-normal outline-none shadow-none
|
|
141
|
+
placeholder-muted-foreground
|
|
141
142
|
text-ellipsis overflow-hidden w-full disabled:cursor-not-allowed bg-white`}
|
|
142
143
|
id={name}
|
|
143
144
|
name={name}
|
|
@@ -43,7 +43,7 @@ export default function RadioGroup({
|
|
|
43
43
|
onChange={onInputChange}
|
|
44
44
|
className=" accent-primary border-gray-300 mr-2"
|
|
45
45
|
/>
|
|
46
|
-
<span className="text-
|
|
46
|
+
<span className="text-muted-foreground text-sm font-normal leading-tight">
|
|
47
47
|
{option.label}
|
|
48
48
|
</span>
|
|
49
49
|
</label>
|
|
@@ -133,7 +133,7 @@ export default function SelectField({
|
|
|
133
133
|
>
|
|
134
134
|
<div className="grow shrink basis-0 px-1 py-2 rounded-md flex-col justify-start items-start gap-2 inline-flex">
|
|
135
135
|
<div className="self-stretch justify-start items-center gap-2 inline-flex">
|
|
136
|
-
<div className="text-
|
|
136
|
+
<div className="text-muted-foreground text-sm font-normal leading-normal">
|
|
137
137
|
{option.label}
|
|
138
138
|
</div>
|
|
139
139
|
{option.description && (
|
|
@@ -199,12 +199,12 @@ export default function SelectField({
|
|
|
199
199
|
>
|
|
200
200
|
<div className="grow shrink basis-0 min-h-[32px] justify-start items-center gap-0 flex whitespace-nowrap w-[calc(100%-40px)] ">
|
|
201
201
|
<div
|
|
202
|
-
className="text-
|
|
202
|
+
className="text-muted-foreground text-sm font-normal leading-normal text-ellipsis overflow-hidden w-full"
|
|
203
203
|
id={name}
|
|
204
204
|
>
|
|
205
205
|
{currentlySelectedOption?.label}
|
|
206
206
|
{!currentlySelectedOption?.label && placeholder && (
|
|
207
|
-
<span className="text-
|
|
207
|
+
<span className="text-muted-foreground font-normal">
|
|
208
208
|
{" "}
|
|
209
209
|
{placeholder}
|
|
210
210
|
</span>
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
interface IPageTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
2
|
-
textSize?: string;
|
|
3
|
-
children?: React.ReactNode;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export default function PageTitle({
|
|
7
|
-
children,
|
|
8
|
-
textSize = "text-2xl",
|
|
9
|
-
...props
|
|
10
|
-
}: IPageTitleProps) {
|
|
11
|
-
// Combine textSize with the other fixed class names
|
|
12
|
-
const className = ` text-
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<h1 {...props} className={className}>
|
|
16
|
-
{children}
|
|
17
|
-
</h1>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
1
|
+
interface IPageTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
2
|
+
textSize?: string;
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export default function PageTitle({
|
|
7
|
+
children,
|
|
8
|
+
textSize = "text-2xl",
|
|
9
|
+
...props
|
|
10
|
+
}: IPageTitleProps) {
|
|
11
|
+
// Combine textSize with the other fixed class names
|
|
12
|
+
const className = ` text-muted-foreground ${textSize} font-medium font-['Inter'] leading-7 mb-5`;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<h1 {...props} className={className}>
|
|
16
|
+
{children}
|
|
17
|
+
</h1>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -10,7 +10,7 @@ export default function SectionTitle({
|
|
|
10
10
|
...props
|
|
11
11
|
}: ISectionTitleProps) {
|
|
12
12
|
// Combine textSize with the other fixed class names
|
|
13
|
-
const className = ` text-
|
|
13
|
+
const className = ` text-muted-foreground ${textSize} font-semibold font-['Inter'] leading-7 mb-3`;
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<div className="border-b border-gray-300 pt-2 mb-5 ">
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../../utils/utils";
|
|
5
|
+
|
|
6
|
+
const badgeVariants = cva(
|
|
7
|
+
"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-normal transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default:
|
|
12
|
+
"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",
|
|
13
|
+
secondary:
|
|
14
|
+
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
15
|
+
destructive:
|
|
16
|
+
"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",
|
|
17
|
+
outline: "text-foreground",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
variant: "default",
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export interface BadgeProps
|
|
27
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
28
|
+
VariantProps<typeof badgeVariants> {}
|
|
29
|
+
|
|
30
|
+
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
31
|
+
return (
|
|
32
|
+
<div className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { Badge, badgeVariants };
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
// src/components/multi-select.tsx
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
5
|
+
import { CheckIcon, XCircle, ChevronDown, XIcon } from "lucide-react";
|
|
6
|
+
|
|
7
|
+
import { cn } from "../../utils/utils";
|
|
8
|
+
import { Separator } from "./separator";
|
|
9
|
+
import { Button } from "./button";
|
|
10
|
+
import { Badge } from "./badge";
|
|
11
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover";
|
|
12
|
+
import {
|
|
13
|
+
Command,
|
|
14
|
+
CommandEmpty,
|
|
15
|
+
CommandGroup,
|
|
16
|
+
CommandInput,
|
|
17
|
+
CommandItem,
|
|
18
|
+
CommandList,
|
|
19
|
+
CommandSeparator,
|
|
20
|
+
} from "./command";
|
|
21
|
+
import { IOptionItem } from "../../types";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Variants for the multi-select component to handle different styles.
|
|
25
|
+
* Uses class-variance-authority (cva) to define different styles based on "variant" prop.
|
|
26
|
+
*/
|
|
27
|
+
const multiSelectVariants = cva("m-1 transition ease-in-out delay-150 ", {
|
|
28
|
+
variants: {
|
|
29
|
+
variant: {
|
|
30
|
+
default:
|
|
31
|
+
"border-foreground/10 text-foreground bg-card hover:bg-card/80 font-normal",
|
|
32
|
+
secondary:
|
|
33
|
+
"border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80 font-normal",
|
|
34
|
+
destructive:
|
|
35
|
+
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80 font-normal",
|
|
36
|
+
inverted: "inverted",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
variant: "default",
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Props for MultiSelect component
|
|
46
|
+
*/
|
|
47
|
+
interface MultiSelectProps
|
|
48
|
+
extends Omit<
|
|
49
|
+
React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
50
|
+
"onChange" | "value"
|
|
51
|
+
>,
|
|
52
|
+
VariantProps<typeof multiSelectVariants> {
|
|
53
|
+
/**
|
|
54
|
+
* An array of option objects to be displayed in the multi-select component.
|
|
55
|
+
* Each option object has a label, value, and an optional icon.
|
|
56
|
+
*/
|
|
57
|
+
options: IOptionItem[];
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Callback function triggered when the selected values change.
|
|
61
|
+
* Receives an array of the new selected values.
|
|
62
|
+
*/
|
|
63
|
+
onChange: (value: string[]) => void;
|
|
64
|
+
|
|
65
|
+
/** The controlled value of the component */
|
|
66
|
+
value?: string[];
|
|
67
|
+
|
|
68
|
+
/** The default selected values when the component mounts (uncontrolled mode) */
|
|
69
|
+
defaultValue?: string[];
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Placeholder text to be displayed when no values are selected.
|
|
73
|
+
* Optional, defaults to "Select options".
|
|
74
|
+
*/
|
|
75
|
+
placeholder?: string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Placeholder text to be displayed when no values are selected.
|
|
79
|
+
* Optional, defaults to "Select options".
|
|
80
|
+
*/
|
|
81
|
+
placeholderSearch?: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Maximum number of items to display. Extra selected items will be summarized.
|
|
85
|
+
* Optional, defaults to 3.
|
|
86
|
+
*/
|
|
87
|
+
maxCount?: number;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The modality of the popover. When set to true, interaction with outside elements
|
|
91
|
+
* will be disabled and only popover content will be visible to screen readers.
|
|
92
|
+
* Optional, defaults to false.
|
|
93
|
+
*/
|
|
94
|
+
modalPopover?: boolean;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* If true, renders the multi-select component as a child of another component.
|
|
98
|
+
* Optional, defaults to false.
|
|
99
|
+
*/
|
|
100
|
+
asChild?: boolean;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Additional class names to apply custom styles to the multi-select component.
|
|
104
|
+
* Optional, can be used to add custom styles.
|
|
105
|
+
*/
|
|
106
|
+
className?: string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* If true, the multi-select component will be disabled.
|
|
110
|
+
* Optional, defaults to false.
|
|
111
|
+
*/
|
|
112
|
+
disabled?: boolean;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* value?: string;
|
|
116
|
+
onChange?: (value: string | undefined) => void;
|
|
117
|
+
*/
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const MultiSelect = React.forwardRef<
|
|
121
|
+
HTMLButtonElement,
|
|
122
|
+
MultiSelectProps
|
|
123
|
+
>(
|
|
124
|
+
(
|
|
125
|
+
{
|
|
126
|
+
options,
|
|
127
|
+
onChange,
|
|
128
|
+
value: propValue,
|
|
129
|
+
variant,
|
|
130
|
+
defaultValue = [],
|
|
131
|
+
placeholder = "Vyberte možnosti",
|
|
132
|
+
placeholderSearch = "Vyhledejte",
|
|
133
|
+
maxCount = 3,
|
|
134
|
+
modalPopover = false,
|
|
135
|
+
asChild = false,
|
|
136
|
+
className,
|
|
137
|
+
...props
|
|
138
|
+
},
|
|
139
|
+
ref
|
|
140
|
+
) => {
|
|
141
|
+
const [selectedValues, setSelectedValues] = React.useState<string[]>(
|
|
142
|
+
propValue ?? defaultValue
|
|
143
|
+
);
|
|
144
|
+
const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
|
|
145
|
+
|
|
146
|
+
// Update internal state when controlled value changes
|
|
147
|
+
React.useEffect(() => {
|
|
148
|
+
if (propValue !== undefined) {
|
|
149
|
+
setSelectedValues(propValue);
|
|
150
|
+
}
|
|
151
|
+
}, [propValue]);
|
|
152
|
+
|
|
153
|
+
const handleValueChange = (newValues: string[]) => {
|
|
154
|
+
setSelectedValues(newValues);
|
|
155
|
+
onChange(newValues);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const handleTogglePopover = () => {
|
|
159
|
+
setIsPopoverOpen((prev) => !prev);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const toggleOption = (option: string | number | null) => {
|
|
163
|
+
if (option === null) return;
|
|
164
|
+
const optionStr = String(option);
|
|
165
|
+
const newSelectedValues = selectedValues.includes(optionStr)
|
|
166
|
+
? selectedValues.filter((value) => value !== optionStr)
|
|
167
|
+
: [...selectedValues, optionStr];
|
|
168
|
+
handleValueChange(newSelectedValues);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const handleClear = () => {
|
|
172
|
+
handleValueChange([]);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const clearExtraOptions = () => {
|
|
176
|
+
const newSelectedValues = selectedValues.slice(0, maxCount);
|
|
177
|
+
handleValueChange(newSelectedValues);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const toggleAll = () => {
|
|
181
|
+
if (selectedValues.length === options.length) {
|
|
182
|
+
handleClear();
|
|
183
|
+
} else {
|
|
184
|
+
const allValues = options.map((option) => option.value as string);
|
|
185
|
+
handleValueChange(allValues);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<Popover
|
|
191
|
+
open={isPopoverOpen}
|
|
192
|
+
onOpenChange={setIsPopoverOpen}
|
|
193
|
+
modal={modalPopover}
|
|
194
|
+
>
|
|
195
|
+
<PopoverTrigger asChild>
|
|
196
|
+
<Button
|
|
197
|
+
ref={ref}
|
|
198
|
+
{...props}
|
|
199
|
+
onClick={handleTogglePopover}
|
|
200
|
+
className={cn(
|
|
201
|
+
"flex w-full p-1 rounded-md border min-h-10 h-auto items-center justify-between hover:bg-inherit [&_svg]:pointer-events-auto font-normal bg-background text-muted-foreground",
|
|
202
|
+
className
|
|
203
|
+
)}
|
|
204
|
+
>
|
|
205
|
+
{selectedValues.length > 0 ? (
|
|
206
|
+
<div className="flex justify-between items-center w-full">
|
|
207
|
+
<div className="flex flex-wrap items-center">
|
|
208
|
+
{selectedValues.slice(0, maxCount).map((value) => {
|
|
209
|
+
const option = options.find((o) => o.value === value);
|
|
210
|
+
return (
|
|
211
|
+
<Badge
|
|
212
|
+
key={value}
|
|
213
|
+
className={cn(multiSelectVariants({ variant }))}
|
|
214
|
+
>
|
|
215
|
+
{option?.label}
|
|
216
|
+
<XCircle
|
|
217
|
+
className="ml-2 h-4 w-4 cursor-pointer text-muted-foreground"
|
|
218
|
+
onClick={(event) => {
|
|
219
|
+
event.stopPropagation();
|
|
220
|
+
toggleOption(value);
|
|
221
|
+
}}
|
|
222
|
+
/>
|
|
223
|
+
</Badge>
|
|
224
|
+
);
|
|
225
|
+
})}
|
|
226
|
+
{selectedValues.length > maxCount && (
|
|
227
|
+
<Badge
|
|
228
|
+
className={cn(
|
|
229
|
+
"bg-transparent text-foreground border-foreground/1 hover:bg-transparent",
|
|
230
|
+
multiSelectVariants({ variant })
|
|
231
|
+
)}
|
|
232
|
+
>
|
|
233
|
+
{`+ ${selectedValues.length - maxCount} další`}
|
|
234
|
+
<XCircle
|
|
235
|
+
className="ml-2 h-4 w-4 cursor-pointer text-muted-foreground"
|
|
236
|
+
onClick={(event) => {
|
|
237
|
+
event.stopPropagation();
|
|
238
|
+
clearExtraOptions();
|
|
239
|
+
}}
|
|
240
|
+
/>
|
|
241
|
+
</Badge>
|
|
242
|
+
)}
|
|
243
|
+
</div>
|
|
244
|
+
<div className="flex items-center justify-between">
|
|
245
|
+
<XIcon
|
|
246
|
+
className="h-4 mx-2 cursor-pointer text-muted-foreground"
|
|
247
|
+
onClick={(event) => {
|
|
248
|
+
event.stopPropagation();
|
|
249
|
+
handleClear();
|
|
250
|
+
}}
|
|
251
|
+
/>
|
|
252
|
+
<Separator
|
|
253
|
+
orientation="vertical"
|
|
254
|
+
className="flex min-h-6 h-full"
|
|
255
|
+
/>
|
|
256
|
+
<ChevronDown className="h-4 mx-2 cursor-pointer text-muted-foreground" />
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
259
|
+
) : (
|
|
260
|
+
<div className="flex items-center justify-between w-full mx-auto">
|
|
261
|
+
<span className="text-sm text-muted-foreground mx-3">
|
|
262
|
+
{placeholder}
|
|
263
|
+
</span>
|
|
264
|
+
<ChevronDown className="h-4 cursor-pointer text-muted-foreground mx-2" />
|
|
265
|
+
</div>
|
|
266
|
+
)}
|
|
267
|
+
</Button>
|
|
268
|
+
</PopoverTrigger>
|
|
269
|
+
<PopoverContent
|
|
270
|
+
className="w-auto p-0"
|
|
271
|
+
align="start"
|
|
272
|
+
onEscapeKeyDown={() => setIsPopoverOpen(false)}
|
|
273
|
+
>
|
|
274
|
+
<Command>
|
|
275
|
+
<CommandInput
|
|
276
|
+
placeholder={placeholderSearch}
|
|
277
|
+
onKeyDown={(e: React.KeyboardEvent<HTMLInputElement>) => {
|
|
278
|
+
if (e.key === "Enter") {
|
|
279
|
+
setIsPopoverOpen(true);
|
|
280
|
+
} else if (e.key === "Backspace" && !e.currentTarget.value) {
|
|
281
|
+
const newSelectedValues = [...selectedValues];
|
|
282
|
+
newSelectedValues.pop();
|
|
283
|
+
handleValueChange(newSelectedValues);
|
|
284
|
+
}
|
|
285
|
+
}}
|
|
286
|
+
/>
|
|
287
|
+
<CommandList>
|
|
288
|
+
<CommandEmpty>No results found.</CommandEmpty>
|
|
289
|
+
<CommandGroup>
|
|
290
|
+
<CommandItem
|
|
291
|
+
key="all"
|
|
292
|
+
onSelect={toggleAll}
|
|
293
|
+
className="cursor-pointer"
|
|
294
|
+
>
|
|
295
|
+
<div
|
|
296
|
+
className={cn(
|
|
297
|
+
"mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
|
|
298
|
+
selectedValues.length === options.length
|
|
299
|
+
? "bg-primary text-primary-foreground"
|
|
300
|
+
: "opacity-50 [&_svg]:invisible"
|
|
301
|
+
)}
|
|
302
|
+
>
|
|
303
|
+
<CheckIcon className="h-4 w-4" />
|
|
304
|
+
</div>
|
|
305
|
+
<span>(Vyberte vše)</span>
|
|
306
|
+
</CommandItem>
|
|
307
|
+
{options.map((option) => {
|
|
308
|
+
const optionStr = String(option.value);
|
|
309
|
+
const isSelected = selectedValues.includes(optionStr);
|
|
310
|
+
return (
|
|
311
|
+
<CommandItem
|
|
312
|
+
key={optionStr}
|
|
313
|
+
onSelect={() => toggleOption(option.value)}
|
|
314
|
+
className="cursor-pointer"
|
|
315
|
+
>
|
|
316
|
+
<div
|
|
317
|
+
className={cn(
|
|
318
|
+
"mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
|
|
319
|
+
isSelected
|
|
320
|
+
? "bg-primary text-primary-foreground"
|
|
321
|
+
: "opacity-50 [&_svg]:invisible"
|
|
322
|
+
)}
|
|
323
|
+
>
|
|
324
|
+
<CheckIcon className="h-4 w-4" />
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
<span>{option.label}</span>
|
|
328
|
+
</CommandItem>
|
|
329
|
+
);
|
|
330
|
+
})}
|
|
331
|
+
</CommandGroup>
|
|
332
|
+
<CommandSeparator />
|
|
333
|
+
<CommandGroup>
|
|
334
|
+
<div className="flex items-center justify-between">
|
|
335
|
+
{selectedValues.length > 0 && (
|
|
336
|
+
<>
|
|
337
|
+
<CommandItem
|
|
338
|
+
onSelect={handleClear}
|
|
339
|
+
className="flex-1 justify-center cursor-pointer"
|
|
340
|
+
>
|
|
341
|
+
Odebrat vše
|
|
342
|
+
</CommandItem>
|
|
343
|
+
<Separator
|
|
344
|
+
orientation="vertical"
|
|
345
|
+
className="flex min-h-6 h-full"
|
|
346
|
+
/>
|
|
347
|
+
</>
|
|
348
|
+
)}
|
|
349
|
+
<CommandItem
|
|
350
|
+
onSelect={() => setIsPopoverOpen(false)}
|
|
351
|
+
className="flex-1 justify-center cursor-pointer max-w-full"
|
|
352
|
+
>
|
|
353
|
+
Zavřít
|
|
354
|
+
</CommandItem>
|
|
355
|
+
</div>
|
|
356
|
+
</CommandGroup>
|
|
357
|
+
</CommandList>
|
|
358
|
+
</Command>
|
|
359
|
+
</PopoverContent>
|
|
360
|
+
</Popover>
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
);
|
|
364
|
+
|
|
365
|
+
MultiSelect.displayName = "MultiSelect";
|
package/lib/main.ts
CHANGED
|
@@ -67,6 +67,10 @@ export * from "./components/ui/tooltip.tsx";
|
|
|
67
67
|
export * from "./components/ui/separator.tsx";
|
|
68
68
|
export * from "./components/ui/textarea.tsx";
|
|
69
69
|
export * from "./components/ui/checkbox.tsx";
|
|
70
|
+
|
|
71
|
+
export * from "./components/ui/multi-select.tsx";
|
|
72
|
+
|
|
73
|
+
|
|
70
74
|
export { Button as ButtonCN, buttonVariants } from "./components/ui/button.tsx";
|
|
71
75
|
|
|
72
76
|
|