@helpwave/hightide 0.0.9 → 0.0.12

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 (301) 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/dist/css/globals.css +2450 -0
  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/globals.css +0 -488
  282. package/hooks/useHoverState.ts +0 -88
  283. package/hooks/useLanguage.tsx +0 -78
  284. package/hooks/useLocalStorage.tsx +0 -33
  285. package/hooks/useOutsideClick.ts +0 -25
  286. package/hooks/useSaveDelay.ts +0 -46
  287. package/hooks/useTheme.tsx +0 -57
  288. package/hooks/useTranslation.ts +0 -43
  289. package/index.ts +0 -0
  290. package/util/array.ts +0 -115
  291. package/util/date.ts +0 -180
  292. package/util/easeFunctions.ts +0 -37
  293. package/util/emailValidation.ts +0 -3
  294. package/util/loopingArray.ts +0 -94
  295. package/util/math.ts +0 -3
  296. package/util/news.ts +0 -43
  297. package/util/noop.ts +0 -1
  298. package/util/storage.ts +0 -37
  299. package/util/types.ts +0 -4
  300. /package/{components/Span.tsx → dist/components/Span.d.ts} +0 -0
  301. /package/{components/examples/Title.tsx → dist/components/examples/Title.d.ts} +0 -0
@@ -0,0 +1,83 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useTranslation } from '../hooks/useTranslation';
3
+ const defaultTimeDisplayTranslations = {
4
+ en: {
5
+ today: 'today',
6
+ yesterday: 'yesterday',
7
+ tomorrow: 'tomorrow',
8
+ inDays: (days) => `in ${days} days`,
9
+ agoDays: (days) => `${days} days ago`,
10
+ january: 'January',
11
+ february: 'February',
12
+ march: 'March',
13
+ april: 'April',
14
+ may: 'May',
15
+ june: 'June',
16
+ july: 'July',
17
+ august: 'August',
18
+ september: 'September',
19
+ october: 'October',
20
+ november: 'November',
21
+ december: 'December'
22
+ },
23
+ de: {
24
+ today: 'heute',
25
+ yesterday: 'gestern',
26
+ tomorrow: 'morgen',
27
+ inDays: (days) => `in ${days} Tagen`,
28
+ agoDays: (days) => `vor ${days} Tagen`,
29
+ january: 'Januar',
30
+ february: 'Februar',
31
+ march: 'März',
32
+ april: 'April',
33
+ may: 'Mai',
34
+ june: 'Juni',
35
+ july: 'Juli',
36
+ august: 'August',
37
+ september: 'September',
38
+ october: 'October',
39
+ november: 'November',
40
+ december: 'December'
41
+ }
42
+ };
43
+ /**
44
+ * A Component for displaying time and dates in a unified fashion
45
+ */
46
+ export const TimeDisplay = ({ overwriteTranslation, date, mode = 'daysFromToday' }) => {
47
+ const translation = useTranslation(defaultTimeDisplayTranslations, overwriteTranslation);
48
+ const difference = new Date().setHours(0, 0, 0, 0).valueOf() - new Date(date).setHours(0, 0, 0, 0).valueOf();
49
+ const isBefore = difference > 0;
50
+ const differenceInDays = Math.floor(Math.abs(difference) / (1000 * 3600 * 24));
51
+ let displayString;
52
+ if (differenceInDays === 0) {
53
+ displayString = translation.today;
54
+ }
55
+ else if (differenceInDays === 1) {
56
+ displayString = isBefore ? translation.yesterday : translation.tomorrow;
57
+ }
58
+ else {
59
+ displayString = isBefore ? translation.agoDays(differenceInDays) : translation.inDays(differenceInDays);
60
+ }
61
+ const monthToTranslation = {
62
+ 0: translation.january,
63
+ 1: translation.february,
64
+ 2: translation.march,
65
+ 3: translation.april,
66
+ 4: translation.may,
67
+ 5: translation.june,
68
+ 6: translation.july,
69
+ 7: translation.august,
70
+ 8: translation.september,
71
+ 9: translation.october,
72
+ 10: translation.november,
73
+ 11: translation.december
74
+ };
75
+ let fullString;
76
+ if (mode === 'daysFromToday') {
77
+ fullString = `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')} - ${displayString}`;
78
+ }
79
+ else {
80
+ fullString = `${date.getDate()}. ${monthToTranslation[date.getMonth()]} ${date.getFullYear()}`;
81
+ }
82
+ return (_jsx("span", { children: fullString }));
83
+ };
@@ -0,0 +1,34 @@
1
+ import type { PropsWithChildren, ReactNode } from 'react';
2
+ type Position = 'top' | 'bottom' | 'left' | 'right';
3
+ export type TooltipProps = PropsWithChildren<{
4
+ tooltip: string | ReactNode;
5
+ /**
6
+ * Number of milliseconds until the tooltip appears
7
+ *
8
+ * defaults to 1000ms
9
+ */
10
+ animationDelay?: number;
11
+ /**
12
+ * Class names of additional styling properties for the tooltip
13
+ */
14
+ tooltipClassName?: string;
15
+ /**
16
+ * Class names of additional styling properties for the container from which the tooltip will be created
17
+ */
18
+ containerClassName?: string;
19
+ position?: Position;
20
+ zIndex?: number;
21
+ }>;
22
+ /**
23
+ * A Component for showing a tooltip when hovering over Content
24
+ * @param tooltip The tooltip to show can be a text or any ReactNode
25
+ * @param children The Content for which the tooltip should be created
26
+ * @param animationDelay The delay before the tooltip appears
27
+ * @param tooltipClassName Additional ClassNames for the Container of the tooltip
28
+ * @param containerClassName Additional ClassNames for the Container holding the content
29
+ * @param position The direction of the tooltip relative to the Container
30
+ * @param zIndex The z Index of the tooltip (you may require this when stacking modals)
31
+ * @constructor
32
+ */
33
+ export declare const Tooltip: ({ tooltip, children, animationDelay, tooltipClassName, containerClassName, position, zIndex, }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
34
+ export {};
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useHoverState } from '../hooks/useHoverState';
3
+ import { clsx } from 'clsx';
4
+ /**
5
+ * A Component for showing a tooltip when hovering over Content
6
+ * @param tooltip The tooltip to show can be a text or any ReactNode
7
+ * @param children The Content for which the tooltip should be created
8
+ * @param animationDelay The delay before the tooltip appears
9
+ * @param tooltipClassName Additional ClassNames for the Container of the tooltip
10
+ * @param containerClassName Additional ClassNames for the Container holding the content
11
+ * @param position The direction of the tooltip relative to the Container
12
+ * @param zIndex The z Index of the tooltip (you may require this when stacking modals)
13
+ * @constructor
14
+ */
15
+ export const Tooltip = ({ tooltip, children, animationDelay = 650, tooltipClassName = '', containerClassName = '', position = 'bottom', zIndex = 10, }) => {
16
+ const { isHovered, handlers } = useHoverState();
17
+ const positionClasses = {
18
+ top: `bottom-full left-1/2 -translate-x-1/2 mb-[6px]`,
19
+ bottom: `top-full left-1/2 -translate-x-1/2 mt-[6px]`,
20
+ left: `right-full top-1/2 -translate-y-1/2 mr-[6px]`,
21
+ right: `left-full top-1/2 -translate-y-1/2 ml-[6px]`
22
+ };
23
+ const triangleSize = 6;
24
+ const triangleClasses = {
25
+ top: `top-full left-1/2 -translate-x-1/2 border-t-gray-600 border-l-transparent border-r-transparent`,
26
+ bottom: `bottom-full left-1/2 -translate-x-1/2 border-b-gray-600 border-l-transparent border-r-transparent`,
27
+ left: `left-full top-1/2 -translate-y-1/2 border-l-gray-600 border-t-transparent border-b-transparent`,
28
+ right: `right-full top-1/2 -translate-y-1/2 border-r-gray-600 border-t-transparent border-b-transparent`
29
+ };
30
+ const triangleStyle = {
31
+ top: { borderWidth: `${triangleSize}px ${triangleSize}px 0 ${triangleSize}px` },
32
+ bottom: { borderWidth: `0 ${triangleSize}px ${triangleSize}px ${triangleSize}px` },
33
+ left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },
34
+ right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }
35
+ };
36
+ return (_jsxs("div", { className: clsx('relative inline-block', containerClassName), ...handlers, children: [children, isHovered && (_jsxs("div", { className: clsx(`opacity-0 absolute text-black text-xs font-semibold text-gray-600 px-2 py-1 rounded whitespace-nowrap border-2 border-gray-600
37
+ animate-tooltip-fade-in shadow-lg bg-gray-100`, positionClasses[position], tooltipClassName), style: { zIndex, animationDelay: animationDelay + 'ms' }, children: [tooltip, _jsx("div", { className: clsx(`absolute w-0 h-0`, triangleClasses[position]), style: { ...triangleStyle[position], zIndex } })] }))] }));
38
+ };
@@ -0,0 +1,11 @@
1
+ export type VerticalDividerProps = {
2
+ width?: number;
3
+ height?: number;
4
+ strokeWidth?: number;
5
+ dashGap?: number;
6
+ dashLength?: number;
7
+ };
8
+ /**
9
+ * A Component for creating a vertical Divider
10
+ */
11
+ export declare const VerticalDivider: ({ width, height, strokeWidth, dashGap, dashLength, }: VerticalDividerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * A Component for creating a vertical Divider
4
+ */
5
+ export const VerticalDivider = ({ width = 1, height = 100, strokeWidth = 4, dashGap = 4, dashLength = 4, }) => {
6
+ return (_jsx("div", { style: { width: width + 'px', height: height + 'px' }, children: _jsxs("svg", { width: width, height: height, viewBox: `0 0 ${width} ${height}`, fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [_jsx("line", { opacity: "0.5", x1: width / 2, y1: height, x2: width / 2, y2: "0", stroke: "url(#paint_linear)", strokeWidth: strokeWidth, strokeDasharray: `${dashLength} ${dashLength + dashGap}`, strokeLinecap: "round" }), _jsx("defs", { children: _jsxs("linearGradient", { id: "paint_linear", x1: width / 2, y1: "0", x2: width / 2, y2: height, gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopOpacity: "0", stopColor: "currentColor" }), _jsx("stop", { offset: "0.5", stopColor: "currentColor" }), _jsx("stop", { offset: "1", stopColor: "currentColor", stopOpacity: "0" })] }) })] }) }));
7
+ };
@@ -0,0 +1,26 @@
1
+ import type { PropsForTranslation } from '../../hooks/useTranslation';
2
+ import type { YearMonthPickerProps } from './YearMonthPicker';
3
+ import type { DayPickerProps } from './DayPicker';
4
+ type DatePickerTranslation = {
5
+ today: string;
6
+ };
7
+ type DisplayMode = 'yearMonth' | 'day';
8
+ export type DatePickerProps = {
9
+ value?: Date;
10
+ start?: Date;
11
+ end?: Date;
12
+ initialDisplay?: DisplayMode;
13
+ onChange?: (date: Date) => void;
14
+ dayPickerProps?: Omit<DayPickerProps, 'displayedMonth' | 'onChange' | 'selected'>;
15
+ yearMonthPickerProps?: Omit<YearMonthPickerProps, 'displayedYearMonth' | 'onChange' | 'start' | 'end'>;
16
+ className?: string;
17
+ };
18
+ /**
19
+ * A Component for picking a date
20
+ */
21
+ export declare const DatePicker: ({ overwriteTranslation, value, start, end, initialDisplay, onChange, yearMonthPickerProps, dayPickerProps, className }: PropsForTranslation<DatePickerTranslation, DatePickerProps>) => import("react/jsx-runtime").JSX.Element;
22
+ /**
23
+ * Example for the Date Picker
24
+ */
25
+ export declare const ControlledDatePicker: ({ value, onChange, ...props }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
26
+ export {};
@@ -0,0 +1,58 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { ArrowDown, ArrowUp, ChevronDown } from 'lucide-react';
4
+ import { useTranslation } from '../../hooks/useTranslation';
5
+ import { noop } from '../../util/noop';
6
+ import { addDuration, isInTimeSpan, subtractDuration } from '../../util/date';
7
+ import clsx from 'clsx';
8
+ import { SolidButton, TextButton } from '../Button';
9
+ import { useLocale } from '../../hooks/useLanguage';
10
+ import { YearMonthPicker } from './YearMonthPicker';
11
+ import { DayPicker } from './DayPicker';
12
+ const defaultDatePickerTranslation = {
13
+ en: {
14
+ today: 'Today',
15
+ },
16
+ de: {
17
+ today: 'Heute',
18
+ }
19
+ };
20
+ /**
21
+ * A Component for picking a date
22
+ */
23
+ export const DatePicker = ({ overwriteTranslation, value = new Date(), start = subtractDuration(new Date(), { years: 50 }), end = addDuration(new Date(), { years: 50 }), initialDisplay = 'day', onChange = noop, yearMonthPickerProps, dayPickerProps, className = '' }) => {
24
+ const locale = useLocale();
25
+ const translation = useTranslation(defaultDatePickerTranslation, overwriteTranslation);
26
+ const [displayedMonth, setDisplayedMonth] = useState(value);
27
+ const [displayMode, setDisplayMode] = useState(initialDisplay);
28
+ useEffect(() => {
29
+ setDisplayedMonth(value);
30
+ }, [value]);
31
+ return (_jsxs("div", { className: clsx('col gap-y-4', className), children: [_jsxs("div", { className: "row items-center justify-between h-7", children: [_jsxs(TextButton, { className: clsx('row gap-x-1 items-center cursor-pointer select-none', {
32
+ 'text-disabled-text': displayMode !== 'day',
33
+ }), onClick: () => setDisplayMode(displayMode === 'day' ? 'yearMonth' : 'day'), children: [`${new Intl.DateTimeFormat(locale, { month: 'long' }).format(displayedMonth)} ${displayedMonth.getFullYear()}`, _jsx(ChevronDown, { size: 16 })] }), displayMode === 'day' && (_jsxs("div", { className: "row justify-end", children: [_jsx(SolidButton, { size: "small", color: "primary", disabled: !isInTimeSpan(subtractDuration(displayedMonth, { months: 1 }), start, end), onClick: () => {
34
+ setDisplayedMonth(subtractDuration(displayedMonth, { months: 1 }));
35
+ }, children: _jsx(ArrowUp, { size: 20 }) }), _jsx(SolidButton, { size: "small", color: "primary", disabled: !isInTimeSpan(addDuration(displayedMonth, { months: 1 }), start, end), onClick: () => {
36
+ setDisplayedMonth(addDuration(displayedMonth, { months: 1 }));
37
+ }, children: _jsx(ArrowDown, { size: 20 }) })] }))] }), displayMode === 'yearMonth' ? (_jsx(YearMonthPicker, { ...yearMonthPickerProps, displayedYearMonth: value, start: start, end: end, onChange: newDate => {
38
+ setDisplayedMonth(newDate);
39
+ setDisplayMode('day');
40
+ } })) : (_jsxs("div", { children: [_jsx(DayPicker, { ...dayPickerProps, displayedMonth: displayedMonth, start: start, end: end, selected: value, onChange: date => {
41
+ onChange(date);
42
+ } }), _jsx("div", { className: "mt-2", children: _jsx(TextButton, { onClick: () => {
43
+ const newDate = new Date();
44
+ newDate.setHours(value.getHours(), value.getMinutes());
45
+ onChange(newDate);
46
+ }, children: translation.today }) })] }))] }));
47
+ };
48
+ /**
49
+ * Example for the Date Picker
50
+ */
51
+ export const ControlledDatePicker = ({ value = new Date(), onChange = noop, ...props }) => {
52
+ const [date, setDate] = useState(value);
53
+ useEffect(() => setDate(value), [value]);
54
+ return (_jsx(DatePicker, { ...props, value: date, onChange: date1 => {
55
+ setDate(date1);
56
+ onChange(date1);
57
+ } }));
58
+ };
@@ -0,0 +1,16 @@
1
+ import type { WeekDay } from '../../util/date';
2
+ export type DayPickerProps = {
3
+ displayedMonth: Date;
4
+ selected?: Date;
5
+ start?: Date;
6
+ end?: Date;
7
+ onChange?: (date: Date) => void;
8
+ weekStart?: WeekDay;
9
+ markToday?: boolean;
10
+ className?: string;
11
+ };
12
+ /**
13
+ * A component for selecting a day of a month
14
+ */
15
+ export declare const DayPicker: ({ displayedMonth, selected, start, end, onChange, weekStart, markToday, className }: DayPickerProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const DayPickerControlled: ({ displayedMonth, onChange, ...restProps }: DayPickerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { isInTimeSpan } from '../../util/date';
3
+ import { equalDate, getWeeksForCalenderMonth } from '../../util/date';
4
+ import { noop } from '../../util/noop';
5
+ import clsx from 'clsx';
6
+ import { useLocale } from '../../hooks/useLanguage';
7
+ import { useEffect, useState } from 'react';
8
+ /**
9
+ * A component for selecting a day of a month
10
+ */
11
+ export const DayPicker = ({ displayedMonth, selected, start, end, onChange = noop, weekStart = 'monday', markToday = true, className = '' }) => {
12
+ const locale = useLocale();
13
+ const month = displayedMonth.getMonth();
14
+ const weeks = getWeeksForCalenderMonth(displayedMonth, weekStart);
15
+ return (_jsxs("div", { className: clsx('col gap-y-1 min-w-[220px] select-none', className), children: [_jsx("div", { className: "row text-center", children: weeks[0].map((weekDay, index) => (_jsx("div", { className: "flex-1 font-semibold", children: new Intl.DateTimeFormat(locale, { weekday: 'long' }).format(weekDay).substring(0, 2) }, index))) }), weeks.map((week, index) => (_jsx("div", { className: "row text-center", children: week.map((date) => {
16
+ const isSelected = !!selected && equalDate(selected, date);
17
+ const isToday = equalDate(new Date(), date);
18
+ const isSameMonth = date.getMonth() === month;
19
+ const isDayValid = isInTimeSpan(date, start, end);
20
+ return (_jsx("button", { disabled: !isDayValid, className: clsx('flex-1 rounded-full border-2 border-transparent shadow-sm', {
21
+ 'text-gray-700 bg-gray-100': !isSameMonth && isDayValid,
22
+ 'text-black bg-white': !isSelected && isSameMonth && isDayValid,
23
+ 'text-on-primary bg-primary': isSelected,
24
+ 'border-black': isToday && markToday,
25
+ 'hover:brightness-90 hover:bg-primary hover:text-on-primary': isDayValid,
26
+ 'text-disabled-text bg-disabled-background': !isDayValid
27
+ }), onClick: () => onChange(date), children: date.getDate() }, date.getDate()));
28
+ }) }, index)))] }));
29
+ };
30
+ export const DayPickerControlled = ({ displayedMonth, onChange = noop, ...restProps }) => {
31
+ const [date, setDate] = useState(displayedMonth);
32
+ useEffect(() => setDate(displayedMonth), [displayedMonth]);
33
+ return (_jsx(DayPicker, { displayedMonth: date, onChange: newDate => {
34
+ setDate(newDate);
35
+ onChange(newDate);
36
+ }, ...restProps }));
37
+ };
@@ -0,0 +1,12 @@
1
+ type MinuteIncrement = '1min' | '5min' | '10min' | '15min' | '30min';
2
+ export type TimePickerProps = {
3
+ time?: Date;
4
+ onChange?: (time: Date) => void;
5
+ is24HourFormat?: boolean;
6
+ minuteIncrement?: MinuteIncrement;
7
+ maxHeight?: number;
8
+ className?: string;
9
+ };
10
+ export declare const TimePicker: ({ time, onChange, is24HourFormat, minuteIncrement, maxHeight, className }: TimePickerProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const ControlledTimePicker: ({ time, onChange, ...props }: TimePickerProps) => import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,79 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { Scrollbars } from 'react-custom-scrollbars-2';
4
+ import { noop } from '../../util/noop';
5
+ import { closestMatch, range } from '../../util/array';
6
+ import clsx from 'clsx';
7
+ export const TimePicker = ({ time = new Date(), onChange = noop, is24HourFormat = true, minuteIncrement = '5min', maxHeight = 300, className = '' }) => {
8
+ const minuteRef = useRef(null);
9
+ const hourRef = useRef(null);
10
+ const isPM = time.getHours() >= 11;
11
+ const hours = is24HourFormat ? range(0, 23) : range(1, 12);
12
+ let minutes = range(0, 59);
13
+ useEffect(() => {
14
+ const scrollToItem = () => {
15
+ if (minuteRef.current) {
16
+ const container = minuteRef.current.parentElement;
17
+ const hasOverflow = container.scrollHeight > maxHeight;
18
+ if (hasOverflow) {
19
+ minuteRef.current.scrollIntoView({
20
+ behavior: 'instant',
21
+ block: 'nearest',
22
+ });
23
+ }
24
+ }
25
+ };
26
+ scrollToItem();
27
+ }, [minuteRef, minuteRef.current]); // eslint-disable-line
28
+ useEffect(() => {
29
+ const scrollToItem = () => {
30
+ if (hourRef.current) {
31
+ const container = hourRef.current.parentElement;
32
+ const hasOverflow = container.scrollHeight > maxHeight;
33
+ if (hasOverflow) {
34
+ hourRef.current.scrollIntoView({
35
+ behavior: 'instant',
36
+ block: 'nearest',
37
+ });
38
+ }
39
+ }
40
+ };
41
+ scrollToItem();
42
+ }, [hourRef, hourRef.current]); // eslint-disable-line
43
+ switch (minuteIncrement) {
44
+ case '5min':
45
+ minutes = minutes.filter(value => value % 5 === 0);
46
+ break;
47
+ case '10min':
48
+ minutes = minutes.filter(value => value % 10 === 0);
49
+ break;
50
+ case '15min':
51
+ minutes = minutes.filter(value => value % 15 === 0);
52
+ break;
53
+ case '30min':
54
+ minutes = minutes.filter(value => value % 30 === 0);
55
+ break;
56
+ }
57
+ const closestMinute = closestMatch(minutes, (item1, item2) => Math.abs(item1 - time.getMinutes()) < Math.abs(item2 - time.getMinutes()));
58
+ const style = (selected) => clsx('chip-full hover:brightness-90 hover:bg-primary hover:text-on-primary rounded-md mr-3', { 'bg-primary text-on-primary': selected, 'bg-white text-black': !selected });
59
+ const onChangeWrapper = (transformer) => {
60
+ const newDate = new Date(time);
61
+ transformer(newDate);
62
+ onChange(newDate);
63
+ };
64
+ return (_jsxs("div", { className: clsx('row gap-x-2 w-fit min-w-[150px] select-none', className), children: [_jsx(Scrollbars, { autoHeight: true, autoHeightMax: maxHeight, style: { height: '100%' }, children: _jsx("div", { className: "col gap-y-1 h-full", children: hours.map(hour => {
65
+ const currentHour = hour === time.getHours() - (!is24HourFormat && isPM ? 12 : 0);
66
+ return (_jsx("button", { ref: currentHour ? hourRef : undefined, className: style(currentHour), onClick: () => onChangeWrapper(newDate => newDate.setHours(hour + (!is24HourFormat && isPM ? 12 : 0))), children: hour.toString().padStart(2, '0') }, hour));
67
+ }) }) }), _jsx(Scrollbars, { autoHeight: true, autoHeightMax: maxHeight, style: { height: '100%' }, children: _jsx("div", { className: "col gap-y-1 h-full", children: minutes.map(minute => {
68
+ const currentMinute = minute === closestMinute;
69
+ return (_jsx("button", { ref: currentMinute ? minuteRef : undefined, className: style(currentMinute), onClick: () => onChangeWrapper(newDate => newDate.setMinutes(minute)), children: minute.toString().padStart(2, '0') }, minute + minuteIncrement));
70
+ }) }) }), !is24HourFormat && (_jsxs("div", { className: "col gap-y-1", children: [_jsx("button", { className: style(!isPM), onClick: () => onChangeWrapper(newDate => isPM && newDate.setHours(newDate.getHours() - 12)), children: "AM" }), _jsx("button", { className: style(isPM), onClick: () => onChangeWrapper(newDate => !isPM && newDate.setHours(newDate.getHours() + 12)), children: "PM" })] }))] }));
71
+ };
72
+ export const ControlledTimePicker = ({ time, onChange = noop, ...props }) => {
73
+ const [value, setValue] = useState(time);
74
+ useEffect(() => setValue(time), [time]);
75
+ return (_jsx(TimePicker, { ...props, time: value, onChange: time1 => {
76
+ setValue(time1);
77
+ onChange(time1);
78
+ } }));
79
+ };
@@ -0,0 +1,11 @@
1
+ export type YearMonthPickerProps = {
2
+ displayedYearMonth?: Date;
3
+ start?: Date;
4
+ end?: Date;
5
+ onChange?: (date: Date) => void;
6
+ className?: string;
7
+ maxHeight?: number;
8
+ showValueOpen?: boolean;
9
+ };
10
+ export declare const YearMonthPicker: ({ displayedYearMonth, start, end, onChange, className, maxHeight, showValueOpen }: YearMonthPickerProps) => import("react/jsx-runtime").JSX.Element | null;
11
+ export declare const ControlledYearMonthPicker: ({ displayedYearMonth, onChange, ...props }: YearMonthPickerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,59 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { Scrollbars } from 'react-custom-scrollbars-2';
4
+ import { noop } from '../../util/noop';
5
+ import { equalSizeGroups, range } from '../../util/array';
6
+ import clsx from 'clsx';
7
+ import { Expandable } from '../Expandable';
8
+ import { addDuration, monthsList, subtractDuration } from '../../util/date';
9
+ import { useLocale } from '../../hooks/useLanguage';
10
+ // TODO use a dynamically loading infinite list here
11
+ export const YearMonthPicker = ({ displayedYearMonth = new Date(), start = subtractDuration(new Date(), { years: 50 }), end = addDuration(new Date(), { years: 50 }), onChange = noop, className = '', maxHeight = 300, showValueOpen = true }) => {
12
+ const locale = useLocale();
13
+ const ref = useRef(null);
14
+ useEffect(() => {
15
+ const scrollToItem = () => {
16
+ if (ref.current) {
17
+ ref.current.scrollIntoView({
18
+ behavior: 'instant',
19
+ block: 'center',
20
+ });
21
+ }
22
+ };
23
+ scrollToItem();
24
+ }, [ref]);
25
+ if (end < start) {
26
+ console.error(`startYear: (${start}) less than endYear: (${end})`);
27
+ return null;
28
+ }
29
+ const years = range(start.getFullYear(), end.getFullYear());
30
+ return (_jsx("div", { className: clsx('col select-none', className), children: _jsx(Scrollbars, { autoHeight: true, autoHeightMax: maxHeight, style: { height: '100%' }, children: _jsx("div", { className: "col gap-y-1 mr-3", children: years.map(year => {
31
+ var _a;
32
+ const selectedYear = displayedYearMonth.getFullYear() === year;
33
+ return (_jsx(Expandable, { ref: ((_a = displayedYearMonth.getFullYear()) !== null && _a !== void 0 ? _a : new Date().getFullYear()) === year ? ref : undefined, label: _jsx("span", { className: clsx({ 'text-primary font-bold': selectedYear }), children: year }), initialExpansion: showValueOpen && selectedYear, children: _jsx("div", { className: "col gap-y-1 px-2 pb-2", children: equalSizeGroups([...monthsList], 3).map((monthList, index) => (_jsx("div", { className: "row", children: monthList.map(month => {
34
+ const monthIndex = monthsList.indexOf(month);
35
+ const newDate = new Date(year, monthIndex);
36
+ const selectedMonth = selectedYear && monthIndex === displayedYearMonth.getMonth();
37
+ const firstOfMonth = new Date(year, monthIndex, 1);
38
+ const lastOfMonth = new Date(year, monthIndex, 1);
39
+ const isAfterStart = start === undefined || start <= addDuration(subtractDuration(lastOfMonth, { days: 1 }), { months: 1 });
40
+ const isBeforeEnd = end === undefined || firstOfMonth <= end;
41
+ const isValid = isAfterStart && isBeforeEnd;
42
+ return (_jsx("button", { disabled: !isValid, className: clsx('chip hover:brightness-95 flex-1', {
43
+ 'bg-gray-50 text-black': !selectedMonth && isValid,
44
+ 'bg-primary text-on-primary': selectedMonth && isValid,
45
+ 'bg-disabled-background text-disabled-text': !isValid
46
+ }), onClick: () => {
47
+ onChange(newDate);
48
+ }, children: new Intl.DateTimeFormat(locale, { month: 'short' }).format(newDate) }, month));
49
+ }) }, index))) }) }, year));
50
+ }) }) }) }));
51
+ };
52
+ export const ControlledYearMonthPicker = ({ displayedYearMonth = new Date(), onChange = noop, ...props }) => {
53
+ const [yearMonth, setYearMonth] = useState(displayedYearMonth);
54
+ useEffect(() => setYearMonth(displayedYearMonth), [displayedYearMonth]);
55
+ return (_jsx(YearMonthPicker, { displayedYearMonth: yearMonth, onChange: date => {
56
+ setYearMonth(date);
57
+ onChange(date);
58
+ }, ...props }));
59
+ };
@@ -0,0 +1,6 @@
1
+ import type { InputGroupProps } from '../InputGroup';
2
+ export type InputGroupExampleProps = Omit<InputGroupProps, 'inputs' | 'onChange'>;
3
+ /**
4
+ * Example for an Input Group
5
+ */
6
+ export declare const InputGroupExample: ({ ...props }: InputGroupExampleProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { InputGroup } from '../InputGroup';
4
+ import { Select } from '../user-input/Select';
5
+ import { Input } from '../user-input/Input';
6
+ import { Textarea } from '../user-input/Textarea';
7
+ /**
8
+ * Example for an Input Group
9
+ */
10
+ export const InputGroupExample = ({ ...props }) => {
11
+ const [state, setState] = useState({
12
+ propertyName: '',
13
+ description: ''
14
+ });
15
+ return (_jsxs(InputGroup, { ...props, onChange: console.log, children: [_jsx(Select, { label: { name: 'Subject Type', labelType: 'labelSmall' }, value: state.subject, options: [
16
+ { value: 'organization', label: 'Organization' },
17
+ { value: 'ward', label: 'Ward' },
18
+ { value: 'bed', label: 'Bed' },
19
+ { value: 'patient', label: 'Patient' },
20
+ ], onChange: subject => setState({ ...state, subject }) }, "item1"), _jsx(Input, { label: { name: 'Property Name' }, value: state.propertyName, onChange: propertyName => setState({ ...state, propertyName }) }, "item2"), _jsx(Textarea, { label: { name: 'Description' }, value: state.description, onChange: description => setState({ ...state, description }) }, "item3")] }));
21
+ };
@@ -0,0 +1,7 @@
1
+ import type { MultiSelectProps } from '../user-input/MultiSelect';
2
+ type MultiSelectExampleProps = Omit<MultiSelectProps<string>, 'search' | 'selectedDisplay'> & {
3
+ enableSearch: boolean;
4
+ useChipDisplay: boolean;
5
+ };
6
+ export declare const MultiSelectExample: ({ options, hintText, enableSearch, onChange, useChipDisplay, ...props }: MultiSelectExampleProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { MultiSelect } from '../user-input/MultiSelect';
4
+ import { ChipList } from '../ChipList';
5
+ export const MultiSelectExample = ({ options, hintText, enableSearch, onChange, useChipDisplay = false, ...props }) => {
6
+ const [usedOptions, setUsedOptions] = useState(options);
7
+ useEffect(() => {
8
+ setUsedOptions(options);
9
+ }, [options]);
10
+ useEffect(() => {
11
+ setUsedOptions(options);
12
+ }, [options]);
13
+ useEffect(() => {
14
+ setUsedOptions(options.map(value => ({ ...value, selected: false })));
15
+ }, [hintText, options]);
16
+ return (_jsx(MultiSelect, { options: usedOptions, onChange: value => {
17
+ onChange(value);
18
+ setUsedOptions(value);
19
+ }, hintText: hintText, search: enableSearch ? { initialSearch: '', searchMapping: value => [value.label] } : undefined, selectedDisplay: useChipDisplay ?
20
+ ({ items }) => {
21
+ const selected = items.filter(value => value.selected);
22
+ if (selected.length === 0) {
23
+ return (_jsx("span", { children: "Select" }));
24
+ }
25
+ return (_jsx(ChipList, { list: selected.map(value => ({ children: value.label })) }));
26
+ } : undefined, ...props }));
27
+ };
@@ -0,0 +1,6 @@
1
+ import type { SearchableSelectProps } from '../user-input/SearchableSelect';
2
+ export type SearchableSelectExampleProps = Omit<SearchableSelectProps<string>, 'searchMapping' | 'additionalItems'>;
3
+ /**
4
+ * Example for a Searchable select
5
+ */
6
+ export declare const SearchableSelectExample: ({ value, options, onChange, ...props }: SearchableSelectExampleProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { SearchableSelect } from '../user-input/SearchableSelect';
4
+ /**
5
+ * Example for a Searchable select
6
+ */
7
+ export const SearchableSelectExample = ({ value, options, onChange, ...props }) => {
8
+ const [selected, setSelected] = useState(value);
9
+ useEffect(() => {
10
+ var _a;
11
+ setSelected((_a = options.find(value1 => value1.value === value)) === null || _a === void 0 ? void 0 : _a.value);
12
+ }, [options, value]);
13
+ return (_jsx(SearchableSelect, { ...props, value: selected, options: options, onChange: value => {
14
+ setSelected(value);
15
+ onChange(value);
16
+ }, searchMapping: value1 => [value1.value] }));
17
+ };
@@ -0,0 +1,4 @@
1
+ import { type SelectProps } from '../user-input/Select';
2
+ type SelectExampleProps<T> = Omit<SelectProps<T>, 'onChange' | 'additionalItems' | 'selectedDisplayOverwrite'>;
3
+ export declare const SelectExample: <T>({ options, value, hintText, ...props }: SelectExampleProps<T>) => import("react/jsx-runtime").JSX.Element;
4
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from 'react';
3
+ import { Select } from '../user-input/Select';
4
+ export const SelectExample = ({ options, value, hintText, ...props }) => {
5
+ const [selected, setSelected] = useState(value);
6
+ useEffect(() => {
7
+ if (options.find(options => options.value === value)) {
8
+ setSelected(value);
9
+ }
10
+ }, [options, value]);
11
+ useEffect(() => {
12
+ setSelected(undefined);
13
+ }, [hintText]);
14
+ return (_jsx(Select, { value: selected, options: options, onChange: value => setSelected(value), hintText: hintText, ...props }));
15
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * An Example Component for Stacking Modals
3
+ */
4
+ export declare const StackingModals: () => 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 { ModalRegister } from '../modals/ModalRegister';
4
+ import { ConfirmDialog } from '../modals/ConfirmDialog';
5
+ import { SolidButton } from '../Button';
6
+ import { modalRootName } from '../modals/Modal';
7
+ /**
8
+ * An Example Component for Stacking Modals
9
+ */
10
+ export const StackingModals = () => {
11
+ const [modal1, setModal1] = useState(false);
12
+ const [modal2, setModal2] = useState(false);
13
+ const [modal3, setModal3] = useState(false);
14
+ return (_jsxs(ModalRegister, { children: [_jsxs(ConfirmDialog, { id: "1", isOpen: modal1, onConfirm: () => setModal1(false), onBackgroundClick: () => setModal1(false), onCloseClick: () => setModal1(false), modalClassName: "!bg-yellow-200 min-h-[300px]", children: ['I\'m Modal 1', _jsx(SolidButton, { onClick: () => setModal2(true), children: "Open Modal 2" })] }), _jsxs(ConfirmDialog, { id: "2", isOpen: modal2, onConfirm: () => setModal2(false), onBackgroundClick: () => setModal2(false), onCloseClick: () => setModal2(false), modalClassName: "!bg-green-200 min-w-[300px]", children: ['The next layer of Modals!', 'This is Modal 2', _jsx(SolidButton, { onClick: () => setModal3(true), children: "Open Modal 3" })] }), _jsx(ConfirmDialog, { id: "3", isOpen: modal3, onConfirm: () => setModal3(false), onBackgroundClick: () => setModal3(false), onCloseClick: () => setModal3(false), children: "This is Modal 3!" }), _jsx("div", { className: "row items-center justify-center min-h-[400px]", id: modalRootName, children: _jsx(SolidButton, { onClick: () => setModal1(true), children: "Open Modal 1" }) })] }));
15
+ };