@helpwave/hightide 0.1.7 → 0.1.8

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 (175) 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.js +18 -20
  6. package/dist/components/date/DatePicker.js.map +1 -1
  7. package/dist/components/date/DatePicker.mjs +18 -20
  8. package/dist/components/date/DatePicker.mjs.map +1 -1
  9. package/dist/components/date/DayPicker.d.mts +1 -1
  10. package/dist/components/date/DayPicker.d.ts +1 -1
  11. package/dist/components/date/DayPicker.js +23 -11
  12. package/dist/components/date/DayPicker.js.map +1 -1
  13. package/dist/components/date/DayPicker.mjs +23 -11
  14. package/dist/components/date/DayPicker.mjs.map +1 -1
  15. package/dist/components/date/YearMonthPicker.js +106 -22
  16. package/dist/components/date/YearMonthPicker.js.map +1 -1
  17. package/dist/components/date/YearMonthPicker.mjs +106 -22
  18. package/dist/components/date/YearMonthPicker.mjs.map +1 -1
  19. package/dist/components/dialogs/ConfirmDialog.js +2 -2
  20. package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
  21. package/dist/components/dialogs/ConfirmDialog.mjs +2 -2
  22. package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
  23. package/dist/components/icons-and-geometry/Avatar.js +2 -2
  24. package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
  25. package/dist/components/icons-and-geometry/Avatar.mjs +2 -2
  26. package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
  27. package/dist/components/layout-and-navigation/Carousel.d.mts +1 -1
  28. package/dist/components/layout-and-navigation/Carousel.d.ts +1 -1
  29. package/dist/components/layout-and-navigation/Carousel.js +86 -28
  30. package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
  31. package/dist/components/layout-and-navigation/Carousel.mjs +86 -28
  32. package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
  33. package/dist/components/layout-and-navigation/Expandable.d.mts +3 -0
  34. package/dist/components/layout-and-navigation/Expandable.d.ts +3 -0
  35. package/dist/components/layout-and-navigation/Expandable.js +4 -3
  36. package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
  37. package/dist/components/layout-and-navigation/Expandable.mjs +4 -3
  38. package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
  39. package/dist/components/layout-and-navigation/FAQSection.js +4 -3
  40. package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
  41. package/dist/components/layout-and-navigation/FAQSection.mjs +4 -3
  42. package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
  43. package/dist/components/layout-and-navigation/Overlay.js +2 -2
  44. package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
  45. package/dist/components/layout-and-navigation/Overlay.mjs +2 -2
  46. package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
  47. package/dist/components/layout-and-navigation/SearchableList.d.mts +7 -6
  48. package/dist/components/layout-and-navigation/SearchableList.d.ts +7 -6
  49. package/dist/components/layout-and-navigation/SearchableList.js +114 -21
  50. package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
  51. package/dist/components/layout-and-navigation/SearchableList.mjs +114 -21
  52. package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
  53. package/dist/components/layout-and-navigation/StepperBar.js +6 -6
  54. package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
  55. package/dist/components/layout-and-navigation/StepperBar.mjs +6 -6
  56. package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
  57. package/dist/components/layout-and-navigation/Table.js +1 -1
  58. package/dist/components/layout-and-navigation/Table.js.map +1 -1
  59. package/dist/components/layout-and-navigation/Table.mjs +1 -1
  60. package/dist/components/layout-and-navigation/Table.mjs.map +1 -1
  61. package/dist/components/layout-and-navigation/Tile.d.mts +10 -15
  62. package/dist/components/layout-and-navigation/Tile.d.ts +10 -15
  63. package/dist/components/layout-and-navigation/Tile.js +30 -8
  64. package/dist/components/layout-and-navigation/Tile.js.map +1 -1
  65. package/dist/components/layout-and-navigation/Tile.mjs +30 -8
  66. package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
  67. package/dist/components/loading-states/ProgressIndicator.js +2 -2
  68. package/dist/components/loading-states/ProgressIndicator.js.map +1 -1
  69. package/dist/components/loading-states/ProgressIndicator.mjs +2 -2
  70. package/dist/components/loading-states/ProgressIndicator.mjs.map +1 -1
  71. package/dist/components/modals/ConfirmModal.js +2 -2
  72. package/dist/components/modals/ConfirmModal.js.map +1 -1
  73. package/dist/components/modals/ConfirmModal.mjs +2 -2
  74. package/dist/components/modals/ConfirmModal.mjs.map +1 -1
  75. package/dist/components/modals/DiscardChangesModal.js +2 -2
  76. package/dist/components/modals/DiscardChangesModal.js.map +1 -1
  77. package/dist/components/modals/DiscardChangesModal.mjs +2 -2
  78. package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
  79. package/dist/components/modals/InputModal.js +2 -2
  80. package/dist/components/modals/InputModal.js.map +1 -1
  81. package/dist/components/modals/InputModal.mjs +2 -2
  82. package/dist/components/modals/InputModal.mjs.map +1 -1
  83. package/dist/components/modals/LanguageModal.js +384 -150
  84. package/dist/components/modals/LanguageModal.js.map +1 -1
  85. package/dist/components/modals/LanguageModal.mjs +383 -149
  86. package/dist/components/modals/LanguageModal.mjs.map +1 -1
  87. package/dist/components/modals/ThemeModal.js +385 -154
  88. package/dist/components/modals/ThemeModal.js.map +1 -1
  89. package/dist/components/modals/ThemeModal.mjs +382 -151
  90. package/dist/components/modals/ThemeModal.mjs.map +1 -1
  91. package/dist/components/properties/CheckboxProperty.js +1 -1
  92. package/dist/components/properties/CheckboxProperty.js.map +1 -1
  93. package/dist/components/properties/CheckboxProperty.mjs +1 -1
  94. package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
  95. package/dist/components/properties/DateProperty.js +1 -1
  96. package/dist/components/properties/DateProperty.js.map +1 -1
  97. package/dist/components/properties/DateProperty.mjs +1 -1
  98. package/dist/components/properties/DateProperty.mjs.map +1 -1
  99. package/dist/components/properties/MultiSelectProperty.d.mts +1 -0
  100. package/dist/components/properties/MultiSelectProperty.d.ts +1 -0
  101. package/dist/components/properties/MultiSelectProperty.js +482 -430
  102. package/dist/components/properties/MultiSelectProperty.js.map +1 -1
  103. package/dist/components/properties/MultiSelectProperty.mjs +478 -426
  104. package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
  105. package/dist/components/properties/NumberProperty.js +1 -1
  106. package/dist/components/properties/NumberProperty.js.map +1 -1
  107. package/dist/components/properties/NumberProperty.mjs +1 -1
  108. package/dist/components/properties/NumberProperty.mjs.map +1 -1
  109. package/dist/components/properties/PropertyBase.js +1 -1
  110. package/dist/components/properties/PropertyBase.js.map +1 -1
  111. package/dist/components/properties/PropertyBase.mjs +1 -1
  112. package/dist/components/properties/PropertyBase.mjs.map +1 -1
  113. package/dist/components/properties/SelectProperty.d.mts +3 -3
  114. package/dist/components/properties/SelectProperty.d.ts +3 -3
  115. package/dist/components/properties/SelectProperty.js +404 -263
  116. package/dist/components/properties/SelectProperty.js.map +1 -1
  117. package/dist/components/properties/SelectProperty.mjs +404 -263
  118. package/dist/components/properties/SelectProperty.mjs.map +1 -1
  119. package/dist/components/properties/TextProperty.js +1 -1
  120. package/dist/components/properties/TextProperty.js.map +1 -1
  121. package/dist/components/properties/TextProperty.mjs +1 -1
  122. package/dist/components/properties/TextProperty.mjs.map +1 -1
  123. package/dist/components/user-action/DateAndTimePicker.js +18 -20
  124. package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
  125. package/dist/components/user-action/DateAndTimePicker.mjs +18 -20
  126. package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
  127. package/dist/components/user-action/Menu.d.mts +14 -8
  128. package/dist/components/user-action/Menu.d.ts +14 -8
  129. package/dist/components/user-action/Menu.js +32 -11
  130. package/dist/components/user-action/Menu.js.map +1 -1
  131. package/dist/components/user-action/Menu.mjs +32 -11
  132. package/dist/components/user-action/Menu.mjs.map +1 -1
  133. package/dist/components/user-action/MultiSelect.d.mts +10 -16
  134. package/dist/components/user-action/MultiSelect.d.ts +10 -16
  135. package/dist/components/user-action/MultiSelect.js +485 -312
  136. package/dist/components/user-action/MultiSelect.js.map +1 -1
  137. package/dist/components/user-action/MultiSelect.mjs +482 -310
  138. package/dist/components/user-action/MultiSelect.mjs.map +1 -1
  139. package/dist/components/user-action/Select.d.mts +5 -18
  140. package/dist/components/user-action/Select.d.ts +5 -18
  141. package/dist/components/user-action/Select.js +309 -113
  142. package/dist/components/user-action/Select.js.map +1 -1
  143. package/dist/components/user-action/Select.mjs +304 -107
  144. package/dist/components/user-action/Select.mjs.map +1 -1
  145. package/dist/components/user-action/Tooltip.js +2 -2
  146. package/dist/components/user-action/Tooltip.js.map +1 -1
  147. package/dist/components/user-action/Tooltip.mjs +2 -2
  148. package/dist/components/user-action/Tooltip.mjs.map +1 -1
  149. package/dist/css/globals.css +213 -205
  150. package/dist/css/uncompiled/globals.css +136 -72
  151. package/dist/hooks/useSearch.d.mts +17 -0
  152. package/dist/hooks/useSearch.d.ts +17 -0
  153. package/dist/hooks/useSearch.js +66 -0
  154. package/dist/hooks/useSearch.js.map +1 -0
  155. package/dist/hooks/useSearch.mjs +42 -0
  156. package/dist/hooks/useSearch.mjs.map +1 -0
  157. package/dist/index.d.mts +7 -5
  158. package/dist/index.d.ts +7 -5
  159. package/dist/index.js +555 -463
  160. package/dist/index.js.map +1 -1
  161. package/dist/index.mjs +517 -427
  162. package/dist/index.mjs.map +1 -1
  163. package/dist/util/PropsWithFunctionChildren.d.mts +14 -0
  164. package/dist/util/PropsWithFunctionChildren.d.ts +14 -0
  165. package/dist/util/PropsWithFunctionChildren.js +38 -0
  166. package/dist/util/PropsWithFunctionChildren.js.map +1 -0
  167. package/dist/util/PropsWithFunctionChildren.mjs +14 -0
  168. package/dist/util/PropsWithFunctionChildren.mjs.map +1 -0
  169. package/dist/util/simpleSearch.d.mts +2 -2
  170. package/dist/util/simpleSearch.d.ts +2 -2
  171. package/dist/util/simpleSearch.js +4 -1
  172. package/dist/util/simpleSearch.js.map +1 -1
  173. package/dist/util/simpleSearch.mjs +4 -1
  174. package/dist/util/simpleSearch.mjs.map +1 -1
  175. 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";
@@ -41,15 +41,196 @@ var useTranslation = (defaults, translationOverwrite = {}) => {
41
41
  return defaultValues;
42
42
  };
43
43
 
44
+ // src/components/properties/PropertyBase.tsx
45
+ import { AlertTriangle } from "lucide-react";
46
+ import clsx2 from "clsx";
47
+
48
+ // src/components/user-action/Button.tsx
49
+ import clsx from "clsx";
50
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
51
+ var paddingMapping = {
52
+ small: "btn-sm",
53
+ medium: "btn-md",
54
+ large: "btn-lg"
55
+ };
56
+ var iconPaddingMapping = {
57
+ small: "icon-btn-sm",
58
+ medium: "icon-btn-md",
59
+ large: "icon-btn-lg"
60
+ };
61
+ var ButtonUtil = {
62
+ paddingMapping,
63
+ iconPaddingMapping
64
+ };
65
+ var TextButton = ({
66
+ children,
67
+ disabled = false,
68
+ color = "neutral",
69
+ size = "medium",
70
+ startIcon,
71
+ endIcon,
72
+ onClick,
73
+ className,
74
+ ...restProps
75
+ }) => {
76
+ const colorClasses = {
77
+ primary: "bg-transparent text-button-text-primary-text",
78
+ negative: "bg-transparent text-button-text-negative-text",
79
+ neutral: "bg-transparent text-button-text-neutral-text"
80
+ }[color];
81
+ const iconColorClasses = {
82
+ primary: "text-button-text-primary-icon",
83
+ negative: "text-button-text-negative-icon",
84
+ neutral: "text-button-text-neutral-icon"
85
+ }[color];
86
+ return /* @__PURE__ */ jsxs(
87
+ "button",
88
+ {
89
+ onClick: disabled ? void 0 : onClick,
90
+ disabled: disabled || onClick === void 0,
91
+ className: clsx(
92
+ {
93
+ "text-disabled-text cursor-not-allowed": disabled,
94
+ [clsx(colorClasses, "hover:bg-button-text-hover-background rounded-full")]: !disabled
95
+ },
96
+ ButtonUtil.paddingMapping[size],
97
+ className
98
+ ),
99
+ ...restProps,
100
+ children: [
101
+ startIcon && /* @__PURE__ */ jsx2(
102
+ "span",
103
+ {
104
+ className: clsx({
105
+ [iconColorClasses]: !disabled,
106
+ [`text-disabled-icon`]: disabled
107
+ }),
108
+ children: startIcon
109
+ }
110
+ ),
111
+ children,
112
+ endIcon && /* @__PURE__ */ jsx2(
113
+ "span",
114
+ {
115
+ className: clsx({
116
+ [iconColorClasses]: !disabled,
117
+ [`text-disabled-icon`]: disabled
118
+ }),
119
+ children: endIcon
120
+ }
121
+ )
122
+ ]
123
+ }
124
+ );
125
+ };
126
+ var IconButton = ({
127
+ children,
128
+ disabled = false,
129
+ color = "primary",
130
+ size = "medium",
131
+ onClick,
132
+ className,
133
+ ...restProps
134
+ }) => {
135
+ const colorClasses = {
136
+ primary: "bg-button-solid-primary-background text-button-solid-primary-text",
137
+ secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
138
+ tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
139
+ positive: "bg-button-solid-positive-background text-button-solid-positive-text",
140
+ warning: "bg-button-solid-warning-background text-button-solid-warning-text",
141
+ negative: "bg-button-solid-negative-background text-button-solid-negative-text",
142
+ neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
143
+ }[color];
144
+ return /* @__PURE__ */ jsx2(
145
+ "button",
146
+ {
147
+ onClick: disabled ? void 0 : onClick,
148
+ disabled: disabled || onClick === void 0,
149
+ className: clsx(
150
+ {
151
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
152
+ [clsx(colorClasses, "hover:brightness-90")]: !disabled
153
+ },
154
+ ButtonUtil.iconPaddingMapping[size],
155
+ className
156
+ ),
157
+ ...restProps,
158
+ children
159
+ }
160
+ );
161
+ };
162
+
163
+ // src/components/properties/PropertyBase.tsx
164
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
165
+ var defaultPropertyBaseTranslation = {
166
+ en: {
167
+ remove: "Remove"
168
+ },
169
+ de: {
170
+ remove: "Entfernen"
171
+ }
172
+ };
173
+ var PropertyBase = ({
174
+ overwriteTranslation,
175
+ name,
176
+ input,
177
+ softRequired = false,
178
+ hasValue,
179
+ icon,
180
+ readOnly,
181
+ onRemove,
182
+ className = ""
183
+ }) => {
184
+ const translation = useTranslation(defaultPropertyBaseTranslation, overwriteTranslation);
185
+ const requiredAndNoValue = softRequired && !hasValue;
186
+ return /* @__PURE__ */ jsxs2("div", { className: clsx2("row gap-x-0 group", className), children: [
187
+ /* @__PURE__ */ jsxs2(
188
+ "div",
189
+ {
190
+ className: clsx2("row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0", {
191
+ "bg-property-title-background property-title-text group-hover:border-primary": !requiredAndNoValue,
192
+ "bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
193
+ }, className),
194
+ children: [
195
+ icon,
196
+ name
197
+ ]
198
+ }
199
+ ),
200
+ /* @__PURE__ */ jsxs2(
201
+ "div",
202
+ {
203
+ className: clsx2("row gap-x-0 grow justify-between items-center rounded-r-xl border-2 border-l-0", {
204
+ "bg-surface group-hover:border-primary": !requiredAndNoValue,
205
+ "bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
206
+ }, className),
207
+ children: [
208
+ input({ softRequired, hasValue }),
209
+ requiredAndNoValue && /* @__PURE__ */ jsx3("div", { className: "text-warning pr-4", children: /* @__PURE__ */ jsx3(AlertTriangle, { size: 24 }) }),
210
+ onRemove && /* @__PURE__ */ jsx3(
211
+ TextButton,
212
+ {
213
+ onClick: onRemove,
214
+ color: "negative",
215
+ className: clsx2("pr-4 items-center", { "!text-transparent": !hasValue || readOnly }),
216
+ disabled: !hasValue || readOnly,
217
+ children: translation.remove
218
+ }
219
+ )
220
+ ]
221
+ }
222
+ )
223
+ ] });
224
+ };
225
+
44
226
  // 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";
227
+ import { ChevronDown, ChevronUp } from "lucide-react";
228
+ import { useEffect as useEffect7, useRef as useRef2, useState as useState6 } from "react";
229
+ import clsx7 from "clsx";
49
230
 
50
231
  // src/components/user-action/Label.tsx
51
- import clsx from "clsx";
52
- import { jsx as jsx2 } from "react/jsx-runtime";
232
+ import clsx3 from "clsx";
233
+ import { jsx as jsx4 } from "react/jsx-runtime";
53
234
  var styleMapping = {
54
235
  labelSmall: "textstyle-label-sm",
55
236
  labelMedium: "textstyle-label-md",
@@ -62,20 +243,16 @@ var Label = ({
62
243
  className,
63
244
  ...props
64
245
  }) => {
65
- return /* @__PURE__ */ jsx2("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
246
+ return /* @__PURE__ */ jsx4("label", { ...props, className: clsx3(styleMapping[labelType], className), children: children ? children : name });
66
247
  };
67
248
 
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
- };
249
+ // src/components/layout-and-navigation/SearchableList.tsx
250
+ import { Search } from "lucide-react";
251
+ import clsx5 from "clsx";
75
252
 
76
253
  // src/components/user-action/Input.tsx
77
254
  import { forwardRef, useEffect as useEffect4, useRef, useState as useState4 } from "react";
78
- import clsx2 from "clsx";
255
+ import clsx4 from "clsx";
79
256
 
80
257
  // src/hooks/useSaveDelay.ts
81
258
  import { useEffect as useEffect3, useState as useState3 } from "react";
@@ -121,7 +298,7 @@ function useSaveDelay(setNotificationStatus, delay) {
121
298
  var noop = () => void 0;
122
299
 
123
300
  // src/components/user-action/Input.tsx
124
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
301
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
125
302
  var Input = ({
126
303
  id,
127
304
  type = "text",
@@ -147,9 +324,9 @@ var Input = ({
147
324
  ref.current?.focus();
148
325
  }
149
326
  }, [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(
327
+ return /* @__PURE__ */ jsxs3("div", { className: clsx4({ "w-full": expanded }, containerClassName), children: [
328
+ label && /* @__PURE__ */ jsx5(Label, { ...label, htmlFor: id, className: clsx4("mb-1", label.className) }),
329
+ /* @__PURE__ */ jsx5(
153
330
  "input",
154
331
  {
155
332
  ref,
@@ -193,13 +370,13 @@ var FormInput = forwardRef(function FormInput2({
193
370
  required,
194
371
  ...restProps
195
372
  }, ref) {
196
- const input = /* @__PURE__ */ jsx3(
373
+ const input = /* @__PURE__ */ jsx5(
197
374
  "input",
198
375
  {
199
376
  ref,
200
377
  id,
201
378
  ...restProps,
202
- className: clsx2(
379
+ className: clsx4(
203
380
  {
204
381
  "focus:border-primary focus:ring-primary": !errorText,
205
382
  "focus:border-negative focus:ring-negative text-negative": !!errorText
@@ -208,278 +385,242 @@ var FormInput = forwardRef(function FormInput2({
208
385
  )
209
386
  }
210
387
  );
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: [
388
+ return /* @__PURE__ */ jsxs3("div", { className: clsx4("flex flex-col gap-y-1", containerClassName), children: [
389
+ labelText && /* @__PURE__ */ jsxs3("label", { htmlFor: id, className: clsx4("textstyle-label-md", labelClassName), children: [
213
390
  labelText,
214
- required && /* @__PURE__ */ jsx3("span", { className: "text-primary font-bold", children: "*" })
391
+ required && /* @__PURE__ */ jsx5("span", { className: "text-primary font-bold", children: "*" })
215
392
  ] }),
216
393
  input,
217
- errorText && /* @__PURE__ */ jsx3("label", { htmlFor: id, className: clsx2("text-negative", errorClassName), children: errorText })
394
+ errorText && /* @__PURE__ */ jsx5("label", { htmlFor: id, className: clsx4("text-negative", errorClassName), children: errorText })
218
395
  ] });
219
396
  });
220
397
 
398
+ // src/hooks/useSearch.ts
399
+ import { useEffect as useEffect5, useMemo, useState as useState5 } from "react";
400
+
401
+ // src/util/simpleSearch.ts
402
+ var MultiSearchWithMapping = (search, objects, mapping) => {
403
+ return objects.filter((object) => {
404
+ const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
405
+ if (!mappedSearchKeywords) {
406
+ return true;
407
+ }
408
+ return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
409
+ });
410
+ };
411
+
412
+ // src/hooks/useSearch.ts
413
+ var useSearch = ({
414
+ list,
415
+ initialSearch,
416
+ searchMapping
417
+ }) => {
418
+ const [items, setItems] = useState5(list);
419
+ const [search, setSearch] = useState5(initialSearch);
420
+ useEffect5(() => {
421
+ setItems(list);
422
+ }, [list]);
423
+ const result = useMemo(
424
+ () => MultiSearchWithMapping(search, items, searchMapping),
425
+ [search, items, searchMapping]
426
+ );
427
+ return {
428
+ result,
429
+ hasResult: result.length > 0,
430
+ allItems: items,
431
+ setItems,
432
+ search,
433
+ setSearch
434
+ };
435
+ };
436
+
437
+ // src/components/layout-and-navigation/SearchableList.tsx
438
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
439
+ var defaultSearchableListTranslation = {
440
+ en: {
441
+ search: "Search",
442
+ nothingFound: "Nothing found"
443
+ },
444
+ de: {
445
+ search: "Suche",
446
+ nothingFound: "Nichts gefunden"
447
+ }
448
+ };
449
+ var SearchableList = ({
450
+ overwriteTranslation,
451
+ list,
452
+ initialSearch = "",
453
+ searchMapping,
454
+ autoFocus,
455
+ minimumItemsForSearch = 6,
456
+ itemMapper,
457
+ className,
458
+ resultListClassName
459
+ }) => {
460
+ const translation = useTranslation(defaultSearchableListTranslation, overwriteTranslation);
461
+ const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
462
+ return /* @__PURE__ */ jsxs4("div", { className: clsx5("col gap-y-2", className), children: [
463
+ list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs4("div", { className: "row justify-between gap-x-4 items-center", children: [
464
+ /* @__PURE__ */ jsx6(
465
+ Input,
466
+ {
467
+ value: search,
468
+ onChangeText: setSearch,
469
+ placeholder: translation.search,
470
+ autoFocus,
471
+ className: "w-full"
472
+ }
473
+ ),
474
+ /* @__PURE__ */ jsx6(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx6(Search, { className: "w-full h-full" }) })
475
+ ] }),
476
+ 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 })
477
+ ] });
478
+ };
479
+
480
+ // src/components/layout-and-navigation/Tile.tsx
481
+ import clsx6 from "clsx";
482
+ import { Check } from "lucide-react";
483
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
484
+ var Tile = ({
485
+ title,
486
+ description,
487
+ onClick,
488
+ isSelected = false,
489
+ isDisabled = false,
490
+ prefix,
491
+ suffix,
492
+ normalClassName = "hover:bg-primary/40 cursor-pointer",
493
+ selectedClassName = " bg-primary/20",
494
+ disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
495
+ className
496
+ }) => {
497
+ return /* @__PURE__ */ jsxs5(
498
+ "div",
499
+ {
500
+ className: clsx6(
501
+ "row gap-x-2 w-full items-center",
502
+ {
503
+ [normalClassName]: !!onClick && !isDisabled,
504
+ [selectedClassName]: isSelected && !isDisabled,
505
+ [disabledClassName]: isDisabled
506
+ },
507
+ className
508
+ ),
509
+ onClick: isDisabled ? void 0 : onClick,
510
+ children: [
511
+ prefix ?? (isSelected ? /* @__PURE__ */ jsx7(Check, { size: 24 }) : void 0),
512
+ /* @__PURE__ */ jsxs5("div", { className: "col gap-y-0 w-full", children: [
513
+ /* @__PURE__ */ jsx7("h4", { className: clsx6(title.className ?? "textstyle-title-normal"), children: title.value }),
514
+ !!description && /* @__PURE__ */ jsx7("span", { className: clsx6(description.className ?? "textstyle-description"), children: description.value })
515
+ ] }),
516
+ suffix
517
+ ]
518
+ }
519
+ );
520
+ };
521
+
522
+ // src/hooks/useOutsideClick.ts
523
+ import { useEffect as useEffect6 } from "react";
524
+ var useOutsideClick = (refs, handler) => {
525
+ useEffect6(() => {
526
+ const listener = (event) => {
527
+ if (event.target === null) return;
528
+ if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
529
+ return;
530
+ }
531
+ handler();
532
+ };
533
+ document.addEventListener("mousedown", listener);
534
+ document.addEventListener("touchstart", listener);
535
+ return () => {
536
+ document.removeEventListener("mousedown", listener);
537
+ document.removeEventListener("touchstart", listener);
538
+ };
539
+ }, [refs, handler]);
540
+ };
541
+
221
542
  // src/components/user-action/Select.tsx
222
- import { Fragment, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
543
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
223
544
  var Select = ({
224
545
  value,
225
546
  label,
226
547
  options,
227
548
  onChange,
228
- isHidingCurrentValue = true,
229
549
  hintText = "",
230
- showDisabledOptions = true,
231
550
  isDisabled,
551
+ isSearchEnabled = false,
232
552
  className,
233
- textColor = "text-menu-text",
234
- additionalItems,
235
553
  selectedDisplayOverwrite
236
554
  }) => {
237
- let filteredOptions = isHidingCurrentValue ? options.filter((option) => option.value !== value) : options;
238
- if (!showDisabledOptions) {
239
- filteredOptions = filteredOptions.filter((value2) => !value2.disabled);
240
- }
555
+ const triggerRef = useRef2(null);
556
+ const menuRef = useRef2(null);
557
+ const [isOpen, setIsOpen] = useState6(false);
558
+ useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
241
559
  const selectedOption = options.find((option) => option.value === value);
242
560
  if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
243
561
  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
562
  }
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,
563
+ const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
564
+ return /* @__PURE__ */ jsxs6("div", { className: clsx7(className), children: [
565
+ label && /* @__PURE__ */ jsx8(Label, { ...label, labelType: label.labelType ?? "labelBig", className: clsx7("mb-1", label.className) }),
566
+ /* @__PURE__ */ jsxs6("div", { className: "relative", children: [
567
+ /* @__PURE__ */ jsxs6(
568
+ "button",
251
569
  {
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,
570
+ ref: triggerRef,
571
+ className: clsx7(
572
+ "btn-md justify-between w-full border-2",
256
573
  {
257
574
  "rounded-b-lg": !open,
258
- "hover:border-primary": !isDisabled,
259
- "bg-disabled-background cursor-not-allowed text-disabled": isDisabled
575
+ "bg-menu-background border-menu-border hover:border-primary": !isDisabled,
576
+ "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
260
577
  }
261
578
  ),
579
+ onClick: () => setIsOpen(!isOpen),
262
580
  disabled: isDisabled,
263
581
  children: [
264
- /* @__PURE__ */ jsx4("span", { children: selectedDisplayOverwrite ?? selectedOption?.label ?? hintText }),
265
- open ? /* @__PURE__ */ jsx4(ChevronUp, {}) : /* @__PURE__ */ jsx4(ChevronDown, {})
582
+ !isShowingHint && /* @__PURE__ */ jsx8("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? selectedOption?.label }),
583
+ isShowingHint && /* @__PURE__ */ jsx8("span", { className: "textstyle-description", children: hintText }),
584
+ isOpen ? /* @__PURE__ */ jsx8(ChevronUp, {}) : /* @__PURE__ */ jsx8(ChevronDown, {})
266
585
  ]
267
586
  }
268
587
  ),
269
- /* @__PURE__ */ jsxs2(
270
- Menu.Items,
588
+ isOpen && /* @__PURE__ */ jsx8(
589
+ "div",
271
590
  {
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) {
591
+ ref: menuRef,
592
+ 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",
593
+ children: /* @__PURE__ */ jsx8(
594
+ SearchableList,
595
+ {
596
+ list: options,
597
+ minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
598
+ searchMapping: (item) => item.searchTags,
599
+ itemMapper: (option, index) => /* @__PURE__ */ jsx8(
600
+ Tile,
601
+ {
602
+ isSelected: selectedOption?.value === option.value,
603
+ className: "px-2 py-1 rounded-md",
604
+ disabledClassName: "text-disabled-text cursor-not-allowed",
605
+ title: { value: option.label, className: "font-semibold" },
606
+ onClick: () => {
301
607
  onChange(option.value);
302
- }
608
+ setIsOpen(false);
609
+ },
610
+ isDisabled: option.disabled
303
611
  },
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
612
+ index
613
+ )
473
614
  }
474
615
  )
475
- ]
476
- }
477
- )
616
+ }
617
+ )
618
+ ] })
478
619
  ] });
479
620
  };
480
621
 
481
622
  // src/components/properties/SelectProperty.tsx
482
- import { jsx as jsx7 } from "react/jsx-runtime";
623
+ import { jsx as jsx9 } from "react/jsx-runtime";
483
624
  var defaultSingleSelectPropertyTranslation = {
484
625
  en: {
485
626
  select: "Select"
@@ -496,11 +637,11 @@ var SingleSelectProperty = ({
496
637
  readOnly = false,
497
638
  softRequired,
498
639
  onRemove,
499
- ...multiSelectProps
640
+ ...selectProps
500
641
  }) => {
501
642
  const translation = useTranslation(defaultSingleSelectPropertyTranslation, overwriteTranslation);
502
643
  const hasValue = value !== void 0;
503
- return /* @__PURE__ */ jsx7(
644
+ return /* @__PURE__ */ jsx9(
504
645
  PropertyBase,
505
646
  {
506
647
  name,
@@ -508,19 +649,19 @@ var SingleSelectProperty = ({
508
649
  readOnly,
509
650
  softRequired,
510
651
  hasValue,
511
- icon: /* @__PURE__ */ jsx7(List, { size: 16 }),
512
- input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ jsx7(
652
+ icon: /* @__PURE__ */ jsx9(List, { size: 16 }),
653
+ input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ jsx9(
513
654
  "div",
514
655
  {
515
- className: clsx6("row grow py-2 px-4 cursor-pointer", { "text-warning": softRequired2 && !hasValue }),
516
- children: /* @__PURE__ */ jsx7(
517
- SearchableSelect,
656
+ className: clsx8("row grow py-2 px-4 cursor-pointer", { "text-warning": softRequired2 && !hasValue }),
657
+ children: /* @__PURE__ */ jsx9(
658
+ Select,
518
659
  {
519
- ...multiSelectProps,
660
+ ...selectProps,
520
661
  value,
521
662
  options,
522
663
  isDisabled: readOnly,
523
- className: clsx6("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
664
+ className: clsx8("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
524
665
  hintText: `${translation.select}...`
525
666
  }
526
667
  )