@helpwave/hightide 0.0.8 → 0.0.11

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 (300) hide show
  1. package/README.md +1 -1
  2. package/dist/coloring/shading.d.ts +2 -0
  3. package/dist/coloring/shading.js +40 -0
  4. package/dist/coloring/types.d.ts +11 -0
  5. package/dist/coloring/types.js +1 -0
  6. package/dist/components/Avatar.d.ts +14 -0
  7. package/dist/components/Avatar.js +35 -0
  8. package/dist/components/AvatarGroup.d.ts +10 -0
  9. package/dist/components/AvatarGroup.js +13 -0
  10. package/dist/components/BreadCrumb.d.ts +16 -0
  11. package/dist/components/BreadCrumb.js +12 -0
  12. package/dist/components/Button.d.ts +41 -0
  13. package/dist/components/Button.js +84 -0
  14. package/dist/components/ChipList.d.ts +21 -0
  15. package/dist/components/ChipList.js +38 -0
  16. package/dist/components/Circle.d.ts +6 -0
  17. package/dist/components/Circle.js +10 -0
  18. package/dist/components/ErrorComponent.d.ts +13 -0
  19. package/dist/components/ErrorComponent.js +19 -0
  20. package/dist/components/Expandable.d.ts +30 -0
  21. package/dist/components/Expandable.js +16 -0
  22. package/dist/components/HelpwaveBadge.d.ts +11 -0
  23. package/dist/components/HelpwaveBadge.js +14 -0
  24. package/dist/components/HideableContentSection.d.ts +10 -0
  25. package/dist/components/HideableContentSection.js +15 -0
  26. package/dist/components/InputGroup.d.ts +13 -0
  27. package/dist/components/InputGroup.js +33 -0
  28. package/dist/components/LoadingAndErrorComponent.d.ts +17 -0
  29. package/dist/components/LoadingAndErrorComponent.js +25 -0
  30. package/dist/components/LoadingAnimation.d.ts +13 -0
  31. package/dist/components/LoadingAnimation.js +19 -0
  32. package/dist/components/LoadingButton.d.ts +6 -0
  33. package/dist/components/LoadingButton.js +10 -0
  34. package/dist/components/MarkdownInterpreter.d.ts +25 -0
  35. package/dist/components/MarkdownInterpreter.js +190 -0
  36. package/dist/components/Pagination.d.ts +14 -0
  37. package/dist/components/Pagination.js +25 -0
  38. package/dist/components/Profile.d.ts +28 -0
  39. package/dist/components/Profile.js +45 -0
  40. package/dist/components/ProgressIndicator.d.ts +21 -0
  41. package/dist/components/ProgressIndicator.js +24 -0
  42. package/dist/components/Ring.d.ts +31 -0
  43. package/dist/components/Ring.js +113 -0
  44. package/dist/components/SearchableList.d.ts +18 -0
  45. package/dist/components/SearchableList.js +27 -0
  46. package/dist/components/SortButton.d.ts +10 -0
  47. package/dist/components/SortButton.js +9 -0
  48. package/dist/components/Span.js +1 -0
  49. package/dist/components/StepperBar.d.ts +23 -0
  50. package/dist/components/StepperBar.js +47 -0
  51. package/dist/components/Table.d.ts +87 -0
  52. package/dist/components/Table.js +187 -0
  53. package/dist/components/TechRadar.d.ts +36 -0
  54. package/dist/components/TechRadar.js +191 -0
  55. package/dist/components/TextImage.d.ts +20 -0
  56. package/dist/components/TextImage.js +31 -0
  57. package/dist/components/TimeDisplay.d.ts +30 -0
  58. package/dist/components/TimeDisplay.js +83 -0
  59. package/dist/components/Tooltip.d.ts +34 -0
  60. package/dist/components/Tooltip.js +38 -0
  61. package/dist/components/VerticalDivider.d.ts +11 -0
  62. package/dist/components/VerticalDivider.js +7 -0
  63. package/dist/components/date/DatePicker.d.ts +26 -0
  64. package/dist/components/date/DatePicker.js +58 -0
  65. package/dist/components/date/DayPicker.d.ts +16 -0
  66. package/dist/components/date/DayPicker.js +37 -0
  67. package/dist/components/date/TimePicker.d.ts +12 -0
  68. package/dist/components/date/TimePicker.js +79 -0
  69. package/dist/components/date/YearMonthPicker.d.ts +11 -0
  70. package/dist/components/date/YearMonthPicker.js +59 -0
  71. package/dist/components/examples/InputGroupExample.d.ts +6 -0
  72. package/dist/components/examples/InputGroupExample.js +21 -0
  73. package/dist/components/examples/MultiSelectExample.d.ts +7 -0
  74. package/dist/components/examples/MultiSelectExample.js +27 -0
  75. package/dist/components/examples/SearchableSelectExample.d.ts +6 -0
  76. package/dist/components/examples/SearchableSelectExample.js +17 -0
  77. package/dist/components/examples/SelectExample.d.ts +4 -0
  78. package/dist/components/examples/SelectExample.js +15 -0
  79. package/dist/components/examples/StackingModals.d.ts +4 -0
  80. package/dist/components/examples/StackingModals.js +15 -0
  81. package/dist/components/examples/TableExample.d.ts +9 -0
  82. package/dist/components/examples/TableExample.js +92 -0
  83. package/dist/components/examples/TextareaExample.d.ts +6 -0
  84. package/dist/components/examples/TextareaExample.js +10 -0
  85. package/dist/components/examples/TileExample.d.ts +9 -0
  86. package/dist/components/examples/TileExample.js +9 -0
  87. package/dist/components/examples/Title.js +1 -0
  88. package/dist/components/examples/date/DateTimePickerExample.d.ts +10 -0
  89. package/dist/components/examples/date/DateTimePickerExample.js +21 -0
  90. package/dist/components/examples/properties/CheckboxPropertyExample.d.ts +8 -0
  91. package/dist/components/examples/properties/CheckboxPropertyExample.js +13 -0
  92. package/dist/components/examples/properties/DatePropertyExample.d.ts +8 -0
  93. package/dist/components/examples/properties/DatePropertyExample.js +23 -0
  94. package/dist/components/examples/properties/MultiSelectPropertyExample.d.ts +8 -0
  95. package/dist/components/examples/properties/MultiSelectPropertyExample.js +16 -0
  96. package/dist/components/examples/properties/NumberPropertyExample.d.ts +6 -0
  97. package/dist/components/examples/properties/NumberPropertyExample.js +13 -0
  98. package/dist/components/examples/properties/SelectPropertyExample.d.ts +6 -0
  99. package/dist/components/examples/properties/SelectPropertyExample.js +18 -0
  100. package/dist/components/examples/properties/TextPropertyExample.d.ts +8 -0
  101. package/dist/components/examples/properties/TextPropertyExample.js +13 -0
  102. package/dist/components/icons/Helpwave.d.ts +10 -0
  103. package/dist/components/icons/Helpwave.js +20 -0
  104. package/dist/components/icons/Tag.d.ts +10 -0
  105. package/dist/components/icons/Tag.js +12 -0
  106. package/dist/components/layout/Carousel.d.ts +22 -0
  107. package/dist/components/layout/Carousel.js +233 -0
  108. package/dist/components/layout/DividerInserter.d.ts +11 -0
  109. package/dist/components/layout/DividerInserter.js +20 -0
  110. package/dist/components/layout/FAQSection.d.ts +23 -0
  111. package/dist/components/layout/FAQSection.js +14 -0
  112. package/dist/components/layout/Tile.d.ts +34 -0
  113. package/dist/components/layout/Tile.js +18 -0
  114. package/dist/components/modals/ConfirmDialog.d.ts +34 -0
  115. package/dist/components/modals/ConfirmDialog.js +31 -0
  116. package/dist/components/modals/DiscardChangesDialog.d.ts +19 -0
  117. package/dist/components/modals/DiscardChangesDialog.js +24 -0
  118. package/dist/components/modals/InputModal.d.ts +9 -0
  119. package/dist/components/modals/InputModal.js +9 -0
  120. package/dist/components/modals/LanguageModal.d.ts +17 -0
  121. package/dist/components/modals/LanguageModal.js +35 -0
  122. package/dist/components/modals/Modal.d.ts +38 -0
  123. package/dist/components/modals/Modal.js +57 -0
  124. package/dist/components/modals/ModalRegister.d.ts +11 -0
  125. package/dist/components/modals/ModalRegister.js +28 -0
  126. package/dist/components/properties/CheckboxProperty.d.ts +15 -0
  127. package/dist/components/properties/CheckboxProperty.js +27 -0
  128. package/dist/components/properties/DateProperty.d.ts +11 -0
  129. package/dist/components/properties/DateProperty.js +22 -0
  130. package/dist/components/properties/MultiSelectProperty.d.ts +12 -0
  131. package/dist/components/properties/MultiSelectProperty.js +33 -0
  132. package/dist/components/properties/NumberProperty.d.ts +16 -0
  133. package/dist/components/properties/NumberProperty.js +42 -0
  134. package/dist/components/properties/PropertyBase.d.ts +23 -0
  135. package/dist/components/properties/PropertyBase.js +27 -0
  136. package/dist/components/properties/SelectProperty.d.ts +12 -0
  137. package/dist/components/properties/SelectProperty.js +22 -0
  138. package/dist/components/properties/TextProperty.d.ts +15 -0
  139. package/dist/components/properties/TextProperty.js +37 -0
  140. package/dist/components/user-input/Checkbox.d.ts +37 -0
  141. package/dist/components/user-input/Checkbox.js +63 -0
  142. package/dist/components/user-input/DateAndTimePicker.d.ts +39 -0
  143. package/dist/components/user-input/DateAndTimePicker.js +65 -0
  144. package/dist/components/user-input/Input.d.ts +61 -0
  145. package/dist/components/user-input/Input.js +61 -0
  146. package/dist/components/user-input/Label.d.ts +12 -0
  147. package/dist/components/user-input/Label.js +12 -0
  148. package/dist/components/user-input/Menu.d.ts +21 -0
  149. package/dist/components/user-input/Menu.js +26 -0
  150. package/dist/components/user-input/MultiSelect.d.ts +39 -0
  151. package/dist/components/user-input/MultiSelect.js +57 -0
  152. package/dist/components/user-input/ScrollPicker.d.ts +11 -0
  153. package/dist/components/user-input/ScrollPicker.js +151 -0
  154. package/dist/components/user-input/SearchableSelect.d.ts +8 -0
  155. package/dist/components/user-input/SearchableSelect.js +14 -0
  156. package/dist/components/user-input/Select.d.ts +32 -0
  157. package/dist/components/user-input/Select.js +48 -0
  158. package/dist/components/user-input/Textarea.d.ts +20 -0
  159. package/dist/components/user-input/Textarea.js +33 -0
  160. package/dist/components/user-input/ToggleableInput.d.ts +32 -0
  161. package/dist/components/user-input/ToggleableInput.js +40 -0
  162. package/{globals.css → dist/css/globals.css} +1 -1
  163. package/dist/hooks/useHoverState.d.ts +40 -0
  164. package/dist/hooks/useHoverState.js +46 -0
  165. package/dist/hooks/useLanguage.d.ts +17 -0
  166. package/dist/hooks/useLanguage.js +51 -0
  167. package/dist/hooks/useLocalStorage.d.ts +4 -0
  168. package/dist/hooks/useLocalStorage.js +24 -0
  169. package/dist/hooks/useOutsideClick.d.ts +2 -0
  170. package/dist/hooks/useOutsideClick.js +22 -0
  171. package/dist/hooks/useSaveDelay.d.ts +5 -0
  172. package/dist/hooks/useSaveDelay.js +41 -0
  173. package/dist/hooks/useTheme.d.ts +16 -0
  174. package/dist/hooks/useTheme.js +32 -0
  175. package/dist/hooks/useTranslation.d.ts +24 -0
  176. package/dist/hooks/useTranslation.js +11 -0
  177. package/dist/util/array.d.ts +23 -0
  178. package/dist/util/array.js +103 -0
  179. package/{util/builder.ts → dist/util/builder.d.ts} +1 -4
  180. package/dist/util/builder.js +9 -0
  181. package/dist/util/date.d.ts +28 -0
  182. package/dist/util/date.js +133 -0
  183. package/dist/util/easeFunctions.d.ts +9 -0
  184. package/dist/util/easeFunctions.js +30 -0
  185. package/dist/util/emailValidation.d.ts +1 -0
  186. package/dist/util/emailValidation.js +3 -0
  187. package/dist/util/loopingArray.d.ts +23 -0
  188. package/dist/util/loopingArray.js +67 -0
  189. package/dist/util/math.d.ts +1 -0
  190. package/dist/util/math.js +3 -0
  191. package/dist/util/news.d.ts +98 -0
  192. package/dist/util/news.js +27 -0
  193. package/dist/util/noop.d.ts +1 -0
  194. package/dist/util/noop.js +1 -0
  195. package/{util/simpleSearch.ts → dist/util/simpleSearch.d.ts} +4 -21
  196. package/dist/util/simpleSearch.js +62 -0
  197. package/dist/util/storage.d.ts +15 -0
  198. package/dist/util/storage.js +32 -0
  199. package/dist/util/types.d.ts +1 -0
  200. package/dist/util/types.js +1 -0
  201. package/package.json +7 -8
  202. package/coloring/shading.ts +0 -46
  203. package/coloring/types.ts +0 -13
  204. package/components/Avatar.tsx +0 -58
  205. package/components/AvatarGroup.tsx +0 -48
  206. package/components/BreadCrumb.tsx +0 -35
  207. package/components/Button.tsx +0 -236
  208. package/components/ChipList.tsx +0 -89
  209. package/components/Circle.tsx +0 -27
  210. package/components/ErrorComponent.tsx +0 -40
  211. package/components/Expandable.tsx +0 -61
  212. package/components/HelpwaveBadge.tsx +0 -35
  213. package/components/HideableContentSection.tsx +0 -43
  214. package/components/InputGroup.tsx +0 -72
  215. package/components/LoadingAndErrorComponent.tsx +0 -47
  216. package/components/LoadingAnimation.tsx +0 -40
  217. package/components/LoadingButton.tsx +0 -27
  218. package/components/MarkdownInterpreter.tsx +0 -278
  219. package/components/Pagination.tsx +0 -65
  220. package/components/Profile.tsx +0 -124
  221. package/components/ProgressIndicator.tsx +0 -58
  222. package/components/Ring.tsx +0 -286
  223. package/components/SearchableList.tsx +0 -69
  224. package/components/SortButton.tsx +0 -33
  225. package/components/StepperBar.tsx +0 -124
  226. package/components/Table.tsx +0 -330
  227. package/components/TechRadar.tsx +0 -247
  228. package/components/TextImage.tsx +0 -86
  229. package/components/TimeDisplay.tsx +0 -121
  230. package/components/Tooltip.tsx +0 -92
  231. package/components/VerticalDivider.tsx +0 -51
  232. package/components/date/DatePicker.tsx +0 -164
  233. package/components/date/DayPicker.tsx +0 -95
  234. package/components/date/TimePicker.tsx +0 -167
  235. package/components/date/YearMonthPicker.tsx +0 -130
  236. package/components/examples/InputGroupExample.tsx +0 -58
  237. package/components/examples/MultiSelectExample.tsx +0 -57
  238. package/components/examples/SearchableSelectExample.tsx +0 -34
  239. package/components/examples/SelectExample.tsx +0 -28
  240. package/components/examples/StackingModals.tsx +0 -54
  241. package/components/examples/TableExample.tsx +0 -159
  242. package/components/examples/TextareaExample.tsx +0 -23
  243. package/components/examples/TileExample.tsx +0 -25
  244. package/components/examples/date/DateTimePickerExample.tsx +0 -53
  245. package/components/examples/properties/CheckboxPropertyExample.tsx +0 -29
  246. package/components/examples/properties/DatePropertyExample.tsx +0 -44
  247. package/components/examples/properties/MultiSelectPropertyExample.tsx +0 -39
  248. package/components/examples/properties/NumberPropertyExample.tsx +0 -28
  249. package/components/examples/properties/SelectPropertyExample.tsx +0 -39
  250. package/components/examples/properties/TextPropertyExample.tsx +0 -30
  251. package/components/icons/Helpwave.tsx +0 -51
  252. package/components/icons/Tag.tsx +0 -29
  253. package/components/layout/Carousel.tsx +0 -396
  254. package/components/layout/DividerInserter.tsx +0 -37
  255. package/components/layout/FAQSection.tsx +0 -57
  256. package/components/layout/Tile.tsx +0 -67
  257. package/components/modals/ConfirmDialog.tsx +0 -105
  258. package/components/modals/DiscardChangesDialog.tsx +0 -71
  259. package/components/modals/InputModal.tsx +0 -26
  260. package/components/modals/LanguageModal.tsx +0 -76
  261. package/components/modals/Modal.tsx +0 -149
  262. package/components/modals/ModalRegister.tsx +0 -45
  263. package/components/properties/CheckboxProperty.tsx +0 -62
  264. package/components/properties/DateProperty.tsx +0 -58
  265. package/components/properties/MultiSelectProperty.tsx +0 -82
  266. package/components/properties/NumberProperty.tsx +0 -86
  267. package/components/properties/PropertyBase.tsx +0 -84
  268. package/components/properties/SelectProperty.tsx +0 -67
  269. package/components/properties/TextProperty.tsx +0 -81
  270. package/components/user-input/Checkbox.tsx +0 -139
  271. package/components/user-input/DateAndTimePicker.tsx +0 -156
  272. package/components/user-input/Input.tsx +0 -192
  273. package/components/user-input/Label.tsx +0 -32
  274. package/components/user-input/Menu.tsx +0 -75
  275. package/components/user-input/MultiSelect.tsx +0 -158
  276. package/components/user-input/ScrollPicker.tsx +0 -240
  277. package/components/user-input/SearchableSelect.tsx +0 -36
  278. package/components/user-input/Select.tsx +0 -132
  279. package/components/user-input/Textarea.tsx +0 -86
  280. package/components/user-input/ToggleableInput.tsx +0 -115
  281. package/hooks/useHoverState.ts +0 -88
  282. package/hooks/useLanguage.tsx +0 -78
  283. package/hooks/useLocalStorage.tsx +0 -33
  284. package/hooks/useOutsideClick.ts +0 -25
  285. package/hooks/useSaveDelay.ts +0 -46
  286. package/hooks/useTheme.tsx +0 -57
  287. package/hooks/useTranslation.ts +0 -43
  288. package/index.ts +0 -0
  289. package/util/array.ts +0 -115
  290. package/util/date.ts +0 -180
  291. package/util/easeFunctions.ts +0 -37
  292. package/util/emailValidation.ts +0 -3
  293. package/util/loopingArray.ts +0 -94
  294. package/util/math.ts +0 -3
  295. package/util/news.ts +0 -43
  296. package/util/noop.ts +0 -1
  297. package/util/storage.ts +0 -37
  298. package/util/types.ts +0 -4
  299. /package/{components/Span.tsx → dist/components/Span.d.ts} +0 -0
  300. /package/{components/examples/Title.tsx → dist/components/examples/Title.d.ts} +0 -0
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  This repository contains all components and themes employed by helpwave's web application
3
3
 
4
4
  ## Theming
5
- Theming is achieved through an extensive [tailwindcss](https://tailwindcss.com) config in the [globals.css](globals.css)
5
+ Theming is achieved through an extensive [tailwindcss](https://tailwindcss.com) config in the [globals.css](src/css/globals.css)
6
6
 
7
7
  ## Storybook
8
8
  We use [storybook](https://storybook.js.org/) for easily testing and showcasing our component library
@@ -0,0 +1,2 @@
1
+ import type { ShadedColors } from './types';
2
+ export declare const generateShadingColors: (partialShading: Omit<Partial<ShadedColors>, "0" | "1000">) => ShadedColors;
@@ -0,0 +1,40 @@
1
+ import tinycolor from 'tinycolor2';
2
+ import { shadingColorValues } from './types';
3
+ // Function to generate a full shading of several colors
4
+ export const generateShadingColors = (partialShading) => {
5
+ var _a, _b;
6
+ const shading = {
7
+ 0: '#FFFFFF',
8
+ 1000: '#000000'
9
+ };
10
+ let index = 1;
11
+ while (index < shadingColorValues.length - 1) {
12
+ const previous = shadingColorValues[index - 1];
13
+ const current = shadingColorValues[index];
14
+ if (partialShading[current] !== undefined) {
15
+ shading[current] = partialShading[current];
16
+ index++;
17
+ continue;
18
+ }
19
+ let j = index + 1;
20
+ while (j < shadingColorValues.length) {
21
+ if (partialShading[shadingColorValues[j]] !== undefined) {
22
+ break;
23
+ }
24
+ j++;
25
+ }
26
+ if (j === shadingColorValues.length) {
27
+ j = shadingColorValues.length - 1;
28
+ }
29
+ const nextFound = shadingColorValues[j];
30
+ const interval = nextFound - previous;
31
+ for (let k = index; k < j; k++) {
32
+ const current = shadingColorValues[k];
33
+ const previousValue = (_a = partialShading[previous]) !== null && _a !== void 0 ? _a : shading[previous];
34
+ const nextValue = (_b = partialShading[nextFound]) !== null && _b !== void 0 ? _b : shading[nextFound];
35
+ shading[current] = tinycolor.mix(tinycolor(previousValue), tinycolor(nextValue), (current - previous) / interval * 100).toHexString();
36
+ }
37
+ index = j;
38
+ }
39
+ return shading;
40
+ };
@@ -0,0 +1,11 @@
1
+ export declare const shadingColorValues: readonly [0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000];
2
+ export type ColorShadingValue = typeof shadingColorValues[number];
3
+ export type ShadedColors = Record<ColorShadingValue, string>;
4
+ export type ColoringStyle = 'background' | 'tonal' | 'tonal-opaque' | 'text' | 'text-border';
5
+ export type ColorMode = 'light' | 'dark';
6
+ export type Coloring = {
7
+ color: '';
8
+ style?: ColoringStyle;
9
+ mode?: ColorMode;
10
+ hover?: boolean;
11
+ };
@@ -0,0 +1 @@
1
+ export const shadingColorValues = [0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000];
@@ -0,0 +1,14 @@
1
+ export declare const avtarSizeList: readonly ["tiny", "small", "medium", "large"];
2
+ export type AvatarSize = typeof avtarSizeList[number];
3
+ export declare const avatarSizeMapping: Record<AvatarSize, number>;
4
+ export type AvatarProps = {
5
+ avatarUrl: string;
6
+ alt: string;
7
+ size?: AvatarSize;
8
+ className?: string;
9
+ };
10
+ /**
11
+ * A component for showing a profile picture
12
+ */
13
+ declare const Avatar: ({ avatarUrl, alt, size, className }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
14
+ export { Avatar };
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Image from 'next/image';
3
+ import clsx from 'clsx';
4
+ export const avtarSizeList = ['tiny', 'small', 'medium', 'large'];
5
+ export const avatarSizeMapping = {
6
+ tiny: 24,
7
+ small: 32,
8
+ medium: 48,
9
+ large: 64
10
+ };
11
+ /**
12
+ * A component for showing a profile picture
13
+ */
14
+ const Avatar = ({ avatarUrl, alt, size = 'medium', className = '' }) => {
15
+ // TODO remove later
16
+ avatarUrl = 'https://cdn.helpwave.de/boringavatar.svg';
17
+ const avtarSize = {
18
+ tiny: 24,
19
+ small: 32,
20
+ medium: 48,
21
+ large: 64,
22
+ }[size];
23
+ const style = {
24
+ width: avtarSize + 'px',
25
+ height: avtarSize + 'px',
26
+ maxWidth: avtarSize + 'px',
27
+ maxHeight: avtarSize + 'px',
28
+ minWidth: avtarSize + 'px',
29
+ minHeight: avtarSize + 'px',
30
+ };
31
+ return (
32
+ // TODO transparent or white background later
33
+ _jsx("div", { className: clsx(`rounded-full bg-primary`, className), style: style, children: _jsx(Image, { className: "rounded-full border border-gray-200", style: style, src: avatarUrl, alt: alt, width: avtarSize, height: avtarSize }) }));
34
+ };
35
+ export { Avatar };
@@ -0,0 +1,10 @@
1
+ import type { AvatarProps, AvatarSize } from './Avatar';
2
+ export type AvatarGroupProps = {
3
+ avatars: Omit<AvatarProps, 'size'>[];
4
+ maxShownProfiles?: number;
5
+ size?: AvatarSize;
6
+ };
7
+ /**
8
+ * A component for showing a group of Avatar's
9
+ */
10
+ export declare const AvatarGroup: ({ avatars, maxShownProfiles, size }: AvatarGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Avatar, avatarSizeMapping } from './Avatar';
3
+ /**
4
+ * A component for showing a group of Avatar's
5
+ */
6
+ export const AvatarGroup = ({ avatars, maxShownProfiles = 5, size = 'tiny' }) => {
7
+ const displayedProfiles = avatars.length < maxShownProfiles ? avatars : avatars.slice(0, maxShownProfiles);
8
+ const diameter = avatarSizeMapping[size];
9
+ const stackingOverlap = 0.5; // given as a percentage
10
+ const notDisplayedProfiles = avatars.length - maxShownProfiles;
11
+ const avatarGroupWidth = diameter * (stackingOverlap * (displayedProfiles.length - 1) + 1);
12
+ return (_jsxs("div", { className: "row relative", style: { height: diameter + 'px' }, children: [_jsx("div", { style: { width: avatarGroupWidth + 'px' }, children: displayedProfiles.map((avatar, index) => (_jsx("div", { className: "absolute", style: { left: (index * diameter * stackingOverlap) + 'px', zIndex: maxShownProfiles - index }, children: _jsx(Avatar, { avatarUrl: avatar.avatarUrl, alt: avatar.alt, size: size }) }, index))) }), notDisplayedProfiles > 0 && (_jsx("div", { className: "truncate row items-center", style: { fontSize: (diameter / 2) + 'px', marginLeft: (1 + diameter / 16) + 'px' }, children: _jsxs("span", { children: ["+ ", notDisplayedProfiles] }) }))] }));
13
+ };
@@ -0,0 +1,16 @@
1
+ export type Crumb = {
2
+ display: string;
3
+ link: string;
4
+ };
5
+ type BreadCrumbProps = {
6
+ crumbs: Crumb[];
7
+ linkClassName?: string;
8
+ containerClassName?: string;
9
+ };
10
+ /**
11
+ * A component for showing a hierarchical link structure with an independent link on each element
12
+ *
13
+ * e.g. Organizations/Ward/<id>
14
+ */
15
+ export declare const BreadCrumb: ({ crumbs, linkClassName, containerClassName }: BreadCrumbProps) => import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Link from 'next/link';
3
+ import clsx from 'clsx';
4
+ /**
5
+ * A component for showing a hierarchical link structure with an independent link on each element
6
+ *
7
+ * e.g. Organizations/Ward/<id>
8
+ */
9
+ export const BreadCrumb = ({ crumbs, linkClassName, containerClassName }) => {
10
+ const color = 'text-description';
11
+ return (_jsx("div", { className: clsx('row', containerClassName), children: crumbs.map((crumb, index) => (_jsxs("div", { children: [_jsx(Link, { href: crumb.link, className: clsx(linkClassName, { [`${color} hover:brightness-60`]: index !== crumbs.length - 1 }), children: crumb.display }), index !== crumbs.length - 1 && _jsx("span", { className: clsx(`px-1`, color), children: "/" })] }, index))) }));
12
+ };
@@ -0,0 +1,41 @@
1
+ import type { PropsWithChildren, ButtonHTMLAttributes, ReactNode } from 'react';
2
+ export type SolidButtonColor = 'primary' | 'secondary' | 'tertiary' | 'positive' | 'warning' | 'negative';
3
+ export type OutlineButtonColor = 'primary';
4
+ export type TextButtonColor = 'negative' | 'neutral';
5
+ type ButtonSizes = 'small' | 'medium' | 'large';
6
+ /**
7
+ * The shard properties between all button types
8
+ */
9
+ export type ButtonProps = PropsWithChildren<{
10
+ /**
11
+ * @default 'medium'
12
+ */
13
+ size?: ButtonSizes;
14
+ }> & ButtonHTMLAttributes<Element>;
15
+ export declare const ButtonSizePaddings: Record<ButtonSizes, string>;
16
+ type ButtonWithIconsProps = ButtonProps & {
17
+ startIcon?: ReactNode;
18
+ endIcon?: ReactNode;
19
+ };
20
+ export type SolidButtonProps = ButtonWithIconsProps & {
21
+ color?: SolidButtonColor;
22
+ };
23
+ export type OutlineButtonProps = ButtonWithIconsProps & {
24
+ color?: OutlineButtonColor;
25
+ };
26
+ export type TextButtonProps = ButtonWithIconsProps & {
27
+ color?: TextButtonColor;
28
+ };
29
+ /**
30
+ * A button with a solid background and different sizes
31
+ */
32
+ declare const SolidButton: ({ children, disabled, color, size, startIcon, endIcon, onClick, className, ...restProps }: SolidButtonProps) => import("react/jsx-runtime").JSX.Element;
33
+ /**
34
+ * A button with an outline border and different sizes
35
+ */
36
+ declare const OutlineButton: ({ children, disabled, color, size, startIcon, endIcon, onClick, className, ...restProps }: OutlineButtonProps) => import("react/jsx-runtime").JSX.Element;
37
+ /**
38
+ * A text that is a button that can have different sizes
39
+ */
40
+ declare const TextButton: ({ children, disabled, color, size, startIcon, endIcon, onClick, className, ...restProps }: TextButtonProps) => import("react/jsx-runtime").JSX.Element;
41
+ export { SolidButton, OutlineButton, TextButton };
@@ -0,0 +1,84 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import clsx from 'clsx';
3
+ export const ButtonSizePaddings = {
4
+ small: 'btn-sm',
5
+ medium: 'btn-md',
6
+ large: 'btn-lg'
7
+ };
8
+ /**
9
+ * A button with a solid background and different sizes
10
+ */
11
+ const SolidButton = ({ children, disabled = false, color = 'primary', size = 'medium', startIcon, endIcon, onClick, className, ...restProps }) => {
12
+ const colorClasses = {
13
+ primary: 'bg-button-solid-primary-background text-button-solid-primary-text',
14
+ secondary: 'bg-button-solid-secondary-background text-button-solid-secondary-text',
15
+ tertiary: 'bg-button-solid-tertiary-background text-button-solid-tertiary-text',
16
+ positive: 'bg-button-solid-positive-background text-button-solid-positive-text',
17
+ warning: 'bg-button-solid-warning-background text-button-solid-warning-text',
18
+ negative: 'bg-button-solid-negative-background text-button-solid-negative-text',
19
+ }[color];
20
+ const iconColorClasses = {
21
+ primary: 'text-button-solid-primary-icon',
22
+ secondary: 'text-button-solid-secondary-icon',
23
+ tertiary: 'text-button-solid-tertiary-icon',
24
+ positive: 'text-button-solid-positive-icon',
25
+ warning: 'text-button-solid-warning-icon',
26
+ negative: 'text-button-solid-negative-icon',
27
+ }[color];
28
+ return (_jsxs("button", { onClick: disabled ? undefined : onClick, disabled: disabled || onClick === undefined, className: clsx(className, {
29
+ 'text-disabled-text bg-disabled-background': disabled,
30
+ [clsx(colorClasses, 'hover:brightness-90')]: !disabled
31
+ }, ButtonSizePaddings[size]), ...restProps, children: [startIcon && (_jsx("span", { className: clsx({
32
+ [iconColorClasses]: !disabled,
33
+ [`text-disabled-icon`]: disabled
34
+ }), children: startIcon })), children, endIcon && (_jsx("span", { className: clsx({
35
+ [iconColorClasses]: !disabled,
36
+ [`text-disabled-icon`]: disabled
37
+ }), children: endIcon }))] }));
38
+ };
39
+ /**
40
+ * A button with an outline border and different sizes
41
+ */
42
+ const OutlineButton = ({ children, disabled = false, color = 'primary', size = 'medium', startIcon, endIcon, onClick, className, ...restProps }) => {
43
+ const colorClasses = {
44
+ primary: 'bg-transparent border-2 border-button-outline-primary-text text-button-outline-primary-text',
45
+ }[color];
46
+ const iconColorClasses = {
47
+ primary: 'text-button-outline-primary-icon',
48
+ }[color];
49
+ return (_jsxs("button", { onClick: disabled ? undefined : onClick, disabled: disabled || onClick === undefined, className: clsx(className, {
50
+ 'text-disabled-text border-disabled-outline)': disabled,
51
+ [clsx(colorClasses, 'hover:brightness-80')]: !disabled,
52
+ }, ButtonSizePaddings[size]), ...restProps, children: [startIcon && (_jsx("span", { className: clsx({
53
+ [iconColorClasses]: !disabled,
54
+ [`text-disabled-icon`]: disabled
55
+ }), children: startIcon })), children, endIcon && (_jsx("span", { className: clsx({
56
+ [iconColorClasses]: !disabled,
57
+ [`text-disabled-icon`]: disabled
58
+ }), children: endIcon }))] }));
59
+ };
60
+ /**
61
+ * A text that is a button that can have different sizes
62
+ */
63
+ const TextButton = ({ children, disabled = false, color = 'neutral', size = 'medium', startIcon, endIcon, onClick, className, ...restProps }) => {
64
+ const colorClasses = {
65
+ negative: 'bg-transparent text-button-text-negative-text',
66
+ neutral: 'bg-transparent text-button-text-neutral-text',
67
+ }[color];
68
+ const iconColorClasses = {
69
+ negative: 'text-button-text-negative-icon',
70
+ neutral: 'text-button-text-neutral-icon',
71
+ }[color];
72
+ return (_jsxs("button", { onClick: disabled ? undefined : onClick, disabled: disabled || onClick === undefined, className: clsx(className, {
73
+ 'text-disabled-text': disabled,
74
+ [clsx(colorClasses, 'hover:bg-button-text-hover-background rounded-full')]: !disabled,
75
+ }, ButtonSizePaddings[size]), ...restProps, children: [startIcon && (_jsx("span", { className: clsx({
76
+ [iconColorClasses]: !disabled,
77
+ [`text-disabled-icon`]: disabled
78
+ }), children: startIcon })), children, endIcon && (_jsx("span", { className: clsx({
79
+ [iconColorClasses]: !disabled,
80
+ [`text-disabled-icon`]: disabled
81
+ }), children: endIcon }))] }));
82
+ };
83
+ // TODO Icon button
84
+ export { SolidButton, OutlineButton, TextButton };
@@ -0,0 +1,21 @@
1
+ import type { HTMLProps, PropsWithChildren, ReactNode } from 'react';
2
+ export type ChipColor = 'default' | 'dark' | 'red' | 'yellow' | 'green' | 'blue' | 'pink';
3
+ type ChipVariant = 'normal' | 'fullyRounded';
4
+ export type ChipProps = HTMLProps<HTMLDivElement> & PropsWithChildren<{
5
+ color?: ChipColor;
6
+ variant?: ChipVariant;
7
+ trailingIcon?: ReactNode;
8
+ }>;
9
+ /**
10
+ * A component for displaying a single chip
11
+ */
12
+ export declare const Chip: ({ children, trailingIcon, color, variant, className, ...restProps }: ChipProps) => import("react/jsx-runtime").JSX.Element;
13
+ export type ChipListProps = {
14
+ list: ChipProps[];
15
+ className?: string;
16
+ };
17
+ /**
18
+ * A component for displaying a list of chips
19
+ */
20
+ export declare const ChipList: ({ list, className }: ChipListProps) => import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import clsx from 'clsx';
3
+ /**
4
+ * A component for displaying a single chip
5
+ */
6
+ export const Chip = ({ children, trailingIcon, color = 'default', variant = 'normal', className = '', ...restProps }) => {
7
+ const colorMapping = {
8
+ default: 'text-tag-default-text bg-tag-default-background',
9
+ dark: 'text-tag-dark-text bg-tag-dark-background',
10
+ red: 'text-tag-red-text bg-tag-red-background',
11
+ yellow: 'text-tag-yellow-text bg-tag-yellow-background',
12
+ green: 'text-tag-green-text bg-tag-green-background',
13
+ blue: 'text-tag-blue-text bg-tag-blue-background',
14
+ pink: 'text-tag-pink-text bg-tag-pink-background',
15
+ }[color];
16
+ const colorMappingIcon = {
17
+ default: 'text-tag-default-icon',
18
+ dark: 'text-tag-dark-icon',
19
+ red: 'text-tag-red-icon',
20
+ yellow: 'text-tag-yellow-icon',
21
+ green: 'text-tag-green-icon',
22
+ blue: 'text-tag-blue-icon',
23
+ pink: 'text-tag-pink-icon',
24
+ }[color];
25
+ return (_jsxs("div", { ...restProps, className: clsx(`row w-fit px-2 py-1`, colorMapping, {
26
+ 'rounded-md': variant === 'normal',
27
+ 'rounded-full': variant === 'fullyRounded',
28
+ }, className), children: [children, trailingIcon && (_jsx("span", { className: colorMappingIcon, children: trailingIcon }))] }));
29
+ };
30
+ /**
31
+ * A component for displaying a list of chips
32
+ */
33
+ export const ChipList = ({ list, className = '' }) => {
34
+ return (_jsx("div", { className: clsx('flex flex-wrap gap-x-4 gap-y-2', className), children: list.map((value, index) => {
35
+ var _a, _b;
36
+ return (_jsx(Chip, { ...value, color: (_a = value.color) !== null && _a !== void 0 ? _a : 'dark', variant: (_b = value.variant) !== null && _b !== void 0 ? _b : 'normal', children: value.children }, index));
37
+ }) }));
38
+ };
@@ -0,0 +1,6 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ export type CircleProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'color'> & {
3
+ radius: number;
4
+ className?: string;
5
+ };
6
+ export declare const Circle: ({ radius, className, style, ...restProps }: CircleProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import clsx from 'clsx';
3
+ export const Circle = ({ radius = 20, className = 'bg-primary', style, ...restProps }) => {
4
+ const size = radius * 2;
5
+ return (_jsx("div", { className: clsx(`rounded-full`, className), style: {
6
+ width: `${size}px`,
7
+ height: `${size}px`,
8
+ ...style,
9
+ }, ...restProps }));
10
+ };
@@ -0,0 +1,13 @@
1
+ import type { PropsForTranslation } from '../hooks/useTranslation';
2
+ type ErrorComponentTranslation = {
3
+ errorOccurred: string;
4
+ };
5
+ export type ErrorComponentProps = {
6
+ errorText?: string;
7
+ classname?: string;
8
+ };
9
+ /**
10
+ * The Component to show when an error occurred
11
+ */
12
+ export declare const ErrorComponent: ({ overwriteTranslation, errorText, classname }: PropsForTranslation<ErrorComponentTranslation, ErrorComponentProps>) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AlertOctagon } from 'lucide-react';
3
+ import { useTranslation } from '../hooks/useTranslation';
4
+ import clsx from 'clsx';
5
+ const defaultErrorComponentTranslation = {
6
+ en: {
7
+ errorOccurred: 'An error occurred'
8
+ },
9
+ de: {
10
+ errorOccurred: 'Ein Fehler ist aufgetreten'
11
+ }
12
+ };
13
+ /**
14
+ * The Component to show when an error occurred
15
+ */
16
+ export const ErrorComponent = ({ overwriteTranslation, errorText, classname }) => {
17
+ const translation = useTranslation(defaultErrorComponentTranslation, overwriteTranslation);
18
+ return (_jsxs("div", { className: clsx('col items-center justify-center gap-y-4 w-full h-24', classname), children: [_jsx(AlertOctagon, { size: 64, className: "text-warning" }), errorText !== null && errorText !== void 0 ? errorText : `${translation.errorOccurred} :(`] }));
19
+ };
@@ -0,0 +1,30 @@
1
+ import type { PropsWithChildren, ReactNode } from 'react';
2
+ type IconBuilder = (expanded: boolean) => ReactNode;
3
+ export type ExpandableProps = PropsWithChildren<{
4
+ label: ReactNode;
5
+ icon?: IconBuilder;
6
+ initialExpansion?: boolean;
7
+ /**
8
+ * Whether the expansion should only happen when the header is clicked or on the entire component
9
+ */
10
+ clickOnlyOnHeader?: boolean;
11
+ className?: string;
12
+ headerClassName?: string;
13
+ }>;
14
+ /**
15
+ * A Component for showing and hiding content
16
+ */
17
+ export declare const Expandable: import("react").ForwardRefExoticComponent<{
18
+ label: ReactNode;
19
+ icon?: IconBuilder;
20
+ initialExpansion?: boolean;
21
+ /**
22
+ * Whether the expansion should only happen when the header is clicked or on the entire component
23
+ */
24
+ clickOnlyOnHeader?: boolean;
25
+ className?: string;
26
+ headerClassName?: string;
27
+ } & {
28
+ children?: ReactNode | undefined;
29
+ } & import("react").RefAttributes<HTMLDivElement>>;
30
+ export {};
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useState } from 'react';
3
+ import { ChevronDown, ChevronUp } from 'lucide-react';
4
+ import clsx from 'clsx';
5
+ const DefaultIcon = (expanded) => expanded ?
6
+ (_jsx(ChevronUp, { size: 16, className: "min-w-[16px]" }))
7
+ : (_jsx(ChevronDown, { size: 16, className: "min-w-[16px]" }));
8
+ /**
9
+ * A Component for showing and hiding content
10
+ */
11
+ export const Expandable = forwardRef(({ children, label, icon, initialExpansion = false, clickOnlyOnHeader = true, className = '', headerClassName = '' }, ref) => {
12
+ const [isExpanded, setIsExpanded] = useState(initialExpansion);
13
+ icon !== null && icon !== void 0 ? icon : (icon = DefaultIcon);
14
+ return (_jsxs("div", { ref: ref, className: clsx('col bg-surface text-on-surface group rounded-lg shadow-sm', { 'cursor-pointer': !clickOnlyOnHeader }, className), onClick: () => !clickOnlyOnHeader && setIsExpanded(!isExpanded), children: [_jsxs("button", { className: clsx('btn-md rounded-lg justify-between items-center bg-surface text-on-surface', { 'group-hover:brightness-95': !isExpanded }, headerClassName), onClick: () => clickOnlyOnHeader && setIsExpanded(!isExpanded), children: [label, icon(isExpanded)] }), isExpanded && (_jsx("div", { className: "col", children: children }))] }));
15
+ });
16
+ Expandable.displayName = 'Expandable';
@@ -0,0 +1,11 @@
1
+ type Size = 'small' | 'large';
2
+ export type HelpwaveBadgeProps = {
3
+ size?: Size;
4
+ title?: string;
5
+ className?: string;
6
+ };
7
+ /**
8
+ * A Badge with the helpwave logo and the helpwave name
9
+ */
10
+ export declare const HelpwaveBadge: ({ size, title, className }: HelpwaveBadgeProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import clsx from 'clsx';
3
+ import { Helpwave } from './icons/Helpwave';
4
+ import { Tile } from './layout/Tile';
5
+ /**
6
+ * A Badge with the helpwave logo and the helpwave name
7
+ */
8
+ export const HelpwaveBadge = ({ size = 'small', title = 'helpwave', className = '' }) => {
9
+ const iconSize = size === 'small' ? 24 : 64;
10
+ return (_jsx(Tile, { prefix: (_jsx(Helpwave, { size: iconSize })), title: { value: title, className: size === 'small' ? 'textstyle-title-lg text-base' : 'textstyle-title-xl' }, className: clsx({
11
+ 'px-2 py-1 rounded-md': size === 'small',
12
+ 'px-4 py-1 rounded-md': size === 'large',
13
+ }, className) }));
14
+ };
@@ -0,0 +1,10 @@
1
+ import { type PropsWithChildren, type ReactNode } from 'react';
2
+ export type HideableContentSectionProps = PropsWithChildren & {
3
+ initiallyOpen?: boolean;
4
+ disabled: boolean;
5
+ header: ReactNode;
6
+ };
7
+ /**
8
+ * A Component to hide and show
9
+ */
10
+ export declare const HideableContentSection: ({ initiallyOpen, disabled, children, header }: HideableContentSectionProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { ChevronDown, ChevronUp } from 'lucide-react';
4
+ import clsx from 'clsx';
5
+ /**
6
+ * A Component to hide and show
7
+ */
8
+ export const HideableContentSection = ({ initiallyOpen = true, disabled, children, header }) => {
9
+ const [open, setOpen] = useState(initiallyOpen);
10
+ return (_jsxs("div", { className: "col", children: [_jsxs("div", { className: clsx('row justify-between items-center', { 'cursor-pointer': !disabled }), onClick: () => {
11
+ if (!disabled) {
12
+ setOpen(!open);
13
+ }
14
+ }, children: [_jsx("div", { children: header }), !disabled && (open ? _jsx(ChevronUp, {}) : _jsx(ChevronDown, {}))] }), open && (_jsx("div", { children: children }))] }));
15
+ };
@@ -0,0 +1,13 @@
1
+ import type { PropsWithChildren } from 'react';
2
+ export type InputGroupProps = PropsWithChildren<{
3
+ title: string;
4
+ expanded?: boolean;
5
+ isExpandable?: boolean;
6
+ disabled?: boolean;
7
+ onChange?: (value: boolean) => void;
8
+ className?: string;
9
+ }>;
10
+ /**
11
+ * A Component for layouting inputs in an expandable group
12
+ */
13
+ export declare const InputGroup: ({ children, title, expanded, isExpandable, disabled, onChange, className, }: InputGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { ChevronDown, ChevronUp } from 'lucide-react';
4
+ import clsx from 'clsx';
5
+ import { noop } from '../util/noop';
6
+ /**
7
+ * A Component for layouting inputs in an expandable group
8
+ */
9
+ export const InputGroup = ({ children, title, expanded = true, isExpandable = true, disabled = false, onChange = noop, className = '', }) => {
10
+ const [isExpanded, setIsExpanded] = useState(expanded);
11
+ useEffect(() => {
12
+ setIsExpanded(expanded);
13
+ }, [expanded]);
14
+ return (_jsxs("div", { className: clsx('col gap-y-4 p-4 bg-white rounded-xl', className), children: [_jsxs("div", { className: clsx('row justify-between items-center', {
15
+ 'cursor-pointer': isExpandable && !disabled,
16
+ 'cursor-not-allowed': disabled,
17
+ }, {
18
+ 'text-primary': !disabled,
19
+ 'text-primary/40': disabled
20
+ }), onClick: () => {
21
+ if (!isExpandable) {
22
+ return;
23
+ }
24
+ const updatedIsExpanded = !isExpanded;
25
+ onChange(updatedIsExpanded);
26
+ setIsExpanded(updatedIsExpanded);
27
+ }, children: [_jsx("span", { className: "textstyle-title-md", children: title }), _jsx("div", { className: clsx('rounded-full text-white w-6 h-6', {
28
+ 'bg-primary': (isExpandable && !disabled) || expanded,
29
+ 'bg-primary/40': disabled,
30
+ }), children: isExpanded
31
+ ? _jsx(ChevronUp, { className: "-translate-y-[1px]", size: 24 })
32
+ : _jsx(ChevronDown, { className: "translate-y-[1px]", size: 24 }) })] }), isExpanded && (_jsx("div", { className: "col gap-y-2 h-full", children: children }))] }));
33
+ };
@@ -0,0 +1,17 @@
1
+ import type { PropsWithChildren } from 'react';
2
+ import type { LoadingAnimationProps } from './LoadingAnimation';
3
+ import type { ErrorComponentProps } from './ErrorComponent';
4
+ export type LoadingAndErrorComponentProps = PropsWithChildren<{
5
+ isLoading?: boolean;
6
+ hasError?: boolean;
7
+ loadingProps?: LoadingAnimationProps;
8
+ errorProps?: ErrorComponentProps;
9
+ /**
10
+ * in milliseconds
11
+ */
12
+ minimumLoadingDuration?: number;
13
+ }>;
14
+ /**
15
+ * A Component that shows the Error and Loading animation, when appropriate and the children otherwise
16
+ */
17
+ export declare const LoadingAndErrorComponent: ({ children, isLoading, hasError, errorProps, loadingProps, minimumLoadingDuration }: LoadingAndErrorComponentProps) => string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<import("react").ReactNode> | null | undefined;
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { LoadingAnimation } from './LoadingAnimation';
4
+ import { ErrorComponent } from './ErrorComponent';
5
+ /**
6
+ * A Component that shows the Error and Loading animation, when appropriate and the children otherwise
7
+ */
8
+ export const LoadingAndErrorComponent = ({ children, isLoading = false, hasError = false, errorProps, loadingProps, minimumLoadingDuration }) => {
9
+ const [isInMinimumLoading, setIsInMinimumLoading] = useState(false);
10
+ const [hasUsedMinimumLoading, setHasUsedMinimumLoading] = useState(false);
11
+ if (minimumLoadingDuration && !isInMinimumLoading && !hasUsedMinimumLoading) {
12
+ setIsInMinimumLoading(true);
13
+ setTimeout(() => {
14
+ setIsInMinimumLoading(false);
15
+ setHasUsedMinimumLoading(true);
16
+ }, minimumLoadingDuration);
17
+ }
18
+ if (isLoading || (minimumLoadingDuration && isInMinimumLoading)) {
19
+ return _jsx(LoadingAnimation, { ...loadingProps });
20
+ }
21
+ if (hasError) {
22
+ return _jsx(ErrorComponent, { ...errorProps });
23
+ }
24
+ return children;
25
+ };
@@ -0,0 +1,13 @@
1
+ import type { PropsForTranslation } from '../hooks/useTranslation';
2
+ type LoadingAnimationTranslation = {
3
+ loading: string;
4
+ };
5
+ export type LoadingAnimationProps = {
6
+ loadingText?: string;
7
+ classname?: string;
8
+ };
9
+ /**
10
+ * A Component to show when loading data
11
+ */
12
+ export declare const LoadingAnimation: ({ overwriteTranslation, loadingText, classname }: PropsForTranslation<LoadingAnimationTranslation, LoadingAnimationProps>) => import("react/jsx-runtime").JSX.Element;
13
+ export {};