@helpwave/hightide 0.1.17 → 0.1.19

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 (261) hide show
  1. package/dist/components/branding/HelpwaveBadge.js +7 -7
  2. package/dist/components/branding/HelpwaveBadge.js.map +1 -1
  3. package/dist/components/branding/HelpwaveBadge.mjs +7 -7
  4. package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
  5. package/dist/components/date/DatePicker.js +65 -38
  6. package/dist/components/date/DatePicker.js.map +1 -1
  7. package/dist/components/date/DatePicker.mjs +54 -27
  8. package/dist/components/date/DatePicker.mjs.map +1 -1
  9. package/dist/components/date/DayPicker.js +3 -3
  10. package/dist/components/date/DayPicker.js.map +1 -1
  11. package/dist/components/date/DayPicker.mjs +3 -3
  12. package/dist/components/date/DayPicker.mjs.map +1 -1
  13. package/dist/components/date/TimePicker.js +4 -4
  14. package/dist/components/date/TimePicker.js.map +1 -1
  15. package/dist/components/date/TimePicker.mjs +4 -4
  16. package/dist/components/date/TimePicker.mjs.map +1 -1
  17. package/dist/components/date/YearMonthPicker.js +46 -19
  18. package/dist/components/date/YearMonthPicker.js.map +1 -1
  19. package/dist/components/date/YearMonthPicker.mjs +44 -17
  20. package/dist/components/date/YearMonthPicker.mjs.map +1 -1
  21. package/dist/components/dialogs/ConfirmDialog.js +32 -28
  22. package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
  23. package/dist/components/dialogs/ConfirmDialog.mjs +18 -14
  24. package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
  25. package/dist/components/icons-and-geometry/Avatar.js +2 -2
  26. package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
  27. package/dist/components/icons-and-geometry/Avatar.mjs +2 -2
  28. package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
  29. package/dist/components/icons-and-geometry/Ring.js +2 -2
  30. package/dist/components/icons-and-geometry/Ring.js.map +1 -1
  31. package/dist/components/icons-and-geometry/Ring.mjs +2 -2
  32. package/dist/components/icons-and-geometry/Ring.mjs.map +1 -1
  33. package/dist/components/layout-and-navigation/BreadCrumb.js +1 -1
  34. package/dist/components/layout-and-navigation/BreadCrumb.js.map +1 -1
  35. package/dist/components/layout-and-navigation/BreadCrumb.mjs +1 -1
  36. package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +1 -1
  37. package/dist/components/layout-and-navigation/Carousel.js +84 -15
  38. package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
  39. package/dist/components/layout-and-navigation/Carousel.mjs +76 -7
  40. package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
  41. package/dist/components/layout-and-navigation/Chip.js +1 -1
  42. package/dist/components/layout-and-navigation/Chip.js.map +1 -1
  43. package/dist/components/layout-and-navigation/Chip.mjs +1 -1
  44. package/dist/components/layout-and-navigation/Chip.mjs.map +1 -1
  45. package/dist/components/layout-and-navigation/Expandable.d.mts +7 -1
  46. package/dist/components/layout-and-navigation/Expandable.d.ts +7 -1
  47. package/dist/components/layout-and-navigation/Expandable.js +36 -9
  48. package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
  49. package/dist/components/layout-and-navigation/Expandable.mjs +36 -10
  50. package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
  51. package/dist/components/layout-and-navigation/FAQSection.js +34 -11
  52. package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
  53. package/dist/components/layout-and-navigation/FAQSection.mjs +36 -13
  54. package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
  55. package/dist/components/layout-and-navigation/Overlay.js +92 -19
  56. package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
  57. package/dist/components/layout-and-navigation/Overlay.mjs +81 -8
  58. package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
  59. package/dist/components/layout-and-navigation/Pagination.js +82 -10
  60. package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
  61. package/dist/components/layout-and-navigation/Pagination.mjs +79 -7
  62. package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
  63. package/dist/components/layout-and-navigation/SearchableList.js +127 -26
  64. package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
  65. package/dist/components/layout-and-navigation/SearchableList.mjs +126 -25
  66. package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
  67. package/dist/components/layout-and-navigation/StepperBar.js +22 -16
  68. package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
  69. package/dist/components/layout-and-navigation/StepperBar.mjs +19 -13
  70. package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
  71. package/dist/components/layout-and-navigation/TextImage.js +7 -3
  72. package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
  73. package/dist/components/layout-and-navigation/TextImage.mjs +7 -3
  74. package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
  75. package/dist/components/layout-and-navigation/Tile.d.mts +2 -2
  76. package/dist/components/layout-and-navigation/Tile.d.ts +2 -2
  77. package/dist/components/layout-and-navigation/Tile.js +7 -7
  78. package/dist/components/layout-and-navigation/Tile.js.map +1 -1
  79. package/dist/components/layout-and-navigation/Tile.mjs +7 -7
  80. package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
  81. package/dist/components/loading-states/ErrorComponent.js +1 -1
  82. package/dist/components/loading-states/ErrorComponent.js.map +1 -1
  83. package/dist/components/loading-states/ErrorComponent.mjs +1 -1
  84. package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
  85. package/dist/components/loading-states/LoadingAndErrorComponent.js +6 -2
  86. package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
  87. package/dist/components/loading-states/LoadingAndErrorComponent.mjs +6 -2
  88. package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
  89. package/dist/components/loading-states/LoadingAnimation.js +5 -1
  90. package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
  91. package/dist/components/loading-states/LoadingAnimation.mjs +5 -1
  92. package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
  93. package/dist/components/loading-states/LoadingButton.js +8 -6
  94. package/dist/components/loading-states/LoadingButton.js.map +1 -1
  95. package/dist/components/loading-states/LoadingButton.mjs +8 -6
  96. package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
  97. package/dist/components/modals/ConfirmModal.js +32 -28
  98. package/dist/components/modals/ConfirmModal.js.map +1 -1
  99. package/dist/components/modals/ConfirmModal.mjs +18 -14
  100. package/dist/components/modals/ConfirmModal.mjs.map +1 -1
  101. package/dist/components/modals/DiscardChangesModal.js +28 -24
  102. package/dist/components/modals/DiscardChangesModal.js.map +1 -1
  103. package/dist/components/modals/DiscardChangesModal.mjs +18 -14
  104. package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
  105. package/dist/components/modals/InputModal.js +32 -29
  106. package/dist/components/modals/InputModal.js.map +1 -1
  107. package/dist/components/modals/InputModal.mjs +18 -15
  108. package/dist/components/modals/InputModal.mjs.map +1 -1
  109. package/dist/components/modals/LanguageModal.js +728 -435
  110. package/dist/components/modals/LanguageModal.js.map +1 -1
  111. package/dist/components/modals/LanguageModal.mjs +728 -431
  112. package/dist/components/modals/LanguageModal.mjs.map +1 -1
  113. package/dist/components/modals/ThemeModal.js +732 -439
  114. package/dist/components/modals/ThemeModal.js.map +1 -1
  115. package/dist/components/modals/ThemeModal.mjs +731 -434
  116. package/dist/components/modals/ThemeModal.mjs.map +1 -1
  117. package/dist/components/properties/CheckboxProperty.js +110 -35
  118. package/dist/components/properties/CheckboxProperty.js.map +1 -1
  119. package/dist/components/properties/CheckboxProperty.mjs +110 -35
  120. package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
  121. package/dist/components/properties/DateProperty.js +118 -42
  122. package/dist/components/properties/DateProperty.js.map +1 -1
  123. package/dist/components/properties/DateProperty.mjs +114 -38
  124. package/dist/components/properties/DateProperty.mjs.map +1 -1
  125. package/dist/components/properties/MultiSelectProperty.d.mts +10 -3
  126. package/dist/components/properties/MultiSelectProperty.d.ts +10 -3
  127. package/dist/components/properties/MultiSelectProperty.js +915 -464
  128. package/dist/components/properties/MultiSelectProperty.js.map +1 -1
  129. package/dist/components/properties/MultiSelectProperty.mjs +920 -465
  130. package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
  131. package/dist/components/properties/NumberProperty.js +101 -19
  132. package/dist/components/properties/NumberProperty.js.map +1 -1
  133. package/dist/components/properties/NumberProperty.mjs +101 -19
  134. package/dist/components/properties/NumberProperty.mjs.map +1 -1
  135. package/dist/components/properties/PropertyBase.js +103 -20
  136. package/dist/components/properties/PropertyBase.js.map +1 -1
  137. package/dist/components/properties/PropertyBase.mjs +99 -16
  138. package/dist/components/properties/PropertyBase.mjs.map +1 -1
  139. package/dist/components/properties/SelectProperty.d.mts +9 -2
  140. package/dist/components/properties/SelectProperty.d.ts +9 -2
  141. package/dist/components/properties/SelectProperty.js +682 -244
  142. package/dist/components/properties/SelectProperty.js.map +1 -1
  143. package/dist/components/properties/SelectProperty.mjs +686 -244
  144. package/dist/components/properties/SelectProperty.mjs.map +1 -1
  145. package/dist/components/properties/TextProperty.js +133 -47
  146. package/dist/components/properties/TextProperty.js.map +1 -1
  147. package/dist/components/properties/TextProperty.mjs +133 -47
  148. package/dist/components/properties/TextProperty.mjs.map +1 -1
  149. package/dist/components/table/Table.js +285 -186
  150. package/dist/components/table/Table.js.map +1 -1
  151. package/dist/components/table/Table.mjs +270 -167
  152. package/dist/components/table/Table.mjs.map +1 -1
  153. package/dist/components/table/TableFilterButton.js +179 -79
  154. package/dist/components/table/TableFilterButton.js.map +1 -1
  155. package/dist/components/table/TableFilterButton.mjs +160 -56
  156. package/dist/components/table/TableFilterButton.mjs.map +1 -1
  157. package/dist/components/table/TableSortButton.js +72 -3
  158. package/dist/components/table/TableSortButton.js.map +1 -1
  159. package/dist/components/table/TableSortButton.mjs +72 -3
  160. package/dist/components/table/TableSortButton.mjs.map +1 -1
  161. package/dist/components/user-action/Button.d.mts +15 -2
  162. package/dist/components/user-action/Button.d.ts +15 -2
  163. package/dist/components/user-action/Button.js +12 -12
  164. package/dist/components/user-action/Button.js.map +1 -1
  165. package/dist/components/user-action/Button.mjs +12 -12
  166. package/dist/components/user-action/Button.mjs.map +1 -1
  167. package/dist/components/user-action/Checkbox.js +6 -15
  168. package/dist/components/user-action/Checkbox.js.map +1 -1
  169. package/dist/components/user-action/Checkbox.mjs +6 -15
  170. package/dist/components/user-action/Checkbox.mjs.map +1 -1
  171. package/dist/components/user-action/CopyToClipboardWrapper.js +6 -2
  172. package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
  173. package/dist/components/user-action/CopyToClipboardWrapper.mjs +6 -2
  174. package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
  175. package/dist/components/user-action/DateAndTimePicker.js +79 -48
  176. package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
  177. package/dist/components/user-action/DateAndTimePicker.mjs +65 -34
  178. package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
  179. package/dist/components/user-action/Input.js +0 -1
  180. package/dist/components/user-action/Input.js.map +1 -1
  181. package/dist/components/user-action/Input.mjs +0 -1
  182. package/dist/components/user-action/Input.mjs.map +1 -1
  183. package/dist/components/user-action/Menu.d.mts +11 -6
  184. package/dist/components/user-action/Menu.d.ts +11 -6
  185. package/dist/components/user-action/Menu.js +128 -31
  186. package/dist/components/user-action/Menu.js.map +1 -1
  187. package/dist/components/user-action/Menu.mjs +134 -33
  188. package/dist/components/user-action/Menu.mjs.map +1 -1
  189. package/dist/components/user-action/MultiSelect.d.mts +17 -7
  190. package/dist/components/user-action/MultiSelect.d.ts +17 -7
  191. package/dist/components/user-action/MultiSelect.js +796 -376
  192. package/dist/components/user-action/MultiSelect.js.map +1 -1
  193. package/dist/components/user-action/MultiSelect.mjs +781 -357
  194. package/dist/components/user-action/MultiSelect.mjs.map +1 -1
  195. package/dist/components/user-action/ScrollPicker.js +2 -2
  196. package/dist/components/user-action/ScrollPicker.js.map +1 -1
  197. package/dist/components/user-action/ScrollPicker.mjs +2 -2
  198. package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
  199. package/dist/components/user-action/SearchBar.d.mts +14 -0
  200. package/dist/components/user-action/SearchBar.d.ts +14 -0
  201. package/dist/components/user-action/SearchBar.js +673 -0
  202. package/dist/components/user-action/SearchBar.js.map +1 -0
  203. package/dist/components/user-action/SearchBar.mjs +637 -0
  204. package/dist/components/user-action/SearchBar.mjs.map +1 -0
  205. package/dist/components/user-action/Select.d.mts +18 -5
  206. package/dist/components/user-action/Select.d.ts +18 -5
  207. package/dist/components/user-action/Select.js +764 -356
  208. package/dist/components/user-action/Select.js.map +1 -1
  209. package/dist/components/user-action/Select.mjs +761 -350
  210. package/dist/components/user-action/Select.mjs.map +1 -1
  211. package/dist/components/user-action/Textarea.d.mts +1 -1
  212. package/dist/components/user-action/Textarea.d.ts +1 -1
  213. package/dist/components/user-action/Textarea.js +13 -4
  214. package/dist/components/user-action/Textarea.js.map +1 -1
  215. package/dist/components/user-action/Textarea.mjs +13 -4
  216. package/dist/components/user-action/Textarea.mjs.map +1 -1
  217. package/dist/components/user-action/ToggleableInput.js +2 -3
  218. package/dist/components/user-action/ToggleableInput.js.map +1 -1
  219. package/dist/components/user-action/ToggleableInput.mjs +2 -3
  220. package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
  221. package/dist/css/globals.css +251 -113
  222. package/dist/css/uncompiled/globals.css +19 -13
  223. package/dist/css/uncompiled/theme/colors-component.css +12 -3
  224. package/dist/css/uncompiled/theme/colors-semantic.css +10 -7
  225. package/dist/css/uncompiled/utitlity/animation.css +70 -1
  226. package/dist/css/uncompiled/utitlity/general.css +16 -0
  227. package/dist/hooks/useDelay.js +0 -1
  228. package/dist/hooks/useDelay.js.map +1 -1
  229. package/dist/hooks/useDelay.mjs +0 -1
  230. package/dist/hooks/useDelay.mjs.map +1 -1
  231. package/dist/hooks/usePopoverPosition.d.mts +15 -0
  232. package/dist/hooks/usePopoverPosition.d.ts +15 -0
  233. package/dist/hooks/usePopoverPosition.js +81 -0
  234. package/dist/hooks/usePopoverPosition.js.map +1 -0
  235. package/dist/hooks/usePopoverPosition.mjs +57 -0
  236. package/dist/hooks/usePopoverPosition.mjs.map +1 -0
  237. package/dist/hooks/useSearch.d.mts +7 -2
  238. package/dist/hooks/useSearch.d.ts +7 -2
  239. package/dist/hooks/useSearch.js +44 -15
  240. package/dist/hooks/useSearch.js.map +1 -1
  241. package/dist/hooks/useSearch.mjs +45 -16
  242. package/dist/hooks/useSearch.mjs.map +1 -1
  243. package/dist/index.d.mts +6 -4
  244. package/dist/index.d.ts +6 -4
  245. package/dist/index.js +1102 -820
  246. package/dist/index.js.map +1 -1
  247. package/dist/index.mjs +1001 -719
  248. package/dist/index.mjs.map +1 -1
  249. package/dist/localization/defaults/form.d.mts +2 -0
  250. package/dist/localization/defaults/form.d.ts +2 -0
  251. package/dist/localization/defaults/form.js +4 -0
  252. package/dist/localization/defaults/form.js.map +1 -1
  253. package/dist/localization/defaults/form.mjs +4 -0
  254. package/dist/localization/defaults/form.mjs.map +1 -1
  255. package/dist/util/simpleSearch.d.mts +1 -1
  256. package/dist/util/simpleSearch.d.ts +1 -1
  257. package/dist/util/simpleSearch.js +4 -1
  258. package/dist/util/simpleSearch.js.map +1 -1
  259. package/dist/util/simpleSearch.mjs +4 -1
  260. package/dist/util/simpleSearch.mjs.map +1 -1
  261. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  // src/components/user-action/Select.tsx
2
- import { ChevronDown, ChevronUp } from "lucide-react";
3
- import { useEffect as useEffect8, useRef as useRef2, useState as useState6 } from "react";
4
- import clsx6 from "clsx";
2
+ import { useCallback as useCallback5 } from "react";
3
+ import { useEffect as useEffect11, useState as useState9 } from "react";
4
+ import clsx8 from "clsx";
5
5
 
6
6
  // src/components/user-action/Label.tsx
7
7
  import clsx from "clsx";
@@ -21,109 +21,388 @@ var Label = ({
21
21
  return /* @__PURE__ */ jsx("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
22
22
  };
23
23
 
24
- // src/components/layout-and-navigation/SearchableList.tsx
25
- import { Search } from "lucide-react";
26
- import clsx4 from "clsx";
24
+ // src/components/layout-and-navigation/Tile.tsx
25
+ import clsx2 from "clsx";
26
+ import { Check } from "lucide-react";
27
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
28
+ var Tile = ({
29
+ title,
30
+ description,
31
+ onClick,
32
+ isSelected = false,
33
+ disabled = false,
34
+ prefix,
35
+ suffix,
36
+ normalClassName = "hover:bg-primary/40 cursor-pointer",
37
+ selectedClassName = " bg-primary/20",
38
+ disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
39
+ className
40
+ }) => {
41
+ return /* @__PURE__ */ jsxs(
42
+ "div",
43
+ {
44
+ className: clsx2(
45
+ "flex-row-2 w-full items-center",
46
+ {
47
+ [normalClassName]: !!onClick && !disabled,
48
+ [selectedClassName]: isSelected && !disabled,
49
+ [disabledClassName]: disabled
50
+ },
51
+ className
52
+ ),
53
+ onClick: disabled ? void 0 : onClick,
54
+ children: [
55
+ prefix,
56
+ /* @__PURE__ */ jsxs("div", { className: "flex-col-0 w-full", children: [
57
+ /* @__PURE__ */ jsx2("h4", { className: clsx2(title.className ?? "textstyle-title-normal"), children: title.value }),
58
+ !!description && /* @__PURE__ */ jsx2("span", { className: clsx2(description.className ?? "textstyle-description"), children: description.value })
59
+ ] }),
60
+ suffix ?? (isSelected ? /* @__PURE__ */ jsx2(Check, { size: 24 }) : void 0)
61
+ ]
62
+ }
63
+ );
64
+ };
27
65
 
28
- // src/localization/LanguageProvider.tsx
29
- import { createContext, useContext, useEffect as useEffect2, useState as useState2 } from "react";
66
+ // src/components/layout-and-navigation/Expandable.tsx
67
+ import { forwardRef, useCallback, useEffect, useState } from "react";
68
+ import { ChevronDown } from "lucide-react";
69
+ import clsx3 from "clsx";
30
70
 
31
- // src/hooks/useLocalStorage.ts
32
- import { useCallback, useEffect, useState } from "react";
71
+ // src/util/noop.ts
72
+ var noop = () => void 0;
33
73
 
34
- // src/localization/util.ts
35
- var languages = ["en", "de"];
36
- var languagesLocalNames = {
37
- en: "English",
38
- de: "Deutsch"
74
+ // src/components/layout-and-navigation/Expandable.tsx
75
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
76
+ var ExpansionIcon = ({ isExpanded, className }) => {
77
+ return /* @__PURE__ */ jsx3(
78
+ ChevronDown,
79
+ {
80
+ className: clsx3(
81
+ "min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
82
+ { "rotate-180": isExpanded },
83
+ className
84
+ )
85
+ }
86
+ );
39
87
  };
40
- var DEFAULT_LANGUAGE = "en";
41
- var LanguageUtil = {
42
- languages,
43
- DEFAULT_LANGUAGE,
44
- languagesLocalNames
88
+ var Expandable = forwardRef(function Expandable2({
89
+ children,
90
+ label,
91
+ icon,
92
+ isExpanded = false,
93
+ onChange = noop,
94
+ clickOnlyOnHeader = true,
95
+ disabled = false,
96
+ className,
97
+ headerClassName,
98
+ contentClassName
99
+ }, ref) {
100
+ const defaultIcon = useCallback((expanded) => /* @__PURE__ */ jsx3(ExpansionIcon, { isExpanded: expanded }), []);
101
+ icon ??= defaultIcon;
102
+ return /* @__PURE__ */ jsxs2(
103
+ "div",
104
+ {
105
+ ref,
106
+ className: clsx3("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
107
+ onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
108
+ children: [
109
+ /* @__PURE__ */ jsxs2(
110
+ "div",
111
+ {
112
+ className: clsx3(
113
+ "flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
114
+ {
115
+ "group-hover:brightness-97": !isExpanded,
116
+ "hover:brightness-97": isExpanded && !disabled,
117
+ "cursor-pointer": clickOnlyOnHeader && !disabled
118
+ },
119
+ headerClassName
120
+ ),
121
+ onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
122
+ children: [
123
+ label,
124
+ icon(isExpanded)
125
+ ]
126
+ }
127
+ ),
128
+ /* @__PURE__ */ jsx3(
129
+ "div",
130
+ {
131
+ className: clsx3(
132
+ "flex-col-2 px-4 transition-all duration-300 ease-in-out",
133
+ {
134
+ "max-h-96 opacity-100 pb-2": isExpanded,
135
+ "max-h-0 opacity-0 overflow-hidden": !isExpanded
136
+ },
137
+ contentClassName
138
+ ),
139
+ children
140
+ }
141
+ )
142
+ ]
143
+ }
144
+ );
145
+ });
146
+ var ExpandableUncontrolled = forwardRef(function ExpandableUncontrolled2({
147
+ isExpanded,
148
+ onChange = noop,
149
+ ...props
150
+ }, ref) {
151
+ const [usedIsExpanded, setUsedIsExpanded] = useState(isExpanded);
152
+ useEffect(() => {
153
+ setUsedIsExpanded(isExpanded);
154
+ }, [isExpanded]);
155
+ return /* @__PURE__ */ jsx3(
156
+ Expandable,
157
+ {
158
+ ...props,
159
+ ref,
160
+ isExpanded: usedIsExpanded,
161
+ onChange: (value) => {
162
+ onChange(value);
163
+ setUsedIsExpanded(value);
164
+ }
165
+ }
166
+ );
167
+ });
168
+
169
+ // src/components/user-action/Menu.tsx
170
+ import {
171
+ useEffect as useEffect4,
172
+ useRef,
173
+ useState as useState3
174
+ } from "react";
175
+ import clsx4 from "clsx";
176
+
177
+ // src/hooks/useOutsideClick.ts
178
+ import { useEffect as useEffect2 } from "react";
179
+ var useOutsideClick = (refs, handler) => {
180
+ useEffect2(() => {
181
+ const listener = (event) => {
182
+ if (event.target === null) return;
183
+ if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
184
+ return;
185
+ }
186
+ handler();
187
+ };
188
+ document.addEventListener("mousedown", listener);
189
+ document.addEventListener("touchstart", listener);
190
+ return () => {
191
+ document.removeEventListener("mousedown", listener);
192
+ document.removeEventListener("touchstart", listener);
193
+ };
194
+ }, [refs, handler]);
45
195
  };
46
196
 
47
- // src/localization/LanguageProvider.tsx
48
- import { jsx as jsx2 } from "react/jsx-runtime";
49
- var LanguageContext = createContext({
50
- language: LanguageUtil.DEFAULT_LANGUAGE,
51
- setLanguage: (v) => v
52
- });
53
- var useLanguage = () => useContext(LanguageContext);
197
+ // src/hooks/useHoverState.ts
198
+ import { useEffect as useEffect3, useState as useState2 } from "react";
199
+ var defaultUseHoverStateProps = {
200
+ closingDelay: 200,
201
+ isDisabled: false
202
+ };
203
+ var useHoverState = (props = void 0) => {
204
+ const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
205
+ const [isHovered, setIsHovered] = useState2(false);
206
+ const [timer, setTimer] = useState2();
207
+ const onMouseEnter = () => {
208
+ if (isDisabled) {
209
+ return;
210
+ }
211
+ clearTimeout(timer);
212
+ setIsHovered(true);
213
+ };
214
+ const onMouseLeave = () => {
215
+ if (isDisabled) {
216
+ return;
217
+ }
218
+ setTimer(setTimeout(() => {
219
+ setIsHovered(false);
220
+ }, closingDelay));
221
+ };
222
+ useEffect3(() => {
223
+ if (timer) {
224
+ return () => {
225
+ clearTimeout(timer);
226
+ };
227
+ }
228
+ });
229
+ useEffect3(() => {
230
+ if (timer) {
231
+ clearTimeout(timer);
232
+ }
233
+ }, [isDisabled]);
234
+ return {
235
+ isHovered,
236
+ setIsHovered,
237
+ handlers: { onMouseEnter, onMouseLeave }
238
+ };
239
+ };
54
240
 
55
- // src/localization/useTranslation.ts
56
- var TranslationPluralCount = {
57
- zero: 0,
58
- one: 1,
59
- two: 2,
60
- few: 3,
61
- many: 11,
62
- other: -1
241
+ // src/util/PropsWithFunctionChildren.ts
242
+ var resolve = (children, bag) => {
243
+ if (typeof children === "function") {
244
+ return children(bag);
245
+ }
246
+ return children ?? void 0;
63
247
  };
64
- var useTranslation = (translations, overwriteTranslation = {}) => {
65
- const { language: languageProp, translation: overwrite } = overwriteTranslation;
66
- const { language: inferredLanguage } = useLanguage();
67
- const usedLanguage = languageProp ?? inferredLanguage;
68
- const usedTranslations = [...translations];
69
- if (overwrite) {
70
- usedTranslations.push(overwrite);
248
+ var BagFunctionUtil = {
249
+ resolve
250
+ };
251
+
252
+ // src/hooks/usePopoverPosition.ts
253
+ var defaultPopoverPositionOptions = {
254
+ edgePadding: 16,
255
+ outerGap: 4,
256
+ horizontalAlignment: "leftInside",
257
+ verticalAlignment: "bottomOutside",
258
+ disabled: false
259
+ };
260
+ var usePopoverPosition = (trigger, options) => {
261
+ const {
262
+ edgePadding,
263
+ outerGap,
264
+ verticalAlignment,
265
+ horizontalAlignment,
266
+ disabled
267
+ } = { ...defaultPopoverPositionOptions, ...options };
268
+ if (disabled || !trigger) {
269
+ return {};
71
270
  }
72
- return (key, options) => {
73
- const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
74
- try {
75
- for (let i = translations.length - 1; i >= 0; i--) {
76
- const translation = translations[i];
77
- const localizedTranslation = translation[usedLanguage];
78
- if (!localizedTranslation) {
79
- continue;
80
- }
81
- const value = localizedTranslation[key];
82
- if (!value) {
83
- continue;
84
- }
85
- let forProcessing;
86
- if (typeof value !== "string") {
87
- if (count === TranslationPluralCount.zero && value?.zero) {
88
- forProcessing = value.zero;
89
- } else if (count === TranslationPluralCount.one && value?.one) {
90
- forProcessing = value.one;
91
- } else if (count === TranslationPluralCount.two && value?.two) {
92
- forProcessing = value.two;
93
- } else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
94
- forProcessing = value.few;
95
- } else if (count > TranslationPluralCount.many && value?.many) {
96
- forProcessing = value.many;
97
- } else {
98
- forProcessing = value.other;
271
+ const left = {
272
+ leftOutside: trigger.left - outerGap,
273
+ leftInside: trigger.left,
274
+ rightOutside: trigger.right + outerGap,
275
+ rightInside: trigger.right,
276
+ center: trigger.left + trigger.width / 2
277
+ }[horizontalAlignment];
278
+ const top = {
279
+ topOutside: trigger.top - outerGap,
280
+ topInside: trigger.top,
281
+ bottomOutside: trigger.bottom + outerGap,
282
+ bottomInside: trigger.bottom,
283
+ center: trigger.top + trigger.height / 2
284
+ }[verticalAlignment];
285
+ const translateX = {
286
+ leftOutside: "-100%",
287
+ leftInside: void 0,
288
+ rightOutside: void 0,
289
+ rightInside: "-100%",
290
+ center: "-50%"
291
+ }[horizontalAlignment];
292
+ const translateY = {
293
+ topOutside: "-100%",
294
+ topInside: void 0,
295
+ bottomOutside: void 0,
296
+ bottomInside: "-100%",
297
+ center: "-50%"
298
+ }[verticalAlignment];
299
+ return {
300
+ left: Math.max(left, edgePadding),
301
+ top: Math.max(top, edgePadding),
302
+ translate: [translateX ?? "0", translateY ?? "0"].join(" ")
303
+ };
304
+ };
305
+
306
+ // src/components/user-action/Menu.tsx
307
+ import { createPortal } from "react-dom";
308
+ import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
309
+ function getScrollableParents(element) {
310
+ const scrollables = [];
311
+ let parent = element.parentElement;
312
+ while (parent) {
313
+ scrollables.push(parent);
314
+ parent = parent.parentElement;
315
+ }
316
+ return scrollables;
317
+ }
318
+ var Menu = ({
319
+ trigger,
320
+ children,
321
+ alignmentHorizontal = "leftInside",
322
+ alignmentVertical = "bottomOutside",
323
+ showOnHover = false,
324
+ disabled = false,
325
+ menuClassName = ""
326
+ }) => {
327
+ const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
328
+ const triggerRef = useRef(null);
329
+ const menuRef = useRef(null);
330
+ useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
331
+ const [isHidden, setIsHidden] = useState3(true);
332
+ const bag = {
333
+ isOpen,
334
+ close: () => setIsOpen(false),
335
+ toggleOpen: () => setIsOpen((prevState) => !prevState),
336
+ disabled
337
+ };
338
+ const menuPosition = usePopoverPosition(
339
+ triggerRef.current?.getBoundingClientRect(),
340
+ { verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
341
+ );
342
+ useEffect4(() => {
343
+ if (!isOpen) return;
344
+ const triggerEl = triggerRef.current;
345
+ if (!triggerEl) return;
346
+ const scrollableParents = getScrollableParents(triggerEl);
347
+ const close = () => setIsOpen(false);
348
+ scrollableParents.forEach((parent) => {
349
+ parent.addEventListener("scroll", close);
350
+ });
351
+ window.addEventListener("resize", close);
352
+ return () => {
353
+ scrollableParents.forEach((parent) => {
354
+ parent.removeEventListener("scroll", close);
355
+ });
356
+ window.removeEventListener("resize", close);
357
+ };
358
+ }, [isOpen, setIsOpen]);
359
+ useEffect4(() => {
360
+ if (isOpen) {
361
+ setIsHidden(false);
362
+ }
363
+ }, [isOpen]);
364
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
365
+ trigger(bag, triggerRef),
366
+ createPortal(/* @__PURE__ */ jsx4(
367
+ "div",
368
+ {
369
+ ref: menuRef,
370
+ onClick: (e) => e.stopPropagation(),
371
+ className: clsx4(
372
+ "absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
373
+ {
374
+ "animate-pop-in": isOpen,
375
+ "animate-pop-out": !isOpen,
376
+ "hidden": isHidden
377
+ },
378
+ menuClassName
379
+ ),
380
+ onAnimationEnd: () => {
381
+ if (!isOpen) {
382
+ setIsHidden(true);
99
383
  }
100
- } else {
101
- forProcessing = value;
102
- }
103
- forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
104
- return replacements[placeholder] ?? `{{key:${placeholder}}}`;
105
- });
106
- return forProcessing;
384
+ },
385
+ style: {
386
+ ...menuPosition
387
+ },
388
+ children: BagFunctionUtil.resolve(children, bag)
107
389
  }
108
- } catch (e) {
109
- console.error(e);
110
- }
111
- return `{{${usedLanguage}:${key}}}`;
112
- };
390
+ ), document.body)
391
+ ] });
113
392
  };
114
393
 
115
394
  // src/components/user-action/Input.tsx
116
- import { forwardRef, useEffect as useEffect5, useImperativeHandle, useRef, useState as useState4 } from "react";
117
- import clsx2 from "clsx";
395
+ import { forwardRef as forwardRef2, useEffect as useEffect7, useImperativeHandle, useRef as useRef2, useState as useState5 } from "react";
396
+ import clsx5 from "clsx";
118
397
 
119
398
  // src/hooks/useDelay.ts
120
- import { useEffect as useEffect3, useState as useState3 } from "react";
399
+ import { useEffect as useEffect5, useState as useState4 } from "react";
121
400
  var defaultOptions = {
122
401
  delay: 3e3,
123
402
  disabled: false
124
403
  };
125
404
  function useDelay(options) {
126
- const [timer, setTimer] = useState3(void 0);
405
+ const [timer, setTimer] = useState4(void 0);
127
406
  const { delay, disabled } = {
128
407
  ...defaultOptions,
129
408
  ...options
@@ -142,24 +421,20 @@ function useDelay(options) {
142
421
  setTimer(void 0);
143
422
  }, delay));
144
423
  };
145
- useEffect3(() => {
424
+ useEffect5(() => {
146
425
  return () => {
147
426
  clearTimeout(timer);
148
427
  };
149
428
  }, [timer]);
150
- useEffect3(() => {
429
+ useEffect5(() => {
151
430
  if (disabled) {
152
431
  clearTimeout(timer);
153
432
  setTimer(void 0);
154
433
  }
155
434
  }, [disabled, timer]);
156
- console.log(timer);
157
435
  return { restartTimer, clearTimer, hasActiveTimer: !!timer };
158
436
  }
159
437
 
160
- // src/util/noop.ts
161
- var noop = () => void 0;
162
-
163
438
  // src/hooks/useFocusManagement.ts
164
439
  import { useCallback as useCallback2 } from "react";
165
440
  function useFocusManagement() {
@@ -218,10 +493,10 @@ function useFocusManagement() {
218
493
  }
219
494
 
220
495
  // src/hooks/useFocusOnceVisible.ts
221
- import React, { useEffect as useEffect4 } from "react";
496
+ import React, { useEffect as useEffect6 } from "react";
222
497
  var useFocusOnceVisible = (ref, disable = false) => {
223
498
  const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
224
- useEffect4(() => {
499
+ useEffect6(() => {
225
500
  if (disable || hasUsedFocus) {
226
501
  return;
227
502
  }
@@ -241,9 +516,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
241
516
  };
242
517
 
243
518
  // src/components/user-action/Input.tsx
244
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
519
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
245
520
  var getInputClassName = ({ disabled = false, hasError = false }) => {
246
- return clsx2(
521
+ return clsx5(
247
522
  "px-2 py-1.5 rounded-md border-2",
248
523
  {
249
524
  "bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
@@ -257,7 +532,7 @@ var defaultEditCompleteOptions = {
257
532
  afterDelay: true,
258
533
  delay: 2500
259
534
  };
260
- var Input = forwardRef(function Input2({
535
+ var Input = forwardRef2(function Input2({
261
536
  id,
262
537
  type = "text",
263
538
  value,
@@ -280,7 +555,7 @@ var Input = forwardRef(function Input2({
280
555
  restartTimer,
281
556
  clearTimer
282
557
  } = useDelay({ delay, disabled: !afterDelay });
283
- const innerRef = useRef(null);
558
+ const innerRef = useRef2(null);
284
559
  const { focusNext } = useFocusManagement();
285
560
  useFocusOnceVisible(innerRef, !autoFocus);
286
561
  useImperativeHandle(forwardedRef, () => innerRef.current);
@@ -291,9 +566,9 @@ var Input = forwardRef(function Input2({
291
566
  focusNext();
292
567
  }
293
568
  };
294
- return /* @__PURE__ */ jsxs("div", { className: clsx2({ "w-full": expanded }, containerClassName), children: [
295
- label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx2("mb-1", label.className) }),
296
- /* @__PURE__ */ jsx3(
569
+ return /* @__PURE__ */ jsxs4("div", { className: clsx5({ "w-full": expanded }, containerClassName), children: [
570
+ label && /* @__PURE__ */ jsx5(Label, { ...label, htmlFor: id, className: clsx5("mb-1", label.className) }),
571
+ /* @__PURE__ */ jsx5(
297
572
  "input",
298
573
  {
299
574
  ...restProps,
@@ -302,7 +577,7 @@ var Input = forwardRef(function Input2({
302
577
  id,
303
578
  type,
304
579
  disabled,
305
- className: clsx2(getInputClassName({ disabled }), className),
580
+ className: clsx5(getInputClassName({ disabled }), className),
306
581
  onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
307
582
  onBlur: (event) => {
308
583
  onBlur?.(event);
@@ -332,7 +607,7 @@ var Input = forwardRef(function Input2({
332
607
  )
333
608
  ] });
334
609
  });
335
- var FormInput = forwardRef(function FormInput2({
610
+ var FormInput = forwardRef2(function FormInput2({
336
611
  id,
337
612
  labelText,
338
613
  errorText,
@@ -344,137 +619,120 @@ var FormInput = forwardRef(function FormInput2({
344
619
  disabled,
345
620
  ...restProps
346
621
  }, ref) {
347
- const input = /* @__PURE__ */ jsx3(
622
+ const input = /* @__PURE__ */ jsx5(
348
623
  "input",
349
624
  {
350
625
  ...restProps,
351
626
  ref,
352
627
  id,
353
628
  disabled,
354
- className: clsx2(
629
+ className: clsx5(
355
630
  getInputClassName({ disabled, hasError: !!errorText }),
356
631
  className
357
632
  )
358
633
  }
359
634
  );
360
- return /* @__PURE__ */ jsxs("div", { className: clsx2("flex flex-col gap-y-1", containerClassName), children: [
361
- labelText && /* @__PURE__ */ jsxs("label", { htmlFor: id, className: clsx2("textstyle-label-md", labelClassName), children: [
635
+ return /* @__PURE__ */ jsxs4("div", { className: clsx5("flex flex-col gap-y-1", containerClassName), children: [
636
+ labelText && /* @__PURE__ */ jsxs4("label", { htmlFor: id, className: clsx5("textstyle-label-md", labelClassName), children: [
362
637
  labelText,
363
- required && /* @__PURE__ */ jsx3("span", { className: "text-primary font-bold", children: "*" })
638
+ required && /* @__PURE__ */ jsx5("span", { className: "text-primary font-bold", children: "*" })
364
639
  ] }),
365
640
  input,
366
- errorText && /* @__PURE__ */ jsx3("label", { htmlFor: id, className: clsx2("text-negative", errorClassName), children: errorText })
641
+ errorText && /* @__PURE__ */ jsx5("label", { htmlFor: id, className: clsx5("text-negative", errorClassName), children: errorText })
367
642
  ] });
368
643
  });
369
644
 
370
- // src/components/user-action/Button.tsx
371
- import clsx3 from "clsx";
372
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
373
- var ButtonColorUtil = {
374
- solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
375
- text: ["primary", "negative", "neutral"],
376
- outline: ["primary"]
377
- };
378
- var IconButtonUtil = {
379
- icon: [...ButtonColorUtil.solid, "transparent"]
380
- };
381
- var paddingMapping = {
382
- small: "btn-sm",
383
- medium: "btn-md",
384
- large: "btn-lg"
385
- };
386
- var iconPaddingMapping = {
387
- tiny: "icon-btn-xs",
388
- small: "icon-btn-sm",
389
- medium: "icon-btn-md",
390
- large: "icon-btn-lg"
645
+ // src/localization/LanguageProvider.tsx
646
+ import { createContext, useContext, useEffect as useEffect9, useState as useState7 } from "react";
647
+
648
+ // src/hooks/useLocalStorage.ts
649
+ import { useCallback as useCallback3, useEffect as useEffect8, useState as useState6 } from "react";
650
+
651
+ // src/localization/util.ts
652
+ var languages = ["en", "de"];
653
+ var languagesLocalNames = {
654
+ en: "English",
655
+ de: "Deutsch"
391
656
  };
392
- var ButtonUtil = {
393
- paddingMapping,
394
- iconPaddingMapping
395
- };
396
- var IconButton = ({
397
- children,
398
- disabled = false,
399
- color = "primary",
400
- size = "medium",
401
- onClick,
402
- className,
403
- ...restProps
404
- }) => {
405
- const colorClasses = {
406
- primary: "bg-button-solid-primary-background text-button-solid-primary-text",
407
- secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
408
- tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
409
- positive: "bg-button-solid-positive-background text-button-solid-positive-text",
410
- warning: "bg-button-solid-warning-background text-button-solid-warning-text",
411
- negative: "bg-button-solid-negative-background text-button-solid-negative-text",
412
- neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
413
- transparent: "bg-transparent"
414
- }[color];
415
- return /* @__PURE__ */ jsx4(
416
- "button",
417
- {
418
- onClick: disabled ? void 0 : onClick,
419
- disabled: disabled || onClick === void 0,
420
- className: clsx3(
421
- {
422
- "text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
423
- "text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
424
- "hover:bg-button-text-hover-background": !disabled && color === "transparent",
425
- [clsx3(colorClasses, "hover:brightness-90")]: !disabled
426
- },
427
- ButtonUtil.iconPaddingMapping[size],
428
- className
429
- ),
430
- ...restProps,
431
- children
432
- }
433
- );
657
+ var DEFAULT_LANGUAGE = "en";
658
+ var LanguageUtil = {
659
+ languages,
660
+ DEFAULT_LANGUAGE,
661
+ languagesLocalNames
434
662
  };
435
663
 
436
- // src/hooks/useSearch.ts
437
- import { useEffect as useEffect6, useMemo, useState as useState5 } from "react";
664
+ // src/localization/LanguageProvider.tsx
665
+ import { jsx as jsx6 } from "react/jsx-runtime";
666
+ var LanguageContext = createContext({
667
+ language: LanguageUtil.DEFAULT_LANGUAGE,
668
+ setLanguage: (v) => v
669
+ });
670
+ var useLanguage = () => useContext(LanguageContext);
438
671
 
439
- // src/util/simpleSearch.ts
440
- var MultiSearchWithMapping = (search, objects, mapping) => {
441
- return objects.filter((object) => {
442
- const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
443
- if (!mappedSearchKeywords) {
444
- return true;
445
- }
446
- return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
447
- });
672
+ // src/localization/useTranslation.ts
673
+ var TranslationPluralCount = {
674
+ zero: 0,
675
+ one: 1,
676
+ two: 2,
677
+ few: 3,
678
+ many: 11,
679
+ other: -1
448
680
  };
449
-
450
- // src/hooks/useSearch.ts
451
- var useSearch = ({
452
- list,
453
- initialSearch,
454
- searchMapping
455
- }) => {
456
- const [items, setItems] = useState5(list);
457
- const [search, setSearch] = useState5(initialSearch);
458
- useEffect6(() => {
459
- setItems(list);
460
- }, [list]);
461
- const result = useMemo(
462
- () => MultiSearchWithMapping(search, items, searchMapping),
463
- [search, items, searchMapping]
464
- );
465
- return {
466
- result,
467
- hasResult: result.length > 0,
468
- allItems: items,
469
- setItems,
470
- search,
471
- setSearch
681
+ var useTranslation = (translations, overwriteTranslation = {}) => {
682
+ const { language: languageProp, translation: overwrite } = overwriteTranslation;
683
+ const { language: inferredLanguage } = useLanguage();
684
+ const usedLanguage = languageProp ?? inferredLanguage;
685
+ const usedTranslations = [...translations];
686
+ if (overwrite) {
687
+ usedTranslations.push(overwrite);
688
+ }
689
+ return (key, options) => {
690
+ const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
691
+ try {
692
+ for (let i = translations.length - 1; i >= 0; i--) {
693
+ const translation = translations[i];
694
+ const localizedTranslation = translation[usedLanguage];
695
+ if (!localizedTranslation) {
696
+ continue;
697
+ }
698
+ const value = localizedTranslation[key];
699
+ if (!value) {
700
+ continue;
701
+ }
702
+ let forProcessing;
703
+ if (typeof value !== "string") {
704
+ if (count === TranslationPluralCount.zero && value?.zero) {
705
+ forProcessing = value.zero;
706
+ } else if (count === TranslationPluralCount.one && value?.one) {
707
+ forProcessing = value.one;
708
+ } else if (count === TranslationPluralCount.two && value?.two) {
709
+ forProcessing = value.two;
710
+ } else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
711
+ forProcessing = value.few;
712
+ } else if (count > TranslationPluralCount.many && value?.many) {
713
+ forProcessing = value.many;
714
+ } else {
715
+ forProcessing = value.other;
716
+ }
717
+ } else {
718
+ forProcessing = value;
719
+ }
720
+ forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
721
+ return replacements[placeholder] ?? `{{key:${placeholder}}}`;
722
+ });
723
+ return forProcessing;
724
+ }
725
+ } catch (e) {
726
+ console.error(e);
727
+ }
728
+ return `{{${usedLanguage}:${key}}}`;
472
729
  };
473
730
  };
474
731
 
475
732
  // src/localization/defaults/form.ts
476
733
  var formTranslation = {
477
734
  en: {
735
+ add: "Add",
478
736
  all: "All",
479
737
  apply: "Apply",
480
738
  back: "Back",
@@ -487,6 +745,7 @@ var formTranslation = {
487
745
  confirm: "Confirm",
488
746
  copy: "Copy",
489
747
  copied: "Copied",
748
+ create: "Create",
490
749
  decline: "Decline",
491
750
  delete: "Delete",
492
751
  discard: "Discard",
@@ -529,6 +788,7 @@ var formTranslation = {
529
788
  yes: "Yes"
530
789
  },
531
790
  de: {
791
+ add: "Hinzuf\xFCgen",
532
792
  all: "Alle",
533
793
  apply: "Anwenden",
534
794
  back: "Zur\xFCck",
@@ -541,6 +801,7 @@ var formTranslation = {
541
801
  confirm: "Best\xE4tigen",
542
802
  copy: "Kopieren",
543
803
  copied: "Kopiert",
804
+ create: "Erstellen",
544
805
  decline: "Ablehnen",
545
806
  delete: "L\xF6schen",
546
807
  discard: "Verwerfen",
@@ -584,186 +845,335 @@ var formTranslation = {
584
845
  }
585
846
  };
586
847
 
587
- // src/components/layout-and-navigation/SearchableList.tsx
588
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
589
- var defaultSearchableListTranslation = {
590
- en: {
591
- nothingFound: "Nothing found"
592
- },
593
- de: {
594
- nothingFound: "Nichts gefunden"
595
- }
848
+ // src/components/user-action/Button.tsx
849
+ import { forwardRef as forwardRef3 } from "react";
850
+ import clsx6 from "clsx";
851
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
852
+ var ButtonColorUtil = {
853
+ solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
854
+ text: ["primary", "negative", "neutral"],
855
+ outline: ["primary"]
596
856
  };
597
- var SearchableList = ({
598
- overwriteTranslation,
599
- list,
600
- initialSearch = "",
601
- searchMapping,
602
- autoFocus,
603
- minimumItemsForSearch = 6,
604
- itemMapper,
605
- className,
606
- resultListClassName
607
- }) => {
608
- const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
609
- const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
610
- return /* @__PURE__ */ jsxs3("div", { className: clsx4("col gap-y-2", className), children: [
611
- list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs3("div", { className: "row justify-between gap-x-4 items-center", children: [
612
- /* @__PURE__ */ jsx5(
613
- Input,
614
- {
615
- value: search,
616
- onChangeText: setSearch,
617
- placeholder: translation("search"),
618
- autoFocus,
619
- className: "w-full"
620
- }
621
- ),
622
- /* @__PURE__ */ jsx5(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx5(Search, { className: "w-full h-full" }) })
623
- ] }),
624
- 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") })
625
- ] });
857
+ var IconButtonUtil = {
858
+ icon: [...ButtonColorUtil.solid, "transparent"]
626
859
  };
627
-
628
- // src/components/layout-and-navigation/Tile.tsx
629
- import clsx5 from "clsx";
630
- import { Check } from "lucide-react";
631
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
632
- var Tile = ({
633
- title,
634
- description,
860
+ var paddingMapping = {
861
+ small: "btn-sm",
862
+ medium: "btn-md",
863
+ large: "btn-lg"
864
+ };
865
+ var iconPaddingMapping = {
866
+ tiny: "icon-btn-xs",
867
+ small: "icon-btn-sm",
868
+ medium: "icon-btn-md",
869
+ large: "icon-btn-lg"
870
+ };
871
+ var ButtonUtil = {
872
+ paddingMapping,
873
+ iconPaddingMapping
874
+ };
875
+ var SolidButton = forwardRef3(function SolidButton2({
876
+ children,
877
+ disabled = false,
878
+ color = "primary",
879
+ size = "medium",
880
+ startIcon,
881
+ endIcon,
635
882
  onClick,
636
- isSelected = false,
637
- isDisabled = false,
638
- prefix,
639
- suffix,
640
- normalClassName = "hover:bg-primary/40 cursor-pointer",
641
- selectedClassName = " bg-primary/20",
642
- disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
643
- className
644
- }) => {
645
- return /* @__PURE__ */ jsxs4(
646
- "div",
883
+ className,
884
+ ...restProps
885
+ }, ref) {
886
+ const colorClasses = {
887
+ primary: "bg-button-solid-primary-background text-button-solid-primary-text",
888
+ secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
889
+ tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
890
+ positive: "bg-button-solid-positive-background text-button-solid-positive-text",
891
+ warning: "bg-button-solid-warning-background text-button-solid-warning-text",
892
+ negative: "bg-button-solid-negative-background text-button-solid-negative-text",
893
+ neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
894
+ }[color];
895
+ const iconColorClasses = {
896
+ primary: "text-button-solid-primary-icon",
897
+ secondary: "text-button-solid-secondary-icon",
898
+ tertiary: "text-button-solid-tertiary-icon",
899
+ positive: "text-button-solid-positive-icon",
900
+ warning: "text-button-solid-warning-icon",
901
+ negative: "text-button-solid-negative-icon",
902
+ neutral: "text-button-solid-neutral-icon"
903
+ }[color];
904
+ return /* @__PURE__ */ jsxs5(
905
+ "button",
647
906
  {
648
- className: clsx5(
649
- "row gap-x-2 w-full items-center",
907
+ ref,
908
+ onClick,
909
+ disabled,
910
+ className: clsx6(
650
911
  {
651
- [normalClassName]: !!onClick && !isDisabled,
652
- [selectedClassName]: isSelected && !isDisabled,
653
- [disabledClassName]: isDisabled
912
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
913
+ [clsx6(colorClasses, "hover:brightness-90")]: !disabled
654
914
  },
915
+ ButtonUtil.paddingMapping[size],
655
916
  className
656
917
  ),
657
- onClick: isDisabled ? void 0 : onClick,
918
+ ...restProps,
658
919
  children: [
659
- prefix,
660
- /* @__PURE__ */ jsxs4("div", { className: "col gap-y-0 w-full", children: [
661
- /* @__PURE__ */ jsx6("h4", { className: clsx5(title.className ?? "textstyle-title-normal"), children: title.value }),
662
- !!description && /* @__PURE__ */ jsx6("span", { className: clsx5(description.className ?? "textstyle-description"), children: description.value })
663
- ] }),
664
- suffix ?? (isSelected ? /* @__PURE__ */ jsx6(Check, { size: 24 }) : void 0)
920
+ startIcon && /* @__PURE__ */ jsx7(
921
+ "span",
922
+ {
923
+ className: clsx6({
924
+ [iconColorClasses]: !disabled,
925
+ [`text-disabled-icon`]: disabled
926
+ }),
927
+ children: startIcon
928
+ }
929
+ ),
930
+ children,
931
+ endIcon && /* @__PURE__ */ jsx7(
932
+ "span",
933
+ {
934
+ className: clsx6({
935
+ [iconColorClasses]: !disabled,
936
+ [`text-disabled-icon`]: disabled
937
+ }),
938
+ children: endIcon
939
+ }
940
+ )
665
941
  ]
666
942
  }
667
943
  );
944
+ });
945
+ var IconButton = ({
946
+ children,
947
+ disabled = false,
948
+ color = "primary",
949
+ size = "medium",
950
+ className,
951
+ ...restProps
952
+ }) => {
953
+ const colorClasses = {
954
+ primary: "bg-button-solid-primary-background text-button-solid-primary-text",
955
+ secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
956
+ tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
957
+ positive: "bg-button-solid-positive-background text-button-solid-positive-text",
958
+ warning: "bg-button-solid-warning-background text-button-solid-warning-text",
959
+ negative: "bg-button-solid-negative-background text-button-solid-negative-text",
960
+ neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
961
+ transparent: "bg-transparent"
962
+ }[color];
963
+ return /* @__PURE__ */ jsx7(
964
+ "button",
965
+ {
966
+ disabled,
967
+ className: clsx6(
968
+ {
969
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
970
+ "text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
971
+ "hover:bg-button-text-hover-background": !disabled && color === "transparent",
972
+ [clsx6(colorClasses, "hover:brightness-90")]: !disabled
973
+ },
974
+ ButtonUtil.iconPaddingMapping[size],
975
+ className
976
+ ),
977
+ ...restProps,
978
+ children
979
+ }
980
+ );
668
981
  };
669
982
 
670
- // src/hooks/useOutsideClick.ts
671
- import { useEffect as useEffect7 } from "react";
672
- var useOutsideClick = (refs, handler) => {
673
- useEffect7(() => {
674
- const listener = (event) => {
675
- if (event.target === null) return;
676
- if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
677
- return;
983
+ // src/components/user-action/SearchBar.tsx
984
+ import { Search } from "lucide-react";
985
+ import { clsx as clsx7 } from "clsx";
986
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
987
+ var SearchBar = ({
988
+ placeholder,
989
+ onSearch,
990
+ disableOnSearch,
991
+ containerClassName,
992
+ ...inputProps
993
+ }) => {
994
+ const translation = useTranslation([formTranslation]);
995
+ return /* @__PURE__ */ jsxs6("div", { className: clsx7("flex-row-2 justify-between items-center", containerClassName), children: [
996
+ /* @__PURE__ */ jsx8(
997
+ Input,
998
+ {
999
+ ...inputProps,
1000
+ placeholder: placeholder ?? translation("search")
678
1001
  }
679
- handler();
680
- };
681
- document.addEventListener("mousedown", listener);
682
- document.addEventListener("touchstart", listener);
683
- return () => {
684
- document.removeEventListener("mousedown", listener);
685
- document.removeEventListener("touchstart", listener);
686
- };
687
- }, [refs, handler]);
1002
+ ),
1003
+ onSearch && /* @__PURE__ */ jsx8(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ jsx8(Search, { className: "w-full h-full" }) })
1004
+ ] });
1005
+ };
1006
+
1007
+ // src/hooks/useSearch.ts
1008
+ import { useCallback as useCallback4, useEffect as useEffect10, useMemo, useState as useState8 } from "react";
1009
+
1010
+ // src/util/simpleSearch.ts
1011
+ var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
1012
+ return objects.filter((object) => {
1013
+ const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
1014
+ if (!mappedSearchKeywords) {
1015
+ return true;
1016
+ }
1017
+ return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
1018
+ });
1019
+ };
1020
+
1021
+ // src/hooks/useSearch.ts
1022
+ var useSearch = ({
1023
+ list,
1024
+ initialSearch,
1025
+ searchMapping,
1026
+ additionalSearchTags,
1027
+ isSearchInstant = true,
1028
+ sortingFunction,
1029
+ filter,
1030
+ disabled = false
1031
+ }) => {
1032
+ const [search, setSearch] = useState8(initialSearch ?? "");
1033
+ const [result, setResult] = useState8(list);
1034
+ const searchTags = useMemo(() => additionalSearchTags ?? [], [additionalSearchTags]);
1035
+ const updateSearch = useCallback4((newSearch) => {
1036
+ const usedSearch = newSearch ?? search;
1037
+ if (newSearch) {
1038
+ setSearch(search);
1039
+ }
1040
+ setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
1041
+ }, [searchTags, list, search, searchMapping]);
1042
+ useEffect10(() => {
1043
+ if (isSearchInstant) {
1044
+ setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
1045
+ }
1046
+ }, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
1047
+ const filteredResult = useMemo(() => {
1048
+ if (!filter) {
1049
+ return result;
1050
+ }
1051
+ return result.filter(filter);
1052
+ }, [result, filter]);
1053
+ const sortedAndFilteredResult = useMemo(() => {
1054
+ if (!sortingFunction) {
1055
+ return filteredResult;
1056
+ }
1057
+ return filteredResult.sort(sortingFunction);
1058
+ }, [filteredResult, sortingFunction]);
1059
+ const usedResult = useMemo(() => {
1060
+ if (!disabled) {
1061
+ return sortedAndFilteredResult;
1062
+ }
1063
+ return list;
1064
+ }, [disabled, list, sortedAndFilteredResult]);
1065
+ return {
1066
+ result: usedResult,
1067
+ hasResult: usedResult.length > 0,
1068
+ allItems: list,
1069
+ updateSearch,
1070
+ search,
1071
+ setSearch
1072
+ };
688
1073
  };
689
1074
 
690
1075
  // src/components/user-action/Select.tsx
691
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1076
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1077
+ var SelectTile = ({
1078
+ className,
1079
+ disabledClassName,
1080
+ title,
1081
+ ...restProps
1082
+ }) => {
1083
+ return /* @__PURE__ */ jsx9(
1084
+ Tile,
1085
+ {
1086
+ ...restProps,
1087
+ className: clsx8("px-2 py-1 rounded-md", className),
1088
+ disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
1089
+ title: { ...title, className: title.className ?? "font-semibold" }
1090
+ }
1091
+ );
1092
+ };
692
1093
  var Select = ({
693
1094
  value,
694
1095
  label,
695
1096
  options,
696
1097
  onChange,
697
1098
  hintText = "",
698
- isDisabled,
699
- isSearchEnabled = false,
1099
+ selectedDisplayOverwrite,
1100
+ searchOptions,
1101
+ additionalItems,
700
1102
  className,
701
- selectedDisplayOverwrite
1103
+ triggerClassName,
1104
+ hintTextClassName,
1105
+ ...menuProps
702
1106
  }) => {
703
- const triggerRef = useRef2(null);
704
- const menuRef = useRef2(null);
705
- const [isOpen, setIsOpen] = useState6(false);
706
- useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
707
1107
  const selectedOption = options.find((option) => option.value === value);
708
1108
  if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
709
1109
  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");
710
1110
  }
711
1111
  const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
712
- return /* @__PURE__ */ jsxs5("div", { className: clsx6(className), children: [
713
- label && /* @__PURE__ */ jsx7(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx6("mb-1", label.className) }),
714
- /* @__PURE__ */ jsxs5("div", { className: "relative", children: [
715
- /* @__PURE__ */ jsxs5(
716
- "button",
717
- {
718
- ref: triggerRef,
719
- className: clsx6(
720
- "btn-md justify-between w-full border-2",
721
- {
722
- "rounded-b-lg": !open,
723
- "bg-menu-background border-menu-border hover:border-primary": !isDisabled,
724
- "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
725
- }
726
- ),
727
- onClick: () => setIsOpen(!isOpen),
728
- disabled: isDisabled,
729
- children: [
730
- !isShowingHint && /* @__PURE__ */ jsx7("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? selectedOption?.label }),
731
- isShowingHint && /* @__PURE__ */ jsx7("span", { className: "textstyle-description", children: hintText }),
732
- isOpen ? /* @__PURE__ */ jsx7(ChevronUp, {}) : /* @__PURE__ */ jsx7(ChevronDown, {})
733
- ]
734
- }
735
- ),
736
- isOpen && /* @__PURE__ */ jsx7(
737
- "div",
738
- {
739
- ref: menuRef,
740
- className: "absolute w-full z-10 rounded-lg mt-0.5 bg-menu-background text-menu-text shadow-around-lg max-h-[500px] overflow-y-auto p-2",
741
- children: /* @__PURE__ */ jsx7(
742
- SearchableList,
743
- {
744
- list: options,
745
- minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
746
- searchMapping: (item) => item.searchTags,
747
- itemMapper: (option, index) => /* @__PURE__ */ jsx7(
748
- Tile,
1112
+ const { result, search, setSearch } = useSearch({
1113
+ list: options,
1114
+ searchMapping: useCallback5((item) => item.searchTags, []),
1115
+ ...searchOptions
1116
+ });
1117
+ return /* @__PURE__ */ jsxs7("div", { className: clsx8(className), children: [
1118
+ label && /* @__PURE__ */ jsx9(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx8("mb-1", label.className) }),
1119
+ /* @__PURE__ */ jsx9(
1120
+ Menu,
1121
+ {
1122
+ ...menuProps,
1123
+ trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ jsxs7(
1124
+ "button",
1125
+ {
1126
+ ref,
1127
+ className: clsx8(
1128
+ "btn-md justify-between w-full border-2",
1129
+ {
1130
+ "rounded-b-lg": !open,
1131
+ "bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
1132
+ "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
1133
+ },
1134
+ triggerClassName
1135
+ ),
1136
+ onClick: toggleOpen,
1137
+ disabled,
1138
+ children: [
1139
+ !isShowingHint && /* @__PURE__ */ jsx9("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? selectedOption?.label }),
1140
+ isShowingHint && /* @__PURE__ */ jsx9("span", { className: clsx8("textstyle-description", hintTextClassName), children: hintText }),
1141
+ /* @__PURE__ */ jsx9(ExpansionIcon, { isExpanded: isOpen })
1142
+ ]
1143
+ }
1144
+ ),
1145
+ menuClassName: clsx8("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
1146
+ children: (bag) => {
1147
+ const { close } = bag;
1148
+ return /* @__PURE__ */ jsxs7(Fragment2, { children: [
1149
+ !searchOptions?.disabled && /* @__PURE__ */ jsx9(
1150
+ SearchBar,
1151
+ {
1152
+ value: search,
1153
+ onChangeText: setSearch,
1154
+ autoFocus: true
1155
+ }
1156
+ ),
1157
+ /* @__PURE__ */ jsxs7("div", { className: "flex-col-2 overflow-y-auto", children: [
1158
+ result.map((option, index) => /* @__PURE__ */ jsx9(
1159
+ SelectTile,
749
1160
  {
750
- isSelected: selectedOption?.value === option.value,
751
- className: "px-2 py-1 rounded-md",
752
- disabledClassName: "text-disabled-text cursor-not-allowed",
753
- title: { value: option.label, className: "font-semibold" },
1161
+ isSelected: option === selectedOption,
1162
+ title: { value: option.label },
754
1163
  onClick: () => {
755
1164
  onChange(option.value);
756
- setIsOpen(false);
1165
+ close();
757
1166
  },
758
- isDisabled: option.disabled
1167
+ disabled: option.disabled
759
1168
  },
760
1169
  index
761
- )
762
- }
763
- )
1170
+ )),
1171
+ additionalItems && additionalItems({ ...bag, search, selected: value })
1172
+ ] })
1173
+ ] });
764
1174
  }
765
- )
766
- ] })
1175
+ }
1176
+ )
767
1177
  ] });
768
1178
  };
769
1179
  var SelectUncontrolled = ({
@@ -773,13 +1183,13 @@ var SelectUncontrolled = ({
773
1183
  hintText,
774
1184
  ...props
775
1185
  }) => {
776
- const [selected, setSelected] = useState6(value);
777
- useEffect8(() => {
1186
+ const [selected, setSelected] = useState9(value);
1187
+ useEffect11(() => {
778
1188
  if (options.find((options2) => options2.value === value)) {
779
1189
  setSelected(value);
780
1190
  }
781
1191
  }, [options, value]);
782
- return /* @__PURE__ */ jsx7(
1192
+ return /* @__PURE__ */ jsx9(
783
1193
  Select,
784
1194
  {
785
1195
  value: selected,
@@ -795,6 +1205,7 @@ var SelectUncontrolled = ({
795
1205
  };
796
1206
  export {
797
1207
  Select,
1208
+ SelectTile,
798
1209
  SelectUncontrolled
799
1210
  };
800
1211
  //# sourceMappingURL=Select.mjs.map