@helpwave/hightide 0.1.18 → 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 (253) 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 -9
  60. package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
  61. package/dist/components/layout-and-navigation/Pagination.mjs +79 -6
  62. package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
  63. package/dist/components/layout-and-navigation/SearchableList.js +127 -25
  64. package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
  65. package/dist/components/layout-and-navigation/SearchableList.mjs +126 -24
  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 -28
  106. package/dist/components/modals/InputModal.js.map +1 -1
  107. package/dist/components/modals/InputModal.mjs +18 -14
  108. package/dist/components/modals/InputModal.mjs.map +1 -1
  109. package/dist/components/modals/LanguageModal.js +728 -434
  110. package/dist/components/modals/LanguageModal.js.map +1 -1
  111. package/dist/components/modals/LanguageModal.mjs +728 -430
  112. package/dist/components/modals/LanguageModal.mjs.map +1 -1
  113. package/dist/components/modals/ThemeModal.js +732 -438
  114. package/dist/components/modals/ThemeModal.js.map +1 -1
  115. package/dist/components/modals/ThemeModal.mjs +731 -433
  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 -41
  122. package/dist/components/properties/DateProperty.js.map +1 -1
  123. package/dist/components/properties/DateProperty.mjs +114 -37
  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 -463
  128. package/dist/components/properties/MultiSelectProperty.js.map +1 -1
  129. package/dist/components/properties/MultiSelectProperty.mjs +920 -464
  130. package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
  131. package/dist/components/properties/NumberProperty.js +101 -18
  132. package/dist/components/properties/NumberProperty.js.map +1 -1
  133. package/dist/components/properties/NumberProperty.mjs +101 -18
  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 -243
  142. package/dist/components/properties/SelectProperty.js.map +1 -1
  143. package/dist/components/properties/SelectProperty.mjs +686 -243
  144. package/dist/components/properties/SelectProperty.mjs.map +1 -1
  145. package/dist/components/properties/TextProperty.js +133 -46
  146. package/dist/components/properties/TextProperty.js.map +1 -1
  147. package/dist/components/properties/TextProperty.mjs +133 -46
  148. package/dist/components/properties/TextProperty.mjs.map +1 -1
  149. package/dist/components/table/Table.js +285 -185
  150. package/dist/components/table/Table.js.map +1 -1
  151. package/dist/components/table/Table.mjs +270 -166
  152. package/dist/components/table/Table.mjs.map +1 -1
  153. package/dist/components/table/TableFilterButton.js +179 -78
  154. package/dist/components/table/TableFilterButton.js.map +1 -1
  155. package/dist/components/table/TableFilterButton.mjs +160 -55
  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/Menu.d.mts +11 -6
  180. package/dist/components/user-action/Menu.d.ts +11 -6
  181. package/dist/components/user-action/Menu.js +128 -31
  182. package/dist/components/user-action/Menu.js.map +1 -1
  183. package/dist/components/user-action/Menu.mjs +134 -33
  184. package/dist/components/user-action/Menu.mjs.map +1 -1
  185. package/dist/components/user-action/MultiSelect.d.mts +17 -7
  186. package/dist/components/user-action/MultiSelect.d.ts +17 -7
  187. package/dist/components/user-action/MultiSelect.js +796 -375
  188. package/dist/components/user-action/MultiSelect.js.map +1 -1
  189. package/dist/components/user-action/MultiSelect.mjs +781 -356
  190. package/dist/components/user-action/MultiSelect.mjs.map +1 -1
  191. package/dist/components/user-action/ScrollPicker.js +2 -2
  192. package/dist/components/user-action/ScrollPicker.js.map +1 -1
  193. package/dist/components/user-action/ScrollPicker.mjs +2 -2
  194. package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
  195. package/dist/components/user-action/SearchBar.d.mts +14 -0
  196. package/dist/components/user-action/SearchBar.d.ts +14 -0
  197. package/dist/components/user-action/SearchBar.js +673 -0
  198. package/dist/components/user-action/SearchBar.js.map +1 -0
  199. package/dist/components/user-action/SearchBar.mjs +637 -0
  200. package/dist/components/user-action/SearchBar.mjs.map +1 -0
  201. package/dist/components/user-action/Select.d.mts +18 -5
  202. package/dist/components/user-action/Select.d.ts +18 -5
  203. package/dist/components/user-action/Select.js +764 -355
  204. package/dist/components/user-action/Select.js.map +1 -1
  205. package/dist/components/user-action/Select.mjs +761 -349
  206. package/dist/components/user-action/Select.mjs.map +1 -1
  207. package/dist/components/user-action/Textarea.d.mts +1 -1
  208. package/dist/components/user-action/Textarea.d.ts +1 -1
  209. package/dist/components/user-action/Textarea.js +13 -3
  210. package/dist/components/user-action/Textarea.js.map +1 -1
  211. package/dist/components/user-action/Textarea.mjs +13 -3
  212. package/dist/components/user-action/Textarea.mjs.map +1 -1
  213. package/dist/components/user-action/ToggleableInput.js +2 -2
  214. package/dist/components/user-action/ToggleableInput.js.map +1 -1
  215. package/dist/components/user-action/ToggleableInput.mjs +2 -2
  216. package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
  217. package/dist/css/globals.css +251 -113
  218. package/dist/css/uncompiled/globals.css +19 -13
  219. package/dist/css/uncompiled/theme/colors-component.css +12 -3
  220. package/dist/css/uncompiled/theme/colors-semantic.css +10 -7
  221. package/dist/css/uncompiled/utitlity/animation.css +70 -1
  222. package/dist/css/uncompiled/utitlity/general.css +16 -0
  223. package/dist/hooks/usePopoverPosition.d.mts +15 -0
  224. package/dist/hooks/usePopoverPosition.d.ts +15 -0
  225. package/dist/hooks/usePopoverPosition.js +81 -0
  226. package/dist/hooks/usePopoverPosition.js.map +1 -0
  227. package/dist/hooks/usePopoverPosition.mjs +57 -0
  228. package/dist/hooks/usePopoverPosition.mjs.map +1 -0
  229. package/dist/hooks/useSearch.d.mts +7 -2
  230. package/dist/hooks/useSearch.d.ts +7 -2
  231. package/dist/hooks/useSearch.js +44 -15
  232. package/dist/hooks/useSearch.js.map +1 -1
  233. package/dist/hooks/useSearch.mjs +45 -16
  234. package/dist/hooks/useSearch.mjs.map +1 -1
  235. package/dist/index.d.mts +6 -4
  236. package/dist/index.d.ts +6 -4
  237. package/dist/index.js +1102 -819
  238. package/dist/index.js.map +1 -1
  239. package/dist/index.mjs +1001 -718
  240. package/dist/index.mjs.map +1 -1
  241. package/dist/localization/defaults/form.d.mts +2 -0
  242. package/dist/localization/defaults/form.d.ts +2 -0
  243. package/dist/localization/defaults/form.js +4 -0
  244. package/dist/localization/defaults/form.js.map +1 -1
  245. package/dist/localization/defaults/form.mjs +4 -0
  246. package/dist/localization/defaults/form.mjs.map +1 -1
  247. package/dist/util/simpleSearch.d.mts +1 -1
  248. package/dist/util/simpleSearch.d.ts +1 -1
  249. package/dist/util/simpleSearch.js +4 -1
  250. package/dist/util/simpleSearch.js.map +1 -1
  251. package/dist/util/simpleSearch.mjs +4 -1
  252. package/dist/util/simpleSearch.mjs.map +1 -1
  253. 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,12 +421,12 @@ 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);
@@ -156,9 +435,6 @@ function useDelay(options) {
156
435
  return { restartTimer, clearTimer, hasActiveTimer: !!timer };
157
436
  }
158
437
 
159
- // src/util/noop.ts
160
- var noop = () => void 0;
161
-
162
438
  // src/hooks/useFocusManagement.ts
163
439
  import { useCallback as useCallback2 } from "react";
164
440
  function useFocusManagement() {
@@ -217,10 +493,10 @@ function useFocusManagement() {
217
493
  }
218
494
 
219
495
  // src/hooks/useFocusOnceVisible.ts
220
- import React, { useEffect as useEffect4 } from "react";
496
+ import React, { useEffect as useEffect6 } from "react";
221
497
  var useFocusOnceVisible = (ref, disable = false) => {
222
498
  const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
223
- useEffect4(() => {
499
+ useEffect6(() => {
224
500
  if (disable || hasUsedFocus) {
225
501
  return;
226
502
  }
@@ -240,9 +516,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
240
516
  };
241
517
 
242
518
  // src/components/user-action/Input.tsx
243
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
519
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
244
520
  var getInputClassName = ({ disabled = false, hasError = false }) => {
245
- return clsx2(
521
+ return clsx5(
246
522
  "px-2 py-1.5 rounded-md border-2",
247
523
  {
248
524
  "bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
@@ -256,7 +532,7 @@ var defaultEditCompleteOptions = {
256
532
  afterDelay: true,
257
533
  delay: 2500
258
534
  };
259
- var Input = forwardRef(function Input2({
535
+ var Input = forwardRef2(function Input2({
260
536
  id,
261
537
  type = "text",
262
538
  value,
@@ -279,7 +555,7 @@ var Input = forwardRef(function Input2({
279
555
  restartTimer,
280
556
  clearTimer
281
557
  } = useDelay({ delay, disabled: !afterDelay });
282
- const innerRef = useRef(null);
558
+ const innerRef = useRef2(null);
283
559
  const { focusNext } = useFocusManagement();
284
560
  useFocusOnceVisible(innerRef, !autoFocus);
285
561
  useImperativeHandle(forwardedRef, () => innerRef.current);
@@ -290,9 +566,9 @@ var Input = forwardRef(function Input2({
290
566
  focusNext();
291
567
  }
292
568
  };
293
- return /* @__PURE__ */ jsxs("div", { className: clsx2({ "w-full": expanded }, containerClassName), children: [
294
- label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx2("mb-1", label.className) }),
295
- /* @__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(
296
572
  "input",
297
573
  {
298
574
  ...restProps,
@@ -301,7 +577,7 @@ var Input = forwardRef(function Input2({
301
577
  id,
302
578
  type,
303
579
  disabled,
304
- className: clsx2(getInputClassName({ disabled }), className),
580
+ className: clsx5(getInputClassName({ disabled }), className),
305
581
  onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
306
582
  onBlur: (event) => {
307
583
  onBlur?.(event);
@@ -331,7 +607,7 @@ var Input = forwardRef(function Input2({
331
607
  )
332
608
  ] });
333
609
  });
334
- var FormInput = forwardRef(function FormInput2({
610
+ var FormInput = forwardRef2(function FormInput2({
335
611
  id,
336
612
  labelText,
337
613
  errorText,
@@ -343,137 +619,120 @@ var FormInput = forwardRef(function FormInput2({
343
619
  disabled,
344
620
  ...restProps
345
621
  }, ref) {
346
- const input = /* @__PURE__ */ jsx3(
622
+ const input = /* @__PURE__ */ jsx5(
347
623
  "input",
348
624
  {
349
625
  ...restProps,
350
626
  ref,
351
627
  id,
352
628
  disabled,
353
- className: clsx2(
629
+ className: clsx5(
354
630
  getInputClassName({ disabled, hasError: !!errorText }),
355
631
  className
356
632
  )
357
633
  }
358
634
  );
359
- return /* @__PURE__ */ jsxs("div", { className: clsx2("flex flex-col gap-y-1", containerClassName), children: [
360
- 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: [
361
637
  labelText,
362
- required && /* @__PURE__ */ jsx3("span", { className: "text-primary font-bold", children: "*" })
638
+ required && /* @__PURE__ */ jsx5("span", { className: "text-primary font-bold", children: "*" })
363
639
  ] }),
364
640
  input,
365
- 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 })
366
642
  ] });
367
643
  });
368
644
 
369
- // src/components/user-action/Button.tsx
370
- import clsx3 from "clsx";
371
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
372
- var ButtonColorUtil = {
373
- solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
374
- text: ["primary", "negative", "neutral"],
375
- outline: ["primary"]
376
- };
377
- var IconButtonUtil = {
378
- icon: [...ButtonColorUtil.solid, "transparent"]
379
- };
380
- var paddingMapping = {
381
- small: "btn-sm",
382
- medium: "btn-md",
383
- large: "btn-lg"
384
- };
385
- var iconPaddingMapping = {
386
- tiny: "icon-btn-xs",
387
- small: "icon-btn-sm",
388
- medium: "icon-btn-md",
389
- 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"
390
656
  };
391
- var ButtonUtil = {
392
- paddingMapping,
393
- iconPaddingMapping
394
- };
395
- var IconButton = ({
396
- children,
397
- disabled = false,
398
- color = "primary",
399
- size = "medium",
400
- onClick,
401
- className,
402
- ...restProps
403
- }) => {
404
- const colorClasses = {
405
- primary: "bg-button-solid-primary-background text-button-solid-primary-text",
406
- secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
407
- tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
408
- positive: "bg-button-solid-positive-background text-button-solid-positive-text",
409
- warning: "bg-button-solid-warning-background text-button-solid-warning-text",
410
- negative: "bg-button-solid-negative-background text-button-solid-negative-text",
411
- neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
412
- transparent: "bg-transparent"
413
- }[color];
414
- return /* @__PURE__ */ jsx4(
415
- "button",
416
- {
417
- onClick: disabled ? void 0 : onClick,
418
- disabled: disabled || onClick === void 0,
419
- className: clsx3(
420
- {
421
- "text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
422
- "text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
423
- "hover:bg-button-text-hover-background": !disabled && color === "transparent",
424
- [clsx3(colorClasses, "hover:brightness-90")]: !disabled
425
- },
426
- ButtonUtil.iconPaddingMapping[size],
427
- className
428
- ),
429
- ...restProps,
430
- children
431
- }
432
- );
657
+ var DEFAULT_LANGUAGE = "en";
658
+ var LanguageUtil = {
659
+ languages,
660
+ DEFAULT_LANGUAGE,
661
+ languagesLocalNames
433
662
  };
434
663
 
435
- // src/hooks/useSearch.ts
436
- 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);
437
671
 
438
- // src/util/simpleSearch.ts
439
- var MultiSearchWithMapping = (search, objects, mapping) => {
440
- return objects.filter((object) => {
441
- const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
442
- if (!mappedSearchKeywords) {
443
- return true;
444
- }
445
- return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
446
- });
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
447
680
  };
448
-
449
- // src/hooks/useSearch.ts
450
- var useSearch = ({
451
- list,
452
- initialSearch,
453
- searchMapping
454
- }) => {
455
- const [items, setItems] = useState5(list);
456
- const [search, setSearch] = useState5(initialSearch);
457
- useEffect6(() => {
458
- setItems(list);
459
- }, [list]);
460
- const result = useMemo(
461
- () => MultiSearchWithMapping(search, items, searchMapping),
462
- [search, items, searchMapping]
463
- );
464
- return {
465
- result,
466
- hasResult: result.length > 0,
467
- allItems: items,
468
- setItems,
469
- search,
470
- 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}}}`;
471
729
  };
472
730
  };
473
731
 
474
732
  // src/localization/defaults/form.ts
475
733
  var formTranslation = {
476
734
  en: {
735
+ add: "Add",
477
736
  all: "All",
478
737
  apply: "Apply",
479
738
  back: "Back",
@@ -486,6 +745,7 @@ var formTranslation = {
486
745
  confirm: "Confirm",
487
746
  copy: "Copy",
488
747
  copied: "Copied",
748
+ create: "Create",
489
749
  decline: "Decline",
490
750
  delete: "Delete",
491
751
  discard: "Discard",
@@ -528,6 +788,7 @@ var formTranslation = {
528
788
  yes: "Yes"
529
789
  },
530
790
  de: {
791
+ add: "Hinzuf\xFCgen",
531
792
  all: "Alle",
532
793
  apply: "Anwenden",
533
794
  back: "Zur\xFCck",
@@ -540,6 +801,7 @@ var formTranslation = {
540
801
  confirm: "Best\xE4tigen",
541
802
  copy: "Kopieren",
542
803
  copied: "Kopiert",
804
+ create: "Erstellen",
543
805
  decline: "Ablehnen",
544
806
  delete: "L\xF6schen",
545
807
  discard: "Verwerfen",
@@ -583,186 +845,335 @@ var formTranslation = {
583
845
  }
584
846
  };
585
847
 
586
- // src/components/layout-and-navigation/SearchableList.tsx
587
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
588
- var defaultSearchableListTranslation = {
589
- en: {
590
- nothingFound: "Nothing found"
591
- },
592
- de: {
593
- nothingFound: "Nichts gefunden"
594
- }
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"]
595
856
  };
596
- var SearchableList = ({
597
- overwriteTranslation,
598
- list,
599
- initialSearch = "",
600
- searchMapping,
601
- autoFocus,
602
- minimumItemsForSearch = 6,
603
- itemMapper,
604
- className,
605
- resultListClassName
606
- }) => {
607
- const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
608
- const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
609
- return /* @__PURE__ */ jsxs3("div", { className: clsx4("col gap-y-2", className), children: [
610
- list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs3("div", { className: "row justify-between gap-x-4 items-center", children: [
611
- /* @__PURE__ */ jsx5(
612
- Input,
613
- {
614
- value: search,
615
- onChangeText: setSearch,
616
- placeholder: translation("search"),
617
- autoFocus,
618
- className: "w-full"
619
- }
620
- ),
621
- /* @__PURE__ */ jsx5(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx5(Search, { className: "w-full h-full" }) })
622
- ] }),
623
- 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") })
624
- ] });
857
+ var IconButtonUtil = {
858
+ icon: [...ButtonColorUtil.solid, "transparent"]
625
859
  };
626
-
627
- // src/components/layout-and-navigation/Tile.tsx
628
- import clsx5 from "clsx";
629
- import { Check } from "lucide-react";
630
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
631
- var Tile = ({
632
- title,
633
- 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,
634
882
  onClick,
635
- isSelected = false,
636
- isDisabled = false,
637
- prefix,
638
- suffix,
639
- normalClassName = "hover:bg-primary/40 cursor-pointer",
640
- selectedClassName = " bg-primary/20",
641
- disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
642
- className
643
- }) => {
644
- return /* @__PURE__ */ jsxs4(
645
- "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",
646
906
  {
647
- className: clsx5(
648
- "row gap-x-2 w-full items-center",
907
+ ref,
908
+ onClick,
909
+ disabled,
910
+ className: clsx6(
649
911
  {
650
- [normalClassName]: !!onClick && !isDisabled,
651
- [selectedClassName]: isSelected && !isDisabled,
652
- [disabledClassName]: isDisabled
912
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
913
+ [clsx6(colorClasses, "hover:brightness-90")]: !disabled
653
914
  },
915
+ ButtonUtil.paddingMapping[size],
654
916
  className
655
917
  ),
656
- onClick: isDisabled ? void 0 : onClick,
918
+ ...restProps,
657
919
  children: [
658
- prefix,
659
- /* @__PURE__ */ jsxs4("div", { className: "col gap-y-0 w-full", children: [
660
- /* @__PURE__ */ jsx6("h4", { className: clsx5(title.className ?? "textstyle-title-normal"), children: title.value }),
661
- !!description && /* @__PURE__ */ jsx6("span", { className: clsx5(description.className ?? "textstyle-description"), children: description.value })
662
- ] }),
663
- 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
+ )
664
941
  ]
665
942
  }
666
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
+ );
667
981
  };
668
982
 
669
- // src/hooks/useOutsideClick.ts
670
- import { useEffect as useEffect7 } from "react";
671
- var useOutsideClick = (refs, handler) => {
672
- useEffect7(() => {
673
- const listener = (event) => {
674
- if (event.target === null) return;
675
- if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
676
- 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")
677
1001
  }
678
- handler();
679
- };
680
- document.addEventListener("mousedown", listener);
681
- document.addEventListener("touchstart", listener);
682
- return () => {
683
- document.removeEventListener("mousedown", listener);
684
- document.removeEventListener("touchstart", listener);
685
- };
686
- }, [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
+ };
687
1073
  };
688
1074
 
689
1075
  // src/components/user-action/Select.tsx
690
- 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
+ };
691
1093
  var Select = ({
692
1094
  value,
693
1095
  label,
694
1096
  options,
695
1097
  onChange,
696
1098
  hintText = "",
697
- isDisabled,
698
- isSearchEnabled = false,
1099
+ selectedDisplayOverwrite,
1100
+ searchOptions,
1101
+ additionalItems,
699
1102
  className,
700
- selectedDisplayOverwrite
1103
+ triggerClassName,
1104
+ hintTextClassName,
1105
+ ...menuProps
701
1106
  }) => {
702
- const triggerRef = useRef2(null);
703
- const menuRef = useRef2(null);
704
- const [isOpen, setIsOpen] = useState6(false);
705
- useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
706
1107
  const selectedOption = options.find((option) => option.value === value);
707
1108
  if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
708
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");
709
1110
  }
710
1111
  const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
711
- return /* @__PURE__ */ jsxs5("div", { className: clsx6(className), children: [
712
- label && /* @__PURE__ */ jsx7(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx6("mb-1", label.className) }),
713
- /* @__PURE__ */ jsxs5("div", { className: "relative", children: [
714
- /* @__PURE__ */ jsxs5(
715
- "button",
716
- {
717
- ref: triggerRef,
718
- className: clsx6(
719
- "btn-md justify-between w-full border-2",
720
- {
721
- "rounded-b-lg": !open,
722
- "bg-menu-background border-menu-border hover:border-primary": !isDisabled,
723
- "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
724
- }
725
- ),
726
- onClick: () => setIsOpen(!isOpen),
727
- disabled: isDisabled,
728
- children: [
729
- !isShowingHint && /* @__PURE__ */ jsx7("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? selectedOption?.label }),
730
- isShowingHint && /* @__PURE__ */ jsx7("span", { className: "textstyle-description", children: hintText }),
731
- isOpen ? /* @__PURE__ */ jsx7(ChevronUp, {}) : /* @__PURE__ */ jsx7(ChevronDown, {})
732
- ]
733
- }
734
- ),
735
- isOpen && /* @__PURE__ */ jsx7(
736
- "div",
737
- {
738
- ref: menuRef,
739
- 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",
740
- children: /* @__PURE__ */ jsx7(
741
- SearchableList,
742
- {
743
- list: options,
744
- minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
745
- searchMapping: (item) => item.searchTags,
746
- itemMapper: (option, index) => /* @__PURE__ */ jsx7(
747
- 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,
748
1160
  {
749
- isSelected: selectedOption?.value === option.value,
750
- className: "px-2 py-1 rounded-md",
751
- disabledClassName: "text-disabled-text cursor-not-allowed",
752
- title: { value: option.label, className: "font-semibold" },
1161
+ isSelected: option === selectedOption,
1162
+ title: { value: option.label },
753
1163
  onClick: () => {
754
1164
  onChange(option.value);
755
- setIsOpen(false);
1165
+ close();
756
1166
  },
757
- isDisabled: option.disabled
1167
+ disabled: option.disabled
758
1168
  },
759
1169
  index
760
- )
761
- }
762
- )
1170
+ )),
1171
+ additionalItems && additionalItems({ ...bag, search, selected: value })
1172
+ ] })
1173
+ ] });
763
1174
  }
764
- )
765
- ] })
1175
+ }
1176
+ )
766
1177
  ] });
767
1178
  };
768
1179
  var SelectUncontrolled = ({
@@ -772,13 +1183,13 @@ var SelectUncontrolled = ({
772
1183
  hintText,
773
1184
  ...props
774
1185
  }) => {
775
- const [selected, setSelected] = useState6(value);
776
- useEffect8(() => {
1186
+ const [selected, setSelected] = useState9(value);
1187
+ useEffect11(() => {
777
1188
  if (options.find((options2) => options2.value === value)) {
778
1189
  setSelected(value);
779
1190
  }
780
1191
  }, [options, value]);
781
- return /* @__PURE__ */ jsx7(
1192
+ return /* @__PURE__ */ jsx9(
782
1193
  Select,
783
1194
  {
784
1195
  value: selected,
@@ -794,6 +1205,7 @@ var SelectUncontrolled = ({
794
1205
  };
795
1206
  export {
796
1207
  Select,
1208
+ SelectTile,
797
1209
  SelectUncontrolled
798
1210
  };
799
1211
  //# sourceMappingURL=Select.mjs.map