@helpwave/hightide 0.1.17 → 0.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/dist/components/branding/HelpwaveBadge.js +7 -7
  2. package/dist/components/branding/HelpwaveBadge.js.map +1 -1
  3. package/dist/components/branding/HelpwaveBadge.mjs +7 -7
  4. package/dist/components/branding/HelpwaveBadge.mjs.map +1 -1
  5. package/dist/components/date/DatePicker.js +65 -38
  6. package/dist/components/date/DatePicker.js.map +1 -1
  7. package/dist/components/date/DatePicker.mjs +54 -27
  8. package/dist/components/date/DatePicker.mjs.map +1 -1
  9. package/dist/components/date/DayPicker.js +3 -3
  10. package/dist/components/date/DayPicker.js.map +1 -1
  11. package/dist/components/date/DayPicker.mjs +3 -3
  12. package/dist/components/date/DayPicker.mjs.map +1 -1
  13. package/dist/components/date/TimePicker.js +4 -4
  14. package/dist/components/date/TimePicker.js.map +1 -1
  15. package/dist/components/date/TimePicker.mjs +4 -4
  16. package/dist/components/date/TimePicker.mjs.map +1 -1
  17. package/dist/components/date/YearMonthPicker.js +46 -19
  18. package/dist/components/date/YearMonthPicker.js.map +1 -1
  19. package/dist/components/date/YearMonthPicker.mjs +44 -17
  20. package/dist/components/date/YearMonthPicker.mjs.map +1 -1
  21. package/dist/components/dialogs/ConfirmDialog.js +32 -28
  22. package/dist/components/dialogs/ConfirmDialog.js.map +1 -1
  23. package/dist/components/dialogs/ConfirmDialog.mjs +18 -14
  24. package/dist/components/dialogs/ConfirmDialog.mjs.map +1 -1
  25. package/dist/components/icons-and-geometry/Avatar.js +2 -2
  26. package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
  27. package/dist/components/icons-and-geometry/Avatar.mjs +2 -2
  28. package/dist/components/icons-and-geometry/Avatar.mjs.map +1 -1
  29. package/dist/components/icons-and-geometry/Ring.js +2 -2
  30. package/dist/components/icons-and-geometry/Ring.js.map +1 -1
  31. package/dist/components/icons-and-geometry/Ring.mjs +2 -2
  32. package/dist/components/icons-and-geometry/Ring.mjs.map +1 -1
  33. package/dist/components/layout-and-navigation/BreadCrumb.js +1 -1
  34. package/dist/components/layout-and-navigation/BreadCrumb.js.map +1 -1
  35. package/dist/components/layout-and-navigation/BreadCrumb.mjs +1 -1
  36. package/dist/components/layout-and-navigation/BreadCrumb.mjs.map +1 -1
  37. package/dist/components/layout-and-navigation/Carousel.js +84 -15
  38. package/dist/components/layout-and-navigation/Carousel.js.map +1 -1
  39. package/dist/components/layout-and-navigation/Carousel.mjs +76 -7
  40. package/dist/components/layout-and-navigation/Carousel.mjs.map +1 -1
  41. package/dist/components/layout-and-navigation/Chip.js +1 -1
  42. package/dist/components/layout-and-navigation/Chip.js.map +1 -1
  43. package/dist/components/layout-and-navigation/Chip.mjs +1 -1
  44. package/dist/components/layout-and-navigation/Chip.mjs.map +1 -1
  45. package/dist/components/layout-and-navigation/Expandable.d.mts +7 -1
  46. package/dist/components/layout-and-navigation/Expandable.d.ts +7 -1
  47. package/dist/components/layout-and-navigation/Expandable.js +36 -9
  48. package/dist/components/layout-and-navigation/Expandable.js.map +1 -1
  49. package/dist/components/layout-and-navigation/Expandable.mjs +36 -10
  50. package/dist/components/layout-and-navigation/Expandable.mjs.map +1 -1
  51. package/dist/components/layout-and-navigation/FAQSection.js +34 -11
  52. package/dist/components/layout-and-navigation/FAQSection.js.map +1 -1
  53. package/dist/components/layout-and-navigation/FAQSection.mjs +36 -13
  54. package/dist/components/layout-and-navigation/FAQSection.mjs.map +1 -1
  55. package/dist/components/layout-and-navigation/Overlay.js +92 -19
  56. package/dist/components/layout-and-navigation/Overlay.js.map +1 -1
  57. package/dist/components/layout-and-navigation/Overlay.mjs +81 -8
  58. package/dist/components/layout-and-navigation/Overlay.mjs.map +1 -1
  59. package/dist/components/layout-and-navigation/Pagination.js +82 -10
  60. package/dist/components/layout-and-navigation/Pagination.js.map +1 -1
  61. package/dist/components/layout-and-navigation/Pagination.mjs +79 -7
  62. package/dist/components/layout-and-navigation/Pagination.mjs.map +1 -1
  63. package/dist/components/layout-and-navigation/SearchableList.js +127 -26
  64. package/dist/components/layout-and-navigation/SearchableList.js.map +1 -1
  65. package/dist/components/layout-and-navigation/SearchableList.mjs +126 -25
  66. package/dist/components/layout-and-navigation/SearchableList.mjs.map +1 -1
  67. package/dist/components/layout-and-navigation/StepperBar.js +22 -16
  68. package/dist/components/layout-and-navigation/StepperBar.js.map +1 -1
  69. package/dist/components/layout-and-navigation/StepperBar.mjs +19 -13
  70. package/dist/components/layout-and-navigation/StepperBar.mjs.map +1 -1
  71. package/dist/components/layout-and-navigation/TextImage.js +7 -3
  72. package/dist/components/layout-and-navigation/TextImage.js.map +1 -1
  73. package/dist/components/layout-and-navigation/TextImage.mjs +7 -3
  74. package/dist/components/layout-and-navigation/TextImage.mjs.map +1 -1
  75. package/dist/components/layout-and-navigation/Tile.d.mts +2 -2
  76. package/dist/components/layout-and-navigation/Tile.d.ts +2 -2
  77. package/dist/components/layout-and-navigation/Tile.js +7 -7
  78. package/dist/components/layout-and-navigation/Tile.js.map +1 -1
  79. package/dist/components/layout-and-navigation/Tile.mjs +7 -7
  80. package/dist/components/layout-and-navigation/Tile.mjs.map +1 -1
  81. package/dist/components/loading-states/ErrorComponent.js +1 -1
  82. package/dist/components/loading-states/ErrorComponent.js.map +1 -1
  83. package/dist/components/loading-states/ErrorComponent.mjs +1 -1
  84. package/dist/components/loading-states/ErrorComponent.mjs.map +1 -1
  85. package/dist/components/loading-states/LoadingAndErrorComponent.js +6 -2
  86. package/dist/components/loading-states/LoadingAndErrorComponent.js.map +1 -1
  87. package/dist/components/loading-states/LoadingAndErrorComponent.mjs +6 -2
  88. package/dist/components/loading-states/LoadingAndErrorComponent.mjs.map +1 -1
  89. package/dist/components/loading-states/LoadingAnimation.js +5 -1
  90. package/dist/components/loading-states/LoadingAnimation.js.map +1 -1
  91. package/dist/components/loading-states/LoadingAnimation.mjs +5 -1
  92. package/dist/components/loading-states/LoadingAnimation.mjs.map +1 -1
  93. package/dist/components/loading-states/LoadingButton.js +8 -6
  94. package/dist/components/loading-states/LoadingButton.js.map +1 -1
  95. package/dist/components/loading-states/LoadingButton.mjs +8 -6
  96. package/dist/components/loading-states/LoadingButton.mjs.map +1 -1
  97. package/dist/components/modals/ConfirmModal.js +32 -28
  98. package/dist/components/modals/ConfirmModal.js.map +1 -1
  99. package/dist/components/modals/ConfirmModal.mjs +18 -14
  100. package/dist/components/modals/ConfirmModal.mjs.map +1 -1
  101. package/dist/components/modals/DiscardChangesModal.js +28 -24
  102. package/dist/components/modals/DiscardChangesModal.js.map +1 -1
  103. package/dist/components/modals/DiscardChangesModal.mjs +18 -14
  104. package/dist/components/modals/DiscardChangesModal.mjs.map +1 -1
  105. package/dist/components/modals/InputModal.js +32 -29
  106. package/dist/components/modals/InputModal.js.map +1 -1
  107. package/dist/components/modals/InputModal.mjs +18 -15
  108. package/dist/components/modals/InputModal.mjs.map +1 -1
  109. package/dist/components/modals/LanguageModal.js +728 -435
  110. package/dist/components/modals/LanguageModal.js.map +1 -1
  111. package/dist/components/modals/LanguageModal.mjs +728 -431
  112. package/dist/components/modals/LanguageModal.mjs.map +1 -1
  113. package/dist/components/modals/ThemeModal.js +732 -439
  114. package/dist/components/modals/ThemeModal.js.map +1 -1
  115. package/dist/components/modals/ThemeModal.mjs +731 -434
  116. package/dist/components/modals/ThemeModal.mjs.map +1 -1
  117. package/dist/components/properties/CheckboxProperty.js +110 -35
  118. package/dist/components/properties/CheckboxProperty.js.map +1 -1
  119. package/dist/components/properties/CheckboxProperty.mjs +110 -35
  120. package/dist/components/properties/CheckboxProperty.mjs.map +1 -1
  121. package/dist/components/properties/DateProperty.js +118 -42
  122. package/dist/components/properties/DateProperty.js.map +1 -1
  123. package/dist/components/properties/DateProperty.mjs +114 -38
  124. package/dist/components/properties/DateProperty.mjs.map +1 -1
  125. package/dist/components/properties/MultiSelectProperty.d.mts +10 -3
  126. package/dist/components/properties/MultiSelectProperty.d.ts +10 -3
  127. package/dist/components/properties/MultiSelectProperty.js +915 -464
  128. package/dist/components/properties/MultiSelectProperty.js.map +1 -1
  129. package/dist/components/properties/MultiSelectProperty.mjs +920 -465
  130. package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
  131. package/dist/components/properties/NumberProperty.js +101 -19
  132. package/dist/components/properties/NumberProperty.js.map +1 -1
  133. package/dist/components/properties/NumberProperty.mjs +101 -19
  134. package/dist/components/properties/NumberProperty.mjs.map +1 -1
  135. package/dist/components/properties/PropertyBase.js +103 -20
  136. package/dist/components/properties/PropertyBase.js.map +1 -1
  137. package/dist/components/properties/PropertyBase.mjs +99 -16
  138. package/dist/components/properties/PropertyBase.mjs.map +1 -1
  139. package/dist/components/properties/SelectProperty.d.mts +9 -2
  140. package/dist/components/properties/SelectProperty.d.ts +9 -2
  141. package/dist/components/properties/SelectProperty.js +682 -244
  142. package/dist/components/properties/SelectProperty.js.map +1 -1
  143. package/dist/components/properties/SelectProperty.mjs +686 -244
  144. package/dist/components/properties/SelectProperty.mjs.map +1 -1
  145. package/dist/components/properties/TextProperty.js +133 -47
  146. package/dist/components/properties/TextProperty.js.map +1 -1
  147. package/dist/components/properties/TextProperty.mjs +133 -47
  148. package/dist/components/properties/TextProperty.mjs.map +1 -1
  149. package/dist/components/table/Table.js +285 -186
  150. package/dist/components/table/Table.js.map +1 -1
  151. package/dist/components/table/Table.mjs +270 -167
  152. package/dist/components/table/Table.mjs.map +1 -1
  153. package/dist/components/table/TableFilterButton.js +179 -79
  154. package/dist/components/table/TableFilterButton.js.map +1 -1
  155. package/dist/components/table/TableFilterButton.mjs +160 -56
  156. package/dist/components/table/TableFilterButton.mjs.map +1 -1
  157. package/dist/components/table/TableSortButton.js +72 -3
  158. package/dist/components/table/TableSortButton.js.map +1 -1
  159. package/dist/components/table/TableSortButton.mjs +72 -3
  160. package/dist/components/table/TableSortButton.mjs.map +1 -1
  161. package/dist/components/user-action/Button.d.mts +15 -2
  162. package/dist/components/user-action/Button.d.ts +15 -2
  163. package/dist/components/user-action/Button.js +12 -12
  164. package/dist/components/user-action/Button.js.map +1 -1
  165. package/dist/components/user-action/Button.mjs +12 -12
  166. package/dist/components/user-action/Button.mjs.map +1 -1
  167. package/dist/components/user-action/Checkbox.js +6 -15
  168. package/dist/components/user-action/Checkbox.js.map +1 -1
  169. package/dist/components/user-action/Checkbox.mjs +6 -15
  170. package/dist/components/user-action/Checkbox.mjs.map +1 -1
  171. package/dist/components/user-action/CopyToClipboardWrapper.js +6 -2
  172. package/dist/components/user-action/CopyToClipboardWrapper.js.map +1 -1
  173. package/dist/components/user-action/CopyToClipboardWrapper.mjs +6 -2
  174. package/dist/components/user-action/CopyToClipboardWrapper.mjs.map +1 -1
  175. package/dist/components/user-action/DateAndTimePicker.js +79 -48
  176. package/dist/components/user-action/DateAndTimePicker.js.map +1 -1
  177. package/dist/components/user-action/DateAndTimePicker.mjs +65 -34
  178. package/dist/components/user-action/DateAndTimePicker.mjs.map +1 -1
  179. package/dist/components/user-action/Input.js +0 -1
  180. package/dist/components/user-action/Input.js.map +1 -1
  181. package/dist/components/user-action/Input.mjs +0 -1
  182. package/dist/components/user-action/Input.mjs.map +1 -1
  183. package/dist/components/user-action/Menu.d.mts +11 -6
  184. package/dist/components/user-action/Menu.d.ts +11 -6
  185. package/dist/components/user-action/Menu.js +128 -31
  186. package/dist/components/user-action/Menu.js.map +1 -1
  187. package/dist/components/user-action/Menu.mjs +134 -33
  188. package/dist/components/user-action/Menu.mjs.map +1 -1
  189. package/dist/components/user-action/MultiSelect.d.mts +17 -7
  190. package/dist/components/user-action/MultiSelect.d.ts +17 -7
  191. package/dist/components/user-action/MultiSelect.js +796 -376
  192. package/dist/components/user-action/MultiSelect.js.map +1 -1
  193. package/dist/components/user-action/MultiSelect.mjs +781 -357
  194. package/dist/components/user-action/MultiSelect.mjs.map +1 -1
  195. package/dist/components/user-action/ScrollPicker.js +2 -2
  196. package/dist/components/user-action/ScrollPicker.js.map +1 -1
  197. package/dist/components/user-action/ScrollPicker.mjs +2 -2
  198. package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
  199. package/dist/components/user-action/SearchBar.d.mts +14 -0
  200. package/dist/components/user-action/SearchBar.d.ts +14 -0
  201. package/dist/components/user-action/SearchBar.js +673 -0
  202. package/dist/components/user-action/SearchBar.js.map +1 -0
  203. package/dist/components/user-action/SearchBar.mjs +637 -0
  204. package/dist/components/user-action/SearchBar.mjs.map +1 -0
  205. package/dist/components/user-action/Select.d.mts +18 -5
  206. package/dist/components/user-action/Select.d.ts +18 -5
  207. package/dist/components/user-action/Select.js +764 -356
  208. package/dist/components/user-action/Select.js.map +1 -1
  209. package/dist/components/user-action/Select.mjs +761 -350
  210. package/dist/components/user-action/Select.mjs.map +1 -1
  211. package/dist/components/user-action/Textarea.d.mts +1 -1
  212. package/dist/components/user-action/Textarea.d.ts +1 -1
  213. package/dist/components/user-action/Textarea.js +13 -4
  214. package/dist/components/user-action/Textarea.js.map +1 -1
  215. package/dist/components/user-action/Textarea.mjs +13 -4
  216. package/dist/components/user-action/Textarea.mjs.map +1 -1
  217. package/dist/components/user-action/ToggleableInput.js +2 -3
  218. package/dist/components/user-action/ToggleableInput.js.map +1 -1
  219. package/dist/components/user-action/ToggleableInput.mjs +2 -3
  220. package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
  221. package/dist/css/globals.css +251 -113
  222. package/dist/css/uncompiled/globals.css +19 -13
  223. package/dist/css/uncompiled/theme/colors-component.css +12 -3
  224. package/dist/css/uncompiled/theme/colors-semantic.css +10 -7
  225. package/dist/css/uncompiled/utitlity/animation.css +70 -1
  226. package/dist/css/uncompiled/utitlity/general.css +16 -0
  227. package/dist/hooks/useDelay.js +0 -1
  228. package/dist/hooks/useDelay.js.map +1 -1
  229. package/dist/hooks/useDelay.mjs +0 -1
  230. package/dist/hooks/useDelay.mjs.map +1 -1
  231. package/dist/hooks/usePopoverPosition.d.mts +15 -0
  232. package/dist/hooks/usePopoverPosition.d.ts +15 -0
  233. package/dist/hooks/usePopoverPosition.js +81 -0
  234. package/dist/hooks/usePopoverPosition.js.map +1 -0
  235. package/dist/hooks/usePopoverPosition.mjs +57 -0
  236. package/dist/hooks/usePopoverPosition.mjs.map +1 -0
  237. package/dist/hooks/useSearch.d.mts +7 -2
  238. package/dist/hooks/useSearch.d.ts +7 -2
  239. package/dist/hooks/useSearch.js +44 -15
  240. package/dist/hooks/useSearch.js.map +1 -1
  241. package/dist/hooks/useSearch.mjs +45 -16
  242. package/dist/hooks/useSearch.mjs.map +1 -1
  243. package/dist/index.d.mts +6 -4
  244. package/dist/index.d.ts +6 -4
  245. package/dist/index.js +1102 -820
  246. package/dist/index.js.map +1 -1
  247. package/dist/index.mjs +1001 -719
  248. package/dist/index.mjs.map +1 -1
  249. package/dist/localization/defaults/form.d.mts +2 -0
  250. package/dist/localization/defaults/form.d.ts +2 -0
  251. package/dist/localization/defaults/form.js +4 -0
  252. package/dist/localization/defaults/form.js.map +1 -1
  253. package/dist/localization/defaults/form.mjs +4 -0
  254. package/dist/localization/defaults/form.mjs.map +1 -1
  255. package/dist/util/simpleSearch.d.mts +1 -1
  256. package/dist/util/simpleSearch.d.ts +1 -1
  257. package/dist/util/simpleSearch.js +4 -1
  258. package/dist/util/simpleSearch.js.map +1 -1
  259. package/dist/util/simpleSearch.mjs +4 -1
  260. package/dist/util/simpleSearch.mjs.map +1 -1
  261. package/package.json +1 -1
@@ -33,8 +33,8 @@ __export(MultiSelect_exports, {
33
33
  MultiSelectUncontrolled: () => MultiSelectUncontrolled
34
34
  });
35
35
  module.exports = __toCommonJS(MultiSelect_exports);
36
- var import_react9 = require("react");
37
- var import_lucide_react3 = require("lucide-react");
36
+ var import_react16 = require("react");
37
+ var import_react17 = require("react");
38
38
 
39
39
  // src/localization/LanguageProvider.tsx
40
40
  var import_react2 = require("react");
@@ -124,7 +124,7 @@ var useTranslation = (translations, overwriteTranslation = {}) => {
124
124
  };
125
125
 
126
126
  // src/components/user-action/MultiSelect.tsx
127
- var import_clsx7 = __toESM(require("clsx"));
127
+ var import_clsx11 = __toESM(require("clsx"));
128
128
 
129
129
  // src/components/user-action/Label.tsx
130
130
  var import_clsx = __toESM(require("clsx"));
@@ -144,22 +144,389 @@ var Label = ({
144
144
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { ...props, className: (0, import_clsx.default)(styleMapping[labelType], className), children: children ? children : name });
145
145
  };
146
146
 
147
- // src/components/layout-and-navigation/SearchableList.tsx
147
+ // src/components/user-action/Select.tsx
148
+ var import_react13 = require("react");
149
+ var import_react14 = require("react");
150
+ var import_clsx8 = __toESM(require("clsx"));
151
+
152
+ // src/components/layout-and-navigation/Tile.tsx
153
+ var import_clsx2 = __toESM(require("clsx"));
148
154
  var import_lucide_react = require("lucide-react");
155
+ var import_jsx_runtime3 = require("react/jsx-runtime");
156
+ var Tile = ({
157
+ title,
158
+ description,
159
+ onClick,
160
+ isSelected = false,
161
+ disabled = false,
162
+ prefix,
163
+ suffix,
164
+ normalClassName = "hover:bg-primary/40 cursor-pointer",
165
+ selectedClassName = " bg-primary/20",
166
+ disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
167
+ className
168
+ }) => {
169
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
170
+ "div",
171
+ {
172
+ className: (0, import_clsx2.default)(
173
+ "flex-row-2 w-full items-center",
174
+ {
175
+ [normalClassName]: !!onClick && !disabled,
176
+ [selectedClassName]: isSelected && !disabled,
177
+ [disabledClassName]: disabled
178
+ },
179
+ className
180
+ ),
181
+ onClick: disabled ? void 0 : onClick,
182
+ children: [
183
+ prefix,
184
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "flex-col-0 w-full", children: [
185
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { className: (0, import_clsx2.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
186
+ !!description && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: (0, import_clsx2.default)(description.className ?? "textstyle-description"), children: description.value })
187
+ ] }),
188
+ suffix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_lucide_react.Check, { size: 24 }) : void 0)
189
+ ]
190
+ }
191
+ );
192
+ };
193
+
194
+ // src/components/layout-and-navigation/Expandable.tsx
195
+ var import_react3 = require("react");
196
+ var import_lucide_react2 = require("lucide-react");
197
+ var import_clsx3 = __toESM(require("clsx"));
198
+
199
+ // src/util/noop.ts
200
+ var noop = () => void 0;
201
+
202
+ // src/components/layout-and-navigation/Expandable.tsx
203
+ var import_jsx_runtime4 = require("react/jsx-runtime");
204
+ var ExpansionIcon = ({ isExpanded, className }) => {
205
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
206
+ import_lucide_react2.ChevronDown,
207
+ {
208
+ className: (0, import_clsx3.default)(
209
+ "min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
210
+ { "rotate-180": isExpanded },
211
+ className
212
+ )
213
+ }
214
+ );
215
+ };
216
+ var Expandable = (0, import_react3.forwardRef)(function Expandable2({
217
+ children,
218
+ label,
219
+ icon,
220
+ isExpanded = false,
221
+ onChange = noop,
222
+ clickOnlyOnHeader = true,
223
+ disabled = false,
224
+ className,
225
+ headerClassName,
226
+ contentClassName
227
+ }, ref) {
228
+ const defaultIcon = (0, import_react3.useCallback)((expanded) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ExpansionIcon, { isExpanded: expanded }), []);
229
+ icon ??= defaultIcon;
230
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
231
+ "div",
232
+ {
233
+ ref,
234
+ className: (0, import_clsx3.default)("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
235
+ onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
236
+ children: [
237
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
238
+ "div",
239
+ {
240
+ className: (0, import_clsx3.default)(
241
+ "flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
242
+ {
243
+ "group-hover:brightness-97": !isExpanded,
244
+ "hover:brightness-97": isExpanded && !disabled,
245
+ "cursor-pointer": clickOnlyOnHeader && !disabled
246
+ },
247
+ headerClassName
248
+ ),
249
+ onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
250
+ children: [
251
+ label,
252
+ icon(isExpanded)
253
+ ]
254
+ }
255
+ ),
256
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
257
+ "div",
258
+ {
259
+ className: (0, import_clsx3.default)(
260
+ "flex-col-2 px-4 transition-all duration-300 ease-in-out",
261
+ {
262
+ "max-h-96 opacity-100 pb-2": isExpanded,
263
+ "max-h-0 opacity-0 overflow-hidden": !isExpanded
264
+ },
265
+ contentClassName
266
+ ),
267
+ children
268
+ }
269
+ )
270
+ ]
271
+ }
272
+ );
273
+ });
274
+ var ExpandableUncontrolled = (0, import_react3.forwardRef)(function ExpandableUncontrolled2({
275
+ isExpanded,
276
+ onChange = noop,
277
+ ...props
278
+ }, ref) {
279
+ const [usedIsExpanded, setUsedIsExpanded] = (0, import_react3.useState)(isExpanded);
280
+ (0, import_react3.useEffect)(() => {
281
+ setUsedIsExpanded(isExpanded);
282
+ }, [isExpanded]);
283
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
284
+ Expandable,
285
+ {
286
+ ...props,
287
+ ref,
288
+ isExpanded: usedIsExpanded,
289
+ onChange: (value) => {
290
+ onChange(value);
291
+ setUsedIsExpanded(value);
292
+ }
293
+ }
294
+ );
295
+ });
296
+
297
+ // src/components/user-action/Menu.tsx
298
+ var import_react6 = require("react");
149
299
  var import_clsx4 = __toESM(require("clsx"));
150
300
 
301
+ // src/hooks/useOutsideClick.ts
302
+ var import_react4 = require("react");
303
+ var useOutsideClick = (refs, handler) => {
304
+ (0, import_react4.useEffect)(() => {
305
+ const listener = (event) => {
306
+ if (event.target === null) return;
307
+ if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
308
+ return;
309
+ }
310
+ handler();
311
+ };
312
+ document.addEventListener("mousedown", listener);
313
+ document.addEventListener("touchstart", listener);
314
+ return () => {
315
+ document.removeEventListener("mousedown", listener);
316
+ document.removeEventListener("touchstart", listener);
317
+ };
318
+ }, [refs, handler]);
319
+ };
320
+
321
+ // src/hooks/useHoverState.ts
322
+ var import_react5 = require("react");
323
+ var defaultUseHoverStateProps = {
324
+ closingDelay: 200,
325
+ isDisabled: false
326
+ };
327
+ var useHoverState = (props = void 0) => {
328
+ const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
329
+ const [isHovered, setIsHovered] = (0, import_react5.useState)(false);
330
+ const [timer, setTimer] = (0, import_react5.useState)();
331
+ const onMouseEnter = () => {
332
+ if (isDisabled) {
333
+ return;
334
+ }
335
+ clearTimeout(timer);
336
+ setIsHovered(true);
337
+ };
338
+ const onMouseLeave = () => {
339
+ if (isDisabled) {
340
+ return;
341
+ }
342
+ setTimer(setTimeout(() => {
343
+ setIsHovered(false);
344
+ }, closingDelay));
345
+ };
346
+ (0, import_react5.useEffect)(() => {
347
+ if (timer) {
348
+ return () => {
349
+ clearTimeout(timer);
350
+ };
351
+ }
352
+ });
353
+ (0, import_react5.useEffect)(() => {
354
+ if (timer) {
355
+ clearTimeout(timer);
356
+ }
357
+ }, [isDisabled]);
358
+ return {
359
+ isHovered,
360
+ setIsHovered,
361
+ handlers: { onMouseEnter, onMouseLeave }
362
+ };
363
+ };
364
+
365
+ // src/util/PropsWithFunctionChildren.ts
366
+ var resolve = (children, bag) => {
367
+ if (typeof children === "function") {
368
+ return children(bag);
369
+ }
370
+ return children ?? void 0;
371
+ };
372
+ var BagFunctionUtil = {
373
+ resolve
374
+ };
375
+
376
+ // src/hooks/usePopoverPosition.ts
377
+ var defaultPopoverPositionOptions = {
378
+ edgePadding: 16,
379
+ outerGap: 4,
380
+ horizontalAlignment: "leftInside",
381
+ verticalAlignment: "bottomOutside",
382
+ disabled: false
383
+ };
384
+ var usePopoverPosition = (trigger, options) => {
385
+ const {
386
+ edgePadding,
387
+ outerGap,
388
+ verticalAlignment,
389
+ horizontalAlignment,
390
+ disabled
391
+ } = { ...defaultPopoverPositionOptions, ...options };
392
+ if (disabled || !trigger) {
393
+ return {};
394
+ }
395
+ const left = {
396
+ leftOutside: trigger.left - outerGap,
397
+ leftInside: trigger.left,
398
+ rightOutside: trigger.right + outerGap,
399
+ rightInside: trigger.right,
400
+ center: trigger.left + trigger.width / 2
401
+ }[horizontalAlignment];
402
+ const top = {
403
+ topOutside: trigger.top - outerGap,
404
+ topInside: trigger.top,
405
+ bottomOutside: trigger.bottom + outerGap,
406
+ bottomInside: trigger.bottom,
407
+ center: trigger.top + trigger.height / 2
408
+ }[verticalAlignment];
409
+ const translateX = {
410
+ leftOutside: "-100%",
411
+ leftInside: void 0,
412
+ rightOutside: void 0,
413
+ rightInside: "-100%",
414
+ center: "-50%"
415
+ }[horizontalAlignment];
416
+ const translateY = {
417
+ topOutside: "-100%",
418
+ topInside: void 0,
419
+ bottomOutside: void 0,
420
+ bottomInside: "-100%",
421
+ center: "-50%"
422
+ }[verticalAlignment];
423
+ return {
424
+ left: Math.max(left, edgePadding),
425
+ top: Math.max(top, edgePadding),
426
+ translate: [translateX ?? "0", translateY ?? "0"].join(" ")
427
+ };
428
+ };
429
+
430
+ // src/components/user-action/Menu.tsx
431
+ var import_react_dom = require("react-dom");
432
+ var import_jsx_runtime5 = require("react/jsx-runtime");
433
+ function getScrollableParents(element) {
434
+ const scrollables = [];
435
+ let parent = element.parentElement;
436
+ while (parent) {
437
+ scrollables.push(parent);
438
+ parent = parent.parentElement;
439
+ }
440
+ return scrollables;
441
+ }
442
+ var Menu = ({
443
+ trigger,
444
+ children,
445
+ alignmentHorizontal = "leftInside",
446
+ alignmentVertical = "bottomOutside",
447
+ showOnHover = false,
448
+ disabled = false,
449
+ menuClassName = ""
450
+ }) => {
451
+ const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
452
+ const triggerRef = (0, import_react6.useRef)(null);
453
+ const menuRef = (0, import_react6.useRef)(null);
454
+ useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
455
+ const [isHidden, setIsHidden] = (0, import_react6.useState)(true);
456
+ const bag = {
457
+ isOpen,
458
+ close: () => setIsOpen(false),
459
+ toggleOpen: () => setIsOpen((prevState) => !prevState),
460
+ disabled
461
+ };
462
+ const menuPosition = usePopoverPosition(
463
+ triggerRef.current?.getBoundingClientRect(),
464
+ { verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
465
+ );
466
+ (0, import_react6.useEffect)(() => {
467
+ if (!isOpen) return;
468
+ const triggerEl = triggerRef.current;
469
+ if (!triggerEl) return;
470
+ const scrollableParents = getScrollableParents(triggerEl);
471
+ const close = () => setIsOpen(false);
472
+ scrollableParents.forEach((parent) => {
473
+ parent.addEventListener("scroll", close);
474
+ });
475
+ window.addEventListener("resize", close);
476
+ return () => {
477
+ scrollableParents.forEach((parent) => {
478
+ parent.removeEventListener("scroll", close);
479
+ });
480
+ window.removeEventListener("resize", close);
481
+ };
482
+ }, [isOpen, setIsOpen]);
483
+ (0, import_react6.useEffect)(() => {
484
+ if (isOpen) {
485
+ setIsHidden(false);
486
+ }
487
+ }, [isOpen]);
488
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
489
+ trigger(bag, triggerRef),
490
+ (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
491
+ "div",
492
+ {
493
+ ref: menuRef,
494
+ onClick: (e) => e.stopPropagation(),
495
+ className: (0, import_clsx4.default)(
496
+ "absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
497
+ {
498
+ "animate-pop-in": isOpen,
499
+ "animate-pop-out": !isOpen,
500
+ "hidden": isHidden
501
+ },
502
+ menuClassName
503
+ ),
504
+ onAnimationEnd: () => {
505
+ if (!isOpen) {
506
+ setIsHidden(true);
507
+ }
508
+ },
509
+ style: {
510
+ ...menuPosition
511
+ },
512
+ children: BagFunctionUtil.resolve(children, bag)
513
+ }
514
+ ), document.body)
515
+ ] });
516
+ };
517
+
151
518
  // src/components/user-action/Input.tsx
152
- var import_react6 = require("react");
153
- var import_clsx2 = __toESM(require("clsx"));
519
+ var import_react10 = require("react");
520
+ var import_clsx5 = __toESM(require("clsx"));
154
521
 
155
522
  // src/hooks/useDelay.ts
156
- var import_react3 = require("react");
523
+ var import_react7 = require("react");
157
524
  var defaultOptions = {
158
525
  delay: 3e3,
159
526
  disabled: false
160
527
  };
161
528
  function useDelay(options) {
162
- const [timer, setTimer] = (0, import_react3.useState)(void 0);
529
+ const [timer, setTimer] = (0, import_react7.useState)(void 0);
163
530
  const { delay, disabled } = {
164
531
  ...defaultOptions,
165
532
  ...options
@@ -178,28 +545,24 @@ function useDelay(options) {
178
545
  setTimer(void 0);
179
546
  }, delay));
180
547
  };
181
- (0, import_react3.useEffect)(() => {
548
+ (0, import_react7.useEffect)(() => {
182
549
  return () => {
183
550
  clearTimeout(timer);
184
551
  };
185
552
  }, [timer]);
186
- (0, import_react3.useEffect)(() => {
553
+ (0, import_react7.useEffect)(() => {
187
554
  if (disabled) {
188
555
  clearTimeout(timer);
189
556
  setTimer(void 0);
190
557
  }
191
558
  }, [disabled, timer]);
192
- console.log(timer);
193
559
  return { restartTimer, clearTimer, hasActiveTimer: !!timer };
194
560
  }
195
561
 
196
- // src/util/noop.ts
197
- var noop = () => void 0;
198
-
199
562
  // src/hooks/useFocusManagement.ts
200
- var import_react4 = require("react");
563
+ var import_react8 = require("react");
201
564
  function useFocusManagement() {
202
- const getFocusableElements = (0, import_react4.useCallback)(() => {
565
+ const getFocusableElements = (0, import_react8.useCallback)(() => {
203
566
  return Array.from(
204
567
  document.querySelectorAll(
205
568
  'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
@@ -208,7 +571,7 @@ function useFocusManagement() {
208
571
  (el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
209
572
  );
210
573
  }, []);
211
- const getNextFocusElement = (0, import_react4.useCallback)(() => {
574
+ const getNextFocusElement = (0, import_react8.useCallback)(() => {
212
575
  const elements = getFocusableElements();
213
576
  if (elements.length === 0) {
214
577
  return void 0;
@@ -220,11 +583,11 @@ function useFocusManagement() {
220
583
  }
221
584
  return nextElement;
222
585
  }, [getFocusableElements]);
223
- const focusNext = (0, import_react4.useCallback)(() => {
586
+ const focusNext = (0, import_react8.useCallback)(() => {
224
587
  const nextElement = getNextFocusElement();
225
588
  nextElement?.focus();
226
589
  }, [getNextFocusElement]);
227
- const getPreviousFocusElement = (0, import_react4.useCallback)(() => {
590
+ const getPreviousFocusElement = (0, import_react8.useCallback)(() => {
228
591
  const elements = getFocusableElements();
229
592
  if (elements.length === 0) {
230
593
  return void 0;
@@ -240,7 +603,7 @@ function useFocusManagement() {
240
603
  }
241
604
  return previousElement;
242
605
  }, [getFocusableElements]);
243
- const focusPrevious = (0, import_react4.useCallback)(() => {
606
+ const focusPrevious = (0, import_react8.useCallback)(() => {
244
607
  const previousElement = getPreviousFocusElement();
245
608
  if (previousElement) previousElement.focus();
246
609
  }, [getPreviousFocusElement]);
@@ -254,10 +617,10 @@ function useFocusManagement() {
254
617
  }
255
618
 
256
619
  // src/hooks/useFocusOnceVisible.ts
257
- var import_react5 = __toESM(require("react"));
620
+ var import_react9 = __toESM(require("react"));
258
621
  var useFocusOnceVisible = (ref, disable = false) => {
259
- const [hasUsedFocus, setHasUsedFocus] = import_react5.default.useState(false);
260
- (0, import_react5.useEffect)(() => {
622
+ const [hasUsedFocus, setHasUsedFocus] = import_react9.default.useState(false);
623
+ (0, import_react9.useEffect)(() => {
261
624
  if (disable || hasUsedFocus) {
262
625
  return;
263
626
  }
@@ -277,9 +640,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
277
640
  };
278
641
 
279
642
  // src/components/user-action/Input.tsx
280
- var import_jsx_runtime3 = require("react/jsx-runtime");
643
+ var import_jsx_runtime6 = require("react/jsx-runtime");
281
644
  var getInputClassName = ({ disabled = false, hasError = false }) => {
282
- return (0, import_clsx2.default)(
645
+ return (0, import_clsx5.default)(
283
646
  "px-2 py-1.5 rounded-md border-2",
284
647
  {
285
648
  "bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
@@ -293,7 +656,7 @@ var defaultEditCompleteOptions = {
293
656
  afterDelay: true,
294
657
  delay: 2500
295
658
  };
296
- var Input = (0, import_react6.forwardRef)(function Input2({
659
+ var Input = (0, import_react10.forwardRef)(function Input2({
297
660
  id,
298
661
  type = "text",
299
662
  value,
@@ -316,10 +679,10 @@ var Input = (0, import_react6.forwardRef)(function Input2({
316
679
  restartTimer,
317
680
  clearTimer
318
681
  } = useDelay({ delay, disabled: !afterDelay });
319
- const innerRef = (0, import_react6.useRef)(null);
682
+ const innerRef = (0, import_react10.useRef)(null);
320
683
  const { focusNext } = useFocusManagement();
321
684
  useFocusOnceVisible(innerRef, !autoFocus);
322
- (0, import_react6.useImperativeHandle)(forwardedRef, () => innerRef.current);
685
+ (0, import_react10.useImperativeHandle)(forwardedRef, () => innerRef.current);
323
686
  const handleKeyDown = (e) => {
324
687
  if (e.key === "Enter" && !e.shiftKey) {
325
688
  e.preventDefault();
@@ -327,9 +690,9 @@ var Input = (0, import_react6.forwardRef)(function Input2({
327
690
  focusNext();
328
691
  }
329
692
  };
330
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx2.default)({ "w-full": expanded }, containerClassName), children: [
331
- label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx2.default)("mb-1", label.className) }),
332
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
693
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_clsx5.default)({ "w-full": expanded }, containerClassName), children: [
694
+ label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx5.default)("mb-1", label.className) }),
695
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
333
696
  "input",
334
697
  {
335
698
  ...restProps,
@@ -338,7 +701,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
338
701
  id,
339
702
  type,
340
703
  disabled,
341
- className: (0, import_clsx2.default)(getInputClassName({ disabled }), className),
704
+ className: (0, import_clsx5.default)(getInputClassName({ disabled }), className),
342
705
  onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
343
706
  onBlur: (event) => {
344
707
  onBlur?.(event);
@@ -368,7 +731,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
368
731
  )
369
732
  ] });
370
733
  });
371
- var FormInput = (0, import_react6.forwardRef)(function FormInput2({
734
+ var FormInput = (0, import_react10.forwardRef)(function FormInput2({
372
735
  id,
373
736
  labelText,
374
737
  errorText,
@@ -380,206 +743,33 @@ var FormInput = (0, import_react6.forwardRef)(function FormInput2({
380
743
  disabled,
381
744
  ...restProps
382
745
  }, ref) {
383
- const input = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
746
+ const input = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
384
747
  "input",
385
748
  {
386
749
  ...restProps,
387
750
  ref,
388
751
  id,
389
752
  disabled,
390
- className: (0, import_clsx2.default)(
753
+ className: (0, import_clsx5.default)(
391
754
  getInputClassName({ disabled, hasError: !!errorText }),
392
755
  className
393
756
  )
394
757
  }
395
758
  );
396
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx2.default)("flex flex-col gap-y-1", containerClassName), children: [
397
- labelText && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { htmlFor: id, className: (0, import_clsx2.default)("textstyle-label-md", labelClassName), children: [
759
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_clsx5.default)("flex flex-col gap-y-1", containerClassName), children: [
760
+ labelText && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { htmlFor: id, className: (0, import_clsx5.default)("textstyle-label-md", labelClassName), children: [
398
761
  labelText,
399
- required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-primary font-bold", children: "*" })
762
+ required && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-primary font-bold", children: "*" })
400
763
  ] }),
401
764
  input,
402
- errorText && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { htmlFor: id, className: (0, import_clsx2.default)("text-negative", errorClassName), children: errorText })
765
+ errorText && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("label", { htmlFor: id, className: (0, import_clsx5.default)("text-negative", errorClassName), children: errorText })
403
766
  ] });
404
767
  });
405
768
 
406
- // src/components/user-action/Button.tsx
407
- var import_clsx3 = __toESM(require("clsx"));
408
- var import_jsx_runtime4 = require("react/jsx-runtime");
409
- var ButtonColorUtil = {
410
- solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
411
- text: ["primary", "negative", "neutral"],
412
- outline: ["primary"]
413
- };
414
- var IconButtonUtil = {
415
- icon: [...ButtonColorUtil.solid, "transparent"]
416
- };
417
- var paddingMapping = {
418
- small: "btn-sm",
419
- medium: "btn-md",
420
- large: "btn-lg"
421
- };
422
- var iconPaddingMapping = {
423
- tiny: "icon-btn-xs",
424
- small: "icon-btn-sm",
425
- medium: "icon-btn-md",
426
- large: "icon-btn-lg"
427
- };
428
- var ButtonUtil = {
429
- paddingMapping,
430
- iconPaddingMapping
431
- };
432
- var SolidButton = ({
433
- children,
434
- disabled = false,
435
- color = "primary",
436
- size = "medium",
437
- startIcon,
438
- endIcon,
439
- onClick,
440
- className,
441
- ...restProps
442
- }) => {
443
- const colorClasses = {
444
- primary: "bg-button-solid-primary-background text-button-solid-primary-text",
445
- secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
446
- tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
447
- positive: "bg-button-solid-positive-background text-button-solid-positive-text",
448
- warning: "bg-button-solid-warning-background text-button-solid-warning-text",
449
- negative: "bg-button-solid-negative-background text-button-solid-negative-text",
450
- neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
451
- }[color];
452
- const iconColorClasses = {
453
- primary: "text-button-solid-primary-icon",
454
- secondary: "text-button-solid-secondary-icon",
455
- tertiary: "text-button-solid-tertiary-icon",
456
- positive: "text-button-solid-positive-icon",
457
- warning: "text-button-solid-warning-icon",
458
- negative: "text-button-solid-negative-icon",
459
- neutral: "text-button-solid-neutral-icon"
460
- }[color];
461
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
462
- "button",
463
- {
464
- onClick: disabled ? void 0 : onClick,
465
- disabled: disabled || onClick === void 0,
466
- className: (0, import_clsx3.default)(
467
- {
468
- "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
469
- [(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
470
- },
471
- ButtonUtil.paddingMapping[size],
472
- className
473
- ),
474
- ...restProps,
475
- children: [
476
- startIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
477
- "span",
478
- {
479
- className: (0, import_clsx3.default)({
480
- [iconColorClasses]: !disabled,
481
- [`text-disabled-icon`]: disabled
482
- }),
483
- children: startIcon
484
- }
485
- ),
486
- children,
487
- endIcon && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
488
- "span",
489
- {
490
- className: (0, import_clsx3.default)({
491
- [iconColorClasses]: !disabled,
492
- [`text-disabled-icon`]: disabled
493
- }),
494
- children: endIcon
495
- }
496
- )
497
- ]
498
- }
499
- );
500
- };
501
- var IconButton = ({
502
- children,
503
- disabled = false,
504
- color = "primary",
505
- size = "medium",
506
- onClick,
507
- className,
508
- ...restProps
509
- }) => {
510
- const colorClasses = {
511
- primary: "bg-button-solid-primary-background text-button-solid-primary-text",
512
- secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
513
- tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
514
- positive: "bg-button-solid-positive-background text-button-solid-positive-text",
515
- warning: "bg-button-solid-warning-background text-button-solid-warning-text",
516
- negative: "bg-button-solid-negative-background text-button-solid-negative-text",
517
- neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
518
- transparent: "bg-transparent"
519
- }[color];
520
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
521
- "button",
522
- {
523
- onClick: disabled ? void 0 : onClick,
524
- disabled: disabled || onClick === void 0,
525
- className: (0, import_clsx3.default)(
526
- {
527
- "text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
528
- "text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
529
- "hover:bg-button-text-hover-background": !disabled && color === "transparent",
530
- [(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
531
- },
532
- ButtonUtil.iconPaddingMapping[size],
533
- className
534
- ),
535
- ...restProps,
536
- children
537
- }
538
- );
539
- };
540
-
541
- // src/hooks/useSearch.ts
542
- var import_react7 = require("react");
543
-
544
- // src/util/simpleSearch.ts
545
- var MultiSearchWithMapping = (search, objects, mapping) => {
546
- return objects.filter((object) => {
547
- const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
548
- if (!mappedSearchKeywords) {
549
- return true;
550
- }
551
- return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
552
- });
553
- };
554
-
555
- // src/hooks/useSearch.ts
556
- var useSearch = ({
557
- list,
558
- initialSearch,
559
- searchMapping
560
- }) => {
561
- const [items, setItems] = (0, import_react7.useState)(list);
562
- const [search, setSearch] = (0, import_react7.useState)(initialSearch);
563
- (0, import_react7.useEffect)(() => {
564
- setItems(list);
565
- }, [list]);
566
- const result = (0, import_react7.useMemo)(
567
- () => MultiSearchWithMapping(search, items, searchMapping),
568
- [search, items, searchMapping]
569
- );
570
- return {
571
- result,
572
- hasResult: result.length > 0,
573
- allItems: items,
574
- setItems,
575
- search,
576
- setSearch
577
- };
578
- };
579
-
580
769
  // src/localization/defaults/form.ts
581
770
  var formTranslation = {
582
771
  en: {
772
+ add: "Add",
583
773
  all: "All",
584
774
  apply: "Apply",
585
775
  back: "Back",
@@ -592,6 +782,7 @@ var formTranslation = {
592
782
  confirm: "Confirm",
593
783
  copy: "Copy",
594
784
  copied: "Copied",
785
+ create: "Create",
595
786
  decline: "Decline",
596
787
  delete: "Delete",
597
788
  discard: "Discard",
@@ -634,6 +825,7 @@ var formTranslation = {
634
825
  yes: "Yes"
635
826
  },
636
827
  de: {
828
+ add: "Hinzuf\xFCgen",
637
829
  all: "Alle",
638
830
  apply: "Anwenden",
639
831
  back: "Zur\xFCck",
@@ -646,6 +838,7 @@ var formTranslation = {
646
838
  confirm: "Best\xE4tigen",
647
839
  copy: "Kopieren",
648
840
  copied: "Kopiert",
841
+ create: "Erstellen",
649
842
  decline: "Ablehnen",
650
843
  delete: "L\xF6schen",
651
844
  discard: "Verwerfen",
@@ -689,92 +882,255 @@ var formTranslation = {
689
882
  }
690
883
  };
691
884
 
692
- // src/components/layout-and-navigation/SearchableList.tsx
693
- var import_jsx_runtime5 = require("react/jsx-runtime");
694
- var defaultSearchableListTranslation = {
695
- en: {
696
- nothingFound: "Nothing found"
697
- },
698
- de: {
699
- nothingFound: "Nichts gefunden"
700
- }
885
+ // src/components/user-action/Button.tsx
886
+ var import_react11 = require("react");
887
+ var import_clsx6 = __toESM(require("clsx"));
888
+ var import_jsx_runtime7 = require("react/jsx-runtime");
889
+ var ButtonColorUtil = {
890
+ solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
891
+ text: ["primary", "negative", "neutral"],
892
+ outline: ["primary"]
701
893
  };
702
- var SearchableList = ({
703
- overwriteTranslation,
704
- list,
705
- initialSearch = "",
706
- searchMapping,
707
- autoFocus,
708
- minimumItemsForSearch = 6,
709
- itemMapper,
894
+ var IconButtonUtil = {
895
+ icon: [...ButtonColorUtil.solid, "transparent"]
896
+ };
897
+ var paddingMapping = {
898
+ small: "btn-sm",
899
+ medium: "btn-md",
900
+ large: "btn-lg"
901
+ };
902
+ var iconPaddingMapping = {
903
+ tiny: "icon-btn-xs",
904
+ small: "icon-btn-sm",
905
+ medium: "icon-btn-md",
906
+ large: "icon-btn-lg"
907
+ };
908
+ var ButtonUtil = {
909
+ paddingMapping,
910
+ iconPaddingMapping
911
+ };
912
+ var SolidButton = (0, import_react11.forwardRef)(function SolidButton2({
913
+ children,
914
+ disabled = false,
915
+ color = "primary",
916
+ size = "medium",
917
+ startIcon,
918
+ endIcon,
919
+ onClick,
710
920
  className,
711
- resultListClassName
921
+ ...restProps
922
+ }, ref) {
923
+ const colorClasses = {
924
+ primary: "bg-button-solid-primary-background text-button-solid-primary-text",
925
+ secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
926
+ tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
927
+ positive: "bg-button-solid-positive-background text-button-solid-positive-text",
928
+ warning: "bg-button-solid-warning-background text-button-solid-warning-text",
929
+ negative: "bg-button-solid-negative-background text-button-solid-negative-text",
930
+ neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
931
+ }[color];
932
+ const iconColorClasses = {
933
+ primary: "text-button-solid-primary-icon",
934
+ secondary: "text-button-solid-secondary-icon",
935
+ tertiary: "text-button-solid-tertiary-icon",
936
+ positive: "text-button-solid-positive-icon",
937
+ warning: "text-button-solid-warning-icon",
938
+ negative: "text-button-solid-negative-icon",
939
+ neutral: "text-button-solid-neutral-icon"
940
+ }[color];
941
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
942
+ "button",
943
+ {
944
+ ref,
945
+ onClick,
946
+ disabled,
947
+ className: (0, import_clsx6.default)(
948
+ {
949
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
950
+ [(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
951
+ },
952
+ ButtonUtil.paddingMapping[size],
953
+ className
954
+ ),
955
+ ...restProps,
956
+ children: [
957
+ startIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
958
+ "span",
959
+ {
960
+ className: (0, import_clsx6.default)({
961
+ [iconColorClasses]: !disabled,
962
+ [`text-disabled-icon`]: disabled
963
+ }),
964
+ children: startIcon
965
+ }
966
+ ),
967
+ children,
968
+ endIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
969
+ "span",
970
+ {
971
+ className: (0, import_clsx6.default)({
972
+ [iconColorClasses]: !disabled,
973
+ [`text-disabled-icon`]: disabled
974
+ }),
975
+ children: endIcon
976
+ }
977
+ )
978
+ ]
979
+ }
980
+ );
981
+ });
982
+ var IconButton = ({
983
+ children,
984
+ disabled = false,
985
+ color = "primary",
986
+ size = "medium",
987
+ className,
988
+ ...restProps
712
989
  }) => {
713
- const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
714
- const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
715
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx4.default)("col gap-y-2", className), children: [
716
- list.length > minimumItemsForSearch && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "row justify-between gap-x-4 items-center", children: [
717
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
718
- Input,
990
+ const colorClasses = {
991
+ primary: "bg-button-solid-primary-background text-button-solid-primary-text",
992
+ secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
993
+ tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
994
+ positive: "bg-button-solid-positive-background text-button-solid-positive-text",
995
+ warning: "bg-button-solid-warning-background text-button-solid-warning-text",
996
+ negative: "bg-button-solid-negative-background text-button-solid-negative-text",
997
+ neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
998
+ transparent: "bg-transparent"
999
+ }[color];
1000
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1001
+ "button",
1002
+ {
1003
+ disabled,
1004
+ className: (0, import_clsx6.default)(
719
1005
  {
720
- value: search,
721
- onChangeText: setSearch,
722
- placeholder: translation("search"),
723
- autoFocus,
724
- className: "w-full"
725
- }
1006
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
1007
+ "text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
1008
+ "hover:bg-button-text-hover-background": !disabled && color === "transparent",
1009
+ [(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
1010
+ },
1011
+ ButtonUtil.iconPaddingMapping[size],
1012
+ className
726
1013
  ),
727
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react.Search, { className: "w-full h-full" }) })
728
- ] }),
729
- hasResult ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: (0, import_clsx4.default)("col gap-y-1", resultListClassName), children: result.map(itemMapper) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "row text-description py-2 px-2", children: translation("nothingFound") })
1014
+ ...restProps,
1015
+ children
1016
+ }
1017
+ );
1018
+ };
1019
+
1020
+ // src/components/user-action/SearchBar.tsx
1021
+ var import_lucide_react3 = require("lucide-react");
1022
+ var import_clsx7 = require("clsx");
1023
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1024
+ var SearchBar = ({
1025
+ placeholder,
1026
+ onSearch,
1027
+ disableOnSearch,
1028
+ containerClassName,
1029
+ ...inputProps
1030
+ }) => {
1031
+ const translation = useTranslation([formTranslation]);
1032
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_clsx7.clsx)("flex-row-2 justify-between items-center", containerClassName), children: [
1033
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1034
+ Input,
1035
+ {
1036
+ ...inputProps,
1037
+ placeholder: placeholder ?? translation("search")
1038
+ }
1039
+ ),
1040
+ onSearch && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.Search, { className: "w-full h-full" }) })
730
1041
  ] });
731
1042
  };
732
1043
 
733
- // src/components/layout-and-navigation/Tile.tsx
734
- var import_clsx5 = __toESM(require("clsx"));
735
- var import_lucide_react2 = require("lucide-react");
736
- var import_jsx_runtime6 = require("react/jsx-runtime");
737
- var Tile = ({
1044
+ // src/hooks/useSearch.ts
1045
+ var import_react12 = require("react");
1046
+
1047
+ // src/util/simpleSearch.ts
1048
+ var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
1049
+ return objects.filter((object) => {
1050
+ const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
1051
+ if (!mappedSearchKeywords) {
1052
+ return true;
1053
+ }
1054
+ return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
1055
+ });
1056
+ };
1057
+
1058
+ // src/hooks/useSearch.ts
1059
+ var useSearch = ({
1060
+ list,
1061
+ initialSearch,
1062
+ searchMapping,
1063
+ additionalSearchTags,
1064
+ isSearchInstant = true,
1065
+ sortingFunction,
1066
+ filter,
1067
+ disabled = false
1068
+ }) => {
1069
+ const [search, setSearch] = (0, import_react12.useState)(initialSearch ?? "");
1070
+ const [result, setResult] = (0, import_react12.useState)(list);
1071
+ const searchTags = (0, import_react12.useMemo)(() => additionalSearchTags ?? [], [additionalSearchTags]);
1072
+ const updateSearch = (0, import_react12.useCallback)((newSearch) => {
1073
+ const usedSearch = newSearch ?? search;
1074
+ if (newSearch) {
1075
+ setSearch(search);
1076
+ }
1077
+ setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
1078
+ }, [searchTags, list, search, searchMapping]);
1079
+ (0, import_react12.useEffect)(() => {
1080
+ if (isSearchInstant) {
1081
+ setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
1082
+ }
1083
+ }, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
1084
+ const filteredResult = (0, import_react12.useMemo)(() => {
1085
+ if (!filter) {
1086
+ return result;
1087
+ }
1088
+ return result.filter(filter);
1089
+ }, [result, filter]);
1090
+ const sortedAndFilteredResult = (0, import_react12.useMemo)(() => {
1091
+ if (!sortingFunction) {
1092
+ return filteredResult;
1093
+ }
1094
+ return filteredResult.sort(sortingFunction);
1095
+ }, [filteredResult, sortingFunction]);
1096
+ const usedResult = (0, import_react12.useMemo)(() => {
1097
+ if (!disabled) {
1098
+ return sortedAndFilteredResult;
1099
+ }
1100
+ return list;
1101
+ }, [disabled, list, sortedAndFilteredResult]);
1102
+ return {
1103
+ result: usedResult,
1104
+ hasResult: usedResult.length > 0,
1105
+ allItems: list,
1106
+ updateSearch,
1107
+ search,
1108
+ setSearch
1109
+ };
1110
+ };
1111
+
1112
+ // src/components/user-action/Select.tsx
1113
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1114
+ var SelectTile = ({
1115
+ className,
1116
+ disabledClassName,
738
1117
  title,
739
- description,
740
- onClick,
741
- isSelected = false,
742
- isDisabled = false,
743
- prefix,
744
- suffix,
745
- normalClassName = "hover:bg-primary/40 cursor-pointer",
746
- selectedClassName = " bg-primary/20",
747
- disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
748
- className
1118
+ ...restProps
749
1119
  }) => {
750
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
751
- "div",
1120
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1121
+ Tile,
752
1122
  {
753
- className: (0, import_clsx5.default)(
754
- "row gap-x-2 w-full items-center",
755
- {
756
- [normalClassName]: !!onClick && !isDisabled,
757
- [selectedClassName]: isSelected && !isDisabled,
758
- [disabledClassName]: isDisabled
759
- },
760
- className
761
- ),
762
- onClick: isDisabled ? void 0 : onClick,
763
- children: [
764
- prefix,
765
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "col gap-y-0 w-full", children: [
766
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { className: (0, import_clsx5.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
767
- !!description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: (0, import_clsx5.default)(description.className ?? "textstyle-description"), children: description.value })
768
- ] }),
769
- suffix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Check, { size: 24 }) : void 0)
770
- ]
1123
+ ...restProps,
1124
+ className: (0, import_clsx8.default)("px-2 py-1 rounded-md", className),
1125
+ disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
1126
+ title: { ...title, className: title.className ?? "font-semibold" }
771
1127
  }
772
1128
  );
773
1129
  };
774
1130
 
775
1131
  // src/components/layout-and-navigation/Chip.tsx
776
- var import_clsx6 = __toESM(require("clsx"));
777
- var import_jsx_runtime7 = require("react/jsx-runtime");
1132
+ var import_clsx9 = __toESM(require("clsx"));
1133
+ var import_jsx_runtime10 = require("react/jsx-runtime");
778
1134
  var Chip = ({
779
1135
  children,
780
1136
  trailingIcon,
@@ -801,11 +1157,11 @@ var Chip = ({
801
1157
  blue: "text-tag-blue-icon",
802
1158
  pink: "text-tag-pink-icon"
803
1159
  }[color];
804
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1160
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
805
1161
  "div",
806
1162
  {
807
1163
  ...restProps,
808
- className: (0, import_clsx6.default)(
1164
+ className: (0, import_clsx9.default)(
809
1165
  `row w-fit px-2 py-1`,
810
1166
  colorMapping,
811
1167
  {
@@ -816,7 +1172,7 @@ var Chip = ({
816
1172
  ),
817
1173
  children: [
818
1174
  children,
819
- trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: colorMappingIcon, children: trailingIcon })
1175
+ trailingIcon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: colorMappingIcon, children: trailingIcon })
820
1176
  ]
821
1177
  }
822
1178
  );
@@ -825,7 +1181,7 @@ var ChipList = ({
825
1181
  list,
826
1182
  className = ""
827
1183
  }) => {
828
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: (0, import_clsx6.default)("flex flex-wrap gap-x-4 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1184
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: (0, import_clsx9.default)("flex flex-wrap gap-x-2 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
829
1185
  Chip,
830
1186
  {
831
1187
  ...value,
@@ -837,28 +1193,74 @@ var ChipList = ({
837
1193
  )) });
838
1194
  };
839
1195
 
840
- // src/hooks/useOutsideClick.ts
841
- var import_react8 = require("react");
842
- var useOutsideClick = (refs, handler) => {
843
- (0, import_react8.useEffect)(() => {
844
- const listener = (event) => {
845
- if (event.target === null) return;
846
- if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
847
- return;
1196
+ // src/components/user-action/Checkbox.tsx
1197
+ var import_react15 = require("react");
1198
+ var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
1199
+ var import_lucide_react4 = require("lucide-react");
1200
+ var import_clsx10 = __toESM(require("clsx"));
1201
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1202
+ var checkboxSizeMapping = {
1203
+ small: "size-5",
1204
+ medium: "size-6",
1205
+ large: "size-8"
1206
+ };
1207
+ var checkboxIconSizeMapping = {
1208
+ small: "size-4",
1209
+ medium: "size-5",
1210
+ large: "size-7"
1211
+ };
1212
+ var Checkbox = ({
1213
+ id,
1214
+ label,
1215
+ checked,
1216
+ disabled,
1217
+ onChange,
1218
+ onChangeTristate,
1219
+ size = "medium",
1220
+ className = "",
1221
+ containerClassName
1222
+ }) => {
1223
+ const usedSizeClass = checkboxSizeMapping[size];
1224
+ const innerIconSize = checkboxIconSizeMapping[size];
1225
+ const propagateChange = (checked2) => {
1226
+ if (onChangeTristate) {
1227
+ onChangeTristate(checked2);
1228
+ }
1229
+ if (onChange) {
1230
+ onChange(checked2 === "indeterminate" ? false : checked2);
1231
+ }
1232
+ };
1233
+ const changeValue = () => {
1234
+ const newValue = checked === "indeterminate" ? false : !checked;
1235
+ propagateChange(newValue);
1236
+ };
1237
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: (0, import_clsx10.default)("group flex-row-2 items-center cursor-pointer", containerClassName), onClick: changeValue, children: [
1238
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1239
+ CheckboxPrimitive.Root,
1240
+ {
1241
+ onCheckedChange: propagateChange,
1242
+ checked,
1243
+ disabled,
1244
+ id,
1245
+ className: (0, import_clsx10.default)(usedSizeClass, `items-center border-2 rounded outline-none `, {
1246
+ "text-disabled-text border-disabled-outline bg-disabled-background cursor-not-allowed": disabled,
1247
+ "focus:border-primary group-hover:border-primary ": !disabled,
1248
+ "bg-surface": !disabled && !checked,
1249
+ "bg-primary/30 border-primary text-primary": !disabled && checked === true || checked === "indeterminate"
1250
+ }, className),
1251
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(CheckboxPrimitive.Indicator, { children: [
1252
+ checked === true && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.Check, { className: innerIconSize }),
1253
+ checked === "indeterminate" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.Minus, { className: innerIconSize })
1254
+ ] })
848
1255
  }
849
- handler();
850
- };
851
- document.addEventListener("mousedown", listener);
852
- document.addEventListener("touchstart", listener);
853
- return () => {
854
- document.removeEventListener("mousedown", listener);
855
- document.removeEventListener("touchstart", listener);
856
- };
857
- }, [refs, handler]);
1256
+ ),
1257
+ label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Label, { ...label, className: (0, import_clsx10.default)(label.className), htmlFor: id })
1258
+ ] });
858
1259
  };
859
1260
 
860
1261
  // src/components/user-action/MultiSelect.tsx
861
- var import_jsx_runtime8 = require("react/jsx-runtime");
1262
+ var import_lucide_react5 = require("lucide-react");
1263
+ var import_jsx_runtime12 = require("react/jsx-runtime");
862
1264
  var defaultMultiSelectTranslation = {
863
1265
  en: {
864
1266
  selected: `{{amount}} selected`
@@ -869,89 +1271,107 @@ var defaultMultiSelectTranslation = {
869
1271
  };
870
1272
  var MultiSelect = ({
871
1273
  overwriteTranslation,
872
- options,
873
1274
  label,
1275
+ options,
874
1276
  onChange,
875
1277
  hintText,
876
- isDisabled = false,
877
- isSearchEnabled = false,
878
1278
  selectedDisplayOverwrite,
1279
+ searchOptions,
1280
+ additionalItems,
879
1281
  useChipDisplay = false,
880
- className = ""
1282
+ className,
1283
+ triggerClassName,
1284
+ hintTextClassName,
1285
+ ...menuProps
881
1286
  }) => {
882
1287
  const translation = useTranslation([formTranslation, defaultMultiSelectTranslation], overwriteTranslation);
883
- const triggerRef = (0, import_react9.useRef)(null);
884
- const menuRef = (0, import_react9.useRef)(null);
885
- const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
886
- useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
1288
+ const { result, search, setSearch } = useSearch({
1289
+ list: options,
1290
+ searchMapping: (0, import_react16.useCallback)((item) => item.searchTags, []),
1291
+ ...searchOptions
1292
+ });
887
1293
  const selectedItems = options.filter((value) => value.selected);
888
1294
  const isShowingHint = !selectedDisplayOverwrite && selectedItems.length === 0;
889
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_clsx7.default)(className), children: [
890
- label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1295
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_clsx11.default)(className), children: [
1296
+ label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
891
1297
  Label,
892
1298
  {
893
1299
  ...label,
894
1300
  htmlFor: label.name,
895
- className: (0, import_clsx7.default)(" mb-1", label.className),
1301
+ className: (0, import_clsx11.default)(" mb-1", label.className),
896
1302
  labelType: label.labelType ?? "labelBig"
897
1303
  }
898
1304
  ),
899
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative", children: [
900
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
901
- "button",
902
- {
903
- ref: triggerRef,
904
- className: (0, import_clsx7.default)(
905
- "btn-md justify-between w-full border-2 h-auto",
906
- {
907
- "rounded-b-lg": !open,
908
- "bg-menu-background border-menu-border hover:border-primary": !isDisabled,
909
- "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
910
- }
911
- ),
912
- onClick: () => setIsOpen(!isOpen),
913
- disabled: isDisabled,
914
- children: [
915
- !isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? (useChipDisplay && selectedItems ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ChipList, { list: selectedItems.map((value) => ({ children: value.label })) }) : translation("selected", { replacements: { amount: selectedItems.length.toString() } })) }),
916
- isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "textstyle-description", children: hintText ?? translation("select") }),
917
- isOpen ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ChevronUp, { size: 24, className: "min-w-6" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react3.ChevronDown, { className: "min-w-6" })
918
- ]
919
- }
920
- ),
921
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
922
- "div",
923
- {
924
- ref: menuRef,
925
- 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",
926
- children: [
927
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
928
- SearchableList,
1305
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1306
+ Menu,
1307
+ {
1308
+ ...menuProps,
1309
+ trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1310
+ "button",
1311
+ {
1312
+ ref,
1313
+ className: (0, import_clsx11.default)(
1314
+ "btn-md justify-between w-full border-2 h-auto",
929
1315
  {
930
- list: options,
931
- minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
932
- searchMapping: (item) => item.searchTags,
933
- itemMapper: (option, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
934
- Tile,
1316
+ "min-h-14": useChipDisplay,
1317
+ "bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
1318
+ "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
1319
+ },
1320
+ triggerClassName
1321
+ ),
1322
+ onClick: toggleOpen,
1323
+ disabled,
1324
+ children: useChipDisplay ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: isShowingHint ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(IconButton, { disabled, size: "small", color: "neutral", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Plus, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChipList, { list: selectedItems.map((value) => ({ children: value.label })) }) }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1325
+ !isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? translation("selected", { replacements: { amount: selectedItems.length.toString() } }) }),
1326
+ isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: (0, import_clsx11.default)("textstyle-description", hintTextClassName), children: hintText ?? translation("select") }),
1327
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ExpansionIcon, { isExpanded: isOpen })
1328
+ ] })
1329
+ }
1330
+ ),
1331
+ menuClassName: (0, import_clsx11.default)("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
1332
+ children: (bag) => {
1333
+ const { close } = bag;
1334
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
1335
+ !searchOptions?.disabled && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1336
+ SearchBar,
1337
+ {
1338
+ value: search,
1339
+ onChangeText: setSearch,
1340
+ autoFocus: true
1341
+ }
1342
+ ),
1343
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex-col-2 overflow-y-auto", children: [
1344
+ result.map((option, index) => {
1345
+ const update = () => {
1346
+ onChange(options.map((value) => value.value === option.value ? {
1347
+ ...option,
1348
+ selected: !value.selected
1349
+ } : value));
1350
+ };
1351
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1352
+ SelectTile,
935
1353
  {
936
- isSelected: option.selected,
937
- className: "px-2 py-1 rounded-md",
938
- disabledClassName: "text-disabled-text cursor-not-allowed",
939
- title: { value: option.label, className: "font-semibold" },
940
- onClick: () => {
941
- onChange(options.map((value) => value.value === option.value ? {
942
- ...option,
943
- selected: !value.selected
944
- } : value));
945
- },
946
- isDisabled: option.disabled
1354
+ prefix: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1355
+ Checkbox,
1356
+ {
1357
+ checked: option.selected,
1358
+ onChange: update,
1359
+ size: "small",
1360
+ disabled: option.disabled
1361
+ }
1362
+ ),
1363
+ title: { value: option.label },
1364
+ onClick: update,
1365
+ disabled: option.disabled
947
1366
  },
948
1367
  index
949
- )
950
- }
951
- ),
952
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "row justify-between mt-2", children: [
953
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "row gap-x-2", children: [
954
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1368
+ );
1369
+ }),
1370
+ additionalItems && additionalItems({ ...bag, search })
1371
+ ] }),
1372
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex-row-2 justify-between", children: [
1373
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex-row-2", children: [
1374
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
955
1375
  SolidButton,
956
1376
  {
957
1377
  color: "neutral",
@@ -966,7 +1386,7 @@ var MultiSelect = ({
966
1386
  children: translation("all")
967
1387
  }
968
1388
  ),
969
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1389
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
970
1390
  SolidButton,
971
1391
  {
972
1392
  color: "neutral",
@@ -981,12 +1401,12 @@ var MultiSelect = ({
981
1401
  }
982
1402
  )
983
1403
  ] }),
984
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SolidButton, { size: "small", onClick: () => setIsOpen(false), children: "Done" })
1404
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SolidButton, { size: "small", onClick: close, children: "Done" })
985
1405
  ] })
986
- ]
1406
+ ] });
987
1407
  }
988
- )
989
- ] })
1408
+ }
1409
+ )
990
1410
  ] });
991
1411
  };
992
1412
  var MultiSelectUncontrolled = ({
@@ -994,11 +1414,11 @@ var MultiSelectUncontrolled = ({
994
1414
  onChange,
995
1415
  ...props
996
1416
  }) => {
997
- const [usedOptions, setUsedOptions] = (0, import_react9.useState)(options);
998
- (0, import_react9.useEffect)(() => {
1417
+ const [usedOptions, setUsedOptions] = (0, import_react17.useState)(options);
1418
+ (0, import_react17.useEffect)(() => {
999
1419
  setUsedOptions(options);
1000
1420
  }, [options]);
1001
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1421
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1002
1422
  MultiSelect,
1003
1423
  {
1004
1424
  ...props,