@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
@@ -1,6 +1,6 @@
1
1
  // src/components/properties/MultiSelectProperty.tsx
2
- import { List } from "lucide-react";
3
- import clsx9 from "clsx";
2
+ import { List, Plus as Plus2 } from "lucide-react";
3
+ import clsx13 from "clsx";
4
4
 
5
5
  // src/localization/LanguageProvider.tsx
6
6
  import { createContext, useContext, useEffect as useEffect2, useState as useState2 } from "react";
@@ -90,9 +90,9 @@ var useTranslation = (translations, overwriteTranslation = {}) => {
90
90
  };
91
91
 
92
92
  // src/components/user-action/MultiSelect.tsx
93
- import { useEffect as useEffect8, useRef as useRef2, useState as useState6 } from "react";
94
- import { ChevronDown, ChevronUp } from "lucide-react";
95
- import clsx7 from "clsx";
93
+ import { useCallback as useCallback6 } from "react";
94
+ import { useEffect as useEffect12, useState as useState11 } from "react";
95
+ import clsx11 from "clsx";
96
96
 
97
97
  // src/components/user-action/Label.tsx
98
98
  import clsx from "clsx";
@@ -112,22 +112,393 @@ var Label = ({
112
112
  return /* @__PURE__ */ jsx2("label", { ...props, className: clsx(styleMapping[labelType], className), children: children ? children : name });
113
113
  };
114
114
 
115
- // src/components/layout-and-navigation/SearchableList.tsx
116
- import { Search } from "lucide-react";
115
+ // src/components/user-action/Select.tsx
116
+ import { useCallback as useCallback5 } from "react";
117
+ import { useEffect as useEffect11, useState as useState9 } from "react";
118
+ import clsx8 from "clsx";
119
+
120
+ // src/components/layout-and-navigation/Tile.tsx
121
+ import clsx2 from "clsx";
122
+ import { Check } from "lucide-react";
123
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
124
+ var Tile = ({
125
+ title,
126
+ description,
127
+ onClick,
128
+ isSelected = false,
129
+ disabled = false,
130
+ prefix,
131
+ suffix,
132
+ normalClassName = "hover:bg-primary/40 cursor-pointer",
133
+ selectedClassName = " bg-primary/20",
134
+ disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
135
+ className
136
+ }) => {
137
+ return /* @__PURE__ */ jsxs(
138
+ "div",
139
+ {
140
+ className: clsx2(
141
+ "flex-row-2 w-full items-center",
142
+ {
143
+ [normalClassName]: !!onClick && !disabled,
144
+ [selectedClassName]: isSelected && !disabled,
145
+ [disabledClassName]: disabled
146
+ },
147
+ className
148
+ ),
149
+ onClick: disabled ? void 0 : onClick,
150
+ children: [
151
+ prefix,
152
+ /* @__PURE__ */ jsxs("div", { className: "flex-col-0 w-full", children: [
153
+ /* @__PURE__ */ jsx3("h4", { className: clsx2(title.className ?? "textstyle-title-normal"), children: title.value }),
154
+ !!description && /* @__PURE__ */ jsx3("span", { className: clsx2(description.className ?? "textstyle-description"), children: description.value })
155
+ ] }),
156
+ suffix ?? (isSelected ? /* @__PURE__ */ jsx3(Check, { size: 24 }) : void 0)
157
+ ]
158
+ }
159
+ );
160
+ };
161
+
162
+ // src/components/layout-and-navigation/Expandable.tsx
163
+ import { forwardRef, useCallback as useCallback2, useEffect as useEffect3, useState as useState3 } from "react";
164
+ import { ChevronDown } from "lucide-react";
165
+ import clsx3 from "clsx";
166
+
167
+ // src/util/noop.ts
168
+ var noop = () => void 0;
169
+
170
+ // src/components/layout-and-navigation/Expandable.tsx
171
+ import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
172
+ var ExpansionIcon = ({ isExpanded, className }) => {
173
+ return /* @__PURE__ */ jsx4(
174
+ ChevronDown,
175
+ {
176
+ className: clsx3(
177
+ "min-w-6 w-6 min-h-6 h-6 transition-transform duration-200 ease-in-out",
178
+ { "rotate-180": isExpanded },
179
+ className
180
+ )
181
+ }
182
+ );
183
+ };
184
+ var Expandable = forwardRef(function Expandable2({
185
+ children,
186
+ label,
187
+ icon,
188
+ isExpanded = false,
189
+ onChange = noop,
190
+ clickOnlyOnHeader = true,
191
+ disabled = false,
192
+ className,
193
+ headerClassName,
194
+ contentClassName
195
+ }, ref) {
196
+ const defaultIcon = useCallback2((expanded) => /* @__PURE__ */ jsx4(ExpansionIcon, { isExpanded: expanded }), []);
197
+ icon ??= defaultIcon;
198
+ return /* @__PURE__ */ jsxs2(
199
+ "div",
200
+ {
201
+ ref,
202
+ className: clsx3("flex-col-0 bg-surface text-on-surface group rounded-lg shadow-sm", { "cursor-pointer": !clickOnlyOnHeader && !disabled }, className),
203
+ onClick: () => !clickOnlyOnHeader && !disabled && onChange(!isExpanded),
204
+ children: [
205
+ /* @__PURE__ */ jsxs2(
206
+ "div",
207
+ {
208
+ className: clsx3(
209
+ "flex-row-2 py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none",
210
+ {
211
+ "group-hover:brightness-97": !isExpanded,
212
+ "hover:brightness-97": isExpanded && !disabled,
213
+ "cursor-pointer": clickOnlyOnHeader && !disabled
214
+ },
215
+ headerClassName
216
+ ),
217
+ onClick: () => clickOnlyOnHeader && !disabled && onChange(!isExpanded),
218
+ children: [
219
+ label,
220
+ icon(isExpanded)
221
+ ]
222
+ }
223
+ ),
224
+ /* @__PURE__ */ jsx4(
225
+ "div",
226
+ {
227
+ className: clsx3(
228
+ "flex-col-2 px-4 transition-all duration-300 ease-in-out",
229
+ {
230
+ "max-h-96 opacity-100 pb-2": isExpanded,
231
+ "max-h-0 opacity-0 overflow-hidden": !isExpanded
232
+ },
233
+ contentClassName
234
+ ),
235
+ children
236
+ }
237
+ )
238
+ ]
239
+ }
240
+ );
241
+ });
242
+ var ExpandableUncontrolled = forwardRef(function ExpandableUncontrolled2({
243
+ isExpanded,
244
+ onChange = noop,
245
+ ...props
246
+ }, ref) {
247
+ const [usedIsExpanded, setUsedIsExpanded] = useState3(isExpanded);
248
+ useEffect3(() => {
249
+ setUsedIsExpanded(isExpanded);
250
+ }, [isExpanded]);
251
+ return /* @__PURE__ */ jsx4(
252
+ Expandable,
253
+ {
254
+ ...props,
255
+ ref,
256
+ isExpanded: usedIsExpanded,
257
+ onChange: (value) => {
258
+ onChange(value);
259
+ setUsedIsExpanded(value);
260
+ }
261
+ }
262
+ );
263
+ });
264
+
265
+ // src/components/user-action/Menu.tsx
266
+ import {
267
+ useEffect as useEffect6,
268
+ useRef,
269
+ useState as useState5
270
+ } from "react";
117
271
  import clsx4 from "clsx";
118
272
 
273
+ // src/hooks/useOutsideClick.ts
274
+ import { useEffect as useEffect4 } from "react";
275
+ var useOutsideClick = (refs, handler) => {
276
+ useEffect4(() => {
277
+ const listener = (event) => {
278
+ if (event.target === null) return;
279
+ if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
280
+ return;
281
+ }
282
+ handler();
283
+ };
284
+ document.addEventListener("mousedown", listener);
285
+ document.addEventListener("touchstart", listener);
286
+ return () => {
287
+ document.removeEventListener("mousedown", listener);
288
+ document.removeEventListener("touchstart", listener);
289
+ };
290
+ }, [refs, handler]);
291
+ };
292
+
293
+ // src/hooks/useHoverState.ts
294
+ import { useEffect as useEffect5, useState as useState4 } from "react";
295
+ var defaultUseHoverStateProps = {
296
+ closingDelay: 200,
297
+ isDisabled: false
298
+ };
299
+ var useHoverState = (props = void 0) => {
300
+ const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props };
301
+ const [isHovered, setIsHovered] = useState4(false);
302
+ const [timer, setTimer] = useState4();
303
+ const onMouseEnter = () => {
304
+ if (isDisabled) {
305
+ return;
306
+ }
307
+ clearTimeout(timer);
308
+ setIsHovered(true);
309
+ };
310
+ const onMouseLeave = () => {
311
+ if (isDisabled) {
312
+ return;
313
+ }
314
+ setTimer(setTimeout(() => {
315
+ setIsHovered(false);
316
+ }, closingDelay));
317
+ };
318
+ useEffect5(() => {
319
+ if (timer) {
320
+ return () => {
321
+ clearTimeout(timer);
322
+ };
323
+ }
324
+ });
325
+ useEffect5(() => {
326
+ if (timer) {
327
+ clearTimeout(timer);
328
+ }
329
+ }, [isDisabled]);
330
+ return {
331
+ isHovered,
332
+ setIsHovered,
333
+ handlers: { onMouseEnter, onMouseLeave }
334
+ };
335
+ };
336
+
337
+ // src/util/PropsWithFunctionChildren.ts
338
+ var resolve = (children, bag) => {
339
+ if (typeof children === "function") {
340
+ return children(bag);
341
+ }
342
+ return children ?? void 0;
343
+ };
344
+ var BagFunctionUtil = {
345
+ resolve
346
+ };
347
+
348
+ // src/hooks/usePopoverPosition.ts
349
+ var defaultPopoverPositionOptions = {
350
+ edgePadding: 16,
351
+ outerGap: 4,
352
+ horizontalAlignment: "leftInside",
353
+ verticalAlignment: "bottomOutside",
354
+ disabled: false
355
+ };
356
+ var usePopoverPosition = (trigger, options) => {
357
+ const {
358
+ edgePadding,
359
+ outerGap,
360
+ verticalAlignment,
361
+ horizontalAlignment,
362
+ disabled
363
+ } = { ...defaultPopoverPositionOptions, ...options };
364
+ if (disabled || !trigger) {
365
+ return {};
366
+ }
367
+ const left = {
368
+ leftOutside: trigger.left - outerGap,
369
+ leftInside: trigger.left,
370
+ rightOutside: trigger.right + outerGap,
371
+ rightInside: trigger.right,
372
+ center: trigger.left + trigger.width / 2
373
+ }[horizontalAlignment];
374
+ const top = {
375
+ topOutside: trigger.top - outerGap,
376
+ topInside: trigger.top,
377
+ bottomOutside: trigger.bottom + outerGap,
378
+ bottomInside: trigger.bottom,
379
+ center: trigger.top + trigger.height / 2
380
+ }[verticalAlignment];
381
+ const translateX = {
382
+ leftOutside: "-100%",
383
+ leftInside: void 0,
384
+ rightOutside: void 0,
385
+ rightInside: "-100%",
386
+ center: "-50%"
387
+ }[horizontalAlignment];
388
+ const translateY = {
389
+ topOutside: "-100%",
390
+ topInside: void 0,
391
+ bottomOutside: void 0,
392
+ bottomInside: "-100%",
393
+ center: "-50%"
394
+ }[verticalAlignment];
395
+ return {
396
+ left: Math.max(left, edgePadding),
397
+ top: Math.max(top, edgePadding),
398
+ translate: [translateX ?? "0", translateY ?? "0"].join(" ")
399
+ };
400
+ };
401
+
402
+ // src/components/user-action/Menu.tsx
403
+ import { createPortal } from "react-dom";
404
+ import { Fragment, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
405
+ function getScrollableParents(element) {
406
+ const scrollables = [];
407
+ let parent = element.parentElement;
408
+ while (parent) {
409
+ scrollables.push(parent);
410
+ parent = parent.parentElement;
411
+ }
412
+ return scrollables;
413
+ }
414
+ var Menu = ({
415
+ trigger,
416
+ children,
417
+ alignmentHorizontal = "leftInside",
418
+ alignmentVertical = "bottomOutside",
419
+ showOnHover = false,
420
+ disabled = false,
421
+ menuClassName = ""
422
+ }) => {
423
+ const { isHovered: isOpen, setIsHovered: setIsOpen } = useHoverState({ isDisabled: !showOnHover || disabled });
424
+ const triggerRef = useRef(null);
425
+ const menuRef = useRef(null);
426
+ useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
427
+ const [isHidden, setIsHidden] = useState5(true);
428
+ const bag = {
429
+ isOpen,
430
+ close: () => setIsOpen(false),
431
+ toggleOpen: () => setIsOpen((prevState) => !prevState),
432
+ disabled
433
+ };
434
+ const menuPosition = usePopoverPosition(
435
+ triggerRef.current?.getBoundingClientRect(),
436
+ { verticalAlignment: alignmentVertical, horizontalAlignment: alignmentHorizontal, disabled }
437
+ );
438
+ useEffect6(() => {
439
+ if (!isOpen) return;
440
+ const triggerEl = triggerRef.current;
441
+ if (!triggerEl) return;
442
+ const scrollableParents = getScrollableParents(triggerEl);
443
+ const close = () => setIsOpen(false);
444
+ scrollableParents.forEach((parent) => {
445
+ parent.addEventListener("scroll", close);
446
+ });
447
+ window.addEventListener("resize", close);
448
+ return () => {
449
+ scrollableParents.forEach((parent) => {
450
+ parent.removeEventListener("scroll", close);
451
+ });
452
+ window.removeEventListener("resize", close);
453
+ };
454
+ }, [isOpen, setIsOpen]);
455
+ useEffect6(() => {
456
+ if (isOpen) {
457
+ setIsHidden(false);
458
+ }
459
+ }, [isOpen]);
460
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
461
+ trigger(bag, triggerRef),
462
+ createPortal(/* @__PURE__ */ jsx5(
463
+ "div",
464
+ {
465
+ ref: menuRef,
466
+ onClick: (e) => e.stopPropagation(),
467
+ className: clsx4(
468
+ "absolute rounded-md bg-menu-background text-menu-text shadow-around-lg z-10",
469
+ {
470
+ "animate-pop-in": isOpen,
471
+ "animate-pop-out": !isOpen,
472
+ "hidden": isHidden
473
+ },
474
+ menuClassName
475
+ ),
476
+ onAnimationEnd: () => {
477
+ if (!isOpen) {
478
+ setIsHidden(true);
479
+ }
480
+ },
481
+ style: {
482
+ ...menuPosition
483
+ },
484
+ children: BagFunctionUtil.resolve(children, bag)
485
+ }
486
+ ), document.body)
487
+ ] });
488
+ };
489
+
119
490
  // src/components/user-action/Input.tsx
120
- import { forwardRef, useEffect as useEffect5, useImperativeHandle, useRef, useState as useState4 } from "react";
121
- import clsx2 from "clsx";
491
+ import { forwardRef as forwardRef2, useEffect as useEffect9, useImperativeHandle, useRef as useRef2, useState as useState7 } from "react";
492
+ import clsx5 from "clsx";
122
493
 
123
494
  // src/hooks/useDelay.ts
124
- import { useEffect as useEffect3, useState as useState3 } from "react";
495
+ import { useEffect as useEffect7, useState as useState6 } from "react";
125
496
  var defaultOptions = {
126
497
  delay: 3e3,
127
498
  disabled: false
128
499
  };
129
500
  function useDelay(options) {
130
- const [timer, setTimer] = useState3(void 0);
501
+ const [timer, setTimer] = useState6(void 0);
131
502
  const { delay, disabled } = {
132
503
  ...defaultOptions,
133
504
  ...options
@@ -146,28 +517,24 @@ function useDelay(options) {
146
517
  setTimer(void 0);
147
518
  }, delay));
148
519
  };
149
- useEffect3(() => {
520
+ useEffect7(() => {
150
521
  return () => {
151
522
  clearTimeout(timer);
152
523
  };
153
524
  }, [timer]);
154
- useEffect3(() => {
525
+ useEffect7(() => {
155
526
  if (disabled) {
156
527
  clearTimeout(timer);
157
528
  setTimer(void 0);
158
529
  }
159
530
  }, [disabled, timer]);
160
- console.log(timer);
161
531
  return { restartTimer, clearTimer, hasActiveTimer: !!timer };
162
532
  }
163
533
 
164
- // src/util/noop.ts
165
- var noop = () => void 0;
166
-
167
534
  // src/hooks/useFocusManagement.ts
168
- import { useCallback as useCallback2 } from "react";
535
+ import { useCallback as useCallback3 } from "react";
169
536
  function useFocusManagement() {
170
- const getFocusableElements = useCallback2(() => {
537
+ const getFocusableElements = useCallback3(() => {
171
538
  return Array.from(
172
539
  document.querySelectorAll(
173
540
  'input, button, select, textarea, a[href], [tabindex]:not([tabindex="-1"])'
@@ -176,7 +543,7 @@ function useFocusManagement() {
176
543
  (el) => el instanceof HTMLElement && !el.hasAttribute("disabled") && !el.hasAttribute("hidden") && el.tabIndex !== -1
177
544
  );
178
545
  }, []);
179
- const getNextFocusElement = useCallback2(() => {
546
+ const getNextFocusElement = useCallback3(() => {
180
547
  const elements = getFocusableElements();
181
548
  if (elements.length === 0) {
182
549
  return void 0;
@@ -188,11 +555,11 @@ function useFocusManagement() {
188
555
  }
189
556
  return nextElement;
190
557
  }, [getFocusableElements]);
191
- const focusNext = useCallback2(() => {
558
+ const focusNext = useCallback3(() => {
192
559
  const nextElement = getNextFocusElement();
193
560
  nextElement?.focus();
194
561
  }, [getNextFocusElement]);
195
- const getPreviousFocusElement = useCallback2(() => {
562
+ const getPreviousFocusElement = useCallback3(() => {
196
563
  const elements = getFocusableElements();
197
564
  if (elements.length === 0) {
198
565
  return void 0;
@@ -208,7 +575,7 @@ function useFocusManagement() {
208
575
  }
209
576
  return previousElement;
210
577
  }, [getFocusableElements]);
211
- const focusPrevious = useCallback2(() => {
578
+ const focusPrevious = useCallback3(() => {
212
579
  const previousElement = getPreviousFocusElement();
213
580
  if (previousElement) previousElement.focus();
214
581
  }, [getPreviousFocusElement]);
@@ -222,10 +589,10 @@ function useFocusManagement() {
222
589
  }
223
590
 
224
591
  // src/hooks/useFocusOnceVisible.ts
225
- import React, { useEffect as useEffect4 } from "react";
592
+ import React, { useEffect as useEffect8 } from "react";
226
593
  var useFocusOnceVisible = (ref, disable = false) => {
227
594
  const [hasUsedFocus, setHasUsedFocus] = React.useState(false);
228
- useEffect4(() => {
595
+ useEffect8(() => {
229
596
  if (disable || hasUsedFocus) {
230
597
  return;
231
598
  }
@@ -245,9 +612,9 @@ var useFocusOnceVisible = (ref, disable = false) => {
245
612
  };
246
613
 
247
614
  // src/components/user-action/Input.tsx
248
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
615
+ import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
249
616
  var getInputClassName = ({ disabled = false, hasError = false }) => {
250
- return clsx2(
617
+ return clsx5(
251
618
  "px-2 py-1.5 rounded-md border-2",
252
619
  {
253
620
  "bg-surface text-on-surface hover:border-primary focus:border-primary": !disabled && !hasError,
@@ -261,7 +628,7 @@ var defaultEditCompleteOptions = {
261
628
  afterDelay: true,
262
629
  delay: 2500
263
630
  };
264
- var Input = forwardRef(function Input2({
631
+ var Input = forwardRef2(function Input2({
265
632
  id,
266
633
  type = "text",
267
634
  value,
@@ -284,7 +651,7 @@ var Input = forwardRef(function Input2({
284
651
  restartTimer,
285
652
  clearTimer
286
653
  } = useDelay({ delay, disabled: !afterDelay });
287
- const innerRef = useRef(null);
654
+ const innerRef = useRef2(null);
288
655
  const { focusNext } = useFocusManagement();
289
656
  useFocusOnceVisible(innerRef, !autoFocus);
290
657
  useImperativeHandle(forwardedRef, () => innerRef.current);
@@ -295,9 +662,9 @@ var Input = forwardRef(function Input2({
295
662
  focusNext();
296
663
  }
297
664
  };
298
- return /* @__PURE__ */ jsxs("div", { className: clsx2({ "w-full": expanded }, containerClassName), children: [
299
- label && /* @__PURE__ */ jsx3(Label, { ...label, htmlFor: id, className: clsx2("mb-1", label.className) }),
300
- /* @__PURE__ */ jsx3(
665
+ return /* @__PURE__ */ jsxs4("div", { className: clsx5({ "w-full": expanded }, containerClassName), children: [
666
+ label && /* @__PURE__ */ jsx6(Label, { ...label, htmlFor: id, className: clsx5("mb-1", label.className) }),
667
+ /* @__PURE__ */ jsx6(
301
668
  "input",
302
669
  {
303
670
  ...restProps,
@@ -306,7 +673,7 @@ var Input = forwardRef(function Input2({
306
673
  id,
307
674
  type,
308
675
  disabled,
309
- className: clsx2(getInputClassName({ disabled }), className),
676
+ className: clsx5(getInputClassName({ disabled }), className),
310
677
  onKeyDown: allowEnterComplete ? handleKeyDown : void 0,
311
678
  onBlur: (event) => {
312
679
  onBlur?.(event);
@@ -336,7 +703,7 @@ var Input = forwardRef(function Input2({
336
703
  )
337
704
  ] });
338
705
  });
339
- var FormInput = forwardRef(function FormInput2({
706
+ var FormInput = forwardRef2(function FormInput2({
340
707
  id,
341
708
  labelText,
342
709
  errorText,
@@ -348,267 +715,33 @@ var FormInput = forwardRef(function FormInput2({
348
715
  disabled,
349
716
  ...restProps
350
717
  }, ref) {
351
- const input = /* @__PURE__ */ jsx3(
718
+ const input = /* @__PURE__ */ jsx6(
352
719
  "input",
353
720
  {
354
721
  ...restProps,
355
722
  ref,
356
723
  id,
357
724
  disabled,
358
- className: clsx2(
725
+ className: clsx5(
359
726
  getInputClassName({ disabled, hasError: !!errorText }),
360
727
  className
361
728
  )
362
729
  }
363
730
  );
364
- return /* @__PURE__ */ jsxs("div", { className: clsx2("flex flex-col gap-y-1", containerClassName), children: [
365
- labelText && /* @__PURE__ */ jsxs("label", { htmlFor: id, className: clsx2("textstyle-label-md", labelClassName), children: [
731
+ return /* @__PURE__ */ jsxs4("div", { className: clsx5("flex flex-col gap-y-1", containerClassName), children: [
732
+ labelText && /* @__PURE__ */ jsxs4("label", { htmlFor: id, className: clsx5("textstyle-label-md", labelClassName), children: [
366
733
  labelText,
367
- required && /* @__PURE__ */ jsx3("span", { className: "text-primary font-bold", children: "*" })
734
+ required && /* @__PURE__ */ jsx6("span", { className: "text-primary font-bold", children: "*" })
368
735
  ] }),
369
736
  input,
370
- errorText && /* @__PURE__ */ jsx3("label", { htmlFor: id, className: clsx2("text-negative", errorClassName), children: errorText })
737
+ errorText && /* @__PURE__ */ jsx6("label", { htmlFor: id, className: clsx5("text-negative", errorClassName), children: errorText })
371
738
  ] });
372
739
  });
373
740
 
374
- // src/components/user-action/Button.tsx
375
- import clsx3 from "clsx";
376
- import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
377
- var ButtonColorUtil = {
378
- solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
379
- text: ["primary", "negative", "neutral"],
380
- outline: ["primary"]
381
- };
382
- var IconButtonUtil = {
383
- icon: [...ButtonColorUtil.solid, "transparent"]
384
- };
385
- var paddingMapping = {
386
- small: "btn-sm",
387
- medium: "btn-md",
388
- large: "btn-lg"
389
- };
390
- var iconPaddingMapping = {
391
- tiny: "icon-btn-xs",
392
- small: "icon-btn-sm",
393
- medium: "icon-btn-md",
394
- large: "icon-btn-lg"
395
- };
396
- var ButtonUtil = {
397
- paddingMapping,
398
- iconPaddingMapping
399
- };
400
- var SolidButton = ({
401
- children,
402
- disabled = false,
403
- color = "primary",
404
- size = "medium",
405
- startIcon,
406
- endIcon,
407
- onClick,
408
- className,
409
- ...restProps
410
- }) => {
411
- const colorClasses = {
412
- primary: "bg-button-solid-primary-background text-button-solid-primary-text",
413
- secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
414
- tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
415
- positive: "bg-button-solid-positive-background text-button-solid-positive-text",
416
- warning: "bg-button-solid-warning-background text-button-solid-warning-text",
417
- negative: "bg-button-solid-negative-background text-button-solid-negative-text",
418
- neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
419
- }[color];
420
- const iconColorClasses = {
421
- primary: "text-button-solid-primary-icon",
422
- secondary: "text-button-solid-secondary-icon",
423
- tertiary: "text-button-solid-tertiary-icon",
424
- positive: "text-button-solid-positive-icon",
425
- warning: "text-button-solid-warning-icon",
426
- negative: "text-button-solid-negative-icon",
427
- neutral: "text-button-solid-neutral-icon"
428
- }[color];
429
- return /* @__PURE__ */ jsxs2(
430
- "button",
431
- {
432
- onClick: disabled ? void 0 : onClick,
433
- disabled: disabled || onClick === void 0,
434
- className: clsx3(
435
- {
436
- "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
437
- [clsx3(colorClasses, "hover:brightness-90")]: !disabled
438
- },
439
- ButtonUtil.paddingMapping[size],
440
- className
441
- ),
442
- ...restProps,
443
- children: [
444
- startIcon && /* @__PURE__ */ jsx4(
445
- "span",
446
- {
447
- className: clsx3({
448
- [iconColorClasses]: !disabled,
449
- [`text-disabled-icon`]: disabled
450
- }),
451
- children: startIcon
452
- }
453
- ),
454
- children,
455
- endIcon && /* @__PURE__ */ jsx4(
456
- "span",
457
- {
458
- className: clsx3({
459
- [iconColorClasses]: !disabled,
460
- [`text-disabled-icon`]: disabled
461
- }),
462
- children: endIcon
463
- }
464
- )
465
- ]
466
- }
467
- );
468
- };
469
- var TextButton = ({
470
- children,
471
- disabled = false,
472
- color = "neutral",
473
- size = "medium",
474
- startIcon,
475
- endIcon,
476
- onClick,
477
- className,
478
- ...restProps
479
- }) => {
480
- const colorClasses = {
481
- primary: "bg-transparent text-button-text-primary-text",
482
- negative: "bg-transparent text-button-text-negative-text",
483
- neutral: "bg-transparent text-button-text-neutral-text"
484
- }[color];
485
- const iconColorClasses = {
486
- primary: "text-button-text-primary-icon",
487
- negative: "text-button-text-negative-icon",
488
- neutral: "text-button-text-neutral-icon"
489
- }[color];
490
- return /* @__PURE__ */ jsxs2(
491
- "button",
492
- {
493
- onClick: disabled ? void 0 : onClick,
494
- disabled: disabled || onClick === void 0,
495
- className: clsx3(
496
- {
497
- "text-disabled-text cursor-not-allowed": disabled,
498
- [clsx3(colorClasses, "hover:bg-button-text-hover-background")]: !disabled
499
- },
500
- ButtonUtil.paddingMapping[size],
501
- className
502
- ),
503
- ...restProps,
504
- children: [
505
- startIcon && /* @__PURE__ */ jsx4(
506
- "span",
507
- {
508
- className: clsx3({
509
- [iconColorClasses]: !disabled,
510
- [`text-disabled-icon`]: disabled
511
- }),
512
- children: startIcon
513
- }
514
- ),
515
- children,
516
- endIcon && /* @__PURE__ */ jsx4(
517
- "span",
518
- {
519
- className: clsx3({
520
- [iconColorClasses]: !disabled,
521
- [`text-disabled-icon`]: disabled
522
- }),
523
- children: endIcon
524
- }
525
- )
526
- ]
527
- }
528
- );
529
- };
530
- var IconButton = ({
531
- children,
532
- disabled = false,
533
- color = "primary",
534
- size = "medium",
535
- onClick,
536
- className,
537
- ...restProps
538
- }) => {
539
- const colorClasses = {
540
- primary: "bg-button-solid-primary-background text-button-solid-primary-text",
541
- secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
542
- tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
543
- positive: "bg-button-solid-positive-background text-button-solid-positive-text",
544
- warning: "bg-button-solid-warning-background text-button-solid-warning-text",
545
- negative: "bg-button-solid-negative-background text-button-solid-negative-text",
546
- neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
547
- transparent: "bg-transparent"
548
- }[color];
549
- return /* @__PURE__ */ jsx4(
550
- "button",
551
- {
552
- onClick: disabled ? void 0 : onClick,
553
- disabled: disabled || onClick === void 0,
554
- className: clsx3(
555
- {
556
- "text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
557
- "text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
558
- "hover:bg-button-text-hover-background": !disabled && color === "transparent",
559
- [clsx3(colorClasses, "hover:brightness-90")]: !disabled
560
- },
561
- ButtonUtil.iconPaddingMapping[size],
562
- className
563
- ),
564
- ...restProps,
565
- children
566
- }
567
- );
568
- };
569
-
570
- // src/hooks/useSearch.ts
571
- import { useEffect as useEffect6, useMemo, useState as useState5 } from "react";
572
-
573
- // src/util/simpleSearch.ts
574
- var MultiSearchWithMapping = (search, objects, mapping) => {
575
- return objects.filter((object) => {
576
- const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
577
- if (!mappedSearchKeywords) {
578
- return true;
579
- }
580
- return !!mappedSearchKeywords.find((value) => value.includes(search.toLowerCase().trim()));
581
- });
582
- };
583
-
584
- // src/hooks/useSearch.ts
585
- var useSearch = ({
586
- list,
587
- initialSearch,
588
- searchMapping
589
- }) => {
590
- const [items, setItems] = useState5(list);
591
- const [search, setSearch] = useState5(initialSearch);
592
- useEffect6(() => {
593
- setItems(list);
594
- }, [list]);
595
- const result = useMemo(
596
- () => MultiSearchWithMapping(search, items, searchMapping),
597
- [search, items, searchMapping]
598
- );
599
- return {
600
- result,
601
- hasResult: result.length > 0,
602
- allItems: items,
603
- setItems,
604
- search,
605
- setSearch
606
- };
607
- };
608
-
609
741
  // src/localization/defaults/form.ts
610
742
  var formTranslation = {
611
743
  en: {
744
+ add: "Add",
612
745
  all: "All",
613
746
  apply: "Apply",
614
747
  back: "Back",
@@ -621,6 +754,7 @@ var formTranslation = {
621
754
  confirm: "Confirm",
622
755
  copy: "Copy",
623
756
  copied: "Copied",
757
+ create: "Create",
624
758
  decline: "Decline",
625
759
  delete: "Delete",
626
760
  discard: "Discard",
@@ -663,6 +797,7 @@ var formTranslation = {
663
797
  yes: "Yes"
664
798
  },
665
799
  de: {
800
+ add: "Hinzuf\xFCgen",
666
801
  all: "Alle",
667
802
  apply: "Anwenden",
668
803
  back: "Zur\xFCck",
@@ -675,6 +810,7 @@ var formTranslation = {
675
810
  confirm: "Best\xE4tigen",
676
811
  copy: "Kopieren",
677
812
  copied: "Kopiert",
813
+ create: "Erstellen",
678
814
  decline: "Ablehnen",
679
815
  delete: "L\xF6schen",
680
816
  discard: "Verwerfen",
@@ -718,92 +854,316 @@ var formTranslation = {
718
854
  }
719
855
  };
720
856
 
721
- // src/components/layout-and-navigation/SearchableList.tsx
722
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
723
- var defaultSearchableListTranslation = {
724
- en: {
725
- nothingFound: "Nothing found"
726
- },
727
- de: {
728
- nothingFound: "Nichts gefunden"
729
- }
857
+ // src/components/user-action/Button.tsx
858
+ import { forwardRef as forwardRef3 } from "react";
859
+ import clsx6 from "clsx";
860
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
861
+ var ButtonColorUtil = {
862
+ solid: ["primary", "secondary", "tertiary", "positive", "warning", "negative", "neutral"],
863
+ text: ["primary", "negative", "neutral"],
864
+ outline: ["primary"]
730
865
  };
731
- var SearchableList = ({
732
- overwriteTranslation,
733
- list,
734
- initialSearch = "",
735
- searchMapping,
736
- autoFocus,
737
- minimumItemsForSearch = 6,
738
- itemMapper,
866
+ var IconButtonUtil = {
867
+ icon: [...ButtonColorUtil.solid, "transparent"]
868
+ };
869
+ var paddingMapping = {
870
+ small: "btn-sm",
871
+ medium: "btn-md",
872
+ large: "btn-lg"
873
+ };
874
+ var iconPaddingMapping = {
875
+ tiny: "icon-btn-xs",
876
+ small: "icon-btn-sm",
877
+ medium: "icon-btn-md",
878
+ large: "icon-btn-lg"
879
+ };
880
+ var ButtonUtil = {
881
+ paddingMapping,
882
+ iconPaddingMapping
883
+ };
884
+ var SolidButton = forwardRef3(function SolidButton2({
885
+ children,
886
+ disabled = false,
887
+ color = "primary",
888
+ size = "medium",
889
+ startIcon,
890
+ endIcon,
891
+ onClick,
739
892
  className,
740
- resultListClassName
741
- }) => {
742
- const translation = useTranslation([defaultSearchableListTranslation, formTranslation], overwriteTranslation);
743
- const { result, hasResult, search, setSearch } = useSearch({ list, initialSearch, searchMapping });
744
- return /* @__PURE__ */ jsxs3("div", { className: clsx4("col gap-y-2", className), children: [
745
- list.length > minimumItemsForSearch && /* @__PURE__ */ jsxs3("div", { className: "row justify-between gap-x-4 items-center", children: [
746
- /* @__PURE__ */ jsx5(
747
- Input,
893
+ ...restProps
894
+ }, ref) {
895
+ const colorClasses = {
896
+ primary: "bg-button-solid-primary-background text-button-solid-primary-text",
897
+ secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
898
+ tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
899
+ positive: "bg-button-solid-positive-background text-button-solid-positive-text",
900
+ warning: "bg-button-solid-warning-background text-button-solid-warning-text",
901
+ negative: "bg-button-solid-negative-background text-button-solid-negative-text",
902
+ neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text"
903
+ }[color];
904
+ const iconColorClasses = {
905
+ primary: "text-button-solid-primary-icon",
906
+ secondary: "text-button-solid-secondary-icon",
907
+ tertiary: "text-button-solid-tertiary-icon",
908
+ positive: "text-button-solid-positive-icon",
909
+ warning: "text-button-solid-warning-icon",
910
+ negative: "text-button-solid-negative-icon",
911
+ neutral: "text-button-solid-neutral-icon"
912
+ }[color];
913
+ return /* @__PURE__ */ jsxs5(
914
+ "button",
915
+ {
916
+ ref,
917
+ onClick,
918
+ disabled,
919
+ className: clsx6(
748
920
  {
749
- value: search,
750
- onChangeText: setSearch,
751
- placeholder: translation("search"),
752
- autoFocus,
753
- className: "w-full"
754
- }
921
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled,
922
+ [clsx6(colorClasses, "hover:brightness-90")]: !disabled
923
+ },
924
+ ButtonUtil.paddingMapping[size],
925
+ className
755
926
  ),
756
- /* @__PURE__ */ jsx5(IconButton, { color: "neutral", disabled: search.length === 0, children: /* @__PURE__ */ jsx5(Search, { className: "w-full h-full" }) })
757
- ] }),
758
- hasResult ? /* @__PURE__ */ jsx5("div", { className: clsx4("col gap-y-1", resultListClassName), children: result.map(itemMapper) }) : /* @__PURE__ */ jsx5("div", { className: "row text-description py-2 px-2", children: translation("nothingFound") })
759
- ] });
760
- };
761
-
762
- // src/components/layout-and-navigation/Tile.tsx
763
- import clsx5 from "clsx";
764
- import { Check } from "lucide-react";
765
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
766
- var Tile = ({
767
- title,
768
- description,
927
+ ...restProps,
928
+ children: [
929
+ startIcon && /* @__PURE__ */ jsx7(
930
+ "span",
931
+ {
932
+ className: clsx6({
933
+ [iconColorClasses]: !disabled,
934
+ [`text-disabled-icon`]: disabled
935
+ }),
936
+ children: startIcon
937
+ }
938
+ ),
939
+ children,
940
+ endIcon && /* @__PURE__ */ jsx7(
941
+ "span",
942
+ {
943
+ className: clsx6({
944
+ [iconColorClasses]: !disabled,
945
+ [`text-disabled-icon`]: disabled
946
+ }),
947
+ children: endIcon
948
+ }
949
+ )
950
+ ]
951
+ }
952
+ );
953
+ });
954
+ var TextButton = ({
955
+ children,
956
+ disabled = false,
957
+ color = "neutral",
958
+ size = "medium",
959
+ startIcon,
960
+ endIcon,
769
961
  onClick,
770
- isSelected = false,
771
- isDisabled = false,
772
- prefix,
773
- suffix,
774
- normalClassName = "hover:bg-primary/40 cursor-pointer",
775
- selectedClassName = " bg-primary/20",
776
- disabledClassName = "text-disabled-text bg-disabled-background cursor-not-allowed",
777
- className
962
+ className,
963
+ ...restProps
778
964
  }) => {
779
- return /* @__PURE__ */ jsxs4(
780
- "div",
965
+ const colorClasses = {
966
+ primary: "bg-transparent text-button-text-primary-text",
967
+ negative: "bg-transparent text-button-text-negative-text",
968
+ neutral: "bg-transparent text-button-text-neutral-text"
969
+ }[color];
970
+ const iconColorClasses = {
971
+ primary: "text-button-text-primary-icon",
972
+ negative: "text-button-text-negative-icon",
973
+ neutral: "text-button-text-neutral-icon"
974
+ }[color];
975
+ return /* @__PURE__ */ jsxs5(
976
+ "button",
781
977
  {
782
- className: clsx5(
783
- "row gap-x-2 w-full items-center",
978
+ onClick,
979
+ disabled,
980
+ className: clsx6(
784
981
  {
785
- [normalClassName]: !!onClick && !isDisabled,
786
- [selectedClassName]: isSelected && !isDisabled,
787
- [disabledClassName]: isDisabled
982
+ "text-disabled-text cursor-not-allowed": disabled,
983
+ [clsx6(colorClasses, "hover:bg-button-text-hover-background")]: !disabled
788
984
  },
985
+ ButtonUtil.paddingMapping[size],
789
986
  className
790
987
  ),
791
- onClick: isDisabled ? void 0 : onClick,
988
+ ...restProps,
792
989
  children: [
793
- prefix,
794
- /* @__PURE__ */ jsxs4("div", { className: "col gap-y-0 w-full", children: [
795
- /* @__PURE__ */ jsx6("h4", { className: clsx5(title.className ?? "textstyle-title-normal"), children: title.value }),
796
- !!description && /* @__PURE__ */ jsx6("span", { className: clsx5(description.className ?? "textstyle-description"), children: description.value })
797
- ] }),
798
- suffix ?? (isSelected ? /* @__PURE__ */ jsx6(Check, { size: 24 }) : void 0)
990
+ startIcon && /* @__PURE__ */ jsx7(
991
+ "span",
992
+ {
993
+ className: clsx6({
994
+ [iconColorClasses]: !disabled,
995
+ [`text-disabled-icon`]: disabled
996
+ }),
997
+ children: startIcon
998
+ }
999
+ ),
1000
+ children,
1001
+ endIcon && /* @__PURE__ */ jsx7(
1002
+ "span",
1003
+ {
1004
+ className: clsx6({
1005
+ [iconColorClasses]: !disabled,
1006
+ [`text-disabled-icon`]: disabled
1007
+ }),
1008
+ children: endIcon
1009
+ }
1010
+ )
799
1011
  ]
800
1012
  }
801
1013
  );
802
1014
  };
1015
+ var IconButton = ({
1016
+ children,
1017
+ disabled = false,
1018
+ color = "primary",
1019
+ size = "medium",
1020
+ className,
1021
+ ...restProps
1022
+ }) => {
1023
+ const colorClasses = {
1024
+ primary: "bg-button-solid-primary-background text-button-solid-primary-text",
1025
+ secondary: "bg-button-solid-secondary-background text-button-solid-secondary-text",
1026
+ tertiary: "bg-button-solid-tertiary-background text-button-solid-tertiary-text",
1027
+ positive: "bg-button-solid-positive-background text-button-solid-positive-text",
1028
+ warning: "bg-button-solid-warning-background text-button-solid-warning-text",
1029
+ negative: "bg-button-solid-negative-background text-button-solid-negative-text",
1030
+ neutral: "bg-button-solid-neutral-background text-button-solid-neutral-text",
1031
+ transparent: "bg-transparent"
1032
+ }[color];
1033
+ return /* @__PURE__ */ jsx7(
1034
+ "button",
1035
+ {
1036
+ disabled,
1037
+ className: clsx6(
1038
+ {
1039
+ "text-disabled-text bg-disabled-background cursor-not-allowed": disabled && color !== "transparent",
1040
+ "text-disabled-text cursor-not-allowed opacity-70": disabled && color === "transparent",
1041
+ "hover:bg-button-text-hover-background": !disabled && color === "transparent",
1042
+ [clsx6(colorClasses, "hover:brightness-90")]: !disabled
1043
+ },
1044
+ ButtonUtil.iconPaddingMapping[size],
1045
+ className
1046
+ ),
1047
+ ...restProps,
1048
+ children
1049
+ }
1050
+ );
1051
+ };
1052
+
1053
+ // src/components/user-action/SearchBar.tsx
1054
+ import { Search } from "lucide-react";
1055
+ import { clsx as clsx7 } from "clsx";
1056
+ import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1057
+ var SearchBar = ({
1058
+ placeholder,
1059
+ onSearch,
1060
+ disableOnSearch,
1061
+ containerClassName,
1062
+ ...inputProps
1063
+ }) => {
1064
+ const translation = useTranslation([formTranslation]);
1065
+ return /* @__PURE__ */ jsxs6("div", { className: clsx7("flex-row-2 justify-between items-center", containerClassName), children: [
1066
+ /* @__PURE__ */ jsx8(
1067
+ Input,
1068
+ {
1069
+ ...inputProps,
1070
+ placeholder: placeholder ?? translation("search")
1071
+ }
1072
+ ),
1073
+ onSearch && /* @__PURE__ */ jsx8(IconButton, { color: "neutral", disabled: disableOnSearch, onClick: onSearch, children: /* @__PURE__ */ jsx8(Search, { className: "w-full h-full" }) })
1074
+ ] });
1075
+ };
1076
+
1077
+ // src/hooks/useSearch.ts
1078
+ import { useCallback as useCallback4, useEffect as useEffect10, useMemo, useState as useState8 } from "react";
1079
+
1080
+ // src/util/simpleSearch.ts
1081
+ var MultiSubjectSearchWithMapping = (search, objects, mapping) => {
1082
+ return objects.filter((object) => {
1083
+ const mappedSearchKeywords = mapping(object)?.map((value) => value.toLowerCase().trim());
1084
+ if (!mappedSearchKeywords) {
1085
+ return true;
1086
+ }
1087
+ return search.every((searchValue) => !!mappedSearchKeywords.find((value) => !!value && value.includes(searchValue.toLowerCase().trim())));
1088
+ });
1089
+ };
1090
+
1091
+ // src/hooks/useSearch.ts
1092
+ var useSearch = ({
1093
+ list,
1094
+ initialSearch,
1095
+ searchMapping,
1096
+ additionalSearchTags,
1097
+ isSearchInstant = true,
1098
+ sortingFunction,
1099
+ filter,
1100
+ disabled = false
1101
+ }) => {
1102
+ const [search, setSearch] = useState8(initialSearch ?? "");
1103
+ const [result, setResult] = useState8(list);
1104
+ const searchTags = useMemo(() => additionalSearchTags ?? [], [additionalSearchTags]);
1105
+ const updateSearch = useCallback4((newSearch) => {
1106
+ const usedSearch = newSearch ?? search;
1107
+ if (newSearch) {
1108
+ setSearch(search);
1109
+ }
1110
+ setResult(MultiSubjectSearchWithMapping([usedSearch, ...searchTags], list, searchMapping));
1111
+ }, [searchTags, list, search, searchMapping]);
1112
+ useEffect10(() => {
1113
+ if (isSearchInstant) {
1114
+ setResult(MultiSubjectSearchWithMapping([search, ...searchTags], list, searchMapping));
1115
+ }
1116
+ }, [searchTags, isSearchInstant, list, search, searchMapping, additionalSearchTags]);
1117
+ const filteredResult = useMemo(() => {
1118
+ if (!filter) {
1119
+ return result;
1120
+ }
1121
+ return result.filter(filter);
1122
+ }, [result, filter]);
1123
+ const sortedAndFilteredResult = useMemo(() => {
1124
+ if (!sortingFunction) {
1125
+ return filteredResult;
1126
+ }
1127
+ return filteredResult.sort(sortingFunction);
1128
+ }, [filteredResult, sortingFunction]);
1129
+ const usedResult = useMemo(() => {
1130
+ if (!disabled) {
1131
+ return sortedAndFilteredResult;
1132
+ }
1133
+ return list;
1134
+ }, [disabled, list, sortedAndFilteredResult]);
1135
+ return {
1136
+ result: usedResult,
1137
+ hasResult: usedResult.length > 0,
1138
+ allItems: list,
1139
+ updateSearch,
1140
+ search,
1141
+ setSearch
1142
+ };
1143
+ };
1144
+
1145
+ // src/components/user-action/Select.tsx
1146
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1147
+ var SelectTile = ({
1148
+ className,
1149
+ disabledClassName,
1150
+ title,
1151
+ ...restProps
1152
+ }) => {
1153
+ return /* @__PURE__ */ jsx9(
1154
+ Tile,
1155
+ {
1156
+ ...restProps,
1157
+ className: clsx8("px-2 py-1 rounded-md", className),
1158
+ disabledClassName: disabledClassName ?? "text-disabled-text cursor-not-allowed",
1159
+ title: { ...title, className: title.className ?? "font-semibold" }
1160
+ }
1161
+ );
1162
+ };
803
1163
 
804
1164
  // src/components/layout-and-navigation/Chip.tsx
805
- import clsx6 from "clsx";
806
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1165
+ import clsx9 from "clsx";
1166
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
807
1167
  var Chip = ({
808
1168
  children,
809
1169
  trailingIcon,
@@ -830,11 +1190,11 @@ var Chip = ({
830
1190
  blue: "text-tag-blue-icon",
831
1191
  pink: "text-tag-pink-icon"
832
1192
  }[color];
833
- return /* @__PURE__ */ jsxs5(
1193
+ return /* @__PURE__ */ jsxs8(
834
1194
  "div",
835
1195
  {
836
1196
  ...restProps,
837
- className: clsx6(
1197
+ className: clsx9(
838
1198
  `row w-fit px-2 py-1`,
839
1199
  colorMapping,
840
1200
  {
@@ -845,7 +1205,7 @@ var Chip = ({
845
1205
  ),
846
1206
  children: [
847
1207
  children,
848
- trailingIcon && /* @__PURE__ */ jsx7("span", { className: colorMappingIcon, children: trailingIcon })
1208
+ trailingIcon && /* @__PURE__ */ jsx10("span", { className: colorMappingIcon, children: trailingIcon })
849
1209
  ]
850
1210
  }
851
1211
  );
@@ -854,7 +1214,7 @@ var ChipList = ({
854
1214
  list,
855
1215
  className = ""
856
1216
  }) => {
857
- return /* @__PURE__ */ jsx7("div", { className: clsx6("flex flex-wrap gap-x-4 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ jsx7(
1217
+ return /* @__PURE__ */ jsx10("div", { className: clsx9("flex flex-wrap gap-x-2 gap-y-2", className), children: list.map((value, index) => /* @__PURE__ */ jsx10(
858
1218
  Chip,
859
1219
  {
860
1220
  ...value,
@@ -866,28 +1226,74 @@ var ChipList = ({
866
1226
  )) });
867
1227
  };
868
1228
 
869
- // src/hooks/useOutsideClick.ts
870
- import { useEffect as useEffect7 } from "react";
871
- var useOutsideClick = (refs, handler) => {
872
- useEffect7(() => {
873
- const listener = (event) => {
874
- if (event.target === null) return;
875
- if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
876
- return;
1229
+ // src/components/user-action/Checkbox.tsx
1230
+ import { useState as useState10 } from "react";
1231
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
1232
+ import { Check as Check2, Minus } from "lucide-react";
1233
+ import clsx10 from "clsx";
1234
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1235
+ var checkboxSizeMapping = {
1236
+ small: "size-5",
1237
+ medium: "size-6",
1238
+ large: "size-8"
1239
+ };
1240
+ var checkboxIconSizeMapping = {
1241
+ small: "size-4",
1242
+ medium: "size-5",
1243
+ large: "size-7"
1244
+ };
1245
+ var Checkbox = ({
1246
+ id,
1247
+ label,
1248
+ checked,
1249
+ disabled,
1250
+ onChange,
1251
+ onChangeTristate,
1252
+ size = "medium",
1253
+ className = "",
1254
+ containerClassName
1255
+ }) => {
1256
+ const usedSizeClass = checkboxSizeMapping[size];
1257
+ const innerIconSize = checkboxIconSizeMapping[size];
1258
+ const propagateChange = (checked2) => {
1259
+ if (onChangeTristate) {
1260
+ onChangeTristate(checked2);
1261
+ }
1262
+ if (onChange) {
1263
+ onChange(checked2 === "indeterminate" ? false : checked2);
1264
+ }
1265
+ };
1266
+ const changeValue = () => {
1267
+ const newValue = checked === "indeterminate" ? false : !checked;
1268
+ propagateChange(newValue);
1269
+ };
1270
+ return /* @__PURE__ */ jsxs9("div", { className: clsx10("group flex-row-2 items-center cursor-pointer", containerClassName), onClick: changeValue, children: [
1271
+ /* @__PURE__ */ jsx11(
1272
+ CheckboxPrimitive.Root,
1273
+ {
1274
+ onCheckedChange: propagateChange,
1275
+ checked,
1276
+ disabled,
1277
+ id,
1278
+ className: clsx10(usedSizeClass, `items-center border-2 rounded outline-none `, {
1279
+ "text-disabled-text border-disabled-outline bg-disabled-background cursor-not-allowed": disabled,
1280
+ "focus:border-primary group-hover:border-primary ": !disabled,
1281
+ "bg-surface": !disabled && !checked,
1282
+ "bg-primary/30 border-primary text-primary": !disabled && checked === true || checked === "indeterminate"
1283
+ }, className),
1284
+ children: /* @__PURE__ */ jsxs9(CheckboxPrimitive.Indicator, { children: [
1285
+ checked === true && /* @__PURE__ */ jsx11(Check2, { className: innerIconSize }),
1286
+ checked === "indeterminate" && /* @__PURE__ */ jsx11(Minus, { className: innerIconSize })
1287
+ ] })
877
1288
  }
878
- handler();
879
- };
880
- document.addEventListener("mousedown", listener);
881
- document.addEventListener("touchstart", listener);
882
- return () => {
883
- document.removeEventListener("mousedown", listener);
884
- document.removeEventListener("touchstart", listener);
885
- };
886
- }, [refs, handler]);
1289
+ ),
1290
+ label && /* @__PURE__ */ jsx11(Label, { ...label, className: clsx10(label.className), htmlFor: id })
1291
+ ] });
887
1292
  };
888
1293
 
889
1294
  // src/components/user-action/MultiSelect.tsx
890
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1295
+ import { Plus } from "lucide-react";
1296
+ import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
891
1297
  var defaultMultiSelectTranslation = {
892
1298
  en: {
893
1299
  selected: `{{amount}} selected`
@@ -898,89 +1304,107 @@ var defaultMultiSelectTranslation = {
898
1304
  };
899
1305
  var MultiSelect = ({
900
1306
  overwriteTranslation,
901
- options,
902
1307
  label,
1308
+ options,
903
1309
  onChange,
904
1310
  hintText,
905
- isDisabled = false,
906
- isSearchEnabled = false,
907
1311
  selectedDisplayOverwrite,
1312
+ searchOptions,
1313
+ additionalItems,
908
1314
  useChipDisplay = false,
909
- className = ""
1315
+ className,
1316
+ triggerClassName,
1317
+ hintTextClassName,
1318
+ ...menuProps
910
1319
  }) => {
911
1320
  const translation = useTranslation([formTranslation, defaultMultiSelectTranslation], overwriteTranslation);
912
- const triggerRef = useRef2(null);
913
- const menuRef = useRef2(null);
914
- const [isOpen, setIsOpen] = useState6(false);
915
- useOutsideClick([triggerRef, menuRef], () => setIsOpen(false));
1321
+ const { result, search, setSearch } = useSearch({
1322
+ list: options,
1323
+ searchMapping: useCallback6((item) => item.searchTags, []),
1324
+ ...searchOptions
1325
+ });
916
1326
  const selectedItems = options.filter((value) => value.selected);
917
1327
  const isShowingHint = !selectedDisplayOverwrite && selectedItems.length === 0;
918
- return /* @__PURE__ */ jsxs6("div", { className: clsx7(className), children: [
919
- label && /* @__PURE__ */ jsx8(
1328
+ return /* @__PURE__ */ jsxs10("div", { className: clsx11(className), children: [
1329
+ label && /* @__PURE__ */ jsx12(
920
1330
  Label,
921
1331
  {
922
1332
  ...label,
923
1333
  htmlFor: label.name,
924
- className: clsx7(" mb-1", label.className),
1334
+ className: clsx11(" mb-1", label.className),
925
1335
  labelType: label.labelType ?? "labelBig"
926
1336
  }
927
1337
  ),
928
- /* @__PURE__ */ jsxs6("div", { className: "relative", children: [
929
- /* @__PURE__ */ jsxs6(
930
- "button",
931
- {
932
- ref: triggerRef,
933
- className: clsx7(
934
- "btn-md justify-between w-full border-2 h-auto",
935
- {
936
- "rounded-b-lg": !open,
937
- "bg-menu-background border-menu-border hover:border-primary": !isDisabled,
938
- "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": isDisabled
939
- }
940
- ),
941
- onClick: () => setIsOpen(!isOpen),
942
- disabled: isDisabled,
943
- children: [
944
- !isShowingHint && /* @__PURE__ */ jsx8("span", { className: "font-semibold text-menu-text", children: selectedDisplayOverwrite ?? (useChipDisplay && selectedItems ? /* @__PURE__ */ jsx8(ChipList, { list: selectedItems.map((value) => ({ children: value.label })) }) : translation("selected", { replacements: { amount: selectedItems.length.toString() } })) }),
945
- isShowingHint && /* @__PURE__ */ jsx8("span", { className: "textstyle-description", children: hintText ?? translation("select") }),
946
- isOpen ? /* @__PURE__ */ jsx8(ChevronUp, { size: 24, className: "min-w-6" }) : /* @__PURE__ */ jsx8(ChevronDown, { className: "min-w-6" })
947
- ]
948
- }
949
- ),
950
- isOpen && /* @__PURE__ */ jsxs6(
951
- "div",
952
- {
953
- ref: menuRef,
954
- 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",
955
- children: [
956
- /* @__PURE__ */ jsx8(
957
- SearchableList,
1338
+ /* @__PURE__ */ jsx12(
1339
+ Menu,
1340
+ {
1341
+ ...menuProps,
1342
+ trigger: ({ toggleOpen, isOpen, disabled }, ref) => /* @__PURE__ */ jsx12(
1343
+ "button",
1344
+ {
1345
+ ref,
1346
+ className: clsx11(
1347
+ "btn-md justify-between w-full border-2 h-auto",
1348
+ {
1349
+ "min-h-14": useChipDisplay,
1350
+ "bg-menu-background text-menu-text border-menu-border hover:border-primary": !disabled,
1351
+ "bg-disabled-background text-disabled-text border-disabled-background cursor-not-allowed": disabled
1352
+ },
1353
+ triggerClassName
1354
+ ),
1355
+ onClick: toggleOpen,
1356
+ disabled,
1357
+ children: useChipDisplay ? /* @__PURE__ */ jsx12(Fragment3, { children: isShowingHint ? /* @__PURE__ */ jsx12(IconButton, { disabled, size: "small", color: "neutral", children: /* @__PURE__ */ jsx12(Plus, {}) }) : /* @__PURE__ */ jsx12(ChipList, { list: selectedItems.map((value) => ({ children: value.label })) }) }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
1358
+ !isShowingHint && /* @__PURE__ */ jsx12("span", { className: "font-semibold", children: selectedDisplayOverwrite ?? translation("selected", { replacements: { amount: selectedItems.length.toString() } }) }),
1359
+ isShowingHint && /* @__PURE__ */ jsx12("span", { className: clsx11("textstyle-description", hintTextClassName), children: hintText ?? translation("select") }),
1360
+ /* @__PURE__ */ jsx12(ExpansionIcon, { isExpanded: isOpen })
1361
+ ] })
1362
+ }
1363
+ ),
1364
+ menuClassName: clsx11("flex-col-2 p-2 max-h-96 overflow-hidden", menuProps.menuClassName),
1365
+ children: (bag) => {
1366
+ const { close } = bag;
1367
+ return /* @__PURE__ */ jsxs10(Fragment3, { children: [
1368
+ !searchOptions?.disabled && /* @__PURE__ */ jsx12(
1369
+ SearchBar,
958
1370
  {
959
- list: options,
960
- minimumItemsForSearch: isSearchEnabled ? void 0 : options.length,
961
- searchMapping: (item) => item.searchTags,
962
- itemMapper: (option, index) => /* @__PURE__ */ jsx8(
963
- Tile,
1371
+ value: search,
1372
+ onChangeText: setSearch,
1373
+ autoFocus: true
1374
+ }
1375
+ ),
1376
+ /* @__PURE__ */ jsxs10("div", { className: "flex-col-2 overflow-y-auto", children: [
1377
+ result.map((option, index) => {
1378
+ const update = () => {
1379
+ onChange(options.map((value) => value.value === option.value ? {
1380
+ ...option,
1381
+ selected: !value.selected
1382
+ } : value));
1383
+ };
1384
+ return /* @__PURE__ */ jsx12(
1385
+ SelectTile,
964
1386
  {
965
- isSelected: option.selected,
966
- className: "px-2 py-1 rounded-md",
967
- disabledClassName: "text-disabled-text cursor-not-allowed",
968
- title: { value: option.label, className: "font-semibold" },
969
- onClick: () => {
970
- onChange(options.map((value) => value.value === option.value ? {
971
- ...option,
972
- selected: !value.selected
973
- } : value));
974
- },
975
- isDisabled: option.disabled
1387
+ prefix: /* @__PURE__ */ jsx12(
1388
+ Checkbox,
1389
+ {
1390
+ checked: option.selected,
1391
+ onChange: update,
1392
+ size: "small",
1393
+ disabled: option.disabled
1394
+ }
1395
+ ),
1396
+ title: { value: option.label },
1397
+ onClick: update,
1398
+ disabled: option.disabled
976
1399
  },
977
1400
  index
978
- )
979
- }
980
- ),
981
- /* @__PURE__ */ jsxs6("div", { className: "row justify-between mt-2", children: [
982
- /* @__PURE__ */ jsxs6("div", { className: "row gap-x-2", children: [
983
- /* @__PURE__ */ jsx8(
1401
+ );
1402
+ }),
1403
+ additionalItems && additionalItems({ ...bag, search })
1404
+ ] }),
1405
+ /* @__PURE__ */ jsxs10("div", { className: "flex-row-2 justify-between", children: [
1406
+ /* @__PURE__ */ jsxs10("div", { className: "flex-row-2", children: [
1407
+ /* @__PURE__ */ jsx12(
984
1408
  SolidButton,
985
1409
  {
986
1410
  color: "neutral",
@@ -995,7 +1419,7 @@ var MultiSelect = ({
995
1419
  children: translation("all")
996
1420
  }
997
1421
  ),
998
- /* @__PURE__ */ jsx8(
1422
+ /* @__PURE__ */ jsx12(
999
1423
  SolidButton,
1000
1424
  {
1001
1425
  color: "neutral",
@@ -1010,19 +1434,19 @@ var MultiSelect = ({
1010
1434
  }
1011
1435
  )
1012
1436
  ] }),
1013
- /* @__PURE__ */ jsx8(SolidButton, { size: "small", onClick: () => setIsOpen(false), children: "Done" })
1437
+ /* @__PURE__ */ jsx12(SolidButton, { size: "small", onClick: close, children: "Done" })
1014
1438
  ] })
1015
- ]
1439
+ ] });
1016
1440
  }
1017
- )
1018
- ] })
1441
+ }
1442
+ )
1019
1443
  ] });
1020
1444
  };
1021
1445
 
1022
1446
  // src/components/properties/PropertyBase.tsx
1023
1447
  import { AlertTriangle } from "lucide-react";
1024
- import clsx8 from "clsx";
1025
- import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1448
+ import clsx12 from "clsx";
1449
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
1026
1450
  var PropertyBase = ({
1027
1451
  overwriteTranslation,
1028
1452
  name,
@@ -1036,36 +1460,44 @@ var PropertyBase = ({
1036
1460
  }) => {
1037
1461
  const translation = useTranslation([formTranslation], overwriteTranslation);
1038
1462
  const requiredAndNoValue = softRequired && !hasValue;
1039
- return /* @__PURE__ */ jsxs7("div", { className: clsx8("row gap-x-0 group", className), children: [
1040
- /* @__PURE__ */ jsxs7(
1463
+ return /* @__PURE__ */ jsxs11("div", { className: clsx12("flex-row-0 group", className), children: [
1464
+ /* @__PURE__ */ jsxs11(
1041
1465
  "div",
1042
1466
  {
1043
- className: clsx8("row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0", {
1044
- "bg-property-title-background property-title-text group-hover:border-primary": !requiredAndNoValue,
1045
- "bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
1046
- }, className),
1467
+ className: clsx12(
1468
+ "flex-row-2 max-w-48 min-w-48 px-3 py-2 items-center rounded-l-xl border-2 border-r-0",
1469
+ {
1470
+ "bg-property-title-background text-property-title-text group-hover:border-primary": !requiredAndNoValue,
1471
+ "bg-warning text-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
1472
+ },
1473
+ className
1474
+ ),
1047
1475
  children: [
1048
- icon,
1049
- name
1476
+ /* @__PURE__ */ jsx13("div", { className: "max-w-6 min-w-6 text-text-default", children: icon }),
1477
+ /* @__PURE__ */ jsx13("span", { className: "font-semibold", children: name })
1050
1478
  ]
1051
1479
  }
1052
1480
  ),
1053
- /* @__PURE__ */ jsxs7(
1481
+ /* @__PURE__ */ jsxs11(
1054
1482
  "div",
1055
1483
  {
1056
- className: clsx8("row gap-x-0 grow justify-between items-center rounded-r-xl border-2 border-l-0", {
1057
- "bg-surface group-hover:border-primary": !requiredAndNoValue,
1058
- "bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
1059
- }, className),
1484
+ className: clsx12(
1485
+ "flex-row-2 grow px-3 py-2 justify-between items-center rounded-r-xl border-2 border-l-0 min-h-15",
1486
+ {
1487
+ "bg-surface group-hover:border-primary": !requiredAndNoValue,
1488
+ "bg-surface-warning group-hover:border-warning border-warning/90": requiredAndNoValue
1489
+ },
1490
+ className
1491
+ ),
1060
1492
  children: [
1061
1493
  input({ softRequired, hasValue }),
1062
- requiredAndNoValue && /* @__PURE__ */ jsx9("div", { className: "text-warning pr-4", children: /* @__PURE__ */ jsx9(AlertTriangle, { size: 24 }) }),
1063
- onRemove && /* @__PURE__ */ jsx9(
1494
+ requiredAndNoValue && /* @__PURE__ */ jsx13("div", { className: "text-warning", children: /* @__PURE__ */ jsx13(AlertTriangle, { size: 24 }) }),
1495
+ onRemove && hasValue && /* @__PURE__ */ jsx13(
1064
1496
  TextButton,
1065
1497
  {
1066
1498
  onClick: onRemove,
1067
1499
  color: "negative",
1068
- className: clsx8("pr-4 items-center", { "!text-transparent": !hasValue || readOnly }),
1500
+ className: clsx12("items-center", { "!text-transparent": !hasValue || readOnly }),
1069
1501
  disabled: !hasValue || readOnly,
1070
1502
  children: translation("remove")
1071
1503
  }
@@ -1077,7 +1509,7 @@ var PropertyBase = ({
1077
1509
  };
1078
1510
 
1079
1511
  // src/components/properties/MultiSelectProperty.tsx
1080
- import { jsx as jsx10 } from "react/jsx-runtime";
1512
+ import { jsx as jsx14 } from "react/jsx-runtime";
1081
1513
  var MultiSelectProperty = ({
1082
1514
  overwriteTranslation,
1083
1515
  options,
@@ -1085,11 +1517,12 @@ var MultiSelectProperty = ({
1085
1517
  readOnly = false,
1086
1518
  softRequired,
1087
1519
  onRemove,
1520
+ onAddNew,
1088
1521
  ...multiSelectProps
1089
1522
  }) => {
1090
1523
  const translation = useTranslation([formTranslation], overwriteTranslation);
1091
1524
  const hasValue = options.some((value) => value.selected);
1092
- return /* @__PURE__ */ jsx10(
1525
+ return /* @__PURE__ */ jsx14(
1093
1526
  PropertyBase,
1094
1527
  {
1095
1528
  name,
@@ -1097,20 +1530,42 @@ var MultiSelectProperty = ({
1097
1530
  readOnly,
1098
1531
  softRequired,
1099
1532
  hasValue,
1100
- icon: /* @__PURE__ */ jsx10(List, { size: 16 }),
1101
- input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ jsx10(
1102
- "div",
1533
+ icon: /* @__PURE__ */ jsx14(List, { size: 24 }),
1534
+ input: ({ softRequired: softRequired2 }) => /* @__PURE__ */ jsx14(
1535
+ MultiSelect,
1103
1536
  {
1104
- className: clsx9("row grow py-2 px-4 cursor-pointer", { "text-warning": softRequired2 && !hasValue }),
1105
- children: /* @__PURE__ */ jsx10(
1106
- MultiSelect,
1537
+ ...multiSelectProps,
1538
+ className: clsx13("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
1539
+ options,
1540
+ disabled: readOnly,
1541
+ useChipDisplay: true,
1542
+ hintText: `${translation("select")}...`,
1543
+ searchOptions: {
1544
+ sortingFunction: (a, b) => a.value.localeCompare(b.value),
1545
+ ...multiSelectProps?.searchOptions
1546
+ },
1547
+ additionalItems: ({ close, search }) => {
1548
+ if (!onAddNew && !search.trim()) {
1549
+ return void 0;
1550
+ }
1551
+ return /* @__PURE__ */ jsx14(
1552
+ SelectTile,
1553
+ {
1554
+ prefix: /* @__PURE__ */ jsx14(Plus2, {}),
1555
+ title: { value: `${translation("add")} ${search.trim()}` },
1556
+ onClick: () => {
1557
+ onAddNew(search);
1558
+ close();
1559
+ },
1560
+ disabled: options.some((value) => value.value === search.trim())
1561
+ }
1562
+ );
1563
+ },
1564
+ triggerClassName: clsx13(
1565
+ "!border-none !p-0 !min-h-10",
1107
1566
  {
1108
- ...multiSelectProps,
1109
- className: clsx9("w-full", { "bg-surface-warning": softRequired2 && !hasValue }),
1110
- options,
1111
- isDisabled: readOnly,
1112
- useChipDisplay: true,
1113
- hintText: `${translation("select")}...`
1567
+ "!bg-warning !text-surface-warning": softRequired2 && !hasValue,
1568
+ "": !softRequired2 || hasValue
1114
1569
  }
1115
1570
  )
1116
1571
  }