@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
@@ -0,0 +1,23 @@
1
+ import type { PropsForTranslation } from '../hooks/useTranslation';
2
+ type StepperBarTranslation = {
3
+ back: string;
4
+ next: string;
5
+ confirm: string;
6
+ };
7
+ export type StepperInformation = {
8
+ step: number;
9
+ lastStep: number;
10
+ seenSteps: Set<number>;
11
+ };
12
+ export type StepperBarProps = {
13
+ stepper: StepperInformation;
14
+ onChange: (step: StepperInformation) => void;
15
+ onFinish: () => void;
16
+ showDots?: boolean;
17
+ className?: string;
18
+ };
19
+ /**
20
+ * A Component for stepping
21
+ */
22
+ export declare const StepperBar: ({ overwriteTranslation, stepper, onChange, onFinish, showDots, className, }: PropsForTranslation<StepperBarTranslation, StepperBarProps>) => import("react/jsx-runtime").JSX.Element;
23
+ export {};
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Check, ChevronLeft, ChevronRight } from 'lucide-react';
3
+ import { useTranslation } from '../hooks/useTranslation';
4
+ import { range } from '../util/array';
5
+ import { SolidButton } from './Button';
6
+ import clsx from 'clsx';
7
+ const defaultStepperBarTranslation = {
8
+ en: {
9
+ back: 'Back',
10
+ next: 'Next Step',
11
+ confirm: 'Create'
12
+ },
13
+ de: {
14
+ back: 'Zurück',
15
+ next: 'Nächster Schritt',
16
+ confirm: 'Erstellen'
17
+ }
18
+ };
19
+ /**
20
+ * A Component for stepping
21
+ */
22
+ export const StepperBar = ({ overwriteTranslation, stepper, onChange, onFinish, showDots = true, className = '', }) => {
23
+ const translation = useTranslation(defaultStepperBarTranslation, overwriteTranslation);
24
+ const dots = range(0, stepper.lastStep);
25
+ const { step, seenSteps, lastStep } = stepper;
26
+ const update = (newStep) => {
27
+ seenSteps.add(newStep);
28
+ onChange({ step: newStep, seenSteps, lastStep });
29
+ };
30
+ return (_jsxs("div", { className: clsx('sticky row p-2 border-2 justify-between rounded-lg shadow-lg', className), children: [_jsx("div", { className: "flex-[2] justify-start", children: _jsxs(SolidButton, { disabled: step === 0, onClick: () => {
31
+ update(step - 1);
32
+ }, className: "row gap-x-1 items-center justify-center", children: [_jsx(ChevronLeft, { size: 14 }), translation.back] }) }), _jsx("div", { className: "row flex-[5] gap-x-2 justify-center items-center", children: showDots && dots.map((value, index) => {
33
+ const seen = seenSteps.has(index);
34
+ return (_jsx("div", { onClick: () => seen && update(index), className: clsx('rounded-full w-4 h-4', {
35
+ 'bg-primary hover:brightness-75': index === step && seen,
36
+ 'bg-primary/40 hover:bg-primary': index !== step && seen,
37
+ 'bg-gray-200 outline-transparent': !seen,
38
+ }, {
39
+ 'cursor-pointer': seen,
40
+ 'cursor-not-allowed': !seen,
41
+ }) }, index));
42
+ }) }), step !== lastStep && (_jsx("div", { className: "flex-[2] justify-end", children: _jsxs(SolidButton, { onClick: () => update(step + 1), className: "row gap-x-1 items-center justify-center", children: [translation.next, _jsx(ChevronRight, { size: 14 })] }) })), step === lastStep && (_jsx("div", { className: "flex-[2] justify-end", children: _jsxs(SolidButton
43
+ // TODO check form validity
44
+ , {
45
+ // TODO check form validity
46
+ disabled: false, onClick: onFinish, className: "row gap-x-1 items-center justify-center", children: [_jsx(Check, { size: 14 }), translation.confirm] }) }))] }));
47
+ };
@@ -0,0 +1,87 @@
1
+ import type { ReactElement } from 'react';
2
+ export type TableStatePagination = {
3
+ currentPage: number;
4
+ entriesPerPage: number;
5
+ };
6
+ export declare const defaultTableStatePagination: {
7
+ currentPage: number;
8
+ entriesPerPage: number;
9
+ };
10
+ export type TableStateSelection<T> = {
11
+ currentSelection: T[];
12
+ hasSelectedAll: boolean;
13
+ hasSelectedSome: boolean;
14
+ hasSelectedNone: boolean;
15
+ };
16
+ export declare const defaultTableStateSelection: {
17
+ currentSelection: never[];
18
+ hasSelectedAll: boolean;
19
+ hasSelectedSome: boolean;
20
+ hasSelectedNone: boolean;
21
+ };
22
+ export type TableState = {
23
+ pagination?: TableStatePagination;
24
+ selection?: {
25
+ /**
26
+ * The mapped ids of the dataType
27
+ */
28
+ currentSelection: string[];
29
+ hasSelectedAll: boolean;
30
+ hasSelectedSome: boolean;
31
+ hasSelectedNone: boolean;
32
+ };
33
+ };
34
+ type IdentifierMapping<T> = (dataObject: T) => string;
35
+ export declare const isDataObjectSelected: <T>(tableState: TableState, dataObject: T, identifierMapping: IdentifierMapping<T>) => boolean;
36
+ export declare const pageForItem: <T>(data: T[], item: T, entriesPerPage: number, identifierMapping: IdentifierMapping<T>) => number;
37
+ export declare const updatePagination: (pagination: TableStatePagination, dataLength: number) => TableStatePagination;
38
+ export declare const addElementToTable: <T>(tableState: TableState, data: T[], dataObject: T, identifierMapping: IdentifierMapping<T>) => {
39
+ pagination: {
40
+ currentPage: number;
41
+ entriesPerPage: number;
42
+ } | undefined;
43
+ selection: {
44
+ hasSelectedAll: boolean;
45
+ hasSelectedSome: boolean;
46
+ /**
47
+ * The mapped ids of the dataType
48
+ */
49
+ currentSelection: string[];
50
+ hasSelectedNone: boolean;
51
+ } | undefined;
52
+ };
53
+ /**
54
+ * data length before delete
55
+ */
56
+ export declare const removeFromTableSelection: <T>(tableState: TableState, deletedObjects: T[], dataLength: number, identifierMapping: IdentifierMapping<T>) => TableState;
57
+ export declare const changeTableSelectionSingle: <T>(tableState: TableState, dataObject: T, dataLength: number, identifierMapping: IdentifierMapping<T>) => TableState;
58
+ export type TableSortingType = 'ascending' | 'descending';
59
+ export type TableSortingFunctionType<T> = (t1: T, t2: T) => number;
60
+ export type TableProps<T> = {
61
+ data: T[];
62
+ /**
63
+ * When using selection or pagination
64
+ */
65
+ stateManagement?: [TableState, (tableState: TableState) => void];
66
+ identifierMapping: IdentifierMapping<T>;
67
+ /**
68
+ * Only the cell itself no boilerplate <tr> or <th> required
69
+ */
70
+ header?: ReactElement[];
71
+ /**
72
+ * Only the cells of the row no boilerplate <tr> or <td> required
73
+ */
74
+ rowMappingToCells: (dataObject: T) => ReactElement[];
75
+ sorting?: [TableSortingFunctionType<T>, TableSortingType];
76
+ /**
77
+ * Always go to the page of this element
78
+ */
79
+ focusElement?: T;
80
+ className?: string;
81
+ };
82
+ /**
83
+ * A Basic stateless reusable table
84
+ * The state must be handled and saved with the updateTableState method
85
+ */
86
+ export declare const Table: <T>({ data, stateManagement, identifierMapping, header, rowMappingToCells, sorting, focusElement, className }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
87
+ export {};
@@ -0,0 +1,187 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Scrollbars } from 'react-custom-scrollbars-2';
3
+ import { useEffect, useRef, useState } from 'react';
4
+ import { noop } from '../util/noop';
5
+ import { Checkbox } from './user-input/Checkbox';
6
+ import { Pagination } from './Pagination';
7
+ import clsx from 'clsx';
8
+ export const defaultTableStatePagination = {
9
+ currentPage: 0,
10
+ entriesPerPage: 5
11
+ };
12
+ export const defaultTableStateSelection = {
13
+ currentSelection: [],
14
+ hasSelectedAll: false,
15
+ hasSelectedSome: false,
16
+ hasSelectedNone: true
17
+ };
18
+ export const isDataObjectSelected = (tableState, dataObject, identifierMapping) => {
19
+ if (!tableState.selection) {
20
+ return false;
21
+ }
22
+ return !!tableState.selection.currentSelection.find(value => value.localeCompare(identifierMapping(dataObject)) === 0);
23
+ };
24
+ export const pageForItem = (data, item, entriesPerPage, identifierMapping) => {
25
+ const index = data.findIndex(value => identifierMapping(value) === identifierMapping(item));
26
+ if (index !== -1) {
27
+ return Math.floor(index / entriesPerPage);
28
+ }
29
+ console.warn("item doesn't exist on data", item, data);
30
+ return 0;
31
+ };
32
+ export const updatePagination = (pagination, dataLength) => ({
33
+ ...pagination,
34
+ currentPage: Math.min(Math.max(Math.ceil(dataLength / pagination.entriesPerPage) - 1, 0), pagination.currentPage)
35
+ });
36
+ export const addElementToTable = (tableState, data, dataObject, identifierMapping) => {
37
+ return {
38
+ ...tableState,
39
+ pagination: tableState.pagination ? {
40
+ ...tableState.pagination,
41
+ currentPage: pageForItem(data, dataObject, tableState.pagination.entriesPerPage, identifierMapping)
42
+ } : undefined,
43
+ selection: tableState.selection ? {
44
+ ...tableState.selection,
45
+ hasSelectedAll: false,
46
+ hasSelectedSome: tableState.selection.hasSelectedAll || tableState.selection.hasSelectedSome
47
+ } : undefined
48
+ };
49
+ };
50
+ /**
51
+ * data length before delete
52
+ */
53
+ export const removeFromTableSelection = (tableState, deletedObjects, dataLength, identifierMapping) => {
54
+ if (!tableState.selection) {
55
+ return tableState;
56
+ }
57
+ const deletedObjectIds = deletedObjects.map(identifierMapping);
58
+ const elementsBefore = tableState.selection.currentSelection.length;
59
+ const currentSelection = tableState.selection.currentSelection.filter((value) => !deletedObjectIds.includes(value));
60
+ dataLength -= elementsBefore - currentSelection.length;
61
+ return {
62
+ ...tableState,
63
+ selection: {
64
+ currentSelection,
65
+ hasSelectedAll: currentSelection.length === dataLength && dataLength !== 0,
66
+ hasSelectedSome: currentSelection.length > 0 && currentSelection.length !== dataLength,
67
+ hasSelectedNone: currentSelection.length === 0,
68
+ },
69
+ pagination: tableState.pagination ? updatePagination(tableState.pagination, dataLength) : undefined
70
+ };
71
+ };
72
+ export const changeTableSelectionSingle = (tableState, dataObject, dataLength, identifierMapping) => {
73
+ if (!tableState.selection) {
74
+ return tableState;
75
+ }
76
+ const hasSelectedObject = isDataObjectSelected(tableState, dataObject, identifierMapping);
77
+ let currentSelection = [...tableState.selection.currentSelection, identifierMapping(dataObject)]; // case !hasSelectedObject
78
+ if (hasSelectedObject) {
79
+ currentSelection = tableState.selection.currentSelection.filter(value => value.localeCompare(identifierMapping(dataObject)) !== 0);
80
+ }
81
+ return {
82
+ ...tableState,
83
+ selection: {
84
+ currentSelection,
85
+ hasSelectedAll: currentSelection.length === dataLength,
86
+ hasSelectedSome: currentSelection.length > 0 && currentSelection.length !== dataLength,
87
+ hasSelectedNone: currentSelection.length === 0,
88
+ }
89
+ };
90
+ };
91
+ const changeTableSelectionAll = (tableState, data, identifierMapping) => {
92
+ if (!tableState.selection) {
93
+ return tableState;
94
+ }
95
+ if (data.length === 0) {
96
+ return {
97
+ ...tableState,
98
+ selection: {
99
+ currentSelection: [],
100
+ hasSelectedAll: false,
101
+ hasSelectedSome: false,
102
+ hasSelectedNone: true
103
+ }
104
+ };
105
+ }
106
+ const hasSelectedAll = !(tableState.selection.hasSelectedSome || tableState.selection.hasSelectedAll);
107
+ return {
108
+ ...tableState,
109
+ selection: {
110
+ currentSelection: hasSelectedAll ? data.map(identifierMapping) : [],
111
+ hasSelectedAll,
112
+ hasSelectedSome: false,
113
+ hasSelectedNone: !hasSelectedAll
114
+ }
115
+ };
116
+ };
117
+ /* Possible extension for better customization
118
+ * Map each element to the displayed row
119
+ * make sure to wrap it in the <tr> and <td> you require
120
+ rowMappingToHTMLRow?: (dataObject: T) => ReactElement
121
+ */
122
+ /**
123
+ * A Basic stateless reusable table
124
+ * The state must be handled and saved with the updateTableState method
125
+ */
126
+ export const Table = ({ data, stateManagement = [{}, noop], identifierMapping, header, rowMappingToCells, sorting, focusElement, className }) => {
127
+ const sortedData = [...data];
128
+ if (sorting) {
129
+ const [sortingFunction, sortingType] = sorting;
130
+ sortedData.sort((a, b) => sortingFunction(a, b) * (sortingType === 'ascending' ? 1 : -1));
131
+ }
132
+ let currentPage = 0;
133
+ let pageCount = 1;
134
+ let entriesPerPage = 5;
135
+ const [tableState, updateTableState] = stateManagement;
136
+ let shownElements = sortedData;
137
+ if (tableState === null || tableState === void 0 ? void 0 : tableState.pagination) {
138
+ if (tableState.pagination.entriesPerPage < 1) {
139
+ console.error('tableState.pagination.entriesPerPage must be >= 1', tableState.pagination.entriesPerPage);
140
+ }
141
+ entriesPerPage = Math.max(1, tableState.pagination.entriesPerPage);
142
+ pageCount = Math.ceil(sortedData.length / entriesPerPage);
143
+ if (tableState.pagination.currentPage < 0 || (tableState.pagination.currentPage >= pageCount && pageCount !== 0)) {
144
+ console.error('tableState.pagination.currentPage < 0 || (tableState.pagination.currentPage >= pageCount && pageCount !== 0) must be fullfilled', [`pageCount: ${pageCount}`, `tableState.pagination.currentPage: ${tableState.pagination.currentPage}`]);
145
+ }
146
+ else {
147
+ currentPage = tableState.pagination.currentPage;
148
+ }
149
+ if (focusElement) {
150
+ currentPage = pageForItem(sortedData, focusElement, entriesPerPage, identifierMapping);
151
+ }
152
+ shownElements = sortedData.slice(currentPage * entriesPerPage, Math.min(sortedData.length, (currentPage + 1) * entriesPerPage));
153
+ }
154
+ else {
155
+ currentPage = 0;
156
+ }
157
+ const headerRow = 'border-b-2 border-gray-300';
158
+ const headerPaddingHead = 'pb-2';
159
+ const headerPaddingBody = 'pt-2';
160
+ const cellPadding = 'py-1 px-2';
161
+ const [scrollbarsAutoHeightMin, setScrollbarsAutoHeightMin] = useState(0);
162
+ const tableRef = useRef(null);
163
+ const calculateHeight = () => {
164
+ if (tableRef.current) {
165
+ const tableHeight = tableRef.current.offsetHeight;
166
+ const offset = 25;
167
+ setScrollbarsAutoHeightMin(tableHeight + offset);
168
+ }
169
+ };
170
+ useEffect(() => {
171
+ calculateHeight();
172
+ // New function to unbind properly
173
+ const handleResize = () => {
174
+ calculateHeight();
175
+ };
176
+ window.addEventListener('resize', handleResize);
177
+ return () => {
178
+ window.removeEventListener('resize', handleResize);
179
+ };
180
+ }, [data, currentPage]);
181
+ return (_jsxs("div", { className: clsx('col gap-y-4 overflow-hidden', className), children: [_jsx("div", { children: _jsx(Scrollbars, { autoHeight: true, autoHeightMin: scrollbarsAutoHeightMin, children: _jsxs("table", { ref: tableRef, className: "w-full mb-[12px]", children: [_jsx("thead", { children: _jsxs("tr", { className: headerRow, children: [header && tableState.selection && (_jsx("th", { className: headerPaddingHead, children: _jsx(Checkbox, { checked: tableState.selection.hasSelectedSome ? 'indeterminate' : tableState.selection.hasSelectedAll, onChange: () => updateTableState(changeTableSelectionAll(tableState, data, identifierMapping)) }) })), header && header.map((value, index) => (_jsx("th", { className: headerPaddingHead, children: _jsx("div", { className: "row justify-start px-2", children: value }) }, `tableHeader${index}`)))] }) }), _jsx("tbody", { children: shownElements.map((value, rowIndex) => (_jsxs("tr", { children: [tableState.selection && (_jsx("td", { className: clsx(cellPadding, { [headerPaddingBody]: rowIndex === 0 }), children: _jsx(Checkbox, { checked: isDataObjectSelected(tableState, value, identifierMapping), onChange: () => {
182
+ updateTableState(changeTableSelectionSingle(tableState, value, data.length, identifierMapping));
183
+ } }) })), rowMappingToCells(value).map((value1, index) => (_jsx("td", { className: clsx(cellPadding, { [headerPaddingBody]: rowIndex === 0 }), children: value1 }, index)))] }, identifierMapping(value)))) })] }) }) }), _jsx("div", { className: "row justify-center", children: tableState.pagination && (_jsx(Pagination, { page: currentPage, numberOfPages: pageCount, onPageChanged: page => updateTableState({
184
+ ...tableState,
185
+ pagination: { entriesPerPage, currentPage: page }
186
+ }) })) })] }));
187
+ };
@@ -0,0 +1,36 @@
1
+ type Config = {
2
+ colors: {
3
+ background: string;
4
+ grid: string;
5
+ inactive: string;
6
+ };
7
+ title: string;
8
+ quadrants: {
9
+ name: string;
10
+ }[];
11
+ rings: {
12
+ name: string;
13
+ color: string;
14
+ }[];
15
+ print_layout: boolean;
16
+ links_in_new_tabs: boolean;
17
+ zoomed_quadrant?: 0 | 1 | 2 | 3;
18
+ };
19
+ type Entry = {
20
+ label: string;
21
+ link?: string;
22
+ active: boolean;
23
+ quadrant: 0 | 1 | 2 | 3;
24
+ ring: 0 | 1 | 2 | 3;
25
+ moved: -1 | 0 | 1;
26
+ };
27
+ type TechRadarProps = {
28
+ date?: Date;
29
+ config?: Config;
30
+ entries?: Entry[];
31
+ };
32
+ /**
33
+ * This component wraps https://github.com/zalando/tech-radar
34
+ */
35
+ export declare const TechRadar: ({ date, config, entries, }: TechRadarProps) => import("react/jsx-runtime").JSX.Element;
36
+ export {};
@@ -0,0 +1,191 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import Script from 'next/script';
4
+ const helpwaveTechRadar = {
5
+ date: new Date('1/28/2024'),
6
+ config: {
7
+ colors: {
8
+ background: '#fff',
9
+ grid: '#dddde0',
10
+ inactive: '#ddd'
11
+ },
12
+ title: 'helpwave Tech-Radar',
13
+ quadrants: [
14
+ { name: 'Languages' },
15
+ { name: 'Language dependencies' },
16
+ { name: 'Infrastructure' },
17
+ { name: 'Datastores' },
18
+ ],
19
+ rings: [
20
+ { name: 'ADOPT', color: '#5ba300' },
21
+ { name: 'TRIAL', color: '#009eb0' },
22
+ { name: 'ASSESS', color: '#c7ba00' },
23
+ { name: 'HOLD', color: '#e09b96' }
24
+ ],
25
+ print_layout: true,
26
+ links_in_new_tabs: true,
27
+ },
28
+ entries: [
29
+ // Languages
30
+ {
31
+ label: 'Golang',
32
+ active: true,
33
+ quadrant: 0,
34
+ ring: 0,
35
+ moved: 0,
36
+ },
37
+ {
38
+ label: 'Python',
39
+ active: true,
40
+ quadrant: 0,
41
+ ring: 2,
42
+ moved: 0,
43
+ },
44
+ {
45
+ label: 'TypeScript',
46
+ active: true,
47
+ quadrant: 0,
48
+ ring: 0,
49
+ moved: 0,
50
+ },
51
+ {
52
+ label: 'Dart',
53
+ active: true,
54
+ quadrant: 0,
55
+ ring: 0,
56
+ moved: 0,
57
+ },
58
+ // Language dependencies
59
+ {
60
+ label: 'Dapr',
61
+ link: 'https://dapr.io/',
62
+ active: true,
63
+ quadrant: 1,
64
+ ring: 0,
65
+ moved: 0,
66
+ },
67
+ {
68
+ label: 'GORM',
69
+ active: true,
70
+ quadrant: 1,
71
+ ring: 3,
72
+ moved: -1,
73
+ },
74
+ {
75
+ label: 'SQLc',
76
+ active: true,
77
+ quadrant: 1,
78
+ ring: 0,
79
+ moved: 1,
80
+ },
81
+ {
82
+ label: 'Flutter',
83
+ active: true,
84
+ quadrant: 1,
85
+ ring: 0,
86
+ moved: 0,
87
+ },
88
+ {
89
+ label: 'Next.js',
90
+ active: true,
91
+ quadrant: 1,
92
+ ring: 0,
93
+ moved: 0,
94
+ },
95
+ // Infrastructure
96
+ {
97
+ label: 'Docker',
98
+ active: true,
99
+ quadrant: 2,
100
+ ring: 0,
101
+ moved: 0,
102
+ },
103
+ {
104
+ label: 'Kubernetes',
105
+ active: true,
106
+ quadrant: 2,
107
+ ring: 2,
108
+ moved: 1,
109
+ },
110
+ {
111
+ label: 'gRPC',
112
+ active: true,
113
+ quadrant: 2,
114
+ ring: 0,
115
+ moved: 0,
116
+ },
117
+ {
118
+ label: 'APISIX',
119
+ active: true,
120
+ quadrant: 2,
121
+ ring: 0,
122
+ moved: 0,
123
+ },
124
+ {
125
+ label: 'GitHub Actions',
126
+ active: true,
127
+ quadrant: 2,
128
+ ring: 0,
129
+ moved: 0,
130
+ },
131
+ {
132
+ label: 'devenv',
133
+ active: true,
134
+ quadrant: 2,
135
+ ring: 1,
136
+ moved: 0,
137
+ },
138
+ // Datastores
139
+ {
140
+ label: 'PostgreSQL',
141
+ active: true,
142
+ quadrant: 3,
143
+ ring: 0,
144
+ moved: 0,
145
+ },
146
+ {
147
+ label: 'Redis',
148
+ active: true,
149
+ quadrant: 3,
150
+ ring: 0,
151
+ moved: 0,
152
+ },
153
+ {
154
+ label: 'EventStoreDB',
155
+ active: true,
156
+ quadrant: 3,
157
+ ring: 1,
158
+ moved: 0,
159
+ },
160
+ ]
161
+ };
162
+ /**
163
+ * This component wraps https://github.com/zalando/tech-radar
164
+ */
165
+ export const TechRadar = ({ date = helpwaveTechRadar.date, config = helpwaveTechRadar.config, entries = helpwaveTechRadar.entries, }) => {
166
+ const [isD3Loaded, setIsD3Loaded] = useState(false);
167
+ const [isRadarLoaded, setIsRadarLoaded] = useState(false);
168
+ const dateString = date.toLocaleDateString('en-US', { year: 'numeric', month: 'numeric', day: 'numeric' });
169
+ useEffect(() => {
170
+ if (!isD3Loaded || !isRadarLoaded)
171
+ return;
172
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
173
+ // @ts-expect-error
174
+ d3.select('svg#radar').select('*').remove();
175
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
176
+ // @ts-expect-error
177
+ radar_visualization({
178
+ svg_id: 'radar',
179
+ width: 1500,
180
+ height: 1000,
181
+ date: dateString,
182
+ entries,
183
+ ...config,
184
+ });
185
+ }, [isD3Loaded, isRadarLoaded, config, entries]); // eslint-disable-line react-hooks/exhaustive-deps
186
+ return (_jsxs(_Fragment, { children: [_jsx(Script, { src: "https://cdn.helpwave.de/js/d3.v4.min.js", onLoad: () => {
187
+ setIsD3Loaded(true);
188
+ } }), _jsx(Script, { src: "https://cdn.helpwave.de/js/radar-0.8.js", onLoad: () => {
189
+ setIsRadarLoaded(true);
190
+ } }), _jsx("svg", { id: "radar" })] }));
191
+ };
@@ -0,0 +1,20 @@
1
+ import type { PropsForTranslation } from '../hooks/useTranslation';
2
+ type TextImageColor = 'primary' | 'secondary' | 'dark';
3
+ type TextImageTranslation = {
4
+ showMore: string;
5
+ };
6
+ export type TextImageProps = {
7
+ title: string;
8
+ description: string;
9
+ imageUrl: string;
10
+ onShowMoreClicked?: () => void;
11
+ color?: TextImageColor;
12
+ badge?: string;
13
+ contentClassName?: string;
14
+ className?: string;
15
+ };
16
+ /**
17
+ * A Component for layering a Text upon a Image
18
+ */
19
+ export declare const TextImage: ({ overwriteTranslation, title, description, imageUrl, onShowMoreClicked, color, badge, contentClassName, className, }: PropsForTranslation<TextImageTranslation, TextImageProps>) => import("react/jsx-runtime").JSX.Element;
20
+ export {};
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTranslation } from '../hooks/useTranslation';
3
+ import clsx from 'clsx';
4
+ const defaultTextImageTranslation = {
5
+ de: {
6
+ showMore: 'Mehr anzeigen'
7
+ },
8
+ en: {
9
+ showMore: 'Show more'
10
+ }
11
+ };
12
+ /**
13
+ * A Component for layering a Text upon a Image
14
+ */
15
+ export const TextImage = ({ overwriteTranslation, title, description, imageUrl, onShowMoreClicked, color = 'primary', badge, contentClassName = '', className = '', }) => {
16
+ const translation = useTranslation(defaultTextImageTranslation, overwriteTranslation);
17
+ const chipColorMapping = {
18
+ primary: 'text-text-image-primary-background bg-text-text-image-primary-text',
19
+ secondary: 'text-text-image-secondary-background bg-text-text-image-secondary-text',
20
+ dark: 'text-text-image-dark-background bg-text-text-image-dark-text',
21
+ };
22
+ const colorMapping = {
23
+ primary: 'text-text-image-primary-text bg-linear-to-r from-30% from-text-image-primary-background to-text-image-primary-background/55',
24
+ secondary: 'text-text-image-secondary-text bg-linear-to-r from-30% from-text-image-secondary-background to-text-image-secondary-background/55',
25
+ dark: 'text-text-image-dark-text bg-linear-to-r from-30% from-text-image-dark-background to-text-image-dark-background/55',
26
+ };
27
+ return (_jsx("div", { className: clsx('rounded-2xl w-full', className), style: {
28
+ backgroundImage: `url(${imageUrl})`,
29
+ backgroundSize: 'cover',
30
+ }, children: _jsxs("div", { className: clsx(`col px-6 py-12 rounded-2xl h-full`, colorMapping[color], contentClassName), children: [badge && (_jsx("div", { className: clsx(`chip-full bg-white mb-2 py-2 px-4 w-fit`, chipColorMapping[color]), children: _jsx("span", { className: "text-lg font-bold", children: badge }) })), _jsxs("div", { className: "col gap-y-1 text-white overflow-hidden", children: [_jsx("span", { className: "textstyle-title-xl", children: title }), _jsx("span", { className: "text-ellipsis overflow-hidden", children: description })] }), onShowMoreClicked && (_jsx("div", { className: "row mt-2 text-white underline", children: _jsx("button", { onClick: onShowMoreClicked, children: translation.showMore }) }))] }) }));
31
+ };
@@ -0,0 +1,30 @@
1
+ import type { PropsForTranslation } from '../hooks/useTranslation';
2
+ type TimeDisplayTranslation = {
3
+ today: string;
4
+ yesterday: string;
5
+ tomorrow: string;
6
+ inDays: (days: number) => string;
7
+ agoDays: (days: number) => string;
8
+ january: string;
9
+ february: string;
10
+ march: string;
11
+ april: string;
12
+ may: string;
13
+ june: string;
14
+ july: string;
15
+ august: string;
16
+ september: string;
17
+ october: string;
18
+ november: string;
19
+ december: string;
20
+ };
21
+ type TimeDisplayMode = 'daysFromToday' | 'date';
22
+ type TimeDisplayProps = {
23
+ date: Date;
24
+ mode?: TimeDisplayMode;
25
+ };
26
+ /**
27
+ * A Component for displaying time and dates in a unified fashion
28
+ */
29
+ export declare const TimeDisplay: ({ overwriteTranslation, date, mode }: PropsForTranslation<TimeDisplayTranslation, TimeDisplayProps>) => import("react/jsx-runtime").JSX.Element;
30
+ export {};