@helpwave/hightide 0.1.17 → 0.1.19

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