@helpwave/hightide 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/dist/components/branding/HelpwaveBadge.js +30 -8
  2. package/dist/components/branding/HelpwaveBadge.js.map +1 -1
  3. package/dist/components/branding/HelpwaveBadge.mjs +30 -8
  4. package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
  5. package/dist/components/date/DatePicker.d.mts +3 -4
  6. package/dist/components/date/DatePicker.d.ts +3 -4
  7. package/dist/components/date/DatePicker.js +135 -33
  8. package/dist/components/date/DatePicker.js.map +1 -1
  9. package/dist/components/date/DatePicker.mjs +135 -33
  10. package/dist/components/date/DatePicker.mjs.map +1 -1
  11. package/dist/components/date/DayPicker.d.mts +1 -1
  12. package/dist/components/date/DayPicker.d.ts +1 -1
  13. package/dist/components/date/DayPicker.js +23 -11
  14. package/dist/components/date/DayPicker.js.map +1 -1
  15. package/dist/components/date/DayPicker.mjs +23 -11
  16. package/dist/components/date/DayPicker.mjs.map +1 -1
  17. package/dist/components/date/TimeDisplay.d.mts +5 -19
  18. package/dist/components/date/TimeDisplay.d.ts +5 -19
  19. package/dist/components/date/TimeDisplay.js +121 -37
  20. package/dist/components/date/TimeDisplay.js.map +1 -1
  21. package/dist/components/date/TimeDisplay.mjs +121 -37
  22. package/dist/components/date/TimeDisplay.mjs.map +1 -1
  23. package/dist/components/date/YearMonthPicker.js +106 -22
  24. package/dist/components/date/YearMonthPicker.js.map +1 -1
  25. package/dist/components/date/YearMonthPicker.mjs +106 -22
  26. package/dist/components/date/YearMonthPicker.mjs.map +1 -1
  27. package/dist/components/dialogs/ConfirmDialog.d.mts +2 -5
  28. package/dist/components/dialogs/ConfirmDialog.d.ts +2 -5
  29. package/dist/components/dialogs/ConfirmDialog.js +157 -25
  30. package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
  31. package/dist/components/dialogs/ConfirmDialog.mjs +157 -25
  32. package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
  33. package/dist/components/icons-and-geometry/Avatar.js +2 -2
  34. package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
  35. package/dist/components/icons-and-geometry/Avatar.mjs +2 -2
  36. package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
  37. package/dist/components/layout-and-navigation/Carousel.d.mts +1 -1
  38. package/dist/components/layout-and-navigation/Carousel.d.ts +1 -1
  39. package/dist/components/layout-and-navigation/Carousel.js +86 -28
  40. package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
  41. package/dist/components/layout-and-navigation/Carousel.mjs +86 -28
  42. package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
  43. package/dist/components/layout-and-navigation/Expandable.d.mts +3 -0
  44. package/dist/components/layout-and-navigation/Expandable.d.ts +3 -0
  45. package/dist/components/layout-and-navigation/Expandable.js +4 -3
  46. package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
  47. package/dist/components/layout-and-navigation/Expandable.mjs +4 -3
  48. package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
  49. package/dist/components/layout-and-navigation/FAQSection.js +4 -3
  50. package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
  51. package/dist/components/layout-and-navigation/FAQSection.mjs +4 -3
  52. package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
  53. package/dist/components/layout-and-navigation/Overlay.d.mts +2 -3
  54. package/dist/components/layout-and-navigation/Overlay.d.ts +2 -3
  55. package/dist/components/layout-and-navigation/Overlay.js +152 -12
  56. package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
  57. package/dist/components/layout-and-navigation/Overlay.mjs +152 -12
  58. package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
  59. package/dist/components/layout-and-navigation/Pagination.d.mts +2 -3
  60. package/dist/components/layout-and-navigation/Pagination.d.ts +2 -3
  61. package/dist/components/layout-and-navigation/Pagination.js +145 -13
  62. package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
  63. package/dist/components/layout-and-navigation/Pagination.mjs +145 -13
  64. package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
  65. package/dist/components/layout-and-navigation/SearchableList.d.mts +10 -8
  66. package/dist/components/layout-and-navigation/SearchableList.d.ts +10 -8
  67. package/dist/components/layout-and-navigation/SearchableList.js +261 -30
  68. package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
  69. package/dist/components/layout-and-navigation/SearchableList.mjs +261 -30
  70. package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
  71. package/dist/components/layout-and-navigation/StepperBar.d.mts +2 -5
  72. package/dist/components/layout-and-navigation/StepperBar.d.ts +2 -5
  73. package/dist/components/layout-and-navigation/StepperBar.js +149 -19
  74. package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
  75. package/dist/components/layout-and-navigation/StepperBar.mjs +149 -19
  76. package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
  77. package/dist/components/layout-and-navigation/Table.js +146 -14
  78. package/dist/components/layout-and-navigation/Table.js.map +1 -1
  79. package/dist/components/layout-and-navigation/Table.mjs +146 -14
  80. package/dist/components/layout-and-navigation/Table.mjs.map +1 -1
  81. package/dist/components/layout-and-navigation/TextImage.d.mts +3 -4
  82. package/dist/components/layout-and-navigation/TextImage.d.ts +3 -4
  83. package/dist/components/layout-and-navigation/TextImage.js +153 -19
  84. package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
  85. package/dist/components/layout-and-navigation/TextImage.mjs +153 -19
  86. package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
  87. package/dist/components/layout-and-navigation/Tile.d.mts +10 -15
  88. package/dist/components/layout-and-navigation/Tile.d.ts +10 -15
  89. package/dist/components/layout-and-navigation/Tile.js +30 -8
  90. package/dist/components/layout-and-navigation/Tile.js.map +1 -1
  91. package/dist/components/layout-and-navigation/Tile.mjs +30 -8
  92. package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
  93. package/dist/components/loading-states/ErrorComponent.js +48 -8
  94. package/dist/components/loading-states/ErrorComponent.js.map +1 -1
  95. package/dist/components/loading-states/ErrorComponent.mjs +48 -8
  96. package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
  97. package/dist/components/loading-states/LoadingAndErrorComponent.d.mts +1 -0
  98. package/dist/components/loading-states/LoadingAndErrorComponent.d.ts +1 -0
  99. package/dist/components/loading-states/LoadingAndErrorComponent.js +147 -15
  100. package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
  101. package/dist/components/loading-states/LoadingAndErrorComponent.mjs +147 -15
  102. package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
  103. package/dist/components/loading-states/LoadingAnimation.d.mts +2 -3
  104. package/dist/components/loading-states/LoadingAnimation.d.ts +2 -3
  105. package/dist/components/loading-states/LoadingAnimation.js +145 -13
  106. package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
  107. package/dist/components/loading-states/LoadingAnimation.mjs +145 -13
  108. package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
  109. package/dist/components/loading-states/ProgressIndicator.js +2 -2
  110. package/dist/components/loading-states/ProgressIndicator.js.map +1 -1
  111. package/dist/components/loading-states/ProgressIndicator.mjs +2 -2
  112. package/dist/components/loading-states/ProgressIndicator.mjs.map +1 -1
  113. package/dist/components/modals/ConfirmModal.d.mts +2 -5
  114. package/dist/components/modals/ConfirmModal.d.ts +2 -5
  115. package/dist/components/modals/ConfirmModal.js +158 -28
  116. package/dist/components/modals/ConfirmModal.js.map +1 -1
  117. package/dist/components/modals/ConfirmModal.mjs +158 -28
  118. package/dist/components/modals/ConfirmModal.mjs.map +1 -1
  119. package/dist/components/modals/DiscardChangesModal.d.mts +2 -7
  120. package/dist/components/modals/DiscardChangesModal.d.ts +2 -7
  121. package/dist/components/modals/DiscardChangesModal.js +162 -48
  122. package/dist/components/modals/DiscardChangesModal.js.map +1 -1
  123. package/dist/components/modals/DiscardChangesModal.mjs +162 -48
  124. package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
  125. package/dist/components/modals/InputModal.d.mts +1 -0
  126. package/dist/components/modals/InputModal.d.ts +1 -0
  127. package/dist/components/modals/InputModal.js +158 -28
  128. package/dist/components/modals/InputModal.js.map +1 -1
  129. package/dist/components/modals/InputModal.mjs +158 -28
  130. package/dist/components/modals/InputModal.mjs.map +1 -1
  131. package/dist/components/modals/LanguageModal.d.mts +3 -2
  132. package/dist/components/modals/LanguageModal.d.ts +3 -2
  133. package/dist/components/modals/LanguageModal.js +538 -166
  134. package/dist/components/modals/LanguageModal.js.map +1 -1
  135. package/dist/components/modals/LanguageModal.mjs +537 -165
  136. package/dist/components/modals/LanguageModal.mjs.map +1 -1
  137. package/dist/components/modals/ThemeModal.d.mts +5 -5
  138. package/dist/components/modals/ThemeModal.d.ts +5 -5
  139. package/dist/components/modals/ThemeModal.js +547 -176
  140. package/dist/components/modals/ThemeModal.js.map +1 -1
  141. package/dist/components/modals/ThemeModal.mjs +544 -173
  142. package/dist/components/modals/ThemeModal.mjs.map +1 -1
  143. package/dist/components/properties/CheckboxProperty.d.mts +3 -5
  144. package/dist/components/properties/CheckboxProperty.d.ts +3 -5
  145. package/dist/components/properties/CheckboxProperty.js +148 -26
  146. package/dist/components/properties/CheckboxProperty.js.map +1 -1
  147. package/dist/components/properties/CheckboxProperty.mjs +148 -26
  148. package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
  149. package/dist/components/properties/DateProperty.d.mts +1 -0
  150. package/dist/components/properties/DateProperty.d.ts +1 -0
  151. package/dist/components/properties/DateProperty.js +146 -14
  152. package/dist/components/properties/DateProperty.js.map +1 -1
  153. package/dist/components/properties/DateProperty.mjs +146 -14
  154. package/dist/components/properties/DateProperty.mjs.map +1 -1
  155. package/dist/components/properties/MultiSelectProperty.d.mts +5 -5
  156. package/dist/components/properties/MultiSelectProperty.d.ts +5 -5
  157. package/dist/components/properties/MultiSelectProperty.js +626 -456
  158. package/dist/components/properties/MultiSelectProperty.js.map +1 -1
  159. package/dist/components/properties/MultiSelectProperty.mjs +622 -452
  160. package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
  161. package/dist/components/properties/NumberProperty.d.mts +1 -0
  162. package/dist/components/properties/NumberProperty.d.ts +1 -0
  163. package/dist/components/properties/NumberProperty.js +148 -16
  164. package/dist/components/properties/NumberProperty.js.map +1 -1
  165. package/dist/components/properties/NumberProperty.mjs +148 -16
  166. package/dist/components/properties/NumberProperty.mjs.map +1 -1
  167. package/dist/components/properties/PropertyBase.d.mts +2 -3
  168. package/dist/components/properties/PropertyBase.d.ts +2 -3
  169. package/dist/components/properties/PropertyBase.js +146 -14
  170. package/dist/components/properties/PropertyBase.js.map +1 -1
  171. package/dist/components/properties/PropertyBase.mjs +146 -14
  172. package/dist/components/properties/PropertyBase.mjs.map +1 -1
  173. package/dist/components/properties/SelectProperty.d.mts +5 -6
  174. package/dist/components/properties/SelectProperty.d.ts +5 -6
  175. package/dist/components/properties/SelectProperty.js +542 -279
  176. package/dist/components/properties/SelectProperty.js.map +1 -1
  177. package/dist/components/properties/SelectProperty.mjs +542 -279
  178. package/dist/components/properties/SelectProperty.mjs.map +1 -1
  179. package/dist/components/properties/TextProperty.d.mts +2 -1
  180. package/dist/components/properties/TextProperty.d.ts +2 -1
  181. package/dist/components/properties/TextProperty.js +150 -18
  182. package/dist/components/properties/TextProperty.js.map +1 -1
  183. package/dist/components/properties/TextProperty.mjs +150 -18
  184. package/dist/components/properties/TextProperty.mjs.map +1 -1
  185. package/dist/components/user-action/DateAndTimePicker.d.mts +4 -20
  186. package/dist/components/user-action/DateAndTimePicker.d.ts +4 -20
  187. package/dist/components/user-action/DateAndTimePicker.js +233 -71
  188. package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
  189. package/dist/components/user-action/DateAndTimePicker.mjs +233 -71
  190. package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
  191. package/dist/components/user-action/Menu.d.mts +14 -8
  192. package/dist/components/user-action/Menu.d.ts +14 -8
  193. package/dist/components/user-action/Menu.js +32 -11
  194. package/dist/components/user-action/Menu.js.map +1 -1
  195. package/dist/components/user-action/Menu.mjs +32 -11
  196. package/dist/components/user-action/Menu.mjs.map +1 -1
  197. package/dist/components/user-action/MultiSelect.d.mts +13 -23
  198. package/dist/components/user-action/MultiSelect.d.ts +13 -23
  199. package/dist/components/user-action/MultiSelect.js +632 -325
  200. package/dist/components/user-action/MultiSelect.js.map +1 -1
  201. package/dist/components/user-action/MultiSelect.mjs +629 -323
  202. package/dist/components/user-action/MultiSelect.mjs.map +1 -1
  203. package/dist/components/user-action/Select.d.mts +5 -18
  204. package/dist/components/user-action/Select.d.ts +5 -18
  205. package/dist/components/user-action/Select.js +447 -113
  206. package/dist/components/user-action/Select.js.map +1 -1
  207. package/dist/components/user-action/Select.mjs +442 -107
  208. package/dist/components/user-action/Select.mjs.map +1 -1
  209. package/dist/components/user-action/Tooltip.js +2 -2
  210. package/dist/components/user-action/Tooltip.js.map +1 -1
  211. package/dist/components/user-action/Tooltip.mjs +2 -2
  212. package/dist/components/user-action/Tooltip.mjs.map +1 -1
  213. package/dist/css/globals.css +224 -207
  214. package/dist/css/uncompiled/globals.css +138 -74
  215. package/dist/hooks/useSearch.d.mts +17 -0
  216. package/dist/hooks/useSearch.d.ts +17 -0
  217. package/dist/hooks/useSearch.js +66 -0
  218. package/dist/hooks/useSearch.js.map +1 -0
  219. package/dist/hooks/useSearch.mjs +42 -0
  220. package/dist/hooks/useSearch.mjs.map +1 -0
  221. package/dist/index.d.mts +10 -6
  222. package/dist/index.d.ts +10 -6
  223. package/dist/index.js +882 -758
  224. package/dist/index.js.map +1 -1
  225. package/dist/index.mjs +836 -717
  226. package/dist/index.mjs.map +1 -1
  227. package/dist/localization/defaults/form.d.mts +54 -0
  228. package/dist/localization/defaults/form.d.ts +54 -0
  229. package/dist/localization/defaults/form.js +127 -0
  230. package/dist/localization/defaults/form.js.map +1 -0
  231. package/dist/localization/defaults/form.mjs +103 -0
  232. package/dist/localization/defaults/form.mjs.map +1 -0
  233. package/dist/localization/defaults/time.d.mts +39 -0
  234. package/dist/localization/defaults/time.d.ts +39 -0
  235. package/dist/localization/defaults/time.js +101 -0
  236. package/dist/localization/defaults/time.js.map +1 -0
  237. package/dist/localization/defaults/time.mjs +76 -0
  238. package/dist/localization/defaults/time.mjs.map +1 -0
  239. package/dist/localization/useTranslation.d.mts +30 -6
  240. package/dist/localization/useTranslation.d.ts +30 -6
  241. package/dist/localization/useTranslation.js +46 -6
  242. package/dist/localization/useTranslation.js.map +1 -1
  243. package/dist/localization/useTranslation.mjs +46 -6
  244. package/dist/localization/useTranslation.mjs.map +1 -1
  245. package/dist/theming/useTheme.d.mts +4 -2
  246. package/dist/theming/useTheme.d.ts +4 -2
  247. package/dist/theming/useTheme.js +10 -2
  248. package/dist/theming/useTheme.js.map +1 -1
  249. package/dist/theming/useTheme.mjs +10 -2
  250. package/dist/theming/useTheme.mjs.map +1 -1
  251. package/dist/util/PropsWithFunctionChildren.d.mts +14 -0
  252. package/dist/util/PropsWithFunctionChildren.d.ts +14 -0
  253. package/dist/util/PropsWithFunctionChildren.js +38 -0
  254. package/dist/util/PropsWithFunctionChildren.js.map +1 -0
  255. package/dist/util/PropsWithFunctionChildren.mjs +14 -0
  256. package/dist/util/PropsWithFunctionChildren.mjs.map +1 -0
  257. package/dist/util/simpleSearch.d.mts +2 -2
  258. package/dist/util/simpleSearch.d.ts +2 -2
  259. package/dist/util/simpleSearch.js +4 -1
  260. package/dist/util/simpleSearch.js.map +1 -1
  261. package/dist/util/simpleSearch.mjs +4 -1
  262. package/dist/util/simpleSearch.mjs.map +1 -1
  263. package/package.json +1 -2
@@ -1,6 +1,6 @@
1
1
  // src/components/properties/SelectProperty.tsx
2
2
  import { List } from "lucide-react";
3
- import clsx6 from "clsx";
3
+ import clsx8 from "clsx";
4
4
 
5
5
  // src/localization/LanguageProvider.tsx
6
6
  import { createContext, useContext, useEffect as useEffect2, useState as useState2 } from "react";
@@ -30,26 +30,339 @@ var LanguageContext = createContext({
30
30
  var useLanguage = () => useContext(LanguageContext);
31
31
 
32
32
  // src/localization/useTranslation.ts
33
- var useTranslation = (defaults, translationOverwrite = {}) => {
34
- const { language: languageProp, translation: overwrite } = translationOverwrite;
33
+ var useTranslation = (translations, overwriteTranslation = {}) => {
34
+ const { language: languageProp, translation: overwrite } = overwriteTranslation;
35
35
  const { language: inferredLanguage } = useLanguage();
36
36
  const usedLanguage = languageProp ?? inferredLanguage;
37
- let defaultValues = defaults[usedLanguage];
38
- if (overwrite && overwrite[usedLanguage]) {
39
- defaultValues = { ...defaultValues, ...overwrite[usedLanguage] };
37
+ const usedTranslations = [...translations];
38
+ if (overwrite) {
39
+ usedTranslations.push(overwrite);
40
40
  }
41
- return defaultValues;
41
+ return (key, options) => {
42
+ const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
43
+ try {
44
+ for (let i = translations.length - 1; i >= 0; i--) {
45
+ const translation = translations[i];
46
+ const localizedTranslation = translation[usedLanguage];
47
+ if (!localizedTranslation) {
48
+ continue;
49
+ }
50
+ const value = localizedTranslation[key];
51
+ if (!value) {
52
+ continue;
53
+ }
54
+ let forProcessing;
55
+ if (typeof value !== "string") {
56
+ if (count <= 0 && value?.zero) {
57
+ forProcessing = value.zero;
58
+ } else if (count === 1 && value?.one) {
59
+ forProcessing = value.one;
60
+ } else if (count === 2 && value?.two) {
61
+ forProcessing = value.two;
62
+ } else if (count <= 10 && value?.few) {
63
+ forProcessing = value.few;
64
+ } else if (count > 10 && value?.many) {
65
+ forProcessing = value.many;
66
+ } else {
67
+ forProcessing = value.other;
68
+ }
69
+ } else {
70
+ forProcessing = value;
71
+ }
72
+ forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
73
+ return replacements[placeholder] ?? `{{${placeholder}}}`;
74
+ });
75
+ return forProcessing;
76
+ }
77
+ } catch (e) {
78
+ console.error(e);
79
+ }
80
+ return `{{${usedLanguage}:${key}}}`;
81
+ };
82
+ };
83
+
84
+ // src/components/properties/PropertyBase.tsx
85
+ import { AlertTriangle } from "lucide-react";
86
+ import clsx2 from "clsx";
87
+
88
+ // src/components/user-action/Button.tsx
89
+ import clsx from "clsx";
90
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
91
+ var paddingMapping = {
92
+ small: "btn-sm",
93
+ medium: "btn-md",
94
+ large: "btn-lg"
95
+ };
96
+ var iconPaddingMapping = {
97
+ small: "icon-btn-sm",
98
+ medium: "icon-btn-md",
99
+ large: "icon-btn-lg"
100
+ };
101
+ var ButtonUtil = {
102
+ paddingMapping,
103
+ iconPaddingMapping
104
+ };
105
+ var TextButton = ({
106
+ children,
107
+ disabled = false,
108
+ color = "neutral",
109
+ size = "medium",
110
+ startIcon,
111
+ endIcon,
112
+ onClick,
113
+ className,
114
+ ...restProps
115
+ }) => {
116
+ const colorClasses = {
117
+ primary: "bg-transparent text-button-text-primary-text",
118
+ negative: "bg-transparent text-button-text-negative-text",
119
+ neutral: "bg-transparent text-button-text-neutral-text"
120
+ }[color];
121
+ const iconColorClasses = {
122
+ primary: "text-button-text-primary-icon",
123
+ negative: "text-button-text-negative-icon",
124
+ neutral: "text-button-text-neutral-icon"
125
+ }[color];
126
+ return /* @__PURE__ */ jsxs(
127
+ "button",
128
+ {
129
+ onClick: disabled ? void 0 : onClick,
130
+ disabled: disabled || onClick === void 0,
131
+ className: clsx(
132
+ {
133
+ "text-disabled-text cursor-not-allowed": disabled,
134
+ [clsx(colorClasses, "hover:bg-button-text-hover-background rounded-full")]: !disabled
135
+ },
136
+ ButtonUtil.paddingMapping[size],
137
+ className
138
+ ),
139
+ ...restProps,
140
+ children: [
141
+ startIcon && /* @__PURE__ */ jsx2(
142
+ "span",
143
+ {
144
+ className: clsx({
145
+ [iconColorClasses]: !disabled,
146
+ [`text-disabled-icon`]: disabled
147
+ }),
148
+ children: startIcon
149
+ }
150
+ ),
151
+ children,
152
+ endIcon && /* @__PURE__ */ jsx2(
153
+ "span",
154
+ {
155
+ className: clsx({
156
+ [iconColorClasses]: !disabled,
157
+ [`text-disabled-icon`]: disabled
158
+ }),
159
+ children: endIcon
160
+ }
161
+ )
162
+ ]
163
+ }
164
+ );
165
+ };
166
+ var IconButton = ({
167
+ children,
168
+ disabled = false,
169
+ color = "primary",
170
+ size = "medium",
171
+ onClick,
172
+ className,
173
+ ...restProps
174
+ }) => {
175
+ const colorClasses = {
176
+ primary: "bg-button-solid-primary-background text-button-solid-primary-text",
177
+ secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
178
+ tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
179
+ positive: "bg-button-solid-positive-background text-button-solid-positive-text",
180
+ warning: "bg-button-solid-warning-background text-button-solid-warning-text",
181
+ negative: "bg-button-solid-negative-background text-button-solid-negative-text",
182
+ neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
183
+ }[color];
184
+ return /* @__PURE__ */ jsx2(
185
+ "button",
186
+ {
187
+ onClick: disabled ? void 0 : onClick,
188
+ disabled: disabled || onClick === void 0,
189
+ className: clsx(
190
+ {
191
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
192
+ [clsx(colorClasses, "hover:brightness-90")]: !disabled
193
+ },
194
+ ButtonUtil.iconPaddingMapping[size],
195
+ className
196
+ ),
197
+ ...restProps,
198
+ children
199
+ }
200
+ );
201
+ };
202
+
203
+ // src/localization/defaults/form.ts
204
+ var formTranslation = {
205
+ en: {
206
+ all: "All",
207
+ back: "Back",
208
+ cancel: "Cancel",
209
+ change: "Change",
210
+ clear: "Clear",
211
+ close: "Close",
212
+ confirm: "Confirm",
213
+ decline: "Decline",
214
+ delete: "Delete",
215
+ discard: "Discard",
216
+ discardChanges: "Discard Changes",
217
+ done: "Done",
218
+ edit: "Edit",
219
+ enterText: "Enter text here",
220
+ error: "Error",
221
+ exit: "Exit",
222
+ fieldRequiredError: "This field is required.",
223
+ invalidEmailError: "Please enter a valid email address.",
224
+ less: "Less",
225
+ loading: "Loading",
226
+ maxLengthError: "Maximum length exceeded.",
227
+ minLengthError: "Minimum length not met.",
228
+ more: "More",
229
+ next: "Next",
230
+ no: "No",
231
+ none: "None",
232
+ of: "of",
233
+ optional: "Optional",
234
+ pleaseWait: "Please wait...",
235
+ previous: "Previous",
236
+ remove: "Remove",
237
+ required: "Required",
238
+ reset: "Reset",
239
+ save: "Save",
240
+ search: "Search",
241
+ select: "Select",
242
+ selectOption: "Select an option",
243
+ show: "Show",
244
+ showMore: "Show more",
245
+ showLess: "Show less",
246
+ submit: "Submit",
247
+ success: "Success",
248
+ update: "Update",
249
+ unsavedChanges: "Unsaved Changes",
250
+ unsavedChangesSaveQuestion: "Do you want to save your changes?",
251
+ yes: "Yes"
252
+ },
253
+ de: {
254
+ all: "Alle",
255
+ back: "Zur\xFCck",
256
+ cancel: "Abbrechen",
257
+ change: "\xC4ndern",
258
+ clear: "L\xF6schen",
259
+ close: "Schlie\xDFen",
260
+ confirm: "Best\xE4tigen",
261
+ decline: "Ablehnen",
262
+ delete: "L\xF6schen",
263
+ discard: "Verwerfen",
264
+ discardChanges: "\xC4nderungen Verwerfen",
265
+ done: "Fertig",
266
+ edit: "Bearbeiten",
267
+ enterText: "Text hier eingeben",
268
+ error: "Fehler",
269
+ exit: "Beenden",
270
+ fieldRequiredError: "Dieses Feld ist erforderlich.",
271
+ invalidEmailError: "Bitte geben Sie eine g\xFCltige E-Mail-Adresse ein.",
272
+ less: "Weniger",
273
+ loading: "L\xE4dt",
274
+ maxLengthError: "Maximale L\xE4nge \xFCberschritten.",
275
+ minLengthError: "Mindestl\xE4nge nicht erreicht.",
276
+ more: "Mehr",
277
+ next: "Weiter",
278
+ no: "Nein",
279
+ none: "Nichts",
280
+ of: "von",
281
+ optional: "Optional",
282
+ pleaseWait: "Bitte warten...",
283
+ previous: "Vorherige",
284
+ remove: "Entfernen",
285
+ required: "Erforderlich",
286
+ reset: "Zur\xFCcksetzen",
287
+ save: "Speichern",
288
+ search: "Suche",
289
+ select: "Select",
290
+ selectOption: "Option ausw\xE4hlen",
291
+ show: "Anzeigen",
292
+ showMore: "Mehr anzeigen",
293
+ showLess: "Weniger anzeigen",
294
+ submit: "Abschicken",
295
+ success: "Erfolg",
296
+ update: "Update",
297
+ unsavedChanges: "Ungespeicherte \xC4nderungen",
298
+ unsavedChangesSaveQuestion: "M\xF6chtest du die \xC4nderungen speichern?",
299
+ yes: "Ja"
300
+ }
301
+ };
302
+
303
+ // src/components/properties/PropertyBase.tsx
304
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
305
+ var PropertyBase = ({
306
+ overwriteTranslation,
307
+ name,
308
+ input,
309
+ softRequired = false,
310
+ hasValue,
311
+ icon,
312
+ readOnly,
313
+ onRemove,
314
+ className = ""
315
+ }) => {
316
+ const translation = useTranslation([formTranslation], overwriteTranslation);
317
+ const requiredAndNoValue = softRequired && !hasValue;
318
+ return /* @__PURE__ */ jsxs2("div", { className: clsx2("row gap-x-0 group", className), children: [
319
+ /* @__PURE__ */ jsxs2(
320
+ "div",
321
+ {
322
+ className: clsx2("row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0", {
323
+ "bg-property-title-background property-title-text group-hover:border-primary": !requiredAndNoValue,
324
+ "bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
325
+ }, className),
326
+ children: [
327
+ icon,
328
+ name
329
+ ]
330
+ }
331
+ ),
332
+ /* @__PURE__ */ jsxs2(
333
+ "div",
334
+ {
335
+ className: clsx2("row gap-x-0 grow justify-between items-center rounded-r-xl border-2 border-l-0", {
336
+ "bg-surface group-hover:border-primary": !requiredAndNoValue,
337
+ "bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
338
+ }, className),
339
+ children: [
340
+ input({ softRequired, hasValue }),
341
+ requiredAndNoValue && /* @__PURE__ */ jsx3("div", { className: "text-warning pr-4", children: /* @__PURE__ */ jsx3(AlertTriangle, { size: 24 }) }),
342
+ onRemove && /* @__PURE__ */ jsx3(
343
+ TextButton,
344
+ {
345
+ onClick: onRemove,
346
+ color: "negative",
347
+ className: clsx2("pr-4 items-center", { "!text-transparent": !hasValue || readOnly }),
348
+ disabled: !hasValue || readOnly,
349
+ children: translation("remove")
350
+ }
351
+ )
352
+ ]
353
+ }
354
+ )
355
+ ] });
42
356
  };
43
357
 
44
358
  // src/components/user-action/Select.tsx
45
- import { Menu } from "@headlessui/react";
46
- import { ChevronDown, ChevronUp, Search } from "lucide-react";
47
- import { useEffect as useEffect5, useState as useState5 } from "react";
48
- import clsx3 from "clsx";
359
+ import { ChevronDown, ChevronUp } from "lucide-react";
360
+ import { useEffect as useEffect7, useRef as useRef2, useState as useState6 } from "react";
361
+ import clsx7 from "clsx";
49
362
 
50
363
  // src/components/user-action/Label.tsx
51
- import clsx from "clsx";
52
- import { jsx as jsx2 } from "react/jsx-runtime";
364
+ import clsx3 from "clsx";
365
+ import { jsx as jsx4 } from "react/jsx-runtime";
53
366
  var styleMapping = {
54
367
  labelSmall: "textstyle-label-sm",
55
368
  labelMedium: "textstyle-label-md",
@@ -62,20 +375,16 @@ var Label = ({
62
375
  className,
63
376
  ...props
64
377
  }) => {
65
- return /* @__PURE__ */ jsx2("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
378
+ return /* @__PURE__ */ jsx4("label", { ...props, className: clsx3(styleMapping[labelType], className), children: children ? children : name });
66
379
  };
67
380
 
68
- // src/util/simpleSearch.ts
69
- var MultiSearchWithMapping = (search, objects, mapping) => {
70
- return objects.filter((object) => {
71
- const mappedSearchKeywords = mapping(object).map((value) => value.toLowerCase().trim());
72
- return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
73
- });
74
- };
381
+ // src/components/layout-and-navigation/SearchableList.tsx
382
+ import { Search } from "lucide-react";
383
+ import clsx5 from "clsx";
75
384
 
76
385
  // src/components/user-action/Input.tsx
77
386
  import { forwardRef, useEffect as useEffect4, useRef, useState as useState4 } from "react";
78
- import clsx2 from "clsx";
387
+ import clsx4 from "clsx";
79
388
 
80
389
  // src/hooks/useSaveDelay.ts
81
390
  import { useEffect as useEffect3, useState as useState3 } from "react";
@@ -121,7 +430,7 @@ function useSaveDelay(setNotificationStatus, delay) {
121
430
  var noop = () => void 0;
122
431
 
123
432
  // src/components/user-action/Input.tsx
124
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
433
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
125
434
  var Input = ({
126
435
  id,
127
436
  type = "text",
@@ -147,9 +456,9 @@ var Input = ({
147
456
  ref.current?.focus();
148
457
  }
149
458
  }, [autoFocus]);
150
- return /* @__PURE__ */ jsxs("div", { className: clsx2({ "w-full": expanded }, containerClassName), children: [
151
- label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx2("mb-1", label.className) }),
152
- /* @__PURE__ */ jsx3(
459
+ return /* @__PURE__ */ jsxs3("div", { className: clsx4({ "w-full": expanded }, containerClassName), children: [
460
+ label && /* @__PURE__ */ jsx5(Label, { ...label, htmlFor: id, className: clsx4("mb-1", label.className) }),
461
+ /* @__PURE__ */ jsx5(
153
462
  "input",
154
463
  {
155
464
  ref,
@@ -193,13 +502,13 @@ var FormInput = forwardRef(function FormInput2({
193
502
  required,
194
503
  ...restProps
195
504
  }, ref) {
196
- const input = /* @__PURE__ */ jsx3(
505
+ const input = /* @__PURE__ */ jsx5(
197
506
  "input",
198
507
  {
199
508
  ref,
200
509
  id,
201
510
  ...restProps,
202
- className: clsx2(
511
+ className: clsx4(
203
512
  {
204
513
  "focus:border-primary focus:ring-primary": !errorText,
205
514
  "focus:border-negative focus:ring-negative text-negative": !!errorText
@@ -208,286 +517,240 @@ var FormInput = forwardRef(function FormInput2({
208
517
  )
209
518
  }
210
519
  );
211
- return /* @__PURE__ */ jsxs("div", { className: clsx2("flex flex-col gap-y-1", containerClassName), children: [
212
- labelText && /* @__PURE__ */ jsxs("label", { htmlFor: id, className: clsx2("textstyle-label-md", labelClassName), children: [
520
+ return /* @__PURE__ */ jsxs3("div", { className: clsx4("flex flex-col gap-y-1", containerClassName), children: [
521
+ labelText && /* @__PURE__ */ jsxs3("label", { htmlFor: id, className: clsx4("textstyle-label-md", labelClassName), children: [
213
522
  labelText,
214
- required && /* @__PURE__ */ jsx3("span", { className: "text-primary font-bold", children: "*" })
523
+ required && /* @__PURE__ */ jsx5("span", { className: "text-primary font-bold", children: "*" })
215
524
  ] }),
216
525
  input,
217
- errorText && /* @__PURE__ */ jsx3("label", { htmlFor: id, className: clsx2("text-negative", errorClassName), children: errorText })
526
+ errorText && /* @__PURE__ */ jsx5("label", { htmlFor: id, className: clsx4("text-negative", errorClassName), children: errorText })
218
527
  ] });
219
528
  });
220
529
 
530
+ // src/hooks/useSearch.ts
531
+ import { useEffect as useEffect5, useMemo, useState as useState5 } from "react";
532
+
533
+ // src/util/simpleSearch.ts
534
+ var MultiSearchWithMapping = (search, objects, mapping) => {
535
+ return objects.filter((object) => {
536
+ const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
537
+ if (!mappedSearchKeywords) {
538
+ return true;
539
+ }
540
+ return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
541
+ });
542
+ };
543
+
544
+ // src/hooks/useSearch.ts
545
+ var useSearch = ({
546
+ list,
547
+ initialSearch,
548
+ searchMapping
549
+ }) => {
550
+ const [items, setItems] = useState5(list);
551
+ const [search, setSearch] = useState5(initialSearch);
552
+ useEffect5(() => {
553
+ setItems(list);
554
+ }, [list]);
555
+ const result = useMemo(
556
+ () => MultiSearchWithMapping(search, items, searchMapping),
557
+ [search, items, searchMapping]
558
+ );
559
+ return {
560
+ result,
561
+ hasResult: result.length > 0,
562
+ allItems: items,
563
+ setItems,
564
+ search,
565
+ setSearch
566
+ };
567
+ };
568
+
569
+ // src/components/layout-and-navigation/SearchableList.tsx
570
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
571
+ var defaultSearchableListTranslation = {
572
+ en: {
573
+ nothingFound: "Nothing found"
574
+ },
575
+ de: {
576
+ nothingFound: "Nichts gefunden"
577
+ }
578
+ };
579
+ var SearchableList = ({
580
+ overwriteTranslation,
581
+ list,
582
+ initialSearch = "",
583
+ searchMapping,
584
+ autoFocus,
585
+ minimumItemsForSearch = 6,
586
+ itemMapper,
587
+ className,
588
+ resultListClassName
589
+ }) => {
590
+ const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
591
+ const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
592
+ return /* @__PURE__ */ jsxs4("div", { className: clsx5("col gap-y-2", className), children: [
593
+ list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs4("div", { className: "row justify-between gap-x-4 items-center", children: [
594
+ /* @__PURE__ */ jsx6(
595
+ Input,
596
+ {
597
+ value: search,
598
+ onChangeText: setSearch,
599
+ placeholder: translation("search"),
600
+ autoFocus,
601
+ className: "w-full"
602
+ }
603
+ ),
604
+ /* @__PURE__ */ jsx6(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx6(Search, { className: "w-full h-full" }) })
605
+ ] }),
606
+ hasResult ? /* @__PURE__ */ jsx6("div", { className: clsx5("col gap-y-1", resultListClassName), children: result.map(itemMapper) }) : /* @__PURE__ */ jsx6("div", { className: "row text-description py-2 px-2", children: translation("nothingFound") })
607
+ ] });
608
+ };
609
+
610
+ // src/components/layout-and-navigation/Tile.tsx
611
+ import clsx6 from "clsx";
612
+ import { Check } from "lucide-react";
613
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
614
+ var Tile = ({
615
+ title,
616
+ description,
617
+ onClick,
618
+ isSelected = false,
619
+ isDisabled = false,
620
+ prefix,
621
+ suffix,
622
+ normalClassName = "hover:bg-primary/40 cursor-pointer",
623
+ selectedClassName = " bg-primary/20",
624
+ disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
625
+ className
626
+ }) => {
627
+ return /* @__PURE__ */ jsxs5(
628
+ "div",
629
+ {
630
+ className: clsx6(
631
+ "row gap-x-2 w-full items-center",
632
+ {
633
+ [normalClassName]: !!onClick && !isDisabled,
634
+ [selectedClassName]: isSelected && !isDisabled,
635
+ [disabledClassName]: isDisabled
636
+ },
637
+ className
638
+ ),
639
+ onClick: isDisabled ? void 0 : onClick,
640
+ children: [
641
+ prefix ?? (isSelected ? /* @__PURE__ */ jsx7(Check, { size: 24 }) : void 0),
642
+ /* @__PURE__ */ jsxs5("div", { className: "col gap-y-0 w-full", children: [
643
+ /* @__PURE__ */ jsx7("h4", { className: clsx6(title.className ?? "textstyle-title-normal"), children: title.value }),
644
+ !!description && /* @__PURE__ */ jsx7("span", { className: clsx6(description.className ?? "textstyle-description"), children: description.value })
645
+ ] }),
646
+ suffix
647
+ ]
648
+ }
649
+ );
650
+ };
651
+
652
+ // src/hooks/useOutsideClick.ts
653
+ import { useEffect as useEffect6 } from "react";
654
+ var useOutsideClick = (refs, handler) => {
655
+ useEffect6(() => {
656
+ const listener = (event) => {
657
+ if (event.target === null) return;
658
+ if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
659
+ return;
660
+ }
661
+ handler();
662
+ };
663
+ document.addEventListener("mousedown", listener);
664
+ document.addEventListener("touchstart", listener);
665
+ return () => {
666
+ document.removeEventListener("mousedown", listener);
667
+ document.removeEventListener("touchstart", listener);
668
+ };
669
+ }, [refs, handler]);
670
+ };
671
+
221
672
  // src/components/user-action/Select.tsx
222
- import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
673
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
223
674
  var Select = ({
224
675
  value,
225
676
  label,
226
677
  options,
227
678
  onChange,
228
- isHidingCurrentValue = true,
229
679
  hintText = "",
230
- showDisabledOptions = true,
231
680
  isDisabled,
681
+ isSearchEnabled = false,
232
682
  className,
233
- textColor = "text-menu-text",
234
- additionalItems,
235
683
  selectedDisplayOverwrite
236
684
  }) => {
237
- let filteredOptions = isHidingCurrentValue ? options.filter((option) => option.value !== value) : options;
238
- if (!showDisabledOptions) {
239
- filteredOptions = filteredOptions.filter((value2) => !value2.disabled);
240
- }
685
+ const triggerRef = useRef2(null);
686
+ const menuRef = useRef2(null);
687
+ const [isOpen, setIsOpen] = useState6(false);
688
+ useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
241
689
  const selectedOption = options.find((option) => option.value === value);
242
690
  if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
243
691
  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");
244
692
  }
245
- const borderColor = "border-menu-border";
246
- return /* @__PURE__ */ jsxs2("div", { className: clsx3(className), children: [
247
- label && /* @__PURE__ */ jsx4(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx3("mb-1", label.className) }),
248
- /* @__PURE__ */ jsx4(Menu, { as: "div", className: "relative text-menu-text", children: ({ open }) => /* @__PURE__ */ jsxs2(Fragment, { children: [
249
- /* @__PURE__ */ jsxs2(
250
- Menu.Button,
693
+ const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
694
+ return /* @__PURE__ */ jsxs6("div", { className: clsx7(className), children: [
695
+ label && /* @__PURE__ */ jsx8(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx7("mb-1", label.className) }),
696
+ /* @__PURE__ */ jsxs6("div", { className: "relative", children: [
697
+ /* @__PURE__ */ jsxs6(
698
+ "button",
251
699
  {
252
- className: clsx3(
253
- "inline-flex w-full justify-between items-center rounded-t-lg border-2 px-4 py-2 font-medium bg-menu-background text-menu-text",
254
- textColor,
255
- borderColor,
700
+ ref: triggerRef,
701
+ className: clsx7(
702
+ "btn-md justify-between w-full border-2",
256
703
  {
257
704
  "rounded-b-lg": !open,
258
- "hover:border-primary": !isDisabled,
259
- "bg-disabled-background cursor-not-allowed text-disabled": isDisabled
705
+ "bg-menu-background border-menu-border hover:border-primary": !isDisabled,
706
+ "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
260
707
  }
261
708
  ),
709
+ onClick: () => setIsOpen(!isOpen),
262
710
  disabled: isDisabled,
263
711
  children: [
264
- /* @__PURE__ */ jsx4("span", { children: selectedDisplayOverwrite ?? selectedOption?.label ?? hintText }),
265
- open ? /* @__PURE__ */ jsx4(ChevronUp, {}) : /* @__PURE__ */ jsx4(ChevronDown, {})
712
+ !isShowingHint && /* @__PURE__ */ jsx8("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? selectedOption?.label }),
713
+ isShowingHint && /* @__PURE__ */ jsx8("span", { className: "textstyle-description", children: hintText }),
714
+ isOpen ? /* @__PURE__ */ jsx8(ChevronUp, {}) : /* @__PURE__ */ jsx8(ChevronDown, {})
266
715
  ]
267
716
  }
268
717
  ),
269
- /* @__PURE__ */ jsxs2(
270
- Menu.Items,
718
+ isOpen && /* @__PURE__ */ jsx8(
719
+ "div",
271
720
  {
272
- className: "absolute w-full z-10 rounded-b-lg bg-menu-background text-menu-text shadow-lg max-h-[500px] overflow-y-auto",
273
- children: [
274
- (additionalItems ?? []).map((item, index) => /* @__PURE__ */ jsx4(
275
- "div",
276
- {
277
- className: clsx3(borderColor, "px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0", {
278
- "border-b-0 rounded-b-lg": filteredOptions.length === 0 && index === (additionalItems?.length ?? 1) - 1
279
- }),
280
- children: item
281
- },
282
- `additionalItems${index}`
283
- )),
284
- filteredOptions.map((option, index) => /* @__PURE__ */ jsx4(Menu.Item, { children: /* @__PURE__ */ jsx4(
285
- "div",
286
- {
287
- className: clsx3(
288
- "px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0 cursor-pointer",
289
- option.className,
290
- borderColor,
291
- {
292
- "brightness-90": option.value === value,
293
- "brightness-95": index % 2 === 1,
294
- "text-disabled bg-disabled-background cursor-not-allowed": !!option.disabled,
295
- "bg-menu-background text-menu-text hover:brightness-90 cursor-pointer": !option.disabled,
296
- "rounded-b-lg": index === filteredOptions.length - 1
297
- }
298
- ),
299
- onClick: () => {
300
- if (!option.disabled) {
721
+ ref: menuRef,
722
+ className: "absolute w-full z-10 rounded-lg mt-0.5 bg-menu-background text-menu-text shadow-around-md max-h-[500px] overflow-y-auto p-2",
723
+ children: /* @__PURE__ */ jsx8(
724
+ SearchableList,
725
+ {
726
+ list: options,
727
+ minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
728
+ searchMapping: (item) => item.searchTags,
729
+ itemMapper: (option, index) => /* @__PURE__ */ jsx8(
730
+ Tile,
731
+ {
732
+ isSelected: selectedOption?.value === option.value,
733
+ className: "px-2 py-1 rounded-md",
734
+ disabledClassName: "text-disabled-text cursor-not-allowed",
735
+ title: { value: option.label, className: "font-semibold" },
736
+ onClick: () => {
301
737
  onChange(option.value);
302
- }
738
+ setIsOpen(false);
739
+ },
740
+ isDisabled: option.disabled
303
741
  },
304
- children: option.label
305
- }
306
- ) }, `item${index}`))
307
- ]
308
- }
309
- )
310
- ] }) })
311
- ] });
312
- };
313
- var SearchableSelect = ({
314
- value,
315
- options,
316
- searchMapping,
317
- ...selectProps
318
- }) => {
319
- const [search, setSearch] = useState5("");
320
- const filteredOptions = MultiSearchWithMapping(search, options, searchMapping);
321
- return /* @__PURE__ */ jsx4(
322
- Select,
323
- {
324
- value,
325
- options: filteredOptions,
326
- additionalItems: [/* @__PURE__ */ jsxs2("div", { className: "row gap-x-2 items-center", children: [
327
- /* @__PURE__ */ jsx4(Input, { autoFocus: true, value: search, onChangeText: setSearch, className: "w-full" }),
328
- /* @__PURE__ */ jsx4(Search, { className: "min-w-[1.5rem] min-h-[1.5rem]" })
329
- ] }, "selectSearch")],
330
- ...selectProps
331
- }
332
- );
333
- };
334
-
335
- // src/components/properties/PropertyBase.tsx
336
- import { AlertTriangle } from "lucide-react";
337
- import clsx5 from "clsx";
338
-
339
- // src/components/user-action/Button.tsx
340
- import clsx4 from "clsx";
341
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
342
- var paddingMapping = {
343
- small: "btn-sm",
344
- medium: "btn-md",
345
- large: "btn-lg"
346
- };
347
- var iconPaddingMapping = {
348
- small: "icon-btn-sm",
349
- medium: "icon-btn-md",
350
- large: "icon-btn-lg"
351
- };
352
- var ButtonUtil = {
353
- paddingMapping,
354
- iconPaddingMapping
355
- };
356
- var TextButton = ({
357
- children,
358
- disabled = false,
359
- color = "neutral",
360
- size = "medium",
361
- startIcon,
362
- endIcon,
363
- onClick,
364
- className,
365
- ...restProps
366
- }) => {
367
- const colorClasses = {
368
- primary: "bg-transparent text-button-text-primary-text",
369
- negative: "bg-transparent text-button-text-negative-text",
370
- neutral: "bg-transparent text-button-text-neutral-text"
371
- }[color];
372
- const iconColorClasses = {
373
- primary: "text-button-text-primary-icon",
374
- negative: "text-button-text-negative-icon",
375
- neutral: "text-button-text-neutral-icon"
376
- }[color];
377
- return /* @__PURE__ */ jsxs3(
378
- "button",
379
- {
380
- onClick: disabled ? void 0 : onClick,
381
- disabled: disabled || onClick === void 0,
382
- className: clsx4(
383
- {
384
- "text-disabled-text cursor-not-allowed": disabled,
385
- [clsx4(colorClasses, "hover:bg-button-text-hover-background rounded-full")]: !disabled
386
- },
387
- ButtonUtil.paddingMapping[size],
388
- className
389
- ),
390
- ...restProps,
391
- children: [
392
- startIcon && /* @__PURE__ */ jsx5(
393
- "span",
394
- {
395
- className: clsx4({
396
- [iconColorClasses]: !disabled,
397
- [`text-disabled-icon`]: disabled
398
- }),
399
- children: startIcon
400
- }
401
- ),
402
- children,
403
- endIcon && /* @__PURE__ */ jsx5(
404
- "span",
405
- {
406
- className: clsx4({
407
- [iconColorClasses]: !disabled,
408
- [`text-disabled-icon`]: disabled
409
- }),
410
- children: endIcon
411
- }
412
- )
413
- ]
414
- }
415
- );
416
- };
417
-
418
- // src/components/properties/PropertyBase.tsx
419
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
420
- var defaultPropertyBaseTranslation = {
421
- en: {
422
- remove: "Remove"
423
- },
424
- de: {
425
- remove: "Entfernen"
426
- }
427
- };
428
- var PropertyBase = ({
429
- overwriteTranslation,
430
- name,
431
- input,
432
- softRequired = false,
433
- hasValue,
434
- icon,
435
- readOnly,
436
- onRemove,
437
- className = ""
438
- }) => {
439
- const translation = useTranslation(defaultPropertyBaseTranslation, overwriteTranslation);
440
- const requiredAndNoValue = softRequired && !hasValue;
441
- return /* @__PURE__ */ jsxs4("div", { className: clsx5("row gap-x-0 group", className), children: [
442
- /* @__PURE__ */ jsxs4(
443
- "div",
444
- {
445
- className: clsx5("row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0", {
446
- "bg-property-title-background property-title-text group-hover:border-primary": !requiredAndNoValue,
447
- "bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
448
- }, className),
449
- children: [
450
- icon,
451
- name
452
- ]
453
- }
454
- ),
455
- /* @__PURE__ */ jsxs4(
456
- "div",
457
- {
458
- className: clsx5("row grow justify-between items-center rounded-r-xl border-2 border-l-0", {
459
- "bg-surface group-hover:border-primary": !requiredAndNoValue,
460
- "bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
461
- }, className),
462
- children: [
463
- input({ softRequired, hasValue }),
464
- requiredAndNoValue && /* @__PURE__ */ jsx6("div", { className: "text-warning pr-4", children: /* @__PURE__ */ jsx6(AlertTriangle, { size: 24 }) }),
465
- onRemove && /* @__PURE__ */ jsx6(
466
- TextButton,
467
- {
468
- onClick: onRemove,
469
- color: "negative",
470
- className: clsx5("pr-4 items-center", { "!text-transparent": !hasValue || readOnly }),
471
- disabled: !hasValue || readOnly,
472
- children: translation.remove
742
+ index
743
+ )
473
744
  }
474
745
  )
475
- ]
476
- }
477
- )
746
+ }
747
+ )
748
+ ] })
478
749
  ] });
479
750
  };
480
751
 
481
752
  // src/components/properties/SelectProperty.tsx
482
- import { jsx as jsx7 } from "react/jsx-runtime";
483
- var defaultSingleSelectPropertyTranslation = {
484
- en: {
485
- select: "Select"
486
- },
487
- de: {
488
- select: "Ausw\xE4hlen"
489
- }
490
- };
753
+ import { jsx as jsx9 } from "react/jsx-runtime";
491
754
  var SingleSelectProperty = ({
492
755
  overwriteTranslation,
493
756
  value,
@@ -496,11 +759,11 @@ var SingleSelectProperty = ({
496
759
  readOnly = false,
497
760
  softRequired,
498
761
  onRemove,
499
- ...multiSelectProps
762
+ ...selectProps
500
763
  }) => {
501
- const translation = useTranslation(defaultSingleSelectPropertyTranslation, overwriteTranslation);
764
+ const translation = useTranslation([formTranslation], overwriteTranslation);
502
765
  const hasValue = value !== void 0;
503
- return /* @__PURE__ */ jsx7(
766
+ return /* @__PURE__ */ jsx9(
504
767
  PropertyBase,
505
768
  {
506
769
  name,
@@ -508,20 +771,20 @@ var SingleSelectProperty = ({
508
771
  readOnly,
509
772
  softRequired,
510
773
  hasValue,
511
- icon: /* @__PURE__ */ jsx7(List, { size: 16 }),
512
- input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ jsx7(
774
+ icon: /* @__PURE__ */ jsx9(List, { size: 16 }),
775
+ input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ jsx9(
513
776
  "div",
514
777
  {
515
- className: clsx6("row grow py-2 px-4 cursor-pointer", { "text-warning": softRequired2 && !hasValue }),
516
- children: /* @__PURE__ */ jsx7(
517
- SearchableSelect,
778
+ className: clsx8("row grow py-2 px-4 cursor-pointer", { "text-warning": softRequired2 && !hasValue }),
779
+ children: /* @__PURE__ */ jsx9(
780
+ Select,
518
781
  {
519
- ...multiSelectProps,
782
+ ...selectProps,
520
783
  value,
521
784
  options,
522
785
  isDisabled: readOnly,
523
- className: clsx6("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
524
- hintText: `${translation.select}...`
786
+ className: clsx8("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
787
+ hintText: `${translation("select")}...`
525
788
  }
526
789
  )
527
790
  }