@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,44 +0,0 @@
1
- import { useEffect, useState } from 'react'
2
- import type { DatePropertyProps } from '../../properties/DateProperty'
3
- import { DateProperty } from '../../properties/DateProperty'
4
- import { noop } from '../../../util/noop'
5
-
6
- export type DatePropertyExampleProps = DatePropertyProps & {
7
- readOnly: boolean,
8
- }
9
-
10
- /**
11
- * Example for using the DateProperty
12
- */
13
- export const DatePropertyExample = ({
14
- value,
15
- onChange = noop,
16
- onRemove = noop,
17
- onEditComplete = noop,
18
- ...restProps
19
- }: DatePropertyExampleProps) => {
20
- const [usedDate, setUsedDate] = useState<Date | undefined>(value)
21
-
22
- useEffect(() => {
23
- setUsedDate(value)
24
- }, [value])
25
-
26
- return (
27
- <DateProperty
28
- {...restProps}
29
- onChange={date => {
30
- setUsedDate(date)
31
- onChange(date)
32
- }}
33
- onEditComplete={date => {
34
- setUsedDate(date)
35
- onEditComplete(date)
36
- }}
37
- onRemove={() => {
38
- setUsedDate(undefined)
39
- onRemove()
40
- }}
41
- value={usedDate}
42
- />
43
- )
44
- }
@@ -1,39 +0,0 @@
1
- import { useEffect, useState } from 'react'
2
- import type { MultiSelectOption } from '../../user-input/MultiSelect'
3
- import type { MultiSelectPropertyProps } from '../../properties/MultiSelectProperty'
4
- import { MultiSelectProperty } from '../../properties/MultiSelectProperty'
5
-
6
- export type MultiSelectPropertyExample = Omit<MultiSelectPropertyProps<string>, 'onChange' | 'onRemove' | 'search' | 'selectedDisplay' > & {
7
- enableSearch: boolean,
8
- }
9
-
10
- /**
11
- * Example for using the MultiSelectProperty
12
- */
13
- export const MultiSelectPropertyExample = ({
14
- options,
15
- hintText,
16
- enableSearch,
17
- ...restProps
18
- }: MultiSelectPropertyExample) => {
19
- const [usedOptions, setUsedOptions] = useState<MultiSelectOption<string>[]>(options)
20
-
21
- useEffect(() => {
22
- setUsedOptions(options)
23
- }, [options])
24
-
25
- useEffect(() => {
26
- setUsedOptions(options.map(value => ({ ...value, selected: false })))
27
- }, [hintText, options])
28
-
29
- return (
30
- <MultiSelectProperty
31
- {...restProps}
32
- options={usedOptions}
33
- search={enableSearch ? { initialSearch: '', searchMapping: value => [value.label] } : undefined}
34
- onChange={setUsedOptions}
35
- onRemove={() => setUsedOptions(usedOptions.map(value => ({ ...value, selected: false })))}
36
- hintText={hintText}
37
- />
38
- )
39
- }
@@ -1,28 +0,0 @@
1
- import { useEffect, useState } from 'react'
2
- import type { NumberPropertyProps } from '../../properties/NumberProperty'
3
- import { NumberProperty } from '../../properties/NumberProperty'
4
-
5
- export type NumberPropertyExampleProps = Omit<NumberPropertyProps, 'onChange' | 'onRemove'>
6
-
7
- /**
8
- * Example for using the NumberProperty
9
- */
10
- export const NumberPropertyExample = ({
11
- value,
12
- ...restProps
13
- }: NumberPropertyExampleProps) => {
14
- const [usedValue, setUsedValue] = useState<number | undefined>(value)
15
-
16
- useEffect(() => {
17
- setUsedValue(value)
18
- }, [value])
19
-
20
- return (
21
- <NumberProperty
22
- {...restProps}
23
- onChange={setUsedValue}
24
- onRemove={() => setUsedValue(undefined)}
25
- value={usedValue}
26
- />
27
- )
28
- }
@@ -1,39 +0,0 @@
1
- import { useEffect, useState } from 'react'
2
- import type { SingleSelectPropertyProps } from '../../properties/SelectProperty'
3
- import { SingleSelectProperty } from '../../properties/SelectProperty'
4
-
5
- export type SingleSelectPropertyExample = Omit<SingleSelectPropertyProps<string>, 'onChange' | 'onRemove'|'searchMapping'>
6
-
7
- /**
8
- * Example for using the SingleSelectProperty
9
- */
10
- export const SingleSelectPropertyExample = ({
11
- value,
12
- options,
13
- hintText,
14
- ...restProps
15
- }: SingleSelectPropertyExample) => {
16
- const [usedValue, setUsedValue] = useState<string | undefined>(value)
17
-
18
- useEffect(() => {
19
- setUsedValue(undefined)
20
- }, [hintText])
21
-
22
- useEffect(() => {
23
- if (options.find(value1 => value1.value === value)) {
24
- setUsedValue(value)
25
- }
26
- }, [value, options])
27
-
28
- return (
29
- <SingleSelectProperty
30
- {...restProps}
31
- value={usedValue}
32
- options={options}
33
- searchMapping={value1 => [value1.value]}
34
- onChange={setUsedValue}
35
- onRemove={() => setUsedValue(undefined)}
36
- hintText={hintText}
37
- />
38
- )
39
- }
@@ -1,30 +0,0 @@
1
- import { useEffect, useState } from 'react'
2
- import type { TextPropertyProps } from '../../properties/TextProperty'
3
- import { TextProperty } from '../../properties/TextProperty'
4
-
5
- export type TextPropertyExampleProps = Omit<TextPropertyProps, 'onChange' | 'onRemove'> & {
6
- readOnly: boolean,
7
- }
8
-
9
- /**
10
- * Example for using the TextProperty
11
- */
12
- export const TextPropertyExample = ({
13
- value,
14
- ...restProps
15
- }: TextPropertyExampleProps) => {
16
- const [usedValue, setUsedValue] = useState<string | undefined>(value)
17
-
18
- useEffect(() => {
19
- setUsedValue(value)
20
- }, [value])
21
-
22
- return (
23
- <TextProperty
24
- {...restProps}
25
- onChange={setUsedValue}
26
- onRemove={() => setUsedValue(undefined)}
27
- value={usedValue}
28
- />
29
- )
30
- }
@@ -1,51 +0,0 @@
1
- import type { SVGProps } from 'react'
2
- import { clsx } from 'clsx'
3
-
4
- export type HelpwaveProps = SVGProps<SVGSVGElement> & {
5
- color?: string,
6
- animate?: 'none' | 'loading' | 'pulse' | 'bounce',
7
- size?: number,
8
- }
9
-
10
- /**
11
- * The helpwave loading spinner based on the svg logo.
12
- */
13
- export const Helpwave = ({
14
- color = 'currentColor',
15
- animate = 'none',
16
- size = 64,
17
- ...props
18
- }: HelpwaveProps) => {
19
- const isLoadingAnimation = animate === 'loading'
20
- let svgAnimationKey = ''
21
-
22
- if (animate === 'pulse') {
23
- svgAnimationKey = 'animate-pulse'
24
- } else if (animate === 'bounce') {
25
- svgAnimationKey = 'animate-bounce'
26
- }
27
-
28
- if (size < 0) {
29
- console.error('size cannot be less than 0')
30
- size = 64
31
- }
32
-
33
- return (
34
- <svg
35
- width={size}
36
- height={size}
37
- viewBox="0 0 888 888"
38
- fill="none"
39
- strokeLinecap="round"
40
- strokeWidth={48}
41
- {...props}
42
- >
43
- <g className={clsx(svgAnimationKey)}>
44
- <path className={clsx({ 'animate-wave-big-left-up': isLoadingAnimation })} d="M144 543.235C144 423.259 232.164 326 340.92 326" stroke={color} strokeDasharray="1000" />
45
- <path className={clsx({ 'animate-wave-big-right-down': isLoadingAnimation })} d="M537.84 544.104C429.084 544.104 340.92 446.844 340.92 326.869" stroke={color} strokeDasharray="1000" />
46
- <path className={clsx({ 'animate-wave-small-left-up': isLoadingAnimation })} d="M462.223 518.035C462.223 432.133 525.348 362.495 603.217 362.495" stroke={color} strokeDasharray="1000" />
47
- <path className={clsx({ 'animate-wave-small-right-down': isLoadingAnimation })} d="M745.001 519.773C666.696 519.773 603.218 450.136 603.218 364.233" stroke={color} strokeDasharray="1000" />
48
- </g>
49
- </svg>
50
- )
51
- }
@@ -1,29 +0,0 @@
1
- import type { ImageProps } from 'next/image'
2
- import Image from 'next/image'
3
-
4
- export type TagProps = Omit<ImageProps, 'src'|'alt'>
5
-
6
- /**
7
- * Tag icon from flaticon
8
- *
9
- * https://www.flaticon.com/free-icon/price-tag_721550?term=label&page=1&position=8&origin=tag&related_id=721550
10
- *
11
- * When using it make attribution
12
- */
13
- export const TagIcon = ({
14
- className,
15
- width = 16,
16
- height = 16,
17
- ...props
18
- }: TagProps) => {
19
- return (
20
- <Image
21
- {...props}
22
- width={width}
23
- height={height}
24
- alt=""
25
- src="https://cdn.helpwave.de/icons/label.png"
26
- className={className}
27
- />
28
- )
29
- }
@@ -1,396 +0,0 @@
1
- import type { ReactNode } from 'react'
2
- import React from 'react'
3
- import clsx from 'clsx'
4
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
5
- import { ChevronLeft, ChevronRight } from 'lucide-react'
6
- import { createLoopingListWithIndex, range } from '../../util/array'
7
- import { clamp } from '../../util/math'
8
- import { EaseFunctions } from '../../util/easeFunctions'
9
- import type { Direction } from '../../util/loopingArray'
10
- import { LoopingArrayCalculator } from '../../util/loopingArray'
11
-
12
-
13
- type CarouselProps = {
14
- children: ReactNode[],
15
- animationTime?: number,
16
- isLooping?: boolean,
17
- isAutoLooping?: boolean,
18
- autoLoopingTimeOut?: number,
19
- autoLoopAnimationTime?: number,
20
- hintNext?: boolean,
21
- arrows?: boolean,
22
- dots?: boolean,
23
- /**
24
- * Percentage that is allowed to be scrolled further
25
- */
26
- overScrollThreshold?: number,
27
- blurColor?: string,
28
- className?: string,
29
- heightClassName?: string,
30
- widthClassName?: string,
31
- }
32
-
33
- type ItemType = {
34
- item: ReactNode,
35
- index: number,
36
- }
37
-
38
- type CarouselAnimationState = {
39
- targetPosition: number,
40
- /**
41
- * Value of either 1 or -1, 1 is forwards -1 is backwards
42
- */
43
- direction: Direction,
44
- startPosition: number,
45
- startTime?: number,
46
- lastUpdateTime?: number,
47
- isAutoLooping: boolean,
48
- }
49
-
50
- type DragState = {
51
- startX: number,
52
- startTime: number,
53
- lastX: number,
54
- startIndex: number,
55
- }
56
-
57
- type CarouselInformation = {
58
- currentPosition: number,
59
- dragState?: DragState,
60
- animationState?: CarouselAnimationState,
61
- }
62
-
63
- export const Carousel = ({
64
- children,
65
- animationTime = 200,
66
- isLooping = false,
67
- isAutoLooping = false,
68
- autoLoopingTimeOut = 5000,
69
- autoLoopAnimationTime = 500,
70
- hintNext = false,
71
- arrows = false,
72
- dots = true,
73
- overScrollThreshold = 0.1,
74
- blurColor = 'from-white',
75
- className = '',
76
- heightClassName = 'h-[24rem]',
77
- widthClassName = 'w-[70%] desktop:w-1/2',
78
- }: CarouselProps) => {
79
- if (isAutoLooping && !isLooping) {
80
- console.error('When isAutoLooping is true, isLooping should also be true')
81
- isLooping = true
82
- }
83
-
84
- const [{
85
- currentPosition,
86
- dragState,
87
- animationState,
88
- }, setCarouselInformation] = useState<CarouselInformation>({
89
- currentPosition: 0,
90
- })
91
- const animationId = useRef<number | undefined>(undefined)
92
- const timeOut = useRef<NodeJS.Timeout | undefined>(undefined)
93
- autoLoopingTimeOut = Math.max(0, autoLoopingTimeOut)
94
-
95
- const length = children.length
96
- const paddingItemCount = 3 // The number of items to append left and right of the list to allow for clean transition when looping
97
-
98
- const util = useMemo(() => new LoopingArrayCalculator(length, isLooping, overScrollThreshold), [length, isLooping, overScrollThreshold])
99
- const currentIndex = util.getCorrectedPosition(LoopingArrayCalculator.withoutOffset(currentPosition))
100
- animationTime = Math.max(200, animationTime) // in ms, must be > 0
101
- autoLoopAnimationTime = Math.max(200, autoLoopAnimationTime)
102
-
103
- const getStyleOffset = (index: number) => {
104
- const baseOffset = -50 + (index - currentPosition) * 100
105
- return `${baseOffset}%`
106
- }
107
-
108
- const animation = useCallback((time: number) => {
109
- let keepAnimating: boolean = true
110
-
111
- // Other calculation in the setState call to avoid updating the useCallback to often
112
- setCarouselInformation((state) => {
113
- const {
114
- animationState,
115
- dragState
116
- } = state
117
- if (animationState === undefined || dragState !== undefined) {
118
- keepAnimating = false
119
- return state
120
- }
121
- if (!animationState.startTime || !animationState.lastUpdateTime) {
122
- return {
123
- ...state,
124
- animationState: {
125
- ...animationState,
126
- startTime: time,
127
- lastUpdateTime: time
128
- }
129
- }
130
- }
131
- const useAnimationTime = animationState.isAutoLooping ? autoLoopAnimationTime : animationTime
132
- const progress = clamp((time - animationState.startTime) / useAnimationTime) // progress
133
- const easedProgress = EaseFunctions.easeInEaseOut(progress)
134
- const distance = util.getDistanceDirectional(animationState.startPosition, animationState.targetPosition, animationState.direction)
135
- const newPosition = util.getCorrectedPosition(easedProgress * distance * animationState.direction + animationState.startPosition)
136
-
137
- if (animationState.targetPosition === newPosition || progress === 1) {
138
- keepAnimating = false
139
- return ({
140
- currentPosition: LoopingArrayCalculator.withoutOffset(newPosition),
141
- animationState: undefined
142
- })
143
- }
144
- return ({
145
- currentPosition: newPosition,
146
- animationState: {
147
- ...animationState!,
148
- lastUpdateTime: time
149
- }
150
- })
151
- })
152
- if (keepAnimating) {
153
- animationId.current = requestAnimationFrame(time1 => animation(time1))
154
- }
155
- }, [animationTime, autoLoopAnimationTime, util])
156
-
157
- useEffect(() => {
158
- if (animationState) {
159
- animationId.current = requestAnimationFrame(animation)
160
- }
161
- return () => {
162
- if (animationId.current) {
163
- cancelAnimationFrame(animationId.current)
164
- animationId.current = 0
165
- }
166
- }
167
- }, [animationState]) // eslint-disable-line react-hooks/exhaustive-deps
168
-
169
- const startAutoLoop = () => setCarouselInformation(prevState => ({
170
- ...prevState,
171
- dragState: prevState.dragState,
172
- animationState: prevState.animationState || prevState.dragState ? prevState.animationState : {
173
- startPosition: currentPosition,
174
- targetPosition: (currentPosition + 1) % length,
175
- direction: 1, // always move forward
176
- isAutoLooping: true
177
- }
178
- }))
179
-
180
- useEffect(() => {
181
- if (!animationId.current && !animationState && !dragState && !timeOut.current) {
182
- if (autoLoopingTimeOut > 0) {
183
- timeOut.current = setTimeout(() => {
184
- startAutoLoop()
185
- timeOut.current = undefined
186
- }, autoLoopingTimeOut)
187
- } else {
188
- startAutoLoop()
189
- }
190
- }
191
- }, [animationState, dragState, animationId.current, timeOut.current]) // eslint-disable-line react-hooks/exhaustive-deps
192
-
193
- const startAnimation = (targetPosition?: number) => {
194
- if (targetPosition === undefined) {
195
- targetPosition = LoopingArrayCalculator.withoutOffset(currentPosition)
196
- }
197
- if (targetPosition === currentPosition) {
198
- return // we are exactly where we want to be
199
- }
200
-
201
- // find target index and fastest path to it
202
- const direction = util.getBestDirection(currentPosition, targetPosition)
203
- clearTimeout(timeOut.current)
204
- timeOut.current = undefined
205
- if (animationId.current) {
206
- cancelAnimationFrame(animationId.current)
207
- animationId.current = undefined
208
- }
209
-
210
- setCarouselInformation(prevState => ({
211
- ...prevState,
212
- dragState: undefined,
213
- animationState: {
214
- targetPosition: targetPosition!,
215
- direction,
216
- startPosition: currentPosition,
217
- isAutoLooping: false
218
- },
219
- timeOut: undefined
220
- }))
221
- }
222
-
223
- const canGoLeft = () => {
224
- return isLooping || currentPosition !== 0
225
- }
226
-
227
- const canGoRight = () => {
228
- return isLooping || currentPosition !== length - 1
229
- }
230
-
231
- const left = () => {
232
- if (canGoLeft()) {
233
- startAnimation(currentPosition === 0 ? length - 1 : LoopingArrayCalculator.withoutOffset(currentPosition - 1))
234
- }
235
- }
236
-
237
- const right = () => {
238
- if (canGoRight()) {
239
- startAnimation(LoopingArrayCalculator.withoutOffset((currentPosition + 1) % length))
240
- }
241
- }
242
-
243
- let items: ItemType[] = children.map((item, index) => ({
244
- index,
245
- item
246
- }))
247
-
248
- if (isLooping) {
249
- const before = createLoopingListWithIndex(children, length - 1, paddingItemCount, false).reverse().map(([index, item]) => ({
250
- index,
251
- item
252
- }))
253
- const after = createLoopingListWithIndex(children, 0, paddingItemCount).map(([index, item]) => ({
254
- index,
255
- item
256
- }))
257
- items = [
258
- ...before,
259
- ...items,
260
- ...after
261
- ]
262
- }
263
-
264
- const onDragStart = (x: number) => setCarouselInformation(prevState => ({
265
- ...prevState,
266
- dragState: {
267
- lastX: x,
268
- startX: x,
269
- startTime: Date.now(),
270
- startIndex: currentPosition,
271
- },
272
- animationState: undefined // cancel animation
273
- }))
274
-
275
- const onDrag = (x: number, width: number) => {
276
- // For some weird reason the clientX is 0 on the last dragUpdate before drag end causing issues
277
- if (!dragState || x === 0) {
278
- return
279
- }
280
- const offsetUpdate = (dragState.lastX - x) / width
281
- const newPosition = util.getCorrectedPosition(currentPosition + offsetUpdate)
282
-
283
- setCarouselInformation(prevState => ({
284
- ...prevState,
285
- currentPosition: newPosition,
286
- dragState: {
287
- ...dragState,
288
- lastX: x
289
- },
290
- }))
291
- }
292
-
293
- const onDragEnd = (x: number, width: number) => {
294
- if (!dragState) {
295
- return
296
- }
297
- const distance = dragState.startX - x
298
- const relativeDistance = distance / width
299
- const duration = (Date.now() - dragState.startTime) // in milliseconds
300
- const velocity = distance / (Date.now() - dragState.startTime)
301
-
302
- const isSlide = Math.abs(velocity) > 2 || (duration < 200 && (Math.abs(relativeDistance) > 0.2 || Math.abs(distance) > 50))
303
- if (isSlide) {
304
- if (distance > 0 && canGoRight()) {
305
- right()
306
- return
307
- } else if (distance < 0 && canGoLeft()) {
308
- left()
309
- return
310
- }
311
- }
312
- startAnimation()
313
- }
314
-
315
- const dragHandlers = {
316
- draggable: true,
317
- onDragStart: (event: React.DragEvent<HTMLDivElement>) => {
318
- onDragStart(event.clientX)
319
- event.dataTransfer.setDragImage(document.createElement('div'), 0, 0)
320
- },
321
- onDrag: (event: React.DragEvent<HTMLDivElement>) => onDrag(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),
322
- onDragEnd: (event: React.DragEvent<HTMLDivElement>) => onDragEnd(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),
323
- onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => onDragStart(event.touches[0]!.clientX),
324
- onTouchMove: (event: React.TouchEvent<HTMLDivElement>) => onDrag(event.touches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),
325
- onTouchEnd: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),
326
- onTouchCancel: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),
327
- }
328
-
329
- return (
330
- <div className="col items-center w-full gap-y-2">
331
- <div className={clsx(`relative w-full overflow-hidden`, heightClassName, className)}>
332
- {arrows && (
333
- <>
334
- <div
335
- className={clsx('absolute z-10 left-0 top-1/2 -translate-y-1/2 bg-gray-200 hover:bg-gray-300 rounded-lg cursor-pointer border-black border-2', { hidden: !canGoLeft() })}
336
- onClick={() => left()}
337
- >
338
- <ChevronLeft size={32}/>
339
- </div>
340
- <div
341
- className={clsx('absolute z-10 right-0 top-1/2 -translate-y-1/2 bg-gray-200 hover:bg-gray-300 rounded-lg cursor-pointer border-black border-2', { hidden: !canGoRight() })}
342
- onClick={() => right()}
343
- >
344
- <ChevronRight size={32}/>
345
- </div>
346
- </>
347
- )}
348
- {hintNext ? (
349
- <div className={clsx(`relative row h-full`, heightClassName)}>
350
- <div className="relative row h-full w-full px-2 overflow-hidden">
351
- {items.map(({
352
- item,
353
- index
354
- }, listIndex) => (
355
- <div
356
- key={listIndex}
357
- className={clsx(`absolute left-[50%] h-full overflow-hidden`, widthClassName, { '!cursor-grabbing': !!dragState })}
358
- style={{ translate: getStyleOffset(listIndex - (isLooping ? paddingItemCount : 0)) }}
359
- {...dragHandlers}
360
- onClick={() => startAnimation(index)}
361
- >
362
- {item}
363
- </div>
364
- ))}
365
- </div>
366
- <div
367
- className={clsx(`hidden pointer-events-none desktop:block absolute left-0 h-full w-[20%] bg-gradient-to-r to-transparent`, blurColor)}
368
- />
369
- <div
370
- className={clsx(`hidden pointer-events-none desktop:block absolute right-0 h-full w-[20%] bg-gradient-to-l to-transparent`, blurColor)}
371
- />
372
- </div>
373
- ) : (
374
- <div className={clsx('px-16 h-full', { '!cursor-grabbing': !!dragState })} {...dragHandlers}>
375
- {children[currentIndex]}
376
- </div>
377
- )}
378
- </div>
379
- {dots && (
380
- <div
381
- className="row items-center justify-center w-full my-2">
382
- {range(0, length - 1).map(index => (
383
- <button
384
- key={index}
385
- className={clsx('w-[2rem] min-w-[2rem] h-[0.75rem] min-h-[0.75rem] hover:bg-primary hover:brightness-90 first:rounded-l-md last:rounded-r-md', {
386
- 'bg-gray-200': currentIndex !== index,
387
- 'bg-primary': currentIndex === index
388
- })}
389
- onClick={() => startAnimation(index)}
390
- />
391
- ))}
392
- </div>
393
- )}
394
- </div>
395
- )
396
- }
@@ -1,37 +0,0 @@
1
- import type { HTMLAttributes, ReactNode } from 'react'
2
- import clsx from 'clsx'
3
-
4
- export type DividerInserterProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
5
- children: ReactNode[],
6
- divider: (index: number) => ReactNode,
7
- }
8
-
9
- /**
10
- * A Component for inserting a divider in the middle of each child element
11
- *
12
- * undefined elements are removed
13
- */
14
- export const DividerInserter = ({
15
- children,
16
- divider,
17
- className,
18
- ...restProps
19
- }: DividerInserterProps) => {
20
- const nodes: ReactNode[] = []
21
-
22
- for (let index = 0; index < children.length; index++) {
23
- const element = children[index]
24
- if (element !== undefined) {
25
- nodes.push(element)
26
- if (index < children.length - 1) {
27
- nodes.push(divider(index))
28
- }
29
- }
30
- }
31
-
32
- return (
33
- <div className={clsx(className)} {...restProps}>
34
- {nodes}
35
- </div>
36
- )
37
- }