@addsign/moje-agenda-shared-lib 2.0.3 → 2.0.5

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 (84) hide show
  1. package/dist/Dialog-BtXGfOmv.js +423 -0
  2. package/dist/Dialog-BtXGfOmv.js.map +1 -0
  3. package/dist/assets/style.css +18 -0
  4. package/dist/assets/tailwind.css +25 -24
  5. package/dist/components/datatable/DataTable.js +3 -1
  6. package/dist/components/datatable/DataTable.js.map +1 -1
  7. package/dist/components/datatable/DataTableServer.js +3 -1
  8. package/dist/components/datatable/DataTableServer.js.map +1 -1
  9. package/dist/components/form/AutocompleteSearchBar.js +3 -1
  10. package/dist/components/form/AutocompleteSearchBar.js.map +1 -1
  11. package/dist/components/form/AutocompleteSearchBarServer.js +3 -1
  12. package/dist/components/form/AutocompleteSearchBarServer.js.map +1 -1
  13. package/dist/components/form/FileInput.js +4 -2
  14. package/dist/components/form/FileInput.js.map +1 -1
  15. package/dist/components/form/FileInputMultiple.js +4 -2
  16. package/dist/components/form/FileInputMultiple.js.map +1 -1
  17. package/dist/components/form/FormField.js +3 -1
  18. package/dist/components/form/FormField.js.map +1 -1
  19. package/dist/components/form/PositionsSelectorSingle.js +3 -1
  20. package/dist/components/form/PositionsSelectorSingle.js.map +1 -1
  21. package/dist/components/form/SelectField.js +3 -1
  22. package/dist/components/form/SelectField.js.map +1 -1
  23. package/dist/components/profiles/ProfileOverview.js +3 -1
  24. package/dist/components/profiles/ProfileOverview.js.map +1 -1
  25. package/dist/components/ui/Combobox.js +18 -7
  26. package/dist/components/ui/Combobox.js.map +1 -1
  27. package/dist/components/ui/DateTimePicker.d.ts +1 -1
  28. package/dist/components/ui/DateTimePicker.js +25 -13
  29. package/dist/components/ui/DateTimePicker.js.map +1 -1
  30. package/dist/components/ui/Dialog.js +1 -1
  31. package/dist/components/ui/ScrollArea.js +2 -2
  32. package/dist/components/ui/checkbox.d.ts +4 -0
  33. package/dist/components/ui/checkbox.js +180 -0
  34. package/dist/components/ui/checkbox.js.map +1 -0
  35. package/dist/components/ui/command.js +2 -2
  36. package/dist/components/ui/datepicker.js +11 -0
  37. package/dist/components/ui/datepicker.js.map +1 -1
  38. package/dist/components/ui/input.js +1 -0
  39. package/dist/components/ui/input.js.map +1 -1
  40. package/dist/components/ui/popover.js +7 -6
  41. package/dist/components/ui/popover.js.map +1 -1
  42. package/dist/components/ui/radioGroup.js +7 -5
  43. package/dist/components/ui/radioGroup.js.map +1 -1
  44. package/dist/components/ui/select.js +8 -6
  45. package/dist/components/ui/select.js.map +1 -1
  46. package/dist/components/ui/textarea.d.ts +3 -0
  47. package/dist/components/ui/textarea.js +21 -0
  48. package/dist/components/ui/textarea.js.map +1 -0
  49. package/dist/components/ui/tooltip.js +6 -5
  50. package/dist/components/ui/tooltip.js.map +1 -1
  51. package/dist/index-BLOUFOiQ.js +2266 -0
  52. package/dist/index-BLOUFOiQ.js.map +1 -0
  53. package/dist/index-CA2QNu6z.js +131 -0
  54. package/dist/index-CA2QNu6z.js.map +1 -0
  55. package/dist/index-CAxGI0Uw.js +230 -0
  56. package/dist/index-CAxGI0Uw.js.map +1 -0
  57. package/dist/index-CDCkSjVs.js +110 -0
  58. package/dist/index-CDCkSjVs.js.map +1 -0
  59. package/dist/index-CDlDRp01.js +1173 -0
  60. package/dist/index-CDlDRp01.js.map +1 -0
  61. package/dist/index-CshadhlS.js +15 -0
  62. package/dist/index-CshadhlS.js.map +1 -0
  63. package/dist/index-DFSwSCB0.js +47 -0
  64. package/dist/index-DFSwSCB0.js.map +1 -0
  65. package/dist/index-Deoi9R3y.js +15 -0
  66. package/dist/index-Deoi9R3y.js.map +1 -0
  67. package/dist/index-DjvLSytK.js +2203 -0
  68. package/dist/index-DjvLSytK.js.map +1 -0
  69. package/dist/index-E5yk6fTE.js +129 -0
  70. package/dist/index-E5yk6fTE.js.map +1 -0
  71. package/dist/index-pLFWXSOv.js +40 -0
  72. package/dist/index-pLFWXSOv.js.map +1 -0
  73. package/dist/main.d.ts +2 -0
  74. package/dist/main.js +5 -1
  75. package/dist/main.js.map +1 -1
  76. package/lib/components/ui/Combobox.tsx +19 -7
  77. package/lib/components/ui/DatePicker.tsx +11 -0
  78. package/lib/components/ui/DateTimePicker.tsx +30 -16
  79. package/lib/components/ui/checkbox.tsx +30 -0
  80. package/lib/components/ui/input.tsx +1 -0
  81. package/lib/components/ui/textarea.tsx +22 -0
  82. package/lib/main.ts +2 -0
  83. package/package.json +4 -2
  84. package/tailwind.config.js +97 -0
@@ -36,7 +36,7 @@ const Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(
36
36
  placeholder,
37
37
  placeholderSearch = "Vyhledejte položku",
38
38
  clearable = false,
39
- options = [],
39
+ options: propOptions = [],
40
40
  allowAddNew = false,
41
41
  },
42
42
  ref
@@ -44,17 +44,28 @@ const Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(
44
44
  const [open, setOpen] = React.useState(false);
45
45
  const [value, setValue] = React.useState(propValue || "");
46
46
  const [inputValue, setInputValue] = React.useState("");
47
- const [frameworks, setFrameworks] = React.useState<IOptionItem[]>(options);
47
+ const [frameworks, setFrameworks] =
48
+ React.useState<IOptionItem[]>(propOptions);
48
49
 
49
50
  React.useEffect(() => {
51
+ console.log(
52
+ "%clibcomponentsCombobox.tsx:51 propValue",
53
+ "color: #007acc;",
54
+ propValue
55
+ );
50
56
  if (propValue !== undefined) {
51
57
  setValue(propValue);
52
58
  }
53
59
  }, [propValue]);
54
60
 
55
61
  React.useEffect(() => {
56
- setFrameworks(options);
57
- }, [options]);
62
+ console.log(
63
+ "%clibcomponentsCombobox.tsx:60 setFrameworks",
64
+ "color: #007acc;",
65
+ setFrameworks
66
+ );
67
+ setFrameworks(propOptions);
68
+ }, [propOptions]);
58
69
 
59
70
  const handleSelect = (currentValue: string) => {
60
71
  if (currentValue === "add-custom") {
@@ -127,7 +138,7 @@ const Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(
127
138
  </Button>
128
139
  )}
129
140
  </div>
130
- <PopoverContent className="min-w-[200px] w-full p-0">
141
+ <PopoverContent className="min-w-[200px] w-[var(--radix-popover-trigger-width)] p-0">
131
142
  <Command>
132
143
  <CommandInput
133
144
  placeholder={placeholderSearch}
@@ -139,6 +150,7 @@ const Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(
139
150
  <CommandEmpty>
140
151
  {allowAddNew && (
141
152
  <Button
153
+ type="button"
142
154
  variant="ghost"
143
155
  className="w-full justify-start"
144
156
  onClick={() => handleSelect("add-custom")}
@@ -153,8 +165,8 @@ const Combobox = React.forwardRef<HTMLButtonElement, ComboboxProps>(
153
165
  {frameworks.map((framework) => (
154
166
  <CommandItem
155
167
  key={framework.value}
156
- value={framework.value as string}
157
- onSelect={handleSelect}
168
+ value={framework.label as string}
169
+ onSelect={() => handleSelect(framework.value as string)}
158
170
  >
159
171
  {framework.label}
160
172
  <Check
@@ -38,6 +38,16 @@ const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(
38
38
 
39
39
  const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
40
40
  setInputValue(event.target.value);
41
+ const parsedDate = parse(event.target.value, DATE_FORMAT, new Date());
42
+ if (isValid(parsedDate)) {
43
+ setDate(parsedDate);
44
+ onChange?.(parsedDate);
45
+ setInputValue(format(parsedDate, DATE_FORMAT));
46
+ } else {
47
+ setInputValue("");
48
+ setDate(undefined);
49
+ onChange?.(undefined);
50
+ }
41
51
  };
42
52
 
43
53
  const handleInputBlur = () => {
@@ -95,6 +105,7 @@ const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(
95
105
  <CalendarIcon className="absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
96
106
  {clearable && inputValue && (
97
107
  <Button
108
+ type="button"
98
109
  variant="ghost"
99
110
  size="icon"
100
111
  className="absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 p-0"
@@ -19,7 +19,7 @@ const DATE_FORMAT = "dd.MM.yyyy HH:mm";
19
19
 
20
20
  interface DateTimePickerProps {
21
21
  value?: Date;
22
- onChange?: (date: Date | undefined) => void;
22
+ onChange?: (date: Date | undefined | null) => void;
23
23
  className?: string;
24
24
  placeholder?: string;
25
25
  clearable?: boolean;
@@ -30,43 +30,56 @@ const DateTimePicker = forwardRef<HTMLInputElement, DateTimePickerProps>(
30
30
  { value, onChange, className, clearable = true, placeholder, ...props },
31
31
  ref
32
32
  ) => {
33
- const [dateTime, setDateTime] = React.useState<Date | undefined>(value);
34
- const [inputValue, setInputValue] = React.useState<string>("");
33
+ const [dateTime, setDateTime] = React.useState<Date | null>(value || null);
34
+ const [inputValue, setInputValue] = React.useState<string | null>("");
35
35
 
36
36
  useEffect(() => {
37
37
  if (value) {
38
38
  setDateTime(value);
39
39
  setInputValue(format(value, DATE_FORMAT));
40
40
  } else {
41
- setDateTime(undefined);
41
+ setDateTime(null);
42
42
  setInputValue("");
43
43
  }
44
44
  }, [value]);
45
45
 
46
46
  const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
47
+ event.stopPropagation(); // Stop bubbling to prevent interference with other components
48
+
47
49
  setInputValue(event.target.value);
50
+ const parsedDateTime = parse(event.target.value, DATE_FORMAT, new Date());
51
+
52
+ if (isValid(parsedDateTime)) {
53
+ setDateTime(parsedDateTime);
54
+ onChange?.(parsedDateTime);
55
+ setInputValue(format(parsedDateTime, DATE_FORMAT));
56
+ } else {
57
+ setInputValue("");
58
+ setDateTime(null);
59
+ onChange?.(null);
60
+ }
48
61
  };
49
62
 
50
63
  const handleInputBlur = () => {
51
64
  if (inputValue === "") {
52
- setDateTime(undefined);
53
- onChange?.(undefined);
65
+ setDateTime(null);
66
+ onChange?.(null);
54
67
  return;
55
68
  }
56
69
 
57
- const parsedDateTime = parse(inputValue, DATE_FORMAT, new Date());
70
+ const parsedDateTime = parse(inputValue || "", DATE_FORMAT, new Date());
58
71
  if (isValid(parsedDateTime)) {
59
72
  setDateTime(parsedDateTime);
60
73
  onChange?.(parsedDateTime);
61
74
  setInputValue(format(parsedDateTime, DATE_FORMAT));
62
75
  } else {
63
76
  setInputValue("");
64
- setDateTime(undefined);
65
- onChange?.(undefined);
77
+ setDateTime(null);
78
+ onChange?.(null);
66
79
  }
67
80
  };
68
81
 
69
- const handleDateSelect = (selectedDate: Date | undefined) => {
82
+ const handleDateSelect = (selectedDate: Date | undefined | null) => {
70
83
  if (selectedDate) {
71
84
  const newDateTime = dateTime
72
85
  ? set(dateTime, {
@@ -79,9 +92,9 @@ const DateTimePicker = forwardRef<HTMLInputElement, DateTimePickerProps>(
79
92
  onChange?.(newDateTime);
80
93
  setInputValue(format(newDateTime, DATE_FORMAT));
81
94
  } else {
82
- setDateTime(undefined);
95
+ setDateTime(null);
83
96
  setInputValue("");
84
- onChange?.(undefined);
97
+ onChange?.(null);
85
98
  }
86
99
  };
87
100
 
@@ -102,8 +115,8 @@ const DateTimePicker = forwardRef<HTMLInputElement, DateTimePickerProps>(
102
115
 
103
116
  const handleClear = () => {
104
117
  setInputValue("");
105
- setDateTime(undefined);
106
- onChange?.(undefined);
118
+ setDateTime(null);
119
+ onChange?.(null);
107
120
  };
108
121
 
109
122
  const timeOptions = Array.from({ length: 48 }, (_, i) => {
@@ -119,7 +132,7 @@ const DateTimePicker = forwardRef<HTMLInputElement, DateTimePickerProps>(
119
132
  <Input
120
133
  ref={ref}
121
134
  type="text"
122
- value={inputValue}
135
+ value={inputValue || ""}
123
136
  onChange={handleInputChange}
124
137
  onBlur={handleInputBlur}
125
138
  placeholder={placeholder}
@@ -132,6 +145,7 @@ const DateTimePicker = forwardRef<HTMLInputElement, DateTimePickerProps>(
132
145
  <CalendarClockIcon className="absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" />
133
146
  {clearable && inputValue && (
134
147
  <Button
148
+ type="button"
135
149
  variant="ghost"
136
150
  size="icon"
137
151
  className="absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 p-0"
@@ -146,7 +160,7 @@ const DateTimePicker = forwardRef<HTMLInputElement, DateTimePickerProps>(
146
160
  <PopoverContent className="w-auto p-0" align="start">
147
161
  <Calendar
148
162
  mode="single"
149
- selected={dateTime}
163
+ selected={dateTime || undefined}
150
164
  onSelect={handleDateSelect}
151
165
  initialFocus
152
166
  />
@@ -0,0 +1,30 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
5
+ import { Check } from "lucide-react";
6
+
7
+ import { cn } from "../../utils/utils";
8
+
9
+ const Checkbox = React.forwardRef<
10
+ React.ElementRef<typeof CheckboxPrimitive.Root>,
11
+ React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
12
+ >(({ className, ...props }, ref) => (
13
+ <CheckboxPrimitive.Root
14
+ ref={ref}
15
+ className={cn(
16
+ "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
17
+ className
18
+ )}
19
+ {...props}
20
+ >
21
+ <CheckboxPrimitive.Indicator
22
+ className={cn("flex items-center justify-center text-current")}
23
+ >
24
+ <Check className="h-4 w-4" />
25
+ </CheckboxPrimitive.Indicator>
26
+ </CheckboxPrimitive.Root>
27
+ ));
28
+ Checkbox.displayName = CheckboxPrimitive.Root.displayName;
29
+
30
+ export { Checkbox };
@@ -90,6 +90,7 @@ const Input = React.forwardRef<HTMLInputElement, IInputProps>(
90
90
  )}
91
91
  {!!internalValue && clearable && (
92
92
  <Button
93
+ type="button"
93
94
  variant="ghost"
94
95
  size="icon"
95
96
  className="absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent"
@@ -0,0 +1,22 @@
1
+ import * as React from "react";
2
+
3
+ import { cn } from "../../utils/utils";
4
+
5
+ const Textarea = React.forwardRef<
6
+ HTMLTextAreaElement,
7
+ React.ComponentProps<"textarea">
8
+ >(({ className, ...props }, ref) => {
9
+ return (
10
+ <textarea
11
+ className={cn(
12
+ "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-ring 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-50 md:text-sm",
13
+ className
14
+ )}
15
+ ref={ref}
16
+ {...props}
17
+ />
18
+ );
19
+ });
20
+ Textarea.displayName = "Textarea";
21
+
22
+ export { Textarea };
package/lib/main.ts CHANGED
@@ -59,6 +59,8 @@ export * from "./components/ui/Combobox.tsx";
59
59
  export * from "./components/ui/select.tsx";
60
60
  export * from "./components/ui/tooltip.tsx";
61
61
  export * from "./components/ui/separator.tsx";
62
+ export * from "./components/ui/textarea.tsx";
63
+ export * from "./components/ui/checkbox.tsx";
62
64
  export { Button as ButtonCN, buttonVariants } from "./components/ui/button.tsx";
63
65
 
64
66
 
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@addsign/moje-agenda-shared-lib",
3
3
  "private": false,
4
- "version": "2.0.3",
4
+ "version": "2.0.5",
5
5
  "type": "module",
6
6
  "main": "dist/main.js",
7
7
  "types": "dist/main.d.ts",
8
8
  "files": [
9
9
  "dist",
10
- "lib"
10
+ "lib",
11
+ "tailwind.config.js"
11
12
  ],
12
13
  "sideEffects": [
13
14
  "**/*.css"
@@ -63,6 +64,7 @@
63
64
  "dependencies": {
64
65
  "@addsign/moje-agenda-shared-lib": "file:",
65
66
  "@hookform/resolvers": "^3.9.1",
67
+ "@radix-ui/react-checkbox": "^1.1.2",
66
68
  "@radix-ui/react-dialog": "^1.1.2",
67
69
  "@radix-ui/react-label": "^2.1.0",
68
70
  "@radix-ui/react-popover": "^1.1.2",
@@ -0,0 +1,97 @@
1
+
2
+ /** @type {import('tailwindcss').Config.theme.extend} */
3
+ export const TAILWIND_THEME_EXTEND = {
4
+ colors: {
5
+ border: "var(--border)",
6
+ input: "var(--input)",
7
+ ring: "var(--ring)",
8
+ background: "var(--background)",
9
+ foreground: "var(--foreground)",
10
+
11
+ // Using modern `rgb`
12
+ primary: {
13
+ DEFAULT: "var(--color-primary)",
14
+ hover: "var(--color-primary-hover)",
15
+ text: "var(--color-primary-text)",
16
+ foreground: "var(--color-primary-text)",
17
+ border: "var(--color-primary-border)",
18
+ },
19
+ secondary: {
20
+ DEFAULT: "var(--color-secondary)",
21
+ hover: "var(--color-secondary-hover)",
22
+ text: "var(--color-secondary-text)",
23
+ foreground: "var(--secondary-foreground)",
24
+ border: "var(--color-secondary-border)",
25
+ },
26
+ danger: {
27
+ DEFAULT: "var(--color-danger)",
28
+ hover: "var(--color-danger-hover)",
29
+ text: "var(--color-danger-text)",
30
+ border: "var(--color-danger-border)",
31
+ },
32
+ destructive: {
33
+ DEFAULT: "var(--destructive)",
34
+ foreground: "var(--destructive-foreground)",
35
+ },
36
+ warning: {
37
+ DEFAULT: "var(--color-warning)",
38
+ hover: "var(--color-warning-hover)",
39
+ text: "var(--color-warning-text)",
40
+ border: "var(--color-warning-border)",
41
+ },
42
+ success: {
43
+ DEFAULT: "var(--color-success)",
44
+ hover: "var(--color-success-hover)",
45
+ text: "var(--color-success-text)",
46
+ border: "var(--color-success-border)",
47
+ },
48
+
49
+ gray: {
50
+ 150: "rgb(238, 240, 243)",
51
+ },
52
+
53
+ muted: {
54
+ DEFAULT: "var(--muted)",
55
+ foreground: "var(--muted-foreground)",
56
+ },
57
+ accent: {
58
+ DEFAULT: "var(--accent)",
59
+ foreground: "var(--accent-foreground)",
60
+ },
61
+ popover: {
62
+ DEFAULT: "var(--popover)",
63
+ foreground: "var(--popover-foreground)",
64
+ },
65
+ card: {
66
+ DEFAULT: "var(--card)",
67
+ foreground: "var(--card-foreground)",
68
+ },
69
+ },
70
+
71
+ animation: {
72
+ spin: 'spin 2s linear infinite',
73
+ },
74
+ }
75
+
76
+ /** @type {import('tailwindcss').Config} */
77
+ export default {
78
+ darkMode: "class",
79
+ important: false, // Ensures all classes use !important
80
+
81
+ content: [
82
+ "./lib/**/*.{js,ts,jsx,tsx}",
83
+ "./lib/**/*.{ts,tsx}",
84
+ "./lib/components/**/*.{ts,tsx}",
85
+ "./node_modules/react-tailwindcss-datepicker/dist/index.esm.js",
86
+ ],
87
+ theme: {
88
+ extend: TAILWIND_THEME_EXTEND,
89
+ },
90
+ plugins: [],
91
+ safelist: [
92
+ "bg-danger", // Add any other dynamic classes here
93
+ "lg:grid-cols-3",
94
+ "lg:grid-cols-2",
95
+ "lg:grid-cols-4",
96
+ ],
97
+ };