@helpwave/hightide 0.1.18 → 0.1.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/dist/components/branding/HelpwaveBadge.js +7 -7
  2. package/dist/components/branding/HelpwaveBadge.js.map +1 -1
  3. package/dist/components/branding/HelpwaveBadge.mjs +7 -7
  4. package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
  5. package/dist/components/date/DatePicker.js +67 -39
  6. package/dist/components/date/DatePicker.js.map +1 -1
  7. package/dist/components/date/DatePicker.mjs +56 -28
  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 +48 -20
  18. package/dist/components/date/YearMonthPicker.js.map +1 -1
  19. package/dist/components/date/YearMonthPicker.mjs +46 -18
  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 +10 -1
  46. package/dist/components/layout-and-navigation/Expandable.d.ts +10 -1
  47. package/dist/components/layout-and-navigation/Expandable.js +38 -10
  48. package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
  49. package/dist/components/layout-and-navigation/Expandable.mjs +38 -11
  50. package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
  51. package/dist/components/layout-and-navigation/FAQSection.js +36 -12
  52. package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
  53. package/dist/components/layout-and-navigation/FAQSection.mjs +38 -14
  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.d.mts +5 -10
  86. package/dist/components/loading-states/LoadingAndErrorComponent.d.ts +5 -10
  87. package/dist/components/loading-states/LoadingAndErrorComponent.js +14 -327
  88. package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
  89. package/dist/components/loading-states/LoadingAndErrorComponent.mjs +15 -318
  90. package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
  91. package/dist/components/loading-states/LoadingAnimation.js +5 -1
  92. package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
  93. package/dist/components/loading-states/LoadingAnimation.mjs +5 -1
  94. package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
  95. package/dist/components/loading-states/LoadingButton.js +8 -6
  96. package/dist/components/loading-states/LoadingButton.js.map +1 -1
  97. package/dist/components/loading-states/LoadingButton.mjs +8 -6
  98. package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
  99. package/dist/components/loading-states/LoadingContainer.d.mts +8 -0
  100. package/dist/components/loading-states/LoadingContainer.d.ts +8 -0
  101. package/dist/components/loading-states/LoadingContainer.js +34 -0
  102. package/dist/components/loading-states/LoadingContainer.js.map +1 -0
  103. package/dist/components/loading-states/LoadingContainer.mjs +10 -0
  104. package/dist/components/loading-states/LoadingContainer.mjs.map +1 -0
  105. package/dist/components/modals/ConfirmModal.js +32 -28
  106. package/dist/components/modals/ConfirmModal.js.map +1 -1
  107. package/dist/components/modals/ConfirmModal.mjs +18 -14
  108. package/dist/components/modals/ConfirmModal.mjs.map +1 -1
  109. package/dist/components/modals/DiscardChangesModal.js +28 -24
  110. package/dist/components/modals/DiscardChangesModal.js.map +1 -1
  111. package/dist/components/modals/DiscardChangesModal.mjs +18 -14
  112. package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
  113. package/dist/components/modals/InputModal.js +32 -28
  114. package/dist/components/modals/InputModal.js.map +1 -1
  115. package/dist/components/modals/InputModal.mjs +18 -14
  116. package/dist/components/modals/InputModal.mjs.map +1 -1
  117. package/dist/components/modals/LanguageModal.js +729 -434
  118. package/dist/components/modals/LanguageModal.js.map +1 -1
  119. package/dist/components/modals/LanguageModal.mjs +729 -430
  120. package/dist/components/modals/LanguageModal.mjs.map +1 -1
  121. package/dist/components/modals/ThemeModal.js +733 -438
  122. package/dist/components/modals/ThemeModal.js.map +1 -1
  123. package/dist/components/modals/ThemeModal.mjs +732 -433
  124. package/dist/components/modals/ThemeModal.mjs.map +1 -1
  125. package/dist/components/properties/CheckboxProperty.js +110 -35
  126. package/dist/components/properties/CheckboxProperty.js.map +1 -1
  127. package/dist/components/properties/CheckboxProperty.mjs +110 -35
  128. package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
  129. package/dist/components/properties/DateProperty.js +118 -41
  130. package/dist/components/properties/DateProperty.js.map +1 -1
  131. package/dist/components/properties/DateProperty.mjs +114 -37
  132. package/dist/components/properties/DateProperty.mjs.map +1 -1
  133. package/dist/components/properties/MultiSelectProperty.d.mts +10 -3
  134. package/dist/components/properties/MultiSelectProperty.d.ts +10 -3
  135. package/dist/components/properties/MultiSelectProperty.js +916 -463
  136. package/dist/components/properties/MultiSelectProperty.js.map +1 -1
  137. package/dist/components/properties/MultiSelectProperty.mjs +921 -464
  138. package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
  139. package/dist/components/properties/NumberProperty.js +101 -18
  140. package/dist/components/properties/NumberProperty.js.map +1 -1
  141. package/dist/components/properties/NumberProperty.mjs +101 -18
  142. package/dist/components/properties/NumberProperty.mjs.map +1 -1
  143. package/dist/components/properties/PropertyBase.js +103 -20
  144. package/dist/components/properties/PropertyBase.js.map +1 -1
  145. package/dist/components/properties/PropertyBase.mjs +99 -16
  146. package/dist/components/properties/PropertyBase.mjs.map +1 -1
  147. package/dist/components/properties/SelectProperty.d.mts +9 -2
  148. package/dist/components/properties/SelectProperty.d.ts +9 -2
  149. package/dist/components/properties/SelectProperty.js +683 -243
  150. package/dist/components/properties/SelectProperty.js.map +1 -1
  151. package/dist/components/properties/SelectProperty.mjs +687 -243
  152. package/dist/components/properties/SelectProperty.mjs.map +1 -1
  153. package/dist/components/properties/TextProperty.js +133 -46
  154. package/dist/components/properties/TextProperty.js.map +1 -1
  155. package/dist/components/properties/TextProperty.mjs +133 -46
  156. package/dist/components/properties/TextProperty.mjs.map +1 -1
  157. package/dist/components/table/Table.js +285 -185
  158. package/dist/components/table/Table.js.map +1 -1
  159. package/dist/components/table/Table.mjs +270 -166
  160. package/dist/components/table/Table.mjs.map +1 -1
  161. package/dist/components/table/TableFilterButton.js +179 -78
  162. package/dist/components/table/TableFilterButton.js.map +1 -1
  163. package/dist/components/table/TableFilterButton.mjs +160 -55
  164. package/dist/components/table/TableFilterButton.mjs.map +1 -1
  165. package/dist/components/table/TableSortButton.js +72 -3
  166. package/dist/components/table/TableSortButton.js.map +1 -1
  167. package/dist/components/table/TableSortButton.mjs +72 -3
  168. package/dist/components/table/TableSortButton.mjs.map +1 -1
  169. package/dist/components/user-action/Button.d.mts +15 -2
  170. package/dist/components/user-action/Button.d.ts +15 -2
  171. package/dist/components/user-action/Button.js +12 -12
  172. package/dist/components/user-action/Button.js.map +1 -1
  173. package/dist/components/user-action/Button.mjs +12 -12
  174. package/dist/components/user-action/Button.mjs.map +1 -1
  175. package/dist/components/user-action/Checkbox.js +6 -15
  176. package/dist/components/user-action/Checkbox.js.map +1 -1
  177. package/dist/components/user-action/Checkbox.mjs +6 -15
  178. package/dist/components/user-action/Checkbox.mjs.map +1 -1
  179. package/dist/components/user-action/CopyToClipboardWrapper.js +6 -2
  180. package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
  181. package/dist/components/user-action/CopyToClipboardWrapper.mjs +6 -2
  182. package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
  183. package/dist/components/user-action/DateAndTimePicker.js +81 -49
  184. package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
  185. package/dist/components/user-action/DateAndTimePicker.mjs +67 -35
  186. package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
  187. package/dist/components/user-action/Menu.d.mts +11 -6
  188. package/dist/components/user-action/Menu.d.ts +11 -6
  189. package/dist/components/user-action/Menu.js +128 -31
  190. package/dist/components/user-action/Menu.js.map +1 -1
  191. package/dist/components/user-action/Menu.mjs +134 -33
  192. package/dist/components/user-action/Menu.mjs.map +1 -1
  193. package/dist/components/user-action/MultiSelect.d.mts +17 -7
  194. package/dist/components/user-action/MultiSelect.d.ts +17 -7
  195. package/dist/components/user-action/MultiSelect.js +797 -375
  196. package/dist/components/user-action/MultiSelect.js.map +1 -1
  197. package/dist/components/user-action/MultiSelect.mjs +782 -356
  198. package/dist/components/user-action/MultiSelect.mjs.map +1 -1
  199. package/dist/components/user-action/ScrollPicker.js +2 -2
  200. package/dist/components/user-action/ScrollPicker.js.map +1 -1
  201. package/dist/components/user-action/ScrollPicker.mjs +2 -2
  202. package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
  203. package/dist/components/user-action/SearchBar.d.mts +14 -0
  204. package/dist/components/user-action/SearchBar.d.ts +14 -0
  205. package/dist/components/user-action/SearchBar.js +673 -0
  206. package/dist/components/user-action/SearchBar.js.map +1 -0
  207. package/dist/components/user-action/SearchBar.mjs +637 -0
  208. package/dist/components/user-action/SearchBar.mjs.map +1 -0
  209. package/dist/components/user-action/Select.d.mts +18 -5
  210. package/dist/components/user-action/Select.d.ts +18 -5
  211. package/dist/components/user-action/Select.js +765 -355
  212. package/dist/components/user-action/Select.js.map +1 -1
  213. package/dist/components/user-action/Select.mjs +762 -349
  214. package/dist/components/user-action/Select.mjs.map +1 -1
  215. package/dist/components/user-action/Textarea.d.mts +1 -1
  216. package/dist/components/user-action/Textarea.d.ts +1 -1
  217. package/dist/components/user-action/Textarea.js +13 -3
  218. package/dist/components/user-action/Textarea.js.map +1 -1
  219. package/dist/components/user-action/Textarea.mjs +13 -3
  220. package/dist/components/user-action/Textarea.mjs.map +1 -1
  221. package/dist/components/user-action/ToggleableInput.js +2 -2
  222. package/dist/components/user-action/ToggleableInput.js.map +1 -1
  223. package/dist/components/user-action/ToggleableInput.mjs +2 -2
  224. package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
  225. package/dist/css/globals.css +284 -113
  226. package/dist/css/uncompiled/globals.css +19 -13
  227. package/dist/css/uncompiled/theme/colors-component.css +12 -3
  228. package/dist/css/uncompiled/theme/colors-semantic.css +10 -7
  229. package/dist/css/uncompiled/utitlity/animation.css +96 -1
  230. package/dist/css/uncompiled/utitlity/general.css +16 -0
  231. package/dist/hooks/usePopoverPosition.d.mts +15 -0
  232. package/dist/hooks/usePopoverPosition.d.ts +15 -0
  233. package/dist/hooks/usePopoverPosition.js +81 -0
  234. package/dist/hooks/usePopoverPosition.js.map +1 -0
  235. package/dist/hooks/usePopoverPosition.mjs +57 -0
  236. package/dist/hooks/usePopoverPosition.mjs.map +1 -0
  237. package/dist/hooks/useSearch.d.mts +7 -2
  238. package/dist/hooks/useSearch.d.ts +7 -2
  239. package/dist/hooks/useSearch.js +44 -15
  240. package/dist/hooks/useSearch.js.map +1 -1
  241. package/dist/hooks/useSearch.mjs +45 -16
  242. package/dist/hooks/useSearch.mjs.map +1 -1
  243. package/dist/index.d.mts +7 -4
  244. package/dist/index.d.ts +7 -4
  245. package/dist/index.js +1197 -902
  246. package/dist/index.js.map +1 -1
  247. package/dist/index.mjs +1048 -754
  248. package/dist/index.mjs.map +1 -1
  249. package/dist/localization/defaults/form.d.mts +2 -0
  250. package/dist/localization/defaults/form.d.ts +2 -0
  251. package/dist/localization/defaults/form.js +4 -0
  252. package/dist/localization/defaults/form.js.map +1 -1
  253. package/dist/localization/defaults/form.mjs +4 -0
  254. package/dist/localization/defaults/form.mjs.map +1 -1
  255. package/dist/util/simpleSearch.d.mts +1 -1
  256. package/dist/util/simpleSearch.d.ts +1 -1
  257. package/dist/util/simpleSearch.js +4 -1
  258. package/dist/util/simpleSearch.js.map +1 -1
  259. package/dist/util/simpleSearch.mjs +4 -1
  260. package/dist/util/simpleSearch.mjs.map +1 -1
  261. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  // src/components/properties/MultiSelectProperty.tsx
2
- import { List } from "lucide-react";
3
- import clsx9 from "clsx";
2
+ import { List, Plus as Plus2 } from "lucide-react";
3
+ import clsx13 from "clsx";
4
4
 
5
5
  // src/localization/LanguageProvider.tsx
6
6
  import { createContext, useContext, useEffect as useEffect2, useState as useState2 } from "react";
@@ -90,9 +90,9 @@ var useTranslation = (translations, overwriteTranslation = {}) => {
90
90
  };
91
91
 
92
92
  // src/components/user-action/MultiSelect.tsx
93
- import { useEffect as useEffect8, useRef as useRef2, useState as useState6 } from "react";
94
- import { ChevronDown, ChevronUp } from "lucide-react";
95
- import clsx7 from "clsx";
93
+ import { useCallback as useCallback6 } from "react";
94
+ import { useEffect as useEffect12, useState as useState11 } from "react";
95
+ import clsx11 from "clsx";
96
96
 
97
97
  // src/components/user-action/Label.tsx
98
98
  import clsx from "clsx";
@@ -112,22 +112,394 @@ var Label = ({
112
112
  return /* @__PURE__ */ jsx2("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
113
113
  };
114
114
 
115
- // src/components/layout-and-navigation/SearchableList.tsx
116
- import { Search } from "lucide-react";
115
+ // src/components/user-action/Select.tsx
116
+ import { useCallback as useCallback5 } from "react";
117
+ import { useEffect as useEffect11, useState as useState9 } from "react";
118
+ import clsx8 from "clsx";
119
+
120
+ // src/components/layout-and-navigation/Tile.tsx
121
+ import clsx2 from "clsx";
122
+ import { Check } from "lucide-react";
123
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
124
+ var Tile = ({
125
+ title,
126
+ description,
127
+ onClick,
128
+ isSelected = false,
129
+ disabled = false,
130
+ prefix,
131
+ suffix,
132
+ normalClassName = "hover:bg-primary/40 cursor-pointer",
133
+ selectedClassName = " bg-primary/20",
134
+ disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
135
+ className
136
+ }) => {
137
+ return /* @__PURE__ */ jsxs(
138
+ "div",
139
+ {
140
+ className: clsx2(
141
+ "flex-row-2 w-full items-center",
142
+ {
143
+ [normalClassName]: !!onClick && !disabled,
144
+ [selectedClassName]: isSelected && !disabled,
145
+ [disabledClassName]: disabled
146
+ },
147
+ className
148
+ ),
149
+ onClick: disabled ? void 0 : onClick,
150
+ children: [
151
+ prefix,
152
+ /* @__PURE__ */ jsxs("div", { className: "flex-col-0 w-full", children: [
153
+ /* @__PURE__ */ jsx3("h4", { className: clsx2(title.className ?? "textstyle-title-normal"), children: title.value }),
154
+ !!description && /* @__PURE__ */ jsx3("span", { className: clsx2(description.className ?? "textstyle-description"), children: description.value })
155
+ ] }),
156
+ suffix ?? (isSelected ? /* @__PURE__ */ jsx3(Check, { size: 24 }) : void 0)
157
+ ]
158
+ }
159
+ );
160
+ };
161
+
162
+ // src/components/layout-and-navigation/Expandable.tsx
163
+ import { forwardRef, useCallback as useCallback2, useEffect as useEffect3, useState as useState3 } from "react";
164
+ import { ChevronDown } from "lucide-react";
165
+ import clsx3 from "clsx";
166
+
167
+ // src/util/noop.ts
168
+ var noop = () => void 0;
169
+
170
+ // src/components/layout-and-navigation/Expandable.tsx
171
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
172
+ var ExpansionIcon = ({ isExpanded, className }) => {
173
+ return /* @__PURE__ */ jsx4(
174
+ ChevronDown,
175
+ {
176
+ className: clsx3(
177
+ "min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
178
+ { "rotate-180": isExpanded },
179
+ className
180
+ )
181
+ }
182
+ );
183
+ };
184
+ var Expandable = forwardRef(function Expandable2({
185
+ children,
186
+ label,
187
+ icon,
188
+ isExpanded = false,
189
+ onChange = noop,
190
+ clickOnlyOnHeader = true,
191
+ disabled = false,
192
+ className,
193
+ headerClassName,
194
+ contentClassName,
195
+ contentExpandedClassName
196
+ }, ref) {
197
+ const defaultIcon = useCallback2((expanded) => /* @__PURE__ */ jsx4(ExpansionIcon, { isExpanded: expanded }), []);
198
+ icon ??= defaultIcon;
199
+ return /* @__PURE__ */ jsxs2(
200
+ "div",
201
+ {
202
+ ref,
203
+ className: clsx3("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
204
+ onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
205
+ children: [
206
+ /* @__PURE__ */ jsxs2(
207
+ "div",
208
+ {
209
+ className: clsx3(
210
+ "flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
211
+ {
212
+ "group-hover:brightness-97": !isExpanded,
213
+ "hover:brightness-97": isExpanded && !disabled,
214
+ "cursor-pointer": clickOnlyOnHeader && !disabled
215
+ },
216
+ headerClassName
217
+ ),
218
+ onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
219
+ children: [
220
+ label,
221
+ icon(isExpanded)
222
+ ]
223
+ }
224
+ ),
225
+ /* @__PURE__ */ jsx4(
226
+ "div",
227
+ {
228
+ className: clsx3(
229
+ "flex-col-2 px-4 transition-all duration-300 ease-in-out",
230
+ {
231
+ [clsx3("max-h-96 opacity-100 pb-2 overflow-y-auto", contentExpandedClassName)]: isExpanded,
232
+ "max-h-0 opacity-0 overflow-hidden": !isExpanded
233
+ },
234
+ contentClassName
235
+ ),
236
+ children
237
+ }
238
+ )
239
+ ]
240
+ }
241
+ );
242
+ });
243
+ var ExpandableUncontrolled = forwardRef(function ExpandableUncontrolled2({
244
+ isExpanded,
245
+ onChange = noop,
246
+ ...props
247
+ }, ref) {
248
+ const [usedIsExpanded, setUsedIsExpanded] = useState3(isExpanded);
249
+ useEffect3(() => {
250
+ setUsedIsExpanded(isExpanded);
251
+ }, [isExpanded]);
252
+ return /* @__PURE__ */ jsx4(
253
+ Expandable,
254
+ {
255
+ ...props,
256
+ ref,
257
+ isExpanded: usedIsExpanded,
258
+ onChange: (value) => {
259
+ onChange(value);
260
+ setUsedIsExpanded(value);
261
+ }
262
+ }
263
+ );
264
+ });
265
+
266
+ // src/components/user-action/Menu.tsx
267
+ import {
268
+ useEffect as useEffect6,
269
+ useRef,
270
+ useState as useState5
271
+ } from "react";
117
272
  import clsx4 from "clsx";
118
273
 
274
+ // src/hooks/useOutsideClick.ts
275
+ import { useEffect as useEffect4 } from "react";
276
+ var useOutsideClick = (refs, handler) => {
277
+ useEffect4(() => {
278
+ const listener = (event) => {
279
+ if (event.target === null) return;
280
+ if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
281
+ return;
282
+ }
283
+ handler();
284
+ };
285
+ document.addEventListener("mousedown", listener);
286
+ document.addEventListener("touchstart", listener);
287
+ return () => {
288
+ document.removeEventListener("mousedown", listener);
289
+ document.removeEventListener("touchstart", listener);
290
+ };
291
+ }, [refs, handler]);
292
+ };
293
+
294
+ // src/hooks/useHoverState.ts
295
+ import { useEffect as useEffect5, useState as useState4 } from "react";
296
+ var defaultUseHoverStateProps = {
297
+ closingDelay: 200,
298
+ isDisabled: false
299
+ };
300
+ var useHoverState = (props = void 0) => {
301
+ const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
302
+ const [isHovered, setIsHovered] = useState4(false);
303
+ const [timer, setTimer] = useState4();
304
+ const onMouseEnter = () => {
305
+ if (isDisabled) {
306
+ return;
307
+ }
308
+ clearTimeout(timer);
309
+ setIsHovered(true);
310
+ };
311
+ const onMouseLeave = () => {
312
+ if (isDisabled) {
313
+ return;
314
+ }
315
+ setTimer(setTimeout(() => {
316
+ setIsHovered(false);
317
+ }, closingDelay));
318
+ };
319
+ useEffect5(() => {
320
+ if (timer) {
321
+ return () => {
322
+ clearTimeout(timer);
323
+ };
324
+ }
325
+ });
326
+ useEffect5(() => {
327
+ if (timer) {
328
+ clearTimeout(timer);
329
+ }
330
+ }, [isDisabled]);
331
+ return {
332
+ isHovered,
333
+ setIsHovered,
334
+ handlers: { onMouseEnter, onMouseLeave }
335
+ };
336
+ };
337
+
338
+ // src/util/PropsWithFunctionChildren.ts
339
+ var resolve = (children, bag) => {
340
+ if (typeof children === "function") {
341
+ return children(bag);
342
+ }
343
+ return children ?? void 0;
344
+ };
345
+ var BagFunctionUtil = {
346
+ resolve
347
+ };
348
+
349
+ // src/hooks/usePopoverPosition.ts
350
+ var defaultPopoverPositionOptions = {
351
+ edgePadding: 16,
352
+ outerGap: 4,
353
+ horizontalAlignment: "leftInside",
354
+ verticalAlignment: "bottomOutside",
355
+ disabled: false
356
+ };
357
+ var usePopoverPosition = (trigger, options) => {
358
+ const {
359
+ edgePadding,
360
+ outerGap,
361
+ verticalAlignment,
362
+ horizontalAlignment,
363
+ disabled
364
+ } = { ...defaultPopoverPositionOptions, ...options };
365
+ if (disabled || !trigger) {
366
+ return {};
367
+ }
368
+ const left = {
369
+ leftOutside: trigger.left - outerGap,
370
+ leftInside: trigger.left,
371
+ rightOutside: trigger.right + outerGap,
372
+ rightInside: trigger.right,
373
+ center: trigger.left + trigger.width / 2
374
+ }[horizontalAlignment];
375
+ const top = {
376
+ topOutside: trigger.top - outerGap,
377
+ topInside: trigger.top,
378
+ bottomOutside: trigger.bottom + outerGap,
379
+ bottomInside: trigger.bottom,
380
+ center: trigger.top + trigger.height / 2
381
+ }[verticalAlignment];
382
+ const translateX = {
383
+ leftOutside: "-100%",
384
+ leftInside: void 0,
385
+ rightOutside: void 0,
386
+ rightInside: "-100%",
387
+ center: "-50%"
388
+ }[horizontalAlignment];
389
+ const translateY = {
390
+ topOutside: "-100%",
391
+ topInside: void 0,
392
+ bottomOutside: void 0,
393
+ bottomInside: "-100%",
394
+ center: "-50%"
395
+ }[verticalAlignment];
396
+ return {
397
+ left: Math.max(left, edgePadding),
398
+ top: Math.max(top, edgePadding),
399
+ translate: [translateX ?? "0", translateY ?? "0"].join(" ")
400
+ };
401
+ };
402
+
403
+ // src/components/user-action/Menu.tsx
404
+ import { createPortal } from "react-dom";
405
+ import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
406
+ function getScrollableParents(element) {
407
+ const scrollables = [];
408
+ let parent = element.parentElement;
409
+ while (parent) {
410
+ scrollables.push(parent);
411
+ parent = parent.parentElement;
412
+ }
413
+ return scrollables;
414
+ }
415
+ var Menu = ({
416
+ trigger,
417
+ children,
418
+ alignmentHorizontal = "leftInside",
419
+ alignmentVertical = "bottomOutside",
420
+ showOnHover = false,
421
+ disabled = false,
422
+ menuClassName = ""
423
+ }) => {
424
+ const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
425
+ const triggerRef = useRef(null);
426
+ const menuRef = useRef(null);
427
+ useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
428
+ const [isHidden, setIsHidden] = useState5(true);
429
+ const bag = {
430
+ isOpen,
431
+ close: () => setIsOpen(false),
432
+ toggleOpen: () => setIsOpen((prevState) => !prevState),
433
+ disabled
434
+ };
435
+ const menuPosition = usePopoverPosition(
436
+ triggerRef.current?.getBoundingClientRect(),
437
+ { verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
438
+ );
439
+ useEffect6(() => {
440
+ if (!isOpen) return;
441
+ const triggerEl = triggerRef.current;
442
+ if (!triggerEl) return;
443
+ const scrollableParents = getScrollableParents(triggerEl);
444
+ const close = () => setIsOpen(false);
445
+ scrollableParents.forEach((parent) => {
446
+ parent.addEventListener("scroll", close);
447
+ });
448
+ window.addEventListener("resize", close);
449
+ return () => {
450
+ scrollableParents.forEach((parent) => {
451
+ parent.removeEventListener("scroll", close);
452
+ });
453
+ window.removeEventListener("resize", close);
454
+ };
455
+ }, [isOpen, setIsOpen]);
456
+ useEffect6(() => {
457
+ if (isOpen) {
458
+ setIsHidden(false);
459
+ }
460
+ }, [isOpen]);
461
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
462
+ trigger(bag, triggerRef),
463
+ createPortal(/* @__PURE__ */ jsx5(
464
+ "div",
465
+ {
466
+ ref: menuRef,
467
+ onClick: (e) => e.stopPropagation(),
468
+ className: clsx4(
469
+ "absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
470
+ {
471
+ "animate-pop-in": isOpen,
472
+ "animate-pop-out": !isOpen,
473
+ "hidden": isHidden
474
+ },
475
+ menuClassName
476
+ ),
477
+ onAnimationEnd: () => {
478
+ if (!isOpen) {
479
+ setIsHidden(true);
480
+ }
481
+ },
482
+ style: {
483
+ ...menuPosition
484
+ },
485
+ children: BagFunctionUtil.resolve(children, bag)
486
+ }
487
+ ), document.body)
488
+ ] });
489
+ };
490
+
119
491
  // src/components/user-action/Input.tsx
120
- import { forwardRef, useEffect as useEffect5, useImperativeHandle, useRef, useState as useState4 } from "react";
121
- import clsx2 from "clsx";
492
+ import { forwardRef as forwardRef2, useEffect as useEffect9, useImperativeHandle, useRef as useRef2, useState as useState7 } from "react";
493
+ import clsx5 from "clsx";
122
494
 
123
495
  // src/hooks/useDelay.ts
124
- import { useEffect as useEffect3, useState as useState3 } from "react";
496
+ import { useEffect as useEffect7, useState as useState6 } from "react";
125
497
  var defaultOptions = {
126
498
  delay: 3e3,
127
499
  disabled: false
128
500
  };
129
501
  function useDelay(options) {
130
- const [timer, setTimer] = useState3(void 0);
502
+ const [timer, setTimer] = useState6(void 0);
131
503
  const { delay, disabled } = {
132
504
  ...defaultOptions,
133
505
  ...options
@@ -146,12 +518,12 @@ function useDelay(options) {
146
518
  setTimer(void 0);
147
519
  }, delay));
148
520
  };
149
- useEffect3(() => {
521
+ useEffect7(() => {
150
522
  return () => {
151
523
  clearTimeout(timer);
152
524
  };
153
525
  }, [timer]);
154
- useEffect3(() => {
526
+ useEffect7(() => {
155
527
  if (disabled) {
156
528
  clearTimeout(timer);
157
529
  setTimer(void 0);
@@ -160,13 +532,10 @@ function useDelay(options) {
160
532
  return { restartTimer, clearTimer, hasActiveTimer: !!timer };
161
533
  }
162
534
 
163
- // src/util/noop.ts
164
- var noop = () => void 0;
165
-
166
535
  // src/hooks/useFocusManagement.ts
167
- import { useCallback as useCallback2 } from "react";
536
+ import { useCallback as useCallback3 } from "react";
168
537
  function useFocusManagement() {
169
- const getFocusableElements = useCallback2(() => {
538
+ const getFocusableElements = useCallback3(() => {
170
539
  return Array.from(
171
540
  document.querySelectorAll(
172
541
  'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
@@ -175,7 +544,7 @@ function useFocusManagement() {
175
544
  (el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
176
545
  );
177
546
  }, []);
178
- const getNextFocusElement = useCallback2(() => {
547
+ const getNextFocusElement = useCallback3(() => {
179
548
  const elements = getFocusableElements();
180
549
  if (elements.length === 0) {
181
550
  return void 0;
@@ -187,11 +556,11 @@ function useFocusManagement() {
187
556
  }
188
557
  return nextElement;
189
558
  }, [getFocusableElements]);
190
- const focusNext = useCallback2(() => {
559
+ const focusNext = useCallback3(() => {
191
560
  const nextElement = getNextFocusElement();
192
561
  nextElement?.focus();
193
562
  }, [getNextFocusElement]);
194
- const getPreviousFocusElement = useCallback2(() => {
563
+ const getPreviousFocusElement = useCallback3(() => {
195
564
  const elements = getFocusableElements();
196
565
  if (elements.length === 0) {
197
566
  return void 0;
@@ -207,7 +576,7 @@ function useFocusManagement() {
207
576
  }
208
577
  return previousElement;
209
578
  }, [getFocusableElements]);
210
- const focusPrevious = useCallback2(() => {
579
+ const focusPrevious = useCallback3(() => {
211
580
  const previousElement = getPreviousFocusElement();
212
581
  if (previousElement) previousElement.focus();
213
582
  }, [getPreviousFocusElement]);
@@ -221,10 +590,10 @@ function useFocusManagement() {
221
590
  }
222
591
 
223
592
  // src/hooks/useFocusOnceVisible.ts
224
- import React, { useEffect as useEffect4 } from "react";
593
+ import React, { useEffect as useEffect8 } from "react";
225
594
  var useFocusOnceVisible = (ref, disable = false) => {
226
595
  const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
227
- useEffect4(() => {
596
+ useEffect8(() => {
228
597
  if (disable || hasUsedFocus) {
229
598
  return;
230
599
  }
@@ -244,9 +613,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
244
613
  };
245
614
 
246
615
  // src/components/user-action/Input.tsx
247
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
616
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
248
617
  var getInputClassName = ({ disabled = false, hasError = false }) => {
249
- return clsx2(
618
+ return clsx5(
250
619
  "px-2 py-1.5 rounded-md border-2",
251
620
  {
252
621
  "bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
@@ -260,7 +629,7 @@ var defaultEditCompleteOptions = {
260
629
  afterDelay: true,
261
630
  delay: 2500
262
631
  };
263
- var Input = forwardRef(function Input2({
632
+ var Input = forwardRef2(function Input2({
264
633
  id,
265
634
  type = "text",
266
635
  value,
@@ -283,7 +652,7 @@ var Input = forwardRef(function Input2({
283
652
  restartTimer,
284
653
  clearTimer
285
654
  } = useDelay({ delay, disabled: !afterDelay });
286
- const innerRef = useRef(null);
655
+ const innerRef = useRef2(null);
287
656
  const { focusNext } = useFocusManagement();
288
657
  useFocusOnceVisible(innerRef, !autoFocus);
289
658
  useImperativeHandle(forwardedRef, () => innerRef.current);
@@ -294,9 +663,9 @@ var Input = forwardRef(function Input2({
294
663
  focusNext();
295
664
  }
296
665
  };
297
- return /* @__PURE__ */ jsxs("div", { className: clsx2({ "w-full": expanded }, containerClassName), children: [
298
- label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx2("mb-1", label.className) }),
299
- /* @__PURE__ */ jsx3(
666
+ return /* @__PURE__ */ jsxs4("div", { className: clsx5({ "w-full": expanded }, containerClassName), children: [
667
+ label && /* @__PURE__ */ jsx6(Label, { ...label, htmlFor: id, className: clsx5("mb-1", label.className) }),
668
+ /* @__PURE__ */ jsx6(
300
669
  "input",
301
670
  {
302
671
  ...restProps,
@@ -305,7 +674,7 @@ var Input = forwardRef(function Input2({
305
674
  id,
306
675
  type,
307
676
  disabled,
308
- className: clsx2(getInputClassName({ disabled }), className),
677
+ className: clsx5(getInputClassName({ disabled }), className),
309
678
  onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
310
679
  onBlur: (event) => {
311
680
  onBlur?.(event);
@@ -335,7 +704,7 @@ var Input = forwardRef(function Input2({
335
704
  )
336
705
  ] });
337
706
  });
338
- var FormInput = forwardRef(function FormInput2({
707
+ var FormInput = forwardRef2(function FormInput2({
339
708
  id,
340
709
  labelText,
341
710
  errorText,
@@ -347,267 +716,33 @@ var FormInput = forwardRef(function FormInput2({
347
716
  disabled,
348
717
  ...restProps
349
718
  }, ref) {
350
- const input = /* @__PURE__ */ jsx3(
719
+ const input = /* @__PURE__ */ jsx6(
351
720
  "input",
352
721
  {
353
722
  ...restProps,
354
723
  ref,
355
724
  id,
356
725
  disabled,
357
- className: clsx2(
726
+ className: clsx5(
358
727
  getInputClassName({ disabled, hasError: !!errorText }),
359
728
  className
360
729
  )
361
730
  }
362
731
  );
363
- return /* @__PURE__ */ jsxs("div", { className: clsx2("flex flex-col gap-y-1", containerClassName), children: [
364
- labelText && /* @__PURE__ */ jsxs("label", { htmlFor: id, className: clsx2("textstyle-label-md", labelClassName), children: [
732
+ return /* @__PURE__ */ jsxs4("div", { className: clsx5("flex flex-col gap-y-1", containerClassName), children: [
733
+ labelText && /* @__PURE__ */ jsxs4("label", { htmlFor: id, className: clsx5("textstyle-label-md", labelClassName), children: [
365
734
  labelText,
366
- required && /* @__PURE__ */ jsx3("span", { className: "text-primary font-bold", children: "*" })
735
+ required && /* @__PURE__ */ jsx6("span", { className: "text-primary font-bold", children: "*" })
367
736
  ] }),
368
737
  input,
369
- errorText && /* @__PURE__ */ jsx3("label", { htmlFor: id, className: clsx2("text-negative", errorClassName), children: errorText })
738
+ errorText && /* @__PURE__ */ jsx6("label", { htmlFor: id, className: clsx5("text-negative", errorClassName), children: errorText })
370
739
  ] });
371
740
  });
372
741
 
373
- // src/components/user-action/Button.tsx
374
- import clsx3 from "clsx";
375
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
376
- var ButtonColorUtil = {
377
- solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
378
- text: ["primary", "negative", "neutral"],
379
- outline: ["primary"]
380
- };
381
- var IconButtonUtil = {
382
- icon: [...ButtonColorUtil.solid, "transparent"]
383
- };
384
- var paddingMapping = {
385
- small: "btn-sm",
386
- medium: "btn-md",
387
- large: "btn-lg"
388
- };
389
- var iconPaddingMapping = {
390
- tiny: "icon-btn-xs",
391
- small: "icon-btn-sm",
392
- medium: "icon-btn-md",
393
- large: "icon-btn-lg"
394
- };
395
- var ButtonUtil = {
396
- paddingMapping,
397
- iconPaddingMapping
398
- };
399
- var SolidButton = ({
400
- children,
401
- disabled = false,
402
- color = "primary",
403
- size = "medium",
404
- startIcon,
405
- endIcon,
406
- onClick,
407
- className,
408
- ...restProps
409
- }) => {
410
- const colorClasses = {
411
- primary: "bg-button-solid-primary-background text-button-solid-primary-text",
412
- secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
413
- tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
414
- positive: "bg-button-solid-positive-background text-button-solid-positive-text",
415
- warning: "bg-button-solid-warning-background text-button-solid-warning-text",
416
- negative: "bg-button-solid-negative-background text-button-solid-negative-text",
417
- neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
418
- }[color];
419
- const iconColorClasses = {
420
- primary: "text-button-solid-primary-icon",
421
- secondary: "text-button-solid-secondary-icon",
422
- tertiary: "text-button-solid-tertiary-icon",
423
- positive: "text-button-solid-positive-icon",
424
- warning: "text-button-solid-warning-icon",
425
- negative: "text-button-solid-negative-icon",
426
- neutral: "text-button-solid-neutral-icon"
427
- }[color];
428
- return /* @__PURE__ */ jsxs2(
429
- "button",
430
- {
431
- onClick: disabled ? void 0 : onClick,
432
- disabled: disabled || onClick === void 0,
433
- className: clsx3(
434
- {
435
- "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
436
- [clsx3(colorClasses, "hover:brightness-90")]: !disabled
437
- },
438
- ButtonUtil.paddingMapping[size],
439
- className
440
- ),
441
- ...restProps,
442
- children: [
443
- startIcon && /* @__PURE__ */ jsx4(
444
- "span",
445
- {
446
- className: clsx3({
447
- [iconColorClasses]: !disabled,
448
- [`text-disabled-icon`]: disabled
449
- }),
450
- children: startIcon
451
- }
452
- ),
453
- children,
454
- endIcon && /* @__PURE__ */ jsx4(
455
- "span",
456
- {
457
- className: clsx3({
458
- [iconColorClasses]: !disabled,
459
- [`text-disabled-icon`]: disabled
460
- }),
461
- children: endIcon
462
- }
463
- )
464
- ]
465
- }
466
- );
467
- };
468
- var TextButton = ({
469
- children,
470
- disabled = false,
471
- color = "neutral",
472
- size = "medium",
473
- startIcon,
474
- endIcon,
475
- onClick,
476
- className,
477
- ...restProps
478
- }) => {
479
- const colorClasses = {
480
- primary: "bg-transparent text-button-text-primary-text",
481
- negative: "bg-transparent text-button-text-negative-text",
482
- neutral: "bg-transparent text-button-text-neutral-text"
483
- }[color];
484
- const iconColorClasses = {
485
- primary: "text-button-text-primary-icon",
486
- negative: "text-button-text-negative-icon",
487
- neutral: "text-button-text-neutral-icon"
488
- }[color];
489
- return /* @__PURE__ */ jsxs2(
490
- "button",
491
- {
492
- onClick: disabled ? void 0 : onClick,
493
- disabled: disabled || onClick === void 0,
494
- className: clsx3(
495
- {
496
- "text-disabled-text cursor-not-allowed": disabled,
497
- [clsx3(colorClasses, "hover:bg-button-text-hover-background")]: !disabled
498
- },
499
- ButtonUtil.paddingMapping[size],
500
- className
501
- ),
502
- ...restProps,
503
- children: [
504
- startIcon && /* @__PURE__ */ jsx4(
505
- "span",
506
- {
507
- className: clsx3({
508
- [iconColorClasses]: !disabled,
509
- [`text-disabled-icon`]: disabled
510
- }),
511
- children: startIcon
512
- }
513
- ),
514
- children,
515
- endIcon && /* @__PURE__ */ jsx4(
516
- "span",
517
- {
518
- className: clsx3({
519
- [iconColorClasses]: !disabled,
520
- [`text-disabled-icon`]: disabled
521
- }),
522
- children: endIcon
523
- }
524
- )
525
- ]
526
- }
527
- );
528
- };
529
- var IconButton = ({
530
- children,
531
- disabled = false,
532
- color = "primary",
533
- size = "medium",
534
- onClick,
535
- className,
536
- ...restProps
537
- }) => {
538
- const colorClasses = {
539
- primary: "bg-button-solid-primary-background text-button-solid-primary-text",
540
- secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
541
- tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
542
- positive: "bg-button-solid-positive-background text-button-solid-positive-text",
543
- warning: "bg-button-solid-warning-background text-button-solid-warning-text",
544
- negative: "bg-button-solid-negative-background text-button-solid-negative-text",
545
- neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
546
- transparent: "bg-transparent"
547
- }[color];
548
- return /* @__PURE__ */ jsx4(
549
- "button",
550
- {
551
- onClick: disabled ? void 0 : onClick,
552
- disabled: disabled || onClick === void 0,
553
- className: clsx3(
554
- {
555
- "text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
556
- "text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
557
- "hover:bg-button-text-hover-background": !disabled && color === "transparent",
558
- [clsx3(colorClasses, "hover:brightness-90")]: !disabled
559
- },
560
- ButtonUtil.iconPaddingMapping[size],
561
- className
562
- ),
563
- ...restProps,
564
- children
565
- }
566
- );
567
- };
568
-
569
- // src/hooks/useSearch.ts
570
- import { useEffect as useEffect6, useMemo, useState as useState5 } from "react";
571
-
572
- // src/util/simpleSearch.ts
573
- var MultiSearchWithMapping = (search, objects, mapping) => {
574
- return objects.filter((object) => {
575
- const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
576
- if (!mappedSearchKeywords) {
577
- return true;
578
- }
579
- return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
580
- });
581
- };
582
-
583
- // src/hooks/useSearch.ts
584
- var useSearch = ({
585
- list,
586
- initialSearch,
587
- searchMapping
588
- }) => {
589
- const [items, setItems] = useState5(list);
590
- const [search, setSearch] = useState5(initialSearch);
591
- useEffect6(() => {
592
- setItems(list);
593
- }, [list]);
594
- const result = useMemo(
595
- () => MultiSearchWithMapping(search, items, searchMapping),
596
- [search, items, searchMapping]
597
- );
598
- return {
599
- result,
600
- hasResult: result.length > 0,
601
- allItems: items,
602
- setItems,
603
- search,
604
- setSearch
605
- };
606
- };
607
-
608
742
  // src/localization/defaults/form.ts
609
743
  var formTranslation = {
610
744
  en: {
745
+ add: "Add",
611
746
  all: "All",
612
747
  apply: "Apply",
613
748
  back: "Back",
@@ -620,6 +755,7 @@ var formTranslation = {
620
755
  confirm: "Confirm",
621
756
  copy: "Copy",
622
757
  copied: "Copied",
758
+ create: "Create",
623
759
  decline: "Decline",
624
760
  delete: "Delete",
625
761
  discard: "Discard",
@@ -662,6 +798,7 @@ var formTranslation = {
662
798
  yes: "Yes"
663
799
  },
664
800
  de: {
801
+ add: "Hinzuf\xFCgen",
665
802
  all: "Alle",
666
803
  apply: "Anwenden",
667
804
  back: "Zur\xFCck",
@@ -674,6 +811,7 @@ var formTranslation = {
674
811
  confirm: "Best\xE4tigen",
675
812
  copy: "Kopieren",
676
813
  copied: "Kopiert",
814
+ create: "Erstellen",
677
815
  decline: "Ablehnen",
678
816
  delete: "L\xF6schen",
679
817
  discard: "Verwerfen",
@@ -717,92 +855,316 @@ var formTranslation = {
717
855
  }
718
856
  };
719
857
 
720
- // src/components/layout-and-navigation/SearchableList.tsx
721
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
722
- var defaultSearchableListTranslation = {
723
- en: {
724
- nothingFound: "Nothing found"
725
- },
726
- de: {
727
- nothingFound: "Nichts gefunden"
728
- }
858
+ // src/components/user-action/Button.tsx
859
+ import { forwardRef as forwardRef3 } from "react";
860
+ import clsx6 from "clsx";
861
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
862
+ var ButtonColorUtil = {
863
+ solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
864
+ text: ["primary", "negative", "neutral"],
865
+ outline: ["primary"]
729
866
  };
730
- var SearchableList = ({
731
- overwriteTranslation,
732
- list,
733
- initialSearch = "",
734
- searchMapping,
735
- autoFocus,
736
- minimumItemsForSearch = 6,
737
- itemMapper,
867
+ var IconButtonUtil = {
868
+ icon: [...ButtonColorUtil.solid, "transparent"]
869
+ };
870
+ var paddingMapping = {
871
+ small: "btn-sm",
872
+ medium: "btn-md",
873
+ large: "btn-lg"
874
+ };
875
+ var iconPaddingMapping = {
876
+ tiny: "icon-btn-xs",
877
+ small: "icon-btn-sm",
878
+ medium: "icon-btn-md",
879
+ large: "icon-btn-lg"
880
+ };
881
+ var ButtonUtil = {
882
+ paddingMapping,
883
+ iconPaddingMapping
884
+ };
885
+ var SolidButton = forwardRef3(function SolidButton2({
886
+ children,
887
+ disabled = false,
888
+ color = "primary",
889
+ size = "medium",
890
+ startIcon,
891
+ endIcon,
892
+ onClick,
738
893
  className,
739
- resultListClassName
740
- }) => {
741
- const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
742
- const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
743
- return /* @__PURE__ */ jsxs3("div", { className: clsx4("col gap-y-2", className), children: [
744
- list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs3("div", { className: "row justify-between gap-x-4 items-center", children: [
745
- /* @__PURE__ */ jsx5(
746
- Input,
894
+ ...restProps
895
+ }, ref) {
896
+ const colorClasses = {
897
+ primary: "bg-button-solid-primary-background text-button-solid-primary-text",
898
+ secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
899
+ tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
900
+ positive: "bg-button-solid-positive-background text-button-solid-positive-text",
901
+ warning: "bg-button-solid-warning-background text-button-solid-warning-text",
902
+ negative: "bg-button-solid-negative-background text-button-solid-negative-text",
903
+ neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
904
+ }[color];
905
+ const iconColorClasses = {
906
+ primary: "text-button-solid-primary-icon",
907
+ secondary: "text-button-solid-secondary-icon",
908
+ tertiary: "text-button-solid-tertiary-icon",
909
+ positive: "text-button-solid-positive-icon",
910
+ warning: "text-button-solid-warning-icon",
911
+ negative: "text-button-solid-negative-icon",
912
+ neutral: "text-button-solid-neutral-icon"
913
+ }[color];
914
+ return /* @__PURE__ */ jsxs5(
915
+ "button",
916
+ {
917
+ ref,
918
+ onClick,
919
+ disabled,
920
+ className: clsx6(
747
921
  {
748
- value: search,
749
- onChangeText: setSearch,
750
- placeholder: translation("search"),
751
- autoFocus,
752
- className: "w-full"
753
- }
922
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
923
+ [clsx6(colorClasses, "hover:brightness-90")]: !disabled
924
+ },
925
+ ButtonUtil.paddingMapping[size],
926
+ className
754
927
  ),
755
- /* @__PURE__ */ jsx5(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx5(Search, { className: "w-full h-full" }) })
756
- ] }),
757
- 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") })
758
- ] });
759
- };
760
-
761
- // src/components/layout-and-navigation/Tile.tsx
762
- import clsx5 from "clsx";
763
- import { Check } from "lucide-react";
764
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
765
- var Tile = ({
766
- title,
767
- description,
928
+ ...restProps,
929
+ children: [
930
+ startIcon && /* @__PURE__ */ jsx7(
931
+ "span",
932
+ {
933
+ className: clsx6({
934
+ [iconColorClasses]: !disabled,
935
+ [`text-disabled-icon`]: disabled
936
+ }),
937
+ children: startIcon
938
+ }
939
+ ),
940
+ children,
941
+ endIcon && /* @__PURE__ */ jsx7(
942
+ "span",
943
+ {
944
+ className: clsx6({
945
+ [iconColorClasses]: !disabled,
946
+ [`text-disabled-icon`]: disabled
947
+ }),
948
+ children: endIcon
949
+ }
950
+ )
951
+ ]
952
+ }
953
+ );
954
+ });
955
+ var TextButton = ({
956
+ children,
957
+ disabled = false,
958
+ color = "neutral",
959
+ size = "medium",
960
+ startIcon,
961
+ endIcon,
768
962
  onClick,
769
- isSelected = false,
770
- isDisabled = false,
771
- prefix,
772
- suffix,
773
- normalClassName = "hover:bg-primary/40 cursor-pointer",
774
- selectedClassName = " bg-primary/20",
775
- disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
776
- className
963
+ className,
964
+ ...restProps
777
965
  }) => {
778
- return /* @__PURE__ */ jsxs4(
779
- "div",
966
+ const colorClasses = {
967
+ primary: "bg-transparent text-button-text-primary-text",
968
+ negative: "bg-transparent text-button-text-negative-text",
969
+ neutral: "bg-transparent text-button-text-neutral-text"
970
+ }[color];
971
+ const iconColorClasses = {
972
+ primary: "text-button-text-primary-icon",
973
+ negative: "text-button-text-negative-icon",
974
+ neutral: "text-button-text-neutral-icon"
975
+ }[color];
976
+ return /* @__PURE__ */ jsxs5(
977
+ "button",
780
978
  {
781
- className: clsx5(
782
- "row gap-x-2 w-full items-center",
979
+ onClick,
980
+ disabled,
981
+ className: clsx6(
783
982
  {
784
- [normalClassName]: !!onClick && !isDisabled,
785
- [selectedClassName]: isSelected && !isDisabled,
786
- [disabledClassName]: isDisabled
983
+ "text-disabled-text cursor-not-allowed": disabled,
984
+ [clsx6(colorClasses, "hover:bg-button-text-hover-background")]: !disabled
787
985
  },
986
+ ButtonUtil.paddingMapping[size],
788
987
  className
789
988
  ),
790
- onClick: isDisabled ? void 0 : onClick,
989
+ ...restProps,
791
990
  children: [
792
- prefix,
793
- /* @__PURE__ */ jsxs4("div", { className: "col gap-y-0 w-full", children: [
794
- /* @__PURE__ */ jsx6("h4", { className: clsx5(title.className ?? "textstyle-title-normal"), children: title.value }),
795
- !!description && /* @__PURE__ */ jsx6("span", { className: clsx5(description.className ?? "textstyle-description"), children: description.value })
796
- ] }),
797
- suffix ?? (isSelected ? /* @__PURE__ */ jsx6(Check, { size: 24 }) : void 0)
991
+ startIcon && /* @__PURE__ */ jsx7(
992
+ "span",
993
+ {
994
+ className: clsx6({
995
+ [iconColorClasses]: !disabled,
996
+ [`text-disabled-icon`]: disabled
997
+ }),
998
+ children: startIcon
999
+ }
1000
+ ),
1001
+ children,
1002
+ endIcon && /* @__PURE__ */ jsx7(
1003
+ "span",
1004
+ {
1005
+ className: clsx6({
1006
+ [iconColorClasses]: !disabled,
1007
+ [`text-disabled-icon`]: disabled
1008
+ }),
1009
+ children: endIcon
1010
+ }
1011
+ )
798
1012
  ]
799
1013
  }
800
1014
  );
801
1015
  };
1016
+ var IconButton = ({
1017
+ children,
1018
+ disabled = false,
1019
+ color = "primary",
1020
+ size = "medium",
1021
+ className,
1022
+ ...restProps
1023
+ }) => {
1024
+ const colorClasses = {
1025
+ primary: "bg-button-solid-primary-background text-button-solid-primary-text",
1026
+ secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
1027
+ tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
1028
+ positive: "bg-button-solid-positive-background text-button-solid-positive-text",
1029
+ warning: "bg-button-solid-warning-background text-button-solid-warning-text",
1030
+ negative: "bg-button-solid-negative-background text-button-solid-negative-text",
1031
+ neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
1032
+ transparent: "bg-transparent"
1033
+ }[color];
1034
+ return /* @__PURE__ */ jsx7(
1035
+ "button",
1036
+ {
1037
+ disabled,
1038
+ className: clsx6(
1039
+ {
1040
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
1041
+ "text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
1042
+ "hover:bg-button-text-hover-background": !disabled && color === "transparent",
1043
+ [clsx6(colorClasses, "hover:brightness-90")]: !disabled
1044
+ },
1045
+ ButtonUtil.iconPaddingMapping[size],
1046
+ className
1047
+ ),
1048
+ ...restProps,
1049
+ children
1050
+ }
1051
+ );
1052
+ };
1053
+
1054
+ // src/components/user-action/SearchBar.tsx
1055
+ import { Search } from "lucide-react";
1056
+ import { clsx as clsx7 } from "clsx";
1057
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1058
+ var SearchBar = ({
1059
+ placeholder,
1060
+ onSearch,
1061
+ disableOnSearch,
1062
+ containerClassName,
1063
+ ...inputProps
1064
+ }) => {
1065
+ const translation = useTranslation([formTranslation]);
1066
+ return /* @__PURE__ */ jsxs6("div", { className: clsx7("flex-row-2 justify-between items-center", containerClassName), children: [
1067
+ /* @__PURE__ */ jsx8(
1068
+ Input,
1069
+ {
1070
+ ...inputProps,
1071
+ placeholder: placeholder ?? translation("search")
1072
+ }
1073
+ ),
1074
+ onSearch && /* @__PURE__ */ jsx8(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ jsx8(Search, { className: "w-full h-full" }) })
1075
+ ] });
1076
+ };
1077
+
1078
+ // src/hooks/useSearch.ts
1079
+ import { useCallback as useCallback4, useEffect as useEffect10, useMemo, useState as useState8 } from "react";
1080
+
1081
+ // src/util/simpleSearch.ts
1082
+ var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
1083
+ return objects.filter((object) => {
1084
+ const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
1085
+ if (!mappedSearchKeywords) {
1086
+ return true;
1087
+ }
1088
+ return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
1089
+ });
1090
+ };
1091
+
1092
+ // src/hooks/useSearch.ts
1093
+ var useSearch = ({
1094
+ list,
1095
+ initialSearch,
1096
+ searchMapping,
1097
+ additionalSearchTags,
1098
+ isSearchInstant = true,
1099
+ sortingFunction,
1100
+ filter,
1101
+ disabled = false
1102
+ }) => {
1103
+ const [search, setSearch] = useState8(initialSearch ?? "");
1104
+ const [result, setResult] = useState8(list);
1105
+ const searchTags = useMemo(() => additionalSearchTags ?? [], [additionalSearchTags]);
1106
+ const updateSearch = useCallback4((newSearch) => {
1107
+ const usedSearch = newSearch ?? search;
1108
+ if (newSearch) {
1109
+ setSearch(search);
1110
+ }
1111
+ setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
1112
+ }, [searchTags, list, search, searchMapping]);
1113
+ useEffect10(() => {
1114
+ if (isSearchInstant) {
1115
+ setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
1116
+ }
1117
+ }, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
1118
+ const filteredResult = useMemo(() => {
1119
+ if (!filter) {
1120
+ return result;
1121
+ }
1122
+ return result.filter(filter);
1123
+ }, [result, filter]);
1124
+ const sortedAndFilteredResult = useMemo(() => {
1125
+ if (!sortingFunction) {
1126
+ return filteredResult;
1127
+ }
1128
+ return filteredResult.sort(sortingFunction);
1129
+ }, [filteredResult, sortingFunction]);
1130
+ const usedResult = useMemo(() => {
1131
+ if (!disabled) {
1132
+ return sortedAndFilteredResult;
1133
+ }
1134
+ return list;
1135
+ }, [disabled, list, sortedAndFilteredResult]);
1136
+ return {
1137
+ result: usedResult,
1138
+ hasResult: usedResult.length > 0,
1139
+ allItems: list,
1140
+ updateSearch,
1141
+ search,
1142
+ setSearch
1143
+ };
1144
+ };
1145
+
1146
+ // src/components/user-action/Select.tsx
1147
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1148
+ var SelectTile = ({
1149
+ className,
1150
+ disabledClassName,
1151
+ title,
1152
+ ...restProps
1153
+ }) => {
1154
+ return /* @__PURE__ */ jsx9(
1155
+ Tile,
1156
+ {
1157
+ ...restProps,
1158
+ className: clsx8("px-2 py-1 rounded-md", className),
1159
+ disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
1160
+ title: { ...title, className: title.className ?? "font-semibold" }
1161
+ }
1162
+ );
1163
+ };
802
1164
 
803
1165
  // src/components/layout-and-navigation/Chip.tsx
804
- import clsx6 from "clsx";
805
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1166
+ import clsx9 from "clsx";
1167
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
806
1168
  var Chip = ({
807
1169
  children,
808
1170
  trailingIcon,
@@ -829,11 +1191,11 @@ var Chip = ({
829
1191
  blue: "text-tag-blue-icon",
830
1192
  pink: "text-tag-pink-icon"
831
1193
  }[color];
832
- return /* @__PURE__ */ jsxs5(
1194
+ return /* @__PURE__ */ jsxs8(
833
1195
  "div",
834
1196
  {
835
1197
  ...restProps,
836
- className: clsx6(
1198
+ className: clsx9(
837
1199
  `row w-fit px-2 py-1`,
838
1200
  colorMapping,
839
1201
  {
@@ -844,7 +1206,7 @@ var Chip = ({
844
1206
  ),
845
1207
  children: [
846
1208
  children,
847
- trailingIcon && /* @__PURE__ */ jsx7("span", { className: colorMappingIcon, children: trailingIcon })
1209
+ trailingIcon && /* @__PURE__ */ jsx10("span", { className: colorMappingIcon, children: trailingIcon })
848
1210
  ]
849
1211
  }
850
1212
  );
@@ -853,7 +1215,7 @@ var ChipList = ({
853
1215
  list,
854
1216
  className = ""
855
1217
  }) => {
856
- return /* @__PURE__ */ jsx7("div", { className: clsx6("flex flex-wrap gap-x-4 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ jsx7(
1218
+ return /* @__PURE__ */ jsx10("div", { className: clsx9("flex flex-wrap gap-x-2 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ jsx10(
857
1219
  Chip,
858
1220
  {
859
1221
  ...value,
@@ -865,28 +1227,74 @@ var ChipList = ({
865
1227
  )) });
866
1228
  };
867
1229
 
868
- // src/hooks/useOutsideClick.ts
869
- import { useEffect as useEffect7 } from "react";
870
- var useOutsideClick = (refs, handler) => {
871
- useEffect7(() => {
872
- const listener = (event) => {
873
- if (event.target === null) return;
874
- if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
875
- return;
1230
+ // src/components/user-action/Checkbox.tsx
1231
+ import { useState as useState10 } from "react";
1232
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
1233
+ import { Check as Check2, Minus } from "lucide-react";
1234
+ import clsx10 from "clsx";
1235
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1236
+ var checkboxSizeMapping = {
1237
+ small: "size-5",
1238
+ medium: "size-6",
1239
+ large: "size-8"
1240
+ };
1241
+ var checkboxIconSizeMapping = {
1242
+ small: "size-4",
1243
+ medium: "size-5",
1244
+ large: "size-7"
1245
+ };
1246
+ var Checkbox = ({
1247
+ id,
1248
+ label,
1249
+ checked,
1250
+ disabled,
1251
+ onChange,
1252
+ onChangeTristate,
1253
+ size = "medium",
1254
+ className = "",
1255
+ containerClassName
1256
+ }) => {
1257
+ const usedSizeClass = checkboxSizeMapping[size];
1258
+ const innerIconSize = checkboxIconSizeMapping[size];
1259
+ const propagateChange = (checked2) => {
1260
+ if (onChangeTristate) {
1261
+ onChangeTristate(checked2);
1262
+ }
1263
+ if (onChange) {
1264
+ onChange(checked2 === "indeterminate" ? false : checked2);
1265
+ }
1266
+ };
1267
+ const changeValue = () => {
1268
+ const newValue = checked === "indeterminate" ? false : !checked;
1269
+ propagateChange(newValue);
1270
+ };
1271
+ return /* @__PURE__ */ jsxs9("div", { className: clsx10("group flex-row-2 items-center cursor-pointer", containerClassName), onClick: changeValue, children: [
1272
+ /* @__PURE__ */ jsx11(
1273
+ CheckboxPrimitive.Root,
1274
+ {
1275
+ onCheckedChange: propagateChange,
1276
+ checked,
1277
+ disabled,
1278
+ id,
1279
+ className: clsx10(usedSizeClass, `items-center border-2 rounded outline-none `, {
1280
+ "text-disabled-text border-disabled-outline bg-disabled-background cursor-not-allowed": disabled,
1281
+ "focus:border-primary group-hover:border-primary ": !disabled,
1282
+ "bg-surface": !disabled && !checked,
1283
+ "bg-primary/30 border-primary text-primary": !disabled && checked === true || checked === "indeterminate"
1284
+ }, className),
1285
+ children: /* @__PURE__ */ jsxs9(CheckboxPrimitive.Indicator, { children: [
1286
+ checked === true && /* @__PURE__ */ jsx11(Check2, { className: innerIconSize }),
1287
+ checked === "indeterminate" && /* @__PURE__ */ jsx11(Minus, { className: innerIconSize })
1288
+ ] })
876
1289
  }
877
- handler();
878
- };
879
- document.addEventListener("mousedown", listener);
880
- document.addEventListener("touchstart", listener);
881
- return () => {
882
- document.removeEventListener("mousedown", listener);
883
- document.removeEventListener("touchstart", listener);
884
- };
885
- }, [refs, handler]);
1290
+ ),
1291
+ label && /* @__PURE__ */ jsx11(Label, { ...label, className: clsx10(label.className), htmlFor: id })
1292
+ ] });
886
1293
  };
887
1294
 
888
1295
  // src/components/user-action/MultiSelect.tsx
889
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1296
+ import { Plus } from "lucide-react";
1297
+ import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
890
1298
  var defaultMultiSelectTranslation = {
891
1299
  en: {
892
1300
  selected: `{{amount}} selected`
@@ -897,89 +1305,107 @@ var defaultMultiSelectTranslation = {
897
1305
  };
898
1306
  var MultiSelect = ({
899
1307
  overwriteTranslation,
900
- options,
901
1308
  label,
1309
+ options,
902
1310
  onChange,
903
1311
  hintText,
904
- isDisabled = false,
905
- isSearchEnabled = false,
906
1312
  selectedDisplayOverwrite,
1313
+ searchOptions,
1314
+ additionalItems,
907
1315
  useChipDisplay = false,
908
- className = ""
1316
+ className,
1317
+ triggerClassName,
1318
+ hintTextClassName,
1319
+ ...menuProps
909
1320
  }) => {
910
1321
  const translation = useTranslation([formTranslation, defaultMultiSelectTranslation], overwriteTranslation);
911
- const triggerRef = useRef2(null);
912
- const menuRef = useRef2(null);
913
- const [isOpen, setIsOpen] = useState6(false);
914
- useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
1322
+ const { result, search, setSearch } = useSearch({
1323
+ list: options,
1324
+ searchMapping: useCallback6((item) => item.searchTags, []),
1325
+ ...searchOptions
1326
+ });
915
1327
  const selectedItems = options.filter((value) => value.selected);
916
1328
  const isShowingHint = !selectedDisplayOverwrite && selectedItems.length === 0;
917
- return /* @__PURE__ */ jsxs6("div", { className: clsx7(className), children: [
918
- label && /* @__PURE__ */ jsx8(
1329
+ return /* @__PURE__ */ jsxs10("div", { className: clsx11(className), children: [
1330
+ label && /* @__PURE__ */ jsx12(
919
1331
  Label,
920
1332
  {
921
1333
  ...label,
922
1334
  htmlFor: label.name,
923
- className: clsx7(" mb-1", label.className),
1335
+ className: clsx11(" mb-1", label.className),
924
1336
  labelType: label.labelType ?? "labelBig"
925
1337
  }
926
1338
  ),
927
- /* @__PURE__ */ jsxs6("div", { className: "relative", children: [
928
- /* @__PURE__ */ jsxs6(
929
- "button",
930
- {
931
- ref: triggerRef,
932
- className: clsx7(
933
- "btn-md justify-between w-full border-2 h-auto",
934
- {
935
- "rounded-b-lg": !open,
936
- "bg-menu-background border-menu-border hover:border-primary": !isDisabled,
937
- "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
938
- }
939
- ),
940
- onClick: () => setIsOpen(!isOpen),
941
- disabled: isDisabled,
942
- children: [
943
- !isShowingHint && /* @__PURE__ */ jsx8("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? (useChipDisplay && selectedItems ? /* @__PURE__ */ jsx8(ChipList, { list: selectedItems.map((value) => ({ children: value.label })) }) : translation("selected", { replacements: { amount: selectedItems.length.toString() } })) }),
944
- isShowingHint && /* @__PURE__ */ jsx8("span", { className: "textstyle-description", children: hintText ?? translation("select") }),
945
- isOpen ? /* @__PURE__ */ jsx8(ChevronUp, { size: 24, className: "min-w-6" }) : /* @__PURE__ */ jsx8(ChevronDown, { className: "min-w-6" })
946
- ]
947
- }
948
- ),
949
- isOpen && /* @__PURE__ */ jsxs6(
950
- "div",
951
- {
952
- ref: menuRef,
953
- 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",
954
- children: [
955
- /* @__PURE__ */ jsx8(
956
- SearchableList,
1339
+ /* @__PURE__ */ jsx12(
1340
+ Menu,
1341
+ {
1342
+ ...menuProps,
1343
+ trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ jsx12(
1344
+ "button",
1345
+ {
1346
+ ref,
1347
+ className: clsx11(
1348
+ "btn-md justify-between w-full border-2 h-auto",
1349
+ {
1350
+ "min-h-14": useChipDisplay,
1351
+ "bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
1352
+ "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
1353
+ },
1354
+ triggerClassName
1355
+ ),
1356
+ onClick: toggleOpen,
1357
+ disabled,
1358
+ children: useChipDisplay ? /* @__PURE__ */ jsx12(Fragment3, { children: isShowingHint ? /* @__PURE__ */ jsx12(IconButton, { disabled, size: "small", color: "neutral", children: /* @__PURE__ */ jsx12(Plus, {}) }) : /* @__PURE__ */ jsx12(ChipList, { list: selectedItems.map((value) => ({ children: value.label })) }) }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
1359
+ !isShowingHint && /* @__PURE__ */ jsx12("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? translation("selected", { replacements: { amount: selectedItems.length.toString() } }) }),
1360
+ isShowingHint && /* @__PURE__ */ jsx12("span", { className: clsx11("textstyle-description", hintTextClassName), children: hintText ?? translation("select") }),
1361
+ /* @__PURE__ */ jsx12(ExpansionIcon, { isExpanded: isOpen })
1362
+ ] })
1363
+ }
1364
+ ),
1365
+ menuClassName: clsx11("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
1366
+ children: (bag) => {
1367
+ const { close } = bag;
1368
+ return /* @__PURE__ */ jsxs10(Fragment3, { children: [
1369
+ !searchOptions?.disabled && /* @__PURE__ */ jsx12(
1370
+ SearchBar,
957
1371
  {
958
- list: options,
959
- minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
960
- searchMapping: (item) => item.searchTags,
961
- itemMapper: (option, index) => /* @__PURE__ */ jsx8(
962
- Tile,
1372
+ value: search,
1373
+ onChangeText: setSearch,
1374
+ autoFocus: true
1375
+ }
1376
+ ),
1377
+ /* @__PURE__ */ jsxs10("div", { className: "flex-col-2 overflow-y-auto", children: [
1378
+ result.map((option, index) => {
1379
+ const update = () => {
1380
+ onChange(options.map((value) => value.value === option.value ? {
1381
+ ...option,
1382
+ selected: !value.selected
1383
+ } : value));
1384
+ };
1385
+ return /* @__PURE__ */ jsx12(
1386
+ SelectTile,
963
1387
  {
964
- isSelected: option.selected,
965
- className: "px-2 py-1 rounded-md",
966
- disabledClassName: "text-disabled-text cursor-not-allowed",
967
- title: { value: option.label, className: "font-semibold" },
968
- onClick: () => {
969
- onChange(options.map((value) => value.value === option.value ? {
970
- ...option,
971
- selected: !value.selected
972
- } : value));
973
- },
974
- isDisabled: option.disabled
1388
+ prefix: /* @__PURE__ */ jsx12(
1389
+ Checkbox,
1390
+ {
1391
+ checked: option.selected,
1392
+ onChange: update,
1393
+ size: "small",
1394
+ disabled: option.disabled
1395
+ }
1396
+ ),
1397
+ title: { value: option.label },
1398
+ onClick: update,
1399
+ disabled: option.disabled
975
1400
  },
976
1401
  index
977
- )
978
- }
979
- ),
980
- /* @__PURE__ */ jsxs6("div", { className: "row justify-between mt-2", children: [
981
- /* @__PURE__ */ jsxs6("div", { className: "row gap-x-2", children: [
982
- /* @__PURE__ */ jsx8(
1402
+ );
1403
+ }),
1404
+ additionalItems && additionalItems({ ...bag, search })
1405
+ ] }),
1406
+ /* @__PURE__ */ jsxs10("div", { className: "flex-row-2 justify-between", children: [
1407
+ /* @__PURE__ */ jsxs10("div", { className: "flex-row-2", children: [
1408
+ /* @__PURE__ */ jsx12(
983
1409
  SolidButton,
984
1410
  {
985
1411
  color: "neutral",
@@ -994,7 +1420,7 @@ var MultiSelect = ({
994
1420
  children: translation("all")
995
1421
  }
996
1422
  ),
997
- /* @__PURE__ */ jsx8(
1423
+ /* @__PURE__ */ jsx12(
998
1424
  SolidButton,
999
1425
  {
1000
1426
  color: "neutral",
@@ -1009,19 +1435,19 @@ var MultiSelect = ({
1009
1435
  }
1010
1436
  )
1011
1437
  ] }),
1012
- /* @__PURE__ */ jsx8(SolidButton, { size: "small", onClick: () => setIsOpen(false), children: "Done" })
1438
+ /* @__PURE__ */ jsx12(SolidButton, { size: "small", onClick: close, children: "Done" })
1013
1439
  ] })
1014
- ]
1440
+ ] });
1015
1441
  }
1016
- )
1017
- ] })
1442
+ }
1443
+ )
1018
1444
  ] });
1019
1445
  };
1020
1446
 
1021
1447
  // src/components/properties/PropertyBase.tsx
1022
1448
  import { AlertTriangle } from "lucide-react";
1023
- import clsx8 from "clsx";
1024
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1449
+ import clsx12 from "clsx";
1450
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
1025
1451
  var PropertyBase = ({
1026
1452
  overwriteTranslation,
1027
1453
  name,
@@ -1035,36 +1461,44 @@ var PropertyBase = ({
1035
1461
  }) => {
1036
1462
  const translation = useTranslation([formTranslation], overwriteTranslation);
1037
1463
  const requiredAndNoValue = softRequired && !hasValue;
1038
- return /* @__PURE__ */ jsxs7("div", { className: clsx8("row gap-x-0 group", className), children: [
1039
- /* @__PURE__ */ jsxs7(
1464
+ return /* @__PURE__ */ jsxs11("div", { className: clsx12("flex-row-0 group", className), children: [
1465
+ /* @__PURE__ */ jsxs11(
1040
1466
  "div",
1041
1467
  {
1042
- className: clsx8("row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0", {
1043
- "bg-property-title-background property-title-text group-hover:border-primary": !requiredAndNoValue,
1044
- "bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
1045
- }, className),
1468
+ className: clsx12(
1469
+ "flex-row-2 max-w-48 min-w-48 px-3 py-2 items-center rounded-l-xl border-2 border-r-0",
1470
+ {
1471
+ "bg-property-title-background text-property-title-text group-hover:border-primary": !requiredAndNoValue,
1472
+ "bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
1473
+ },
1474
+ className
1475
+ ),
1046
1476
  children: [
1047
- icon,
1048
- name
1477
+ /* @__PURE__ */ jsx13("div", { className: "max-w-6 min-w-6 text-text-default", children: icon }),
1478
+ /* @__PURE__ */ jsx13("span", { className: "font-semibold", children: name })
1049
1479
  ]
1050
1480
  }
1051
1481
  ),
1052
- /* @__PURE__ */ jsxs7(
1482
+ /* @__PURE__ */ jsxs11(
1053
1483
  "div",
1054
1484
  {
1055
- className: clsx8("row gap-x-0 grow justify-between items-center rounded-r-xl border-2 border-l-0", {
1056
- "bg-surface group-hover:border-primary": !requiredAndNoValue,
1057
- "bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
1058
- }, className),
1485
+ className: clsx12(
1486
+ "flex-row-2 grow px-3 py-2 justify-between items-center rounded-r-xl border-2 border-l-0 min-h-15",
1487
+ {
1488
+ "bg-surface group-hover:border-primary": !requiredAndNoValue,
1489
+ "bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
1490
+ },
1491
+ className
1492
+ ),
1059
1493
  children: [
1060
1494
  input({ softRequired, hasValue }),
1061
- requiredAndNoValue && /* @__PURE__ */ jsx9("div", { className: "text-warning pr-4", children: /* @__PURE__ */ jsx9(AlertTriangle, { size: 24 }) }),
1062
- onRemove && /* @__PURE__ */ jsx9(
1495
+ requiredAndNoValue && /* @__PURE__ */ jsx13("div", { className: "text-warning", children: /* @__PURE__ */ jsx13(AlertTriangle, { size: 24 }) }),
1496
+ onRemove && hasValue && /* @__PURE__ */ jsx13(
1063
1497
  TextButton,
1064
1498
  {
1065
1499
  onClick: onRemove,
1066
1500
  color: "negative",
1067
- className: clsx8("pr-4 items-center", { "!text-transparent": !hasValue || readOnly }),
1501
+ className: clsx12("items-center", { "!text-transparent": !hasValue || readOnly }),
1068
1502
  disabled: !hasValue || readOnly,
1069
1503
  children: translation("remove")
1070
1504
  }
@@ -1076,7 +1510,7 @@ var PropertyBase = ({
1076
1510
  };
1077
1511
 
1078
1512
  // src/components/properties/MultiSelectProperty.tsx
1079
- import { jsx as jsx10 } from "react/jsx-runtime";
1513
+ import { jsx as jsx14 } from "react/jsx-runtime";
1080
1514
  var MultiSelectProperty = ({
1081
1515
  overwriteTranslation,
1082
1516
  options,
@@ -1084,11 +1518,12 @@ var MultiSelectProperty = ({
1084
1518
  readOnly = false,
1085
1519
  softRequired,
1086
1520
  onRemove,
1521
+ onAddNew,
1087
1522
  ...multiSelectProps
1088
1523
  }) => {
1089
1524
  const translation = useTranslation([formTranslation], overwriteTranslation);
1090
1525
  const hasValue = options.some((value) => value.selected);
1091
- return /* @__PURE__ */ jsx10(
1526
+ return /* @__PURE__ */ jsx14(
1092
1527
  PropertyBase,
1093
1528
  {
1094
1529
  name,
@@ -1096,20 +1531,42 @@ var MultiSelectProperty = ({
1096
1531
  readOnly,
1097
1532
  softRequired,
1098
1533
  hasValue,
1099
- icon: /* @__PURE__ */ jsx10(List, { size: 16 }),
1100
- input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ jsx10(
1101
- "div",
1534
+ icon: /* @__PURE__ */ jsx14(List, { size: 24 }),
1535
+ input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ jsx14(
1536
+ MultiSelect,
1102
1537
  {
1103
- className: clsx9("row grow py-2 px-4 cursor-pointer", { "text-warning": softRequired2 && !hasValue }),
1104
- children: /* @__PURE__ */ jsx10(
1105
- MultiSelect,
1538
+ ...multiSelectProps,
1539
+ className: clsx13("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
1540
+ options,
1541
+ disabled: readOnly,
1542
+ useChipDisplay: true,
1543
+ hintText: `${translation("select")}...`,
1544
+ searchOptions: {
1545
+ sortingFunction: (a, b) => a.value.localeCompare(b.value),
1546
+ ...multiSelectProps?.searchOptions
1547
+ },
1548
+ additionalItems: ({ close, search }) => {
1549
+ if (!onAddNew && !search.trim()) {
1550
+ return void 0;
1551
+ }
1552
+ return /* @__PURE__ */ jsx14(
1553
+ SelectTile,
1554
+ {
1555
+ prefix: /* @__PURE__ */ jsx14(Plus2, {}),
1556
+ title: { value: `${translation("add")} ${search.trim()}` },
1557
+ onClick: () => {
1558
+ onAddNew(search);
1559
+ close();
1560
+ },
1561
+ disabled: options.some((value) => value.value === search.trim())
1562
+ }
1563
+ );
1564
+ },
1565
+ triggerClassName: clsx13(
1566
+ "!border-none !p-0 !min-h-10",
1106
1567
  {
1107
- ...multiSelectProps,
1108
- className: clsx9("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
1109
- options,
1110
- isDisabled: readOnly,
1111
- useChipDisplay: true,
1112
- hintText: `${translation("select")}...`
1568
+ "!bg-warning !text-surface-warning": softRequired2 && !hasValue,
1569
+ "": !softRequired2 || hasValue
1113
1570
  }
1114
1571
  )
1115
1572
  }