@helpwave/hightide 0.1.18 → 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 (253) 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 -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.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 -28
  106. package/dist/components/modals/InputModal.js.map +1 -1
  107. package/dist/components/modals/InputModal.mjs +18 -14
  108. package/dist/components/modals/InputModal.mjs.map +1 -1
  109. package/dist/components/modals/LanguageModal.js +728 -434
  110. package/dist/components/modals/LanguageModal.js.map +1 -1
  111. package/dist/components/modals/LanguageModal.mjs +728 -430
  112. package/dist/components/modals/LanguageModal.mjs.map +1 -1
  113. package/dist/components/modals/ThemeModal.js +732 -438
  114. package/dist/components/modals/ThemeModal.js.map +1 -1
  115. package/dist/components/modals/ThemeModal.mjs +731 -433
  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 -41
  122. package/dist/components/properties/DateProperty.js.map +1 -1
  123. package/dist/components/properties/DateProperty.mjs +114 -37
  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 -463
  128. package/dist/components/properties/MultiSelectProperty.js.map +1 -1
  129. package/dist/components/properties/MultiSelectProperty.mjs +920 -464
  130. package/dist/components/properties/MultiSelectProperty.mjs.map +1 -1
  131. package/dist/components/properties/NumberProperty.js +101 -18
  132. package/dist/components/properties/NumberProperty.js.map +1 -1
  133. package/dist/components/properties/NumberProperty.mjs +101 -18
  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 -243
  142. package/dist/components/properties/SelectProperty.js.map +1 -1
  143. package/dist/components/properties/SelectProperty.mjs +686 -243
  144. package/dist/components/properties/SelectProperty.mjs.map +1 -1
  145. package/dist/components/properties/TextProperty.js +133 -46
  146. package/dist/components/properties/TextProperty.js.map +1 -1
  147. package/dist/components/properties/TextProperty.mjs +133 -46
  148. package/dist/components/properties/TextProperty.mjs.map +1 -1
  149. package/dist/components/table/Table.js +285 -185
  150. package/dist/components/table/Table.js.map +1 -1
  151. package/dist/components/table/Table.mjs +270 -166
  152. package/dist/components/table/Table.mjs.map +1 -1
  153. package/dist/components/table/TableFilterButton.js +179 -78
  154. package/dist/components/table/TableFilterButton.js.map +1 -1
  155. package/dist/components/table/TableFilterButton.mjs +160 -55
  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/Menu.d.mts +11 -6
  180. package/dist/components/user-action/Menu.d.ts +11 -6
  181. package/dist/components/user-action/Menu.js +128 -31
  182. package/dist/components/user-action/Menu.js.map +1 -1
  183. package/dist/components/user-action/Menu.mjs +134 -33
  184. package/dist/components/user-action/Menu.mjs.map +1 -1
  185. package/dist/components/user-action/MultiSelect.d.mts +17 -7
  186. package/dist/components/user-action/MultiSelect.d.ts +17 -7
  187. package/dist/components/user-action/MultiSelect.js +796 -375
  188. package/dist/components/user-action/MultiSelect.js.map +1 -1
  189. package/dist/components/user-action/MultiSelect.mjs +781 -356
  190. package/dist/components/user-action/MultiSelect.mjs.map +1 -1
  191. package/dist/components/user-action/ScrollPicker.js +2 -2
  192. package/dist/components/user-action/ScrollPicker.js.map +1 -1
  193. package/dist/components/user-action/ScrollPicker.mjs +2 -2
  194. package/dist/components/user-action/ScrollPicker.mjs.map +1 -1
  195. package/dist/components/user-action/SearchBar.d.mts +14 -0
  196. package/dist/components/user-action/SearchBar.d.ts +14 -0
  197. package/dist/components/user-action/SearchBar.js +673 -0
  198. package/dist/components/user-action/SearchBar.js.map +1 -0
  199. package/dist/components/user-action/SearchBar.mjs +637 -0
  200. package/dist/components/user-action/SearchBar.mjs.map +1 -0
  201. package/dist/components/user-action/Select.d.mts +18 -5
  202. package/dist/components/user-action/Select.d.ts +18 -5
  203. package/dist/components/user-action/Select.js +764 -355
  204. package/dist/components/user-action/Select.js.map +1 -1
  205. package/dist/components/user-action/Select.mjs +761 -349
  206. package/dist/components/user-action/Select.mjs.map +1 -1
  207. package/dist/components/user-action/Textarea.d.mts +1 -1
  208. package/dist/components/user-action/Textarea.d.ts +1 -1
  209. package/dist/components/user-action/Textarea.js +13 -3
  210. package/dist/components/user-action/Textarea.js.map +1 -1
  211. package/dist/components/user-action/Textarea.mjs +13 -3
  212. package/dist/components/user-action/Textarea.mjs.map +1 -1
  213. package/dist/components/user-action/ToggleableInput.js +2 -2
  214. package/dist/components/user-action/ToggleableInput.js.map +1 -1
  215. package/dist/components/user-action/ToggleableInput.mjs +2 -2
  216. package/dist/components/user-action/ToggleableInput.mjs.map +1 -1
  217. package/dist/css/globals.css +251 -113
  218. package/dist/css/uncompiled/globals.css +19 -13
  219. package/dist/css/uncompiled/theme/colors-component.css +12 -3
  220. package/dist/css/uncompiled/theme/colors-semantic.css +10 -7
  221. package/dist/css/uncompiled/utitlity/animation.css +70 -1
  222. package/dist/css/uncompiled/utitlity/general.css +16 -0
  223. package/dist/hooks/usePopoverPosition.d.mts +15 -0
  224. package/dist/hooks/usePopoverPosition.d.ts +15 -0
  225. package/dist/hooks/usePopoverPosition.js +81 -0
  226. package/dist/hooks/usePopoverPosition.js.map +1 -0
  227. package/dist/hooks/usePopoverPosition.mjs +57 -0
  228. package/dist/hooks/usePopoverPosition.mjs.map +1 -0
  229. package/dist/hooks/useSearch.d.mts +7 -2
  230. package/dist/hooks/useSearch.d.ts +7 -2
  231. package/dist/hooks/useSearch.js +44 -15
  232. package/dist/hooks/useSearch.js.map +1 -1
  233. package/dist/hooks/useSearch.mjs +45 -16
  234. package/dist/hooks/useSearch.mjs.map +1 -1
  235. package/dist/index.d.mts +6 -4
  236. package/dist/index.d.ts +6 -4
  237. package/dist/index.js +1102 -819
  238. package/dist/index.js.map +1 -1
  239. package/dist/index.mjs +1001 -718
  240. package/dist/index.mjs.map +1 -1
  241. package/dist/localization/defaults/form.d.mts +2 -0
  242. package/dist/localization/defaults/form.d.ts +2 -0
  243. package/dist/localization/defaults/form.js +4 -0
  244. package/dist/localization/defaults/form.js.map +1 -1
  245. package/dist/localization/defaults/form.mjs +4 -0
  246. package/dist/localization/defaults/form.mjs.map +1 -1
  247. package/dist/util/simpleSearch.d.mts +1 -1
  248. package/dist/util/simpleSearch.d.ts +1 -1
  249. package/dist/util/simpleSearch.js +4 -1
  250. package/dist/util/simpleSearch.js.map +1 -1
  251. package/dist/util/simpleSearch.mjs +4 -1
  252. package/dist/util/simpleSearch.mjs.map +1 -1
  253. 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,12 +452,12 @@ 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);
@@ -190,13 +466,10 @@ function useDelay(options) {
190
466
  return { restartTimer, clearTimer, hasActiveTimer: !!timer };
191
467
  }
192
468
 
193
- // src/util/noop.ts
194
- var noop = () => void 0;
195
-
196
469
  // src/hooks/useFocusManagement.ts
197
- var import_react4 = require("react");
470
+ var import_react6 = require("react");
198
471
  function useFocusManagement() {
199
- const getFocusableElements = (0, import_react4.useCallback)(() => {
472
+ const getFocusableElements = (0, import_react6.useCallback)(() => {
200
473
  return Array.from(
201
474
  document.querySelectorAll(
202
475
  'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
@@ -205,7 +478,7 @@ function useFocusManagement() {
205
478
  (el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
206
479
  );
207
480
  }, []);
208
- const getNextFocusElement = (0, import_react4.useCallback)(() => {
481
+ const getNextFocusElement = (0, import_react6.useCallback)(() => {
209
482
  const elements = getFocusableElements();
210
483
  if (elements.length === 0) {
211
484
  return void 0;
@@ -217,11 +490,11 @@ function useFocusManagement() {
217
490
  }
218
491
  return nextElement;
219
492
  }, [getFocusableElements]);
220
- const focusNext = (0, import_react4.useCallback)(() => {
493
+ const focusNext = (0, import_react6.useCallback)(() => {
221
494
  const nextElement = getNextFocusElement();
222
495
  nextElement?.focus();
223
496
  }, [getNextFocusElement]);
224
- const getPreviousFocusElement = (0, import_react4.useCallback)(() => {
497
+ const getPreviousFocusElement = (0, import_react6.useCallback)(() => {
225
498
  const elements = getFocusableElements();
226
499
  if (elements.length === 0) {
227
500
  return void 0;
@@ -237,7 +510,7 @@ function useFocusManagement() {
237
510
  }
238
511
  return previousElement;
239
512
  }, [getFocusableElements]);
240
- const focusPrevious = (0, import_react4.useCallback)(() => {
513
+ const focusPrevious = (0, import_react6.useCallback)(() => {
241
514
  const previousElement = getPreviousFocusElement();
242
515
  if (previousElement) previousElement.focus();
243
516
  }, [getPreviousFocusElement]);
@@ -251,10 +524,10 @@ function useFocusManagement() {
251
524
  }
252
525
 
253
526
  // src/hooks/useFocusOnceVisible.ts
254
- var import_react5 = __toESM(require("react"));
527
+ var import_react7 = __toESM(require("react"));
255
528
  var useFocusOnceVisible = (ref, disable = false) => {
256
- const [hasUsedFocus, setHasUsedFocus] = import_react5.default.useState(false);
257
- (0, import_react5.useEffect)(() => {
529
+ const [hasUsedFocus, setHasUsedFocus] = import_react7.default.useState(false);
530
+ (0, import_react7.useEffect)(() => {
258
531
  if (disable || hasUsedFocus) {
259
532
  return;
260
533
  }
@@ -274,9 +547,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
274
547
  };
275
548
 
276
549
  // src/components/user-action/Input.tsx
277
- var import_jsx_runtime3 = require("react/jsx-runtime");
550
+ var import_jsx_runtime5 = require("react/jsx-runtime");
278
551
  var getInputClassName = ({ disabled = false, hasError = false }) => {
279
- return (0, import_clsx2.default)(
552
+ return (0, import_clsx5.default)(
280
553
  "px-2 py-1.5 rounded-md border-2",
281
554
  {
282
555
  "bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
@@ -290,7 +563,7 @@ var defaultEditCompleteOptions = {
290
563
  afterDelay: true,
291
564
  delay: 2500
292
565
  };
293
- var Input = (0, import_react6.forwardRef)(function Input2({
566
+ var Input = (0, import_react8.forwardRef)(function Input2({
294
567
  id,
295
568
  type = "text",
296
569
  value,
@@ -313,10 +586,10 @@ var Input = (0, import_react6.forwardRef)(function Input2({
313
586
  restartTimer,
314
587
  clearTimer
315
588
  } = useDelay({ delay, disabled: !afterDelay });
316
- const innerRef = (0, import_react6.useRef)(null);
589
+ const innerRef = (0, import_react8.useRef)(null);
317
590
  const { focusNext } = useFocusManagement();
318
591
  useFocusOnceVisible(innerRef, !autoFocus);
319
- (0, import_react6.useImperativeHandle)(forwardedRef, () => innerRef.current);
592
+ (0, import_react8.useImperativeHandle)(forwardedRef, () => innerRef.current);
320
593
  const handleKeyDown = (e) => {
321
594
  if (e.key === "Enter" && !e.shiftKey) {
322
595
  e.preventDefault();
@@ -324,9 +597,9 @@ var Input = (0, import_react6.forwardRef)(function Input2({
324
597
  focusNext();
325
598
  }
326
599
  };
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)(
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)(
330
603
  "input",
331
604
  {
332
605
  ...restProps,
@@ -335,7 +608,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
335
608
  id,
336
609
  type,
337
610
  disabled,
338
- className: (0, import_clsx2.default)(getInputClassName({ disabled }), className),
611
+ className: (0, import_clsx5.default)(getInputClassName({ disabled }), className),
339
612
  onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
340
613
  onBlur: (event) => {
341
614
  onBlur?.(event);
@@ -365,7 +638,7 @@ var Input = (0, import_react6.forwardRef)(function Input2({
365
638
  )
366
639
  ] });
367
640
  });
368
- var FormInput = (0, import_react6.forwardRef)(function FormInput2({
641
+ var FormInput = (0, import_react8.forwardRef)(function FormInput2({
369
642
  id,
370
643
  labelText,
371
644
  errorText,
@@ -377,137 +650,120 @@ var FormInput = (0, import_react6.forwardRef)(function FormInput2({
377
650
  disabled,
378
651
  ...restProps
379
652
  }, ref) {
380
- const input = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
653
+ const input = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
381
654
  "input",
382
655
  {
383
656
  ...restProps,
384
657
  ref,
385
658
  id,
386
659
  disabled,
387
- className: (0, import_clsx2.default)(
660
+ className: (0, import_clsx5.default)(
388
661
  getInputClassName({ disabled, hasError: !!errorText }),
389
662
  className
390
663
  )
391
664
  }
392
665
  );
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: [
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: [
395
668
  labelText,
396
- 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: "*" })
397
670
  ] }),
398
671
  input,
399
- 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 })
400
673
  ] });
401
674
  });
402
675
 
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"]
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"
410
687
  };
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
- );
688
+ var DEFAULT_LANGUAGE = "en";
689
+ var LanguageUtil = {
690
+ languages,
691
+ DEFAULT_LANGUAGE,
692
+ languagesLocalNames
467
693
  };
468
694
 
469
- // src/hooks/useSearch.ts
470
- 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);
471
702
 
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
- });
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
481
711
  };
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
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}}}`;
505
760
  };
506
761
  };
507
762
 
508
763
  // src/localization/defaults/form.ts
509
764
  var formTranslation = {
510
765
  en: {
766
+ add: "Add",
511
767
  all: "All",
512
768
  apply: "Apply",
513
769
  back: "Back",
@@ -520,6 +776,7 @@ var formTranslation = {
520
776
  confirm: "Confirm",
521
777
  copy: "Copy",
522
778
  copied: "Copied",
779
+ create: "Create",
523
780
  decline: "Decline",
524
781
  delete: "Delete",
525
782
  discard: "Discard",
@@ -562,6 +819,7 @@ var formTranslation = {
562
819
  yes: "Yes"
563
820
  },
564
821
  de: {
822
+ add: "Hinzuf\xFCgen",
565
823
  all: "Alle",
566
824
  apply: "Anwenden",
567
825
  back: "Zur\xFCck",
@@ -574,6 +832,7 @@ var formTranslation = {
574
832
  confirm: "Best\xE4tigen",
575
833
  copy: "Kopieren",
576
834
  copied: "Kopiert",
835
+ create: "Erstellen",
577
836
  decline: "Ablehnen",
578
837
  delete: "L\xF6schen",
579
838
  discard: "Verwerfen",
@@ -617,186 +876,335 @@ var formTranslation = {
617
876
  }
618
877
  };
619
878
 
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
- }
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"]
629
887
  };
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
- ] });
888
+ var IconButtonUtil = {
889
+ icon: [...ButtonColorUtil.solid, "transparent"]
659
890
  };
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,
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,
668
913
  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",
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",
680
937
  {
681
- className: (0, import_clsx5.default)(
682
- "row gap-x-2 w-full items-center",
938
+ ref,
939
+ onClick,
940
+ disabled,
941
+ className: (0, import_clsx6.default)(
683
942
  {
684
- [normalClassName]: !!onClick && !isDisabled,
685
- [selectedClassName]: isSelected && !isDisabled,
686
- [disabledClassName]: isDisabled
943
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
944
+ [(0, import_clsx6.default)(colorClasses, "hover:brightness-90")]: !disabled
687
945
  },
946
+ ButtonUtil.paddingMapping[size],
688
947
  className
689
948
  ),
690
- onClick: isDisabled ? void 0 : onClick,
949
+ ...restProps,
691
950
  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)
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
+ )
698
972
  ]
699
973
  }
700
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
+ );
701
1012
  };
702
1013
 
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;
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")
711
1032
  }
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]);
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
+ };
721
1104
  };
722
1105
 
723
1106
  // src/components/user-action/Select.tsx
724
- 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
+ };
725
1124
  var Select = ({
726
1125
  value,
727
1126
  label,
728
1127
  options,
729
1128
  onChange,
730
1129
  hintText = "",
731
- isDisabled,
732
- isSearchEnabled = false,
1130
+ selectedDisplayOverwrite,
1131
+ searchOptions,
1132
+ additionalItems,
733
1133
  className,
734
- selectedDisplayOverwrite
1134
+ triggerClassName,
1135
+ hintTextClassName,
1136
+ ...menuProps
735
1137
  }) => {
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
1138
  const selectedOption = options.find((option) => option.value === value);
741
1139
  if (value !== void 0 && selectedOption === void 0 && selectedDisplayOverwrite === void 0) {
742
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");
743
1141
  }
744
1142
  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,
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,
782
1191
  {
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" },
1192
+ isSelected: option === selectedOption,
1193
+ title: { value: option.label },
787
1194
  onClick: () => {
788
1195
  onChange(option.value);
789
- setIsOpen(false);
1196
+ close();
790
1197
  },
791
- isDisabled: option.disabled
1198
+ disabled: option.disabled
792
1199
  },
793
1200
  index
794
- )
795
- }
796
- )
1201
+ )),
1202
+ additionalItems && additionalItems({ ...bag, search, selected: value })
1203
+ ] })
1204
+ ] });
797
1205
  }
798
- )
799
- ] })
1206
+ }
1207
+ )
800
1208
  ] });
801
1209
  };
802
1210
  var SelectUncontrolled = ({
@@ -806,13 +1214,13 @@ var SelectUncontrolled = ({
806
1214
  hintText,
807
1215
  ...props
808
1216
  }) => {
809
- const [selected, setSelected] = (0, import_react9.useState)(value);
810
- (0, import_react9.useEffect)(() => {
1217
+ const [selected, setSelected] = (0, import_react14.useState)(value);
1218
+ (0, import_react14.useEffect)(() => {
811
1219
  if (options.find((options2) => options2.value === value)) {
812
1220
  setSelected(value);
813
1221
  }
814
1222
  }, [options, value]);
815
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1223
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
816
1224
  Select,
817
1225
  {
818
1226
  value: selected,
@@ -829,6 +1237,7 @@ var SelectUncontrolled = ({
829
1237
  // Annotate the CommonJS export names for ESM import in node:
830
1238
  0 && (module.exports = {
831
1239
  Select,
1240
+ SelectTile,
832
1241
  SelectUncontrolled
833
1242
  });
834
1243
  //# sourceMappingURL=Select.js.map