@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
@@ -30,12 +30,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var Select_exports = {};
31
31
  __export(Select_exports, {
32
32
  Select: () => Select,
33
+ SelectTile: () => SelectTile,
33
34
  SelectUncontrolled: () => SelectUncontrolled
34
35
  });
35
36
  module.exports = __toCommonJS(Select_exports);
36
- var import_lucide_react3 = require("lucide-react");
37
- var import_react9 = require("react");
38
- var import_clsx6 = __toESM(require("clsx"));
37
+ var import_react13 = require("react");
38
+ var import_react14 = require("react");
39
+ var import_clsx8 = __toESM(require("clsx"));
39
40
 
40
41
  // src/components/user-action/Label.tsx
41
42
  var import_clsx = __toESM(require("clsx"));
@@ -55,109 +56,385 @@ var Label = ({
55
56
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { ...props, className: (0, import_clsx.default)(styleMapping[labelType], className), children: children ? children : name });
56
57
  };
57
58
 
58
- // src/components/layout-and-navigation/SearchableList.tsx
59
+ // src/components/layout-and-navigation/Tile.tsx
60
+ var import_clsx2 = __toESM(require("clsx"));
59
61
  var import_lucide_react = require("lucide-react");
62
+ var import_jsx_runtime2 = require("react/jsx-runtime");
63
+ var Tile = ({
64
+ title,
65
+ description,
66
+ onClick,
67
+ isSelected = false,
68
+ disabled = false,
69
+ prefix,
70
+ suffix,
71
+ normalClassName = "hover:bg-primary/40 cursor-pointer",
72
+ selectedClassName = " bg-primary/20",
73
+ disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
74
+ className
75
+ }) => {
76
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
77
+ "div",
78
+ {
79
+ className: (0, import_clsx2.default)(
80
+ "flex-row-2 w-full items-center",
81
+ {
82
+ [normalClassName]: !!onClick && !disabled,
83
+ [selectedClassName]: isSelected && !disabled,
84
+ [disabledClassName]: disabled
85
+ },
86
+ className
87
+ ),
88
+ onClick: disabled ? void 0 : onClick,
89
+ children: [
90
+ prefix,
91
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex-col-0 w-full", children: [
92
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h4", { className: (0, import_clsx2.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
93
+ !!description && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: (0, import_clsx2.default)(description.className ?? "textstyle-description"), children: description.value })
94
+ ] }),
95
+ suffix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react.Check, { size: 24 }) : void 0)
96
+ ]
97
+ }
98
+ );
99
+ };
100
+
101
+ // src/components/layout-and-navigation/Expandable.tsx
102
+ var import_react = require("react");
103
+ var import_lucide_react2 = require("lucide-react");
104
+ var import_clsx3 = __toESM(require("clsx"));
105
+
106
+ // src/util/noop.ts
107
+ var noop = () => void 0;
108
+
109
+ // src/components/layout-and-navigation/Expandable.tsx
110
+ var import_jsx_runtime3 = require("react/jsx-runtime");
111
+ var ExpansionIcon = ({ isExpanded, className }) => {
112
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
113
+ import_lucide_react2.ChevronDown,
114
+ {
115
+ className: (0, import_clsx3.default)(
116
+ "min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
117
+ { "rotate-180": isExpanded },
118
+ className
119
+ )
120
+ }
121
+ );
122
+ };
123
+ var Expandable = (0, import_react.forwardRef)(function Expandable2({
124
+ children,
125
+ label,
126
+ icon,
127
+ isExpanded = false,
128
+ onChange = noop,
129
+ clickOnlyOnHeader = true,
130
+ disabled = false,
131
+ className,
132
+ headerClassName,
133
+ contentClassName,
134
+ contentExpandedClassName
135
+ }, ref) {
136
+ const defaultIcon = (0, import_react.useCallback)((expanded) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ExpansionIcon, { isExpanded: expanded }), []);
137
+ icon ??= defaultIcon;
138
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
139
+ "div",
140
+ {
141
+ ref,
142
+ className: (0, import_clsx3.default)("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
143
+ onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
144
+ children: [
145
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
146
+ "div",
147
+ {
148
+ className: (0, import_clsx3.default)(
149
+ "flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
150
+ {
151
+ "group-hover:brightness-97": !isExpanded,
152
+ "hover:brightness-97": isExpanded && !disabled,
153
+ "cursor-pointer": clickOnlyOnHeader && !disabled
154
+ },
155
+ headerClassName
156
+ ),
157
+ onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
158
+ children: [
159
+ label,
160
+ icon(isExpanded)
161
+ ]
162
+ }
163
+ ),
164
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
165
+ "div",
166
+ {
167
+ className: (0, import_clsx3.default)(
168
+ "flex-col-2 px-4 transition-all duration-300 ease-in-out",
169
+ {
170
+ [(0, import_clsx3.default)("max-h-96 opacity-100 pb-2 overflow-y-auto", contentExpandedClassName)]: isExpanded,
171
+ "max-h-0 opacity-0 overflow-hidden": !isExpanded
172
+ },
173
+ contentClassName
174
+ ),
175
+ children
176
+ }
177
+ )
178
+ ]
179
+ }
180
+ );
181
+ });
182
+ var ExpandableUncontrolled = (0, import_react.forwardRef)(function ExpandableUncontrolled2({
183
+ isExpanded,
184
+ onChange = noop,
185
+ ...props
186
+ }, ref) {
187
+ const [usedIsExpanded, setUsedIsExpanded] = (0, import_react.useState)(isExpanded);
188
+ (0, import_react.useEffect)(() => {
189
+ setUsedIsExpanded(isExpanded);
190
+ }, [isExpanded]);
191
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
192
+ Expandable,
193
+ {
194
+ ...props,
195
+ ref,
196
+ isExpanded: usedIsExpanded,
197
+ onChange: (value) => {
198
+ onChange(value);
199
+ setUsedIsExpanded(value);
200
+ }
201
+ }
202
+ );
203
+ });
204
+
205
+ // src/components/user-action/Menu.tsx
206
+ var import_react4 = require("react");
60
207
  var import_clsx4 = __toESM(require("clsx"));
61
208
 
62
- // src/localization/LanguageProvider.tsx
209
+ // src/hooks/useOutsideClick.ts
63
210
  var import_react2 = require("react");
211
+ var useOutsideClick = (refs, handler) => {
212
+ (0, import_react2.useEffect)(() => {
213
+ const listener = (event) => {
214
+ if (event.target === null) return;
215
+ if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
216
+ return;
217
+ }
218
+ handler();
219
+ };
220
+ document.addEventListener("mousedown", listener);
221
+ document.addEventListener("touchstart", listener);
222
+ return () => {
223
+ document.removeEventListener("mousedown", listener);
224
+ document.removeEventListener("touchstart", listener);
225
+ };
226
+ }, [refs, handler]);
227
+ };
64
228
 
65
- // src/hooks/useLocalStorage.ts
66
- var import_react = require("react");
67
-
68
- // src/localization/util.ts
69
- var languages = ["en", "de"];
70
- var languagesLocalNames = {
71
- en: "English",
72
- de: "Deutsch"
229
+ // src/hooks/useHoverState.ts
230
+ var import_react3 = require("react");
231
+ var defaultUseHoverStateProps = {
232
+ closingDelay: 200,
233
+ isDisabled: false
73
234
  };
74
- var DEFAULT_LANGUAGE = "en";
75
- var LanguageUtil = {
76
- languages,
77
- DEFAULT_LANGUAGE,
78
- languagesLocalNames
235
+ var useHoverState = (props = void 0) => {
236
+ const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
237
+ const [isHovered, setIsHovered] = (0, import_react3.useState)(false);
238
+ const [timer, setTimer] = (0, import_react3.useState)();
239
+ const onMouseEnter = () => {
240
+ if (isDisabled) {
241
+ return;
242
+ }
243
+ clearTimeout(timer);
244
+ setIsHovered(true);
245
+ };
246
+ const onMouseLeave = () => {
247
+ if (isDisabled) {
248
+ return;
249
+ }
250
+ setTimer(setTimeout(() => {
251
+ setIsHovered(false);
252
+ }, closingDelay));
253
+ };
254
+ (0, import_react3.useEffect)(() => {
255
+ if (timer) {
256
+ return () => {
257
+ clearTimeout(timer);
258
+ };
259
+ }
260
+ });
261
+ (0, import_react3.useEffect)(() => {
262
+ if (timer) {
263
+ clearTimeout(timer);
264
+ }
265
+ }, [isDisabled]);
266
+ return {
267
+ isHovered,
268
+ setIsHovered,
269
+ handlers: { onMouseEnter, onMouseLeave }
270
+ };
79
271
  };
80
272
 
81
- // src/localization/LanguageProvider.tsx
82
- var import_jsx_runtime2 = require("react/jsx-runtime");
83
- var LanguageContext = (0, import_react2.createContext)({
84
- language: LanguageUtil.DEFAULT_LANGUAGE,
85
- setLanguage: (v) => v
86
- });
87
- var useLanguage = () => (0, import_react2.useContext)(LanguageContext);
273
+ // src/util/PropsWithFunctionChildren.ts
274
+ var resolve = (children, bag) => {
275
+ if (typeof children === "function") {
276
+ return children(bag);
277
+ }
278
+ return children ?? void 0;
279
+ };
280
+ var BagFunctionUtil = {
281
+ resolve
282
+ };
88
283
 
89
- // src/localization/useTranslation.ts
90
- var TranslationPluralCount = {
91
- zero: 0,
92
- one: 1,
93
- two: 2,
94
- few: 3,
95
- many: 11,
96
- other: -1
284
+ // src/hooks/usePopoverPosition.ts
285
+ var defaultPopoverPositionOptions = {
286
+ edgePadding: 16,
287
+ outerGap: 4,
288
+ horizontalAlignment: "leftInside",
289
+ verticalAlignment: "bottomOutside",
290
+ disabled: false
97
291
  };
98
- var useTranslation = (translations, overwriteTranslation = {}) => {
99
- const { language: languageProp, translation: overwrite } = overwriteTranslation;
100
- const { language: inferredLanguage } = useLanguage();
101
- const usedLanguage = languageProp ?? inferredLanguage;
102
- const usedTranslations = [...translations];
103
- if (overwrite) {
104
- usedTranslations.push(overwrite);
292
+ var usePopoverPosition = (trigger, options) => {
293
+ const {
294
+ edgePadding,
295
+ outerGap,
296
+ verticalAlignment,
297
+ horizontalAlignment,
298
+ disabled
299
+ } = { ...defaultPopoverPositionOptions, ...options };
300
+ if (disabled || !trigger) {
301
+ return {};
105
302
  }
106
- return (key, options) => {
107
- const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
108
- try {
109
- for (let i = translations.length - 1; i >= 0; i--) {
110
- const translation = translations[i];
111
- const localizedTranslation = translation[usedLanguage];
112
- if (!localizedTranslation) {
113
- continue;
114
- }
115
- const value = localizedTranslation[key];
116
- if (!value) {
117
- continue;
118
- }
119
- let forProcessing;
120
- if (typeof value !== "string") {
121
- if (count === TranslationPluralCount.zero && value?.zero) {
122
- forProcessing = value.zero;
123
- } else if (count === TranslationPluralCount.one && value?.one) {
124
- forProcessing = value.one;
125
- } else if (count === TranslationPluralCount.two && value?.two) {
126
- forProcessing = value.two;
127
- } else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
128
- forProcessing = value.few;
129
- } else if (count > TranslationPluralCount.many && value?.many) {
130
- forProcessing = value.many;
131
- } else {
132
- forProcessing = value.other;
303
+ const left = {
304
+ leftOutside: trigger.left - outerGap,
305
+ leftInside: trigger.left,
306
+ rightOutside: trigger.right + outerGap,
307
+ rightInside: trigger.right,
308
+ center: trigger.left + trigger.width / 2
309
+ }[horizontalAlignment];
310
+ const top = {
311
+ topOutside: trigger.top - outerGap,
312
+ topInside: trigger.top,
313
+ bottomOutside: trigger.bottom + outerGap,
314
+ bottomInside: trigger.bottom,
315
+ center: trigger.top + trigger.height / 2
316
+ }[verticalAlignment];
317
+ const translateX = {
318
+ leftOutside: "-100%",
319
+ leftInside: void 0,
320
+ rightOutside: void 0,
321
+ rightInside: "-100%",
322
+ center: "-50%"
323
+ }[horizontalAlignment];
324
+ const translateY = {
325
+ topOutside: "-100%",
326
+ topInside: void 0,
327
+ bottomOutside: void 0,
328
+ bottomInside: "-100%",
329
+ center: "-50%"
330
+ }[verticalAlignment];
331
+ return {
332
+ left: Math.max(left, edgePadding),
333
+ top: Math.max(top, edgePadding),
334
+ translate: [translateX ?? "0", translateY ?? "0"].join(" ")
335
+ };
336
+ };
337
+
338
+ // src/components/user-action/Menu.tsx
339
+ var import_react_dom = require("react-dom");
340
+ var import_jsx_runtime4 = require("react/jsx-runtime");
341
+ function getScrollableParents(element) {
342
+ const scrollables = [];
343
+ let parent = element.parentElement;
344
+ while (parent) {
345
+ scrollables.push(parent);
346
+ parent = parent.parentElement;
347
+ }
348
+ return scrollables;
349
+ }
350
+ var Menu = ({
351
+ trigger,
352
+ children,
353
+ alignmentHorizontal = "leftInside",
354
+ alignmentVertical = "bottomOutside",
355
+ showOnHover = false,
356
+ disabled = false,
357
+ menuClassName = ""
358
+ }) => {
359
+ const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
360
+ const triggerRef = (0, import_react4.useRef)(null);
361
+ const menuRef = (0, import_react4.useRef)(null);
362
+ useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
363
+ const [isHidden, setIsHidden] = (0, import_react4.useState)(true);
364
+ const bag = {
365
+ isOpen,
366
+ close: () => setIsOpen(false),
367
+ toggleOpen: () => setIsOpen((prevState) => !prevState),
368
+ disabled
369
+ };
370
+ const menuPosition = usePopoverPosition(
371
+ triggerRef.current?.getBoundingClientRect(),
372
+ { verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
373
+ );
374
+ (0, import_react4.useEffect)(() => {
375
+ if (!isOpen) return;
376
+ const triggerEl = triggerRef.current;
377
+ if (!triggerEl) return;
378
+ const scrollableParents = getScrollableParents(triggerEl);
379
+ const close = () => setIsOpen(false);
380
+ scrollableParents.forEach((parent) => {
381
+ parent.addEventListener("scroll", close);
382
+ });
383
+ window.addEventListener("resize", close);
384
+ return () => {
385
+ scrollableParents.forEach((parent) => {
386
+ parent.removeEventListener("scroll", close);
387
+ });
388
+ window.removeEventListener("resize", close);
389
+ };
390
+ }, [isOpen, setIsOpen]);
391
+ (0, import_react4.useEffect)(() => {
392
+ if (isOpen) {
393
+ setIsHidden(false);
394
+ }
395
+ }, [isOpen]);
396
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
397
+ trigger(bag, triggerRef),
398
+ (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
399
+ "div",
400
+ {
401
+ ref: menuRef,
402
+ onClick: (e) => e.stopPropagation(),
403
+ className: (0, import_clsx4.default)(
404
+ "absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
405
+ {
406
+ "animate-pop-in": isOpen,
407
+ "animate-pop-out": !isOpen,
408
+ "hidden": isHidden
409
+ },
410
+ menuClassName
411
+ ),
412
+ onAnimationEnd: () => {
413
+ if (!isOpen) {
414
+ setIsHidden(true);
133
415
  }
134
- } else {
135
- forProcessing = value;
136
- }
137
- forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
138
- return replacements[placeholder] ?? `{{key:${placeholder}}}`;
139
- });
140
- return forProcessing;
416
+ },
417
+ style: {
418
+ ...menuPosition
419
+ },
420
+ children: BagFunctionUtil.resolve(children, bag)
141
421
  }
142
- } catch (e) {
143
- console.error(e);
144
- }
145
- return `{{${usedLanguage}:${key}}}`;
146
- };
422
+ ), document.body)
423
+ ] });
147
424
  };
148
425
 
149
426
  // src/components/user-action/Input.tsx
150
- var import_react6 = require("react");
151
- var import_clsx2 = __toESM(require("clsx"));
427
+ var import_react8 = require("react");
428
+ var import_clsx5 = __toESM(require("clsx"));
152
429
 
153
430
  // src/hooks/useDelay.ts
154
- var import_react3 = require("react");
431
+ var import_react5 = require("react");
155
432
  var defaultOptions = {
156
433
  delay: 3e3,
157
434
  disabled: false
158
435
  };
159
436
  function useDelay(options) {
160
- const [timer, setTimer] = (0, import_react3.useState)(void 0);
437
+ const [timer, setTimer] = (0, import_react5.useState)(void 0);
161
438
  const { delay, disabled } = {
162
439
  ...defaultOptions,
163
440
  ...options
@@ -176,12 +453,12 @@ function useDelay(options) {
176
453
  setTimer(void 0);
177
454
  }, delay));
178
455
  };
179
- (0, import_react3.useEffect)(() => {
456
+ (0, import_react5.useEffect)(() => {
180
457
  return () => {
181
458
  clearTimeout(timer);
182
459
  };
183
460
  }, [timer]);
184
- (0, import_react3.useEffect)(() => {
461
+ (0, import_react5.useEffect)(() => {
185
462
  if (disabled) {
186
463
  clearTimeout(timer);
187
464
  setTimer(void 0);
@@ -190,13 +467,10 @@ function useDelay(options) {
190
467
  return { restartTimer, clearTimer, hasActiveTimer: !!timer };
191
468
  }
192
469
 
193
- // src/util/noop.ts
194
- var noop = () => void 0;
195
-
196
470
  // src/hooks/useFocusManagement.ts
197
- var import_react4 = require("react");
471
+ var import_react6 = require("react");
198
472
  function useFocusManagement() {
199
- const getFocusableElements = (0, import_react4.useCallback)(() => {
473
+ const getFocusableElements = (0, import_react6.useCallback)(() => {
200
474
  return Array.from(
201
475
  document.querySelectorAll(
202
476
  'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
@@ -205,7 +479,7 @@ function useFocusManagement() {
205
479
  (el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
206
480
  );
207
481
  }, []);
208
- const getNextFocusElement = (0, import_react4.useCallback)(() => {
482
+ const getNextFocusElement = (0, import_react6.useCallback)(() => {
209
483
  const elements = getFocusableElements();
210
484
  if (elements.length === 0) {
211
485
  return void 0;
@@ -217,11 +491,11 @@ function useFocusManagement() {
217
491
  }
218
492
  return nextElement;
219
493
  }, [getFocusableElements]);
220
- const focusNext = (0, import_react4.useCallback)(() => {
494
+ const focusNext = (0, import_react6.useCallback)(() => {
221
495
  const nextElement = getNextFocusElement();
222
496
  nextElement?.focus();
223
497
  }, [getNextFocusElement]);
224
- const getPreviousFocusElement = (0, import_react4.useCallback)(() => {
498
+ const getPreviousFocusElement = (0, import_react6.useCallback)(() => {
225
499
  const elements = getFocusableElements();
226
500
  if (elements.length === 0) {
227
501
  return void 0;
@@ -237,7 +511,7 @@ function useFocusManagement() {
237
511
  }
238
512
  return previousElement;
239
513
  }, [getFocusableElements]);
240
- const focusPrevious = (0, import_react4.useCallback)(() => {
514
+ const focusPrevious = (0, import_react6.useCallback)(() => {
241
515
  const previousElement = getPreviousFocusElement();
242
516
  if (previousElement) previousElement.focus();
243
517
  }, [getPreviousFocusElement]);
@@ -251,10 +525,10 @@ function useFocusManagement() {
251
525
  }
252
526
 
253
527
  // src/hooks/useFocusOnceVisible.ts
254
- var import_react5 = __toESM(require("react"));
528
+ var import_react7 = __toESM(require("react"));
255
529
  var useFocusOnceVisible = (ref, disable = false) => {
256
- const [hasUsedFocus, setHasUsedFocus] = import_react5.default.useState(false);
257
- (0, import_react5.useEffect)(() => {
530
+ const [hasUsedFocus, setHasUsedFocus] = import_react7.default.useState(false);
531
+ (0, import_react7.useEffect)(() => {
258
532
  if (disable || hasUsedFocus) {
259
533
  return;
260
534
  }
@@ -274,9 +548,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
274
548
  };
275
549
 
276
550
  // src/components/user-action/Input.tsx
277
- var import_jsx_runtime3 = require("react/jsx-runtime");
551
+ var import_jsx_runtime5 = require("react/jsx-runtime");
278
552
  var getInputClassName = ({ disabled = false, hasError = false }) => {
279
- return (0, import_clsx2.default)(
553
+ return (0, import_clsx5.default)(
280
554
  "px-2 py-1.5 rounded-md border-2",
281
555
  {
282
556
  "bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
@@ -290,7 +564,7 @@ var defaultEditCompleteOptions = {
290
564
  afterDelay: true,
291
565
  delay: 2500
292
566
  };
293
- var Input = (0, import_react6.forwardRef)(function Input2({
567
+ var Input = (0, import_react8.forwardRef)(function Input2({
294
568
  id,
295
569
  type = "text",
296
570
  value,
@@ -313,10 +587,10 @@ var Input = (0, import_react6.forwardRef)(function Input2({
313
587
  restartTimer,
314
588
  clearTimer
315
589
  } = useDelay({ delay, disabled: !afterDelay });
316
- const innerRef = (0, import_react6.useRef)(null);
590
+ const innerRef = (0, import_react8.useRef)(null);
317
591
  const { focusNext } = useFocusManagement();
318
592
  useFocusOnceVisible(innerRef, !autoFocus);
319
- (0, import_react6.useImperativeHandle)(forwardedRef, () => innerRef.current);
593
+ (0, import_react8.useImperativeHandle)(forwardedRef, () => innerRef.current);
320
594
  const handleKeyDown = (e) => {
321
595
  if (e.key === "Enter" && !e.shiftKey) {
322
596
  e.preventDefault();
@@ -324,9 +598,9 @@ var Input = (0, import_react6.forwardRef)(function Input2({
324
598
  focusNext();
325
599
  }
326
600
  };
327
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx2.default)({ "w-full": expanded }, containerClassName), children: [
328
- label && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx2.default)("mb-1", label.className) }),
329
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
601
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx5.default)({ "w-full": expanded }, containerClassName), children: [
602
+ label && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Label, { ...label, htmlFor: id, className: (0, import_clsx5.default)("mb-1", label.className) }),
603
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
330
604
  "input",
331
605
  {
332
606
  ...restProps,
@@ -335,7 +609,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
335
609
  id,
336
610
  type,
337
611
  disabled,
338
- className: (0, import_clsx2.default)(getInputClassName({ disabled }), className),
612
+ className: (0, import_clsx5.default)(getInputClassName({ disabled }), className),
339
613
  onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
340
614
  onBlur: (event) => {
341
615
  onBlur?.(event);
@@ -365,7 +639,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
365
639
  )
366
640
  ] });
367
641
  });
368
- var FormInput = (0, import_react6.forwardRef)(function FormInput2({
642
+ var FormInput = (0, import_react8.forwardRef)(function FormInput2({
369
643
  id,
370
644
  labelText,
371
645
  errorText,
@@ -377,137 +651,120 @@ var FormInput = (0, import_react6.forwardRef)(function FormInput2({
377
651
  disabled,
378
652
  ...restProps
379
653
  }, ref) {
380
- const input = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
654
+ const input = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
381
655
  "input",
382
656
  {
383
657
  ...restProps,
384
658
  ref,
385
659
  id,
386
660
  disabled,
387
- className: (0, import_clsx2.default)(
661
+ className: (0, import_clsx5.default)(
388
662
  getInputClassName({ disabled, hasError: !!errorText }),
389
663
  className
390
664
  )
391
665
  }
392
666
  );
393
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: (0, import_clsx2.default)("flex flex-col gap-y-1", containerClassName), children: [
394
- labelText && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("label", { htmlFor: id, className: (0, import_clsx2.default)("textstyle-label-md", labelClassName), children: [
667
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx5.default)("flex flex-col gap-y-1", containerClassName), children: [
668
+ labelText && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { htmlFor: id, className: (0, import_clsx5.default)("textstyle-label-md", labelClassName), children: [
395
669
  labelText,
396
- required && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-primary font-bold", children: "*" })
670
+ required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-primary font-bold", children: "*" })
397
671
  ] }),
398
672
  input,
399
- errorText && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { htmlFor: id, className: (0, import_clsx2.default)("text-negative", errorClassName), children: errorText })
673
+ errorText && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: id, className: (0, import_clsx5.default)("text-negative", errorClassName), children: errorText })
400
674
  ] });
401
675
  });
402
676
 
403
- // src/components/user-action/Button.tsx
404
- var import_clsx3 = __toESM(require("clsx"));
405
- var import_jsx_runtime4 = require("react/jsx-runtime");
406
- var ButtonColorUtil = {
407
- solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
408
- text: ["primary", "negative", "neutral"],
409
- outline: ["primary"]
677
+ // src/localization/LanguageProvider.tsx
678
+ var import_react10 = require("react");
679
+
680
+ // src/hooks/useLocalStorage.ts
681
+ var import_react9 = require("react");
682
+
683
+ // src/localization/util.ts
684
+ var languages = ["en", "de"];
685
+ var languagesLocalNames = {
686
+ en: "English",
687
+ de: "Deutsch"
410
688
  };
411
- var IconButtonUtil = {
412
- icon: [...ButtonColorUtil.solid, "transparent"]
413
- };
414
- var paddingMapping = {
415
- small: "btn-sm",
416
- medium: "btn-md",
417
- large: "btn-lg"
418
- };
419
- var iconPaddingMapping = {
420
- tiny: "icon-btn-xs",
421
- small: "icon-btn-sm",
422
- medium: "icon-btn-md",
423
- large: "icon-btn-lg"
424
- };
425
- var ButtonUtil = {
426
- paddingMapping,
427
- iconPaddingMapping
428
- };
429
- var IconButton = ({
430
- children,
431
- disabled = false,
432
- color = "primary",
433
- size = "medium",
434
- onClick,
435
- className,
436
- ...restProps
437
- }) => {
438
- const colorClasses = {
439
- primary: "bg-button-solid-primary-background text-button-solid-primary-text",
440
- secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
441
- tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
442
- positive: "bg-button-solid-positive-background text-button-solid-positive-text",
443
- warning: "bg-button-solid-warning-background text-button-solid-warning-text",
444
- negative: "bg-button-solid-negative-background text-button-solid-negative-text",
445
- neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
446
- transparent: "bg-transparent"
447
- }[color];
448
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
449
- "button",
450
- {
451
- onClick: disabled ? void 0 : onClick,
452
- disabled: disabled || onClick === void 0,
453
- className: (0, import_clsx3.default)(
454
- {
455
- "text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
456
- "text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
457
- "hover:bg-button-text-hover-background": !disabled && color === "transparent",
458
- [(0, import_clsx3.default)(colorClasses, "hover:brightness-90")]: !disabled
459
- },
460
- ButtonUtil.iconPaddingMapping[size],
461
- className
462
- ),
463
- ...restProps,
464
- children
465
- }
466
- );
689
+ var DEFAULT_LANGUAGE = "en";
690
+ var LanguageUtil = {
691
+ languages,
692
+ DEFAULT_LANGUAGE,
693
+ languagesLocalNames
467
694
  };
468
695
 
469
- // src/hooks/useSearch.ts
470
- var import_react7 = require("react");
696
+ // src/localization/LanguageProvider.tsx
697
+ var import_jsx_runtime6 = require("react/jsx-runtime");
698
+ var LanguageContext = (0, import_react10.createContext)({
699
+ language: LanguageUtil.DEFAULT_LANGUAGE,
700
+ setLanguage: (v) => v
701
+ });
702
+ var useLanguage = () => (0, import_react10.useContext)(LanguageContext);
471
703
 
472
- // src/util/simpleSearch.ts
473
- var MultiSearchWithMapping = (search, objects, mapping) => {
474
- return objects.filter((object) => {
475
- const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
476
- if (!mappedSearchKeywords) {
477
- return true;
478
- }
479
- return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
480
- });
704
+ // src/localization/useTranslation.ts
705
+ var TranslationPluralCount = {
706
+ zero: 0,
707
+ one: 1,
708
+ two: 2,
709
+ few: 3,
710
+ many: 11,
711
+ other: -1
481
712
  };
482
-
483
- // src/hooks/useSearch.ts
484
- var useSearch = ({
485
- list,
486
- initialSearch,
487
- searchMapping
488
- }) => {
489
- const [items, setItems] = (0, import_react7.useState)(list);
490
- const [search, setSearch] = (0, import_react7.useState)(initialSearch);
491
- (0, import_react7.useEffect)(() => {
492
- setItems(list);
493
- }, [list]);
494
- const result = (0, import_react7.useMemo)(
495
- () => MultiSearchWithMapping(search, items, searchMapping),
496
- [search, items, searchMapping]
497
- );
498
- return {
499
- result,
500
- hasResult: result.length > 0,
501
- allItems: items,
502
- setItems,
503
- search,
504
- setSearch
713
+ var useTranslation = (translations, overwriteTranslation = {}) => {
714
+ const { language: languageProp, translation: overwrite } = overwriteTranslation;
715
+ const { language: inferredLanguage } = useLanguage();
716
+ const usedLanguage = languageProp ?? inferredLanguage;
717
+ const usedTranslations = [...translations];
718
+ if (overwrite) {
719
+ usedTranslations.push(overwrite);
720
+ }
721
+ return (key, options) => {
722
+ const { count, replacements } = { ...{ count: 0, replacements: {} }, ...options };
723
+ try {
724
+ for (let i = translations.length - 1; i >= 0; i--) {
725
+ const translation = translations[i];
726
+ const localizedTranslation = translation[usedLanguage];
727
+ if (!localizedTranslation) {
728
+ continue;
729
+ }
730
+ const value = localizedTranslation[key];
731
+ if (!value) {
732
+ continue;
733
+ }
734
+ let forProcessing;
735
+ if (typeof value !== "string") {
736
+ if (count === TranslationPluralCount.zero && value?.zero) {
737
+ forProcessing = value.zero;
738
+ } else if (count === TranslationPluralCount.one && value?.one) {
739
+ forProcessing = value.one;
740
+ } else if (count === TranslationPluralCount.two && value?.two) {
741
+ forProcessing = value.two;
742
+ } else if (TranslationPluralCount.few <= count && count < TranslationPluralCount.many && value?.few) {
743
+ forProcessing = value.few;
744
+ } else if (count > TranslationPluralCount.many && value?.many) {
745
+ forProcessing = value.many;
746
+ } else {
747
+ forProcessing = value.other;
748
+ }
749
+ } else {
750
+ forProcessing = value;
751
+ }
752
+ forProcessing = forProcessing.replace(/\{\{(\w+)}}/g, (_, placeholder) => {
753
+ return replacements[placeholder] ?? `{{key:${placeholder}}}`;
754
+ });
755
+ return forProcessing;
756
+ }
757
+ } catch (e) {
758
+ console.error(e);
759
+ }
760
+ return `{{${usedLanguage}:${key}}}`;
505
761
  };
506
762
  };
507
763
 
508
764
  // src/localization/defaults/form.ts
509
765
  var formTranslation = {
510
766
  en: {
767
+ add: "Add",
511
768
  all: "All",
512
769
  apply: "Apply",
513
770
  back: "Back",
@@ -520,6 +777,7 @@ var formTranslation = {
520
777
  confirm: "Confirm",
521
778
  copy: "Copy",
522
779
  copied: "Copied",
780
+ create: "Create",
523
781
  decline: "Decline",
524
782
  delete: "Delete",
525
783
  discard: "Discard",
@@ -562,6 +820,7 @@ var formTranslation = {
562
820
  yes: "Yes"
563
821
  },
564
822
  de: {
823
+ add: "Hinzuf\xFCgen",
565
824
  all: "Alle",
566
825
  apply: "Anwenden",
567
826
  back: "Zur\xFCck",
@@ -574,6 +833,7 @@ var formTranslation = {
574
833
  confirm: "Best\xE4tigen",
575
834
  copy: "Kopieren",
576
835
  copied: "Kopiert",
836
+ create: "Erstellen",
577
837
  decline: "Ablehnen",
578
838
  delete: "L\xF6schen",
579
839
  discard: "Verwerfen",
@@ -617,186 +877,335 @@ var formTranslation = {
617
877
  }
618
878
  };
619
879
 
620
- // src/components/layout-and-navigation/SearchableList.tsx
621
- var import_jsx_runtime5 = require("react/jsx-runtime");
622
- var defaultSearchableListTranslation = {
623
- en: {
624
- nothingFound: "Nothing found"
625
- },
626
- de: {
627
- nothingFound: "Nichts gefunden"
628
- }
880
+ // src/components/user-action/Button.tsx
881
+ var import_react11 = require("react");
882
+ var import_clsx6 = __toESM(require("clsx"));
883
+ var import_jsx_runtime7 = require("react/jsx-runtime");
884
+ var ButtonColorUtil = {
885
+ solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
886
+ text: ["primary", "negative", "neutral"],
887
+ outline: ["primary"]
629
888
  };
630
- var SearchableList = ({
631
- overwriteTranslation,
632
- list,
633
- initialSearch = "",
634
- searchMapping,
635
- autoFocus,
636
- minimumItemsForSearch = 6,
637
- itemMapper,
638
- className,
639
- resultListClassName
640
- }) => {
641
- const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
642
- const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
643
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_clsx4.default)("col gap-y-2", className), children: [
644
- list.length > minimumItemsForSearch && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "row justify-between gap-x-4 items-center", children: [
645
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
646
- Input,
647
- {
648
- value: search,
649
- onChangeText: setSearch,
650
- placeholder: translation("search"),
651
- autoFocus,
652
- className: "w-full"
653
- }
654
- ),
655
- /* @__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" }) })
656
- ] }),
657
- 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") })
658
- ] });
889
+ var IconButtonUtil = {
890
+ icon: [...ButtonColorUtil.solid, "transparent"]
659
891
  };
660
-
661
- // src/components/layout-and-navigation/Tile.tsx
662
- var import_clsx5 = __toESM(require("clsx"));
663
- var import_lucide_react2 = require("lucide-react");
664
- var import_jsx_runtime6 = require("react/jsx-runtime");
665
- var Tile = ({
666
- title,
667
- description,
892
+ var paddingMapping = {
893
+ small: "btn-sm",
894
+ medium: "btn-md",
895
+ large: "btn-lg"
896
+ };
897
+ var iconPaddingMapping = {
898
+ tiny: "icon-btn-xs",
899
+ small: "icon-btn-sm",
900
+ medium: "icon-btn-md",
901
+ large: "icon-btn-lg"
902
+ };
903
+ var ButtonUtil = {
904
+ paddingMapping,
905
+ iconPaddingMapping
906
+ };
907
+ var SolidButton = (0, import_react11.forwardRef)(function SolidButton2({
908
+ children,
909
+ disabled = false,
910
+ color = "primary",
911
+ size = "medium",
912
+ startIcon,
913
+ endIcon,
668
914
  onClick,
669
- isSelected = false,
670
- isDisabled = false,
671
- prefix,
672
- suffix,
673
- normalClassName = "hover:bg-primary/40 cursor-pointer",
674
- selectedClassName = " bg-primary/20",
675
- disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
676
- className
677
- }) => {
678
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
679
- "div",
915
+ className,
916
+ ...restProps
917
+ }, ref) {
918
+ const colorClasses = {
919
+ primary: "bg-button-solid-primary-background text-button-solid-primary-text",
920
+ secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
921
+ tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
922
+ positive: "bg-button-solid-positive-background text-button-solid-positive-text",
923
+ warning: "bg-button-solid-warning-background text-button-solid-warning-text",
924
+ negative: "bg-button-solid-negative-background text-button-solid-negative-text",
925
+ neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
926
+ }[color];
927
+ const iconColorClasses = {
928
+ primary: "text-button-solid-primary-icon",
929
+ secondary: "text-button-solid-secondary-icon",
930
+ tertiary: "text-button-solid-tertiary-icon",
931
+ positive: "text-button-solid-positive-icon",
932
+ warning: "text-button-solid-warning-icon",
933
+ negative: "text-button-solid-negative-icon",
934
+ neutral: "text-button-solid-neutral-icon"
935
+ }[color];
936
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
937
+ "button",
680
938
  {
681
- className: (0, import_clsx5.default)(
682
- "row gap-x-2 w-full items-center",
939
+ ref,
940
+ onClick,
941
+ disabled,
942
+ className: (0, import_clsx6.default)(
683
943
  {
684
- [normalClassName]: !!onClick && !isDisabled,
685
- [selectedClassName]: isSelected && !isDisabled,
686
- [disabledClassName]: isDisabled
944
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
945
+ [(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
687
946
  },
947
+ ButtonUtil.paddingMapping[size],
688
948
  className
689
949
  ),
690
- onClick: isDisabled ? void 0 : onClick,
950
+ ...restProps,
691
951
  children: [
692
- prefix,
693
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "col gap-y-0 w-full", children: [
694
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h4", { className: (0, import_clsx5.default)(title.className ?? "textstyle-title-normal"), children: title.value }),
695
- !!description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: (0, import_clsx5.default)(description.className ?? "textstyle-description"), children: description.value })
696
- ] }),
697
- suffix ?? (isSelected ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react2.Check, { size: 24 }) : void 0)
952
+ startIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
953
+ "span",
954
+ {
955
+ className: (0, import_clsx6.default)({
956
+ [iconColorClasses]: !disabled,
957
+ [`text-disabled-icon`]: disabled
958
+ }),
959
+ children: startIcon
960
+ }
961
+ ),
962
+ children,
963
+ endIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
964
+ "span",
965
+ {
966
+ className: (0, import_clsx6.default)({
967
+ [iconColorClasses]: !disabled,
968
+ [`text-disabled-icon`]: disabled
969
+ }),
970
+ children: endIcon
971
+ }
972
+ )
698
973
  ]
699
974
  }
700
975
  );
976
+ });
977
+ var IconButton = ({
978
+ children,
979
+ disabled = false,
980
+ color = "primary",
981
+ size = "medium",
982
+ className,
983
+ ...restProps
984
+ }) => {
985
+ const colorClasses = {
986
+ primary: "bg-button-solid-primary-background text-button-solid-primary-text",
987
+ secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
988
+ tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
989
+ positive: "bg-button-solid-positive-background text-button-solid-positive-text",
990
+ warning: "bg-button-solid-warning-background text-button-solid-warning-text",
991
+ negative: "bg-button-solid-negative-background text-button-solid-negative-text",
992
+ neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
993
+ transparent: "bg-transparent"
994
+ }[color];
995
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
996
+ "button",
997
+ {
998
+ disabled,
999
+ className: (0, import_clsx6.default)(
1000
+ {
1001
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
1002
+ "text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
1003
+ "hover:bg-button-text-hover-background": !disabled && color === "transparent",
1004
+ [(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
1005
+ },
1006
+ ButtonUtil.iconPaddingMapping[size],
1007
+ className
1008
+ ),
1009
+ ...restProps,
1010
+ children
1011
+ }
1012
+ );
701
1013
  };
702
1014
 
703
- // src/hooks/useOutsideClick.ts
704
- var import_react8 = require("react");
705
- var useOutsideClick = (refs, handler) => {
706
- (0, import_react8.useEffect)(() => {
707
- const listener = (event) => {
708
- if (event.target === null) return;
709
- if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
710
- return;
1015
+ // src/components/user-action/SearchBar.tsx
1016
+ var import_lucide_react3 = require("lucide-react");
1017
+ var import_clsx7 = require("clsx");
1018
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1019
+ var SearchBar = ({
1020
+ placeholder,
1021
+ onSearch,
1022
+ disableOnSearch,
1023
+ containerClassName,
1024
+ ...inputProps
1025
+ }) => {
1026
+ const translation = useTranslation([formTranslation]);
1027
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: (0, import_clsx7.clsx)("flex-row-2 justify-between items-center", containerClassName), children: [
1028
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1029
+ Input,
1030
+ {
1031
+ ...inputProps,
1032
+ placeholder: placeholder ?? translation("search")
711
1033
  }
712
- handler();
713
- };
714
- document.addEventListener("mousedown", listener);
715
- document.addEventListener("touchstart", listener);
716
- return () => {
717
- document.removeEventListener("mousedown", listener);
718
- document.removeEventListener("touchstart", listener);
719
- };
720
- }, [refs, handler]);
1034
+ ),
1035
+ 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" }) })
1036
+ ] });
1037
+ };
1038
+
1039
+ // src/hooks/useSearch.ts
1040
+ var import_react12 = require("react");
1041
+
1042
+ // src/util/simpleSearch.ts
1043
+ var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
1044
+ return objects.filter((object) => {
1045
+ const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
1046
+ if (!mappedSearchKeywords) {
1047
+ return true;
1048
+ }
1049
+ return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
1050
+ });
1051
+ };
1052
+
1053
+ // src/hooks/useSearch.ts
1054
+ var useSearch = ({
1055
+ list,
1056
+ initialSearch,
1057
+ searchMapping,
1058
+ additionalSearchTags,
1059
+ isSearchInstant = true,
1060
+ sortingFunction,
1061
+ filter,
1062
+ disabled = false
1063
+ }) => {
1064
+ const [search, setSearch] = (0, import_react12.useState)(initialSearch ?? "");
1065
+ const [result, setResult] = (0, import_react12.useState)(list);
1066
+ const searchTags = (0, import_react12.useMemo)(() => additionalSearchTags ?? [], [additionalSearchTags]);
1067
+ const updateSearch = (0, import_react12.useCallback)((newSearch) => {
1068
+ const usedSearch = newSearch ?? search;
1069
+ if (newSearch) {
1070
+ setSearch(search);
1071
+ }
1072
+ setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
1073
+ }, [searchTags, list, search, searchMapping]);
1074
+ (0, import_react12.useEffect)(() => {
1075
+ if (isSearchInstant) {
1076
+ setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
1077
+ }
1078
+ }, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
1079
+ const filteredResult = (0, import_react12.useMemo)(() => {
1080
+ if (!filter) {
1081
+ return result;
1082
+ }
1083
+ return result.filter(filter);
1084
+ }, [result, filter]);
1085
+ const sortedAndFilteredResult = (0, import_react12.useMemo)(() => {
1086
+ if (!sortingFunction) {
1087
+ return filteredResult;
1088
+ }
1089
+ return filteredResult.sort(sortingFunction);
1090
+ }, [filteredResult, sortingFunction]);
1091
+ const usedResult = (0, import_react12.useMemo)(() => {
1092
+ if (!disabled) {
1093
+ return sortedAndFilteredResult;
1094
+ }
1095
+ return list;
1096
+ }, [disabled, list, sortedAndFilteredResult]);
1097
+ return {
1098
+ result: usedResult,
1099
+ hasResult: usedResult.length > 0,
1100
+ allItems: list,
1101
+ updateSearch,
1102
+ search,
1103
+ setSearch
1104
+ };
721
1105
  };
722
1106
 
723
1107
  // src/components/user-action/Select.tsx
724
- var import_jsx_runtime7 = require("react/jsx-runtime");
1108
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1109
+ var SelectTile = ({
1110
+ className,
1111
+ disabledClassName,
1112
+ title,
1113
+ ...restProps
1114
+ }) => {
1115
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1116
+ Tile,
1117
+ {
1118
+ ...restProps,
1119
+ className: (0, import_clsx8.default)("px-2 py-1 rounded-md", className),
1120
+ disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
1121
+ title: { ...title, className: title.className ?? "font-semibold" }
1122
+ }
1123
+ );
1124
+ };
725
1125
  var Select = ({
726
1126
  value,
727
1127
  label,
728
1128
  options,
729
1129
  onChange,
730
1130
  hintText = "",
731
- isDisabled,
732
- isSearchEnabled = false,
1131
+ selectedDisplayOverwrite,
1132
+ searchOptions,
1133
+ additionalItems,
733
1134
  className,
734
- selectedDisplayOverwrite
1135
+ triggerClassName,
1136
+ hintTextClassName,
1137
+ ...menuProps
735
1138
  }) => {
736
- const triggerRef = (0, import_react9.useRef)(null);
737
- const menuRef = (0, import_react9.useRef)(null);
738
- const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
739
- useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
740
1139
  const selectedOption = options.find((option) => option.value === value);
741
1140
  if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
742
1141
  console.warn("The selected value is not found in the options list. This might be an error on your part or default behavior if it is complex data type on which === does not work. In case of the latter use selectedDisplayOverwrite to set your selected text or component");
743
1142
  }
744
1143
  const isShowingHint = !selectedDisplayOverwrite && !selectedOption?.label;
745
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: (0, import_clsx6.default)(className), children: [
746
- label && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Label, { ...label, labelType: label.labelType ?? "labelBig", className: (0, import_clsx6.default)("mb-1", label.className) }),
747
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative", children: [
748
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
749
- "button",
750
- {
751
- ref: triggerRef,
752
- className: (0, import_clsx6.default)(
753
- "btn-md justify-between w-full border-2",
754
- {
755
- "rounded-b-lg": !open,
756
- "bg-menu-background border-menu-border hover:border-primary": !isDisabled,
757
- "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
758
- }
759
- ),
760
- onClick: () => setIsOpen(!isOpen),
761
- disabled: isDisabled,
762
- children: [
763
- !isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? selectedOption?.label }),
764
- isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "textstyle-description", children: hintText }),
765
- isOpen ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ChevronUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react3.ChevronDown, {})
766
- ]
767
- }
768
- ),
769
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
770
- "div",
771
- {
772
- ref: menuRef,
773
- 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",
774
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
775
- SearchableList,
776
- {
777
- list: options,
778
- minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
779
- searchMapping: (item) => item.searchTags,
780
- itemMapper: (option, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
781
- Tile,
1144
+ const { result, search, setSearch } = useSearch({
1145
+ list: options,
1146
+ searchMapping: (0, import_react13.useCallback)((item) => item.searchTags, []),
1147
+ ...searchOptions
1148
+ });
1149
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: (0, import_clsx8.default)(className), children: [
1150
+ label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Label, { ...label, labelType: label.labelType ?? "labelBig", className: (0, import_clsx8.default)("mb-1", label.className) }),
1151
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1152
+ Menu,
1153
+ {
1154
+ ...menuProps,
1155
+ trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1156
+ "button",
1157
+ {
1158
+ ref,
1159
+ className: (0, import_clsx8.default)(
1160
+ "btn-md justify-between w-full border-2",
1161
+ {
1162
+ "rounded-b-lg": !open,
1163
+ "bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
1164
+ "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
1165
+ },
1166
+ triggerClassName
1167
+ ),
1168
+ onClick: toggleOpen,
1169
+ disabled,
1170
+ children: [
1171
+ !isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? selectedOption?.label }),
1172
+ isShowingHint && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: (0, import_clsx8.default)("textstyle-description", hintTextClassName), children: hintText }),
1173
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ExpansionIcon, { isExpanded: isOpen })
1174
+ ]
1175
+ }
1176
+ ),
1177
+ menuClassName: (0, import_clsx8.default)("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
1178
+ children: (bag) => {
1179
+ const { close } = bag;
1180
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1181
+ !searchOptions?.disabled && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1182
+ SearchBar,
1183
+ {
1184
+ value: search,
1185
+ onChangeText: setSearch,
1186
+ autoFocus: true
1187
+ }
1188
+ ),
1189
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-col-2 overflow-y-auto", children: [
1190
+ result.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1191
+ SelectTile,
782
1192
  {
783
- isSelected: selectedOption?.value === option.value,
784
- className: "px-2 py-1 rounded-md",
785
- disabledClassName: "text-disabled-text cursor-not-allowed",
786
- title: { value: option.label, className: "font-semibold" },
1193
+ isSelected: option === selectedOption,
1194
+ title: { value: option.label },
787
1195
  onClick: () => {
788
1196
  onChange(option.value);
789
- setIsOpen(false);
1197
+ close();
790
1198
  },
791
- isDisabled: option.disabled
1199
+ disabled: option.disabled
792
1200
  },
793
1201
  index
794
- )
795
- }
796
- )
1202
+ )),
1203
+ additionalItems && additionalItems({ ...bag, search, selected: value })
1204
+ ] })
1205
+ ] });
797
1206
  }
798
- )
799
- ] })
1207
+ }
1208
+ )
800
1209
  ] });
801
1210
  };
802
1211
  var SelectUncontrolled = ({
@@ -806,13 +1215,13 @@ var SelectUncontrolled = ({
806
1215
  hintText,
807
1216
  ...props
808
1217
  }) => {
809
- const [selected, setSelected] = (0, import_react9.useState)(value);
810
- (0, import_react9.useEffect)(() => {
1218
+ const [selected, setSelected] = (0, import_react14.useState)(value);
1219
+ (0, import_react14.useEffect)(() => {
811
1220
  if (options.find((options2) => options2.value === value)) {
812
1221
  setSelected(value);
813
1222
  }
814
1223
  }, [options, value]);
815
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1224
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
816
1225
  Select,
817
1226
  {
818
1227
  value: selected,
@@ -829,6 +1238,7 @@ var SelectUncontrolled = ({
829
1238
  // Annotate the CommonJS export names for ESM import in node:
830
1239
  0 && (module.exports = {
831
1240
  Select,
1241
+ SelectTile,
832
1242
  SelectUncontrolled
833
1243
  });
834
1244
  //# sourceMappingURL=Select.js.map