@helpwave/hightide 0.1.7 → 0.1.9

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 (263) hide show
  1. package/dist/components/branding/HelpwaveBadge.js +30 -8
  2. package/dist/components/branding/HelpwaveBadge.js.map +1 -1
  3. package/dist/components/branding/HelpwaveBadge.mjs +30 -8
  4. package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
  5. package/dist/components/date/DatePicker.d.mts +3 -4
  6. package/dist/components/date/DatePicker.d.ts +3 -4
  7. package/dist/components/date/DatePicker.js +135 -33
  8. package/dist/components/date/DatePicker.js.map +1 -1
  9. package/dist/components/date/DatePicker.mjs +135 -33
  10. package/dist/components/date/DatePicker.mjs.map +1 -1
  11. package/dist/components/date/DayPicker.d.mts +1 -1
  12. package/dist/components/date/DayPicker.d.ts +1 -1
  13. package/dist/components/date/DayPicker.js +23 -11
  14. package/dist/components/date/DayPicker.js.map +1 -1
  15. package/dist/components/date/DayPicker.mjs +23 -11
  16. package/dist/components/date/DayPicker.mjs.map +1 -1
  17. package/dist/components/date/TimeDisplay.d.mts +5 -19
  18. package/dist/components/date/TimeDisplay.d.ts +5 -19
  19. package/dist/components/date/TimeDisplay.js +121 -37
  20. package/dist/components/date/TimeDisplay.js.map +1 -1
  21. package/dist/components/date/TimeDisplay.mjs +121 -37
  22. package/dist/components/date/TimeDisplay.mjs.map +1 -1
  23. package/dist/components/date/YearMonthPicker.js +106 -22
  24. package/dist/components/date/YearMonthPicker.js.map +1 -1
  25. package/dist/components/date/YearMonthPicker.mjs +106 -22
  26. package/dist/components/date/YearMonthPicker.mjs.map +1 -1
  27. package/dist/components/dialogs/ConfirmDialog.d.mts +2 -5
  28. package/dist/components/dialogs/ConfirmDialog.d.ts +2 -5
  29. package/dist/components/dialogs/ConfirmDialog.js +157 -25
  30. package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
  31. package/dist/components/dialogs/ConfirmDialog.mjs +157 -25
  32. package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
  33. package/dist/components/icons-and-geometry/Avatar.js +2 -2
  34. package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
  35. package/dist/components/icons-and-geometry/Avatar.mjs +2 -2
  36. package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
  37. package/dist/components/layout-and-navigation/Carousel.d.mts +1 -1
  38. package/dist/components/layout-and-navigation/Carousel.d.ts +1 -1
  39. package/dist/components/layout-and-navigation/Carousel.js +86 -28
  40. package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
  41. package/dist/components/layout-and-navigation/Carousel.mjs +86 -28
  42. package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
  43. package/dist/components/layout-and-navigation/Expandable.d.mts +3 -0
  44. package/dist/components/layout-and-navigation/Expandable.d.ts +3 -0
  45. package/dist/components/layout-and-navigation/Expandable.js +4 -3
  46. package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
  47. package/dist/components/layout-and-navigation/Expandable.mjs +4 -3
  48. package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
  49. package/dist/components/layout-and-navigation/FAQSection.js +4 -3
  50. package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
  51. package/dist/components/layout-and-navigation/FAQSection.mjs +4 -3
  52. package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
  53. package/dist/components/layout-and-navigation/Overlay.d.mts +2 -3
  54. package/dist/components/layout-and-navigation/Overlay.d.ts +2 -3
  55. package/dist/components/layout-and-navigation/Overlay.js +152 -12
  56. package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
  57. package/dist/components/layout-and-navigation/Overlay.mjs +152 -12
  58. package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
  59. package/dist/components/layout-and-navigation/Pagination.d.mts +2 -3
  60. package/dist/components/layout-and-navigation/Pagination.d.ts +2 -3
  61. package/dist/components/layout-and-navigation/Pagination.js +145 -13
  62. package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
  63. package/dist/components/layout-and-navigation/Pagination.mjs +145 -13
  64. package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
  65. package/dist/components/layout-and-navigation/SearchableList.d.mts +10 -8
  66. package/dist/components/layout-and-navigation/SearchableList.d.ts +10 -8
  67. package/dist/components/layout-and-navigation/SearchableList.js +261 -30
  68. package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
  69. package/dist/components/layout-and-navigation/SearchableList.mjs +261 -30
  70. package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
  71. package/dist/components/layout-and-navigation/StepperBar.d.mts +2 -5
  72. package/dist/components/layout-and-navigation/StepperBar.d.ts +2 -5
  73. package/dist/components/layout-and-navigation/StepperBar.js +149 -19
  74. package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
  75. package/dist/components/layout-and-navigation/StepperBar.mjs +149 -19
  76. package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
  77. package/dist/components/layout-and-navigation/Table.js +146 -14
  78. package/dist/components/layout-and-navigation/Table.js.map +1 -1
  79. package/dist/components/layout-and-navigation/Table.mjs +146 -14
  80. package/dist/components/layout-and-navigation/Table.mjs.map +1 -1
  81. package/dist/components/layout-and-navigation/TextImage.d.mts +3 -4
  82. package/dist/components/layout-and-navigation/TextImage.d.ts +3 -4
  83. package/dist/components/layout-and-navigation/TextImage.js +153 -19
  84. package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
  85. package/dist/components/layout-and-navigation/TextImage.mjs +153 -19
  86. package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
  87. package/dist/components/layout-and-navigation/Tile.d.mts +10 -15
  88. package/dist/components/layout-and-navigation/Tile.d.ts +10 -15
  89. package/dist/components/layout-and-navigation/Tile.js +30 -8
  90. package/dist/components/layout-and-navigation/Tile.js.map +1 -1
  91. package/dist/components/layout-and-navigation/Tile.mjs +30 -8
  92. package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
  93. package/dist/components/loading-states/ErrorComponent.js +48 -8
  94. package/dist/components/loading-states/ErrorComponent.js.map +1 -1
  95. package/dist/components/loading-states/ErrorComponent.mjs +48 -8
  96. package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
  97. package/dist/components/loading-states/LoadingAndErrorComponent.d.mts +1 -0
  98. package/dist/components/loading-states/LoadingAndErrorComponent.d.ts +1 -0
  99. package/dist/components/loading-states/LoadingAndErrorComponent.js +147 -15
  100. package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
  101. package/dist/components/loading-states/LoadingAndErrorComponent.mjs +147 -15
  102. package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
  103. package/dist/components/loading-states/LoadingAnimation.d.mts +2 -3
  104. package/dist/components/loading-states/LoadingAnimation.d.ts +2 -3
  105. package/dist/components/loading-states/LoadingAnimation.js +145 -13
  106. package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
  107. package/dist/components/loading-states/LoadingAnimation.mjs +145 -13
  108. package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
  109. package/dist/components/loading-states/ProgressIndicator.js +2 -2
  110. package/dist/components/loading-states/ProgressIndicator.js.map +1 -1
  111. package/dist/components/loading-states/ProgressIndicator.mjs +2 -2
  112. package/dist/components/loading-states/ProgressIndicator.mjs.map +1 -1
  113. package/dist/components/modals/ConfirmModal.d.mts +2 -5
  114. package/dist/components/modals/ConfirmModal.d.ts +2 -5
  115. package/dist/components/modals/ConfirmModal.js +158 -28
  116. package/dist/components/modals/ConfirmModal.js.map +1 -1
  117. package/dist/components/modals/ConfirmModal.mjs +158 -28
  118. package/dist/components/modals/ConfirmModal.mjs.map +1 -1
  119. package/dist/components/modals/DiscardChangesModal.d.mts +2 -7
  120. package/dist/components/modals/DiscardChangesModal.d.ts +2 -7
  121. package/dist/components/modals/DiscardChangesModal.js +162 -48
  122. package/dist/components/modals/DiscardChangesModal.js.map +1 -1
  123. package/dist/components/modals/DiscardChangesModal.mjs +162 -48
  124. package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
  125. package/dist/components/modals/InputModal.d.mts +1 -0
  126. package/dist/components/modals/InputModal.d.ts +1 -0
  127. package/dist/components/modals/InputModal.js +158 -28
  128. package/dist/components/modals/InputModal.js.map +1 -1
  129. package/dist/components/modals/InputModal.mjs +158 -28
  130. package/dist/components/modals/InputModal.mjs.map +1 -1
  131. package/dist/components/modals/LanguageModal.d.mts +3 -2
  132. package/dist/components/modals/LanguageModal.d.ts +3 -2
  133. package/dist/components/modals/LanguageModal.js +538 -166
  134. package/dist/components/modals/LanguageModal.js.map +1 -1
  135. package/dist/components/modals/LanguageModal.mjs +537 -165
  136. package/dist/components/modals/LanguageModal.mjs.map +1 -1
  137. package/dist/components/modals/ThemeModal.d.mts +5 -5
  138. package/dist/components/modals/ThemeModal.d.ts +5 -5
  139. package/dist/components/modals/ThemeModal.js +547 -176
  140. package/dist/components/modals/ThemeModal.js.map +1 -1
  141. package/dist/components/modals/ThemeModal.mjs +544 -173
  142. package/dist/components/modals/ThemeModal.mjs.map +1 -1
  143. package/dist/components/properties/CheckboxProperty.d.mts +3 -5
  144. package/dist/components/properties/CheckboxProperty.d.ts +3 -5
  145. package/dist/components/properties/CheckboxProperty.js +148 -26
  146. package/dist/components/properties/CheckboxProperty.js.map +1 -1
  147. package/dist/components/properties/CheckboxProperty.mjs +148 -26
  148. package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
  149. package/dist/components/properties/DateProperty.d.mts +1 -0
  150. package/dist/components/properties/DateProperty.d.ts +1 -0
  151. package/dist/components/properties/DateProperty.js +146 -14
  152. package/dist/components/properties/DateProperty.js.map +1 -1
  153. package/dist/components/properties/DateProperty.mjs +146 -14
  154. package/dist/components/properties/DateProperty.mjs.map +1 -1
  155. package/dist/components/properties/MultiSelectProperty.d.mts +5 -5
  156. package/dist/components/properties/MultiSelectProperty.d.ts +5 -5
  157. package/dist/components/properties/MultiSelectProperty.js +626 -456
  158. package/dist/components/properties/MultiSelectProperty.js.map +1 -1
  159. package/dist/components/properties/MultiSelectProperty.mjs +622 -452
  160. package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
  161. package/dist/components/properties/NumberProperty.d.mts +1 -0
  162. package/dist/components/properties/NumberProperty.d.ts +1 -0
  163. package/dist/components/properties/NumberProperty.js +148 -16
  164. package/dist/components/properties/NumberProperty.js.map +1 -1
  165. package/dist/components/properties/NumberProperty.mjs +148 -16
  166. package/dist/components/properties/NumberProperty.mjs.map +1 -1
  167. package/dist/components/properties/PropertyBase.d.mts +2 -3
  168. package/dist/components/properties/PropertyBase.d.ts +2 -3
  169. package/dist/components/properties/PropertyBase.js +146 -14
  170. package/dist/components/properties/PropertyBase.js.map +1 -1
  171. package/dist/components/properties/PropertyBase.mjs +146 -14
  172. package/dist/components/properties/PropertyBase.mjs.map +1 -1
  173. package/dist/components/properties/SelectProperty.d.mts +5 -6
  174. package/dist/components/properties/SelectProperty.d.ts +5 -6
  175. package/dist/components/properties/SelectProperty.js +542 -279
  176. package/dist/components/properties/SelectProperty.js.map +1 -1
  177. package/dist/components/properties/SelectProperty.mjs +542 -279
  178. package/dist/components/properties/SelectProperty.mjs.map +1 -1
  179. package/dist/components/properties/TextProperty.d.mts +2 -1
  180. package/dist/components/properties/TextProperty.d.ts +2 -1
  181. package/dist/components/properties/TextProperty.js +150 -18
  182. package/dist/components/properties/TextProperty.js.map +1 -1
  183. package/dist/components/properties/TextProperty.mjs +150 -18
  184. package/dist/components/properties/TextProperty.mjs.map +1 -1
  185. package/dist/components/user-action/DateAndTimePicker.d.mts +4 -20
  186. package/dist/components/user-action/DateAndTimePicker.d.ts +4 -20
  187. package/dist/components/user-action/DateAndTimePicker.js +233 -71
  188. package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
  189. package/dist/components/user-action/DateAndTimePicker.mjs +233 -71
  190. package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
  191. package/dist/components/user-action/Menu.d.mts +14 -8
  192. package/dist/components/user-action/Menu.d.ts +14 -8
  193. package/dist/components/user-action/Menu.js +32 -11
  194. package/dist/components/user-action/Menu.js.map +1 -1
  195. package/dist/components/user-action/Menu.mjs +32 -11
  196. package/dist/components/user-action/Menu.mjs.map +1 -1
  197. package/dist/components/user-action/MultiSelect.d.mts +13 -23
  198. package/dist/components/user-action/MultiSelect.d.ts +13 -23
  199. package/dist/components/user-action/MultiSelect.js +632 -325
  200. package/dist/components/user-action/MultiSelect.js.map +1 -1
  201. package/dist/components/user-action/MultiSelect.mjs +629 -323
  202. package/dist/components/user-action/MultiSelect.mjs.map +1 -1
  203. package/dist/components/user-action/Select.d.mts +5 -18
  204. package/dist/components/user-action/Select.d.ts +5 -18
  205. package/dist/components/user-action/Select.js +447 -113
  206. package/dist/components/user-action/Select.js.map +1 -1
  207. package/dist/components/user-action/Select.mjs +442 -107
  208. package/dist/components/user-action/Select.mjs.map +1 -1
  209. package/dist/components/user-action/Tooltip.js +2 -2
  210. package/dist/components/user-action/Tooltip.js.map +1 -1
  211. package/dist/components/user-action/Tooltip.mjs +2 -2
  212. package/dist/components/user-action/Tooltip.mjs.map +1 -1
  213. package/dist/css/globals.css +224 -207
  214. package/dist/css/uncompiled/globals.css +138 -74
  215. package/dist/hooks/useSearch.d.mts +17 -0
  216. package/dist/hooks/useSearch.d.ts +17 -0
  217. package/dist/hooks/useSearch.js +66 -0
  218. package/dist/hooks/useSearch.js.map +1 -0
  219. package/dist/hooks/useSearch.mjs +42 -0
  220. package/dist/hooks/useSearch.mjs.map +1 -0
  221. package/dist/index.d.mts +10 -6
  222. package/dist/index.d.ts +10 -6
  223. package/dist/index.js +882 -758
  224. package/dist/index.js.map +1 -1
  225. package/dist/index.mjs +836 -717
  226. package/dist/index.mjs.map +1 -1
  227. package/dist/localization/defaults/form.d.mts +54 -0
  228. package/dist/localization/defaults/form.d.ts +54 -0
  229. package/dist/localization/defaults/form.js +127 -0
  230. package/dist/localization/defaults/form.js.map +1 -0
  231. package/dist/localization/defaults/form.mjs +103 -0
  232. package/dist/localization/defaults/form.mjs.map +1 -0
  233. package/dist/localization/defaults/time.d.mts +39 -0
  234. package/dist/localization/defaults/time.d.ts +39 -0
  235. package/dist/localization/defaults/time.js +101 -0
  236. package/dist/localization/defaults/time.js.map +1 -0
  237. package/dist/localization/defaults/time.mjs +76 -0
  238. package/dist/localization/defaults/time.mjs.map +1 -0
  239. package/dist/localization/useTranslation.d.mts +30 -6
  240. package/dist/localization/useTranslation.d.ts +30 -6
  241. package/dist/localization/useTranslation.js +46 -6
  242. package/dist/localization/useTranslation.js.map +1 -1
  243. package/dist/localization/useTranslation.mjs +46 -6
  244. package/dist/localization/useTranslation.mjs.map +1 -1
  245. package/dist/theming/useTheme.d.mts +4 -2
  246. package/dist/theming/useTheme.d.ts +4 -2
  247. package/dist/theming/useTheme.js +10 -2
  248. package/dist/theming/useTheme.js.map +1 -1
  249. package/dist/theming/useTheme.mjs +10 -2
  250. package/dist/theming/useTheme.mjs.map +1 -1
  251. package/dist/util/PropsWithFunctionChildren.d.mts +14 -0
  252. package/dist/util/PropsWithFunctionChildren.d.ts +14 -0
  253. package/dist/util/PropsWithFunctionChildren.js +38 -0
  254. package/dist/util/PropsWithFunctionChildren.js.map +1 -0
  255. package/dist/util/PropsWithFunctionChildren.mjs +14 -0
  256. package/dist/util/PropsWithFunctionChildren.mjs.map +1 -0
  257. package/dist/util/simpleSearch.d.mts +2 -2
  258. package/dist/util/simpleSearch.d.ts +2 -2
  259. package/dist/util/simpleSearch.js +4 -1
  260. package/dist/util/simpleSearch.js.map +1 -1
  261. package/dist/util/simpleSearch.mjs +4 -1
  262. package/dist/util/simpleSearch.mjs.map +1 -1
  263. package/package.json +1 -2
@@ -26,22 +26,61 @@ var LanguageContext = createContext({
26
26
  var useLanguage = () => useContext(LanguageContext);
27
27
 
28
28
  // src/localization/useTranslation.ts
29
- var useTranslation = (defaults, translationOverwrite = {}) => {
30
- const { language: languageProp, translation: overwrite } = translationOverwrite;
29
+ var useTranslation = (translations, overwriteTranslation = {}) => {
30
+ const { language: languageProp, translation: overwrite } = overwriteTranslation;
31
31
  const { language: inferredLanguage } = useLanguage();
32
32
  const usedLanguage = languageProp ?? inferredLanguage;
33
- let defaultValues = defaults[usedLanguage];
34
- if (overwrite && overwrite[usedLanguage]) {
35
- defaultValues = { ...defaultValues, ...overwrite[usedLanguage] };
33
+ const usedTranslations = [...translations];
34
+ if (overwrite) {
35
+ usedTranslations.push(overwrite);
36
36
  }
37
- return defaultValues;
37
+ return (key, options) => {
38
+ const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
39
+ try {
40
+ for (let i = translations.length - 1; i >= 0; i--) {
41
+ const translation = translations[i];
42
+ const localizedTranslation = translation[usedLanguage];
43
+ if (!localizedTranslation) {
44
+ continue;
45
+ }
46
+ const value = localizedTranslation[key];
47
+ if (!value) {
48
+ continue;
49
+ }
50
+ let forProcessing;
51
+ if (typeof value !== "string") {
52
+ if (count <= 0 && value?.zero) {
53
+ forProcessing = value.zero;
54
+ } else if (count === 1 && value?.one) {
55
+ forProcessing = value.one;
56
+ } else if (count === 2 && value?.two) {
57
+ forProcessing = value.two;
58
+ } else if (count <= 10 && value?.few) {
59
+ forProcessing = value.few;
60
+ } else if (count > 10 && value?.many) {
61
+ forProcessing = value.many;
62
+ } else {
63
+ forProcessing = value.other;
64
+ }
65
+ } else {
66
+ forProcessing = value;
67
+ }
68
+ forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
69
+ return replacements[placeholder] ?? `{{${placeholder}}}`;
70
+ });
71
+ return forProcessing;
72
+ }
73
+ } catch (e) {
74
+ console.error(e);
75
+ }
76
+ return `{{${usedLanguage}:${key}}}`;
77
+ };
38
78
  };
39
79
 
40
80
  // src/components/user-action/Select.tsx
41
- import { Menu } from "@headlessui/react";
42
- import { ChevronDown, ChevronUp, Search } from "lucide-react";
43
- import { useEffect as useEffect5, useState as useState5 } from "react";
44
- import clsx3 from "clsx";
81
+ import { ChevronDown, ChevronUp } from "lucide-react";
82
+ import { useEffect as useEffect7, useRef as useRef2, useState as useState6 } from "react";
83
+ import clsx6 from "clsx";
45
84
 
46
85
  // src/components/user-action/Label.tsx
47
86
  import clsx from "clsx";
@@ -61,18 +100,119 @@ var Label = ({
61
100
  return /* @__PURE__ */ jsx2("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
62
101
  };
63
102
 
103
+ // src/components/layout-and-navigation/SearchableList.tsx
104
+ import { Search } from "lucide-react";
105
+ import clsx4 from "clsx";
106
+
64
107
  // src/components/user-action/Input.tsx
65
108
  import { forwardRef, useEffect as useEffect4, useRef, useState as useState4 } from "react";
66
109
  import clsx2 from "clsx";
67
110
 
68
111
  // src/hooks/useSaveDelay.ts
69
112
  import { useEffect as useEffect3, useState as useState3 } from "react";
113
+ function useSaveDelay(setNotificationStatus, delay) {
114
+ const [updateTimer, setUpdateTimer] = useState3(void 0);
115
+ const [notificationTimer, setNotificationTimer] = useState3(void 0);
116
+ const restartTimer = (onSave) => {
117
+ clearTimeout(updateTimer);
118
+ setUpdateTimer(setTimeout(() => {
119
+ onSave();
120
+ setNotificationStatus(true);
121
+ clearTimeout(notificationTimer);
122
+ setNotificationTimer(setTimeout(() => {
123
+ setNotificationStatus(false);
124
+ clearTimeout(notificationTimer);
125
+ }, delay));
126
+ clearTimeout(updateTimer);
127
+ }, delay));
128
+ };
129
+ const clearUpdateTimer = (hasSaved = true) => {
130
+ clearTimeout(updateTimer);
131
+ if (hasSaved) {
132
+ setNotificationStatus(true);
133
+ clearTimeout(notificationTimer);
134
+ setNotificationTimer(setTimeout(() => {
135
+ setNotificationStatus(false);
136
+ clearTimeout(notificationTimer);
137
+ }, delay));
138
+ } else {
139
+ setNotificationStatus(false);
140
+ }
141
+ };
142
+ useEffect3(() => {
143
+ return () => {
144
+ clearTimeout(updateTimer);
145
+ clearTimeout(notificationTimer);
146
+ };
147
+ }, []);
148
+ return { restartTimer, clearUpdateTimer };
149
+ }
70
150
 
71
151
  // src/util/noop.ts
72
152
  var noop = () => void 0;
73
153
 
74
154
  // src/components/user-action/Input.tsx
75
155
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
156
+ var Input = ({
157
+ id,
158
+ type = "text",
159
+ value,
160
+ label,
161
+ onChange = noop,
162
+ onChangeText = noop,
163
+ onEditCompleted,
164
+ className = "",
165
+ expanded = true,
166
+ autoFocus,
167
+ onBlur,
168
+ containerClassName,
169
+ ...restProps
170
+ }) => {
171
+ const {
172
+ restartTimer,
173
+ clearUpdateTimer
174
+ } = useSaveDelay(() => void 0, 3e3);
175
+ const ref = useRef(null);
176
+ useEffect4(() => {
177
+ if (autoFocus) {
178
+ ref.current?.focus();
179
+ }
180
+ }, [autoFocus]);
181
+ return /* @__PURE__ */ jsxs("div", { className: clsx2({ "w-full": expanded }, containerClassName), children: [
182
+ label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx2("mb-1", label.className) }),
183
+ /* @__PURE__ */ jsx3(
184
+ "input",
185
+ {
186
+ ref,
187
+ value,
188
+ id,
189
+ type,
190
+ className,
191
+ onBlur: (event) => {
192
+ if (onBlur) {
193
+ onBlur(event);
194
+ }
195
+ if (onEditCompleted) {
196
+ onEditCompleted(event.target.value);
197
+ clearUpdateTimer();
198
+ }
199
+ },
200
+ onChange: (e) => {
201
+ const value2 = e.target.value;
202
+ if (onEditCompleted) {
203
+ restartTimer(() => {
204
+ onEditCompleted(value2);
205
+ clearUpdateTimer();
206
+ });
207
+ }
208
+ onChange(e);
209
+ onChangeText(value2);
210
+ },
211
+ ...restProps
212
+ }
213
+ )
214
+ ] });
215
+ };
76
216
  var FormInput = forwardRef(function FormInput2({
77
217
  id,
78
218
  labelText,
@@ -109,102 +249,9 @@ var FormInput = forwardRef(function FormInput2({
109
249
  ] });
110
250
  });
111
251
 
112
- // src/components/user-action/Select.tsx
113
- import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
114
- var Select = ({
115
- value,
116
- label,
117
- options,
118
- onChange,
119
- isHidingCurrentValue = true,
120
- hintText = "",
121
- showDisabledOptions = true,
122
- isDisabled,
123
- className,
124
- textColor = "text-menu-text",
125
- additionalItems,
126
- selectedDisplayOverwrite
127
- }) => {
128
- let filteredOptions = isHidingCurrentValue ? options.filter((option) => option.value !== value) : options;
129
- if (!showDisabledOptions) {
130
- filteredOptions = filteredOptions.filter((value2) => !value2.disabled);
131
- }
132
- const selectedOption = options.find((option) => option.value === value);
133
- if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
134
- console.warn("The selected value is not found in the options list. This might be an error on your part or default behavior if it is complex data type on which === does not work. In case of the latter use selectedDisplayOverwrite to set your selected text or component");
135
- }
136
- const borderColor = "border-menu-border";
137
- return /* @__PURE__ */ jsxs2("div", { className: clsx3(className), children: [
138
- label && /* @__PURE__ */ jsx4(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx3("mb-1", label.className) }),
139
- /* @__PURE__ */ jsx4(Menu, { as: "div", className: "relative text-menu-text", children: ({ open }) => /* @__PURE__ */ jsxs2(Fragment, { children: [
140
- /* @__PURE__ */ jsxs2(
141
- Menu.Button,
142
- {
143
- className: clsx3(
144
- "inline-flex w-full justify-between items-center rounded-t-lg border-2 px-4 py-2 font-medium bg-menu-background text-menu-text",
145
- textColor,
146
- borderColor,
147
- {
148
- "rounded-b-lg": !open,
149
- "hover:border-primary": !isDisabled,
150
- "bg-disabled-background cursor-not-allowed text-disabled": isDisabled
151
- }
152
- ),
153
- disabled: isDisabled,
154
- children: [
155
- /* @__PURE__ */ jsx4("span", { children: selectedDisplayOverwrite ?? selectedOption?.label ?? hintText }),
156
- open ? /* @__PURE__ */ jsx4(ChevronUp, {}) : /* @__PURE__ */ jsx4(ChevronDown, {})
157
- ]
158
- }
159
- ),
160
- /* @__PURE__ */ jsxs2(
161
- Menu.Items,
162
- {
163
- className: "absolute w-full z-10 rounded-b-lg bg-menu-background text-menu-text shadow-lg max-h-[500px] overflow-y-auto",
164
- children: [
165
- (additionalItems ?? []).map((item, index) => /* @__PURE__ */ jsx4(
166
- "div",
167
- {
168
- className: clsx3(borderColor, "px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0", {
169
- "border-b-0 rounded-b-lg": filteredOptions.length === 0 && index === (additionalItems?.length ?? 1) - 1
170
- }),
171
- children: item
172
- },
173
- `additionalItems${index}`
174
- )),
175
- filteredOptions.map((option, index) => /* @__PURE__ */ jsx4(Menu.Item, { children: /* @__PURE__ */ jsx4(
176
- "div",
177
- {
178
- className: clsx3(
179
- "px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0 cursor-pointer",
180
- option.className,
181
- borderColor,
182
- {
183
- "brightness-90": option.value === value,
184
- "brightness-95": index % 2 === 1,
185
- "text-disabled bg-disabled-background cursor-not-allowed": !!option.disabled,
186
- "bg-menu-background text-menu-text hover:brightness-90 cursor-pointer": !option.disabled,
187
- "rounded-b-lg": index === filteredOptions.length - 1
188
- }
189
- ),
190
- onClick: () => {
191
- if (!option.disabled) {
192
- onChange(option.value);
193
- }
194
- },
195
- children: option.label
196
- }
197
- ) }, `item${index}`))
198
- ]
199
- }
200
- )
201
- ] }) })
202
- ] });
203
- };
204
-
205
252
  // src/components/user-action/Button.tsx
206
- import clsx4 from "clsx";
207
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
253
+ import clsx3 from "clsx";
254
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
208
255
  var paddingMapping = {
209
256
  small: "btn-sm",
210
257
  medium: "btn-md",
@@ -248,25 +295,25 @@ var SolidButton = ({
248
295
  negative: "text-button-solid-negative-icon",
249
296
  neutral: "text-button-solid-neutral-icon"
250
297
  }[color];
251
- return /* @__PURE__ */ jsxs3(
298
+ return /* @__PURE__ */ jsxs2(
252
299
  "button",
253
300
  {
254
301
  onClick: disabled ? void 0 : onClick,
255
302
  disabled: disabled || onClick === void 0,
256
- className: clsx4(
303
+ className: clsx3(
257
304
  {
258
305
  "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
259
- [clsx4(colorClasses, "hover:brightness-90")]: !disabled
306
+ [clsx3(colorClasses, "hover:brightness-90")]: !disabled
260
307
  },
261
308
  ButtonUtil.paddingMapping[size],
262
309
  className
263
310
  ),
264
311
  ...restProps,
265
312
  children: [
266
- startIcon && /* @__PURE__ */ jsx5(
313
+ startIcon && /* @__PURE__ */ jsx4(
267
314
  "span",
268
315
  {
269
- className: clsx4({
316
+ className: clsx3({
270
317
  [iconColorClasses]: !disabled,
271
318
  [`text-disabled-icon`]: disabled
272
319
  }),
@@ -274,10 +321,10 @@ var SolidButton = ({
274
321
  }
275
322
  ),
276
323
  children,
277
- endIcon && /* @__PURE__ */ jsx5(
324
+ endIcon && /* @__PURE__ */ jsx4(
278
325
  "span",
279
326
  {
280
- className: clsx4({
327
+ className: clsx3({
281
328
  [iconColorClasses]: !disabled,
282
329
  [`text-disabled-icon`]: disabled
283
330
  }),
@@ -306,15 +353,15 @@ var IconButton = ({
306
353
  negative: "bg-button-solid-negative-background text-button-solid-negative-text",
307
354
  neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
308
355
  }[color];
309
- return /* @__PURE__ */ jsx5(
356
+ return /* @__PURE__ */ jsx4(
310
357
  "button",
311
358
  {
312
359
  onClick: disabled ? void 0 : onClick,
313
360
  disabled: disabled || onClick === void 0,
314
- className: clsx4(
361
+ className: clsx3(
315
362
  {
316
363
  "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
317
- [clsx4(colorClasses, "hover:brightness-90")]: !disabled
364
+ [clsx3(colorClasses, "hover:brightness-90")]: !disabled
318
365
  },
319
366
  ButtonUtil.iconPaddingMapping[size],
320
367
  className
@@ -325,21 +372,343 @@ var IconButton = ({
325
372
  );
326
373
  };
327
374
 
375
+ // src/hooks/useSearch.ts
376
+ import { useEffect as useEffect5, useMemo, useState as useState5 } from "react";
377
+
378
+ // src/util/simpleSearch.ts
379
+ var MultiSearchWithMapping = (search, objects, mapping) => {
380
+ return objects.filter((object) => {
381
+ const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
382
+ if (!mappedSearchKeywords) {
383
+ return true;
384
+ }
385
+ return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
386
+ });
387
+ };
388
+
389
+ // src/hooks/useSearch.ts
390
+ var useSearch = ({
391
+ list,
392
+ initialSearch,
393
+ searchMapping
394
+ }) => {
395
+ const [items, setItems] = useState5(list);
396
+ const [search, setSearch] = useState5(initialSearch);
397
+ useEffect5(() => {
398
+ setItems(list);
399
+ }, [list]);
400
+ const result = useMemo(
401
+ () => MultiSearchWithMapping(search, items, searchMapping),
402
+ [search, items, searchMapping]
403
+ );
404
+ return {
405
+ result,
406
+ hasResult: result.length > 0,
407
+ allItems: items,
408
+ setItems,
409
+ search,
410
+ setSearch
411
+ };
412
+ };
413
+
414
+ // src/localization/defaults/form.ts
415
+ var formTranslation = {
416
+ en: {
417
+ all: "All",
418
+ back: "Back",
419
+ cancel: "Cancel",
420
+ change: "Change",
421
+ clear: "Clear",
422
+ close: "Close",
423
+ confirm: "Confirm",
424
+ decline: "Decline",
425
+ delete: "Delete",
426
+ discard: "Discard",
427
+ discardChanges: "Discard Changes",
428
+ done: "Done",
429
+ edit: "Edit",
430
+ enterText: "Enter text here",
431
+ error: "Error",
432
+ exit: "Exit",
433
+ fieldRequiredError: "This field is required.",
434
+ invalidEmailError: "Please enter a valid email address.",
435
+ less: "Less",
436
+ loading: "Loading",
437
+ maxLengthError: "Maximum length exceeded.",
438
+ minLengthError: "Minimum length not met.",
439
+ more: "More",
440
+ next: "Next",
441
+ no: "No",
442
+ none: "None",
443
+ of: "of",
444
+ optional: "Optional",
445
+ pleaseWait: "Please wait...",
446
+ previous: "Previous",
447
+ remove: "Remove",
448
+ required: "Required",
449
+ reset: "Reset",
450
+ save: "Save",
451
+ search: "Search",
452
+ select: "Select",
453
+ selectOption: "Select an option",
454
+ show: "Show",
455
+ showMore: "Show more",
456
+ showLess: "Show less",
457
+ submit: "Submit",
458
+ success: "Success",
459
+ update: "Update",
460
+ unsavedChanges: "Unsaved Changes",
461
+ unsavedChangesSaveQuestion: "Do you want to save your changes?",
462
+ yes: "Yes"
463
+ },
464
+ de: {
465
+ all: "Alle",
466
+ back: "Zur\xFCck",
467
+ cancel: "Abbrechen",
468
+ change: "\xC4ndern",
469
+ clear: "L\xF6schen",
470
+ close: "Schlie\xDFen",
471
+ confirm: "Best\xE4tigen",
472
+ decline: "Ablehnen",
473
+ delete: "L\xF6schen",
474
+ discard: "Verwerfen",
475
+ discardChanges: "\xC4nderungen Verwerfen",
476
+ done: "Fertig",
477
+ edit: "Bearbeiten",
478
+ enterText: "Text hier eingeben",
479
+ error: "Fehler",
480
+ exit: "Beenden",
481
+ fieldRequiredError: "Dieses Feld ist erforderlich.",
482
+ invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
483
+ less: "Weniger",
484
+ loading: "L\xE4dt",
485
+ maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
486
+ minLengthError: "Mindestl\xE4nge nicht erreicht.",
487
+ more: "Mehr",
488
+ next: "Weiter",
489
+ no: "Nein",
490
+ none: "Nichts",
491
+ of: "von",
492
+ optional: "Optional",
493
+ pleaseWait: "Bitte warten...",
494
+ previous: "Vorherige",
495
+ remove: "Entfernen",
496
+ required: "Erforderlich",
497
+ reset: "Zur\xFCcksetzen",
498
+ save: "Speichern",
499
+ search: "Suche",
500
+ select: "Select",
501
+ selectOption: "Option ausw\xE4hlen",
502
+ show: "Anzeigen",
503
+ showMore: "Mehr anzeigen",
504
+ showLess: "Weniger anzeigen",
505
+ submit: "Abschicken",
506
+ success: "Erfolg",
507
+ update: "Update",
508
+ unsavedChanges: "Ungespeicherte \xC4nderungen",
509
+ unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
510
+ yes: "Ja"
511
+ }
512
+ };
513
+
514
+ // src/components/layout-and-navigation/SearchableList.tsx
515
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
516
+ var defaultSearchableListTranslation = {
517
+ en: {
518
+ nothingFound: "Nothing found"
519
+ },
520
+ de: {
521
+ nothingFound: "Nichts gefunden"
522
+ }
523
+ };
524
+ var SearchableList = ({
525
+ overwriteTranslation,
526
+ list,
527
+ initialSearch = "",
528
+ searchMapping,
529
+ autoFocus,
530
+ minimumItemsForSearch = 6,
531
+ itemMapper,
532
+ className,
533
+ resultListClassName
534
+ }) => {
535
+ const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
536
+ const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
537
+ return /* @__PURE__ */ jsxs3("div", { className: clsx4("col gap-y-2", className), children: [
538
+ list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs3("div", { className: "row justify-between gap-x-4 items-center", children: [
539
+ /* @__PURE__ */ jsx5(
540
+ Input,
541
+ {
542
+ value: search,
543
+ onChangeText: setSearch,
544
+ placeholder: translation("search"),
545
+ autoFocus,
546
+ className: "w-full"
547
+ }
548
+ ),
549
+ /* @__PURE__ */ jsx5(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx5(Search, { className: "w-full h-full" }) })
550
+ ] }),
551
+ hasResult ? /* @__PURE__ */ jsx5("div", { className: clsx4("col gap-y-1", resultListClassName), children: result.map(itemMapper) }) : /* @__PURE__ */ jsx5("div", { className: "row text-description py-2 px-2", children: translation("nothingFound") })
552
+ ] });
553
+ };
554
+
555
+ // src/components/layout-and-navigation/Tile.tsx
556
+ import clsx5 from "clsx";
557
+ import { Check } from "lucide-react";
558
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
559
+ var Tile = ({
560
+ title,
561
+ description,
562
+ onClick,
563
+ isSelected = false,
564
+ isDisabled = false,
565
+ prefix,
566
+ suffix,
567
+ normalClassName = "hover:bg-primary/40 cursor-pointer",
568
+ selectedClassName = " bg-primary/20",
569
+ disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
570
+ className
571
+ }) => {
572
+ return /* @__PURE__ */ jsxs4(
573
+ "div",
574
+ {
575
+ className: clsx5(
576
+ "row gap-x-2 w-full items-center",
577
+ {
578
+ [normalClassName]: !!onClick && !isDisabled,
579
+ [selectedClassName]: isSelected && !isDisabled,
580
+ [disabledClassName]: isDisabled
581
+ },
582
+ className
583
+ ),
584
+ onClick: isDisabled ? void 0 : onClick,
585
+ children: [
586
+ prefix ?? (isSelected ? /* @__PURE__ */ jsx6(Check, { size: 24 }) : void 0),
587
+ /* @__PURE__ */ jsxs4("div", { className: "col gap-y-0 w-full", children: [
588
+ /* @__PURE__ */ jsx6("h4", { className: clsx5(title.className ?? "textstyle-title-normal"), children: title.value }),
589
+ !!description && /* @__PURE__ */ jsx6("span", { className: clsx5(description.className ?? "textstyle-description"), children: description.value })
590
+ ] }),
591
+ suffix
592
+ ]
593
+ }
594
+ );
595
+ };
596
+
597
+ // src/hooks/useOutsideClick.ts
598
+ import { useEffect as useEffect6 } from "react";
599
+ var useOutsideClick = (refs, handler) => {
600
+ useEffect6(() => {
601
+ const listener = (event) => {
602
+ if (event.target === null) return;
603
+ if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
604
+ return;
605
+ }
606
+ handler();
607
+ };
608
+ document.addEventListener("mousedown", listener);
609
+ document.addEventListener("touchstart", listener);
610
+ return () => {
611
+ document.removeEventListener("mousedown", listener);
612
+ document.removeEventListener("touchstart", listener);
613
+ };
614
+ }, [refs, handler]);
615
+ };
616
+
617
+ // src/components/user-action/Select.tsx
618
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
619
+ var Select = ({
620
+ value,
621
+ label,
622
+ options,
623
+ onChange,
624
+ hintText = "",
625
+ isDisabled,
626
+ isSearchEnabled = false,
627
+ className,
628
+ selectedDisplayOverwrite
629
+ }) => {
630
+ const triggerRef = useRef2(null);
631
+ const menuRef = useRef2(null);
632
+ const [isOpen, setIsOpen] = useState6(false);
633
+ useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
634
+ const selectedOption = options.find((option) => option.value === value);
635
+ if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
636
+ console.warn("The selected value is not found in the options list. This might be an error on your part or default behavior if it is complex data type on which === does not work. In case of the latter use selectedDisplayOverwrite to set your selected text or component");
637
+ }
638
+ const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
639
+ return /* @__PURE__ */ jsxs5("div", { className: clsx6(className), children: [
640
+ label && /* @__PURE__ */ jsx7(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx6("mb-1", label.className) }),
641
+ /* @__PURE__ */ jsxs5("div", { className: "relative", children: [
642
+ /* @__PURE__ */ jsxs5(
643
+ "button",
644
+ {
645
+ ref: triggerRef,
646
+ className: clsx6(
647
+ "btn-md justify-between w-full border-2",
648
+ {
649
+ "rounded-b-lg": !open,
650
+ "bg-menu-background border-menu-border hover:border-primary": !isDisabled,
651
+ "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
652
+ }
653
+ ),
654
+ onClick: () => setIsOpen(!isOpen),
655
+ disabled: isDisabled,
656
+ children: [
657
+ !isShowingHint && /* @__PURE__ */ jsx7("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? selectedOption?.label }),
658
+ isShowingHint && /* @__PURE__ */ jsx7("span", { className: "textstyle-description", children: hintText }),
659
+ isOpen ? /* @__PURE__ */ jsx7(ChevronUp, {}) : /* @__PURE__ */ jsx7(ChevronDown, {})
660
+ ]
661
+ }
662
+ ),
663
+ isOpen && /* @__PURE__ */ jsx7(
664
+ "div",
665
+ {
666
+ ref: menuRef,
667
+ className: "absolute w-full z-10 rounded-lg mt-0.5 bg-menu-background text-menu-text shadow-around-md max-h-[500px] overflow-y-auto p-2",
668
+ children: /* @__PURE__ */ jsx7(
669
+ SearchableList,
670
+ {
671
+ list: options,
672
+ minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
673
+ searchMapping: (item) => item.searchTags,
674
+ itemMapper: (option, index) => /* @__PURE__ */ jsx7(
675
+ Tile,
676
+ {
677
+ isSelected: selectedOption?.value === option.value,
678
+ className: "px-2 py-1 rounded-md",
679
+ disabledClassName: "text-disabled-text cursor-not-allowed",
680
+ title: { value: option.label, className: "font-semibold" },
681
+ onClick: () => {
682
+ onChange(option.value);
683
+ setIsOpen(false);
684
+ },
685
+ isDisabled: option.disabled
686
+ },
687
+ index
688
+ )
689
+ }
690
+ )
691
+ }
692
+ )
693
+ ] })
694
+ ] });
695
+ };
696
+
328
697
  // src/components/layout-and-navigation/Overlay.tsx
329
- import { useEffect as useEffect7, useRef as useRef2, useState as useState7 } from "react";
698
+ import { useEffect as useEffect9, useRef as useRef3, useState as useState8 } from "react";
330
699
  import ReactDOM from "react-dom";
331
- import clsx6 from "clsx";
700
+ import clsx8 from "clsx";
332
701
 
333
702
  // src/hooks/useHoverState.ts
334
- import { useEffect as useEffect6, useState as useState6 } from "react";
703
+ import { useEffect as useEffect8, useState as useState7 } from "react";
335
704
  var defaultUseHoverStateProps = {
336
705
  closingDelay: 200,
337
706
  isDisabled: false
338
707
  };
339
708
  var useHoverState = (props = void 0) => {
340
709
  const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
341
- const [isHovered, setIsHovered] = useState6(false);
342
- const [timer, setTimer] = useState6();
710
+ const [isHovered, setIsHovered] = useState7(false);
711
+ const [timer, setTimer] = useState7();
343
712
  const onMouseEnter = () => {
344
713
  if (isDisabled) {
345
714
  return;
@@ -355,14 +724,14 @@ var useHoverState = (props = void 0) => {
355
724
  setIsHovered(false);
356
725
  }, closingDelay));
357
726
  };
358
- useEffect6(() => {
727
+ useEffect8(() => {
359
728
  if (timer) {
360
729
  return () => {
361
730
  clearTimeout(timer);
362
731
  };
363
732
  }
364
733
  });
365
- useEffect6(() => {
734
+ useEffect8(() => {
366
735
  if (timer) {
367
736
  clearTimeout(timer);
368
737
  }
@@ -375,8 +744,8 @@ var useHoverState = (props = void 0) => {
375
744
  };
376
745
 
377
746
  // src/components/user-action/Tooltip.tsx
378
- import { clsx as clsx5 } from "clsx";
379
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
747
+ import { clsx as clsx7 } from "clsx";
748
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
380
749
  var Tooltip = ({
381
750
  tooltip,
382
751
  children,
@@ -406,30 +775,30 @@ var Tooltip = ({
406
775
  left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },
407
776
  right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }
408
777
  };
409
- return /* @__PURE__ */ jsxs4(
778
+ return /* @__PURE__ */ jsxs6(
410
779
  "div",
411
780
  {
412
- className: clsx5("relative inline-block", containerClassName),
781
+ className: clsx7("relative inline-block", containerClassName),
413
782
  ...handlers,
414
783
  children: [
415
784
  children,
416
- isHovered && /* @__PURE__ */ jsxs4(
785
+ isHovered && /* @__PURE__ */ jsxs6(
417
786
  "div",
418
787
  {
419
- className: clsx5(
788
+ className: clsx7(
420
789
  `opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap
421
- animate-tooltip-fade-in shadow-lg bg-tooltip-background`,
790
+ animate-tooltip-fade-in shadow-around-md bg-tooltip-background`,
422
791
  positionClasses[position],
423
792
  tooltipClassName
424
793
  ),
425
794
  style: { zIndex, animationDelay: animationDelay + "ms" },
426
795
  children: [
427
796
  tooltip,
428
- /* @__PURE__ */ jsx6(
797
+ /* @__PURE__ */ jsx8(
429
798
  "div",
430
799
  {
431
- className: clsx5(`absolute w-0 h-0`, triangleClasses[position]),
432
- style: { ...triangleStyle[position], zIndex }
800
+ className: clsx7(`absolute w-0 h-0`, triangleClasses[position]),
801
+ style: { ...triangleStyle[position], zIndex: zIndex + 1 }
433
802
  }
434
803
  )
435
804
  ]
@@ -442,24 +811,24 @@ var Tooltip = ({
442
811
 
443
812
  // src/components/layout-and-navigation/Overlay.tsx
444
813
  import { X } from "lucide-react";
445
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
814
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
446
815
  var Overlay = ({
447
816
  children,
448
817
  isOpen,
449
818
  onBackgroundClick,
450
819
  backgroundClassName
451
820
  }) => {
452
- const [root, setRoot] = useState7();
453
- useEffect7(() => {
821
+ const [root, setRoot] = useState8();
822
+ useEffect9(() => {
454
823
  setRoot(document.body);
455
824
  }, []);
456
825
  if (!root || !isOpen) return null;
457
826
  return ReactDOM.createPortal(
458
- /* @__PURE__ */ jsxs5("div", { className: clsx6("fixed inset-0 z-[9999]"), children: [
459
- /* @__PURE__ */ jsx7(
827
+ /* @__PURE__ */ jsxs7("div", { className: clsx8("fixed inset-0 z-[9999]"), children: [
828
+ /* @__PURE__ */ jsx9(
460
829
  "div",
461
830
  {
462
- className: clsx6("fixed inset-0 h-screen w-screen bg-black/30", backgroundClassName),
831
+ className: clsx8("fixed inset-0 h-screen w-screen bg-black/30", backgroundClassName),
463
832
  onClick: onBackgroundClick
464
833
  }
465
834
  ),
@@ -471,10 +840,10 @@ var Overlay = ({
471
840
  var overlayStack = [];
472
841
  var defaultModalHeaderTranslation = {
473
842
  en: {
474
- close: "Close"
843
+ ...formTranslation.en
475
844
  },
476
845
  de: {
477
- close: "Schlie\xDFen"
846
+ ...formTranslation.de
478
847
  }
479
848
  };
480
849
  var OverlayHeader = ({
@@ -485,23 +854,23 @@ var OverlayHeader = ({
485
854
  description,
486
855
  descriptionText = ""
487
856
  }) => {
488
- const translation = useTranslation(defaultModalHeaderTranslation, overwriteTranslation);
857
+ const translation = useTranslation([defaultModalHeaderTranslation], overwriteTranslation);
489
858
  const hasTitleRow = !!title || !!titleText || !!onClose;
490
- const titleRow = /* @__PURE__ */ jsxs5("div", { className: "row justify-between items-start gap-x-8", children: [
491
- title ?? /* @__PURE__ */ jsx7(
859
+ const titleRow = /* @__PURE__ */ jsxs7("div", { className: "row justify-between items-start gap-x-8", children: [
860
+ title ?? /* @__PURE__ */ jsx9(
492
861
  "h2",
493
862
  {
494
- className: clsx6("textstyle-title-lg", {
863
+ className: clsx8("textstyle-title-lg", {
495
864
  "mb-1": description || descriptionText
496
865
  }),
497
866
  children: titleText
498
867
  }
499
868
  ),
500
- !!onClose && /* @__PURE__ */ jsx7(Tooltip, { tooltip: translation.close, children: /* @__PURE__ */ jsx7(IconButton, { color: "neutral", size: "small", onClick: onClose, children: /* @__PURE__ */ jsx7(X, { className: "w-full h-full" }) }) })
869
+ !!onClose && /* @__PURE__ */ jsx9(Tooltip, { tooltip: translation("close"), children: /* @__PURE__ */ jsx9(IconButton, { color: "neutral", size: "small", onClick: onClose, children: /* @__PURE__ */ jsx9(X, { className: "w-full h-full" }) }) })
501
870
  ] });
502
- return /* @__PURE__ */ jsxs5("div", { className: "col", children: [
871
+ return /* @__PURE__ */ jsxs7("div", { className: "col", children: [
503
872
  hasTitleRow && titleRow,
504
- description ?? (descriptionText && /* @__PURE__ */ jsx7("span", { className: "textstyle-description", children: descriptionText }))
873
+ description ?? (descriptionText && /* @__PURE__ */ jsx9("span", { className: "textstyle-description", children: descriptionText }))
505
874
  ] });
506
875
  };
507
876
  var Modal = ({
@@ -512,8 +881,8 @@ var Modal = ({
512
881
  backgroundClassName,
513
882
  headerProps
514
883
  }) => {
515
- const ref = useRef2(null);
516
- useEffect7(() => {
884
+ const ref = useRef3(null);
885
+ useEffect9(() => {
517
886
  if (!isOpen) return;
518
887
  const modal = ref.current;
519
888
  if (!modal) {
@@ -550,25 +919,25 @@ var Modal = ({
550
919
  overlayStack = overlayStack.filter((m) => m !== modal);
551
920
  };
552
921
  }, [isOpen, onClose]);
553
- return /* @__PURE__ */ jsx7(
922
+ return /* @__PURE__ */ jsx9(
554
923
  Overlay,
555
924
  {
556
925
  isOpen,
557
926
  onBackgroundClick: onClose,
558
927
  backgroundClassName,
559
- children: /* @__PURE__ */ jsxs5(
928
+ children: /* @__PURE__ */ jsxs7(
560
929
  "div",
561
930
  {
562
931
  ref,
563
932
  tabIndex: -1,
564
- className: clsx6(
933
+ className: clsx8(
565
934
  "fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 col p-4 bg-overlay-background text-overlay-text rounded-xl shadow-xl",
566
935
  className
567
936
  ),
568
937
  role: "dialog",
569
938
  "aria-modal": true,
570
939
  children: [
571
- /* @__PURE__ */ jsx7(OverlayHeader, { ...headerProps, onClose }),
940
+ /* @__PURE__ */ jsx9(OverlayHeader, { ...headerProps, onClose }),
572
941
  children
573
942
  ]
574
943
  }
@@ -578,17 +947,25 @@ var Modal = ({
578
947
  };
579
948
 
580
949
  // src/theming/useTheme.tsx
581
- import { createContext as createContext2, useContext as useContext2, useEffect as useEffect8, useState as useState8 } from "react";
582
- import { jsx as jsx8 } from "react/jsx-runtime";
950
+ import { createContext as createContext2, useContext as useContext2, useEffect as useEffect10, useState as useState9 } from "react";
951
+ import { jsx as jsx10 } from "react/jsx-runtime";
583
952
  var themes = ["light", "dark"];
584
953
  var defaultThemeTypeTranslation = {
585
954
  en: {
586
955
  dark: "Dark",
587
- light: "Light"
956
+ light: "Light",
957
+ theme: {
958
+ one: "Theme",
959
+ other: "Themes"
960
+ }
588
961
  },
589
962
  de: {
590
963
  dark: "Dunkel",
591
- light: "Hell"
964
+ light: "Hell",
965
+ theme: {
966
+ one: "Farbschema",
967
+ other: "Farbschemas"
968
+ }
592
969
  }
593
970
  };
594
971
  var ThemeUtil = {
@@ -602,19 +979,13 @@ var ThemeContext = createContext2({
602
979
  var useTheme = () => useContext2(ThemeContext);
603
980
 
604
981
  // src/components/modals/ThemeModal.tsx
605
- import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
982
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
606
983
  var defaultConfirmDialogTranslation = {
607
984
  en: {
608
- title: "Theme",
609
- message: "Choose your preferred theme",
610
- done: "Done",
611
- ...ThemeUtil.translation.en
985
+ chooseTheme: "Choose your preferred theme"
612
986
  },
613
987
  de: {
614
- title: "Farbschema",
615
- message: "W\xE4hle dein bevorzugtes Farbschema",
616
- done: "Fertig",
617
- ...ThemeUtil.translation.en
988
+ chooseTheme: "W\xE4hle dein bevorzugtes Farbschema"
618
989
  }
619
990
  };
620
991
  var ThemeModal = ({
@@ -624,19 +995,19 @@ var ThemeModal = ({
624
995
  ...modalProps
625
996
  }) => {
626
997
  const { theme, setTheme } = useTheme();
627
- const translation = useTranslation(defaultConfirmDialogTranslation, overwriteTranslation);
628
- return /* @__PURE__ */ jsx9(
998
+ const translation = useTranslation([defaultConfirmDialogTranslation, formTranslation, ThemeUtil.translation], overwriteTranslation);
999
+ return /* @__PURE__ */ jsx11(
629
1000
  Modal,
630
1001
  {
631
1002
  headerProps: {
632
1003
  ...headerProps,
633
- titleText: headerProps?.titleText ?? translation.title,
634
- descriptionText: headerProps?.descriptionText ?? translation.message
1004
+ titleText: headerProps?.titleText ?? translation("theme"),
1005
+ descriptionText: headerProps?.descriptionText ?? translation("chooseTheme")
635
1006
  },
636
1007
  onClose,
637
1008
  ...modalProps,
638
- children: /* @__PURE__ */ jsxs6("div", { className: "w-64", children: [
639
- /* @__PURE__ */ jsx9(
1009
+ children: /* @__PURE__ */ jsxs8("div", { className: "w-64", children: [
1010
+ /* @__PURE__ */ jsx11(
640
1011
  Select,
641
1012
  {
642
1013
  className: "mt-2",
@@ -645,7 +1016,7 @@ var ThemeModal = ({
645
1016
  onChange: (theme2) => setTheme(theme2)
646
1017
  }
647
1018
  ),
648
- /* @__PURE__ */ jsx9("div", { className: "row mt-3 gap-x-4 justify-end", children: /* @__PURE__ */ jsx9(SolidButton, { autoFocus: true, color: "positive", onClick: onClose, children: translation.done }) })
1019
+ /* @__PURE__ */ jsx11("div", { className: "row mt-3 gap-x-4 justify-end", children: /* @__PURE__ */ jsx11(SolidButton, { autoFocus: true, color: "positive", onClick: onClose, children: translation("done") }) })
649
1020
  ] })
650
1021
  }
651
1022
  );