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