@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
@@ -1,58 +0,0 @@
1
- export type ProgressIndicatorProps = {
2
- /*
3
- The amount of progress that has been made
4
- Value form 0 to 1
5
- */
6
- progress: number,
7
- strokeWidth?: number,
8
- size?: keyof typeof sizeMapping,
9
- direction?: 'clockwise' | 'counterclockwise',
10
- /*
11
- Rotation of the starting point of the indicator
12
- default start at 3 o'clock
13
- Given in degree
14
- */
15
- rotation?: number,
16
- }
17
-
18
- const sizeMapping = { small: 16, medium: 24, big: 48 }
19
-
20
- /**
21
- * A progress indicator
22
- *
23
- * Start rotation is 3 o'clock and fills counterclockwise
24
- *
25
- * Progress is given from 0 to 1
26
- */
27
- export const ProgressIndicator = ({
28
- progress,
29
- strokeWidth = 5,
30
- size = 'medium',
31
- direction = 'counterclockwise',
32
- rotation = 0
33
- }: ProgressIndicatorProps) => {
34
- const currentSize = sizeMapping[size]
35
- const center = currentSize / 2
36
- const radius = center - strokeWidth / 2
37
- const arcLength = 2 * Math.PI * radius
38
- const arcOffset = arcLength * progress
39
- if (direction === 'clockwise') {
40
- rotation += 360 * progress
41
- }
42
- return (
43
- <svg
44
- style={{
45
- height: `${currentSize}px`,
46
- width: `${currentSize}px`,
47
- transform: `rotate(${rotation}deg)`
48
- }}
49
- >
50
- <circle cx={center} cy={center} r={radius} fill="transparent" strokeWidth={strokeWidth}
51
- className="stroke-primary"
52
- />
53
- <circle cx={center} cy={center} r={radius} fill="transparent" strokeWidth={strokeWidth}
54
- strokeDasharray={arcLength} strokeDashoffset={arcOffset} className="stroke-gray-300"
55
- />
56
- </svg>
57
- )
58
- }
@@ -1,286 +0,0 @@
1
- import type { CSSProperties } from 'react'
2
- import { useCallback, useEffect, useState } from 'react'
3
- import { noop } from '../util/noop'
4
- import { Circle } from './Circle'
5
- import clsx from 'clsx'
6
-
7
- export type RingProps = {
8
- innerSize: number, // the size of the entire circle including the circleWidth
9
- width: number,
10
- className?: string,
11
- };
12
-
13
- export const Ring = ({
14
- innerSize = 20,
15
- width = 7,
16
- className = 'outline-primary',
17
- }: RingProps) => {
18
- return (
19
- <div
20
- className={clsx(`bg-transparent rounded-full outline`, className)}
21
- style={{
22
- width: `${innerSize}px`,
23
- height: `${innerSize}px`,
24
- outlineWidth: `${width}px`,
25
- }}
26
- />
27
- )
28
- }
29
-
30
- export type AnimatedRingProps = RingProps & {
31
- fillAnimationDuration?: number, // in seconds, 0 means no animation
32
- repeating?: boolean,
33
- onAnimationFinished?: () => void,
34
- style?: CSSProperties,
35
- };
36
-
37
- export const AnimatedRing = ({
38
- innerSize,
39
- width,
40
- className,
41
- fillAnimationDuration = 3,
42
- repeating = false,
43
- onAnimationFinished = noop,
44
- style,
45
- }: AnimatedRingProps) => {
46
- const [currentWidth, setCurrentWidth] = useState(0)
47
- const milliseconds = 1000 * fillAnimationDuration
48
-
49
- const animate = useCallback((timestamp: number, startTime: number) => {
50
- const progress = Math.min((timestamp - startTime) / milliseconds, 1)
51
- const newWidth = Math.min(width * progress, width)
52
-
53
- setCurrentWidth(newWidth)
54
-
55
- if (progress < 1) {
56
- requestAnimationFrame((newTimestamp) => animate(newTimestamp, startTime))
57
- } else {
58
- onAnimationFinished()
59
- if (repeating) {
60
- setCurrentWidth(0)
61
- requestAnimationFrame((newTimestamp) => animate(newTimestamp, newTimestamp))
62
- }
63
- }
64
- }, [milliseconds, onAnimationFinished, repeating, width])
65
-
66
- useEffect(() => {
67
- if (currentWidth < width) {
68
- requestAnimationFrame((timestamp) => animate(timestamp, timestamp))
69
- }
70
- }, []) // eslint-disable-line react-hooks/exhaustive-deps
71
-
72
- return (
73
- <div
74
- className="row items-center justify-center"
75
- style={{
76
- width: `${innerSize + 2 * width}px`,
77
- height: `${innerSize + 2 * width}px`,
78
- ...style,
79
- }}
80
- >
81
- <Ring
82
- innerSize={innerSize}
83
- width={currentWidth}
84
- className={className}
85
- />
86
- </div>
87
- )
88
- }
89
-
90
- export type RingWaveProps = Omit<AnimatedRingProps, 'innerSize'> & {
91
- startInnerSize: number,
92
- endInnerSize: number,
93
- style?: CSSProperties,
94
- };
95
-
96
- export const RingWave = ({
97
- startInnerSize = 20,
98
- endInnerSize = 30,
99
- width,
100
- className,
101
- fillAnimationDuration = 3,
102
- repeating = false,
103
- onAnimationFinished = noop,
104
- style
105
- }: RingWaveProps) => {
106
- const [currentInnerSize, setCurrentInnerSize] = useState(startInnerSize)
107
- const distance = endInnerSize - startInnerSize
108
- const milliseconds = 1000 * fillAnimationDuration
109
-
110
- const animate = useCallback((timestamp: number, startTime: number) => {
111
- const progress = Math.min((timestamp - startTime) / milliseconds, 1)
112
- const newInnerSize = Math.min(
113
- startInnerSize + distance * progress,
114
- endInnerSize
115
- )
116
-
117
- setCurrentInnerSize(newInnerSize)
118
-
119
- if (progress < 1) {
120
- requestAnimationFrame((newTimestamp) => animate(newTimestamp, startTime))
121
- } else {
122
- onAnimationFinished()
123
- if (repeating) {
124
- setCurrentInnerSize(startInnerSize)
125
- requestAnimationFrame((newTimestamp) => animate(newTimestamp, newTimestamp))
126
- }
127
- }
128
- }, [distance, endInnerSize, milliseconds, onAnimationFinished, repeating, startInnerSize])
129
-
130
- useEffect(() => {
131
- if (currentInnerSize < endInnerSize) {
132
- requestAnimationFrame((timestamp) => animate(timestamp, timestamp))
133
- }
134
- }, []) // eslint-disable-line react-hooks/exhaustive-deps
135
-
136
- return (
137
- <div
138
- className="row items-center justify-center"
139
- style={{
140
- width: `${endInnerSize + 2 * width}px`,
141
- height: `${endInnerSize + 2 * width}px`,
142
- ...style
143
- }}
144
- >
145
- <Ring
146
- innerSize={currentInnerSize}
147
- width={width}
148
- className={className}
149
- />
150
- </div>
151
- )
152
- }
153
-
154
- export type RadialRingsProps = {
155
- circle1ClassName?: string,
156
- circle2ClassName?: string,
157
- circle3ClassName?: string,
158
- waveWidth?: number,
159
- waveBaseColor?: string,
160
- sizeCircle1?: number,
161
- sizeCircle2?: number,
162
- sizeCircle3?: number,
163
- };
164
-
165
- // TODO use fixed colors here to avoid artifacts
166
- export const RadialRings = ({
167
- circle1ClassName = 'bg-primary/90 outline-primary/90',
168
- circle2ClassName = 'bg-primary/60 outline-primary/60',
169
- circle3ClassName = 'bg-primary/40 outline-primary/40',
170
- waveWidth = 10,
171
- waveBaseColor = 'outline-white/20',
172
- sizeCircle1 = 100,
173
- sizeCircle2 = 200,
174
- sizeCircle3 = 300
175
- }: RadialRingsProps) => {
176
- const [currentRing, setCurrentRing] = useState(0)
177
- const size = sizeCircle3
178
-
179
- return (
180
- <div
181
- className="relative"
182
- style={{
183
- width: `${sizeCircle3}px`,
184
- height: `${sizeCircle3}px`,
185
- }}
186
- >
187
- <Circle
188
- radius={sizeCircle1 / 2}
189
- className={clsx(circle1ClassName, `absolute z-[10] -translate-y-1/2 -translate-x-1/2`)}
190
- style={{
191
- left: `${size / 2}px`,
192
- top: `${size / 2}px`
193
- }}
194
- />
195
- {currentRing === 0 ? (
196
- <AnimatedRing
197
- innerSize={sizeCircle1}
198
- width={(sizeCircle2 - sizeCircle1) / 2}
199
- onAnimationFinished={() =>
200
- currentRing === 0 ? setCurrentRing(1) : null
201
- }
202
- repeating={true}
203
- className={clsx(circle2ClassName,
204
- { 'opacity-5': currentRing !== 0 })}
205
- style={{
206
- left: `${size / 2}px`,
207
- top: `${size / 2}px`,
208
- position: 'absolute',
209
- translate: `-50% -50%`,
210
- zIndex: 9
211
- }}
212
- />
213
- ) : null}
214
- {currentRing === 2 ? (
215
- <RingWave
216
- startInnerSize={sizeCircle1 - waveWidth}
217
- endInnerSize={sizeCircle2}
218
- width={waveWidth}
219
- repeating={true}
220
- className={clsx(waveBaseColor, `opacity-5`)}
221
- style={{
222
- left: `${size / 2}px`,
223
- top: `${size / 2}px`,
224
- position: 'absolute',
225
- translate: `-50% -50%`,
226
- zIndex: 9,
227
- }}
228
- />
229
- ) : null}
230
- <Circle
231
- radius={sizeCircle2 / 2}
232
- className={clsx(circle2ClassName,
233
- { 'opacity-20': currentRing < 1 },
234
- `absolute z-[8] -translate-y-1/2 -translate-x-1/2`)}
235
- style={{
236
- left: `${size / 2}px`,
237
- top: `${size / 2}px`
238
- }}
239
- />
240
- {currentRing === 1 ? (
241
- <AnimatedRing
242
- innerSize={sizeCircle2 - 1} // potentially harmful
243
- width={(sizeCircle3 - sizeCircle2) / 2}
244
- onAnimationFinished={() =>
245
- currentRing === 1 ? setCurrentRing(2) : null
246
- }
247
- repeating={true}
248
- className={clsx(circle3ClassName)}
249
- style={{
250
- left: `${size / 2}px`,
251
- top: `${size / 2}px`,
252
- position: 'absolute',
253
- translate: `-50% -50%`,
254
- zIndex: 7,
255
- }}
256
- />
257
- ) : null}
258
- {currentRing === 2 ? (
259
- <RingWave
260
- startInnerSize={sizeCircle2}
261
- endInnerSize={sizeCircle3 - waveWidth}
262
- width={waveWidth}
263
- repeating={true}
264
- className={clsx(waveBaseColor, `opacity-5`)}
265
- style={{
266
- left: `${size / 2}px`,
267
- top: `${size / 2}px`,
268
- position: 'absolute',
269
- translate: `-50% -50%`,
270
- zIndex: 7,
271
- }}
272
- />
273
- ) : null}
274
- <Circle
275
- radius={sizeCircle3 / 2}
276
- className={clsx(circle3ClassName,
277
- { 'opacity-20': currentRing < 2 },
278
- `absolute z-[6] -translate-y-1/2 -translate-x-1/2`)}
279
- style={{
280
- left: `${size / 2}px`,
281
- top: `${size / 2}px`
282
- }}
283
- />
284
- </div>
285
- )
286
- }
@@ -1,69 +0,0 @@
1
- import type { ReactNode } from 'react'
2
- import { useEffect, useMemo, useState } from 'react'
3
- import { Search } from 'lucide-react'
4
- import clsx from 'clsx'
5
- import type { Languages } from '../hooks/useLanguage'
6
- import { useTranslation } from '../hooks/useTranslation'
7
- import type { PropsForTranslation } from '../hooks/useTranslation'
8
- import { MultiSearchWithMapping } from '../util/simpleSearch'
9
- import { Input } from './user-input/Input'
10
-
11
- type SearchableListTranslation = {
12
- search: string,
13
- nothingFound: string,
14
- }
15
-
16
- const defaultSearchableListTranslation: Record<Languages, SearchableListTranslation> = {
17
- en: {
18
- search: 'Search',
19
- nothingFound: 'Nothing found'
20
- },
21
- de: {
22
- search: 'Suche',
23
- nothingFound: 'Nichts gefunden'
24
- }
25
- }
26
-
27
- export type SearchableListProps<T> = {
28
- list: T[],
29
- initialSearch?: string,
30
- searchMapping: (value: T) => string[],
31
- itemMapper: (value: T) => ReactNode,
32
- className?: string,
33
- }
34
-
35
- /**
36
- * A component for searching a list
37
- */
38
- export const SearchableList = <T, >({
39
- overwriteTranslation,
40
- list,
41
- initialSearch = '',
42
- searchMapping,
43
- itemMapper,
44
- className
45
- }: PropsForTranslation<SearchableListTranslation, SearchableListProps<T>>) => {
46
- const translation = useTranslation(defaultSearchableListTranslation, overwriteTranslation)
47
- const [search, setSearch] = useState<string>(initialSearch)
48
-
49
- useEffect(() => setSearch(initialSearch), [initialSearch])
50
-
51
- const filteredEntries = useMemo(() => MultiSearchWithMapping(search, list, searchMapping), [search, list, searchMapping])
52
-
53
- return (
54
- <div className={clsx('col gap-y-2', className)}>
55
- <div className="row justify-between gap-x-2 items-center">
56
- <div className="flex-1">
57
- <Input value={search} onChange={setSearch} placeholder={translation.search}/>
58
- </div>
59
- <Search size={20}/>
60
- </div>
61
- {filteredEntries.length > 0 && (
62
- <div className="col gap-y-1">
63
- {filteredEntries.map(itemMapper)}
64
- </div>
65
- )}
66
- {!filteredEntries.length && <div className="row justify-center">{translation.nothingFound}</div>}
67
- </div>
68
- )
69
- }
@@ -1,33 +0,0 @@
1
- import { ChevronDown, ChevronsUpDown, ChevronUp } from 'lucide-react'
2
- import type { TextButtonProps } from './Button'
3
- import { TextButton } from './Button'
4
- import type { TableSortingType } from './Table'
5
-
6
- export type SortButtonProps = Omit<TextButtonProps, 'onClick'> & {
7
- ascending?: TableSortingType,
8
- onClick: (newTableSorting:TableSortingType) => void,
9
- }
10
-
11
- /**
12
- * A Extension of the normal button that displays the sorting state right of the content
13
- */
14
- export const SortButton = ({
15
- children,
16
- ascending,
17
- color,
18
- onClick,
19
- ...buttonProps
20
- }: SortButtonProps) => {
21
- return (
22
- <TextButton
23
- color={color}
24
- onClick={() => onClick(ascending === 'descending' ? 'ascending' : 'descending')}
25
- {...buttonProps}
26
- >
27
- <div className="row gap-x-2">
28
- {children}
29
- {ascending === 'ascending' ? <ChevronUp/> : (!ascending ? <ChevronsUpDown/> : <ChevronDown/>)}
30
- </div>
31
- </TextButton>
32
- )
33
- }
@@ -1,124 +0,0 @@
1
- import { Check, ChevronLeft, ChevronRight } from 'lucide-react'
2
- import type { Languages } from '../hooks/useLanguage'
3
- import type { PropsForTranslation } from '../hooks/useTranslation'
4
- import { useTranslation } from '../hooks/useTranslation'
5
- import { range } from '../util/array'
6
- import { SolidButton } from './Button'
7
- import clsx from 'clsx'
8
-
9
- type StepperBarTranslation = {
10
- back: string,
11
- next: string,
12
- confirm: string,
13
- }
14
-
15
- const defaultStepperBarTranslation: Record<Languages, StepperBarTranslation> = {
16
- en: {
17
- back: 'Back',
18
- next: 'Next Step',
19
- confirm: 'Create'
20
- },
21
- de: {
22
- back: 'Zurück',
23
- next: 'Nächster Schritt',
24
- confirm: 'Erstellen'
25
- }
26
- }
27
-
28
- export type StepperInformation = {
29
- step: number,
30
- lastStep: number,
31
- seenSteps: Set<number>,
32
- }
33
-
34
- export type StepperBarProps = {
35
- stepper: StepperInformation,
36
- onChange: (step: StepperInformation) => void,
37
- onFinish: () => void,
38
- showDots?: boolean,
39
- className?: string,
40
- }
41
-
42
- /**
43
- * A Component for stepping
44
- */
45
- export const StepperBar = ({
46
- overwriteTranslation,
47
- stepper,
48
- onChange,
49
- onFinish,
50
- showDots = true,
51
- className = '',
52
- }: PropsForTranslation<StepperBarTranslation, StepperBarProps>) => {
53
- const translation = useTranslation(defaultStepperBarTranslation, overwriteTranslation)
54
- const dots = range(0, stepper.lastStep)
55
- const { step, seenSteps, lastStep } = stepper
56
-
57
- const update = (newStep: number) => {
58
- seenSteps.add(newStep)
59
- onChange({ step: newStep, seenSteps, lastStep })
60
- }
61
-
62
- return (
63
- <div
64
- className={clsx('sticky row p-2 border-2 justify-between rounded-lg shadow-lg', className)}
65
- >
66
- <div className="flex-[2] justify-start">
67
- <SolidButton
68
- disabled={step === 0}
69
- onClick={() => {
70
- update(step - 1)
71
- }}
72
- className="row gap-x-1 items-center justify-center"
73
- >
74
- <ChevronLeft size={14}/>
75
- {translation.back}
76
- </SolidButton>
77
- </div>
78
- <div className="row flex-[5] gap-x-2 justify-center items-center">
79
- {showDots && dots.map((value, index) => {
80
- const seen = seenSteps.has(index)
81
- return (
82
- <div
83
- key={index}
84
- onClick={() => seen && update(index)}
85
- className={clsx('rounded-full w-4 h-4', {
86
- 'bg-primary hover:brightness-75': index === step && seen,
87
- 'bg-primary/40 hover:bg-primary': index !== step && seen,
88
- 'bg-gray-200 outline-transparent': !seen,
89
- },
90
- {
91
- 'cursor-pointer': seen,
92
- 'cursor-not-allowed': !seen,
93
- })}
94
- />
95
- )
96
- })}
97
- </div>
98
- {step !== lastStep && (
99
- <div className="flex-[2] justify-end">
100
- <SolidButton
101
- onClick={() => update(step + 1)}
102
- className="row gap-x-1 items-center justify-center"
103
- >
104
- {translation.next}
105
- <ChevronRight size={14}/>
106
- </SolidButton>
107
- </div>
108
- )}
109
- {step === lastStep && (
110
- <div className="flex-[2] justify-end">
111
- <SolidButton
112
- // TODO check form validity
113
- disabled={false}
114
- onClick={onFinish}
115
- className="row gap-x-1 items-center justify-center"
116
- >
117
- <Check size={14}/>
118
- {translation.confirm}
119
- </SolidButton>
120
- </div>
121
- )}
122
- </div>
123
- )
124
- }